js.documents 1.70.1 → 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.
Files changed (61) hide show
  1. package/dist/edit/odg/page.d.cts +1 -1
  2. package/dist/edit/odg/page.d.ts +1 -1
  3. package/dist/edit/odp/shape.d.cts +1 -1
  4. package/dist/edit/odp/shape.d.ts +1 -1
  5. package/dist/edit/odp/slide.cjs +15 -1
  6. package/dist/edit/odp/slide.d.cts +3 -2
  7. package/dist/edit/odp/slide.d.ts +3 -2
  8. package/dist/edit/odp/slide.js +15 -1
  9. package/dist/edit/odt/content.cjs +43 -0
  10. package/dist/edit/odt/content.d.cts +2 -2
  11. package/dist/edit/odt/content.d.ts +2 -2
  12. package/dist/edit/odt/content.js +43 -0
  13. package/dist/edit/odt/editor.d.cts +3 -3
  14. package/dist/edit/odt/editor.d.ts +3 -3
  15. package/dist/edit/odt/image.cjs +23 -0
  16. package/dist/edit/odt/image.d.cts +2 -0
  17. package/dist/edit/odt/image.d.ts +2 -0
  18. package/dist/edit/odt/image.js +21 -0
  19. package/dist/edit/odt/list.d.cts +1 -1
  20. package/dist/edit/odt/list.d.ts +1 -1
  21. package/dist/edit/odt/paragraph.cjs +11 -0
  22. package/dist/edit/odt/paragraph.d.cts +1 -1
  23. package/dist/edit/odt/paragraph.d.ts +1 -1
  24. package/dist/edit/odt/paragraph.js +11 -0
  25. package/dist/edit/odt/table.d.cts +1 -1
  26. package/dist/edit/odt/table.d.ts +1 -1
  27. package/dist/edit/pptx/slide.cjs +10 -0
  28. package/dist/edit/pptx/slide.d.cts +2 -1
  29. package/dist/edit/pptx/slide.d.ts +2 -1
  30. package/dist/edit/pptx/slide.js +11 -1
  31. package/dist/edit/pptx/table.cjs +7 -0
  32. package/dist/edit/pptx/table.d.cts +2 -2
  33. package/dist/edit/pptx/table.d.ts +2 -2
  34. package/dist/edit/pptx/table.js +7 -1
  35. package/dist/image-DwrOnL_Z.d.ts +14 -0
  36. package/dist/image-m_rfpuY8.d.cts +14 -0
  37. package/dist/index.d.cts +5 -5
  38. package/dist/index.d.ts +5 -5
  39. package/dist/{list-BJVehfU8.d.ts → list-7hZydHAV.d.ts} +1 -1
  40. package/dist/{list-BzcN-LTJ.d.cts → list-DXRaCcT1.d.cts} +1 -1
  41. package/dist/odf/formula/detect.cjs +2 -15
  42. package/dist/odf/formula/detect.js +2 -15
  43. package/dist/odf/image/detect.cjs +48 -0
  44. package/dist/odf/image/detect.d.cts +10 -0
  45. package/dist/odf/image/detect.d.ts +10 -0
  46. package/dist/odf/image/detect.js +47 -0
  47. package/dist/odf/odt/read.cjs +65 -11
  48. package/dist/odf/odt/read.js +65 -11
  49. package/dist/odf/shared/flow-anchor.cjs +19 -0
  50. package/dist/odf/shared/flow-anchor.d.cts +6 -0
  51. package/dist/odf/shared/flow-anchor.d.ts +6 -0
  52. package/dist/odf/shared/flow-anchor.js +18 -0
  53. package/dist/{paragraph-BXbXKPy3.d.cts → paragraph-Dlly6_E9.d.cts} +2 -0
  54. package/dist/{paragraph-CjtZP77X.d.ts → paragraph-kMJVZhAi.d.ts} +2 -0
  55. package/dist/{shape-C8qDhn0l.d.cts → shape-BR8GL8XC.d.cts} +2 -2
  56. package/dist/{shape-GV8i37zL.d.ts → shape-DeP-P4Nh.d.ts} +2 -2
  57. package/dist/{table-C3CPZ--2.d.cts → table-CfRjVOFN.d.cts} +2 -1
  58. package/dist/{table-Db91eorq.d.ts → table-L5SxKy8_.d.ts} +2 -1
  59. package/dist/{table-Vf6nCixr.d.ts → table-kvclAXS5.d.ts} +1 -1
  60. package/dist/{table-DjYcNOFm.d.cts → table-sEo1Jf8c.d.cts} +1 -1
  61. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { t as ImageInit } from "../../image-M5SezZVI.cjs";
