@textbus/collaborate 4.0.3 → 4.1.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ import { History, RootComponentRef, Scheduler, Selection } from '@textbus/core';
2
+ import { Observable } from '@tanbo/stream';
3
+ import { Item, Transaction } from 'yjs';
4
+ import { Collaborate } from './collaborate';
5
+ export declare abstract class CustomUndoManagerConfig {
6
+ abstract captureTransaction?(arg0: Transaction): boolean;
7
+ abstract deleteFilter?(arg0: Item): boolean;
8
+ }
9
+ export declare class CollabHistory implements History {
10
+ private rootComponentRef;
11
+ private collaborate;
12
+ private scheduler;
13
+ private selection;
14
+ private stackSize;
15
+ private undoManagerConfig;
16
+ onBack: Observable<void>;
17
+ onForward: Observable<void>;
18
+ onChange: Observable<void>;
19
+ onPush: Observable<void>;
20
+ get canBack(): boolean;
21
+ get canForward(): boolean;
22
+ private manager;
23
+ private historyItems;
24
+ private index;
25
+ private subscriptions;
26
+ private backEvent;
27
+ private forwardEvent;
28
+ private changeEvent;
29
+ private pushEvent;
30
+ constructor(rootComponentRef: RootComponentRef, collaborate: Collaborate, scheduler: Scheduler, selection: Selection, stackSize: number, undoManagerConfig: CustomUndoManagerConfig);
31
+ listen(): void;
32
+ back(): void;
33
+ forward(): void;
34
+ clear(): void;
35
+ destroy(): void;
36
+ private getAbstractSelection;
37
+ private getRelativeCursorLocation;
38
+ }
@@ -1,46 +1,40 @@
1
1
  import { Observable } from '@tanbo/stream';
2
- import { Registry, History, RootComponentRef, Scheduler, Selection } from '@textbus/core';
3
- import { Doc as YDoc, Transaction, Item } from 'yjs';
4
- export declare abstract class CustomUndoManagerConfig {
5
- abstract captureTransaction?(arg0: Transaction): boolean;
6
- abstract deleteFilter?(arg0: Item): boolean;
2
+ import { Component, Registry, Scheduler, Selection, Slot } from '@textbus/core';
3
+ import { AbstractType, Doc as YDoc, Map as YMap, Text as YText } from 'yjs';
4
+ import { SubModelLoader } from './sub-model-loader';
5
+ declare class SlotMap {
6
+ private slotAndYTextMap;
7
+ private yTextAndSlotMap;
8
+ set(key: Slot, value: YText): void;
9
+ set(key: YText, value: Slot): void;
10
+ get(key: Slot): YText | null;
11
+ get(key: YText): Slot | null;
12
+ delete(key: Slot | YText): void;
7
13
  }
8
- export declare class Collaborate implements History {
9
- private stackSize;
10
- private rootComponentRef;
14
+ export interface SubModelLoaded {
15
+ yType: AbstractType<any>;
16
+ yDoc: YDoc;
17
+ }
18
+ export declare class Collaborate {
11
19
  private scheduler;
12
20
  private registry;
13
21
  private selection;
14
- private undoManagerConfig;
15
- onLocalChangesApplied: Observable<void>;
22
+ private subModelLoader;
16
23
  yDoc: YDoc;
17
- onBack: Observable<void>;
18
- onForward: Observable<void>;
19
- onChange: Observable<void>;
20
- onPush: Observable<void>;
21
- get canBack(): boolean;
22
- get canForward(): boolean;
23
- private backEvent;
24
- private forwardEvent;
25
- private changeEvent;
26
- private pushEvent;
27
- private manager;
24
+ slotMap: SlotMap;
25
+ onAddSubModel: Observable<SubModelLoaded>;
28
26
  private subscriptions;
29
27
  private updateFromRemote;
30
- private localChangesAppliedEvent;
31
- private selectionChangeEvent;
32
- private slotMap;
28
+ private addSubModelEvent;
33
29
  private updateRemoteActions;
34
30
  private noRecord;
35
- private historyItems;
36
- private index;
37
- constructor(stackSize: number, rootComponentRef: RootComponentRef, scheduler: Scheduler, registry: Registry, selection: Selection, undoManagerConfig: CustomUndoManagerConfig);
38
- listen(): void;
39
- back(): void;
40
- forward(): void;
41
- clear(): void;
31
+ constructor(scheduler: Scheduler, registry: Registry, selection: Selection, subModelLoader: SubModelLoader);
32
+ syncRootComponent(yDoc: YDoc, sharedComponent: YMap<any>, localComponent: Component<any>): void;
33
+ syncRootSlot(yDoc: YDoc, sharedSlot: YText, localSlot: Slot): void;
34
+ private initSyncEvent;
35
+ private syncComponent;
36
+ private syncSlot;
42
37
  destroy(): void;
43
- private syncRootComponent;
44
38
  private syncSharedMapToLocalMap;
45
39
  private createLocalMapBySharedMap;
46
40
  private createLocalArrayBySharedArray;
@@ -48,12 +42,11 @@ export declare class Collaborate implements History {
48
42
  private createSharedMapByLocalMap;
49
43
  private createSharedArrayByLocalArray;
50
44
  private createSharedSlotByLocalSlot;
45
+ private initSharedSlotByLocalSlot;
51
46
  private createLocalSlotBySharedSlot;
47
+ private initLocalSlotBySharedSlot;
52
48
  private createSharedModelByLocalModel;
53
49
  private createLocalModelBySharedByModel;
54
- private getAbstractSelection;
55
- private getRelativeCursorLocation;
56
- private syncSlot;
57
50
  private createSharedComponentByLocalComponent;
58
51
  private createLocalComponentBySharedComponent;
59
52
  /**
@@ -73,3 +66,4 @@ export declare class Collaborate implements History {
73
66
  private runLocalUpdate;
74
67
  private runRemoteUpdate;
75
68
  }
69
+ export {};