@ai-matrx/office 0.8.35 → 0.8.37
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 +33 -1
- package/dist/collab-sheets-transform.cjs +106 -6
- package/dist/collab-sheets-transform.cjs.map +1 -1
- package/dist/collab-sheets-transform.d.cts +2 -2
- package/dist/collab-sheets-transform.d.ts +2 -2
- package/dist/collab-sheets-transform.js +106 -6
- package/dist/collab-sheets-transform.js.map +1 -1
- package/dist/sheets-comment-anchors.cjs.map +1 -1
- package/dist/sheets-comment-anchors.d.cts +15 -0
- package/dist/sheets-comment-anchors.d.ts +15 -0
- package/dist/sheets-comment-anchors.js.map +1 -1
- package/dist/univer-collab.cjs +108 -8
- package/dist/univer-collab.cjs.map +1 -1
- package/dist/univer-collab.d.cts +1 -1
- package/dist/univer-collab.d.ts +1 -1
- package/dist/univer-collab.js +108 -8
- package/dist/univer-collab.js.map +1 -1
- package/package.json +3 -3
package/dist/univer-collab.d.cts
CHANGED
|
@@ -569,7 +569,7 @@ type SheetOp = SheetMutation[] | null;
|
|
|
569
569
|
* The room's protocol (§6.4): Univer 1.0.4 + transformer `SHEET_TRANSFORMER_VERSION`. Any Univer or transformer
|
|
570
570
|
* change raises it; a room at another proto opens read-only for this build.
|
|
571
571
|
*/
|
|
572
|
-
declare const SHEETS_COLLAB_PROTO =
|
|
572
|
+
declare const SHEETS_COLLAB_PROTO = 4;
|
|
573
573
|
/**
|
|
574
574
|
* Every Sheets protocol this package still reads (the fold, the server): each proto's transforms are a superset of
|
|
575
575
|
* the one before, so a room still at an older protocol folds here. Raising the proto appends, never replaces.
|
package/dist/univer-collab.d.ts
CHANGED
|
@@ -569,7 +569,7 @@ type SheetOp = SheetMutation[] | null;
|
|
|
569
569
|
* The room's protocol (§6.4): Univer 1.0.4 + transformer `SHEET_TRANSFORMER_VERSION`. Any Univer or transformer
|
|
570
570
|
* change raises it; a room at another proto opens read-only for this build.
|
|
571
571
|
*/
|
|
572
|
-
declare const SHEETS_COLLAB_PROTO =
|
|
572
|
+
declare const SHEETS_COLLAB_PROTO = 4;
|
|
573
573
|
/**
|
|
574
574
|
* Every Sheets protocol this package still reads (the fold, the server): each proto's transforms are a superset of
|
|
575
575
|
* the one before, so a room still at an older protocol folds here. Raising the proto appends, never replaces.
|
package/dist/univer-collab.js
CHANGED
|
@@ -1824,6 +1824,13 @@ var SHEET_MUTATIONS = {
|
|
|
1824
1824
|
"data-validation.mutation.updateRule": covered("dv", "ruleId", "payload", "source", "derived"),
|
|
1825
1825
|
"data-validation.mutation.removeRule": covered("dv", "ruleId", "source", "derived"),
|
|
1826
1826
|
"sheet.mutation.set-filter-range": covered("filter", "range", "derived"),
|
|
1827
|
+
// C5f: Univer's cell notes. Their transform is built (comment-anchor-transform.ts `transformCellNote`, pairwise and
|
|
1828
|
+
// chained fuzz green) but the session fuzz still diverges on note cells (seed 1015, 6 seats: a note at column 5 on
|
|
1829
|
+
// one seat, 8 on another), so they stay barriers until that seed is green. Covered form, for the next lane:
|
|
1830
|
+
// covered("note", "sheetId", "row", "col", "note" | "noteId", "newPosition", "silent", "derived")
|
|
1831
|
+
"sheet.mutation.update-note": barrier("C5c", "cell note: the session fuzz diverges on note cells (seed 1015)"),
|
|
1832
|
+
"sheet.mutation.remove-note": barrier("C5c", "cell note: the session fuzz diverges on note cells (seed 1015)"),
|
|
1833
|
+
"sheet.mutation.update-note-position": barrier("C5c", "cell note: the session fuzz diverges on note cells (seed 1015)"),
|
|
1827
1834
|
"sheet.mutation.set-filter-criteria": covered("filter", "col", "criteria", "reCalc", "derived"),
|
|
1828
1835
|
"sheet.mutation.remove-filter": covered("filter", "derived"),
|
|
1829
1836
|
"sheet.mutation.add-table": barrier("C5c", RESOURCE),
|
|
@@ -1836,9 +1843,6 @@ var SHEET_MUTATIONS = {
|
|
|
1836
1843
|
"sheets.mutation.update-hyper-link": barrier("C5c", RESOURCE),
|
|
1837
1844
|
"sheets.mutation.update-hyper-link-ref": barrier("C5c", RESOURCE),
|
|
1838
1845
|
"sheets.mutation.update-rich-hyper-link": barrier("C5c", RESOURCE),
|
|
1839
|
-
"sheet.mutation.update-note": barrier("C5c", RESOURCE),
|
|
1840
|
-
"sheet.mutation.remove-note": barrier("C5c", RESOURCE),
|
|
1841
|
-
"sheet.mutation.update-note-position": barrier("C5c", RESOURCE),
|
|
1842
1846
|
"sheet.mutation.set-drawing-apply": barrier("C5c", RESOURCE),
|
|
1843
1847
|
"sheet.mutation.set-worksheet-background-image": barrier("C5c", RESOURCE),
|
|
1844
1848
|
"sheet.mutation.add-range-theme": barrier("C5c", RESOURCE),
|
|
@@ -2262,7 +2266,88 @@ var label = (m) => {
|
|
|
2262
2266
|
const c = cellOf(m);
|
|
2263
2267
|
return `${String(m.params.subUnitId ?? "")}!${c ? sheetCellName(c) : "?"} comment`;
|
|
2264
2268
|
};
|
|
2269
|
+
var UPDATE_NOTE = "sheet.mutation.update-note";
|
|
2270
|
+
var REMOVE_NOTE = "sheet.mutation.remove-note";
|
|
2271
|
+
var UPDATE_NOTE_POSITION = "sheet.mutation.update-note-position";
|
|
2272
|
+
var NOTE_IDS = /* @__PURE__ */ new Set([UPDATE_NOTE, REMOVE_NOTE, UPDATE_NOTE_POSITION]);
|
|
2273
|
+
var isNoteMutation = (id) => NOTE_IDS.has(id);
|
|
2274
|
+
var cellAt = (row, col) => typeof row === "number" && typeof col === "number" ? { row, col } : null;
|
|
2275
|
+
function noteRef(m) {
|
|
2276
|
+
const p = m.params;
|
|
2277
|
+
const sheet = String(p.sheetId ?? "");
|
|
2278
|
+
if (m.id === UPDATE_NOTE) return { role: "write", sheet, id: p.note?.id ? String(p.note.id) : null, cell: cellAt(p.row, p.col) };
|
|
2279
|
+
if (m.id === UPDATE_NOTE_POSITION) return { role: "move", sheet, id: p.noteId ? String(p.noteId) : null, cell: cellAt(p.newPosition?.row, p.newPosition?.col) };
|
|
2280
|
+
return { role: "remove", sheet, id: p.noteId ? String(p.noteId) : null, cell: p.noteId ? null : cellAt(p.row, p.col) };
|
|
2281
|
+
}
|
|
2282
|
+
var noteDerived = (m) => m.params.derived === true;
|
|
2283
|
+
var noteLabel = (n) => `${n.sheet}!${n.cell ? sheetCellName(n.cell) : "?"} note`;
|
|
2284
|
+
var tellNote = (m, n) => noteDerived(m) ? [] : [noteLabel(n)];
|
|
2285
|
+
var noteBarrier = (reason) => ({ barrier: true, reason: `note: ${reason}` });
|
|
2286
|
+
var removeNoteOf = (sheet, id) => ({ id: REMOVE_NOTE, params: { sheetId: sheet, noteId: id, derived: true } });
|
|
2287
|
+
var moveNoteTo = (sheet, id, cell) => ({
|
|
2288
|
+
id: UPDATE_NOTE_POSITION,
|
|
2289
|
+
params: { sheetId: sheet, noteId: id, newPosition: { row: cell.row, col: cell.col }, derived: true }
|
|
2290
|
+
});
|
|
2291
|
+
var onSheet = (m, sheet) => String(m.params.subUnitId ?? "") === sheet;
|
|
2292
|
+
function transformCellNote(x, y, side) {
|
|
2293
|
+
const xn = isNoteMutation(x.id);
|
|
2294
|
+
const yn = isNoteMutation(y.id);
|
|
2295
|
+
if (!xn && !yn) return null;
|
|
2296
|
+
if (!xn) {
|
|
2297
|
+
const n2 = noteRef(y);
|
|
2298
|
+
if (n2.role === "remove" || !n2.cell || !onSheet(x, n2.sheet)) return ok([x]);
|
|
2299
|
+
if (x.id === REMOVE_SHEET) return n2.id ? ok([removeNoteOf(n2.sheet, n2.id), x]) : ok([x]);
|
|
2300
|
+
if (!structuralAxisOp(x.id, x.params)) return ok([x]);
|
|
2301
|
+
if (!n2.id) return noteBarrier("a note without an id against a row or column change");
|
|
2302
|
+
const moved = moveSheetAnchorCell(n2.cell, n2.sheet, x.id, x.params);
|
|
2303
|
+
if (!moved) return ok([x, removeNoteOf(n2.sheet, n2.id)]);
|
|
2304
|
+
return moved === n2.cell ? ok([x]) : ok([x, moveNoteTo(n2.sheet, n2.id, moved)]);
|
|
2305
|
+
}
|
|
2306
|
+
const n = noteRef(x);
|
|
2307
|
+
if (!yn) {
|
|
2308
|
+
if (!onSheet(y, n.sheet)) return ok([x]);
|
|
2309
|
+
if (y.id === REMOVE_SHEET) return ok([], [], tellNote(x, n));
|
|
2310
|
+
if (!structuralAxisOp(y.id, y.params)) return ok([x]);
|
|
2311
|
+
if (n.role === "write" && !n.id) return noteBarrier("a note without an id against a row or column change");
|
|
2312
|
+
const p = x.params;
|
|
2313
|
+
const from = cellAt(p.row, p.col);
|
|
2314
|
+
const fromMoved = from ? moveSheetAnchorCell(from, n.sheet, y.id, y.params) : null;
|
|
2315
|
+
if (n.role === "remove") {
|
|
2316
|
+
if (n.id) return ok([x]);
|
|
2317
|
+
return fromMoved ? ok([{ id: x.id, params: { ...p, row: fromMoved.row, col: fromMoved.col } }]) : ok([]);
|
|
2318
|
+
}
|
|
2319
|
+
const moved = n.cell ? moveSheetAnchorCell(n.cell, n.sheet, y.id, y.params) : null;
|
|
2320
|
+
if (n.role === "write") {
|
|
2321
|
+
if (!moved) return ok([], [], tellNote(x, n));
|
|
2322
|
+
return ok([moved === n.cell ? x : { id: x.id, params: { ...p, row: moved.row, col: moved.col } }]);
|
|
2323
|
+
}
|
|
2324
|
+
if (!moved) return n.id ? ok([removeNoteOf(n.sheet, n.id)], [], tellNote(x, n)) : ok([], [], tellNote(x, n));
|
|
2325
|
+
const params = { ...p, newPosition: { ...p.newPosition, row: moved.row, col: moved.col } };
|
|
2326
|
+
if (fromMoved) Object.assign(params, { row: fromMoved.row, col: fromMoved.col });
|
|
2327
|
+
return ok([{ id: x.id, params }]);
|
|
2328
|
+
}
|
|
2329
|
+
const m = noteRef(y);
|
|
2330
|
+
if (n.sheet !== m.sheet) return ok([x]);
|
|
2331
|
+
if (!n.id || !m.id) return noteBarrier("a note change addressed by cell against another note change on its sheet");
|
|
2332
|
+
if (n.id !== m.id) {
|
|
2333
|
+
const sameCell = n.cell && m.cell && n.cell.row === m.cell.row && n.cell.col === m.cell.col;
|
|
2334
|
+
return sameCell ? noteBarrier("two notes written to one cell at once") : ok([x]);
|
|
2335
|
+
}
|
|
2336
|
+
if (n.role === "remove") return ok([x]);
|
|
2337
|
+
if (m.role === "remove") return ok([], [], tellNote(x, n));
|
|
2338
|
+
if (n.role === "write" && m.role === "move") {
|
|
2339
|
+
return m.cell ? ok([{ id: x.id, params: { ...x.params, row: m.cell.row, col: m.cell.col } }]) : ok([x]);
|
|
2340
|
+
}
|
|
2341
|
+
if (n.role === "move" && m.role === "write") return ok([x]);
|
|
2342
|
+
const dx = noteDerived(x);
|
|
2343
|
+
const dy = noteDerived(y);
|
|
2344
|
+
if (dx && dy) return ok([x]);
|
|
2345
|
+
const xWins = dx !== dy ? !dx : side === "left";
|
|
2346
|
+
return xWins ? ok([x], tellNote(y, m)) : ok([], [], tellNote(x, n));
|
|
2347
|
+
}
|
|
2265
2348
|
function transformCommentAnchor(x, y, side) {
|
|
2349
|
+
const note = transformCellNote(x, y, side);
|
|
2350
|
+
if (note) return note;
|
|
2266
2351
|
const xa = x.id === SET_SHEET_COMMENT_ANCHOR;
|
|
2267
2352
|
const ya = y.id === SET_SHEET_COMMENT_ANCHOR;
|
|
2268
2353
|
if (!xa && !ya) return null;
|
|
@@ -2383,7 +2468,7 @@ registerRangedResource({
|
|
|
2383
2468
|
});
|
|
2384
2469
|
|
|
2385
2470
|
// src/collab/sheets/transform/transform.ts
|
|
2386
|
-
var SHEET_TRANSFORMER_VERSION = "
|
|
2471
|
+
var SHEET_TRANSFORMER_VERSION = "c5f-1";
|
|
2387
2472
|
var ID = {
|
|
2388
2473
|
values: "sheet.mutation.set-range-values",
|
|
2389
2474
|
insertRow: "sheet.mutation.insert-row",
|
|
@@ -2472,6 +2557,21 @@ function buildStructural(template, axis, op) {
|
|
|
2472
2557
|
const start = op.kind === "insert" ? op.at : op.start;
|
|
2473
2558
|
return { id: template.id, params: { ...p, range: { ...p.range, [a0]: start, [a1]: start + op.count - 1 } } };
|
|
2474
2559
|
}
|
|
2560
|
+
function crossThrough(x, sy) {
|
|
2561
|
+
const [a0, a1] = S(sy.axis);
|
|
2562
|
+
const p = x.params;
|
|
2563
|
+
const params = { ...p };
|
|
2564
|
+
for (const k of ["range", "sourceRange", "targetRange"]) {
|
|
2565
|
+
const r = p[k];
|
|
2566
|
+
if (!r || typeof r[a0] !== "number" || typeof r[a1] !== "number") continue;
|
|
2567
|
+
const spans = spanThrough(sy.op, r[a0], r[a1]);
|
|
2568
|
+
if (!spans.length) continue;
|
|
2569
|
+
const lo = r[a0] === 0 ? 0 : Math.min(...spans.map(([l]) => l));
|
|
2570
|
+
const hi = Math.max(...spans.map(([, h]) => h));
|
|
2571
|
+
params[k] = { ...r, [a0]: lo, [a1]: hi };
|
|
2572
|
+
}
|
|
2573
|
+
return { id: x.id, params };
|
|
2574
|
+
}
|
|
2475
2575
|
function univerMutationInfo(axis, op) {
|
|
2476
2576
|
const FULL2 = { startRow: 0, endRow: Number.MAX_SAFE_INTEGER, startColumn: 0, endColumn: Number.MAX_SAFE_INTEGER };
|
|
2477
2577
|
const start = op.kind === "insert" ? op.at : op.start;
|
|
@@ -3195,7 +3295,7 @@ function annotateSheetOpsInOrder(group, sheetOrder) {
|
|
|
3195
3295
|
let structural = false;
|
|
3196
3296
|
return group.map((m0) => {
|
|
3197
3297
|
if (structuralOf(m0)) structural = true;
|
|
3198
|
-
const m = structural && rangedSpecOf(m0.id) && !isDerived(m0) ? { id: m0.id, params: { ...m0.params, derived: true } } : m0;
|
|
3298
|
+
const m = structural && (rangedSpecOf(m0.id) || isNoteMutation(m0.id)) && !isDerived(m0) ? { id: m0.id, params: { ...m0.params, derived: true } } : m0;
|
|
3199
3299
|
if (m.id === ID.insertSheet) {
|
|
3200
3300
|
const index = typeof m.params.index === "number" ? Math.min(m.params.index, order.length) : order.length;
|
|
3201
3301
|
order.splice(index, 0, sheetIdOf(m));
|
|
@@ -3442,7 +3542,7 @@ function transformMutation(x, y, side) {
|
|
|
3442
3542
|
const np = numfmtPair(x, y, side, sx, sy);
|
|
3443
3543
|
if (np) return np;
|
|
3444
3544
|
if (sx && sy) {
|
|
3445
|
-
if (sx.axis !== sy.axis) return ok2([x]);
|
|
3545
|
+
if (sx.axis !== sy.axis) return ok2([crossThrough(x, sy)]);
|
|
3446
3546
|
const out = transformAxis(sx.op, sy.op, side);
|
|
3447
3547
|
if (!out) return barrier2(`${x.id} over ${y.id}: moved blocks overlap in part, or the block would split`);
|
|
3448
3548
|
const dropped = out.length === 0 && sx.op.kind === "move" ? [`${sheetOf(x)}: moved ${sx.axis}s`] : [];
|
|
@@ -3664,8 +3764,8 @@ async function sheetsStateHash(snapshot) {
|
|
|
3664
3764
|
}
|
|
3665
3765
|
|
|
3666
3766
|
// src/univer/collab/sheets-ot/room.ts
|
|
3667
|
-
var SHEETS_COLLAB_PROTO =
|
|
3668
|
-
var SHEETS_READABLE_PROTOS = [2, SHEETS_COLLAB_PROTO];
|
|
3767
|
+
var SHEETS_COLLAB_PROTO = 4;
|
|
3768
|
+
var SHEETS_READABLE_PROTOS = [2, 3, SHEETS_COLLAB_PROTO];
|
|
3669
3769
|
var SHEETS_EDIT_GROUP = "sheets.edit";
|
|
3670
3770
|
var flip2 = (side) => side === "left" ? "right" : "left";
|
|
3671
3771
|
var isNoopSheetOp = (op) => op == null || op.length === 0;
|