@ai-matrx/office 0.8.22 → 0.8.24

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 { OpSessionNotice, OpSession, OpTransport, OpPresence, OpSessionIncident, OpSessionStatus, AwarenessState, CollabRpcClient, collabReplace, OpDocumentAdapter } from '@ai-matrx/data/realtime/collab';
3
+ import { OpSessionNotice, OpSession, OpTransport, OpPresence, OpSessionIncident, OpSessionStatus, OpOfflineOptions, OpOfflineState, AwarenessState, CollabRpcClient, collabReplace, OpDocumentAdapter, CollabGroup } from '@ai-matrx/data/realtime/collab';
4
4
  import { IDocumentData } from '@univerjs/core';
5
5
  import { CommitReason } from '@ai-matrx/kit/working-copy';
6
6
 
@@ -362,6 +362,10 @@ interface OpenDocsOtRoomOptions {
362
362
  onNotice?: (n: DocsOtNotice) => void;
363
363
  onIncident?: (i: OpSessionIncident) => void;
364
364
  onStatus?: (s: OpSessionStatus) => void;
365
+ /** C10: unsent edits persist on this device under a lease (the host builds it: `browserOfflineOptions`). */
366
+ offline?: OpOfflineOptions | null;
367
+ /** C10: the chrome's offline state. */
368
+ onOffline?: (s: OpOfflineState) => void;
365
369
  /** Watch IME composition here (default: `document`). */
366
370
  compositionTarget?: Pick<Document, "addEventListener" | "removeEventListener"> | null;
367
371
  }
@@ -481,6 +485,8 @@ interface DocumentOtFactoryOptions {
481
485
  onNotice?: (n: DocsOtNotice) => void;
482
486
  onIncident?: (i: OpSessionIncident) => void;
483
487
  onStatus?: (s: OpSessionStatus) => void;
488
+ /** C10: the chrome's offline state (unsent edits are kept on this device, one tab per document and person owns them). */
489
+ onOffline?: (s: OpOfflineState) => void;
484
490
  }
485
491
  /** The `DocumentModel.startOtRoom` factory for one document. */
486
492
  declare function documentOtFactory(o: DocumentOtFactoryOptions): DocumentOtFactory;
@@ -683,6 +689,10 @@ interface OpenSheetsOtRoomOptions {
683
689
  onNotice?: (n: SheetsOtNotice) => void;
684
690
  onIncident?: (i: OpSessionIncident) => void;
685
691
  onStatus?: (s: OpSessionStatus) => void;
692
+ /** C10: unsent edits persist on this device under a lease (the host builds it: `browserOfflineOptions`). */
693
+ offline?: OpOfflineOptions | null;
694
+ /** C10: the chrome's offline state. */
695
+ onOffline?: (s: OpOfflineState) => void;
686
696
  }
