ooxml-core 1.26.0 → 1.26.1
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-5QBRBXRX.mjs → PptxHandler-64BZOBWX.mjs} +2 -2
- package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-AILFLRH7.cjs} +2 -2
- package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-PMLQGMFQ.mjs} +1 -1
- package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-EJY2TYWL.mjs} +1 -1
- package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-HBCCO2CF.mjs} +2 -2
- package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-RBQP6A37.cjs} +4 -4
- package/dist/{chunk-EBJ724RB.mjs → chunk-DHAZSMC7.mjs} +1 -1
- package/dist/{chunk-4IIR2QEH.mjs → chunk-FZBAMWCJ.mjs} +181 -172
- package/dist/{chunk-EEHK52XB.cjs → chunk-NXTHB2M3.cjs} +180 -171
- package/dist/{chunk-KONCS53X.mjs → chunk-OQPT5IC3.mjs} +4 -4
- package/dist/{chunk-K6OFJ5GJ.mjs → chunk-OTXJVFMY.mjs} +180 -171
- package/dist/{chunk-DNYZX6YG.mjs → chunk-R7RL7W43.mjs} +1 -1
- package/dist/{chunk-ZXPPM63Y.mjs → chunk-WRFMS5CL.mjs} +1 -1
- package/dist/pptx/automation/index.cjs +188 -178
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-D3gKRIAi.d.ts → index-CbFowkp4.d.ts} +3 -3
- package/dist/pptx/chunks/{index-D3gKRIAi.d.ts.map → index-CbFowkp4.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-BOpULlxB.d.ts → index-D4FnOx6x.d.ts} +2 -2
- package/dist/pptx/chunks/{index-BOpULlxB.d.ts.map → index-D4FnOx6x.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-B94RKk84.d.ts → index-D8DNpc1X.d.ts} +14 -4
- package/dist/pptx/chunks/{index-B94RKk84.d.ts.map → index-D8DNpc1X.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +188 -178
- 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 +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +188 -178
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/pptx/cli/index.cjs
CHANGED
|
@@ -106026,6 +106026,157 @@ var init_pptx_view_props_helpers = __esm({
|
|
|
106026
106026
|
}
|
|
106027
106027
|
});
|
|
106028
106028
|
|
|
106029
|
+
// pptx/core/core/runtime/chart-part-registration.ts
|
|
106030
|
+
function asArray4(value) {
|
|
106031
|
+
if (value === void 0 || value === null) {
|
|
106032
|
+
return [];
|
|
106033
|
+
}
|
|
106034
|
+
return (Array.isArray(value) ? value : [value]).filter(
|
|
106035
|
+
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
106036
|
+
);
|
|
106037
|
+
}
|
|
106038
|
+
function nextFreeChartPartPath(zip, directory) {
|
|
106039
|
+
let n = 1;
|
|
106040
|
+
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
106041
|
+
n += 1;
|
|
106042
|
+
}
|
|
106043
|
+
return `${directory}/chart${n}.xml`;
|
|
106044
|
+
}
|
|
106045
|
+
function resolvePartTarget(fromPart, target) {
|
|
106046
|
+
if (target.startsWith("/")) {
|
|
106047
|
+
return target.slice(1);
|
|
106048
|
+
}
|
|
106049
|
+
const segments = fromPart.split("/").slice(0, -1);
|
|
106050
|
+
for (const segment of target.split("/")) {
|
|
106051
|
+
if (segment === "..") {
|
|
106052
|
+
segments.pop();
|
|
106053
|
+
} else if (segment !== "." && segment !== "") {
|
|
106054
|
+
segments.push(segment);
|
|
106055
|
+
}
|
|
106056
|
+
}
|
|
106057
|
+
return segments.join("/");
|
|
106058
|
+
}
|
|
106059
|
+
function relativePartTarget2(fromPart, toPart) {
|
|
106060
|
+
const from = fromPart.split("/").slice(0, -1);
|
|
106061
|
+
const to = toPart.split("/");
|
|
106062
|
+
let common = 0;
|
|
106063
|
+
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
106064
|
+
common += 1;
|
|
106065
|
+
}
|
|
106066
|
+
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
106067
|
+
}
|
|
106068
|
+
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
106069
|
+
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
106070
|
+
if (!xml) {
|
|
106071
|
+
return;
|
|
106072
|
+
}
|
|
106073
|
+
const tree = deps.parser.parse(xml);
|
|
106074
|
+
const types = tree["Types"] ?? {};
|
|
106075
|
+
const overrides = asArray4(types["Override"]);
|
|
106076
|
+
const partName = `/${partPath}`;
|
|
106077
|
+
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
106078
|
+
return;
|
|
106079
|
+
}
|
|
106080
|
+
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
106081
|
+
types["Override"] = overrides;
|
|
106082
|
+
tree["Types"] = types;
|
|
106083
|
+
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
106084
|
+
}
|
|
106085
|
+
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
106086
|
+
const slash = slidePath.lastIndexOf("/");
|
|
106087
|
+
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
106088
|
+
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
106089
|
+
if (!xml) {
|
|
106090
|
+
return void 0;
|
|
106091
|
+
}
|
|
106092
|
+
const tree = deps.parser.parse(xml);
|
|
106093
|
+
const root = tree["Relationships"];
|
|
106094
|
+
const relationships3 = asArray4(root?.["Relationship"]);
|
|
106095
|
+
const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
|
|
106096
|
+
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
106097
|
+
);
|
|
106098
|
+
if (!match || !root) {
|
|
106099
|
+
return void 0;
|
|
106100
|
+
}
|
|
106101
|
+
match["@_Type"] = rewrite.relationshipType;
|
|
106102
|
+
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
106103
|
+
delete match["@_TargetMode"];
|
|
106104
|
+
root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
|
|
106105
|
+
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
106106
|
+
return String(match["@_Id"]);
|
|
106107
|
+
}
|
|
106108
|
+
function rebindGraphicData(node, relationshipId2, extended) {
|
|
106109
|
+
for (const key2 of Object.keys(node)) {
|
|
106110
|
+
delete node[key2];
|
|
106111
|
+
}
|
|
106112
|
+
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
106113
|
+
if (extended) {
|
|
106114
|
+
node["cx:chart"] = {
|
|
106115
|
+
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
106116
|
+
"@_xmlns:r": NS_R,
|
|
106117
|
+
"@_r:id": relationshipId2
|
|
106118
|
+
};
|
|
106119
|
+
} else {
|
|
106120
|
+
node["c:chart"] = {
|
|
106121
|
+
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
106122
|
+
"@_xmlns:r": NS_R,
|
|
106123
|
+
"@_r:id": relationshipId2
|
|
106124
|
+
};
|
|
106125
|
+
}
|
|
106126
|
+
}
|
|
106127
|
+
function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
|
|
106128
|
+
if (!node || typeof node !== "object") {
|
|
106129
|
+
return 0;
|
|
106130
|
+
}
|
|
106131
|
+
if (Array.isArray(node)) {
|
|
106132
|
+
return node.reduce(
|
|
106133
|
+
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
|
|
106134
|
+
0
|
|
106135
|
+
);
|
|
106136
|
+
}
|
|
106137
|
+
const object = node;
|
|
106138
|
+
let count = 0;
|
|
106139
|
+
for (const key2 of Object.keys(object)) {
|
|
106140
|
+
if (key2.startsWith("@_")) {
|
|
106141
|
+
continue;
|
|
106142
|
+
}
|
|
106143
|
+
const value = object[key2];
|
|
106144
|
+
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
106145
|
+
for (const candidate of asArray4(value)) {
|
|
106146
|
+
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
106147
|
+
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
106148
|
+
if (chart && String(chart["@_r:id"]) === relationshipId2) {
|
|
106149
|
+
rebindGraphicData(candidate, relationshipId2, extended);
|
|
106150
|
+
count += 1;
|
|
106151
|
+
}
|
|
106152
|
+
}
|
|
106153
|
+
continue;
|
|
106154
|
+
}
|
|
106155
|
+
count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
|
|
106156
|
+
}
|
|
106157
|
+
return count;
|
|
106158
|
+
}
|
|
106159
|
+
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
|
|
106160
|
+
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
106161
|
+
if (!xml) {
|
|
106162
|
+
return 0;
|
|
106163
|
+
}
|
|
106164
|
+
const tree = deps.parser.parse(xml);
|
|
106165
|
+
const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
|
|
106166
|
+
if (count > 0) {
|
|
106167
|
+
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
106168
|
+
}
|
|
106169
|
+
return count;
|
|
106170
|
+
}
|
|
106171
|
+
var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
|
|
106172
|
+
var init_chart_part_registration = __esm({
|
|
106173
|
+
"pptx/core/core/runtime/chart-part-registration.ts"() {
|
|
106174
|
+
CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
106175
|
+
CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
106176
|
+
NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
106177
|
+
}
|
|
106178
|
+
});
|
|
106179
|
+
|
|
106029
106180
|
// pptx/core/utils/chart-color-style-writer.ts
|
|
106030
106181
|
function localName22(key2) {
|
|
106031
106182
|
return key2.replace(/^.*:/u, "");
|
|
@@ -106295,7 +106446,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
106295
106446
|
const chartSpace = {
|
|
106296
106447
|
"@_xmlns:cx": NS_CX,
|
|
106297
106448
|
"@_xmlns:a": NS_A,
|
|
106298
|
-
"@_xmlns:r":
|
|
106449
|
+
"@_xmlns:r": NS_R2,
|
|
106299
106450
|
"cx:chartData": {
|
|
106300
106451
|
"cx:data": chartData.series.map(
|
|
106301
106452
|
(series, index) => buildChartExData(chartData, series, index)
|
|
@@ -106309,7 +106460,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
106309
106460
|
}
|
|
106310
106461
|
return { "cx:chartSpace": chartSpace };
|
|
106311
106462
|
}
|
|
106312
|
-
var NS_CX, NS_A,
|
|
106463
|
+
var NS_CX, NS_A, NS_R2, NS_C;
|
|
106313
106464
|
var init_chart_cx_generator = __esm({
|
|
106314
106465
|
"pptx/core/utils/chart-cx-generator.ts"() {
|
|
106315
106466
|
init_chart_cx_legend();
|
|
@@ -106317,7 +106468,7 @@ var init_chart_cx_generator = __esm({
|
|
|
106317
106468
|
init_chart_cx_legend();
|
|
106318
106469
|
NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
106319
106470
|
NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
106320
|
-
|
|
106471
|
+
NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
106321
106472
|
NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
106322
106473
|
}
|
|
106323
106474
|
});
|
|
@@ -107944,7 +108095,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
107944
108095
|
"c:chartSpace": {
|
|
107945
108096
|
"@_xmlns:c": NS_C2,
|
|
107946
108097
|
"@_xmlns:a": NS_A2,
|
|
107947
|
-
"@_xmlns:r":
|
|
108098
|
+
"@_xmlns:r": NS_R3,
|
|
107948
108099
|
"c:chart": chart
|
|
107949
108100
|
}
|
|
107950
108101
|
};
|
|
@@ -107952,7 +108103,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
107952
108103
|
applyGeneratedChartSpaceFormat(result, chartData);
|
|
107953
108104
|
return result;
|
|
107954
108105
|
}
|
|
107955
|
-
var NS_C2, NS_A2,
|
|
108106
|
+
var NS_C2, NS_A2, NS_R3, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
|
|
107956
108107
|
var init_chart_xml_generator = __esm({
|
|
107957
108108
|
"pptx/core/utils/chart-xml-generator.ts"() {
|
|
107958
108109
|
init_chart_bubble_options();
|
|
@@ -107973,7 +108124,7 @@ var init_chart_xml_generator = __esm({
|
|
|
107973
108124
|
init_chart_xml_series_fill();
|
|
107974
108125
|
NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
107975
108126
|
NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
107976
|
-
|
|
108127
|
+
NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
107977
108128
|
CAT_AX_ID = 111111111;
|
|
107978
108129
|
VAL_AX_ID = 222222222;
|
|
107979
108130
|
SER_AX_ID = 333333333;
|
|
@@ -110125,7 +110276,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
|
|
|
110125
110276
|
}
|
|
110126
110277
|
return rPr;
|
|
110127
110278
|
}
|
|
110128
|
-
function
|
|
110279
|
+
function asArray5(value) {
|
|
110129
110280
|
if (Array.isArray(value)) {
|
|
110130
110281
|
return value;
|
|
110131
110282
|
}
|
|
@@ -110144,7 +110295,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
110144
110295
|
return txKey;
|
|
110145
110296
|
}
|
|
110146
110297
|
const pKey = findKey30(rich, "p", getLocalName2) ?? "a:p";
|
|
110147
|
-
const paragraphs =
|
|
110298
|
+
const paragraphs = asArray5(rich[pKey]).map((para) => {
|
|
110148
110299
|
const next = { ...para };
|
|
110149
110300
|
const pPrKey = findKey30(next, "pPr", getLocalName2) ?? "a:pPr";
|
|
110150
110301
|
const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
|
|
@@ -110157,7 +110308,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
110157
110308
|
next[pPrKey] = pPr;
|
|
110158
110309
|
const rKey = findKey30(next, "r", getLocalName2);
|
|
110159
110310
|
if (rKey) {
|
|
110160
|
-
const runs =
|
|
110311
|
+
const runs = asArray5(next[rKey]).map((run2) => {
|
|
110161
110312
|
const rPrKey = findKey30(run2, "rPr", getLocalName2) ?? "a:rPr";
|
|
110162
110313
|
const existingRPr = run2[rPrKey] ?? {};
|
|
110163
110314
|
const nextRun = { ...run2 };
|
|
@@ -110551,7 +110702,7 @@ var init_chart_neutral_save = __esm({
|
|
|
110551
110702
|
function findKey31(node, localName28, getLocalName2) {
|
|
110552
110703
|
return Object.keys(node).find((key2) => getLocalName2(key2) === localName28);
|
|
110553
110704
|
}
|
|
110554
|
-
function
|
|
110705
|
+
function asArray6(value) {
|
|
110555
110706
|
if (value === void 0 || value === null) {
|
|
110556
110707
|
return [];
|
|
110557
110708
|
}
|
|
@@ -110565,8 +110716,8 @@ function dimensionType(node) {
|
|
|
110565
110716
|
function replaceLevels(target, source, getLocalName2) {
|
|
110566
110717
|
const targetKey = findKey31(target, "lvl", getLocalName2) ?? "cx:lvl";
|
|
110567
110718
|
const sourceKey = findKey31(source, "lvl", getLocalName2);
|
|
110568
|
-
const oldLevels =
|
|
110569
|
-
const newLevels =
|
|
110719
|
+
const oldLevels = asArray6(target[targetKey]);
|
|
110720
|
+
const newLevels = asArray6(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
|
|
110570
110721
|
const old = oldLevels[index];
|
|
110571
110722
|
if (!old) {
|
|
110572
110723
|
return level2;
|
|
@@ -110585,8 +110736,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
|
|
|
110585
110736
|
for (const kind of ["strDim", "numDim"]) {
|
|
110586
110737
|
const targetKey = findKey31(target, kind, getLocalName2) ?? `cx:${kind}`;
|
|
110587
110738
|
const freshKey = findKey31(fresh, kind, getLocalName2);
|
|
110588
|
-
const existing =
|
|
110589
|
-
const incoming =
|
|
110739
|
+
const existing = asArray6(target[targetKey]);
|
|
110740
|
+
const incoming = asArray6(freshKey ? fresh[freshKey] : void 0);
|
|
110590
110741
|
for (const dimension of incoming) {
|
|
110591
110742
|
const wantedType = dimensionType(dimension);
|
|
110592
110743
|
let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
|
|
@@ -110624,7 +110775,7 @@ function child28(node, localName28, getLocalName2) {
|
|
|
110624
110775
|
const value = key2 ? node[key2] : void 0;
|
|
110625
110776
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
110626
110777
|
}
|
|
110627
|
-
function
|
|
110778
|
+
function asArray7(value) {
|
|
110628
110779
|
if (value === void 0 || value === null) {
|
|
110629
110780
|
return [];
|
|
110630
110781
|
}
|
|
@@ -110813,7 +110964,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
|
|
|
110813
110964
|
getLocalName2
|
|
110814
110965
|
);
|
|
110815
110966
|
const seriesKey = region ? findKey32(region, "series", getLocalName2) : void 0;
|
|
110816
|
-
const first2 = region && seriesKey ?
|
|
110967
|
+
const first2 = region && seriesKey ? asArray7(region[seriesKey])[0] : void 0;
|
|
110817
110968
|
const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
|
|
110818
110969
|
const series = chartData.series[0];
|
|
110819
110970
|
if (!existing || !series) {
|
|
@@ -110831,9 +110982,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
|
|
|
110831
110982
|
const chartDataKey = findKey32(chartSpace, "chartData", getLocalName2);
|
|
110832
110983
|
const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
|
|
110833
110984
|
const dataKey = findKey32(chartDataNode, "data", getLocalName2) ?? "cx:data";
|
|
110834
|
-
const dataNodes =
|
|
110985
|
+
const dataNodes = asArray7(chartDataNode[dataKey]);
|
|
110835
110986
|
const seriesKey = findKey32(region, "series", getLocalName2) ?? "cx:series";
|
|
110836
|
-
const existing =
|
|
110987
|
+
const existing = asArray7(region[seriesKey]);
|
|
110837
110988
|
const updated = [];
|
|
110838
110989
|
chartData.series.forEach((series, index) => {
|
|
110839
110990
|
const node = existing[index];
|
|
@@ -110915,157 +111066,6 @@ var init_chart_external_workbook_save = __esm({
|
|
|
110915
111066
|
}
|
|
110916
111067
|
});
|
|
110917
111068
|
|
|
110918
|
-
// pptx/core/core/runtime/chart-part-registration.ts
|
|
110919
|
-
function asArray7(value) {
|
|
110920
|
-
if (value === void 0 || value === null) {
|
|
110921
|
-
return [];
|
|
110922
|
-
}
|
|
110923
|
-
return (Array.isArray(value) ? value : [value]).filter(
|
|
110924
|
-
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
110925
|
-
);
|
|
110926
|
-
}
|
|
110927
|
-
function nextFreeChartPartPath(zip, directory) {
|
|
110928
|
-
let n = 1;
|
|
110929
|
-
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
110930
|
-
n += 1;
|
|
110931
|
-
}
|
|
110932
|
-
return `${directory}/chart${n}.xml`;
|
|
110933
|
-
}
|
|
110934
|
-
function resolvePartTarget(fromPart, target) {
|
|
110935
|
-
if (target.startsWith("/")) {
|
|
110936
|
-
return target.slice(1);
|
|
110937
|
-
}
|
|
110938
|
-
const segments = fromPart.split("/").slice(0, -1);
|
|
110939
|
-
for (const segment of target.split("/")) {
|
|
110940
|
-
if (segment === "..") {
|
|
110941
|
-
segments.pop();
|
|
110942
|
-
} else if (segment !== "." && segment !== "") {
|
|
110943
|
-
segments.push(segment);
|
|
110944
|
-
}
|
|
110945
|
-
}
|
|
110946
|
-
return segments.join("/");
|
|
110947
|
-
}
|
|
110948
|
-
function relativePartTarget2(fromPart, toPart) {
|
|
110949
|
-
const from = fromPart.split("/").slice(0, -1);
|
|
110950
|
-
const to = toPart.split("/");
|
|
110951
|
-
let common = 0;
|
|
110952
|
-
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
110953
|
-
common += 1;
|
|
110954
|
-
}
|
|
110955
|
-
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
110956
|
-
}
|
|
110957
|
-
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
110958
|
-
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
110959
|
-
if (!xml) {
|
|
110960
|
-
return;
|
|
110961
|
-
}
|
|
110962
|
-
const tree = deps.parser.parse(xml);
|
|
110963
|
-
const types = tree["Types"] ?? {};
|
|
110964
|
-
const overrides = asArray7(types["Override"]);
|
|
110965
|
-
const partName = `/${partPath}`;
|
|
110966
|
-
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
110967
|
-
return;
|
|
110968
|
-
}
|
|
110969
|
-
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
110970
|
-
types["Override"] = overrides;
|
|
110971
|
-
tree["Types"] = types;
|
|
110972
|
-
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
110973
|
-
}
|
|
110974
|
-
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
110975
|
-
const slash = slidePath.lastIndexOf("/");
|
|
110976
|
-
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
110977
|
-
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
110978
|
-
if (!xml) {
|
|
110979
|
-
return void 0;
|
|
110980
|
-
}
|
|
110981
|
-
const tree = deps.parser.parse(xml);
|
|
110982
|
-
const root = tree["Relationships"];
|
|
110983
|
-
const relationships3 = asArray7(root?.["Relationship"]);
|
|
110984
|
-
const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
|
|
110985
|
-
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
110986
|
-
);
|
|
110987
|
-
if (!match || !root) {
|
|
110988
|
-
return void 0;
|
|
110989
|
-
}
|
|
110990
|
-
match["@_Type"] = rewrite.relationshipType;
|
|
110991
|
-
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
110992
|
-
delete match["@_TargetMode"];
|
|
110993
|
-
root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
|
|
110994
|
-
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
110995
|
-
return String(match["@_Id"]);
|
|
110996
|
-
}
|
|
110997
|
-
function rebindGraphicData(node, relationshipId2, extended) {
|
|
110998
|
-
for (const key2 of Object.keys(node)) {
|
|
110999
|
-
delete node[key2];
|
|
111000
|
-
}
|
|
111001
|
-
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
111002
|
-
if (extended) {
|
|
111003
|
-
node["cx:chart"] = {
|
|
111004
|
-
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
111005
|
-
"@_xmlns:r": NS_R3,
|
|
111006
|
-
"@_r:id": relationshipId2
|
|
111007
|
-
};
|
|
111008
|
-
} else {
|
|
111009
|
-
node["c:chart"] = {
|
|
111010
|
-
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
111011
|
-
"@_xmlns:r": NS_R3,
|
|
111012
|
-
"@_r:id": relationshipId2
|
|
111013
|
-
};
|
|
111014
|
-
}
|
|
111015
|
-
}
|
|
111016
|
-
function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
|
|
111017
|
-
if (!node || typeof node !== "object") {
|
|
111018
|
-
return 0;
|
|
111019
|
-
}
|
|
111020
|
-
if (Array.isArray(node)) {
|
|
111021
|
-
return node.reduce(
|
|
111022
|
-
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
|
|
111023
|
-
0
|
|
111024
|
-
);
|
|
111025
|
-
}
|
|
111026
|
-
const object = node;
|
|
111027
|
-
let count = 0;
|
|
111028
|
-
for (const key2 of Object.keys(object)) {
|
|
111029
|
-
if (key2.startsWith("@_")) {
|
|
111030
|
-
continue;
|
|
111031
|
-
}
|
|
111032
|
-
const value = object[key2];
|
|
111033
|
-
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
111034
|
-
for (const candidate of asArray7(value)) {
|
|
111035
|
-
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
111036
|
-
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
111037
|
-
if (chart && String(chart["@_r:id"]) === relationshipId2) {
|
|
111038
|
-
rebindGraphicData(candidate, relationshipId2, extended);
|
|
111039
|
-
count += 1;
|
|
111040
|
-
}
|
|
111041
|
-
}
|
|
111042
|
-
continue;
|
|
111043
|
-
}
|
|
111044
|
-
count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
|
|
111045
|
-
}
|
|
111046
|
-
return count;
|
|
111047
|
-
}
|
|
111048
|
-
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
|
|
111049
|
-
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
111050
|
-
if (!xml) {
|
|
111051
|
-
return 0;
|
|
111052
|
-
}
|
|
111053
|
-
const tree = deps.parser.parse(xml);
|
|
111054
|
-
const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
|
|
111055
|
-
if (count > 0) {
|
|
111056
|
-
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
111057
|
-
}
|
|
111058
|
-
return count;
|
|
111059
|
-
}
|
|
111060
|
-
var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R3;
|
|
111061
|
-
var init_chart_part_registration = __esm({
|
|
111062
|
-
"pptx/core/core/runtime/chart-part-registration.ts"() {
|
|
111063
|
-
CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
111064
|
-
CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
111065
|
-
NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
111066
|
-
}
|
|
111067
|
-
});
|
|
111068
|
-
|
|
111069
111069
|
// pptx/core/core/runtime/chart-part-family-switch.ts
|
|
111070
111070
|
function detectChartPartFamily(chartSpace, getLocalName2) {
|
|
111071
111071
|
const keys = Object.keys(chartSpace);
|
|
@@ -114145,18 +114145,22 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
114145
114145
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
114146
114146
|
* a `p:cNvPr` parent.
|
|
114147
114147
|
*/
|
|
114148
|
-
serializeSingleAction(cNvPr, nodeName, action,
|
|
114148
|
+
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
114149
114149
|
if (!action) {
|
|
114150
114150
|
delete cNvPr[nodeName];
|
|
114151
114151
|
return;
|
|
114152
114152
|
}
|
|
114153
114153
|
const node = {};
|
|
114154
|
+
const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
|
|
114154
114155
|
let rId = action.rId;
|
|
114155
|
-
if (
|
|
114156
|
+
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
114157
|
+
rId = void 0;
|
|
114158
|
+
}
|
|
114159
|
+
if (!rId && url) {
|
|
114156
114160
|
const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
|
|
114157
114161
|
action.action ?? ""
|
|
114158
114162
|
);
|
|
114159
|
-
rId = resolveHyperlinkRelationshipId(
|
|
114163
|
+
rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
|
|
114160
114164
|
}
|
|
114161
114165
|
node["@_r:id"] = rId ?? "";
|
|
114162
114166
|
if (action.action) {
|
|
@@ -114230,7 +114234,7 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
114230
114234
|
* the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
|
|
114231
114235
|
* non-visual properties.
|
|
114232
114236
|
*/
|
|
114233
|
-
serializeElementActions(shape, el,
|
|
114237
|
+
serializeElementActions(shape, el, links) {
|
|
114234
114238
|
const key2 = this.getTreeBucketKeyForElementType(el.type);
|
|
114235
114239
|
const cNvPr = this.getCnvPrNode(shape, key2);
|
|
114236
114240
|
if (!cNvPr) {
|
|
@@ -114238,8 +114242,8 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
114238
114242
|
}
|
|
114239
114243
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
114240
114244
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
114241
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick,
|
|
114242
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover,
|
|
114245
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
114246
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
114243
114247
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
114244
114248
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
114245
114249
|
}
|
|
@@ -127354,7 +127358,7 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
|
|
|
127354
127358
|
if (ctx.connectorShapeIds) {
|
|
127355
127359
|
applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
|
|
127356
127360
|
}
|
|
127357
|
-
this.serializeElementActions(shape, el, ctx
|
|
127361
|
+
this.serializeElementActions(shape, el, ctx);
|
|
127358
127362
|
this.serializeShapeLocks(shape, el);
|
|
127359
127363
|
this.applyHiddenToCnvPr(shape, el);
|
|
127360
127364
|
this.applyNameToCnvPr(shape, el);
|
|
@@ -128332,6 +128336,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
|
|
|
128332
128336
|
init_theme_override_utils();
|
|
128333
128337
|
init_builders();
|
|
128334
128338
|
init_authored_slide_background();
|
|
128339
|
+
init_chart_part_registration();
|
|
128335
128340
|
init_PptxHandlerRuntimeSaveElementWriter();
|
|
128336
128341
|
init_save_structural_id_gate();
|
|
128337
128342
|
init_slide_fingerprint();
|
|
@@ -128467,7 +128472,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
|
|
|
128467
128472
|
* Process a single slide during save: update slide XML, process elements,
|
|
128468
128473
|
* rebuild shape tree, and persist relationships.
|
|
128469
128474
|
*/
|
|
128470
|
-
async processSlideForSave(slide, saveSession, constants) {
|
|
128475
|
+
async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
|
|
128471
128476
|
if (this.canSkipSlideSave(slide)) {
|
|
128472
128477
|
return;
|
|
128473
128478
|
}
|
|
@@ -128652,6 +128657,10 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
|
|
|
128652
128657
|
slideRelationshipRegistry,
|
|
128653
128658
|
resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
|
|
128654
128659
|
getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
|
|
128660
|
+
slideTargetAt: (index) => {
|
|
128661
|
+
const target = slidePaths[index];
|
|
128662
|
+
return target ? relativePartTarget2(slide.id, target) : void 0;
|
|
128663
|
+
},
|
|
128655
128664
|
resolvedMediaBytes,
|
|
128656
128665
|
saveSession,
|
|
128657
128666
|
slideImageRelationshipType: constants.slideImageRelationshipType,
|
|
@@ -131027,8 +131036,9 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
131027
131036
|
await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
|
|
131028
131037
|
await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
|
|
131029
131038
|
this.templateElementBaselines.beginSave();
|
|
131039
|
+
const slidePaths = slides.map((slide) => slide.id);
|
|
131030
131040
|
for (const slide of slides) {
|
|
131031
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
131041
|
+
await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
|
|
131032
131042
|
}
|
|
131033
131043
|
this.templateElementBaselines.commitSave();
|
|
131034
131044
|
const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
|
package/dist/pptx/cli/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { replaceText, findText, mergePresentation } from '../../chunk-
|
|
3
|
-
import { PptxMarkdownConverter } from '../../chunk-
|
|
4
|
-
import { PptxHandler } from '../../chunk-
|
|
5
|
-
import { SvgExporter, isImageLikeElement, blobUrlToDataUrl } from '../../chunk-
|
|
2
|
+
import { replaceText, findText, mergePresentation } from '../../chunk-WRFMS5CL.mjs';
|
|
3
|
+
import { PptxMarkdownConverter } from '../../chunk-DHAZSMC7.mjs';
|
|
4
|
+
import { PptxHandler } from '../../chunk-FZBAMWCJ.mjs';
|
|
5
|
+
import { SvgExporter, isImageLikeElement, blobUrlToDataUrl } from '../../chunk-R7RL7W43.mjs';
|
|
6
6
|
import '../../chunk-JJ37PCNR.mjs';
|
|
7
7
|
import '../../chunk-3GXV5MPC.mjs';
|
|
8
8
|
import '../../chunk-54S5A5PZ.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SlideProcessor, B as generateMediaFilename, C as PptxJsonAssetStats, D as SvgExportOptions, E as isPptxJsonText, F as deriveOutputPath, H as ConversionResult, I as getDirectory, L as normalizePath, M as PptxConverterOptions, N as PptxMarkdownConverter, O as SvgExporter, P as DocumentConverter, R as MediaContext, S as PPTX_JSON_VERSION, T as decodePptxJsonText, U as FileSystemAdapter, V as ConversionOptions, _ as decodeJsonValue, a as deserializePptxFromJson, b as PPTX_JSON_FORMAT, c as pptxDataFromJsonDocument, d as serializePptxToJson, f as PRESENTATION_FIELD_KEYS, g as bytesToBase64, h as base64ToBytes, i as PptxJsonFormatError, j as SlideProcessorOptions, k as SlideMetadataRenderer, l as PptxJsonSerializeOptions, m as JsonAssetAccumulator, n as PptxJsonConverterOptions, o as parsePptxJson, p as PRESENTATION_FIELD_NAMES, r as applyImportedPptxData, s as parsePptxJsonDocument, t as PptxJsonConverter, u as buildPptxJsonDocument, v as encodeJsonValue, w as PptxJsonDocument, x as PPTX_JSON_MIME_TYPE, y as PPTX_JSON_FILE_EXTENSION, z as dataUrlToMediaBytes } from "../chunks/index-
|
|
1
|
+
import { A as SlideProcessor, B as generateMediaFilename, C as PptxJsonAssetStats, D as SvgExportOptions, E as isPptxJsonText, F as deriveOutputPath, H as ConversionResult, I as getDirectory, L as normalizePath, M as PptxConverterOptions, N as PptxMarkdownConverter, O as SvgExporter, P as DocumentConverter, R as MediaContext, S as PPTX_JSON_VERSION, T as decodePptxJsonText, U as FileSystemAdapter, V as ConversionOptions, _ as decodeJsonValue, a as deserializePptxFromJson, b as PPTX_JSON_FORMAT, c as pptxDataFromJsonDocument, d as serializePptxToJson, f as PRESENTATION_FIELD_KEYS, g as bytesToBase64, h as base64ToBytes, i as PptxJsonFormatError, j as SlideProcessorOptions, k as SlideMetadataRenderer, l as PptxJsonSerializeOptions, m as JsonAssetAccumulator, n as PptxJsonConverterOptions, o as parsePptxJson, p as PRESENTATION_FIELD_NAMES, r as applyImportedPptxData, s as parsePptxJsonDocument, t as PptxJsonConverter, u as buildPptxJsonDocument, v as encodeJsonValue, w as PptxJsonDocument, x as PPTX_JSON_MIME_TYPE, y as PPTX_JSON_FILE_EXTENSION, z as dataUrlToMediaBytes } from "../chunks/index-D4FnOx6x.js";
|
|
2
2
|
export { type ConversionOptions, type ConversionResult, DocumentConverter, type FileSystemAdapter, type JsonAssetAccumulator, MediaContext, PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, type PptxConverterOptions, type PptxJsonAssetStats, PptxJsonConverter, type PptxJsonConverterOptions, type PptxJsonDocument, PptxJsonFormatError, type PptxJsonSerializeOptions, PptxMarkdownConverter, SlideMetadataRenderer, SlideProcessor, type SlideProcessorOptions, type SvgExportOptions, SvgExporter, applyImportedPptxData, base64ToBytes, buildPptxJsonDocument, bytesToBase64, dataUrlToMediaBytes, decodeJsonValue, decodePptxJsonText, deriveOutputPath, deserializePptxFromJson, encodeJsonValue, generateMediaFilename, getDirectory, isPptxJsonText, normalizePath, parsePptxJson, parsePptxJsonDocument, pptxDataFromJsonDocument, serializePptxToJson };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../chunk-6Q7TP72Y.mjs';
|
|
2
|
-
export { DocumentConverter, MediaContext, PptxMarkdownConverter, SlideMetadataRenderer, SlideProcessor, dataUrlToMediaBytes, deriveOutputPath, generateMediaFilename, getDirectory, normalizePath } from '../../chunk-
|
|
3
|
-
export { PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, PptxJsonConverter, PptxJsonFormatError, SvgExporter, applyImportedPptxData, base64ToBytes, buildPptxJsonDocument, bytesToBase64, decodeJsonValue, decodePptxJsonText, deserializePptxFromJson, encodeJsonValue, isPptxJsonText, parsePptxJson, parsePptxJsonDocument, pptxDataFromJsonDocument, serializePptxToJson } from '../../chunk-
|
|
2
|
+
export { DocumentConverter, MediaContext, PptxMarkdownConverter, SlideMetadataRenderer, SlideProcessor, dataUrlToMediaBytes, deriveOutputPath, generateMediaFilename, getDirectory, normalizePath } from '../../chunk-DHAZSMC7.mjs';
|
|
3
|
+
export { PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, PptxJsonConverter, PptxJsonFormatError, SvgExporter, applyImportedPptxData, base64ToBytes, buildPptxJsonDocument, bytesToBase64, decodeJsonValue, decodePptxJsonText, deserializePptxFromJson, encodeJsonValue, isPptxJsonText, parsePptxJson, parsePptxJsonDocument, pptxDataFromJsonDocument, serializePptxToJson } from '../../chunk-R7RL7W43.mjs';
|
|
4
4
|
import '../../chunk-JJ37PCNR.mjs';
|
|
5
5
|
import '../../chunk-54S5A5PZ.mjs';
|
|
6
6
|
import '../../chunk-KII4AAYH.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../chunks/index-
|
|
1
|
+
import "../../chunks/index-CbFowkp4.js";
|
|
2
2
|
import { C as PptxSlide } from "../../chunks/text-operations-CNfUj45U.js";
|
|
3
3
|
//#region pptx/editor/render/find-replace.d.ts
|
|
4
4
|
/** Identifies a single match of the find query at segment-level precision. */
|