documents.js 1.65.0 → 1.67.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 (119) hide show
  1. package/README.md +18 -11
  2. package/dist/color-C98dn-pT.d.ts +2 -0
  3. package/dist/convert/convert.cjs +2 -1
  4. package/dist/convert/convert.js +2 -1
  5. package/dist/edit/docx/content.cjs +5 -0
  6. package/dist/edit/docx/content.js +5 -0
  7. package/dist/edit/docx/image.cjs +1 -0
  8. package/dist/edit/docx/image.d.cts +2 -2
  9. package/dist/edit/docx/image.d.ts +2 -2
  10. package/dist/edit/docx/image.js +1 -1
  11. package/dist/edit/docx/paragraph.cjs +10 -1
  12. package/dist/edit/docx/paragraph.d.cts +4 -3
  13. package/dist/edit/docx/paragraph.d.ts +4 -3
  14. package/dist/edit/docx/paragraph.js +13 -4
  15. package/dist/edit/docx/props.d.ts +1 -1
  16. package/dist/edit/docx/run.cjs +8 -1
  17. package/dist/edit/docx/run.d.cts +2 -2
  18. package/dist/edit/docx/run.d.ts +2 -2
  19. package/dist/edit/docx/run.js +8 -2
  20. package/dist/edit/docx/vector.cjs +69 -0
  21. package/dist/edit/docx/vector.d.cts +6 -0
  22. package/dist/edit/docx/vector.d.ts +6 -0
  23. package/dist/edit/docx/vector.js +68 -0
  24. package/dist/edit/drawingml/vector.cjs +113 -0
  25. package/dist/edit/drawingml/vector.d.cts +9 -0
  26. package/dist/edit/drawingml/vector.d.ts +9 -0
  27. package/dist/edit/drawingml/vector.js +109 -0
  28. package/dist/edit/odg/content.cjs +1 -26
  29. package/dist/edit/odg/content.js +1 -26
  30. package/dist/edit/odg/page.cjs +14 -1
  31. package/dist/edit/odg/page.d.cts +5 -3
  32. package/dist/edit/odg/page.d.ts +5 -3
  33. package/dist/edit/odg/page.js +14 -1
  34. package/dist/edit/odg/style.cjs +17 -3
  35. package/dist/edit/odg/style.d.cts +1 -0
  36. package/dist/edit/odg/style.d.ts +1 -0
  37. package/dist/edit/odg/style.js +17 -3
  38. package/dist/edit/odg/vector.cjs +65 -3
  39. package/dist/edit/odg/vector.d.cts +2 -2
  40. package/dist/edit/odg/vector.d.ts +2 -2
  41. package/dist/edit/odg/vector.js +63 -4
  42. package/dist/edit/odp/content.cjs +4 -1
  43. package/dist/edit/odp/content.js +5 -2
  44. package/dist/edit/odp/shape.cjs +1 -1
  45. package/dist/edit/odp/shape.d.cts +1 -1
  46. package/dist/edit/odp/shape.d.ts +1 -1
  47. package/dist/edit/odp/shape.js +1 -1
  48. package/dist/edit/odp/slide.cjs +4 -0
  49. package/dist/edit/odp/slide.d.cts +8 -5
  50. package/dist/edit/odp/slide.d.ts +9 -6
  51. package/dist/edit/odp/slide.js +4 -0
  52. package/dist/edit/odt/content.cjs +5 -0
  53. package/dist/edit/odt/content.d.ts +2 -2
  54. package/dist/edit/odt/content.js +5 -0
  55. package/dist/edit/odt/editor.cjs +7 -0
  56. package/dist/edit/odt/editor.d.cts +3 -2
  57. package/dist/edit/odt/editor.d.ts +5 -4
  58. package/dist/edit/odt/editor.js +7 -0
  59. package/dist/edit/odt/list.cjs +13 -0
  60. package/dist/edit/odt/list.d.cts +1 -1
  61. package/dist/edit/odt/list.d.ts +1 -1
  62. package/dist/edit/odt/list.js +13 -0
  63. package/dist/edit/odt/paragraph.d.ts +1 -1
  64. package/dist/edit/odt/run.d.ts +1 -1
  65. package/dist/edit/odt/table.d.ts +1 -1
  66. package/dist/edit/pptx/content.cjs +5 -2
  67. package/dist/edit/pptx/content.js +5 -2
  68. package/dist/edit/pptx/shape.cjs +2 -5
  69. package/dist/edit/pptx/shape.d.ts +1 -1
  70. package/dist/edit/pptx/shape.js +2 -5
  71. package/dist/edit/pptx/slide.cjs +7 -0
  72. package/dist/edit/pptx/slide.d.cts +6 -4
  73. package/dist/edit/pptx/slide.d.ts +8 -6
  74. package/dist/edit/pptx/slide.js +7 -0
  75. package/dist/edit/pptx/table.d.ts +1 -1
  76. package/dist/edit/pptx/vector.cjs +17 -0
  77. package/dist/edit/pptx/vector.d.cts +6 -0
  78. package/dist/edit/pptx/vector.d.ts +6 -0
  79. package/dist/edit/pptx/vector.js +16 -0
  80. package/dist/{image-BfRLAD9B.d.cts → image-DRqXQmEg.d.cts} +2 -1
  81. package/dist/{image-BfRLAD9B.d.ts → image-DRqXQmEg.d.ts} +2 -1
  82. package/dist/index.cjs +2 -2
  83. package/dist/index.d.cts +6 -6
  84. package/dist/index.d.ts +12 -12
  85. package/dist/index.js +2 -2
  86. package/dist/layout/engine.cjs +1 -5
  87. package/dist/layout/engine.js +1 -5
  88. package/dist/layout/shared.cjs +6 -0
  89. package/dist/layout/shared.d.cts +2 -1
  90. package/dist/layout/shared.d.ts +2 -1
  91. package/dist/layout/shared.js +6 -1
  92. package/dist/layout/sheets.cjs +70 -9
  93. package/dist/layout/sheets.d.cts +7 -3
  94. package/dist/layout/sheets.d.ts +7 -3
  95. package/dist/layout/sheets.js +72 -11
  96. package/dist/layout/slides.cjs +1 -5
  97. package/dist/layout/slides.js +1 -5
  98. package/dist/{list-BuBM9rwQ.d.cts → list-BzcN-LTJ.d.cts} +3 -0
  99. package/dist/{list-CvKxhy3y.d.ts → list-nlhN5bat.d.ts} +4 -1
  100. package/dist/markdown/write.cjs +1 -1
  101. package/dist/markdown/write.js +1 -1
  102. package/dist/model/color.d.ts +1 -1
  103. package/dist/model/embedded-drawing.cjs +47 -0
  104. package/dist/model/embedded-drawing.d.cts +4 -2
  105. package/dist/model/embedded-drawing.d.ts +4 -2
  106. package/dist/model/embedded-drawing.js +46 -1
  107. package/dist/{paragraph-CoUi_88j.d.ts → paragraph-DndYbWuT.d.ts} +1 -1
  108. package/dist/{run-D2rTWHbt.d.ts → run-BhYv2wJf.d.ts} +3 -2
  109. package/dist/{run-CJfh8rv3.d.ts → run-DtrwZwN6.d.ts} +1 -1
  110. package/dist/{run-B3GNScJH.d.cts → run-P0b2pDdX.d.cts} +2 -1
  111. package/dist/{shape-BkVcwPcf.d.ts → shape-B-TjU_Ej.d.ts} +1 -1
  112. package/dist/{shape-CXZ6fejV.d.cts → shape-C8qDhn0l.d.cts} +1 -1
  113. package/dist/{shape-CVXedeL7.d.ts → shape-XGp__l-J.d.ts} +2 -2
  114. package/dist/{table-DqfqMkVq.d.ts → table-BHeUmLzZ.d.ts} +1 -1
  115. package/dist/{table-DvS_7UQS.d.ts → table-DQpKafyl.d.ts} +1 -1
  116. package/dist/{vector-Puuqu_IT.d.cts → vector-D03KX8Ux.d.cts} +15 -2
  117. package/dist/{vector-Puuqu_IT.d.ts → vector-D03KX8Ux.d.ts} +15 -2
  118. package/package.json +3 -3
  119. package/dist/color-Bo228AY2.d.ts +0 -2