687
697
  interface SheetsOtRoom {
688
698
  session: OpSession<SheetOp>;
@@ -821,6 +831,15 @@ declare const canonicalSheetString: (snapshot: unknown) => string;
821
831
  /** SHA-256 (hex) of the canonical form. Web Crypto, so the browser and Node compute the same hash. */
822
832
  declare function sheetsStateHash(snapshot: unknown): Promise<string>;
823
833
 
834
+ /**
835
+ * "Copy my offline text" (C10): the words a person typed while offline, pulled out of the wire groups of a buffer
836
+ * the room refused (changed protocol, document trashed). Format-light on purpose: Docs inserts carry their text in
837
+ * `body.dataStream`; Sheets writes carry cell values in `cellValue`. Anything else contributes nothing, and the
838
+ * caller says so when nothing could be read (the record stays on the device regardless).
839
+ */
840
+
841
+ declare function offlineTextOfGroups(buffers: CollabGroup[][]): string;
842
+
824
843
  /** `collab.ot_rooms` (§12.2): which workbooks without a room open one. */
825
844
  type WorkbookOtRoomsKnob = "off" | "new" | "all";
826
845
  /** Whether this workbook opens on the ordered log: its room exists, or the knob opens one. */
@@ -836,6 +855,8 @@ interface WorkbookOtRoomOptions {
836
855
  onNotice?: (n: SheetsOtNotice) => void;
837
856
  onIncident?: (i: OpSessionIncident) => void;
838
857
  onStatus?: (s: OpSessionStatus) => void;
858
+ /** C10: the chrome's offline state (unsent edits are kept on this device, one tab per workbook and person owns them). */
859
+ onOffline?: (s: OpOfflineState) => void;
839
860
  }
840
861
  interface WorkbookOtRoomHandle {
841
862
  session: OpSession<SheetOp>;
@@ -857,4 +878,4 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
857
878
  dispose?: () => void;
858
879
  }, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
859
880
 
860
- export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
881
+ export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
@@ -1,6 +1,6 @@
1
1
  import * as Y from 'yjs';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
- import { OpSessionNotice, OpSession, OpTransport, OpPresence, OpSessionIncident, OpSessionStatus, AwarenessState, CollabRpcClient, collabReplace, OpDocumentAdapter } from '@ai-matrx/data/realtime/collab';
3
+ import { OpSessionNotice, OpSession, OpTransport, OpPresence, OpSessionIncident, OpSessionStatus, OpOfflineOptions, OpOfflineState, AwarenessState, CollabRpcClient, collabReplace, OpDocumentAdapter, CollabGroup } from '@ai-matrx/data/realtime/collab';
4
4
  import { IDocumentData } from '@univerjs/core';
5
5
  import { CommitReason } from '@ai-matrx/kit/working-copy';
6
6
 
@@ -362,6 +362,10 @@ interface OpenDocsOtRoomOptions {
362
362
  onNotice?: (n: DocsOtNotice) => void;
363
363
  onIncident?: (i: OpSessionIncident) => void;
364
364
  onStatus?: (s: OpSessionStatus) => void;
365
+ /** C10: unsent edits persist on this device under a lease (the host builds it: `browserOfflineOptions`). */
366
+ offline?: OpOfflineOptions | null;
367
+ /** C10: the chrome's offline state. */
368
+ onOffline?: (s: OpOfflineState) => void;
365
369
  /** Watch IME composition here (default: `document`). */
366
370
  compositionTarget?: Pick<Document, "addEventListener" | "removeEventListener"> | null;
367
371
  }
@@ -481,6 +485,8 @@ interface DocumentOtFactoryOptions {
481
485
  onNotice?: (n: DocsOtNotice) => void;
482
486
  onIncident?: (i: OpSessionIncident) => void;
483
487
  onStatus?: (s: OpSessionStatus) => void;
488
+ /** C10: the chrome's offline state (unsent edits are kept on this device, one tab per document and person owns them). */
489
+ onOffline?: (s: OpOfflineState) => void;
484
490
  }
485
491
  /** The `DocumentModel.startOtRoom` factory for one document. */
486
492
  declare function documentOtFactory(o: DocumentOtFactoryOptions): DocumentOtFactory;
@@ -683,6 +689,10 @@ interface OpenSheetsOtRoomOptions {
683
689
  onNotice?: (n: SheetsOtNotice) => void;
684
690
  onIncident?: (i: OpSessionIncident) => void;
685
691
  onStatus?: (s: OpSessionStatus) => void;
692
+ /** C10: unsent edits persist on this device under a lease (the host builds it: `browserOfflineOptions`). */
693
+ offline?: OpOfflineOptions | null;
694
+ /** C10: the chrome's offline state. */
695
+ onOffline?: (s: OpOfflineState) => void;
686
696
  }
687
697
  interface SheetsOtRoom {
688
698
  session: OpSession<SheetOp>;
@@ -821,6 +831,15 @@ declare const canonicalSheetString: (snapshot: unknown) => string;
821
831
  /** SHA-256 (hex) of the canonical form. Web Crypto, so the browser and Node compute the same hash. */
822
832
  declare function sheetsStateHash(snapshot: unknown): Promise<string>;
823
833
 
834
+ /**
835
+ * "Copy my offline text" (C10): the words a person typed while offline, pulled out of the wire groups of a buffer
836
+ * the room refused (changed protocol, document trashed). Format-light on purpose: Docs inserts carry their text in
837
+ * `body.dataStream`; Sheets writes carry cell values in `cellValue`. Anything else contributes nothing, and the
838
+ * caller says so when nothing could be read (the record stays on the device regardless).
839
+ */
840
+
841
+ declare function offlineTextOfGroups(buffers: CollabGroup[][]): string;
842
+
824
843
  /** `collab.ot_rooms` (§12.2): which workbooks without a room open one. */
825
844
  type WorkbookOtRoomsKnob = "off" | "new" | "all";
826
845
  /** Whether this workbook opens on the ordered log: its room exists, or the knob opens one. */
@@ -836,6 +855,8 @@ interface WorkbookOtRoomOptions {
836
855
  onNotice?: (n: SheetsOtNotice) => void;
837
856
  onIncident?: (i: OpSessionIncident) => void;
838
857
  onStatus?: (s: OpSessionStatus) => void;
858
+ /** C10: the chrome's offline state (unsent edits are kept on this device, one tab per workbook and person owns them). */
859
+ onOffline?: (s: OpOfflineState) => void;
839
860
  }
840
861
  interface WorkbookOtRoomHandle {
841
862
  session: OpSession<SheetOp>;
@@ -857,4 +878,4 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
857
878
  dispose?: () => void;
858
879
  }, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
859
880
 
860
- export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
881
+ export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };