pptx-viewer-core 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.mjs +0 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +116 -19
- package/dist/index.mjs +116 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,8 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
|
|
5
5
|
by [git-cliff](https://git-cliff.org); do not edit it by hand.
|
|
6
6
|
|
|
7
|
+
## [1.2.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.2.2) - 2026-07-07
|
|
8
|
+
|
|
7
9
|
## [1.2.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.2.1) - 2026-07-06
|
|
8
10
|
|
|
9
11
|
## [1.2.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.2.0) - 2026-07-05
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ There is no UI here: this is the engine on its own. Use it directly when you nee
|
|
|
20
20
|
npm install pptx-viewer-core
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
> That's it, nothing else to install.
|
|
23
|
+
> That's it, nothing else to install. All runtime dependencies are pulled in automatically by your package manager. Password protection and digital signatures need a few extra packages (`node-forge`, `xml-crypto`, `@xmldom/xmldom`), but only if you actually use those features.
|
|
24
24
|
|
|
25
25
|
## What it does
|
|
26
26
|
|
package/dist/cli/index.js
CHANGED
|
Binary file
|
package/dist/cli/index.mjs
CHANGED
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -2594,7 +2594,11 @@ declare function addSmartArtNode(data: PptxSmartArtData, text: string, afterNode
|
|
|
2594
2594
|
declare function removeSmartArtNode(data: PptxSmartArtData, nodeId: string): PptxSmartArtData;
|
|
2595
2595
|
/**
|
|
2596
2596
|
* Update the text of a SmartArt node by ID.
|
|
2597
|
-
*
|
|
2597
|
+
*
|
|
2598
|
+
* When drawing shapes exist, updates the matching shape's text in-place so the
|
|
2599
|
+
* renderer path does not change (avoids polygon-to-chevron downgrade that makes
|
|
2600
|
+
* a pyramid look like stacked bars). When no drawing shapes are present the
|
|
2601
|
+
* family renderer reads text directly from the node array.
|
|
2598
2602
|
*/
|
|
2599
2603
|
declare function updateSmartArtNodeText(data: PptxSmartArtData, nodeId: string, newText: string): PptxSmartArtData;
|
|
2600
2604
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2594,7 +2594,11 @@ declare function addSmartArtNode(data: PptxSmartArtData, text: string, afterNode
|
|
|
2594
2594
|
declare function removeSmartArtNode(data: PptxSmartArtData, nodeId: string): PptxSmartArtData;
|
|
2595
2595
|
/**
|
|
2596
2596
|
* Update the text of a SmartArt node by ID.
|
|
2597
|
-
*
|
|
2597
|
+
*
|
|
2598
|
+
* When drawing shapes exist, updates the matching shape's text in-place so the
|
|
2599
|
+
* renderer path does not change (avoids polygon-to-chevron downgrade that makes
|
|
2600
|
+
* a pyramid look like stacked bars). When no drawing shapes are present the
|
|
2601
|
+
* family renderer reads text directly from the node array.
|
|
2598
2602
|
*/
|
|
2599
2603
|
declare function updateSmartArtNodeText(data: PptxSmartArtData, nodeId: string, newText: string): PptxSmartArtData;
|
|
2600
2604
|
/**
|
package/dist/index.js
CHANGED
|
@@ -17952,6 +17952,9 @@ function resolveLayoutFromRawType(layoutType) {
|
|
|
17952
17952
|
}
|
|
17953
17953
|
|
|
17954
17954
|
// src/core/utils/smartart-editing-node-ops.ts
|
|
17955
|
+
function markShapesStale(shapes) {
|
|
17956
|
+
return shapes !== void 0 && shapes.length > 0 ? [] : void 0;
|
|
17957
|
+
}
|
|
17955
17958
|
function nextModelId() {
|
|
17956
17959
|
return `{${generateFontGuid()}}`;
|
|
17957
17960
|
}
|
|
@@ -18005,8 +18008,7 @@ function addSmartArtNode(data, text, afterNodeId) {
|
|
|
18005
18008
|
...data,
|
|
18006
18009
|
nodes,
|
|
18007
18010
|
connections: connections.length > 0 ? connections : void 0,
|
|
18008
|
-
|
|
18009
|
-
drawingShapes: void 0
|
|
18011
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18010
18012
|
};
|
|
18011
18013
|
}
|
|
18012
18014
|
function removeSmartArtNode(data, nodeId) {
|
|
@@ -18035,7 +18037,7 @@ function removeSmartArtNode(data, nodeId) {
|
|
|
18035
18037
|
...data,
|
|
18036
18038
|
nodes,
|
|
18037
18039
|
connections: connections.length > 0 ? connections : void 0,
|
|
18038
|
-
drawingShapes:
|
|
18040
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18039
18041
|
};
|
|
18040
18042
|
}
|
|
18041
18043
|
function updateSmartArtNodeText(data, nodeId, newText) {
|
|
@@ -18043,9 +18045,48 @@ function updateSmartArtNodeText(data, nodeId, newText) {
|
|
|
18043
18045
|
return {
|
|
18044
18046
|
...data,
|
|
18045
18047
|
nodes,
|
|
18046
|
-
drawingShapes:
|
|
18048
|
+
drawingShapes: patchDrawingShapeText(data.drawingShapes, data.nodes, nodeId, newText)
|
|
18047
18049
|
};
|
|
18048
18050
|
}
|
|
18051
|
+
function patchDrawingShapeText(shapes, nodes, nodeId, newText) {
|
|
18052
|
+
if (!shapes || shapes.length === 0) {
|
|
18053
|
+
return shapes;
|
|
18054
|
+
}
|
|
18055
|
+
const idx = findDrawingShapeIndex(shapes, nodes, nodeId);
|
|
18056
|
+
if (idx < 0) {
|
|
18057
|
+
return [];
|
|
18058
|
+
}
|
|
18059
|
+
const updated = [...shapes];
|
|
18060
|
+
updated[idx] = { ...updated[idx], text: newText };
|
|
18061
|
+
return updated;
|
|
18062
|
+
}
|
|
18063
|
+
function findDrawingShapeIndex(shapes, nodes, nodeId) {
|
|
18064
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18065
|
+
if (shapes[i].id.startsWith("reflow-") && shapes[i].id.endsWith(`-${nodeId}`)) {
|
|
18066
|
+
return i;
|
|
18067
|
+
}
|
|
18068
|
+
}
|
|
18069
|
+
if (shapes.length === nodes.length) {
|
|
18070
|
+
const nodeIdx = nodes.findIndex((n) => n.id === nodeId);
|
|
18071
|
+
if (nodeIdx >= 0) {
|
|
18072
|
+
return nodeIdx;
|
|
18073
|
+
}
|
|
18074
|
+
}
|
|
18075
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
18076
|
+
if (node?.text) {
|
|
18077
|
+
const text = node.text.trim();
|
|
18078
|
+
const matches = [];
|
|
18079
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18080
|
+
if (shapes[i].text?.trim() === text) {
|
|
18081
|
+
matches.push(i);
|
|
18082
|
+
}
|
|
18083
|
+
}
|
|
18084
|
+
if (matches.length === 1) {
|
|
18085
|
+
return matches[0];
|
|
18086
|
+
}
|
|
18087
|
+
}
|
|
18088
|
+
return -1;
|
|
18089
|
+
}
|
|
18049
18090
|
function reorderSmartArtNode(data, nodeId, direction) {
|
|
18050
18091
|
const node = data.nodes.find((n) => n.id === nodeId);
|
|
18051
18092
|
if (!node) {
|
|
@@ -18068,7 +18109,7 @@ function reorderSmartArtNode(data, nodeId, direction) {
|
|
|
18068
18109
|
return {
|
|
18069
18110
|
...data,
|
|
18070
18111
|
nodes,
|
|
18071
|
-
drawingShapes:
|
|
18112
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18072
18113
|
};
|
|
18073
18114
|
}
|
|
18074
18115
|
function promoteSmartArtNode(data, nodeId) {
|
|
@@ -18095,7 +18136,7 @@ function promoteSmartArtNode(data, nodeId) {
|
|
|
18095
18136
|
...data,
|
|
18096
18137
|
nodes,
|
|
18097
18138
|
connections: connections.length > 0 ? connections : void 0,
|
|
18098
|
-
drawingShapes:
|
|
18139
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18099
18140
|
};
|
|
18100
18141
|
}
|
|
18101
18142
|
function demoteSmartArtNode(data, nodeId) {
|
|
@@ -18122,7 +18163,7 @@ function demoteSmartArtNode(data, nodeId) {
|
|
|
18122
18163
|
...data,
|
|
18123
18164
|
nodes,
|
|
18124
18165
|
connections: connections.length > 0 ? connections : void 0,
|
|
18125
|
-
drawingShapes:
|
|
18166
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18126
18167
|
};
|
|
18127
18168
|
}
|
|
18128
18169
|
function addSmartArtNodeAsChild(data, parentId, text) {
|
|
@@ -18150,7 +18191,7 @@ function addSmartArtNodeAsChild(data, parentId, text) {
|
|
|
18150
18191
|
...data,
|
|
18151
18192
|
nodes,
|
|
18152
18193
|
connections: connections.length > 0 ? connections : void 0,
|
|
18153
|
-
drawingShapes:
|
|
18194
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18154
18195
|
};
|
|
18155
18196
|
}
|
|
18156
18197
|
function reorderSmartArtNodeToIndex(data, nodeId, newIndex) {
|
|
@@ -18183,7 +18224,7 @@ function reorderSmartArtNodeToIndex(data, nodeId, newIndex) {
|
|
|
18183
18224
|
return {
|
|
18184
18225
|
...data,
|
|
18185
18226
|
nodes,
|
|
18186
|
-
drawingShapes:
|
|
18227
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18187
18228
|
};
|
|
18188
18229
|
}
|
|
18189
18230
|
|
|
@@ -18223,9 +18264,61 @@ function setSmartArtNodeStyle(data, nodeId, style) {
|
|
|
18223
18264
|
return {
|
|
18224
18265
|
...data,
|
|
18225
18266
|
nodes,
|
|
18226
|
-
drawingShapes:
|
|
18267
|
+
drawingShapes: patchDrawingShapeStyle(data.drawingShapes, data.nodes, nodeId, style)
|
|
18227
18268
|
};
|
|
18228
18269
|
}
|
|
18270
|
+
function patchDrawingShapeStyle(shapes, nodes, nodeId, style) {
|
|
18271
|
+
if (!shapes || shapes.length === 0) {
|
|
18272
|
+
return shapes;
|
|
18273
|
+
}
|
|
18274
|
+
const idx = findShapeIndexForNode(shapes, nodes, nodeId);
|
|
18275
|
+
if (idx < 0) {
|
|
18276
|
+
return [];
|
|
18277
|
+
}
|
|
18278
|
+
const patch = {};
|
|
18279
|
+
if (style.fillColor !== void 0) {
|
|
18280
|
+
patch.fillColor = style.fillColor;
|
|
18281
|
+
}
|
|
18282
|
+
if (style.lineColor !== void 0) {
|
|
18283
|
+
patch.strokeColor = style.lineColor;
|
|
18284
|
+
}
|
|
18285
|
+
if (style.fontColor !== void 0) {
|
|
18286
|
+
patch.fontColor = style.fontColor;
|
|
18287
|
+
}
|
|
18288
|
+
if (Object.keys(patch).length === 0) {
|
|
18289
|
+
return shapes;
|
|
18290
|
+
}
|
|
18291
|
+
const updated = [...shapes];
|
|
18292
|
+
updated[idx] = { ...updated[idx], ...patch };
|
|
18293
|
+
return updated;
|
|
18294
|
+
}
|
|
18295
|
+
function findShapeIndexForNode(shapes, nodes, nodeId) {
|
|
18296
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18297
|
+
if (shapes[i].id.startsWith("reflow-") && shapes[i].id.endsWith(`-${nodeId}`)) {
|
|
18298
|
+
return i;
|
|
18299
|
+
}
|
|
18300
|
+
}
|
|
18301
|
+
if (shapes.length === nodes.length) {
|
|
18302
|
+
const nodeIdx = nodes.findIndex((n) => n.id === nodeId);
|
|
18303
|
+
if (nodeIdx >= 0) {
|
|
18304
|
+
return nodeIdx;
|
|
18305
|
+
}
|
|
18306
|
+
}
|
|
18307
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
18308
|
+
if (node?.text) {
|
|
18309
|
+
const text = node.text.trim();
|
|
18310
|
+
const matches = [];
|
|
18311
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18312
|
+
if (shapes[i].text?.trim() === text) {
|
|
18313
|
+
matches.push(i);
|
|
18314
|
+
}
|
|
18315
|
+
}
|
|
18316
|
+
if (matches.length === 1) {
|
|
18317
|
+
return matches[0];
|
|
18318
|
+
}
|
|
18319
|
+
}
|
|
18320
|
+
return -1;
|
|
18321
|
+
}
|
|
18229
18322
|
|
|
18230
18323
|
// src/core/utils/smartart-editing-reflow-layouts-geometric.ts
|
|
18231
18324
|
function reflowCycle(nodes, bounds) {
|
|
@@ -20282,20 +20375,24 @@ function switchSmartArtLayout(currentData, newLayoutType) {
|
|
|
20282
20375
|
return {
|
|
20283
20376
|
...currentData,
|
|
20284
20377
|
// Clear the raw layoutType string since the user is explicitly
|
|
20285
|
-
// choosing a resolved category
|
|
20378
|
+
// choosing a resolved category - this avoids the heuristic
|
|
20286
20379
|
// re-resolve overriding their choice.
|
|
20287
20380
|
layoutType: newLayoutType,
|
|
20288
20381
|
resolvedLayoutType: newLayoutType,
|
|
20289
|
-
// Clear the named layout preset
|
|
20382
|
+
// Clear the named layout preset - switching category invalidates it
|
|
20290
20383
|
layout: void 0,
|
|
20291
|
-
//
|
|
20384
|
+
// Mark stale pre-computed drawing shapes from the old layout so the
|
|
20292
20385
|
// reflow pipeline (rebuildDrawingShapesIfCleared) regenerates them for
|
|
20293
|
-
// the new layout type
|
|
20294
|
-
//
|
|
20295
|
-
|
|
20386
|
+
// the new layout type. If the element never had drawing shapes (freshly
|
|
20387
|
+
// inserted), leave undefined so the family SVG renderer handles it
|
|
20388
|
+
// without triggering a lossy polygon-to-chevron reflow.
|
|
20389
|
+
drawingShapes: markShapesStale2(currentData.drawingShapes)
|
|
20296
20390
|
// Preserve everything else: nodes, connections, colours, styles, chrome, etc.
|
|
20297
20391
|
};
|
|
20298
20392
|
}
|
|
20393
|
+
function markShapesStale2(shapes) {
|
|
20394
|
+
return shapes !== void 0 && shapes.length > 0 ? [] : void 0;
|
|
20395
|
+
}
|
|
20299
20396
|
function isSwitchableLayoutType(layoutType) {
|
|
20300
20397
|
return SWITCHABLE_LAYOUT_TYPES.includes(layoutType);
|
|
20301
20398
|
}
|
|
@@ -37618,6 +37715,9 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
37618
37715
|
slideLayoutRelationshipType,
|
|
37619
37716
|
relationshipsNamespace
|
|
37620
37717
|
});
|
|
37718
|
+
for (const slide of slides) {
|
|
37719
|
+
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
37720
|
+
}
|
|
37621
37721
|
const contentTypesXml2 = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
37622
37722
|
if (contentTypesXml2) {
|
|
37623
37723
|
const contentTypesData = this.parser.parse(contentTypesXml2);
|
|
@@ -37629,9 +37729,6 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
37629
37729
|
});
|
|
37630
37730
|
this.zip.file("[Content_Types].xml", this.builder.build(contentTypesData));
|
|
37631
37731
|
}
|
|
37632
|
-
for (const slide of slides) {
|
|
37633
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
37634
|
-
}
|
|
37635
37732
|
for (const existingCommentPath of saveSession.getExistingCommentPaths()) {
|
|
37636
37733
|
if (saveSession.isCommentPathActive(existingCommentPath)) {
|
|
37637
37734
|
continue;
|
package/dist/index.mjs
CHANGED
|
@@ -17947,6 +17947,9 @@ function resolveLayoutFromRawType(layoutType) {
|
|
|
17947
17947
|
}
|
|
17948
17948
|
|
|
17949
17949
|
// src/core/utils/smartart-editing-node-ops.ts
|
|
17950
|
+
function markShapesStale(shapes) {
|
|
17951
|
+
return shapes !== void 0 && shapes.length > 0 ? [] : void 0;
|
|
17952
|
+
}
|
|
17950
17953
|
function nextModelId() {
|
|
17951
17954
|
return `{${generateFontGuid()}}`;
|
|
17952
17955
|
}
|
|
@@ -18000,8 +18003,7 @@ function addSmartArtNode(data, text, afterNodeId) {
|
|
|
18000
18003
|
...data,
|
|
18001
18004
|
nodes,
|
|
18002
18005
|
connections: connections.length > 0 ? connections : void 0,
|
|
18003
|
-
|
|
18004
|
-
drawingShapes: void 0
|
|
18006
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18005
18007
|
};
|
|
18006
18008
|
}
|
|
18007
18009
|
function removeSmartArtNode(data, nodeId) {
|
|
@@ -18030,7 +18032,7 @@ function removeSmartArtNode(data, nodeId) {
|
|
|
18030
18032
|
...data,
|
|
18031
18033
|
nodes,
|
|
18032
18034
|
connections: connections.length > 0 ? connections : void 0,
|
|
18033
|
-
drawingShapes:
|
|
18035
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18034
18036
|
};
|
|
18035
18037
|
}
|
|
18036
18038
|
function updateSmartArtNodeText(data, nodeId, newText) {
|
|
@@ -18038,9 +18040,48 @@ function updateSmartArtNodeText(data, nodeId, newText) {
|
|
|
18038
18040
|
return {
|
|
18039
18041
|
...data,
|
|
18040
18042
|
nodes,
|
|
18041
|
-
drawingShapes:
|
|
18043
|
+
drawingShapes: patchDrawingShapeText(data.drawingShapes, data.nodes, nodeId, newText)
|
|
18042
18044
|
};
|
|
18043
18045
|
}
|
|
18046
|
+
function patchDrawingShapeText(shapes, nodes, nodeId, newText) {
|
|
18047
|
+
if (!shapes || shapes.length === 0) {
|
|
18048
|
+
return shapes;
|
|
18049
|
+
}
|
|
18050
|
+
const idx = findDrawingShapeIndex(shapes, nodes, nodeId);
|
|
18051
|
+
if (idx < 0) {
|
|
18052
|
+
return [];
|
|
18053
|
+
}
|
|
18054
|
+
const updated = [...shapes];
|
|
18055
|
+
updated[idx] = { ...updated[idx], text: newText };
|
|
18056
|
+
return updated;
|
|
18057
|
+
}
|
|
18058
|
+
function findDrawingShapeIndex(shapes, nodes, nodeId) {
|
|
18059
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18060
|
+
if (shapes[i].id.startsWith("reflow-") && shapes[i].id.endsWith(`-${nodeId}`)) {
|
|
18061
|
+
return i;
|
|
18062
|
+
}
|
|
18063
|
+
}
|
|
18064
|
+
if (shapes.length === nodes.length) {
|
|
18065
|
+
const nodeIdx = nodes.findIndex((n) => n.id === nodeId);
|
|
18066
|
+
if (nodeIdx >= 0) {
|
|
18067
|
+
return nodeIdx;
|
|
18068
|
+
}
|
|
18069
|
+
}
|
|
18070
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
18071
|
+
if (node?.text) {
|
|
18072
|
+
const text = node.text.trim();
|
|
18073
|
+
const matches = [];
|
|
18074
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18075
|
+
if (shapes[i].text?.trim() === text) {
|
|
18076
|
+
matches.push(i);
|
|
18077
|
+
}
|
|
18078
|
+
}
|
|
18079
|
+
if (matches.length === 1) {
|
|
18080
|
+
return matches[0];
|
|
18081
|
+
}
|
|
18082
|
+
}
|
|
18083
|
+
return -1;
|
|
18084
|
+
}
|
|
18044
18085
|
function reorderSmartArtNode(data, nodeId, direction) {
|
|
18045
18086
|
const node = data.nodes.find((n) => n.id === nodeId);
|
|
18046
18087
|
if (!node) {
|
|
@@ -18063,7 +18104,7 @@ function reorderSmartArtNode(data, nodeId, direction) {
|
|
|
18063
18104
|
return {
|
|
18064
18105
|
...data,
|
|
18065
18106
|
nodes,
|
|
18066
|
-
drawingShapes:
|
|
18107
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18067
18108
|
};
|
|
18068
18109
|
}
|
|
18069
18110
|
function promoteSmartArtNode(data, nodeId) {
|
|
@@ -18090,7 +18131,7 @@ function promoteSmartArtNode(data, nodeId) {
|
|
|
18090
18131
|
...data,
|
|
18091
18132
|
nodes,
|
|
18092
18133
|
connections: connections.length > 0 ? connections : void 0,
|
|
18093
|
-
drawingShapes:
|
|
18134
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18094
18135
|
};
|
|
18095
18136
|
}
|
|
18096
18137
|
function demoteSmartArtNode(data, nodeId) {
|
|
@@ -18117,7 +18158,7 @@ function demoteSmartArtNode(data, nodeId) {
|
|
|
18117
18158
|
...data,
|
|
18118
18159
|
nodes,
|
|
18119
18160
|
connections: connections.length > 0 ? connections : void 0,
|
|
18120
|
-
drawingShapes:
|
|
18161
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18121
18162
|
};
|
|
18122
18163
|
}
|
|
18123
18164
|
function addSmartArtNodeAsChild(data, parentId, text) {
|
|
@@ -18145,7 +18186,7 @@ function addSmartArtNodeAsChild(data, parentId, text) {
|
|
|
18145
18186
|
...data,
|
|
18146
18187
|
nodes,
|
|
18147
18188
|
connections: connections.length > 0 ? connections : void 0,
|
|
18148
|
-
drawingShapes:
|
|
18189
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18149
18190
|
};
|
|
18150
18191
|
}
|
|
18151
18192
|
function reorderSmartArtNodeToIndex(data, nodeId, newIndex) {
|
|
@@ -18178,7 +18219,7 @@ function reorderSmartArtNodeToIndex(data, nodeId, newIndex) {
|
|
|
18178
18219
|
return {
|
|
18179
18220
|
...data,
|
|
18180
18221
|
nodes,
|
|
18181
|
-
drawingShapes:
|
|
18222
|
+
drawingShapes: markShapesStale(data.drawingShapes)
|
|
18182
18223
|
};
|
|
18183
18224
|
}
|
|
18184
18225
|
|
|
@@ -18218,9 +18259,61 @@ function setSmartArtNodeStyle(data, nodeId, style) {
|
|
|
18218
18259
|
return {
|
|
18219
18260
|
...data,
|
|
18220
18261
|
nodes,
|
|
18221
|
-
drawingShapes:
|
|
18262
|
+
drawingShapes: patchDrawingShapeStyle(data.drawingShapes, data.nodes, nodeId, style)
|
|
18222
18263
|
};
|
|
18223
18264
|
}
|
|
18265
|
+
function patchDrawingShapeStyle(shapes, nodes, nodeId, style) {
|
|
18266
|
+
if (!shapes || shapes.length === 0) {
|
|
18267
|
+
return shapes;
|
|
18268
|
+
}
|
|
18269
|
+
const idx = findShapeIndexForNode(shapes, nodes, nodeId);
|
|
18270
|
+
if (idx < 0) {
|
|
18271
|
+
return [];
|
|
18272
|
+
}
|
|
18273
|
+
const patch = {};
|
|
18274
|
+
if (style.fillColor !== void 0) {
|
|
18275
|
+
patch.fillColor = style.fillColor;
|
|
18276
|
+
}
|
|
18277
|
+
if (style.lineColor !== void 0) {
|
|
18278
|
+
patch.strokeColor = style.lineColor;
|
|
18279
|
+
}
|
|
18280
|
+
if (style.fontColor !== void 0) {
|
|
18281
|
+
patch.fontColor = style.fontColor;
|
|
18282
|
+
}
|
|
18283
|
+
if (Object.keys(patch).length === 0) {
|
|
18284
|
+
return shapes;
|
|
18285
|
+
}
|
|
18286
|
+
const updated = [...shapes];
|
|
18287
|
+
updated[idx] = { ...updated[idx], ...patch };
|
|
18288
|
+
return updated;
|
|
18289
|
+
}
|
|
18290
|
+
function findShapeIndexForNode(shapes, nodes, nodeId) {
|
|
18291
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18292
|
+
if (shapes[i].id.startsWith("reflow-") && shapes[i].id.endsWith(`-${nodeId}`)) {
|
|
18293
|
+
return i;
|
|
18294
|
+
}
|
|
18295
|
+
}
|
|
18296
|
+
if (shapes.length === nodes.length) {
|
|
18297
|
+
const nodeIdx = nodes.findIndex((n) => n.id === nodeId);
|
|
18298
|
+
if (nodeIdx >= 0) {
|
|
18299
|
+
return nodeIdx;
|
|
18300
|
+
}
|
|
18301
|
+
}
|
|
18302
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
18303
|
+
if (node?.text) {
|
|
18304
|
+
const text = node.text.trim();
|
|
18305
|
+
const matches = [];
|
|
18306
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
18307
|
+
if (shapes[i].text?.trim() === text) {
|
|
18308
|
+
matches.push(i);
|
|
18309
|
+
}
|
|
18310
|
+
}
|
|
18311
|
+
if (matches.length === 1) {
|
|
18312
|
+
return matches[0];
|
|
18313
|
+
}
|
|
18314
|
+
}
|
|
18315
|
+
return -1;
|
|
18316
|
+
}
|
|
18224
18317
|
|
|
18225
18318
|
// src/core/utils/smartart-editing-reflow-layouts-geometric.ts
|
|
18226
18319
|
function reflowCycle(nodes, bounds) {
|
|
@@ -20277,20 +20370,24 @@ function switchSmartArtLayout(currentData, newLayoutType) {
|
|
|
20277
20370
|
return {
|
|
20278
20371
|
...currentData,
|
|
20279
20372
|
// Clear the raw layoutType string since the user is explicitly
|
|
20280
|
-
// choosing a resolved category
|
|
20373
|
+
// choosing a resolved category - this avoids the heuristic
|
|
20281
20374
|
// re-resolve overriding their choice.
|
|
20282
20375
|
layoutType: newLayoutType,
|
|
20283
20376
|
resolvedLayoutType: newLayoutType,
|
|
20284
|
-
// Clear the named layout preset
|
|
20377
|
+
// Clear the named layout preset - switching category invalidates it
|
|
20285
20378
|
layout: void 0,
|
|
20286
|
-
//
|
|
20379
|
+
// Mark stale pre-computed drawing shapes from the old layout so the
|
|
20287
20380
|
// reflow pipeline (rebuildDrawingShapesIfCleared) regenerates them for
|
|
20288
|
-
// the new layout type
|
|
20289
|
-
//
|
|
20290
|
-
|
|
20381
|
+
// the new layout type. If the element never had drawing shapes (freshly
|
|
20382
|
+
// inserted), leave undefined so the family SVG renderer handles it
|
|
20383
|
+
// without triggering a lossy polygon-to-chevron reflow.
|
|
20384
|
+
drawingShapes: markShapesStale2(currentData.drawingShapes)
|
|
20291
20385
|
// Preserve everything else: nodes, connections, colours, styles, chrome, etc.
|
|
20292
20386
|
};
|
|
20293
20387
|
}
|
|
20388
|
+
function markShapesStale2(shapes) {
|
|
20389
|
+
return shapes !== void 0 && shapes.length > 0 ? [] : void 0;
|
|
20390
|
+
}
|
|
20294
20391
|
function isSwitchableLayoutType(layoutType) {
|
|
20295
20392
|
return SWITCHABLE_LAYOUT_TYPES.includes(layoutType);
|
|
20296
20393
|
}
|
|
@@ -37613,6 +37710,9 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
37613
37710
|
slideLayoutRelationshipType,
|
|
37614
37711
|
relationshipsNamespace
|
|
37615
37712
|
});
|
|
37713
|
+
for (const slide of slides) {
|
|
37714
|
+
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
37715
|
+
}
|
|
37616
37716
|
const contentTypesXml2 = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
37617
37717
|
if (contentTypesXml2) {
|
|
37618
37718
|
const contentTypesData = this.parser.parse(contentTypesXml2);
|
|
@@ -37624,9 +37724,6 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
37624
37724
|
});
|
|
37625
37725
|
this.zip.file("[Content_Types].xml", this.builder.build(contentTypesData));
|
|
37626
37726
|
}
|
|
37627
|
-
for (const slide of slides) {
|
|
37628
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
37629
|
-
}
|
|
37630
37727
|
for (const existingCommentPath of saveSession.getExistingCommentPaths()) {
|
|
37631
37728
|
if (saveSession.isCommentPathActive(existingCommentPath)) {
|
|
37632
37729
|
continue;
|