@textbus/collaborate 3.0.0-alpha.8 → 3.0.0-y.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,6 @@
1
1
  import { Observable, Subject, Subscription } from '@tanbo/stream';
2
- import { ComponentInstance, Controller, Factory, History, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot, Starter } from '@textbus/core';
3
- import { Array as YArray, Doc as YDoc, Map as YMap, RelativePosition, Text as YText, Transaction, UndoManager } from 'yjs';
4
- import { CollaborateCursor, RemoteSelection } from './collaborate-cursor';
2
+ import { AbstractSelection, ComponentInstance, Controller, Registry, History, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot, Starter } from '@textbus/core';
3
+ import { Array as YArray, Doc as YDoc, Map as YMap, RelativePosition, Text as YText, Transaction, UndoManager, Item } from 'yjs';
5
4
  interface CursorPosition {
6
5
  anchor: RelativePosition;
7
6
  focus: RelativePosition;
@@ -19,16 +18,20 @@ interface UpdateItem {
19
18
  record: boolean;
20
19
  action(): void;
21
20
  }
21
+ export declare abstract class CustomUndoManagerConfig {
22
+ abstract captureTransaction?(arg0: Transaction): boolean;
23
+ abstract deleteFilter?(arg0: Item): boolean;
24
+ }
22
25
  export declare class Collaborate implements History {
23
26
  protected stackSize: number;
24
27
  protected rootComponentRef: RootComponentRef;
25
- protected collaborateCursor: CollaborateCursor;
26
28
  protected controller: Controller;
27
29
  protected scheduler: Scheduler;
28
- protected factory: Factory;
30
+ protected registry: Registry;
29
31
  protected selection: Selection;
30
32
  protected starter: Starter;
31
- onSelectionChange: Observable<SelectionPaths>;
33
+ protected undoManagerConfig: CustomUndoManagerConfig;
34
+ onLocalChangesApplied: Observable<void>;
32
35
  yDoc: YDoc;
33
36
  onBack: Observable<void>;
34
37
  onForward: Observable<void>;
@@ -47,19 +50,21 @@ export declare class Collaborate implements History {
47
50
  protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
48
51
  protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
49
52
  protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
53
+ protected localChangesAppliedEvent: Subject<void>;
50
54
  protected selectionChangeEvent: Subject<SelectionPaths>;
51
55
  protected contentMap: ContentMap;
52
56
  protected updateRemoteActions: Array<UpdateItem>;
53
57
  protected noRecord: {};
54
- constructor(stackSize: number, rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor, controller: Controller, scheduler: Scheduler, factory: Factory, selection: Selection, starter: Starter);
58
+ protected historyItems: Array<CursorPosition | null>;
59
+ protected index: number;
60
+ constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, registry: Registry, selection: Selection, starter: Starter, undoManagerConfig: CustomUndoManagerConfig);
55
61
  listen(): void;
56
- updateRemoteSelection(paths: RemoteSelection[]): void;
57
62
  back(): void;
58
63
  forward(): void;
59
64
  clear(): void;
60
65
  destroy(): void;
61
66
  protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
62
- protected restoreCursorLocation(position: CursorPosition): void;
67
+ protected getAbstractSelection(position: CursorPosition): AbstractSelection | null;
63
68
  protected getRelativeCursorLocation(): CursorPosition | null;
64
69
  protected syncSlotContent(content: YText, slot: Slot): void;
65
70
  protected syncSlotState(remoteSlot: YMap<any>, slot: Slot): void;
@@ -69,7 +74,7 @@ export declare class Collaborate implements History {
69
74
  protected runRemoteUpdate(tr: Transaction, fn: () => void): void;
70
75
  protected createSharedComponentByComponent(component: ComponentInstance): YMap<any>;
71
76
  protected createSharedSlotBySlot(slot: Slot): YMap<any>;
72
- protected createComponentBySharedComponent(yMap: YMap<any>, canInsertInlineComponent: boolean): ComponentInstance;
77
+ protected createComponentBySharedComponent(yMap: YMap<any>): ComponentInstance;
73
78
  protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
74
79
  protected cleanSubscriptionsBySlot(slot: Slot): void;
75
80
  protected cleanSubscriptionsByComponent(component: ComponentInstance): void;