odf.js 6.3.0 → 6.4.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 (128) hide show
  1. package/README.md +172 -18
  2. package/dist/{codec-BnzBd5_I.d.cts → codec-CFdlbFLJ.d.cts} +16 -10
  3. package/dist/{codec-Dg_HWuH1.d.ts → codec-DTAgph2r.d.ts} +16 -10
  4. package/dist/codec.d.cts +1 -1
  5. package/dist/codec.d.ts +1 -1
  6. package/dist/{embedded-BONPxvS3.js → embedded-BnavfkP-.js} +3 -3
  7. package/dist/{embedded-wrtHCJ68.cjs → embedded-Bxyss_ck.cjs} +14 -2
  8. package/dist/index.cjs +34 -1
  9. package/dist/index.d.cts +19 -13
  10. package/dist/index.d.ts +19 -13
  11. package/dist/index.js +12 -6
  12. package/dist/{list-vhXd0Jf6.d.ts → list-7FO0SDqZ.d.ts} +14 -1
  13. package/dist/{list-Bttwr1mk.d.cts → list-BorrTJBY.d.cts} +14 -1
  14. package/dist/{ns-C14w-Zhf.d.cts → ns-DrleaIZQ.d.cts} +3 -1
  15. package/dist/{ns-CTyKJZeF.d.ts → ns-E0TfX9tZ.d.ts} +3 -1
  16. package/dist/ooo1/ns.cjs +9 -0
  17. package/dist/ooo1/ns.d.cts +2 -2
  18. package/dist/ooo1/ns.d.ts +2 -2
  19. package/dist/ooo1/ns.js +8 -1
  20. package/dist/ooo1/properties.cjs +30 -0
  21. package/dist/ooo1/properties.d.cts +6 -2
  22. package/dist/ooo1/properties.d.ts +6 -2
  23. package/dist/ooo1/properties.js +30 -1
  24. package/dist/ooo1/read.cjs +1 -1
  25. package/dist/ooo1/read.d.cts +1 -1
  26. package/dist/ooo1/read.d.ts +1 -1
  27. package/dist/ooo1/read.js +1 -1
  28. package/dist/ooo1/transform.cjs +290 -0
  29. package/dist/ooo1/transform.d.cts +2 -2
  30. package/dist/ooo1/transform.d.ts +2 -2
  31. package/dist/ooo1/transform.js +293 -4
  32. package/dist/ooo1/write.cjs +40 -0
  33. package/dist/ooo1/write.d.cts +2 -0
  34. package/dist/ooo1/write.d.ts +2 -0
  35. package/dist/ooo1/write.js +32 -0
  36. package/dist/package-io/scaffold.cjs +2 -1
  37. package/dist/package-io/scaffold.js +2 -1
  38. package/dist/{paragraph-BdwsQisB.d.cts → paragraph-Bf6Iq5wC.d.cts} +1 -1
  39. package/dist/{paragraph-BoVy1LrN.d.ts → paragraph-DtC86tft.d.ts} +1 -1
  40. package/dist/{path-CK0dIPgx.d.cts → path-8HQS-J7y.d.cts} +3 -1
  41. package/dist/{path-CK0dIPgx.d.ts → path-8HQS-J7y.d.ts} +3 -1
  42. package/dist/{read-Bo1GBjSE.d.ts → read-A3CJkqVM.d.ts} +3 -1
  43. package/dist/{read-RFqq4ckj.d.cts → read-BgnLFuSi.d.cts} +1 -1
  44. package/dist/{read-3yy5EFV_.d.ts → read-CqaZ01kU.d.ts} +1 -1
  45. package/dist/{read-tpfiT_n4.d.cts → read-fphkvCpR.d.cts} +3 -1
  46. package/dist/{shapes-DUzrrf7b.d.ts → shapes-B6Ms7ibr.d.ts} +1 -1
  47. package/dist/{shapes-BQhXAk0D.d.cts → shapes-CbBc9t0y.d.cts} +1 -1
  48. package/dist/{table-ByhqRnSG.d.cts → table-CECMtPxZ.d.cts} +6 -2
  49. package/dist/{table-DElqGcT0.d.ts → table-XuniPr2I.d.ts} +6 -2
  50. package/dist/{transform-SDysw9wx.d.cts → transform-DFCPKX7e.d.cts} +2 -1
  51. package/dist/{transform-DRr76JEu.d.ts → transform-DPliWQuD.d.ts} +2 -1
  52. package/dist/typed/draw/embedded.cjs +1 -1
  53. package/dist/typed/draw/embedded.js +1 -1
  54. package/dist/typed/draw/shapes.cjs +7 -2
  55. package/dist/typed/draw/shapes.d.cts +1 -1
  56. package/dist/typed/draw/shapes.d.ts +1 -1
  57. package/dist/typed/draw/shapes.js +7 -2
  58. package/dist/typed/draw/write-shapes.cjs +210 -0
  59. package/dist/typed/draw/write-shapes.d.cts +2 -0
  60. package/dist/typed/draw/write-shapes.d.ts +2 -0
  61. package/dist/typed/draw/write-shapes.js +203 -0
  62. package/dist/typed/draw/write-vectors.cjs +132 -0
  63. package/dist/typed/draw/write-vectors.d.cts +2 -0
  64. package/dist/typed/draw/write-vectors.d.ts +2 -0
  65. package/dist/typed/draw/write-vectors.js +129 -0
  66. package/dist/typed/odb/form.cjs +1 -1
  67. package/dist/typed/odb/form.js +1 -1
  68. package/dist/typed/odg/write.cjs +80 -0
  69. package/dist/typed/odg/write.d.cts +2 -0
  70. package/dist/typed/odg/write.d.ts +2 -0
  71. package/dist/typed/odg/write.js +77 -0
  72. package/dist/typed/odp/write.cjs +108 -0
  73. package/dist/typed/odp/write.d.cts +2 -0
  74. package/dist/typed/odp/write.d.ts +2 -0
  75. package/dist/typed/odp/write.js +105 -0
  76. package/dist/typed/ods/read.cjs +3 -1
  77. package/dist/typed/ods/read.d.cts +2 -2
  78. package/dist/typed/ods/read.d.ts +2 -2
  79. package/dist/typed/ods/read.js +2 -2
  80. package/dist/typed/ods/write.cjs +578 -0
  81. package/dist/typed/ods/write.d.cts +2 -0
  82. package/dist/typed/ods/write.d.ts +2 -0
  83. package/dist/typed/ods/write.js +575 -0
  84. package/dist/typed/odt/read.cjs +1 -1
  85. package/dist/typed/odt/read.js +1 -1
  86. package/dist/typed/odt/write.cjs +9 -140
  87. package/dist/typed/odt/write.d.cts +1 -1
  88. package/dist/typed/odt/write.d.ts +1 -1
  89. package/dist/typed/odt/write.js +8 -139
  90. package/dist/typed/shared/canonicalise.cjs +126 -0
  91. package/dist/typed/shared/canonicalise.d.cts +10 -0
  92. package/dist/typed/shared/canonicalise.d.ts +10 -0
  93. package/dist/typed/shared/canonicalise.js +120 -0
  94. package/dist/typed/shared/list.cjs +32 -0
  95. package/dist/typed/shared/list.d.cts +2 -2
  96. package/dist/typed/shared/list.d.ts +2 -2
  97. package/dist/typed/shared/list.js +28 -1
  98. package/dist/typed/shared/paragraph.d.cts +1 -1
  99. package/dist/typed/shared/paragraph.d.ts +1 -1
  100. package/dist/typed/shared/path.cjs +19 -0
  101. package/dist/typed/shared/path.d.cts +2 -2
  102. package/dist/typed/shared/path.d.ts +2 -2
  103. package/dist/typed/shared/path.js +18 -1
  104. package/dist/typed/shared/table.cjs +3 -0
  105. package/dist/typed/shared/table.d.cts +2 -2
  106. package/dist/typed/shared/table.d.ts +2 -2
  107. package/dist/typed/shared/table.js +1 -1
  108. package/dist/typed/shared/units.cjs +16 -1
  109. package/dist/typed/shared/units.d.cts +2 -2
  110. package/dist/typed/shared/units.d.ts +2 -2
  111. package/dist/typed/shared/units.js +16 -2
  112. package/dist/{units-BQSNkTQZ.d.ts → units-DdyaQolR.d.cts} +2 -1
  113. package/dist/{units-BQSNkTQZ.d.cts → units-DdyaQolR.d.ts} +2 -1
  114. package/dist/write-4kMi-asu.d.ts +14 -0
  115. package/dist/write-BZXpT8F6.d.cts +17 -0
  116. package/dist/write-BhG3t3fJ.d.cts +14 -0
  117. package/dist/write-BuLQmwLD.d.cts +14 -0
  118. package/dist/write-C2c4xBXs.d.cts +14 -0
  119. package/dist/{write-7Uu_wlkL.d.cts → write-CPATqG4v.d.cts} +1 -0
  120. package/dist/write-CfTE2jY8.d.ts +14 -0
  121. package/dist/write-DttX1rTC.d.ts +14 -0
  122. package/dist/{write-DGcI9W7Z.d.ts → write-JERychL3.d.ts} +1 -0
  123. package/dist/write-SKnCTU4C.d.ts +17 -0
  124. package/dist/write-shapes-Co7BrmMZ.d.ts +36 -0
  125. package/dist/write-shapes-D4piGKf4.d.cts +36 -0
  126. package/dist/write-vectors-B-RVHAKI.d.cts +11 -0
  127. package/dist/write-vectors-CYjZoVBW.d.ts +11 -0
  128. package/package.json +2 -2
