docxodus 10.0.0 → 12.0.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 (113) hide show
  1. package/README.md +7 -5
  2. package/dist/docxodus.worker.js +6 -38
  3. package/dist/docxodus.worker.js.map +1 -1
  4. package/dist/editor-comments.d.ts +129 -0
  5. package/dist/editor-comments.d.ts.map +1 -0
  6. package/dist/editor-comments.js +805 -0
  7. package/dist/editor-comments.js.map +1 -0
  8. package/dist/editor-headerfooter.d.ts +125 -85
  9. package/dist/editor-headerfooter.d.ts.map +1 -1
  10. package/dist/editor-headerfooter.js +572 -306
  11. package/dist/editor-headerfooter.js.map +1 -1
  12. package/dist/editor-image-patch.d.ts +38 -0
  13. package/dist/editor-image-patch.d.ts.map +1 -0
  14. package/dist/editor-image-patch.js +101 -0
  15. package/dist/editor-image-patch.js.map +1 -0
  16. package/dist/editor.bundle.js +3815 -778
  17. package/dist/editor.d.ts +237 -5
  18. package/dist/editor.d.ts.map +1 -1
  19. package/dist/editor.js +1063 -112
  20. package/dist/editor.js.map +1 -1
  21. package/dist/embed.bundle.js +3911 -849
  22. package/dist/embed.d.ts +1 -1
  23. package/dist/embed.d.ts.map +1 -1
  24. package/dist/embed.iife.js +3899 -837
  25. package/dist/embed.js +10 -1
  26. package/dist/embed.js.map +1 -1
  27. package/dist/export-assets.json +40 -46
  28. package/dist/export-browser.bundle.js +27 -3
  29. package/dist/index.d.ts +28 -64
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +68 -134
  32. package/dist/index.js.map +1 -1
  33. package/dist/pagination.bundle.js +25 -0
  34. package/dist/pagination.d.ts +6 -0
  35. package/dist/pagination.d.ts.map +1 -1
  36. package/dist/pagination.js +19 -0
  37. package/dist/pagination.js.map +1 -1
  38. package/dist/react.d.ts +4 -4
  39. package/dist/react.d.ts.map +1 -1
  40. package/dist/react.js.map +1 -1
  41. package/dist/ribbon-chrome.d.ts +20 -4
  42. package/dist/ribbon-chrome.d.ts.map +1 -1
  43. package/dist/ribbon-chrome.js +575 -184
  44. package/dist/ribbon-chrome.js.map +1 -1
  45. package/dist/ribbon.d.ts +5 -4
  46. package/dist/ribbon.d.ts.map +1 -1
  47. package/dist/ribbon.js +978 -129
  48. package/dist/ribbon.js.map +1 -1
  49. package/dist/session.bundle.js +100 -3
  50. package/dist/session.d.ts +60 -4
  51. package/dist/session.d.ts.map +1 -1
  52. package/dist/session.js +75 -3
  53. package/dist/session.js.map +1 -1
  54. package/dist/types.d.ts +194 -227
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/types.js +9 -75
  57. package/dist/types.js.map +1 -1
  58. package/dist/viewport.d.ts +7 -0
  59. package/dist/viewport.d.ts.map +1 -1
  60. package/dist/viewport.js +12 -0
  61. package/dist/viewport.js.map +1 -1
  62. package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm +0 -0
  63. package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm.br +0 -0
  64. package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm +0 -0
  65. package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm.br +0 -0
  66. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  67. package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
  68. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  69. package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
  70. package/dist/wasm/_framework/System.Collections.Concurrent.wasm +0 -0
  71. package/dist/wasm/_framework/System.Collections.Concurrent.wasm.br +0 -0
  72. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm +0 -0
  73. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm.br +0 -0
  74. package/dist/wasm/_framework/System.IO.Compression.wasm +0 -0
  75. package/dist/wasm/_framework/System.IO.Compression.wasm.br +0 -0
  76. package/dist/wasm/_framework/System.IO.Packaging.wasm +0 -0
  77. package/dist/wasm/_framework/System.IO.Packaging.wasm.br +0 -0
  78. package/dist/wasm/_framework/System.IO.Pipelines.wasm +0 -0
  79. package/dist/wasm/_framework/System.IO.Pipelines.wasm.br +0 -0
  80. package/dist/wasm/_framework/System.Linq.wasm +0 -0
  81. package/dist/wasm/_framework/System.Linq.wasm.br +0 -0
  82. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  83. package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
  84. package/dist/wasm/_framework/System.Private.Uri.wasm +0 -0
  85. package/dist/wasm/_framework/System.Private.Uri.wasm.br +0 -0
  86. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
  87. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm.br +0 -0
  88. package/dist/wasm/_framework/System.Private.Xml.wasm +0 -0
  89. package/dist/wasm/_framework/System.Private.Xml.wasm.br +0 -0
  90. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  91. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm.br +0 -0
  92. package/dist/wasm/_framework/System.Security.Cryptography.wasm +0 -0
  93. package/dist/wasm/_framework/System.Security.Cryptography.wasm.br +0 -0
  94. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm +0 -0
  95. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm.br +0 -0
  96. package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
  97. package/dist/wasm/_framework/System.Text.Json.wasm.br +0 -0
  98. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
  99. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm.br +0 -0
  100. package/dist/wasm/_framework/dotnet.boot.js +31 -37
  101. package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
  102. package/dist/wasm/_framework/dotnet.native.js +39 -3
  103. package/dist/wasm/_framework/dotnet.native.js.br +0 -0
  104. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  105. package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
  106. package/dist/worker-proxy.bundle.js +2 -3
  107. package/dist/worker-proxy.d.ts +2 -2
  108. package/dist/worker-proxy.d.ts.map +1 -1
  109. package/dist/worker-proxy.js +1 -2
  110. package/dist/worker-proxy.js.map +1 -1
  111. package/package.json +3 -3
  112. package/dist/wasm/_framework/System.Diagnostics.Process.wasm +0 -0
  113. package/dist/wasm/_framework/System.Diagnostics.Process.wasm.br +0 -0
