ooxml-core 1.19.0 → 1.19.2

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.
Files changed (166) hide show
  1. package/dist/{PptxHandler-5GBBVJCR.mjs → PptxHandler-2V4PQL6O.mjs} +2 -2
  2. package/dist/{PptxHandler-ZHPGBSAF.cjs → PptxHandler-6TNIQ7S5.cjs} +2 -2
  3. package/dist/{PptxHandler-H43MAMTO.mjs → PptxHandler-HSPKEP5E.mjs} +1 -1
  4. package/dist/{PresentationBuilder-7ZSUKCX5.mjs → PresentationBuilder-G7MPEGXJ.mjs} +1 -1
  5. package/dist/{PresentationBuilder-IJW42L3R.mjs → PresentationBuilder-HQ6C7L4V.mjs} +2 -2
  6. package/dist/{PresentationBuilder-O4H4MMWB.cjs → PresentationBuilder-RM52LCVN.cjs} +4 -4
  7. package/dist/automation/index.cjs +167 -60
  8. package/dist/automation/index.mjs +167 -60
  9. package/dist/automation/node.cjs +2 -1
  10. package/dist/automation/node.d.ts.map +1 -1
  11. package/dist/automation/node.mjs +2 -1
  12. package/dist/{chunk-D4GBMBG6.mjs → chunk-365VXA3X.mjs} +1 -1
  13. package/dist/{chunk-3XFPCZKB.mjs → chunk-4FTUAD2B.mjs} +20 -5
  14. package/dist/{chunk-PLWRGPRH.mjs → chunk-4YDPRQRH.mjs} +145 -96
  15. package/dist/{chunk-QXDWDDLN.mjs → chunk-6UV3JVB3.mjs} +1 -1
  16. package/dist/{chunk-3ATTMOYZ.mjs → chunk-7FPQ7LGN.mjs} +1 -1
  17. package/dist/{chunk-7WCCQKV2.mjs → chunk-7I7CMDUZ.mjs} +1 -1
  18. package/dist/{chunk-KZ6UTEES.mjs → chunk-E6WNB3JX.mjs} +1 -1
  19. package/dist/{chunk-SPG7WICG.mjs → chunk-EDRS3OSM.mjs} +1 -1
  20. package/dist/{chunk-VXLBSKZ6.mjs → chunk-GKLDCQLY.mjs} +1 -1
  21. package/dist/{chunk-ITQNJLJW.mjs → chunk-ILG6NKXV.mjs} +1 -1
  22. package/dist/{chunk-OXZUJR7O.mjs → chunk-J3PD5JWS.mjs} +1 -1
  23. package/dist/{chunk-QBJRB6WW.mjs → chunk-JUABSM7C.mjs} +1 -1
  24. package/dist/{chunk-5GBNB7VU.mjs → chunk-LMDNFNZJ.mjs} +1 -1
  25. package/dist/{chunk-BIVNVDAH.mjs → chunk-M6GDBVQ7.mjs} +1 -1
  26. package/dist/{chunk-4SMQRUUE.mjs → chunk-MZP6H7QY.mjs} +1 -1
  27. package/dist/{chunk-KCALUCYU.mjs → chunk-NIGOXRUP.mjs} +1 -1
  28. package/dist/{chunk-VB7NKWZH.mjs → chunk-P37EWZBC.mjs} +1 -1
  29. package/dist/{chunk-VD3XNFJH.mjs → chunk-PIOG7ZFF.mjs} +1 -1
  30. package/dist/{chunk-MHMVD23Y.cjs → chunk-R5FIHHGB.cjs} +33 -13
  31. package/dist/{chunk-4EUHK4OA.mjs → chunk-RRQFRNPQ.mjs} +1 -1
  32. package/dist/{chunk-AXDQEOYK.mjs → chunk-S3E6XBOU.mjs} +1 -1
  33. package/dist/{chunk-RUZEMWDI.mjs → chunk-SLNQNVQM.mjs} +1 -1
  34. package/dist/{chunk-75GLSRZE.mjs → chunk-TJPUAUWL.mjs} +4 -4
  35. package/dist/{chunk-53GW7NSV.mjs → chunk-UFZZESXL.mjs} +1 -1
  36. package/dist/{chunk-4JGKTRLH.mjs → chunk-X45XTEMI.mjs} +1 -1
  37. package/dist/{chunk-DUSAQQTU.mjs → chunk-YIXIC3TR.mjs} +1 -1
  38. package/dist/{chunk-YSKKMXDL.mjs → chunk-ZDD2RZGB.mjs} +1 -1
  39. package/dist/{chunk-H6TNNXJK.mjs → chunk-ZJ2OKIJN.mjs} +33 -13
  40. package/dist/docx/embedded.cjs +4 -1
  41. package/dist/docx/embedded.mjs +4 -1
  42. package/dist/docx/index.cjs +4 -1
  43. package/dist/docx/index.mjs +4 -1
  44. package/dist/docx/load/index.cjs +4 -1
  45. package/dist/docx/load/index.mjs +4 -1
  46. package/dist/docx/write-table.d.ts.map +1 -1
  47. package/dist/pptx/automation/index.cjs +35 -14
  48. package/dist/pptx/automation/index.d.ts +2 -2
  49. package/dist/pptx/automation/index.mjs +5 -5
  50. package/dist/pptx/automation/schemas/chart-formatting-schemas.cjs +145 -96
  51. package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts +1 -1
  52. package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts.map +1 -1
  53. package/dist/pptx/automation/schemas/chart-formatting-schemas.mjs +2 -2
  54. package/dist/pptx/automation/schemas/chart-schemas.cjs +145 -96
  55. package/dist/pptx/automation/schemas/chart-schemas.d.ts +1 -1
  56. package/dist/pptx/automation/schemas/chart-schemas.d.ts.map +1 -1
  57. package/dist/pptx/automation/schemas/chart-schemas.mjs +2 -2
  58. package/dist/pptx/automation/schemas/chart-user-shape-schemas.cjs +145 -96
  59. package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts +1 -1
  60. package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts.map +1 -1
  61. package/dist/pptx/automation/schemas/chart-user-shape-schemas.mjs +2 -2
  62. package/dist/pptx/automation/schemas/element-schemas.cjs +145 -96
  63. package/dist/pptx/automation/schemas/element-schemas.d.ts +1 -1
  64. package/dist/pptx/automation/schemas/element-schemas.d.ts.map +1 -1
  65. package/dist/pptx/automation/schemas/element-schemas.mjs +2 -2
  66. package/dist/pptx/automation/schemas/export-schemas.cjs +145 -96
  67. package/dist/pptx/automation/schemas/export-schemas.d.ts +1 -1
  68. package/dist/pptx/automation/schemas/export-schemas.d.ts.map +1 -1
  69. package/dist/pptx/automation/schemas/export-schemas.mjs +2 -2
  70. package/dist/pptx/automation/schemas/geometry-schemas.cjs +145 -96
  71. package/dist/pptx/automation/schemas/geometry-schemas.d.ts +1 -1
  72. package/dist/pptx/automation/schemas/geometry-schemas.d.ts.map +1 -1
  73. package/dist/pptx/automation/schemas/geometry-schemas.mjs +2 -2
  74. package/dist/pptx/automation/schemas/hyperlink-schemas.cjs +145 -96
  75. package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts +1 -1
  76. package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts.map +1 -1
  77. package/dist/pptx/automation/schemas/hyperlink-schemas.mjs +2 -2
  78. package/dist/pptx/automation/schemas/index.cjs +145 -96
  79. package/dist/pptx/automation/schemas/index.mjs +21 -21
  80. package/dist/pptx/automation/schemas/json-schemas.cjs +145 -96
  81. package/dist/pptx/automation/schemas/json-schemas.d.ts +1 -1
  82. package/dist/pptx/automation/schemas/json-schemas.d.ts.map +1 -1
  83. package/dist/pptx/automation/schemas/json-schemas.mjs +2 -2
  84. package/dist/pptx/automation/schemas/layout-schemas.cjs +145 -96
  85. package/dist/pptx/automation/schemas/layout-schemas.d.ts +1 -1
  86. package/dist/pptx/automation/schemas/layout-schemas.d.ts.map +1 -1
  87. package/dist/pptx/automation/schemas/layout-schemas.mjs +2 -2
  88. package/dist/pptx/automation/schemas/lock-schemas.cjs +145 -96
  89. package/dist/pptx/automation/schemas/lock-schemas.d.ts +1 -1
  90. package/dist/pptx/automation/schemas/lock-schemas.d.ts.map +1 -1
  91. package/dist/pptx/automation/schemas/lock-schemas.mjs +2 -2
  92. package/dist/pptx/automation/schemas/metadata-schemas.cjs +145 -96
  93. package/dist/pptx/automation/schemas/metadata-schemas.d.ts +1 -1
  94. package/dist/pptx/automation/schemas/metadata-schemas.d.ts.map +1 -1
  95. package/dist/pptx/automation/schemas/metadata-schemas.mjs +2 -2
  96. package/dist/pptx/automation/schemas/ole-schemas.cjs +145 -96
  97. package/dist/pptx/automation/schemas/ole-schemas.d.ts +1 -1
  98. package/dist/pptx/automation/schemas/ole-schemas.d.ts.map +1 -1
  99. package/dist/pptx/automation/schemas/ole-schemas.mjs +2 -2
  100. package/dist/pptx/automation/schemas/presentation-schemas.cjs +145 -96
  101. package/dist/pptx/automation/schemas/presentation-schemas.d.ts +1 -1
  102. package/dist/pptx/automation/schemas/presentation-schemas.d.ts.map +1 -1
  103. package/dist/pptx/automation/schemas/presentation-schemas.mjs +2 -2
  104. package/dist/pptx/automation/schemas/section-schemas.cjs +145 -96
  105. package/dist/pptx/automation/schemas/section-schemas.d.ts +1 -1
  106. package/dist/pptx/automation/schemas/section-schemas.d.ts.map +1 -1
  107. package/dist/pptx/automation/schemas/section-schemas.mjs +2 -2
  108. package/dist/pptx/automation/schemas/slide-schemas.cjs +145 -96
  109. package/dist/pptx/automation/schemas/slide-schemas.d.ts +1 -1
  110. package/dist/pptx/automation/schemas/slide-schemas.d.ts.map +1 -1
  111. package/dist/pptx/automation/schemas/slide-schemas.mjs +2 -2
  112. package/dist/pptx/automation/schemas/smartart-schemas.cjs +145 -96
  113. package/dist/pptx/automation/schemas/smartart-schemas.d.ts +1 -1
  114. package/dist/pptx/automation/schemas/smartart-schemas.d.ts.map +1 -1
  115. package/dist/pptx/automation/schemas/smartart-schemas.mjs +2 -2
  116. package/dist/pptx/automation/schemas/table-style-schemas.cjs +145 -96
  117. package/dist/pptx/automation/schemas/table-style-schemas.d.ts +1 -1
  118. package/dist/pptx/automation/schemas/table-style-schemas.d.ts.map +1 -1
  119. package/dist/pptx/automation/schemas/table-style-schemas.mjs +2 -2
  120. package/dist/pptx/automation/schemas/template-schemas.cjs +145 -96
  121. package/dist/pptx/automation/schemas/template-schemas.d.ts +1 -1
  122. package/dist/pptx/automation/schemas/template-schemas.d.ts.map +1 -1
  123. package/dist/pptx/automation/schemas/template-schemas.mjs +2 -2
  124. package/dist/pptx/automation/schemas/theme-schemas.cjs +145 -96
  125. package/dist/pptx/automation/schemas/theme-schemas.d.ts +1 -1
  126. package/dist/pptx/automation/schemas/theme-schemas.d.ts.map +1 -1
  127. package/dist/pptx/automation/schemas/theme-schemas.mjs +2 -2
  128. package/dist/pptx/automation/schemas/validation-schemas.cjs +145 -96
  129. package/dist/pptx/automation/schemas/validation-schemas.d.ts +1 -1
  130. package/dist/pptx/automation/schemas/validation-schemas.d.ts.map +1 -1
  131. package/dist/pptx/automation/schemas/validation-schemas.mjs +2 -2
  132. package/dist/pptx/chunks/{index-CiyTR6mm.d.ts → index-B9x557hr.d.ts} +3 -2
  133. package/dist/pptx/chunks/{index-CiyTR6mm.d.ts.map → index-B9x557hr.d.ts.map} +1 -1
  134. package/dist/pptx/chunks/{index-BWHNCVNC.d.ts → index-Bqm-jFG-.d.ts} +3 -4
  135. package/dist/pptx/chunks/{index-BWHNCVNC.d.ts.map → index-Bqm-jFG-.d.ts.map} +1 -1
  136. package/dist/pptx/chunks/schemas-CWr181Wx.d.ts +2186 -0
  137. package/dist/pptx/chunks/schemas-CWr181Wx.d.ts.map +1 -0
  138. package/dist/pptx/cli/index.cjs +35 -14
  139. package/dist/pptx/cli/index.mjs +4 -4
  140. package/dist/pptx/converter/index.d.ts +1 -1
  141. package/dist/pptx/converter/index.mjs +2 -2
  142. package/dist/pptx/editor/loader/table-style-image-paths.d.ts +1 -0
  143. package/dist/pptx/editor/render/collaboration-text-native-edit.d.ts +1 -0
  144. package/dist/pptx/editor/render/collaboration-text-session-paragraph.d.ts +1 -0
  145. package/dist/pptx/editor/render/collaboration-text-snapshot-positions.d.ts.map +1 -1
  146. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  147. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  148. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  149. package/dist/pptx/index.cjs +30 -6
  150. package/dist/pptx/index.d.ts +2 -2
  151. package/dist/pptx/index.mjs +5 -5
  152. package/dist/pptx/ui/index.d.ts +1 -0
  153. package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
  154. package/dist/xlsx/index.cjs +145 -38
  155. package/dist/xlsx/index.mjs +145 -38
  156. package/dist/xlsx/layout/merge-sweep.d.ts +36 -0
  157. package/dist/xlsx/layout/merge-sweep.d.ts.map +1 -0
  158. package/dist/xlsx/layout/metrics.d.ts +5 -0
  159. package/dist/xlsx/layout/metrics.d.ts.map +1 -1
  160. package/dist/xlsx/layout/row-autofit.d.ts +6 -0
  161. package/dist/xlsx/layout/row-autofit.d.ts.map +1 -1
  162. package/dist/xlsx/ui/index.cjs +143 -39
  163. package/dist/xlsx/ui/index.mjs +143 -39
  164. package/package.json +9 -9
  165. package/dist/pptx/chunks/external-DQ3B4V-o.d.ts +0 -4275
  166. package/dist/pptx/chunks/external-DQ3B4V-o.d.ts.map +0 -1
