dsh-office-tools 1.0.5 → 1.0.6

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-office-tools",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "main": "lib/index.js",
5
5
  "description": "Office tools for the model: create, read, and update Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files inside the session workspace through the official DSH filesystem service.",
6
6
  "engines": {
package/lib/index.js CHANGED
@@ -1519,7 +1519,7 @@ function sketchSlide(widthIn, heightIn, elements) {
1519
1519
  }
1520
1520
  };
1521
1521
  for (const element of elements) {
1522
- const label = element.type === "image" ? "IMG" : (element.text ?? element.type).split(/\s+/)[0]?.slice(0, 10) || element.type;
1522
+ const label = element.type === "image" ? "IMG" : element.type === "graphicFrame" ? "FRAME" : (element.text ?? element.type).split(/\s+/)[0]?.slice(0, 10) || element.type;
1523
1523
  drawRect(element.xIn, element.yIn, element.wIn, element.hIn, label);
1524
1524
  }
1525
1525
  const border = [];
@@ -1586,16 +1586,12 @@ function extractElements(slideXmlText) {
1586
1586
  };
1587
1587
  if (block.startsWith("<p:pic")) {
1588
1588
  const descr = block.match(PICTURE_DESCR)?.[1];
1589
- elements.push({ type: "image", ...base, alt: descr === void 0 ? void 0 : decodeXmlEntities(descr) });
1589
+ elements.push(descr === void 0 ? { type: "image", ...base } : { type: "image", ...base, alt: decodeXmlEntities(descr) });
1590
1590
  continue;
1591
1591
  }
1592
1592
  if (block.startsWith("<p:graphicFrame")) {
1593
1593
  const table = extractTables(block)[0];
1594
- elements.push({
1595
- type: "table",
1596
- ...base,
1597
- text: table === void 0 ? void 0 : `${table.length}x${table[0]?.length ?? 0}`
1598
- });
1594
+ elements.push(table === void 0 ? { type: "graphicFrame", ...base } : { type: "table", ...base, text: `${table.length}x${table[0]?.length ?? 0}` });
1599
1595
  continue;
1600
1596
  }
1601
1597
  const text = extractParagraphs(stripTables(block), false).join(" | ");
@@ -1647,7 +1643,7 @@ var ELEMENT_SCHEMA = {
1647
1643
  type: "object",
1648
1644
  additionalProperties: false,
1649
1645
  properties: {
1650
- type: { type: "string", required: true, description: "Element kind: text, bullets, image, or table." },
1646
+ type: { type: "string", required: true, description: "Element kind: text, bullets, image, table, or graphicFrame (an OLE object, chart, or other non-table frame)." },
1651
1647
  xIn: { type: "number", required: true, description: "Left edge in inches from the slide origin." },
1652
1648
  yIn: { type: "number", required: true, description: "Top edge in inches from the slide origin." },
1653
1649
  wIn: { type: "number", required: true, description: "Width in inches." },
@@ -44,7 +44,7 @@ interface PptCreateArgs {
44
44
  }
45
45
  /** One placed element, echoed by create and parsed back by read. */
46
46
  export interface SlideElementBox {
47
- type: 'text' | 'bullets' | 'image' | 'table';
47
+ type: 'text' | 'bullets' | 'image' | 'table' | 'graphicFrame';
48
48
  xIn: number;
49
49
  yIn: number;
50
50
  wIn: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-office-tools",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "DSH model-facing Office tools: create, read, and update Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files inside the session workspace, entirely through the official DSH filesystem service.",
5
5
  "license": "MIT",
6
6
  "type": "module",