package/dist/types.d.ts CHANGED
@@ -149,7 +149,10 @@ export interface MarkdownProjection {
149
149
  anchorIndex: Record<string, MarkdownAnchorTarget>;
150
150
  }
151
151
  /**
152
- * Revision type enum matching the .NET WmlComparerRevisionType
152
+ * Revision type enum matching the .NET `DocxDiffRevisionType`, as returned by the `docxDiff*`
153
+ * comparison APIs. NOT the shape {@link getRevisions} returns — that reads a document's own markup
154
+ * and reports the markup-level kind on `RevisionListEntry.type` (`ins`/`del`/`moveFrom`), with the
155
+ * grouped classification on `family`.
153
156
  */
154
157
  export declare enum RevisionType {
155
158
  /** Text or content that was added/inserted */
@@ -161,24 +164,6 @@ export declare enum RevisionType {
161
164
  /** Text content unchanged but formatting (bold, italic, etc.) changed */
162
165
  FormatChanged = "FormatChanged"
163
166
  }
164
- /**
165
- * Which comparison engine {@link compareDocuments} / {@link compareDocumentsToHtml}
166
- * use to redline two documents.
167
- *
168
- * The numeric values are the contract shared with the .NET `ComparisonEngine` enum
169
- * and the WASM boundary (marshalled as an int); `0` remains
170
- * {@link ComparisonEngine.WmlComparer} for wire compatibility. Omitted selectors use
171
- * {@link ComparisonEngine.DocxDiff}.
172
- *
173
- * `DocxDiff` is the default comparison engine. `WmlComparer` remains available for
174
- * callers that explicitly require its historical behavior.
175
- */
176
- export declare enum ComparisonEngine {
177
- /** The legacy WmlComparer engine (retained at wire value 0). */
178
- WmlComparer = 0,
179
- /** The default DocxDiff IR diff engine. */
180
- DocxDiff = 1
181
- }
182
167
  /**
183
168
  * Comment render mode
184
169
  * Use -1 (Disabled) to not render comments, or a positive value to enable with that mode
@@ -306,8 +291,6 @@ export interface ConversionOptions {
306
291
  export interface CompareOptions {
307
292
  /** Author name for tracked changes (default: "Docxodus") */
308
293
  authorName?: string;
309
- /** Detail threshold 0.0-1.0 (default: 0.15, lower = more detailed) */
310
- detailThreshold?: number;
311
294
  /** Whether comparison is case-insensitive (default: false) */
312
295
  caseInsensitive?: boolean;
313
296
  /**
@@ -316,68 +299,6 @@ export interface CompareOptions {
316
299
  * If false: changes are accepted, output shows final "clean" document
317
300
  */
318
301
  renderTrackedChanges?: boolean;
319
- /**
320
- * Which comparison engine to use (default: {@link ComparisonEngine.DocxDiff}).
321
- * Pass {@link ComparisonEngine.WmlComparer} only when its historical behavior is required.
322
- */
323
- engine?: ComparisonEngine;
324
- }
325
- /**
326
- * Information about a document revision extracted from a compared document.
327
- *
328
- * @example
329
- * ```typescript
330
- * const revisions = await getRevisions(comparedDoc);
331
- * for (const rev of revisions) {
332
- * if (rev.revisionType === RevisionType.Inserted) {
333
- * console.log(`${rev.author} added: "${rev.text}"`);
334
- * } else if (rev.revisionType === RevisionType.Deleted) {
335
- * console.log(`${rev.author} removed: "${rev.text}"`);
336
- * }
337
- * }
338
- * ```
339
- */
340
- export interface Revision {
341
- /**
342
- * Author who made the revision.
343
- * This comes from the Word document's tracked changes author attribute.
344
- * May be empty string if the document doesn't specify an author.
345
- */
346
- author: string;
347
- /**
348
- * ISO 8601 date string when the revision was made.
349
- * Format: "YYYY-MM-DDTHH:mm:ssZ" (e.g., "2024-01-15T10:30:00Z")
350
- * May be empty string if the document doesn't specify a date.
351
- */
352
- date: string;
353
- /**
354
- * Type of revision - "Inserted", "Deleted", or "Moved".
355
- * Use the RevisionType enum for type-safe comparisons.
356
- */
357
- revisionType: RevisionType | string;
358
- /**
359
- * Text content of the revision.
360
- * For paragraph breaks, this will be a newline character.
361
- * May be empty string for non-text elements (e.g., images, math equations).
362
- */
363
- text: string;
364
- /**
365
- * For Moved revisions, this ID links the source and destination.
366
- * Both the "from" and "to" revisions share the same moveGroupId.
367
- * Undefined for non-move revisions.
368
- */
369
- moveGroupId?: number;
370
- /**
371
- * For Moved revisions: true = source (content moved FROM here),
372
- * false = destination (content moved TO here).
373
- * Undefined for non-move revisions.
374
- */
375
- isMoveSource?: boolean;
376
- /**
377
- * For FormatChanged revisions: details about what formatting changed.
378
- * Undefined for non-format-change revisions.
379
- */
380
- formatChange?: FormatChangeDetails;
381
302
  }