2
- import { t as OdpShape } from "../../shape-C8qDhn0l.cjs";
2
+ import { t as OdpShape } from "../../shape-BR8GL8XC.cjs";
3
3
  import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-D03KX8Ux.cjs";
4
4
  import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "odf.js";
@@ -1,5 +1,5 @@
1
1
  import { t as ImageInit } from "../../image-DHcA9kaK.js";
2
- import { t as OdpShape } from "../../shape-GV8i37zL.js";
2
+ import { t as OdpShape } from "../../shape-DeP-P4Nh.js";
3
3
  import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-D03KX8Ux.js";
4
4
  import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "odf.js";
@@ -1,2 +1,2 @@
1
- import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-C8qDhn0l.cjs";
1
+ import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-BR8GL8XC.cjs";
2
2
  export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
@@ -1,2 +1,2 @@
1
- import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-GV8i37zL.js";
1
+ import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-DeP-P4Nh.js";
2
2
  export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
@@ -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
  }
@@ -1,8 +1,8 @@
1
1
  import { t as Box$1 } from "../../geometry-DaJr8yQW.cjs";
2
2
  import { t as ImageInit } from "../../image-M5SezZVI.cjs";
3
- import { t as OdpShape } from "../../shape-C8qDhn0l.cjs";
3
+ import { t as OdpShape } from "../../shape-BR8GL8XC.cjs";
4
4
  import { s as OdgVector } from "../../vector-D03KX8Ux.cjs";
5
- import { i as TableInit, t as OdtTable } from "../../table-DjYcNOFm.cjs";
5
+ import { i as TableInit, t as OdtTable } from "../../table-sEo1Jf8c.cjs";
6
6
  import { ContentVector } from "document-schema.js";
7
7
  import { Package, XmlElement, XmlNode } from "odf.js";
8
8
  //#region src/edit/odp/slide.d.ts
@@ -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);
@@ -1,8 +1,8 @@
1
1
  import { t as Box$1 } from "../../geometry-DaJr8yQW.js";
2
2
  import { t as ImageInit } from "../../image-DHcA9kaK.js";
3
- import { t as OdpShape } from "../../shape-GV8i37zL.js";
3
+ import { t as OdpShape } from "../../shape-DeP-P4Nh.js";
4
4
  import { s as OdgVector } from "../../vector-D03KX8Ux.js";
5
- import { i as TableInit, t as OdtTable } from "../../table-Vf6nCixr.js";
5
+ import { i as TableInit, t as OdtTable } from "../../table-kvclAXS5.js";
6
6
  import { ContentVector } from "document-schema.js";
7
7
  import { Package, XmlElement, XmlNode } from "odf.js";
8
8
  //#region src/edit/odp/slide.d.ts
@@ -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
  }
@@ -5,6 +5,7 @@ const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs
5
5
  const require_model_formula = require("../../model/formula.cjs");
6
6
  const require_edit_odt_scaffold = require("./scaffold.cjs");
7
7
  const require_edit_odt_editor = require("./editor.cjs");
8
+ let odf_js = require("odf.js");
8
9
  //#region src/edit/odt/content.ts
