js.documents 1.71.0 → 1.72.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.
@@ -45,7 +45,7 @@ var OdpSlide = class {
45
45
  shapes() {
46
46
  const node = this.live();
47
47
  const out = [];
48
- for (const child of node.children) if (child.type === "element" && child.tag === "draw:frame") out.push(new require_edit_odp_shape.OdpShape(node.children, child, this.context.pkg));
48
+ for (const child of node.children) if (child.type === "element" && child.tag === "draw:frame" && directChild(child, "table:table") === void 0) out.push(new require_edit_odp_shape.OdpShape(node.children, child, this.context.pkg));
49
49
  return out;
50
50
  }
51
51
  addTextBox(init) {
@@ -71,6 +71,20 @@ var OdpSlide = class {
71
71
  table: new require_edit_odt_table.OdtTable(frameElement.children, tableElement, this.context.pkg)
72
72
  };
73
73
  }
74
+ tables() {
75
+ const node = this.live();
76
+ const out = [];
77
+ for (const child of node.children) {
78
+ if (child.type !== "element" || child.tag !== "draw:frame") continue;
79
+ const tableElement = directChild(child, "table:table");
80
+ if (tableElement === void 0) continue;
81
+ out.push({
82
+ shape: new require_edit_odp_shape.OdpShape(node.children, child, this.context.pkg),
83
+ table: new require_edit_odt_table.OdtTable(child.children, tableElement, this.context.pkg)
84
+ });
85
+ }
86
+ return out;
87
+ }
74
88
  addVector(vector) {
75
89
  return require_edit_odg_vector.appendVectorTo(this.live().children, this.context.pkg, vector);
76
90
  }
@@ -35,6 +35,7 @@ declare class OdpSlide {
35
35
  addTextBox(init: TextBoxInit): OdpShape;
36
36
  addImage(init: SlideImageInit): OdpShape;
37
37
  addTable(init: SlideTableInit): OdpTableShape;
38
+ tables(): OdpTableShape[];
38
39
  addVector(vector: ContentVector): OdgVector;
39
40
  get notes(): string;
40
41
  set notes(value: string);
@@ -35,6 +35,7 @@ declare class OdpSlide {
35
35
  addTextBox(init: TextBoxInit): OdpShape;
36
36
  addImage(init: SlideImageInit): OdpShape;
37
37
  addTable(init: SlideTableInit): OdpTableShape;
38
+ tables(): OdpTableShape[];
38
39
  addVector(vector: ContentVector): OdgVector;
39
40
  get notes(): string;
40
41
  set notes(value: string);
@@ -44,7 +44,7 @@ var OdpSlide = class {
44
44
  shapes() {
45
45
  const node = this.live();
46
46
  const out = [];
47
- for (const child of node.children) if (child.type === "element" && child.tag === "draw:frame") out.push(new OdpShape(node.children, child, this.context.pkg));
47
+ for (const child of node.children) if (child.type === "element" && child.tag === "draw:frame" && directChild(child, "table:table") === void 0) out.push(new OdpShape(node.children, child, this.context.pkg));
48
48
  return out;
49
49
  }
50
50
  addTextBox(init) {
@@ -70,6 +70,20 @@ var OdpSlide = class {
70
70
  table: new OdtTable(frameElement.children, tableElement, this.context.pkg)
71
71
  };
72
72
  }
73
+ tables() {
74
+ const node = this.live();
75
+ const out = [];
76
+ for (const child of node.children) {
77
+ if (child.type !== "element" || child.tag !== "draw:frame") continue;
78
+ const tableElement = directChild(child, "table:table");
79
+ if (tableElement === void 0) continue;
80
+ out.push({
81
+ shape: new OdpShape(node.children, child, this.context.pkg),
82
+ table: new OdtTable(child.children, tableElement, this.context.pkg)
83
+ });
84
+ }
85
+ return out;
86
+ }
73
87
  addVector(vector) {
74
88
  return appendVectorTo(this.live().children, this.context.pkg, vector);
75
89
  }
@@ -92,6 +92,16 @@ var PptxSlide = class {
92
92
  for (const child of spTree.children) if (child.type === "element" && (child.tag === "p:sp" || child.tag === "p:pic")) out.push(new require_edit_pptx_shape.PptxShape(spTree.children, child));
93
93
  return out;
94
94
  }
95
+ tables() {
96
+ const spTree = findSpTree(this.live());
97
+ const out = [];
98
+ for (const child of spTree.children) {
99
+ if (child.type !== "element" || child.tag !== "p:graphicFrame") continue;
100
+ const tableElement = require_edit_pptx_table.findGraphicFrameTable(child);
101
+ if (tableElement !== void 0) out.push(new require_edit_pptx_table.PptxTable(tableElement));
102
+ }
103
+ return out;
104
+ }
95
105
  addTextBox(init) {
96
106
  const spTree = findSpTree(this.live());
97
107
  const id = nextIdIn(spTree);
@@ -1,7 +1,7 @@
1
1
  import { t as Box$1 } from "../../geometry-DaJr8yQW.cjs";
2
2
  import { t as ImageInit } from "../../image-7snmKIxn.cjs";
3
3
  import { r as PptxShape } from "../../shape-BhkP6HB8.cjs";
4
- import { r as PptxTableInit, t as PptxTable } from "../../table-C3CPZ--2.cjs";
4
+ import { r as PptxTableInit, t as PptxTable } from "../../table-CfRjVOFN.cjs";
5
5
  import { ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "ooxml.js";
7
7
  //#region src/edit/pptx/slide.d.ts
@@ -30,6 +30,7 @@ declare class PptxSlide {
30
30
  constructor(container: XmlNode[], node: XmlElement, context: SlideContext);
31
31
  private live;
32
32
  shapes(): PptxShape[];
33
+ tables(): PptxTable[];
33
34
  addTextBox(init: TextBoxInit): PptxShape;
34
35
  addVector(vector: ContentVector): PptxShape;
35
36
  addImage(init: SlideImageInit): PptxShape;
@@ -1,7 +1,7 @@
1
1
  import { t as Box$1 } from "../../geometry-DaJr8yQW.js";
2
2
  import { t as ImageInit } from "../../image-Cs8xF753.js";
3
3
  import { r as PptxShape } from "../../shape-BjX3wlig.js";
4
- import { r as PptxTableInit, t as PptxTable } from "../../table-Db91eorq.js";
4
+ import { r as PptxTableInit, t as PptxTable } from "../../table-L5SxKy8_.js";
5
5
  import { Package, XmlElement, XmlNode } from "ooxml.js";
6
6
  import { ContentVector } from "document-schema.js";
7
7
  //#region src/edit/pptx/slide.d.ts
@@ -30,6 +30,7 @@ declare class PptxSlide {
30
30
  constructor(container: XmlNode[], node: XmlElement, context: SlideContext);
31
31
  private live;
32
32
  shapes(): PptxShape[];
33
+ tables(): PptxTable[];
33
34
  addTextBox(init: TextBoxInit): PptxShape;
34
35
  addVector(vector: ContentVector): PptxShape;
35
36
  addImage(init: SlideImageInit): PptxShape;
@@ -7,7 +7,7 @@ import { ensureContentTypeOverride } from "../../opc/content-types.js";
7
7
  import { DML_NS, NOTES_MASTER_REL_TYPE, PML_NS, buildEmptyGroupSpTree, ensureNotesMaster } from "./scaffold.js";
8
8
  import { PptxShape, buildTextBoxShape } from "./shape.js";
9
9
  import { insertPictureShapeMedia } from "./image.js";
10
- import { PptxTable, buildDrawingTable, buildTableGraphicFrame } from "./table.js";
10
+ import { PptxTable, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable } from "./table.js";
11
11
  import { buildVectorShape } from "./vector.js";
12
12
  import { resolveRelationships, rootElement, textContent } from "ooxml.js";
13
13
  //#region src/edit/pptx/slide.ts
@@ -91,6 +91,16 @@ var PptxSlide = class {
91
91
  for (const child of spTree.children) if (child.type === "element" && (child.tag === "p:sp" || child.tag === "p:pic")) out.push(new PptxShape(spTree.children, child));
92
92
  return out;
93
93
  }
94
+ tables() {
95
+ const spTree = findSpTree(this.live());
96
+ const out = [];
97
+ for (const child of spTree.children) {
98
+ if (child.type !== "element" || child.tag !== "p:graphicFrame") continue;
99
+ const tableElement = findGraphicFrameTable(child);
100
+ if (tableElement !== void 0) out.push(new PptxTable(tableElement));
101
+ }
102
+ return out;
103
+ }
94
104
  addTextBox(init) {
95
105
  const spTree = findSpTree(this.live());
96
106
  const id = nextIdIn(spTree);
@@ -128,9 +128,16 @@ function buildTableGraphicFrame(frame, tableElement, shapeId, rotationDeg) {
128
128
  require_xml_fragment.el("a:graphic", {}, [require_xml_fragment.el("a:graphicData", { uri: TABLE_GRAPHIC_URI }, [tableElement])])
129
129
  ]);
130
130
  }
131
+ function findGraphicFrameTable(graphicFrame) {
132
+ const graphic = require_xml_edit.directChildElement(graphicFrame, "a:graphic");
133
+ const graphicData = graphic === void 0 ? void 0 : require_xml_edit.directChildElement(graphic, "a:graphicData");
134
+ if (graphicData === void 0 || (0, ooxml_js.attr)(graphicData, "uri") !== TABLE_GRAPHIC_URI) return;
135
+ return require_xml_edit.directChildElement(graphicData, "a:tbl");
136
+ }
131
137
  //#endregion
132
138
  exports.PptxTable = PptxTable;
133
139
  exports.PptxTableCell = PptxTableCell;
134
140
  exports.PptxTableRow = PptxTableRow;
135
141
  exports.buildDrawingTable = buildDrawingTable;
136
142
  exports.buildTableGraphicFrame = buildTableGraphicFrame;
143
+ exports.findGraphicFrameTable = findGraphicFrameTable;
@@ -1,2 +1,2 @@
1
- import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, t as PptxTable } from "../../table-C3CPZ--2.cjs";
2
- export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame };
1
+ import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-CfRjVOFN.cjs";
2
+ export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
@@ -1,2 +1,2 @@
1
- import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, t as PptxTable } from "../../table-Db91eorq.js";
2
- export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame };
1
+ import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-L5SxKy8_.js";
2
+ export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
@@ -127,5 +127,11 @@ function buildTableGraphicFrame(frame, tableElement, shapeId, rotationDeg) {
127
127
  el("a:graphic", {}, [el("a:graphicData", { uri: TABLE_GRAPHIC_URI }, [tableElement])])
128
128
  ]);
129
129
  }
130
+ function findGraphicFrameTable(graphicFrame) {
131
+ const graphic = directChildElement(graphicFrame, "a:graphic");
132
+ const graphicData = graphic === void 0 ? void 0 : directChildElement(graphic, "a:graphicData");
133
+ if (graphicData === void 0 || attr(graphicData, "uri") !== TABLE_GRAPHIC_URI) return;
134
+ return directChildElement(graphicData, "a:tbl");
135
+ }
130
136
  //#endregion
131
- export { PptxTable, PptxTableCell, PptxTableRow, buildDrawingTable, buildTableGraphicFrame };
137
+ export { PptxTable, PptxTableCell, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
package/dist/index.d.cts CHANGED
@@ -42,7 +42,7 @@ import { CreateOdtOptions, OdtBody, OdtEditor, createOdt, openOdt } from "./edit
42
42
  import { CreateEmptyOdtPackageOptions } from "./edit/odt/scaffold.cjs";
43
43
  import { BuildPptxPackageOptions, buildPptxPackage } from "./edit/pptx/content.cjs";
44
44
  import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-BhkP6HB8.cjs";
45
- import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-C3CPZ--2.cjs";
45
+ import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-CfRjVOFN.cjs";
46
46
  import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.cjs";
47
47
  import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.cjs";
48
48
  import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.cjs";
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ import { CreateOdtOptions, OdtBody, OdtEditor, createOdt, openOdt } from "./edit
42
42
  import { CreateEmptyOdtPackageOptions } from "./edit/odt/scaffold.js";
43
43
  import { BuildPptxPackageOptions, buildPptxPackage } from "./edit/pptx/content.js";
44
44
  import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-BjX3wlig.js";
45
- import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-Db91eorq.js";
45
+ import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-L5SxKy8_.js";
46
46
  import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.js";
47
47
  import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.js";
48
48
  import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.js";
@@ -31,5 +31,6 @@ declare class PptxTable {
31
31
  }
32
32
  declare function buildDrawingTable(init: PptxTableInit): XmlElement;
33
33
  declare function buildTableGraphicFrame(frame: Box, tableElement: XmlElement, shapeId: number, rotationDeg: number | undefined): XmlElement;
34
+ declare function findGraphicFrameTable(graphicFrame: XmlElement): XmlElement | undefined;
34
35
  //#endregion
35
- export { buildDrawingTable as a, PptxTableRow as i, PptxTableCell as n, buildTableGraphicFrame as o, PptxTableInit as r, PptxTable as t };
36
+ export { buildDrawingTable as a, PptxTableRow as i, PptxTableCell as n, buildTableGraphicFrame as o, PptxTableInit as r, findGraphicFrameTable as s, PptxTable as t };
@@ -31,5 +31,6 @@ declare class PptxTable {
31
31
  }
32
32
  declare function buildDrawingTable(init: PptxTableInit): XmlElement;
33
33
  declare function buildTableGraphicFrame(frame: Box, tableElement: XmlElement, shapeId: number, rotationDeg: number | undefined): XmlElement;
34
+ declare function findGraphicFrameTable(graphicFrame: XmlElement): XmlElement | undefined;
34
35
  //#endregion
35
- export { buildDrawingTable as a, PptxTableRow as i, PptxTableCell as n, buildTableGraphicFrame as o, PptxTableInit as r, PptxTable as t };
36
+ export { buildDrawingTable as a, PptxTableRow as i, PptxTableCell as n, buildTableGraphicFrame as o, PptxTableInit as r, findGraphicFrameTable as s, PptxTable as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "1.71.0",
3
+ "version": "1.72.0",
4
4
  "description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {