pptx-templates 0.0.0-stage → 0.1.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 +2253 -0
- package/CHANGELOG.md +49 -0
- package/LICENSE +23 -0
- package/README.md +86 -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/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 +147 -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 @@
|
|
|
1
|
+
{"version":3,"file":"modify-image-helper.js","sourceRoot":"","sources":["../../src/helper/modify-image-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAA+B;AAG/B,0CAAgD;AAChD,sDAA8B;AAC9B,yDAAqD;AACrD,4CAAoB;AAEpB,6CAAyC;AACzC,yDAG4B;AAE5B,MAAqB,iBAAiB;;;A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AAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC;gBAED,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,MAAK,SAAS,EAAE,CAAC;oBACxC,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3D,IAAI,MAAM,EAAE,CAAC;wBACX,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,IAAI,OAAO,EAAE,CAAC;gBACZ,uCAAuC;gBACvC,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,AAvCkB,CAuCjB;kBA1Ke,iBAAiB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import IArchive from '../interfaces/iarchive';
|
|
2
|
+
import { XmlDocument } from '../types/xml-types';
|
|
3
|
+
export default class ModifyPresentationHelper {
|
|
4
|
+
/**
|
|
5
|
+
* Get Collection of slides
|
|
6
|
+
*/
|
|
7
|
+
static getSlidesCollection: (xml: XmlDocument) => import("@xmldom/xmldom").LiveNodeList<import("@xmldom/xmldom").Element>;
|
|
8
|
+
static getSlideMastersCollection: (xml: XmlDocument) => import("@xmldom/xmldom").LiveNodeList<import("@xmldom/xmldom").Element>;
|
|
9
|
+
/**
|
|
10
|
+
* Pass an array of slide numbers to define a target sort order.
|
|
11
|
+
* First slide starts by 1.
|
|
12
|
+
* @param order Array of slide numbers, starting by 1
|
|
13
|
+
*/
|
|
14
|
+
static sortSlides: (order: number[]) => (xml: XmlDocument) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Pass an array of slide numbers to remove from slide sortation.
|
|
17
|
+
* @param numbers Array of slide numbers, starting by 1
|
|
18
|
+
*/
|
|
19
|
+
static removeSlides: (numbers: number[]) => (xml: XmlDocument) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Set ids to prevent corrupted pptx.
|
|
22
|
+
* Must start with 256 and increment by one.
|
|
23
|
+
*/
|
|
24
|
+
static normalizeSlideIds: (xml: XmlDocument) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Smallest id PowerPoint accepts for `p:sldMasterId` / `p:sldLayoutId`
|
|
27
|
+
* (ids below 2^31 trigger the repair prompt; see #85).
|
|
28
|
+
*/
|
|
29
|
+
static readonly MIN_SLIDE_MASTER_ID = 2147483648;
|
|
30
|
+
/**
|
|
31
|
+
* Update slideMaster ids to prevent corrupted pptx.
|
|
32
|
+
* - Take first slideMaster id from presentation.xml to start (raised to
|
|
33
|
+
* `MIN_SLIDE_MASTER_ID` if it is lower),
|
|
34
|
+
* - then update incremental ids of each p:sldLayoutId in the master part
|
|
35
|
+
* the entry's relationship points at (starting by slideMasterId + 1)
|
|
36
|
+
* - and update next slideMaster id with previous p:sldLayoutId + 1
|
|
37
|
+
*
|
|
38
|
+
* p:sldMasterId-ids and p:sldLayoutId-ids need to be in a row, otherwise
|
|
39
|
+
* PowerPoint will complain on any p:sldLayoutId-id lower than its
|
|
40
|
+
* corresponding slideMaster-id. omg.
|
|
41
|
+
*/
|
|
42
|
+
static normalizeSlideMasterIds: (xml: XmlDocument, i: number, archive: IArchive) => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* The content tracker's files include all files that have been
|
|
45
|
+
* copied to the root template by automizer. We remove all other files.
|
|
46
|
+
*/
|
|
47
|
+
static removeUnusedFiles(xml: XmlDocument, i: number, archive: IArchive): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* PPT won't complain about unused items in [Content_Types].xml,
|
|
50
|
+
* but we remove them anyway in case the file mentioned in PartName-
|
|
51
|
+
* attribute does not exist.
|
|
52
|
+
*/
|
|
53
|
+
static removeUnusedContentTypes(xml: XmlDocument, i: number, archive: IArchive): Promise<void>;
|
|
54
|
+
static removedUnusedImages(xml: XmlDocument, i: number, archive: IArchive): Promise<void>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
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
|
+
var _a;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const xml_helper_1 = require("./xml-helper");
|
|
14
|
+
const xml_relationship_helper_1 = require("./xml-relationship-helper");
|
|
15
|
+
const ppt_paths_1 = require("./ppt-paths");
|
|
16
|
+
const file_helper_1 = require("./file-helper");
|
|
17
|
+
class ModifyPresentationHelper {
|
|
18
|
+
/**
|
|
19
|
+
* The content tracker's files include all files that have been
|
|
20
|
+
* copied to the root template by automizer. We remove all other files.
|
|
21
|
+
*/
|
|
22
|
+
static removeUnusedFiles(xml, i, archive) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const tracker = archive.contentTracker;
|
|
25
|
+
if (!tracker) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Need to skip some dirs until masters and layouts are handled properly.
|
|
29
|
+
// ppt/drawings is tracked for image collection only (see
|
|
30
|
+
// removedUnusedImages); it also holds vml drawings that may belong to
|
|
31
|
+
// masters and layouts, so it is left alone here.
|
|
32
|
+
const skipDirs = [
|
|
33
|
+
'ppt/slideMasters',
|
|
34
|
+
'ppt/slideMasters/_rels',
|
|
35
|
+
'ppt/slideLayouts',
|
|
36
|
+
'ppt/slideLayouts/_rels',
|
|
37
|
+
'ppt/drawings',
|
|
38
|
+
];
|
|
39
|
+
for (const dir in tracker.files) {
|
|
40
|
+
if (skipDirs.includes(dir)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const requiredFiles = tracker.files[dir];
|
|
44
|
+
yield file_helper_1.FileHelper.removeFromDirectory(archive, dir, (file) => {
|
|
45
|
+
return !requiredFiles.includes(file.relativePath);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* PPT won't complain about unused items in [Content_Types].xml,
|
|
52
|
+
* but we remove them anyway in case the file mentioned in PartName-
|
|
53
|
+
* attribute does not exist.
|
|
54
|
+
*/
|
|
55
|
+
static removeUnusedContentTypes(xml, i, archive) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
yield xml_helper_1.XmlHelper.removeIf({
|
|
58
|
+
archive,
|
|
59
|
+
file: `[Content_Types].xml`,
|
|
60
|
+
tag: 'Override',
|
|
61
|
+
clause: (xml, element) => {
|
|
62
|
+
const filename = element.getAttribute('PartName').substring(1);
|
|
63
|
+
const exists = file_helper_1.FileHelper.fileExistsInArchive(archive, filename);
|
|
64
|
+
return exists ? false : true;
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
static removedUnusedImages(xml, i, archive) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const tracker = archive.contentTracker;
|
|
72
|
+
if (!tracker) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
yield tracker.analyzeContents(archive);
|
|
76
|
+
const extensions = ['jpg', 'jpeg', 'png', 'gif', 'svg', 'emf'];
|
|
77
|
+
const keepFiles = [];
|
|
78
|
+
yield tracker.collect('ppt/slides', 'image', keepFiles);
|
|
79
|
+
yield tracker.collect('ppt/slideMasters', 'image', keepFiles);
|
|
80
|
+
yield tracker.collect('ppt/slideLayouts', 'image', keepFiles);
|
|
81
|
+
// Images referenced by copied charts (e.g. scatter point markers) and by
|
|
82
|
+
// their user shapes drawings (e.g. a picture in a chart annotation).
|
|
83
|
+
yield tracker.collect('ppt/charts', 'image', keepFiles);
|
|
84
|
+
yield tracker.collect('ppt/drawings', 'image', keepFiles);
|
|
85
|
+
yield file_helper_1.FileHelper.removeFromDirectory(archive, 'ppt/media', (file) => {
|
|
86
|
+
const info = file_helper_1.FileHelper.getFileInfo(file.name);
|
|
87
|
+
return (extensions.includes(info.extension.toLowerCase()) &&
|
|
88
|
+
!keepFiles.includes(info.base));
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
_a = ModifyPresentationHelper;
|
|
94
|
+
/**
|
|
95
|
+
* Get Collection of slides
|
|
96
|
+
*/
|
|
97
|
+
ModifyPresentationHelper.getSlidesCollection = (xml) => {
|
|
98
|
+
return xml.getElementsByTagName('p:sldId');
|
|
99
|
+
};
|
|
100
|
+
ModifyPresentationHelper.getSlideMastersCollection = (xml) => {
|
|
101
|
+
return xml.getElementsByTagName('p:sldMasterId');
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Pass an array of slide numbers to define a target sort order.
|
|
105
|
+
* First slide starts by 1.
|
|
106
|
+
* @param order Array of slide numbers, starting by 1
|
|
107
|
+
*/
|
|
108
|
+
ModifyPresentationHelper.sortSlides = (order) => (xml) => {
|
|
109
|
+
const slides = _a.getSlidesCollection(xml);
|
|
110
|
+
order.map((index, i) => order[i]--);
|
|
111
|
+
xml_helper_1.XmlHelper.sortCollection(slides, order);
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Pass an array of slide numbers to remove from slide sortation.
|
|
115
|
+
* @param numbers Array of slide numbers, starting by 1
|
|
116
|
+
*/
|
|
117
|
+
ModifyPresentationHelper.removeSlides = (numbers) => (xml) => {
|
|
118
|
+
const slides = _a.getSlidesCollection(xml);
|
|
119
|
+
numbers.map((index, i) => numbers[i]--);
|
|
120
|
+
for (let i = 0; i <= slides.length; i++) {
|
|
121
|
+
if (numbers.includes(i)) {
|
|
122
|
+
xml_helper_1.XmlHelper.remove(slides[i]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Set ids to prevent corrupted pptx.
|
|
128
|
+
* Must start with 256 and increment by one.
|
|
129
|
+
*/
|
|
130
|
+
ModifyPresentationHelper.normalizeSlideIds = (xml) => {
|
|
131
|
+
const slides = _a.getSlidesCollection(xml);
|
|
132
|
+
const firstId = 256;
|
|
133
|
+
xml_helper_1.XmlHelper.modifyCollection(slides, (slide, i) => {
|
|
134
|
+
slide.setAttribute('id', String(firstId + i));
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Smallest id PowerPoint accepts for `p:sldMasterId` / `p:sldLayoutId`
|
|
139
|
+
* (ids below 2^31 trigger the repair prompt; see #85).
|
|
140
|
+
*/
|
|
141
|
+
ModifyPresentationHelper.MIN_SLIDE_MASTER_ID = 2147483648;
|
|
142
|
+
/**
|
|
143
|
+
* Update slideMaster ids to prevent corrupted pptx.
|
|
144
|
+
* - Take first slideMaster id from presentation.xml to start (raised to
|
|
145
|
+
* `MIN_SLIDE_MASTER_ID` if it is lower),
|
|
146
|
+
* - then update incremental ids of each p:sldLayoutId in the master part
|
|
147
|
+
* the entry's relationship points at (starting by slideMasterId + 1)
|
|
148
|
+
* - and update next slideMaster id with previous p:sldLayoutId + 1
|
|
149
|
+
*
|
|
150
|
+
* p:sldMasterId-ids and p:sldLayoutId-ids need to be in a row, otherwise
|
|
151
|
+
* PowerPoint will complain on any p:sldLayoutId-id lower than its
|
|
152
|
+
* corresponding slideMaster-id. omg.
|
|
153
|
+
*/
|
|
154
|
+
ModifyPresentationHelper.normalizeSlideMasterIds = (xml, i, archive) => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
+
const slides = _a.getSlideMastersCollection(xml);
|
|
156
|
+
// The list entries and the master part numbers do not line up once a
|
|
157
|
+
// master has been removed: resolve each entry through its relationship.
|
|
158
|
+
const masterTargets = yield xml_relationship_helper_1.XmlRelationshipHelper.getTargetsByRelationshipType(archive, ppt_paths_1.PptPaths.presentationRels, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster');
|
|
159
|
+
let currentId;
|
|
160
|
+
yield xml_helper_1.XmlHelper.modifyCollectionAsync(slides, (slide, i) => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
+
const masterTarget = masterTargets.find((target) => target.rId === slide.getAttribute('r:id'));
|
|
162
|
+
const masterId = masterTarget ? masterTarget.number : i + 1;
|
|
163
|
+
if (i === 0) {
|
|
164
|
+
currentId = Math.max(Number(slide.getAttribute('id')) || 0, _a.MIN_SLIDE_MASTER_ID);
|
|
165
|
+
}
|
|
166
|
+
slide.setAttribute('id', String(currentId));
|
|
167
|
+
currentId++;
|
|
168
|
+
const slideMasterXml = yield xml_helper_1.XmlHelper.getXmlFromArchive(archive, ppt_paths_1.PptPaths.slideMaster(masterId));
|
|
169
|
+
const slideLayouts = slideMasterXml.getElementsByTagName('p:sldLayoutId');
|
|
170
|
+
xml_helper_1.XmlHelper.modifyCollection(slideLayouts, (slideLayout) => {
|
|
171
|
+
slideLayout.setAttribute('id', String(currentId));
|
|
172
|
+
currentId++;
|
|
173
|
+
});
|
|
174
|
+
}));
|
|
175
|
+
});
|
|
176
|
+
exports.default = ModifyPresentationHelper;
|
|
177
|
+
//# sourceMappingURL=modify-presentation-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modify-presentation-helper.js","sourceRoot":"","sources":["../../src/helper/modify-presentation-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAyC;AACzC,uEAAkE;AAClE,2CAAuC;AACvC,+CAA2C;AAI3C,MAAqB,wBAAwB;IAiH3C;;;OAGG;IACH,MAAM,CAAO,iBAAiB,CAC5B,GAAgB,EAChB,CAAS,EACT,OAAiB;;YAEjB,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;YACvC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YACD,yEAAyE;YACzE,yDAAyD;YACzD,sEAAsE;YACtE,iDAAiD;YACjD,MAAM,QAAQ,GAAG;gBACf,kBAAkB;gBAClB,wBAAwB;gBACxB,kBAAkB;gBAClB,wBAAwB;gBACxB,cAAc;aACf,CAAC;YACF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChC,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC3B,SAAS;gBACX,CAAC;gBACD,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACzC,MAAM,wBAAU,CAAC,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC1D,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACpD,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KAAA;IAED;;;;OAIG;IACH,MAAM,CAAO,wBAAwB,CACnC,GAAgB,EAChB,CAAS,EACT,OAAiB;;YAEjB,MAAM,sBAAS,CAAC,QAAQ,CAAC;gBACvB,OAAO;gBACP,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,EAAE,UAAU;gBACf,MAAM,EAAE,CAAC,GAAgB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,CACtD,CAAC;QACF,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,SAAS,GAAG,IAAI,CAAC,GAAG,CAClB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EACrC,EAAwB,CAAC,mBAAmB,CAC7C,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5C,SAAS,EAAE,CAAC;QAEZ,MAAM,cAAc,GAAG,MAAM,sBAAS,CAAC,iBAAiB,CACtD,OAAO,EACP,oBAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAC/B,CAAC;QAEF,MAAM,YAAY,GAChB,cAAc,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC;QACvD,sBAAS,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,WAAuB,EAAE,EAAE;YACnE,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YAClD,SAAS,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,CAAA,CACF,CAAC;AACJ,CAAC,CAAA,AA7C6B,CA6C5B;kBA/GiB,wBAAwB"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ModifyShapeHelper provides utility functions for manipulating PowerPoint shapes
|
|
3
|
+
* through XML modifications.
|
|
4
|
+
*/
|
|
5
|
+
import { BulletListContent, ReplaceText, ReplaceTextOptions, ShapeOutline } from '../types/modify-types';
|
|
6
|
+
import { ShapeCoordinates } from '../types/shape-types';
|
|
7
|
+
import { ElementVisualType, PlaceholderInfo, ShapeBackgroundInfo, XmlElement } from '../types/xml-types';
|
|
8
|
+
/**
|
|
9
|
+
* Helper class for modifying PowerPoint shapes in XML structure
|
|
10
|
+
* Provides various methods for manipulating shape appearance, position, and content
|
|
11
|
+
*/
|
|
12
|
+
export default class ModifyShapeHelper {
|
|
13
|
+
/**
|
|
14
|
+
* Set solid fill of modified shape to accent6 color
|
|
15
|
+
*
|
|
16
|
+
* @param element - XML element representing the shape
|
|
17
|
+
*/
|
|
18
|
+
static setSolidFill: (element: XmlElement) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Set outline (line) properties of an existing shape, picture or
|
|
21
|
+
* placeholder: width, dash style and color.
|
|
22
|
+
*
|
|
23
|
+
* Creates an <a:ln> element if the shape has none, which is the case
|
|
24
|
+
* whenever the outline was never overridden in PowerPoint and is
|
|
25
|
+
* inherited from the theme or the shape style.
|
|
26
|
+
*
|
|
27
|
+
* Note: if the shape's outline was explicitly switched off in PowerPoint
|
|
28
|
+
* (<a:ln><a:noFill/></a:ln>), a weight alone stays invisible - pass a
|
|
29
|
+
* color as well. Use ModifyCleanupHelper.removeBorder to drop an outline.
|
|
30
|
+
*
|
|
31
|
+
* @param outline - Width (EMU, 1pt = 12700), dash type and/or color
|
|
32
|
+
* @returns Function that accepts an XML element to modify
|
|
33
|
+
*/
|
|
34
|
+
static setOutline: (outline: ShapeOutline) => (element: XmlElement) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Set text content of a shape
|
|
37
|
+
*
|
|
38
|
+
* @param text - Text string to set as shape content
|
|
39
|
+
* @returns Function that accepts an XML element to modify
|
|
40
|
+
*/
|
|
41
|
+
static setText: (text: string) => (element: XmlElement) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Set content to bulleted list within a shape
|
|
44
|
+
*
|
|
45
|
+
* @param list - Array or string content for the bullet list
|
|
46
|
+
* @returns Function that accepts an XML element to modify
|
|
47
|
+
*/
|
|
48
|
+
static setBulletList: (list: BulletListContent) => (element: XmlElement) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Replace tagged text content within modified shape
|
|
51
|
+
*
|
|
52
|
+
* @param replaceText - Single replacement or array of replacements
|
|
53
|
+
* @param options - Optional configuration for text replacement
|
|
54
|
+
* @returns Function that accepts an XML element to modify
|
|
55
|
+
*/
|
|
56
|
+
static replaceText: (replaceText: ReplaceText | ReplaceText[], options?: ReplaceTextOptions) => (element: XmlElement) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Creates missing transformation elements (a:off and a:ext) with default values
|
|
59
|
+
* Ensures that a shape has the required XML structure for positioning and sizing
|
|
60
|
+
*
|
|
61
|
+
* @param element - The XML element to check and modify
|
|
62
|
+
* @returns The xfrm element that contains or will contain the transformation data
|
|
63
|
+
*/
|
|
64
|
+
static ensureTransformElements: (element: XmlElement) => XmlElement | null;
|
|
65
|
+
/**
|
|
66
|
+
* Set absolute position and size of a shape
|
|
67
|
+
*
|
|
68
|
+
* @param pos - Object containing position and size coordinates
|
|
69
|
+
* @returns Function that accepts an XML element to modify
|
|
70
|
+
*/
|
|
71
|
+
static setPosition: (pos: ShapeCoordinates) => (element: XmlElement) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Incrementally update position and size of a shape by adding delta values
|
|
74
|
+
*
|
|
75
|
+
* @param pos - Object containing delta values for position and size
|
|
76
|
+
* @returns Function that accepts an XML element to modify
|
|
77
|
+
*/
|
|
78
|
+
static updatePosition: (pos: ShapeCoordinates) => (element: XmlElement) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Rotate a shape by a given angle in degrees
|
|
81
|
+
*
|
|
82
|
+
* @param degrees - Rotation angle in degrees (positive = clockwise, negative = counterclockwise)
|
|
83
|
+
* @returns Function that accepts an XML element to modify
|
|
84
|
+
*/
|
|
85
|
+
static rotate: (degrees: number) => (element: XmlElement) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Apply rounded corners to a shape with a specified corner radius
|
|
88
|
+
*
|
|
89
|
+
* @param degree - Corner radius in EMU units (1 cm = 360000 EMU)
|
|
90
|
+
* @returns Function that accepts an XML element to modify
|
|
91
|
+
*/
|
|
92
|
+
static roundedCorners: (degree: number) => (element: XmlElement) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Determines the type of visual element in PowerPoint
|
|
95
|
+
* @param element The XML element to check
|
|
96
|
+
* @returns A string identifying the element type
|
|
97
|
+
*/
|
|
98
|
+
static getElementVisualType(element: XmlElement): ElementVisualType;
|
|
99
|
+
/**
|
|
100
|
+
* Forward placeholder info function
|
|
101
|
+
* @param element The XML element to check
|
|
102
|
+
* @returns The PlaceholderInfo object
|
|
103
|
+
*/
|
|
104
|
+
static getElementPlaceholderInfo(element: XmlElement): PlaceholderInfo;
|
|
105
|
+
/**
|
|
106
|
+
* Check if the given element has a background which is non-transparent
|
|
107
|
+
* @param element The XML element to check
|
|
108
|
+
* @returns ShapeBackgroundInfo
|
|
109
|
+
*/
|
|
110
|
+
static elementHasBackground(element: XmlElement): ShapeBackgroundInfo;
|
|
111
|
+
}
|