js.documents 4.0.19 → 4.4.5

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 (116) hide show
  1. package/README.md +43 -29
  2. package/dist/cell-typing-CEWlywIc.d.cts +22 -0
  3. package/dist/cell-typing-CEWlywIc.d.ts +22 -0
  4. package/dist/codecs/read.cjs +66 -0
  5. package/dist/codecs/read.d.cts +15 -0
  6. package/dist/codecs/read.d.ts +15 -0
  7. package/dist/codecs/read.js +64 -0
  8. package/dist/codecs/registry.cjs +13 -59
  9. package/dist/codecs/registry.d.cts +2 -8
  10. package/dist/codecs/registry.d.ts +2 -8
  11. package/dist/codecs/registry.js +20 -64
  12. package/dist/convert/codec.cjs +11 -10
  13. package/dist/convert/codec.js +2 -1
  14. package/dist/convert/composition-to-pdf.cjs +133 -0
  15. package/dist/convert/composition-to-pdf.d.cts +7 -0
  16. package/dist/convert/composition-to-pdf.d.ts +7 -0
  17. package/dist/convert/composition-to-pdf.js +131 -0
  18. package/dist/convert/composition.cjs +31 -129
  19. package/dist/convert/composition.d.cts +14 -4
  20. package/dist/convert/composition.d.ts +14 -4
  21. package/dist/convert/composition.js +25 -128
  22. package/dist/convert/convert.cjs +35 -75
  23. package/dist/convert/convert.d.cts +5 -20
  24. package/dist/convert/convert.d.ts +5 -20
  25. package/dist/convert/convert.js +2 -32
  26. package/dist/convert/from-package.cjs +2 -1
  27. package/dist/convert/from-package.js +2 -1
  28. package/dist/convert/from-pdf.cjs +50 -0
  29. package/dist/convert/from-pdf.d.cts +26 -0
  30. package/dist/convert/from-pdf.d.ts +26 -0
  31. package/dist/convert/from-pdf.js +39 -0
  32. package/dist/convert/local.cjs +2 -1
  33. package/dist/convert/local.js +2 -1
  34. package/dist/convert/pdf-package-tables.cjs +76 -0
  35. package/dist/convert/pdf-package-tables.d.cts +6 -0
  36. package/dist/convert/pdf-package-tables.d.ts +6 -0
  37. package/dist/convert/pdf-package-tables.js +75 -0
  38. package/dist/csv/read.d.cts +1 -1
  39. package/dist/csv/read.d.ts +1 -1
  40. package/dist/diagnostics-DVAXKgcf.d.cts +10 -0
  41. package/dist/diagnostics-DVAXKgcf.d.ts +10 -0
  42. package/dist/edit/docx/content.cjs +1 -0
  43. package/dist/edit/docx/content.js +1 -0
  44. package/dist/edit/docx/paragraph.cjs +18 -1
  45. package/dist/edit/docx/paragraph.d.cts +3 -0
  46. package/dist/edit/docx/paragraph.d.ts +3 -0
  47. package/dist/edit/docx/paragraph.js +18 -1
  48. package/dist/edit/docx/props.cjs +1 -0
  49. package/dist/edit/docx/props.js +1 -0
  50. package/dist/edit/markdown/editor.cjs +1 -1
  51. package/dist/edit/markdown/editor.js +1 -1
  52. package/dist/edit/pdf/item.cjs +42 -1
  53. package/dist/edit/pdf/item.d.cts +2 -2
  54. package/dist/edit/pdf/item.d.ts +2 -2
  55. package/dist/edit/pdf/item.js +42 -2
  56. package/dist/edit/pdf/page.d.cts +1 -1
  57. package/dist/edit/pdf/page.d.ts +1 -1
  58. package/dist/fonts/registry.d.cts +1 -19
  59. package/dist/fonts/registry.d.ts +1 -19
  60. package/dist/hsqldb/binary-script.d.cts +1 -1
  61. package/dist/hsqldb/binary-script.d.ts +1 -1
  62. package/dist/hsqldb/cache.d.cts +1 -1
  63. package/dist/hsqldb/cache.d.ts +1 -1
  64. package/dist/hsqldb/rowformat.d.cts +1 -24
  65. package/dist/hsqldb/rowformat.d.ts +1 -24
  66. package/dist/index.cjs +17 -16
  67. package/dist/index.d.cts +11 -10
  68. package/dist/index.d.ts +11 -10
  69. package/dist/index.js +8 -7
  70. package/dist/{item-D9vQKT0T.d.cts → item-DhXpJNAQ.d.cts} +17 -3
  71. package/dist/{item-D9vQKT0T.d.ts → item-DhXpJNAQ.d.ts} +17 -3
  72. package/dist/layout/cell-typing.d.cts +1 -21
  73. package/dist/layout/cell-typing.d.ts +1 -21
  74. package/dist/layout/reconstruct.cjs +177 -14
  75. package/dist/layout/reconstruct.d.cts +1 -1
  76. package/dist/layout/reconstruct.d.ts +1 -1
  77. package/dist/layout/reconstruct.js +175 -12
  78. package/dist/layout/shared.cjs +2 -2
  79. package/dist/layout/shared.js +1 -1
  80. package/dist/markdown/math.cjs +5 -7
  81. package/dist/markdown/math.js +5 -7
  82. package/dist/markdown/read.cjs +15 -1
  83. package/dist/markdown/read.js +16 -2
  84. package/dist/markdown/write.cjs +7 -10
  85. package/dist/markdown/write.d.cts +3 -6
  86. package/dist/markdown/write.d.ts +3 -6
  87. package/dist/markdown/write.js +8 -11
  88. package/dist/metadata/write.cjs +2 -1
  89. package/dist/metadata/write.js +2 -1
  90. package/dist/model/bytes.cjs +8 -0
  91. package/dist/model/bytes.d.cts +2 -1
  92. package/dist/model/bytes.d.ts +2 -1
  93. package/dist/model/bytes.js +8 -1
  94. package/dist/odb/read.d.cts +1 -1
  95. package/dist/odb/read.d.ts +1 -1
  96. package/dist/odb/report/content.d.cts +1 -1
  97. package/dist/odb/report/content.d.ts +1 -1
  98. package/dist/odb/report/source.d.cts +1 -1
  99. package/dist/odb/report/source.d.ts +1 -1
  100. package/dist/odf/odt/read.cjs +1 -1
  101. package/dist/odf/odt/read.js +1 -1
  102. package/dist/registry-BcBT-bnX.d.cts +20 -0
  103. package/dist/registry-D1Pu5XxB.d.ts +20 -0
  104. package/dist/rowformat-Cl2exlEh.d.cts +25 -0
  105. package/dist/rowformat-Cl2exlEh.d.ts +25 -0
  106. package/dist/svg/diagnostics.d.cts +1 -9
  107. package/dist/svg/diagnostics.d.ts +1 -9
  108. package/dist/svg/read.d.cts +1 -1
  109. package/dist/svg/read.d.ts +1 -1
  110. package/dist/svg/write.d.cts +1 -1
  111. package/dist/svg/write.d.ts +1 -1
  112. package/package.json +27 -10
  113. package/dist/metadata/read.cjs +0 -15
  114. package/dist/metadata/read.d.cts +0 -9
  115. package/dist/metadata/read.d.ts +0 -9
  116. package/dist/metadata/read.js +0 -14
