ooxml-core 1.40.0 → 1.42.0
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/README.md +4 -0
- package/dist/PptxHandler-73QIJ6SD.cjs +14 -0
- package/dist/{PptxHandler-2WYH66TS.mjs → PptxHandler-A2J4PCOB.mjs} +2 -2
- package/dist/PptxHandler-OGLVLX2T.mjs +5 -0
- package/dist/{PresentationBuilder-BUUVVMNI.cjs → PresentationBuilder-6S5PJXXF.cjs} +6 -6
- package/dist/{PresentationBuilder-VHDHLGIK.mjs → PresentationBuilder-APJKCMVS.mjs} +2 -2
- package/dist/{PresentationBuilder-RTHLLHLE.mjs → PresentationBuilder-F3BWDERK.mjs} +3 -3
- package/dist/automation/index.cjs +5322 -3452
- package/dist/automation/index.mjs +5322 -3452
- package/dist/chart/index.cjs +5 -5
- package/dist/chart/index.mjs +5 -5
- package/dist/{chunk-EXSPNK6W.cjs → chunk-3J6VIKLP.cjs} +3 -3
- package/dist/chunk-CODMW5KF.cjs +110 -0
- package/dist/{chunk-3E4GSBC7.mjs → chunk-CPSTCCRD.mjs} +4 -4
- package/dist/{chunk-6XAAJTA3.mjs → chunk-IPV3J3I5.mjs} +4925 -3049
- package/dist/{chunk-HLBIT5H4.mjs → chunk-MXA67O7R.mjs} +1 -1
- package/dist/{chunk-OGD5OQK2.mjs → chunk-N6X5CJZP.mjs} +6723 -4840
- package/dist/chunk-O3YGBYGZ.mjs +104 -0
- package/dist/{chunk-SEGPDD5W.cjs → chunk-QZPOPUI5.cjs} +4925 -3048
- package/dist/{chunk-5BVSDSJZ.mjs → chunk-VKFKEVHK.mjs} +1 -1
- package/dist/{chunk-AZNF3IOI.mjs → chunk-VV724DWE.mjs} +87 -11
- package/dist/{chunk-NHV47JOE.mjs → chunk-XVB3CBNM.mjs} +53 -9
- package/dist/{chunk-U6FMLGWH.cjs → chunk-YNQRXFTC.cjs} +1317 -1273
- package/dist/{chunk-725QJW4K.mjs → chunk-ZUEN4RQG.mjs} +1 -1
- package/dist/color/index.cjs +36 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.mjs +35 -1
- package/dist/color/office-gradient-stops.d.ts +27 -0
- package/dist/color/office-gradient-stops.d.ts.map +1 -0
- package/dist/diagram/index.cjs +5223 -3170
- package/dist/diagram/index.d.ts +1 -0
- package/dist/diagram/index.d.ts.map +1 -1
- package/dist/diagram/index.mjs +5218 -3171
- package/dist/docx/embedded.cjs +4862 -3000
- package/dist/docx/embedded.mjs +4862 -3000
- package/dist/docx/index.cjs +4970 -3072
- package/dist/docx/index.mjs +4970 -3072
- package/dist/docx/layout/index.cjs +4952 -3054
- package/dist/docx/layout/index.mjs +4952 -3054
- package/dist/docx/load/index.cjs +4999 -3137
- package/dist/docx/load/index.mjs +4999 -3137
- package/dist/docx/shape-svg.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +4907 -3045
- package/dist/docx/ui/index.mjs +4907 -3045
- package/dist/drawingml/dash-pattern.d.ts +61 -0
- package/dist/drawingml/dash-pattern.d.ts.map +1 -0
- package/dist/drawingml/index.cjs +319 -53
- package/dist/drawingml/index.d.ts +3 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +310 -54
- package/dist/drawingml/path-data.d.ts.map +1 -1
- package/dist/drawingml/rect-path-gradient.d.ts +17 -0
- package/dist/drawingml/rect-path-gradient.d.ts.map +1 -1
- package/dist/drawingml/shape-path-gradient.d.ts +57 -0
- package/dist/drawingml/shape-path-gradient.d.ts.map +1 -0
- package/dist/geometry/index.cjs +4117 -2254
- package/dist/geometry/index.mjs +4117 -2255
- package/dist/geometry/ooxml-arc.d.ts +10 -1
- package/dist/geometry/ooxml-arc.d.ts.map +1 -1
- package/dist/geometry/preset-shape-definitions-action-buttons.d.ts +7 -36
- package/dist/geometry/preset-shape-definitions-action-buttons.d.ts.map +1 -1
- package/dist/geometry/preset-shape-definitions-connectors-brackets.d.ts.map +1 -1
- package/dist/geometry/preset-shape-definitions-exact-action-buttons.d.ts +19 -0
- package/dist/geometry/preset-shape-definitions-exact-action-buttons.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-arcs.d.ts +14 -0
- package/dist/geometry/preset-shape-definitions-exact-arcs.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-arrows.d.ts +11 -0
- package/dist/geometry/preset-shape-definitions-exact-arrows.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-basic.d.ts +12 -0
- package/dist/geometry/preset-shape-definitions-exact-basic.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-circular.d.ts +18 -0
- package/dist/geometry/preset-shape-definitions-exact-circular.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-ellipse-ribbons.d.ts +16 -0
- package/dist/geometry/preset-shape-definitions-exact-ellipse-ribbons.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-funnel.d.ts +13 -0
- package/dist/geometry/preset-shape-definitions-exact-funnel.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-left-right-ribbon.d.ts +13 -0
- package/dist/geometry/preset-shape-definitions-exact-left-right-ribbon.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-math.d.ts +14 -0
- package/dist/geometry/preset-shape-definitions-exact-math.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-misc.d.ts +11 -0
- package/dist/geometry/preset-shape-definitions-exact-misc.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-ribbons.d.ts +12 -0
- package/dist/geometry/preset-shape-definitions-exact-ribbons.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-exact-scrolls.d.ts +13 -0
- package/dist/geometry/preset-shape-definitions-exact-scrolls.d.ts.map +1 -0
- package/dist/geometry/preset-shape-definitions-flowchart.d.ts.map +1 -1
- package/dist/geometry/preset-shape-definitions-misc.d.ts.map +1 -1
- package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
- package/dist/geometry/preset-shape-exact-dsl.d.ts +30 -0
- package/dist/geometry/preset-shape-exact-dsl.d.ts.map +1 -0
- package/dist/index.cjs +7637 -5216
- package/dist/index.mjs +7637 -5216
- package/dist/pptx/automation/index.cjs +5683 -3508
- package/dist/pptx/automation/index.d.ts +11 -17
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +156 -71
- package/dist/pptx/chunks/{elements-DheCTwi0.d.ts → elements-PBugbKtv.d.ts} +3 -848
- package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-Jcce8TlI.d.ts → index-BJuR8GLL.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Jcce8TlI.d.ts.map → index-BJuR8GLL.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CYukxWbl.d.ts → index-Rbvl2WaM.d.ts} +32 -13
- package/dist/pptx/chunks/index-Rbvl2WaM.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B4ofjG6_.d.ts → index-xoJGYTgQ.d.ts} +5 -3
- package/dist/pptx/chunks/index-xoJGYTgQ.d.ts.map +1 -0
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts +875 -0
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-CdgEnFuK.d.ts → text-operations-BNJr7aGa.d.ts} +3 -2
- package/dist/pptx/chunks/text-operations-BNJr7aGa.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +5419 -3335
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +4936 -2978
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +5 -5
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/table-layout.cjs +6 -6
- package/dist/pptx/editor/render/table-layout.d.ts +8 -37
- package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-layout.mjs +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +7298 -5162
- package/dist/pptx/index.d.ts +7 -6
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/teams/index.cjs +5332 -3307
- package/dist/teams/index.mjs +5332 -3307
- package/dist/text/font-metrics/design-advances.generated.d.ts +3 -1
- package/dist/text/font-metrics/design-advances.generated.d.ts.map +1 -1
- package/dist/text/font-metrics/office-font-metrics.generated.d.ts +23 -0
- package/dist/text/font-metrics/office-font-metrics.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/vertical-metrics.d.ts +35 -0
- package/dist/text/font-metrics/vertical-metrics.d.ts.map +1 -0
- package/dist/text/index.cjs +268 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +267 -1
- package/dist/visio/index.cjs +8 -0
- package/dist/visio/index.mjs +8 -0
- package/dist/visio/ui/index.cjs +8 -0
- package/dist/visio/ui/index.mjs +8 -0
- package/dist/xlsx/collab/index.cjs +5084 -3222
- package/dist/xlsx/collab/index.mjs +5084 -3222
- package/dist/xlsx/index.cjs +5298 -3404
- package/dist/xlsx/index.mjs +5298 -3404
- package/dist/xlsx/layout/shape-paint.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +5103 -3241
- package/dist/xlsx/load/index.mjs +5103 -3241
- package/dist/xlsx/ui/index.cjs +5261 -3399
- package/dist/xlsx/ui/index.mjs +5261 -3399
- package/package.json +1 -1
- package/dist/PptxHandler-SD6VWF3I.mjs +0 -5
- package/dist/PptxHandler-ZHWWOO2X.cjs +0 -14
- package/dist/chunk-3IT6ZD7K.mjs +0 -213
- package/dist/chunk-FRUB573B.cjs +0 -219
- package/dist/pptx/chunks/elements-DheCTwi0.d.ts.map +0 -1
- package/dist/pptx/chunks/index-B4ofjG6_.d.ts.map +0 -1
- package/dist/pptx/chunks/index-CYukxWbl.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-CdgEnFuK.d.ts.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// pptx/editor/render/table-layout.ts
|
|
2
|
+
var DEFAULT_INSERTED_ROW_HEIGHT = 40;
|
|
3
|
+
function createCell(text = "") {
|
|
4
|
+
return { text, style: {} };
|
|
5
|
+
}
|
|
6
|
+
function copyRows(data) {
|
|
7
|
+
return data.rows.map((row) => ({ ...row, cells: [...row.cells] }));
|
|
8
|
+
}
|
|
9
|
+
function updateIntersectingMerges(source, rows, edit) {
|
|
10
|
+
const isRowEdit = edit.axis === "row";
|
|
11
|
+
const inserting = edit.action === "insert";
|
|
12
|
+
const delta = inserting ? 1 : -1;
|
|
13
|
+
for (const [rowIndex, row] of source.rows.entries()) {
|
|
14
|
+
for (const [columnIndex, anchor] of row.cells.entries()) {
|
|
15
|
+
if (anchor.hMerge || anchor.vMerge) continue;
|
|
16
|
+
const rowSpan = anchor.rowSpan ?? 1;
|
|
17
|
+
const gridSpan = anchor.gridSpan ?? 1;
|
|
18
|
+
const start = isRowEdit ? rowIndex : columnIndex;
|
|
19
|
+
const span = isRowEdit ? rowSpan : gridSpan;
|
|
20
|
+
if (edit.index < start || edit.index >= start + span || (inserting ? edit.index === start : span === 1)) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (!Number.isInteger(rowSpan) || !Number.isInteger(gridSpan) || rowSpan < 1 || gridSpan < 1 || rowIndex + rowSpan > source.rows.length || columnIndex + gridSpan > source.columnWidths.length) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const height = isRowEdit ? rowSpan + delta : rowSpan;
|
|
27
|
+
const width = isRowEdit ? gridSpan : gridSpan + delta;
|
|
28
|
+
const anchorRemoved = !inserting && edit.index === start;
|
|
29
|
+
for (let r = rowIndex; r < rowIndex + height; r++) {
|
|
30
|
+
for (let c = columnIndex; c < columnIndex + width; c++) {
|
|
31
|
+
const cell = rows[r]?.cells[c];
|
|
32
|
+
if (!cell) continue;
|
|
33
|
+
const firstRow = r === rowIndex;
|
|
34
|
+
const firstColumn = c === columnIndex;
|
|
35
|
+
const promote = anchorRemoved && firstRow && firstColumn;
|
|
36
|
+
const content = promote && anchor.text ? anchor : cell;
|
|
37
|
+
rows[r].cells[c] = {
|
|
38
|
+
...cell,
|
|
39
|
+
text: content.text,
|
|
40
|
+
textRuns: content.textRuns,
|
|
41
|
+
paragraphs: content.paragraphs,
|
|
42
|
+
style: promote ? cell.style ?? anchor.style : cell.style,
|
|
43
|
+
rowSpan: firstRow && height > 1 ? height : void 0,
|
|
44
|
+
gridSpan: firstColumn && width > 1 ? width : void 0,
|
|
45
|
+
hMerge: firstColumn ? void 0 : true,
|
|
46
|
+
vMerge: firstRow ? void 0 : true
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function normalizeWidths(widths) {
|
|
54
|
+
const sum = widths.reduce((total, width) => total + width, 0);
|
|
55
|
+
return sum > 0 ? widths.map((width) => width / sum) : widths;
|
|
56
|
+
}
|
|
57
|
+
function insertTableRow(tableData, rowIdx, position, cellTexts) {
|
|
58
|
+
const index = Math.max(0, Math.min(tableData.rows.length, rowIdx + Number(position === "below")));
|
|
59
|
+
const rows = copyRows(tableData);
|
|
60
|
+
rows.splice(index, 0, {
|
|
61
|
+
height: DEFAULT_INSERTED_ROW_HEIGHT,
|
|
62
|
+
cells: tableData.columnWidths.map((_, column) => createCell(cellTexts?.[column]))
|
|
63
|
+
});
|
|
64
|
+
updateIntersectingMerges(tableData, rows, { axis: "row", action: "insert", index });
|
|
65
|
+
return { ...tableData, rows };
|
|
66
|
+
}
|
|
67
|
+
function deleteTableRow(tableData, rowIdx) {
|
|
68
|
+
if (tableData.rows.length <= 1 || rowIdx < 0 || rowIdx >= tableData.rows.length) {
|
|
69
|
+
return tableData;
|
|
70
|
+
}
|
|
71
|
+
const rows = copyRows(tableData);
|
|
72
|
+
rows.splice(rowIdx, 1);
|
|
73
|
+
updateIntersectingMerges(tableData, rows, { axis: "row", action: "delete", index: rowIdx });
|
|
74
|
+
return { ...tableData, rows };
|
|
75
|
+
}
|
|
76
|
+
function insertTableColumn(tableData, colIdx, position, cellTexts) {
|
|
77
|
+
const count = tableData.columnWidths.length;
|
|
78
|
+
const index = Math.max(0, Math.min(count, colIdx + Number(position === "right")));
|
|
79
|
+
const columnWidths = [...tableData.columnWidths];
|
|
80
|
+
if (count === 0) {
|
|
81
|
+
columnWidths.push(1);
|
|
82
|
+
} else {
|
|
83
|
+
const neighbour = Math.min(index, count - 1);
|
|
84
|
+
const half = columnWidths[neighbour] / 2;
|
|
85
|
+
columnWidths[neighbour] = half;
|
|
86
|
+
columnWidths.splice(index, 0, half);
|
|
87
|
+
}
|
|
88
|
+
const rows = copyRows(tableData);
|
|
89
|
+
rows.forEach((row, rowIndex) => row.cells.splice(index, 0, createCell(cellTexts?.[rowIndex])));
|
|
90
|
+
updateIntersectingMerges(tableData, rows, { axis: "column", action: "insert", index });
|
|
91
|
+
return { ...tableData, rows, columnWidths: normalizeWidths(columnWidths) };
|
|
92
|
+
}
|
|
93
|
+
function deleteTableColumn(tableData, colIdx) {
|
|
94
|
+
if (tableData.columnWidths.length <= 1 || colIdx < 0 || colIdx >= tableData.columnWidths.length) {
|
|
95
|
+
return tableData;
|
|
96
|
+
}
|
|
97
|
+
const rows = copyRows(tableData);
|
|
98
|
+
rows.forEach((row) => row.cells.splice(colIdx, 1));
|
|
99
|
+
updateIntersectingMerges(tableData, rows, { axis: "column", action: "delete", index: colIdx });
|
|
100
|
+
const columnWidths = tableData.columnWidths.filter((_, index) => index !== colIdx);
|
|
101
|
+
return { ...tableData, rows, columnWidths: normalizeWidths(columnWidths) };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { DEFAULT_INSERTED_ROW_HEIGHT, deleteTableColumn, deleteTableRow, insertTableColumn, insertTableRow };
|