@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 CHANGED
@@ -1,10 +1,42 @@
1
1
  # Changelog
2
2
 
3
- ## 0.8.35
3
+ ## 0.8.37
4
4
 
5
5
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
6
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/office/src`.
7
7
 
8
+ ## 0.8.36
9
+
10
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
11
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
12
+ Diff: `git diff ea809490d8 1700d8bdd6 -- apps/shared/office/src`
13
+
14
+ Changed shipped source files (6):
15
+ - `apps/shared/office/src/collab/sheets/comment-anchor-transform.ts`
16
+ - `apps/shared/office/src/collab/sheets/transform/fuzz/corpus.ts`
17
+ - `apps/shared/office/src/collab/sheets/transform/fuzz/seats.ts`
18
+ - `apps/shared/office/src/collab/sheets/transform/registry.ts`
19
+ - `apps/shared/office/src/collab/sheets/transform/transform.ts`
20
+ - `apps/shared/office/src/univer/collab/sheets-ot/room.ts`
21
+
22
+ ## 0.8.35
23
+
24
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
25
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
26
+ Diff: `git diff e3e3414a65 ea809490d8 -- apps/shared/office/src`
27
+
28
+ Changed shipped source files (5):
29
+ - `apps/shared/office/src/collab/sheets/transform/fuzz/seats.ts`
30
+ - `apps/shared/office/src/univer/collab/fold/fold.ts`
31
+ - `apps/shared/office/src/univer/collab/sheets-ot/index.ts`
32
+ - `apps/shared/office/src/univer/collab/sheets-ot/room-plugins.ts`
33
+ - `apps/shared/office/src/univer/collab/sheets-ot/room-presets.ts`
34
+
35
+ ## 0.8.34
36
+
37
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 7b99704de8 e3e3414a65 -- apps/shared/office/src`
38
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
39
+
8
40
  ## 0.8.33
9
41
 
10
42
  **The Documents and Workbooks Trash reads the whole bin.** `listTrashedDocuments` and