@@ -0,0 +1,40 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_typed_odp_write = require("../typed/odp/write.cjs");
3
+ const require_typed_odt_write = require("../typed/odt/write.cjs");
4
+ const require_typed_odg_write = require("../typed/odg/write.cjs");
5
+ const require_typed_ods_write = require("../typed/ods/write.cjs");
6
+ const require_ooo1_transform = require("./transform.cjs");
7
+ //#region src/ooo1/write.ts
8
+ function writeSxw(document, options = {}) {
9
+ return require_ooo1_transform.transformToOoo1Package(require_typed_odt_write.writeOdt(document, options));
10
+ }
11
+ function writeSxwContent(document, options = {}) {
12
+ return require_ooo1_transform.transformToOoo1Package(require_typed_odt_write.writeOdtContent(document, options));
13
+ }
14
+ function writeSxc(document, options = {}) {
15
+ return require_ooo1_transform.transformToOoo1Package(require_typed_ods_write.writeOds(document, options));
16
+ }
17
+ function writeSxcContent(document, options = {}) {
18
+ return require_ooo1_transform.transformToOoo1Package(require_typed_ods_write.writeOdsContent(document, options));
19
+ }
20
+ function writeSxi(document, options = {}) {
21
+ return require_ooo1_transform.transformToOoo1Package(require_typed_odp_write.writeOdp(document, options));
22
+ }
23
+ function writeSxiContent(document, options = {}) {
24
+ return require_ooo1_transform.transformToOoo1Package(require_typed_odp_write.writeOdpContent(document, options));
25
+ }
26
+ function writeSxd(document, options = {}) {
27
+ return require_ooo1_transform.transformToOoo1Package(require_typed_odg_write.writeOdg(document, options));
28
+ }
29
+ function writeSxdContent(document, options = {}) {
30
+ return require_ooo1_transform.transformToOoo1Package(require_typed_odg_write.writeOdgContent(document, options));
31
+ }
32
+ //#endregion
33
+ exports.writeSxc = writeSxc;
34
+ exports.writeSxcContent = writeSxcContent;
35
+ exports.writeSxd = writeSxd;
36
+ exports.writeSxdContent = writeSxdContent;
37
+ exports.writeSxi = writeSxi;
38
+ exports.writeSxiContent = writeSxiContent;
39
+ exports.writeSxw = writeSxw;
40
+ exports.writeSxwContent = writeSxwContent;
@@ -0,0 +1,2 @@
1
+ import { a as writeSxi, c as writeSxwContent, i as writeSxdContent, n as writeSxcContent, o as writeSxiContent, r as writeSxd, s as writeSxw, t as writeSxc } from "../write-BZXpT8F6.cjs";
2
+ export { writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent };
@@ -0,0 +1,2 @@
1
+ import { a as writeSxi, c as writeSxwContent, i as writeSxdContent, n as writeSxcContent, o as writeSxiContent, r as writeSxd, s as writeSxw, t as writeSxc } from "../write-SKnCTU4C.js";
2
+ export { writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent };
@@ -0,0 +1,32 @@
1
+ import { writeOdp, writeOdpContent } from "../typed/odp/write.js";
2
+ import { writeOdt, writeOdtContent } from "../typed/odt/write.js";
3
+ import { writeOdg, writeOdgContent } from "../typed/odg/write.js";
4
+ import { writeOds, writeOdsContent } from "../typed/ods/write.js";
5
+ import { transformToOoo1Package } from "./transform.js";
6
+ //#region src/ooo1/write.ts
7
+ function writeSxw(document, options = {}) {
8
+ return transformToOoo1Package(writeOdt(document, options));
9
+ }
10
+ function writeSxwContent(document, options = {}) {
11
+ return transformToOoo1Package(writeOdtContent(document, options));
12
+ }
13
+ function writeSxc(document, options = {}) {
14
+ return transformToOoo1Package(writeOds(document, options));
15
+ }
16
+ function writeSxcContent(document, options = {}) {
17
+ return transformToOoo1Package(writeOdsContent(document, options));
18
+ }
19
+ function writeSxi(document, options = {}) {
20
+ return transformToOoo1Package(writeOdp(document, options));
21
+ }
22
+ function writeSxiContent(document, options = {}) {
23
+ return transformToOoo1Package(writeOdpContent(document, options));
24
+ }
25
+ function writeSxd(document, options = {}) {
26
+ return transformToOoo1Package(writeOdg(document, options));
27
+ }
28
+ function writeSxdContent(document, options = {}) {
29
+ return transformToOoo1Package(writeOdgContent(document, options));
30
+ }
31
+ //#endregion
32
+ export { writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent };
@@ -15,7 +15,8 @@ const ODF_DOCUMENT_PREFIXES = [
15
15
  "dc",
16
16
  "meta",
17
17
  "number",
18
- "svg"
18
+ "svg",
19
+ "presentation"
19
20
  ];
