@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.
Files changed (76) hide show
  1. package/lib/cjs/chunk-4MGIQFAJ.js +40 -0
  2. package/lib/cjs/chunk-JHTS3PZO.js +1882 -0
  3. package/lib/cjs/facade.js +98 -0
  4. package/lib/cjs/index.js +37 -1329
  5. package/lib/cjs/locale/ar-SA.js +25 -0
  6. package/lib/cjs/locale/ca-ES.js +25 -0
  7. package/lib/cjs/locale/de-DE.js +25 -0
  8. package/lib/cjs/locale/en-US.js +25 -0
  9. package/lib/cjs/locale/es-ES.js +25 -0
  10. package/lib/cjs/locale/fa-IR.js +25 -0
  11. package/lib/cjs/locale/fr-FR.js +25 -0
  12. package/lib/cjs/locale/id-ID.js +25 -0
  13. package/lib/cjs/locale/it-IT.js +25 -0
  14. package/lib/cjs/locale/ja-JP.js +25 -0
  15. package/lib/cjs/locale/ko-KR.js +25 -0
  16. package/lib/cjs/locale/pl-PL.js +25 -0
  17. package/lib/cjs/locale/pt-BR.js +25 -0
  18. package/lib/cjs/locale/ru-RU.js +25 -0
  19. package/lib/cjs/locale/sk-SK.js +25 -0
  20. package/lib/cjs/locale/vi-VN.js +25 -0
  21. package/lib/cjs/locale/zh-CN.js +25 -0
  22. package/lib/cjs/locale/zh-HK.js +25 -0
  23. package/lib/cjs/locale/zh-TW.js +25 -0
  24. package/lib/es/chunk-4MGIQFAJ.js +16 -0
  25. package/lib/es/chunk-JHTS3PZO.js +1832 -0
  26. package/lib/es/facade.js +80 -0
  27. package/lib/es/index.js +38 -1302
  28. package/lib/es/locale/ar-SA.js +7 -0
  29. package/lib/es/locale/ca-ES.js +7 -0
  30. package/lib/es/locale/de-DE.js +7 -0
  31. package/lib/es/locale/en-US.js +7 -0
  32. package/lib/es/locale/es-ES.js +7 -0
  33. package/lib/es/locale/fa-IR.js +7 -0
  34. package/lib/es/locale/fr-FR.js +7 -0
  35. package/lib/es/locale/id-ID.js +7 -0
  36. package/lib/es/locale/it-IT.js +7 -0
  37. package/lib/es/locale/ja-JP.js +7 -0
  38. package/lib/es/locale/ko-KR.js +7 -0
  39. package/lib/es/locale/pl-PL.js +7 -0
  40. package/lib/es/locale/pt-BR.js +7 -0
  41. package/lib/es/locale/ru-RU.js +7 -0
  42. package/lib/es/locale/sk-SK.js +7 -0
  43. package/lib/es/locale/vi-VN.js +7 -0
  44. package/lib/es/locale/zh-CN.js +7 -0
  45. package/lib/es/locale/zh-HK.js +7 -0
  46. package/lib/es/locale/zh-TW.js +7 -0
  47. package/lib/types/src/assets.d.ts +41 -0
  48. package/lib/types/src/authorization.d.ts +31 -0
  49. package/lib/types/src/document-recovery.d.ts +3 -3
  50. package/lib/types/src/document-undo.d.ts +3 -1
  51. package/lib/types/src/facade/index.d.ts +46 -0
  52. package/lib/types/src/index.d.ts +14 -12
  53. package/lib/types/src/locale/ar-SA.d.ts +20 -0
  54. package/lib/types/src/locale/ca-ES.d.ts +20 -0
  55. package/lib/types/src/locale/de-DE.d.ts +20 -0
  56. package/lib/types/src/locale/en-US.d.ts +20 -0
  57. package/lib/types/src/locale/es-ES.d.ts +20 -0
  58. package/lib/types/src/locale/fa-IR.d.ts +20 -0
  59. package/lib/types/src/locale/fr-FR.d.ts +20 -0
  60. package/lib/types/src/locale/id-ID.d.ts +20 -0
  61. package/lib/types/src/locale/it-IT.d.ts +20 -0
  62. package/lib/types/src/locale/ja-JP.d.ts +20 -0
  63. package/lib/types/src/locale/ko-KR.d.ts +20 -0
  64. package/lib/types/src/locale/pl-PL.d.ts +20 -0
  65. package/lib/types/src/locale/pt-BR.d.ts +20 -0
  66. package/lib/types/src/locale/ru-RU.d.ts +20 -0
  67. package/lib/types/src/locale/sk-SK.d.ts +20 -0
  68. package/lib/types/src/locale/vi-VN.d.ts +20 -0
  69. package/lib/types/src/locale/zh-CN.d.ts +20 -0
  70. package/lib/types/src/locale/zh-HK.d.ts +20 -0
  71. package/lib/types/src/locale/zh-TW.d.ts +20 -0
  72. package/lib/types/src/revision-recovery.d.ts +12 -4
  73. package/lib/types/src/session.d.ts +7 -2
  74. package/lib/types/src/socket.d.ts +6 -6
  75. package/lib/types/src/workspace.d.ts +100 -0
  76. package/package.json +134 -2
