ooxml-core 1.43.0 → 1.45.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/dist/{PptxHandler-V23RDNEX.cjs → PptxHandler-3RDVJFQV.cjs} +2 -2
- package/dist/{PptxHandler-WB3KL2WH.mjs → PptxHandler-EI6DMHPM.mjs} +1 -1
- package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-FXLXIOLT.mjs} +2 -2
- package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-3FKFRSSV.mjs} +2 -2
- package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-CSKLG64K.cjs} +4 -4
- package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-DDYHRV26.mjs} +1 -1
- package/dist/automation/index.cjs +10 -1
- package/dist/automation/index.mjs +10 -1
- package/dist/chart/edit/fill.d.ts +6 -2
- package/dist/chart/edit/fill.d.ts.map +1 -1
- package/dist/chart/index.cjs +12 -3
- package/dist/chart/index.mjs +12 -3
- package/dist/{chunk-HLYOHD2Z.mjs → chunk-CVJX6NNO.mjs} +438 -108
- package/dist/{chunk-243ZYX2B.mjs → chunk-GGJUWJXB.mjs} +1 -1
- package/dist/{chunk-KCDLTVUI.mjs → chunk-GXYK3H4O.mjs} +1 -1
- package/dist/{chunk-WEAWSXUX.mjs → chunk-LCXBTJXE.mjs} +4 -4
- package/dist/{chunk-JHYU7HGG.mjs → chunk-RVYGAYCP.mjs} +1 -1
- package/dist/{chunk-4LEVL6ZW.mjs → chunk-U5BXJQZG.mjs} +457 -105
- package/dist/{chunk-RNZQ2OU4.cjs → chunk-YBSNMVSN.cjs} +437 -107
- package/dist/index.cjs +164 -71
- package/dist/index.mjs +165 -72
- package/dist/opc/declared-fonts.d.ts +9 -0
- package/dist/opc/declared-fonts.d.ts.map +1 -0
- package/dist/opc/index.cjs +84 -0
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +85 -2
- package/dist/pptx/automation/index.cjs +529 -167
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-6Ot1b-4U.d.ts} +6 -6
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-6Ot1b-4U.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DGKI80Hj.d.ts} +61 -6
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts.map → index-DGKI80Hj.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-jdZUtLGB.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-jdZUtLGB.d.ts.map} +1 -1
- package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-Mek86RBL.d.ts} +3 -3
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-Mek86RBL.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +525 -163
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/editor/render/table-layout.d.ts +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 +558 -168
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/xlsx/index.cjs +10 -1
- package/dist/xlsx/index.mjs +10 -1
- package/dist/xlsx/ui/index.cjs +50 -6
- package/dist/xlsx/ui/index.mjs +50 -6
- package/dist/xlsx/ui/locales/de/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/options.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
|
@@ -1216,7 +1216,7 @@ function scan(xml) {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
1218
|
var escapeText = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\r/g, "
");
|
|
1219
|
-
var qualifiedName = (xml,
|
|
1219
|
+
var qualifiedName = (xml, span2) => /^<([^\s/>]+)/.exec(xml.slice(span2.start, span2.openEnd))?.[1] ?? "";
|
|
1220
1220
|
var PartPatch = class {
|
|
1221
1221
|
constructor(xml, rootElement) {
|
|
1222
1222
|
this.xml = xml;
|
|
@@ -1243,9 +1243,9 @@ var PartPatch = class {
|
|
|
1243
1243
|
this.edits.push({ start, end, text, seq: this.seq++ });
|
|
1244
1244
|
}
|
|
1245
1245
|
span(element2) {
|
|
1246
|
-
const
|
|
1247
|
-
if (!
|
|
1248
|
-
return
|
|
1246
|
+
const span2 = this.spans.get(element2);
|
|
1247
|
+
if (!span2) throw new Error("Element is not a child of the patched root");
|
|
1248
|
+
return span2;
|
|
1249
1249
|
}
|
|
1250
1250
|
/** The prefix bound to `ns` on the root, declaring `preferred` for it when none is. */
|
|
1251
1251
|
prefix(ns, preferred) {
|
|
@@ -1265,20 +1265,20 @@ var PartPatch = class {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
/** Replaces the element's content, keeping its start tag (and attributes) as written. */
|
|
1267
1267
|
setContent(element2, content2) {
|
|
1268
|
-
const
|
|
1269
|
-
if (
|
|
1270
|
-
this.add(
|
|
1271
|
-
else this.add(
|
|
1268
|
+
const span2 = this.span(element2);
|
|
1269
|
+
if (span2.selfClosing)
|
|
1270
|
+
this.add(span2.openEnd - 2, span2.openEnd, `>${content2}</${qualifiedName(this.xml, span2)}>`);
|
|
1271
|
+
else this.add(span2.openEnd, span2.closeStart, content2);
|
|
1272
1272
|
}
|
|
1273
1273
|
/** Adds ` name="value"` text to the element's start tag. */
|
|
1274
1274
|
addAttribute(element2, attribute2) {
|
|
1275
|
-
const
|
|
1276
|
-
const at =
|
|
1275
|
+
const span2 = this.span(element2);
|
|
1276
|
+
const at = span2.openEnd - (span2.selfClosing ? 2 : 1);
|
|
1277
1277
|
this.add(at, at, attribute2);
|
|
1278
1278
|
}
|
|
1279
1279
|
remove(element2) {
|
|
1280
|
-
const
|
|
1281
|
-
this.add(
|
|
1280
|
+
const span2 = this.span(element2);
|
|
1281
|
+
this.add(span2.start, span2.end, "");
|
|
1282
1282
|
}
|
|
1283
1283
|
/** Inserts `markup` before `before`, or as the root's last child. */
|
|
1284
1284
|
insert(markup, before) {
|
|
@@ -8112,6 +8112,10 @@ function applyCellFillStyle(cellProperties, style, context, slidePath) {
|
|
|
8112
8112
|
}
|
|
8113
8113
|
return hasStyle;
|
|
8114
8114
|
}
|
|
8115
|
+
function presetDashValue(value) {
|
|
8116
|
+
const text = typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
8117
|
+
return text ? text : void 0;
|
|
8118
|
+
}
|
|
8115
8119
|
function applyCellBorderStyle(cellProperties, style, context) {
|
|
8116
8120
|
if (!cellProperties) {
|
|
8117
8121
|
return false;
|
|
@@ -8149,13 +8153,13 @@ function applyCellBorderStyle(cellProperties, style, context) {
|
|
|
8149
8153
|
style[`${prefix}Color`] = color3;
|
|
8150
8154
|
hasStyle = true;
|
|
8151
8155
|
}
|
|
8152
|
-
const
|
|
8153
|
-
if (
|
|
8154
|
-
|
|
8155
|
-
if (
|
|
8156
|
-
style[`${prefix}
|
|
8157
|
-
hasStyle = true;
|
|
8156
|
+
const dash = chunkQZPOPUI5_cjs.parseDrawingLineDash(node, presetDashValue);
|
|
8157
|
+
if (dash.strokeDash) {
|
|
8158
|
+
style[`${prefix}Dash`] = dash.strokeDash;
|
|
8159
|
+
if (dash.strokeDash === "custom") {
|
|
8160
|
+
style[`${prefix}DashSegments`] = dash.customDashSegments;
|
|
8158
8161
|
}
|
|
8162
|
+
hasStyle = true;
|
|
8159
8163
|
}
|
|
8160
8164
|
}
|
|
8161
8165
|
const firstBorderColor = style.borderTopColor || style.borderBottomColor || style.borderLeftColor || style.borderRightColor;
|
|
@@ -41166,7 +41170,16 @@ function repaintSeriesForFamily(series, toLine) {
|
|
|
41166
41170
|
shape2.fill = structuredClone(shape2.line.fill);
|
|
41167
41171
|
}
|
|
41168
41172
|
function clearPointPaint(series, key2) {
|
|
41169
|
-
|
|
41173
|
+
const emptied2 = (part) => Object.keys(part).every((name) => name === "sourceXml");
|
|
41174
|
+
for (const point of series.dataPoints) {
|
|
41175
|
+
if (!point.spPr) continue;
|
|
41176
|
+
delete point.spPr[key2];
|
|
41177
|
+
if (point.spPr.line && emptied2(point.spPr.line)) delete point.spPr.line;
|
|
41178
|
+
if (emptied2(point.spPr)) delete point.spPr;
|
|
41179
|
+
}
|
|
41180
|
+
series.dataPoints = series.dataPoints.filter(
|
|
41181
|
+
(point) => Object.keys(point).some((name) => name !== "index")
|
|
41182
|
+
);
|
|
41170
41183
|
}
|
|
41171
41184
|
function setChartSeriesFill(space, index, fill3) {
|
|
41172
41185
|
return editChartSpace(space, (draft) => {
|
|
@@ -41175,7 +41188,7 @@ function setChartSeriesFill(space, index, fill3) {
|
|
|
41175
41188
|
clearPointPaint(series, "fill");
|
|
41176
41189
|
});
|
|
41177
41190
|
}
|
|
41178
|
-
function setChartSeriesColor(space, index, color3) {
|
|
41191
|
+
function setChartSeriesColor(space, index, color3, options2 = {}) {
|
|
41179
41192
|
return editChartSpace(space, (draft) => {
|
|
41180
41193
|
const { series } = chartSeriesEntryAt(draft, index);
|
|
41181
41194
|
const shape2 = series.spPr ??= {};
|
|
@@ -41185,7 +41198,7 @@ function setChartSeriesColor(space, index, color3) {
|
|
|
41185
41198
|
const fill3 = color3 ? { kind: "solid", color: withAlphaOf(color3, previous) } : void 0;
|
|
41186
41199
|
if (line) assignOrDelete(shape2.line ??= {}, "fill", fill3);
|
|
41187
41200
|
else assignOrDelete(shape2, "fill", fill3);
|
|
41188
|
-
clearPointPaint(series, line ? "line" : "fill");
|
|
41201
|
+
if (!options2.keepPointColors) clearPointPaint(series, line ? "line" : "fill");
|
|
41189
41202
|
});
|
|
41190
41203
|
}
|
|
41191
41204
|
|
|
@@ -50826,16 +50839,16 @@ function tableToShapeGroup(tableData, bounds) {
|
|
|
50826
50839
|
const y = bounds.y + rowIndex * rowHeightEmu;
|
|
50827
50840
|
let colIndex = 0;
|
|
50828
50841
|
for (const cell2 of row.cells) {
|
|
50829
|
-
const
|
|
50842
|
+
const span2 = Math.max(1, cell2.gridSpan ?? 1);
|
|
50830
50843
|
if (cell2.vMerge) {
|
|
50831
50844
|
vMergeActive[colIndex] = true;
|
|
50832
|
-
colIndex +=
|
|
50845
|
+
colIndex += span2;
|
|
50833
50846
|
continue;
|
|
50834
50847
|
}
|
|
50835
50848
|
vMergeActive[colIndex] = false;
|
|
50836
50849
|
if (!cell2.hMerge) {
|
|
50837
50850
|
const x = colStartX[colIndex] ?? bounds.x;
|
|
50838
|
-
const w = colEmuWidths.slice(colIndex, colIndex +
|
|
50851
|
+
const w = colEmuWidths.slice(colIndex, colIndex + span2).reduce((s, v) => s + v, 0);
|
|
50839
50852
|
children6.push({
|
|
50840
50853
|
kind: "shape",
|
|
50841
50854
|
spt: 1,
|
|
@@ -50849,7 +50862,7 @@ function tableToShapeGroup(tableData, bounds) {
|
|
|
50849
50862
|
text: { textType: 4, paragraphs: cellParagraphs(cell2.text) }
|
|
50850
50863
|
});
|
|
50851
50864
|
}
|
|
50852
|
-
colIndex +=
|
|
50865
|
+
colIndex += span2;
|
|
50853
50866
|
}
|
|
50854
50867
|
});
|
|
50855
50868
|
return { kind: "group", anchor: bounds, children: children6 };
|
|
@@ -60545,6 +60558,11 @@ function planNeutralChartChrome(before, probe, edits) {
|
|
|
60545
60558
|
}
|
|
60546
60559
|
|
|
60547
60560
|
// pptx/core/utils/chart-neutral-save-points.ts
|
|
60561
|
+
var emptied = (part) => Object.keys(part).every((key2) => key2 === "sourceXml");
|
|
60562
|
+
function pointShape(shape2) {
|
|
60563
|
+
if (shape2.line && emptied(shape2.line)) delete shape2.line;
|
|
60564
|
+
return emptied(shape2) ? null : shape2;
|
|
60565
|
+
}
|
|
60548
60566
|
function pointEdit(edits, seriesIndex, old, next) {
|
|
60549
60567
|
for (const key2 of ["picture", "impliedPicture", "uniqueId"])
|
|
60550
60568
|
if (!same4(old?.[key2], next[key2])) return false;
|
|
@@ -60567,6 +60585,7 @@ function pointEdit(edits, seriesIndex, old, next) {
|
|
|
60567
60585
|
) ?? null
|
|
60568
60586
|
});
|
|
60569
60587
|
}
|
|
60588
|
+
if (edit.spPr) edit.spPr = pointShape(edit.spPr);
|
|
60570
60589
|
if (!same4(old?.marker, next.marker)) {
|
|
60571
60590
|
if (!next.marker) edit.marker = null;
|
|
60572
60591
|
else {
|
|
@@ -60821,7 +60840,9 @@ function planNeutralChartSeriesColors(before, probe, edits) {
|
|
|
60821
60840
|
const value = series.color?.replace(/^#/, "");
|
|
60822
60841
|
if (value !== void 0 && !/^[\da-f]{6}$/i.test(value)) return;
|
|
60823
60842
|
edits.push(
|
|
60824
|
-
(space) => setChartSeriesColor(space, index, value ? { kind: "srgb", value, transforms: [] } : null
|
|
60843
|
+
(space) => setChartSeriesColor(space, index, value ? { kind: "srgb", value, transforms: [] } : null, {
|
|
60844
|
+
keepPointColors: true
|
|
60845
|
+
})
|
|
60825
60846
|
);
|
|
60826
60847
|
if (previous.color === void 0) delete series.color;
|
|
60827
60848
|
else series.color = previous.color;
|
|
@@ -63671,8 +63692,8 @@ function renderBars(element2, x, y, w, h) {
|
|
|
63671
63692
|
const values = chartValues(element2);
|
|
63672
63693
|
const min = Math.min(0, ...values);
|
|
63673
63694
|
const max = Math.max(0, ...values);
|
|
63674
|
-
const
|
|
63675
|
-
const zeroY = y + max /
|
|
63695
|
+
const span2 = max - min || 1;
|
|
63696
|
+
const zeroY = y + max / span2 * h;
|
|
63676
63697
|
const categoryCount = Math.max(
|
|
63677
63698
|
data.categories.length,
|
|
63678
63699
|
...data.series.map((s) => s.values.length),
|
|
@@ -63683,7 +63704,7 @@ function renderBars(element2, x, y, w, h) {
|
|
|
63683
63704
|
const parts = [`<line x1="${x}" y1="${zeroY}" x2="${x + w}" y2="${zeroY}" stroke="#666666" />`];
|
|
63684
63705
|
data.series.forEach((series, seriesIndex) => {
|
|
63685
63706
|
series.values.forEach((value, categoryIndex) => {
|
|
63686
|
-
const valueY = y + (max - value) /
|
|
63707
|
+
const valueY = y + (max - value) / span2 * h;
|
|
63687
63708
|
parts.push(
|
|
63688
63709
|
`<rect data-chart-mark="bar" x="${x + categoryIndex * clusterWidth + clusterWidth * 0.14 + seriesIndex * barWidth}" y="${Math.min(valueY, zeroY)}" width="${Math.max(barWidth - 1, 1)}" height="${Math.max(Math.abs(zeroY - valueY), 0.5)}" fill="${esc3(color2(series, seriesIndex))}" />`
|
|
63689
63710
|
);
|
|
@@ -63696,10 +63717,10 @@ function renderLines(element2, x, y, w, h) {
|
|
|
63696
63717
|
const values = chartValues(element2);
|
|
63697
63718
|
const min = Math.min(...values);
|
|
63698
63719
|
const max = Math.max(...values);
|
|
63699
|
-
const
|
|
63720
|
+
const span2 = max - min || 1;
|
|
63700
63721
|
return data.series.map((series, seriesIndex) => {
|
|
63701
63722
|
const denominator = Math.max(series.values.length - 1, 1);
|
|
63702
|
-
const points7 = series.values.map((value, index) => `${x + index / denominator * w},${y + (max - value) /
|
|
63723
|
+
const points7 = series.values.map((value, index) => `${x + index / denominator * w},${y + (max - value) / span2 * h}`).join(" ");
|
|
63703
63724
|
return `<polyline data-chart-mark="line" points="${points7}" fill="none" stroke="${esc3(color2(series, seriesIndex))}" stroke-width="2" />`;
|
|
63704
63725
|
}).join("");
|
|
63705
63726
|
}
|
|
@@ -68515,6 +68536,17 @@ var CHART_GRAPHIC_DATA_URI2 = "http://schemas.openxmlformats.org/drawingml/2006/
|
|
|
68515
68536
|
var CHART_EX_GRAPHIC_DATA_URI2 = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
68516
68537
|
var CHART_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
68517
68538
|
var CHART_NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
68539
|
+
function tableGridXml(el, widthEmu) {
|
|
68540
|
+
const fractions = el.tableData?.columnWidths ?? [];
|
|
68541
|
+
if (fractions.length === 0 || !(widthEmu > 0)) {
|
|
68542
|
+
return {};
|
|
68543
|
+
}
|
|
68544
|
+
const widths = fractions.map((fraction) => Math.max(0, Math.round(fraction * widthEmu)));
|
|
68545
|
+
const last = widths.length - 1;
|
|
68546
|
+
widths[last] = Math.max(0, (widths[last] ?? 0) + widthEmu - widths.reduce((a, b) => a + b, 0));
|
|
68547
|
+
const cols = widths.map((w) => ({ "@_w": String(w) }));
|
|
68548
|
+
return { "a:gridCol": cols.length === 1 ? cols[0] : cols };
|
|
68549
|
+
}
|
|
68518
68550
|
function buildTableGraphicFrameXml(el, emuPerPx) {
|
|
68519
68551
|
el.locks = { noGrouping: true, ...el.locks };
|
|
68520
68552
|
const offX = String(Math.round(el.x * emuPerPx));
|
|
@@ -68545,7 +68577,7 @@ function buildTableGraphicFrameXml(el, emuPerPx) {
|
|
|
68545
68577
|
"@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
|
|
68546
68578
|
"a:tbl": {
|
|
68547
68579
|
"a:tblPr": tblPr,
|
|
68548
|
-
"a:tblGrid":
|
|
68580
|
+
"a:tblGrid": tableGridXml(el, Number(extCx))
|
|
68549
68581
|
}
|
|
68550
68582
|
}
|
|
68551
68583
|
}
|
|
@@ -70679,12 +70711,86 @@ var NON_MATERIALIZED_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set([
|
|
|
70679
70711
|
"sldimg"
|
|
70680
70712
|
]);
|
|
70681
70713
|
|
|
70714
|
+
// pptx/core/core/runtime/table-cell-border-save.ts
|
|
70715
|
+
function cellEdges(style) {
|
|
70716
|
+
return [
|
|
70717
|
+
{
|
|
70718
|
+
xmlKey: "a:lnT",
|
|
70719
|
+
width: style.borderTopWidth,
|
|
70720
|
+
color: style.borderTopColor,
|
|
70721
|
+
dash: style.borderTopDash,
|
|
70722
|
+
segments: style.borderTopDashSegments
|
|
70723
|
+
},
|
|
70724
|
+
{
|
|
70725
|
+
xmlKey: "a:lnB",
|
|
70726
|
+
width: style.borderBottomWidth,
|
|
70727
|
+
color: style.borderBottomColor,
|
|
70728
|
+
dash: style.borderBottomDash,
|
|
70729
|
+
segments: style.borderBottomDashSegments
|
|
70730
|
+
},
|
|
70731
|
+
{
|
|
70732
|
+
xmlKey: "a:lnL",
|
|
70733
|
+
width: style.borderLeftWidth,
|
|
70734
|
+
color: style.borderLeftColor,
|
|
70735
|
+
dash: style.borderLeftDash,
|
|
70736
|
+
segments: style.borderLeftDashSegments
|
|
70737
|
+
},
|
|
70738
|
+
{
|
|
70739
|
+
xmlKey: "a:lnR",
|
|
70740
|
+
width: style.borderRightWidth,
|
|
70741
|
+
color: style.borderRightColor,
|
|
70742
|
+
dash: style.borderRightDash,
|
|
70743
|
+
segments: style.borderRightDashSegments
|
|
70744
|
+
}
|
|
70745
|
+
];
|
|
70746
|
+
}
|
|
70747
|
+
function writeEdgeDash(ln, edge) {
|
|
70748
|
+
if (edge.dash === void 0 || edge.dash === "") {
|
|
70749
|
+
return;
|
|
70750
|
+
}
|
|
70751
|
+
if (edge.dash === "solid") {
|
|
70752
|
+
delete ln["a:prstDash"];
|
|
70753
|
+
delete ln["a:custDash"];
|
|
70754
|
+
return;
|
|
70755
|
+
}
|
|
70756
|
+
if (edge.dash === "custom") {
|
|
70757
|
+
if (edge.segments && edge.segments.length > 0) {
|
|
70758
|
+
chunkQZPOPUI5_cjs.applyDrawingLineDash(ln, { strokeDash: "custom", customDashSegments: edge.segments });
|
|
70759
|
+
}
|
|
70760
|
+
return;
|
|
70761
|
+
}
|
|
70762
|
+
chunkQZPOPUI5_cjs.applyDrawingLineDash(ln, { strokeDash: edge.dash });
|
|
70763
|
+
}
|
|
70764
|
+
function writeCellEdgeBorders(tcPr, style, emuPerPx) {
|
|
70765
|
+
for (const edge of cellEdges(style)) {
|
|
70766
|
+
if (edge.width === void 0 && edge.color === void 0 && edge.dash === void 0) {
|
|
70767
|
+
continue;
|
|
70768
|
+
}
|
|
70769
|
+
const existing = tcPr[edge.xmlKey];
|
|
70770
|
+
const ln = existing && typeof existing === "object" ? existing : {};
|
|
70771
|
+
if (edge.width !== void 0) {
|
|
70772
|
+
ln["@_w"] = String(Math.round(edge.width * emuPerPx));
|
|
70773
|
+
}
|
|
70774
|
+
if (edge.color) {
|
|
70775
|
+
delete ln["a:noFill"];
|
|
70776
|
+
delete ln["a:gradFill"];
|
|
70777
|
+
delete ln["a:pattFill"];
|
|
70778
|
+
ln["a:solidFill"] = {
|
|
70779
|
+
"a:srgbClr": { "@_val": edge.color.replace("#", "") }
|
|
70780
|
+
};
|
|
70781
|
+
}
|
|
70782
|
+
writeEdgeDash(ln, edge);
|
|
70783
|
+
tcPr[edge.xmlKey] = chunkQZPOPUI5_cjs.reorderObjectKeys(ln, chunkQZPOPUI5_cjs.LN_CHILD_ORDER);
|
|
70784
|
+
}
|
|
70785
|
+
}
|
|
70786
|
+
|
|
70682
70787
|
// pptx/core/core/runtime/table-cell-save-helpers.ts
|
|
70683
70788
|
function writeCellFill(tcPr, style, resolveColorXml) {
|
|
70684
70789
|
if (style.fillMode === "gradient" && style.gradientFillStops && style.gradientFillStops.length > 0) {
|
|
70685
70790
|
delete tcPr["a:solidFill"];
|
|
70686
70791
|
delete tcPr["a:pattFill"];
|
|
70687
70792
|
delete tcPr["a:blipFill"];
|
|
70793
|
+
delete tcPr["a:noFill"];
|
|
70688
70794
|
const stops = style.gradientFillStops.map((stop) => {
|
|
70689
70795
|
const posRaw = typeof stop.position === "number" ? stop.position : 0;
|
|
70690
70796
|
const position3 = Math.round(Math.max(0, Math.min(1, posRaw / 100)) * 1e5);
|
|
@@ -70736,6 +70842,7 @@ function writeCellFill(tcPr, style, resolveColorXml) {
|
|
|
70736
70842
|
delete tcPr["a:solidFill"];
|
|
70737
70843
|
delete tcPr["a:gradFill"];
|
|
70738
70844
|
delete tcPr["a:blipFill"];
|
|
70845
|
+
delete tcPr["a:noFill"];
|
|
70739
70846
|
const pattXml = {
|
|
70740
70847
|
"@_prst": style.patternFillPreset
|
|
70741
70848
|
};
|
|
@@ -70759,10 +70866,12 @@ function writeCellFill(tcPr, style, resolveColorXml) {
|
|
|
70759
70866
|
delete tcPr["a:gradFill"];
|
|
70760
70867
|
delete tcPr["a:pattFill"];
|
|
70761
70868
|
delete tcPr["a:blipFill"];
|
|
70869
|
+
tcPr["a:noFill"] = tcPr["a:noFill"] ?? {};
|
|
70762
70870
|
} else if (style.fillMode !== "image" && style.backgroundColor) {
|
|
70763
70871
|
delete tcPr["a:gradFill"];
|
|
70764
70872
|
delete tcPr["a:pattFill"];
|
|
70765
70873
|
delete tcPr["a:blipFill"];
|
|
70874
|
+
delete tcPr["a:noFill"];
|
|
70766
70875
|
const resolvedOriginal = style.backgroundColorXml && resolveColorXml ? resolveColorXml(style.backgroundColorXml) : void 0;
|
|
70767
70876
|
tcPr["a:solidFill"] = chunkQZPOPUI5_cjs.serializeColorChoiceWithRef(
|
|
70768
70877
|
style.backgroundColorRef,
|
|
@@ -70979,53 +71088,7 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
70979
71088
|
pPr["@_algn"] = token2;
|
|
70980
71089
|
}
|
|
70981
71090
|
}
|
|
70982
|
-
|
|
70983
|
-
{
|
|
70984
|
-
xmlKey: "a:lnT",
|
|
70985
|
-
width: style.borderTopWidth,
|
|
70986
|
-
color: style.borderTopColor,
|
|
70987
|
-
dash: style.borderTopDash
|
|
70988
|
-
},
|
|
70989
|
-
{
|
|
70990
|
-
xmlKey: "a:lnB",
|
|
70991
|
-
width: style.borderBottomWidth,
|
|
70992
|
-
color: style.borderBottomColor,
|
|
70993
|
-
dash: style.borderBottomDash
|
|
70994
|
-
},
|
|
70995
|
-
{
|
|
70996
|
-
xmlKey: "a:lnL",
|
|
70997
|
-
width: style.borderLeftWidth,
|
|
70998
|
-
color: style.borderLeftColor,
|
|
70999
|
-
dash: style.borderLeftDash
|
|
71000
|
-
},
|
|
71001
|
-
{
|
|
71002
|
-
xmlKey: "a:lnR",
|
|
71003
|
-
width: style.borderRightWidth,
|
|
71004
|
-
color: style.borderRightColor,
|
|
71005
|
-
dash: style.borderRightDash
|
|
71006
|
-
}
|
|
71007
|
-
];
|
|
71008
|
-
for (const edge of borderEdges) {
|
|
71009
|
-
if (edge.width !== void 0 || edge.color !== void 0 || edge.dash !== void 0) {
|
|
71010
|
-
if (!tcPr[edge.xmlKey]) {
|
|
71011
|
-
tcPr[edge.xmlKey] = {};
|
|
71012
|
-
}
|
|
71013
|
-
const ln = tcPr[edge.xmlKey];
|
|
71014
|
-
if (edge.width !== void 0) {
|
|
71015
|
-
ln["@_w"] = String(Math.round(edge.width * _PptxHandlerRuntime.EMU_PER_PX));
|
|
71016
|
-
}
|
|
71017
|
-
if (edge.color) {
|
|
71018
|
-
ln["a:solidFill"] = {
|
|
71019
|
-
"a:srgbClr": { "@_val": edge.color.replace("#", "") }
|
|
71020
|
-
};
|
|
71021
|
-
}
|
|
71022
|
-
if (edge.dash && edge.dash !== "solid") {
|
|
71023
|
-
ln["a:prstDash"] = { "@_val": edge.dash };
|
|
71024
|
-
} else if (edge.dash === "solid") {
|
|
71025
|
-
delete ln["a:prstDash"];
|
|
71026
|
-
}
|
|
71027
|
-
}
|
|
71028
|
-
}
|
|
71091
|
+
writeCellEdgeBorders(tcPr, style, _PptxHandlerRuntime.EMU_PER_PX);
|
|
71029
71092
|
const emuPerPx = _PptxHandlerRuntime.EMU_PER_PX;
|
|
71030
71093
|
if (style.marginLeft !== void 0) {
|
|
71031
71094
|
tcPr["@_marL"] = String(Math.round(style.marginLeft * emuPerPx));
|
|
@@ -71390,10 +71453,13 @@ var FILL_KEYS = [
|
|
|
71390
71453
|
"a:grpFill"
|
|
71391
71454
|
];
|
|
71392
71455
|
var LINE_KEYS = [
|
|
71393
|
-
["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
|
|
71394
|
-
["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
|
|
71395
|
-
["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
|
|
71396
|
-
[
|
|
71456
|
+
["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash", "borderLeftDashSegments"]],
|
|
71457
|
+
["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash", "borderRightDashSegments"]],
|
|
71458
|
+
["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash", "borderTopDashSegments"]],
|
|
71459
|
+
[
|
|
71460
|
+
"a:lnB",
|
|
71461
|
+
["borderBottomWidth", "borderBottomColor", "borderBottomDash", "borderBottomDashSegments"]
|
|
71462
|
+
],
|
|
71397
71463
|
["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
|
|
71398
71464
|
["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
|
|
71399
71465
|
];
|
|
@@ -98019,6 +98085,269 @@ function buildShapeStyle(opts) {
|
|
|
98019
98085
|
return Object.keys(parts).length > 0 ? parts : void 0;
|
|
98020
98086
|
}
|
|
98021
98087
|
|
|
98088
|
+
// pptx/core/builders/sdk/table-border-input.ts
|
|
98089
|
+
var MAX_DASH_UNITS = 2147483647;
|
|
98090
|
+
var EDGES = [
|
|
98091
|
+
["top", "borderTop"],
|
|
98092
|
+
["right", "borderRight"],
|
|
98093
|
+
["bottom", "borderBottom"],
|
|
98094
|
+
["left", "borderLeft"]
|
|
98095
|
+
];
|
|
98096
|
+
function borderDashSegments(edge, lengths, width) {
|
|
98097
|
+
const name = `TableCellInput.borders.${edge}.dash`;
|
|
98098
|
+
if (lengths.length === 0) {
|
|
98099
|
+
throw new RangeError(`${name} must give at least one length`);
|
|
98100
|
+
}
|
|
98101
|
+
if (lengths.some((n) => !Number.isFinite(n) || n <= 0)) {
|
|
98102
|
+
throw new RangeError(`${name} lengths must be finite and above 0, got [${lengths.join(", ")}]`);
|
|
98103
|
+
}
|
|
98104
|
+
const segments = customDashSegments([...lengths], width !== void 0 && width > 0 ? width : 1);
|
|
98105
|
+
if (segments.some((s) => s.dash <= 0 || s.space <= 0)) {
|
|
98106
|
+
throw new RangeError(`${name} has a length too short to write: [${lengths.join(", ")}]`);
|
|
98107
|
+
}
|
|
98108
|
+
if (segments.some((s) => s.dash > MAX_DASH_UNITS || s.space > MAX_DASH_UNITS)) {
|
|
98109
|
+
throw new RangeError(`${name} has a length too long to write: [${lengths.join(", ")}]`);
|
|
98110
|
+
}
|
|
98111
|
+
return segments;
|
|
98112
|
+
}
|
|
98113
|
+
function edgeStyle(edge, prefix, input) {
|
|
98114
|
+
if (input.width !== void 0 && (!Number.isFinite(input.width) || input.width < 0)) {
|
|
98115
|
+
throw new RangeError(
|
|
98116
|
+
`TableCellInput.borders.${edge}.width must be a finite width of 0 or more, got ${input.width}`
|
|
98117
|
+
);
|
|
98118
|
+
}
|
|
98119
|
+
const out = {};
|
|
98120
|
+
if (input.width !== void 0) out[`${prefix}Width`] = input.width;
|
|
98121
|
+
if (input.color !== void 0) out[`${prefix}Color`] = input.color;
|
|
98122
|
+
if (Array.isArray(input.dash)) {
|
|
98123
|
+
out[`${prefix}Dash`] = "custom";
|
|
98124
|
+
out[`${prefix}DashSegments`] = borderDashSegments(edge, input.dash, input.width);
|
|
98125
|
+
} else if (input.dash !== void 0) {
|
|
98126
|
+
if (input.dash === "custom") {
|
|
98127
|
+
throw new RangeError(`TableCellInput.borders.${edge}.dash: give 'custom' as a length list`);
|
|
98128
|
+
}
|
|
98129
|
+
out[`${prefix}Dash`] = input.dash;
|
|
98130
|
+
}
|
|
98131
|
+
return out;
|
|
98132
|
+
}
|
|
98133
|
+
function tableCellBorderStyle(borders) {
|
|
98134
|
+
if (!borders) {
|
|
98135
|
+
return {};
|
|
98136
|
+
}
|
|
98137
|
+
const out = {};
|
|
98138
|
+
for (const [edge, prefix] of EDGES) {
|
|
98139
|
+
const own = borders[edge];
|
|
98140
|
+
const input = borders.all || own ? { ...borders.all, ...own } : void 0;
|
|
98141
|
+
if (input) {
|
|
98142
|
+
Object.assign(out, edgeStyle(own ? edge : "all", prefix, input));
|
|
98143
|
+
}
|
|
98144
|
+
}
|
|
98145
|
+
return out;
|
|
98146
|
+
}
|
|
98147
|
+
|
|
98148
|
+
// pptx/core/builders/sdk/table-cell-input.ts
|
|
98149
|
+
function refuseGradientExtras(fill3) {
|
|
98150
|
+
const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
|
|
98151
|
+
const unsupported3 = [
|
|
98152
|
+
fill3.tile !== void 0 ? "tile" : void 0,
|
|
98153
|
+
fill3.scaled === false ? "scaled: false" : void 0,
|
|
98154
|
+
fill3.rotWithShape !== void 0 ? "rotWithShape" : void 0,
|
|
98155
|
+
fill3.focus !== void 0 && !radial ? "focus on a linear gradient" : void 0
|
|
98156
|
+
].filter((name) => name !== void 0);
|
|
98157
|
+
if (unsupported3.length > 0) {
|
|
98158
|
+
throw new RangeError(
|
|
98159
|
+
`TableCellInput.fill: ${unsupported3.join(", ")} cannot be written on a table cell`
|
|
98160
|
+
);
|
|
98161
|
+
}
|
|
98162
|
+
if (fill3.stops.length === 0) {
|
|
98163
|
+
throw new RangeError("TableCellInput.fill: a gradient needs at least one stop");
|
|
98164
|
+
}
|
|
98165
|
+
}
|
|
98166
|
+
function tableCellFillStyle(fill3) {
|
|
98167
|
+
switch (fill3?.type) {
|
|
98168
|
+
case void 0:
|
|
98169
|
+
return {};
|
|
98170
|
+
case "solid":
|
|
98171
|
+
if (fill3.opacity !== void 0 && fill3.opacity !== 1) {
|
|
98172
|
+
throw new RangeError(
|
|
98173
|
+
`TableCellInput.fill.opacity cannot be written on a table cell, got ${fill3.opacity}`
|
|
98174
|
+
);
|
|
98175
|
+
}
|
|
98176
|
+
return {
|
|
98177
|
+
fillMode: "solid",
|
|
98178
|
+
backgroundColor: fill3.color,
|
|
98179
|
+
...fill3.themeColorRef ? { backgroundColorRef: fill3.themeColorRef } : {}
|
|
98180
|
+
};
|
|
98181
|
+
case "gradient": {
|
|
98182
|
+
refuseGradientExtras(fill3);
|
|
98183
|
+
const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
|
|
98184
|
+
return {
|
|
98185
|
+
fillMode: "gradient",
|
|
98186
|
+
gradientFillType: radial ? "radial" : "linear",
|
|
98187
|
+
gradientFillAngle: fill3.angle ?? 0,
|
|
98188
|
+
gradientFillStops: fill3.stops.map((stop) => ({
|
|
98189
|
+
color: stop.color,
|
|
98190
|
+
position: stop.position,
|
|
98191
|
+
...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
|
|
98192
|
+
})),
|
|
98193
|
+
...radial ? { gradientFillPathType: fill3.path ?? "circle" } : {},
|
|
98194
|
+
...fill3.focus ? { gradientFillFillToRect: { ...fill3.focus } } : {}
|
|
98195
|
+
};
|
|
98196
|
+
}
|
|
98197
|
+
case "pattern":
|
|
98198
|
+
if (!fill3.preset) {
|
|
98199
|
+
throw new RangeError("TableCellInput.fill: a pattern fill needs a preset");
|
|
98200
|
+
}
|
|
98201
|
+
return {
|
|
98202
|
+
fillMode: "pattern",
|
|
98203
|
+
patternFillPreset: fill3.preset,
|
|
98204
|
+
...fill3.foreground !== void 0 ? { patternFillForeground: fill3.foreground } : {},
|
|
98205
|
+
...fill3.background !== void 0 ? { patternFillBackground: fill3.background } : {}
|
|
98206
|
+
};
|
|
98207
|
+
case "image":
|
|
98208
|
+
throw new RangeError("TableCellInput.fill: an image fill cannot be written on a table cell");
|
|
98209
|
+
case "none":
|
|
98210
|
+
return { fillMode: "none" };
|
|
98211
|
+
}
|
|
98212
|
+
}
|
|
98213
|
+
function tableCellTextStyle(style) {
|
|
98214
|
+
const out = {};
|
|
98215
|
+
if (style?.fontSize !== void 0) out.fontSize = style.fontSize;
|
|
98216
|
+
if (style?.bold !== void 0) out.bold = style.bold;
|
|
98217
|
+
if (style?.italic !== void 0) out.italic = style.italic;
|
|
98218
|
+
if (style?.color !== void 0) out.color = style.color;
|
|
98219
|
+
if (style?.alignment !== void 0) out.align = style.alignment;
|
|
98220
|
+
return out;
|
|
98221
|
+
}
|
|
98222
|
+
function tableCellStyle(cell2) {
|
|
98223
|
+
const style = {
|
|
98224
|
+
...tableCellTextStyle(cell2.style),
|
|
98225
|
+
...tableCellFillStyle(cell2.fill),
|
|
98226
|
+
...tableCellBorderStyle(cell2.borders)
|
|
98227
|
+
};
|
|
98228
|
+
return cell2.style || Object.keys(style).length > 0 ? style : void 0;
|
|
98229
|
+
}
|
|
98230
|
+
|
|
98231
|
+
// pptx/core/builders/sdk/table-merge-input.ts
|
|
98232
|
+
function span(value, name) {
|
|
98233
|
+
if (value === void 0) {
|
|
98234
|
+
return 1;
|
|
98235
|
+
}
|
|
98236
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
98237
|
+
throw new RangeError(`TableCellInput.${name} must be a whole number from 1, got ${value}`);
|
|
98238
|
+
}
|
|
98239
|
+
return value;
|
|
98240
|
+
}
|
|
98241
|
+
function placeTableCells(input) {
|
|
98242
|
+
const rowCount = input.rows.length;
|
|
98243
|
+
const slots = input.rows.map(() => []);
|
|
98244
|
+
input.rows.forEach((row, ri) => {
|
|
98245
|
+
const rowSlots = slots[ri] ?? [];
|
|
98246
|
+
let ci = 0;
|
|
98247
|
+
for (const cell2 of row.cells) {
|
|
98248
|
+
while (rowSlots[ci]) {
|
|
98249
|
+
ci += 1;
|
|
98250
|
+
}
|
|
98251
|
+
const colSpan = span(cell2.gridSpan, "gridSpan");
|
|
98252
|
+
const rowSpan = span(cell2.rowSpan, "rowSpan");
|
|
98253
|
+
if (ri + rowSpan > rowCount) {
|
|
98254
|
+
throw new RangeError(
|
|
98255
|
+
`A cell in row ${ri} spans ${rowSpan} rows, past the table's ${rowCount} rows`
|
|
98256
|
+
);
|
|
98257
|
+
}
|
|
98258
|
+
for (let dr = 0; dr < rowSpan; dr++) {
|
|
98259
|
+
for (let dc = 0; dc < colSpan; dc++) {
|
|
98260
|
+
const target = slots[ri + dr] ?? [];
|
|
98261
|
+
if (target[ci + dc]) {
|
|
98262
|
+
throw new RangeError(
|
|
98263
|
+
`A cell in row ${ri} overlaps the merge covering row ${ri + dr}, column ${ci + dc}`
|
|
98264
|
+
);
|
|
98265
|
+
}
|
|
98266
|
+
target[ci + dc] = dr === 0 && dc === 0 ? { cell: cell2 } : { hMerge: dc > 0, vMerge: dr > 0 };
|
|
98267
|
+
}
|
|
98268
|
+
}
|
|
98269
|
+
ci += colSpan;
|
|
98270
|
+
}
|
|
98271
|
+
});
|
|
98272
|
+
const widest = Math.max(...slots.map((row) => row.length), 1);
|
|
98273
|
+
const declared = input.columnWidths?.length;
|
|
98274
|
+
if (declared !== void 0 && widest > declared) {
|
|
98275
|
+
throw new RangeError(`A row takes ${widest} columns, but columnWidths gives ${declared}`);
|
|
98276
|
+
}
|
|
98277
|
+
const columnCount = declared ?? widest;
|
|
98278
|
+
return {
|
|
98279
|
+
columnCount,
|
|
98280
|
+
rows: slots.map(
|
|
98281
|
+
(row) => Array.from({ length: columnCount }, (_, ci) => row[ci] ?? { cell: { text: "" } })
|
|
98282
|
+
)
|
|
98283
|
+
};
|
|
98284
|
+
}
|
|
98285
|
+
function columnFractions(columnWidths, columnCount) {
|
|
98286
|
+
if (!columnWidths) {
|
|
98287
|
+
return Array.from({ length: columnCount }, () => 1 / columnCount);
|
|
98288
|
+
}
|
|
98289
|
+
if (columnWidths.length !== columnCount) {
|
|
98290
|
+
throw new RangeError(
|
|
98291
|
+
`columnWidths gives ${columnWidths.length} widths for a table of ${columnCount} columns`
|
|
98292
|
+
);
|
|
98293
|
+
}
|
|
98294
|
+
if (columnWidths.some((w) => !Number.isFinite(w) || w < 0)) {
|
|
98295
|
+
throw new RangeError("columnWidths must be finite widths of 0 or more");
|
|
98296
|
+
}
|
|
98297
|
+
const sum = columnWidths.reduce((a, b) => a + b, 0);
|
|
98298
|
+
if (sum <= 0) {
|
|
98299
|
+
throw new RangeError("columnWidths must not all be 0");
|
|
98300
|
+
}
|
|
98301
|
+
return columnWidths.map((w) => w / sum);
|
|
98302
|
+
}
|
|
98303
|
+
|
|
98304
|
+
// pptx/core/builders/sdk/text-segment-style.ts
|
|
98305
|
+
var RUN_KEYS = [
|
|
98306
|
+
"fontFamily",
|
|
98307
|
+
"fontSize",
|
|
98308
|
+
"bold",
|
|
98309
|
+
"italic",
|
|
98310
|
+
"underline",
|
|
98311
|
+
"strikethrough",
|
|
98312
|
+
"color",
|
|
98313
|
+
"colorRef",
|
|
98314
|
+
"characterSpacing",
|
|
98315
|
+
"hyperlink",
|
|
98316
|
+
"hyperlinkAction",
|
|
98317
|
+
"hyperlinkTargetSlideIndex",
|
|
98318
|
+
"hyperlinkTooltip",
|
|
98319
|
+
"align"
|
|
98320
|
+
];
|
|
98321
|
+
function elementStyleForSegments(textStyle, segments) {
|
|
98322
|
+
const styled = segments.filter((segment) => !segment.isParagraphBreak);
|
|
98323
|
+
const first2 = styled[0]?.style;
|
|
98324
|
+
if (!first2) {
|
|
98325
|
+
return textStyle;
|
|
98326
|
+
}
|
|
98327
|
+
const next = { ...textStyle };
|
|
98328
|
+
for (const key2 of RUN_KEYS) {
|
|
98329
|
+
const value = first2[key2];
|
|
98330
|
+
if (!styled.every((segment) => sameValue2(segment.style?.[key2], value))) {
|
|
98331
|
+
continue;
|
|
98332
|
+
}
|
|
98333
|
+
if (value === void 0) {
|
|
98334
|
+
delete next[key2];
|
|
98335
|
+
} else {
|
|
98336
|
+
next[key2] = value;
|
|
98337
|
+
}
|
|
98338
|
+
}
|
|
98339
|
+
return next;
|
|
98340
|
+
}
|
|
98341
|
+
function sameValue2(a, b) {
|
|
98342
|
+
if (a === b) {
|
|
98343
|
+
return true;
|
|
98344
|
+
}
|
|
98345
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
98346
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
98347
|
+
}
|
|
98348
|
+
return false;
|
|
98349
|
+
}
|
|
98350
|
+
|
|
98022
98351
|
// pptx/core/builders/sdk/ElementFactory.ts
|
|
98023
98352
|
var idCounter = 0;
|
|
98024
98353
|
function generateId(prefix) {
|
|
@@ -98138,6 +98467,7 @@ function createTextElement(text, options2) {
|
|
|
98138
98467
|
verticalAlignment: options2?.verticalAlignment,
|
|
98139
98468
|
lineSpacing: options2?.lineSpacing
|
|
98140
98469
|
};
|
|
98470
|
+
const textSegments = buildTextSegments(text, textStyleBase);
|
|
98141
98471
|
return {
|
|
98142
98472
|
type: "text",
|
|
98143
98473
|
id: generateId("txt"),
|
|
@@ -98145,8 +98475,8 @@ function createTextElement(text, options2) {
|
|
|
98145
98475
|
rotation: options2?.rotation,
|
|
98146
98476
|
opacity: options2?.opacity,
|
|
98147
98477
|
text: plainText,
|
|
98148
|
-
textStyle: mapTextStyleInput(textStyleBase),
|
|
98149
|
-
textSegments
|
|
98478
|
+
textStyle: elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
|
|
98479
|
+
textSegments,
|
|
98150
98480
|
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
|
|
98151
98481
|
};
|
|
98152
98482
|
}
|
|
@@ -98226,32 +98556,30 @@ function createImageElement(source, options2) {
|
|
|
98226
98556
|
cropBottom: options2?.cropBottom
|
|
98227
98557
|
};
|
|
98228
98558
|
}
|
|
98559
|
+
function createTableCell(cellInput) {
|
|
98560
|
+
return {
|
|
98561
|
+
text: cellInput.text,
|
|
98562
|
+
gridSpan: cellInput.gridSpan,
|
|
98563
|
+
rowSpan: cellInput.rowSpan,
|
|
98564
|
+
style: tableCellStyle(cellInput)
|
|
98565
|
+
};
|
|
98566
|
+
}
|
|
98229
98567
|
function createTableElement(input, options2) {
|
|
98230
|
-
const
|
|
98568
|
+
const grid = input.fillMergedCells ? placeTableCells(input) : void 0;
|
|
98569
|
+
const numCols = grid?.columnCount ?? Math.max(...input.rows.map((r) => r.cells.length), 1);
|
|
98231
98570
|
const rowHeight = input.rows.length > 0 ? Math.max(30, Math.floor(200 / input.rows.length)) : 30;
|
|
98232
98571
|
const totalHeight = options2?.height ?? Math.max(100, input.rows.length * rowHeight);
|
|
98233
98572
|
const p = pos("table", { ...options2, height: totalHeight });
|
|
98234
|
-
|
|
98235
|
-
|
|
98236
|
-
const sum = input.columnWidths.reduce((a, b) => a + b, 0);
|
|
98237
|
-
colWidths = input.columnWidths.map((w) => w / sum);
|
|
98238
|
-
} else {
|
|
98239
|
-
colWidths = Array(numCols).fill(1 / numCols);
|
|
98240
|
-
}
|
|
98241
|
-
const rows = input.rows.map((rowInput) => ({
|
|
98573
|
+
const colWidths = columnFractions(input.columnWidths, numCols);
|
|
98574
|
+
const rows = input.rows.map((rowInput, ri) => ({
|
|
98242
98575
|
height: rowInput.height ?? rowHeight,
|
|
98243
|
-
cells:
|
|
98244
|
-
|
|
98245
|
-
|
|
98246
|
-
|
|
98247
|
-
|
|
98248
|
-
|
|
98249
|
-
|
|
98250
|
-
italic: cellInput.style.italic,
|
|
98251
|
-
color: cellInput.style.color,
|
|
98252
|
-
align: cellInput.style.alignment
|
|
98253
|
-
} : void 0
|
|
98254
|
-
}))
|
|
98576
|
+
cells: grid ? (grid.rows[ri] ?? []).map(
|
|
98577
|
+
(slot2) => slot2.cell ? createTableCell(slot2.cell) : {
|
|
98578
|
+
text: "",
|
|
98579
|
+
...slot2.hMerge ? { hMerge: true } : {},
|
|
98580
|
+
...slot2.vMerge ? { vMerge: true } : {}
|
|
98581
|
+
}
|
|
98582
|
+
) : rowInput.cells.map(createTableCell)
|
|
98255
98583
|
}));
|
|
98256
98584
|
const tableData = {
|
|
98257
98585
|
rows,
|
|
@@ -98266,7 +98594,9 @@ function createTableElement(input, options2) {
|
|
|
98266
98594
|
// Accent 1 unless the caller picked a style. This is decided at
|
|
98267
98595
|
// creation time so the save pipeline never has to invent a style for
|
|
98268
98596
|
// loaded tables that legitimately have none.
|
|
98269
|
-
|
|
98597
|
+
// `style: 'none'` (or '') opts out, so the cells' own formatting is not
|
|
98598
|
+
// painted over by the theme banding.
|
|
98599
|
+
tableStyleId: input.style === "none" ? void 0 : input.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
|
|
98270
98600
|
};
|
|
98271
98601
|
return {
|
|
98272
98602
|
type: "table",
|