@@ -32270,9 +32270,9 @@ function toHtml(cells, theme2) {
32270
32270
  for (let r = link.range.start.row; r <= link.range.end.row; r++)
32271
32271
  for (let c2 = link.range.start.col; c2 <= link.range.end.col; c2++) links.set(`${r},${c2}`, link);
32272
32272
  const covered = /* @__PURE__ */ new Set();
32273
- const spans2 = /* @__PURE__ */ new Map();
32273
+ const spans3 = /* @__PURE__ */ new Map();
32274
32274
  for (const m of cells.merges) {
32275
- spans2.set(`${m.start.row},${m.start.col}`, m);
32275
+ spans3.set(`${m.start.row},${m.start.col}`, m);
32276
32276
  for (let r = m.start.row; r <= m.end.row; r++)
32277
32277
  for (let c2 = m.start.col; c2 <= m.end.col; c2++)
32278
32278
  if (r !== m.start.row || c2 !== m.start.col) covered.add(`${r},${c2}`);
@@ -32284,7 +32284,7 @@ function toHtml(cells, theme2) {
32284
32284
  if (covered.has(`${r},${c2}`)) continue;
32285
32285
  const cell = cells.data[r]?.[c2] ?? null;
32286
32286
  const attrs2 = [];
32287
- const span4 = spans2.get(`${r},${c2}`);
32287
+ const span4 = spans3.get(`${r},${c2}`);
32288
32288
  if (span4 && span4.end.row > span4.start.row)
32289
32289
  attrs2.push(`rowspan="${span4.end.row - span4.start.row + 1}"`);
32290
32290
  if (span4 && span4.end.col > span4.start.col)
@@ -34647,16 +34647,27 @@ function columnOverrides(sheet, mdw, defaultPx) {
34647
34647
  }
34648
34648
  return out;
34649
34649
  }
34650
- function createGridMetrics(sheet, options7 = {}) {
34651
- const zoom = zoomPercent(options7.zoom ?? sheet.view.zoom);
34650
+ function pixelScale(zoom) {
34652
34651
  const factor = zoom / 100;
34653
- const mdw = options7.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
34654
- const scale2 = (px) => px > 0 ? Math.max(1, Math.round(px * factor)) : 0;
34652
+ return (px) => px > 0 ? Math.max(1, Math.round(px * factor)) : 0;
34653
+ }
34654
+ function columnAxis(sheet, mdw, scale2) {
34655
34655
  const defaultColPx = defaultColumnPixels(sheet.defaultColWidth, mdw);
34656
34656
  const colOverrides = [...columnOverrides(sheet, mdw, defaultColPx)].map(
34657
34657
  ([c2, px]) => [c2, scale2(px)]
34658
34658
  );
34659
- const cols = new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
34659
+ return new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
34660
+ }
34661
+ function createColumnWidths(sheet, options7 = {}) {
34662
+ const zoom = zoomPercent(options7.zoom ?? sheet.view.zoom);
34663
+ const cols = columnAxis(sheet, options7.mdw ?? DEFAULT_MAX_DIGIT_WIDTH, pixelScale(zoom));
34664
+ return (c2) => cols.size(c2);
34665
+ }
34666
+ function createGridMetrics(sheet, options7 = {}) {
34667
+ const zoom = zoomPercent(options7.zoom ?? sheet.view.zoom);
34668
+ const mdw = options7.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
34669
+ const scale2 = pixelScale(zoom);
34670
+ const cols = columnAxis(sheet, mdw, scale2);
34660
34671
  const defaultRowPx = pointsToPixels(sheet.defaultRowHeight);
34661
34672
  const rowOverrides = [];
34662
34673
  for (const [r, info] of sheet.rowInfo) {
@@ -38749,6 +38760,87 @@ function cellView(workbook, sheetIndex2, row2, col, cf, options7 = {}) {
38749
38760
  return view;
38750
38761
  }
38751
38762
 
38763
+ // xlsx/layout/merge-sweep.ts
38764
+ var NONE = { merged: false, spanned: false };
38765
+ var SINGLE3 = { merged: true, spanned: false };
38766
+ var SPANNED = { merged: true, spanned: true };
38767
+ var spans2 = (merge2) => merge2.start.row !== merge2.end.row || merge2.start.col !== merge2.end.col;
38768
+ function firstRightOf(merges, col) {
38769
+ let lo = 0;
38770
+ let hi = merges.length;
38771
+ while (lo < hi) {
38772
+ const mid = lo + hi >> 1;
38773
+ if ((merges[mid]?.start.col ?? 0) <= col) lo = mid + 1;
38774
+ else hi = mid;
38775
+ }
38776
+ return lo;
38777
+ }
38778
+ var MergeSweep = class {
38779
+ /** The merges by first row; `next` is the first one the sweep has not reached. */
38780
+ byRow;
38781
+ next = 0;
38782
+ row = Number.NEGATIVE_INFINITY;
38783
+ /** The merges covering the current row, by first column. */
38784
+ active = [];
38785
+ /** The last row of the earliest-ending active merge. */
38786
+ firstEnd = Number.POSITIVE_INFINITY;
38787
+ overlapping = false;
38788
+ constructor(merges) {
38789
+ this.byRow = [...merges].sort((a2, b) => a2.start.row - b.start.row);
38790
+ }
38791
+ /** How many merges cover the current row, which is everything the sweep holds. */
38792
+ get size() {
38793
+ return this.active.length;
38794
+ }
38795
+ /** Moves to `row`, which must not be above the previous one. */
38796
+ moveTo(row2) {
38797
+ if (row2 < this.row) throw new RangeError(`Rows must not go up: ${row2} after ${this.row}`);
38798
+ this.row = row2;
38799
+ if (row2 > this.firstEnd) this.dropEnded(row2);
38800
+ for (; this.next < this.byRow.length; this.next++) {
38801
+ const merge2 = this.byRow[this.next];
38802
+ if (!merge2 || merge2.start.row > row2) break;
38803
+ if (merge2.end.row >= row2) this.add(merge2);
38804
+ }
38805
+ }
38806
+ /** How the merges cover column `col` of the current row. */
38807
+ at(col) {
38808
+ if (this.overlapping) {
38809
+ let merged = false;
38810
+ for (const merge3 of this.active) {
38811
+ if (col < merge3.start.col || col > merge3.end.col) continue;
38812
+ if (spans2(merge3)) return SPANNED;
38813
+ merged = true;
38814
+ }
38815
+ return merged ? SINGLE3 : NONE;
38816
+ }
38817
+ const merge2 = this.active[firstRightOf(this.active, col) - 1];
38818
+ if (!merge2 || col > merge2.end.col) return NONE;
38819
+ return spans2(merge2) ? SPANNED : SINGLE3;
38820
+ }
38821
+ add(merge2) {
38822
+ const at = firstRightOf(this.active, merge2.start.col);
38823
+ const before = this.active[at - 1];
38824
+ const after = this.active[at];
38825
+ if (before && before.end.col >= merge2.start.col || after && merge2.end.col >= after.start.col)
38826
+ this.overlapping = true;
38827
+ this.active.splice(at, 0, merge2);
38828
+ this.firstEnd = Math.min(this.firstEnd, merge2.end.row);
38829
+ }
38830
+ dropEnded(row2) {
38831
+ let kept = 0;
38832
+ let firstEnd = Number.POSITIVE_INFINITY;
38833
+ for (const merge2 of this.active) {
38834
+ if (merge2.end.row < row2) continue;
38835
+ this.active[kept++] = merge2;
38836
+ firstEnd = Math.min(firstEnd, merge2.end.row);
38837
+ }
38838
+ this.active.length = kept;
38839
+ this.firstEnd = firstEnd;
38840
+ if (!kept) this.overlapping = false;
38841
+ }
38842
+ };
38843
+
38752
38844
  // xlsx/layout/row-autofit.ts
38753
38845
  var LINE_HEIGHTS = [
38754
38846
  [6, 8.25],
@@ -38808,30 +38900,39 @@ function wrappedLineCount(text4, width, measure3) {
38808
38900
  }
38809
38901
  return lines;
38810
38902
  }
38811
- function autoFitRowHeight(workbook, sheetIndex2, row2, measure3) {
38903
+ function fitRowHeights(workbook, sheetIndex2, rows2, measure3) {
38904
+ const heights = /* @__PURE__ */ new Map();
38812
38905
  const sheet = workbook.sheets[sheetIndex2];
38813
- if (!sheet) return 15;
38814
- const cells = sheet.rows.get(row2);
38815
- if (!cells?.size) return sheet.defaultRowHeight;
38816
- const metrics = createGridMetrics(sheet, { zoom: 100 });
38817
- let tallest = 0;
38818
- for (const col of cells.keys()) {
38819
- const merged = sheet.merges.some(
38820
- (m) => row2 >= m.start.row && row2 <= m.end.row && col >= m.start.col && col <= m.end.col && (m.start.row !== m.end.row || m.start.col !== m.end.col)
38821
- );
38822
- if (merged) continue;
38823
- const view = cellView(workbook, sheetIndex2, row2, col);
38824
- if (!view.text) continue;
38825
- const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
38826
- const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
38827
- let lines = 1;
38828
- if (view.wrap) {
38829
- const width = metrics.colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
38830
- lines = wrappedLineCount(view.text, width, (text4) => measure3(text4, view.font));
38831
- }
38832
- tallest = Math.max(tallest, lines * lineHeightPoints(sizePt));
38833
- }
38834
- return tallest > 0 ? tallest : sheet.defaultRowHeight;
38906
+ if (!sheet) return heights;
38907
+ const filled = [];
38908
+ for (const row2 of new Set(rows2)) {
38909
+ if (sheet.rows.get(row2)?.size) filled.push(row2);
38910
+ else heights.set(row2, sheet.defaultRowHeight);
38911
+ }
38912
+ filled.sort((a2, b) => a2 - b);
38913
+ const merges = new MergeSweep(sheet.merges);
38914
+ let colWidth;
38915
+ for (const row2 of filled) {
38916
+ merges.moveTo(row2);
38917
+ let tallest = 0;
38918
+ for (const col of sheet.rows.get(row2)?.keys() ?? []) {
38919
+ const cover = merges.at(col);
38920
+ if (cover.spanned) continue;
38921
+ const view = cellView(workbook, sheetIndex2, row2, col, void 0, { merged: cover.merged });
38922
+ if (!view.text) continue;
38923
+ const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
38924
+ const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
38925
+ let lines = 1;
38926
+ if (view.wrap) {
38927
+ colWidth ??= createColumnWidths(sheet, { zoom: 100 });
38928
+ const width = colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
38929
+ lines = wrappedLineCount(view.text, width, (text4) => measure3(text4, view.font));
38930
+ }
38931
+ tallest = Math.max(tallest, lines * lineHeightPoints(sizePt));
38932
+ }
38933
+ heights.set(row2, tallest > 0 ? tallest : sheet.defaultRowHeight);
38934
+ }
38935
+ return heights;
38835
38936
  }
38836
38937
  var approximateMeasure = (text4, font) => text4.length * font.sizePx * (font.bold ? 0.58 : 0.53);
38837
38938
 
@@ -38839,13 +38940,16 @@ var approximateMeasure = (text4, font) => text4.length * font.sizePx * (font.bol
38839
38940
  var MAX_HEIGHT2 = 409;
38840
38941
  function autoGrowRows(ctx, s, rows2, measure3 = approximateMeasure) {
38841
38942
  const sheet = sheetAt(ctx.workbook, s);
38842
- const updates = [];
38843
- for (const row2 of new Set(rows2)) {
38943
+ const candidates = [...new Set(rows2)].filter((row2) => {
38844
38944
  const info = sheet.rowInfo.get(row2);
38845
- if (info?.customHeight || info?.hidden) continue;
38846
- const fit2 = Math.min(MAX_HEIGHT2, autoFitRowHeight(ctx.workbook, s, row2, measure3));
38945
+ return !info?.customHeight && !info?.hidden;
38946
+ });
38947
+ const fits = fitRowHeights(ctx.workbook, s, candidates, measure3);
38948
+ const updates = [];
38949
+ for (const row2 of candidates) {
38950
+ const fit2 = Math.min(MAX_HEIGHT2, fits.get(row2) ?? sheet.defaultRowHeight);
38847
38951
  const next = Math.abs(fit2 - sheet.defaultRowHeight) < 1e-9 ? void 0 : fit2;
38848
- const current = info?.height;
38952
+ const current = sheet.rowInfo.get(row2)?.height;
38849
38953
  if (current === next) continue;
38850
38954
  if (current !== void 0 && next !== void 0 && Math.abs(current - next) < 1e-9) continue;
38851
38955
  updates.push([row2, next]);
@@ -43387,13 +43491,13 @@ function chartRichTitleSvg(model, width, options7 = {}, frameHeight = 400) {
43387
43491
  measured ? 4 : 0
43388
43492
  );
43389
43493
  let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical2[0]?.before ?? 0) + (vertical2[0]?.leading ?? 0);
43390
- const spans2 = [];
43494
+ const spans3 = [];
43391
43495
  for (const [index3, line3] of metrics.entries()) {
43392
43496
  if (index3)
43393
43497
  baseline += vertical2[index3 - 1].descent + vertical2[index3 - 1].after + vertical2[index3].before + vertical2[index3].ascent;
43394
43498
  let x = line3.align === "l" ? (width - boxWidth) / 2 + 4 : line3.align === "r" ? (width + boxWidth) / 2 - 4 - line3.width : (width - line3.width) / 2;
43395
43499
  for (const run2 of line3.runs) {
43396
- spans2.push(
43500
+ spans3.push(
43397
43501
  text3(x, baseline, run2.text, {
43398
43502
  ...run2.attrs,
43399
43503
  anchor: "start"
@@ -43404,7 +43508,7 @@ function chartRichTitleSvg(model, width, options7 = {}, frameHeight = 400) {
43404
43508
  }
43405
43509
  const parent = text3(0, 0, "", { ...base, underline: false }).replace(
43406
43510
  "</text>",
43407
- `${spans2.join("")}</text>`
43511
+ `${spans3.join("")}</text>`
43408
43512
  );
43409
43513
  const markup = chartAreaRect(model, "title", {
43410
43514
  x: (width - boxWidth) / 2,
@@ -32264,9 +32264,9 @@ function toHtml(cells, theme2) {
32264
32264
  for (let r = link.range.start.row; r <= link.range.end.row; r++)
32265
32265
  for (let c2 = link.range.start.col; c2 <= link.range.end.col; c2++) links.set(`${r},${c2}`, link);
32266
32266
  const covered = /* @__PURE__ */ new Set();
32267
- const spans2 = /* @__PURE__ */ new Map();
32267
+ const spans3 = /* @__PURE__ */ new Map();
32268
32268
  for (const m of cells.merges) {
32269
- spans2.set(`${m.start.row},${m.start.col}`, m);
32269
+ spans3.set(`${m.start.row},${m.start.col}`, m);
32270
32270
  for (let r = m.start.row; r <= m.end.row; r++)
32271
32271
  for (let c2 = m.start.col; c2 <= m.end.col; c2++)
32272
32272
  if (r !== m.start.row || c2 !== m.start.col) covered.add(`${r},${c2}`);
@@ -32278,7 +32278,7 @@ function toHtml(cells, theme2) {
32278
32278
  if (covered.has(`${r},${c2}`)) continue;
32279
32279
  const cell = cells.data[r]?.[c2] ?? null;
32280
32280
  const attrs2 = [];
32281
- const span4 = spans2.get(`${r},${c2}`);
32281
+ const span4 = spans3.get(`${r},${c2}`);
32282
32282
  if (span4 && span4.end.row > span4.start.row)
32283
32283
  attrs2.push(`rowspan="${span4.end.row - span4.start.row + 1}"`);
32284
32284
  if (span4 && span4.end.col > span4.start.col)
@@ -34641,16 +34641,27 @@ function columnOverrides(sheet, mdw, defaultPx) {
34641
34641
  }
34642
34642
  return out;
34643
34643
  }
34644
- function createGridMetrics(sheet, options7 = {}) {
34645
- const zoom = zoomPercent(options7.zoom ?? sheet.view.zoom);
34644
+ function pixelScale(zoom) {
34646
34645
  const factor = zoom / 100;
34647
- const mdw = options7.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
34648
- const scale2 = (px) => px > 0 ? Math.max(1, Math.round(px * factor)) : 0;
34646
+ return (px) => px > 0 ? Math.max(1, Math.round(px * factor)) : 0;
34647
+ }
34648
+ function columnAxis(sheet, mdw, scale2) {
34649
34649
  const defaultColPx = defaultColumnPixels(sheet.defaultColWidth, mdw);
34650
34650
  const colOverrides = [...columnOverrides(sheet, mdw, defaultColPx)].map(
34651
34651
  ([c2, px]) => [c2, scale2(px)]
34652
34652
  );
34653
- const cols = new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
34653
+ return new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
34654
+ }
34655
+ function createColumnWidths(sheet, options7 = {}) {
34656
+ const zoom = zoomPercent(options7.zoom ?? sheet.view.zoom);
34657
+ const cols = columnAxis(sheet, options7.mdw ?? DEFAULT_MAX_DIGIT_WIDTH, pixelScale(zoom));
34658
+ return (c2) => cols.size(c2);
34659
+ }
34660
+ function createGridMetrics(sheet, options7 = {}) {
34661
+ const zoom = zoomPercent(options7.zoom ?? sheet.view.zoom);
34662
+ const mdw = options7.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
34663
+ const scale2 = pixelScale(zoom);
34664
+ const cols = columnAxis(sheet, mdw, scale2);
34654
34665
  const defaultRowPx = pointsToPixels(sheet.defaultRowHeight);
34655
34666
  const rowOverrides = [];
34656
34667
  for (const [r, info] of sheet.rowInfo) {
@@ -38743,6 +38754,87 @@ function cellView(workbook, sheetIndex2, row2, col, cf, options7 = {}) {
38743
38754
  return view;
38744
38755
  }
38745
38756
 
38757
+ // xlsx/layout/merge-sweep.ts
38758
+ var NONE = { merged: false, spanned: false };
38759
+ var SINGLE3 = { merged: true, spanned: false };
38760
+ var SPANNED = { merged: true, spanned: true };
38761
+ var spans2 = (merge2) => merge2.start.row !== merge2.end.row || merge2.start.col !== merge2.end.col;
38762
+ function firstRightOf(merges, col) {
38763
+ let lo = 0;
38764
+ let hi = merges.length;
38765
+ while (lo < hi) {
38766
+ const mid = lo + hi >> 1;
38767
+ if ((merges[mid]?.start.col ?? 0) <= col) lo = mid + 1;
38768
+ else hi = mid;
38769
+ }
38770
+ return lo;
38771
+ }
38772
+ var MergeSweep = class {
38773
+ /** The merges by first row; `next` is the first one the sweep has not reached. */
38774
+ byRow;
38775
+ next = 0;
38776
+ row = Number.NEGATIVE_INFINITY;
38777
+ /** The merges covering the current row, by first column. */
38778
+ active = [];
38779
+ /** The last row of the earliest-ending active merge. */
38780
+ firstEnd = Number.POSITIVE_INFINITY;
38781
+ overlapping = false;
38782
+ constructor(merges) {
38783
+ this.byRow = [...merges].sort((a2, b) => a2.start.row - b.start.row);
38784
+ }
38785
+ /** How many merges cover the current row, which is everything the sweep holds. */
38786
+ get size() {
38787
+ return this.active.length;
38788
+ }
38789
+ /** Moves to `row`, which must not be above the previous one. */
38790
+ moveTo(row2) {
38791
+ if (row2 < this.row) throw new RangeError(`Rows must not go up: ${row2} after ${this.row}`);
38792
+ this.row = row2;
38793
+ if (row2 > this.firstEnd) this.dropEnded(row2);
38794
+ for (; this.next < this.byRow.length; this.next++) {
38795
+ const merge2 = this.byRow[this.next];
38796
+ if (!merge2 || merge2.start.row > row2) break;
38797
+ if (merge2.end.row >= row2) this.add(merge2);
38798
+ }
38799
+ }
38800
+ /** How the merges cover column `col` of the current row. */
38801
+ at(col) {
38802
+ if (this.overlapping) {
38803
+ let merged = false;
38804
+ for (const merge3 of this.active) {
38805
+ if (col < merge3.start.col || col > merge3.end.col) continue;
38806
+ if (spans2(merge3)) return SPANNED;
38807
+ merged = true;
38808
+ }
38809
+ return merged ? SINGLE3 : NONE;
38810
+ }
38811
+ const merge2 = this.active[firstRightOf(this.active, col) - 1];
38812
+ if (!merge2 || col > merge2.end.col) return NONE;
38813
+ return spans2(merge2) ? SPANNED : SINGLE3;
38814
+ }
38815
+ add(merge2) {
38816
+ const at = firstRightOf(this.active, merge2.start.col);
38817
+ const before = this.active[at - 1];
38818
+ const after = this.active[at];
38819
+ if (before && before.end.col >= merge2.start.col || after && merge2.end.col >= after.start.col)
38820
+ this.overlapping = true;
38821
+ this.active.splice(at, 0, merge2);
38822
+ this.firstEnd = Math.min(this.firstEnd, merge2.end.row);
38823
+ }
38824
+ dropEnded(row2) {
38825
+ let kept = 0;
38826
+ let firstEnd = Number.POSITIVE_INFINITY;
38827
+ for (const merge2 of this.active) {
38828
+ if (merge2.end.row < row2) continue;
38829
+ this.active[kept++] = merge2;
38830
+ firstEnd = Math.min(firstEnd, merge2.end.row);
38831
+ }
38832
+ this.active.length = kept;
38833
+ this.firstEnd = firstEnd;
38834
+ if (!kept) this.overlapping = false;
38835
+ }
38836
+ };
38837
+
38746
38838
  // xlsx/layout/row-autofit.ts
38747
38839
  var LINE_HEIGHTS = [
38748
38840
  [6, 8.25],
@@ -38802,30 +38894,39 @@ function wrappedLineCount(text4, width, measure3) {
38802
38894
  }
38803
38895
  return lines;
38804
38896
  }
38805
- function autoFitRowHeight(workbook, sheetIndex2, row2, measure3) {
38897
+ function fitRowHeights(workbook, sheetIndex2, rows2, measure3) {
38898
+ const heights = /* @__PURE__ */ new Map();
38806
38899
  const sheet = workbook.sheets[sheetIndex2];
38807
- if (!sheet) return 15;
38808
- const cells = sheet.rows.get(row2);
38809
- if (!cells?.size) return sheet.defaultRowHeight;
38810
- const metrics = createGridMetrics(sheet, { zoom: 100 });
38811
- let tallest = 0;
38812
- for (const col of cells.keys()) {
38813
- const merged = sheet.merges.some(
38814
- (m) => row2 >= m.start.row && row2 <= m.end.row && col >= m.start.col && col <= m.end.col && (m.start.row !== m.end.row || m.start.col !== m.end.col)
38815
- );
38816
- if (merged) continue;
38817
- const view = cellView(workbook, sheetIndex2, row2, col);
38818
- if (!view.text) continue;
38819
- const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
38820
- const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
38821
- let lines = 1;
38822
- if (view.wrap) {
38823
- const width = metrics.colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
38824
- lines = wrappedLineCount(view.text, width, (text4) => measure3(text4, view.font));
38825
- }
38826
- tallest = Math.max(tallest, lines * lineHeightPoints(sizePt));
38827
- }
38828
- return tallest > 0 ? tallest : sheet.defaultRowHeight;
38900
+ if (!sheet) return heights;
38901
+ const filled = [];
38902
+ for (const row2 of new Set(rows2)) {
38903
+ if (sheet.rows.get(row2)?.size) filled.push(row2);
38904
+ else heights.set(row2, sheet.defaultRowHeight);
38905
+ }
38906
+ filled.sort((a2, b) => a2 - b);
38907
+ const merges = new MergeSweep(sheet.merges);
38908
+ let colWidth;
38909
+ for (const row2 of filled) {
38910
+ merges.moveTo(row2);
38911
+ let tallest = 0;
38912
+ for (const col of sheet.rows.get(row2)?.keys() ?? []) {
38913
+ const cover = merges.at(col);
38914
+ if (cover.spanned) continue;
38915
+ const view = cellView(workbook, sheetIndex2, row2, col, void 0, { merged: cover.merged });
38916
+ if (!view.text) continue;
38917
+ const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
38918
+ const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
38919
+ let lines = 1;
38920
+ if (view.wrap) {
38921
+ colWidth ??= createColumnWidths(sheet, { zoom: 100 });
38922
+ const width = colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
38923
+ lines = wrappedLineCount(view.text, width, (text4) => measure3(text4, view.font));
38924
+ }
38925
+ tallest = Math.max(tallest, lines * lineHeightPoints(sizePt));
38926
+ }
38927
+ heights.set(row2, tallest > 0 ? tallest : sheet.defaultRowHeight);
38928
+ }
38929
+ return heights;
38829
38930
  }
38830
38931
  var approximateMeasure = (text4, font) => text4.length * font.sizePx * (font.bold ? 0.58 : 0.53);
38831
38932
 
@@ -38833,13 +38934,16 @@ var approximateMeasure = (text4, font) => text4.length * font.sizePx * (font.bol
38833
38934
  var MAX_HEIGHT2 = 409;
38834
38935
  function autoGrowRows(ctx, s, rows2, measure3 = approximateMeasure) {
38835
38936
  const sheet = sheetAt(ctx.workbook, s);
38836
- const updates = [];
38837
- for (const row2 of new Set(rows2)) {
38937
+ const candidates = [...new Set(rows2)].filter((row2) => {
38838
38938
  const info = sheet.rowInfo.get(row2);
38839
- if (info?.customHeight || info?.hidden) continue;
38840
- const fit2 = Math.min(MAX_HEIGHT2, autoFitRowHeight(ctx.workbook, s, row2, measure3));
38939
+ return !info?.customHeight && !info?.hidden;
38940
+ });
38941
+ const fits = fitRowHeights(ctx.workbook, s, candidates, measure3);
38942
+ const updates = [];
38943
+ for (const row2 of candidates) {
38944
+ const fit2 = Math.min(MAX_HEIGHT2, fits.get(row2) ?? sheet.defaultRowHeight);
38841
38945
  const next = Math.abs(fit2 - sheet.defaultRowHeight) < 1e-9 ? void 0 : fit2;
38842
- const current = info?.height;
38946
+ const current = sheet.rowInfo.get(row2)?.height;
38843
38947
  if (current === next) continue;
38844
38948
  if (current !== void 0 && next !== void 0 && Math.abs(current - next) < 1e-9) continue;
38845
38949
  updates.push([row2, next]);
@@ -43381,13 +43485,13 @@ function chartRichTitleSvg(model, width, options7 = {}, frameHeight = 400) {
43381
43485
  measured ? 4 : 0
43382
43486
  );
43383
43487
  let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical2[0]?.before ?? 0) + (vertical2[0]?.leading ?? 0);
43384
- const spans2 = [];
43488
+ const spans3 = [];
43385
43489
  for (const [index3, line3] of metrics.entries()) {
43386
43490
  if (index3)
43387
43491
  baseline += vertical2[index3 - 1].descent + vertical2[index3 - 1].after + vertical2[index3].before + vertical2[index3].ascent;
43388
43492
  let x = line3.align === "l" ? (width - boxWidth) / 2 + 4 : line3.align === "r" ? (width + boxWidth) / 2 - 4 - line3.width : (width - line3.width) / 2;
43389
43493
  for (const run2 of line3.runs) {
43390
- spans2.push(
43494
+ spans3.push(
43391
43495
  text3(x, baseline, run2.text, {
43392
43496
  ...run2.attrs,
43393
43497
  anchor: "start"
@@ -43398,7 +43502,7 @@ function chartRichTitleSvg(model, width, options7 = {}, frameHeight = 400) {
43398
43502
  }
43399
43503
  const parent = text3(0, 0, "", { ...base, underline: false }).replace(
43400
43504
  "</text>",
43401
- `${spans2.join("")}</text>`
43505
+ `${spans3.join("")}</text>`
43402
43506
  );
43403
43507
  const markup = chartAreaRect(model, "title", {
43404
43508
  x: (width - boxWidth) / 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-core",
3
- "version": "1.19.0",
3
+ "version": "1.19.2",
4
4
  "description": "Shared OOXML logic for the Word, PowerPoint and Excel viewers: everything except the UI",
5
5
  "keywords": [
6
6
  "charts",
@@ -261,7 +261,7 @@
261
261
  },
262
262
  "dependencies": {
263
263
  "@xmldom/xmldom": "^0.9.12",
264
- "emf-converter": "^4.18.1",
264
+ "emf-converter": "^4.21.0",
265
265
  "fast-xml-parser": "^5.11.2",
266
266
  "fflate": "^0.8.3",
267
267
  "jszip": "^3.10.2",
@@ -283,20 +283,20 @@
283
283
  "devDependencies": {
284
284
  "@christophervr/ole2": "0.13.0",
285
285
  "@modelcontextprotocol/sdk": "^1.32.1",
286
- "@napi-rs/canvas": "^1.0.10",
287
- "@types/node": "^22.20.5",
286
+ "@napi-rs/canvas": "^1.0.11",
287
+ "@types/node": "^26.6.5",
288
288
  "@types/node-forge": "^1.3.14",
289
289
  "@types/utif": "3.0.6",
290
290
  "fast-check": "^4.10.2",
291
291
  "node-forge": "^1.4.0",
292
- "tsdown": "^0.23.0",
293
- "tsup": "^8.5.1",
292
+ "tsdown": "^0.23.1",
293
+ "tsup": "^9.0.0",
294
294
  "typescript": "^7.0.2",
295
295
  "unrun": "^0.3.1",
296
- "vitest": "^5.0.3",
297
- "xml-crypto": "^6.3.3",
296
+ "vitest": "^5.0.5",
297
+ "xml-crypto": "^6.4.0",
298
298
  "xmllint-wasm": "5.3.0",
299
- "zod": "^4.6.5"
299
+ "zod": "^4.6.7"
300
300
  },
301
301
  "peerDependencies": {
302
302
  "@napi-rs/canvas": "^1.0.9",