@textbus/collaborate 2.0.0-beta.4 → 2.0.0-beta.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,33 +1,44 @@
1
1
  import { SelectionBridge } from '@textbus/browser';
2
- import { Selection, SelectionPaths } from '@textbus/core';
2
+ import { Selection, SelectionPaths, Range as TBRange } from '@textbus/core';
3
3
  export interface RemoteSelection {
4
4
  color: string;
5
5
  username: string;
6
6
  paths: SelectionPaths;
7
7
  }
8
- export interface SelectionRect {
9
- color: string;
10
- username: string;
8
+ export interface Rect {
11
9
  x: number;
12
10
  y: number;
13
11
  width: number;
14
12
  height: number;
15
13
  }
14
+ export interface SelectionRect extends Rect {
15
+ color: string;
16
+ username: string;
17
+ }
16
18
  export interface RemoteSelectionCursor {
17
19
  cursor: HTMLElement;
18
20
  anchor: HTMLElement;
19
21
  userTip: HTMLElement;
20
22
  }
23
+ export declare abstract class CollaborateCursorAwarenessDelegate {
24
+ abstract getRects(range: TBRange, nativeRange: Range): false | Rect[];
25
+ }
21
26
  export declare class CollaborateCursor {
22
27
  private container;
23
- private document;
28
+ private awarenessDelegate;
24
29
  private nativeSelection;
25
30
  private selection;
31
+ private host;
32
+ private canvasContainer;
26
33
  private canvas;
27
34
  private context;
28
35
  private tooltips;
29
36
  private onRectsChange;
30
- constructor(container: HTMLElement, document: Document, nativeSelection: SelectionBridge, selection: Selection);
37
+ private subscription;
38
+ private currentSelection;
39
+ constructor(container: HTMLElement, awarenessDelegate: CollaborateCursorAwarenessDelegate, nativeSelection: SelectionBridge, selection: Selection);
40
+ refresh(): void;
41
+ destroy(): void;
31
42
  draw(paths: RemoteSelection[]): void;
32
43
  private drawUserCursor;
33
44
  private getUserCursor;
@@ -0,0 +1,327 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Inject, Injectable, Optional } from '@tanbo/di';
14
+ import { createElement, VIEW_CONTAINER, getLayoutRectByRange, SelectionBridge } from '@textbus/browser';
15
+ import { Selection } from '@textbus/core';
16
+ import { fromEvent, Subject, Subscription } from '@tanbo/stream';
17
+ export class CollaborateCursorAwarenessDelegate {
18
+ }
19
+ let CollaborateCursor = class CollaborateCursor {
20
+ constructor(container, awarenessDelegate, nativeSelection, selection) {
21
+ Object.defineProperty(this, "container", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: container
26
+ });
27
+ Object.defineProperty(this, "awarenessDelegate", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: awarenessDelegate
32
+ });
33
+ Object.defineProperty(this, "nativeSelection", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: nativeSelection
38
+ });
39
+ Object.defineProperty(this, "selection", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: selection
44
+ });
45
+ Object.defineProperty(this, "host", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: createElement('div', {
50
+ styles: {
51
+ position: 'absolute',
52
+ left: 0,
53
+ top: 0,
54
+ width: '100%',
55
+ height: '100%',
56
+ pointerEvents: 'none',
57
+ zIndex: 1
58
+ }
59
+ })
60
+ });
61
+ Object.defineProperty(this, "canvasContainer", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: createElement('div', {
66
+ styles: {
67
+ position: 'absolute',
68
+ left: 0,
69
+ top: 0,
70
+ width: '100%',
71
+ height: '100%',
72
+ overflow: 'hidden'
73
+ }
74
+ })
75
+ });
76
+ Object.defineProperty(this, "canvas", {
77
+ enumerable: true,
78
+ configurable: true,
79
+ writable: true,
80
+ value: createElement('canvas', {
81
+ styles: {
82
+ position: 'absolute',
83
+ opacity: 0.5,
84
+ left: 0,
85
+ top: 0,
86
+ width: '100%',
87
+ height: document.documentElement.clientHeight + 'px',
88
+ pointerEvents: 'none',
89
+ }
90
+ })
91
+ });
92
+ Object.defineProperty(this, "context", {
93
+ enumerable: true,
94
+ configurable: true,
95
+ writable: true,
96
+ value: this.canvas.getContext('2d')
97
+ });
98
+ Object.defineProperty(this, "tooltips", {
99
+ enumerable: true,
100
+ configurable: true,
101
+ writable: true,
102
+ value: createElement('div', {
103
+ styles: {
104
+ position: 'absolute',
105
+ left: 0,
106
+ top: 0,
107
+ width: '100%',
108
+ height: '100%',
109
+ pointerEvents: 'none',
110
+ fontSize: '12px',
111
+ zIndex: 10
112
+ }
113
+ })
114
+ });
115
+ Object.defineProperty(this, "onRectsChange", {
116
+ enumerable: true,
117
+ configurable: true,
118
+ writable: true,
119
+ value: new Subject()
120
+ });
121
+ Object.defineProperty(this, "subscription", {
122
+ enumerable: true,
123
+ configurable: true,
124
+ writable: true,
125
+ value: new Subscription()
126
+ });
127
+ Object.defineProperty(this, "currentSelection", {
128
+ enumerable: true,
129
+ configurable: true,
130
+ writable: true,
131
+ value: []
132
+ });
133
+ this.canvasContainer.append(this.canvas);
134
+ this.host.append(this.canvasContainer, this.tooltips);
135
+ container.prepend(this.host);
136
+ this.subscription.add(this.onRectsChange.subscribe(rects => {
137
+ for (const rect of rects) {
138
+ this.context.fillStyle = rect.color;
139
+ this.context.beginPath();
140
+ this.context.rect(rect.x, rect.y, rect.width, rect.height);
141
+ this.context.fill();
142
+ this.context.closePath();
143
+ }
144
+ }), fromEvent(window, 'resize').subscribe(() => {
145
+ this.canvas.style.height = document.documentElement.clientHeight + 'px';
146
+ this.refresh();
147
+ }));
148
+ }
149
+ refresh() {
150
+ this.draw(this.currentSelection);
151
+ }
152
+ destroy() {
153
+ this.subscription.unsubscribe();
154
+ }
155
+ draw(paths) {
156
+ this.currentSelection = paths;
157
+ const containerRect = this.container.getBoundingClientRect();
158
+ this.canvas.style.top = containerRect.y * -1 + 'px';
159
+ this.canvas.width = this.canvas.offsetWidth;
160
+ this.canvas.height = this.canvas.offsetHeight;
161
+ this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
162
+ const users = [];
163
+ paths.filter(i => {
164
+ return i.paths.anchor.length && i.paths.focus.length;
165
+ }).forEach(item => {
166
+ const anchorPaths = [...item.paths.anchor];
167
+ const focusPaths = [...item.paths.focus];
168
+ const anchorOffset = anchorPaths.pop();
169
+ const anchorSlot = this.selection.findSlotByPaths(anchorPaths);
170
+ const focusOffset = focusPaths.pop();
171
+ const focusSlot = this.selection.findSlotByPaths(focusPaths);
172
+ if (!anchorSlot || !focusSlot) {
173
+ return;
174
+ }
175
+ const { focus, anchor } = this.nativeSelection.getPositionByRange({
176
+ focusOffset,
177
+ anchorOffset,
178
+ focusSlot,
179
+ anchorSlot
180
+ });
181
+ if (!focus || !anchor) {
182
+ return;
183
+ }
184
+ const nativeRange = document.createRange();
185
+ nativeRange.setStart(anchor.node, anchor.offset);
186
+ nativeRange.setEnd(focus.node, focus.offset);
187
+ if ((anchor.node !== focus.node || anchor.offset !== focus.offset) && nativeRange.collapsed) {
188
+ nativeRange.setStart(focus.node, focus.offset);
189
+ nativeRange.setEnd(anchor.node, anchor.offset);
190
+ }
191
+ let rects = false;
192
+ if (this.awarenessDelegate) {
193
+ rects = this.awarenessDelegate.getRects({
194
+ focusOffset,
195
+ anchorOffset,
196
+ focusSlot,
197
+ anchorSlot
198
+ }, nativeRange);
199
+ }
200
+ if (!rects) {
201
+ rects = nativeRange.getClientRects();
202
+ }
203
+ const selectionRects = [];
204
+ for (let i = rects.length - 1; i >= 0; i--) {
205
+ const rect = rects[i];
206
+ selectionRects.push({
207
+ color: item.color,
208
+ username: item.username,
209
+ x: rect.x - containerRect.x,
210
+ y: rect.y,
211
+ width: rect.width,
212
+ height: rect.height,
213
+ });
214
+ }
215
+ this.onRectsChange.next(selectionRects);
216
+ const cursorRange = nativeRange.cloneRange();
217
+ cursorRange.setStart(focus.node, focus.offset);
218
+ cursorRange.collapse(true);
219
+ const cursorRect = getLayoutRectByRange(cursorRange);
220
+ const rect = {
221
+ username: item.username,
222
+ color: item.color,
223
+ x: cursorRect.x - containerRect.x,
224
+ y: cursorRect.y - containerRect.y,
225
+ width: 2,
226
+ height: cursorRect.height
227
+ };
228
+ if (rect.x < 0 || rect.y < 0 || rect.x > containerRect.width) {
229
+ return;
230
+ }
231
+ users.push(rect);
232
+ });
233
+ this.drawUserCursor(users);
234
+ }
235
+ drawUserCursor(rects) {
236
+ for (let i = 0; i < rects.length; i++) {
237
+ const rect = rects[i];
238
+ const { cursor, userTip, anchor } = this.getUserCursor(i);
239
+ Object.assign(cursor.style, {
240
+ left: rect.x + 'px',
241
+ top: rect.y + 'px',
242
+ width: rect.width + 'px',
243
+ height: rect.height + 'px',
244
+ background: rect.color,
245
+ display: 'block'
246
+ });
247
+ anchor.style.background = rect.color;
248
+ userTip.innerText = rect.username;
249
+ userTip.style.background = rect.color;
250
+ }
251
+ for (let i = rects.length; i < this.tooltips.children.length; i++) {
252
+ this.tooltips.removeChild(this.tooltips.children[i]);
253
+ }
254
+ }
255
+ getUserCursor(index) {
256
+ let child = this.tooltips.children[index];
257
+ if (child) {
258
+ const anchor = child.children[0];
259
+ return {
260
+ cursor: child,
261
+ anchor,
262
+ userTip: anchor.children[0]
263
+ };
264
+ }
265
+ const userTip = createElement('span', {
266
+ styles: {
267
+ position: 'absolute',
268
+ display: 'none',
269
+ left: '50%',
270
+ transform: 'translateX(-50%)',
271
+ marginBottom: '2px',
272
+ bottom: '100%',
273
+ whiteSpace: 'nowrap',
274
+ color: '#fff',
275
+ boxShadow: '0 1px 2px rgba(0,0,0,.1)',
276
+ borderRadius: '3px',
277
+ padding: '3px 5px',
278
+ pointerEvents: 'none',
279
+ }
280
+ });
281
+ const anchor = createElement('span', {
282
+ styles: {
283
+ position: 'absolute',
284
+ top: '-2px',
285
+ left: '-2px',
286
+ width: '6px',
287
+ height: '6px',
288
+ pointerEvents: 'auto',
289
+ pointer: 'cursor',
290
+ },
291
+ children: [userTip],
292
+ on: {
293
+ mouseenter() {
294
+ userTip.style.display = 'block';
295
+ },
296
+ mouseleave() {
297
+ userTip.style.display = 'none';
298
+ }
299
+ }
300
+ });
301
+ child = createElement('span', {
302
+ styles: {
303
+ position: 'absolute',
304
+ },
305
+ children: [
306
+ anchor
307
+ ]
308
+ });
309
+ this.tooltips.append(child);
310
+ return {
311
+ cursor: child,
312
+ anchor,
313
+ userTip
314
+ };
315
+ }
316
+ };
317
+ CollaborateCursor = __decorate([
318
+ Injectable(),
319
+ __param(0, Inject(VIEW_CONTAINER)),
320
+ __param(1, Optional()),
321
+ __metadata("design:paramtypes", [HTMLElement,
322
+ CollaborateCursorAwarenessDelegate,
323
+ SelectionBridge,
324
+ Selection])
325
+ ], CollaborateCursor);
326
+ export { CollaborateCursor };
327
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGFib3JhdGUtY3Vyc29yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbGxhYm9yYXRlLWN1cnNvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxXQUFXLENBQUE7QUFDeEQsT0FBTyxFQUNMLGFBQWEsRUFDYixjQUFjLEVBQ2Qsb0JBQW9CLEVBQ3BCLGVBQWUsRUFDaEIsTUFBTSxrQkF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9yOiAnI2ZmZicsXG4gICAgICAgIGJveFNoYWRvdzogJzAgMXB4IDJweCByZ2JhKDAsMCwwLC4xKScsXG4gICAgICAgIGJvcmRlclJhZGl1czogJzNweCcsXG4gICAgICAgIHBhZGRpbmc6ICczcHggNXB4JyxcbiAgICAgICAgcG9pbnRlckV2ZW50czogJ25vbmUnLFxuICAgICAgfVxuICAgIH0pXG5cbiAgICBjb25zdCBhbmNob3IgPSBjcmVhdGVFbGVtZW50KCdzcGFuJywge1xuICAgICAgc3R5bGVzOiB7XG4gICAgICAgIHBvc2l0aW9uOiAnYWJzb2x1dGUnLFxuICAgICAgICB0b3A6ICctMnB4JyxcbiAgICAgICAgbGVmdDogJy0ycHgnLFxuICAgICAgICB3aWR0aDogJzZweCcsXG4gICAgICAgIGhlaWdodDogJzZweCcsXG4gICAgICAgIHBvaW50ZXJFdmVudHM6ICdhdXRvJyxcbiAgICAgICAgcG9pbnRlcjogJ2N1cnNvcicsXG4gICAgICB9LFxuICAgICAgY2hpbGRyZW46IFt1c2VyVGlwXSxcbiAgICAgIG9uOiB7XG4gICAgICAgIG1vdXNlZW50ZXIoKSB7XG4gICAgICAgICAgdXNlclRpcC5zdHlsZS5kaXNwbGF5ID0gJ2Jsb2NrJ1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWxlYXZlKCkge1xuICAgICAgICAgIHVzZXJUaXAuc3R5bGUuZGlzcGxheSA9ICdub25lJ1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSlcbiAgICBjaGlsZCA9IGNyZWF0ZUVsZW1lbnQoJ3NwYW4nLCB7XG4gICAgICBzdHlsZXM6IHtcbiAgICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICB9LFxuICAgICAgY2hpbGRyZW46IFtcbiAgICAgICAgYW5jaG9yXG4gICAgICBdXG4gICAgfSlcbiAgICB0aGlzLnRvb2x0aXBzLmFwcGVuZChjaGlsZClcbiAgICByZXR1cm4ge1xuICAgICAgY3Vyc29yOiBjaGlsZCxcbiAgICAgIGFuY2hvcixcbiAgICAgIHVzZXJUaXBcbiAgICB9XG4gIH1cbn1cbiJdfQ==
@@ -1,12 +1,14 @@
1
1
  import { Observable } from '@tanbo/stream';
