@cool-office/collaboration-client 1.2.1 → 1.2.2
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/lib/cjs/chunk-4MGIQFAJ.js +40 -0
- package/lib/cjs/chunk-JHTS3PZO.js +1882 -0
- package/lib/cjs/facade.js +98 -0
- package/lib/cjs/index.js +37 -1329
- package/lib/cjs/locale/ar-SA.js +25 -0
- package/lib/cjs/locale/ca-ES.js +25 -0
- package/lib/cjs/locale/de-DE.js +25 -0
- package/lib/cjs/locale/en-US.js +25 -0
- package/lib/cjs/locale/es-ES.js +25 -0
- package/lib/cjs/locale/fa-IR.js +25 -0
- package/lib/cjs/locale/fr-FR.js +25 -0
- package/lib/cjs/locale/id-ID.js +25 -0
- package/lib/cjs/locale/it-IT.js +25 -0
- package/lib/cjs/locale/ja-JP.js +25 -0
- package/lib/cjs/locale/ko-KR.js +25 -0
- package/lib/cjs/locale/pl-PL.js +25 -0
- package/lib/cjs/locale/pt-BR.js +25 -0
- package/lib/cjs/locale/ru-RU.js +25 -0
- package/lib/cjs/locale/sk-SK.js +25 -0
- package/lib/cjs/locale/vi-VN.js +25 -0
- package/lib/cjs/locale/zh-CN.js +25 -0
- package/lib/cjs/locale/zh-HK.js +25 -0
- package/lib/cjs/locale/zh-TW.js +25 -0
- package/lib/es/chunk-4MGIQFAJ.js +16 -0
- package/lib/es/chunk-JHTS3PZO.js +1832 -0
- package/lib/es/facade.js +80 -0
- package/lib/es/index.js +38 -1302
- package/lib/es/locale/ar-SA.js +7 -0
- package/lib/es/locale/ca-ES.js +7 -0
- package/lib/es/locale/de-DE.js +7 -0
- package/lib/es/locale/en-US.js +7 -0
- package/lib/es/locale/es-ES.js +7 -0
- package/lib/es/locale/fa-IR.js +7 -0
- package/lib/es/locale/fr-FR.js +7 -0
- package/lib/es/locale/id-ID.js +7 -0
- package/lib/es/locale/it-IT.js +7 -0
- package/lib/es/locale/ja-JP.js +7 -0
- package/lib/es/locale/ko-KR.js +7 -0
- package/lib/es/locale/pl-PL.js +7 -0
- package/lib/es/locale/pt-BR.js +7 -0
- package/lib/es/locale/ru-RU.js +7 -0
- package/lib/es/locale/sk-SK.js +7 -0
- package/lib/es/locale/vi-VN.js +7 -0
- package/lib/es/locale/zh-CN.js +7 -0
- package/lib/es/locale/zh-HK.js +7 -0
- package/lib/es/locale/zh-TW.js +7 -0
- package/lib/types/src/assets.d.ts +41 -0
- package/lib/types/src/authorization.d.ts +31 -0
- package/lib/types/src/document-recovery.d.ts +3 -3
- package/lib/types/src/document-undo.d.ts +3 -1
- package/lib/types/src/facade/index.d.ts +46 -0
- package/lib/types/src/index.d.ts +14 -12
- package/lib/types/src/locale/ar-SA.d.ts +20 -0
- package/lib/types/src/locale/ca-ES.d.ts +20 -0
- package/lib/types/src/locale/de-DE.d.ts +20 -0
- package/lib/types/src/locale/en-US.d.ts +20 -0
- package/lib/types/src/locale/es-ES.d.ts +20 -0
- package/lib/types/src/locale/fa-IR.d.ts +20 -0
- package/lib/types/src/locale/fr-FR.d.ts +20 -0
- package/lib/types/src/locale/id-ID.d.ts +20 -0
- package/lib/types/src/locale/it-IT.d.ts +20 -0
- package/lib/types/src/locale/ja-JP.d.ts +20 -0
- package/lib/types/src/locale/ko-KR.d.ts +20 -0
- package/lib/types/src/locale/pl-PL.d.ts +20 -0
- package/lib/types/src/locale/pt-BR.d.ts +20 -0
- package/lib/types/src/locale/ru-RU.d.ts +20 -0
- package/lib/types/src/locale/sk-SK.d.ts +20 -0
- package/lib/types/src/locale/vi-VN.d.ts +20 -0
- package/lib/types/src/locale/zh-CN.d.ts +20 -0
- package/lib/types/src/locale/zh-HK.d.ts +20 -0
- package/lib/types/src/locale/zh-TW.d.ts +20 -0
- package/lib/types/src/revision-recovery.d.ts +12 -4
- package/lib/types/src/session.d.ts +7 -2
- package/lib/types/src/socket.d.ts +6 -6
- package/lib/types/src/workspace.d.ts +100 -0
- package/package.json +134 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __coolOfficeModuleUrl = require("node:url").pathToFileURL(__filename).href;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var facade_exports = {};
|
|
20
|
+
__export(facade_exports, {
|
|
21
|
+
FCollaboration: () => FCollaboration
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(facade_exports);
|
|
24
|
+
var import_chunk_JHTS3PZO = require("./chunk-JHTS3PZO.js");
|
|
25
|
+
var import_chunk_4MGIQFAJ = require("./chunk-4MGIQFAJ.js");
|
|
26
|
+
var import_collaboration = require("@cool-office/collaboration");
|
|
27
|
+
var import_core = require("@cool-office/core");
|
|
28
|
+
var import_facade = require("@cool-office/core/facade");
|
|
29
|
+
var import_protocol = require("@cool-office/protocol");
|
|
30
|
+
var import_rxjs = require("rxjs");
|
|
31
|
+
var FCollaboration = class {
|
|
32
|
+
constructor(api, injector) {
|
|
33
|
+
this.api = api;
|
|
34
|
+
this.injector = injector;
|
|
35
|
+
}
|
|
36
|
+
async load(type, getter, unitId, context) {
|
|
37
|
+
const instances = this.injector.get(import_core.IUniverInstanceService);
|
|
38
|
+
const unit = instances.getUnit(unitId, type) ?? await this.injector.get(import_collaboration.SnapshotService).loadUnit(type, unitId, 0, context);
|
|
39
|
+
await this.injector.get(import_chunk_JHTS3PZO.CollaborationController).readyForCollab(unitId);
|
|
40
|
+
const api = this.api;
|
|
41
|
+
return api[getter] ? api[getter](unitId) : unit;
|
|
42
|
+
}
|
|
43
|
+
loadSheetAsync(id, context) {
|
|
44
|
+
return this.load(import_protocol.UniverType.UNIVER_SHEET, "getWorkbook", id, context);
|
|
45
|
+
}
|
|
46
|
+
loadDocAsync(id, context) {
|
|
47
|
+
return this.load(import_protocol.UniverType.UNIVER_DOC, "getDocument", id, context);
|
|
48
|
+
}
|
|
49
|
+
loadSlideAsync(id, context) {
|
|
50
|
+
return this.load(import_protocol.UniverType.UNIVER_SLIDE, "getPresentation", id, context);
|
|
51
|
+
}
|
|
52
|
+
loadBoardAsync(id, context) {
|
|
53
|
+
return this.load(import_protocol.UniverType.UNIVER_BOARD, "getBoard", id, context);
|
|
54
|
+
}
|
|
55
|
+
loadBaseAsync(id, context) {
|
|
56
|
+
return this.load(import_protocol.UniverType.UNIVER_BASE, "getBase", id, context);
|
|
57
|
+
}
|
|
58
|
+
focusedId() {
|
|
59
|
+
return this.injector.get(import_core.IUniverInstanceService).getFocusedUnit()?.getUnitId();
|
|
60
|
+
}
|
|
61
|
+
getCollaborationStatus(id = this.focusedId()) {
|
|
62
|
+
return id ? this.injector.get(import_chunk_JHTS3PZO.CollaborationController).getStatus(id) : "not_collab";
|
|
63
|
+
}
|
|
64
|
+
async flush(id = this.focusedId(), options) {
|
|
65
|
+
if (id) await this.injector.get(import_chunk_JHTS3PZO.CollaborationController).flush(id, { timeoutMs: options?.timeout });
|
|
66
|
+
}
|
|
67
|
+
subscribeCollaborators(id, callback) {
|
|
68
|
+
const subscription = this.injector.get(import_chunk_JHTS3PZO.MemberService).waitForRoom$(id).pipe(
|
|
69
|
+
(0, import_rxjs.switchMap)((room) => room?.members$ ?? (0, import_rxjs.of)(/* @__PURE__ */ new Map()))
|
|
70
|
+
).subscribe((members) => callback(Array.from(members.values())));
|
|
71
|
+
return (0, import_core.toDisposable)(() => subscription.unsubscribe());
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var CollaborationUniverFacade = class extends import_facade.FUniver {
|
|
75
|
+
getCollaboration() {
|
|
76
|
+
return new FCollaboration(this, this._injector);
|
|
77
|
+
}
|
|
78
|
+
_initialize(injector) {
|
|
79
|
+
this.disposeWithMe(this.registerEventHandler(this.Event.CollaborationStatusChanged, () => injector.get(import_chunk_JHTS3PZO.CollaborationController).statusChanged$.subscribe((event) => this.fireEvent(this.Event.CollaborationStatusChanged, event))));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var CollaborationEventName = class extends import_facade.FEventName {
|
|
83
|
+
get CollaborationStatusChanged() {
|
|
84
|
+
return "CollaborationStatusChanged";
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var CollaborationEnum = class extends import_facade.FEnum {
|
|
88
|
+
get CollaborationStatus() {
|
|
89
|
+
return import_chunk_JHTS3PZO.CollaborationStatus;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
import_facade.FEnum.extend(CollaborationEnum);
|
|
93
|
+
import_facade.FEventName.extend(CollaborationEventName);
|
|
94
|
+
import_facade.FUniver.extend(CollaborationUniverFacade);
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
FCollaboration
|
|
98
|
+
});
|