js.documents 4.6.2 → 4.7.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 (43) hide show
  1. package/dist/edit/odg/content.cjs +1 -1
  2. package/dist/edit/odg/content.js +1 -1
  3. package/dist/edit/odg/page.d.cts +1 -1
  4. package/dist/edit/odg/page.d.ts +1 -1
  5. package/dist/edit/odg/scaffold.cjs +12 -1
  6. package/dist/edit/odg/scaffold.js +12 -1
  7. package/dist/edit/odp/content.cjs +1 -1
  8. package/dist/edit/odp/content.js +1 -1
  9. package/dist/edit/odp/scaffold.cjs +12 -1
  10. package/dist/edit/odp/scaffold.js +12 -1
  11. package/dist/edit/odp/shape.d.cts +1 -1
  12. package/dist/edit/odp/shape.d.ts +1 -1
  13. package/dist/edit/odp/slide.d.cts +2 -2
  14. package/dist/edit/odp/slide.d.ts +2 -2
  15. package/dist/edit/ods/cell.cjs +1 -1
  16. package/dist/edit/ods/cell.js +1 -1
  17. package/dist/edit/odt/content.cjs +8 -6
  18. package/dist/edit/odt/content.d.cts +3 -3
  19. package/dist/edit/odt/content.d.ts +3 -3
  20. package/dist/edit/odt/content.js +8 -6
  21. package/dist/edit/odt/editor.d.cts +3 -3
  22. package/dist/edit/odt/editor.d.ts +3 -3
  23. package/dist/edit/odt/list.d.cts +1 -1
  24. package/dist/edit/odt/list.d.ts +1 -1
  25. package/dist/edit/odt/paragraph.cjs +5 -1
  26. package/dist/edit/odt/paragraph.d.cts +2 -2
  27. package/dist/edit/odt/paragraph.d.ts +2 -2
  28. package/dist/edit/odt/paragraph.js +5 -2
  29. package/dist/edit/odt/table.cjs +1 -1
  30. package/dist/edit/odt/table.d.cts +1 -1
  31. package/dist/edit/odt/table.d.ts +1 -1
  32. package/dist/edit/odt/table.js +1 -1
  33. package/dist/index.d.cts +4 -4
  34. package/dist/index.d.ts +4 -4
  35. package/dist/{list-Cg_zlwVv.d.ts → list-C55W_YCp.d.ts} +1 -1
  36. package/dist/{list-CzGRStUr.d.cts → list-lTB3eDLC.d.cts} +1 -1
  37. package/dist/{paragraph-CeFnOpEi.d.ts → paragraph--69uh-Ys.d.ts} +2 -1
  38. package/dist/{paragraph-C9jf4pMK.d.cts → paragraph-CoPeTuHR.d.cts} +2 -1
  39. package/dist/{shape-C56METn9.d.cts → shape-CLHm7U8Y.d.cts} +2 -2
  40. package/dist/{shape-JrdFW78K.d.ts → shape-Dnz6-wmG.d.ts} +2 -2
  41. package/dist/{table-CY1ChByv.d.ts → table-BxMiEZXd.d.ts} +1 -1
  42. package/dist/{table-Cu8f1XmW.d.cts → table-C_tSXnbt.d.cts} +1 -1
  43. package/package.json +3 -3
@@ -41,7 +41,7 @@ function appendShape(page, shape) {
41
41
  textShape.paragraphs()[0]?.remove();
42
42
  for (const block of shape.blocks) {
43
43
  if (block.kind !== "paragraph") continue;
44
- require_edit_odt_content.populateParagraph(textShape.appendParagraph(), block, { headings: false });
44
+ require_edit_odt_content.populateParagraph(textShape.appendParagraph(), block, { headings: "style-name" });
45
45
  }
46
46
  }
47
47
  //#endregion
@@ -40,7 +40,7 @@ function appendShape(page, shape) {
40
40
  textShape.paragraphs()[0]?.remove();
41
41
  for (const block of shape.blocks) {
42
42
  if (block.kind !== "paragraph") continue;
43
- populateParagraph(textShape.appendParagraph(), block, { headings: false });
43
+ populateParagraph(textShape.appendParagraph(), block, { headings: "style-name" });
44
44
  }
45
45
  }
46
46
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { t as ImageInit } from "../../image-3ql9_z1y.cjs";
2
- import { t as OdpShape } from "../../shape-C56METn9.cjs";
2
+ import { t as OdpShape } from "../../shape-CLHm7U8Y.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-3ql9_z1y.js";
2
- import { t as OdpShape } from "../../shape-JrdFW78K.js";
2
+ import { t as OdpShape } from "../../shape-Dnz6-wmG.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,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_entities = require("../../xml/entities.cjs");
4
+ const require_layout_shared = require("../../layout/shared.cjs");
4
5
  let document_schema_js = require("document-schema.js");
5
6
  let odf_js = require("odf.js");
6
7
  //#region src/edit/odg/scaffold.ts
