pptx-templates 0.3.8 → 0.4.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/AI-INSTRUCTOR.md +91 -2
- package/CHANGELOG.md +125 -1
- package/dist/automizer.js +143 -176
- package/dist/automizer.js.map +1 -1
- package/dist/classes/content-type-registry.js +23 -36
- package/dist/classes/content-type-registry.js.map +1 -1
- package/dist/classes/element-importer.js +129 -148
- package/dist/classes/element-importer.js.map +1 -1
- package/dist/classes/has-shapes.js +81 -126
- package/dist/classes/has-shapes.js.map +1 -1
- package/dist/classes/layout.js +47 -67
- package/dist/classes/layout.js.map +1 -1
- package/dist/classes/master.js +70 -89
- package/dist/classes/master.js.map +1 -1
- package/dist/classes/placeholder-normalizer.js +48 -37
- package/dist/classes/placeholder-normalizer.js.map +1 -1
- package/dist/classes/related-content-copier.js +65 -86
- package/dist/classes/related-content-copier.js.map +1 -1
- package/dist/classes/shape.js +79 -110
- package/dist/classes/shape.js.map +1 -1
- package/dist/classes/slide-master-remover.js +108 -130
- package/dist/classes/slide-master-remover.js.map +1 -1
- package/dist/classes/slide-notes-copier.js +24 -41
- package/dist/classes/slide-notes-copier.js.map +1 -1
- package/dist/classes/slide.js +112 -141
- package/dist/classes/slide.js.map +1 -1
- package/dist/classes/template.js +82 -117
- package/dist/classes/template.js.map +1 -1
- package/dist/errors.js +5 -5
- package/dist/errors.js.map +1 -1
- package/dist/extensions/cli/index.js +3 -13
- package/dist/extensions/cli/index.js.map +1 -1
- package/dist/extensions/hide-slide/index.js +48 -46
- package/dist/extensions/hide-slide/index.js.map +1 -1
- package/dist/extensions/master-parts/index.js +36 -49
- package/dist/extensions/master-parts/index.js.map +1 -1
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js +56 -70
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -1
- package/dist/extensions/regexp-escape/index.d.ts +10 -0
- package/dist/extensions/regexp-escape/index.js +15 -0
- package/dist/extensions/regexp-escape/index.js.map +1 -0
- package/dist/extensions/run-merge/index.js +4 -5
- package/dist/extensions/run-merge/index.js.map +1 -1
- package/dist/extensions/shape-geometry/index.d.ts +2 -0
- package/dist/extensions/shape-geometry/index.js +13 -13
- package/dist/extensions/shape-geometry/index.js.map +1 -1
- package/dist/extensions/template-lint/cli.js +49 -41
- package/dist/extensions/template-lint/cli.js.map +1 -1
- package/dist/extensions/template-lint/config.js +18 -10
- package/dist/extensions/template-lint/config.js.map +1 -1
- package/dist/extensions/template-lint/data-model.js +17 -20
- package/dist/extensions/template-lint/data-model.js.map +1 -1
- package/dist/extensions/template-lint/init-cli.js +12 -17
- package/dist/extensions/template-lint/init-cli.js.map +1 -1
- package/dist/extensions/template-lint/lint.js +195 -62
- package/dist/extensions/template-lint/lint.js.map +1 -1
- package/dist/extensions/template-lint/skeleton.js +5 -6
- package/dist/extensions/template-lint/skeleton.js.map +1 -1
- package/dist/extensions/template-lint/usage-cli.js +10 -14
- package/dist/extensions/template-lint/usage-cli.js.map +1 -1
- package/dist/extensions/template-lint/usage.js +8 -9
- package/dist/extensions/template-lint/usage.js.map +1 -1
- package/dist/extensions/template-logic/clone.d.ts +2 -16
- package/dist/extensions/template-logic/clone.js +15 -90
- package/dist/extensions/template-logic/clone.js.map +1 -1
- package/dist/extensions/template-logic/commands.d.ts +8 -0
- package/dist/extensions/template-logic/commands.js +21 -12
- package/dist/extensions/template-logic/commands.js.map +1 -1
- package/dist/extensions/template-logic/expression.d.ts +6 -0
- package/dist/extensions/template-logic/expression.js +56 -54
- package/dist/extensions/template-logic/expression.js.map +1 -1
- package/dist/extensions/template-logic/images.d.ts +14 -0
- package/dist/extensions/template-logic/images.js +277 -49
- package/dist/extensions/template-logic/images.js.map +1 -1
- package/dist/extensions/template-logic/index.js +20 -27
- package/dist/extensions/template-logic/index.js.map +1 -1
- package/dist/extensions/template-logic/list-commands.js +31 -16
- package/dist/extensions/template-logic/list-commands.js.map +1 -1
- package/dist/extensions/template-logic/renderer.d.ts +24 -0
- package/dist/extensions/template-logic/renderer.js +505 -380
- package/dist/extensions/template-logic/renderer.js.map +1 -1
- package/dist/extensions/template-logic/types.d.ts +5 -0
- package/dist/extensions/template-logic/types.js +6 -0
- package/dist/extensions/template-logic/types.js.map +1 -1
- package/dist/extensions/template-render/cli.js +7 -18
- package/dist/extensions/template-render/cli.js.map +1 -1
- package/dist/extensions/template-render/index.js +152 -107
- package/dist/extensions/template-render/index.js.map +1 -1
- package/dist/extensions/template-render/prune.d.ts +14 -0
- package/dist/extensions/template-render/prune.js +131 -0
- package/dist/extensions/template-render/prune.js.map +1 -0
- package/dist/extensions/template-render/zip-text.d.ts +9 -0
- package/dist/extensions/template-render/zip-text.js +27 -0
- package/dist/extensions/template-render/zip-text.js.map +1 -0
- package/dist/extensions/template-render/zip-writer.d.ts +16 -0
- package/dist/extensions/template-render/zip-writer.js +151 -0
- package/dist/extensions/template-render/zip-writer.js.map +1 -0
- package/dist/extensions/text-flow/flow.d.ts +5 -0
- package/dist/extensions/text-flow/flow.js +196 -207
- package/dist/extensions/text-flow/flow.js.map +1 -1
- package/dist/extensions/text-flow/font-file.js +9 -7
- package/dist/extensions/text-flow/font-file.js.map +1 -1
- package/dist/extensions/text-flow/fonts.d.ts +4 -0
- package/dist/extensions/text-flow/fonts.js +45 -22
- package/dist/extensions/text-flow/fonts.js.map +1 -1
- package/dist/extensions/text-flow/layout.js +5 -6
- package/dist/extensions/text-flow/layout.js.map +1 -1
- package/dist/extensions/text-flow/slide-styles.js +18 -22
- package/dist/extensions/text-flow/slide-styles.js.map +1 -1
- package/dist/extensions/text-flow/styles.d.ts +11 -0
- package/dist/extensions/text-flow/styles.js +121 -62
- package/dist/extensions/text-flow/styles.js.map +1 -1
- package/dist/helper/archive/archive-fs.js +102 -138
- package/dist/helper/archive/archive-fs.js.map +1 -1
- package/dist/helper/archive/archive-jszip.js +101 -125
- package/dist/helper/archive/archive-jszip.js.map +1 -1
- package/dist/helper/archive/archive.d.ts +6 -0
- package/dist/helper/archive/archive.js +21 -30
- package/dist/helper/archive/archive.js.map +1 -1
- package/dist/helper/archive/jszip-fast-read.d.ts +19 -0
- package/dist/helper/archive/jszip-fast-read.js +153 -0
- package/dist/helper/archive/jszip-fast-read.js.map +1 -0
- package/dist/helper/compute-src-rect.js +4 -5
- package/dist/helper/compute-src-rect.js.map +1 -1
- package/dist/helper/content-tracker.js +86 -114
- package/dist/helper/content-tracker.js.map +1 -1
- package/dist/helper/count-helper.js +48 -78
- package/dist/helper/count-helper.js.map +1 -1
- package/dist/helper/css-style-parser.js +1 -2
- package/dist/helper/css-style-parser.js.map +1 -1
- package/dist/helper/file-helper.js +30 -48
- package/dist/helper/file-helper.js.map +1 -1
- package/dist/helper/generate/generate-pptxgenjs.js +36 -48
- package/dist/helper/generate/generate-pptxgenjs.js.map +1 -1
- package/dist/helper/html-to-multitext-helper.js +34 -18
- package/dist/helper/html-to-multitext-helper.js.map +1 -1
- package/dist/helper/hyperlink-processor.js +125 -139
- package/dist/helper/hyperlink-processor.js.map +1 -1
- package/dist/helper/jszip-helper.js +23 -32
- package/dist/helper/jszip-helper.js.map +1 -1
- package/dist/helper/layout-index.js +51 -71
- package/dist/helper/layout-index.js.map +1 -1
- package/dist/helper/logger.js +4 -4
- package/dist/helper/logger.js.map +1 -1
- package/dist/helper/media-deduplicator.d.ts +24 -0
- package/dist/helper/media-deduplicator.js +81 -34
- package/dist/helper/media-deduplicator.js.map +1 -1
- package/dist/helper/modify-background-helper.js +46 -46
- package/dist/helper/modify-background-helper.js.map +1 -1
- package/dist/helper/modify-chart-helper.js +597 -591
- package/dist/helper/modify-chart-helper.js.map +1 -1
- package/dist/helper/modify-cleanup-helper.js +112 -112
- package/dist/helper/modify-cleanup-helper.js.map +1 -1
- package/dist/helper/modify-color-helper.js +53 -53
- package/dist/helper/modify-color-helper.js.map +1 -1
- package/dist/helper/modify-helper.js +25 -25
- package/dist/helper/modify-helper.js.map +1 -1
- package/dist/helper/modify-hyperlink-helper.js +143 -154
- package/dist/helper/modify-hyperlink-helper.js.map +1 -1
- package/dist/helper/modify-image-helper.js +121 -132
- package/dist/helper/modify-image-helper.js.map +1 -1
- package/dist/helper/modify-presentation-helper.js +137 -154
- package/dist/helper/modify-presentation-helper.js.map +1 -1
- package/dist/helper/modify-shape-helper.js +262 -262
- package/dist/helper/modify-shape-helper.js.map +1 -1
- package/dist/helper/modify-table-helper.js +84 -84
- package/dist/helper/modify-table-helper.js.map +1 -1
- package/dist/helper/modify-text-helper.js +187 -189
- package/dist/helper/modify-text-helper.js.map +1 -1
- package/dist/helper/modify-xml-helper.js +36 -36
- package/dist/helper/modify-xml-helper.js.map +1 -1
- package/dist/helper/multitext-helper.js +9 -7
- package/dist/helper/multitext-helper.js.map +1 -1
- package/dist/helper/ppt-paths.js +17 -17
- package/dist/helper/ppt-paths.js.map +1 -1
- package/dist/helper/shape-type-detector.js +18 -29
- package/dist/helper/shape-type-detector.js.map +1 -1
- package/dist/helper/text-replace-helper.js +6 -7
- package/dist/helper/text-replace-helper.js.map +1 -1
- package/dist/helper/xml-clone.d.ts +24 -0
- package/dist/helper/xml-clone.js +269 -0
- package/dist/helper/xml-clone.js.map +1 -0
- package/dist/helper/xml-elements.js +17 -20
- package/dist/helper/xml-elements.js.map +1 -1
- package/dist/helper/xml-find.d.ts +4 -0
- package/dist/helper/xml-find.js +48 -0
- package/dist/helper/xml-find.js.map +1 -0
- package/dist/helper/xml-helper.js +99 -134
- package/dist/helper/xml-helper.js.map +1 -1
- package/dist/helper/xml-parse-cache.d.ts +31 -0
- package/dist/helper/xml-parse-cache.js +71 -0
- package/dist/helper/xml-parse-cache.js.map +1 -0
- package/dist/helper/xml-placeholder-helper.js +10 -10
- package/dist/helper/xml-placeholder-helper.js.map +1 -1
- package/dist/helper/xml-relationship-helper.js +120 -144
- package/dist/helper/xml-relationship-helper.js.map +1 -1
- package/dist/helper/xml-serializer.d.ts +2 -0
- package/dist/helper/xml-serializer.js +192 -0
- package/dist/helper/xml-serializer.js.map +1 -0
- package/dist/helper/xml-slide-helper.js +109 -129
- package/dist/helper/xml-slide-helper.js.map +1 -1
- package/dist/helper/xml-template-helper.js +120 -144
- package/dist/helper/xml-template-helper.js.map +1 -1
- package/dist/helper/xmldom-sax-patch.js +52 -2
- package/dist/helper/xmldom-sax-patch.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/modify/modify-chart.js +35 -23
- package/dist/modify/modify-chart.js.map +1 -1
- package/dist/modify/modify-table.js +11 -14
- package/dist/modify/modify-table.js.map +1 -1
- package/dist/shapes/chart.js +238 -287
- package/dist/shapes/chart.js.map +1 -1
- package/dist/shapes/diagram.js +73 -104
- package/dist/shapes/diagram.js.map +1 -1
- package/dist/shapes/generic.js +62 -83
- package/dist/shapes/generic.js.map +1 -1
- package/dist/shapes/hyperlink.js +98 -124
- package/dist/shapes/hyperlink.js.map +1 -1
- package/dist/shapes/image.js +112 -151
- package/dist/shapes/image.js.map +1 -1
- package/dist/shapes/ole.js +148 -188
- package/dist/shapes/ole.js.map +1 -1
- package/package.json +3 -4
|
@@ -49,6 +49,268 @@ const SPPR_AFTER_LINE_TAGS = [
|
|
|
49
49
|
* Provides various methods for manipulating shape appearance, position, and content
|
|
50
50
|
*/
|
|
51
51
|
class ModifyShapeHelper {
|
|
52
|
+
/**
|
|
53
|
+
* Set solid fill of modified shape to accent6 color
|
|
54
|
+
*
|
|
55
|
+
* @param element - XML element representing the shape
|
|
56
|
+
*/
|
|
57
|
+
static { this.setSolidFill = (element) => {
|
|
58
|
+
element
|
|
59
|
+
.getElementsByTagName('a:solidFill')[0]
|
|
60
|
+
.getElementsByTagName('a:schemeClr')[0]
|
|
61
|
+
.setAttribute('val', 'accent6');
|
|
62
|
+
}; }
|
|
63
|
+
/**
|
|
64
|
+
* Set outline (line) properties of an existing shape, picture or
|
|
65
|
+
* placeholder: width, dash style and color.
|
|
66
|
+
*
|
|
67
|
+
* Creates an <a:ln> element if the shape has none, which is the case
|
|
68
|
+
* whenever the outline was never overridden in PowerPoint and is
|
|
69
|
+
* inherited from the theme or the shape style.
|
|
70
|
+
*
|
|
71
|
+
* Note: if the shape's outline was explicitly switched off in PowerPoint
|
|
72
|
+
* (<a:ln><a:noFill/></a:ln>), a weight alone stays invisible - pass a
|
|
73
|
+
* color as well. Use ModifyCleanupHelper.removeBorder to drop an outline.
|
|
74
|
+
*
|
|
75
|
+
* @param outline - Width (EMU, 1pt = 12700), dash type and/or color
|
|
76
|
+
* @returns Function that accepts an XML element to modify
|
|
77
|
+
*/
|
|
78
|
+
static { this.setOutline = (outline) => (element) => {
|
|
79
|
+
// For grouped shapes, this targets the first child shape;
|
|
80
|
+
// modify the members of a group individually instead.
|
|
81
|
+
const spPr = element.getElementsByTagName('p:spPr')[0] ||
|
|
82
|
+
element.getElementsByTagName('a:spPr')[0];
|
|
83
|
+
if (!spPr) {
|
|
84
|
+
return; // e.g. a graphicFrame (table/chart) has no shape properties
|
|
85
|
+
}
|
|
86
|
+
// Direct child only: <a:ln> also occurs in text run properties.
|
|
87
|
+
const existingLine = xml_helper_1.XmlHelper.getFirstDirectChild(spPr, ['a:ln']);
|
|
88
|
+
if (existingLine) {
|
|
89
|
+
new xml_elements_1.default(spPr, { outline }).applyOutline(existingLine);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const line = new xml_elements_1.default(spPr, { outline }).outline();
|
|
93
|
+
const anchor = xml_helper_1.XmlHelper.getFirstDirectChild(spPr, SPPR_AFTER_LINE_TAGS);
|
|
94
|
+
if (anchor) {
|
|
95
|
+
spPr.insertBefore(line, anchor);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
spPr.appendChild(line);
|
|
99
|
+
}
|
|
100
|
+
}; }
|
|
101
|
+
/**
|
|
102
|
+
* Set text content of a shape
|
|
103
|
+
*
|
|
104
|
+
* @param text - Text string to set as shape content
|
|
105
|
+
* @returns Function that accepts an XML element to modify
|
|
106
|
+
*/
|
|
107
|
+
static { this.setText = (text) => (element) => {
|
|
108
|
+
modify_text_helper_1.default.setText(text)(element);
|
|
109
|
+
}; }
|
|
110
|
+
/**
|
|
111
|
+
* Set content to bulleted list within a shape
|
|
112
|
+
*
|
|
113
|
+
* @param list - Array or string content for the bullet list
|
|
114
|
+
* @returns Function that accepts an XML element to modify
|
|
115
|
+
*/
|
|
116
|
+
static { this.setBulletList = (list) => (element) => {
|
|
117
|
+
modify_text_helper_1.default.setBulletList(list)(element);
|
|
118
|
+
}; }
|
|
119
|
+
/**
|
|
120
|
+
* Replace tagged text content within modified shape
|
|
121
|
+
*
|
|
122
|
+
* @param replaceText - Single replacement or array of replacements
|
|
123
|
+
* @param options - Optional configuration for text replacement
|
|
124
|
+
* @returns Function that accepts an XML element to modify
|
|
125
|
+
*/
|
|
126
|
+
static { this.replaceText = (replaceText, options) => (element) => {
|
|
127
|
+
const replaceTexts = general_helper_1.GeneralHelper.arrayify(replaceText);
|
|
128
|
+
new text_replace_helper_1.default(options, element)
|
|
129
|
+
.isolateTaggedNodes()
|
|
130
|
+
.applyReplacements(replaceTexts);
|
|
131
|
+
}; }
|
|
132
|
+
/**
|
|
133
|
+
* Creates missing transformation elements (a:off and a:ext) with default values
|
|
134
|
+
* Ensures that a shape has the required XML structure for positioning and sizing
|
|
135
|
+
*
|
|
136
|
+
* @param element - The XML element to check and modify
|
|
137
|
+
* @returns The xfrm element that contains or will contain the transformation data
|
|
138
|
+
*/
|
|
139
|
+
static { this.ensureTransformElements = (element) => {
|
|
140
|
+
// First find the xfrm element (could be a:xfrm or p:xfrm)
|
|
141
|
+
let xfrm = element.getElementsByTagName('a:xfrm')[0];
|
|
142
|
+
if (!xfrm) {
|
|
143
|
+
xfrm = element.getElementsByTagName('p:xfrm')[0];
|
|
144
|
+
}
|
|
145
|
+
// If no xfrm element exists, try to find the appropriate parent to create it
|
|
146
|
+
if (!xfrm) {
|
|
147
|
+
const spPr = element.getElementsByTagName('p:spPr')[0] ||
|
|
148
|
+
element.getElementsByTagName('a:spPr')[0];
|
|
149
|
+
if (!spPr) {
|
|
150
|
+
return null; // Cannot create xfrm without a proper parent
|
|
151
|
+
}
|
|
152
|
+
// Create the xfrm element
|
|
153
|
+
xfrm = element.ownerDocument.createElement('a:xfrm');
|
|
154
|
+
spPr.appendChild(xfrm);
|
|
155
|
+
}
|
|
156
|
+
// Create a:off element if it doesn't exist
|
|
157
|
+
if (!xfrm.getElementsByTagName('a:off')[0]) {
|
|
158
|
+
const newAOff = element.ownerDocument.createElement('a:off');
|
|
159
|
+
// Set default coordinates (0,0)
|
|
160
|
+
newAOff.setAttribute('x', '0');
|
|
161
|
+
newAOff.setAttribute('y', '0');
|
|
162
|
+
// Insert a:off as the first child of xfrm
|
|
163
|
+
if (xfrm.hasChildNodes()) {
|
|
164
|
+
xfrm.insertBefore(newAOff, xfrm.firstChild);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
xfrm.appendChild(newAOff);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Create a:ext element if it doesn't exist
|
|
171
|
+
if (!xfrm.getElementsByTagName('a:ext')[0]) {
|
|
172
|
+
const newAExt = element.ownerDocument.createElement('a:ext');
|
|
173
|
+
// Set default dimensions - using 1000000 which is about 2.78cm
|
|
174
|
+
newAExt.setAttribute('cx', '1000000');
|
|
175
|
+
newAExt.setAttribute('cy', '1000000');
|
|
176
|
+
// Add the a:ext element after a:off
|
|
177
|
+
xfrm.appendChild(newAExt);
|
|
178
|
+
}
|
|
179
|
+
return xfrm;
|
|
180
|
+
}; }
|
|
181
|
+
/**
|
|
182
|
+
* Set absolute position and size of a shape
|
|
183
|
+
*
|
|
184
|
+
* @param pos - Object containing position and size coordinates
|
|
185
|
+
* @returns Function that accepts an XML element to modify
|
|
186
|
+
*/
|
|
187
|
+
static { this.setPosition = (pos) => (element) => {
|
|
188
|
+
// Ensure the transform elements exist
|
|
189
|
+
const xfrm = ModifyShapeHelper.ensureTransformElements(element);
|
|
190
|
+
if (!xfrm) {
|
|
191
|
+
return; // Cannot set position without proper structure
|
|
192
|
+
}
|
|
193
|
+
// Apply each provided coordinate
|
|
194
|
+
Object.keys(pos).forEach((key) => {
|
|
195
|
+
const mapped = map[key];
|
|
196
|
+
let value = Math.round(pos[key]);
|
|
197
|
+
// Skip invalid values or unsupported properties
|
|
198
|
+
if (typeof value !== 'number' || !mapped)
|
|
199
|
+
return;
|
|
200
|
+
// Ensure value is not negative
|
|
201
|
+
value = value < 0 ? 0 : value;
|
|
202
|
+
// Set the value in the appropriate XML tag and attribute
|
|
203
|
+
xfrm
|
|
204
|
+
.getElementsByTagName(mapped.tag)[0]
|
|
205
|
+
.setAttribute(mapped.attribute, String(value));
|
|
206
|
+
});
|
|
207
|
+
}; }
|
|
208
|
+
/**
|
|
209
|
+
* Incrementally update position and size of a shape by adding delta values
|
|
210
|
+
*
|
|
211
|
+
* @param pos - Object containing delta values for position and size
|
|
212
|
+
* @returns Function that accepts an XML element to modify
|
|
213
|
+
*/
|
|
214
|
+
static { this.updatePosition = (pos) => (element) => {
|
|
215
|
+
// Ensure the transform elements exist
|
|
216
|
+
const xfrm = ModifyShapeHelper.ensureTransformElements(element);
|
|
217
|
+
if (!xfrm) {
|
|
218
|
+
return; // Cannot update position without proper structure
|
|
219
|
+
}
|
|
220
|
+
// Apply each provided delta coordinate
|
|
221
|
+
Object.keys(pos).forEach((key) => {
|
|
222
|
+
const mapped = map[key];
|
|
223
|
+
let value = Math.round(pos[key]);
|
|
224
|
+
// Skip invalid values or unsupported properties
|
|
225
|
+
if (typeof value !== 'number' || !mapped)
|
|
226
|
+
return;
|
|
227
|
+
// Get current value and add the delta
|
|
228
|
+
const currentValue = xfrm
|
|
229
|
+
.getElementsByTagName(mapped.tag)[0]
|
|
230
|
+
.getAttribute(mapped.attribute);
|
|
231
|
+
value += Number(currentValue);
|
|
232
|
+
// Update the value in the appropriate XML tag and attribute
|
|
233
|
+
xfrm
|
|
234
|
+
.getElementsByTagName(mapped.tag)[0]
|
|
235
|
+
.setAttribute(mapped.attribute, String(value));
|
|
236
|
+
});
|
|
237
|
+
}; }
|
|
238
|
+
/**
|
|
239
|
+
* Rotate a shape by a given angle in degrees
|
|
240
|
+
*
|
|
241
|
+
* @param degrees - Rotation angle in degrees (positive = clockwise, negative = counterclockwise)
|
|
242
|
+
* @returns Function that accepts an XML element to modify
|
|
243
|
+
*/
|
|
244
|
+
static { this.rotate = (degrees) => (element) => {
|
|
245
|
+
const spPr = element.getElementsByTagName('p:spPr');
|
|
246
|
+
if (spPr) {
|
|
247
|
+
const xfrm = spPr.item(0).getElementsByTagName('a:xfrm').item(0);
|
|
248
|
+
// Convert negative degrees to equivalent positive value (0-359)
|
|
249
|
+
degrees = degrees < 0 ? 360 + degrees : degrees;
|
|
250
|
+
// PowerPoint uses 60000 units per degree for rotation
|
|
251
|
+
xfrm.setAttribute('rot', String(Math.round(degrees * 60000)));
|
|
252
|
+
}
|
|
253
|
+
}; }
|
|
254
|
+
/**
|
|
255
|
+
* Apply rounded corners to a shape with a specified corner radius
|
|
256
|
+
*
|
|
257
|
+
* @param degree - Corner radius in EMU units (1 cm = 360000 EMU)
|
|
258
|
+
* @returns Function that accepts an XML element to modify
|
|
259
|
+
*/
|
|
260
|
+
static { this.roundedCorners = (degree) => (element) => {
|
|
261
|
+
// Find the spPr element where we need to add or modify the a:prstGeom element
|
|
262
|
+
const spPr = element.getElementsByTagName('p:spPr')[0] ||
|
|
263
|
+
element.getElementsByTagName('a:spPr')[0];
|
|
264
|
+
if (!spPr) {
|
|
265
|
+
return; // Cannot find spPr element
|
|
266
|
+
}
|
|
267
|
+
// Get the shape dimensions to calculate the appropriate adjustment value
|
|
268
|
+
const xfrm = ModifyShapeHelper.ensureTransformElements(element);
|
|
269
|
+
if (!xfrm) {
|
|
270
|
+
return; // Cannot proceed without proper transformation data
|
|
271
|
+
}
|
|
272
|
+
// Get current width and height
|
|
273
|
+
const width = Number(xfrm.getElementsByTagName('a:ext')[0].getAttribute('cx'));
|
|
274
|
+
const height = Number(xfrm.getElementsByTagName('a:ext')[0].getAttribute('cy'));
|
|
275
|
+
// Calculate the adjustment value based on the smaller dimension
|
|
276
|
+
const minDimension = Math.min(width, height);
|
|
277
|
+
// Ensure degree is within reasonable bounds (PowerPoint uses 0-50% for rounded rect)
|
|
278
|
+
const clampedDegree = Math.max(0, Math.min(degree, minDimension / 2));
|
|
279
|
+
// Calculate the adjustment value (0-100000 where 100000 is 100%)
|
|
280
|
+
// PowerPoint uses the percentage of the shorter dimension for corners
|
|
281
|
+
const adjValue = Math.round((clampedDegree / minDimension) * 100000);
|
|
282
|
+
// Remove any existing prstGeom element
|
|
283
|
+
const existingPrstGeom = spPr.getElementsByTagName('a:prstGeom')[0];
|
|
284
|
+
if (existingPrstGeom) {
|
|
285
|
+
xml_helper_1.XmlHelper.remove(existingPrstGeom);
|
|
286
|
+
}
|
|
287
|
+
// Create the new prstGeom element with the roundRect preset
|
|
288
|
+
const prstGeom = element.ownerDocument.createElement('a:prstGeom');
|
|
289
|
+
prstGeom.setAttribute('prst', 'roundRect');
|
|
290
|
+
// Create the avLst element and the adjustment value
|
|
291
|
+
const avLst = element.ownerDocument.createElement('a:avLst');
|
|
292
|
+
const gd = element.ownerDocument.createElement('a:gd');
|
|
293
|
+
gd.setAttribute('name', 'adj');
|
|
294
|
+
gd.setAttribute('fmla', `val ${adjValue}`);
|
|
295
|
+
// Build the element hierarchy
|
|
296
|
+
avLst.appendChild(gd);
|
|
297
|
+
prstGeom.appendChild(avLst);
|
|
298
|
+
// Add the new prstGeom element to spPr at the appropriate position
|
|
299
|
+
// It should be added after xfrm but before other elements
|
|
300
|
+
const xfrmElement = spPr.getElementsByTagName('a:xfrm')[0];
|
|
301
|
+
if (xfrmElement && xfrmElement.nextSibling) {
|
|
302
|
+
spPr.insertBefore(prstGeom, xfrmElement.nextSibling);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
spPr.appendChild(prstGeom);
|
|
306
|
+
}
|
|
307
|
+
// Check for noFill element - for picture elements, we need to remove noFill
|
|
308
|
+
// otherwise the picture will be invisible when we apply rounded corners
|
|
309
|
+
const noFillElement = spPr.getElementsByTagName('a:noFill')[0];
|
|
310
|
+
if (noFillElement) {
|
|
311
|
+
xml_helper_1.XmlHelper.remove(noFillElement);
|
|
312
|
+
}
|
|
313
|
+
}; }
|
|
52
314
|
/**
|
|
53
315
|
* Determines the type of visual element in PowerPoint
|
|
54
316
|
* @param element The XML element to check
|
|
@@ -74,267 +336,5 @@ class ModifyShapeHelper {
|
|
|
74
336
|
return index_1.ModifyColorHelper.elementHasBackground(element);
|
|
75
337
|
}
|
|
76
338
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Set solid fill of modified shape to accent6 color
|
|
79
|
-
*
|
|
80
|
-
* @param element - XML element representing the shape
|
|
81
|
-
*/
|
|
82
|
-
ModifyShapeHelper.setSolidFill = (element) => {
|
|
83
|
-
element
|
|
84
|
-
.getElementsByTagName('a:solidFill')[0]
|
|
85
|
-
.getElementsByTagName('a:schemeClr')[0]
|
|
86
|
-
.setAttribute('val', 'accent6');
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Set outline (line) properties of an existing shape, picture or
|
|
90
|
-
* placeholder: width, dash style and color.
|
|
91
|
-
*
|
|
92
|
-
* Creates an <a:ln> element if the shape has none, which is the case
|
|
93
|
-
* whenever the outline was never overridden in PowerPoint and is
|
|
94
|
-
* inherited from the theme or the shape style.
|
|
95
|
-
*
|
|
96
|
-
* Note: if the shape's outline was explicitly switched off in PowerPoint
|
|
97
|
-
* (<a:ln><a:noFill/></a:ln>), a weight alone stays invisible - pass a
|
|
98
|
-
* color as well. Use ModifyCleanupHelper.removeBorder to drop an outline.
|
|
99
|
-
*
|
|
100
|
-
* @param outline - Width (EMU, 1pt = 12700), dash type and/or color
|
|
101
|
-
* @returns Function that accepts an XML element to modify
|
|
102
|
-
*/
|
|
103
|
-
ModifyShapeHelper.setOutline = (outline) => (element) => {
|
|
104
|
-
// For grouped shapes, this targets the first child shape;
|
|
105
|
-
// modify the members of a group individually instead.
|
|
106
|
-
const spPr = element.getElementsByTagName('p:spPr')[0] ||
|
|
107
|
-
element.getElementsByTagName('a:spPr')[0];
|
|
108
|
-
if (!spPr) {
|
|
109
|
-
return; // e.g. a graphicFrame (table/chart) has no shape properties
|
|
110
|
-
}
|
|
111
|
-
// Direct child only: <a:ln> also occurs in text run properties.
|
|
112
|
-
const existingLine = xml_helper_1.XmlHelper.getFirstDirectChild(spPr, ['a:ln']);
|
|
113
|
-
if (existingLine) {
|
|
114
|
-
new xml_elements_1.default(spPr, { outline }).applyOutline(existingLine);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const line = new xml_elements_1.default(spPr, { outline }).outline();
|
|
118
|
-
const anchor = xml_helper_1.XmlHelper.getFirstDirectChild(spPr, SPPR_AFTER_LINE_TAGS);
|
|
119
|
-
if (anchor) {
|
|
120
|
-
spPr.insertBefore(line, anchor);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
spPr.appendChild(line);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Set text content of a shape
|
|
128
|
-
*
|
|
129
|
-
* @param text - Text string to set as shape content
|
|
130
|
-
* @returns Function that accepts an XML element to modify
|
|
131
|
-
*/
|
|
132
|
-
ModifyShapeHelper.setText = (text) => (element) => {
|
|
133
|
-
modify_text_helper_1.default.setText(text)(element);
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Set content to bulleted list within a shape
|
|
137
|
-
*
|
|
138
|
-
* @param list - Array or string content for the bullet list
|
|
139
|
-
* @returns Function that accepts an XML element to modify
|
|
140
|
-
*/
|
|
141
|
-
ModifyShapeHelper.setBulletList = (list) => (element) => {
|
|
142
|
-
modify_text_helper_1.default.setBulletList(list)(element);
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Replace tagged text content within modified shape
|
|
146
|
-
*
|
|
147
|
-
* @param replaceText - Single replacement or array of replacements
|
|
148
|
-
* @param options - Optional configuration for text replacement
|
|
149
|
-
* @returns Function that accepts an XML element to modify
|
|
150
|
-
*/
|
|
151
|
-
ModifyShapeHelper.replaceText = (replaceText, options) => (element) => {
|
|
152
|
-
const replaceTexts = general_helper_1.GeneralHelper.arrayify(replaceText);
|
|
153
|
-
new text_replace_helper_1.default(options, element)
|
|
154
|
-
.isolateTaggedNodes()
|
|
155
|
-
.applyReplacements(replaceTexts);
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Creates missing transformation elements (a:off and a:ext) with default values
|
|
159
|
-
* Ensures that a shape has the required XML structure for positioning and sizing
|
|
160
|
-
*
|
|
161
|
-
* @param element - The XML element to check and modify
|
|
162
|
-
* @returns The xfrm element that contains or will contain the transformation data
|
|
163
|
-
*/
|
|
164
|
-
ModifyShapeHelper.ensureTransformElements = (element) => {
|
|
165
|
-
// First find the xfrm element (could be a:xfrm or p:xfrm)
|
|
166
|
-
let xfrm = element.getElementsByTagName('a:xfrm')[0];
|
|
167
|
-
if (!xfrm) {
|
|
168
|
-
xfrm = element.getElementsByTagName('p:xfrm')[0];
|
|
169
|
-
}
|
|
170
|
-
// If no xfrm element exists, try to find the appropriate parent to create it
|
|
171
|
-
if (!xfrm) {
|
|
172
|
-
const spPr = element.getElementsByTagName('p:spPr')[0] ||
|
|
173
|
-
element.getElementsByTagName('a:spPr')[0];
|
|
174
|
-
if (!spPr) {
|
|
175
|
-
return null; // Cannot create xfrm without a proper parent
|
|
176
|
-
}
|
|
177
|
-
// Create the xfrm element
|
|
178
|
-
xfrm = element.ownerDocument.createElement('a:xfrm');
|
|
179
|
-
spPr.appendChild(xfrm);
|
|
180
|
-
}
|
|
181
|
-
// Create a:off element if it doesn't exist
|
|
182
|
-
if (!xfrm.getElementsByTagName('a:off')[0]) {
|
|
183
|
-
const newAOff = element.ownerDocument.createElement('a:off');
|
|
184
|
-
// Set default coordinates (0,0)
|
|
185
|
-
newAOff.setAttribute('x', '0');
|
|
186
|
-
newAOff.setAttribute('y', '0');
|
|
187
|
-
// Insert a:off as the first child of xfrm
|
|
188
|
-
if (xfrm.hasChildNodes()) {
|
|
189
|
-
xfrm.insertBefore(newAOff, xfrm.firstChild);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
xfrm.appendChild(newAOff);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
// Create a:ext element if it doesn't exist
|
|
196
|
-
if (!xfrm.getElementsByTagName('a:ext')[0]) {
|
|
197
|
-
const newAExt = element.ownerDocument.createElement('a:ext');
|
|
198
|
-
// Set default dimensions - using 1000000 which is about 2.78cm
|
|
199
|
-
newAExt.setAttribute('cx', '1000000');
|
|
200
|
-
newAExt.setAttribute('cy', '1000000');
|
|
201
|
-
// Add the a:ext element after a:off
|
|
202
|
-
xfrm.appendChild(newAExt);
|
|
203
|
-
}
|
|
204
|
-
return xfrm;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* Set absolute position and size of a shape
|
|
208
|
-
*
|
|
209
|
-
* @param pos - Object containing position and size coordinates
|
|
210
|
-
* @returns Function that accepts an XML element to modify
|
|
211
|
-
*/
|
|
212
|
-
ModifyShapeHelper.setPosition = (pos) => (element) => {
|
|
213
|
-
// Ensure the transform elements exist
|
|
214
|
-
const xfrm = ModifyShapeHelper.ensureTransformElements(element);
|
|
215
|
-
if (!xfrm) {
|
|
216
|
-
return; // Cannot set position without proper structure
|
|
217
|
-
}
|
|
218
|
-
// Apply each provided coordinate
|
|
219
|
-
Object.keys(pos).forEach((key) => {
|
|
220
|
-
const mapped = map[key];
|
|
221
|
-
let value = Math.round(pos[key]);
|
|
222
|
-
// Skip invalid values or unsupported properties
|
|
223
|
-
if (typeof value !== 'number' || !mapped)
|
|
224
|
-
return;
|
|
225
|
-
// Ensure value is not negative
|
|
226
|
-
value = value < 0 ? 0 : value;
|
|
227
|
-
// Set the value in the appropriate XML tag and attribute
|
|
228
|
-
xfrm
|
|
229
|
-
.getElementsByTagName(mapped.tag)[0]
|
|
230
|
-
.setAttribute(mapped.attribute, String(value));
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Incrementally update position and size of a shape by adding delta values
|
|
235
|
-
*
|
|
236
|
-
* @param pos - Object containing delta values for position and size
|
|
237
|
-
* @returns Function that accepts an XML element to modify
|
|
238
|
-
*/
|
|
239
|
-
ModifyShapeHelper.updatePosition = (pos) => (element) => {
|
|
240
|
-
// Ensure the transform elements exist
|
|
241
|
-
const xfrm = ModifyShapeHelper.ensureTransformElements(element);
|
|
242
|
-
if (!xfrm) {
|
|
243
|
-
return; // Cannot update position without proper structure
|
|
244
|
-
}
|
|
245
|
-
// Apply each provided delta coordinate
|
|
246
|
-
Object.keys(pos).forEach((key) => {
|
|
247
|
-
const mapped = map[key];
|
|
248
|
-
let value = Math.round(pos[key]);
|
|
249
|
-
// Skip invalid values or unsupported properties
|
|
250
|
-
if (typeof value !== 'number' || !mapped)
|
|
251
|
-
return;
|
|
252
|
-
// Get current value and add the delta
|
|
253
|
-
const currentValue = xfrm
|
|
254
|
-
.getElementsByTagName(mapped.tag)[0]
|
|
255
|
-
.getAttribute(mapped.attribute);
|
|
256
|
-
value += Number(currentValue);
|
|
257
|
-
// Update the value in the appropriate XML tag and attribute
|
|
258
|
-
xfrm
|
|
259
|
-
.getElementsByTagName(mapped.tag)[0]
|
|
260
|
-
.setAttribute(mapped.attribute, String(value));
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
* Rotate a shape by a given angle in degrees
|
|
265
|
-
*
|
|
266
|
-
* @param degrees - Rotation angle in degrees (positive = clockwise, negative = counterclockwise)
|
|
267
|
-
* @returns Function that accepts an XML element to modify
|
|
268
|
-
*/
|
|
269
|
-
ModifyShapeHelper.rotate = (degrees) => (element) => {
|
|
270
|
-
const spPr = element.getElementsByTagName('p:spPr');
|
|
271
|
-
if (spPr) {
|
|
272
|
-
const xfrm = spPr.item(0).getElementsByTagName('a:xfrm').item(0);
|
|
273
|
-
// Convert negative degrees to equivalent positive value (0-359)
|
|
274
|
-
degrees = degrees < 0 ? 360 + degrees : degrees;
|
|
275
|
-
// PowerPoint uses 60000 units per degree for rotation
|
|
276
|
-
xfrm.setAttribute('rot', String(Math.round(degrees * 60000)));
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
/**
|
|
280
|
-
* Apply rounded corners to a shape with a specified corner radius
|
|
281
|
-
*
|
|
282
|
-
* @param degree - Corner radius in EMU units (1 cm = 360000 EMU)
|
|
283
|
-
* @returns Function that accepts an XML element to modify
|
|
284
|
-
*/
|
|
285
|
-
ModifyShapeHelper.roundedCorners = (degree) => (element) => {
|
|
286
|
-
// Find the spPr element where we need to add or modify the a:prstGeom element
|
|
287
|
-
const spPr = element.getElementsByTagName('p:spPr')[0] ||
|
|
288
|
-
element.getElementsByTagName('a:spPr')[0];
|
|
289
|
-
if (!spPr) {
|
|
290
|
-
return; // Cannot find spPr element
|
|
291
|
-
}
|
|
292
|
-
// Get the shape dimensions to calculate the appropriate adjustment value
|
|
293
|
-
const xfrm = ModifyShapeHelper.ensureTransformElements(element);
|
|
294
|
-
if (!xfrm) {
|
|
295
|
-
return; // Cannot proceed without proper transformation data
|
|
296
|
-
}
|
|
297
|
-
// Get current width and height
|
|
298
|
-
const width = Number(xfrm.getElementsByTagName('a:ext')[0].getAttribute('cx'));
|
|
299
|
-
const height = Number(xfrm.getElementsByTagName('a:ext')[0].getAttribute('cy'));
|
|
300
|
-
// Calculate the adjustment value based on the smaller dimension
|
|
301
|
-
const minDimension = Math.min(width, height);
|
|
302
|
-
// Ensure degree is within reasonable bounds (PowerPoint uses 0-50% for rounded rect)
|
|
303
|
-
const clampedDegree = Math.max(0, Math.min(degree, minDimension / 2));
|
|
304
|
-
// Calculate the adjustment value (0-100000 where 100000 is 100%)
|
|
305
|
-
// PowerPoint uses the percentage of the shorter dimension for corners
|
|
306
|
-
const adjValue = Math.round((clampedDegree / minDimension) * 100000);
|
|
307
|
-
// Remove any existing prstGeom element
|
|
308
|
-
const existingPrstGeom = spPr.getElementsByTagName('a:prstGeom')[0];
|
|
309
|
-
if (existingPrstGeom) {
|
|
310
|
-
xml_helper_1.XmlHelper.remove(existingPrstGeom);
|
|
311
|
-
}
|
|
312
|
-
// Create the new prstGeom element with the roundRect preset
|
|
313
|
-
const prstGeom = element.ownerDocument.createElement('a:prstGeom');
|
|
314
|
-
prstGeom.setAttribute('prst', 'roundRect');
|
|
315
|
-
// Create the avLst element and the adjustment value
|
|
316
|
-
const avLst = element.ownerDocument.createElement('a:avLst');
|
|
317
|
-
const gd = element.ownerDocument.createElement('a:gd');
|
|
318
|
-
gd.setAttribute('name', 'adj');
|
|
319
|
-
gd.setAttribute('fmla', `val ${adjValue}`);
|
|
320
|
-
// Build the element hierarchy
|
|
321
|
-
avLst.appendChild(gd);
|
|
322
|
-
prstGeom.appendChild(avLst);
|
|
323
|
-
// Add the new prstGeom element to spPr at the appropriate position
|
|
324
|
-
// It should be added after xfrm but before other elements
|
|
325
|
-
const xfrmElement = spPr.getElementsByTagName('a:xfrm')[0];
|
|
326
|
-
if (xfrmElement && xfrmElement.nextSibling) {
|
|
327
|
-
spPr.insertBefore(prstGeom, xfrmElement.nextSibling);
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
spPr.appendChild(prstGeom);
|
|
331
|
-
}
|
|
332
|
-
// Check for noFill element - for picture elements, we need to remove noFill
|
|
333
|
-
// otherwise the picture will be invisible when we apply rounded corners
|
|
334
|
-
const noFillElement = spPr.getElementsByTagName('a:noFill')[0];
|
|
335
|
-
if (noFillElement) {
|
|
336
|
-
xml_helper_1.XmlHelper.remove(noFillElement);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
339
|
exports.default = ModifyShapeHelper;
|
|
340
340
|
//# sourceMappingURL=modify-shape-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modify-shape-helper.js","sourceRoot":"","sources":["../../src/helper/modify-shape-hel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