pptx-kit 0.2.0 → 0.3.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 +39 -0
- package/README.md +70 -34
- package/dist/index.d.ts +27 -4
- package/dist/index.js +151 -48
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +151 -48
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1068,6 +1068,67 @@ var OpcPackage = class _OpcPackage {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
};
|
|
1070
1070
|
|
|
1071
|
+
// src/internal/parts/blank-deck.ts
|
|
1072
|
+
var SLIDE_SIZE = {
|
|
1073
|
+
"16:9": { cx: 12192e3, cy: 6858e3, type: "screen16x9" },
|
|
1074
|
+
"4:3": { cx: 9144e3, cy: 6858e3, type: "screen4x3" }
|
|
1075
|
+
};
|
|
1076
|
+
var RELS_CONTENT_TYPE = "application/vnd.openxmlformats-package.relationships+xml";
|
|
1077
|
+
var PRESENTATION_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
|
1078
|
+
var PRES_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml";
|
|
1079
|
+
var VIEW_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml";
|
|
1080
|
+
var SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
1081
|
+
var SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
1082
|
+
var THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
1083
|
+
var CORE_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-package.core-properties+xml";
|
|
1084
|
+
var EXTENDED_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.extended-properties+xml";
|
|
1085
|
+
var XML_DECL = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';
|
|
1086
|
+
var RT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
1087
|
+
var RT_PACKAGE = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
1088
|
+
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>`;
|
|
1089
|
+
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>`;
|
|
1090
|
+
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>`;
|
|
1091
|
+
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>`;
|
|
1092
|
+
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>`;
|
|
1093
|
+
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>`;
|
|
1094
|
+
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"/>`;
|
|
1095
|
+
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"/>`;
|
|
1096
|
+
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>`;
|
|
1097
|
+
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>`;
|
|
1098
|
+
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>`;
|
|
1099
|
+
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>`;
|
|
1100
|
+
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>`;
|
|
1101
|
+
var LAYOUT_RELS_XML = `${XML_DECL}<Relationships xmlns="${RT_PACKAGE}"><Relationship Id="rId1" Type="${RT}/slideMaster" Target="../slideMasters/slideMaster1.xml"/></Relationships>`;
|
|
1102
|
+
var TEXT_ENCODER2 = new TextEncoder();
|
|
1103
|
+
var encode2 = (s) => TEXT_ENCODER2.encode(s);
|
|
1104
|
+
var buildBlankDeck = (aspect) => {
|
|
1105
|
+
const pkg = OpcPackage.empty();
|
|
1106
|
+
const size = SLIDE_SIZE[aspect];
|
|
1107
|
+
const add = (name, contentType, xml) => {
|
|
1108
|
+
pkg.addPart(partName(name), contentType, encode2(xml));
|
|
1109
|
+
};
|
|
1110
|
+
const addRels = (name, xml) => {
|
|
1111
|
+
pkg.addPart(partName(name), RELS_CONTENT_TYPE, encode2(xml));
|
|
1112
|
+
};
|
|
1113
|
+
add("/ppt/presentation.xml", PRESENTATION_CONTENT_TYPE, buildPresentationXml(size));
|
|
1114
|
+
add("/ppt/presProps.xml", PRES_PROPS_CONTENT_TYPE, PRES_PROPS_XML);
|
|
1115
|
+
add("/ppt/viewProps.xml", VIEW_PROPS_CONTENT_TYPE, VIEW_PROPS_XML);
|
|
1116
|
+
add("/ppt/theme/theme1.xml", THEME_CONTENT_TYPE, THEME_XML);
|
|
1117
|
+
add("/ppt/slideMasters/slideMaster1.xml", SLIDE_MASTER_CONTENT_TYPE, SLIDE_MASTER_XML);
|
|
1118
|
+
add("/ppt/slideLayouts/slideLayout1.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_BLANK_XML);
|
|
1119
|
+
add("/ppt/slideLayouts/slideLayout2.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_TITLE_XML);
|
|
1120
|
+
add("/ppt/slideLayouts/slideLayout3.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_OBJ_XML);
|
|
1121
|
+
add("/docProps/core.xml", CORE_PROPS_CONTENT_TYPE, CORE_PROPS_XML);
|
|
1122
|
+
add("/docProps/app.xml", EXTENDED_PROPS_CONTENT_TYPE, EXTENDED_PROPS_XML);
|
|
1123
|
+
addRels("/_rels/.rels", ROOT_RELS_XML);
|
|
1124
|
+
addRels("/ppt/_rels/presentation.xml.rels", PRES_RELS_XML);
|
|
1125
|
+
addRels("/ppt/slideMasters/_rels/slideMaster1.xml.rels", MASTER_RELS_XML);
|
|
1126
|
+
addRels("/ppt/slideLayouts/_rels/slideLayout1.xml.rels", LAYOUT_RELS_XML);
|
|
1127
|
+
addRels("/ppt/slideLayouts/_rels/slideLayout2.xml.rels", LAYOUT_RELS_XML);
|
|
1128
|
+
addRels("/ppt/slideLayouts/_rels/slideLayout3.xml.rels", LAYOUT_RELS_XML);
|
|
1129
|
+
return pkg;
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1071
1132
|
// src/api/_internal-symbols.ts
|
|
1072
1133
|
var INTERNAL_PACKAGE = /* @__PURE__ */ Symbol.for("pptx-kit.package");
|
|
1073
1134
|
var SLIDE_PART_NAME = /* @__PURE__ */ Symbol.for("pptx-kit.slide.partName");
|
|
@@ -1100,8 +1161,9 @@ var loadPresentation = async (input) => {
|
|
|
1100
1161
|
const pkg = OpcPackage.load(bytes);
|
|
1101
1162
|
return { [INTERNAL_PACKAGE]: pkg, _slidesCache: null };
|
|
1102
1163
|
};
|
|
1103
|
-
var createPresentation = () => {
|
|
1104
|
-
const
|
|
1164
|
+
var createPresentation = (options = {}) => {
|
|
1165
|
+
const aspect = options.size ?? "16:9";
|
|
1166
|
+
const pkg = buildBlankDeck(aspect);
|
|
1105
1167
|
return { [INTERNAL_PACKAGE]: pkg, _slidesCache: null };
|
|
1106
1168
|
};
|
|
1107
1169
|
var savePresentation = (pres) => {
|
|
@@ -1595,6 +1657,10 @@ var parseColor2 = (value) => {
|
|
|
1595
1657
|
if (/^[0-9A-Fa-f]{6}$/.test(hex)) return { kind: "srgb", hex: hex.toUpperCase() };
|
|
1596
1658
|
return null;
|
|
1597
1659
|
};
|
|
1660
|
+
var parseSrgbHex = (value) => {
|
|
1661
|
+
const hex = value.startsWith("#") ? value.slice(1) : value;
|
|
1662
|
+
return /^[0-9A-Fa-f]{6}$/.test(hex) ? hex.toUpperCase() : null;
|
|
1663
|
+
};
|
|
1598
1664
|
var buildColorElement = (value) => {
|
|
1599
1665
|
const parsed = parseColor2(value);
|
|
1600
1666
|
if (parsed === null) throw new Error(`unrecognized color: ${value}`);
|
|
@@ -2878,26 +2944,28 @@ var equalShares = (total, n) => {
|
|
|
2878
2944
|
};
|
|
2879
2945
|
var buildTable = (opts) => {
|
|
2880
2946
|
const rows = opts.rows;
|
|
2881
|
-
if (rows.length === 0) throw new Error("
|
|
2947
|
+
if (rows.length === 0) throw new Error("addSlideTable: at least one row is required");
|
|
2882
2948
|
const colCount = rows[0]?.length ?? 0;
|
|
2883
|
-
if (colCount === 0) throw new Error("
|
|
2949
|
+
if (colCount === 0) throw new Error("addSlideTable: at least one column is required");
|
|
2884
2950
|
for (let i = 0; i < rows.length; i++) {
|
|
2885
2951
|
const r2 = rows[i];
|
|
2886
|
-
if (!r2) throw new Error(`
|
|
2952
|
+
if (!r2) throw new Error(`addSlideTable: row ${i} is missing`);
|
|
2887
2953
|
if (r2.length !== colCount) {
|
|
2888
2954
|
throw new Error(
|
|
2889
|
-
`
|
|
2955
|
+
`addSlideTable: row ${i} has ${r2.length} cells; expected ${colCount} to match row 0`
|
|
2890
2956
|
);
|
|
2891
2957
|
}
|
|
2892
2958
|
}
|
|
2893
2959
|
const colWidths = opts.colWidths ?? equalShares(opts.w, colCount);
|
|
2894
2960
|
if (colWidths.length !== colCount) {
|
|
2895
|
-
throw new Error(
|
|
2961
|
+
throw new Error(
|
|
2962
|
+
`addSlideTable: colWidths has ${colWidths.length} entries; expected ${colCount}`
|
|
2963
|
+
);
|
|
2896
2964
|
}
|
|
2897
2965
|
const rowHeights = opts.rowHeights ?? equalShares(opts.h, rows.length);
|
|
2898
2966
|
if (rowHeights.length !== rows.length) {
|
|
2899
2967
|
throw new Error(
|
|
2900
|
-
`
|
|
2968
|
+
`addSlideTable: rowHeights has ${rowHeights.length} entries; expected ${rows.length}`
|
|
2901
2969
|
);
|
|
2902
2970
|
}
|
|
2903
2971
|
const name = opts.name ?? `Table ${opts.id}`;
|
|
@@ -3422,10 +3490,10 @@ var buildCommentListDoc = (comments) => {
|
|
|
3422
3490
|
|
|
3423
3491
|
// src/api/fn/_helpers.ts
|
|
3424
3492
|
var TEXT_DECODER2 = new TextDecoder();
|
|
3425
|
-
var
|
|
3493
|
+
var TEXT_ENCODER3 = new TextEncoder();
|
|
3426
3494
|
var decode2 = (b) => TEXT_DECODER2.decode(b);
|
|
3427
|
-
var
|
|
3428
|
-
var
|
|
3495
|
+
var encode3 = (s) => TEXT_ENCODER3.encode(s);
|
|
3496
|
+
var SLIDE_LAYOUT_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
3429
3497
|
var SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
|
3430
3498
|
var PRES_PART_NAME = partName("/ppt/presentation.xml");
|
|
3431
3499
|
var NAME_PRESENTATION2 = qname("p", "presentation", NS.pml);
|
|
@@ -3442,7 +3510,7 @@ var commitSlideData = (slide) => {
|
|
|
3442
3510
|
const xml = serializeXml(slide[SLIDE_DOCUMENT]);
|
|
3443
3511
|
const part = slide[INTERNAL_PACKAGE].getPart(slide[SLIDE_PART_NAME]);
|
|
3444
3512
|
if (!part) throw new Error(`slide part missing: ${slide[SLIDE_PART_NAME]}`);
|
|
3445
|
-
part.data =
|
|
3513
|
+
part.data = encode3(xml);
|
|
3446
3514
|
};
|
|
3447
3515
|
var refreshSlideData = (slide) => {
|
|
3448
3516
|
const fresh = readSlidePart(slide[SLIDE_DOCUMENT].root);
|
|
@@ -3530,7 +3598,7 @@ var setOpcDefault = (pkg, extension, contentType) => {
|
|
|
3530
3598
|
};
|
|
3531
3599
|
|
|
3532
3600
|
// src/api/fn/theme.ts
|
|
3533
|
-
var
|
|
3601
|
+
var THEME_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
3534
3602
|
var NAME_THEME_ELEMENTS = qname("a", "themeElements", NS.dml);
|
|
3535
3603
|
var NAME_CLR_SCHEME = qname("a", "clrScheme", NS.dml);
|
|
3536
3604
|
var NAME_SRGB_CLR3 = qname("a", "srgbClr", NS.dml);
|
|
@@ -3552,7 +3620,7 @@ var readSchemeSlot = (parent, local) => {
|
|
|
3552
3620
|
};
|
|
3553
3621
|
var getPresentationTheme = (pres) => {
|
|
3554
3622
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
3555
|
-
const themePart = pkg.parts.filter((p) => p.contentType ===
|
|
3623
|
+
const themePart = pkg.parts.filter((p) => p.contentType === THEME_CONTENT_TYPE2).sort((a2, b) => a2.name.localeCompare(b.name))[0];
|
|
3556
3624
|
if (!themePart) return null;
|
|
3557
3625
|
const root = parseXml(decode2(themePart.data)).root;
|
|
3558
3626
|
const themeElements = firstChildElement(root, NAME_THEME_ELEMENTS);
|
|
@@ -3585,7 +3653,7 @@ var readTypeface = (parent, local) => {
|
|
|
3585
3653
|
};
|
|
3586
3654
|
var getPresentationFonts = (pres) => {
|
|
3587
3655
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
3588
|
-
const themePart = pkg.parts.filter((p) => p.contentType ===
|
|
3656
|
+
const themePart = pkg.parts.filter((p) => p.contentType === THEME_CONTENT_TYPE2).sort((a2, b) => a2.name.localeCompare(b.name))[0];
|
|
3589
3657
|
if (!themePart) return null;
|
|
3590
3658
|
const root = parseXml(decode2(themePart.data)).root;
|
|
3591
3659
|
const themeElements = firstChildElement(root, NAME_THEME_ELEMENTS);
|
|
@@ -3627,7 +3695,7 @@ var loadAuthorList = (pkg) => {
|
|
|
3627
3695
|
};
|
|
3628
3696
|
var writeAuthorList = (pkg, authors) => {
|
|
3629
3697
|
const doc = buildCommentAuthorListDoc(authors);
|
|
3630
|
-
const bytes =
|
|
3698
|
+
const bytes = encode3(serializeXml(doc));
|
|
3631
3699
|
const existing = pkg.getPart(COMMENT_AUTHORS_PART_NAME);
|
|
3632
3700
|
if (existing !== null) {
|
|
3633
3701
|
existing.data = bytes;
|
|
@@ -3674,7 +3742,7 @@ var writeCommentsForSlide = (slide, comments) => {
|
|
|
3674
3742
|
return;
|
|
3675
3743
|
}
|
|
3676
3744
|
const doc = buildCommentListDoc(comments);
|
|
3677
|
-
const bytes =
|
|
3745
|
+
const bytes = encode3(serializeXml(doc));
|
|
3678
3746
|
const existing = pkg.getPart(commentsName);
|
|
3679
3747
|
if (existing !== null) {
|
|
3680
3748
|
existing.data = bytes;
|
|
@@ -5879,8 +5947,8 @@ var readChartSpec = (root) => {
|
|
|
5879
5947
|
};
|
|
5880
5948
|
|
|
5881
5949
|
// src/internal/chartml/embedded-xlsx.ts
|
|
5882
|
-
var
|
|
5883
|
-
var
|
|
5950
|
+
var TEXT_ENCODER4 = new TextEncoder();
|
|
5951
|
+
var encode4 = (s) => TEXT_ENCODER4.encode(s);
|
|
5884
5952
|
var xmlEscape = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5885
5953
|
var colLetter = (col) => {
|
|
5886
5954
|
let n = col;
|
|
@@ -5928,11 +5996,11 @@ var buildEmbeddedXlsx = (seriesNames, rows) => {
|
|
|
5928
5996
|
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
5997
|
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
5998
|
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:
|
|
5999
|
+
{ name: "[Content_Types].xml", data: encode4(contentTypesXml) },
|
|
6000
|
+
{ name: "_rels/.rels", data: encode4(rootRelsXml) },
|
|
6001
|
+
{ name: "xl/workbook.xml", data: encode4(workbookXml) },
|
|
6002
|
+
{ name: "xl/_rels/workbook.xml.rels", data: encode4(workbookRelsXml) },
|
|
6003
|
+
{ name: "xl/worksheets/sheet1.xml", data: encode4(sheetXml) }
|
|
5936
6004
|
]);
|
|
5937
6005
|
};
|
|
5938
6006
|
|
|
@@ -5990,7 +6058,41 @@ var buildChartGraphicFrame = (opts) => {
|
|
|
5990
6058
|
const graphic = elem(NAME_GRAPHIC2, { children: [graphicData] });
|
|
5991
6059
|
return elem(NAME_GRAPHIC_FRAME2, { children: [nvGraphicFramePr, xfrm, graphic] });
|
|
5992
6060
|
};
|
|
6061
|
+
var checkChartColor = (value, label) => {
|
|
6062
|
+
if (value === null || value === void 0) return;
|
|
6063
|
+
if (parseSrgbHex(value) === null) {
|
|
6064
|
+
throw new Error(
|
|
6065
|
+
`${label}: invalid chart color ${JSON.stringify(value)} \u2014 expected an sRGB hex like "#4472C4" or "4472C4"`
|
|
6066
|
+
);
|
|
6067
|
+
}
|
|
6068
|
+
};
|
|
6069
|
+
var validateChartSpecColors = (spec) => {
|
|
6070
|
+
checkChartColor(spec.plotAreaFill, "addSlideChart: plotAreaFill");
|
|
6071
|
+
checkChartColor(spec.plotAreaStrokeColor, "addSlideChart: plotAreaStrokeColor");
|
|
6072
|
+
checkChartColor(spec.chartAreaFill, "addSlideChart: chartAreaFill");
|
|
6073
|
+
checkChartColor(spec.chartAreaStrokeColor, "addSlideChart: chartAreaStrokeColor");
|
|
6074
|
+
checkChartColor(spec.valueAxisMajorGridlineColor, "addSlideChart: valueAxisMajorGridlineColor");
|
|
6075
|
+
checkChartColor(spec.valueAxisMinorGridlineColor, "addSlideChart: valueAxisMinorGridlineColor");
|
|
6076
|
+
checkChartColor(
|
|
6077
|
+
spec.categoryAxisMajorGridlineColor,
|
|
6078
|
+
"addSlideChart: categoryAxisMajorGridlineColor"
|
|
6079
|
+
);
|
|
6080
|
+
checkChartColor(
|
|
6081
|
+
spec.categoryAxisMinorGridlineColor,
|
|
6082
|
+
"addSlideChart: categoryAxisMinorGridlineColor"
|
|
6083
|
+
);
|
|
6084
|
+
checkChartColor(spec.valueAxisLineColor, "addSlideChart: valueAxisLineColor");
|
|
6085
|
+
checkChartColor(spec.categoryAxisLineColor, "addSlideChart: categoryAxisLineColor");
|
|
6086
|
+
spec.series.forEach((series, i) => {
|
|
6087
|
+
checkChartColor(series.color, `addSlideChart: series[${i}].color`);
|
|
6088
|
+
checkChartColor(series.trendline?.color, `addSlideChart: series[${i}].trendline.color`);
|
|
6089
|
+
series.pointColors?.forEach((c2, j) => {
|
|
6090
|
+
checkChartColor(c2, `addSlideChart: series[${i}].pointColors[${j}]`);
|
|
6091
|
+
});
|
|
6092
|
+
});
|
|
6093
|
+
};
|
|
5993
6094
|
var addSlideChart = (slide, opts) => {
|
|
6095
|
+
validateChartSpecColors(opts.spec);
|
|
5994
6096
|
const pkg = slide[INTERNAL_PACKAGE];
|
|
5995
6097
|
const chartN = allocateChartIndex(pkg);
|
|
5996
6098
|
const chartPartName = partName(`/ppt/charts/chart${chartN}.xml`);
|
|
@@ -6004,7 +6106,7 @@ var addSlideChart = (slide, opts) => {
|
|
|
6004
6106
|
xlsxRows
|
|
6005
6107
|
);
|
|
6006
6108
|
const chartDoc = buildChartSpaceDoc(opts.spec);
|
|
6007
|
-
const chartBytes =
|
|
6109
|
+
const chartBytes = encode3(serializeXml(chartDoc));
|
|
6008
6110
|
pkg.addPart(chartPartName, CHART_CONTENT_TYPE, chartBytes);
|
|
6009
6111
|
pkg.addPart(xlsxPartName, EMBEDDED_XLSX_CONTENT_TYPE, xlsxBytes);
|
|
6010
6112
|
setOpcDefault(pkg, "rels", "application/vnd.openxmlformats-package.relationships+xml");
|
|
@@ -6057,6 +6159,7 @@ var resolveChartPartName = (slide, shape) => {
|
|
|
6057
6159
|
return { partName: partNameValue, rId };
|
|
6058
6160
|
};
|
|
6059
6161
|
var setChartSpec = (chart, spec) => {
|
|
6162
|
+
validateChartSpecColors(spec);
|
|
6060
6163
|
const slide = chart.shape[SHAPE_SLIDE];
|
|
6061
6164
|
const pkg = slide[INTERNAL_PACKAGE];
|
|
6062
6165
|
const resolved = resolveChartPartName(slide, chart.shape);
|
|
@@ -6064,7 +6167,7 @@ var setChartSpec = (chart, spec) => {
|
|
|
6064
6167
|
throw new Error("setChartSpec: shape is not a chart graphic frame");
|
|
6065
6168
|
}
|
|
6066
6169
|
const doc = buildChartSpaceDoc(spec);
|
|
6067
|
-
const chartBytes =
|
|
6170
|
+
const chartBytes = encode3(serializeXml(doc));
|
|
6068
6171
|
const chartPart = pkg.getPart(resolved.partName);
|
|
6069
6172
|
if (!chartPart) {
|
|
6070
6173
|
throw new Error(`setChartSpec: chart part ${resolved.partName} not found`);
|
|
@@ -6653,7 +6756,7 @@ var getSlideLayouts = (pres) => {
|
|
|
6653
6756
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
6654
6757
|
const out = [];
|
|
6655
6758
|
for (const part of pkg.parts) {
|
|
6656
|
-
if (part.contentType !==
|
|
6759
|
+
if (part.contentType !== SLIDE_LAYOUT_CONTENT_TYPE2) continue;
|
|
6657
6760
|
const root = parseXml(decode2(part.data)).root;
|
|
6658
6761
|
out.push({
|
|
6659
6762
|
[LAYOUT_PART_NAME]: part.name,
|
|
@@ -6747,7 +6850,7 @@ var getCoreProperties = (pres) => {
|
|
|
6747
6850
|
category: read(NS_CORE_PROPS, "category")
|
|
6748
6851
|
};
|
|
6749
6852
|
};
|
|
6750
|
-
var
|
|
6853
|
+
var CORE_PROPS_CONTENT_TYPE2 = "application/vnd.openxmlformats-package.core-properties+xml";
|
|
6751
6854
|
var CORE_PROP_FIELDS = [
|
|
6752
6855
|
{ key: "title", uri: NS_DC, prefix: "dc", local: "title" },
|
|
6753
6856
|
{ key: "subject", uri: NS_DC, prefix: "dc", local: "subject" },
|
|
@@ -6803,16 +6906,16 @@ var setCoreProperties = (pres, values) => {
|
|
|
6803
6906
|
root.children.push(elem(name, { children: [text(value)] }));
|
|
6804
6907
|
}
|
|
6805
6908
|
}
|
|
6806
|
-
const bytes =
|
|
6909
|
+
const bytes = encode3(serializeXml(doc));
|
|
6807
6910
|
if (part) {
|
|
6808
6911
|
part.data = bytes;
|
|
6809
6912
|
return;
|
|
6810
6913
|
}
|
|
6811
6914
|
pkg.contentTypes.overrides.push({
|
|
6812
6915
|
partName: CORE_PROPS_PART_NAME,
|
|
6813
|
-
contentType:
|
|
6916
|
+
contentType: CORE_PROPS_CONTENT_TYPE2
|
|
6814
6917
|
});
|
|
6815
|
-
pkg.addPart(CORE_PROPS_PART_NAME,
|
|
6918
|
+
pkg.addPart(CORE_PROPS_PART_NAME, CORE_PROPS_CONTENT_TYPE2, bytes);
|
|
6816
6919
|
const rootRels = pkg.rootRels() ?? emptyRels();
|
|
6817
6920
|
const rId = nextRelId(rootRels.items.map((r2) => r2.id));
|
|
6818
6921
|
rootRels.items.push({
|
|
@@ -6876,7 +6979,7 @@ var setExtendedProperties = (pres, values) => {
|
|
|
6876
6979
|
doc.root.children.push(elem(name, { children: [text(value)] }));
|
|
6877
6980
|
}
|
|
6878
6981
|
}
|
|
6879
|
-
part.data =
|
|
6982
|
+
part.data = encode3(serializeXml(doc));
|
|
6880
6983
|
};
|
|
6881
6984
|
|
|
6882
6985
|
// src/api/fn/thumbnail.ts
|
|
@@ -9046,7 +9149,7 @@ var setSlideNotes = (slide, value) => {
|
|
|
9046
9149
|
const txBody = firstChildElement(child, qname("p", "txBody", NS.pml));
|
|
9047
9150
|
if (!txBody) continue;
|
|
9048
9151
|
setTextBody(txBody, value);
|
|
9049
|
-
part.data =
|
|
9152
|
+
part.data = encode3(serializeXml(doc2));
|
|
9050
9153
|
return;
|
|
9051
9154
|
}
|
|
9052
9155
|
throw new Error("notesSlide has no body placeholder to fill");
|
|
@@ -9066,7 +9169,7 @@ var setSlideNotes = (slide, value) => {
|
|
|
9066
9169
|
pkg.addPart(
|
|
9067
9170
|
notesName,
|
|
9068
9171
|
"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",
|
|
9069
|
-
|
|
9172
|
+
encode3(serializeXml(doc))
|
|
9070
9173
|
);
|
|
9071
9174
|
const notesRels = emptyRels();
|
|
9072
9175
|
const slideBase = slide[SLIDE_PART_NAME].split("/").pop() ?? "slide.xml";
|
|
@@ -9156,7 +9259,7 @@ var setSlideSize = (pres, opts) => {
|
|
|
9156
9259
|
}
|
|
9157
9260
|
sldSz.attrs = [attr(ATTR_CX9, String(opts.width)), attr(ATTR_CY9, String(opts.height))];
|
|
9158
9261
|
if (opts.type !== void 0) sldSz.attrs.push(attr(ATTR_TYPE8, opts.type));
|
|
9159
|
-
presPart.data =
|
|
9262
|
+
presPart.data = encode3(serializeXml(doc));
|
|
9160
9263
|
};
|
|
9161
9264
|
var SLIDE_SIZE_4_3 = {
|
|
9162
9265
|
width: emu(9144e3),
|
|
@@ -12458,7 +12561,7 @@ var getSlideLayoutCount = (pres) => {
|
|
|
12458
12561
|
const pkg = pres[INTERNAL_PACKAGE];
|
|
12459
12562
|
let n = 0;
|
|
12460
12563
|
for (const part of pkg.parts) {
|
|
12461
|
-
if (part.contentType ===
|
|
12564
|
+
if (part.contentType === SLIDE_LAYOUT_CONTENT_TYPE2) n++;
|
|
12462
12565
|
}
|
|
12463
12566
|
return n;
|
|
12464
12567
|
};
|
|
@@ -12681,7 +12784,7 @@ var replaceTokensInPresentation = (pres, tokens) => {
|
|
|
12681
12784
|
const doc = parseXml(decode2(part.data));
|
|
12682
12785
|
const n = replaceTokensInTree(doc.root, tokens);
|
|
12683
12786
|
if (n > 0) {
|
|
12684
|
-
part.data =
|
|
12787
|
+
part.data = encode3(serializeXml(doc));
|
|
12685
12788
|
count += n;
|
|
12686
12789
|
}
|
|
12687
12790
|
}
|
|
@@ -12696,7 +12799,7 @@ var replaceTextInPresentation = (pres, from, to) => {
|
|
|
12696
12799
|
const doc = parseXml(decode2(part.data));
|
|
12697
12800
|
const n = replaceTextInTree(doc.root, from, to);
|
|
12698
12801
|
if (n > 0) {
|
|
12699
|
-
part.data =
|
|
12802
|
+
part.data = encode3(serializeXml(doc));
|
|
12700
12803
|
count += n;
|
|
12701
12804
|
}
|
|
12702
12805
|
}
|
|
@@ -12833,7 +12936,7 @@ var setSlideSections = (pres, sections) => {
|
|
|
12833
12936
|
doc.root.children = doc.root.children.filter((c2) => c2 !== extLst);
|
|
12834
12937
|
}
|
|
12835
12938
|
}
|
|
12836
|
-
presPart.data =
|
|
12939
|
+
presPart.data = encode3(serializeXml(doc));
|
|
12837
12940
|
return;
|
|
12838
12941
|
}
|
|
12839
12942
|
const sectionLst = ensureSectionLst(doc.root);
|
|
@@ -12852,7 +12955,7 @@ var setSlideSections = (pres, sections) => {
|
|
|
12852
12955
|
children: [elem(NAME_P14_SLD_ID_LST, { children: sldIds })]
|
|
12853
12956
|
});
|
|
12854
12957
|
});
|
|
12855
|
-
presPart.data =
|
|
12958
|
+
presPart.data = encode3(serializeXml(doc));
|
|
12856
12959
|
};
|
|
12857
12960
|
|
|
12858
12961
|
// src/api/fn/slide-deck.ts
|
|
@@ -12961,7 +13064,7 @@ var addSlide = (pres, options) => {
|
|
|
12961
13064
|
const layoutSpTree = firstChildElement(layoutCsld, NAME_SP_TREE4);
|
|
12962
13065
|
if (!layoutSpTree) throw new Error(`layout ${layoutPartName} missing <p:spTree>`);
|
|
12963
13066
|
const slideDoc = buildSlideFromLayout(layoutSpTree);
|
|
12964
|
-
const slideBytes =
|
|
13067
|
+
const slideBytes = encode3(serializeXml(slideDoc));
|
|
12965
13068
|
pkg.addPart(newSlidePartName, SLIDE_CONTENT_TYPE, slideBytes);
|
|
12966
13069
|
const slideRels = emptyRels();
|
|
12967
13070
|
slideRels.items.push({
|
|
@@ -12985,7 +13088,7 @@ var addSlide = (pres, options) => {
|
|
|
12985
13088
|
attrs: [attr(ATTR_ID13, String(newSldId)), attr(ATTR_R_ID3, newRId)]
|
|
12986
13089
|
})
|
|
12987
13090
|
);
|
|
12988
|
-
presPart.data =
|
|
13091
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
12989
13092
|
pres._slidesCache = null;
|
|
12990
13093
|
const slides = getSlides(pres);
|
|
12991
13094
|
const last = slides[slides.length - 1];
|
|
@@ -13020,7 +13123,7 @@ var removeSlide = (pres, slide) => {
|
|
|
13020
13123
|
return getAttrValue(c2, ATTR_R_ID3) !== removedRel.id;
|
|
13021
13124
|
});
|
|
13022
13125
|
}
|
|
13023
|
-
presPart.data =
|
|
13126
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13024
13127
|
pkg.removePart(relsPartNameFor(slidePartName));
|
|
13025
13128
|
pkg.removePart(slidePartName);
|
|
13026
13129
|
pres._slidesCache = null;
|
|
@@ -13063,7 +13166,7 @@ var sortSlides = (pres, compareFn) => {
|
|
|
13063
13166
|
(c2) => !(c2.kind === "element" && c2.name.namespaceURI === NS.pml && c2.name.localName === "sldId")
|
|
13064
13167
|
);
|
|
13065
13168
|
sldIdLst.children = [...nonSldIdChildren, ...newOrder];
|
|
13066
|
-
presPart.data =
|
|
13169
|
+
presPart.data = encode3(serializeXml(doc));
|
|
13067
13170
|
pres._slidesCache = null;
|
|
13068
13171
|
};
|
|
13069
13172
|
var reverseSlides = (pres) => {
|
|
@@ -13115,7 +13218,7 @@ var moveSlide = (pres, slide, toIndex) => {
|
|
|
13115
13218
|
remaining.splice(insertAt, 0, target);
|
|
13116
13219
|
}
|
|
13117
13220
|
sldIdLst.children = remaining;
|
|
13118
|
-
presPart.data =
|
|
13221
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13119
13222
|
pres._slidesCache = null;
|
|
13120
13223
|
};
|
|
13121
13224
|
var duplicateSlide = (pres, slide) => {
|
|
@@ -13149,7 +13252,7 @@ var duplicateSlide = (pres, slide) => {
|
|
|
13149
13252
|
attrs: [attr(ATTR_ID13, String(newSldId)), attr(ATTR_R_ID3, newRId)]
|
|
13150
13253
|
})
|
|
13151
13254
|
);
|
|
13152
|
-
presPart.data =
|
|
13255
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13153
13256
|
pres._slidesCache = null;
|
|
13154
13257
|
const slides = getSlides(pres);
|
|
13155
13258
|
const dup = slides[slides.length - 1];
|
|
@@ -13247,7 +13350,7 @@ var importSlide = (targetPres, sourceSlide, targetLayout) => {
|
|
|
13247
13350
|
attrs: [attr(ATTR_ID13, String(newSldId)), attr(ATTR_R_ID3, newRId)]
|
|
13248
13351
|
})
|
|
13249
13352
|
);
|
|
13250
|
-
presPart.data =
|
|
13353
|
+
presPart.data = encode3(serializeXml(presDoc));
|
|
13251
13354
|
targetPres._slidesCache = null;
|
|
13252
13355
|
const slides = getSlides(targetPres);
|
|
13253
13356
|
const last = slides[slides.length - 1];
|
|
@@ -13267,7 +13370,7 @@ var mergePresentations = (targetPres, sourcePres, targetLayout) => {
|
|
|
13267
13370
|
};
|
|
13268
13371
|
|
|
13269
13372
|
// src/api/index.ts
|
|
13270
|
-
var VERSION = "0.
|
|
13373
|
+
var VERSION = "0.3.0" ;
|
|
13271
13374
|
|
|
13272
13375
|
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 };
|
|
13273
13376
|
//# sourceMappingURL=index.js.map
|