pptx-kit 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/README.md +70 -34
- package/dist/index.d.ts +88 -6
- package/dist/index.js +336 -73
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +336 -73
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -850,6 +850,50 @@ var detectImageFormat = (bytes) => {
|
|
|
850
850
|
if (/<svg[\s>]/.test(head)) return "svg";
|
|
851
851
|
return null;
|
|
852
852
|
};
|
|
853
|
+
var readUint16Be = (bytes, at) => bytes[at] << 8 | bytes[at + 1];
|
|
854
|
+
var readUint32Be = (bytes, at) => (
|
|
855
|
+
// `>>> 0` keeps the result an unsigned 32-bit int (a 4-byte PNG dimension
|
|
856
|
+
// with the high bit set would otherwise read as negative).
|
|
857
|
+
(bytes[at] << 24 | bytes[at + 1] << 16 | bytes[at + 2] << 8 | bytes[at + 3]) >>> 0
|
|
858
|
+
);
|
|
859
|
+
var pngSize = (bytes) => {
|
|
860
|
+
if (bytes.length < 24) return null;
|
|
861
|
+
const width = readUint32Be(bytes, 16);
|
|
862
|
+
const height = readUint32Be(bytes, 20);
|
|
863
|
+
if (width <= 0 || height <= 0) return null;
|
|
864
|
+
return { width, height };
|
|
865
|
+
};
|
|
866
|
+
var JPEG_SOF_EXCLUDED = /* @__PURE__ */ new Set([196, 200, 204]);
|
|
867
|
+
var jpegSize = (bytes) => {
|
|
868
|
+
let offset = 2;
|
|
869
|
+
while (offset + 9 < bytes.length) {
|
|
870
|
+
if (bytes[offset] !== 255) {
|
|
871
|
+
offset++;
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
const marker = bytes[offset + 1];
|
|
875
|
+
if (marker === 255 || marker >= 208 && marker <= 217 || marker === 1) {
|
|
876
|
+
offset += 2;
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
const segmentLength = readUint16Be(bytes, offset + 2);
|
|
880
|
+
if (segmentLength < 2) return null;
|
|
881
|
+
if (marker >= 192 && marker <= 207 && !JPEG_SOF_EXCLUDED.has(marker)) {
|
|
882
|
+
const height = readUint16Be(bytes, offset + 5);
|
|
883
|
+
const width = readUint16Be(bytes, offset + 7);
|
|
884
|
+
if (width <= 0 || height <= 0) return null;
|
|
885
|
+
return { width, height };
|
|
886
|
+
}
|
|
887
|
+
offset += 2 + segmentLength;
|
|
888
|
+
}
|
|
889
|
+
return null;
|
|
890
|
+
};
|
|
891
|
+
var readImagePixelSize = (bytes) => {
|
|
892
|
+
const format = detectImageFormat(bytes);
|
|
893
|
+
if (format === "png") return pngSize(bytes);
|
|
894
|
+
if (format === "jpeg") return jpegSize(bytes);
|
|
895
|
+
return null;
|
|
896
|
+
};
|
|
853
897
|
var extensionForFormat = (format) => {
|
|
854
898
|
switch (format) {
|
|
855
899
|
case "jpeg":
|
|
@@ -1068,6 +1112,67 @@ var OpcPackage = class _OpcPackage {
|
|
|
1068
1112
|
}
|
|
1069
1113
|
};
|
|
1070
1114
|
|
|
1115
|
+
// src/internal/parts/blank-deck.ts
|
|
1116
|
+
var SLIDE_SIZE = {
|
|
1117
|
+
"16:9": { cx: 12192e3, cy: 6858e3, type: "screen16x9" },
|
|
1118
|
+
"4:3": { cx: 9144e3, cy: 6858e3, type: "screen4x3" }
|
|
1119
|
+
};
|
|
1120
|
+
var RELS_CONTENT_TYPE = "application/vnd.openxmlformats-package.relationships+xml";
|
|
1121
|
+
var PRESENTATION_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
|
1122
|
+
var PRES_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml";
|
|
1123
|
+
var VIEW_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml";
|
|
1124
|
+
var SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
1125
|
+
var SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
1126
|
+
var THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
1127
|
+
var CORE_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-package.core-properties+xml";
|
|
1128
|
+
var EXTENDED_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.extended-properties+xml";
|
|
1129
|
+
var XML_DECL = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';
|
|
1130
|
+
var RT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
1131
|
+
var RT_PACKAGE = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
1132
|
+
var THEME_XML = `${XML_DECL}<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="1F497D"/></a:dk2><a:lt2><a:srgbClr val="EEECE1"/></a:lt2><a:accent1><a:srgbClr val="4F81BD"/></a:accent1><a:accent2><a:srgbClr val="C0504D"/></a:accent2><a:accent3><a:srgbClr val="9BBB59"/></a:accent3><a:accent4><a:srgbClr val="8064A2"/></a:accent4><a:accent5><a:srgbClr val="4BACC6"/></a:accent5><a:accent6><a:srgbClr val="F79646"/></a:accent6><a:hlink><a:srgbClr val="0000FF"/></a:hlink><a:folHlink><a:srgbClr val="800080"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="1"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst><a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d><a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>`;
|
|
1133
|
+
var SLIDE_MASTER_XML = `${XML_DECL}<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="274638"/><a:ext cx="8229600" cy="1143000"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Text Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="1600200"/><a:ext cx="8229600" cy="4525963"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master text styles</a:t></a:r></a:p></p:txBody></p:sp></p:spTree></p:cSld><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"/><p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/><p:sldLayoutId id="2147483650" r:id="rId2"/><p:sldLayoutId id="2147483651" r:id="rId3"/></p:sldLayoutIdLst><p:txStyles><p:titleStyle><a:lvl1pPr algn="ctr" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="0"/></a:spcBef><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/><a:ea typeface="+mj-ea"/><a:cs typeface="+mj-cs"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle><a:lvl1pPr marL="342900" indent="-342900" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="\u2022"/><a:defRPr sz="3200" 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></a:lvl1pPr><a:lvl2pPr marL="742950" indent="-285750" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="\u2013"/><a:defRPr sz="2800" 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></a:lvl2pPr><a:lvl3pPr marL="1143000" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="\u2022"/><a:defRPr sz="2400" 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></a:lvl3pPr><a:lvl4pPr marL="1600200" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="\u2013"/><a:defRPr sz="2000" 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></a:lvl4pPr><a:lvl5pPr marL="2057400" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="\xBB"/><a:defRPr sz="2000" 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></a:lvl5pPr></p:bodyStyle><p:otherStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr><a:lvl1pPr marL="0" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" 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></a:lvl1pPr></p:otherStyle></p:txStyles></p:sldMaster>`;
|
|
1134
|
+
var LAYOUT_BLANK_XML = `${XML_DECL}<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="blank" preserve="1"><p:cSld name="Blank"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`;
|
|
1135
|
+
var LAYOUT_TITLE_XML = `${XML_DECL}<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="title" preserve="1"><p:cSld name="Title Slide"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ctrTitle"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="685800" y="2130425"/><a:ext cx="7772400" cy="1470025"/></a:xfrm></p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Subtitle 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="subTitle" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="1371600" y="3886200"/><a:ext cx="6400800" cy="1752600"/></a:xfrm></p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master subtitle style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`;
|
|
1136
|
+
var LAYOUT_OBJ_XML = `${XML_DECL}<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="obj" preserve="1"><p:cSld name="Title and Content"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Content Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master text styles</a:t></a:r></a:p></p:txBody></p:sp></p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`;
|
|
1137
|
+
var buildPresentationXml = (size) => `${XML_DECL}<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" saveSubsetFonts="1"><p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst><p:sldSz cx="${size.cx}" cy="${size.cy}" type="${size.type}"/><p:notesSz cx="6858000" cy="9144000"/></p:presentation>`;
|
|
1138
|
+
var PRES_PROPS_XML = `${XML_DECL}<p:presentationPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"/>`;
|
|
1139
|
+
var VIEW_PROPS_XML = `${XML_DECL}<p:viewPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"/>`;
|
|
1140
|
+
var CORE_PROPS_XML = `${XML_DECL}<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title></dc:title><dc:creator>pptx-kit</dc:creator><cp:lastModifiedBy>pptx-kit</cp:lastModifiedBy></cp:coreProperties>`;
|
|
1141
|
+
var EXTENDED_PROPS_XML = `${XML_DECL}<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>pptx-kit</Application></Properties>`;
|
|
1142
|
+
var ROOT_RELS_XML = `${XML_DECL}<Relationships xmlns="${RT_PACKAGE}"><Relationship Id="rId1" Type="${RT}/officeDocument" Target="ppt/presentation.xml"/><Relationship Id="rId2" Type="${RT_PACKAGE}/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="${RT}/extended-properties" Target="docProps/app.xml"/></Relationships>`;
|
|
1143
|
+
var PRES_RELS_XML = `${XML_DECL}<Relationships xmlns="${RT_PACKAGE}"><Relationship Id="rId1" Type="${RT}/slideMaster" Target="slideMasters/slideMaster1.xml"/><Relationship Id="rId2" Type="${RT}/theme" Target="theme/theme1.xml"/><Relationship Id="rId3" Type="${RT}/presProps" Target="presProps.xml"/><Relationship Id="rId4" Type="${RT}/viewProps" Target="viewProps.xml"/></Relationships>`;
|
|
1144
|
+
var MASTER_RELS_XML = `${XML_DECL}<Relationships xmlns="${RT_PACKAGE}"><Relationship Id="rId1" Type="${RT}/slideLayout" Target="../slideLayouts/slideLayout1.xml"/><Relationship Id="rId2" Type="${RT}/slideLayout" Target="../slideLayouts/slideLayout2.xml"/><Relationship Id="rId3" Type="${RT}/slideLayout" Target="../slideLayouts/slideLayout3.xml"/><Relationship Id="rId4" Type="${RT}/theme" Target="../theme/theme1.xml"/></Relationships>`;
|
|
1145
|
+
var LAYOUT_RELS_XML = `${XML_DECL}<Relationships xmlns="${RT_PACKAGE}"><Relationship Id="rId1" Type="${RT}/slideMaster" Target="../slideMasters/slideMaster1.xml"/></Relationships>`;
|
|
1146
|
+
var TEXT_ENCODER2 = new TextEncoder();
|
|
1147
|
+
var encode2 = (s) => TEXT_ENCODER2.encode(s);
|
|
1148
|
+
var buildBlankDeck = (aspect) => {
|
|
1149
|
+
const pkg = OpcPackage.empty();
|
|
1150
|
+
const size = SLIDE_SIZE[aspect];
|
|
1151
|
+
const add = (name, contentType, xml) => {
|
|
1152
|
+
pkg.addPart(partName(name), contentType, encode2(xml));
|
|
1153
|
+
};
|
|
1154
|
+
const addRels = (name, xml) => {
|
|
1155
|
+
pkg.addPart(partName(name), RELS_CONTENT_TYPE, encode2(xml));
|
|
1156
|
+
};
|
|
1157
|
+
add("/ppt/presentation.xml", PRESENTATION_CONTENT_TYPE, buildPresentationXml(size));
|
|
1158
|
+
add("/ppt/presProps.xml", PRES_PROPS_CONTENT_TYPE, PRES_PROPS_XML);
|
|
1159
|
+
add("/ppt/viewProps.xml", VIEW_PROPS_CONTENT_TYPE, VIEW_PROPS_XML);
|
|
1160
|
+
add("/ppt/theme/theme1.xml", THEME_CONTENT_TYPE, THEME_XML);
|
|
1161
|
+
add("/ppt/slideMasters/slideMaster1.xml", SLIDE_MASTER_CONTENT_TYPE, SLIDE_MASTER_XML);
|
|
1162
|
+
add("/ppt/slideLayouts/slideLayout1.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_BLANK_XML);
|
|
1163
|
+
add("/ppt/slideLayouts/slideLayout2.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_TITLE_XML);
|
|
1164
|
+
add("/ppt/slideLayouts/slideLayout3.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_OBJ_XML);
|
|
1165
|
+
add("/docProps/core.xml", CORE_PROPS_CONTENT_TYPE, CORE_PROPS_XML);
|
|
1166
|
+
add("/docProps/app.xml", EXTENDED_PROPS_CONTENT_TYPE, EXTENDED_PROPS_XML);
|
|
1167
|
+
addRels("/_rels/.rels", ROOT_RELS_XML);
|
|
1168
|
+
addRels("/ppt/_rels/presentation.xml.rels", PRES_RELS_XML);
|
|
1169
|
+
addRels("/ppt/slideMasters/_rels/slideMaster1.xml.rels", MASTER_RELS_XML);
|
|
1170
|
+
addRels("/ppt/slideLayouts/_rels/slideLayout1.xml.rels", LAYOUT_RELS_XML);
|
|
1171
|
+
addRels("/ppt/slideLayouts/_rels/slideLayout2.xml.rels", LAYOUT_RELS_XML);
|
|
1172
|
+
addRels("/ppt/slideLayouts/_rels/slideLayout3.xml.rels", LAYOUT_RELS_XML);
|
|
1173
|
+
return pkg;
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1071
1176
|
// src/api/_internal-symbols.ts
|
|
1072
1177
|
var INTERNAL_PACKAGE = /* @__PURE__ */ Symbol.for("pptx-kit.package");
|
|
1073
1178
|
var SLIDE_PART_NAME = /* @__PURE__ */ Symbol.for("pptx-kit.slide.partName");
|
|
@@ -1100,8 +1205,9 @@ var loadPresentation = async (input) => {
|
|
|
1100
1205
|
const pkg = OpcPackage.load(bytes);
|
|
1101
1206
|
return { [INTERNAL_PACKAGE]: pkg, _slidesCache: null };
|
|
1102
1207
|
};
|
|
1103
|
-
var createPresentation = () => {
|
|
1104
|
-
const
|
|
1208
|
+
var createPresentation = (options = {}) => {
|
|
1209
|
+
const aspect = options.size ?? "16:9";
|
|
1210
|
+
const pkg = buildBlankDeck(aspect);
|
|
1105
1211
|
return { [INTERNAL_PACKAGE]: pkg, _slidesCache: null };
|
|
1106
1212
|
};
|
|
1107
1213
|
var savePresentation = (pres) => {
|
|
@@ -1595,6 +1701,10 @@ var parseColor2 = (value) => {
|
|
|
1595
1701
|
if (/^[0-9A-Fa-f]{6}$/.test(hex)) return { kind: "srgb", hex: hex.toUpperCase() };
|
|
1596
1702
|
return null;
|
|
1597
1703
|
};
|
|
1704
|
+
var parseSrgbHex = (value) => {
|
|
1705
|
+
const hex = value.startsWith("#") ? value.slice(1) : value;
|
|
1706
|
+
return /^[0-9A-Fa-f]{6}$/.test(hex) ? hex.toUpperCase() : null;
|
|
1707
|
+
};
|
|
1598
1708
|
var buildColorElement = (value) => {
|
|
1599
1709
|
const parsed = parseColor2(value);
|
|
1600
1710
|
if (parsed === null) throw new Error(`unrecognized color: ${value}`);
|
|
@@ -2878,26 +2988,28 @@ var equalShares = (total, n) => {
|
|
|
2878
2988
|
};
|
|
2879
2989
|
var buildTable = (opts) => {
|
|
2880
2990
|
const rows = opts.rows;
|
|
2881
|
-
if (rows.length === 0) throw new Error("
|
|
2991
|
+
if (rows.length === 0) throw new Error("addSlideTable: at least one row is required");
|
|
2882
2992
|
const colCount = rows[0]?.length ?? 0;
|
|
2883
|
-
if (colCount === 0) throw new Error("
|
|
2993
|
+
if (colCount === 0) throw new Error("addSlideTable: at least one column is required");
|
|
2884
2994
|
for (let i = 0; i < rows.length; i++) {
|
|
2885
2995
|
const r2 = rows[i];
|
|
2886
|
-
if (!r2) throw new Error(`
|
|
2996
|
+
if (!r2) throw new Error(`addSlideTable: row ${i} is missing`);
|
|
2887
2997
|
if (r2.length !== colCount) {
|
|
2888
2998
|
throw new Error(
|
|
2889
|
-
`
|
|
2999
|
+
`addSlideTable: row ${i} has ${r2.length} cells; expected ${colCount} to match row 0`
|
|
2890
3000
|
);
|
|
2891
3001
|
}
|
|
2892
3002
|
}
|
|
2893
3003
|
const colWidths = opts.colWidths ?? equalShares(opts.w, colCount);
|
|
2894
3004
|
if (colWidths.length !== colCount) {
|
|
2895
|
-
throw new Error(
|
|
3005
|
+
throw new Error(
|
|
3006
|
+
`addSlideTable: colWidths has ${colWidths.length} entries; expected ${colCount}`
|
|
3007
|
+
);
|
|
2896
3008
|
}
|
|
2897
3009
|
const rowHeights = opts.rowHeights ?? equalShares(opts.h, rows.length);
|
|
2898
3010
|
if (rowHeights.length !== rows.length) {
|
|
2899
3011
|
throw new Error(
|
|
2900
|
-
`
|
|
3012
|
+
`addSlideTable: rowHeights has ${rowHeights.length} entries; expected ${rows.length}`
|
|
2901
3013
|
);
|
|
2902
3014
|
}
|
|
2903
3015
|
const name = opts.name ?? `Table ${opts.id}`;
|
|
@@ -3422,10 +3534,10 @@ var buildCommentListDoc = (comments) => {
|
|
|
3422
3534
|
|
|
3423
3535
|
// src/api/fn/_helpers.ts
|
|
3424
3536
|
var TEXT_DECODER2 = new TextDecoder();
|
|
3425
|
-
var
|
|
3537
|
+
var TEXT_ENCODER3 = new TextEncoder();
|
|
3426
3538
|
var decode2 = (b) => TEXT_DECODER2.decode(b);
|
|
3427
|
-
var
|
|
3428
|
-
var
|
|
3539
|
+
var encode3 = (s) => TEXT_ENCODER3.encode(s);
|
|
3540
|
+
var SLIDE_LAYOUT_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
3429
3541
|
var SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
|
3430
3542
|
var PRES_PART_NAME = partName("/ppt/presentation.xml");
|
|
3431
3543
|
var NAME_PRESENTATION2 = qname("p", "presentation", NS.pml);
|
|
@@ -3442,7 +3554,7 @@ var commitSlideData = (slide) => {
|
|
|
3442
3554
|
const xml = serializeXml(slide[SLIDE_DOCUMENT]);
|
|
3443
3555
|
const part = slide[INTERNAL_PACKAGE].getPart(slide[SLIDE_PART_NAME]);
|
|
3444
3556
|
if (!part) throw new Error(`slide part missing: ${slide[SLIDE_PART_NAME]}`);
|
|
3445
|
-
part.data =
|
|
3557
|
+
part.data = encode3(xml);
|
|
3446
3558
|
};
|
|
3447
3559
|
var refreshSlideData = (slide) => {
|
|
3448
3560
|
const fresh = readSlidePart(slide[SLIDE_DOCUMENT].root);
|
|
@@ -3530,7 +3642,7 @@ var setOpcDefault = (pkg, extension, contentType) => {
|
|
|
3530
3642
|
};
|
|
3531
3643
|
|
|
3532
3644
|
// src/api/fn/theme.ts
|
|
3533
|
-
var
|
|
3645
|
+
var THEME_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
3534
3646
|
var NAME_THEME_ELEMENTS = qname("a", "themeElements", NS.dml);
|
|
3535
3647
|
var NAME_CLR_SCHEME = qname("a", "clrScheme", NS.dml);
|
|
3536
3648
|
var NAME_SRGB_CLR3 = qname("a", "srgbClr", NS.dml);
|
|
@@ -3552,7 +3664,7 @@ var readSchemeSlot = (parent, local) => {
|
|
|
3552
3664
|
};
|
|
3553
3665
|
var getPresentationTheme = (pres) => {
|
|
3554
3666
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
3555
|
-
const themePart = pkg.parts.filter((p) => p.contentType ===
|
|
3667
|
+
const themePart = pkg.parts.filter((p) => p.contentType === THEME_CONTENT_TYPE2).sort((a2, b) => a2.name.localeCompare(b.name))[0];
|
|
3556
3668
|
if (!themePart) return null;
|
|
3557
3669
|
const root = parseXml(decode2(themePart.data)).root;
|
|
3558
3670
|
const themeElements = firstChildElement(root, NAME_THEME_ELEMENTS);
|
|
@@ -3585,7 +3697,7 @@ var readTypeface = (parent, local) => {
|
|
|
3585
3697
|
};
|
|
3586
3698
|
var getPresentationFonts = (pres) => {
|
|
3587
3699
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
3588
|
-
const themePart = pkg.parts.filter((p) => p.contentType ===
|
|
3700
|
+
const themePart = pkg.parts.filter((p) => p.contentType === THEME_CONTENT_TYPE2).sort((a2, b) => a2.name.localeCompare(b.name))[0];
|
|
3589
3701
|
if (!themePart) return null;
|
|
3590
3702
|
const root = parseXml(decode2(themePart.data)).root;
|
|
3591
3703
|
const themeElements = firstChildElement(root, NAME_THEME_ELEMENTS);
|
|
@@ -3627,7 +3739,7 @@ var loadAuthorList = (pkg) => {
|
|
|
3627
3739
|
};
|
|
3628
3740
|
var writeAuthorList = (pkg, authors) => {
|
|
3629
3741
|
const doc = buildCommentAuthorListDoc(authors);
|
|
3630
|
-
const bytes =
|
|
3742
|
+
const bytes = encode3(serializeXml(doc));
|
|
3631
3743
|
const existing = pkg.getPart(COMMENT_AUTHORS_PART_NAME);
|
|
3632
3744
|
if (existing !== null) {
|
|
3633
3745
|
existing.data = bytes;
|
|
@@ -3674,7 +3786,7 @@ var writeCommentsForSlide = (slide, comments) => {
|
|
|
3674
3786
|
return;
|
|
3675
3787
|
}
|
|
3676
3788
|
const doc = buildCommentListDoc(comments);
|
|
3677
|
-
const bytes =
|
|
3789
|
+
const bytes = encode3(serializeXml(doc));
|
|
3678
3790
|
const existing = pkg.getPart(commentsName);
|
|
3679
3791
|
if (existing !== null) {
|
|
3680
3792
|
existing.data = bytes;
|
|
@@ -3904,6 +4016,15 @@ var getCommentPosition = (comment2) => comment2[COMMENT_SNAPSHOT].position;
|
|
|
3904
4016
|
var getCommentSlide = (comment2) => comment2[COMMENT_SLIDE];
|
|
3905
4017
|
|
|
3906
4018
|
// src/api/fn/shape-image.ts
|
|
4019
|
+
var fitImageRect = (box, fit, naturalSize) => {
|
|
4020
|
+
if (fit === "fill" || naturalSize === null) return box;
|
|
4021
|
+
const scale = Math.min(box.w / naturalSize.width, box.h / naturalSize.height);
|
|
4022
|
+
const w = Math.round(naturalSize.width * scale);
|
|
4023
|
+
const h = Math.round(naturalSize.height * scale);
|
|
4024
|
+
const x = box.x + Math.round((box.w - w) / 2);
|
|
4025
|
+
const y = box.y + Math.round((box.h - h) / 2);
|
|
4026
|
+
return { x, y, w, h };
|
|
4027
|
+
};
|
|
3907
4028
|
var setShapeImage = (shape, bytes, options = {}) => {
|
|
3908
4029
|
if (shape[SHAPE_SNAPSHOT].kind !== "picture") {
|
|
3909
4030
|
throw new Error(
|
|
@@ -3936,27 +4057,43 @@ var setShapeImage = (shape, bytes, options = {}) => {
|
|
|
3936
4057
|
if (!part) throw new Error(`media part missing: ${mediaName}`);
|
|
3937
4058
|
part.data = bytes;
|
|
3938
4059
|
part.contentType = newContentType;
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
4060
|
+
} else {
|
|
4061
|
+
let nextN = 1;
|
|
4062
|
+
const mediaPathRegex = /^\/ppt\/media\/image(\d+)\./;
|
|
4063
|
+
for (const p of pkg.parts) {
|
|
4064
|
+
const m = p.name.match(mediaPathRegex);
|
|
4065
|
+
if (m?.[1] !== void 0) {
|
|
4066
|
+
const num = Number.parseInt(m[1], 10);
|
|
4067
|
+
if (Number.isFinite(num) && num >= nextN) nextN = num + 1;
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
const newPartName = partName(`/ppt/media/image${nextN}.${newExtension}`);
|
|
4071
|
+
const hasDefault = pkg.contentTypes.defaults.some(
|
|
4072
|
+
(d) => d.extension.toLowerCase() === newExtension
|
|
4073
|
+
);
|
|
4074
|
+
if (!hasDefault) {
|
|
4075
|
+
pkg.contentTypes.defaults.push({ extension: newExtension, contentType: newContentType });
|
|
4076
|
+
}
|
|
4077
|
+
pkg.addPart(newPartName, newContentType, bytes);
|
|
4078
|
+
rel.target = `../media/image${nextN}.${newExtension}`;
|
|
4079
|
+
pkg.setRels(slide[SLIDE_PART_NAME], rels);
|
|
4080
|
+
}
|
|
4081
|
+
if (options.fit === "contain") {
|
|
4082
|
+
const pos = readPosition(shape[SHAPE_ELEMENT], "picture");
|
|
4083
|
+
const size = readSize2(shape[SHAPE_ELEMENT], "picture");
|
|
4084
|
+
const natural = readImagePixelSize(bytes);
|
|
4085
|
+
if (pos !== null && size !== null && natural !== null) {
|
|
4086
|
+
const fitted = fitImageRect(
|
|
4087
|
+
{ x: pos.x, y: pos.y, w: size.w, h: size.h },
|
|
4088
|
+
"contain",
|
|
4089
|
+
natural
|
|
4090
|
+
);
|
|
4091
|
+
setPosition(shape[SHAPE_ELEMENT], "picture", fitted.x, fitted.y);
|
|
4092
|
+
setSize(shape[SHAPE_ELEMENT], "picture", fitted.w, fitted.h);
|
|
4093
|
+
commitSlideData(slide);
|
|
4094
|
+
refreshSlideData(slide);
|
|
3948
4095
|
}
|
|
3949
4096
|
}
|
|
3950
|
-
const newPartName = partName(`/ppt/media/image${nextN}.${newExtension}`);
|
|
3951
|
-
const hasDefault = pkg.contentTypes.defaults.some(
|
|
3952
|
-
(d) => d.extension.toLowerCase() === newExtension
|
|
3953
|
-
);
|
|
3954
|
-
if (!hasDefault) {
|
|
3955
|
-
pkg.contentTypes.defaults.push({ extension: newExtension, contentType: newContentType });
|
|
3956
|
-
}
|
|
3957
|
-
pkg.addPart(newPartName, newContentType, bytes);
|
|
3958
|
-
rel.target = `../media/image${nextN}.${newExtension}`;
|
|
3959
|
-
pkg.setRels(slide[SLIDE_PART_NAME], rels);
|
|
3960
4097
|
};
|
|
3961
4098
|
|
|
3962
4099
|
// src/api/fn/shape-click-action.ts
|
|
@@ -4598,6 +4735,11 @@ var rPrAttrsFromStyle = (style) => {
|
|
|
4598
4735
|
})
|
|
4599
4736
|
);
|
|
4600
4737
|
}
|
|
4738
|
+
if (style?.font !== void 0) {
|
|
4739
|
+
const typeface = attr(qname("", "typeface", ""), style.font);
|
|
4740
|
+
children.push(elem(a("latin"), { attrs: [typeface] }));
|
|
4741
|
+
children.push(elem(a("ea"), { attrs: [typeface] }));
|
|
4742
|
+
}
|
|
4601
4743
|
return { attrs, children };
|
|
4602
4744
|
};
|
|
4603
4745
|
var titleElement = (title, style, rotationDeg) => {
|
|
@@ -5080,7 +5222,10 @@ var NAME_A_RPR = qname("a", "rPr", NS_A2);
|
|
|
5080
5222
|
var NAME_A_DEF_RPR = qname("a", "defRPr", NS_A2);
|
|
5081
5223
|
var NAME_A_PPR = qname("a", "pPr", NS_A2);
|
|
5082
5224
|
var NAME_A_SRGB = qname("a", "srgbClr", NS_A2);
|
|
5225
|
+
var NAME_A_LATIN = qname("a", "latin", NS_A2);
|
|
5226
|
+
var ATTR_TYPEFACE2 = qname("", "typeface", "");
|
|
5083
5227
|
var readRunStyle = (rPr) => {
|
|
5228
|
+
let font;
|
|
5084
5229
|
let sizePt;
|
|
5085
5230
|
let bold;
|
|
5086
5231
|
let italic;
|
|
@@ -5102,10 +5247,16 @@ var readRunStyle = (rPr) => {
|
|
|
5102
5247
|
if (v !== null) color = `#${v.toUpperCase()}`;
|
|
5103
5248
|
}
|
|
5104
5249
|
}
|
|
5105
|
-
|
|
5250
|
+
const latin = firstChildElement(rPr, NAME_A_LATIN);
|
|
5251
|
+
if (latin) {
|
|
5252
|
+
const tf = getAttrValue(latin, ATTR_TYPEFACE2);
|
|
5253
|
+
if (tf !== null && tf !== "") font = tf;
|
|
5254
|
+
}
|
|
5255
|
+
if (font === void 0 && sizePt === void 0 && bold === void 0 && italic === void 0 && color === void 0) {
|
|
5106
5256
|
return void 0;
|
|
5107
5257
|
}
|
|
5108
5258
|
return {
|
|
5259
|
+
...font !== void 0 ? { font } : {},
|
|
5109
5260
|
...sizePt !== void 0 ? { sizePt } : {},
|
|
5110
5261
|
...bold !== void 0 ? { bold } : {},
|
|
5111
5262
|
...italic !== void 0 ? { italic } : {},
|
|
@@ -5879,8 +6030,8 @@ var readChartSpec = (root) => {
|
|
|
5879
6030
|
};
|
|
5880
6031
|
|
|
5881
6032
|
// src/internal/chartml/embedded-xlsx.ts
|
|
5882
|
-
var
|
|
5883
|
-
var
|
|
6033
|
+
var TEXT_ENCODER4 = new TextEncoder();
|
|
6034
|
+
var encode4 = (s) => TEXT_ENCODER4.encode(s);
|
|
5884
6035
|
var xmlEscape = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5885
6036
|
var colLetter = (col) => {
|
|
5886
6037
|
let n = col;
|
|
@@ -5928,11 +6079,11 @@ var buildEmbeddedXlsx = (seriesNames, rows) => {
|
|
|
5928
6079
|
const rootRelsXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>';
|
|
5929
6080
|
const contentTypesXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>';
|
|
5930
6081
|
return writeZip([
|
|
5931
|
-
{ name: "[Content_Types].xml", data:
|
|
5932
|
-
{ name: "_rels/.rels", data:
|
|
5933
|
-
{ name: "xl/workbook.xml", data:
|
|
5934
|
-
{ name: "xl/_rels/workbook.xml.rels", data:
|
|
5935
|
-
{ name: "xl/worksheets/sheet1.xml", data:
|
|
6082
|
+
{ name: "[Content_Types].xml", data: encode4(contentTypesXml) },
|
|
6083
|
+
{ name: "_rels/.rels", data: encode4(rootRelsXml) },
|
|
6084
|
+
{ name: "xl/workbook.xml", data: encode4(workbookXml) },
|
|
6085
|
+
{ name: "xl/_rels/workbook.xml.rels", data: encode4(workbookRelsXml) },
|
|
6086
|
+
{ name: "xl/worksheets/sheet1.xml", data: encode4(sheetXml) }
|
|
5936
6087
|
]);
|
|
5937
6088
|
};
|
|
5938
6089
|
|
|
@@ -5990,7 +6141,41 @@ var buildChartGraphicFrame = (opts) => {
|
|
|
5990
6141
|
const graphic = elem(NAME_GRAPHIC2, { children: [graphicData] });
|
|
5991
6142
|
return elem(NAME_GRAPHIC_FRAME2, { children: [nvGraphicFramePr, xfrm, graphic] });
|
|
5992
6143
|
};
|
|
6144
|
+
var checkChartColor = (value, label) => {
|
|
6145
|
+
if (value === null || value === void 0) return;
|
|
6146
|
+
if (parseSrgbHex(value) === null) {
|
|
6147
|
+
throw new Error(
|
|
6148
|
+
`${label}: invalid chart color ${JSON.stringify(value)} \u2014 expected an sRGB hex like "#4472C4" or "4472C4"`
|
|
6149
|
+
);
|
|
6150
|
+
}
|
|
6151
|
+
};
|
|
6152
|
+
var validateChartSpecColors = (spec) => {
|
|
6153
|
+
checkChartColor(spec.plotAreaFill, "addSlideChart: plotAreaFill");
|
|
6154
|
+
checkChartColor(spec.plotAreaStrokeColor, "addSlideChart: plotAreaStrokeColor");
|
|
6155
|
+
checkChartColor(spec.chartAreaFill, "addSlideChart: chartAreaFill");
|
|
6156
|
+
checkChartColor(spec.chartAreaStrokeColor, "addSlideChart: chartAreaStrokeColor");
|
|
6157
|
+
checkChartColor(spec.valueAxisMajorGridlineColor, "addSlideChart: valueAxisMajorGridlineColor");
|
|
6158
|
+
checkChartColor(spec.valueAxisMinorGridlineColor, "addSlideChart: valueAxisMinorGridlineColor");
|
|
6159
|
+
checkChartColor(
|
|
6160
|
+
spec.categoryAxisMajorGridlineColor,
|
|
6161
|
+
"addSlideChart: categoryAxisMajorGridlineColor"
|
|
6162
|
+
);
|
|
6163
|
+
checkChartColor(
|
|
6164
|
+
spec.categoryAxisMinorGridlineColor,
|
|
6165
|
+
"addSlideChart: categoryAxisMinorGridlineColor"
|
|
6166
|
+
);
|
|
6167
|
+
checkChartColor(spec.valueAxisLineColor, "addSlideChart: valueAxisLineColor");
|
|
6168
|
+
checkChartColor(spec.categoryAxisLineColor, "addSlideChart: categoryAxisLineColor");
|
|
6169
|
+
spec.series.forEach((series, i) => {
|
|
6170
|
+
checkChartColor(series.color, `addSlideChart: series[${i}].color`);
|
|
6171
|
+
checkChartColor(series.trendline?.color, `addSlideChart: series[${i}].trendline.color`);
|
|
6172
|
+
series.pointColors?.forEach((c2, j) => {
|
|
6173
|
+
checkChartColor(c2, `addSlideChart: series[${i}].pointColors[${j}]`);
|
|
6174
|
+
});
|
|
6175
|
+
});
|
|
6176
|
+
};
|
|
5993
6177
|
var addSlideChart = (slide, opts) => {
|
|
6178
|
+
validateChartSpecColors(opts.spec);
|
|
5994
6179
|
const pkg = slide[INTERNAL_PACKAGE];
|
|
5995
6180
|
const chartN = allocateChartIndex(pkg);
|
|
5996
6181
|
const chartPartName = partName(`/ppt/charts/chart${chartN}.xml`);
|
|
@@ -6004,7 +6189,7 @@ var addSlideChart = (slide, opts) => {
|
|
|
6004
6189
|
xlsxRows
|
|
6005
6190
|
);
|
|
6006
6191
|
const chartDoc = buildChartSpaceDoc(opts.spec);
|
|
6007
|
-
const chartBytes =
|
|
6192
|
+
const chartBytes = encode3(serializeXml(chartDoc));
|
|
6008
6193
|
pkg.addPart(chartPartName, CHART_CONTENT_TYPE, chartBytes);
|
|
6009
6194
|
pkg.addPart(xlsxPartName, EMBEDDED_XLSX_CONTENT_TYPE, xlsxBytes);
|
|
6010
6195
|
setOpcDefault(pkg, "rels", "application/vnd.openxmlformats-package.relationships+xml");
|
|
@@ -6057,6 +6242,7 @@ var resolveChartPartName = (slide, shape) => {
|
|
|
6057
6242
|
return { partName: partNameValue, rId };
|
|
6058
6243
|
};
|
|
6059
6244
|
var setChartSpec = (chart, spec) => {
|
|
6245
|
+
validateChartSpecColors(spec);
|
|
6060
6246
|
const slide = chart.shape[SHAPE_SLIDE];
|
|
6061
6247
|
const pkg = slide[INTERNAL_PACKAGE];
|
|
6062
6248
|
const resolved = resolveChartPartName(slide, chart.shape);
|
|
@@ -6064,7 +6250,7 @@ var setChartSpec = (chart, spec) => {
|
|
|
6064
6250
|
throw new Error("setChartSpec: shape is not a chart graphic frame");
|
|
6065
6251
|
}
|
|
6066
6252
|
const doc = buildChartSpaceDoc(spec);
|
|
6067
|
-
const chartBytes =
|
|
6253
|
+
const chartBytes = encode3(serializeXml(doc));
|
|
6068
6254
|
const chartPart = pkg.getPart(resolved.partName);
|
|
6069
6255
|
if (!chartPart) {
|
|
6070
6256
|
throw new Error(`setChartSpec: chart part ${resolved.partName} not found`);
|
|
@@ -6653,7 +6839,7 @@ var getSlideLayouts = (pres) => {
|
|
|
6653
6839
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
6654
6840
|
const out = [];
|
|
6655
6841
|
for (const part of pkg.parts) {
|
|
6656
|
-
if (part.contentType !==
|
|
6842
|
+
if (part.contentType !== SLIDE_LAYOUT_CONTENT_TYPE2) continue;
|
|
6657
6843
|
const root = parseXml(decode2(part.data)).root;
|
|
6658
6844
|
out.push({
|
|
6659
6845
|
[LAYOUT_PART_NAME]: part.name,
|
|
@@ -6747,7 +6933,7 @@ var getCoreProperties = (pres) => {
|
|
|
6747
6933
|
category: read(NS_CORE_PROPS, "category")
|
|
6748
6934
|
};
|
|
6749
6935
|
};
|
|
6750
|
-
var
|
|
6936
|
+
var CORE_PROPS_CONTENT_TYPE2 = "application/vnd.openxmlformats-package.core-properties+xml";
|
|
6751
6937
|
var CORE_PROP_FIELDS = [
|
|
6752
6938
|
{ key: "title", uri: NS_DC, prefix: "dc", local: "title" },
|
|
6753
6939
|
{ key: "subject", uri: NS_DC, prefix: "dc", local: "subject" },
|
|
@@ -6803,16 +6989,16 @@ var setCoreProperties = (pres, values) => {
|
|
|
6803
6989
|
root.children.push(elem(name, { children: [text(value)] }));
|
|
6804
6990
|
}
|
|
6805
6991
|
}
|
|
6806
|
-
const bytes =
|
|
6992
|
+
const bytes = encode3(serializeXml(doc));
|
|
6807
6993
|
if (part) {
|
|
6808
6994
|
part.data = bytes;
|
|
6809
6995
|
return;
|
|
6810
6996
|
}
|
|
6811
6997
|
pkg.contentTypes.overrides.push({
|
|
6812
6998
|
partName: CORE_PROPS_PART_NAME,
|
|
6813
|
-
contentType:
|
|
6999
|
+
contentType: CORE_PROPS_CONTENT_TYPE2
|
|
6814
7000
|
});
|
|
6815
|
-
pkg.addPart(CORE_PROPS_PART_NAME,
|
|
7001
|
+
pkg.addPart(CORE_PROPS_PART_NAME, CORE_PROPS_CONTENT_TYPE2, bytes);
|
|
6816
7002
|
const rootRels = pkg.rootRels() ?? emptyRels();
|
|
6817
7003
|
const rId = nextRelId(rootRels.items.map((r2) => r2.id));
|
|
6818
7004
|
rootRels.items.push({
|
|
@@ -6876,7 +7062,7 @@ var setExtendedProperties = (pres, values) => {
|
|
|
6876
7062
|
doc.root.children.push(elem(name, { children: [text(value)] }));
|
|
6877
7063
|
}
|
|
6878
7064
|
}
|
|
6879
|
-
part.data =
|
|
7065
|
+
part.data = encode3(serializeXml(doc));
|
|
6880
7066
|
};
|
|
6881
7067
|
|
|
6882
7068
|
// src/api/fn/thumbnail.ts
|
|
@@ -7206,6 +7392,78 @@ var getTableCellSpan = (cell) => {
|
|
|
7206
7392
|
vMerge: vm === "1" || vm === "true"
|
|
7207
7393
|
};
|
|
7208
7394
|
};
|
|
7395
|
+
var ATTR_GRID_SPAN = qname("", "gridSpan", "");
|
|
7396
|
+
var ATTR_ROW_SPAN = qname("", "rowSpan", "");
|
|
7397
|
+
var ATTR_H_MERGE = qname("", "hMerge", "");
|
|
7398
|
+
var ATTR_V_MERGE = qname("", "vMerge", "");
|
|
7399
|
+
var setSpanAttr = (tc, name, value) => {
|
|
7400
|
+
tc.attrs = tc.attrs.filter(
|
|
7401
|
+
(a2) => !(a2.name.namespaceURI === "" && a2.name.localName === name.localName)
|
|
7402
|
+
);
|
|
7403
|
+
tc.attrs.push(attr(name, value));
|
|
7404
|
+
};
|
|
7405
|
+
var cellIsMergedAlready = (tc) => {
|
|
7406
|
+
const gs = getAttrValue(tc, ATTR_GRID_SPAN);
|
|
7407
|
+
const rs = getAttrValue(tc, ATTR_ROW_SPAN);
|
|
7408
|
+
const hm = getAttrValue(tc, ATTR_H_MERGE);
|
|
7409
|
+
const vm = getAttrValue(tc, ATTR_V_MERGE);
|
|
7410
|
+
return gs !== null && Number.parseInt(gs, 10) > 1 || rs !== null && Number.parseInt(rs, 10) > 1 || hm === "1" || hm === "true" || vm === "1" || vm === "true";
|
|
7411
|
+
};
|
|
7412
|
+
var mergeTableCells = (table, block) => {
|
|
7413
|
+
const { row, col, rowSpan, colSpan } = block;
|
|
7414
|
+
if (!Number.isInteger(rowSpan) || !Number.isInteger(colSpan) || rowSpan < 1 || colSpan < 1) {
|
|
7415
|
+
throw new RangeError(
|
|
7416
|
+
`mergeTableCells: rowSpan / colSpan must be integers \u2265 1 (got ${rowSpan} \xD7 ${colSpan})`
|
|
7417
|
+
);
|
|
7418
|
+
}
|
|
7419
|
+
if (rowSpan === 1 && colSpan === 1) {
|
|
7420
|
+
throw new RangeError("mergeTableCells: a 1\xD71 block is not a merge");
|
|
7421
|
+
}
|
|
7422
|
+
if (!Number.isInteger(row) || !Number.isInteger(col) || row < 0 || col < 0) {
|
|
7423
|
+
throw new RangeError(
|
|
7424
|
+
`mergeTableCells: row / col must be non-negative integers (got ${row}, ${col})`
|
|
7425
|
+
);
|
|
7426
|
+
}
|
|
7427
|
+
const cells = getTableCells(table);
|
|
7428
|
+
const lastRow = row + rowSpan - 1;
|
|
7429
|
+
const lastCol = col + colSpan - 1;
|
|
7430
|
+
if (lastRow >= cells.length) {
|
|
7431
|
+
throw new RangeError(
|
|
7432
|
+
`mergeTableCells: block rows ${row}..${lastRow} exceed table height ${cells.length}`
|
|
7433
|
+
);
|
|
7434
|
+
}
|
|
7435
|
+
for (let r2 = row; r2 <= lastRow; r2++) {
|
|
7436
|
+
const rowCellsArr = cells[r2];
|
|
7437
|
+
if (lastCol >= rowCellsArr.length) {
|
|
7438
|
+
throw new RangeError(
|
|
7439
|
+
`mergeTableCells: block cols ${col}..${lastCol} exceed row ${r2} width ${rowCellsArr.length}`
|
|
7440
|
+
);
|
|
7441
|
+
}
|
|
7442
|
+
}
|
|
7443
|
+
for (let r2 = row; r2 <= lastRow; r2++) {
|
|
7444
|
+
for (let c2 = col; c2 <= lastCol; c2++) {
|
|
7445
|
+
if (cellIsMergedAlready(cells[r2][c2][CELL_ELEMENT])) {
|
|
7446
|
+
throw new Error(
|
|
7447
|
+
`mergeTableCells: cell (${r2}, ${c2}) is already part of a merge; split it before re-merging`
|
|
7448
|
+
);
|
|
7449
|
+
}
|
|
7450
|
+
}
|
|
7451
|
+
}
|
|
7452
|
+
for (let r2 = row; r2 <= lastRow; r2++) {
|
|
7453
|
+
for (let c2 = col; c2 <= lastCol; c2++) {
|
|
7454
|
+
const tc = cells[r2][c2][CELL_ELEMENT];
|
|
7455
|
+
if (r2 === row && c2 === col) {
|
|
7456
|
+
if (colSpan > 1) setSpanAttr(tc, ATTR_GRID_SPAN, String(colSpan));
|
|
7457
|
+
if (rowSpan > 1) setSpanAttr(tc, ATTR_ROW_SPAN, String(rowSpan));
|
|
7458
|
+
continue;
|
|
7459
|
+
}
|
|
7460
|
+
if (c2 > col) setSpanAttr(tc, ATTR_H_MERGE, "1");
|
|
7461
|
+
if (r2 > row) setSpanAttr(tc, ATTR_V_MERGE, "1");
|
|
7462
|
+
}
|
|
7463
|
+
}
|
|
7464
|
+
commitSlideData(table[SHAPE_SLIDE]);
|
|
7465
|
+
refreshSlideData(table[SHAPE_SLIDE]);
|
|
7466
|
+
};
|
|
7209
7467
|
var getTableCellBorders = (pres, cell) => {
|
|
7210
7468
|
const tcPr = firstChildElement(cell[CELL_ELEMENT], NAME_A_TC_PR);
|
|
7211
7469
|
const theme = getPresentationTheme(pres);
|
|
@@ -9046,7 +9304,7 @@ var setSlideNotes = (slide, value) => {
|
|
|
9046
9304
|
const txBody = firstChildElement(child, qname("p", "txBody", NS.pml));
|
|
9047
9305
|
if (!txBody) continue;
|
|
9048
9306
|
setTextBody(txBody, value);
|
|
9049
|
-
part.data =
|
|
9307
|
+
part.data = encode3(serializeXml(doc2));
|
|
9050
9308
|
return;
|
|
9051
9309
|
}
|
|
9052
9310
|
throw new Error("notesSlide has no body placeholder to fill");
|
|
@@ -9066,7 +9324,7 @@ var setSlideNotes = (slide, value) => {
|
|
|
9066
9324
|
pkg.addPart(
|
|
9067
9325
|
notesName,
|
|
9068
9326
|
"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",
|
|
9069
|
-
|
|
9327
|
+
encode3(serializeXml(doc))
|
|
9070
9328
|
);
|
|
9071
9329
|
const notesRels = emptyRels();
|
|
9072
9330
|
const slideBase = slide[SLIDE_PART_NAME].split("/").pop() ?? "slide.xml";
|
|
@@ -9156,7 +9414,7 @@ var setSlideSize = (pres, opts) => {
|
|
|
9156
9414
|
}
|
|
9157
9415
|
sldSz.attrs = [attr(ATTR_CX9, String(opts.width)), attr(ATTR_CY9, String(opts.height))];
|
|
9158
9416
|
if (opts.type !== void 0) sldSz.attrs.push(attr(ATTR_TYPE8, opts.type));
|
|
9159
|
-
presPart.data =
|
|
9417
|
+
presPart.data = encode3(serializeXml(doc));
|
|
9160
9418
|
};
|
|
9161
9419
|
var SLIDE_SIZE_4_3 = {
|
|
9162
9420
|
width: emu(9144e3),
|
|
@@ -12410,14 +12668,19 @@ var addSlideImage = (slide, bytes, opts) => {
|
|
|
12410
12668
|
targetMode: "Internal"
|
|
12411
12669
|
});
|
|
12412
12670
|
pkg.setRels(slide[SLIDE_PART_NAME], rels);
|
|
12671
|
+
const rect = fitImageRect(
|
|
12672
|
+
{ x: opts.x, y: opts.y, w: opts.w, h: opts.h },
|
|
12673
|
+
opts.fit ?? "fill",
|
|
12674
|
+
readImagePixelSize(bytes)
|
|
12675
|
+
);
|
|
12413
12676
|
const pic = buildPicture({
|
|
12414
12677
|
id: nextShapeId(slide),
|
|
12415
12678
|
...opts.name !== void 0 ? { name: opts.name } : {},
|
|
12416
12679
|
rEmbed: newRId,
|
|
12417
|
-
x:
|
|
12418
|
-
y:
|
|
12419
|
-
w:
|
|
12420
|
-
h:
|
|
12680
|
+
x: rect.x,
|
|
12681
|
+
y: rect.y,
|
|
12682
|
+
w: rect.w,
|
|
12683
|
+
h: rect.h
|
|
12421
12684
|
});
|
|
12422
12685
|
return appendAndReturnNewShape(slide, pic);
|
|
12423
12686
|
};
|
|
@@ -12458,7 +12721,7 @@ var getSlideLayoutCount = (pres) => {
|
|
|
12458
12721
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
12459
12722
|
let n = 0;
|
|
12460
12723
|
for (const part of pkg.parts) {
|
|
12461
|
-
if (part.contentType ===
|
|
12724
|
+
if (part.contentType === SLIDE_LAYOUT_CONTENT_TYPE2) n++;
|
|
12462
12725
|
}
|
|
12463
12726
|
return n;
|
|
12464
12727
|
};
|
|
@@ -12681,7 +12944,7 @@ var replaceTokensInPresentation = (pres, tokens) => {
|
|
|
12681
12944
|
const doc = parseXml(decode2(part.data));
|
|
12682
12945
|
const n = replaceTokensInTree(doc.root, tokens);
|
|
12683
12946
|
if (n > 0) {
|
|
12684
|
-
part.data =
|
|
12947
|
+
part.data = encode3(serializeXml(doc));
|
|
12685
12948
|
count += n;
|
|
12686
12949
|
}
|
|
12687
12950
|
}
|
|
@@ -12696,7 +12959,7 @@ var replaceTextInPresentation = (pres, from, to) => {
|
|
|
12696
12959
|
const doc = parseXml(decode2(part.data));
|
|
12697
12960
|
const n = replaceTextInTree(doc.root, from, to);
|
|
12698
12961
|
if (n > 0) {
|
|
12699
|
-
part.data =
|
|
12962
|
+
part.data = encode3(serializeXml(doc));
|
|
12700
12963
|
count += n;
|
|
12701
12964
|
}
|
|
12702
12965
|
}
|
|
@@ -12833,7 +13096,7 @@ var setSlideSections = (pres, sections) => {
|
|
|
12833
13096
|
doc.root.children = doc.root.children.filter((c2) => c2 !== extLst);
|
|
12834
13097
|
}
|
|
12835
13098
|
}
|
|
12836
|
-
presPart.data =
|
|
13099
|
+
presPart.data = encode3(serializeXml(doc));
|
|
12837
13100
|
return;
|
|
12838
13101
|
}
|
|
12839
13102
|
const sectionLst = ensureSectionLst(doc.root);
|
|
@@ -12852,7 +13115,7 @@ var setSlideSections = (pres, sections) => {
|
|
|
12852
13115
|
children: [elem(NAME_P14_SLD_ID_LST, { children: sldIds })]
|
|
12853
13116
|
});
|
|
12854
13117
|
});
|
|
12855
|
-
presPart.data =
|
|
13118
|
+
presPart.data = encode3(serializeXml(doc));
|
|
12856
13119
|
};
|
|
12857
13120
|
|
|
12858
13121
|
// src/api/fn/slide-deck.ts
|
|
@@ -12961,7 +13224,7 @@ var addSlide = (pres, options) => {
|
|
|
12961
13224
|
const layoutSpTree = firstChildElement(layoutCsld, NAME_SP_TREE4);
|
|
12962
13225
|
if (!layoutSpTree) throw new Error(`layout ${layoutPartName} missing <p:spTree>`);
|
|
12963
13226
|
const slideDoc = buildSlideFromLayout(layoutSpTree);
|
|
12964
|
-
const slideBytes =
|
|
13227
|
+
const slideBytes = encode3(serializeXml(slideDoc));
|
|
12965
13228
|
pkg.addPart(newSlidePartName, SLIDE_CONTENT_TYPE, slideBytes);
|
|
12966
13229
|
const slideRels = emptyRels();
|
|
12967
13230
|
slideRels.items.push({
|
|
@@ -12985,7 +13248,7 @@ var addSlide = (pres, options) => {
|
|
|
12985
13248
|
attrs: [attr(ATTR_ID13, String(newSldId)), attr(ATTR_R_ID3, newRId)]
|
|
12986
13249
|
})
|
|
12987
13250
|
);
|
|
12988
|
-
presPart.data =
|
|
13251
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
12989
13252
|
pres._slidesCache = null;
|
|
12990
13253
|
const slides = getSlides(pres);
|
|
12991
13254
|
const last = slides[slides.length - 1];
|
|
@@ -13020,7 +13283,7 @@ var removeSlide = (pres, slide) => {
|
|
|
13020
13283
|
return getAttrValue(c2, ATTR_R_ID3) !== removedRel.id;
|
|
13021
13284
|
});
|
|
13022
13285
|
}
|
|
13023
|
-
presPart.data =
|
|
13286
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13024
13287
|
pkg.removePart(relsPartNameFor(slidePartName));
|
|
13025
13288
|
pkg.removePart(slidePartName);
|
|
13026
13289
|
pres._slidesCache = null;
|
|
@@ -13063,7 +13326,7 @@ var sortSlides = (pres, compareFn) => {
|
|
|
13063
13326
|
(c2) => !(c2.kind === "element" && c2.name.namespaceURI === NS.pml && c2.name.localName === "sldId")
|
|
13064
13327
|
);
|
|
13065
13328
|
sldIdLst.children = [...nonSldIdChildren, ...newOrder];
|
|
13066
|
-
presPart.data =
|
|
13329
|
+
presPart.data = encode3(serializeXml(doc));
|
|
13067
13330
|
pres._slidesCache = null;
|
|
13068
13331
|
};
|
|
13069
13332
|
var reverseSlides = (pres) => {
|
|
@@ -13115,7 +13378,7 @@ var moveSlide = (pres, slide, toIndex) => {
|
|
|
13115
13378
|
remaining.splice(insertAt, 0, target);
|
|
13116
13379
|
}
|
|
13117
13380
|
sldIdLst.children = remaining;
|
|
13118
|
-
presPart.data =
|
|
13381
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13119
13382
|
pres._slidesCache = null;
|
|
13120
13383
|
};
|
|
13121
13384
|
var duplicateSlide = (pres, slide) => {
|
|
@@ -13149,7 +13412,7 @@ var duplicateSlide = (pres, slide) => {
|
|
|
13149
13412
|
attrs: [attr(ATTR_ID13, String(newSldId)), attr(ATTR_R_ID3, newRId)]
|
|
13150
13413
|
})
|
|
13151
13414
|
);
|
|
13152
|
-
presPart.data =
|
|
13415
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13153
13416
|
pres._slidesCache = null;
|
|
13154
13417
|
const slides = getSlides(pres);
|
|
13155
13418
|
const dup = slides[slides.length - 1];
|
|
@@ -13247,7 +13510,7 @@ var importSlide = (targetPres, sourceSlide, targetLayout) => {
|
|
|
13247
13510
|
attrs: [attr(ATTR_ID13, String(newSldId)), attr(ATTR_R_ID3, newRId)]
|
|
13248
13511
|
})
|
|
13249
13512
|
);
|
|
13250
|
-
presPart.data =
|
|
13513
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13251
13514
|
targetPres._slidesCache = null;
|
|
13252
13515
|
const slides = getSlides(targetPres);
|
|
13253
13516
|
const last = slides[slides.length - 1];
|
|
@@ -13267,8 +13530,8 @@ var mergePresentations = (targetPres, sourcePres, targetLayout) => {
|
|
|
13267
13530
|
};
|
|
13268
13531
|
|
|
13269
13532
|
// src/api/index.ts
|
|
13270
|
-
var VERSION = "0.
|
|
13533
|
+
var VERSION = "0.4.0" ;
|
|
13271
13534
|
|
|
13272
|
-
export { SLIDE_SIZE_16_10, SLIDE_SIZE_16_9, SLIDE_SIZE_4_3, VERSION, _internalPackageOf, addBlankSlide, addContentSlide, addSectionHeaderSlide, addSlide, addSlideAt, addSlideChart, addSlideComment, addSlideImage, addSlideLine, addSlideShape, addSlideTable, addSlideTextBox, addTitleSlide, appendShapeText, appendSlideNotes, bringShapeForward, bringShapeToFront, centerShapeOnSlide, clearAllHyperlinks, clearAllSlideComments, clearAllSlideNotes, clearShapeEffects, clearShapeFill, clearShapeStroke, clearSlideAnimations, clearSlideBackground, clearSlideComments, clearSlideHyperlinks, clearSlideShapes, clearSlideTransition, clearTableCellFill, cm, compactPackage, copyShape, createPresentation, duplicateSlide, duplicateSlideAt, emu, findChartByKind, findChartsBySeriesName, findChartsWithDataLabels, findChartsWithTrendlines, findCommentAuthorByName, findCommentsAfter, findCommentsBefore, findCommentsByAuthor, findCommentsByText, findEmptyPlaceholders, findFlippedShapes, findLayoutsWithPlaceholderType, findOverlappingShapePairs, findShapeById, findShapeByName, findShapeByText, findShapeInPresentation, findShapesAtPoint, findShapesByEffect, findShapesByHyperlink, findShapesByKind, findShapesByName, findShapesByPreset, findShapesByText, findShapesInRect, findShapesOutsideCanvas, findShapesWithAnimation, findShapesWithHyperlinks, findSlideByPartName, findSlideByText, findSlideByTitle, findSlideLayout, findSlideLayoutByPartName, findSlideLayoutByType, findSlidePlaceholder, findSlidePlaceholderByIdx, findSlidePlaceholders, findSlidesByHyperlink, findSlidesByLayoutName, findSlidesByLayoutPartName, findSlidesByLayoutType, findSlidesByNotes, findSlidesByText, findSlidesWithChartKind, findSlidesWithChartTrendlines, findSlidesWithCommentsByAuthor, getAllCharts, getAllComments, getAllHyperlinks, getAllImages, getAllNotes, getAllShapes, getAllTables, getCommentAuthor, getCommentAuthors, getCommentDate, getCommentPosition, getCommentSlide, getCommentText, getCommentsSortedByDate, getCoreProperties, getDistinctHyperlinkUrls, getEmptySlides, getExtendedProperties, getGroupChildren, getGroupTransform, getHiddenSlides, getMaxShapeId, getMaxShapeIdInPresentation, getMediaParts, getOrphanMediaPartNames, getOutlineText, getPackageSize, getParagraphAlignment, getParagraphBullet, getParagraphBulletImageBytes, getParagraphBulletStyle, getParagraphIndent, getParagraphLevel, getParagraphLineSpacing, getParagraphPropertiesEffective, getParagraphSpacing, getPresentationChartCountsBySlide, getPresentationChartKindCounts, getPresentationCommentCountsByAuthor, getPresentationCommentCountsBySlide, getPresentationCommenters, getPresentationCreated, getPresentationFonts, getPresentationHyperlinkCountsBySlide, getPresentationImageCountsBySlide, getPresentationModified, getPresentationNotesLength, getPresentationNotesLengthsBySlide, getPresentationNotesText, getPresentationShapeCountsBySlide, getPresentationSummary, getPresentationTableCountsBySlide, getPresentationText, getPresentationTextLength, getPresentationTextLengthsBySlide, getPresentationTheme, getShapeAdjustValues, getShapeAltTitle, getShapeAnimation, getShapeAt, getShapeBodyPrEffective, getShapeBounds, getShapeBoundsResolved, getShapeCenter, getShapeChartCategories, getShapeChartKind, getShapeChartSeriesNames, getShapeChartSeriesValues, getShapeChartSpec, getShapeClickAction, getShapeCustomGeometry, getShapeDescription, getShapeEffect, getShapeEffects, getShapeEffectsEffective, getShapeFill, getShapeFillColor, getShapeFillColorResolved, getShapeFillEffective, getShapeFlip, getShapeGradientFill, getShapeGradientFillEffective, getShapeHyperlink, getShapeHyperlinkTooltip, getShapeId, getShapeImageBiLevelThreshold, getShapeImageBrightness, getShapeImageBytes, getShapeImageContrast, getShapeImageCrop, getShapeImageDuotone, getShapeImageFillBytes, getShapeImageFormat, getShapeImageLinkUrl, getShapeImageOpacity, getShapeImagePartName, getShapeIndex, getShapeKind, getShapeName, getShapeParagraphCount, getShapeParagraphElements, getShapePatternFill, getShapePlaceholderIdx, getShapePlaceholderType, getShapePosition, getShapePreset, getShapeRotation, getShapeRunClickAction, getShapeRunCount, getShapeRunFormat, getShapeRunFormatEffective, getShapeRunHyperlink, getShapeRunHyperlinkTooltip, getShapeRunText, getShapeSize, getShapeSlide, getShapeStroke, getShapeStrokeArrow, getShapeStrokeCap, getShapeStrokeColor, getShapeStrokeColorResolved, getShapeStrokeCompound, getShapeStrokeDash, getShapeStrokeEffective, getShapeStrokeJoin, getShapeStrokeWidth, getShapeText, getShapeTextAnchor, getShapeTextAutoFit, getShapeTextAutoFitParams, getShapeTextBodyRotationDeg, getShapeTextColumns, getShapeTextDirection, getShapeTextMargins, getShapeTextWrap, getShapeXmlString, getShapeZIndex, getShapesBounds, getSlideAt, getSlideBackground, getSlideBackgroundGradientFill, getSlideBackgroundImageBytes, getSlideBackgroundPatternFill, getSlideBody, getSlideCharts, getSlideColorMapOverride, getSlideCommentAuthors, getSlideComments, getSlideCount, getSlideIndex, getSlideInfo, getSlideLayout, getSlideLayoutBackground, getSlideLayoutBackgroundGradientFill, getSlideLayoutBackgroundImageBytes, getSlideLayoutBackgroundPatternFill, getSlideLayoutBackgroundShapes, getSlideLayoutCount, getSlideLayoutName, getSlideLayoutPartName, getSlideLayoutPlaceholders, getSlideLayoutShapes, getSlideLayoutType, getSlideLayoutUsageCounts, getSlideLayoutUsageCountsByType, getSlideLayouts, getSlideMasterBackground, getSlideMasterBackgroundGradientFill, getSlideMasterBackgroundImageBytes, getSlideMasterBackgroundPatternFill, getSlideMasterCount, getSlideMasterPartName, getSlideMasterPartNames, getSlideMasterShapes, getSlideMasterUsageCounts, getSlideMediaPartNames, getSlideNotes, getSlideNotesLength, getSlideOutline, getSlidePartName, getSlideSections, getSlideShapes, getSlideSize, getSlideTables, getSlideText, getSlideTextLength, getSlideTitle, getSlideTransition, getSlideXmlString, getSlides, getSlidesByLayout, getSlidesWithCharts, getSlidesWithComments, getSlidesWithEmptyPlaceholders, getSlidesWithHyperlinks, getSlidesWithImages, getSlidesWithNotes, getSlidesWithOverlap, getSlidesWithTables, getTableCell, getTableCellAlignment, getTableCellAnchor, getTableCellBorders, getTableCellFill, getTableCellMargins, getTableCellParagraphs, getTableCellPosition, getTableCellSpan, getTableCellText, getTableCellTextDirection, getTableCells, getTableColumnWidths, getTableDimensions, getTableRowHeights, getTableSize, getTableStyleFlags, getTableStyleId, getThumbnail, getUnusedSlideLayouts, getUnusedSlideMasters, getVisibleSlides, hasShapeImage, hasShapeText, hasSlideNotes, importSlide, inches, incrementRevision, insertTableColumn, insertTableRow, isChartShape, isParagraphBulletPicture, isShapeHidden, isShapeImageGrayscale, isShapePlaceholder, isShapeTextBox, isSlideHidden, isTableShape, listPackageParts, loadPresentation, mergePresentations, mm, moveSlide, pointInShape, pt, readPackagePart, removeShape, removeSlide, removeSlideComment, removeSlideNotes, removeTableColumn, removeTableRow, removeThumbnail, renameShape, replaceHyperlink, replaceTextInNotes, replaceTextInPresentation, replaceTextInSlide, replaceTextInSlideNotes, replaceTokensInPresentation, replaceTokensInSlide, resolveDrawingColor, reverseSlides, savePresentation, searchSlides, sendShapeBackward, sendShapeToBack, setChartSpec, setCoreProperties, setExtendedProperties, setMediaPartBytes, setParagraphAlignment, setParagraphBullet, setParagraphLevel, setParagraphSpacing, setShapeAlignment, setShapeAltTitle, setShapeAnimation, setShapeBounds, setShapeBullets, setShapeClickAction, setShapeDescription, setShapeFill, setShapeFlip, setShapeGlow, setShapeGradientFill, setShapeHidden, setShapeHyperlink, setShapeImage, setShapeImageBrightness, setShapeImageContrast, setShapeImageCrop, setShapeImageFill, setShapeImageOpacity, setShapeNoFill, setShapeNoStroke, setShapePatternFill, setShapePosition, setShapeRotation, setShapeRunFormat, setShapeRunHyperlink, setShapeRunText, setShapeShadow, setShapeSize, setShapeStroke, setShapeStrokeArrow, setShapeStrokeCap, setShapeStrokeCompound, setShapeStrokeDash, setShapeStrokeJoin, setShapeText, setShapeTextAnchor, setShapeTextAutoFit, setShapeTextBodyRotationDeg, setShapeTextColumns, setShapeTextDirection, setShapeTextFormat, setShapeTextMargins, setShapeTextWrap, setShapeZIndex, setSlideBackground, setSlideBackgroundImage, setSlideBody, setSlideHidden, setSlideLayout, setSlideNotes, setSlidePlaceholders, setSlideSections, setSlideSize, setSlideTitle, setSlideTransition, setTableCellAlignment, setTableCellAnchor, setTableCellBorders, setTableCellFill, setTableCellMargins, setTableCellText, setTableCellTextDirection, setTableCellTextFormat, setTableColumnWidth, setTableRowHeight, setTableStyleFlags, setTableStyleId, setThumbnail, shapesOverlap, slideHasAnimations, slidesUsingMediaPart, sortSlides, swapSlides, touchModified, translateShapes, validatePresentation };
|
|
13535
|
+
export { SLIDE_SIZE_16_10, SLIDE_SIZE_16_9, SLIDE_SIZE_4_3, VERSION, _internalPackageOf, addBlankSlide, addContentSlide, addSectionHeaderSlide, addSlide, addSlideAt, addSlideChart, addSlideComment, addSlideImage, addSlideLine, addSlideShape, addSlideTable, addSlideTextBox, addTitleSlide, appendShapeText, appendSlideNotes, bringShapeForward, bringShapeToFront, centerShapeOnSlide, clearAllHyperlinks, clearAllSlideComments, clearAllSlideNotes, clearShapeEffects, clearShapeFill, clearShapeStroke, clearSlideAnimations, clearSlideBackground, clearSlideComments, clearSlideHyperlinks, clearSlideShapes, clearSlideTransition, clearTableCellFill, cm, compactPackage, copyShape, createPresentation, duplicateSlide, duplicateSlideAt, emu, findChartByKind, findChartsBySeriesName, findChartsWithDataLabels, findChartsWithTrendlines, findCommentAuthorByName, findCommentsAfter, findCommentsBefore, findCommentsByAuthor, findCommentsByText, findEmptyPlaceholders, findFlippedShapes, findLayoutsWithPlaceholderType, findOverlappingShapePairs, findShapeById, findShapeByName, findShapeByText, findShapeInPresentation, findShapesAtPoint, findShapesByEffect, findShapesByHyperlink, findShapesByKind, findShapesByName, findShapesByPreset, findShapesByText, findShapesInRect, findShapesOutsideCanvas, findShapesWithAnimation, findShapesWithHyperlinks, findSlideByPartName, findSlideByText, findSlideByTitle, findSlideLayout, findSlideLayoutByPartName, findSlideLayoutByType, findSlidePlaceholder, findSlidePlaceholderByIdx, findSlidePlaceholders, findSlidesByHyperlink, findSlidesByLayoutName, findSlidesByLayoutPartName, findSlidesByLayoutType, findSlidesByNotes, findSlidesByText, findSlidesWithChartKind, findSlidesWithChartTrendlines, findSlidesWithCommentsByAuthor, getAllCharts, getAllComments, getAllHyperlinks, getAllImages, getAllNotes, getAllShapes, getAllTables, getCommentAuthor, getCommentAuthors, getCommentDate, getCommentPosition, getCommentSlide, getCommentText, getCommentsSortedByDate, getCoreProperties, getDistinctHyperlinkUrls, getEmptySlides, getExtendedProperties, getGroupChildren, getGroupTransform, getHiddenSlides, getMaxShapeId, getMaxShapeIdInPresentation, getMediaParts, getOrphanMediaPartNames, getOutlineText, getPackageSize, getParagraphAlignment, getParagraphBullet, getParagraphBulletImageBytes, getParagraphBulletStyle, getParagraphIndent, getParagraphLevel, getParagraphLineSpacing, getParagraphPropertiesEffective, getParagraphSpacing, getPresentationChartCountsBySlide, getPresentationChartKindCounts, getPresentationCommentCountsByAuthor, getPresentationCommentCountsBySlide, getPresentationCommenters, getPresentationCreated, getPresentationFonts, getPresentationHyperlinkCountsBySlide, getPresentationImageCountsBySlide, getPresentationModified, getPresentationNotesLength, getPresentationNotesLengthsBySlide, getPresentationNotesText, getPresentationShapeCountsBySlide, getPresentationSummary, getPresentationTableCountsBySlide, getPresentationText, getPresentationTextLength, getPresentationTextLengthsBySlide, getPresentationTheme, getShapeAdjustValues, getShapeAltTitle, getShapeAnimation, getShapeAt, getShapeBodyPrEffective, getShapeBounds, getShapeBoundsResolved, getShapeCenter, getShapeChartCategories, getShapeChartKind, getShapeChartSeriesNames, getShapeChartSeriesValues, getShapeChartSpec, getShapeClickAction, getShapeCustomGeometry, getShapeDescription, getShapeEffect, getShapeEffects, getShapeEffectsEffective, getShapeFill, getShapeFillColor, getShapeFillColorResolved, getShapeFillEffective, getShapeFlip, getShapeGradientFill, getShapeGradientFillEffective, getShapeHyperlink, getShapeHyperlinkTooltip, getShapeId, getShapeImageBiLevelThreshold, getShapeImageBrightness, getShapeImageBytes, getShapeImageContrast, getShapeImageCrop, getShapeImageDuotone, getShapeImageFillBytes, getShapeImageFormat, getShapeImageLinkUrl, getShapeImageOpacity, getShapeImagePartName, getShapeIndex, getShapeKind, getShapeName, getShapeParagraphCount, getShapeParagraphElements, getShapePatternFill, getShapePlaceholderIdx, getShapePlaceholderType, getShapePosition, getShapePreset, getShapeRotation, getShapeRunClickAction, getShapeRunCount, getShapeRunFormat, getShapeRunFormatEffective, getShapeRunHyperlink, getShapeRunHyperlinkTooltip, getShapeRunText, getShapeSize, getShapeSlide, getShapeStroke, getShapeStrokeArrow, getShapeStrokeCap, getShapeStrokeColor, getShapeStrokeColorResolved, getShapeStrokeCompound, getShapeStrokeDash, getShapeStrokeEffective, getShapeStrokeJoin, getShapeStrokeWidth, getShapeText, getShapeTextAnchor, getShapeTextAutoFit, getShapeTextAutoFitParams, getShapeTextBodyRotationDeg, getShapeTextColumns, getShapeTextDirection, getShapeTextMargins, getShapeTextWrap, getShapeXmlString, getShapeZIndex, getShapesBounds, getSlideAt, getSlideBackground, getSlideBackgroundGradientFill, getSlideBackgroundImageBytes, getSlideBackgroundPatternFill, getSlideBody, getSlideCharts, getSlideColorMapOverride, getSlideCommentAuthors, getSlideComments, getSlideCount, getSlideIndex, getSlideInfo, getSlideLayout, getSlideLayoutBackground, getSlideLayoutBackgroundGradientFill, getSlideLayoutBackgroundImageBytes, getSlideLayoutBackgroundPatternFill, getSlideLayoutBackgroundShapes, getSlideLayoutCount, getSlideLayoutName, getSlideLayoutPartName, getSlideLayoutPlaceholders, getSlideLayoutShapes, getSlideLayoutType, getSlideLayoutUsageCounts, getSlideLayoutUsageCountsByType, getSlideLayouts, getSlideMasterBackground, getSlideMasterBackgroundGradientFill, getSlideMasterBackgroundImageBytes, getSlideMasterBackgroundPatternFill, getSlideMasterCount, getSlideMasterPartName, getSlideMasterPartNames, getSlideMasterShapes, getSlideMasterUsageCounts, getSlideMediaPartNames, getSlideNotes, getSlideNotesLength, getSlideOutline, getSlidePartName, getSlideSections, getSlideShapes, getSlideSize, getSlideTables, getSlideText, getSlideTextLength, getSlideTitle, getSlideTransition, getSlideXmlString, getSlides, getSlidesByLayout, getSlidesWithCharts, getSlidesWithComments, getSlidesWithEmptyPlaceholders, getSlidesWithHyperlinks, getSlidesWithImages, getSlidesWithNotes, getSlidesWithOverlap, getSlidesWithTables, getTableCell, getTableCellAlignment, getTableCellAnchor, getTableCellBorders, getTableCellFill, getTableCellMargins, getTableCellParagraphs, getTableCellPosition, getTableCellSpan, getTableCellText, getTableCellTextDirection, getTableCells, getTableColumnWidths, getTableDimensions, getTableRowHeights, getTableSize, getTableStyleFlags, getTableStyleId, getThumbnail, getUnusedSlideLayouts, getUnusedSlideMasters, getVisibleSlides, hasShapeImage, hasShapeText, hasSlideNotes, importSlide, inches, incrementRevision, insertTableColumn, insertTableRow, isChartShape, isParagraphBulletPicture, isShapeHidden, isShapeImageGrayscale, isShapePlaceholder, isShapeTextBox, isSlideHidden, isTableShape, listPackageParts, loadPresentation, mergePresentations, mergeTableCells, mm, moveSlide, pointInShape, pt, readPackagePart, removeShape, removeSlide, removeSlideComment, removeSlideNotes, removeTableColumn, removeTableRow, removeThumbnail, renameShape, replaceHyperlink, replaceTextInNotes, replaceTextInPresentation, replaceTextInSlide, replaceTextInSlideNotes, replaceTokensInPresentation, replaceTokensInSlide, resolveDrawingColor, reverseSlides, savePresentation, searchSlides, sendShapeBackward, sendShapeToBack, setChartSpec, setCoreProperties, setExtendedProperties, setMediaPartBytes, setParagraphAlignment, setParagraphBullet, setParagraphLevel, setParagraphSpacing, setShapeAlignment, setShapeAltTitle, setShapeAnimation, setShapeBounds, setShapeBullets, setShapeClickAction, setShapeDescription, setShapeFill, setShapeFlip, setShapeGlow, setShapeGradientFill, setShapeHidden, setShapeHyperlink, setShapeImage, setShapeImageBrightness, setShapeImageContrast, setShapeImageCrop, setShapeImageFill, setShapeImageOpacity, setShapeNoFill, setShapeNoStroke, setShapePatternFill, setShapePosition, setShapeRotation, setShapeRunFormat, setShapeRunHyperlink, setShapeRunText, setShapeShadow, setShapeSize, setShapeStroke, setShapeStrokeArrow, setShapeStrokeCap, setShapeStrokeCompound, setShapeStrokeDash, setShapeStrokeJoin, setShapeText, setShapeTextAnchor, setShapeTextAutoFit, setShapeTextBodyRotationDeg, setShapeTextColumns, setShapeTextDirection, setShapeTextFormat, setShapeTextMargins, setShapeTextWrap, setShapeZIndex, setSlideBackground, setSlideBackgroundImage, setSlideBody, setSlideHidden, setSlideLayout, setSlideNotes, setSlidePlaceholders, setSlideSections, setSlideSize, setSlideTitle, setSlideTransition, setTableCellAlignment, setTableCellAnchor, setTableCellBorders, setTableCellFill, setTableCellMargins, setTableCellText, setTableCellTextDirection, setTableCellTextFormat, setTableColumnWidth, setTableRowHeight, setTableStyleFlags, setTableStyleId, setThumbnail, shapesOverlap, slideHasAnimations, slidesUsingMediaPart, sortSlides, swapSlides, touchModified, translateShapes, validatePresentation };
|
|
13273
13536
|
//# sourceMappingURL=index.js.map
|
|
13274
13537
|
//# sourceMappingURL=index.js.map
|