20
21
  const DEFAULT_ODF_VERSION = "1.3";
21
22
  function documentPartNodes(rootTag, version, containers) {
@@ -14,7 +14,8 @@ const ODF_DOCUMENT_PREFIXES = [
14
14
  "dc",
15
15
  "meta",
16
16
  "number",
17
- "svg"
17
+ "svg",
18
+ "presentation"
18
19
  ];
19
20
  const DEFAULT_ODF_VERSION = "1.3";
20
21
  function documentPartNodes(rootTag, version, containers) {
@@ -2,7 +2,7 @@ import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.cjs";
2
2
  import { r as Package } from "./package-DMk9fuTI.cjs";
3
3
  import { n as StyleProperties } from "./properties-CiIoNu2h.cjs";
4
4
  import { a as StyleRegistry } from "./registry-PoQIRgbY.cjs";
5
- import { n as OdfListIdState } from "./list-Bttwr1mk.cjs";
5
+ import { i as OdfListIdState } from "./list-BorrTJBY.cjs";
6
6
  import { a as OdfDefinitionsSink, l as OdfResidueFormat, s as OdfMarkerHalf } from "./constructs-BzLZy5YP.cjs";
7
7
  import { ContentBlock, ContentParagraph, ContentRun, ProvenanceDescriptor } from "document-schema.js";
8
8
  //#region src/typed/shared/paragraph.d.ts
@@ -2,7 +2,7 @@ import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.js";
2
2
  import { r as Package } from "./package-otZYrxiO.js";
3
3
  import { n as StyleProperties } from "./properties-CJyykyc_.js";
4
4
  import { a as StyleRegistry } from "./registry-C_16-N6i.js";
5
- import { n as OdfListIdState } from "./list-vhXd0Jf6.js";
5
+ import { i as OdfListIdState } from "./list-7FO0SDqZ.js";
6
6
  import { a as OdfDefinitionsSink, l as OdfResidueFormat, s as OdfMarkerHalf } from "./constructs-BntJjuvH.js";
7
7
  import { ContentBlock, ContentParagraph, ContentRun, ProvenanceDescriptor } from "document-schema.js";
8
8
  //#region src/typed/shared/paragraph.d.ts
@@ -30,5 +30,7 @@ declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: bo
30
30
  declare function parseOdfPathData(d: string): OdfRawSubpath[];
31
31
  declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
32
32
  declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
33
+ declare function formatOdfViewBox(frame: Box): string;
34
+ declare function formatOdfPathData(subpaths: readonly ContentSubpath[]): string;
33
35
  //#endregion
34
- export { buildOdfSubpaths as a, parseOdfViewBox as c, OdfViewBox as i, rawSubpathFromPoints as l, OdfRawSegment as n, parseOdfPathData as o, OdfRawSubpath as r, parseOdfPointsList as s, OdfRawPoint as t, scaleOdfRawPoint as u };
36
+ export { buildOdfSubpaths as a, parseOdfPathData as c, rawSubpathFromPoints as d, scaleOdfRawPoint as f, OdfViewBox as i, parseOdfPointsList as l, OdfRawSegment as n, formatOdfPathData as o, OdfRawSubpath as r, formatOdfViewBox as s, OdfRawPoint as t, parseOdfViewBox as u };
@@ -30,5 +30,7 @@ declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: bo
30
30
  declare function parseOdfPathData(d: string): OdfRawSubpath[];
31
31
  declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
32
32
  declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
33
+ declare function formatOdfViewBox(frame: Box): string;
34
+ declare function formatOdfPathData(subpaths: readonly ContentSubpath[]): string;
33
35
  //#endregion
34
- export { buildOdfSubpaths as a, parseOdfViewBox as c, OdfViewBox as i, rawSubpathFromPoints as l, OdfRawSegment as n, parseOdfPathData as o, OdfRawSubpath as r, parseOdfPointsList as s, OdfRawPoint as t, scaleOdfRawPoint as u };
36
+ export { buildOdfSubpaths as a, parseOdfPathData as c, rawSubpathFromPoints as d, scaleOdfRawPoint as f, OdfViewBox as i, parseOdfPointsList as l, OdfRawSegment as n, formatOdfPathData as o, OdfRawSubpath as r, formatOdfViewBox as s, OdfRawPoint as t, parseOdfViewBox as u };
@@ -7,7 +7,9 @@ interface OdsDocument {
7
7
  definitions?: DefinitionsTable;
8
8
  source?: Record<string, SourceResidue>;
9
9
  }
10
+ declare const DEFAULT_COLUMN_WIDTH_PT = 64;
11
+ declare const DEFAULT_ROW_HEIGHT_PT = 15;
10
12
  declare function readOdsContent(pkg: Package): OdsDocument;
11
13
  declare function readOds(pkg: Package): DocumentTree;
12
14
  //#endregion
13
- export { readOds as n, readOdsContent as r, OdsDocument as t };
15
+ export { readOdsContent as a, readOds as i, DEFAULT_ROW_HEIGHT_PT as n, OdsDocument as r, DEFAULT_COLUMN_WIDTH_PT as t };
@@ -2,7 +2,7 @@ import { r as Package } from "./package-DMk9fuTI.cjs";
2
2
  import { t as OdpDocument } from "./read-DHOQqjOZ.cjs";
3
3
  import { i as OdtReadOptions, t as OdtDocument } from "./read-Dy5p1OMb.cjs";
4
4
  import { t as OdgDocument } from "./read-DSyz0YLj.cjs";
5
- import { t as OdsDocument } from "./read-tpfiT_n4.cjs";
5
+ import { r as OdsDocument } from "./read-fphkvCpR.cjs";
6
6
  import { DocumentTree } from "document-schema.js";
7
7
  //#region src/ooo1/read.d.ts
8
8
  declare function readSxwContent(pkg: Package, options?: OdtReadOptions): OdtDocument;
@@ -2,7 +2,7 @@ import { r as Package } from "./package-otZYrxiO.js";
2
2
  import { t as OdpDocument } from "./read-DUOJ-1hX.js";
3
3
  import { i as OdtReadOptions, t as OdtDocument } from "./read-BcxAWBB5.js";
4
4
  import { t as OdgDocument } from "./read-D3wLfr-7.js";
5
- import { t as OdsDocument } from "./read-Bo1GBjSE.js";
5
+ import { r as OdsDocument } from "./read-A3CJkqVM.js";
6
6
  import { DocumentTree } from "document-schema.js";
7
7
  //#region src/ooo1/read.d.ts
8
8
  declare function readSxwContent(pkg: Package, options?: OdtReadOptions): OdtDocument;
@@ -7,7 +7,9 @@ interface OdsDocument {
7
7
  definitions?: DefinitionsTable;
8
8
  source?: Record<string, SourceResidue>;
9
9
  }
10
+ declare const DEFAULT_COLUMN_WIDTH_PT = 64;
11
+ declare const DEFAULT_ROW_HEIGHT_PT = 15;
10
12
  declare function readOdsContent(pkg: Package): OdsDocument;
11
13
  declare function readOds(pkg: Package): DocumentTree;
12
14
  //#endregion
13
- export { readOds as n, readOdsContent as r, OdsDocument as t };
15
+ export { readOdsContent as a, readOds as i, DEFAULT_ROW_HEIGHT_PT as n, OdsDocument as r, DEFAULT_COLUMN_WIDTH_PT as t };
@@ -1,6 +1,6 @@
1
1
  import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.js";
2
2
  import { r as Package } from "./package-otZYrxiO.js";
3
- import { n as OdfListIdState } from "./list-vhXd0Jf6.js";
3
+ import { i as OdfListIdState } from "./list-7FO0SDqZ.js";
4
4
  import { r as OdfTransformFunction } from "./transform-BFNc16LQ.js";
5
5
  import { Box, ContentImageBlock, ContentShape, ContentVector } from "document-schema.js";
6
6
  //#region src/typed/draw/shapes.d.ts
@@ -1,6 +1,6 @@
1
1
  import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.cjs";
2
2
  import { r as Package } from "./package-DMk9fuTI.cjs";
3
- import { n as OdfListIdState } from "./list-Bttwr1mk.cjs";
3
+ import { i as OdfListIdState } from "./list-BorrTJBY.cjs";
4
4
  import { r as OdfTransformFunction } from "./transform-M1gbHp4j.cjs";
5
5
  import { Box, ContentImageBlock, ContentShape, ContentVector } from "document-schema.js";
6
6
  //#region src/typed/draw/shapes.d.ts
@@ -1,8 +1,11 @@
1
1
  import { l as XmlElement } from "./node-B6JX5CRX.cjs";
2
2
  import { r as Package } from "./package-DMk9fuTI.cjs";
3
3
  import { a as StyleRegistry } from "./registry-PoQIRgbY.cjs";
4
- import { Alignment, Color, ContentCellBorders, ContentTable } from "document-schema.js";
4
+ import { Alignment, Color, ContentBorder, ContentCellBorders, ContentTable } from "document-schema.js";
5
5
  //#region src/typed/shared/table.d.ts
6
+ type BorderEdgeKey = "left" | "right" | "top" | "bottom";
7
+ declare const BORDER_EDGE_KEYS: readonly BorderEdgeKey[];
8
+ declare const BORDER_EDGE_ATTRS: Readonly<Record<BorderEdgeKey, string>>;
6
9
  interface CellStyleDecoration {
7
10
  background?: Color;
8
11
  borders?: ContentCellBorders;
@@ -10,7 +13,8 @@ interface CellStyleDecoration {
10
13
  verticalAlignment?: "top" | "middle" | "bottom";
11
14
  }
12
15
  declare function readCellStyleDecoration(elements: readonly XmlElement[]): CellStyleDecoration;
16
+ declare function formatBorderEdge(border: ContentBorder): string;
13
17
  declare function writeOdfTable(table: ContentTable, registry: StyleRegistry, tableName: string): XmlElement;
14
18
  declare function readOdfTable(tableElement: XmlElement, pkg: Package): ContentTable;
15
19
  //#endregion
16
- export { writeOdfTable as i, readCellStyleDecoration as n, readOdfTable as r, CellStyleDecoration as t };
20
+ export { formatBorderEdge as a, writeOdfTable as c, CellStyleDecoration as i, BORDER_EDGE_KEYS as n, readCellStyleDecoration as o, BorderEdgeKey as r, readOdfTable as s, BORDER_EDGE_ATTRS as t };
@@ -1,8 +1,11 @@
1
1
  import { l as XmlElement } from "./node-B6JX5CRX.js";
2
2
  import { r as Package } from "./package-otZYrxiO.js";
3
3
  import { a as StyleRegistry } from "./registry-C_16-N6i.js";
4
- import { Alignment, Color, ContentCellBorders, ContentTable } from "document-schema.js";
4
+ import { Alignment, Color, ContentBorder, ContentCellBorders, ContentTable } from "document-schema.js";
5
5
  //#region src/typed/shared/table.d.ts
6
+ type BorderEdgeKey = "left" | "right" | "top" | "bottom";
7
+ declare const BORDER_EDGE_KEYS: readonly BorderEdgeKey[];
8
+ declare const BORDER_EDGE_ATTRS: Readonly<Record<BorderEdgeKey, string>>;
6
9
  interface CellStyleDecoration {
7
10
  background?: Color;
8
11
  borders?: ContentCellBorders;
@@ -10,7 +13,8 @@ interface CellStyleDecoration {
10
13
  verticalAlignment?: "top" | "middle" | "bottom";
11
14
  }
12
15
  declare function readCellStyleDecoration(elements: readonly XmlElement[]): CellStyleDecoration;
16
+ declare function formatBorderEdge(border: ContentBorder): string;
13
17
  declare function writeOdfTable(table: ContentTable, registry: StyleRegistry, tableName: string): XmlElement;
14
18
  declare function readOdfTable(tableElement: XmlElement, pkg: Package): ContentTable;
15
19
  //#endregion
16
- export { writeOdfTable as i, readCellStyleDecoration as n, readOdfTable as r, CellStyleDecoration as t };
20
+ export { formatBorderEdge as a, writeOdfTable as c, CellStyleDecoration as i, BORDER_EDGE_KEYS as n, readCellStyleDecoration as o, BorderEdgeKey as r, readOdfTable as s, BORDER_EDGE_ATTRS as t };
@@ -1,5 +1,6 @@
1
1
  import { r as Package } from "./package-DMk9fuTI.cjs";
2
2
  //#region src/ooo1/transform.d.ts
3
3
  declare function transformOoo1Package(pkg: Package): Package;
4
+ declare function transformToOoo1Package(pkg: Package): Package;
4
5
  //#endregion
5
- export { transformOoo1Package as t };
6
+ export { transformToOoo1Package as n, transformOoo1Package as t };
@@ -1,5 +1,6 @@
1
1
  import { r as Package } from "./package-otZYrxiO.js";
2
2
  //#region src/ooo1/transform.d.ts
3
3
  declare function transformOoo1Package(pkg: Package): Package;
4
+ declare function transformToOoo1Package(pkg: Package): Package;
4
5
  //#endregion
5
- export { transformOoo1Package as t };
6
+ export { transformToOoo1Package as n, transformOoo1Package as t };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_embedded = require("../../embedded-wrtHCJ68.cjs");
2
+ const require_embedded = require("../../embedded-Bxyss_ck.cjs");
3
3
  exports.readDrawObjectReference = require_embedded.readDrawObjectReference;
4
4
  exports.readEmbeddedObjectDocument = require_embedded.readEmbeddedObjectDocument;
5
5
  exports.readOdfChartContent = require_embedded.readOdfChartContent;
@@ -1,2 +1,2 @@
1
- import { n as readEmbeddedObjectDocument, r as readOdfChartContent, t as readDrawObjectReference } from "../../embedded-BONPxvS3.js";
1
+ import { n as readEmbeddedObjectDocument, r as readOdfChartContent, t as readDrawObjectReference } from "../../embedded-BnavfkP-.js";
2
2
  export { readDrawObjectReference, readEmbeddedObjectDocument, readOdfChartContent };
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_util_base64 = require("../../util/base64.cjs");
3
3
  const require_image_sniff = require("../../image/sniff.cjs");
4
+ const require_xml_entities = require("../../xml/entities.cjs");
4
5
  const require_typed_shared_units = require("../shared/units.cjs");
5
6
  const require_typed_shared_color = require("../shared/color.cjs");
6
7
  const require_xml_query = require("../../xml/query.cjs");
@@ -40,6 +41,10 @@ function readFrameInsets(frame, pkg) {
40
41
  }
41
42
  return insets;
42
43
  }
44
+ function readDrawName(element) {
45
+ const raw = require_xml_query.attrValue(element, "draw:name");
46
+ return raw === void 0 ? void 0 : require_xml_entities.decodeXmlText(raw);
47
+ }
43
48
  function readFrameAltText(frame) {
44
49
  const title = require_xml_query.childrenWithTag(frame, "svg:title")[0];
45
50
  const decodedTitle = title === void 0 ? void 0 : require_typed_shared_text.decodeOdfText(title);
@@ -97,7 +102,7 @@ function readDrawFrame(frame, groupFunctions, pkg, listIdState = { next: 1 }, fl
97
102
  if (ownGeometry === void 0) return;
98
103
  const geometry = require_typed_shared_transform.composeOdfGroupTransform(groupFunctions, ownGeometry);
99
104
  return {
100
- name: require_xml_query.attrValue(frame, "draw:name"),
105
+ name: readDrawName(frame),
101
106
  frame: geometry.frame,
102
107
  rotationDeg: geometry.rotationDeg,
103
108
  ...readFrameInsets(frame, pkg),
@@ -287,7 +292,7 @@ function readCustomShapeAsTextShape(element, groupFunctions, pkg) {
287
292
  const geometry = require_typed_shared_transform.composeOdfGroupTransform(groupFunctions, ownGeometry);
288
293
  const enhancedGeometry = require_xml_query.childrenWithTag(element, "draw:enhanced-geometry")[0];
289
294
  return {
290
- name: require_xml_query.attrValue(element, "draw:name"),
295
+ name: readDrawName(element),
291
296
  frame: geometry.frame,
292
297
  rotationDeg: geometry.rotationDeg,
293
298
  ...readFrameInsets(element, pkg),
@@ -1,2 +1,2 @@
1
- import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-BQhXAk0D.cjs";
1
+ import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-CbBc9t0y.cjs";
2
2
  export { DrawPageContent, readDrawFrame, readDrawImageBlock, readDrawPageContent, walkDrawShapes };
@@ -1,2 +1,2 @@
1
- import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-DUzrrf7b.js";
1
+ import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-B6Ms7ibr.js";
2
2
  export { DrawPageContent, readDrawFrame, readDrawImageBlock, readDrawPageContent, walkDrawShapes };
@@ -1,5 +1,6 @@
1
1
  import { base64ToBytes } from "../../util/base64.js";
2
2
  import { sniffImageFormat } from "../../image/sniff.js";
3
+ import { decodeXmlText } from "../../xml/entities.js";
3
4
  import { parseOdfLength } from "../shared/units.js";
4
5
  import { parseOdfColor } from "../shared/color.js";
5
6
  import { attrValue, childrenWithTag, elementsWithTag } from "../../xml/query.js";
@@ -39,6 +40,10 @@ function readFrameInsets(frame, pkg) {
39
40
  }
40
41
  return insets;
41
42
  }
43
+ function readDrawName(element) {
44
+ const raw = attrValue(element, "draw:name");
45
+ return raw === void 0 ? void 0 : decodeXmlText(raw);
46
+ }
42
47
  function readFrameAltText(frame) {
43
48
  const title = childrenWithTag(frame, "svg:title")[0];
44
49
  const decodedTitle = title === void 0 ? void 0 : decodeOdfText(title);
@@ -96,7 +101,7 @@ function readDrawFrame(frame, groupFunctions, pkg, listIdState = { next: 1 }, fl
96
101
  if (ownGeometry === void 0) return;
97
102
  const geometry = composeOdfGroupTransform(groupFunctions, ownGeometry);
98
103
  return {
99
- name: attrValue(frame, "draw:name"),
104
+ name: readDrawName(frame),
100
105
  frame: geometry.frame,
101
106
  rotationDeg: geometry.rotationDeg,
102
107
  ...readFrameInsets(frame, pkg),
@@ -286,7 +291,7 @@ function readCustomShapeAsTextShape(element, groupFunctions, pkg) {
286
291
  const geometry = composeOdfGroupTransform(groupFunctions, ownGeometry);
287
292
  const enhancedGeometry = childrenWithTag(element, "draw:enhanced-geometry")[0];
288
293
  return {
289
- name: attrValue(element, "draw:name"),
294
+ name: readDrawName(element),
290
295
  frame: geometry.frame,
291
296
  rotationDeg: geometry.rotationDeg,
292
297
  ...readFrameInsets(element, pkg),
@@ -0,0 +1,210 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_xml_fragment = require("../../xml/fragment.cjs");
3
+ const require_xml_entities = require("../../xml/entities.cjs");
4
+ const require_typed_shared_units = require("../shared/units.cjs");
5
+ const require_typed_shared_list = require("../shared/list.cjs");
6
+ const require_typed_shared_paragraph = require("../shared/paragraph.cjs");
7
+ const require_typed_shared_table = require("../shared/table.cjs");
8
+ const require_typed_shared_canonicalise = require("../shared/canonicalise.cjs");
9
+ //#region src/typed/draw/write-shapes.ts
10
+ function unsupportedShapeContent(what) {
11
+ return /* @__PURE__ */ new Error(`writeDrawFrame: a shape carries ${what}, which this writer does not write yet -- refusing rather than producing a document that silently lost it. See ExaDev/documents.js for the tracked follow-up covering the fidelity constructs.`);
12
+ }
13
+ function planShapeContent(blocks, listState) {
14
+ require_typed_shared_list.closeListPlan(listState);
15
+ if (blocks.length === 1) {
16
+ const only = blocks[0];
17
+ if (only.kind === "table") return {
18
+ kind: "table",
19
+ table: only
20
+ };
21
+ if (only.kind === "image") return {
22
+ kind: "image",
23
+ image: only
24
+ };
25
+ }
26
+ const paragraphs = [];
27
+ for (const block of blocks) {
28
+ if (block.kind === "table") throw unsupportedShapeContent("a table alongside other content (a draw:frame's own content is exactly one of table:table/draw:text-box/draw:image, never a mix)");
29
+ if (block.kind === "image") throw unsupportedShapeContent("an image alongside other content (same reason)");
30
+ if (block.kind === "pageBreak") throw unsupportedShapeContent("a page break (no ODF spelling inside a shape's own text)");
31
+ if (block.kind === "embeddedObject") throw unsupportedShapeContent("an embedded object");
32
+ if (block.kind === "constructStart" || block.kind === "constructEnd") throw unsupportedShapeContent("a construct boundary marker");
33
+ if (block.constructs !== void 0 && block.constructs.length > 0) throw unsupportedShapeContent("a run-level construct extent (a field, bookmark, note, annotation, or tracked change)");
34
+ if (block.headingLevel !== void 0) throw unsupportedShapeContent("a heading (a shape's own draw:text-box has no text:h reading path)");
35
+ const canonicalId = require_typed_shared_list.planListMembership(block.list, listState);
36
+ paragraphs.push(canonicalId === void 0 ? {
37
+ ...block,
38
+ list: void 0
39
+ } : {
40
+ ...block,
41
+ list: {
42
+ numId: canonicalId,
43
+ level: block.list.level
44
+ }
45
+ });
46
+ }
47
+ return {
48
+ kind: "text",
49
+ paragraphs
50
+ };
51
+ }
52
+ function createDrawShapeWriteState(pkg, registry, contentAutomaticStyles) {
53
+ return {
54
+ pkg,
55
+ registry,
56
+ contentAutomaticStyles,
57
+ nextImage: 1,
58
+ nextTable: 1,
59
+ nextListStyle: 1,
60
+ listStyleByKind: /* @__PURE__ */ new Map()
61
+ };
62
+ }
63
+ function listStyleNameFor(kind, state) {
64
+ const existing = state.listStyleByKind.get(kind);
65
+ if (existing !== void 0) return existing;
66
+ const name = `SL${state.nextListStyle}`;
67
+ state.nextListStyle += 1;
68
+ state.listStyleByKind.set(kind, name);
69
+ state.contentAutomaticStyles.children.push(require_typed_shared_list.buildOdfListStyle(name, kind));
70
+ return name;
71
+ }
72
+ function frameGeometryAttrs(frame, rotationDeg) {
73
+ if (rotationDeg === void 0 || rotationDeg === 0) return {
74
+ "svg:x": require_typed_shared_units.formatOdfLength(frame.xPt),
75
+ "svg:y": require_typed_shared_units.formatOdfLength(frame.yPt),
76
+ "svg:width": require_typed_shared_units.formatOdfLength(frame.widthPt),
77
+ "svg:height": require_typed_shared_units.formatOdfLength(frame.heightPt)
78
+ };
79
+ const angleRad = -rotationDeg * Math.PI / 180;
80
+ const cos = Math.cos(angleRad);
81
+ const sin = Math.sin(angleRad);
82
+ const halfWidthPt = frame.widthPt / 2;
83
+ const halfHeightPt = frame.heightPt / 2;
84
+ const txPt = frame.xPt + halfWidthPt - halfWidthPt * cos - halfHeightPt * sin;
85
+ const tyPt = frame.yPt + halfHeightPt - halfHeightPt * cos + halfWidthPt * sin;
86
+ return {
87
+ "svg:width": require_typed_shared_units.formatOdfLength(frame.widthPt),
88
+ "svg:height": require_typed_shared_units.formatOdfLength(frame.heightPt),
89
+ "draw:transform": `rotate(${require_typed_shared_units.formatOdfNumber(angleRad)}) translate(${require_typed_shared_units.formatOdfLength(txPt)} ${require_typed_shared_units.formatOdfLength(tyPt)})`
90
+ };
91
+ }
92
+ function shapeGraphicStyleName(shape, state) {
93
+ const properties = {
94
+ "draw:fill": "none",
95
+ "draw:stroke": "none"
96
+ };
97
+ if (shape.insetLeftPt !== 0 || shape.insetTopPt !== 0 || shape.insetRightPt !== 0 || shape.insetBottomPt !== 0) {
98
+ properties["fo:padding-left"] = require_typed_shared_units.formatOdfLength(shape.insetLeftPt);
99
+ properties["fo:padding-top"] = require_typed_shared_units.formatOdfLength(shape.insetTopPt);
100
+ properties["fo:padding-right"] = require_typed_shared_units.formatOdfLength(shape.insetRightPt);
101
+ properties["fo:padding-bottom"] = require_typed_shared_units.formatOdfLength(shape.insetBottomPt);
102
+ }
103
+ return state.registry.intern({
104
+ properties: {},
105
+ family: "graphic",
106
+ propertyElements: [require_xml_fragment.el("style:graphic-properties", properties)]
107
+ });
108
+ }
109
+ function writeShapeTextBox(paragraphs, state) {
110
+ const out = [];
111
+ let openList;
112
+ const closeList = () => {
113
+ if (openList === void 0) return;
114
+ const kind = require_typed_shared_list.listKindOf(openList.numId);
115
+ const built = require_typed_shared_list.writeOdfList(openList.entries, kind === void 0 ? void 0 : listStyleNameFor(kind, state));
116
+ openList.element.attributes = built.attributes;
117
+ openList.element.children = built.children;
118
+ openList = void 0;
119
+ };
120
+ for (const paragraph of paragraphs) {
121
+ const element = require_typed_shared_paragraph.writeOdfParagraph(paragraph, state.registry);
122
+ const membership = paragraph.list;
123
+ if (membership?.numId === void 0) {
124
+ closeList();
125
+ out.push(element);
126
+ continue;
127
+ }
128
+ if (openList !== void 0 && openList.numId !== membership.numId) closeList();
129
+ if (openList === void 0) {
130
+ const listElement = require_xml_fragment.el("text:list");
131
+ openList = {
132
+ numId: membership.numId,
133
+ entries: [],
134
+ element: listElement
135
+ };
136
+ out.push(listElement);
137
+ }
138
+ openList.entries.push({
139
+ level: membership.level,
140
+ element
141
+ });
142
+ }
143
+ closeList();
144
+ return require_xml_fragment.el("draw:text-box", {}, out);
145
+ }
146
+ const PICTURES_DIRECTORY = "Pictures";
147
+ function writeShapeImage(image, state) {
148
+ const extension = image.format === "png" ? "png" : "jpg";
149
+ const path = `${PICTURES_DIRECTORY}/image${state.nextImage}.${extension}`;
150
+ state.nextImage += 1;
151
+ state.pkg.parts[path] = {
152
+ kind: "binary",
153
+ base64: image.base64
154
+ };
155
+ const children = [require_xml_fragment.el("draw:image", {
156
+ "xlink:href": require_xml_entities.encodeXmlText(path),
157
+ "xlink:type": "simple",
158
+ "xlink:show": "embed",
159
+ "xlink:actuate": "onLoad"
160
+ })];
161
+ if (image.altText !== void 0) children.push(require_xml_fragment.el("svg:title", {}, [require_xml_fragment.txt(require_xml_entities.encodeXmlText(image.altText))]));
162
+ return children;
163
+ }
164
+ function odfZIndexOf(paintOrder) {
165
+ if (paintOrder === void 0 || !Number.isSafeInteger(paintOrder) || paintOrder < 0) return;
166
+ return paintOrder;
167
+ }
168
+ function writeDrawFrame(shape, listState, state, documentIndex) {
169
+ const zIndex = odfZIndexOf(shape.paintOrder) ?? documentIndex;
170
+ const attributes = {
171
+ "draw:z-index": String(zIndex),
172
+ ...frameGeometryAttrs(shape.frame, shape.rotationDeg)
173
+ };
174
+ if (shape.name !== void 0) attributes["draw:name"] = require_xml_entities.encodeXmlText(shape.name);
175
+ attributes["draw:style-name"] = require_xml_entities.encodeXmlText(shapeGraphicStyleName(shape, state));
176
+ const content = planShapeContent(shape.blocks, listState);
177
+ const children = content.kind === "table" ? [require_typed_shared_table.writeOdfTable(content.table, state.registry, `DrawTable${state.nextTable++}`)] : content.kind === "image" ? writeShapeImage(content.image, state) : [writeShapeTextBox(content.paragraphs, state)];
178
+ return require_xml_fragment.el("draw:frame", attributes, children);
179
+ }
180
+ function canonicalDrawShape(shape, documentIndex, listState) {
181
+ const content = planShapeContent(shape.blocks, listState);
182
+ const blocks = content.kind === "table" ? [require_typed_shared_canonicalise.canonicalTable(content.table)] : content.kind === "image" ? [{
183
+ ...require_typed_shared_canonicalise.canonicalImage(content.image),
184
+ widthPt: shape.frame.widthPt,
185
+ heightPt: shape.frame.heightPt
186
+ }] : content.paragraphs.map((paragraph) => require_typed_shared_canonicalise.canonicalParagraph(paragraph, paragraph.list?.numId));
187
+ const canonical = {
188
+ frame: shape.frame,
189
+ insetLeftPt: shape.insetLeftPt,
190
+ insetTopPt: shape.insetTopPt,
191
+ insetRightPt: shape.insetRightPt,
192
+ insetBottomPt: shape.insetBottomPt,
193
+ paintOrder: odfZIndexOf(shape.paintOrder) ?? documentIndex,
194
+ blocks
195
+ };
196
+ if (shape.name !== void 0) canonical.name = shape.name;
197
+ if (shape.rotationDeg !== void 0 && shape.rotationDeg !== 0) canonical.rotationDeg = shape.rotationDeg;
198
+ return canonical;
199
+ }
200
+ function writeDrawShapes(shapes, listState, state) {
201
+ return shapes.map((shape, index) => writeDrawFrame(shape, listState, state, index));
202
+ }
203
+ //#endregion
204
+ exports.canonicalDrawShape = canonicalDrawShape;
205
+ exports.createDrawShapeWriteState = createDrawShapeWriteState;
206
+ exports.frameGeometryAttrs = frameGeometryAttrs;
207
+ exports.odfZIndexOf = odfZIndexOf;
208
+ exports.planShapeContent = planShapeContent;
209
+ exports.writeDrawFrame = writeDrawFrame;
210
+ exports.writeDrawShapes = writeDrawShapes;
@@ -0,0 +1,2 @@
1
+ import { a as frameGeometryAttrs, c as writeDrawFrame, i as createDrawShapeWriteState, l as writeDrawShapes, n as ShapeContentPlan, o as odfZIndexOf, r as canonicalDrawShape, s as planShapeContent, t as DrawShapeWriteState } from "../../write-shapes-D4piGKf4.cjs";
2
+ export { DrawShapeWriteState, ShapeContentPlan, canonicalDrawShape, createDrawShapeWriteState, frameGeometryAttrs, odfZIndexOf, planShapeContent, writeDrawFrame, writeDrawShapes };
@@ -0,0 +1,2 @@
1
+ import { a as frameGeometryAttrs, c as writeDrawFrame, i as createDrawShapeWriteState, l as writeDrawShapes, n as ShapeContentPlan, o as odfZIndexOf, r as canonicalDrawShape, s as planShapeContent, t as DrawShapeWriteState } from "../../write-shapes-Co7BrmMZ.js";
2
+ export { DrawShapeWriteState, ShapeContentPlan, canonicalDrawShape, createDrawShapeWriteState, frameGeometryAttrs, odfZIndexOf, planShapeContent, writeDrawFrame, writeDrawShapes };