@office-open/pptx 0.6.8 → 0.6.10
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/README.md +26 -20
- package/dist/index.d.mts +17 -24
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +320 -186
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- /package/dist/{chunk-090QGkrx.mjs → chunk-DHfcOUro.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-
|
|
2
|
-
import { AppProperties, BaseXmlComponent, BuilderElement, EmptyElement, Formatter, Formatter as Formatter$1, ImportedXmlComponent, OoxmlMimeType, PPTX_NS, Relationships, XmlComponent,
|
|
1
|
+
import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-DHfcOUro.mjs";
|
|
2
|
+
import { AppProperties, BaseXmlComponent, BuilderElement, EmptyElement, Formatter, Formatter as Formatter$1, ImportedXmlComponent, OoxmlMimeType, PPTX_NS, Relationships, XmlComponent, addSmartArtRelationships, appendContentType, buildAttrObject, buildCorePropertiesXmlString, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPixels as convertEmuToPixels$1, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPixelsToEmu as convertPixelsToEmu$1, convertPointsToEmu, createPacker, createReplacer, formatId, getReferencedMedia, hasPlaceholders, hashedId, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, toJson, uniqueId, uniqueNumericIdCreator, uniqueUuid, unzipSync, xsdLineEndSize, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, zipAndConvert } from "@office-open/core";
|
|
3
3
|
import { BevelPresetType, CompoundLine, LineCap, LineJoin, PathShadeType, PenAlignment, PresetDash, PresetGeometry, PresetMaterialType, Stretch, TileFlipMode, buildFill, createBevel, createBlip, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createEffectList as createEffectList$1, createGradientFill, createGradientStop, createGroupTransform2D, createOutline, createOutline as createOutline$1, createScene3D, createScene3D as createScene3D$1, createShape3D, createShape3D as createShape3D$1, createTransform2D, extractBlipFillMedia } from "@office-open/core/drawingml";
|
|
4
4
|
import { ChartCollection, ChartSpace } from "@office-open/core/chart";
|
|
5
5
|
import { attr, attrBool, attrNum, children, colorAttr, escapeXml, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
|
|
@@ -270,6 +270,7 @@ const PPTX_SLIDE_MASTER = "application/vnd.openxmlformats-officedocument.present
|
|
|
270
270
|
const PPTX_SLIDE_LAYOUT = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
271
271
|
const PPTX_THEME = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
272
272
|
const PPTX_NOTES = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
|
273
|
+
const PPTX_NOTES_MASTER = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
273
274
|
const PPTX_COMMENTS = "application/vnd.openxmlformats-officedocument.presentationml.comments+xml";
|
|
274
275
|
const PPTX_COMMENT_AUTHORS = "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml";
|
|
275
276
|
const PPTX_CHART = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
@@ -364,6 +365,13 @@ var ContentTypes = class extends BaseXmlComponent {
|
|
|
364
365
|
key: `/ppt/notesSlides/notesSlide${index}.xml`
|
|
365
366
|
});
|
|
366
367
|
}
|
|
368
|
+
addNotesMaster() {
|
|
369
|
+
this.dynamicEntries.push({
|
|
370
|
+
type: "Override",
|
|
371
|
+
contentType: PPTX_NOTES_MASTER,
|
|
372
|
+
key: "/ppt/notesMasters/notesMaster1.xml"
|
|
373
|
+
});
|
|
374
|
+
}
|
|
367
375
|
addComments(index) {
|
|
368
376
|
this.dynamicEntries.push({
|
|
369
377
|
type: "Override",
|
|
@@ -511,36 +519,6 @@ var Media = class {
|
|
|
511
519
|
}
|
|
512
520
|
};
|
|
513
521
|
//#endregion
|
|
514
|
-
//#region src/file/drawingml/group-transform-2d.ts
|
|
515
|
-
init_xml_components();
|
|
516
|
-
/**
|
|
517
|
-
* a:xfrm — Group transform (CT_GroupTransform2D).
|
|
518
|
-
* Extends regular Transform2D with child offset (chOff) and child extent (chExt).
|
|
519
|
-
* Delegates to core createGroupTransform2D.
|
|
520
|
-
*/
|
|
521
|
-
var GroupTransform2D = class extends XmlComponent {
|
|
522
|
-
core;
|
|
523
|
-
constructor(options, prefix = "a") {
|
|
524
|
-
super(`${prefix}:xfrm`);
|
|
525
|
-
this.core = createGroupTransform2D(options, `${prefix}:xfrm`);
|
|
526
|
-
}
|
|
527
|
-
toXml(context) {
|
|
528
|
-
return this.core.toXml(context);
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
//#endregion
|
|
532
|
-
//#region src/file/drawingml/group-shape-properties.ts
|
|
533
|
-
init_xml_components();
|
|
534
|
-
/**
|
|
535
|
-
* p:grpSpPr — Group shape properties with CT_GroupTransform2D.
|
|
536
|
-
*/
|
|
537
|
-
var GroupShapeProperties = class extends XmlComponent {
|
|
538
|
-
constructor(options) {
|
|
539
|
-
super("p:grpSpPr");
|
|
540
|
-
this.root.push(new GroupTransform2D(options ?? {}));
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
//#endregion
|
|
544
522
|
//#region src/file/shape-tree/group-shape-non-visual.ts
|
|
545
523
|
init_xml_components();
|
|
546
524
|
/**
|
|
@@ -573,12 +551,6 @@ var GroupShapeNonVisualProperties = class extends BuilderElement {
|
|
|
573
551
|
//#endregion
|
|
574
552
|
//#region src/file/shape/paragraph/paragraph-properties.ts
|
|
575
553
|
init_xml_components();
|
|
576
|
-
const TextAlignment = {
|
|
577
|
-
LEFT: "left",
|
|
578
|
-
CENTER: "center",
|
|
579
|
-
RIGHT: "right",
|
|
580
|
-
JUSTIFY: "justify"
|
|
581
|
-
};
|
|
582
554
|
function buildBulletChildren(options) {
|
|
583
555
|
const children = [];
|
|
584
556
|
if (options.type === "none") {
|
|
@@ -795,105 +767,6 @@ var Paragraph = class extends XmlComponent {
|
|
|
795
767
|
}
|
|
796
768
|
};
|
|
797
769
|
//#endregion
|
|
798
|
-
//#region src/file/table/table-cell-properties.ts
|
|
799
|
-
init_xml_components();
|
|
800
|
-
init_fill();
|
|
801
|
-
function buildBorderLine(name, options) {
|
|
802
|
-
const attrs = [];
|
|
803
|
-
if (options.width !== void 0) attrs.push(`w="${options.width}"`);
|
|
804
|
-
const children = [];
|
|
805
|
-
if (options.color) children.push(`<a:solidFill><a:srgbClr val="${options.color.replace("#", "")}"/></a:solidFill>`);
|
|
806
|
-
if (options.dashStyle) children.push(`<a:prstDash val="${options.dashStyle}"/>`);
|
|
807
|
-
const attrStr = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
808
|
-
if (children.length === 0) return `<${name}${attrStr}/>`;
|
|
809
|
-
return `<${name}${attrStr}>${children.join("")}</${name}>`;
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* a:tcPr — Table cell properties (borders + fill).
|
|
813
|
-
*/
|
|
814
|
-
var TableCellProperties = class extends BaseXmlComponent {
|
|
815
|
-
options;
|
|
816
|
-
constructor(options) {
|
|
817
|
-
super("a:tcPr");
|
|
818
|
-
this.options = options;
|
|
819
|
-
}
|
|
820
|
-
toXml(context) {
|
|
821
|
-
const parts = [];
|
|
822
|
-
const opts = this.options;
|
|
823
|
-
if (opts?.verticalAlign) parts.push(`anchor="${opts.verticalAlign}"`);
|
|
824
|
-
if (opts?.borders) {
|
|
825
|
-
if (opts.borders.left) parts.push(buildBorderLine("a:lnL", opts.borders.left));
|
|
826
|
-
if (opts.borders.right) parts.push(buildBorderLine("a:lnR", opts.borders.right));
|
|
827
|
-
if (opts.borders.top) parts.push(buildBorderLine("a:lnT", opts.borders.top));
|
|
828
|
-
if (opts.borders.bottom) parts.push(buildBorderLine("a:lnB", opts.borders.bottom));
|
|
829
|
-
}
|
|
830
|
-
if (opts?.fill !== void 0) {
|
|
831
|
-
const fillComp = buildFill(opts.fill);
|
|
832
|
-
parts.push(fillComp.toXml(context));
|
|
833
|
-
}
|
|
834
|
-
if (parts.length === 0) return "<a:tcPr/>";
|
|
835
|
-
if (!parts[0].startsWith("<")) {
|
|
836
|
-
const attrStr = parts[0];
|
|
837
|
-
const children = parts.slice(1);
|
|
838
|
-
if (children.length === 0) return `<a:tcPr ${attrStr}/>`;
|
|
839
|
-
return `<a:tcPr ${attrStr}>${children.join("")}</a:tcPr>`;
|
|
840
|
-
}
|
|
841
|
-
return `<a:tcPr>${parts.join("")}</a:tcPr>`;
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
//#endregion
|
|
845
|
-
//#region src/file/table/table-cell.ts
|
|
846
|
-
init_xml_components();
|
|
847
|
-
const VerticalAlignment = {
|
|
848
|
-
TOP: "top",
|
|
849
|
-
CENTER: "center",
|
|
850
|
-
BOTTOM: "bottom"
|
|
851
|
-
};
|
|
852
|
-
/**
|
|
853
|
-
* a:tc — Table cell with text body and properties.
|
|
854
|
-
* Lazy: stores options, builds XML string in toXml.
|
|
855
|
-
*/
|
|
856
|
-
var TableCell = class extends BaseXmlComponent {
|
|
857
|
-
options;
|
|
858
|
-
paragraphs;
|
|
859
|
-
constructor(options = {}) {
|
|
860
|
-
super("a:tc");
|
|
861
|
-
this.options = options;
|
|
862
|
-
this.paragraphs = options.children?.map((c) => typeof c === "string" ? new Paragraph(c) : c instanceof BaseXmlComponent ? c : new Paragraph(c)) ?? (options.text !== void 0 ? [new Paragraph({
|
|
863
|
-
properties: {},
|
|
864
|
-
children: [new TextRun({ text: options.text })]
|
|
865
|
-
})] : void 0);
|
|
866
|
-
}
|
|
867
|
-
toXml(context) {
|
|
868
|
-
const opts = this.options;
|
|
869
|
-
const parts = [];
|
|
870
|
-
const tcAttrs = [];
|
|
871
|
-
if (opts.columnSpan !== void 0 && opts.columnSpan > 1) tcAttrs.push(`gridSpan="${opts.columnSpan}"`);
|
|
872
|
-
if (opts.rowSpan !== void 0 && opts.rowSpan > 1) tcAttrs.push(`rowSpan="${opts.rowSpan}"`);
|
|
873
|
-
const tcAttrStr = tcAttrs.length > 0 ? ` ${tcAttrs.join(" ")}` : "";
|
|
874
|
-
const txParts = [];
|
|
875
|
-
const margins = opts.margins;
|
|
876
|
-
const bodyPrAttrs = [];
|
|
877
|
-
if (margins?.top !== void 0) bodyPrAttrs.push(`tIns="${margins.top}"`);
|
|
878
|
-
if (margins?.bottom !== void 0) bodyPrAttrs.push(`bIns="${margins.bottom}"`);
|
|
879
|
-
if (margins?.left !== void 0) bodyPrAttrs.push(`lIns="${margins.left}"`);
|
|
880
|
-
if (margins?.right !== void 0) bodyPrAttrs.push(`rIns="${margins.right}"`);
|
|
881
|
-
const bodyPrStr = bodyPrAttrs.length > 0 ? ` ${bodyPrAttrs.join(" ")}` : "";
|
|
882
|
-
txParts.push(`<a:bodyPr${bodyPrStr}/>`);
|
|
883
|
-
txParts.push("<a:lstStyle/>");
|
|
884
|
-
if (this.paragraphs) for (const p of this.paragraphs) txParts.push(p.toXml(context));
|
|
885
|
-
else txParts.push("<a:p/>");
|
|
886
|
-
parts.push(`<a:txBody>${txParts.join("")}</a:txBody>`);
|
|
887
|
-
const tcPr = new TableCellProperties({
|
|
888
|
-
fill: opts.fill,
|
|
889
|
-
borders: opts.borders,
|
|
890
|
-
verticalAlign: opts.verticalAlign ? xsdTextAnchor.to(opts.verticalAlign) : void 0
|
|
891
|
-
});
|
|
892
|
-
parts.push(tcPr.toXml(context));
|
|
893
|
-
return `<a:tc${tcAttrStr}>${parts.join("")}</a:tc>`;
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
//#endregion
|
|
897
770
|
//#region src/file/shape/text-body.ts
|
|
898
771
|
init_xml_components();
|
|
899
772
|
/**
|
|
@@ -945,11 +818,6 @@ var TextBody = class extends XmlComponent {
|
|
|
945
818
|
//#endregion
|
|
946
819
|
//#region src/file/notes/notes-slide.ts
|
|
947
820
|
init_xml_components();
|
|
948
|
-
/**
|
|
949
|
-
* p:notes — A notes slide associated with a presentation slide.
|
|
950
|
-
*
|
|
951
|
-
* Contains a slide image placeholder and a body text area for speaker notes.
|
|
952
|
-
*/
|
|
953
821
|
var NotesSlide = class extends XmlComponent {
|
|
954
822
|
constructor(options = {}) {
|
|
955
823
|
super("p:notes");
|
|
@@ -975,7 +843,66 @@ var NotesShapeTree = class extends XmlComponent {
|
|
|
975
843
|
constructor(text) {
|
|
976
844
|
super("p:spTree");
|
|
977
845
|
this.root.push(new GroupShapeNonVisualProperties());
|
|
978
|
-
this.root.push(new
|
|
846
|
+
this.root.push(new BuilderElement({
|
|
847
|
+
name: "p:grpSpPr",
|
|
848
|
+
children: [new BuilderElement({
|
|
849
|
+
name: "a:xfrm",
|
|
850
|
+
children: [
|
|
851
|
+
new BuilderElement({
|
|
852
|
+
name: "a:off",
|
|
853
|
+
attributes: {
|
|
854
|
+
x: {
|
|
855
|
+
key: "x",
|
|
856
|
+
value: 0
|
|
857
|
+
},
|
|
858
|
+
y: {
|
|
859
|
+
key: "y",
|
|
860
|
+
value: 0
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}),
|
|
864
|
+
new BuilderElement({
|
|
865
|
+
name: "a:ext",
|
|
866
|
+
attributes: {
|
|
867
|
+
cx: {
|
|
868
|
+
key: "cx",
|
|
869
|
+
value: 0
|
|
870
|
+
},
|
|
871
|
+
cy: {
|
|
872
|
+
key: "cy",
|
|
873
|
+
value: 0
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}),
|
|
877
|
+
new BuilderElement({
|
|
878
|
+
name: "a:chOff",
|
|
879
|
+
attributes: {
|
|
880
|
+
x: {
|
|
881
|
+
key: "x",
|
|
882
|
+
value: 0
|
|
883
|
+
},
|
|
884
|
+
y: {
|
|
885
|
+
key: "y",
|
|
886
|
+
value: 0
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}),
|
|
890
|
+
new BuilderElement({
|
|
891
|
+
name: "a:chExt",
|
|
892
|
+
attributes: {
|
|
893
|
+
cx: {
|
|
894
|
+
key: "cx",
|
|
895
|
+
value: 0
|
|
896
|
+
},
|
|
897
|
+
cy: {
|
|
898
|
+
key: "cy",
|
|
899
|
+
value: 0
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
})
|
|
903
|
+
]
|
|
904
|
+
})]
|
|
905
|
+
}));
|
|
979
906
|
this.root.push(new SlideImagePlaceholder());
|
|
980
907
|
this.root.push(new NotesBodyPlaceholder(text));
|
|
981
908
|
}
|
|
@@ -999,7 +926,26 @@ var SlideImagePlaceholder = class extends XmlComponent {
|
|
|
999
926
|
}
|
|
1000
927
|
}
|
|
1001
928
|
}),
|
|
1002
|
-
new BuilderElement({
|
|
929
|
+
new BuilderElement({
|
|
930
|
+
name: "p:cNvSpPr",
|
|
931
|
+
children: [new BuilderElement({
|
|
932
|
+
name: "a:spLocks",
|
|
933
|
+
attributes: {
|
|
934
|
+
noGrp: {
|
|
935
|
+
key: "noGrp",
|
|
936
|
+
value: 1
|
|
937
|
+
},
|
|
938
|
+
noRot: {
|
|
939
|
+
key: "noRot",
|
|
940
|
+
value: 1
|
|
941
|
+
},
|
|
942
|
+
noChangeAspect: {
|
|
943
|
+
key: "noChangeAspect",
|
|
944
|
+
value: 1
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
})]
|
|
948
|
+
}),
|
|
1003
949
|
new BuilderElement({
|
|
1004
950
|
name: "p:nvPr",
|
|
1005
951
|
children: [new BuilderElement({
|
|
@@ -1064,7 +1010,16 @@ var NotesBodyPlaceholder = class extends XmlComponent {
|
|
|
1064
1010
|
}
|
|
1065
1011
|
}
|
|
1066
1012
|
}),
|
|
1067
|
-
new BuilderElement({
|
|
1013
|
+
new BuilderElement({
|
|
1014
|
+
name: "p:cNvSpPr",
|
|
1015
|
+
children: [new BuilderElement({
|
|
1016
|
+
name: "a:spLocks",
|
|
1017
|
+
attributes: { noGrp: {
|
|
1018
|
+
key: "noGrp",
|
|
1019
|
+
value: 1
|
|
1020
|
+
} }
|
|
1021
|
+
})]
|
|
1022
|
+
}),
|
|
1068
1023
|
new BuilderElement({
|
|
1069
1024
|
name: "p:nvPr",
|
|
1070
1025
|
children: [new BuilderElement({
|
|
@@ -1188,6 +1143,12 @@ var Presentation = class extends XmlComponent {
|
|
|
1188
1143
|
super("p:presentation");
|
|
1189
1144
|
this.options = options;
|
|
1190
1145
|
}
|
|
1146
|
+
setNotesMasterRId(rId) {
|
|
1147
|
+
this.options = {
|
|
1148
|
+
...this.options,
|
|
1149
|
+
notesMasterRId: rId
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1191
1152
|
toXml(_context) {
|
|
1192
1153
|
const opts = this.options;
|
|
1193
1154
|
const cx = opts.slideWidth ?? 12192e3;
|
|
@@ -1196,6 +1157,7 @@ var Presentation = class extends XmlComponent {
|
|
|
1196
1157
|
s += "<p:sldMasterIdLst>";
|
|
1197
1158
|
for (let mi = 0; mi < opts.masterCount; mi++) s += `<p:sldMasterId id="${2147483648 + mi * 12}" r:id="rId${mi + 1}"/>`;
|
|
1198
1159
|
s += "</p:sldMasterIdLst>";
|
|
1160
|
+
if (opts.notesMasterRId) s += `<p:notesMasterIdLst><p:notesMasterId r:id="rId${opts.notesMasterRId}"/></p:notesMasterIdLst>`;
|
|
1199
1161
|
s += "<p:sldIdLst>";
|
|
1200
1162
|
const sRidOff = opts.masterCount + 1;
|
|
1201
1163
|
for (let i = 0; i < opts.slideIds.length; i++) s += `<p:sldId id="${opts.slideIds[i]}" r:id="rId${sRidOff + i}"/>`;
|
|
@@ -1726,7 +1688,7 @@ var Picture = class Picture extends XmlComponent {
|
|
|
1726
1688
|
}
|
|
1727
1689
|
/** Register image with the File's Media collection. */
|
|
1728
1690
|
registerMedia(context) {
|
|
1729
|
-
context.fileData
|
|
1691
|
+
context.fileData.media.addImage(this.imageData.fileName, this.imageData);
|
|
1730
1692
|
}
|
|
1731
1693
|
toXml(context) {
|
|
1732
1694
|
this.registerMedia(context);
|
|
@@ -2314,6 +2276,100 @@ var TableProperties = class extends BaseXmlComponent {
|
|
|
2314
2276
|
}
|
|
2315
2277
|
};
|
|
2316
2278
|
//#endregion
|
|
2279
|
+
//#region src/file/table/table-cell-properties.ts
|
|
2280
|
+
init_xml_components();
|
|
2281
|
+
init_fill();
|
|
2282
|
+
function buildBorderLine(name, options) {
|
|
2283
|
+
const attrs = [];
|
|
2284
|
+
if (options.width !== void 0) attrs.push(`w="${options.width}"`);
|
|
2285
|
+
const children = [];
|
|
2286
|
+
if (options.color) children.push(`<a:solidFill><a:srgbClr val="${options.color.replace("#", "")}"/></a:solidFill>`);
|
|
2287
|
+
if (options.dashStyle) children.push(`<a:prstDash val="${options.dashStyle}"/>`);
|
|
2288
|
+
const attrStr = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
2289
|
+
if (children.length === 0) return `<${name}${attrStr}/>`;
|
|
2290
|
+
return `<${name}${attrStr}>${children.join("")}</${name}>`;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* a:tcPr — Table cell properties (borders + fill).
|
|
2294
|
+
*/
|
|
2295
|
+
var TableCellProperties = class extends BaseXmlComponent {
|
|
2296
|
+
options;
|
|
2297
|
+
constructor(options) {
|
|
2298
|
+
super("a:tcPr");
|
|
2299
|
+
this.options = options;
|
|
2300
|
+
}
|
|
2301
|
+
toXml(context) {
|
|
2302
|
+
const parts = [];
|
|
2303
|
+
const opts = this.options;
|
|
2304
|
+
if (opts?.verticalAlign) parts.push(`anchor="${opts.verticalAlign}"`);
|
|
2305
|
+
if (opts?.borders) {
|
|
2306
|
+
if (opts.borders.left) parts.push(buildBorderLine("a:lnL", opts.borders.left));
|
|
2307
|
+
if (opts.borders.right) parts.push(buildBorderLine("a:lnR", opts.borders.right));
|
|
2308
|
+
if (opts.borders.top) parts.push(buildBorderLine("a:lnT", opts.borders.top));
|
|
2309
|
+
if (opts.borders.bottom) parts.push(buildBorderLine("a:lnB", opts.borders.bottom));
|
|
2310
|
+
}
|
|
2311
|
+
if (opts?.fill !== void 0) {
|
|
2312
|
+
const fillComp = buildFill(opts.fill);
|
|
2313
|
+
parts.push(fillComp.toXml(context));
|
|
2314
|
+
}
|
|
2315
|
+
if (parts.length === 0) return "<a:tcPr/>";
|
|
2316
|
+
if (!parts[0].startsWith("<")) {
|
|
2317
|
+
const attrStr = parts[0];
|
|
2318
|
+
const children = parts.slice(1);
|
|
2319
|
+
if (children.length === 0) return `<a:tcPr ${attrStr}/>`;
|
|
2320
|
+
return `<a:tcPr ${attrStr}>${children.join("")}</a:tcPr>`;
|
|
2321
|
+
}
|
|
2322
|
+
return `<a:tcPr>${parts.join("")}</a:tcPr>`;
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
//#endregion
|
|
2326
|
+
//#region src/file/table/table-cell.ts
|
|
2327
|
+
init_xml_components();
|
|
2328
|
+
/**
|
|
2329
|
+
* a:tc — Table cell with text body and properties.
|
|
2330
|
+
* Lazy: stores options, builds XML string in toXml.
|
|
2331
|
+
*/
|
|
2332
|
+
var TableCell = class extends BaseXmlComponent {
|
|
2333
|
+
options;
|
|
2334
|
+
paragraphs;
|
|
2335
|
+
constructor(options = {}) {
|
|
2336
|
+
super("a:tc");
|
|
2337
|
+
this.options = options;
|
|
2338
|
+
this.paragraphs = options.children?.map((c) => typeof c === "string" ? new Paragraph(c) : c instanceof BaseXmlComponent ? c : new Paragraph(c)) ?? (options.text !== void 0 ? [new Paragraph({
|
|
2339
|
+
properties: {},
|
|
2340
|
+
children: [new TextRun({ text: options.text })]
|
|
2341
|
+
})] : void 0);
|
|
2342
|
+
}
|
|
2343
|
+
toXml(context) {
|
|
2344
|
+
const opts = this.options;
|
|
2345
|
+
const parts = [];
|
|
2346
|
+
const tcAttrs = [];
|
|
2347
|
+
if (opts.columnSpan !== void 0 && opts.columnSpan > 1) tcAttrs.push(`gridSpan="${opts.columnSpan}"`);
|
|
2348
|
+
if (opts.rowSpan !== void 0 && opts.rowSpan > 1) tcAttrs.push(`rowSpan="${opts.rowSpan}"`);
|
|
2349
|
+
const tcAttrStr = tcAttrs.length > 0 ? ` ${tcAttrs.join(" ")}` : "";
|
|
2350
|
+
const txParts = [];
|
|
2351
|
+
const margins = opts.margins;
|
|
2352
|
+
const bodyPrAttrs = [];
|
|
2353
|
+
if (margins?.top !== void 0) bodyPrAttrs.push(`tIns="${margins.top}"`);
|
|
2354
|
+
if (margins?.bottom !== void 0) bodyPrAttrs.push(`bIns="${margins.bottom}"`);
|
|
2355
|
+
if (margins?.left !== void 0) bodyPrAttrs.push(`lIns="${margins.left}"`);
|
|
2356
|
+
if (margins?.right !== void 0) bodyPrAttrs.push(`rIns="${margins.right}"`);
|
|
2357
|
+
const bodyPrStr = bodyPrAttrs.length > 0 ? ` ${bodyPrAttrs.join(" ")}` : "";
|
|
2358
|
+
txParts.push(`<a:bodyPr${bodyPrStr}/>`);
|
|
2359
|
+
txParts.push("<a:lstStyle/>");
|
|
2360
|
+
if (this.paragraphs) for (const p of this.paragraphs) txParts.push(p.toXml(context));
|
|
2361
|
+
else txParts.push("<a:p/>");
|
|
2362
|
+
parts.push(`<a:txBody>${txParts.join("")}</a:txBody>`);
|
|
2363
|
+
const tcPr = new TableCellProperties({
|
|
2364
|
+
fill: opts.fill,
|
|
2365
|
+
borders: opts.borders,
|
|
2366
|
+
verticalAlign: opts.verticalAlign ? xsdTextAnchor.to(opts.verticalAlign) : void 0
|
|
2367
|
+
});
|
|
2368
|
+
parts.push(tcPr.toXml(context));
|
|
2369
|
+
return `<a:tc${tcAttrStr}>${parts.join("")}</a:tc>`;
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
//#endregion
|
|
2317
2373
|
//#region src/file/table/table-row.ts
|
|
2318
2374
|
init_xml_components();
|
|
2319
2375
|
/**
|
|
@@ -3857,14 +3913,17 @@ const DIRECTION_MAP = {
|
|
|
3857
3913
|
function buildTransitionElement(type, direction, orient, thruBlk, spokes) {
|
|
3858
3914
|
const dir = direction ? DIRECTION_MAP[direction] : void 0;
|
|
3859
3915
|
const attrs = [];
|
|
3860
|
-
if (ORIENT_TYPES.has(type) && dir) attrs.push(`dir="${dir}"`);
|
|
3861
|
-
else if (SIDE_DIR_TYPES.has(type) && dir) attrs.push(`dir="${dir}"`);
|
|
3862
|
-
else if (EIGHT_DIR_TYPES.has(type) && dir) attrs.push(`dir="${dir}"`);
|
|
3863
|
-
else if (type === "strips" && dir) attrs.push(`dir="${dir}"`);
|
|
3916
|
+
if (ORIENT_TYPES.has(type) && dir && dir !== "horz") attrs.push(`dir="${dir}"`);
|
|
3917
|
+
else if (SIDE_DIR_TYPES.has(type) && dir && dir !== "l") attrs.push(`dir="${dir}"`);
|
|
3918
|
+
else if (EIGHT_DIR_TYPES.has(type) && dir && dir !== "l") attrs.push(`dir="${dir}"`);
|
|
3919
|
+
else if (type === "strips" && dir && dir !== "lu") attrs.push(`dir="${dir}"`);
|
|
3864
3920
|
else if ((type === "fade" || type === "cut") && thruBlk !== void 0) attrs.push(`thruBlk="${thruBlk ? 1 : 0}"`);
|
|
3865
|
-
else if (type === "split")
|
|
3866
|
-
|
|
3867
|
-
|
|
3921
|
+
else if (type === "split") {
|
|
3922
|
+
if (orient && orient !== "horz") attrs.push(`orient="${orient}"`);
|
|
3923
|
+
if (dir && dir !== "out") attrs.push(`dir="${dir}"`);
|
|
3924
|
+
} else if (type === "wheel") {
|
|
3925
|
+
if (spokes !== void 0 && spokes !== 4) attrs.push(`spokes="${spokes}"`);
|
|
3926
|
+
} else if (type === "zoom" && dir && dir !== "in") attrs.push(`dir="${dir}"`);
|
|
3868
3927
|
return attrs.length > 0 ? `<p:${type} ${attrs.join(" ")}/>` : `<p:${type}/>`;
|
|
3869
3928
|
}
|
|
3870
3929
|
function buildTransition(options) {
|
|
@@ -4260,14 +4319,19 @@ var File = class {
|
|
|
4260
4319
|
if (!this._contentTypes) {
|
|
4261
4320
|
this._contentTypes = new ContentTypes();
|
|
4262
4321
|
let hasComments = false;
|
|
4322
|
+
let notesSlideIdx = 0;
|
|
4263
4323
|
for (let i = 0; i < this.slideOptions.length; i++) {
|
|
4264
4324
|
this._contentTypes.addSlide(i + 1);
|
|
4265
|
-
if (this.slideOptions[i].notes)
|
|
4325
|
+
if (this.slideOptions[i].notes) {
|
|
4326
|
+
this._contentTypes.addNotesSlide(notesSlideIdx + 1);
|
|
4327
|
+
notesSlideIdx++;
|
|
4328
|
+
}
|
|
4266
4329
|
if (this.slideOptions[i].comments && this.slideOptions[i].comments.length > 0) {
|
|
4267
4330
|
this._contentTypes.addComments(i + 1);
|
|
4268
4331
|
hasComments = true;
|
|
4269
4332
|
}
|
|
4270
4333
|
}
|
|
4334
|
+
if (notesSlideIdx > 0) this._contentTypes.addNotesMaster();
|
|
4271
4335
|
if (hasComments) this._contentTypes.addCommentAuthors();
|
|
4272
4336
|
}
|
|
4273
4337
|
return this._contentTypes;
|
|
@@ -4433,7 +4497,7 @@ var File = class {
|
|
|
4433
4497
|
this._slideCommentLists[i] = new SlideCommentList(commentEntries);
|
|
4434
4498
|
}
|
|
4435
4499
|
if (authorMap.size > 0) {
|
|
4436
|
-
const authors =
|
|
4500
|
+
const authors = Array.from(authorMap.values(), (a) => ({
|
|
4437
4501
|
id: a.id,
|
|
4438
4502
|
name: a.name,
|
|
4439
4503
|
initials: a.initials,
|
|
@@ -4544,6 +4608,36 @@ var NonVisualDrawingProperties = class extends BuilderElement {
|
|
|
4544
4608
|
}
|
|
4545
4609
|
};
|
|
4546
4610
|
//#endregion
|
|
4611
|
+
//#region src/file/drawingml/group-transform-2d.ts
|
|
4612
|
+
init_xml_components();
|
|
4613
|
+
/**
|
|
4614
|
+
* a:xfrm — Group transform (CT_GroupTransform2D).
|
|
4615
|
+
* Extends regular Transform2D with child offset (chOff) and child extent (chExt).
|
|
4616
|
+
* Delegates to core createGroupTransform2D.
|
|
4617
|
+
*/
|
|
4618
|
+
var GroupTransform2D = class extends XmlComponent {
|
|
4619
|
+
core;
|
|
4620
|
+
constructor(options, prefix = "a") {
|
|
4621
|
+
super(`${prefix}:xfrm`);
|
|
4622
|
+
this.core = createGroupTransform2D(options, `${prefix}:xfrm`);
|
|
4623
|
+
}
|
|
4624
|
+
toXml(context) {
|
|
4625
|
+
return this.core.toXml(context);
|
|
4626
|
+
}
|
|
4627
|
+
};
|
|
4628
|
+
//#endregion
|
|
4629
|
+
//#region src/file/drawingml/group-shape-properties.ts
|
|
4630
|
+
init_xml_components();
|
|
4631
|
+
/**
|
|
4632
|
+
* p:grpSpPr — Group shape properties with CT_GroupTransform2D.
|
|
4633
|
+
*/
|
|
4634
|
+
var GroupShapeProperties = class extends XmlComponent {
|
|
4635
|
+
constructor(options) {
|
|
4636
|
+
super("p:grpSpPr");
|
|
4637
|
+
this.root.push(new GroupTransform2D(options ?? {}));
|
|
4638
|
+
}
|
|
4639
|
+
};
|
|
4640
|
+
//#endregion
|
|
4547
4641
|
//#region src/file/shape-tree/shape-tree.ts
|
|
4548
4642
|
init_xml_components();
|
|
4549
4643
|
/**
|
|
@@ -4584,6 +4678,35 @@ const NOTES_MASTER_XML = `<p:notesMaster xmlns:a="http://schemas.openxmlformats.
|
|
|
4584
4678
|
</p:spTree>
|
|
4585
4679
|
</p:cSld>
|
|
4586
4680
|
<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
|
|
4681
|
+
<p:notesStyle>
|
|
4682
|
+
<a:lvl1pPr marL="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4683
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4684
|
+
</a:lvl1pPr>
|
|
4685
|
+
<a:lvl2pPr marL="457200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4686
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4687
|
+
</a:lvl2pPr>
|
|
4688
|
+
<a:lvl3pPr marL="914400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4689
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4690
|
+
</a:lvl3pPr>
|
|
4691
|
+
<a:lvl4pPr marL="1371600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4692
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4693
|
+
</a:lvl4pPr>
|
|
4694
|
+
<a:lvl5pPr marL="1828800" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4695
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4696
|
+
</a:lvl5pPr>
|
|
4697
|
+
<a:lvl6pPr marL="2286000" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4698
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4699
|
+
</a:lvl6pPr>
|
|
4700
|
+
<a:lvl7pPr marL="2743200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4701
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4702
|
+
</a:lvl7pPr>
|
|
4703
|
+
<a:lvl8pPr marL="3200400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4704
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4705
|
+
</a:lvl8pPr>
|
|
4706
|
+
<a:lvl9pPr marL="3657600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
|
|
4707
|
+
<a:defRPr sz="1200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
4708
|
+
</a:lvl9pPr>
|
|
4709
|
+
</p:notesStyle>
|
|
4587
4710
|
</p:notesMaster>`;
|
|
4588
4711
|
var DefaultNotesMaster = class DefaultNotesMaster extends ImportedXmlComponent {
|
|
4589
4712
|
static instance = ImportedXmlComponent.fromXmlString(NOTES_MASTER_XML);
|
|
@@ -4646,25 +4769,19 @@ init_background();
|
|
|
4646
4769
|
//#region src/export/packer/hyperlink-placeholders.ts
|
|
4647
4770
|
function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
|
|
4648
4771
|
let result = xml;
|
|
4649
|
-
hyperlinks.
|
|
4650
|
-
result = result.replaceAll(`{hlink:${h.key}}`, formatId(offset, i, "rId"));
|
|
4651
|
-
});
|
|
4772
|
+
for (let i = 0; i < hyperlinks.length; i++) result = result.replaceAll(`{hlink:${hyperlinks[i].key}}`, formatId(offset, i, "rId"));
|
|
4652
4773
|
return result;
|
|
4653
4774
|
}
|
|
4654
4775
|
//#endregion
|
|
4655
4776
|
//#region src/export/packer/media-placeholders.ts
|
|
4656
4777
|
function replaceMediaPlaceholders(xml, mediaData, offset) {
|
|
4657
4778
|
let result = xml;
|
|
4658
|
-
mediaData.
|
|
4659
|
-
result = result.replaceAll(`{media:${m.fileName}}`, formatId(offset, i, "rId"));
|
|
4660
|
-
});
|
|
4779
|
+
for (let i = 0; i < mediaData.length; i++) result = result.replaceAll(`{media:${mediaData[i].fileName}}`, formatId(offset, i, "rId"));
|
|
4661
4780
|
return result;
|
|
4662
4781
|
}
|
|
4663
4782
|
function replaceVideoPlaceholders(xml, mediaData, offset) {
|
|
4664
4783
|
let result = xml;
|
|
4665
|
-
mediaData.
|
|
4666
|
-
result = result.replaceAll(`{video:${m.fileName}}`, formatId(offset, i, "rId"));
|
|
4667
|
-
});
|
|
4784
|
+
for (let i = 0; i < mediaData.length; i++) result = result.replaceAll(`{video:${mediaData[i].fileName}}`, formatId(offset, i, "rId"));
|
|
4668
4785
|
return result;
|
|
4669
4786
|
}
|
|
4670
4787
|
function getMediaRefs(xml, mediaArray) {
|
|
@@ -4691,7 +4808,7 @@ function collectRefs(xml, search, mediaArray) {
|
|
|
4691
4808
|
const encoder$1 = new TextEncoder();
|
|
4692
4809
|
var Compiler = class {
|
|
4693
4810
|
formatter = new Formatter$1();
|
|
4694
|
-
compile(file, overrides = []) {
|
|
4811
|
+
compile(file, overrides = [], mediaLevel = 0) {
|
|
4695
4812
|
const context = {
|
|
4696
4813
|
fileData: file,
|
|
4697
4814
|
stack: []
|
|
@@ -4757,13 +4874,24 @@ var Compiler = class {
|
|
|
4757
4874
|
file.contentTypes.addTheme(mi + 1);
|
|
4758
4875
|
}
|
|
4759
4876
|
if (file.notesSlides.length > 0) {
|
|
4760
|
-
file.presentationWrapper.relationships.
|
|
4877
|
+
const notesMasterRId = file.presentationWrapper.relationships.relationshipCount + 1;
|
|
4878
|
+
file.presentationWrapper.relationships.addRelationship(notesMasterRId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster", "notesMasters/notesMaster1.xml");
|
|
4879
|
+
file.presentationWrapper.view.setNotesMasterRId(notesMasterRId);
|
|
4880
|
+
const notesMasterThemeIndex = themes.length + 1;
|
|
4761
4881
|
mapping["NotesMaster"] = {
|
|
4762
4882
|
data: this.formatter.formatToXml(new DefaultNotesMaster(), context),
|
|
4763
4883
|
path: "ppt/notesMasters/notesMaster1.xml"
|
|
4764
4884
|
};
|
|
4885
|
+
const notesMasterTheme = new DefaultTheme();
|
|
4886
|
+
mapping["NotesMasterTheme"] = {
|
|
4887
|
+
data: this.formatter.formatToXml(notesMasterTheme, context),
|
|
4888
|
+
path: `ppt/theme/theme${notesMasterThemeIndex}.xml`
|
|
4889
|
+
};
|
|
4890
|
+
file.contentTypes.addTheme(notesMasterThemeIndex);
|
|
4891
|
+
const notesMasterRels = new Relationships();
|
|
4892
|
+
notesMasterRels.addRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", `../theme/theme${notesMasterThemeIndex}.xml`);
|
|
4765
4893
|
mapping["NotesMasterRelationships"] = {
|
|
4766
|
-
data: this.formatter.formatToXml(
|
|
4894
|
+
data: this.formatter.formatToXml(notesMasterRels, context),
|
|
4767
4895
|
path: "ppt/notesMasters/_rels/notesMaster1.xml.rels"
|
|
4768
4896
|
};
|
|
4769
4897
|
}
|
|
@@ -4878,22 +5006,25 @@ var Compiler = class {
|
|
|
4878
5006
|
files[`ppt/diagrams/colors${i + 1}.xml`] = encoder$1.encode(getColorXml(smartArtData.color));
|
|
4879
5007
|
files[`ppt/diagrams/drawing${i + 1}.xml`] = encoder$1.encode(DEFAULT_DRAWING_XML);
|
|
4880
5008
|
}
|
|
5009
|
+
const notesSlideToSlide = /* @__PURE__ */ new Map();
|
|
5010
|
+
for (const [slideIdx, notesIdx] of file.notesSlideIndexMap) notesSlideToSlide.set(notesIdx, slideIdx);
|
|
4881
5011
|
for (let i = 0; i < file.notesSlides.length; i++) {
|
|
4882
5012
|
const notesSlide = file.notesSlides[i];
|
|
4883
5013
|
files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(notesSlide, context));
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
5014
|
+
const slideIdx = notesSlideToSlide.get(i) ?? 0;
|
|
5015
|
+
const nsRels = new Relationships();
|
|
5016
|
+
nsRels.addRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster", "../notesMasters/notesMaster1.xml");
|
|
5017
|
+
nsRels.addRelationship(2, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", `../slides/slide${slideIdx + 1}.xml`);
|
|
5018
|
+
files[`ppt/notesSlides/_rels/notesSlide${i + 1}.xml.rels`] = encoder$1.encode(this.formatter.formatToXml(nsRels, context));
|
|
4888
5019
|
}
|
|
4889
5020
|
if (file.commentAuthorList) files["ppt/commentAuthors.xml"] = encoder$1.encode(this.formatter.formatToXml(file.commentAuthorList, context));
|
|
4890
5021
|
const commentLists = file.slideCommentLists;
|
|
4891
5022
|
for (let i = 0; i < commentLists.length; i++) if (commentLists[i]) files[`ppt/comments/comment${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(commentLists[i], context));
|
|
4892
5023
|
for (const image of file.media.array) {
|
|
4893
|
-
files[`ppt/media/${image.fileName}`] = [image.data, { level:
|
|
5024
|
+
files[`ppt/media/${image.fileName}`] = [image.data, { level: mediaLevel }];
|
|
4894
5025
|
if (image.type === "svg" && "fallback" in image) {
|
|
4895
5026
|
const fallback = image.fallback;
|
|
4896
|
-
files[`ppt/media/${fallback.fileName}`] = [fallback.data, { level:
|
|
5027
|
+
files[`ppt/media/${fallback.fileName}`] = [fallback.data, { level: mediaLevel }];
|
|
4897
5028
|
}
|
|
4898
5029
|
}
|
|
4899
5030
|
return files;
|
|
@@ -4903,7 +5034,7 @@ var Compiler = class {
|
|
|
4903
5034
|
//#region src/export/packer/packer.ts
|
|
4904
5035
|
const compiler = new Compiler();
|
|
4905
5036
|
const Packer = createPacker({
|
|
4906
|
-
compile: (file, overrides) => compiler.compile(file, overrides),
|
|
5037
|
+
compile: (file, overrides, mediaLevel) => compiler.compile(file, overrides, mediaLevel),
|
|
4907
5038
|
mimeType: OoxmlMimeType.PPTX
|
|
4908
5039
|
});
|
|
4909
5040
|
//#endregion
|
|
@@ -4948,6 +5079,8 @@ var util_exports = /* @__PURE__ */ __exportAll({
|
|
|
4948
5079
|
//#endregion
|
|
4949
5080
|
//#region src/parse/context.ts
|
|
4950
5081
|
var ParseContext = class {
|
|
5082
|
+
pptx;
|
|
5083
|
+
slideRels;
|
|
4951
5084
|
constructor(pptx, slideRels) {
|
|
4952
5085
|
this.pptx = pptx;
|
|
4953
5086
|
this.slideRels = slideRels;
|
|
@@ -6699,6 +6832,10 @@ function parseRootRels(doc) {
|
|
|
6699
6832
|
};
|
|
6700
6833
|
}
|
|
6701
6834
|
function parseSlideRels(doc, slidePaths, refs) {
|
|
6835
|
+
const commentsSet = new Set(refs.comments);
|
|
6836
|
+
const chartsSet = new Set(refs.charts);
|
|
6837
|
+
const diagramDataSet = new Set(refs.diagramData);
|
|
6838
|
+
const mediaSet = new Set(refs.media);
|
|
6702
6839
|
for (const slidePath of slidePaths) {
|
|
6703
6840
|
const parts = slidePath.split("/");
|
|
6704
6841
|
const fileName = parts.pop();
|
|
@@ -6711,17 +6848,16 @@ function parseSlideRels(doc, slidePaths, refs) {
|
|
|
6711
6848
|
const target = attr(child, "Target") ?? "";
|
|
6712
6849
|
if (!target) continue;
|
|
6713
6850
|
const path = resolveRelsPath(target);
|
|
6714
|
-
if (type.includes("/comments") && !type.includes("commentAuthors"))
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
} else if (type.includes("/diagramData")) {
|
|
6719
|
-
if (!refs.diagramData.includes(path)) refs.diagramData.push(path);
|
|
6720
|
-
} else if (type.includes("/image") || type.includes("/video") || type.includes("/media")) {
|
|
6721
|
-
if (!refs.media.includes(path)) refs.media.push(path);
|
|
6722
|
-
}
|
|
6851
|
+
if (type.includes("/comments") && !type.includes("commentAuthors")) commentsSet.add(path);
|
|
6852
|
+
else if (type.includes("/chart")) chartsSet.add(path);
|
|
6853
|
+
else if (type.includes("/diagramData")) diagramDataSet.add(path);
|
|
6854
|
+
else if (type.includes("/image") || type.includes("/video") || type.includes("/media")) mediaSet.add(path);
|
|
6723
6855
|
}
|
|
6724
6856
|
}
|
|
6857
|
+
refs.comments = [...commentsSet];
|
|
6858
|
+
refs.charts = [...chartsSet];
|
|
6859
|
+
refs.diagramData = [...diagramDataSet];
|
|
6860
|
+
refs.media = [...mediaSet];
|
|
6725
6861
|
}
|
|
6726
6862
|
function parsePptx(data) {
|
|
6727
6863
|
const doc = parseArchive(toUint8Array(data));
|
|
@@ -7139,7 +7275,6 @@ __reExport(/* @__PURE__ */ __exportAll({
|
|
|
7139
7275
|
TableProperties: () => TableProperties,
|
|
7140
7276
|
TableRow: () => TableRow,
|
|
7141
7277
|
Text: () => Text,
|
|
7142
|
-
TextAlignment: () => TextAlignment,
|
|
7143
7278
|
TextBody: () => TextBody,
|
|
7144
7279
|
TextCapitalization: () => TextCapitalization,
|
|
7145
7280
|
TextRun: () => TextRun,
|
|
@@ -7147,7 +7282,6 @@ __reExport(/* @__PURE__ */ __exportAll({
|
|
|
7147
7282
|
Transform2D: () => Transform2D,
|
|
7148
7283
|
Transition: () => Transition,
|
|
7149
7284
|
UnderlineStyle: () => UnderlineStyle,
|
|
7150
|
-
VerticalAlignment: () => VerticalAlignment,
|
|
7151
7285
|
VideoFrame: () => VideoFrame,
|
|
7152
7286
|
buildFill: () => buildFill,
|
|
7153
7287
|
coerceChild: () => coerceChild,
|
|
@@ -7182,6 +7316,6 @@ __reExport(/* @__PURE__ */ __exportAll({
|
|
|
7182
7316
|
uniqueUuid: () => uniqueUuid
|
|
7183
7317
|
}), util_exports);
|
|
7184
7318
|
//#endregion
|
|
7185
|
-
export { AppProperties, AudioFrame, Background, BevelPresetType, BlipFill, Chart, ChartCollection, ChartSpace, CompoundLine, ConnectorShape, ContentTypes, CoreProperties, DateTimeField, DefaultNotesMaster, DefaultSlideLayout, DefaultSlideMaster, DefaultTheme, DrawingTable, EndParagraphRunProperties, Field, File, File as Presentation, GroupShape, GroupShapeProperties, GroupTransform2D, HeaderFooter, LineCap, LineJoin, LineShape, Media, NonVisualDrawingProperties, NonVisualPictureProperties, NonVisualShapeProperties, NotesSlide, Packer, Paragraph, ParagraphProperties, PatchType, PathShadeType, PenAlignment, Picture, PresentationWrapper, PresetDash, PresetGeometry, PresetMaterialType, ReflectionAlignment, Relationships, RunProperties, Shape, ShapeProperties, ShapeTree, Slide, SlideLayout, SlideNumberField, SlideSizePreset, SmartArt, StrikeStyle, Table, TableCell, TableCellProperties, TableProperties, TableRow, Text,
|
|
7319
|
+
export { AppProperties, AudioFrame, Background, BevelPresetType, BlipFill, Chart, ChartCollection, ChartSpace, CompoundLine, ConnectorShape, ContentTypes, CoreProperties, DateTimeField, DefaultNotesMaster, DefaultSlideLayout, DefaultSlideMaster, DefaultTheme, DrawingTable, EndParagraphRunProperties, Field, File, File as Presentation, GroupShape, GroupShapeProperties, GroupTransform2D, HeaderFooter, LineCap, LineJoin, LineShape, Media, NonVisualDrawingProperties, NonVisualPictureProperties, NonVisualShapeProperties, NotesSlide, Packer, Paragraph, ParagraphProperties, PatchType, PathShadeType, PenAlignment, Picture, PresentationWrapper, PresetDash, PresetGeometry, PresetMaterialType, ReflectionAlignment, Relationships, RunProperties, Shape, ShapeProperties, ShapeTree, Slide, SlideLayout, SlideNumberField, SlideSizePreset, SmartArt, StrikeStyle, Table, TableCell, TableCellProperties, TableProperties, TableRow, Text, TextBody, TextCapitalization, TextRun, TileFlipMode, Transform2D, Transition, UnderlineStyle, VideoFrame, buildFill, coerceChild, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPointsToEmu, createBevel, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createGradientFill, createGradientStop, createOutline, createOutlineCompat, createPptxEffectList, createScene3D, createShape3D, createTransformation, extractBlipFillMedia, hashedId, parseArchive, parsePptx, parsePresentation, patchPresentation, percentToTHousandths, uniqueId, uniqueNumericIdCreator, uniqueUuid };
|
|
7186
7320
|
|
|
7187
7321
|
//# sourceMappingURL=index.mjs.map
|