9
10
  function buildOdtPackage(content, options) {
10
11
  if (content.kind !== "wordprocessing") throw new Error("buildOdtPackage requires a wordprocessing ContentDocument");
@@ -17,6 +18,21 @@ function buildOdtPackage(content, options) {
17
18
  });
18
19
  return editor.toPackage();
19
20
  }
21
+ function isMergeableImageParagraph(block) {
22
+ return block.kind === "paragraph" && block.list === void 0 && block.runs.every((run) => run.text === "");
23
+ }
24
+ function appendMergedImageParagraph(body, paragraphBlock, imageBlock) {
25
+ const paragraph = body.appendParagraph();
26
+ if (paragraphBlock.styleId !== void 0) paragraph.styleId = paragraphBlock.styleId;
27
+ if (paragraphBlock.alignment !== void 0) paragraph.alignment = paragraphBlock.alignment;
28
+ paragraph.insertImageAfter({
29
+ format: imageBlock.format,
30
+ bytes: (0, odf_js.base64ToBytes)(imageBlock.base64),
31
+ widthPt: imageBlock.widthPt,
32
+ heightPt: imageBlock.heightPt,
33
+ altText: imageBlock.altText
34
+ });
35
+ }
20
36
  function appendBlocks(body, blocks) {
21
37
  let i = 0;
22
38
  while (i < blocks.length) {
@@ -25,6 +41,12 @@ function appendBlocks(body, blocks) {
25
41
  i++;
26
42
  continue;
27
43
  }
44
+ const next = blocks[i + 1];
45
+ if (isMergeableImageParagraph(block) && next?.kind === "image") {
46
+ appendMergedImageParagraph(body, block, next);
47
+ i += 2;
48
+ continue;
49
+ }
28
50
  if (block.kind === "paragraph" && block.list !== void 0) {
29
51
  const run = [];
30
52
  while (i < blocks.length) {
@@ -86,6 +108,13 @@ function populateCellBlocks(cell, blocks) {
86
108
  const [firstBlock, ...restBlocks] = blocks;
87
109
  const firstParagraph = cell.paragraphs()[0];
88
110
  if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock);
111
+ else if (firstBlock?.kind === "image" && firstParagraph !== void 0) firstParagraph.insertImageAfter({
112
+ format: firstBlock.format,
113
+ bytes: (0, odf_js.base64ToBytes)(firstBlock.base64),
114
+ widthPt: firstBlock.widthPt,
115
+ heightPt: firstBlock.heightPt,
116
+ altText: firstBlock.altText
117
+ });
89
118
  else if (firstBlock !== void 0) appendCellBlock(cell, firstBlock);
90
119
  for (const remaining of restBlocks) appendCellBlock(cell, remaining);
91
120
  }
@@ -135,9 +164,23 @@ function appendTable(body, block) {
135
164
  }
136
165
  function appendCellBlock(cell, block) {
137
166
  if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block);
167
+ else if (block.kind === "image") cell.appendParagraph().insertImageAfter({
168
+ format: block.format,
169
+ bytes: (0, odf_js.base64ToBytes)(block.base64),
170
+ widthPt: block.widthPt,
171
+ heightPt: block.heightPt,
172
+ altText: block.altText
173
+ });
138
174
  }
139
175
  function appendBlock(body, block) {
140
176
  if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block);
177
+ else if (block.kind === "image") body.appendParagraph().insertImageAfter({
178
+ format: block.format,
179
+ bytes: (0, odf_js.base64ToBytes)(block.base64),
180
+ widthPt: block.widthPt,
181
+ heightPt: block.heightPt,
182
+ altText: block.altText
183
+ });
141
184
  else if (block.kind === "pageBreak") body.appendPageBreak();
142
185
  else if (block.kind === "table") appendTable(body, block);
143
186
  else if (block.kind === "embeddedObject") appendEmbeddedObject(body, block);
@@ -1,6 +1,6 @@
1
1
  import { ClockPort } from "../../ports/clock.cjs";
2
- import { t as OdtParagraph } from "../../paragraph-BXbXKPy3.cjs";
3
- import { t as OdtTable } from "../../table-DjYcNOFm.cjs";
2
+ import { t as OdtParagraph } from "../../paragraph-Dlly6_E9.cjs";
3
+ import { t as OdtTable } from "../../table-sEo1Jf8c.cjs";
4
4
  import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
5
5
  import { Package } from "odf.js";
6
6
  //#region src/edit/odt/content.d.ts
@@ -1,6 +1,6 @@
1
1
  import { ClockPort } from "../../ports/clock.js";
2
- import { t as OdtParagraph } from "../../paragraph-CjtZP77X.js";
3
- import { t as OdtTable } from "../../table-Vf6nCixr.js";
2
+ import { t as OdtParagraph } from "../../paragraph-kMJVZhAi.js";
3
+ import { t as OdtTable } from "../../table-kvclAXS5.js";
4
4
  import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
5
5
  import { Package } from "odf.js";
6
6
  //#region src/edit/odt/content.d.ts
@@ -4,6 +4,7 @@ import { FLOW_CONTAINER_ORIGIN, drawingOfBlock, embeddedDrawingVectors } from ".
4
4
  import { formulaOfBlock, formulaPlaceholderText } from "../../model/formula.js";
5
5
  import { createEmptyOdtPackage } from "./scaffold.js";
6
6
  import { OdtEditor } from "./editor.js";
7
+ import { base64ToBytes } from "odf.js";
7
8
  //#region src/edit/odt/content.ts
8
9
  function buildOdtPackage(content, options) {
9
10
  if (content.kind !== "wordprocessing") throw new Error("buildOdtPackage requires a wordprocessing ContentDocument");
@@ -16,6 +17,21 @@ function buildOdtPackage(content, options) {
16
17
  });
17
18
  return editor.toPackage();
18
19
  }
20
+ function isMergeableImageParagraph(block) {
21
+ return block.kind === "paragraph" && block.list === void 0 && block.runs.every((run) => run.text === "");
22
+ }
23
+ function appendMergedImageParagraph(body, paragraphBlock, imageBlock) {
24
+ const paragraph = body.appendParagraph();
25
+ if (paragraphBlock.styleId !== void 0) paragraph.styleId = paragraphBlock.styleId;
26
+ if (paragraphBlock.alignment !== void 0) paragraph.alignment = paragraphBlock.alignment;
27
+ paragraph.insertImageAfter({
28
+ format: imageBlock.format,
29
+ bytes: base64ToBytes(imageBlock.base64),
30
+ widthPt: imageBlock.widthPt,
31
+ heightPt: imageBlock.heightPt,
32
+ altText: imageBlock.altText
33
+ });
34
+ }
19
35
  function appendBlocks(body, blocks) {
20
36
  let i = 0;
21
37
  while (i < blocks.length) {
@@ -24,6 +40,12 @@ function appendBlocks(body, blocks) {
24
40
  i++;
25
41
  continue;
26
42
  }
43
+ const next = blocks[i + 1];
44
+ if (isMergeableImageParagraph(block) && next?.kind === "image") {
45
+ appendMergedImageParagraph(body, block, next);
46
+ i += 2;
47
+ continue;
48
+ }
27
49
  if (block.kind === "paragraph" && block.list !== void 0) {
28
50
  const run = [];
29
51
  while (i < blocks.length) {
@@ -85,6 +107,13 @@ function populateCellBlocks(cell, blocks) {
85
107
  const [firstBlock, ...restBlocks] = blocks;
86
108
  const firstParagraph = cell.paragraphs()[0];
87
109
  if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock);
110
+ else if (firstBlock?.kind === "image" && firstParagraph !== void 0) firstParagraph.insertImageAfter({
111
+ format: firstBlock.format,
112
+ bytes: base64ToBytes(firstBlock.base64),
113
+ widthPt: firstBlock.widthPt,
114
+ heightPt: firstBlock.heightPt,
115
+ altText: firstBlock.altText
116
+ });
88
117
  else if (firstBlock !== void 0) appendCellBlock(cell, firstBlock);
89
118
  for (const remaining of restBlocks) appendCellBlock(cell, remaining);
90
119
  }
@@ -134,9 +163,23 @@ function appendTable(body, block) {
134
163
  }
135
164
  function appendCellBlock(cell, block) {
136
165
  if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block);
166
+ else if (block.kind === "image") cell.appendParagraph().insertImageAfter({
167
+ format: block.format,
168
+ bytes: base64ToBytes(block.base64),
169
+ widthPt: block.widthPt,
170
+ heightPt: block.heightPt,
171
+ altText: block.altText
172
+ });
137
173
  }
138
174
  function appendBlock(body, block) {
139
175
  if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block);
176
+ else if (block.kind === "image") body.appendParagraph().insertImageAfter({
177
+ format: block.format,
178
+ bytes: base64ToBytes(block.base64),
179
+ widthPt: block.widthPt,
180
+ heightPt: block.heightPt,
181
+ altText: block.altText
182
+ });
140
183
  else if (block.kind === "pageBreak") body.appendPageBreak();
141
184
  else if (block.kind === "table") appendTable(body, block);
142
185
  else if (block.kind === "embeddedObject") appendEmbeddedObject(body, block);
@@ -1,8 +1,8 @@
1
1
  import { ClockPort } from "../../ports/clock.cjs";
2
2
  import { t as Box$1 } from "../../geometry-DaJr8yQW.cjs";
3
- import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-BXbXKPy3.cjs";
4
- import { t as OdtList } from "../../list-BzcN-LTJ.cjs";
5
- import { i as TableInit, t as OdtTable } from "../../table-DjYcNOFm.cjs";
3
+ import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-Dlly6_E9.cjs";
4
+ import { t as OdtList } from "../../list-DXRaCcT1.cjs";
5
+ import { i as TableInit, t as OdtTable } from "../../table-sEo1Jf8c.cjs";
6
6
  import { ContentFormula, ContentVector } from "document-schema.js";
7
7
  import { Package } from "odf.js";
8
8
  //#region src/edit/odt/editor.d.ts
@@ -1,8 +1,8 @@
1
1
  import { ClockPort } from "../../ports/clock.js";
2
2
  import { t as Box$1 } from "../../geometry-DaJr8yQW.js";
3
- import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-CjtZP77X.js";
4
- import { t as OdtList } from "../../list-BJVehfU8.js";
5
- import { i as TableInit, t as OdtTable } from "../../table-Vf6nCixr.js";
3
+ import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-kMJVZhAi.js";
4
+ import { t as OdtList } from "../../list-7hZydHAV.js";
5
+ import { i as TableInit, t as OdtTable } from "../../table-kvclAXS5.js";
6
6
  import { ContentFormula, ContentVector } from "document-schema.js";
7
7
  import { Package } from "odf.js";
8
8
  //#region src/edit/odt/editor.d.ts
@@ -0,0 +1,23 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_xml_fragment = require("../../xml/fragment.cjs");
3
+ const require_xml_odf_text = require("../../xml/odf-text.cjs");
4
+ const require_odf_package_media = require("../../odf-package/media.cjs");
5
+ let odf_js = require("odf.js");
6
+ //#region src/edit/odt/image.ts
7
+ function buildImageFrame(href, frame, altText) {
8
+ const children = [];
9
+ if (altText !== void 0) children.push(require_xml_fragment.el("svg:title", {}, require_xml_odf_text.encodeOdfText(altText)));
10
+ children.push(require_xml_fragment.el("draw:image", { "xlink:href": href }));
11
+ return require_xml_fragment.el("draw:frame", {
12
+ "text:anchor-type": "as-char",
13
+ "svg:width": (0, odf_js.formatOdfLength)(frame.widthPt),
14
+ "svg:height": (0, odf_js.formatOdfLength)(frame.heightPt)
15
+ }, children);
16
+ }
17
+ function insertImageFrameMedia(pkg, frame, image) {
18
+ const { partPath } = require_odf_package_media.addImageMedia(pkg, image.bytes, image.format);
19
+ return buildImageFrame(partPath, frame, image.altText);
20
+ }
21
+ //#endregion
22
+ exports.buildImageFrame = buildImageFrame;
23
+ exports.insertImageFrameMedia = insertImageFrameMedia;
@@ -0,0 +1,2 @@
1
+ import { n as buildImageFrame, r as insertImageFrameMedia, t as ImageInit } from "../../image-m_rfpuY8.cjs";
2
+ export { ImageInit, buildImageFrame, insertImageFrameMedia };
@@ -0,0 +1,2 @@
1
+ import { n as buildImageFrame, r as insertImageFrameMedia, t as ImageInit } from "../../image-DwrOnL_Z.js";
2
+ export { ImageInit, buildImageFrame, insertImageFrameMedia };
@@ -0,0 +1,21 @@
1
+ import { el } from "../../xml/fragment.js";
2
+ import { encodeOdfText } from "../../xml/odf-text.js";
3
+ import { addImageMedia } from "../../odf-package/media.js";
4
+ import { formatOdfLength } from "odf.js";
5
+ //#region src/edit/odt/image.ts
6
+ function buildImageFrame(href, frame, altText) {
7
+ const children = [];
8
+ if (altText !== void 0) children.push(el("svg:title", {}, encodeOdfText(altText)));
9
+ children.push(el("draw:image", { "xlink:href": href }));
10
+ return el("draw:frame", {
11
+ "text:anchor-type": "as-char",
12
+ "svg:width": formatOdfLength(frame.widthPt),
13
+ "svg:height": formatOdfLength(frame.heightPt)
14
+ }, children);
15
+ }
16
+ function insertImageFrameMedia(pkg, frame, image) {
17
+ const { partPath } = addImageMedia(pkg, image.bytes, image.format);
18
+ return buildImageFrame(partPath, frame, image.altText);
19
+ }
20
+ //#endregion
21
+ export { buildImageFrame, insertImageFrameMedia };
@@ -1,2 +1,2 @@
1
- import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-BzcN-LTJ.cjs";
1
+ import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-DXRaCcT1.cjs";
2
2
  export { OdtList, OdtListItem, buildList };
@@ -1,2 +1,2 @@
1
- import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-BJVehfU8.js";
1
+ import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-7hZydHAV.js";
2
2
  export { OdtList, OdtListItem, buildList };
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_xml_fragment = require("../../xml/fragment.cjs");
3
3
  const require_xml_edit = require("../../xml/edit.cjs");
4
4
  const require_xml_odf_text = require("../../xml/odf-text.cjs");
5
+ const require_edit_odt_image = require("./image.cjs");
5
6
  const require_edit_odt_props = require("./props.cjs");
6
7
  const require_edit_odt_run = require("./run.cjs");
7
8
  let ooxml_js = require("ooxml.js");
@@ -66,6 +67,16 @@ var OdtParagraph = class {
66
67
  set alignment(value) {
67
68
  require_edit_odt_props.applyStyleChange(this.pkg, this.live(), "paragraph", { alignment: value });
68
69
  }
70
+ insertImageAfter(image) {
71
+ const node = this.live();
72
+ const frame = {
73
+ xPt: 0,
74
+ yPt: 0,
75
+ widthPt: image.widthPt,
76
+ heightPt: image.heightPt
77
+ };
78
+ node.children.push(require_edit_odt_image.insertImageFrameMedia(this.pkg, frame, image));
79
+ }
69
80
  remove() {
70
81
  require_xml_edit.removeChild(this.container, this.live());
71
82
  this.removed = true;
@@ -1,2 +1,2 @@
1
- import { n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-BXbXKPy3.cjs";
1
+ import { n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-Dlly6_E9.cjs";
2
2
  export { OdtParagraph, ParagraphInit, buildParagraph };
@@ -1,2 +1,2 @@
1
- import { n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-CjtZP77X.js";
1
+ import { n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-kMJVZhAi.js";
2
2
  export { OdtParagraph, ParagraphInit, buildParagraph };
@@ -1,6 +1,7 @@
1
1
  import { el } from "../../xml/fragment.js";
2
2
  import { removeAttr, removeChild, setAttr } from "../../xml/edit.js";
3
3
  import { decodeOdfText } from "../../xml/odf-text.js";
4
+ import { insertImageFrameMedia } from "./image.js";
4
5
  import { applyStyleChange, readCurrentStyleProperties } from "./props.js";
5
6
  import { OdtRun, buildRun } from "./run.js";
6
7
  import { attr } from "ooxml.js";
@@ -65,6 +66,16 @@ var OdtParagraph = class {
65
66
  set alignment(value) {
66
67
  applyStyleChange(this.pkg, this.live(), "paragraph", { alignment: value });
67
68
  }
69
+ insertImageAfter(image) {
70
+ const node = this.live();
71
+ const frame = {
72
+ xPt: 0,
73
+ yPt: 0,
74
+ widthPt: image.widthPt,
75
+ heightPt: image.heightPt
76
+ };
77
+ node.children.push(insertImageFrameMedia(this.pkg, frame, image));
78
+ }
68
79
  remove() {
69
80
  removeChild(this.container, this.live());
70
81
  this.removed = true;
@@ -1,2 +1,2 @@
1
- import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-DjYcNOFm.cjs";
1
+ import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-sEo1Jf8c.cjs";
2
2
  export { OdtTable, OdtTableCell, OdtTableRow, TableInit, buildTable };
@@ -1,2 +1,2 @@
1
- import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-Vf6nCixr.js";
1
+ import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-kvclAXS5.js";
2
2
  export { OdtTable, OdtTableCell, OdtTableRow, TableInit, buildTable };
@@ -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 };
@@ -0,0 +1,14 @@
1
+ import { t as Box } from "./geometry-DaJr8yQW.js";
2
+ import { Package, XmlElement } from "odf.js";
3
+ //#region src/edit/odt/image.d.ts
4
+ interface ImageInit {
5
+ readonly format: 'png' | 'jpeg';
6
+ readonly bytes: Uint8Array<ArrayBuffer>;
7
+ readonly widthPt: number;
8
+ readonly heightPt: number;
9
+ readonly altText?: string;
10
+ }
11
+ declare function buildImageFrame(href: string, frame: Box, altText?: string): XmlElement;
12
+ declare function insertImageFrameMedia(pkg: Package, frame: Box, image: ImageInit): XmlElement;
13
+ //#endregion
14
+ export { buildImageFrame as n, insertImageFrameMedia as r, ImageInit as t };
@@ -0,0 +1,14 @@
1
+ import { t as Box } from "./geometry-DaJr8yQW.cjs";
2
+ import { Package, XmlElement } from "odf.js";
3
+ //#region src/edit/odt/image.d.ts
4
+ interface ImageInit {
5
+ readonly format: 'png' | 'jpeg';
6
+ readonly bytes: Uint8Array<ArrayBuffer>;
7
+ readonly widthPt: number;
8
+ readonly heightPt: number;
9
+ readonly altText?: string;
10
+ }
11
+ declare function buildImageFrame(href: string, frame: Box, altText?: string): XmlElement;
12
+ declare function insertImageFrameMedia(pkg: Package, frame: Box, image: ImageInit): XmlElement;
13
+ //#endregion
14
+ export { buildImageFrame as n, insertImageFrameMedia as r, ImageInit as t };