js.documents 14.0.2 → 14.1.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.
@@ -0,0 +1,17 @@
1
+ //#region src/edit/pptx/diagnostics.d.ts
2
+ type PptxWriteDiagnosticSeverity = "info" | "warning";
3
+ declare const PptxWriteDiagnosticCodes: {
4
+ readonly TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped";
5
+ };
6
+ type PptxWriteDiagnosticCode = (typeof PptxWriteDiagnosticCodes)[keyof typeof PptxWriteDiagnosticCodes];
7
+ interface PptxWriteDiagnostic {
8
+ readonly code: PptxWriteDiagnosticCode;
9
+ readonly severity: PptxWriteDiagnosticSeverity;
10
+ readonly message: string;
11
+ }
12
+ type PptxWriteDiagnosticSink = (diagnostic: PptxWriteDiagnostic, context: {
13
+ readonly sourcePath?: string;
14
+ }) => void;
15
+ declare const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK: PptxWriteDiagnosticSink;
16
+ //#endregion
17
+ export { PptxWriteDiagnosticSeverity as a, PptxWriteDiagnosticCodes as i, PptxWriteDiagnostic as n, PptxWriteDiagnosticSink as o, PptxWriteDiagnosticCode as r, NOOP_PPTX_WRITE_DIAGNOSTIC_SINK as t };
@@ -0,0 +1,17 @@
1
+ //#region src/edit/pptx/diagnostics.d.ts
2
+ type PptxWriteDiagnosticSeverity = "info" | "warning";
3
+ declare const PptxWriteDiagnosticCodes: {
4
+ readonly TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped";
5
+ };
6
+ type PptxWriteDiagnosticCode = (typeof PptxWriteDiagnosticCodes)[keyof typeof PptxWriteDiagnosticCodes];
7
+ interface PptxWriteDiagnostic {
8
+ readonly code: PptxWriteDiagnosticCode;
9
+ readonly severity: PptxWriteDiagnosticSeverity;
10
+ readonly message: string;
11
+ }
12
+ type PptxWriteDiagnosticSink = (diagnostic: PptxWriteDiagnostic, context: {
13
+ readonly sourcePath?: string;
14
+ }) => void;
15
+ declare const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK: PptxWriteDiagnosticSink;
16
+ //#endregion
17
+ export { PptxWriteDiagnosticSeverity as a, PptxWriteDiagnosticCodes as i, PptxWriteDiagnostic as n, PptxWriteDiagnosticSink as o, PptxWriteDiagnosticCode as r, NOOP_PPTX_WRITE_DIAGNOSTIC_SINK as t };
@@ -6,6 +6,7 @@ const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs
6
6
  const require_model_formula = require("../../model/formula.cjs");
7
7
  const require_edit_pptx_scaffold = require("./scaffold.cjs");
8
8
  const require_edit_pptx_editor = require("./editor.cjs");
9
+ const require_edit_pptx_diagnostics = require("./diagnostics.cjs");
9
10
  let ooxml_js = require("ooxml.js");
10
11
  let document_schema_js = require("document-schema.js");
11
12
  //#region src/edit/pptx/content.ts
@@ -65,7 +66,7 @@ function appendShape(slide, shape, options) {
65
66
  columns: (0, document_schema_js.tableGridColumnCount)(onlyBlock),
66
67
  columnWidthsPt: onlyBlock.columnWidthsPt
67
68
  }
68
- }), onlyBlock, (url) => slide.registerHyperlink(url));
69
+ }), onlyBlock, options?.onDiagnostic ?? require_edit_pptx_diagnostics.NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, (url) => slide.registerHyperlink(url));
69
70
  return;
70
71
  }
71
72
  const paragraphs = [];
@@ -114,9 +115,14 @@ function populateCellParagraphs(cell, blocks, resolveHyperlinkRId) {
114
115
  }
115
116
  cell.setParagraphs(paragraphs);
116
117
  }
