@textbus/collaborate 2.5.2 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,697 +0,0 @@
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 } from '@tanbo/di';
14
- import { delay, filter, map, Subject } from '@tanbo/stream';
15
- import { ChangeOrigin, ContentType, Controller, FormatType, HISTORY_STACK_SIZE, makeError, Registry, RootComponentRef, Scheduler, Selection, Slot, Starter, Translator } from '@textbus/core';
16
- import { Array as YArray, Doc as YDoc, Map as YMap, Text as YText, UndoManager, createAbsolutePositionFromRelativePosition, createRelativePositionFromTypeIndex } from 'yjs';
17
- import { CollaborateCursor } from './collaborate-cursor';
18
- import { createUnknownComponent } from './unknown.component';
19
- const collaborateErrorFn = makeError('Collaborate');
20
- class ContentMap {
21
- constructor() {
22
- this.slotAndYTextMap = new WeakMap();
23
- this.yTextAndSLotMap = new WeakMap();
24
- }
25
- set(key, value) {
26
- if (key instanceof Slot) {
27
- this.slotAndYTextMap.set(key, value);
28
- this.yTextAndSLotMap.set(value, key);
29
- }
30
- else {
31
- this.slotAndYTextMap.set(value, key);
32
- this.yTextAndSLotMap.set(key, value);
33
- }
34
- }
35
- get(key) {
36
- if (key instanceof Slot) {
37
- return this.slotAndYTextMap.get(key) || null;
38
- }
39
- return this.yTextAndSLotMap.get(key) || null;
40
- }
41
- delete(key) {
42
- if (key instanceof Slot) {
43
- const v = this.slotAndYTextMap.get(key);
44
- this.slotAndYTextMap.delete(key);
45
- if (v) {
46
- this.yTextAndSLotMap.delete(v);
47
- }
48
- }
49
- else {
50
- const v = this.yTextAndSLotMap.get(key);
51
- this.yTextAndSLotMap.delete(key);
52
- if (v) {
53
- this.slotAndYTextMap.delete(v);
54
- }
55
- }
56
- }
57
- }
58
- let Collaborate = class Collaborate {
59
- constructor(stackSize, rootComponentRef, collaborateCursor, controller, scheduler, translator, registry, selection, starter) {
60
- this.stackSize = stackSize;
61
- this.rootComponentRef = rootComponentRef;
62
- this.collaborateCursor = collaborateCursor;
63
- this.controller = controller;
64
- this.scheduler = scheduler;
65
- this.translator = translator;
66
- this.registry = registry;
67
- this.selection = selection;
68
- this.starter = starter;
69
- this.yDoc = new YDoc();
70
- this.backEvent = new Subject();
71
- this.forwardEvent = new Subject();
72
- this.changeEvent = new Subject();
73
- this.pushEvent = new Subject();
74
- this.manager = null;
75
- this.subscriptions = [];
76
- this.updateFromRemote = false;
77
- this.contentSyncCaches = new WeakMap();
78
- this.slotStateSyncCaches = new WeakMap();
79
- this.slotsSyncCaches = new WeakMap();
80
- this.componentStateSyncCaches = new WeakMap();
81
- this.selectionChangeEvent = new Subject();
82
- this.contentMap = new ContentMap();
83
- this.updateRemoteActions = [];
84
- this.noRecord = {};
85
- this.onSelectionChange = this.selectionChangeEvent.asObservable().pipe(delay());
86
- this.onBack = this.backEvent.asObservable();
87
- this.onForward = this.forwardEvent.asObservable();
88
- this.onChange = this.changeEvent.asObservable();
89
- this.onPush = this.pushEvent.asObservable();
90
- }
91
- get canBack() {
92
- var _a;
93
- return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canUndo()) || false;
94
- }
95
- get canForward() {
96
- var _a;
97
- return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
98
- }
99
- listen() {
100
- const root = this.yDoc.getMap('RootComponent');
101
- const rootComponent = this.rootComponentRef.component;
102
- this.manager = new UndoManager(root, {
103
- trackedOrigins: new Set([this.yDoc])
104
- });
105
- const cursorKey = 'cursor-position';
106
- this.manager.on('stack-item-added', event => {
107
- event.stackItem.meta.set(cursorKey, this.getRelativeCursorLocation());
108
- if (this.manager.undoStack.length > this.stackSize) {
109
- this.manager.undoStack.shift();
110
- }
111
- if (event.origin === this.yDoc) {
112
- this.pushEvent.next();
113
- }
114
- this.changeEvent.next();
115
- });
116
- this.manager.on('stack-item-popped', event => {
117
- const position = event.stackItem.meta.get(cursorKey);
118
- if (position) {
119
- this.restoreCursorLocation(position);
120
- }
121
- });
122
- this.subscriptions.push(this.selection.onChange.subscribe(() => {
123
- const paths = this.selection.getPaths();
124
- this.selectionChangeEvent.next(paths);
125
- }), this.scheduler.onDocChanged.pipe(map(item => {
126
- return item.filter(i => {
127
- return i.from !== ChangeOrigin.Remote;
128
- });
129
- }), filter(item => {
130
- return item.length;
131
- })).subscribe(() => {
132
- const updates = [];
133
- let update = null;
134
- for (const item of this.updateRemoteActions) {
135
- if (!update) {
136
- update = {
137
- record: item.record,
138
- actions: []
139
- };
140
- updates.push(update);
141
- }
142
- if (update.record === item.record) {
143
- update.actions.push(item.action);
144
- }
145
- else {
146
- update = {
147
- record: item.record,
148
- actions: [item.action]
149
- };
150
- updates.push(update);
151
- }
152
- }
153
- this.updateRemoteActions = [];
154
- for (const item of updates) {
155
- this.yDoc.transact(() => {
156
- item.actions.forEach(fn => {
157
- fn();
158
- });
159
- }, item.record ? this.yDoc : this.noRecord);
160
- }
161
- }));
162
- this.syncRootComponent(root, rootComponent);
163
- }
164
- updateRemoteSelection(paths) {
165
- this.collaborateCursor.draw(paths);
166
- }
167
- back() {
168
- var _a;
169
- if (this.canBack) {
170
- (_a = this.manager) === null || _a === void 0 ? void 0 : _a.undo();
171
- this.backEvent.next();
172
- }
173
- }
174
- forward() {
175
- var _a;
176
- if (this.canForward) {
177
- (_a = this.manager) === null || _a === void 0 ? void 0 : _a.redo();
178
- this.forwardEvent.next();
179
- }
180
- }
181
- clear() {
182
- var _a;
183
- (_a = this.manager) === null || _a === void 0 ? void 0 : _a.clear();
184
- this.changeEvent.next();
185
- }
186
- destroy() {
187
- var _a;
188
- this.subscriptions.forEach(i => i.unsubscribe());
189
- this.collaborateCursor.destroy();
190
- (_a = this.manager) === null || _a === void 0 ? void 0 : _a.destroy();
191
- }
192
- syncRootComponent(root, rootComponent) {
193
- let slots = root.get('slots');
194
- if (!slots) {
195
- slots = new YArray();
196
- rootComponent.slots.toArray().forEach(i => {
197
- const sharedSlot = this.createSharedSlotBySlot(i);
198
- slots.push([sharedSlot]);
199
- });
200
- this.yDoc.transact(() => {
201
- root.set('state', rootComponent.state);
202
- root.set('slots', slots);
203
- });
204
- }
205
- else if (slots.length === 0) {
206
- rootComponent.updateState(() => {
207
- return root.get('state');
208
- });
209
- this.yDoc.transact(() => {
210
- rootComponent.slots.toArray().forEach(i => {
211
- const sharedSlot = this.createSharedSlotBySlot(i);
212
- slots.push([sharedSlot]);
213
- });
214
- });
215
- }
216
- else {
217
- rootComponent.updateState(() => {
218
- return root.get('state');
219
- });
220
- rootComponent.slots.clean();
221
- slots.forEach(sharedSlot => {
222
- const slot = this.createSlotBySharedSlot(sharedSlot);
223
- this.syncContent(sharedSlot.get('content'), slot);
224
- this.syncSlot(sharedSlot, slot);
225
- rootComponent.slots.insert(slot);
226
- });
227
- }
228
- this.syncComponent(root, rootComponent);
229
- this.syncSlots(slots, rootComponent);
230
- }
231
- restoreCursorLocation(position) {
232
- const anchorPosition = createAbsolutePositionFromRelativePosition(position.anchor, this.yDoc);
233
- const focusPosition = createAbsolutePositionFromRelativePosition(position.focus, this.yDoc);
234
- if (anchorPosition && focusPosition) {
235
- const focusSlot = this.contentMap.get(focusPosition.type);
236
- const anchorSlot = this.contentMap.get(anchorPosition.type);
237
- if (focusSlot && anchorSlot) {
238
- this.selection.setBaseAndExtent(anchorSlot, anchorPosition.index, focusSlot, focusPosition.index);
239
- return;
240
- }
241
- }
242
- this.selection.unSelect();
243
- }
244
- getRelativeCursorLocation() {
245
- const { anchorSlot, anchorOffset, focusSlot, focusOffset } = this.selection;
246
- if (anchorSlot) {
247
- const anchorYText = this.contentMap.get(anchorSlot);
248
- if (anchorYText) {
249
- const anchorPosition = createRelativePositionFromTypeIndex(anchorYText, anchorOffset);
250
- if (focusSlot) {
251
- const focusYText = this.contentMap.get(focusSlot);
252
- if (focusYText) {
253
- const focusPosition = createRelativePositionFromTypeIndex(focusYText, focusOffset);
254
- return {
255
- focus: focusPosition,
256
- anchor: anchorPosition
257
- };
258
- }
259
- }
260
- }
261
- }
262
- return null;
263
- }
264
- syncContent(content, slot) {
265
- this.contentMap.set(slot, content);
266
- const syncRemote = (ev, tr) => {
267
- this.runRemoteUpdate(tr, () => {
268
- slot.retain(0);
269
- ev.delta.forEach(action => {
270
- if (Reflect.has(action, 'retain')) {
271
- if (action.attributes) {
272
- const formats = remoteFormatsToLocal(this.registry, action.attributes);
273
- if (formats.length) {
274
- slot.retain(action.retain, formats);
275
- }
276
- slot.retain(slot.index + action.retain);
277
- }
278
- else {
279
- slot.retain(action.retain);
280
- }
281
- }
282
- else if (action.insert) {
283
- const index = slot.index;
284
- let length = 1;
285
- if (typeof action.insert === 'string') {
286
- length = action.insert.length;
287
- slot.insert(action.insert, remoteFormatsToLocal(this.registry, action.attributes));
288
- }
289
- else {
290
- const sharedComponent = action.insert;
291
- const canInsertInlineComponent = slot.schema.includes(ContentType.InlineComponent);
292
- const component = this.createComponentBySharedComponent(sharedComponent, canInsertInlineComponent);
293
- this.syncSlots(sharedComponent.get('slots'), component);
294
- this.syncComponent(sharedComponent, component);
295
- slot.insert(component);
296
- }
297
- if (this.selection.isSelected) {
298
- if (slot === this.selection.anchorSlot && this.selection.anchorOffset > index) {
299
- this.selection.setAnchor(slot, this.selection.anchorOffset + length);
300
- }
301
- if (slot === this.selection.focusSlot && this.selection.focusOffset > index) {
302
- this.selection.setFocus(slot, this.selection.focusOffset + length);
303
- }
304
- }
305
- }
306
- else if (action.delete) {
307
- const index = slot.index;
308
- slot.retain(slot.index);
309
- slot.delete(action.delete);
310
- if (this.selection.isSelected) {
311
- if (slot === this.selection.anchorSlot && this.selection.anchorOffset >= index) {
312
- this.selection.setAnchor(slot, this.selection.startOffset - action.delete);
313
- }
314
- if (slot === this.selection.focusSlot && this.selection.focusOffset >= index) {
315
- this.selection.setFocus(slot, this.selection.focusOffset - action.delete);
316
- }
317
- }
318
- }
319
- else if (action.attributes) {
320
- slot.updateState(draft => {
321
- if (typeof draft === 'object' && draft !== null) {
322
- Object.assign(draft, action.attributes);
323
- }
324
- else {
325
- return action.attributes;
326
- }
327
- });
328
- }
329
- });
330
- });
331
- };
332
- content.observe(syncRemote);
333
- const sub = slot.onContentChange.subscribe(actions => {
334
- this.runLocalUpdate(() => {
335
- var _a;
336
- let offset = 0;
337
- let length = 0;
338
- for (const action of actions) {
339
- if (action.type === 'retain') {
340
- const formats = action.formats;
341
- if (formats) {
342
- const keys = Object.keys(formats);
343
- let length = keys.length;
344
- keys.forEach(key => {
345
- const formatter = this.registry.getFormatter(key);
346
- if (!formatter) {
347
- length--;
348
- Reflect.deleteProperty(formats, key);
349
- }
350
- });
351
- if (length) {
352
- content.format(offset, action.offset, formats);
353
- }
354
- }
355
- else {
356
- offset = action.offset;
357
- }
358
- }
359
- else if (action.type === 'insert') {
360
- const delta = content.toDelta();
361
- const isEmpty = delta.length === 1 && delta[0].insert === Slot.emptyPlaceholder;
362
- if (typeof action.content === 'string') {
363
- length = action.content.length;
364
- content.insert(offset, action.content, action.formats || {});
365
- }
366
- else {
367
- length = 1;
368
- const sharedComponent = this.createSharedComponentByComponent(action.ref);
369
- content.insertEmbed(offset, sharedComponent, action.formats || {});
370
- }
371
- if (isEmpty && offset === 0) {
372
- content.delete(content.length - 1, 1);
373
- }
374
- offset += length;
375
- }
376
- else if (action.type === 'delete') {
377
- const delta = content.toDelta();
378
- if (content.length) {
379
- content.delete(offset, action.count);
380
- }
381
- if (content.length === 0) {
382
- content.insert(0, '\n', (_a = delta[0]) === null || _a === void 0 ? void 0 : _a.attributes);
383
- }
384
- }
385
- }
386
- });
387
- });
388
- sub.add(slot.onChildComponentRemove.subscribe(components => {
389
- components.forEach(c => {
390
- this.cleanSubscriptionsByComponent(c);
391
- });
392
- }));
393
- this.contentSyncCaches.set(slot, () => {
394
- content.unobserve(syncRemote);
395
- sub.unsubscribe();
396
- });
397
- }
398
- syncSlot(remoteSlot, slot) {
399
- const syncRemote = (ev, tr) => {
400
- this.runRemoteUpdate(tr, () => {
401
- ev.keysChanged.forEach(key => {
402
- if (key === 'state') {
403
- const state = ev.target.get('state');
404
- slot.updateState(draft => {
405
- if (typeof draft === 'object' && draft !== null) {
406
- Object.assign(draft, state);
407
- }
408
- else {
409
- return state;
410
- }
411
- });
412
- }
413
- });
414
- });
415
- };
416
- remoteSlot.observe(syncRemote);
417
- const sub = slot.onStateChange.subscribe(change => {
418
- this.runLocalUpdate(() => {
419
- remoteSlot.set('state', change.newState);
420
- }, change.record);
421
- });
422
- this.slotStateSyncCaches.set(slot, () => {
423
- remoteSlot.unobserve(syncRemote);
424
- sub.unsubscribe();
425
- });
426
- }
427
- syncSlots(remoteSlots, component) {
428
- const slots = component.slots;
429
- const syncRemote = (ev, tr) => {
430
- this.runRemoteUpdate(tr, () => {
431
- let index = 0;
432
- slots.retain(index);
433
- ev.delta.forEach(action => {
434
- if (Reflect.has(action, 'retain')) {
435
- index += action.retain;
436
- slots.retain(index);
437
- }
438
- else if (action.insert) {
439
- action.insert.forEach(item => {
440
- const slot = this.createSlotBySharedSlot(item);
441
- slots.insert(slot);
442
- this.syncContent(item.get('content'), slot);
443
- this.syncSlot(item, slot);
444
- index++;
445
- });
446
- }
447
- else if (action.delete) {
448
- slots.retain(index);
449
- slots.delete(action.delete);
450
- }
451
- });
452
- });
453
- };
454
- remoteSlots.observe(syncRemote);
455
- const sub = slots.onChange.subscribe(operations => {
456
- this.runLocalUpdate(() => {
457
- const applyActions = operations.apply;
458
- let index;
459
- applyActions.forEach(action => {
460
- if (action.type === 'retain') {
461
- index = action.offset;
462
- }
463
- else if (action.type === 'insertSlot') {
464
- const sharedSlot = this.createSharedSlotBySlot(action.ref);
465
- remoteSlots.insert(index, [sharedSlot]);
466
- index++;
467
- }
468
- else if (action.type === 'delete') {
469
- remoteSlots.delete(index, action.count);
470
- }
471
- });
472
- });
473
- });
474
- sub.add(slots.onChildSlotRemove.subscribe(slots => {
475
- slots.forEach(slot => {
476
- this.cleanSubscriptionsBySlot(slot);
477
- });
478
- }));
479
- this.slotsSyncCaches.set(component, () => {
480
- remoteSlots.unobserve(syncRemote);
481
- sub.unsubscribe();
482
- });
483
- }
484
- syncComponent(remoteComponent, component) {
485
- const syncRemote = (ev, tr) => {
486
- this.runRemoteUpdate(tr, () => {
487
- ev.keysChanged.forEach(key => {
488
- if (key === 'state') {
489
- const state = ev.target.get('state');
490
- component.updateState(draft => {
491
- if (typeof draft === 'object' && draft !== null) {
492
- Object.assign(draft, state);
493
- }
494
- else {
495
- return state;
496
- }
497
- });
498
- }
499
- });
500
- });
501
- };
502
- remoteComponent.observe(syncRemote);
503
- const sub = component.onStateChange.subscribe(change => {
504
- this.runLocalUpdate(() => {
505
- remoteComponent.set('state', change.newState);
506
- }, change.record);
507
- });
508
- this.componentStateSyncCaches.set(component, () => {
509
- remoteComponent.unobserve(syncRemote);
510
- sub.unsubscribe();
511
- });
512
- }
513
- runLocalUpdate(fn, record = true) {
514
- if (this.updateFromRemote || this.controller.readonly) {
515
- return;
516
- }
517
- this.updateRemoteActions.push({
518
- record,
519
- action: fn
520
- });
521
- }
522
- runRemoteUpdate(tr, fn) {
523
- if (tr.origin === this.yDoc) {
524
- return;
525
- }
526
- this.updateFromRemote = true;
527
- if (tr.origin === this.manager) {
528
- this.scheduler.historyApplyTransact(fn);
529
- }
530
- else {
531
- this.scheduler.remoteUpdateTransact(fn);
532
- }
533
- this.updateFromRemote = false;
534
- }
535
- createSharedComponentByComponent(component) {
536
- const sharedComponent = new YMap();
537
- sharedComponent.set('state', component.state);
538
- sharedComponent.set('name', component.name);
539
- const sharedSlots = new YArray();
540
- sharedComponent.set('slots', sharedSlots);
541
- component.slots.toArray().forEach(slot => {
542
- const sharedSlot = this.createSharedSlotBySlot(slot);
543
- sharedSlots.push([sharedSlot]);
544
- });
545
- this.syncSlots(sharedSlots, component);
546
- this.syncComponent(sharedComponent, component);
547
- return sharedComponent;
548
- }
549
- createSharedSlotBySlot(slot) {
550
- const sharedSlot = new YMap();
551
- sharedSlot.set('schema', slot.schema);
552
- sharedSlot.set('state', slot.state);
553
- const sharedContent = new YText();
554
- sharedSlot.set('content', sharedContent);
555
- let offset = 0;
556
- slot.toDelta().forEach(i => {
557
- let formats = {};
558
- if (i.formats) {
559
- i.formats.forEach(item => {
560
- formats[item[0].name] = item[1];
561
- });
562
- }
563
- else {
564
- formats = null;
565
- }
566
- if (typeof i.insert === 'string') {
567
- sharedContent.insert(offset, i.insert, formats);
568
- }
569
- else {
570
- const sharedComponent = this.createSharedComponentByComponent(i.insert);
571
- sharedContent.insertEmbed(offset, sharedComponent, formats);
572
- }
573
- offset += i.insert.length;
574
- });
575
- this.syncContent(sharedContent, slot);
576
- this.syncSlot(sharedSlot, slot);
577
- return sharedSlot;
578
- }
579
- createComponentBySharedComponent(yMap, canInsertInlineComponent) {
580
- const sharedSlots = yMap.get('slots');
581
- const slots = [];
582
- sharedSlots.forEach(sharedSlot => {
583
- const slot = this.createSlotBySharedSlot(sharedSlot);
584
- slots.push(slot);
585
- });
586
- const name = yMap.get('name');
587
- const state = yMap.get('state');
588
- const instance = this.translator.createComponentByData(name, {
589
- state,
590
- slots
591
- });
592
- if (instance) {
593
- instance.slots.toArray().forEach((slot, index) => {
594
- let sharedSlot = sharedSlots.get(index);
595
- if (!sharedSlot) {
596
- sharedSlot = this.createSharedSlotBySlot(slot);
597
- sharedSlots.push([sharedSlot]);
598
- }
599
- this.syncSlot(sharedSlot, slot);
600
- this.syncContent(sharedSlot.get('content'), slot);
601
- });
602
- return instance;
603
- }
604
- return createUnknownComponent(name, canInsertInlineComponent).createInstance(this.starter);
605
- }
606
- createSlotBySharedSlot(sharedSlot) {
607
- const content = sharedSlot.get('content');
608
- const delta = content.toDelta();
609
- const slot = this.translator.createSlot({
610
- schema: sharedSlot.get('schema'),
611
- state: sharedSlot.get('state'),
612
- formats: {},
613
- content: []
614
- });
615
- for (const action of delta) {
616
- if (action.insert) {
617
- if (typeof action.insert === 'string') {
618
- const blockFormats = [];
619
- const formats = remoteFormatsToLocal(this.registry, action.attributes).filter(item => {
620
- if (item[0].type === FormatType.Block) {
621
- blockFormats.push(item);
622
- return false;
623
- }
624
- return true;
625
- });
626
- slot.insert(action.insert, formats);
627
- const index = slot.index;
628
- blockFormats.forEach(item => {
629
- slot.setAttribute(item[0], item[1]);
630
- });
631
- slot.retain(index);
632
- }
633
- else {
634
- const sharedComponent = action.insert;
635
- const canInsertInlineComponent = slot.schema.includes(ContentType.InlineComponent);
636
- const component = this.createComponentBySharedComponent(sharedComponent, canInsertInlineComponent);
637
- slot.insert(component, remoteFormatsToLocal(this.registry, action.attributes));
638
- this.syncSlots(sharedComponent.get('slots'), component);
639
- this.syncComponent(sharedComponent, component);
640
- }
641
- }
642
- else {
643
- throw collaborateErrorFn('unexpected delta action.');
644
- }
645
- }
646
- return slot;
647
- }
648
- cleanSubscriptionsBySlot(slot) {
649
- this.contentMap.delete(slot);
650
- [this.contentSyncCaches.get(slot), this.slotStateSyncCaches.get(slot)].forEach(fn => {
651
- if (fn) {
652
- fn();
653
- }
654
- });
655
- slot.sliceContent().forEach(i => {
656
- if (typeof i !== 'string') {
657
- this.cleanSubscriptionsByComponent(i);
658
- }
659
- });
660
- }
661
- cleanSubscriptionsByComponent(component) {
662
- [this.slotsSyncCaches.get(component), this.componentStateSyncCaches.get(component)].forEach(fn => {
663
- if (fn) {
664
- fn();
665
- }
666
- });
667
- component.slots.toArray().forEach(slot => {
668
- this.cleanSubscriptionsBySlot(slot);
669
- });
670
- }
671
- };
672
- Collaborate = __decorate([
673
- Injectable(),
674
- __param(0, Inject(HISTORY_STACK_SIZE)),
675
- __metadata("design:paramtypes", [Number, RootComponentRef,
676
- CollaborateCursor,
677
- Controller,
678
- Scheduler,
679
- Translator,
680
- Registry,
681
- Selection,
682
- Starter])
683
- ], Collaborate);
684
- export { Collaborate };
685
- function remoteFormatsToLocal(registry, attrs) {
686
- const formats = [];
687
- if (attrs) {
688
- Object.keys(attrs).forEach(key => {
689
- const formatter = registry.getFormatter(key);
690
- if (formatter) {
691
- formats.push([formatter, attrs[key]]);
692
- }
693
- });
694
- }
695
- return formats;
696
- }
697
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGFib3JhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29sbGFib3JhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsTUFBTSxXQUFXLENBQUE7QUFDOUMsT0FBTyxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFjLE9BQU8sRUFBZ0IsTUFBTSxlQUFlLENBQUE7QUFDckYsT0FBTyxFQUNMLFlBQVksRUFFWixXQUFXLEVBQ1gsVUFBVSxFQUNELFVBQVUsRUFFbkIsa0JBQWtCLEVBQ2xCLFNBQVMsRUFDVCxRQUFRLEVBQ1IsZ0JBQWdCLEVBQ2hCLFNBQVMsRUFDVCxTQUFTLEVBRVQsSUFBSSxFQUNKLE9BQU8sRUFDUCxVQUFVLEVBQ1gsTUFBTSxlQUFlLENBQUE7QUFDdEIsT0FBTyxFQUNMLEtBQUssSUFBSSxNQUFNLEVBQ2YsR0FBRyxJQUFJLElBQUksRUFDWCxHQUFHLElBQU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zY3JpYmUoKCkgPT4ge1xuICAgICAgICBjb25zdCBwYXRocyA9IHRoaXMuc2VsZWN0aW9uLmdldFBhdGhzKClcbiAgICAgICAgdGhpcy5zZWxlY3Rpb25DaGFuZ2VFdmVudC5uZXh0KHBhdGhzKVxuICAgICAgfSksXG4gICAgICB0aGlzLnNjaGVkdWxlci5vbkRvY0NoYW5nZWQucGlwZShcbiAgICAgICAgbWFwKGl0ZW0gPT4ge1xuICAgICAgICAgIHJldHVybiBpdGVtLmZpbHRlcihpID0+IHtcbiAgICAgICAgICAgIHJldHVybiBpLmZyb20gIT09IENoYW5nZU9yaWdpbi5SZW1vdGVcbiAgICAgICAgICB9KVxuICAgICAgICB9KSxcbiAgICAgICAgZmlsdGVyKGl0ZW0gPT4ge1xuICAgICAgICAgIHJldHVybiBpdGVtLmxlbmd0aFxuICAgICAgICB9KVxuICAgICAgKS5zdWJzY3JpYmUoKCkgPT4ge1xuICAgICAgICBjb25zdCB1cGRhdGVzOiBVcGRhdGVbXSA9IFtdXG5cbiAgICAgICAgbGV0IHVwZGF0ZTogVXBkYXRlIHwgbnVsbCA9IG51bGxcblxuICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy51cGRhdGVSZW1vdGVBY3Rpb25zKSB7XG4gICAgICAgICAgaWYgKCF1cGRhdGUpIHtcbiAgICAgICAgICAgIHVwZGF0ZSA9IHtcbiAgICAgICAgICAgICAgcmVjb3JkOiBpdGVtLnJlY29yZCxcbiAgICAgICAgICAgICAgYWN0aW9uczogW11cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHVwZGF0ZXMucHVzaCh1cGRhdGUpXG4gICAgICAgICAgfVxuICAgICAgICAgIGlmICh1cGRhdGUucmVjb3JkID09PSBpdGVtLnJlY29yZCkge1xuICAgICAgICAgICAgdXBkYXRlLmFjdGlvbnMucHVzaChpdGVtLmFjdGlvbilcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdXBkYXRlID0ge1xuICA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ICAgICAgICAgICAgIHNsb3QucmV0YWluKGFjdGlvbi5yZXRhaW4hLCBmb3JtYXRzKVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHNsb3QucmV0YWluKHNsb3QuaW5kZXggKyBhY3Rpb24ucmV0YWluKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgc2xvdC5yZXRhaW4oYWN0aW9uLnJldGFpbilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2UgaWYgKGFjdGlvbi5pbnNlcnQpIHtcbiAgICAgICAgICAgIGNvbnN0IGluZGV4ID0gc2xvdC5pbmRleFxuICAgICAgICAgICAgbGV0IGxlbmd0aCA9IDFcbiAgICAgICAgICAgIGlmICh0eXBlb2YgYWN0aW9uLmluc2VydCA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgbGVuZ3RoID0gYWN0aW9uLmluc2VydC5sZW5ndGhcbiAgICAgICAgICAgICAgc2xvdC5pbnNlcnQoYWN0aW9uLmluc2VydCwgcmVtb3RlRm9ybWF0c1RvTG9jYWwodGhpcy5yZWdpc3RyeSwgYWN0aW9uLmF0dHJpYnV0ZXMpKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkQ29tcG9uZW50ID0gYWN0aW9uLmluc2VydCBhcyBZTWFwPGFueT5cbiAgICAgICAgICAgICAgY29uc3QgY2FuSW5zZXJ0SW5saW5lQ29tcG9uZW50ID0gc2xvdC5zY2hlbWEuaW5jbHVkZXMoQ29udGVudFR5cGUuSW5saW5lQ29tcG9uZW50KVxuICAgICAgICAgICAgICBjb25zdCBjb21wb25lbnQgPSB0aGlzLmNyZWF0ZUNvbXBvbmVudEJ5U2hhcmVkQ29tcG9uZW50KHNoYXJlZENvbXBvbmVudCwgY2FuSW5zZXJ0SW5saW5lQ29tcG9uZW50KVxuICAgICAgICAgICAgICB0aGlzLnN5bmNTbG90cyhzaGFyZWRDb21wb25lbnQuZ2V0KCdzbG90cycpLCBjb21wb25lbnQpXG4gICAgICAgICAgICAgIHRoaXMuc3luY0NvbXBvbmVudChzaGFyZWRDb21wb25lbnQsIGNvbXBvbmVudClcbiAgICAgICAgICAgICAgc2xvdC5pbnNlcnQoY29tcG9uZW50KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuc2VsZWN0aW9uLmlzU2VsZWN0ZWQpIHtcbiAgICAgICAgICAgICAgaWYgKHNsb3QgPT09IHRoaXMuc2VsZWN0aW9uLmFuY2hvclNsb3QgJiYgdGhpcy5zZWxlY3Rpb24uYW5jaG9yT2Zmc2V0ISA+IGluZGV4KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3Rpb24uc2V0QW5jaG9yKHNsb3QsIHRoaXMuc2VsZWN0aW9uLmFuY2hvck9mZnNldCEgKyBsZW5ndGgpXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKHNsb3QgPT09IHRoaXMuc2VsZWN0aW9uLmZvY3VzU2xvdCAmJiB0aGlzLnNlbGVjdGlvbi5mb2N1c09mZnNldCEgPiBpbmRleCkge1xuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLnNldEZvY3VzKHNsb3QsIHRoaXMuc2VsZWN0aW9uLmZvY3VzT2Zmc2V0ISArIGxlbmd0aClcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmRlbGV0ZSkge1xuICAgICAgICAgICAgY29uc3QgaW5kZXggPSBzbG90LmluZGV4XG4gICAgICAgICAgICBzbG90LnJldGFpbihzbG90LmluZGV4KVxuICAgICAgICAgICAgc2xvdC5kZWxldGUoYWN0aW9uLmRlbGV0ZSlcbiAgICAgICAgICAgIGlmICh0aGlzLnNlbGVjdGlvbi5pc1NlbGVjdGVkKSB7XG4gICAgICAgICAgICAgIGlmIChzbG90ID09PSB0aGlzLnNlbGVjdGlvbi5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IHRoaXMucnVuTG9jYWxVcGRhdGUoKCkgPT4ge1xuICAgICAgICBsZXQgb2Zmc2V0ID0gMFxuICAgICAgICBsZXQgbGVuZ3RoID0gMFxuICAgICAgICBmb3IgKGNvbnN0IGFjdGlvbiBvZiBhY3Rpb25zKSB7XG4gICAgICAgICAgaWYgKGFjdGlvbi50eXBlID09PSAncmV0YWluJykge1xuICAgICAgICAgICAgY29uc3QgZm9ybWF0cyA9IGFjdGlvbi5mb3JtYXRzXG4gICAgICAgICAgICBpZiAoZm9ybWF0cykge1xuICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXMoZm9ybWF0cylcbiAgICAgICAgICAgICAgbGV0IGxlbmd0aCA9IGtleXMubGVuZ3RoXG4gICAgICAgICAgICAgIGtleXMuZm9yRWFjaChrZXkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IGZvcm1hdHRlciA9IHRoaXMucmVnaXN0cnkuZ2V0Rm9ybWF0dGVyKGtleSlcbiAgICAgICAgICAgICAgICBpZiAoIWZvcm1hdHRlcikge1xuICAgICAgICAgICAgICAgICAgbGVuZ3RoLS1cbiAgICAgICAgICAgICAgICAgIFJlZmxlY3QuZGVsZXRlUHJvcGVydHkoZm9ybWF0cywga2V5KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgaWYgKGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIGNvbnRlbnQuZm9ybWF0KG9mZnNldCwgYWN0aW9uLm9mZnNldCwgZm9ybWF0cylcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgb2Zmc2V0ID0gYWN0aW9uLm9mZnNldFxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLnR5cGUgPT09ICdpbnNlcnQnKSB7XG4gICAgICAgICAgICBjb25zdCBkZWx0YSA9IGNvbnRlbnQudG9EZWx0YSgpXG4gICAgICAgICAgICBjb25zdCBpc0VtcHR5ID0gZGVsdGEubGVuZ3RoID09PSAxICYmIGRlbHRhWzBdLmluc2VydCA9PT0gU2xvdC5lbXB0eVBsYWNlaG9sZGVyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGFjdGlvbi5jb250ZW50ID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICBsZW5ndGggPSBhY3Rpb24uY29udGVudC5sZW5ndGhcbiAgICAgICAgICAgICAgY29udGVudC5pbnNlcnQob2Zmc2V0LCBhY3Rpb24uY29udGVudCwgYWN0aW9uLmZvcm1hdHMgfHwge30pXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBsZW5ndGggPSAxXG4gICAgICAgICAgICAgIGNvbnN0IHNoYXJlZENvbXBvbmVudCA9IHRoaXMuY3JlYXRlU2hhcmVkQ29tcG9uZW50QnlDb21wb25lbnQoYWN0aW9uLnJlZiBhcyBDb21wb25lbnRJbnN0YW5jZSlcbiAgICAgICAgICAgICAgY29udGVudC5pbnNlcnRFbWJlZChvZmZzZXQsIHNoYXJlZENvbXBvbmVudCwgYWN0aW9uLmZvcm1hdHMgfHwge30pXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpc0VtcHR5ICYmIG9mZnNldCA9PT0gMCkge1xuICAgICAgICAgICAgICBjb250ZW50LmRlbGV0ZShjb250ZW50Lmxlbmd0aCAtIDEsIDEpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBvZmZzZXQgKz0gbGVuZ3RoXG4gICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24udHlwZSA9PT0gJ2RlbGV0ZScpIHtcbiAgICAgICAgICAgIGNvbnN0IGRlbHRhID0gY29udGVudC50b0RlbHRhKClcbiAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCkge1xuICAgICAgICAgICAgICBjb250ZW50LmRlbGV0ZShvZmZzZXQsIGFjdGlvbi5jb3VudClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICBjb250ZW50Lmluc2VydCgwLCAnXFxuJywgZGVsdGFbMF0/LmF0dHJpYnV0ZXMpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9KVxuICAgIH0pXG5cbiAgICBzdWIuYWRkKHNsb3Qub25DaGlsZENvbXBvbmVudFJlbW92ZS5zdWJzY3JpYmUoY29tcG9uZW50cyA9PiB7XG4gICAgICBjb21wb25lbnRzLmZvckVhY2goYyA9PiB7XG4gICAgICAgIHRoaXMuY2xlYW5TdWJzY3JpcHRpb25zQnlDb21wb25lbnQoYylcbiAgICAgIH0pXG4gICAgfSkpXG4gICAgdGhpcy5jb250ZW50U3luY0NhY2hlcy5zZXQoc2xvdCwgKCkgPT4ge1xuICAgICAgY29udGVudC51bm9ic2VydmUoc3luY1JlbW90ZSlcbiAgICAgIHN1Yi51bnN1YnNjcmliZSgpXG4gICAgfSlcbiAgfVxuXG4gIHByb3RlY3RlZCBzeW5jU2xvdChyZW1vdGVTbG90OiBZTWFwPGFueT4sIHNsb3Q6IFNsb3QpIHtcbiAgICBjb25zdCBzeW5jUmVtb3RlID0gKGV2LCB0cikgPT4ge1xuICAgICAgdGhpcy5ydW5SZW1vdGVVcGRhdGUodHIsICgpID0+IHtcbiAgICAgICAgZXYua2V5c0NoYW5nZWQuZm9yRWFjaChrZXkgPT4ge1xuICAgICAgICAgIGlmIChrZXkgPT09ICdzdGF0ZScpIHtcbiAgICAgICAgICAgIGNvbnN0IHN0YXRlID0gKGV2LnRhcmdldCBhcyBZTWFwPGFueT4pLmdldCgnc3RhdGUnKVxuICAgICAgICAgICAgc2xvdC51cGRhdGVTdGF0ZShkcmFmdCA9PiB7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgZHJhZnQgPT09ICdvYmplY3QnICYmIGRyYWZ0ICE9PSBudWxsKSB7XG4gICAgICAgICAg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