2
- import { RootComponentRef, Starter, Translator, Registry, Selection, SelectionPaths, History, Renderer } from '@textbus/core';
2
+ import { Controller, History, Registry, RootComponentRef, Scheduler, Selection, SelectionPaths, Starter, Translator } from '@textbus/core';
3
3
  import { Doc as YDoc } from 'yjs';
4
- import { CollaborateCursor, RemoteSelection } from './collab/_api';
4
+ import { CollaborateCursor, RemoteSelection } from './collaborate-cursor';
5
5
  export declare class Collaborate implements History {
6
+ private stackSize;
6
7
  private rootComponentRef;
7
8
  private collaborateCursor;
9
+ private controller;
10
+ private scheduler;
8
11
  private translator;
9
- private renderer;
10
12
  private registry;
11
13
  private selection;
12
14
  private starter;
@@ -30,15 +32,19 @@ export declare class Collaborate implements History {
30
32
  private slotsSyncCaches;
31
33
  private componentStateSyncCaches;
32
34
  private selectionChangeEvent;
35
+ private contentMap;
33
36
  private updateRemoteActions;
34
- constructor(rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor, translator: Translator, renderer: Renderer, registry: Registry, selection: Selection, starter: Starter);
37
+ constructor(stackSize: number, rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor, controller: Controller, scheduler: Scheduler, translator: Translator, registry: Registry, selection: Selection, starter: Starter);
35
38
  setup(): void;
36
39
  updateRemoteSelection(paths: RemoteSelection[]): void;
37
40
  listen(): void;
38
41
  back(): void;
39
42
  forward(): void;
43
+ clear(): void;
40
44
  destroy(): void;
41
- private listen2;
45
+ private syncRootComponent;
46
+ private restoreCursorLocation;
47
+ private getRelativeCursorLocation;
42
48
  private syncContent;
43
49
  private syncSlot;
44
50
  private syncSlots;