382
303
  /**
383
304
  * Which property container a FormatChanged revision describes.
@@ -417,7 +338,7 @@ export interface FormatChangeDetails {
417
338
  export declare enum DocxDiffRevisionGranularity {
418
339
  /** The engine's native one-revision-per-token-span grain (the default). */
419
340
  Fine = 0,
420
- /** Coalesced to counts/texts comparable to the shipped WmlComparer's. */
341
+ /** Coalesced to the coarser contiguous-region grain the legacy comparer reported. */
421
342
  WmlComparerCompatible = 1
422
343
  }
423
344
  /**
@@ -549,6 +470,22 @@ export interface DocxDiffProducts {
549
470
  /** The stable semantic-change schema (what `docxDiffGetSemanticChanges` returns). */
550
471
  semanticChanges?: SemanticChangeSet;
551
472
  }
473
+ /** One candidate of a {@link docxDiffCompareBatch} run: the products of comparing the shared
474
+ * baseline against it, or the error that comparing it produced. */
475
+ export interface DocxDiffBatchResult extends DocxDiffProducts {
476
+ /** The candidate's name, echoed from the request (its index when none was given). */
477
+ name: string;
478
+ /** Set when this candidate failed; its products are then absent. The rest of the batch is
479
+ * unaffected — one malformed counterparty markup must not cost the other ninety-nine. */
480
+ error?: string;
481
+ }
482
+ /** A candidate document for {@link docxDiffCompareBatch}. */
483
+ export interface DocxDiffBatchCandidate {
484
+ /** Echoed back on the matching result. Defaults to the candidate's index. */
485
+ name?: string;
486
+ /** The candidate document. */
487
+ document: File | Uint8Array;
488
+ }
552
489
  /** Stable v1 operation names emitted by the semantic-change schema. */
553
490
  export type SemanticChangeOperation = "insert" | "delete" | "move" | "modify";
554
491
  /** Stable v1 semantic families. New schema versions may append families. */
@@ -675,7 +612,7 @@ export interface DocxDiffConsolidatedRevision extends DocxDiffRevision {
675
612
  * const insertions = revisions.filter(isInsertion);
676
613
  * ```
677
614
  */
678
- export declare function isInsertion(revision: Revision): boolean;
615
+ export declare function isInsertion(revision: RevisionListEntry): boolean;
679
616
  /**
680
617
  * Type guard to check if a revision is a deletion.
681
618
  * @param revision - The revision to check
@@ -687,7 +624,7 @@ export declare function isInsertion(revision: Revision): boolean;
687
624
  * const deletions = revisions.filter(isDeletion);
688
625
  * ```
689
626
  */
690
- export declare function isDeletion(revision: Revision): boolean;
627
+ export declare function isDeletion(revision: RevisionListEntry): boolean;
691
628
  /**
692
629
  * Type guard to check if a revision is a move operation.
693
630
  * @param revision - The revision to check
@@ -699,7 +636,7 @@ export declare function isDeletion(revision: Revision): boolean;
699
636
  * const moves = revisions.filter(isMove);
700
637
  * ```
701
638
  */
702
- export declare function isMove(revision: Revision): boolean;
639
+ export declare function isMove(revision: RevisionListEntry): boolean;
703
640
  /**
704
641
  * Type guard to check if a revision is a format change.
705
642
  * @param revision - The revision to check
@@ -714,47 +651,7 @@ export declare function isMove(revision: Revision): boolean;
714
651
  * }
715
652
  * ```
716
653
  */
717
- export declare function isFormatChange(revision: Revision): boolean;
718
- /**
719
- * Type guard to check if a revision is a move source (content moved FROM here).
720
- * @param revision - The revision to check
721
- * @returns true if the revision is the source of a move
722
- *
723
- * @example
724
- * ```typescript
725
- * const revisions = await getRevisions(doc);
726
- * const moveSources = revisions.filter(isMoveSource);
727
- * ```
728
- */
729
- export declare function isMoveSource(revision: Revision): boolean;
730
- /**
731
- * Type guard to check if a revision is a move destination (content moved TO here).
732
- * @param revision - The revision to check
733
- * @returns true if the revision is the destination of a move
734
- *
735
- * @example
736
- * ```typescript
737
- * const revisions = await getRevisions(doc);
738
- * const moveDestinations = revisions.filter(isMoveDestination);
739
- * ```
740
- */
741
- export declare function isMoveDestination(revision: Revision): boolean;
742
- /**
743
- * Find the matching pair for a move revision.
744
- * @param revision - A move revision
745
- * @param allRevisions - All revisions from the document
746
- * @returns The matching move revision, or undefined if not found
747
- *
748
- * @example
749
- * ```typescript
750
- * const revisions = await getRevisions(doc);
751
- * for (const rev of revisions.filter(isMoveSource)) {
752
- * const destination = findMovePair(rev, revisions);
753
- * console.log(`"${rev.text}" moved to become "${destination?.text}"`);
754
- * }
755
- * ```
756
- */
757
- export declare function findMovePair(revision: Revision, allRevisions: Revision[]): Revision | undefined;
654
+ export declare function isFormatChange(revision: RevisionListEntry): boolean;
758
655
  /**
759
656
  * Version information for the library
760
657
  */
@@ -778,7 +675,7 @@ export interface CompareResult {
778
675
  /** The redlined document as a Uint8Array */
779
676
  document: Uint8Array;
780
677
  /** List of revisions found */
781
- revisions: Revision[];
678
+ revisions: RevisionListEntry[];
782
679
  }
783
680
  /** Algorithm-labelled digest in a verification artifact. */
784
681
  export interface VerificationDigest {
@@ -1195,15 +1092,12 @@ export interface DocxodusWasmExports {
1195
1092
  * Idempotent — assemblies load only once.
1196
1093
  */
1197
1094
  Warmup: () => string;
1198
- CompareDocuments: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, engine: number) => Uint8Array;
1095
+ CompareDocuments: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string) => Uint8Array;
1199
1096
  CompareDocumentsToHtml: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string) => string;