@@ -0,0 +1,80 @@
1
+ import {
2
+ CollaborationController,
3
+ CollaborationStatus,
4
+ MemberService
5
+ } from "./chunk-JHTS3PZO.js";
6
+ import "./chunk-4MGIQFAJ.js";
7
+
8
+ // src/facade/index.ts
9
+ import { SnapshotService } from "@cool-office/collaboration";
10
+ import { IUniverInstanceService, toDisposable } from "@cool-office/core";
11
+ import { FEnum, FEventName, FUniver } from "@cool-office/core/facade";
12
+ import { UniverType } from "@cool-office/protocol";
13
+ import { of, switchMap } from "rxjs";
14
+ var FCollaboration = class {
15
+ constructor(api, injector) {
16
+ this.api = api;
17
+ this.injector = injector;
18
+ }
19
+ async load(type, getter, unitId, context) {
20
+ const instances = this.injector.get(IUniverInstanceService);
21
+ const unit = instances.getUnit(unitId, type) ?? await this.injector.get(SnapshotService).loadUnit(type, unitId, 0, context);
22
+ await this.injector.get(CollaborationController).readyForCollab(unitId);
23
+ const api = this.api;
24
+ return api[getter] ? api[getter](unitId) : unit;
25
+ }
26
+ loadSheetAsync(id, context) {
27
+ return this.load(UniverType.UNIVER_SHEET, "getWorkbook", id, context);
28
+ }
29
+ loadDocAsync(id, context) {
30
+ return this.load(UniverType.UNIVER_DOC, "getDocument", id, context);
31
+ }
32
+ loadSlideAsync(id, context) {
33
+ return this.load(UniverType.UNIVER_SLIDE, "getPresentation", id, context);
34
+ }
35
+ loadBoardAsync(id, context) {
36
+ return this.load(UniverType.UNIVER_BOARD, "getBoard", id, context);
37
+ }
38
+ loadBaseAsync(id, context) {
39
+ return this.load(UniverType.UNIVER_BASE, "getBase", id, context);
40
+ }
41
+ focusedId() {
42
+ return this.injector.get(IUniverInstanceService).getFocusedUnit()?.getUnitId();
43
+ }
44
+ getCollaborationStatus(id = this.focusedId()) {
45
+ return id ? this.injector.get(CollaborationController).getStatus(id) : "not_collab" /* NOT_COLLAB */;
46
+ }
47
+ async flush(id = this.focusedId(), options) {
48
+ if (id) await this.injector.get(CollaborationController).flush(id, { timeoutMs: options?.timeout });
49
+ }
50
+ subscribeCollaborators(id, callback) {
51
+ const subscription = this.injector.get(MemberService).waitForRoom$(id).pipe(
52
+ switchMap((room) => room?.members$ ?? of(/* @__PURE__ */ new Map()))
53
+ ).subscribe((members) => callback(Array.from(members.values())));
54
+ return toDisposable(() => subscription.unsubscribe());
55
+ }
56
+ };
57
+ var CollaborationUniverFacade = class extends FUniver {
58
+ getCollaboration() {
59
+ return new FCollaboration(this, this._injector);
60
+ }
61
+ _initialize(injector) {
62
+ this.disposeWithMe(this.registerEventHandler(this.Event.CollaborationStatusChanged, () => injector.get(CollaborationController).statusChanged$.subscribe((event) => this.fireEvent(this.Event.CollaborationStatusChanged, event))));
63
+ }
64
+ };
65
+ var CollaborationEventName = class extends FEventName {
66
+ get CollaborationStatusChanged() {
67
+ return "CollaborationStatusChanged";
68
+ }
69
+ };
70
+ var CollaborationEnum = class extends FEnum {
71
+ get CollaborationStatus() {
72
+ return CollaborationStatus;
73
+ }
74
+ };
75
+ FEnum.extend(CollaborationEnum);
76
+ FEventName.extend(CollaborationEventName);
77
+ FUniver.extend(CollaborationUniverFacade);
78
+ export {
79
+ FCollaboration
80
+ };