@@ -0,0 +1,76 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/convert/pdf-package-tables.ts
3
+ function stampPdfPackageTables(pkg, layout) {
4
+ if (layout.destinations !== void 0 || layout.outline !== void 0) {
5
+ const destinations = {};
6
+ for (const destination of layout.destinations ?? []) destinations[destination.name] = {
7
+ kind: "destination",
8
+ pageIndex: destination.pageIndex,
9
+ viewKind: destination.target.kind,
10
+ ...destination.target.leftPt !== void 0 ? { leftPt: destination.target.leftPt } : {},
11
+ ...destination.target.topPt !== void 0 ? { topPt: destination.target.topPt } : {},
12
+ ...destination.target.bottomPt !== void 0 ? { bottomPt: destination.target.bottomPt } : {},
13
+ ...destination.target.rightPt !== void 0 ? { rightPt: destination.target.rightPt } : {},
14
+ ...destination.target.zoom !== void 0 ? { zoom: destination.target.zoom } : {}
15
+ };
16
+ const outlineKeys = [];
17
+ const walkOutline = (items, parentKey) => {
18
+ for (const item of items ?? []) {
19
+ const key = `outline-${String(outlineKeys.length + 1)}`;
20
+ outlineKeys.push(key);
21
+ destinations[key] = {
22
+ kind: "outline",
23
+ title: item.title,
24
+ ...item.destination !== void 0 ? { destination: item.destination } : {},
25
+ ...parentKey !== void 0 ? { parent: parentKey } : {}
26
+ };
27
+ walkOutline(item.children, key);
28
+ }
29
+ };
30
+ walkOutline(layout.outline, void 0);
31
+ pkg.destinations = {
32
+ ...pkg.destinations,
33
+ ...destinations
34
+ };
35
+ }
36
+ if (layout.attachments !== void 0 && layout.attachments.length > 0) pkg.attachments = {
37
+ ...pkg.attachments,
38
+ ...Object.fromEntries(layout.attachments.map((attachment) => [attachment.name, {
39
+ kind: "attachment",
40
+ name: attachment.name,
41
+ ...attachment.description !== void 0 ? { description: attachment.description } : {},
42
+ ...attachment.mimeType !== void 0 ? { mimeType: attachment.mimeType } : {},
43
+ base64: attachment.base64
44
+ }]))
45
+ };
46
+ if (layout.layers !== void 0 && layout.layers.length > 0) pkg.layers = {
47
+ ...pkg.layers,
48
+ ...Object.fromEntries(layout.layers.map((layer) => [layer.name, {
49
+ kind: "layer",
50
+ name: layer.name,
51
+ visible: layer.visible
52
+ }]))
53
+ };
54
+ if (layout.source !== void 0) pkg.source = {
55
+ ...pkg.source,
56
+ ...layout.source
57
+ };
58
+ const definitions = {};
59
+ layout.pages.forEach((page, pageIndex) => {
60
+ (page.annotations ?? []).forEach((annotation, annotIndex) => {
61
+ definitions[`pdf-annot-${String(pageIndex)}-${String(annotIndex)}`] = {
62
+ kind: "comment",
63
+ ...annotation.contents !== void 0 ? { body: annotation.contents } : {},
64
+ ...annotation.author !== void 0 ? { author: annotation.author } : {},
65
+ ...annotation.modifiedIso !== void 0 ? { dateIso: annotation.modifiedIso } : {},
66
+ ...annotation.source !== void 0 ? { source: annotation.source } : {}
67
+ };
68
+ });
69
+ });
70
+ if (Object.keys(definitions).length > 0) pkg.definitions = {
71
+ ...pkg.definitions,
72
+ ...definitions
73
+ };
74
+ }
75
+ //#endregion
76
+ exports.stampPdfPackageTables = stampPdfPackageTables;
@@ -0,0 +1,6 @@
1
+ import { DocumentPackage } from "document-schema.js";
2
+ import { LayoutDocument } from "pdf-codec";
3
+ //#region src/convert/pdf-package-tables.d.ts
4
+ declare function stampPdfPackageTables(pkg: DocumentPackage, layout: LayoutDocument): void;
5
+ //#endregion
6
+ export { stampPdfPackageTables };
@@ -0,0 +1,6 @@
1
+ import { DocumentPackage } from "document-schema.js";
2
+ import { LayoutDocument } from "pdf-codec";
3
+ //#region src/convert/pdf-package-tables.d.ts
4
+ declare function stampPdfPackageTables(pkg: DocumentPackage, layout: LayoutDocument): void;
5
+ //#endregion
6
+ export { stampPdfPackageTables };
@@ -0,0 +1,75 @@
1
+ //#region src/convert/pdf-package-tables.ts
2
+ function stampPdfPackageTables(pkg, layout) {
3
+ if (layout.destinations !== void 0 || layout.outline !== void 0) {
4
+ const destinations = {};
5
+ for (const destination of layout.destinations ?? []) destinations[destination.name] = {
6
+ kind: "destination",
7
+ pageIndex: destination.pageIndex,
8
+ viewKind: destination.target.kind,
9
+ ...destination.target.leftPt !== void 0 ? { leftPt: destination.target.leftPt } : {},
10
+ ...destination.target.topPt !== void 0 ? { topPt: destination.target.topPt } : {},
11
+ ...destination.target.bottomPt !== void 0 ? { bottomPt: destination.target.bottomPt } : {},
12
+ ...destination.target.rightPt !== void 0 ? { rightPt: destination.target.rightPt } : {},
13
+ ...destination.target.zoom !== void 0 ? { zoom: destination.target.zoom } : {}
14
+ };
15
+ const outlineKeys = [];
16
+ const walkOutline = (items, parentKey) => {
17
+ for (const item of items ?? []) {
18
+ const key = `outline-${String(outlineKeys.length + 1)}`;
19
+ outlineKeys.push(key);
20
+ destinations[key] = {
21
+ kind: "outline",
22
+ title: item.title,
23
+ ...item.destination !== void 0 ? { destination: item.destination } : {},
24
+ ...parentKey !== void 0 ? { parent: parentKey } : {}
25
+ };
26
+ walkOutline(item.children, key);
27
+ }
28
+ };
29
+ walkOutline(layout.outline, void 0);
30
+ pkg.destinations = {
31
+ ...pkg.destinations,
32
+ ...destinations
33
+ };
34
+ }
35
+ if (layout.attachments !== void 0 && layout.attachments.length > 0) pkg.attachments = {
36
+ ...pkg.attachments,
37
+ ...Object.fromEntries(layout.attachments.map((attachment) => [attachment.name, {
38
+ kind: "attachment",
39
+ name: attachment.name,
40
+ ...attachment.description !== void 0 ? { description: attachment.description } : {},
41
+ ...attachment.mimeType !== void 0 ? { mimeType: attachment.mimeType } : {},
42
+ base64: attachment.base64
43
+ }]))
44
+ };
45
+ if (layout.layers !== void 0 && layout.layers.length > 0) pkg.layers = {
46
+ ...pkg.layers,
47
+ ...Object.fromEntries(layout.layers.map((layer) => [layer.name, {
48
+ kind: "layer",
49
+ name: layer.name,
50
+ visible: layer.visible
51
+ }]))
52
+ };
53
+ if (layout.source !== void 0) pkg.source = {
54
+ ...pkg.source,
55
+ ...layout.source
56
+ };
57
+ const definitions = {};
58
+ layout.pages.forEach((page, pageIndex) => {
59
+ (page.annotations ?? []).forEach((annotation, annotIndex) => {
60
+ definitions[`pdf-annot-${String(pageIndex)}-${String(annotIndex)}`] = {
61
+ kind: "comment",
62
+ ...annotation.contents !== void 0 ? { body: annotation.contents } : {},
63
+ ...annotation.author !== void 0 ? { author: annotation.author } : {},
64
+ ...annotation.modifiedIso !== void 0 ? { dateIso: annotation.modifiedIso } : {},
65
+ ...annotation.source !== void 0 ? { source: annotation.source } : {}
66
+ };
67
+ });
68
+ });
69
+ if (Object.keys(definitions).length > 0) pkg.definitions = {
70
+ ...pkg.definitions,
71
+ ...definitions
72
+ };
73
+ }
74
+ //#endregion
75
+ export { stampPdfPackageTables };
@@ -1,4 +1,4 @@
1
- import { CellTypeInferenceSink } from "../layout/cell-typing.cjs";
1
+ import { i as CellTypeInferenceSink } from "../cell-typing-CEWlywIc.cjs";
2
2
  import { ContentDocument } from "document-schema.js";