1200
- CompareDocumentsToHtmlWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, renderTrackedChanges: boolean, engine: number) => string;
1201
- CompareDocumentsToHtmlFull: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, detailThreshold: number, caseInsensitive: boolean, renderTrackedChanges: boolean, engine: number) => string;
1202
- CompareDocumentsWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, detailThreshold: number, caseInsensitive: boolean, engine: number) => Uint8Array;
1097
+ CompareDocumentsToHtmlWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, renderTrackedChanges: boolean) => string;
1098
+ CompareDocumentsToHtmlFull: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, caseInsensitive: boolean, renderTrackedChanges: boolean) => string;
1099
+ CompareDocumentsWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, caseInsensitive: boolean) => Uint8Array;
1203
1100
  GetRevisionsJson: (comparedDocBytes: Uint8Array) => string;
1204
- GetRevisionsJsonWithOptions: (comparedDocBytes: Uint8Array, detectMoves: boolean, moveSimilarityThreshold: number, moveMinimumWordCount: number, caseInsensitive: boolean) => string;
1205
- CompareDocumentsWithLog: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, detailThreshold: number, caseInsensitive: boolean) => string;
1206
- CompareDocumentsToHtmlWithLog: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, detailThreshold: number, caseInsensitive: boolean, renderTrackedChanges: boolean) => string;
1207
1101
  };
