@textbus/collaborate 4.0.4 → 4.1.0-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/collab-history.d.ts +36 -0
- package/bundles/collaborate.d.ts +44 -35
- package/bundles/connectors/hocuspocus-connector.d.ts +2 -1
- package/bundles/connectors/y-websocket-connector.d.ts +2 -1
- package/bundles/index.esm.js +765 -317
- package/bundles/index.js +764 -314
- package/bundles/multiple-doc-collab-history.d.ts +37 -0
- package/bundles/multiple-document-collaborate-module.d.ts +14 -0
- package/bundles/public-api.d.ts +4 -0
- package/bundles/sub-model-loader.d.ts +45 -0
- package/package.json +3 -3
@@ -0,0 +1,36 @@
|
|
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
|
+
}
|
package/bundles/collaborate.d.ts
CHANGED
@@ -1,46 +1,55 @@
|
|
1
1
|
import { Observable } from '@tanbo/stream';
|
2
|
-
import { Registry,
|
3
|
-
import { Doc as YDoc,
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
import { Component, Registry, Scheduler, Selection, Slot, AbstractSelection } from '@textbus/core';
|
3
|
+
import { AbstractType, Doc as YDoc, Map as YMap, RelativePosition, Text as YText } from 'yjs';
|
4
|
+
import { SubModelLoader } from './sub-model-loader';
|
5
|
+
export interface RelativePositionRecord {
|
6
|
+
doc: YDoc;
|
7
|
+
position: RelativePosition;
|
7
8
|
}
|
8
|
-
export
|
9
|
-
|
10
|
-
|
9
|
+
export interface CursorPosition {
|
10
|
+
anchor: RelativePositionRecord;
|
11
|
+
focus: RelativePositionRecord;
|
12
|
+
}
|
13
|
+
export interface CollaborateHistorySelectionPosition {
|
14
|
+
before: CursorPosition | null;
|
15
|
+
after: CursorPosition | null;
|
16
|
+
}
|
17
|
+
declare class SlotMap {
|
18
|
+
private slotAndYTextMap;
|
19
|
+
private yTextAndSlotMap;
|
20
|
+
set(key: Slot, value: YText): void;
|
21
|
+
set(key: YText, value: Slot): void;
|
22
|
+
get(key: Slot): YText | null;
|
23
|
+
get(key: YText): Slot | null;
|
24
|
+
delete(key: Slot | YText): void;
|
25
|
+
}
|
26
|
+
export interface SubModelLoaded {
|
27
|
+
yType: AbstractType<any>;
|
28
|
+
yDoc: YDoc;
|
29
|
+
}
|
30
|
+
export declare class Collaborate {
|
11
31
|
private scheduler;
|
12
32
|
private registry;
|
13
33
|
private selection;
|
14
|
-
private
|
15
|
-
onLocalChangesApplied: Observable<void>;
|
34
|
+
private subModelLoader;
|
16
35
|
yDoc: YDoc;
|
17
|
-
|
18
|
-
|
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;
|
36
|
+
slotMap: SlotMap;
|
37
|
+
onAddSubModel: Observable<SubModelLoaded>;
|
28
38
|
private subscriptions;
|
29
39
|
private updateFromRemote;
|
30
|
-
private
|
31
|
-
private selectionChangeEvent;
|
32
|
-
private slotMap;
|
40
|
+
private addSubModelEvent;
|
33
41
|
private updateRemoteActions;
|
34
42
|
private noRecord;
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
constructor(scheduler: Scheduler, registry: Registry, selection: Selection, subModelLoader: SubModelLoader);
|
44
|
+
syncRootComponent(yDoc: YDoc, sharedComponent: YMap<any>, localComponent: Component<any>): void;
|
45
|
+
syncRootSlot(yDoc: YDoc, sharedSlot: YText, localSlot: Slot): void;
|
46
|
+
getAbstractSelection(position: CursorPosition): AbstractSelection | null;
|
47
|
+
getRelativeCursorLocation(): CursorPosition | null;
|
48
|
+
restoreCursorPosition(position: CursorPosition | null): void;
|
49
|
+
private initSyncEvent;
|
50
|
+
private syncComponent;
|
51
|
+
private syncSlot;
|
42
52
|
destroy(): void;
|
43
|
-
private syncRootComponent;
|
44
53
|
private syncSharedMapToLocalMap;
|
45
54
|
private createLocalMapBySharedMap;
|
46
55
|
private createLocalArrayBySharedArray;
|
@@ -48,12 +57,11 @@ export declare class Collaborate implements History {
|
|
48
57
|
private createSharedMapByLocalMap;
|
49
58
|
private createSharedArrayByLocalArray;
|
50
59
|
private createSharedSlotByLocalSlot;
|
60
|
+
private initSharedSlotByLocalSlot;
|
51
61
|
private createLocalSlotBySharedSlot;
|
62
|
+
private initLocalSlotBySharedSlot;
|
52
63
|
private createSharedModelByLocalModel;
|
53
64
|
private createLocalModelBySharedByModel;
|
54
|
-
private getAbstractSelection;
|
55
|
-
private getRelativeCursorLocation;
|
56
|
-
private syncSlot;
|
57
65
|
private createSharedComponentByLocalComponent;
|
58
66
|
private createLocalComponentBySharedComponent;
|
59
67
|
/**
|
@@ -73,3 +81,4 @@ export declare class Collaborate implements History {
|
|
73
81
|
private runLocalUpdate;
|
74
82
|
private runRemoteUpdate;
|
75
83
|
}
|
84
|
+
export {};
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import { HocuspocusProvider } from '@hocuspocus/provider';
|
1
2
|
import { HocuspocusProviderConfiguration } from '@hocuspocus/provider';
|
2
3
|
import { SyncConnector } from '../sync-connector';
|
3
4
|
export declare class HocuspocusConnector extends SyncConnector {
|
4
|
-
|
5
|
+
provide: HocuspocusProvider;
|
5
6
|
constructor(config: HocuspocusProviderConfiguration);
|
6
7
|
setLocalStateField(key: string, data: Record<string, any>): void;
|
7
8
|
onDestroy(): void;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { Doc as YDoc } from 'yjs';
|
2
|
+
import { WebsocketProvider } from 'y-websocket';
|
2
3
|
import { SyncConnector } from '../sync-connector';
|
3
4
|
export declare class YWebsocketConnector extends SyncConnector {
|
4
|
-
|
5
|
+
provide: WebsocketProvider;
|
5
6
|
constructor(url: string, roomName: string, yDoc: YDoc);
|
6
7
|
setLocalStateField(key: string, data: Record<string, any>): void;
|
7
8
|
onDestroy(): void;
|