3
3
  //#region src/csv/read.d.ts
4
4
  interface ReadCsvContentOptions {
@@ -1,4 +1,4 @@
1
- import { CellTypeInferenceSink } from "../layout/cell-typing.js";
1
+ import { i as CellTypeInferenceSink } from "../cell-typing-CEWlywIc.js";
2
2
  import { ContentDocument } from "document-schema.js";
3
3
  //#region src/csv/read.d.ts
4
4
  interface ReadCsvContentOptions {
@@ -0,0 +1,10 @@
1
+ //#region src/svg/diagnostics.d.ts
2
+ declare const SVG_DIAGNOSTIC_CODES: readonly ["svg/text-unsupported", "svg/image-unsupported", "svg/use-unsupported", "svg/gradient-unsupported", "svg/element-unsupported", "svg/element-skipped", "svg/css-style-ignored", "svg/paint-unsupported", "svg/opacity-ignored", "svg/preserve-aspect-ratio-stretched", "svg/default-size-assumed", "svg/shape-unsupported", "svg/stroke-style-unsupported"];
3
+ type SvgDiagnosticCode = (typeof SVG_DIAGNOSTIC_CODES)[number];
4
+ interface SvgDiagnostic {
5
+ readonly code: SvgDiagnosticCode;
6
+ readonly detail?: string;
7
+ }
8
+ type SvgDiagnosticSink = (diagnostic: SvgDiagnostic) => void;
9
+ //#endregion
10
+ export { SvgDiagnosticSink as i, SvgDiagnostic as n, SvgDiagnosticCode as r, SVG_DIAGNOSTIC_CODES as t };
@@ -0,0 +1,10 @@
1
+ //#region src/svg/diagnostics.d.ts
2
+ declare const SVG_DIAGNOSTIC_CODES: readonly ["svg/text-unsupported", "svg/image-unsupported", "svg/use-unsupported", "svg/gradient-unsupported", "svg/element-unsupported", "svg/element-skipped", "svg/css-style-ignored", "svg/paint-unsupported", "svg/opacity-ignored", "svg/preserve-aspect-ratio-stretched", "svg/default-size-assumed", "svg/shape-unsupported", "svg/stroke-style-unsupported"];
3
+ type SvgDiagnosticCode = (typeof SVG_DIAGNOSTIC_CODES)[number];
4
+ interface SvgDiagnostic {
5
+ readonly code: SvgDiagnosticCode;
6
+ readonly detail?: string;
7
+ }
8
+ type SvgDiagnosticSink = (diagnostic: SvgDiagnostic) => void;
9
+ //#endregion
10
+ export { SvgDiagnosticSink as i, SvgDiagnostic as n, SvgDiagnosticCode as r, SVG_DIAGNOSTIC_CODES as t };
@@ -123,6 +123,7 @@ function populateParagraph(paragraph, block) {
123
123
  paragraph.styleId = block.styleId;
124
124
  paragraph.alignment = block.alignment;
125
125
  paragraph.list = block.list;
126
+ if (block.headingLevel !== void 0) paragraph.headingLevel = block.headingLevel;
126
127
  if (block.spacingBeforePt !== void 0) paragraph.spacingBeforePt = block.spacingBeforePt;
127
128
  if (block.spacingAfterPt !== void 0) paragraph.spacingAfterPt = block.spacingAfterPt;
128
129
  if (block.lineSpacing !== void 0) paragraph.lineSpacing = block.lineSpacing;
@@ -122,6 +122,7 @@ function populateParagraph(paragraph, block) {
122
122
  paragraph.styleId = block.styleId;
123
123
  paragraph.alignment = block.alignment;
124
124
  paragraph.list = block.list;
125
+ if (block.headingLevel !== void 0) paragraph.headingLevel = block.headingLevel;
125
126
  if (block.spacingBeforePt !== void 0) paragraph.spacingBeforePt = block.spacingBeforePt;
126
127
  if (block.spacingAfterPt !== void 0) paragraph.spacingAfterPt = block.spacingAfterPt;
127
128
  if (block.lineSpacing !== void 0) paragraph.lineSpacing = block.lineSpacing;
@@ -208,6 +208,22 @@ var DocxParagraph = class {
208
208
  const numPr = require_xml_edit.getOrCreateChildElement(pPr, "w:numPr", require_edit_docx_props.PPR_ORDER, () => require_xml_fragment.el("w:numPr"));
209
209
  numPr.children = [require_xml_fragment.el("w:ilvl", { "w:val": String(value.level) }), require_xml_fragment.el("w:numId", { "w:val": value.numId })];
210
210
  }
211
+ get headingLevel() {
212
+ const pPr = this.pPr(false);
213
+ const outlineLvl = pPr === void 0 ? void 0 : directChild(pPr, "w:outlineLvl");
214
+ const val = outlineLvl === void 0 ? void 0 : (0, ooxml_js.attr)(outlineLvl, "w:val");
215
+ return val === void 0 ? void 0 : Number(val) + 1;
216
+ }
217
+ set headingLevel(value) {
218
+ if (value === void 0) {
219
+ const pPr = this.pPr(false);
220
+ const existing = pPr === void 0 ? void 0 : directChild(pPr, "w:outlineLvl");
221
+ if (existing !== void 0 && pPr !== void 0) require_xml_edit.removeChild(pPr.children, existing);
222
+ return;
223
+ }
224
+ const outlineLvl = require_xml_edit.getOrCreateChildElement(this.pPr(true), "w:outlineLvl", require_edit_docx_props.PPR_ORDER, () => require_xml_fragment.el("w:outlineLvl"));
225
+ require_xml_edit.setAttr(outlineLvl, "w:val", String(value - 1));
226
+ }
211
227
  appendOfficeMath(mathml) {
212
228
  const node = this.live();
213
229
  const result = require_omml_write.buildOfficeMathParagraph(mathml);
@@ -256,10 +272,11 @@ var DocxParagraph = class {
256
272
  };
257
273
  function buildParagraph(init = {}) {
258
274
  const paragraph = require_xml_fragment.el("w:p");
259
- if (init.styleId !== void 0 || init.alignment !== void 0) {
275
+ if (init.styleId !== void 0 || init.alignment !== void 0 || init.headingLevel !== void 0) {
260
276
  const pPr = require_xml_fragment.el("w:pPr");
261
277
  if (init.styleId !== void 0) pPr.children.push(require_xml_fragment.el("w:pStyle", { "w:val": init.styleId }));
262
278
  if (init.alignment !== void 0) pPr.children.push(require_xml_fragment.el("w:jc", { "w:val": init.alignment === "justify" ? "both" : init.alignment }));
279
+ if (init.headingLevel !== void 0) pPr.children.push(require_xml_fragment.el("w:outlineLvl", { "w:val": String(init.headingLevel - 1) }));
263
280
  paragraph.children.push(pPr);
264
281
  }
265
282
  if (init.text !== void 0) paragraph.children.push(require_edit_docx_run.buildRun({ text: init.text }));
@@ -8,6 +8,7 @@ import { Package, XmlElement, XmlNode } from "ooxml.js";
8
8
  interface ParagraphInit {
9
9
  readonly text?: string;
10
10
  readonly styleId?: string;
11
+ readonly headingLevel?: number;
11
12
  readonly alignment?: 'left' | 'center' | 'right' | 'justify';
12
13
  }
13
14
  interface ImageMediaContext {
@@ -47,6 +48,8 @@ declare class DocxParagraph {
47
48
  set indentFirstLinePt(value: number | undefined);
48
49
  get list(): ContentListMembership | undefined;
49
50
  set list(value: ContentListMembership | undefined);
51
+ get headingLevel(): number | undefined;
52
+ set headingLevel(value: number | undefined);
50
53
  appendOfficeMath(mathml: readonly MathMlNode$1[]): OmmlWriteResult & {
51
54
  readonly written: boolean;
52
55
  };
@@ -8,6 +8,7 @@ import { ContentListMembership, ContentVector } from "document-schema.js";
8
8
  interface ParagraphInit {
9
9
  readonly text?: string;
10
10
  readonly styleId?: string;
11
+ readonly headingLevel?: number;
11
12
  readonly alignment?: 'left' | 'center' | 'right' | 'justify';
12
13
  }
13
14
  interface ImageMediaContext {
@@ -47,6 +48,8 @@ declare class DocxParagraph {
47
48
  set indentFirstLinePt(value: number | undefined);
48
49
  get list(): ContentListMembership | undefined;
49
50
  set list(value: ContentListMembership | undefined);
51
+ get headingLevel(): number | undefined;
52
+ set headingLevel(value: number | undefined);
50
53
  appendOfficeMath(mathml: readonly MathMlNode$1[]): OmmlWriteResult & {
51
54
  readonly written: boolean;
52
55
  };
@@ -207,6 +207,22 @@ var DocxParagraph = class {
207
207
  const numPr = getOrCreateChildElement(pPr, "w:numPr", PPR_ORDER, () => el("w:numPr"));
208
208
  numPr.children = [el("w:ilvl", { "w:val": String(value.level) }), el("w:numId", { "w:val": value.numId })];
209
209
  }
210
+ get headingLevel() {
211
+ const pPr = this.pPr(false);
212
+ const outlineLvl = pPr === void 0 ? void 0 : directChild(pPr, "w:outlineLvl");
213
+ const val = outlineLvl === void 0 ? void 0 : attr(outlineLvl, "w:val");
214
+ return val === void 0 ? void 0 : Number(val) + 1;
215
+ }
216
+ set headingLevel(value) {
217
+ if (value === void 0) {
218
+ const pPr = this.pPr(false);
219
+ const existing = pPr === void 0 ? void 0 : directChild(pPr, "w:outlineLvl");
220
+ if (existing !== void 0 && pPr !== void 0) removeChild(pPr.children, existing);
221
+ return;
222
+ }
223
+ const outlineLvl = getOrCreateChildElement(this.pPr(true), "w:outlineLvl", PPR_ORDER, () => el("w:outlineLvl"));
224
+ setAttr(outlineLvl, "w:val", String(value - 1));
225
+ }
210
226
  appendOfficeMath(mathml) {
211
227
  const node = this.live();
212
228
  const result = buildOfficeMathParagraph(mathml);
@@ -255,10 +271,11 @@ var DocxParagraph = class {
255
271
  };
256
272
  function buildParagraph(init = {}) {
257
273
  const paragraph = el("w:p");
258
- if (init.styleId !== void 0 || init.alignment !== void 0) {
274
+ if (init.styleId !== void 0 || init.alignment !== void 0 || init.headingLevel !== void 0) {
259
275
  const pPr = el("w:pPr");
260
276
  if (init.styleId !== void 0) pPr.children.push(el("w:pStyle", { "w:val": init.styleId }));
261
277
  if (init.alignment !== void 0) pPr.children.push(el("w:jc", { "w:val": init.alignment === "justify" ? "both" : init.alignment }));
278
+ if (init.headingLevel !== void 0) pPr.children.push(el("w:outlineLvl", { "w:val": String(init.headingLevel - 1) }));
262
279
  paragraph.children.push(pPr);
263
280
  }
264
281
  if (init.text !== void 0) paragraph.children.push(buildRun({ text: init.text }));
@@ -24,6 +24,7 @@ const PPR_ORDER = [
24
24
  "w:spacing",
25
25
  "w:ind",
26
26
  "w:jc",
27
+ "w:outlineLvl",
27
28
  "w:rPr"
28
29
  ];
29
30
  function ensureFirstChild(parent, tag) {
@@ -23,6 +23,7 @@ const PPR_ORDER = [
23
23
  "w:spacing",
24
24
  "w:ind",
25
25
  "w:jc",
26
+ "w:outlineLvl",
26
27
  "w:rPr"
27
28
  ];
28
29
  function ensureFirstChild(parent, tag) {
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_model_metadata = require("../../model/metadata.cjs");
3
3
  const require_ports_clock = require("../../ports/clock.cjs");
4
- const require_markdown_read = require("../../markdown/read.cjs");
5
4
  const require_markdown_write = require("../../markdown/write.cjs");
5
+ const require_markdown_read = require("../../markdown/read.cjs");
6
6
  const require_edit_markdown_paragraph = require("./paragraph.cjs");
7
7
  const require_edit_markdown_list = require("./list.cjs");
8
8
  const require_edit_markdown_table = require("./table.cjs");
@@ -1,7 +1,7 @@
1
1
  import { resolveMetadataTimestamps } from "../../model/metadata.js";
2
2
  import { systemClock } from "../../ports/clock.js";
3
- import { readMarkdownContent as readMarkdownContent$1 } from "../../markdown/read.js";
4
3
  import { buildMarkdownText } from "../../markdown/write.js";
4
+ import { readMarkdownContent as readMarkdownContent$1 } from "../../markdown/read.js";
5
5
  import { MarkdownParagraph, buildParagraph } from "./paragraph.js";
6
6
  import { MarkdownList } from "./list.js";
7
7
  import { MarkdownTable, buildTable } from "./table.js";
@@ -16,7 +16,8 @@ var PdfItemBase = class {
16
16
  return this.node;
17
17
  }
18
18
  get sourcePath() {
19
- return this.live().sourcePath;
19
+ const node = this.live();
20
+ return node.kind === "internalLink" ? void 0 : node.sourcePath;
20
21
  }
21
22
  remove() {
22
23
  const node = this.live();
@@ -416,6 +417,44 @@ function buildLinkItem(init) {
416
417
  heightPt: init.heightPt
417
418
  };
418
419
  }
420
+ var PdfInternalLinkItem = class extends PdfItemBase {
421
+ kind = "internalLink";
422
+ constructor(container, node) {
423
+ super(container, node, "PdfInternalLinkItem");
424
+ }
425
+ get destination() {
426
+ return this.live().destination;
427
+ }
428
+ set destination(value) {
429
+ this.live().destination = value;
430
+ }
431
+ get xPt() {
432
+ return this.live().xPt;
433
+ }
434
+ set xPt(value) {
435
+ this.live().xPt = value;
436
+ }
437
+ get yPt() {
438
+ return this.live().yPt;
439
+ }
440
+ set yPt(value) {
441
+ this.live().yPt = value;
442
+ }
443
+ get widthPt() {
444
+ return this.live().widthPt;
445
+ }
446
+ set widthPt(value) {
447
+ requireNonNegative(value, "widthPt");
448
+ this.live().widthPt = value;
449
+ }
450
+ get heightPt() {
451
+ return this.live().heightPt;
452
+ }
453
+ set heightPt(value) {
454
+ requireNonNegative(value, "heightPt");
455
+ this.live().heightPt = value;
456
+ }
457
+ };
419
458
  var PdfLinkItem = class extends PdfItemBase {
420
459
  kind = "link";
421
460
  constructor(container, node) {
@@ -460,6 +499,7 @@ function wrapItem(container, node, images) {
460
499
  case "image": return new PdfImageItem(container, node, images);
461
500
  case "rect": return new PdfRectItem(container, node);
462
501
  case "ellipse": return new PdfEllipseItem(container, node);
502
+ case "internalLink": return new PdfInternalLinkItem(container, node);
463
503
  case "line": return new PdfLineItem(container, node);
464
504
  case "path": return new PdfPathItem(container, node);
465
505
  case "link": return new PdfLinkItem(container, node);
@@ -468,6 +508,7 @@ function wrapItem(container, node, images) {
468
508
  //#endregion
469
509
  exports.PdfEllipseItem = PdfEllipseItem;
470
510
  exports.PdfImageItem = PdfImageItem;
511
+ exports.PdfInternalLinkItem = PdfInternalLinkItem;
471
512
  exports.PdfLineItem = PdfLineItem;
472
513
  exports.PdfLinkItem = PdfLinkItem;
473
514
  exports.PdfPathItem = PdfPathItem;
@@ -1,2 +1,2 @@
1
- import { C as wrapItem, S as buildTextItem, _ as buildImageItem, a as PdfItem, b as buildPathItem, c as PdfLinkInit, d as PdfPathItem, f as PdfRectInit, g as buildEllipseItem, h as PdfTextItem, i as PdfImageItem, l as PdfLinkItem, m as PdfTextInit, n as PdfEllipseItem, o as PdfLineInit, p as PdfRectItem, r as PdfImageInit, s as PdfLineItem, t as PdfEllipseInit, u as PdfPathInit, v as buildLineItem, x as buildRectItem, y as buildLinkItem } from "../../item-D9vQKT0T.cjs";
2
- export { PdfEllipseInit, PdfEllipseItem, PdfImageInit, PdfImageItem, PdfItem, PdfLineInit, PdfLineItem, PdfLinkInit, PdfLinkItem, PdfPathInit, PdfPathItem, PdfRectInit, PdfRectItem, PdfTextInit, PdfTextItem, buildEllipseItem, buildImageItem, buildLineItem, buildLinkItem, buildPathItem, buildRectItem, buildTextItem, wrapItem };
1
+ import { C as buildTextItem, S as buildRectItem, _ as buildEllipseItem, a as PdfInternalLinkItem, b as buildLinkItem, c as PdfLineItem, d as PdfPathInit, f as PdfPathItem, g as PdfTextItem, h as PdfTextInit, i as PdfImageItem, l as PdfLinkInit, m as PdfRectItem, n as PdfEllipseItem, o as PdfItem, p as PdfRectInit, r as PdfImageInit, s as PdfLineInit, t as PdfEllipseInit, u as PdfLinkItem, v as buildImageItem, w as wrapItem, x as buildPathItem, y as buildLineItem } from "../../item-DhXpJNAQ.cjs";
2
+ export { PdfEllipseInit, PdfEllipseItem, PdfImageInit, PdfImageItem, PdfInternalLinkItem, PdfItem, PdfLineInit, PdfLineItem, PdfLinkInit, PdfLinkItem, PdfPathInit, PdfPathItem, PdfRectInit, PdfRectItem, PdfTextInit, PdfTextItem, buildEllipseItem, buildImageItem, buildLineItem, buildLinkItem, buildPathItem, buildRectItem, buildTextItem, wrapItem };
@@ -1,2 +1,2 @@
1
- import { C as wrapItem, S as buildTextItem, _ as buildImageItem, a as PdfItem, b as buildPathItem, c as PdfLinkInit, d as PdfPathItem, f as PdfRectInit, g as buildEllipseItem, h as PdfTextItem, i as PdfImageItem, l as PdfLinkItem, m as PdfTextInit, n as PdfEllipseItem, o as PdfLineInit, p as PdfRectItem, r as PdfImageInit, s as PdfLineItem, t as PdfEllipseInit, u as PdfPathInit, v as buildLineItem, x as buildRectItem, y as buildLinkItem } from "../../item-D9vQKT0T.js";
2
- export { PdfEllipseInit, PdfEllipseItem, PdfImageInit, PdfImageItem, PdfItem, PdfLineInit, PdfLineItem, PdfLinkInit, PdfLinkItem, PdfPathInit, PdfPathItem, PdfRectInit, PdfRectItem, PdfTextInit, PdfTextItem, buildEllipseItem, buildImageItem, buildLineItem, buildLinkItem, buildPathItem, buildRectItem, buildTextItem, wrapItem };
1
+ import { C as buildTextItem, S as buildRectItem, _ as buildEllipseItem, a as PdfInternalLinkItem, b as buildLinkItem, c as PdfLineItem, d as PdfPathInit, f as PdfPathItem, g as PdfTextItem, h as PdfTextInit, i as PdfImageItem, l as PdfLinkInit, m as PdfRectItem, n as PdfEllipseItem, o as PdfItem, p as PdfRectInit, r as PdfImageInit, s as PdfLineInit, t as PdfEllipseInit, u as PdfLinkItem, v as buildImageItem, w as wrapItem, x as buildPathItem, y as buildLineItem } from "../../item-DhXpJNAQ.js";
2
+ export { PdfEllipseInit, PdfEllipseItem, PdfImageInit, PdfImageItem, PdfInternalLinkItem, PdfItem, PdfLineInit, PdfLineItem, PdfLinkInit, PdfLinkItem, PdfPathInit, PdfPathItem, PdfRectInit, PdfRectItem, PdfTextInit, PdfTextItem, buildEllipseItem, buildImageItem, buildLineItem, buildLinkItem, buildPathItem, buildRectItem, buildTextItem, wrapItem };
@@ -15,7 +15,8 @@ var PdfItemBase = class {
15
15
  return this.node;
16
16
  }
17
17
  get sourcePath() {
18
- return this.live().sourcePath;
18
+ const node = this.live();
19
+ return node.kind === "internalLink" ? void 0 : node.sourcePath;
19
20
  }
20
21
  remove() {
21
22
  const node = this.live();
@@ -415,6 +416,44 @@ function buildLinkItem(init) {
415
416
  heightPt: init.heightPt
416
417
  };
417
418
  }
419
+ var PdfInternalLinkItem = class extends PdfItemBase {
420
+ kind = "internalLink";
421
+ constructor(container, node) {
422
+ super(container, node, "PdfInternalLinkItem");
423
+ }
424
+ get destination() {
425
+ return this.live().destination;
426
+ }
427
+ set destination(value) {
428
+ this.live().destination = value;
429
+ }
430
+ get xPt() {
431
+ return this.live().xPt;
432
+ }
433
+ set xPt(value) {
434
+ this.live().xPt = value;
435
+ }
436
+ get yPt() {
437
+ return this.live().yPt;
438
+ }
439
+ set yPt(value) {
440
+ this.live().yPt = value;
441
+ }
442
+ get widthPt() {
443
+ return this.live().widthPt;
444
+ }
445
+ set widthPt(value) {
446
+ requireNonNegative(value, "widthPt");
447
+ this.live().widthPt = value;
448
+ }
449
+ get heightPt() {
450
+ return this.live().heightPt;
451
+ }
452
+ set heightPt(value) {
453
+ requireNonNegative(value, "heightPt");
454
+ this.live().heightPt = value;
455
+ }
456
+ };
418
457
  var PdfLinkItem = class extends PdfItemBase {
419
458
  kind = "link";
420
459
  constructor(container, node) {
@@ -459,10 +498,11 @@ function wrapItem(container, node, images) {
459
498
  case "image": return new PdfImageItem(container, node, images);
460
499
  case "rect": return new PdfRectItem(container, node);
461
500
  case "ellipse": return new PdfEllipseItem(container, node);
501
+ case "internalLink": return new PdfInternalLinkItem(container, node);
462
502
  case "line": return new PdfLineItem(container, node);
463
503
  case "path": return new PdfPathItem(container, node);
464
504
  case "link": return new PdfLinkItem(container, node);
465
505
  }
466
506
  }
467
507
  //#endregion
468
- export { PdfEllipseItem, PdfImageItem, PdfLineItem, PdfLinkItem, PdfPathItem, PdfRectItem, PdfTextItem, buildEllipseItem, buildImageItem, buildLineItem, buildLinkItem, buildPathItem, buildRectItem, buildTextItem, wrapItem };
508
+ export { PdfEllipseItem, PdfImageItem, PdfInternalLinkItem, PdfLineItem, PdfLinkItem, PdfPathItem, PdfRectItem, PdfTextItem, buildEllipseItem, buildImageItem, buildLineItem, buildLinkItem, buildPathItem, buildRectItem, buildTextItem, wrapItem };
@@ -1,4 +1,4 @@
1
- import { a as PdfItem, c as PdfLinkInit, d as PdfPathItem, f as PdfRectInit, h as PdfTextItem, i as PdfImageItem, l as PdfLinkItem, m as PdfTextInit, n as PdfEllipseItem, o as PdfLineInit, p as PdfRectItem, r as PdfImageInit, s as PdfLineItem, t as PdfEllipseInit, u as PdfPathInit } from "../../item-D9vQKT0T.cjs";
1
+ import { c as PdfLineItem, d as PdfPathInit, f as PdfPathItem, g as PdfTextItem, h as PdfTextInit, i as PdfImageItem, l as PdfLinkInit, m as PdfRectItem, n as PdfEllipseItem, o as PdfItem, p as PdfRectInit, r as PdfImageInit, s as PdfLineInit, t as PdfEllipseInit, u as PdfLinkItem } from "../../item-DhXpJNAQ.cjs";
2
2
  import { LayoutImageAsset, LayoutPage } from "pdf-codec";
3
3
  //#region src/edit/pdf/page.d.ts
4
4
  interface PageInit {
@@ -1,4 +1,4 @@
1
- import { a as PdfItem, c as PdfLinkInit, d as PdfPathItem, f as PdfRectInit, h as PdfTextItem, i as PdfImageItem, l as PdfLinkItem, m as PdfTextInit, n as PdfEllipseItem, o as PdfLineInit, p as PdfRectItem, r as PdfImageInit, s as PdfLineItem, t as PdfEllipseInit, u as PdfPathInit } from "../../item-D9vQKT0T.js";
1
+ import { c as PdfLineItem, d as PdfPathInit, f as PdfPathItem, g as PdfTextItem, h as PdfTextInit, i as PdfImageItem, l as PdfLinkInit, m as PdfRectItem, n as PdfEllipseItem, o as PdfItem, p as PdfRectInit, r as PdfImageInit, s as PdfLineInit, t as PdfEllipseInit, u as PdfLinkItem } from "../../item-DhXpJNAQ.js";
2
2
  import { LayoutImageAsset, LayoutPage } from "pdf-codec";
3
3
  //#region src/edit/pdf/page.d.ts
4
4
  interface PageInit {
@@ -1,20 +1,2 @@
1
- import { FontSubstitution, ProvidedFont } from "document-schema.js";
2
- import { FontRegistry } from "pdf-codec";
3
- import { Package } from "ooxml.js";
4
- import { Package as Package$1 } from "odf.js";
5
- //#region src/fonts/registry.d.ts
6
- type FontSourcePackage = {
7
- readonly kind: 'docx' | 'pptx';
8
- readonly package: Package;
9
- } | {
10
- readonly kind: 'odf';
11
- readonly package: Package$1;
12
- };
13
- interface DocumentFontRegistryOptions {
14
- readonly fonts?: readonly ProvidedFont[];
15
- readonly onFontSubstitution?: (substitution: FontSubstitution) => void;
16
- }
17
- declare function extractSourceFonts(source: FontSourcePackage): ProvidedFont[];
18
- declare function createDocumentFontRegistry(source: FontSourcePackage, options?: DocumentFontRegistryOptions): FontRegistry;
19
- //#endregion
1
+ import { i as extractSourceFonts, n as FontSourcePackage, r as createDocumentFontRegistry, t as DocumentFontRegistryOptions } from "../registry-BcBT-bnX.cjs";
20
2
  export { DocumentFontRegistryOptions, FontSourcePackage, createDocumentFontRegistry, extractSourceFonts };
@@ -1,20 +1,2 @@
1
- import { Package } from "ooxml.js";
2
- import { FontSubstitution, ProvidedFont } from "document-schema.js";
3
- import { FontRegistry } from "pdf-codec";
4
- import { Package as Package$1 } from "odf.js";
5
- //#region src/fonts/registry.d.ts
6
- type FontSourcePackage = {
7
- readonly kind: 'docx' | 'pptx';
8
- readonly package: Package;
9
- } | {
10
- readonly kind: 'odf';
11
- readonly package: Package$1;
12
- };
13
- interface DocumentFontRegistryOptions {
14
- readonly fonts?: readonly ProvidedFont[];
15
- readonly onFontSubstitution?: (substitution: FontSubstitution) => void;
16
- }
17
- declare function extractSourceFonts(source: FontSourcePackage): ProvidedFont[];
18
- declare function createDocumentFontRegistry(source: FontSourcePackage, options?: DocumentFontRegistryOptions): FontRegistry;
19
- //#endregion
1
+ import { i as extractSourceFonts, n as FontSourcePackage, r as createDocumentFontRegistry, t as DocumentFontRegistryOptions } from "../registry-D1Pu5XxB.js";
20
2
  export { DocumentFontRegistryOptions, FontSourcePackage, createDocumentFontRegistry, extractSourceFonts };
@@ -1,4 +1,4 @@
1
- import { HsqldbDecodeOptions } from "./rowformat.cjs";
1
+ import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
2
2
  import { r as HsqldbTable } from "../script-DsGGIzGU.cjs";
3
3
  //#region src/hsqldb/binary-script.d.ts
4
4
  declare class HsqldbBinaryScriptParseError extends Error {
@@ -1,4 +1,4 @@
1
- import { HsqldbDecodeOptions } from "./rowformat.js";
1
+ import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
2
2
  import { r as HsqldbTable } from "../script-DsGGIzGU.js";
3
3
  //#region src/hsqldb/binary-script.d.ts
4
4
  declare class HsqldbBinaryScriptParseError extends Error {
@@ -1,4 +1,4 @@
1
- import { HsqldbDecodeOptions } from "./rowformat.cjs";
1
+ import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
2
2
  import { r as HsqldbTable, t as HsqldbColumn } from "../script-DsGGIzGU.cjs";
3
3
  import { ContentCellValue } from "document-schema.js";
4
4
  //#region src/hsqldb/cache.d.ts
@@ -1,4 +1,4 @@
1
- import { HsqldbDecodeOptions } from "./rowformat.js";
1
+ import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
2
2
  import { r as HsqldbTable, t as HsqldbColumn } from "../script-DsGGIzGU.js";
3
3
  import { ContentCellValue } from "document-schema.js";
4
4
  //#region src/hsqldb/cache.d.ts
@@ -1,25 +1,2 @@
1
- import { ContentCellValue } from "document-schema.js";
2
- //#region src/hsqldb/rowformat.d.ts
3
- declare class HsqldbRowFormatError extends Error {
4
- constructor(message: string);
5
- }
6
- declare function resolveHsqldbTypeCode(declaredType: string): number;
7
- declare class HsqldbDataCursor {
8
- private readonly bytes;
9
- private readonly view;
10
- position: number;
11
- constructor(bytes: Uint8Array<ArrayBuffer>, offset?: number);
12
- readUint8(): number;
13
- readInt16(): number;
14
- readInt32(): number;
15
- readBigInt64(): bigint;
16
- readFloat64(): number;
17
- readBytes(length: number): Uint8Array<ArrayBuffer>;
18
- }
19
- declare function readModifiedUtf8(bytes: Uint8Array<ArrayBuffer>): string;
20
- interface HsqldbDecodeOptions {
21
- readonly timeZone?: string;
22
- }
23
- declare function readHsqldbColumnValue(cursor: HsqldbDataCursor, typeCode: number, options?: HsqldbDecodeOptions): ContentCellValue;
24
- //#endregion
1
+ import { a as readModifiedUtf8, i as readHsqldbColumnValue, n as HsqldbDecodeOptions, o as resolveHsqldbTypeCode, r as HsqldbRowFormatError, t as HsqldbDataCursor } from "../rowformat-Cl2exlEh.cjs";
25
2
  export { HsqldbDataCursor, HsqldbDecodeOptions, HsqldbRowFormatError, readHsqldbColumnValue, readModifiedUtf8, resolveHsqldbTypeCode };