1208
1102
  DocxDiffBridge: {
1209
1103
  /** Redlined DOCX bytes (native markup), or empty array on error. */
@@ -1217,6 +1111,9 @@ export interface DocxodusWasmExports {
1217
1111
  /** One memoized pass, every requested product: `{"redlineB64":…, "revisions":[…],
1218
1112
  * "editScript":…, "semanticChanges":…}` JSON (issue #594), or a JSON error object. */
1219
1113
  CompareProductsJson: (leftBytes: Uint8Array, rightBytes: Uint8Array, settingsJson: string, productsJson: string) => string;
1114
+ /** One baseline read once, compared against many candidates:
1115
+ * `{"results":[{"name":…, …products…}]}` JSON (issue #617), or a JSON error object. */
1116
+ CompareBatchJson: (baselineBytes: Uint8Array, candidatesJson: string, settingsJson: string, productsJson: string) => string;
1220
1117
  /** Accept all tracked revisions in a redlined DOCX → "right"-side bytes, or empty array on error. */
1221
1118
  AcceptRevisions: (bytes: Uint8Array) => Uint8Array;
1222
1119
  /** Reject all tracked revisions in a redlined DOCX → "left"-side bytes, or empty array on error. */
@@ -1274,6 +1171,18 @@ export interface DocxodusWasmExports {
1274
1171
  RenderBlockHtmlForReview?: (handle: number, anchorId: string, cssPrefix: string, fabricateClasses: boolean, renderTrackedChanges: boolean) => string;
1275
1172
  RenderHtml: (handle: number, cssPrefix: string, fabricateClasses: boolean, paginated: boolean, scale: number) => string;
1276
1173
  RenderHtmlForReview?: (handle: number, cssPrefix: string, fabricateClasses: boolean, paginated: boolean, scale: number, renderTrackedChanges: boolean) => string;
1174
+ /** The editor's comments-aware render profile: `optionsJson` is a serialized
1175
+ * {@link EditorRenderOptions}. With `comments: true` the output carries the converter's
1176
+ * Inline comment markup (`comment-highlight` spans with `data-comment-id`, `comment-marker`
1177
+ * anchors) using the `comment-` class prefix; with `comments: false` it is byte-identical to
1178
+ * `RenderHtml` / `RenderHtmlForReview`. Same error convention: HTML starts with '<', an
1179
+ * error object with '{'. Optional: absent on older WASM bundles. */
1180
+ RenderEditorHtml?: (handle: number, optionsJson: string) => string;
1181
+ /** Batch block render with the editor profile — `RenderBlocksHtml` plus comment markup;
1182
+ * same JSON-object result (`{ [anchorId]: html | null }`, or `{"error": …}`). */
1183
+ RenderEditorBlocksHtml?: (handle: number, anchorIdsJson: string, optionsJson: string) => string;
1184
+ /** Single-block render with the editor profile — `RenderBlockHtml` plus comment markup. */
1185
+ RenderEditorBlockHtml?: (handle: number, anchorId: string, optionsJson: string) => string;
1277
1186
  ReplaceText: (handle: number, anchor: string, md: string) => string;
1278
1187
  DeleteBlock: (handle: number, anchor: string) => string;
1279
1188
  MoveBlock: (handle: number, sourceAnchor: string, targetAnchor: string, pos: string) => string;
@@ -1307,8 +1216,19 @@ export interface DocxodusWasmExports {
1307
1216
  SetFooterText: (handle: number, anchor: string, kind: string, markdown: string) => string;
1308
1217
  InsertPageNumberField: (handle: number, anchor: string, field: string, format: string) => string;
1309
1218
  SetPageNumbering: (handle: number, anchor: string, opJson: string) => string;
1219
+ InsertTableOfContents: (handle: number, anchor: string, pos: string, optionsJson: string) => string;
1220
+ InsertTableOfFigures: (handle: number, anchor: string, pos: string, optionsJson: string) => string;
1221
+ InsertTableOfAuthorities: (handle: number, anchor: string, pos: string, optionsJson: string) => string;
1310
1222
  ClearPageNumbering: (handle: number, anchor: string) => string;
1311
1223
  EnsureHeaderFooterVisible: (handle: number, anchor: string, kind: string) => string;
1224
+ /** Word's "Different first page" / "Different odd & even pages" checkboxes. `kind` is
1225
+ * "first" | "even"; `enabled: false` removes `w:titlePg` / `w:evenAndOddHeaders` and leaves
1226
+ * the story parts in place. Optional: absent on older WASM bundles. */
1227
+ SetHeaderFooterKindEnabled?: (handle: number, anchor: string, kind: string, enabled: boolean) => string;
1228
+ /** Page size / orientation / margins / header-footer distance of the section owning
1229
+ * `anchor`; `opJson` is a serialized {@link PageSetupOp}. Optional: absent on older WASM
1230
+ * bundles. */
1231
+ SetPageSetup?: (handle: number, anchor: string, opJson: string) => string;
1312
1232
  InsertFootnote: (handle: number, anchor: string, characterOffset: number, markdown: string) => string;
1313
1233
  InsertCrossReference: (handle: number, anchor: string, characterOffset: number, bookmarkName: string, optionsJson: string) => string;
1314
1234
  InsertEndnote: (handle: number, anchor: string, characterOffset: number, markdown: string) => string;
@@ -1414,7 +1334,7 @@ export interface DocxodusWasmExports {
1414
1334
  SaveWithAnchorIds: (handle: number) => Uint8Array;
1415
1335
  };
1416
1336
  }
1417
- export type EditErrorCode = "anchor_not_found" | "anchor_wrong_kind" | "anchors_not_adjacent" | "session_disposed" | "malformed_markdown" | "unsupported_markdown_syntax" | "table_insert_not_supported" | "footnote_ref_not_supported" | "comment_marker_not_supported" | "image_insert_not_supported" | "anchor_token_in_payload" | "offset_out_of_range" | "invalid_position" | "text_not_found" | "unknown_style" | "invalid_list_level" | "invalid_list_start_value" | "invalid_page_numbering" | "invalid_paragraph_format" | "invalid_table_styling" | "invalid_table_merge" | "table_anchor_migration_required" | "malformed_xml" | "disallowed_namespace" | "incompatible_element_type" | "validation_failed" | "nothing_to_undo" | "nothing_to_redo" | "duplicate_annotation_id" | "annotation_not_found" | "empty_annotation_span" | "empty_comment_span" | "revision_not_found" | "precondition_failed" | "invalid_batch_step" | "invalid_transaction" | "transaction_conflict" | "transaction_result_evicted" | "transaction_incomplete" | "hyperlink_not_found" | "bookmark_not_found" | "duplicate_bookmark_name" | "invalid_bookmark_name" | "invalid_hyperlink_target" | "missing_bookmark_target" | "bookmark_in_use" | "managed_bookmark" | "empty_hyperlink_span" | "unsupported_inline_boundary" | "revision_unsupported" | "revision_malformed" | "revision_ambiguous" | "tracked_operation_unsupported" | "unresolved_structural_revision" | "content_control_not_found" | "content_control_malformed" | "content_control_unsupported" | "content_control_locked" | "content_control_bound" | "content_control_wrong_type" | "invalid_content_control_value" | "content_control_placement_unsupported" | "content_control_nested_fill_unsupported" | "repeating_section_constraint" | "image_not_found" | "invalid_image_data" | "unsupported_image_format" | "image_too_large" | "invalid_image_dimensions" | "unsupported_image_markup" | "linked_image_read_only" | "invalid_image_layout" | "internal_error";
1337
+ export type EditErrorCode = "anchor_not_found" | "anchor_wrong_kind" | "anchors_not_adjacent" | "session_disposed" | "malformed_markdown" | "unsupported_markdown_syntax" | "table_insert_not_supported" | "footnote_ref_not_supported" | "comment_marker_not_supported" | "image_insert_not_supported" | "anchor_token_in_payload" | "offset_out_of_range" | "invalid_position" | "text_not_found" | "unknown_style" | "invalid_list_level" | "invalid_list_start_value" | "invalid_page_numbering" | "invalid_page_setup" | "invalid_reference_field" | "invalid_paragraph_format" | "invalid_table_styling" | "invalid_table_merge" | "table_anchor_migration_required" | "malformed_xml" | "disallowed_namespace" | "incompatible_element_type" | "validation_failed" | "nothing_to_undo" | "nothing_to_redo" | "duplicate_annotation_id" | "annotation_not_found" | "empty_annotation_span" | "empty_comment_span" | "revision_not_found" | "precondition_failed" | "invalid_batch_step" | "invalid_transaction" | "transaction_conflict" | "transaction_result_evicted" | "transaction_incomplete" | "hyperlink_not_found" | "bookmark_not_found" | "duplicate_bookmark_name" | "invalid_bookmark_name" | "invalid_hyperlink_target" | "missing_bookmark_target" | "bookmark_in_use" | "managed_bookmark" | "empty_hyperlink_span" | "unsupported_inline_boundary" | "revision_unsupported" | "revision_malformed" | "revision_ambiguous" | "tracked_operation_unsupported" | "unresolved_structural_revision" | "content_control_not_found" | "content_control_malformed" | "content_control_unsupported" | "content_control_locked" | "content_control_bound" | "content_control_wrong_type" | "invalid_content_control_value" | "content_control_placement_unsupported" | "content_control_nested_fill_unsupported" | "repeating_section_constraint" | "image_not_found" | "invalid_image_data" | "unsupported_image_format" | "image_too_large" | "invalid_image_dimensions" | "unsupported_image_markup" | "linked_image_read_only" | "invalid_image_layout" | "internal_error";
1418
1338
  export interface AnchorRef {
1419
1339
  id: string;
1420
1340
  kind: string;
@@ -1732,11 +1652,15 @@ export interface BookmarkInfo {
1732
1652
  * `date` is the raw `w:date` attribute string; `text` is the flattened body.
1733
1653
  * `parentAnchorId` and `resolved` are present when the comment has a
1734
1654
  * `commentsExtended.xml` entry; their absence distinguishes a legacy/flat comment from an
1735
- * explicitly reopened one. The numeric `w:id` is deliberately not surfaced — comments are
1736
- * addressed by anchor everywhere.
1655
+ * explicitly reopened one. `id` is the numeric `w:id` — the value rendered comment markup
1656
+ * carries as `data-comment-id`, which is how a highlight in the DOM is matched back to its
1657
+ * entry. Mutations still address comments by `anchorId`.
1737
1658
  */
1738
1659
  export interface CommentListEntry {
1739
1660
  anchorId: string;
1661
+ /** The comment's numeric `w:comment/@w:id`; equals the `data-comment-id` of its rendered
1662
+ * highlight spans and marker. */
1663
+ id: number;
1740
1664
  author: string;
1741
1665
  initials?: string;
1742
1666
  date?: string;
@@ -1805,6 +1729,20 @@ export interface FormatOp {
1805
1729
  * the explicit font so the run inherits the style/default. Lets a run match a serif filing.
1806
1730
  */
1807
1731
  fontFamily?: string;
1732
+ /**
1733
+ * Text highlight colour (`w:highlight`) — one of Word's sixteen `ST_HighlightColor` names:
1734
+ * "yellow", "green", "cyan", "magenta", "blue", "red", "darkBlue", "darkCyan", "darkGreen",
1735
+ * "darkMagenta", "darkRed", "darkYellow", "darkGray", "lightGray", "black", "white". Omit to
1736
+ * leave unchanged; `""` or `"none"` clears. Any other value fails the op (`internal_error`
1737
+ * with the message, like an invalid `vertAlign`) — Word has no free-form highlight.
1738
+ */
1739
+ highlight?: string;
1740
+ /** All capitals (`w:caps`). `true` sets it and removes `w:smallCaps` (Word's either/or rule);
1741
+ * `false` removes it; omit to leave unchanged. */
1742
+ caps?: boolean;
1743
+ /** Small capitals (`w:smallCaps`). `true` sets it and removes `w:caps`; `false` removes it;
1744
+ * omit to leave unchanged. */
1745
+ smallCaps?: boolean;
1808
1746
  }
1809
1747
  /** One edge of a paragraph border (`w:pBdr` top/bottom) — drives S-1 horizontal rules. */
1810
1748
  export interface ParagraphBorderEdge {
@@ -1868,9 +1806,54 @@ export interface ParagraphFormatOp {
1868
1806
  * `"even"` (even pages; sets `w:evenAndOddHeaders`).
1869
1807
  */
1870
1808
  export type HeaderFooterKind = "default" | "first" | "even";
1809
+ /**
1810
+ * Options for {@link DocxSession.insertTableOfContents} (issue #607). Every field is a typed switch
1811
+ * on the underlying `TOC` field, so a caller never writes `\o "1-3"` by hand — a malformed switch
1812
+ * string renders as nothing in Word, silently, which is the failure these exist to prevent.
1813
+ */
1814
+ export interface TableOfContentsOptions {
1815
+ /** Heading levels to list (`\o`): a level or a range within 1-9, e.g. `"1-3"`. Default `"1-3"`. */
1816
+ levels?: string;
1817
+ /** Make each entry a hyperlink to its heading (`\h`). Default true. */
1818
+ hyperlinks?: boolean;
1819
+ /** Hide the leader tab and page numbers in Word's web view (`\z`). Default true. */
1820
+ hideTabAndPageNumbersInWeb?: boolean;
1821
+ /** Include paragraphs with an outline level but no heading style (`\u`). Default true. */
1822
+ useOutlineLevels?: boolean;
1823
+ /** Heading above the table, in Word's `TOCHeading` style. `null` or `""` inserts no heading.
1824
+ * Default `"Contents"`. */
1825
+ title?: string | null;
1826
+ /** Right-aligned dot-leader tab stop in twips. Default 9350 (US Letter, one-inch margins). */
1827
+ rightTabPos?: number;
1828
+ }
1829
+ /** Options for {@link DocxSession.insertTableOfFigures}. A table of figures is a `TOC` field
1830
+ * selecting by caption label rather than outline level — Word's own encoding. */
1831
+ export interface TableOfFiguresOptions {
1832
+ /** The caption label whose captions to list (`\c`) — `"Figure"`, `"Table"`, `"Exhibit"`. */
1833
+ captionLabel?: string;
1834
+ /** Make each entry a hyperlink to its caption (`\h`). Default true. */
1835
+ hyperlinks?: boolean;
1836
+ /** Right-aligned dot-leader tab stop in twips. Default 9350. */
1837
+ rightTabPos?: number;
1838
+ }
1839
+ /** Word's fixed table-of-authorities categories. */
1840
+ export type AuthorityCategory = "cases" | "statutes" | "other_authorities" | "rules" | "treatises" | "regulations" | "constitutional_provisions";
1841
+ /** Options for {@link DocxSession.insertTableOfAuthorities}. */
1842
+ export interface TableOfAuthoritiesOptions {
1843
+ /** Which category of authority to list (`\c`). Default `"cases"`. */
1844
+ category?: AuthorityCategory;
1845
+ /** Make each entry a hyperlink to its citation (`\h`). Default true. */
1846
+ hyperlinks?: boolean;
1847
+ /** Separator between an entry and its page numbers (`\e`), e.g. a tab. Default: Word's own. */
1848
+ entryPageSeparator?: string;
1849
+ /** Right-aligned dot-leader tab stop in twips. Default 9350. */
1850
+ rightTabPos?: number;
1851
+ }
1871
1852
  /** Which page-number field `DocxSession.insertPageNumberField` emits: `"currentPage"` → PAGE,
1872
- * `"totalPages"` → NUMPAGES. */
1873
- export type PageNumberField = "currentPage" | "totalPages";
1853
+ * `"totalPages"` → NUMPAGES, `"pageOfTotal"` → Word's "Page X of Y" gallery entry (the text
1854
+ * `Page `, a PAGE field, ` of `, a NUMPAGES field, every run inheriting the paragraph's last run
1855
+ * formatting). */
1856
+ export type PageNumberField = "currentPage" | "totalPages" | "pageOfTotal";
1874
1857
  /**
1875
1858
  * Section-level page-numbering setup for {@link DocxSession.setPageNumbering} — the `w:pgNumType`
1876
1859
  * element, which is what Word's *Format Page Numbers…* dialog writes. Each field is tri-state: an
@@ -1891,6 +1874,61 @@ export interface PageNumberingOp {
1891
1874
  * rejected — pages cannot be bulleted. */
1892
1875
  format?: NumberFormat;
1893
1876
  }
1877
+ /**
1878
+ * Page geometry for {@link DocxSession.setPageSetup} — the `w:pgSz` / `w:pgMar` of the governing
1879
+ * `w:sectPr`, i.e. what Word's *Page Setup* dialog writes. Every field is tri-state: an omitted
1880
+ * field leaves that attribute exactly as it is. All values are twips (1440 = 1 inch). Read the
1881
+ * current values back from {@link SectionInfo}.
1882
+ *
1883
+ * Validation runs against the section's effective values after the op: width and height must be
1884
+ * positive, margins and header/footer distances non-negative, and `left + right < width`,
1885
+ * `top + bottom < height`; a violation fails with `invalid_page_setup` and touches nothing.
1886
+ */
1887
+ export interface PageSetupOp {
1888
+ /** Page width (`w:pgSz/@w:w`). */
1889
+ pageWidthTwips?: number;
1890
+ /** Page height (`w:pgSz/@w:h`). */
1891
+ pageHeightTwips?: number;
1892
+ /** Orientation (`w:pgSz/@w:orient`). `true` writes `landscape` and — when no explicit size is
1893
+ * given and the page is currently taller than wide — swaps width and height; `false` removes
1894
+ * the attribute and swaps back when the page is wider than tall. With an explicit size only
1895
+ * the attribute is written. */
1896
+ landscape?: boolean;
1897
+ /** Top margin (`w:pgMar/@w:top`). */
1898
+ marginTopTwips?: number;
1899
+ /** Bottom margin (`w:pgMar/@w:bottom`). */
1900
+ marginBottomTwips?: number;
1901
+ /** Left margin (`w:pgMar/@w:left`). */
1902
+ marginLeftTwips?: number;
1903
+ /** Right margin (`w:pgMar/@w:right`). */
1904
+ marginRightTwips?: number;
1905
+ /** Header distance from the page's top edge (`w:pgMar/@w:header`). */
1906
+ headerDistanceTwips?: number;
1907
+ /** Footer distance from the page's bottom edge (`w:pgMar/@w:footer`). */
1908
+ footerDistanceTwips?: number;
1909
+ }
1910
+ /**
1911
+ * The browser editor's render profile, passed as one JSON object to the `RenderEditorHtml` /
1912
+ * `RenderEditorBlocksHtml` / `RenderEditorBlockHtml` bridge exports. Defaults match the editor's
1913
+ * first paint: `"docx-"`, no fabricated classes, continuous, scale 1, revisions and comments off.
1914
+ */
1915
+ export interface EditorRenderOptions {
1916
+ /** CSS class prefix for the document's own classes. Default `"docx-"`. */
1917
+ cssPrefix?: string;
1918
+ /** Emit fabricated per-run CSS classes instead of inline styles. Default false. */
1919
+ fabricateClasses?: boolean;
1920
+ /** Paginated (page-box) output with headers/footers. Default false. Full-document render only. */
1921
+ paginated?: boolean;
1922
+ /** Pagination scale. Default 1. Full-document render only. */
1923
+ scale?: number;
1924
+ /** Render tracked changes as redlines instead of accepting them. Default false. */
1925
+ renderTrackedChanges?: boolean;
1926
+ /** Render native Word comments inline: `comment-highlight` spans carrying `data-comment-id`
1927
+ * around every run inside a comment range, `comment-marker` anchors at each reference. The
1928
+ * ids match {@link CommentListEntry.id}. Default false, which renders exactly as the
1929
+ * comment-less `RenderHtml` / `RenderBlockHtml` do. */
1930
+ comments?: boolean;
1931
+ }
1894
1932
  /** Options for `DocxSession.insertTable`. */
1895
1933
  export interface TableInsertOptions {
1896
1934
  /** Emit an invisible layout table (explicit "none" borders) — the S-1 multi-column blocks. */
@@ -2535,6 +2573,20 @@ export interface SectionInfo {
2535
2573
  marginBottomTwips: number;
2536
2574
  marginLeftTwips: number;
2537
2575
  marginRightTwips: number;
2576
+ /** Header distance from the page's top edge (`w:pgMar/@w:header`); Word's default 720 when
2577
+ * the attribute is absent. */
2578
+ headerDistanceTwips: number;
2579
+ /** Footer distance from the page's bottom edge (`w:pgMar/@w:footer`); Word's default 720 when
2580
+ * the attribute is absent. */
2581
+ footerDistanceTwips: number;
2582
+ /** Word's "Different first page" flag — true when the governing `w:sectPr` carries an
2583
+ * on-valued `w:titlePg`, so the section's first-page stories actually render. Toggle with
2584
+ * {@link DocxSession.setHeaderFooterKindEnabled}. */
2585
+ titlePage: boolean;
2586
+ /** Word's "Different odd & even pages" flag — true when the settings part carries an
2587
+ * on-valued `w:evenAndOddHeaders`. Document-global, so every section reports the same
2588
+ * value. Toggle with {@link DocxSession.setHeaderFooterKindEnabled}. */
2589
+ evenAndOddHeaders: boolean;
2538
2590
  columns: number;
2539
2591
  headerPartUris: string[];
2540
2592
  footerPartUris: string[];
@@ -2691,61 +2743,6 @@ export declare enum ComparisonLogLevel {
2691
2743
  /** Error that may affect comparison results but didn't stop processing */
2692
2744
  Error = "Error"
2693
2745
  }
2694
- /**
2695
- * A single log entry from the comparison process.
2696
- */
2697
- export interface ComparisonLogEntry {
2698
- /** Severity level: "Info", "Warning", or "Error" */
2699
- level: ComparisonLogLevel | string;
2700
- /**
2701
- * Machine-readable code identifying the type of issue.
2702
- * Examples: "ORPHANED_FOOTNOTE_REFERENCE", "MISSING_STYLE"
2703
- */
2704
- code: string;
2705
- /** Human-readable description of the issue */
2706
- message: string;
2707
- /** Additional context or technical details (optional) */
2708
- details?: string;
2709
- /**
2710
- * Location in the document where the issue occurred (optional).
2711
- * Format: "part/xpath" e.g., "document.xml/w:footnoteReference[@w:id='3']"
2712
- */
2713
- location?: string;
2714
- }
2715
- /**
2716
- * Result from comparison operations that includes a log of warnings/errors.
2717
- */
2718
- export interface CompareResultWithLog {
2719
- /** Whether the comparison succeeded */
2720
- success: boolean;
2721
- /** The redlined document as a Uint8Array (only if success is true) */
2722
- document?: Uint8Array;
2723
- /** Error message if success is false */
2724
- error?: string;
2725
- /** Log entries from the comparison process */
2726
- log: ComparisonLogEntry[];
2727
- /** Whether the log contains any warnings */
2728
- hasWarnings: boolean;
2729
- /** Whether the log contains any errors */
2730
- hasErrors: boolean;
2731
- }
2732
- /**
2733
- * Result from HTML comparison operations that includes a log of warnings/errors.
2734
- */
2735
- export interface CompareToHtmlResultWithLog {
2736
- /** Whether the comparison succeeded */
2737
- success: boolean;
2738
- /** The HTML output (only if success is true) */
2739
- html?: string;
2740
- /** Error message if success is false */
2741
- error?: string;
2742
- /** Log entries from the comparison process */
2743
- log: ComparisonLogEntry[];
2744
- /** Whether the log contains any warnings */
2745
- hasWarnings: boolean;
2746
- /** Whether the log contains any errors */
2747
- hasErrors: boolean;
2748
- }
2749
2746
  /**
2750
2747
  * Well-known log entry codes used by the comparison engine.
2751
2748
  */
@@ -2767,34 +2764,6 @@ export declare const ComparisonLogCodes: {
2767
2764
  /** A bookmark reference has no corresponding bookmark start/end */
2768
2765
  readonly OrphanedBookmark: "ORPHANED_BOOKMARK";
2769
2766
  };
2770
- /**
2771
- * Options for revision extraction with move detection configuration.
2772
- */
2773
- export interface GetRevisionsOptions {
2774
- /**
2775
- * Whether to detect and mark moved content.
2776
- * When enabled, deletions and insertions with similar text are linked as move pairs.
2777
- * @default true
2778
- */
2779
- detectMoves?: boolean;
2780
- /**
2781
- * Jaccard similarity threshold for move detection (0.0 to 1.0).
2782
- * Higher values require more exact word overlap between deletion and insertion.
2783
- * @default 0.8
2784
- */
2785
- moveSimilarityThreshold?: number;
2786
- /**
2787
- * Minimum word count for content to be considered for move detection.
2788
- * Short phrases below this threshold are excluded to avoid false positives.
2789
- * @default 3
2790
- */
2791
- moveMinimumWordCount?: number;
2792
- /**
2793
- * Whether similarity matching ignores case differences.
2794
- * @default false
2795
- */
2796
- caseInsensitive?: boolean;
2797
- }
2798
2767
  /**
2799
2768
  * A custom annotation on a document range.
2800
2769
  */
@@ -3341,8 +3310,6 @@ export interface WorkerGetRevisionsRequest extends WorkerRequestBase {
3341
3310
  type: "getRevisions";
3342
3311
  /** Document bytes */
3343
3312
  documentBytes: Uint8Array;
3344
- /** Revision extraction options */
3345
- options?: GetRevisionsOptions;
3346
3313
  }
3347
3314
  /**
3348
3315
  * Get document metadata for lazy loading request.
@@ -3518,7 +3485,7 @@ export interface WorkerGetSemanticChangesResponse extends WorkerResponseBase {
3518
3485
  export interface WorkerGetRevisionsResponse extends WorkerResponseBase {
3519
3486
  type: "getRevisions";
3520
3487
  /** Array of revisions */
3521
- revisions?: Revision[];
3488
+ revisions?: RevisionListEntry[];
3522
3489
  }
3523
3490
  /**
3524
3491
  * Response from getDocumentMetadata request.