@@ -164,6 +164,13 @@ var SHEET_MUTATIONS = {
164
164
  "data-validation.mutation.updateRule": covered("dv", "ruleId", "payload", "source", "derived"),
165
165
  "data-validation.mutation.removeRule": covered("dv", "ruleId", "source", "derived"),
166
166
  "sheet.mutation.set-filter-range": covered("filter", "range", "derived"),
167
+ // C5f: Univer's cell notes. Their transform is built (comment-anchor-transform.ts `transformCellNote`, pairwise and
168
+ // chained fuzz green) but the session fuzz still diverges on note cells (seed 1015, 6 seats: a note at column 5 on
169
+ // one seat, 8 on another), so they stay barriers until that seed is green. Covered form, for the next lane:
170
+ // covered("note", "sheetId", "row", "col", "note" | "noteId", "newPosition", "silent", "derived")
171
+ "sheet.mutation.update-note": barrier("C5c", "cell note: the session fuzz diverges on note cells (seed 1015)"),
172
+ "sheet.mutation.remove-note": barrier("C5c", "cell note: the session fuzz diverges on note cells (seed 1015)"),
173
+ "sheet.mutation.update-note-position": barrier("C5c", "cell note: the session fuzz diverges on note cells (seed 1015)"),
167
174
  "sheet.mutation.set-filter-criteria": covered("filter", "col", "criteria", "reCalc", "derived"),
168
175
  "sheet.mutation.remove-filter": covered("filter", "derived"),
169
176
  "sheet.mutation.add-table": barrier("C5c", RESOURCE),
@@ -176,9 +183,6 @@ var SHEET_MUTATIONS = {
176
183
  "sheets.mutation.update-hyper-link": barrier("C5c", RESOURCE),
177
184
  "sheets.mutation.update-hyper-link-ref": barrier("C5c", RESOURCE),
178
185
  "sheets.mutation.update-rich-hyper-link": barrier("C5c", RESOURCE),
179
- "sheet.mutation.update-note": barrier("C5c", RESOURCE),
180
- "sheet.mutation.remove-note": barrier("C5c", RESOURCE),
181
- "sheet.mutation.update-note-position": barrier("C5c", RESOURCE),
182
186
  "sheet.mutation.set-drawing-apply": barrier("C5c", RESOURCE),
183
187
  "sheet.mutation.set-worksheet-background-image": barrier("C5c", RESOURCE),
184
188
  "sheet.mutation.add-range-theme": barrier("C5c", RESOURCE),
@@ -590,7 +594,88 @@ var label = (m) => {
590
594
  const c = cellOf(m);
591
595
  return `${String(m.params.subUnitId ?? "")}!${c ? sheetCellName(c) : "?"} comment`;
592
596
  };
597
+ var UPDATE_NOTE = "sheet.mutation.update-note";
598
+ var REMOVE_NOTE = "sheet.mutation.remove-note";
599
+ var UPDATE_NOTE_POSITION = "sheet.mutation.update-note-position";
600
+ var NOTE_IDS = /* @__PURE__ */ new Set([UPDATE_NOTE, REMOVE_NOTE, UPDATE_NOTE_POSITION]);
601
+ var isNoteMutation = (id) => NOTE_IDS.has(id);
602
+ var cellAt = (row, col) => typeof row === "number" && typeof col === "number" ? { row, col } : null;
603
+ function noteRef(m) {
604
+ const p = m.params;
605
+ const sheet = String(p.sheetId ?? "");
606
+ if (m.id === UPDATE_NOTE) return { role: "write", sheet, id: p.note?.id ? String(p.note.id) : null, cell: cellAt(p.row, p.col) };
607
+ 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) };
608
+ return { role: "remove", sheet, id: p.noteId ? String(p.noteId) : null, cell: p.noteId ? null : cellAt(p.row, p.col) };
609
+ }
610
+ var noteDerived = (m) => m.params.derived === true;
611
+ var noteLabel = (n) => `${n.sheet}!${n.cell ? sheetCellName(n.cell) : "?"} note`;
612
+ var tellNote = (m, n) => noteDerived(m) ? [] : [noteLabel(n)];
613
+ var noteBarrier = (reason) => ({ barrier: true, reason: `note: ${reason}` });
614
+ var removeNoteOf = (sheet, id) => ({ id: REMOVE_NOTE, params: { sheetId: sheet, noteId: id, derived: true } });
615
+ var moveNoteTo = (sheet, id, cell) => ({
616
+ id: UPDATE_NOTE_POSITION,
617
+ params: { sheetId: sheet, noteId: id, newPosition: { row: cell.row, col: cell.col }, derived: true }
618
+ });
619
+ var onSheet = (m, sheet) => String(m.params.subUnitId ?? "") === sheet;
620
+ function transformCellNote(x, y, side) {
621
+ const xn = isNoteMutation(x.id);
622
+ const yn = isNoteMutation(y.id);
623
+ if (!xn && !yn) return null;
624
+ if (!xn) {
625
+ const n2 = noteRef(y);
626
+ if (n2.role === "remove" || !n2.cell || !onSheet(x, n2.sheet)) return ok([x]);
627
+ if (x.id === REMOVE_SHEET) return n2.id ? ok([removeNoteOf(n2.sheet, n2.id), x]) : ok([x]);
628
+ if (!structuralAxisOp(x.id, x.params)) return ok([x]);
629
+ if (!n2.id) return noteBarrier("a note without an id against a row or column change");
630
+ const moved = moveSheetAnchorCell(n2.cell, n2.sheet, x.id, x.params);
631
+ if (!moved) return ok([x, removeNoteOf(n2.sheet, n2.id)]);
632
+ return moved === n2.cell ? ok([x]) : ok([x, moveNoteTo(n2.sheet, n2.id, moved)]);
633
+ }
634
+ const n = noteRef(x);
635
+ if (!yn) {
636
+ if (!onSheet(y, n.sheet)) return ok([x]);
637
+ if (y.id === REMOVE_SHEET) return ok([], [], tellNote(x, n));
638
+ if (!structuralAxisOp(y.id, y.params)) return ok([x]);
639
+ if (n.role === "write" && !n.id) return noteBarrier("a note without an id against a row or column change");
640
+ const p = x.params;
641
+ const from = cellAt(p.row, p.col);
642
+ const fromMoved = from ? moveSheetAnchorCell(from, n.sheet, y.id, y.params) : null;
643
+ if (n.role === "remove") {
644
+ if (n.id) return ok([x]);
645
+ return fromMoved ? ok([{ id: x.id, params: { ...p, row: fromMoved.row, col: fromMoved.col } }]) : ok([]);
646
+ }
647
+ const moved = n.cell ? moveSheetAnchorCell(n.cell, n.sheet, y.id, y.params) : null;
648
+ if (n.role === "write") {
649
+ if (!moved) return ok([], [], tellNote(x, n));
650
+ return ok([moved === n.cell ? x : { id: x.id, params: { ...p, row: moved.row, col: moved.col } }]);
651
+ }
652
+ if (!moved) return n.id ? ok([removeNoteOf(n.sheet, n.id)], [], tellNote(x, n)) : ok([], [], tellNote(x, n));
653
+ const params = { ...p, newPosition: { ...p.newPosition, row: moved.row, col: moved.col } };
654
+ if (fromMoved) Object.assign(params, { row: fromMoved.row, col: fromMoved.col });
655
+ return ok([{ id: x.id, params }]);
656
+ }
657
+ const m = noteRef(y);
658
+ if (n.sheet !== m.sheet) return ok([x]);
659
+ if (!n.id || !m.id) return noteBarrier("a note change addressed by cell against another note change on its sheet");
660
+ if (n.id !== m.id) {
661
+ const sameCell = n.cell && m.cell && n.cell.row === m.cell.row && n.cell.col === m.cell.col;
662
+ return sameCell ? noteBarrier("two notes written to one cell at once") : ok([x]);
663
+ }
664
+ if (n.role === "remove") return ok([x]);
665
+ if (m.role === "remove") return ok([], [], tellNote(x, n));
666
+ if (n.role === "write" && m.role === "move") {
667
+ return m.cell ? ok([{ id: x.id, params: { ...x.params, row: m.cell.row, col: m.cell.col } }]) : ok([x]);
668
+ }
669
+ if (n.role === "move" && m.role === "write") return ok([x]);
670
+ const dx = noteDerived(x);
671
+ const dy = noteDerived(y);
672
+ if (dx && dy) return ok([x]);
673
+ const xWins = dx !== dy ? !dx : side === "left";
674
+ return xWins ? ok([x], tellNote(y, m)) : ok([], [], tellNote(x, n));
675
+ }
593
676
  function transformCommentAnchor(x, y, side) {
677
+ const note = transformCellNote(x, y, side);
678
+ if (note) return note;
594
679
  const xa = x.id === SET_SHEET_COMMENT_ANCHOR;
595
680
  const ya = y.id === SET_SHEET_COMMENT_ANCHOR;
596
681
  if (!xa && !ya) return null;
@@ -711,7 +796,7 @@ registerRangedResource({
711
796
  });
712
797
 
713
798
  // src/collab/sheets/transform/transform.ts
714
- var SHEET_TRANSFORMER_VERSION = "c5d-1";
799
+ var SHEET_TRANSFORMER_VERSION = "c5f-1";
715
800
  var ID = {
716
801
  values: "sheet.mutation.set-range-values",
717
802
  insertRow: "sheet.mutation.insert-row",
@@ -800,6 +885,21 @@ function buildStructural(template, axis, op) {
800
885
  const start = op.kind === "insert" ? op.at : op.start;
801
886
  return { id: template.id, params: { ...p, range: { ...p.range, [a0]: start, [a1]: start + op.count - 1 } } };
802
887
  }
888
+ function crossThrough(x, sy) {
889
+ const [a0, a1] = S(sy.axis);
890
+ const p = x.params;
891
+ const params = { ...p };
892
+ for (const k of ["range", "sourceRange", "targetRange"]) {
893
+ const r = p[k];
894
+ if (!r || typeof r[a0] !== "number" || typeof r[a1] !== "number") continue;
895
+ const spans = spanThrough(sy.op, r[a0], r[a1]);
896
+ if (!spans.length) continue;
897
+ const lo = r[a0] === 0 ? 0 : Math.min(...spans.map(([l]) => l));
898
+ const hi = Math.max(...spans.map(([, h]) => h));
899
+ params[k] = { ...r, [a0]: lo, [a1]: hi };
900
+ }
901
+ return { id: x.id, params };
902
+ }
803
903
  function univerMutationInfo(axis, op) {
804
904
  const FULL2 = { startRow: 0, endRow: Number.MAX_SAFE_INTEGER, startColumn: 0, endColumn: Number.MAX_SAFE_INTEGER };
805
905
  const start = op.kind === "insert" ? op.at : op.start;
@@ -1523,7 +1623,7 @@ function annotateSheetOpsInOrder(group, sheetOrder) {
1523
1623
  let structural = false;
1524
1624
  return group.map((m0) => {
1525
1625
  if (structuralOf(m0)) structural = true;
1526
- const m = structural && rangedSpecOf(m0.id) && !isDerived(m0) ? { id: m0.id, params: { ...m0.params, derived: true } } : m0;
1626
+ const m = structural && (rangedSpecOf(m0.id) || isNoteMutation(m0.id)) && !isDerived(m0) ? { id: m0.id, params: { ...m0.params, derived: true } } : m0;
1527
1627
  if (m.id === ID.insertSheet) {
1528
1628
  const index = typeof m.params.index === "number" ? Math.min(m.params.index, order.length) : order.length;
1529
1629
  order.splice(index, 0, sheetIdOf(m));
@@ -1770,7 +1870,7 @@ function transformMutation(x, y, side) {
1770
1870
  const np = numfmtPair(x, y, side, sx, sy);
1771
1871
  if (np) return np;
1772
1872
  if (sx && sy) {
1773
- if (sx.axis !== sy.axis) return ok2([x]);
1873
+ if (sx.axis !== sy.axis) return ok2([crossThrough(x, sy)]);
1774
1874
  const out = transformAxis(sx.op, sy.op, side);
1775
1875
  if (!out) return barrier2(`${x.id} over ${y.id}: moved blocks overlap in part, or the block would split`);
1776
1876
  const dropped = out.length === 0 && sx.op.kind === "move" ? [`${sheetOf(x)}: moved ${sx.axis}s`] : [];