@ai-matrx/office 0.8.34 → 0.8.36

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,28 @@
1
1
  # Changelog
2
2
 
3
- ## 0.8.34
3
+ ## 0.8.36
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.35
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 e3e3414a65 ea809490d8 -- apps/shared/office/src`
13
+
14
+ Changed shipped source files (5):
15
+ - `apps/shared/office/src/collab/sheets/transform/fuzz/seats.ts`
16
+ - `apps/shared/office/src/univer/collab/fold/fold.ts`
17
+ - `apps/shared/office/src/univer/collab/sheets-ot/index.ts`
18
+ - `apps/shared/office/src/univer/collab/sheets-ot/room-plugins.ts`
19
+ - `apps/shared/office/src/univer/collab/sheets-ot/room-presets.ts`
20
+
21
+ ## 0.8.34
22
+
23
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 7b99704de8 e3e3414a65 -- apps/shared/office/src`
24
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
25
+
8
26
  ## 0.8.33
9
27
 
10
28
  **The Documents and Workbooks Trash reads the whole bin.** `listTrashedDocuments` and
@@ -164,6 +164,10 @@ 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, keyed by note id, anchored to one cell (their transform: comment-anchor-transform.ts)
168
+ "sheet.mutation.update-note": covered("note", "sheetId", "row", "col", "note", "silent", "derived"),
169
+ "sheet.mutation.remove-note": covered("note", "sheetId", "noteId", "row", "col", "silent", "derived"),
170
+ "sheet.mutation.update-note-position": covered("note", "sheetId", "noteId", "row", "col", "newPosition", "silent", "derived"),
167
171
  "sheet.mutation.set-filter-criteria": covered("filter", "col", "criteria", "reCalc", "derived"),
168
172
  "sheet.mutation.remove-filter": covered("filter", "derived"),
169
173
  "sheet.mutation.add-table": barrier("C5c", RESOURCE),