@@ -57,12 +58,22 @@ function buildPageLayout() {
57
58
  "fo:page-height": `${document_schema_js.PAGE_SIZE_A4.heightPt}pt`
58
59
  })]);
59
60
  }
61
+ function buildHeadingStyles() {
62
+ return Object.entries(require_layout_shared.HEADING_STYLES).map(([level, style]) => require_xml_fragment.el("style:style", {
63
+ "style:name": `Heading_20_${level}`,
64
+ "style:display-name": `Heading ${level}`,
65
+ "style:family": "paragraph"
66
+ }, [require_xml_fragment.el("style:text-properties", {
67
+ "fo:font-size": `${String(style.sizePt)}pt`,
68
+ "fo:font-weight": style.bold ? "bold" : "normal"
69
+ })]));
70
+ }
60
71
  function buildStylesXml() {
61
72
  return require_xml_fragment.el("office:document-styles", {
62
73
  ...(0, odf_js.xmlnsAttributes)([...STYLES_NS_PREFIXES]),
63
74
  "office:version": ODF_VERSION
64
75
  }, [
65
- require_xml_fragment.el("office:styles"),
76
+ require_xml_fragment.el("office:styles", {}, buildHeadingStyles()),
66
77
  require_xml_fragment.el("office:automatic-styles", {}, [buildPageLayout()]),
67
78
  require_xml_fragment.el("office:master-styles", {}, [require_xml_fragment.el("style:master-page", {
68
79
  "style:name": MASTER_PAGE_NAME,
@@ -1,5 +1,6 @@
1
1
  import { el, txt } from "../../xml/fragment.js";
2
2
  import { encodeXmlText as encodeXmlText$1 } from "../../xml/entities.js";
3
+ import { HEADING_STYLES } from "../../layout/shared.js";
3
4
  import { PAGE_SIZE_A4 } from "document-schema.js";
4
5
  import { ODF_MEDIA_TYPES, setDocumentMediaType, syncManifest, xmlnsAttributes } from "odf.js";
5
6
  //#region src/edit/odg/scaffold.ts
@@ -56,12 +57,22 @@ function buildPageLayout() {
56
57
  "fo:page-height": `${PAGE_SIZE_A4.heightPt}pt`
57
58
  })]);
58
59
  }
60
+ function buildHeadingStyles() {
61
+ return Object.entries(HEADING_STYLES).map(([level, style]) => el("style:style", {
62
+ "style:name": `Heading_20_${level}`,
63
+ "style:display-name": `Heading ${level}`,
64
+ "style:family": "paragraph"
65
+ }, [el("style:text-properties", {
66
+ "fo:font-size": `${String(style.sizePt)}pt`,
67
+ "fo:font-weight": style.bold ? "bold" : "normal"
68
+ })]));
69
+ }
59
70
  function buildStylesXml() {
60
71
  return el("office:document-styles", {
61
72
  ...xmlnsAttributes([...STYLES_NS_PREFIXES]),
62
73
  "office:version": ODF_VERSION
63
74
  }, [
64
- el("office:styles"),
75
+ el("office:styles", {}, buildHeadingStyles()),
65
76
  el("office:automatic-styles", {}, [buildPageLayout()]),
66
77
  el("office:master-styles", {}, [el("style:master-page", {
67
78
  "style:name": MASTER_PAGE_NAME,
@@ -70,7 +70,7 @@ function appendShape(slide, shape) {
70
70
  textShape.paragraphs()[0]?.remove();
71
71
  for (const block of shape.blocks) {
72
72
  if (block.kind !== "paragraph") continue;
73
- require_edit_odt_content.populateParagraph(textShape.appendParagraph(), block, { headings: false });
73
+ require_edit_odt_content.populateParagraph(textShape.appendParagraph(), block, { headings: "style-name" });
74
74
  }
75
75
  }
76
76
  //#endregion
@@ -69,7 +69,7 @@ function appendShape(slide, shape) {
69
69
  textShape.paragraphs()[0]?.remove();
70
70
  for (const block of shape.blocks) {
71
71
  if (block.kind !== "paragraph") continue;
72
- populateParagraph(textShape.appendParagraph(), block, { headings: false });
72
+ populateParagraph(textShape.appendParagraph(), block, { headings: "style-name" });
73
73
  }
74
74
  }
75
75
  //#endregion
@@ -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_entities = require("../../xml/entities.cjs");
4
+ const require_layout_shared = require("../../layout/shared.cjs");
4
5
  let document_schema_js = require("document-schema.js");
5
6
  let odf_js = require("odf.js");
6
7
  //#region src/edit/odp/scaffold.ts
@@ -59,12 +60,22 @@ function buildPageLayout() {
59
60
  "fo:page-height": `${document_schema_js.SLIDE_SIZE_WIDESCREEN.heightPt}pt`
60
61
  })]);
61
62
  }
63
+ function buildHeadingStyles() {
64
+ return Object.entries(require_layout_shared.HEADING_STYLES).map(([level, style]) => require_xml_fragment.el("style:style", {
65
+ "style:name": `Heading_20_${level}`,
66
+ "style:display-name": `Heading ${level}`,
67
+ "style:family": "paragraph"
68
+ }, [require_xml_fragment.el("style:text-properties", {
69
+ "fo:font-size": `${String(style.sizePt)}pt`,
70
+ "fo:font-weight": style.bold ? "bold" : "normal"
71
+ })]));
72
+ }
62
73
  function buildStylesXml() {
63
74
  return require_xml_fragment.el("office:document-styles", {
64
75
  ...(0, odf_js.xmlnsAttributes)([...STYLES_NS_PREFIXES]),
65
76
  "office:version": ODF_VERSION
66
77
  }, [
67
- require_xml_fragment.el("office:styles"),
78
+ require_xml_fragment.el("office:styles", {}, buildHeadingStyles()),
68
79
  require_xml_fragment.el("office:automatic-styles", {}, [buildPageLayout()]),
69
80
  require_xml_fragment.el("office:master-styles", {}, [require_xml_fragment.el("style:master-page", {
70
81
  "style:name": MASTER_PAGE_NAME,
@@ -1,5 +1,6 @@
1
1
  import { el, txt } from "../../xml/fragment.js";
2
2
  import { encodeXmlText as encodeXmlText$1 } from "../../xml/entities.js";
3
+ import { HEADING_STYLES } from "../../layout/shared.js";
3
4
  import { SLIDE_SIZE_WIDESCREEN } from "document-schema.js";
4
5
  import { ODF_MEDIA_TYPES, setDocumentMediaType, syncManifest, xmlnsAttributes } from "odf.js";
5
6
  //#region src/edit/odp/scaffold.ts
@@ -58,12 +59,22 @@ function buildPageLayout() {
58
59
  "fo:page-height": `${SLIDE_SIZE_WIDESCREEN.heightPt}pt`
59
60
  })]);
60
61
  }
62
+ function buildHeadingStyles() {
63
+ return Object.entries(HEADING_STYLES).map(([level, style]) => el("style:style", {
64
+ "style:name": `Heading_20_${level}`,
65
+ "style:display-name": `Heading ${level}`,
66
+ "style:family": "paragraph"
67
+ }, [el("style:text-properties", {
68
+ "fo:font-size": `${String(style.sizePt)}pt`,
69
+ "fo:font-weight": style.bold ? "bold" : "normal"
70
+ })]));
71
+ }
61
72
  function buildStylesXml() {
62
73
  return el("office:document-styles", {
63
74
  ...xmlnsAttributes([...STYLES_NS_PREFIXES]),
64
75
  "office:version": ODF_VERSION
65
76
  }, [
66
- el("office:styles"),
77
+ el("office:styles", {}, buildHeadingStyles()),
67
78
  el("office:automatic-styles", {}, [buildPageLayout()]),
68
79
  el("office:master-styles", {}, [el("style:master-page", {
69
80
  "style:name": MASTER_PAGE_NAME,
@@ -1,2 +1,2 @@
1
- import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-C56METn9.cjs";
1
+ import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-CLHm7U8Y.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-JrdFW78K.js";
1
+ import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-Dnz6-wmG.js";
2
2
  export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
@@ -1,7 +1,7 @@
1
1
  import { t as ImageInit } from "../../image-3ql9_z1y.cjs";
2
- import { t as OdpShape } from "../../shape-C56METn9.cjs";
2
+ import { t as OdpShape } from "../../shape-CLHm7U8Y.cjs";
3
3
  import { s as OdgVector } from "../../vector-D03KX8Ux.cjs";
4
- import { a as TableInit, n as OdtTable } from "../../table-Cu8f1XmW.cjs";
4
+ import { a as TableInit, n as OdtTable } from "../../table-C_tSXnbt.cjs";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "odf.js";
7
7
  //#region src/edit/odp/slide.d.ts
@@ -1,7 +1,7 @@
1
1
  import { t as ImageInit } from "../../image-3ql9_z1y.js";
2
- import { t as OdpShape } from "../../shape-JrdFW78K.js";
2
+ import { t as OdpShape } from "../../shape-Dnz6-wmG.js";
3
3
  import { s as OdgVector } from "../../vector-D03KX8Ux.js";
4
- import { a as TableInit, n as OdtTable } from "../../table-CY1ChByv.js";
4
+ import { a as TableInit, n as OdtTable } from "../../table-BxMiEZXd.js";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "odf.js";
7
7
  //#region src/edit/odp/slide.d.ts
@@ -175,7 +175,7 @@ var OdsCell = class {
175
175
  require_edit_odt_content.populateParagraph(paragraph, {
176
176
  kind: "paragraph",
177
177
  runs: [...runs]
178
- }, { headings: false });
178
+ }, { headings: "none" });
179
179
  }
180
180
  };
181
181
  //#endregion
@@ -174,7 +174,7 @@ var OdsCell = class {
174
174
  populateParagraph(paragraph, {
175
175
  kind: "paragraph",
176
176
  runs: [...runs]
177
- }, { headings: false });
177
+ }, { headings: "none" });
178
178
  }
179
179
  };
180
180
  //#endregion
@@ -3,6 +3,7 @@ const require_model_metadata = require("../../model/metadata.cjs");
3
3
  const require_ports_clock = require("../../ports/clock.cjs");
4
4
  const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs");
5
5
  const require_model_formula = require("../../model/formula.cjs");
6
+ const require_edit_odt_paragraph = require("./paragraph.cjs");
6
7
  const require_edit_odt_scaffold = require("./scaffold.cjs");
7
8
  const require_edit_odt_editor = require("./editor.cjs");
8
9
  let odf_js = require("odf.js");
@@ -84,12 +85,13 @@ function appendListRun(body, paragraphs) {
84
85
  const currentList = stack[stack.length - 1];
85
86
  if (currentList === void 0) continue;
86
87
  const item = currentList.addItem();
87
- populateParagraph(item.appendParagraph(), para, { headings: true });
88
+ populateParagraph(item.appendParagraph(), para, { headings: "element" });
88
89
  lastItem = item;
89
90
  }
90
91
  }
91
92
  function populateParagraph(paragraph, block, options) {
92
- if (options.headings && block.headingLevel !== void 0) paragraph.headingLevel = block.headingLevel;
93
+ if (options.headings === "element" && block.headingLevel !== void 0) paragraph.headingLevel = block.headingLevel;
94
+ else if (options.headings === "style-name" && block.headingLevel !== void 0) paragraph.styleId = require_edit_odt_paragraph.headingStyleName(block.headingLevel);
93
95
  else if (block.styleId !== void 0) paragraph.styleId = block.styleId;
94
96
  if (block.alignment !== void 0) paragraph.alignment = block.alignment;
95
97
  if (block.spacingBeforePt !== void 0) paragraph.spacingBeforePt = block.spacingBeforePt;
@@ -116,7 +118,7 @@ function populateParagraph(paragraph, block, options) {
116
118
  function populateCellBlocks(cell, blocks) {
117
119
  const [firstBlock, ...restBlocks] = blocks;
118
120
  const firstParagraph = cell.paragraphs()[0];
119
- if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock, { headings: false });
121
+ if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock, { headings: "element" });
120
122
  else if (firstBlock?.kind === "image" && firstParagraph !== void 0) firstParagraph.insertImageAfter({
121
123
  format: firstBlock.format,
122
124
  bytes: (0, odf_js.base64ToBytes)(firstBlock.base64),
@@ -174,7 +176,7 @@ function appendTable(body, block) {
174
176
  }), block);
175
177
  }
176
178
  function appendCellBlock(cell, block) {
177
- if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block, { headings: false });
179
+ if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block, { headings: "element" });
178
180
  else if (block.kind === "image") cell.appendParagraph().insertImageAfter({
179
181
  format: block.format,
180
182
  bytes: (0, odf_js.base64ToBytes)(block.base64),
@@ -184,7 +186,7 @@ function appendCellBlock(cell, block) {
184
186
  });
185
187
  }
186
188
  function appendBlock(body, block) {
187
- if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block, { headings: true });
189
+ if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block, { headings: "element" });
188
190
  else if (block.kind === "image") body.appendParagraph().insertImageAfter({
189
191
  format: block.format,
190
192
  bytes: (0, odf_js.base64ToBytes)(block.base64),
@@ -207,7 +209,7 @@ function appendEmbeddedObject(body, block) {
207
209
  populateParagraph(body.appendParagraph(), {
208
210
  kind: "paragraph",
209
211
  runs: [{ text: require_model_formula.formulaPlaceholderText(formula) }]
210
- }, { headings: false });
212
+ }, { headings: "none" });
211
213
  return;
212
214
  }
213
215
  body.appendFormula(formula, block.frame);
@@ -1,6 +1,6 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
- import { t as OdtParagraph } from "../../paragraph-C9jf4pMK.cjs";
3
- import { n as OdtTable } from "../../table-Cu8f1XmW.cjs";
2
+ import { t as OdtParagraph } from "../../paragraph-CoPeTuHR.cjs";
3
+ import { n as OdtTable } from "../../table-C_tSXnbt.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
@@ -9,7 +9,7 @@ interface BuildOdtPackageOptions {
9
9
  }
10
10
  declare function buildOdtPackage(content: ContentDocument, options?: BuildOdtPackageOptions): Package;
11
11
  interface PopulateParagraphOptions {
12
- readonly headings: boolean;
12
+ readonly headings: 'element' | 'style-name' | 'none';
13
13
  }
14
14
  declare function populateParagraph(paragraph: OdtParagraph, block: ContentParagraph, options: PopulateParagraphOptions): void;
15
15
  declare function populateOdtTable(table: OdtTable, block: ContentTable): void;
@@ -1,6 +1,6 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.js";
2
- import { t as OdtParagraph } from "../../paragraph-CeFnOpEi.js";
3
- import { n as OdtTable } from "../../table-CY1ChByv.js";
2
+ import { t as OdtParagraph } from "../../paragraph--69uh-Ys.js";
3
+ import { n as OdtTable } from "../../table-BxMiEZXd.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
@@ -9,7 +9,7 @@ interface BuildOdtPackageOptions {
9
9
  }
10
10
  declare function buildOdtPackage(content: ContentDocument, options?: BuildOdtPackageOptions): Package;
11
11
  interface PopulateParagraphOptions {
12
- readonly headings: boolean;
12
+ readonly headings: 'element' | 'style-name' | 'none';
13
13
  }
14
14
  declare function populateParagraph(paragraph: OdtParagraph, block: ContentParagraph, options: PopulateParagraphOptions): void;
15
15
  declare function populateOdtTable(table: OdtTable, block: ContentTable): void;
@@ -2,6 +2,7 @@ import { resolveMetadataTimestamps } from "../../model/metadata.js";
2
2
  import { systemClock } from "../../ports/clock.js";
3
3
  import { FLOW_CONTAINER_ORIGIN, drawingOfBlock, embeddedDrawingVectors } from "../../model/embedded-drawing.js";
4
4
  import { formulaOfBlock, formulaPlaceholderText } from "../../model/formula.js";
5
+ import { headingStyleName } from "./paragraph.js";
5
6
  import { createEmptyOdtPackage } from "./scaffold.js";
6
7
  import { OdtEditor } from "./editor.js";
7
8
  import { base64ToBytes } from "odf.js";
@@ -83,12 +84,13 @@ function appendListRun(body, paragraphs) {
83
84
  const currentList = stack[stack.length - 1];
84
85
  if (currentList === void 0) continue;
85
86
  const item = currentList.addItem();
86
- populateParagraph(item.appendParagraph(), para, { headings: true });
87
+ populateParagraph(item.appendParagraph(), para, { headings: "element" });
87
88
  lastItem = item;
88
89
  }
89
90
  }
90
91
  function populateParagraph(paragraph, block, options) {
91
- if (options.headings && block.headingLevel !== void 0) paragraph.headingLevel = block.headingLevel;
92
+ if (options.headings === "element" && block.headingLevel !== void 0) paragraph.headingLevel = block.headingLevel;
93
+ else if (options.headings === "style-name" && block.headingLevel !== void 0) paragraph.styleId = headingStyleName(block.headingLevel);
92
94
  else if (block.styleId !== void 0) paragraph.styleId = block.styleId;
93
95
  if (block.alignment !== void 0) paragraph.alignment = block.alignment;
94
96
  if (block.spacingBeforePt !== void 0) paragraph.spacingBeforePt = block.spacingBeforePt;
@@ -115,7 +117,7 @@ function populateParagraph(paragraph, block, options) {
115
117
  function populateCellBlocks(cell, blocks) {
116
118
  const [firstBlock, ...restBlocks] = blocks;
117
119
  const firstParagraph = cell.paragraphs()[0];
118
- if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock, { headings: false });
120
+ if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock, { headings: "element" });
119
121
  else if (firstBlock?.kind === "image" && firstParagraph !== void 0) firstParagraph.insertImageAfter({
120
122
  format: firstBlock.format,
121
123
  bytes: base64ToBytes(firstBlock.base64),
@@ -173,7 +175,7 @@ function appendTable(body, block) {
173
175
  }), block);
174
176
  }
175
177
  function appendCellBlock(cell, block) {
176
- if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block, { headings: false });
178
+ if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block, { headings: "element" });
177
179
  else if (block.kind === "image") cell.appendParagraph().insertImageAfter({
178
180
  format: block.format,
179
181
  bytes: base64ToBytes(block.base64),
@@ -183,7 +185,7 @@ function appendCellBlock(cell, block) {
183
185
  });
184
186
  }
185
187
  function appendBlock(body, block) {
186
- if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block, { headings: true });
188
+ if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block, { headings: "element" });
187
189
  else if (block.kind === "image") body.appendParagraph().insertImageAfter({
188
190
  format: block.format,
189
191
  bytes: base64ToBytes(block.base64),
@@ -206,7 +208,7 @@ function appendEmbeddedObject(body, block) {
206
208
  populateParagraph(body.appendParagraph(), {
207
209
  kind: "paragraph",
208
210
  runs: [{ text: formulaPlaceholderText(formula) }]
209
- }, { headings: false });
211
+ }, { headings: "none" });
210
212
  return;
211
213
  }
212
214
  body.appendFormula(formula, block.frame);
@@ -1,7 +1,7 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
- import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-C9jf4pMK.cjs";
3
- import { t as OdtList } from "../../list-CzGRStUr.cjs";
4
- import { a as TableInit, n as OdtTable } from "../../table-Cu8f1XmW.cjs";
2
+ import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-CoPeTuHR.cjs";
3
+ import { t as OdtList } from "../../list-lTB3eDLC.cjs";
4
+ import { a as TableInit, n as OdtTable } from "../../table-C_tSXnbt.cjs";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package } from "odf.js";
7
7
  //#region src/edit/odt/editor.d.ts
@@ -1,7 +1,7 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.js";
2
- import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-CeFnOpEi.js";
3
- import { t as OdtList } from "../../list-Cg_zlwVv.js";
4
- import { a as TableInit, n as OdtTable } from "../../table-CY1ChByv.js";
2
+ import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph--69uh-Ys.js";
3
+ import { t as OdtList } from "../../list-C55W_YCp.js";
4
+ import { a as TableInit, n as OdtTable } from "../../table-BxMiEZXd.js";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package } from "odf.js";
7
7
  //#region src/edit/odt/editor.d.ts
@@ -1,2 +1,2 @@
1
- import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-CzGRStUr.cjs";
1
+ import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-lTB3eDLC.cjs";
2
2
  export { OdtList, OdtListItem, buildList };
@@ -1,2 +1,2 @@
1
- import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-Cg_zlwVv.js";
1
+ import { n as OdtListItem, r as buildList, t as OdtList } from "../../list-C55W_YCp.js";
2
2
  export { OdtList, OdtListItem, buildList };
@@ -7,6 +7,9 @@ const require_edit_odt_props = require("./props.cjs");
7
7
  const require_edit_odt_run = require("./run.cjs");
8
8
  let ooxml_js = require("ooxml.js");
9
9
  //#region src/edit/odt/paragraph.ts
10
+ function headingStyleName(level) {
11
+ return `Heading_20_${String(level)}`;
12
+ }
10
13
  var OdtParagraph = class {
11
14
  container;
12
15
  node;
@@ -89,7 +92,7 @@ var OdtParagraph = class {
89
92
  }
90
93
  node.tag = "text:h";
91
94
  require_xml_edit.setAttr(node, "text:outline-level", String(value));
92
- require_xml_edit.setAttr(node, "text:style-name", `Heading_20_${String(value)}`);
95
+ require_xml_edit.setAttr(node, "text:style-name", headingStyleName(value));
93
96
  }
94
97
  get alignment() {
95
98
  return require_edit_odt_props.readCurrentStyleProperties(this.pkg, this.live(), "paragraph").alignment;
@@ -154,3 +157,4 @@ function buildParagraph(pkg, init = {}) {
154
157
  //#endregion
155
158
  exports.OdtParagraph = OdtParagraph;
156
159
  exports.buildParagraph = buildParagraph;
160
+ exports.headingStyleName = headingStyleName;
@@ -1,2 +1,2 @@
1
- import { n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-C9jf4pMK.cjs";
2
- export { OdtParagraph, ParagraphInit, buildParagraph };
1
+ import { i as headingStyleName, n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-CoPeTuHR.cjs";
2
+ export { OdtParagraph, ParagraphInit, buildParagraph, headingStyleName };
@@ -1,2 +1,2 @@
1
- import { n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph-CeFnOpEi.js";
2
- export { OdtParagraph, ParagraphInit, buildParagraph };
1
+ import { i as headingStyleName, n as ParagraphInit, r as buildParagraph, t as OdtParagraph } from "../../paragraph--69uh-Ys.js";
2
+ export { OdtParagraph, ParagraphInit, buildParagraph, headingStyleName };
@@ -6,6 +6,9 @@ import { applyStyleChange, readCurrentStyleProperties } from "./props.js";
6
6
  import { OdtRun, buildRun } from "./run.js";
7
7
  import { attr } from "ooxml.js";
8
8
  //#region src/edit/odt/paragraph.ts
9
+ function headingStyleName(level) {
10
+ return `Heading_20_${String(level)}`;
11
+ }
9
12
  var OdtParagraph = class {
10
13
  container;
11
14
  node;
@@ -88,7 +91,7 @@ var OdtParagraph = class {
88
91
  }
89
92
  node.tag = "text:h";
90
93
  setAttr(node, "text:outline-level", String(value));
91
- setAttr(node, "text:style-name", `Heading_20_${String(value)}`);
94
+ setAttr(node, "text:style-name", headingStyleName(value));
92
95
  }
93
96
  get alignment() {
94
97
  return readCurrentStyleProperties(this.pkg, this.live(), "paragraph").alignment;
@@ -151,4 +154,4 @@ function buildParagraph(pkg, init = {}) {
151
154
  return node;
152
155
  }
153
156
  //#endregion
154
- export { OdtParagraph, buildParagraph };
157
+ export { OdtParagraph, buildParagraph, headingStyleName };
@@ -116,7 +116,7 @@ var OdtTableCell = class {
116
116
  }
117
117
  paragraphs() {
118
118
  const out = [];
119
- for (const child of this.node.children) if (child.type === "element" && child.tag === "text:p") out.push(new require_edit_odt_paragraph.OdtParagraph(this.node.children, child, this.pkg));
119
+ for (const child of this.node.children) if (child.type === "element" && (child.tag === "text:p" || child.tag === "text:h")) out.push(new require_edit_odt_paragraph.OdtParagraph(this.node.children, child, this.pkg));
120
120
  return out;
121
121
  }
122
122
  appendParagraph(init) {
@@ -1,2 +1,2 @@
1
- import { a as TableInit, c as readCellDecoration, i as OdtTableRow, n as OdtTable, o as buildCellStyle, r as OdtTableCell, s as buildTable, t as CellDecoration } from "../../table-Cu8f1XmW.cjs";
1
+ import { a as TableInit, c as readCellDecoration, i as OdtTableRow, n as OdtTable, o as buildCellStyle, r as OdtTableCell, s as buildTable, t as CellDecoration } from "../../table-C_tSXnbt.cjs";
2
2
  export { CellDecoration, OdtTable, OdtTableCell, OdtTableRow, TableInit, buildCellStyle, buildTable, readCellDecoration };
@@ -1,2 +1,2 @@
1
- import { a as TableInit, c as readCellDecoration, i as OdtTableRow, n as OdtTable, o as buildCellStyle, r as OdtTableCell, s as buildTable, t as CellDecoration } from "../../table-CY1ChByv.js";
1
+ import { a as TableInit, c as readCellDecoration, i as OdtTableRow, n as OdtTable, o as buildCellStyle, r as OdtTableCell, s as buildTable, t as CellDecoration } from "../../table-BxMiEZXd.js";
2
2
  export { CellDecoration, OdtTable, OdtTableCell, OdtTableRow, TableInit, buildCellStyle, buildTable, readCellDecoration };
@@ -115,7 +115,7 @@ var OdtTableCell = class {
115
115
  }
116
116
  paragraphs() {
117
117
  const out = [];
118
- for (const child of this.node.children) if (child.type === "element" && child.tag === "text:p") out.push(new OdtParagraph(this.node.children, child, this.pkg));
118
+ for (const child of this.node.children) if (child.type === "element" && (child.tag === "text:p" || child.tag === "text:h")) out.push(new OdtParagraph(this.node.children, child, this.pkg));
119
119
  return out;
120
120
  }
121
121
  appendParagraph(init) {
package/dist/index.d.cts CHANGED
@@ -33,15 +33,15 @@ import { MarkdownTable, MarkdownTableCell, MarkdownTableRow, TableInit } from ".
33
33
  import { CreateMarkdownEditorOptions, MarkdownBody, MarkdownEditor, createMarkdownEditor, openMarkdown } from "./edit/markdown/editor.cjs";
34
34
  import { BuildOdgPackageOptions, buildOdgPackage } from "./edit/odg/content.cjs";
35
35
  import { n as RunInit$1, t as OdtRun } from "./run-mzBHuFWz.cjs";
36
- import { n as ParagraphInit$1, t as OdtParagraph } from "./paragraph-C9jf4pMK.cjs";
37
- import { n as OdtListItem, t as OdtList } from "./list-CzGRStUr.cjs";
38
- import { t as OdpShape } from "./shape-C56METn9.cjs";
36
+ import { n as ParagraphInit$1, t as OdtParagraph } from "./paragraph-CoPeTuHR.cjs";
37
+ import { n as OdtListItem, t as OdtList } from "./list-lTB3eDLC.cjs";
38
+ import { t as OdpShape } from "./shape-CLHm7U8Y.cjs";
39
39
  import { a as OdgLineVector, c as OdgVectorKind, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "./vector-D03KX8Ux.cjs";
40
40
  import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.cjs";
41
41
  import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.cjs";
42
42
  import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.cjs";
43
43
  import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.cjs";
44
- import { a as TableInit$1, i as OdtTableRow, n as OdtTable, r as OdtTableCell } from "./table-Cu8f1XmW.cjs";
44
+ import { a as TableInit$1, i as OdtTableRow, n as OdtTable, r as OdtTableCell } from "./table-C_tSXnbt.cjs";
45
45
  import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.cjs";
46
46
  import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.cjs";
47
47
  import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.cjs";
package/dist/index.d.ts CHANGED
@@ -33,15 +33,15 @@ import { MarkdownTable, MarkdownTableCell, MarkdownTableRow, TableInit } from ".
33
33
  import { CreateMarkdownEditorOptions, MarkdownBody, MarkdownEditor, createMarkdownEditor, openMarkdown } from "./edit/markdown/editor.js";
34
34
  import { BuildOdgPackageOptions, buildOdgPackage } from "./edit/odg/content.js";
35
35
  import { n as RunInit$1, t as OdtRun } from "./run-mzBHuFWz.js";
36
- import { n as ParagraphInit$1, t as OdtParagraph } from "./paragraph-CeFnOpEi.js";
37
- import { n as OdtListItem, t as OdtList } from "./list-Cg_zlwVv.js";
38
- import { t as OdpShape } from "./shape-JrdFW78K.js";
36
+ import { n as ParagraphInit$1, t as OdtParagraph } from "./paragraph--69uh-Ys.js";
37
+ import { n as OdtListItem, t as OdtList } from "./list-C55W_YCp.js";
38
+ import { t as OdpShape } from "./shape-Dnz6-wmG.js";
39
39
  import { a as OdgLineVector, c as OdgVectorKind, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "./vector-D03KX8Ux.js";
40
40
  import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
41
41
  import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
42
42
  import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.js";
43
43
  import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.js";
44
- import { a as TableInit$1, i as OdtTableRow, n as OdtTable, r as OdtTableCell } from "./table-CY1ChByv.js";
44
+ import { a as TableInit$1, i as OdtTableRow, n as OdtTable, r as OdtTableCell } from "./table-BxMiEZXd.js";
45
45
  import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
46
46
  import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
47
47
  import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.js";
@@ -1,4 +1,4 @@
1
- import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CeFnOpEi.js";
1
+ import { n as ParagraphInit, t as OdtParagraph } from "./paragraph--69uh-Ys.js";
2
2
  import { Package, XmlElement, XmlNode } from "odf.js";
3
3
  //#region src/edit/odt/list.d.ts
4
4
  declare class OdtListItem {
@@ -1,4 +1,4 @@
1
- import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-C9jf4pMK.cjs";
1
+ import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CoPeTuHR.cjs";
2
2
  import { Package, XmlElement, XmlNode } from "odf.js";
3
3
  //#region src/edit/odt/list.d.ts
4
4
  declare class OdtListItem {
@@ -9,6 +9,7 @@ interface ParagraphInit {
9
9
  readonly headingLevel?: number;
10
10
  readonly alignment?: Alignment;
11
11
  }
12
+ declare function headingStyleName(level: number): string;
12
13
  declare class OdtParagraph {
13
14
  private readonly container;
14
15
  private readonly node;
@@ -43,4 +44,4 @@ declare class OdtParagraph {
43
44
  }
44
45
  declare function buildParagraph(pkg: Package, init?: ParagraphInit): XmlElement;
45
46
  //#endregion
46
- export { ParagraphInit as n, buildParagraph as r, OdtParagraph as t };
47
+ export { headingStyleName as i, ParagraphInit as n, buildParagraph as r, OdtParagraph as t };
@@ -9,6 +9,7 @@ interface ParagraphInit {
9
9
  readonly headingLevel?: number;
10
10
  readonly alignment?: Alignment;
11
11
  }
12
+ declare function headingStyleName(level: number): string;
12
13
  declare class OdtParagraph {
13
14
  private readonly container;
14
15
  private readonly node;
@@ -43,4 +44,4 @@ declare class OdtParagraph {
43
44
  }
44
45
  declare function buildParagraph(pkg: Package, init?: ParagraphInit): XmlElement;
45
46
  //#endregion
46
- export { ParagraphInit as n, buildParagraph as r, OdtParagraph as t };
47
+ export { headingStyleName as i, ParagraphInit as n, buildParagraph as r, OdtParagraph as t };
@@ -1,5 +1,5 @@
1
- import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-C9jf4pMK.cjs";
2
- import { t as OdtList } from "./list-CzGRStUr.cjs";
1
+ import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CoPeTuHR.cjs";
2
+ import { t as OdtList } from "./list-lTB3eDLC.cjs";
3
3
  import { Box } from "document-schema.js";
4
4
  import { Package, XmlElement, XmlNode } from "odf.js";
5
5
  //#region src/edit/odp/shape.d.ts
@@ -1,5 +1,5 @@
1
- import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CeFnOpEi.js";
2
- import { t as OdtList } from "./list-Cg_zlwVv.js";
1
+ import { n as ParagraphInit, t as OdtParagraph } from "./paragraph--69uh-Ys.js";
2
+ import { t as OdtList } from "./list-C55W_YCp.js";
3
3
  import { Box } from "document-schema.js";
4
4
  import { Package, XmlElement, XmlNode } from "odf.js";
5
5
  //#region src/edit/odp/shape.d.ts
@@ -1,4 +1,4 @@
1
- import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CeFnOpEi.js";
1
+ import { n as ParagraphInit, t as OdtParagraph } from "./paragraph--69uh-Ys.js";
2
2
  import { Color, ContentCellBorders } from "document-schema.js";
3
3
  import { Package, XmlElement, XmlNode } from "odf.js";
4
4
  //#region src/edit/odt/table.d.ts
@@ -1,4 +1,4 @@
1
- import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-C9jf4pMK.cjs";
1
+ import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CoPeTuHR.cjs";
2
2
  import { Color, ContentCellBorders } from "document-schema.js";
3
3
  import { Package, XmlElement, XmlNode } from "odf.js";
4
4
  //#region src/edit/odt/table.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "4.6.2",
3
+ "version": "4.7.0",
4
4
  "description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -81,8 +81,8 @@
81
81
  "document-schema.js": "^4.9.0",
82
82
  "fflate": "^0.8.3",
83
83
  "markdown-codec": "^5.0.1",
84
- "odf.js": "^5.4.0",
85
- "ooxml.js": "^4.6.0",
84
+ "odf.js": "^5.5.0",
85
+ "ooxml.js": "^4.7.0",
86
86
  "pdf-codec": "^3.3.1",
87
87
  "temml": "0.13.4",
88
88
  "zod": "^4.4.3"