@ai-matrx/office 0.8.44 → 0.8.46
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.
- package/CHANGELOG.md +23 -2
- package/dist/collab-sheets-transform.cjs +12 -0
- package/dist/collab-sheets-transform.cjs.map +1 -1
- package/dist/collab-sheets-transform.js +12 -0
- package/dist/collab-sheets-transform.js.map +1 -1
- package/dist/docs.cjs +85 -24
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.cts +15 -1
- package/dist/docs.d.ts +15 -1
- package/dist/docs.js +65 -4
- package/dist/docs.js.map +1 -1
- package/dist/pdf-model.cjs +232 -0
- package/dist/pdf-model.cjs.map +1 -0
- package/dist/pdf-model.d.cts +248 -0
- package/dist/pdf-model.d.ts +248 -0
- package/dist/pdf-model.js +209 -0
- package/dist/pdf-model.js.map +1 -0
- package/dist/pdf.cjs +1127 -0
- package/dist/pdf.cjs.map +1 -0
- package/dist/pdf.d.cts +255 -0
- package/dist/pdf.d.ts +255 -0
- package/dist/pdf.js +1133 -0
- package/dist/pdf.js.map +1 -0
- package/dist/univer-collab.cjs +250 -22
- package/dist/univer-collab.cjs.map +1 -1
- package/dist/univer-collab.d.cts +91 -10
- package/dist/univer-collab.d.ts +91 -10
- package/dist/univer-collab.js +250 -22
- package/dist/univer-collab.js.map +1 -1
- package/package.json +27 -6
package/dist/univer-collab.d.cts
CHANGED
|
@@ -411,14 +411,18 @@ declare function undoStacksOf(service: unknown): {
|
|
|
411
411
|
/**
|
|
412
412
|
* §6.9: rebase one stack over a remote op; items that cannot follow are dropped. Returns how many were dropped.
|
|
413
413
|
*
|
|
414
|
-
* `stack` says which side of each item applies
|
|
415
|
-
* `
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
414
|
+
* `stack` says which side of each item applies next: an undo-stack item's `undoMutations`, a redo-stack item's
|
|
415
|
+
* `redoMutations`. A stack applies top first, so each item's active side applies to the document as the items
|
|
416
|
+
* above it leave it: the top item meets the remote op as it is, and every item below meets it carried past the
|
|
417
|
+
* active sides of the items above (rebasing each item against the same op put a deeper item at offsets the items
|
|
418
|
+
* above had moved). The inactive side meets the op carried past its own active side; it is a fallback only: the
|
|
419
|
+
* room rewrites it from the real document whenever the item runs (`openDocsOtRoom`, walk 2 F1), because a tie at
|
|
420
|
+
* the edge of what the active side removes cannot say on which side of a collaborator's letters it belongs.
|
|
420
421
|
*/
|
|
421
422
|
declare function rebaseUndoStack(items: UndoItem$1[], remote: DocsOp, stack: "undo" | "redo"): number;
|
|
423
|
+
/** Univer 1.0.4's undo and redo command ids (the outermost command of every mutation a history step runs). */
|
|
424
|
+
declare const UNDO_COMMAND = "univer.command.undo";
|
|
425
|
+
declare const REDO_COMMAND = "univer.command.redo";
|
|
422
426
|
declare function openDocsOtRoom(o: OpenDocsOtRoomOptions): DocsOtRoom;
|
|
423
427
|
|
|
424
428
|
interface CaretRange {
|
|
@@ -613,10 +617,16 @@ type SheetsLocalEvent = SheetsLocalGroup | SheetsNotShared;
|
|
|
613
617
|
/** What the workbook editor lends the room (implemented by `univerSheetsOtPort`). */
|
|
614
618
|
interface SheetsOtPort {
|
|
615
619
|
onLocal(listener: (e: SheetsLocalEvent) => void): () => void;
|
|
616
|
-
/** True while a local command is still running (its group is not handed over yet). */
|
|
620
|
+
/** True while a local command is still running (its group is not handed over yet). Every remote op waits. */
|
|
617
621
|
busy(): boolean;
|
|
618
622
|
/** Run `fn` once no local command is running (immediately when none is). */
|
|
619
623
|
whenIdle(fn: () => void): void;
|
|
624
|
+
/**
|
|
625
|
+
* True when this remote op must wait until `whenIdle`: the port's cell editor is open on a cell the op writes, or
|
|
626
|
+
* the op moves or removes that cell. A later op waits behind a held one only when the two do not commute; every
|
|
627
|
+
* other op applies live. The held ops apply when the editor closes, and the person's commit is rebased over them.
|
|
628
|
+
*/
|
|
629
|
+
defers?(op: SheetMutation[]): boolean;
|
|
620
630
|
/** Apply one committed mutation to this seat's workbook; throws when the editor refused it. */
|
|
621
631
|
applyRemote(m: SheetMutation): void;
|
|
622
632
|
/** The workbook as the editor holds it now (with resources), or null when none is mounted. */
|
|
@@ -637,11 +647,18 @@ interface SheetsOtPort {
|
|
|
637
647
|
/** Ask for a save (the record's one coalesced save). */
|
|
638
648
|
markDirty(): void;
|
|
639
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* `resynced`: this seat's workbook disagreed with the room's (a peer's quiet hash, a save's hash or an ack) and the
|
|
652
|
+
* reload that healed it changed what the person sees. One notice per heal; a heal that changed nothing says nothing.
|
|
653
|
+
*/
|
|
640
654
|
type SheetsOtNotice = OpSessionNotice<SheetOp> | {
|
|
641
655
|
kind: "not_shared";
|
|
642
656
|
mutationId: string;
|
|
643
657
|
} | {
|
|
644
658
|
kind: "not_live";
|
|
659
|
+
} | {
|
|
660
|
+
kind: "resynced";
|
|
661
|
+
reason: string;
|
|
645
662
|
};
|
|
646
663
|
/**
|
|
647
664
|
* The adapter's transform: the C5a/C5b group transform, with `lost` widened by what y can no longer apply
|
|
@@ -688,6 +705,8 @@ interface SheetsOtAdapterHooks {
|
|
|
688
705
|
onUndoRebased?: (dropped: number) => void;
|
|
689
706
|
/** Called with the milliseconds of undo bookkeeping each remote op (and each catch-up) cost (tests, logs). */
|
|
690
707
|
onUndoWork?: (ms: number, kind: "remote" | "catch_up") => void;
|
|
708
|
+
/** The session's rev right now (the rev of the op being applied): a held op remembers it for `overrode`. */
|
|
709
|
+
rev?: () => number;
|
|
691
710
|
/**
|
|
692
711
|
* The state hash of a snapshot (default `sheetsStateHash`, Web Crypto). A seeded test passes a synchronous one:
|
|
693
712
|
* Web Crypto resolves on a worker thread, outside a virtual clock, so the same seed would not replay.
|
|
@@ -698,8 +717,17 @@ interface SheetsOtAdapterHooks {
|
|
|
698
717
|
interface SheetsOtAdapter extends OpDocumentAdapter<SheetOp> {
|
|
699
718
|
/** Remote ops held while a local command runs. */
|
|
700
719
|
held(): number;
|
|
701
|
-
/**
|
|
702
|
-
|
|
720
|
+
/**
|
|
721
|
+
* A local group finished while remote ops were held: rebase it over them and them over it (Docs IME rule).
|
|
722
|
+
* `overrode` names what it overrode of each held op (by the rev it was committed at), for that op's author.
|
|
723
|
+
*/
|
|
724
|
+
rebaseLocalOverHeld(local: SheetMutation[]): {
|
|
725
|
+
op: SheetMutation[];
|
|
726
|
+
overrode: Array<{
|
|
727
|
+
rev: number;
|
|
728
|
+
lost: string[];
|
|
729
|
+
}>;
|
|
730
|
+
} | "barrier";
|
|
703
731
|
clearHeld(): void;
|
|
704
732
|
}
|
|
705
733
|
declare function createSheetsOtAdapter(port: SheetsOtPort, hooks?: SheetsOtAdapterHooks): SheetsOtAdapter;
|
|
@@ -782,6 +810,10 @@ interface SheetsWorksheetLike {
|
|
|
782
810
|
getMaxColumns?(): number;
|
|
783
811
|
getCellRaw(row: number, col: number): Obj | null | undefined;
|
|
784
812
|
getMergeData(): SheetRange[];
|
|
813
|
+
/** Univer's `Worksheet.getCellMatrix()` (every stored cell). */
|
|
814
|
+
getCellMatrix?(): {
|
|
815
|
+
forValue(fn: (row: number, col: number, cell: Obj | null | undefined) => unknown): void;
|
|
816
|
+
};
|
|
785
817
|
}
|
|
786
818
|
interface SheetsWorkbookLike {
|
|
787
819
|
getUnitId(): string;
|
|
@@ -821,10 +853,52 @@ interface UniverSheetsOtPortOptions {
|
|
|
821
853
|
* time on this seat. Without it a seat with a filter diverges from its peers on that write.
|
|
822
854
|
*/
|
|
823
855
|
filterRange?(unitId: string, subUnitId: string): SheetRange | null | undefined;
|
|
856
|
+
/**
|
|
857
|
+
* The cell this seat's cell editor is open on, or null when it is closed (`IEditorBridgeService`:
|
|
858
|
+
* `isVisible().visible` and `getEditLocation()`). Univer rewrites an open editor's text whenever any write lands on
|
|
859
|
+
* its cell (`EditorDataSyncController` → `refreshEditCellState` → the editor's `ReplaceSnapshotCommand`, caret back
|
|
860
|
+
* to 0), so a peer's value landing mid-typing spliced into the draft and Enter committed the mix (the attack's
|
|
861
|
+
* "$1,234.50" vs "$7" → 507). While the editor is open, a remote op whose ranges cover its cell, or that moves or
|
|
862
|
+
* removes it (a row/column insert, remove or move, a sheet removal, a shrink), is held: the person's draft and the
|
|
863
|
+
* cell it is committed against stay as they saw them, and their commit is rebased over the held ops when the editor
|
|
864
|
+
* closes (the later commit wins whole). Everything else applies live, so the person still sees the others work.
|
|
865
|
+
*/
|
|
866
|
+
cellEditor?(): EditedCell | null;
|
|
824
867
|
/** Replace the workbook's whole content, keeping its unit id. */
|
|
825
868
|
load(snapshot: unknown): void;
|
|
826
869
|
markDirty(): void;
|
|
827
870
|
}
|
|
871
|
+
/** The cell an open cell editor is on. */
|
|
872
|
+
interface EditedCell {
|
|
873
|
+
sheetId: string;
|
|
874
|
+
row: number;
|
|
875
|
+
col: number;
|
|
876
|
+
}
|
|
877
|
+
/** What the port reads of Univer's `SheetsFilterService` (sheets-filter). */
|
|
878
|
+
interface FilterServiceLike {
|
|
879
|
+
getFilterModel(unitId: string, subUnitId: string): {
|
|
880
|
+
getRange(): SheetRange | null | undefined;
|
|
881
|
+
} | null | undefined;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* The port's `filterRange` over Univer's filter service: the range as the filter stores it, `rangeType` included.
|
|
885
|
+
* Every host lends this one (the editor, the fold, the fuzz seats): a host that dropped `rangeType` restored a peer's
|
|
886
|
+
* growth without it, and that seat's filter saved differently from the others (hash_mismatch, live attack rev 90).
|
|
887
|
+
*/
|
|
888
|
+
declare function filterServiceRange(service: () => FilterServiceLike | null | undefined): (unitId: string, subUnitId: string) => SheetRange | null;
|
|
889
|
+
/** What the port reads of Univer's `IEditorBridgeService` (sheets-ui). */
|
|
890
|
+
interface EditorBridgeLike {
|
|
891
|
+
isVisible(): {
|
|
892
|
+
visible: boolean;
|
|
893
|
+
};
|
|
894
|
+
getEditLocation(): {
|
|
895
|
+
sheetId: string;
|
|
896
|
+
row: number;
|
|
897
|
+
column: number;
|
|
898
|
+
} | null | undefined;
|
|
899
|
+
}
|
|
900
|
+
/** The port's `cellEditor` over Univer's editor bridge: the cell the cell editor is open on, or null. */
|
|
901
|
+
declare function editorBridgeCell(bridge: EditorBridgeLike): () => EditedCell | null;
|
|
828
902
|
/** One selection as `SheetsSelectionsService` holds it (range, primary cell, style). */
|
|
829
903
|
interface SheetSelection {
|
|
830
904
|
range: SheetRange & {
|
|
@@ -844,6 +918,13 @@ declare function univerSheetsOtPort(o: UniverSheetsOtPortOptions): SheetsOtPort
|
|
|
844
918
|
dispose(): void;
|
|
845
919
|
running(): string[];
|
|
846
920
|
};
|
|
921
|
+
/**
|
|
922
|
+
* Whether a remote mutation must wait for the open cell editor: it writes the editor's cell (a value, a style, a
|
|
923
|
+
* merge, a format, a rule or a sort whose ranges cover it), or it moves or removes that cell (a row/column insert,
|
|
924
|
+
* remove or move before it, its sheet's removal, a row or column count below it). A mutation with no range on that
|
|
925
|
+
* sheet (a rename, a sheet order, a filter's criteria) never touches the cell. Anything this cannot read waits.
|
|
926
|
+
*/
|
|
927
|
+
declare function touchesEditedCell(m: SheetMutation, at: EditedCell): boolean;
|
|
847
928
|
/**
|
|
848
929
|
* This seat's selections after a remote structural op: indices move with their rows/columns; one the op removed
|
|
849
930
|
* lands on the first surviving index; everything is clamped to the sheet; whole-row/column ranges span the sheet.
|
|
@@ -933,4 +1014,4 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
|
|
|
933
1014
|
dispose?: () => void;
|
|
934
1015
|
}, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
|
|
935
1016
|
|
|
936
|
-
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, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, 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 };
|
|
1017
|
+
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 EditedCell, type EditorBridgeLike, type FilterServiceLike, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, REDO_COMMAND, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, 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, UNDO_COMMAND, 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, editorBridgeCell, encodeSheetOp, filterServiceRange, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, touchesEditedCell, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
|
package/dist/univer-collab.d.ts
CHANGED
|
@@ -411,14 +411,18 @@ declare function undoStacksOf(service: unknown): {
|
|
|
411
411
|
/**
|
|
412
412
|
* §6.9: rebase one stack over a remote op; items that cannot follow are dropped. Returns how many were dropped.
|
|
413
413
|
*
|
|
414
|
-
* `stack` says which side of each item applies
|
|
415
|
-
* `
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
414
|
+
* `stack` says which side of each item applies next: an undo-stack item's `undoMutations`, a redo-stack item's
|
|
415
|
+
* `redoMutations`. A stack applies top first, so each item's active side applies to the document as the items
|
|
416
|
+
* above it leave it: the top item meets the remote op as it is, and every item below meets it carried past the
|
|
417
|
+
* active sides of the items above (rebasing each item against the same op put a deeper item at offsets the items
|
|
418
|
+
* above had moved). The inactive side meets the op carried past its own active side; it is a fallback only: the
|
|
419
|
+
* room rewrites it from the real document whenever the item runs (`openDocsOtRoom`, walk 2 F1), because a tie at
|
|
420
|
+
* the edge of what the active side removes cannot say on which side of a collaborator's letters it belongs.
|
|
420
421
|
*/
|
|
421
422
|
declare function rebaseUndoStack(items: UndoItem$1[], remote: DocsOp, stack: "undo" | "redo"): number;
|
|
423
|
+
/** Univer 1.0.4's undo and redo command ids (the outermost command of every mutation a history step runs). */
|
|
424
|
+
declare const UNDO_COMMAND = "univer.command.undo";
|
|
425
|
+
declare const REDO_COMMAND = "univer.command.redo";
|
|
422
426
|
declare function openDocsOtRoom(o: OpenDocsOtRoomOptions): DocsOtRoom;
|
|
423
427
|
|
|
424
428
|
interface CaretRange {
|
|
@@ -613,10 +617,16 @@ type SheetsLocalEvent = SheetsLocalGroup | SheetsNotShared;
|
|
|
613
617
|
/** What the workbook editor lends the room (implemented by `univerSheetsOtPort`). */
|
|
614
618
|
interface SheetsOtPort {
|
|
615
619
|
onLocal(listener: (e: SheetsLocalEvent) => void): () => void;
|
|
616
|
-
/** True while a local command is still running (its group is not handed over yet). */
|
|
620
|
+
/** True while a local command is still running (its group is not handed over yet). Every remote op waits. */
|
|
617
621
|
busy(): boolean;
|
|
618
622
|
/** Run `fn` once no local command is running (immediately when none is). */
|
|
619
623
|
whenIdle(fn: () => void): void;
|
|
624
|
+
/**
|
|
625
|
+
* True when this remote op must wait until `whenIdle`: the port's cell editor is open on a cell the op writes, or
|
|
626
|
+
* the op moves or removes that cell. A later op waits behind a held one only when the two do not commute; every
|
|
627
|
+
* other op applies live. The held ops apply when the editor closes, and the person's commit is rebased over them.
|
|
628
|
+
*/
|
|
629
|
+
defers?(op: SheetMutation[]): boolean;
|
|
620
630
|
/** Apply one committed mutation to this seat's workbook; throws when the editor refused it. */
|
|
621
631
|
applyRemote(m: SheetMutation): void;
|
|
622
632
|
/** The workbook as the editor holds it now (with resources), or null when none is mounted. */
|
|
@@ -637,11 +647,18 @@ interface SheetsOtPort {
|
|
|
637
647
|
/** Ask for a save (the record's one coalesced save). */
|
|
638
648
|
markDirty(): void;
|
|
639
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* `resynced`: this seat's workbook disagreed with the room's (a peer's quiet hash, a save's hash or an ack) and the
|
|
652
|
+
* reload that healed it changed what the person sees. One notice per heal; a heal that changed nothing says nothing.
|
|
653
|
+
*/
|
|
640
654
|
type SheetsOtNotice = OpSessionNotice<SheetOp> | {
|
|
641
655
|
kind: "not_shared";
|
|
642
656
|
mutationId: string;
|
|
643
657
|
} | {
|
|
644
658
|
kind: "not_live";
|
|
659
|
+
} | {
|
|
660
|
+
kind: "resynced";
|
|
661
|
+
reason: string;
|
|
645
662
|
};
|
|
646
663
|
/**
|
|
647
664
|
* The adapter's transform: the C5a/C5b group transform, with `lost` widened by what y can no longer apply
|
|
@@ -688,6 +705,8 @@ interface SheetsOtAdapterHooks {
|
|
|
688
705
|
onUndoRebased?: (dropped: number) => void;
|
|
689
706
|
/** Called with the milliseconds of undo bookkeeping each remote op (and each catch-up) cost (tests, logs). */
|
|
690
707
|
onUndoWork?: (ms: number, kind: "remote" | "catch_up") => void;
|
|
708
|
+
/** The session's rev right now (the rev of the op being applied): a held op remembers it for `overrode`. */
|
|
709
|
+
rev?: () => number;
|
|
691
710
|
/**
|
|
692
711
|
* The state hash of a snapshot (default `sheetsStateHash`, Web Crypto). A seeded test passes a synchronous one:
|
|
693
712
|
* Web Crypto resolves on a worker thread, outside a virtual clock, so the same seed would not replay.
|
|
@@ -698,8 +717,17 @@ interface SheetsOtAdapterHooks {
|
|
|
698
717
|
interface SheetsOtAdapter extends OpDocumentAdapter<SheetOp> {
|
|
699
718
|
/** Remote ops held while a local command runs. */
|
|
700
719
|
held(): number;
|
|
701
|
-
/**
|
|
702
|
-
|
|
720
|
+
/**
|
|
721
|
+
* A local group finished while remote ops were held: rebase it over them and them over it (Docs IME rule).
|
|
722
|
+
* `overrode` names what it overrode of each held op (by the rev it was committed at), for that op's author.
|
|
723
|
+
*/
|
|
724
|
+
rebaseLocalOverHeld(local: SheetMutation[]): {
|
|
725
|
+
op: SheetMutation[];
|
|
726
|
+
overrode: Array<{
|
|
727
|
+
rev: number;
|
|
728
|
+
lost: string[];
|
|
729
|
+
}>;
|
|
730
|
+
} | "barrier";
|
|
703
731
|
clearHeld(): void;
|
|
704
732
|
}
|
|
705
733
|
declare function createSheetsOtAdapter(port: SheetsOtPort, hooks?: SheetsOtAdapterHooks): SheetsOtAdapter;
|
|
@@ -782,6 +810,10 @@ interface SheetsWorksheetLike {
|
|
|
782
810
|
getMaxColumns?(): number;
|
|
783
811
|
getCellRaw(row: number, col: number): Obj | null | undefined;
|
|
784
812
|
getMergeData(): SheetRange[];
|
|
813
|
+
/** Univer's `Worksheet.getCellMatrix()` (every stored cell). */
|
|
814
|
+
getCellMatrix?(): {
|
|
815
|
+
forValue(fn: (row: number, col: number, cell: Obj | null | undefined) => unknown): void;
|
|
816
|
+
};
|
|
785
817
|
}
|
|
786
818
|
interface SheetsWorkbookLike {
|
|
787
819
|
getUnitId(): string;
|
|
@@ -821,10 +853,52 @@ interface UniverSheetsOtPortOptions {
|
|
|
821
853
|
* time on this seat. Without it a seat with a filter diverges from its peers on that write.
|
|
822
854
|
*/
|
|
823
855
|
filterRange?(unitId: string, subUnitId: string): SheetRange | null | undefined;
|
|
856
|
+
/**
|
|
857
|
+
* The cell this seat's cell editor is open on, or null when it is closed (`IEditorBridgeService`:
|
|
858
|
+
* `isVisible().visible` and `getEditLocation()`). Univer rewrites an open editor's text whenever any write lands on
|
|
859
|
+
* its cell (`EditorDataSyncController` → `refreshEditCellState` → the editor's `ReplaceSnapshotCommand`, caret back
|
|
860
|
+
* to 0), so a peer's value landing mid-typing spliced into the draft and Enter committed the mix (the attack's
|
|
861
|
+
* "$1,234.50" vs "$7" → 507). While the editor is open, a remote op whose ranges cover its cell, or that moves or
|
|
862
|
+
* removes it (a row/column insert, remove or move, a sheet removal, a shrink), is held: the person's draft and the
|
|
863
|
+
* cell it is committed against stay as they saw them, and their commit is rebased over the held ops when the editor
|
|
864
|
+
* closes (the later commit wins whole). Everything else applies live, so the person still sees the others work.
|
|
865
|
+
*/
|
|
866
|
+
cellEditor?(): EditedCell | null;
|
|
824
867
|
/** Replace the workbook's whole content, keeping its unit id. */
|
|
825
868
|
load(snapshot: unknown): void;
|
|
826
869
|
markDirty(): void;
|
|
827
870
|
}
|
|
871
|
+
/** The cell an open cell editor is on. */
|
|
872
|
+
interface EditedCell {
|
|
873
|
+
sheetId: string;
|
|
874
|
+
row: number;
|
|
875
|
+
col: number;
|
|
876
|
+
}
|
|
877
|
+
/** What the port reads of Univer's `SheetsFilterService` (sheets-filter). */
|
|
878
|
+
interface FilterServiceLike {
|
|
879
|
+
getFilterModel(unitId: string, subUnitId: string): {
|
|
880
|
+
getRange(): SheetRange | null | undefined;
|
|
881
|
+
} | null | undefined;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* The port's `filterRange` over Univer's filter service: the range as the filter stores it, `rangeType` included.
|
|
885
|
+
* Every host lends this one (the editor, the fold, the fuzz seats): a host that dropped `rangeType` restored a peer's
|
|
886
|
+
* growth without it, and that seat's filter saved differently from the others (hash_mismatch, live attack rev 90).
|
|
887
|
+
*/
|
|
888
|
+
declare function filterServiceRange(service: () => FilterServiceLike | null | undefined): (unitId: string, subUnitId: string) => SheetRange | null;
|
|
889
|
+
/** What the port reads of Univer's `IEditorBridgeService` (sheets-ui). */
|
|
890
|
+
interface EditorBridgeLike {
|
|
891
|
+
isVisible(): {
|
|
892
|
+
visible: boolean;
|
|
893
|
+
};
|
|
894
|
+
getEditLocation(): {
|
|
895
|
+
sheetId: string;
|
|
896
|
+
row: number;
|
|
897
|
+
column: number;
|
|
898
|
+
} | null | undefined;
|
|
899
|
+
}
|
|
900
|
+
/** The port's `cellEditor` over Univer's editor bridge: the cell the cell editor is open on, or null. */
|
|
901
|
+
declare function editorBridgeCell(bridge: EditorBridgeLike): () => EditedCell | null;
|
|
828
902
|
/** One selection as `SheetsSelectionsService` holds it (range, primary cell, style). */
|
|
829
903
|
interface SheetSelection {
|
|
830
904
|
range: SheetRange & {
|
|
@@ -844,6 +918,13 @@ declare function univerSheetsOtPort(o: UniverSheetsOtPortOptions): SheetsOtPort
|
|
|
844
918
|
dispose(): void;
|
|
845
919
|
running(): string[];
|
|
846
920
|
};
|
|
921
|
+
/**
|
|
922
|
+
* Whether a remote mutation must wait for the open cell editor: it writes the editor's cell (a value, a style, a
|
|
923
|
+
* merge, a format, a rule or a sort whose ranges cover it), or it moves or removes that cell (a row/column insert,
|
|
924
|
+
* remove or move before it, its sheet's removal, a row or column count below it). A mutation with no range on that
|
|
925
|
+
* sheet (a rename, a sheet order, a filter's criteria) never touches the cell. Anything this cannot read waits.
|
|
926
|
+
*/
|
|
927
|
+
declare function touchesEditedCell(m: SheetMutation, at: EditedCell): boolean;
|
|
847
928
|
/**
|
|
848
929
|
* This seat's selections after a remote structural op: indices move with their rows/columns; one the op removed
|
|
849
930
|
* lands on the first surviving index; everything is clamped to the sheet; whole-row/column ranges span the sheet.
|
|
@@ -933,4 +1014,4 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
|
|
|
933
1014
|
dispose?: () => void;
|
|
934
1015
|
}, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
|
|
935
1016
|
|
|
936
|
-
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, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, 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 };
|
|
1017
|
+
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 EditedCell, type EditorBridgeLike, type FilterServiceLike, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, REDO_COMMAND, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, 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, UNDO_COMMAND, 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, editorBridgeCell, encodeSheetOp, filterServiceRange, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, touchesEditedCell, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
|