pptx-templates 0.0.0-stage → 0.1.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/AI-INSTRUCTOR.md +2253 -0
- package/CHANGELOG.md +56 -0
- package/LICENSE +23 -0
- package/README.md +84 -2
- package/dist/automizer.d.ts +224 -0
- package/dist/automizer.js +704 -0
- package/dist/automizer.js.map +1 -0
- package/dist/classes/content-type-registry.d.ts +46 -0
- package/dist/classes/content-type-registry.js +170 -0
- package/dist/classes/content-type-registry.js.map +1 -0
- package/dist/classes/element-importer.d.ts +49 -0
- package/dist/classes/element-importer.js +254 -0
- package/dist/classes/element-importer.js.map +1 -0
- package/dist/classes/has-shapes.d.ts +286 -0
- package/dist/classes/has-shapes.js +385 -0
- package/dist/classes/has-shapes.js.map +1 -0
- package/dist/classes/layout.d.ts +42 -0
- package/dist/classes/layout.js +113 -0
- package/dist/classes/layout.js.map +1 -0
- package/dist/classes/master.d.ts +45 -0
- package/dist/classes/master.js +146 -0
- package/dist/classes/master.js.map +1 -0
- package/dist/classes/placeholder-normalizer.d.ts +42 -0
- package/dist/classes/placeholder-normalizer.js +136 -0
- package/dist/classes/placeholder-normalizer.js.map +1 -0
- package/dist/classes/related-content-copier.d.ts +18 -0
- package/dist/classes/related-content-copier.js +114 -0
- package/dist/classes/related-content-copier.js.map +1 -0
- package/dist/classes/shape.d.ts +62 -0
- package/dist/classes/shape.js +194 -0
- package/dist/classes/shape.js.map +1 -0
- package/dist/classes/slide-master-remover.d.ts +44 -0
- package/dist/classes/slide-master-remover.js +201 -0
- package/dist/classes/slide-master-remover.js.map +1 -0
- package/dist/classes/slide-notes-copier.d.ts +26 -0
- package/dist/classes/slide-notes-copier.js +76 -0
- package/dist/classes/slide-notes-copier.js.map +1 -0
- package/dist/classes/slide.d.ts +91 -0
- package/dist/classes/slide.js +286 -0
- package/dist/classes/slide.js.map +1 -0
- package/dist/classes/template.d.ts +137 -0
- package/dist/classes/template.js +311 -0
- package/dist/classes/template.js.map +1 -0
- package/dist/constants/constants.d.ts +11 -0
- package/dist/constants/constants.js +182 -0
- package/dist/constants/constants.js.map +1 -0
- package/dist/enums/chart-type.d.ts +11 -0
- package/dist/enums/chart-type.js +16 -0
- package/dist/enums/chart-type.js.map +1 -0
- package/dist/enums/content-type-map.d.ts +16 -0
- package/dist/enums/content-type-map.js +23 -0
- package/dist/enums/content-type-map.js.map +1 -0
- package/dist/enums/element-type.d.ts +14 -0
- package/dist/enums/element-type.js +20 -0
- package/dist/enums/element-type.js.map +1 -0
- package/dist/errors.d.ts +81 -0
- package/dist/errors.js +100 -0
- package/dist/errors.js.map +1 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/index.js +31 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.d.ts +5 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js +9 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/index.d.ts +5 -0
- package/dist/extensions/pptxgenjs-compat/index.js +10 -0
- package/dist/extensions/pptxgenjs-compat/index.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.d.ts +14 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js +139 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -0
- package/dist/extensions/run-merge/index.d.ts +13 -0
- package/dist/extensions/run-merge/index.js +89 -0
- package/dist/extensions/run-merge/index.js.map +1 -0
- package/dist/extensions/template-logic/commands.d.ts +22 -0
- package/dist/extensions/template-logic/commands.js +83 -0
- package/dist/extensions/template-logic/commands.js.map +1 -0
- package/dist/extensions/template-logic/expression.d.ts +61 -0
- package/dist/extensions/template-logic/expression.js +499 -0
- package/dist/extensions/template-logic/expression.js.map +1 -0
- package/dist/extensions/template-logic/images.d.ts +26 -0
- package/dist/extensions/template-logic/images.js +183 -0
- package/dist/extensions/template-logic/images.js.map +1 -0
- package/dist/extensions/template-logic/index.d.ts +14 -0
- package/dist/extensions/template-logic/index.js +64 -0
- package/dist/extensions/template-logic/index.js.map +1 -0
- package/dist/extensions/template-logic/list-commands.d.ts +9 -0
- package/dist/extensions/template-logic/list-commands.js +72 -0
- package/dist/extensions/template-logic/list-commands.js.map +1 -0
- package/dist/extensions/template-logic/renderer.d.ts +85 -0
- package/dist/extensions/template-logic/renderer.js +867 -0
- package/dist/extensions/template-logic/renderer.js.map +1 -0
- package/dist/extensions/template-logic/types.d.ts +62 -0
- package/dist/extensions/template-logic/types.js +3 -0
- package/dist/extensions/template-logic/types.js.map +1 -0
- package/dist/helper/archive/archive-fs.d.ts +45 -0
- package/dist/helper/archive/archive-fs.js +206 -0
- package/dist/helper/archive/archive-fs.js.map +1 -0
- package/dist/helper/archive/archive-jszip.d.ts +31 -0
- package/dist/helper/archive/archive-jszip.js +173 -0
- package/dist/helper/archive/archive-jszip.js.map +1 -0
- package/dist/helper/archive/archive.d.ts +27 -0
- package/dist/helper/archive/archive.js +78 -0
- package/dist/helper/archive/archive.js.map +1 -0
- package/dist/helper/cell-id-helper.d.ts +25 -0
- package/dist/helper/cell-id-helper.js +95 -0
- package/dist/helper/cell-id-helper.js.map +1 -0
- package/dist/helper/compute-src-rect.d.ts +9 -0
- package/dist/helper/compute-src-rect.js +52 -0
- package/dist/helper/compute-src-rect.js.map +1 -0
- package/dist/helper/content-tracker.d.ts +31 -0
- package/dist/helper/content-tracker.js +227 -0
- package/dist/helper/content-tracker.js.map +1 -0
- package/dist/helper/count-helper.d.ts +33 -0
- package/dist/helper/count-helper.js +140 -0
- package/dist/helper/count-helper.js.map +1 -0
- package/dist/helper/css-style-parser.d.ts +52 -0
- package/dist/helper/css-style-parser.js +246 -0
- package/dist/helper/css-style-parser.js.map +1 -0
- package/dist/helper/file-helper.d.ts +36 -0
- package/dist/helper/file-helper.js +150 -0
- package/dist/helper/file-helper.js.map +1 -0
- package/dist/helper/general-helper.d.ts +6 -0
- package/dist/helper/general-helper.js +34 -0
- package/dist/helper/general-helper.js.map +1 -0
- package/dist/helper/generate/generate-pptxgenjs.d.ts +37 -0
- package/dist/helper/generate/generate-pptxgenjs.js +134 -0
- package/dist/helper/generate/generate-pptxgenjs.js.map +1 -0
- package/dist/helper/html-to-multitext-helper.d.ts +84 -0
- package/dist/helper/html-to-multitext-helper.js +490 -0
- package/dist/helper/html-to-multitext-helper.js.map +1 -0
- package/dist/helper/hyperlink-processor.d.ts +54 -0
- package/dist/helper/hyperlink-processor.js +289 -0
- package/dist/helper/hyperlink-processor.js.map +1 -0
- package/dist/helper/image-dimensions.d.ts +21 -0
- package/dist/helper/image-dimensions.js +202 -0
- package/dist/helper/image-dimensions.js.map +1 -0
- package/dist/helper/jszip-helper.d.ts +21 -0
- package/dist/helper/jszip-helper.js +162 -0
- package/dist/helper/jszip-helper.js.map +1 -0
- package/dist/helper/layout-index.d.ts +55 -0
- package/dist/helper/layout-index.js +155 -0
- package/dist/helper/layout-index.js.map +1 -0
- package/dist/helper/logger.d.ts +53 -0
- package/dist/helper/logger.js +73 -0
- package/dist/helper/logger.js.map +1 -0
- package/dist/helper/media-deduplicator.d.ts +42 -0
- package/dist/helper/media-deduplicator.js +88 -0
- package/dist/helper/media-deduplicator.js.map +1 -0
- package/dist/helper/modify-background-helper.d.ts +19 -0
- package/dist/helper/modify-background-helper.js +59 -0
- package/dist/helper/modify-background-helper.js.map +1 -0
- package/dist/helper/modify-chart-helper.d.ts +159 -0
- package/dist/helper/modify-chart-helper.js +642 -0
- package/dist/helper/modify-chart-helper.js.map +1 -0
- package/dist/helper/modify-cleanup-helper.d.ts +69 -0
- package/dist/helper/modify-cleanup-helper.js +343 -0
- package/dist/helper/modify-cleanup-helper.js.map +1 -0
- package/dist/helper/modify-color-helper.d.ts +35 -0
- package/dist/helper/modify-color-helper.js +211 -0
- package/dist/helper/modify-color-helper.js.map +1 -0
- package/dist/helper/modify-helper.d.ts +23 -0
- package/dist/helper/modify-helper.js +61 -0
- package/dist/helper/modify-helper.js.map +1 -0
- package/dist/helper/modify-hyperlink-element.d.ts +9 -0
- package/dist/helper/modify-hyperlink-element.js +34 -0
- package/dist/helper/modify-hyperlink-element.js.map +1 -0
- package/dist/helper/modify-hyperlink-helper.d.ts +42 -0
- package/dist/helper/modify-hyperlink-helper.js +258 -0
- package/dist/helper/modify-hyperlink-helper.js.map +1 -0
- package/dist/helper/modify-image-helper.d.ts +23 -0
- package/dist/helper/modify-image-helper.js +157 -0
- package/dist/helper/modify-image-helper.js.map +1 -0
- package/dist/helper/modify-presentation-helper.d.ts +55 -0
- package/dist/helper/modify-presentation-helper.js +177 -0
- package/dist/helper/modify-presentation-helper.js.map +1 -0
- package/dist/helper/modify-shape-helper.d.ts +111 -0
- package/dist/helper/modify-shape-helper.js +340 -0
- package/dist/helper/modify-shape-helper.js.map +1 -0
- package/dist/helper/modify-table-helper.d.ts +11 -0
- package/dist/helper/modify-table-helper.js +100 -0
- package/dist/helper/modify-table-helper.js.map +1 -0
- package/dist/helper/modify-text-helper.d.ts +62 -0
- package/dist/helper/modify-text-helper.js +244 -0
- package/dist/helper/modify-text-helper.js.map +1 -0
- package/dist/helper/modify-xml-helper.d.ts +52 -0
- package/dist/helper/modify-xml-helper.js +305 -0
- package/dist/helper/modify-xml-helper.js.map +1 -0
- package/dist/helper/multitext-helper.d.ts +116 -0
- package/dist/helper/multitext-helper.js +462 -0
- package/dist/helper/multitext-helper.js.map +1 -0
- package/dist/helper/ppt-paths.d.ts +76 -0
- package/dist/helper/ppt-paths.js +116 -0
- package/dist/helper/ppt-paths.js.map +1 -0
- package/dist/helper/shape-type-detector.d.ts +34 -0
- package/dist/helper/shape-type-detector.js +99 -0
- package/dist/helper/shape-type-detector.js.map +1 -0
- package/dist/helper/text-replace-helper.d.ts +30 -0
- package/dist/helper/text-replace-helper.js +149 -0
- package/dist/helper/text-replace-helper.js.map +1 -0
- package/dist/helper/xml/lnLRTB.d.ts +1 -0
- package/dist/helper/xml/lnLRTB.js +62 -0
- package/dist/helper/xml/lnLRTB.js.map +1 -0
- package/dist/helper/xml/prstGeom.d.ts +1 -0
- package/dist/helper/xml/prstGeom.js +11 -0
- package/dist/helper/xml/prstGeom.js.map +1 -0
- package/dist/helper/xml-elements.d.ts +134 -0
- package/dist/helper/xml-elements.js +538 -0
- package/dist/helper/xml-elements.js.map +1 -0
- package/dist/helper/xml-helper.d.ts +120 -0
- package/dist/helper/xml-helper.js +495 -0
- package/dist/helper/xml-helper.js.map +1 -0
- package/dist/helper/xml-placeholder-helper.d.ts +92 -0
- package/dist/helper/xml-placeholder-helper.js +454 -0
- package/dist/helper/xml-placeholder-helper.js.map +1 -0
- package/dist/helper/xml-pretty-print.d.ts +17 -0
- package/dist/helper/xml-pretty-print.js +88 -0
- package/dist/helper/xml-pretty-print.js.map +1 -0
- package/dist/helper/xml-relationship-helper.d.ts +103 -0
- package/dist/helper/xml-relationship-helper.js +397 -0
- package/dist/helper/xml-relationship-helper.js.map +1 -0
- package/dist/helper/xml-slide-helper.d.ts +107 -0
- package/dist/helper/xml-slide-helper.js +676 -0
- package/dist/helper/xml-slide-helper.js.map +1 -0
- package/dist/helper/xml-template-helper.d.ts +42 -0
- package/dist/helper/xml-template-helper.js +252 -0
- package/dist/helper/xml-template-helper.js.map +1 -0
- package/dist/helper/xmldom-sax-patch.d.ts +18 -0
- package/dist/helper/xmldom-sax-patch.js +58 -0
- package/dist/helper/xmldom-sax-patch.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/iarchive.d.ts +43 -0
- package/dist/interfaces/iarchive.js +3 -0
- package/dist/interfaces/iarchive.js.map +1 -0
- package/dist/interfaces/ichart.d.ts +7 -0
- package/dist/interfaces/ichart.js +3 -0
- package/dist/interfaces/ichart.js.map +1 -0
- package/dist/interfaces/icounter.d.ts +7 -0
- package/dist/interfaces/icounter.js +3 -0
- package/dist/interfaces/icounter.js.map +1 -0
- package/dist/interfaces/igenerator.d.ts +4 -0
- package/dist/interfaces/igenerator.js +3 -0
- package/dist/interfaces/igenerator.js.map +1 -0
- package/dist/interfaces/iimage.d.ts +7 -0
- package/dist/interfaces/iimage.js +3 -0
- package/dist/interfaces/iimage.js.map +1 -0
- package/dist/interfaces/ilayout.d.ts +14 -0
- package/dist/interfaces/ilayout.js +3 -0
- package/dist/interfaces/ilayout.js.map +1 -0
- package/dist/interfaces/imaster.d.ts +15 -0
- package/dist/interfaces/imaster.js +3 -0
- package/dist/interfaces/imaster.js.map +1 -0
- package/dist/interfaces/imulti-text.d.ts +50 -0
- package/dist/interfaces/imulti-text.js +3 -0
- package/dist/interfaces/imulti-text.js.map +1 -0
- package/dist/interfaces/ipptxgenjs-slide.d.ts +40 -0
- package/dist/interfaces/ipptxgenjs-slide.js +3 -0
- package/dist/interfaces/ipptxgenjs-slide.js.map +1 -0
- package/dist/interfaces/ipresentation-props.d.ts +16 -0
- package/dist/interfaces/ipresentation-props.js +3 -0
- package/dist/interfaces/ipresentation-props.js.map +1 -0
- package/dist/interfaces/ishape-action.d.ts +18 -0
- package/dist/interfaces/ishape-action.js +3 -0
- package/dist/interfaces/ishape-action.js.map +1 -0
- package/dist/interfaces/ishape.d.ts +5 -0
- package/dist/interfaces/ishape.js +3 -0
- package/dist/interfaces/ishape.js.map +1 -0
- package/dist/interfaces/islide.d.ts +71 -0
- package/dist/interfaces/islide.js +3 -0
- package/dist/interfaces/islide.js.map +1 -0
- package/dist/interfaces/itemplate.d.ts +9 -0
- package/dist/interfaces/itemplate.js +3 -0
- package/dist/interfaces/itemplate.js.map +1 -0
- package/dist/interfaces/pres-template.d.ts +9 -0
- package/dist/interfaces/pres-template.js +3 -0
- package/dist/interfaces/pres-template.js.map +1 -0
- package/dist/interfaces/root-pres-template.d.ts +38 -0
- package/dist/interfaces/root-pres-template.js +3 -0
- package/dist/interfaces/root-pres-template.js.map +1 -0
- package/dist/modify/modify-chart.d.ts +74 -0
- package/dist/modify/modify-chart.js +753 -0
- package/dist/modify/modify-chart.js.map +1 -0
- package/dist/modify/modify-table.d.ts +64 -0
- package/dist/modify/modify-table.js +435 -0
- package/dist/modify/modify-table.js.map +1 -0
- package/dist/shapes/chart.d.ts +91 -0
- package/dist/shapes/chart.js +437 -0
- package/dist/shapes/chart.js.map +1 -0
- package/dist/shapes/diagram.d.ts +33 -0
- package/dist/shapes/diagram.js +167 -0
- package/dist/shapes/diagram.js.map +1 -0
- package/dist/shapes/generic.d.ts +27 -0
- package/dist/shapes/generic.js +118 -0
- package/dist/shapes/generic.js.map +1 -0
- package/dist/shapes/hyperlink.d.ts +27 -0
- package/dist/shapes/hyperlink.js +193 -0
- package/dist/shapes/hyperlink.js.map +1 -0
- package/dist/shapes/image.d.ts +47 -0
- package/dist/shapes/image.js +244 -0
- package/dist/shapes/image.js.map +1 -0
- package/dist/shapes/ole.d.ts +30 -0
- package/dist/shapes/ole.js +237 -0
- package/dist/shapes/ole.js.map +1 -0
- package/dist/types/chart-types.d.ts +115 -0
- package/dist/types/chart-types.js +3 -0
- package/dist/types/chart-types.js.map +1 -0
- package/dist/types/modify-types.d.ts +128 -0
- package/dist/types/modify-types.js +3 -0
- package/dist/types/modify-types.js.map +1 -0
- package/dist/types/shape-types.d.ts +40 -0
- package/dist/types/shape-types.js +3 -0
- package/dist/types/shape-types.js.map +1 -0
- package/dist/types/table-types.d.ts +38 -0
- package/dist/types/table-types.js +3 -0
- package/dist/types/table-types.js.map +1 -0
- package/dist/types/types.d.ts +317 -0
- package/dist/types/types.js +16 -0
- package/dist/types/types.js.map +1 -0
- package/dist/types/xml-types.d.ts +168 -0
- package/dist/types/xml-types.js +3 -0
- package/dist/types/xml-types.js.map +1 -0
- package/package.json +92 -4
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Thanks to https://github.com/aishwar/xml-pretty-print
|
|
3
|
+
// Alternative: https://github.com/riversun/xml-beautify
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.XmlPrettyPrint = void 0;
|
|
6
|
+
class XmlPrettyPrint {
|
|
7
|
+
constructor(xmlStr) {
|
|
8
|
+
this.xmlStr = xmlStr;
|
|
9
|
+
this.TAB = ' ';
|
|
10
|
+
}
|
|
11
|
+
dump() {
|
|
12
|
+
console.log(this.prettify());
|
|
13
|
+
}
|
|
14
|
+
prettify() {
|
|
15
|
+
return this.parse(this.xmlStr).join('\n');
|
|
16
|
+
}
|
|
17
|
+
parse(xmlStr) {
|
|
18
|
+
const opener = /<(\w+)[^>]*?>/m;
|
|
19
|
+
const closer = /<\/[^>]*>/m;
|
|
20
|
+
let idx = 0;
|
|
21
|
+
let indent = 0;
|
|
22
|
+
let processing = '';
|
|
23
|
+
const tags = [];
|
|
24
|
+
const output = [];
|
|
25
|
+
while (idx < xmlStr.length) {
|
|
26
|
+
processing += xmlStr[idx];
|
|
27
|
+
const openToken = this.getToken(opener, processing);
|
|
28
|
+
const closeToken = this.getToken(closer, processing);
|
|
29
|
+
if (openToken) {
|
|
30
|
+
// Check if it is a singular element, e.g. <link />
|
|
31
|
+
if (processing[processing.length - 2] != '/') {
|
|
32
|
+
this.addLine(output, openToken.preContent, indent);
|
|
33
|
+
this.addLine(output, openToken.match, indent);
|
|
34
|
+
tags.push(openToken.tag);
|
|
35
|
+
indent += 1;
|
|
36
|
+
processing = '';
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.addLine(output, openToken.preContent, indent);
|
|
40
|
+
this.addLine(output, openToken.match, indent);
|
|
41
|
+
processing = '';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (closeToken) {
|
|
45
|
+
this.addLine(output, closeToken.preContent, indent);
|
|
46
|
+
if (tags[tags.length] == closeToken.tag) {
|
|
47
|
+
tags.pop();
|
|
48
|
+
indent -= 1;
|
|
49
|
+
}
|
|
50
|
+
this.addLine(output, closeToken.match, indent);
|
|
51
|
+
processing = '';
|
|
52
|
+
}
|
|
53
|
+
idx += 1;
|
|
54
|
+
}
|
|
55
|
+
if (tags.length) {
|
|
56
|
+
console.log('WARNING: xmlFile may be malformed. Not all opening tags were closed. Following tags were left open:');
|
|
57
|
+
console.log(tags);
|
|
58
|
+
}
|
|
59
|
+
return output;
|
|
60
|
+
}
|
|
61
|
+
getToken(regex, str) {
|
|
62
|
+
if (regex.test(str)) {
|
|
63
|
+
const matches = regex.exec(str);
|
|
64
|
+
const match = matches[0];
|
|
65
|
+
const offset = str.length - match.length;
|
|
66
|
+
const preContent = str.substring(0, offset);
|
|
67
|
+
return {
|
|
68
|
+
match,
|
|
69
|
+
tag: matches[1],
|
|
70
|
+
offset,
|
|
71
|
+
preContent,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
addLine(output, content, indent) {
|
|
76
|
+
// Trim the content
|
|
77
|
+
content = content.replace(/^\s+|\s+$/, '');
|
|
78
|
+
if (content) {
|
|
79
|
+
let tabs = '';
|
|
80
|
+
while (indent--) {
|
|
81
|
+
tabs += this.TAB;
|
|
82
|
+
}
|
|
83
|
+
output.push(tabs + content);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.XmlPrettyPrint = XmlPrettyPrint;
|
|
88
|
+
//# sourceMappingURL=xml-pretty-print.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-pretty-print.js","sourceRoot":"","sources":["../../src/helper/xml-pretty-print.ts"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,wDAAwD;;;AASxD,MAAa,cAAc;IAIzB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,IAAI;QACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAA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ACvD,mBAAmB;QACnB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,IAAI,GAAG,EAAE,CAAC;YAEd,OAAO,MAAM,EAAE,EAAE,CAAC;gBAChB,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AAnGD,wCAmGC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { HelperElement, RelationshipAttribute, XmlDocument, XmlElement, XmlElementCollection, XmlNodeCollection } from '../types/xml-types';
|
|
2
|
+
import { GetRelationshipsCallback, Target } from '../types/types';
|
|
3
|
+
import IArchive from '../interfaces/iarchive';
|
|
4
|
+
import { ElementSubtype } from '../enums/element-type';
|
|
5
|
+
/**
|
|
6
|
+
* Relationship handling for `_rels` parts (ROADMAP: #55).
|
|
7
|
+
*
|
|
8
|
+
* Instance methods work on one parsed rels document (`initialize` /
|
|
9
|
+
* `setXml`, then `getTargetsByPrefix`, `getTargetsByType`, …). The static
|
|
10
|
+
* methods are the archive-level helpers that used to live on `XmlHelper`;
|
|
11
|
+
* the `XmlHelper` names remain as deprecated delegates.
|
|
12
|
+
*/
|
|
13
|
+
export declare class XmlRelationshipHelper {
|
|
14
|
+
archive: IArchive;
|
|
15
|
+
file: string;
|
|
16
|
+
path: string;
|
|
17
|
+
tag: string;
|
|
18
|
+
xml: XmlDocument;
|
|
19
|
+
xmlTargets: XmlElement[];
|
|
20
|
+
targets: Target[];
|
|
21
|
+
constructor(xml?: XmlDocument, tag?: string);
|
|
22
|
+
initialize(archive: IArchive, file: string, path: string, prefix?: string): Promise<this | Target[]>;
|
|
23
|
+
setXml(xml: XmlDocument): this;
|
|
24
|
+
getTargetsByPrefix(prefix: string | string[]): Target[];
|
|
25
|
+
getTargetsByType(type: string): Target[];
|
|
26
|
+
getTargetByRelId(findRid: string): Target | null;
|
|
27
|
+
readTargets(): this;
|
|
28
|
+
/**
|
|
29
|
+
* This will copy all unhandled related contents into
|
|
30
|
+
* the target archive.
|
|
31
|
+
*
|
|
32
|
+
* Pptx messages on opening a corrupted file are most likely
|
|
33
|
+
* caused by broken relations and this is going to prevent
|
|
34
|
+
* files from being missed.
|
|
35
|
+
*
|
|
36
|
+
* @param sourceArchive
|
|
37
|
+
* @param check
|
|
38
|
+
* @param assert
|
|
39
|
+
*/
|
|
40
|
+
assertRelatedContent(sourceArchive: IArchive, check?: boolean, assert?: boolean): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Parses one `<Relationship>` element into a `Target`.
|
|
43
|
+
*
|
|
44
|
+
* With a `prefix` (e.g. `../charts/chart`), the target is matched against
|
|
45
|
+
* it: the relationship type must end in the prefix's last path segment
|
|
46
|
+
* (`chart`; `data` is mapped to `diagramData`) and the `Target` attribute
|
|
47
|
+
* must start with the prefix. Absolute `/ppt/...` targets, as written by
|
|
48
|
+
* pptxgenjs, are matched as if they were relative. A matching target gets
|
|
49
|
+
* `prefix`, `subtype` and `updateTargetIndex()`; a non-matching one is
|
|
50
|
+
* returned without `prefix` — or as `undefined` if `matchByPrefix` is set.
|
|
51
|
+
*
|
|
52
|
+
* `number` is the trailing number of the target file name (`chart12.xml`
|
|
53
|
+
* → 12, `0` if there is none), `filenameBase` the part before it.
|
|
54
|
+
*/
|
|
55
|
+
static parseRelationTarget(element: XmlElement, prefix?: string, matchByPrefix?: boolean): Target | undefined;
|
|
56
|
+
static extendTarget(prefix: string, subtype: ElementSubtype, target: Target): Target;
|
|
57
|
+
/**
|
|
58
|
+
* `true` if a relationship of `relType` pointing at `file` is the kind of
|
|
59
|
+
* part addressed by `prefix` (see `parseRelationTarget`). Embedded
|
|
60
|
+
* packages (`relType === 'package'`) always match.
|
|
61
|
+
*/
|
|
62
|
+
static targetMatchesRelationship(relType: string, subtype: string, file: string, prefix: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Iterates the `<Relationship>` elements of a rels part in `archive` and
|
|
65
|
+
* lets `cb` push `Target`s into the returned list.
|
|
66
|
+
*/
|
|
67
|
+
static getRelationshipItems(archive: IArchive, path: string, cb: GetRelationshipsCallback, tag?: string): Promise<Target[]>;
|
|
68
|
+
/**
|
|
69
|
+
* All targets of a rels part in `archive` matching one of the given
|
|
70
|
+
* prefixes (see `parseRelationTarget`).
|
|
71
|
+
*/
|
|
72
|
+
static getRelationshipTargetsByPrefix(archive: IArchive, path: string, prefix: string | string[]): Promise<Target[]>;
|
|
73
|
+
/**
|
|
74
|
+
* All targets of a rels part in `archive` with the given relationship
|
|
75
|
+
* `Type` URI.
|
|
76
|
+
*/
|
|
77
|
+
static getTargetsByRelationshipType(archive: IArchive, path: string, type: string): Promise<Target[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Resolves the relationship target a shape element refers to: reads the
|
|
80
|
+
* element's `r:id`-style attribute for the given `TargetByRelIdMap` key
|
|
81
|
+
* (`chart`, `image`, `hyperlink`, …) and looks it up in `relsPath`.
|
|
82
|
+
*/
|
|
83
|
+
static resolveElementTarget(archive: IArchive, relsPath: string, element: XmlElement, type: string): Promise<Target>;
|
|
84
|
+
/**
|
|
85
|
+
* Next free relationship id of a rels part, suffixed with `-created`
|
|
86
|
+
* (`rId<max+1>-created`). The suffix marks relationships created by
|
|
87
|
+
* automizer; cleanup relies on it — do not change the format.
|
|
88
|
+
*/
|
|
89
|
+
static getNextRelId(rootArchive: IArchive, file: string): Promise<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Highest numeric `rId` among `rels` (ignoring the `-created` suffix),
|
|
92
|
+
* optionally incremented by one and raised to `minId`.
|
|
93
|
+
*/
|
|
94
|
+
static getMaxId(rels: XmlNodeCollection | XmlElementCollection, attribute: string, increment?: boolean, minId?: number): number;
|
|
95
|
+
/**
|
|
96
|
+
* `HelperElement` for `XmlHelper.append` that adds a `<Relationship>` to
|
|
97
|
+
* `targetRelFile`; the relation is recorded with the archive's content
|
|
98
|
+
* tracker.
|
|
99
|
+
*/
|
|
100
|
+
static createRelationshipChild(archive: IArchive, targetRelFile: string, attributes: RelationshipAttribute): HelperElement;
|
|
101
|
+
static getSlideLayoutNumber(sourceArchive: IArchive, slideId: number): Promise<number>;
|
|
102
|
+
static getSlideMasterNumber(sourceArchive: IArchive, slideLayoutId: number): Promise<number>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.XmlRelationshipHelper = void 0;
|
|
13
|
+
const xml_helper_1 = require("./xml-helper");
|
|
14
|
+
const general_helper_1 = require("./general-helper");
|
|
15
|
+
const file_helper_1 = require("./file-helper");
|
|
16
|
+
const crypto_1 = require("crypto");
|
|
17
|
+
const constants_1 = require("../constants/constants");
|
|
18
|
+
const errors_1 = require("../errors");
|
|
19
|
+
/**
|
|
20
|
+
* Relationship subtypes that are spelled differently in the target prefix
|
|
21
|
+
* and in the relationship type: a `../diagrams/data` prefix refers to a
|
|
22
|
+
* `.../relationships/diagramData` relationship.
|
|
23
|
+
*/
|
|
24
|
+
const PREFIX_SUBTYPE_MAP = {
|
|
25
|
+
data: 'diagramData',
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Relationship handling for `_rels` parts (ROADMAP: #55).
|
|
29
|
+
*
|
|
30
|
+
* Instance methods work on one parsed rels document (`initialize` /
|
|
31
|
+
* `setXml`, then `getTargetsByPrefix`, `getTargetsByType`, …). The static
|
|
32
|
+
* methods are the archive-level helpers that used to live on `XmlHelper`;
|
|
33
|
+
* the `XmlHelper` names remain as deprecated delegates.
|
|
34
|
+
*/
|
|
35
|
+
class XmlRelationshipHelper {
|
|
36
|
+
constructor(xml, tag) {
|
|
37
|
+
this.xmlTargets = [];
|
|
38
|
+
this.targets = [];
|
|
39
|
+
if (xml) {
|
|
40
|
+
this.setXml(xml);
|
|
41
|
+
}
|
|
42
|
+
this.tag = tag || 'Relationship';
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
initialize(archive, file, path, prefix) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
this.archive = archive;
|
|
48
|
+
this.file = file;
|
|
49
|
+
this.path = path + '/';
|
|
50
|
+
this.xml = yield xml_helper_1.XmlHelper.getXmlFromArchive(this.archive, this.path + this.file);
|
|
51
|
+
yield this.readTargets();
|
|
52
|
+
if (prefix) {
|
|
53
|
+
return this.getTargetsByPrefix(prefix);
|
|
54
|
+
}
|
|
55
|
+
return this;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
setXml(xml) {
|
|
59
|
+
this.xml = xml;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
getTargetsByPrefix(prefix) {
|
|
63
|
+
const prefixes = typeof prefix === 'string' ? [prefix] : prefix;
|
|
64
|
+
const targets = [];
|
|
65
|
+
this.xmlTargets.forEach((xmlTarget) => {
|
|
66
|
+
prefixes.forEach((prefix) => {
|
|
67
|
+
const target = XmlRelationshipHelper.parseRelationTarget(xmlTarget, prefix, true);
|
|
68
|
+
if (target === null || target === void 0 ? void 0 : target.prefix) {
|
|
69
|
+
targets.push(target);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return targets;
|
|
74
|
+
}
|
|
75
|
+
getTargetsByType(type) {
|
|
76
|
+
const targets = [];
|
|
77
|
+
this.xmlTargets.forEach((xmlTarget) => {
|
|
78
|
+
const target = XmlRelationshipHelper.parseRelationTarget(xmlTarget);
|
|
79
|
+
if ((target === null || target === void 0 ? void 0 : target.type) === type) {
|
|
80
|
+
targets.push(target);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return targets;
|
|
84
|
+
}
|
|
85
|
+
getTargetByRelId(findRid) {
|
|
86
|
+
const matchedTarget = this.xmlTargets.find((xmlTarget) => xmlTarget.getAttribute('Id') === findRid);
|
|
87
|
+
if (matchedTarget) {
|
|
88
|
+
return XmlRelationshipHelper.parseRelationTarget(matchedTarget);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
readTargets() {
|
|
92
|
+
if (this.xmlTargets.length) {
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
const relationshipItems = this.xml.getElementsByTagName(this.tag);
|
|
96
|
+
for (const i in relationshipItems) {
|
|
97
|
+
if (relationshipItems[i] &&
|
|
98
|
+
relationshipItems[i].getAttribute !== undefined) {
|
|
99
|
+
this.xmlTargets.push(relationshipItems[i]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* This will copy all unhandled related contents into
|
|
106
|
+
* the target archive.
|
|
107
|
+
*
|
|
108
|
+
* Pptx messages on opening a corrupted file are most likely
|
|
109
|
+
* caused by broken relations and this is going to prevent
|
|
110
|
+
* files from being missed.
|
|
111
|
+
*
|
|
112
|
+
* @param sourceArchive
|
|
113
|
+
* @param check
|
|
114
|
+
* @param assert
|
|
115
|
+
*/
|
|
116
|
+
assertRelatedContent(sourceArchive, check, assert) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
for (const xmlTarget of this.xmlTargets) {
|
|
119
|
+
const targetFile = xmlTarget.getAttribute('Target');
|
|
120
|
+
const targetMode = xmlTarget.getAttribute('TargetMode');
|
|
121
|
+
const targetPath = targetFile.replace('../', 'ppt/');
|
|
122
|
+
if (targetMode !== 'External' &&
|
|
123
|
+
this.archive.fileExists(targetPath) === false) {
|
|
124
|
+
// ToDo: There are falsy errors on files that have already been
|
|
125
|
+
// copied with another target name.
|
|
126
|
+
// if (check) {
|
|
127
|
+
// if (typeof sourceArchive.filename === 'string') {
|
|
128
|
+
// console.error(
|
|
129
|
+
// 'Related content from ' +
|
|
130
|
+
// sourceArchive.filename +
|
|
131
|
+
// ' not found: ' +
|
|
132
|
+
// targetFile,
|
|
133
|
+
// );
|
|
134
|
+
// } else {
|
|
135
|
+
// console.error('Related content not found: ' + targetFile);
|
|
136
|
+
// }
|
|
137
|
+
// }
|
|
138
|
+
if (assert) {
|
|
139
|
+
const target = XmlRelationshipHelper.parseRelationTarget(xmlTarget);
|
|
140
|
+
const buf = (0, crypto_1.randomBytes)(5).toString('hex');
|
|
141
|
+
const targetSuffix = '-' + buf + '.' + target.filenameExt;
|
|
142
|
+
yield file_helper_1.FileHelper.zipCopy(sourceArchive, targetPath, this.archive, targetPath + targetSuffix);
|
|
143
|
+
xmlTarget.setAttribute('Target', xml_helper_1.XmlHelper.sanitizeAttr(targetFile + targetSuffix));
|
|
144
|
+
yield xml_helper_1.XmlHelper.appendImageExtensionToContentType(this.archive, target.filenameExt);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Parses one `<Relationship>` element into a `Target`.
|
|
152
|
+
*
|
|
153
|
+
* With a `prefix` (e.g. `../charts/chart`), the target is matched against
|
|
154
|
+
* it: the relationship type must end in the prefix's last path segment
|
|
155
|
+
* (`chart`; `data` is mapped to `diagramData`) and the `Target` attribute
|
|
156
|
+
* must start with the prefix. Absolute `/ppt/...` targets, as written by
|
|
157
|
+
* pptxgenjs, are matched as if they were relative. A matching target gets
|
|
158
|
+
* `prefix`, `subtype` and `updateTargetIndex()`; a non-matching one is
|
|
159
|
+
* returned without `prefix` — or as `undefined` if `matchByPrefix` is set.
|
|
160
|
+
*
|
|
161
|
+
* `number` is the trailing number of the target file name (`chart12.xml`
|
|
162
|
+
* → 12, `0` if there is none), `filenameBase` the part before it.
|
|
163
|
+
*/
|
|
164
|
+
static parseRelationTarget(element, prefix, matchByPrefix) {
|
|
165
|
+
if (!element || element.getAttribute === undefined) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const type = element.getAttribute('Type');
|
|
169
|
+
const file = element.getAttribute('Target');
|
|
170
|
+
const rId = element.getAttribute('Id');
|
|
171
|
+
const filename = (0, general_helper_1.last)(file.split('/'));
|
|
172
|
+
const relType = (0, general_helper_1.last)(type.split('/'));
|
|
173
|
+
const filenameExt = (0, general_helper_1.last)(filename.split('.'));
|
|
174
|
+
const filenameMatch = filename
|
|
175
|
+
.replace('.' + filenameExt, '')
|
|
176
|
+
.match(/^(.+?)(\d+)*$/);
|
|
177
|
+
const number = filenameMatch && filenameMatch[2] ? Number(filenameMatch[2]) : 0;
|
|
178
|
+
const filenameBase = filenameMatch && filenameMatch[1] ? filenameMatch[1] : filename;
|
|
179
|
+
const target = {
|
|
180
|
+
rId,
|
|
181
|
+
type,
|
|
182
|
+
file,
|
|
183
|
+
filename,
|
|
184
|
+
relType,
|
|
185
|
+
element,
|
|
186
|
+
filenameExt,
|
|
187
|
+
filenameMatch,
|
|
188
|
+
number,
|
|
189
|
+
filenameBase,
|
|
190
|
+
getTargetValue: () => target.element.getAttribute('Target'),
|
|
191
|
+
updateTargetValue: (newTarget) => {
|
|
192
|
+
target.element.setAttribute('Target', xml_helper_1.XmlHelper.sanitizeAttr(newTarget));
|
|
193
|
+
},
|
|
194
|
+
updateId: (newId) => {
|
|
195
|
+
target.element.setAttribute('Id', newId);
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
if (prefix) {
|
|
199
|
+
const prefixSubtype = (0, general_helper_1.last)(prefix.split('/'));
|
|
200
|
+
const subtype = (PREFIX_SUBTYPE_MAP[prefixSubtype] ||
|
|
201
|
+
prefixSubtype);
|
|
202
|
+
if (XmlRelationshipHelper.targetMatchesRelationship(relType, subtype, file, prefix)) {
|
|
203
|
+
return XmlRelationshipHelper.extendTarget(prefix, subtype, target);
|
|
204
|
+
}
|
|
205
|
+
if (matchByPrefix) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
return Object.assign(Object.assign({}, target), { subtype });
|
|
209
|
+
}
|
|
210
|
+
return target;
|
|
211
|
+
}
|
|
212
|
+
static extendTarget(prefix, subtype, target) {
|
|
213
|
+
return Object.assign(Object.assign({}, target), { prefix,
|
|
214
|
+
subtype, updateTargetIndex: (newIndex) => {
|
|
215
|
+
target.element.setAttribute('Target', xml_helper_1.XmlHelper.sanitizeAttr(`${prefix}${newIndex}.xml`));
|
|
216
|
+
} });
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* `true` if a relationship of `relType` pointing at `file` is the kind of
|
|
220
|
+
* part addressed by `prefix` (see `parseRelationTarget`). Embedded
|
|
221
|
+
* packages (`relType === 'package'`) always match.
|
|
222
|
+
*/
|
|
223
|
+
static targetMatchesRelationship(relType, subtype, file, prefix) {
|
|
224
|
+
if (relType === 'package')
|
|
225
|
+
return true;
|
|
226
|
+
// pptxgenjs uses absolute paths in "Target" attributes
|
|
227
|
+
if (file.indexOf('/ppt/') === 0) {
|
|
228
|
+
file = file.replace('/ppt/', '../');
|
|
229
|
+
}
|
|
230
|
+
return relType === subtype && file.indexOf(prefix) === 0;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Iterates the `<Relationship>` elements of a rels part in `archive` and
|
|
234
|
+
* lets `cb` push `Target`s into the returned list.
|
|
235
|
+
*/
|
|
236
|
+
static getRelationshipItems(archive, path, cb, tag) {
|
|
237
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
tag = tag || 'Relationship';
|
|
239
|
+
const xml = yield xml_helper_1.XmlHelper.getXmlFromArchive(archive, path);
|
|
240
|
+
const relationshipItems = xml.getElementsByTagName(tag);
|
|
241
|
+
const rels = [];
|
|
242
|
+
for (const i in relationshipItems) {
|
|
243
|
+
if (relationshipItems[i].getAttribute) {
|
|
244
|
+
cb(relationshipItems[i], rels);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return rels;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* All targets of a rels part in `archive` matching one of the given
|
|
252
|
+
* prefixes (see `parseRelationTarget`).
|
|
253
|
+
*/
|
|
254
|
+
static getRelationshipTargetsByPrefix(archive, path, prefix) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
+
const prefixes = typeof prefix === 'string' ? [prefix] : prefix;
|
|
257
|
+
return XmlRelationshipHelper.getRelationshipItems(archive, path, (element, targets) => {
|
|
258
|
+
prefixes.forEach((prefix) => {
|
|
259
|
+
const target = XmlRelationshipHelper.parseRelationTarget(element, prefix, true);
|
|
260
|
+
if (target) {
|
|
261
|
+
targets.push(target);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* All targets of a rels part in `archive` with the given relationship
|
|
269
|
+
* `Type` URI.
|
|
270
|
+
*/
|
|
271
|
+
static getTargetsByRelationshipType(archive, path, type) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
return XmlRelationshipHelper.getRelationshipItems(archive, path, (element, rels) => {
|
|
274
|
+
if (element.getAttribute('Type') === type) {
|
|
275
|
+
rels.push(XmlRelationshipHelper.parseRelationTarget(element));
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Resolves the relationship target a shape element refers to: reads the
|
|
282
|
+
* element's `r:id`-style attribute for the given `TargetByRelIdMap` key
|
|
283
|
+
* (`chart`, `image`, `hyperlink`, …) and looks it up in `relsPath`.
|
|
284
|
+
*/
|
|
285
|
+
static resolveElementTarget(archive, relsPath, element, type) {
|
|
286
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
287
|
+
var _a;
|
|
288
|
+
const params = constants_1.TargetByRelIdMap[type];
|
|
289
|
+
// For elements that need to search all instances (like hyperlinks)
|
|
290
|
+
if (params.findAll) {
|
|
291
|
+
// Find all hyperlink elements
|
|
292
|
+
const hyperlinks = element.getElementsByTagName(params.relRootTag);
|
|
293
|
+
if (hyperlinks.length > 0) {
|
|
294
|
+
// Use the first hyperlink found
|
|
295
|
+
const sourceRid = hyperlinks[0].getAttribute(params.relAttribute);
|
|
296
|
+
// Get all relationships
|
|
297
|
+
const allRels = yield XmlRelationshipHelper.getRelationshipItems(archive, relsPath, (element, rels) => {
|
|
298
|
+
rels.push({
|
|
299
|
+
rId: element.getAttribute('Id'),
|
|
300
|
+
type: element.getAttribute('Type'),
|
|
301
|
+
file: element.getAttribute('Target'),
|
|
302
|
+
filename: element.getAttribute('Target'),
|
|
303
|
+
element: element,
|
|
304
|
+
isExternal: element.getAttribute('TargetMode') === 'External',
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
// Find the matching relationship
|
|
308
|
+
return allRels.find((rel) => rel.rId === sourceRid);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// Standard behavior for other element types
|
|
313
|
+
const sourceRid = (_a = element
|
|
314
|
+
.getElementsByTagName(params.relRootTag)
|
|
315
|
+
.item(0)) === null || _a === void 0 ? void 0 : _a.getAttribute(params.relAttribute);
|
|
316
|
+
if (!sourceRid) {
|
|
317
|
+
throw new errors_1.ElementNotFoundError('No sourceRid for ' + params.relRootTag, {
|
|
318
|
+
selector: params.relRootTag,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
const shapeRels = yield XmlRelationshipHelper.getRelationshipTargetsByPrefix(archive, relsPath, params.prefix);
|
|
322
|
+
return shapeRels.find((rel) => rel.rId === sourceRid);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Next free relationship id of a rels part, suffixed with `-created`
|
|
328
|
+
* (`rId<max+1>-created`). The suffix marks relationships created by
|
|
329
|
+
* automizer; cleanup relies on it — do not change the format.
|
|
330
|
+
*/
|
|
331
|
+
static getNextRelId(rootArchive, file) {
|
|
332
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
333
|
+
const presentationRelsXml = yield xml_helper_1.XmlHelper.getXmlFromArchive(rootArchive, file);
|
|
334
|
+
const increment = (max) => 'rId' + max;
|
|
335
|
+
const relationNodes = presentationRelsXml.documentElement.childNodes;
|
|
336
|
+
const rid = XmlRelationshipHelper.getMaxId(relationNodes, 'Id', true);
|
|
337
|
+
return increment(rid) + '-created';
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Highest numeric `rId` among `rels` (ignoring the `-created` suffix),
|
|
342
|
+
* optionally incremented by one and raised to `minId`.
|
|
343
|
+
*/
|
|
344
|
+
static getMaxId(rels, attribute, increment, minId) {
|
|
345
|
+
let max = 0;
|
|
346
|
+
for (const i in rels) {
|
|
347
|
+
const rel = rels[i];
|
|
348
|
+
if (rel.getAttribute !== undefined && rel.getAttribute(attribute)) {
|
|
349
|
+
const id = Number(rel
|
|
350
|
+
.getAttribute(attribute)
|
|
351
|
+
.replace('rId', '')
|
|
352
|
+
.replace('-created', ''));
|
|
353
|
+
max = id > max ? id : max;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
switch (typeof increment) {
|
|
357
|
+
case 'boolean':
|
|
358
|
+
++max;
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
if (max < minId) {
|
|
362
|
+
return minId;
|
|
363
|
+
}
|
|
364
|
+
return max;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* `HelperElement` for `XmlHelper.append` that adds a `<Relationship>` to
|
|
368
|
+
* `targetRelFile`; the relation is recorded with the archive's content
|
|
369
|
+
* tracker.
|
|
370
|
+
*/
|
|
371
|
+
static createRelationshipChild(archive, targetRelFile, attributes) {
|
|
372
|
+
var _a;
|
|
373
|
+
(_a = archive.contentTracker) === null || _a === void 0 ? void 0 : _a.trackRelation(targetRelFile, attributes);
|
|
374
|
+
return {
|
|
375
|
+
archive,
|
|
376
|
+
file: targetRelFile,
|
|
377
|
+
// `Relationships` is the document element of a .rels part.
|
|
378
|
+
parent: (xml) => xml.documentElement,
|
|
379
|
+
tag: 'Relationship',
|
|
380
|
+
attributes,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
static getSlideLayoutNumber(sourceArchive, slideId) {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
const slideToLayouts = (yield new XmlRelationshipHelper().initialize(sourceArchive, `slide${slideId}.xml.rels`, `ppt/slides/_rels`, '../slideLayouts/slideLayout'));
|
|
386
|
+
return slideToLayouts[0].number;
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
static getSlideMasterNumber(sourceArchive, slideLayoutId) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
391
|
+
const layoutToMaster = (yield new XmlRelationshipHelper().initialize(sourceArchive, `slideLayout${slideLayoutId}.xml.rels`, `ppt/slideLayouts/_rels`, '../slideMasters/slideMaster'));
|
|
392
|
+
return layoutToMaster[0].number;
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
exports.XmlRelationshipHelper = XmlRelationshipHelper;
|
|
397
|
+
//# sourceMappingURL=xml-relationship-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-relationship-helper.js","sourceRoot":"","sources":["../../src/helper/xml-relationship-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,6CAAyC;AACzC,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