@ai-matrx/office 0.8.11 → 0.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/dist/collab-sheets-transform.cjs +457 -39
- package/dist/collab-sheets-transform.cjs.map +1 -1
- package/dist/collab-sheets-transform.d.cts +65 -7
- package/dist/collab-sheets-transform.d.ts +65 -7
- package/dist/collab-sheets-transform.js +463 -36
- package/dist/collab-sheets-transform.js.map +1 -1
- package/dist/docs.cjs +35 -21
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.cts +32 -2
- package/dist/docs.d.ts +32 -2
- package/dist/docs.js +16 -2
- package/dist/docs.js.map +1 -1
- package/dist/univer-collab.cjs +201 -5
- package/dist/univer-collab.cjs.map +1 -1
- package/dist/univer-collab.d.cts +71 -2
- package/dist/univer-collab.d.ts +71 -2
- package/dist/univer-collab.js +201 -5
- package/dist/univer-collab.js.map +1 -1
- package/dist/univer.cjs +4 -0
- package/dist/univer.cjs.map +1 -1
- package/dist/univer.d.cts +3 -1
- package/dist/univer.d.ts +3 -1
- package/dist/univer.js +4 -0
- package/dist/univer.js.map +1 -1
- package/package.json +5 -5
package/dist/docs.cjs
CHANGED
|
@@ -191,13 +191,13 @@ var DocumentModel = (_class = class {
|
|
|
191
191
|
return editor;
|
|
192
192
|
}
|
|
193
193
|
onViewMutation(viewId, info, options) {
|
|
194
|
-
if (this.relaying || _optionalChain([options, 'optionalAccess',
|
|
194
|
+
if (this.relaying || _optionalChain([options, 'optionalAccess', _19 => _19.fromCollab]) || _optionalChain([options, 'optionalAccess', _20 => _20.fromChangeset])) return;
|
|
195
195
|
const view = this.views.get(viewId);
|
|
196
196
|
if (!view || !view.port.editable()) return;
|
|
197
197
|
this.lastEditedView = viewId;
|
|
198
198
|
this.relay(info, viewId);
|
|
199
199
|
for (const listener of this.collabListeners) listener(info, options);
|
|
200
|
-
if (this.otListeners.size && !_optionalChain([options, 'optionalAccess',
|
|
200
|
+
if (this.otListeners.size && !_optionalChain([options, 'optionalAccess', _21 => _21.onlyLocal])) {
|
|
201
201
|
const m = {
|
|
202
202
|
id: info.id,
|
|
203
203
|
params: info.params,
|
|
@@ -226,7 +226,7 @@ var DocumentModel = (_class = class {
|
|
|
226
226
|
try {
|
|
227
227
|
const snap = view.port.snapshot();
|
|
228
228
|
view.pre = snap ? structuredClone(snap) : null;
|
|
229
|
-
} catch (
|
|
229
|
+
} catch (e5) {
|
|
230
230
|
view.pre = null;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -257,8 +257,8 @@ var DocumentModel = (_class = class {
|
|
|
257
257
|
/** The unit id a view's document has (what a replayed mutation must be addressed to). */
|
|
258
258
|
unitIdOf(view) {
|
|
259
259
|
try {
|
|
260
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([view, 'access',
|
|
261
|
-
} catch (
|
|
260
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([view, 'access', _22 => _22.port, 'access', _23 => _23.unitId, 'optionalCall', _24 => _24()]), () => ( _optionalChain([view, 'access', _25 => _25.port, 'access', _26 => _26.snapshot, 'call', _27 => _27(), 'optionalAccess', _28 => _28.id]))), () => ( null));
|
|
261
|
+
} catch (e6) {
|
|
262
262
|
return null;
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -291,7 +291,7 @@ var DocumentModel = (_class = class {
|
|
|
291
291
|
/** A view could not follow an edit: say so, then show the saved version (unless this tab has unsaved edits of its own). */
|
|
292
292
|
applyFailed(mutationId, error) {
|
|
293
293
|
try {
|
|
294
|
-
_optionalChain([this, 'access',
|
|
294
|
+
_optionalChain([this, 'access', _29 => _29.deps, 'access', _30 => _30.onApplyFailed, 'optionalCall', _31 => _31(this.documentId, mutationId, error)]);
|
|
295
295
|
} catch (notifyError) {
|
|
296
296
|
console.warn(`[document-model] the notice for ${this.documentId}'s failed apply also failed`, notifyError);
|
|
297
297
|
}
|
|
@@ -319,7 +319,7 @@ var DocumentModel = (_class = class {
|
|
|
319
319
|
async write(reason) {
|
|
320
320
|
if (this.ot) {
|
|
321
321
|
const wrote = await this.ot.write(reason);
|
|
322
|
-
if (wrote) _optionalChain([this, 'access',
|
|
322
|
+
if (wrote) _optionalChain([this, 'access', _32 => _32.deps, 'access', _33 => _33.onSaved, 'optionalCall', _34 => _34(this.documentId, reason === "manual" ? "manual" : "autosave")]);
|
|
323
323
|
return wrote;
|
|
324
324
|
}
|
|
325
325
|
const snapshot = this.latest();
|
|
@@ -344,7 +344,7 @@ var DocumentModel = (_class = class {
|
|
|
344
344
|
this.saving = false;
|
|
345
345
|
}
|
|
346
346
|
if (this.views.size === 0) this.stored = snapshot;
|
|
347
|
-
_optionalChain([this, 'access',
|
|
347
|
+
_optionalChain([this, 'access', _35 => _35.deps, 'access', _36 => _36.onSaved, 'optionalCall', _37 => _37(this.documentId, origin)]);
|
|
348
348
|
return true;
|
|
349
349
|
}
|
|
350
350
|
hasUnsaved() {
|
|
@@ -387,7 +387,7 @@ var DocumentModel = (_class = class {
|
|
|
387
387
|
replaceContent(row) {
|
|
388
388
|
if (this.ot) return this.ot.replace(row.snapshot);
|
|
389
389
|
this.show(row);
|
|
390
|
-
_optionalChain([this, 'access',
|
|
390
|
+
_optionalChain([this, 'access', _38 => _38.collab, 'optionalAccess', _39 => _39.announceReplaced, 'call', _40 => _40(row.id)]);
|
|
391
391
|
}
|
|
392
392
|
/** A peer replaced the document: show the newest save (once). */
|
|
393
393
|
async onPeerReplaced() {
|
|
@@ -410,7 +410,7 @@ var DocumentModel = (_class = class {
|
|
|
410
410
|
this.relaying = true;
|
|
411
411
|
try {
|
|
412
412
|
for (const view of this.views.values()) view.port.remount(snapshot);
|
|
413
|
-
_optionalChain([this, 'access',
|
|
413
|
+
_optionalChain([this, 'access', _41 => _41.parked, 'optionalAccess', _42 => _42.remount, 'call', _43 => _43(snapshot)]);
|
|
414
414
|
} finally {
|
|
415
415
|
this.relaying = false;
|
|
416
416
|
}
|
|
@@ -484,8 +484,8 @@ var DocumentModel = (_class = class {
|
|
|
484
484
|
const input = Array.isArray(params.actions) ? params.actions.length : 0;
|
|
485
485
|
let sel = null;
|
|
486
486
|
try {
|
|
487
|
-
sel = _nullishCoalesce(_optionalChain([view, 'access',
|
|
488
|
-
} catch (
|
|
487
|
+
sel = _nullishCoalesce(_optionalChain([view, 'access', _44 => _44.port, 'access', _45 => _45.selection, 'optionalAccess', _46 => _46.get, 'call', _47 => _47()]), () => ( null));
|
|
488
|
+
} catch (e7) {
|
|
489
489
|
sel = null;
|
|
490
490
|
}
|
|
491
491
|
const p = { ...params, ...unitId ? { unitId } : {}, textRanges: null, noNeedSetTextRange: true };
|
|
@@ -495,7 +495,7 @@ var DocumentModel = (_class = class {
|
|
|
495
495
|
const moved = sel && sel.length && sel.every((r) => !r.segmentId) ? moveRangesThroughBodyEdit(sel, params.actions) : null;
|
|
496
496
|
if (moved) {
|
|
497
497
|
try {
|
|
498
|
-
_optionalChain([view, 'access',
|
|
498
|
+
_optionalChain([view, 'access', _48 => _48.port, 'access', _49 => _49.selection, 'optionalAccess', _50 => _50.set, 'call', _51 => _51(moved)]);
|
|
499
499
|
} catch (error) {
|
|
500
500
|
console.warn(`[document-model] could not move this view's caret past a collaborator's edit`, error);
|
|
501
501
|
}
|
|
@@ -514,7 +514,7 @@ var DocumentModel = (_class = class {
|
|
|
514
514
|
this.relaying = true;
|
|
515
515
|
try {
|
|
516
516
|
for (const view of this.views.values()) view.port.remount(s2);
|
|
517
|
-
_optionalChain([this, 'access',
|
|
517
|
+
_optionalChain([this, 'access', _52 => _52.parked, 'optionalAccess', _53 => _53.remount, 'call', _54 => _54(s2)]);
|
|
518
518
|
} finally {
|
|
519
519
|
this.relaying = false;
|
|
520
520
|
}
|
|
@@ -523,12 +523,22 @@ var DocumentModel = (_class = class {
|
|
|
523
523
|
const out = [];
|
|
524
524
|
for (const view of this.views.values()) {
|
|
525
525
|
const unitId = this.unitIdOf(view);
|
|
526
|
-
const service = _optionalChain([view, 'access',
|
|
526
|
+
const service = _optionalChain([view, 'access', _55 => _55.port, 'access', _56 => _56.undoRedo, 'optionalCall', _57 => _57()]);
|
|
527
527
|
if (unitId && service) out.push({ service, unitId });
|
|
528
528
|
}
|
|
529
529
|
return out;
|
|
530
530
|
},
|
|
531
|
-
markDirty: () => this.markDirty()
|
|
531
|
+
markDirty: () => this.markDirty(),
|
|
532
|
+
selection: () => {
|
|
533
|
+
for (const view of this.views.values()) {
|
|
534
|
+
try {
|
|
535
|
+
const sel = _optionalChain([view, 'access', _58 => _58.port, 'access', _59 => _59.selection, 'optionalAccess', _60 => _60.get, 'call', _61 => _61()]);
|
|
536
|
+
if (sel) return sel;
|
|
537
|
+
} catch (e8) {
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
532
542
|
}}
|
|
533
543
|
/** Join the document's ordered-log room once (C3). Exclusive with `startCollab`. */
|
|
534
544
|
startOtRoom(factory) {
|
|
@@ -581,9 +591,9 @@ var DocumentModel = (_class = class {
|
|
|
581
591
|
* so a collaborator's save still reaches the body a returning view boots from.
|
|
582
592
|
*/
|
|
583
593
|
rest() {
|
|
584
|
-
_optionalChain([this, 'access',
|
|
594
|
+
_optionalChain([this, 'access', _62 => _62.collab, 'optionalAccess', _63 => _63.stop, 'call', _64 => _64()]);
|
|
585
595
|
this.collab = null;
|
|
586
|
-
_optionalChain([this, 'access',
|
|
596
|
+
_optionalChain([this, 'access', _65 => _65.ot, 'optionalAccess', _66 => _66.stop, 'call', _67 => _67()]);
|
|
587
597
|
this.ot = null;
|
|
588
598
|
this.awareness = null;
|
|
589
599
|
}
|
|
@@ -599,9 +609,9 @@ var DocumentModel = (_class = class {
|
|
|
599
609
|
console.warn(`[document-model] could not dispose ${this.documentId}'s kept editor`, error);
|
|
600
610
|
}
|
|
601
611
|
}
|
|
602
|
-
_optionalChain([this, 'access',
|
|
612
|
+
_optionalChain([this, 'access', _68 => _68.realtimeClose, 'optionalCall', _69 => _69()]);
|
|
603
613
|
this.realtimeClose = null;
|
|
604
|
-
_optionalChain([this, 'access',
|
|
614
|
+
_optionalChain([this, 'access', _70 => _70.pageClose, 'optionalCall', _71 => _71()]);
|
|
605
615
|
this.pageClose = null;
|
|
606
616
|
}
|
|
607
617
|
}, _class);
|
|
@@ -611,7 +621,11 @@ function moveRangesThroughBodyEdit(ranges, actions) {
|
|
|
611
621
|
const sub = a[1];
|
|
612
622
|
if (!sub || sub.et !== "text-x" || !Array.isArray(sub.e)) return null;
|
|
613
623
|
const e2 = sub.e;
|
|
614
|
-
return ranges.map((r) =>
|
|
624
|
+
return ranges.map((r) => {
|
|
625
|
+
const collapsed = r.startOffset === r.endOffset;
|
|
626
|
+
const startOffset = _core.TextX.transformPosition(e2, r.startOffset, collapsed);
|
|
627
|
+
return { startOffset, endOffset: collapsed ? startOffset : _core.TextX.transformPosition(e2, r.endOffset, true) };
|
|
628
|
+
});
|
|
615
629
|
}
|
|
616
630
|
function contentFingerprint(snapshot) {
|
|
617
631
|
const { id: _id, rev: _rev, ...content } = snapshot;
|