117
- function populatePptxTable(table, block, resolveHyperlinkRId) {
118
+ function populatePptxTable(table, block, onDiagnostic, resolveHyperlinkRId) {
118
119
  require_edit_table_grid.assertTableObeysGridRule(block, "buildPptxPackage");
119
120
  (0, document_schema_js.walkTableGrid)(block).forEach((positions, rowIndex) => {
121
+ if (block.rows[rowIndex]?.isHeader === true) onDiagnostic({
122
+ code: require_edit_pptx_diagnostics.PptxWriteDiagnosticCodes.TABLE_HEADER_ROW_DROPPED,
123
+ severity: "warning",
124
+ message: `buildPptxPackage: table row ${String(rowIndex)} is a header row, and that is dropped; DrawingML has no per-row header marker, so the row is written exactly as any other`
125
+ }, { sourcePath: block.sourcePath });
120
126
  positions.forEach((position) => {
121
127
  const { cell, columnIndex } = position;
122
128
  const tableCell = table.cell(rowIndex, columnIndex);
@@ -1,11 +1,13 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
2
  import { t as OmmlDiagnosticSink } from "../../formula-BH1FBblm.cjs";
3
+ import { o as PptxWriteDiagnosticSink } from "../../diagnostics-9twvwLNY.cjs";
3
4
  import { ContentDocument } from "document-schema.js";
4
5
  import { EmbeddedPresentationSerialiser, Package } from "ooxml.js";
5
6
  //#region src/edit/pptx/content.d.ts
6
7
  interface BuildPptxPackageOptions {
7
8
  readonly clock?: ClockPort;
8
9
  readonly onMathDiagnostic?: OmmlDiagnosticSink;
10
+ readonly onDiagnostic?: PptxWriteDiagnosticSink;
9
11
  }
10
12
  declare function buildPptxPackage(content: ContentDocument, options?: BuildPptxPackageOptions): Package;
11
13
  declare const embeddedPresentationSerialiser: EmbeddedPresentationSerialiser;
@@ -1,11 +1,13 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.js";
2
2
  import { t as OmmlDiagnosticSink } from "../../formula-DF4R1QEJ.js";
3
+ import { o as PptxWriteDiagnosticSink } from "../../diagnostics-9twvwLNY.js";
3
4
  import { EmbeddedPresentationSerialiser, Package } from "ooxml.js";
4
5
  import { ContentDocument } from "document-schema.js";
5
6
  //#region src/edit/pptx/content.d.ts
6
7
  interface BuildPptxPackageOptions {
7
8
  readonly clock?: ClockPort;
8
9
  readonly onMathDiagnostic?: OmmlDiagnosticSink;
10
+ readonly onDiagnostic?: PptxWriteDiagnosticSink;
9
11
  }
10
12
  declare function buildPptxPackage(content: ContentDocument, options?: BuildPptxPackageOptions): Package;
11
13
  declare const embeddedPresentationSerialiser: EmbeddedPresentationSerialiser;
@@ -5,6 +5,7 @@ import { drawingOfBlock, embeddedDrawingVectors } from "../../model/embedded-dra
5
5
  import { formulaOfBlock, formulaPlaceholderText } from "../../model/formula.js";
6
6
  import { createEmptyPptxPackage } from "./scaffold.js";
7
7
  import { PptxEditor } from "./editor.js";
8
+ import { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnosticCodes } from "./diagnostics.js";
8
9
  import { base64ToBytes, encodePackage } from "ooxml.js";
9
10
  import { resolveCellFillColor, tableCellColumnSpan, tableCellRowSpan, tableGridColumnCount, walkTableGrid } from "document-schema.js";
10
11
  //#region src/edit/pptx/content.ts
@@ -64,7 +65,7 @@ function appendShape(slide, shape, options) {
64
65
  columns: tableGridColumnCount(onlyBlock),
65
66
  columnWidthsPt: onlyBlock.columnWidthsPt
66
67
  }
67
- }), onlyBlock, (url) => slide.registerHyperlink(url));
68
+ }), onlyBlock, options?.onDiagnostic ?? NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, (url) => slide.registerHyperlink(url));
68
69
  return;
69
70
  }
70
71
  const paragraphs = [];
@@ -113,9 +114,14 @@ function populateCellParagraphs(cell, blocks, resolveHyperlinkRId) {
113
114
  }
114
115
  cell.setParagraphs(paragraphs);
115
116
  }
116
- function populatePptxTable(table, block, resolveHyperlinkRId) {
117
+ function populatePptxTable(table, block, onDiagnostic, resolveHyperlinkRId) {
117
118
  assertTableObeysGridRule(block, "buildPptxPackage");
118
119
  walkTableGrid(block).forEach((positions, rowIndex) => {
120
+ if (block.rows[rowIndex]?.isHeader === true) onDiagnostic({
121
+ code: PptxWriteDiagnosticCodes.TABLE_HEADER_ROW_DROPPED,
122
+ severity: "warning",
123
+ message: `buildPptxPackage: table row ${String(rowIndex)} is a header row, and that is dropped; DrawingML has no per-row header marker, so the row is written exactly as any other`
124
+ }, { sourcePath: block.sourcePath });
119
125
  positions.forEach((position) => {
120
126
  const { cell, columnIndex } = position;
121
127
  const tableCell = table.cell(rowIndex, columnIndex);
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/edit/pptx/diagnostics.ts
3
+ const PptxWriteDiagnosticCodes = { TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped" };
4
+ const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = () => {};
5
+ //#endregion
6
+ exports.NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = NOOP_PPTX_WRITE_DIAGNOSTIC_SINK;
7
+ exports.PptxWriteDiagnosticCodes = PptxWriteDiagnosticCodes;
@@ -0,0 +1,2 @@
1
+ import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-9twvwLNY.cjs";
2
+ export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnostic, PptxWriteDiagnosticCode, PptxWriteDiagnosticCodes, PptxWriteDiagnosticSeverity, PptxWriteDiagnosticSink };
@@ -0,0 +1,2 @@
1
+ import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-9twvwLNY.js";
2
+ export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnostic, PptxWriteDiagnosticCode, PptxWriteDiagnosticCodes, PptxWriteDiagnosticSeverity, PptxWriteDiagnosticSink };
@@ -0,0 +1,5 @@
1
+ //#region src/edit/pptx/diagnostics.ts
2
+ const PptxWriteDiagnosticCodes = { TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped" };
3
+ const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = () => {};
4
+ //#endregion
5
+ export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnosticCodes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "14.0.2",
3
+ "version": "14.1.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": {
@@ -83,12 +83,12 @@
83
83
  "document-schema.js": "7.14.0",
84
84
  "epub-codec": "5.0.1",
85
85
  "fflate": "0.8.3",
86
- "markdown-codec": "11.0.0",
86
+ "markdown-codec": "11.0.1",
87
87
  "odf.js": "11.0.0",
88
88
  "ooxml.js": "12.0.0",
89
89
  "pdf-codec": "5.2.4",
90
90
  "ppt-codec": "2.1.0",
91
- "rtf-codec": "8.0.0",
91
+ "rtf-codec": "8.0.1",
92
92
  "temml": "0.13.4",
93
93
  "wpd-codec": "5.1.0",
94
94
  "xls-codec": "4.15.16",