@@ -1,7 +1,7 @@
1
1
  import { t as ImageInit } from "../../image-M5SezZVI.cjs";
2
- import { t as OdpShape } from "../../shape-CXZ6fejV.cjs";
3
- import { a as OdgLineVector, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit } from "../../vector-Puuqu_IT.cjs";
4
- import { Box } from "document-schema.js";
2
+ import { t as OdpShape } from "../../shape-C8qDhn0l.cjs";
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
+ import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "odf.js";
6
6
  //#region src/edit/odg/page.d.ts
7
7
  interface TextBoxInit {
@@ -24,10 +24,12 @@ declare class OdgPage {
24
24
  shapes(): OdpShape[];
25
25
  addTextBox(init: TextBoxInit): OdpShape;
26
26
  addImage(init: PageImageInit): OdpShape;
27
+ vectors(): OdgVector[];
27
28
  addRect(init: BoxVectorInit): OdgBoxVector;
28
29
  addEllipse(init: BoxVectorInit): OdgBoxVector;
29
30
  addLine(init: LineVectorInit): OdgLineVector;
30
31
  addPath(init: PathVectorInit): OdgPathVector;
32
+ addVector(vector: ContentVector): OdgVector;
31
33
  remove(): void;
32
34
  }
33
35
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { t as ImageInit } from "../../image-DHcA9kaK.js";
2
- import { t as OdpShape } from "../../shape-CVXedeL7.js";
3
- import { a as OdgLineVector, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit } from "../../vector-Puuqu_IT.js";
4
- import { Box } from "document-schema.js";
2
+ import { t as OdpShape } from "../../shape-XGp__l-J.js";
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
+ import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "odf.js";
6
6
  //#region src/edit/odg/page.d.ts
7
7
  interface TextBoxInit {
@@ -24,10 +24,12 @@ declare class OdgPage {
24
24
  shapes(): OdpShape[];
25
25
  addTextBox(init: TextBoxInit): OdpShape;
26
26
  addImage(init: PageImageInit): OdpShape;
27
+ vectors(): OdgVector[];
27
28
  addRect(init: BoxVectorInit): OdgBoxVector;
28
29
  addEllipse(init: BoxVectorInit): OdgBoxVector;
29
30
  addLine(init: LineVectorInit): OdgLineVector;
30
31
  addPath(init: PathVectorInit): OdgPathVector;
32
+ addVector(vector: ContentVector): OdgVector;
31
33
  remove(): void;
32
34
  }
33
35
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { removeChild } from "../../xml/edit.js";
2
+ import { OdgBoxVector, OdgLineVector, OdgPathVector, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, wrapVectorElement } from "./vector.js";
2
3
  import { OdpShape, buildTextBoxFrame } from "../odp/shape.js";
3
4
  import { insertImageFrameMedia } from "../odp/image.js";
4
- import { OdgBoxVector, OdgLineVector, OdgPathVector, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement } from "./vector.js";
5
5
  //#region src/edit/odg/page.ts
6
6
  var OdgPage = class {
7
7
  container;
@@ -36,6 +36,16 @@ var OdgPage = class {
36
36
  node.children.push(frameElement);
37
37
  return new OdpShape(node.children, frameElement, this.context.pkg);
38
38
  }
39
+ vectors() {
40
+ const node = this.live();
41
+ const out = [];
42
+ for (const child of node.children) {
43
+ if (child.type !== "element") continue;
44
+ const vector = wrapVectorElement(node.children, child, this.context.pkg);
45
+ if (vector !== void 0) out.push(vector);
46
+ }
47
+ return out;
48
+ }
39
49
  addRect(init) {
40
50
  const node = this.live();
41
51
  const element = buildRectElement(this.context.pkg, init);
@@ -60,6 +70,9 @@ var OdgPage = class {
60
70
  node.children.push(element);
61
71
  return new OdgPathVector(node.children, element, this.context.pkg);
62
72
  }
73
+ addVector(vector) {
74
+ return appendVectorTo(this.live().children, this.context.pkg, vector);
75
+ }
63
76
  remove() {
64
77
  removeChild(this.container, this.live());
65
78
  this.removed = true;
@@ -6,8 +6,16 @@ let ooxml_js = require("ooxml.js");
6
6
  let odf_js = require("odf.js");
7
7
  //#region src/edit/odg/style.ts
8
8
  const GRAPHIC_STYLE_PREFIX = "gr";
9
+ const TEXT_FLOW_ANCHOR_ATTRS = {
10
+ "style:wrap": "run-through",
11
+ "style:run-through": "background",
12
+ "style:horizontal-pos": "from-left",
13
+ "style:horizontal-rel": "page",
14
+ "style:vertical-pos": "from-top",
15
+ "style:vertical-rel": "page"
16
+ };
9
17
  function graphicPropertyAttrs(init) {
10
- const attrs = {};
18
+ const attrs = init.textFlowAnchored === true ? { ...TEXT_FLOW_ANCHOR_ATTRS } : {};
11
19
  if (init.fill === void 0) attrs["draw:fill"] = "none";
12
20
  else {
13
21
  attrs["draw:fill"] = "solid";
@@ -61,17 +69,23 @@ function readGraphicStroke(pkg, element) {
61
69
  widthPt
62
70
  };
63
71
  }
72
+ function readGraphicTextFlowAnchored(pkg, element) {
73
+ const props = graphicProperties(pkg, element);
74
+ return props !== void 0 && (0, ooxml_js.attr)(props, "style:vertical-rel") === TEXT_FLOW_ANCHOR_ATTRS["style:vertical-rel"];
75
+ }
64
76
  function setGraphicFill(pkg, element, fill) {
65
77
  const name = buildGraphicStyle(pkg, {
66
78
  fill,
67
- stroke: readGraphicStroke(pkg, element)
79
+ stroke: readGraphicStroke(pkg, element),
80
+ textFlowAnchored: readGraphicTextFlowAnchored(pkg, element)
68
81
  });
69
82
  require_xml_edit.setAttr(element, "draw:style-name", name);
70
83
  }
71
84
  function setGraphicStroke(pkg, element, stroke) {
72
85
  const name = buildGraphicStyle(pkg, {
73
86
  fill: readGraphicFill(pkg, element),
74
- stroke
87
+ stroke,
88
+ textFlowAnchored: readGraphicTextFlowAnchored(pkg, element)
75
89
  });
76
90
  require_xml_edit.setAttr(element, "draw:style-name", name);
77
91
  }
@@ -4,6 +4,7 @@ import { Package, XmlElement } from "odf.js";
4
4
  interface GraphicStyleInit {
5
5
  readonly fill?: Color;
6
6
  readonly stroke?: ContentStroke;
7
+ readonly textFlowAnchored?: boolean;
7
8
  }
8
9
  declare function buildGraphicStyle(pkg: Package, init: GraphicStyleInit): string;
9
10
  declare function readGraphicFill(pkg: Package, element: XmlElement): Color | undefined;
@@ -4,6 +4,7 @@ import { Package, XmlElement } from "odf.js";
4
4
  interface GraphicStyleInit {
5
5
  readonly fill?: Color;
6
6
  readonly stroke?: ContentStroke;
7
+ readonly textFlowAnchored?: boolean;
7
8
  }
8
9
  declare function buildGraphicStyle(pkg: Package, init: GraphicStyleInit): string;
9
10
  declare function readGraphicFill(pkg: Package, element: XmlElement): Color | undefined;
@@ -5,8 +5,16 @@ import { attr } from "ooxml.js";
5
5
  import { formatOdfColor, formatOdfLength, parseOdfColor, parseOdfLength } from "odf.js";
6
6
  //#region src/edit/odg/style.ts
7
7
  const GRAPHIC_STYLE_PREFIX = "gr";
8
+ const TEXT_FLOW_ANCHOR_ATTRS = {
9
+ "style:wrap": "run-through",
10
+ "style:run-through": "background",
11
+ "style:horizontal-pos": "from-left",
12
+ "style:horizontal-rel": "page",
13
+ "style:vertical-pos": "from-top",
14
+ "style:vertical-rel": "page"
15
+ };
8
16
  function graphicPropertyAttrs(init) {
9
- const attrs = {};
17
+ const attrs = init.textFlowAnchored === true ? { ...TEXT_FLOW_ANCHOR_ATTRS } : {};
10
18
  if (init.fill === void 0) attrs["draw:fill"] = "none";
11
19
  else {
12
20
  attrs["draw:fill"] = "solid";
@@ -60,17 +68,23 @@ function readGraphicStroke(pkg, element) {
60
68
  widthPt
61
69
  };
62
70
  }
71
+ function readGraphicTextFlowAnchored(pkg, element) {
72
+ const props = graphicProperties(pkg, element);
73
+ return props !== void 0 && attr(props, "style:vertical-rel") === TEXT_FLOW_ANCHOR_ATTRS["style:vertical-rel"];
74
+ }
63
75
  function setGraphicFill(pkg, element, fill) {
64
76
  const name = buildGraphicStyle(pkg, {
65
77
  fill,
66
- stroke: readGraphicStroke(pkg, element)
78
+ stroke: readGraphicStroke(pkg, element),
79
+ textFlowAnchored: readGraphicTextFlowAnchored(pkg, element)
67
80
  });
68
81
  setAttr(element, "draw:style-name", name);
69
82
  }
70
83
  function setGraphicStroke(pkg, element, stroke) {
71
84
  const name = buildGraphicStyle(pkg, {
72
85
  fill: readGraphicFill(pkg, element),
73
- stroke
86
+ stroke,
87
+ textFlowAnchored: readGraphicTextFlowAnchored(pkg, element)
74
88
  });
75
89
  setAttr(element, "draw:style-name", name);
76
90
  }
@@ -13,7 +13,8 @@ function directTextP() {
13
13
  function buildBoxVectorElement(pkg, tag, init) {
14
14
  const styleName = require_edit_odg_style.buildGraphicStyle(pkg, {
15
15
  fill: init.fill,
16
- stroke: init.stroke
16
+ stroke: init.stroke,
17
+ textFlowAnchored: init.textFlowAnchored
17
18
  });
18
19
  return require_xml_fragment.el(tag, {
19
20
  "draw:style-name": styleName,
@@ -81,7 +82,10 @@ var OdgBoxVector = class {
81
82
  }
82
83
  };
83
84
  function buildLineElement(pkg, init) {
84
- const styleName = require_edit_odg_style.buildGraphicStyle(pkg, { stroke: init.stroke });
85
+ const styleName = require_edit_odg_style.buildGraphicStyle(pkg, {
86
+ stroke: init.stroke,
87
+ textFlowAnchored: init.textFlowAnchored
88
+ });
85
89
  return require_xml_fragment.el("draw:line", {
86
90
  "draw:style-name": styleName,
87
91
  "svg:x1": (0, odf_js.formatOdfLength)(init.from.xPt),
@@ -91,6 +95,7 @@ function buildLineElement(pkg, init) {
91
95
  }, [directTextP()]);
92
96
  }
93
97
  var OdgLineVector = class {
98
+ kind = "line";
94
99
  container;
95
100
  node;
96
101
  pkg;
@@ -137,7 +142,8 @@ var OdgLineVector = class {
137
142
  function buildPathElement(pkg, init) {
138
143
  const styleName = require_edit_odg_style.buildGraphicStyle(pkg, {
139
144
  fill: init.fill,
140
- stroke: init.stroke
145
+ stroke: init.stroke,
146
+ textFlowAnchored: init.textFlowAnchored
141
147
  });
142
148
  return require_xml_fragment.el("draw:path", {
143
149
  "draw:style-name": styleName,
@@ -150,6 +156,7 @@ function buildPathElement(pkg, init) {
150
156
  }, [directTextP()]);
151
157
  }
152
158
  var OdgPathVector = class {
159
+ kind = "path";
153
160
  container;
154
161
  node;
155
162
  pkg;
@@ -207,11 +214,66 @@ var OdgPathVector = class {
207
214
  this.removed = true;
208
215
  }
209
216
  };
217
+ function wrapVectorElement(container, node, pkg) {
218
+ switch (node.tag) {
219
+ case "draw:rect":
220
+ case "draw:ellipse": return new OdgBoxVector(container, node, pkg);
221
+ case "draw:line": return new OdgLineVector(container, node, pkg);
222
+ case "draw:path": return new OdgPathVector(container, node, pkg);
223
+ default: return;
224
+ }
225
+ }
226
+ function buildVectorElement(pkg, vector, options) {
227
+ const textFlowAnchored = options?.textFlowAnchored;
228
+ const element = buildUnanchoredVectorElement(pkg, vector, textFlowAnchored);
229
+ if (textFlowAnchored === true) require_xml_edit.setAttr(element, "text:anchor-type", "paragraph");
230
+ return element;
231
+ }
232
+ function appendVectorTo(container, pkg, vector, options) {
233
+ const element = buildVectorElement(pkg, vector, options);
234
+ container.push(element);
235
+ switch (vector.kind) {
236
+ case "line": return new OdgLineVector(container, element, pkg);
237
+ case "path": return new OdgPathVector(container, element, pkg);
238
+ case "rect":
239
+ case "ellipse": return new OdgBoxVector(container, element, pkg);
240
+ }
241
+ }
242
+ function buildUnanchoredVectorElement(pkg, vector, textFlowAnchored) {
243
+ if (vector.kind === "line") return buildLineElement(pkg, {
244
+ from: vector.from,
245
+ to: vector.to,
246
+ stroke: vector.stroke,
247
+ textFlowAnchored
248
+ });
249
+ const element = vector.kind === "rect" ? buildRectElement(pkg, {
250
+ frame: vector.frame,
251
+ fill: vector.fill,
252
+ stroke: vector.stroke,
253
+ textFlowAnchored
254
+ }) : vector.kind === "ellipse" ? buildEllipseElement(pkg, {
255
+ frame: vector.frame,
256
+ fill: vector.fill,
257
+ stroke: vector.stroke,
258
+ textFlowAnchored
259
+ }) : buildPathElement(pkg, {
260
+ frame: vector.frame,
261
+ subpaths: vector.subpaths,
262
+ fill: vector.fill,
263
+ stroke: vector.stroke,
264
+ textFlowAnchored
265
+ });
266
+ if (vector.rotationDeg !== void 0) require_edit_geometry.applyOdfGeometry(element, vector.frame, vector.rotationDeg);
267
+ return element;
268
+ }
210
269
  //#endregion
211
270
  exports.OdgBoxVector = OdgBoxVector;
212
271
  exports.OdgLineVector = OdgLineVector;
213
272
  exports.OdgPathVector = OdgPathVector;
273
+ exports.appendVectorTo = appendVectorTo;
214
274
  exports.buildEllipseElement = buildEllipseElement;
215
275
  exports.buildLineElement = buildLineElement;
216
276
  exports.buildPathElement = buildPathElement;
217
277
  exports.buildRectElement = buildRectElement;
278
+ exports.buildVectorElement = buildVectorElement;
279
+ exports.wrapVectorElement = wrapVectorElement;
@@ -1,2 +1,2 @@
1
- import { a as OdgLineVector, c as buildEllipseElement, d as buildRectElement, i as OdgBoxVectorKind, l as buildLineElement, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit, u as buildPathElement } from "../../vector-Puuqu_IT.cjs";
2
- export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, PathVectorInit, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement };
1
+ import { _ as wrapVectorElement, a as OdgLineVector, c as OdgVectorKind, d as appendVectorTo, f as buildEllipseElement, g as buildVectorElement, h as buildRectElement, i as OdgBoxVectorKind, l as PathVectorInit, m as buildPathElement, n as LineVectorInit, o as OdgPathVector, p as buildLineElement, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit, u as VectorElementOptions } from "../../vector-D03KX8Ux.cjs";
2
+ export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, OdgVector, OdgVectorKind, PathVectorInit, VectorElementOptions, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
@@ -1,2 +1,2 @@
1
- import { a as OdgLineVector, c as buildEllipseElement, d as buildRectElement, i as OdgBoxVectorKind, l as buildLineElement, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit, u as buildPathElement } from "../../vector-Puuqu_IT.js";
2
- export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, PathVectorInit, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement };
1
+ import { _ as wrapVectorElement, a as OdgLineVector, c as OdgVectorKind, d as appendVectorTo, f as buildEllipseElement, g as buildVectorElement, h as buildRectElement, i as OdgBoxVectorKind, l as PathVectorInit, m as buildPathElement, n as LineVectorInit, o as OdgPathVector, p as buildLineElement, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit, u as VectorElementOptions } from "../../vector-D03KX8Ux.js";
2
+ export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, OdgVector, OdgVectorKind, PathVectorInit, VectorElementOptions, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
@@ -12,7 +12,8 @@ function directTextP() {
12
12
  function buildBoxVectorElement(pkg, tag, init) {
13
13
  const styleName = buildGraphicStyle(pkg, {
14
14
  fill: init.fill,
15
- stroke: init.stroke
15
+ stroke: init.stroke,
16
+ textFlowAnchored: init.textFlowAnchored
16
17
  });
17
18
  return el(tag, {
18
19
  "draw:style-name": styleName,
@@ -80,7 +81,10 @@ var OdgBoxVector = class {
80
81
  }
81
82
  };
82
83
  function buildLineElement(pkg, init) {
83
- const styleName = buildGraphicStyle(pkg, { stroke: init.stroke });
84
+ const styleName = buildGraphicStyle(pkg, {
85
+ stroke: init.stroke,
86
+ textFlowAnchored: init.textFlowAnchored
87
+ });
84
88
  return el("draw:line", {
85
89
  "draw:style-name": styleName,
86
90
  "svg:x1": formatOdfLength(init.from.xPt),
@@ -90,6 +94,7 @@ function buildLineElement(pkg, init) {
90
94
  }, [directTextP()]);
91
95
  }
92
96
  var OdgLineVector = class {
97
+ kind = "line";
93
98
  container;
94
99
  node;
95
100
  pkg;
@@ -136,7 +141,8 @@ var OdgLineVector = class {
136
141
  function buildPathElement(pkg, init) {
137
142
  const styleName = buildGraphicStyle(pkg, {
138
143
  fill: init.fill,
139
- stroke: init.stroke
144
+ stroke: init.stroke,
145
+ textFlowAnchored: init.textFlowAnchored
140
146
  });
141
147
  return el("draw:path", {
142
148
  "draw:style-name": styleName,
@@ -149,6 +155,7 @@ function buildPathElement(pkg, init) {
149
155
  }, [directTextP()]);
150
156
  }
151
157
  var OdgPathVector = class {
158
+ kind = "path";
152
159
  container;
153
160
  node;
154
161
  pkg;
@@ -206,5 +213,57 @@ var OdgPathVector = class {
206
213
  this.removed = true;
207
214
  }
208
215
  };
216
+ function wrapVectorElement(container, node, pkg) {
217
+ switch (node.tag) {
218
+ case "draw:rect":
219
+ case "draw:ellipse": return new OdgBoxVector(container, node, pkg);
220
+ case "draw:line": return new OdgLineVector(container, node, pkg);
221
+ case "draw:path": return new OdgPathVector(container, node, pkg);
222
+ default: return;
223
+ }
224
+ }
225
+ function buildVectorElement(pkg, vector, options) {
226
+ const textFlowAnchored = options?.textFlowAnchored;
227
+ const element = buildUnanchoredVectorElement(pkg, vector, textFlowAnchored);
228
+ if (textFlowAnchored === true) setAttr(element, "text:anchor-type", "paragraph");
229
+ return element;
230
+ }
231
+ function appendVectorTo(container, pkg, vector, options) {
232
+ const element = buildVectorElement(pkg, vector, options);
233
+ container.push(element);
234
+ switch (vector.kind) {
235
+ case "line": return new OdgLineVector(container, element, pkg);
236
+ case "path": return new OdgPathVector(container, element, pkg);
237
+ case "rect":
238
+ case "ellipse": return new OdgBoxVector(container, element, pkg);
239
+ }
240
+ }
241
+ function buildUnanchoredVectorElement(pkg, vector, textFlowAnchored) {
242
+ if (vector.kind === "line") return buildLineElement(pkg, {
243
+ from: vector.from,
244
+ to: vector.to,
245
+ stroke: vector.stroke,
246
+ textFlowAnchored
247
+ });
248
+ const element = vector.kind === "rect" ? buildRectElement(pkg, {
249
+ frame: vector.frame,
250
+ fill: vector.fill,
251
+ stroke: vector.stroke,
252
+ textFlowAnchored
253
+ }) : vector.kind === "ellipse" ? buildEllipseElement(pkg, {
254
+ frame: vector.frame,
255
+ fill: vector.fill,
256
+ stroke: vector.stroke,
257
+ textFlowAnchored
258
+ }) : buildPathElement(pkg, {
259
+ frame: vector.frame,
260
+ subpaths: vector.subpaths,
261
+ fill: vector.fill,
262
+ stroke: vector.stroke,
263
+ textFlowAnchored
264
+ });
265
+ if (vector.rotationDeg !== void 0) applyOdfGeometry(element, vector.frame, vector.rotationDeg);
266
+ return element;
267
+ }
209
268
  //#endregion
210
- export { OdgBoxVector, OdgLineVector, OdgPathVector, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement };
269
+ export { OdgBoxVector, OdgLineVector, OdgPathVector, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
@@ -18,7 +18,10 @@ function buildOdpPackage(content) {
18
18
  }
19
19
  function appendShape(slide, shape) {
20
20
  const [onlyBlock] = shape.blocks;
21
- if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && require_model_embedded_drawing.drawingOfBlock(onlyBlock) !== void 0) return;
21
+ if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && require_model_embedded_drawing.drawingOfBlock(onlyBlock) !== void 0) {
22
+ for (const vector of require_model_embedded_drawing.embeddedDrawingVectors(onlyBlock, shape.frame)) slide.addVector(vector);
23
+ return;
24
+ }
22
25
  if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
23
26
  const imageShape = slide.addImage({
24
27
  frame: shape.frame,
@@ -1,4 +1,4 @@
1
- import { drawingOfBlock } from "../../model/embedded-drawing.js";
1
+ import { drawingOfBlock, embeddedDrawingVectors } from "../../model/embedded-drawing.js";
2
2
  import { populateOdtTable, populateParagraph } from "../odt/content.js";
3
3
  import { createOdp } from "./editor.js";
4
4
  import { base64ToBytes } from "odf.js";
@@ -17,7 +17,10 @@ function buildOdpPackage(content) {
17
17
  }
18
18
  function appendShape(slide, shape) {
19
19
  const [onlyBlock] = shape.blocks;
20
- if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && drawingOfBlock(onlyBlock) !== void 0) return;
20
+ if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && drawingOfBlock(onlyBlock) !== void 0) {
21
+ for (const vector of embeddedDrawingVectors(onlyBlock, shape.frame)) slide.addVector(vector);
22
+ return;
23
+ }
21
24
  if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
22
25
  const imageShape = slide.addImage({
23
26
  frame: shape.frame,
@@ -1,9 +1,9 @@
1
1
  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
+ const require_edit_geometry = require("../geometry.cjs");
4
5
  const require_edit_odt_paragraph = require("../odt/paragraph.cjs");
5
6
  const require_edit_odt_list = require("../odt/list.cjs");
6
- const require_edit_geometry = require("../geometry.cjs");
7
7
  let ooxml_js = require("ooxml.js");
8
8
  let odf_js = require("odf.js");
9
9
  //#region src/edit/odp/shape.ts
@@ -1,2 +1,2 @@
1
- import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-CXZ6fejV.cjs";
1
+ import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-C8qDhn0l.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-CVXedeL7.js";
1
+ import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-XGp__l-J.js";
2
2
  export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
@@ -1,8 +1,8 @@
1
1
  import { el } from "../../xml/fragment.js";
2
2
  import { removeChild } from "../../xml/edit.js";
3
+ import { applyOdfGeometry } from "../geometry.js";
3
4
  import { OdtParagraph, buildParagraph } from "../odt/paragraph.js";
4
5
  import { OdtList, buildList } from "../odt/list.js";
5
- import { applyOdfGeometry } from "../geometry.js";
6
6
  import { attr } from "ooxml.js";
7
7
  import { formatOdfLength, resolveOdfShapeGeometry } from "odf.js";
8
8
  //#region src/edit/odp/shape.ts
@@ -1,6 +1,7 @@
1
1
  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
+ const require_edit_odg_vector = require("../odg/vector.cjs");
4
5
  const require_xml_odf_text = require("../../xml/odf-text.cjs");
5
6
  const require_edit_odt_paragraph = require("../odt/paragraph.cjs");
6
7
  const require_edit_odt_table = require("../odt/table.cjs");
@@ -70,6 +71,9 @@ var OdpSlide = class {
70
71
  table: new require_edit_odt_table.OdtTable(frameElement.children, tableElement, this.context.pkg)
71
72
  };
72
73
  }
74
+ addVector(vector) {
75
+ return require_edit_odg_vector.appendVectorTo(this.live().children, this.context.pkg, vector);
76
+ }
73
77
  get notes() {
74
78
  const notesElement = directChild(this.live(), "presentation:notes");
75
79
  if (notesElement === void 0) return "";
@@ -1,18 +1,20 @@
1
- import { t as Box } from "../../geometry-DaJr8yQW.cjs";
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-CXZ6fejV.cjs";
3
+ import { t as OdpShape } from "../../shape-C8qDhn0l.cjs";
4
+ import { s as OdgVector } from "../../vector-D03KX8Ux.cjs";
4
5
  import { i as TableInit, t as OdtTable } from "../../table-DjYcNOFm.cjs";
6
+ import { ContentVector } from "document-schema.js";
5
7
  import { Package, XmlElement, XmlNode } from "odf.js";
6
8
  //#region src/edit/odp/slide.d.ts
7
9
  interface TextBoxInit {
8
- readonly frame: Box;
10
+ readonly frame: Box$1;
9
11
  readonly text: string;
10
12
  }
11
13
  interface SlideImageInit extends ImageInit {
12
- readonly frame: Box;
14
+ readonly frame: Box$1;
13
15
  }
14
16
  interface SlideTableInit {
15
- readonly frame: Box;
17
+ readonly frame: Box$1;
16
18
  readonly table: TableInit;
17
19
  }
18
20
  interface SlideContext {
@@ -33,6 +35,7 @@ declare class OdpSlide {
33
35
  addTextBox(init: TextBoxInit): OdpShape;
34
36
  addImage(init: SlideImageInit): OdpShape;
35
37
  addTable(init: SlideTableInit): OdpTableShape;
38
+ addVector(vector: ContentVector): OdgVector;
36
39
  get notes(): string;
37
40
  set notes(value: string);
38
41
  remove(): void;
@@ -1,18 +1,20 @@
1
- import { t as Box } from "../../geometry-DaJr8yQW.js";
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-CVXedeL7.js";
4
- import { i as TableInit, t as OdtTable } from "../../table-DqfqMkVq.js";
3
+ import { t as OdpShape } from "../../shape-XGp__l-J.js";
4
+ import { s as OdgVector } from "../../vector-D03KX8Ux.js";
5
+ import { i as TableInit, t as OdtTable } from "../../table-BHeUmLzZ.js";
6
+ import { ContentVector } from "document-schema.js";
5
7
  import { Package, XmlElement, XmlNode } from "odf.js";
6
8
  //#region src/edit/odp/slide.d.ts
7
9
  interface TextBoxInit {
8
- readonly frame: Box;
10
+ readonly frame: Box$1;
9
11
  readonly text: string;
10
12
  }
11
13
  interface SlideImageInit extends ImageInit {
12
- readonly frame: Box;
14
+ readonly frame: Box$1;
13
15
  }
14
16
  interface SlideTableInit {
15
- readonly frame: Box;
17
+ readonly frame: Box$1;
16
18
  readonly table: TableInit;
17
19
  }
18
20
  interface SlideContext {
@@ -33,6 +35,7 @@ declare class OdpSlide {
33
35
  addTextBox(init: TextBoxInit): OdpShape;
34
36
  addImage(init: SlideImageInit): OdpShape;
35
37
  addTable(init: SlideTableInit): OdpTableShape;
38
+ addVector(vector: ContentVector): OdgVector;
36
39
  get notes(): string;
37
40
  set notes(value: string);
38
41
  remove(): void;
@@ -1,5 +1,6 @@
1
1
  import { el } from "../../xml/fragment.js";
2
2
  import { removeChild } from "../../xml/edit.js";
3
+ import { appendVectorTo } from "../odg/vector.js";
3
4
  import { decodeOdfText as decodeOdfText$1 } from "../../xml/odf-text.js";
4
5
  import { buildParagraph } from "../odt/paragraph.js";
5
6
  import { OdtTable, buildTable } from "../odt/table.js";
@@ -69,6 +70,9 @@ var OdpSlide = class {
69
70
  table: new OdtTable(frameElement.children, tableElement, this.context.pkg)
70
71
  };
71
72
  }
73
+ addVector(vector) {
74
+ return appendVectorTo(this.live().children, this.context.pkg, vector);
75
+ }
72
76
  get notes() {
73
77
  const notesElement = directChild(this.live(), "presentation:notes");
74
78
  if (notesElement === void 0) return "";
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs");
2
3
  const require_model_formula = require("../../model/formula.cjs");
3
4
  const require_edit_odt_editor = require("./editor.cjs");
4
5
  //#region src/edit/odt/content.ts
@@ -137,6 +138,10 @@ function appendBlock(body, block) {
137
138
  else if (block.kind === "embeddedObject") appendEmbeddedObject(body, block);
138
139
  }
139
140
  function appendEmbeddedObject(body, block) {
141
+ if (require_model_embedded_drawing.drawingOfBlock(block) !== void 0) {
142
+ body.appendVectors(require_model_embedded_drawing.embeddedDrawingVectors(block, require_model_embedded_drawing.FLOW_CONTAINER_ORIGIN));
143
+ return;
144
+ }
140
145
  const formula = require_model_formula.formulaOfBlock(block);
141
146
  if (formula === void 0) return;
142
147
  if (formula.mathml.length === 0) {
@@ -1,5 +1,5 @@
1
- import { t as OdtParagraph } from "../../paragraph-CoUi_88j.js";
2
- import { t as OdtTable } from "../../table-DqfqMkVq.js";
1
+ import { t as OdtParagraph } from "../../paragraph-DndYbWuT.js";
2
+ import { t as OdtTable } from "../../table-BHeUmLzZ.js";
3
3
  import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
4
4
  import { Package } from "odf.js";
5
5
  //#region src/edit/odt/content.d.ts
@@ -1,3 +1,4 @@
1
+ import { FLOW_CONTAINER_ORIGIN, drawingOfBlock, embeddedDrawingVectors } from "../../model/embedded-drawing.js";
1
2
  import { formulaOfBlock, formulaPlaceholderText } from "../../model/formula.js";
2
3
  import { createOdt } from "./editor.js";
3
4
  //#region src/edit/odt/content.ts
@@ -136,6 +137,10 @@ function appendBlock(body, block) {
136
137
  else if (block.kind === "embeddedObject") appendEmbeddedObject(body, block);
137
138
  }
138
139
  function appendEmbeddedObject(body, block) {
140
+ if (drawingOfBlock(block) !== void 0) {
141
+ body.appendVectors(embeddedDrawingVectors(block, FLOW_CONTAINER_ORIGIN));
142
+ return;
143
+ }
139
144
  const formula = formulaOfBlock(block);
140
145
  if (formula === void 0) return;
141
146
  if (formula.mathml.length === 0) {