@@ -176,9 +180,6 @@ var SHEET_MUTATIONS = {
176
180
  "sheets.mutation.update-hyper-link": barrier("C5c", RESOURCE),
177
181
  "sheets.mutation.update-hyper-link-ref": barrier("C5c", RESOURCE),
178
182
  "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
183
  "sheet.mutation.set-drawing-apply": barrier("C5c", RESOURCE),
183
184
  "sheet.mutation.set-worksheet-background-image": barrier("C5c", RESOURCE),
184
185
  "sheet.mutation.add-range-theme": barrier("C5c", RESOURCE),
@@ -590,7 +591,88 @@ var label = (m) => {
590
591
  const c = cellOf(m);
591
592
  return `${String(m.params.subUnitId ?? "")}!${c ? sheetCellName(c) : "?"} comment`;
592
593
  };
594
+ var UPDATE_NOTE = "sheet.mutation.update-note";
595
+ var REMOVE_NOTE = "sheet.mutation.remove-note";
596
+ var UPDATE_NOTE_POSITION = "sheet.mutation.update-note-position";
597
+ var NOTE_IDS = /* @__PURE__ */ new Set([UPDATE_NOTE, REMOVE_NOTE, UPDATE_NOTE_POSITION]);
598
+ var isNoteMutation = (id) => NOTE_IDS.has(id);
599
+ var cellAt = (row, col) => typeof row === "number" && typeof col === "number" ? { row, col } : null;
600
+ function noteRef(m) {
601
+ const p = m.params;
602
+ const sheet = String(p.sheetId ?? "");
603
+ if (m.id === UPDATE_NOTE) return { role: "write", sheet, id: p.note?.id ? String(p.note.id) : null, cell: cellAt(p.row, p.col) };
604
+ 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) };
605
+ return { role: "remove", sheet, id: p.noteId ? String(p.noteId) : null, cell: p.noteId ? null : cellAt(p.row, p.col) };
606
+ }
607
+ var noteDerived = (m) => m.params.derived === true;
608
+ var noteLabel = (n) => `${n.sheet}!${n.cell ? sheetCellName(n.cell) : "?"} note`;
609
+ var tellNote = (m, n) => noteDerived(m) ? [] : [noteLabel(n)];
610
+ var noteBarrier = (reason) => ({ barrier: true, reason: `note: ${reason}` });
611
+ var removeNoteOf = (sheet, id) => ({ id: REMOVE_NOTE, params: { sheetId: sheet, noteId: id, derived: true } });
612
+ var moveNoteTo = (sheet, id, cell) => ({
613
+ id: UPDATE_NOTE_POSITION,
614
+ params: { sheetId: sheet, noteId: id, newPosition: { row: cell.row, col: cell.col }, derived: true }
615
+ });
616
+ var onSheet = (m, sheet) => String(m.params.subUnitId ?? "") === sheet;
617
+ function transformCellNote(x, y, side) {
618
+ const xn = isNoteMutation(x.id);
619
+ const yn = isNoteMutation(y.id);
620
+ if (!xn && !yn) return null;
621
+ if (!xn) {
622
+ const n2 = noteRef(y);
623
+ if (n2.role === "remove" || !n2.cell || !onSheet(x, n2.sheet)) return ok([x]);
624
+ if (x.id === REMOVE_SHEET) return n2.id ? ok([removeNoteOf(n2.sheet, n2.id), x]) : ok([x]);
625
+ if (!structuralAxisOp(x.id, x.params)) return ok([x]);
626
+ if (!n2.id) return noteBarrier("a note without an id against a row or column change");
627
+ const moved = moveSheetAnchorCell(n2.cell, n2.sheet, x.id, x.params);
628
+ if (!moved) return ok([x, removeNoteOf(n2.sheet, n2.id)]);
629
+ return moved === n2.cell ? ok([x]) : ok([x, moveNoteTo(n2.sheet, n2.id, moved)]);
630
+ }
631
+ const n = noteRef(x);
632
+ if (!yn) {
633
+ if (!onSheet(y, n.sheet)) return ok([x]);
634
+ if (y.id === REMOVE_SHEET) return ok([], [], tellNote(x, n));
635
+ if (!structuralAxisOp(y.id, y.params)) return ok([x]);
636
+ if (n.role === "write" && !n.id) return noteBarrier("a note without an id against a row or column change");
637
+ const p = x.params;
638
+ const from = cellAt(p.row, p.col);
639
+ const fromMoved = from ? moveSheetAnchorCell(from, n.sheet, y.id, y.params) : null;
640
+ if (n.role === "remove") {
641
+ if (n.id) return ok([x]);
642
+ return fromMoved ? ok([{ id: x.id, params: { ...p, row: fromMoved.row, col: fromMoved.col } }]) : ok([]);
643
+ }
644
+ const moved = n.cell ? moveSheetAnchorCell(n.cell, n.sheet, y.id, y.params) : null;
645
+ if (n.role === "write") {
646
+ if (!moved) return ok([], [], tellNote(x, n));
647
+ return ok([moved === n.cell ? x : { id: x.id, params: { ...p, row: moved.row, col: moved.col } }]);
648
+ }
649
+ if (!moved) return n.id ? ok([removeNoteOf(n.sheet, n.id)], [], tellNote(x, n)) : ok([], [], tellNote(x, n));
650
+ const params = { ...p, newPosition: { ...p.newPosition, row: moved.row, col: moved.col } };
651
+ if (fromMoved) Object.assign(params, { row: fromMoved.row, col: fromMoved.col });
652
+ return ok([{ id: x.id, params }]);
653
+ }
654
+ const m = noteRef(y);
655
+ if (n.sheet !== m.sheet) return ok([x]);
656
+ if (!n.id || !m.id) return noteBarrier("a note change addressed by cell against another note change on its sheet");
657
+ if (n.id !== m.id) {
658
+ const sameCell = n.cell && m.cell && n.cell.row === m.cell.row && n.cell.col === m.cell.col;
659
+ return sameCell ? noteBarrier("two notes written to one cell at once") : ok([x]);
660
+ }
661
+ if (n.role === "remove") return ok([x]);
662
+ if (m.role === "remove") return ok([], [], tellNote(x, n));
663
+ if (n.role === "write" && m.role === "move") {
664
+ return m.cell ? ok([{ id: x.id, params: { ...x.params, row: m.cell.row, col: m.cell.col } }]) : ok([x]);
665
+ }
666
+ if (n.role === "move" && m.role === "write") return ok([x]);
667
+ const dx = noteDerived(x);
668
+ const dy = noteDerived(y);
669
+ if (dx && dy) return ok([x]);
670
+ const xWins = dx !== dy ? !dx : side === "left";
671
+ return xWins ? ok([x], tellNote(y, m)) : ok([], [], tellNote(x, n));
672
+ }
593
673
  function transformCommentAnchor(x, y, side) {
674
+ const note = transformCellNote(x, y, side);
675
+ if (note) return note;
594
676
  const xa = x.id === SET_SHEET_COMMENT_ANCHOR;
595
677
  const ya = y.id === SET_SHEET_COMMENT_ANCHOR;
596
678
  if (!xa && !ya) return null;
@@ -711,7 +793,7 @@ registerRangedResource({
711
793
  });
712
794
 
713
795
  // src/collab/sheets/transform/transform.ts
714
- var SHEET_TRANSFORMER_VERSION = "c5d-1";
796
+ var SHEET_TRANSFORMER_VERSION = "c5f-1";
715
797
  var ID = {
716
798
  values: "sheet.mutation.set-range-values",
717
799
  insertRow: "sheet.mutation.insert-row",
@@ -800,6 +882,21 @@ function buildStructural(template, axis, op) {
800
882
  const start = op.kind === "insert" ? op.at : op.start;
801
883
  return { id: template.id, params: { ...p, range: { ...p.range, [a0]: start, [a1]: start + op.count - 1 } } };
802
884
  }
885
+ function crossThrough(x, sy) {
886
+ const [a0, a1] = S(sy.axis);
887
+ const p = x.params;
888
+ const params = { ...p };
889
+ for (const k of ["range", "sourceRange", "targetRange"]) {
890
+ const r = p[k];
891
+ if (!r || typeof r[a0] !== "number" || typeof r[a1] !== "number") continue;
892
+ const spans = spanThrough(sy.op, r[a0], r[a1]);
893
+ if (!spans.length) continue;
894
+ const lo = r[a0] === 0 ? 0 : Math.min(...spans.map(([l]) => l));
895
+ const hi = Math.max(...spans.map(([, h]) => h));
896
+ params[k] = { ...r, [a0]: lo, [a1]: hi };
897
+ }
898
+ return { id: x.id, params };
899
+ }
803
900
  function univerMutationInfo(axis, op) {
804
901
  const FULL2 = { startRow: 0, endRow: Number.MAX_SAFE_INTEGER, startColumn: 0, endColumn: Number.MAX_SAFE_INTEGER };
805
902
  const start = op.kind === "insert" ? op.at : op.start;
@@ -1523,7 +1620,7 @@ function annotateSheetOpsInOrder(group, sheetOrder) {
1523
1620
  let structural = false;
1524
1621
  return group.map((m0) => {
1525
1622
  if (structuralOf(m0)) structural = true;
1526
- const m = structural && rangedSpecOf(m0.id) && !isDerived(m0) ? { id: m0.id, params: { ...m0.params, derived: true } } : m0;
1623
+ const m = structural && (rangedSpecOf(m0.id) || isNoteMutation(m0.id)) && !isDerived(m0) ? { id: m0.id, params: { ...m0.params, derived: true } } : m0;
1527
1624
  if (m.id === ID.insertSheet) {
1528
1625
  const index = typeof m.params.index === "number" ? Math.min(m.params.index, order.length) : order.length;
1529
1626
  order.splice(index, 0, sheetIdOf(m));
@@ -1770,7 +1867,7 @@ function transformMutation(x, y, side) {
1770
1867
  const np = numfmtPair(x, y, side, sx, sy);
1771
1868
  if (np) return np;
1772
1869
  if (sx && sy) {
1773
- if (sx.axis !== sy.axis) return ok2([x]);
1870
+ if (sx.axis !== sy.axis) return ok2([crossThrough(x, sy)]);
1774
1871
  const out = transformAxis(sx.op, sy.op, side);
1775
1872
  if (!out) return barrier2(`${x.id} over ${y.id}: moved blocks overlap in part, or the block would split`);
1776
1873
  const dropped = out.length === 0 && sx.op.kind === "move" ? [`${sheetOf(x)}: moved ${sx.axis}s`] : [];