pptx-kit 0.6.0 → 0.6.2

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/dist/node.js CHANGED
@@ -1127,6 +1127,7 @@ var VIEW_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.pre
1127
1127
  var SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
1128
1128
  var SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
1129
1129
  var THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
1130
+ var TABLE_STYLES_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml";
1130
1131
  var CORE_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-package.core-properties+xml";
1131
1132
  var EXTENDED_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.extended-properties+xml";
1132
1133
  var XML_DECL = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';
@@ -1140,10 +1141,11 @@ var LAYOUT_OBJ_XML = `${XML_DECL}<p:sldLayout xmlns:a="http://schemas.openxmlfor
1140
1141
  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>`;
1141
1142
  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"/>`;
1142
1143
  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"/>`;
1144
+ var TABLE_STYLES_XML = `${XML_DECL}<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/>`;
1143
1145
  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>`;
1144
1146
  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>`;
1145
1147
  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>`;
1146
- 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>`;
1148
+ 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"/><Relationship Id="rId5" Type="${RT}/tableStyles" Target="tableStyles.xml"/></Relationships>`;
1147
1149
  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>`;
1148
1150
  var LAYOUT_RELS_XML = `${XML_DECL}<Relationships xmlns="${RT_PACKAGE}"><Relationship Id="rId1" Type="${RT}/slideMaster" Target="../slideMasters/slideMaster1.xml"/></Relationships>`;
1149
1151
  var TEXT_ENCODER2 = new TextEncoder();
@@ -1161,6 +1163,7 @@ var buildBlankDeck = (aspect) => {
1161
1163
  add("/ppt/presProps.xml", PRES_PROPS_CONTENT_TYPE, PRES_PROPS_XML);
1162
1164
  add("/ppt/viewProps.xml", VIEW_PROPS_CONTENT_TYPE, VIEW_PROPS_XML);
1163
1165
  add("/ppt/theme/theme1.xml", THEME_CONTENT_TYPE, THEME_XML);
1166
+ add("/ppt/tableStyles.xml", TABLE_STYLES_CONTENT_TYPE, TABLE_STYLES_XML);
1164
1167
  add("/ppt/slideMasters/slideMaster1.xml", SLIDE_MASTER_CONTENT_TYPE, SLIDE_MASTER_XML);
1165
1168
  add("/ppt/slideLayouts/slideLayout1.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_BLANK_XML);
1166
1169
  add("/ppt/slideLayouts/slideLayout2.xml", SLIDE_LAYOUT_CONTENT_TYPE, LAYOUT_TITLE_XML);
@@ -1506,6 +1509,17 @@ var applyAlignmentToAllParagraphs = (txBody, align) => {
1506
1509
  pPr.attrs.push(attr(ATTR_ALGN, token));
1507
1510
  }
1508
1511
  };
1512
+ var BULLET_INDENT_BY_LEVEL = [
1513
+ { marL: 342900, indent: -342900 },
1514
+ { marL: 742950, indent: -285750 },
1515
+ { marL: 1143e3, indent: -228600 },
1516
+ { marL: 1600200, indent: -228600 },
1517
+ { marL: 2057400, indent: -228600 }
1518
+ ];
1519
+ var bulletIndentForLevel = (lvl) => BULLET_INDENT_BY_LEVEL[Math.min(lvl, BULLET_INDENT_BY_LEVEL.length - 1)];
1520
+ var ATTR_MAR_L = qname("", "marL", "");
1521
+ var ATTR_INDENT = qname("", "indent", "");
1522
+ var hasAttr = (el, local) => el.attrs.some((a2) => a2.name.namespaceURI === "" && a2.name.localName === local);
1509
1523
  var applyBulletToParagraph = (paragraph, style) => {
1510
1524
  let pPr = firstChildElement(paragraph, NAME_PPR_FOR_BULLET);
1511
1525
  if (pPr === null) {
@@ -1515,6 +1529,15 @@ var applyBulletToParagraph = (paragraph, style) => {
1515
1529
  pPr.children = pPr.children.filter(
1516
1530
  (c2) => !(c2.kind === "element" && c2.name.namespaceURI === NS.dml && (c2.name.localName === "buChar" || c2.name.localName === "buAutoNum" || c2.name.localName === "buNone"))
1517
1531
  );
1532
+ if (style !== "none") {
1533
+ const lvl = Number.parseInt(
1534
+ pPr.attrs.find((a2) => a2.name.localName === "lvl")?.value ?? "0",
1535
+ 10
1536
+ );
1537
+ const { marL, indent } = bulletIndentForLevel(Number.isFinite(lvl) ? lvl : 0);
1538
+ if (!hasAttr(pPr, "marL")) pPr.attrs.push(attr(ATTR_MAR_L, String(marL)));
1539
+ if (!hasAttr(pPr, "indent")) pPr.attrs.push(attr(ATTR_INDENT, String(indent)));
1540
+ }
1518
1541
  pPr.children.push(buildBulletElement(style));
1519
1542
  };
1520
1543
  var applyBulletToAllParagraphs = (txBody, style) => {
@@ -2929,6 +2952,7 @@ var buildPicture = (opts) => {
2929
2952
 
2930
2953
  // src/internal/presentationml/table-builder.ts
2931
2954
  var TABLE_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
2955
+ var DEFAULT_TABLE_STYLE_ID = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
2932
2956
  var NAME_GRAPHIC_FRAME = qname("p", "graphicFrame", NS.pml);
2933
2957
  var NAME_NV_GRAPHIC_FRAME_PR2 = qname("p", "nvGraphicFramePr", NS.pml);
2934
2958
  var NAME_C_NV_PR7 = qname("p", "cNvPr", NS.pml);
@@ -2942,6 +2966,7 @@ var NAME_GRAPHIC = qname("a", "graphic", NS.dml);
2942
2966
  var NAME_GRAPHIC_DATA = qname("a", "graphicData", NS.dml);
2943
2967
  var NAME_TBL = qname("a", "tbl", NS.dml);
2944
2968
  var NAME_TBL_PR = qname("a", "tblPr", NS.dml);
2969
+ var NAME_TABLE_STYLE_ID = qname("a", "tableStyleId", NS.dml);
2945
2970
  var NAME_TBL_GRID = qname("a", "tblGrid", NS.dml);
2946
2971
  var NAME_GRID_COL = qname("a", "gridCol", NS.dml);
2947
2972
  var NAME_TR = qname("a", "tr", NS.dml);
@@ -3050,11 +3075,15 @@ var buildTable = (opts) => {
3050
3075
  attrs: [attr(ATTR_CX8, String(Math.round(opts.w))), attr(ATTR_CY8, String(Math.round(opts.h)))]
3051
3076
  });
3052
3077
  const xfrm = elem(NAME_P_XFRM3, { children: [off, ext] });
3078
+ const tableStyleId = elem(NAME_TABLE_STYLE_ID, {
3079
+ children: [text(opts.styleId ?? DEFAULT_TABLE_STYLE_ID)]
3080
+ });
3053
3081
  const tblPr = elem(NAME_TBL_PR, {
3054
3082
  attrs: [
3055
3083
  attr(ATTR_FIRST_ROW, opts.firstRow ?? true ? "1" : "0"),
3056
3084
  attr(ATTR_BAND_ROW, opts.bandRow ?? true ? "1" : "0")
3057
- ]
3085
+ ],
3086
+ children: [tableStyleId]
3058
3087
  });
3059
3088
  const tblGrid = elem(NAME_TBL_GRID, {
3060
3089
  children: colWidths.map(
@@ -4450,7 +4479,7 @@ var seriesElement = (spec, seriesIdx, sheet) => {
4450
4479
  valNode(c("order"), seriesIdx),
4451
4480
  elem(c("tx"), { children: [strRef(headerCellFormula, [series.name])] })
4452
4481
  ];
4453
- if (series.lineWidthEmu !== void 0 || series.lineDash !== void 0) {
4482
+ if (spec.kind === "line" || series.lineWidthEmu !== void 0 || series.lineDash !== void 0) {
4454
4483
  children.push(seriesSpPr(color, series.lineWidthEmu, series.lineDash));
4455
4484
  } else {
4456
4485
  children.push(solidFillSpPr(color));
@@ -4693,7 +4722,7 @@ var buildLineChart = (spec, sheet) => {
4693
4722
  if (spec.dropLines) children.push(elem(c("dropLines")));
4694
4723
  if (spec.hiLowLines) children.push(elem(c("hiLowLines")));
4695
4724
  children.push(
4696
- valNode(c("marker"), "1"),
4725
+ valNode(c("marker"), spec.lineMarkers === false ? "0" : "1"),
4697
4726
  valNode(c("axId"), CAT_AX_ID),
4698
4727
  valNode(c("axId"), VAL_AX_ID)
4699
4728
  );
@@ -4923,6 +4952,9 @@ var NAME_STR_CACHE = qname("c", "strCache", NS_C2);
4923
4952
  var NAME_NUM_CACHE = qname("c", "numCache", NS_C2);
4924
4953
  var NAME_STR_LIT = qname("c", "strLit", NS_C2);
4925
4954
  var NAME_NUM_LIT = qname("c", "numLit", NS_C2);
4955
+ var NAME_MULTI_LVL_STR_REF = qname("c", "multiLvlStrRef", NS_C2);
4956
+ var NAME_MULTI_LVL_STR_CACHE = qname("c", "multiLvlStrCache", NS_C2);
4957
+ var NAME_LVL = qname("c", "lvl", NS_C2);
4926
4958
  var NAME_PT = qname("c", "pt", NS_C2);
4927
4959
  var NAME_V = qname("c", "v", NS_C2);
4928
4960
  var NAME_TITLE = qname("c", "title", NS_C2);
@@ -4997,6 +5029,12 @@ var readStringChannel = (parent) => {
4997
5029
  }
4998
5030
  const lit = firstChildElement(parent, NAME_STR_LIT);
4999
5031
  if (lit) return readPtArray(lit);
5032
+ const multi = firstChildElement(parent, NAME_MULTI_LVL_STR_REF);
5033
+ if (multi) {
5034
+ const cache = firstChildElement(multi, NAME_MULTI_LVL_STR_CACHE);
5035
+ const lvl = cache ? firstChildElement(cache, NAME_LVL) : null;
5036
+ if (lvl) return readPtArray(lvl);
5037
+ }
5000
5038
  return null;
5001
5039
  };
5002
5040
  var readStringRef = (parent) => readStringChannel(parent);
@@ -5577,6 +5615,16 @@ var readChartSpec = (root) => {
5577
5615
  const hiLowLinesEl = firstChildElement(plotted, qname("c", "hiLowLines", NS_C2));
5578
5616
  const dropLines = dropLinesEl !== null ? true : void 0;
5579
5617
  const hiLowLines = hiLowLinesEl !== null ? true : void 0;
5618
+ let lineMarkers;
5619
+ if (kind === "line") {
5620
+ const markerEl = firstChildElement(plotted, qname("c", "marker", NS_C2));
5621
+ if (markerEl === null) {
5622
+ lineMarkers = false;
5623
+ } else {
5624
+ const v = getAttrValue(markerEl, ATTR_VAL8);
5625
+ lineMarkers = v === null ? true : v === "1" || v === "true";
5626
+ }
5627
+ }
5580
5628
  let gapWidthPct;
5581
5629
  let overlapPct;
5582
5630
  if (kind === "column" || kind === "bar") {
@@ -5989,6 +6037,7 @@ var readChartSpec = (root) => {
5989
6037
  ...grouping !== void 0 ? { grouping } : {},
5990
6038
  ...dropLines !== void 0 ? { dropLines } : {},
5991
6039
  ...hiLowLines !== void 0 ? { hiLowLines } : {},
6040
+ ...lineMarkers !== void 0 ? { lineMarkers } : {},
5992
6041
  ...gapWidthPct !== void 0 ? { gapWidthPct } : {},
5993
6042
  ...overlapPct !== void 0 ? { overlapPct } : {},
5994
6043
  ...legend !== void 0 ? { legend } : {},
@@ -13653,7 +13702,7 @@ var mergePresentations = (targetPres, sourcePres, targetLayout) => {
13653
13702
  };
13654
13703
 
13655
13704
  // src/api/index.ts
13656
- var VERSION = "0.6.0" ;
13705
+ var VERSION = "0.6.2" ;
13657
13706
 
13658
13707
  // src/node.ts
13659
13708
  var loadPresentationFile = async (path) => {