@ai-matrx/office 0.8.53 → 0.8.55

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,27 @@
1
1
  # Changelog
2
2
 
3
- ## 0.8.53
3
+ ## 0.8.55
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.54
9
+
10
+ - `univerDocToMarkdown` now backslash-escapes typed text that a markdown reader would take for HTML (`<b>`, `<A22-klm>`) or an
11
+ entity (`&amp;`), so Word, HTML, EPUB, PDF, ODT and RTF downloads and print keep the text a person typed (they dropped it before).
12
+ A plain `<` or `&` (`A < B`, `a&b`) is untouched. Consumer action: a caller that wants the raw characters (the Google push, an agent
13
+ reading the passage, a source view) passes `{ escapeMarkup: false }`.
14
+
15
+ ## 0.8.53
16
+
17
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
18
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
19
+ Diff: `git diff 1847f8934e cd73e23915 -- apps/shared/office/src`
20
+
21
+ Changed shipped source files (2):
22
+ - `apps/shared/office/src/pdf/panels.tsx`
23
+ - `apps/shared/office/src/pdf/ports.ts`
24
+
8
25
  ## 0.8.52
9
26
 
10
27
  Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff bc6abc5d4e 1847f8934e -- apps/shared/office/src`
@@ -77,6 +77,12 @@ var SHEET_MUTATIONS = {
77
77
  "sheet.mutation.set-worksheet-row-is-auto-height": covered("size", "ranges", "autoHeightInfo"),
78
78
  "sheet.mutation.set-worksheet-row-auto-height": covered("size", "rowsAutoHeightInfo"),
79
79
  "sheet.mutation.set-worksheet-col-width": covered("size", "ranges", "colWidth"),
80
+ // a row or column's hidden flag (`hd`): per index like a size, the later of two wins (the gate's F5: Make table
81
+ // hides its Record ID column, which was rolled back as "not shared" in a room)
82
+ "sheet.mutation.set-row-hidden": covered("size", "ranges"),
83
+ "sheet.mutation.set-row-visible": covered("size", "ranges"),
84
+ "sheet.mutation.set-col-hidden": covered("size", "ranges"),
85
+ "sheet.mutation.set-col-visible": covered("size", "ranges"),
80
86
  "sheet.mutation.set-worksheet-name": covered("name", "name"),
81
87
  // ── covered (C5c) ────────────────────────────────────────────────────────────────────────────────
82
88
  "sheet.mutation.set.numfmt": covered("numfmt", "values", "refMap"),
@@ -133,10 +139,6 @@ var SHEET_MUTATIONS = {
133
139
  "sheet.mutation.set-frozen": barrier("X", "absolute frozen indices: not in C5a"),
134
140
  "sheet.mutation.set-row-data": barrier("X", "row properties by index: not in C5a"),
135
141
  "sheet.mutation.set-col-data": barrier("X", "column properties by index: not in C5a"),
136
- "sheet.mutation.set-row-hidden": barrier("X", "row visibility: not in C5a"),
137
- "sheet.mutation.set-row-visible": barrier("X", "row visibility: not in C5a"),
138
- "sheet.mutation.set-col-hidden": barrier("X", "column visibility: not in C5a"),
139
- "sheet.mutation.set-col-visible": barrier("X", "column visibility: not in C5a"),
140
142
  "sheet.mutation.add-range-protection": barrier("X", "permissions: not in C5a"),
141
143
  "sheet.mutation.set-range-protection": barrier("X", "permissions: not in C5a"),
142
144
  "sheet.mutation.delete-range-protection": barrier("X", "permissions: not in C5a"),
@@ -808,6 +810,10 @@ var ID = {
808
810
  rowIsAuto: "sheet.mutation.set-worksheet-row-is-auto-height",
809
811
  rowAutoHeight: "sheet.mutation.set-worksheet-row-auto-height",
810
812
  colWidth: "sheet.mutation.set-worksheet-col-width",
813
+ colHidden: "sheet.mutation.set-col-hidden",
814
+ colVisible: "sheet.mutation.set-col-visible",
815
+ rowHidden: "sheet.mutation.set-row-hidden",
816
+ rowVisible: "sheet.mutation.set-row-visible",
811
817
  name: "sheet.mutation.set-worksheet-name",
812
818
  setName: "formula.mutation.set-defined-name",
813
819
  removeName: "formula.mutation.remove-defined-name",
@@ -1106,7 +1112,8 @@ function transformCell(X, Y, side) {
1106
1112
  out.s = { ...outS && typeof outS === "object" ? outS : {}, n: null };
1107
1113
  } else if (side === "right" && outS && typeof outS === "object" && "n" in outS) {
1108
1114
  const rest = withoutStyleKeys(outS, /* @__PURE__ */ new Set(["n"]));
1109
- if (rest) out.s = rest;
1115
+ if (!has(Y.s) && Y.s !== null) out.s = { ...rest ?? {}, n: null };
1116
+ else if (rest) out.s = rest;
1110
1117
  else delete out.s;
1111
1118
  xLost = true;
1112
1119
  }
@@ -1144,6 +1151,34 @@ function transformCellsOverCells(x, y, side) {
1144
1151
  const op = passes.filter((p) => !isEmptyMatrix(p)).map((p) => cellsMutation(x, p));
1145
1152
  return ok2(op, lost, dropped);
1146
1153
  }
1154
+ var coveredByMerge = (ranges, r, c) => ranges.some((q) => q.startRow <= r && r <= q.endRow && q.startColumn <= c && c <= q.endColumn && !(r === q.startRow && c === q.startColumn));
1155
+ var EMPTY_CONTENT = Object.fromEntries(CONTENT_KEYS.filter((k) => k !== "t").map((k) => [k, null]));
1156
+ function valuesUnderMerge(x, y) {
1157
+ const ranges = mergeRanges(y);
1158
+ const out = {};
1159
+ const dropped = [];
1160
+ let changed = false;
1161
+ forEachCell(cellsOf(x), (r, c, v) => {
1162
+ if (v === null || !hasContent(v) || !coveredByMerge(ranges, r, c)) return putCell(out, r, c, v);
1163
+ changed = true;
1164
+ if (!isDerived(x)) dropped.push(cellRef(sheetOf(x), r, c));
1165
+ if ("s" in v) putCell(out, r, c, { s: v.s });
1166
+ });
1167
+ if (!changed) return ok2([x]);
1168
+ return ok2(isEmptyMatrix(out) ? [] : [cellsMutation(x, out)], [], dropped);
1169
+ }
1170
+ function mergeOverValues(x, y) {
1171
+ const ranges = mergeRanges(x);
1172
+ const clear = {};
1173
+ const lost = [];
1174
+ forEachCell(cellsOf(y), (r, c, v) => {
1175
+ if (v === null || !hasContent(v) || !coveredByMerge(ranges, r, c)) return;
1176
+ putCell(clear, r, c, { ...EMPTY_CONTENT });
1177
+ if (!isDerived(y)) lost.push(cellRef(sheetOf(y), r, c));
1178
+ });
1179
+ if (isEmptyMatrix(clear)) return ok2([x]);
1180
+ return ok2([x, { id: ID.values, params: { subUnitId: sheetOf(x), cellValue: clear, derived: true } }], lost);
1181
+ }
1147
1182
  var SIDE_CAR_PARAMS = ["refSheets", "previousName", "derived", "sheetIndex", "sheetsLeft"];
1148
1183
  var isDerived = (m) => m.params.derived === true;
1149
1184
  function derivedSide(x, y, side) {
@@ -1360,9 +1395,21 @@ function annotateFormulas(group, sheets, definedNames) {
1360
1395
  return m;
1361
1396
  });
1362
1397
  }
1398
+ var HIDE_SHOW = {
1399
+ [ID.colHidden]: { axis: "col", hidden: true },
1400
+ [ID.colVisible]: { axis: "col", hidden: false },
1401
+ [ID.rowHidden]: { axis: "row", hidden: true },
1402
+ [ID.rowVisible]: { axis: "row", hidden: false }
1403
+ };
1363
1404
  function sizeOf(m) {
1364
1405
  const p = m.params;
1365
1406
  const values = /* @__PURE__ */ new Map();
1407
+ const hs = HIDE_SHOW[m.id];
1408
+ if (hs) {
1409
+ const [a02, a12] = S(hs.axis);
1410
+ for (const r of p.ranges ?? []) for (let i = r[a02]; i <= r[a12]; i++) values.set(i, hs.hidden);
1411
+ return { axis: hs.axis, attr: "hd", values };
1412
+ }
1366
1413
  if (m.id === ID.rowAutoHeight) {
1367
1414
  for (const { row, autoHeight } of p.rowsAutoHeightInfo ?? []) values.set(row, autoHeight);
1368
1415
  return { axis: "row", attr: "ah", values };
@@ -1382,6 +1429,12 @@ function sizeOf(m) {
1382
1429
  function buildSize(template, values) {
1383
1430
  if (values.size === 0) return null;
1384
1431
  const p = template.params;
1432
+ const hs = HIDE_SHOW[template.id];
1433
+ if (hs) {
1434
+ const [a02, a12] = S(hs.axis);
1435
+ const first2 = (p.ranges ?? [])[0] ?? { startRow: 0, endRow: 0, startColumn: 0, endColumn: 0 };
1436
+ return { id: template.id, params: { ...p, ranges: runs(values.keys()).map((r) => ({ ...first2, [a02]: r.start, [a12]: r.start + r.count - 1 })) } };
1437
+ }
1385
1438
  if (template.id === ID.rowAutoHeight)
1386
1439
  return { id: template.id, params: { ...p, rowsAutoHeightInfo: [...values].sort((a, b) => a[0] - b[0]).map(([row, autoHeight]) => ({ row, autoHeight })) } };
1387
1440
  const axis = template.id === ID.colWidth ? "col" : "row";
@@ -1927,6 +1980,8 @@ function transformMutation(x, y, side) {
1927
1980
  return ok2([...pre, x, ...mid, ...add.length ? [mergeMutation(ID.addMerge, sheet, add)] : []], lostMerges);
1928
1981
  }
1929
1982
  if (fx === "cell" && fy === "cell") return transformCellsOverCells(x, y, side);
1983
+ if (x.id === ID.values && y.id === ID.addMerge) return valuesUnderMerge(x, y);
1984
+ if (x.id === ID.addMerge && y.id === ID.values) return mergeOverValues(x, y);
1930
1985
  if (fx === "merge" && fy === "merge") {
1931
1986
  const xr = mergeRanges(x);
1932
1987
  const yr = mergeRanges(y);