docxodus 12.6.4 → 13.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 (92) hide show
  1. package/README.md +8 -5
  2. package/dist/canonical.d.ts.map +1 -1
  3. package/dist/canonical.js +7 -3
  4. package/dist/canonical.js.map +1 -1
  5. package/dist/conversion-options.d.ts +16 -0
  6. package/dist/conversion-options.d.ts.map +1 -0
  7. package/dist/conversion-options.js +31 -0
  8. package/dist/conversion-options.js.map +1 -0
  9. package/dist/core.d.ts +17 -9
  10. package/dist/core.d.ts.map +1 -1
  11. package/dist/core.js +23 -24
  12. package/dist/core.js.map +1 -1
  13. package/dist/docxodus.worker.js +2 -1073
  14. package/dist/docxodus.worker.js.map +7 -1
  15. package/dist/editor.bundle.js +35 -14296
  16. package/dist/editor.bundle.js.map +7 -0
  17. package/dist/editor.d.ts +33 -2
  18. package/dist/editor.d.ts.map +1 -1
  19. package/dist/editor.js +6739 -4773
  20. package/dist/editor.js.map +7 -1
  21. package/dist/embed.bundle.js +159 -18703
  22. package/dist/embed.bundle.js.map +7 -0
  23. package/dist/embed.d.ts +1 -1
  24. package/dist/embed.iife.js +37 -18595
  25. package/dist/embed.iife.js.map +7 -0
  26. package/dist/embed.js +1 -1
  27. package/dist/export-assets.json +27 -27
  28. package/dist/export-browser.bundle.js +1388 -477
  29. package/dist/export-browser.d.ts +20 -0
  30. package/dist/export-browser.d.ts.map +1 -1
  31. package/dist/export-browser.js +132 -37
  32. package/dist/export-browser.js.map +1 -1
  33. package/dist/font-runtime.d.ts.map +1 -1
  34. package/dist/font-runtime.js +54 -0
  35. package/dist/font-runtime.js.map +1 -1
  36. package/dist/line-metrics.d.ts +60 -0
  37. package/dist/line-metrics.d.ts.map +1 -0
  38. package/dist/line-metrics.js +343 -0
  39. package/dist/line-metrics.js.map +1 -0
  40. package/dist/pagination.bundle.js +3 -3214
  41. package/dist/pagination.bundle.js.map +7 -0
  42. package/dist/pagination.d.ts +86 -9
  43. package/dist/pagination.d.ts.map +1 -1
  44. package/dist/pagination.js +358 -55
  45. package/dist/pagination.js.map +1 -1
  46. package/dist/react.d.ts.map +1 -1
  47. package/dist/react.js +63 -12
  48. package/dist/react.js.map +1 -1
  49. package/dist/render-report-v2.schema.json +29 -0
  50. package/dist/session.bundle.js +2 -2013
  51. package/dist/session.bundle.js.map +7 -0
  52. package/dist/session.d.ts +14 -5
  53. package/dist/session.d.ts.map +1 -1
  54. package/dist/session.js +62 -29
  55. package/dist/session.js.map +1 -1
  56. package/dist/types.d.ts +137 -21
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/types.js +14 -0
  59. package/dist/types.js.map +1 -1
  60. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  61. package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
  62. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  63. package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
  64. package/dist/wasm/_framework/System.Collections.wasm +0 -0
  65. package/dist/wasm/_framework/System.Collections.wasm.br +0 -0
  66. package/dist/wasm/_framework/System.IO.Compression.wasm +0 -0
  67. package/dist/wasm/_framework/System.IO.Compression.wasm.br +0 -0
  68. package/dist/wasm/_framework/System.Linq.wasm +0 -0
  69. package/dist/wasm/_framework/System.Linq.wasm.br +0 -0
  70. package/dist/wasm/_framework/System.Memory.wasm +0 -0
  71. package/dist/wasm/_framework/System.Memory.wasm.br +0 -0
  72. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  73. package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
  74. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
  75. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm.br +0 -0
  76. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
  77. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm.br +0 -0
  78. package/dist/wasm/_framework/dotnet.boot.js +11 -11
  79. package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
  80. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  81. package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
  82. package/dist/word-text.d.ts +14 -0
  83. package/dist/word-text.d.ts.map +1 -0
  84. package/dist/word-text.js +377 -0
  85. package/dist/word-text.js.map +1 -0
  86. package/dist/worker-proxy.bundle.js +2 -536
  87. package/dist/worker-proxy.bundle.js.map +7 -0
  88. package/dist/worker-proxy.d.ts +14 -1
  89. package/dist/worker-proxy.d.ts.map +1 -1
  90. package/dist/worker-proxy.js +357 -339
  91. package/dist/worker-proxy.js.map +1 -1
  92. package/package.json +13 -12
package/dist/types.d.ts CHANGED
@@ -191,6 +191,19 @@ export declare enum PaginationMode {
191
191
  */
192
192
  Paginated = 1
193
193
  }
194
+ /**
195
+ * How rendered tracked changes look (issue #851). Only used when `renderTrackedChanges` is on.
196
+ */
197
+ export declare enum RevisionPresentation {
198
+ /** Docxodus's own review style (default): green/red text with light fills, purple moves, pilcrows. */
199
+ Docxodus = 0,
200
+ /**
201
+ * Close to Word's All Markup print: one colour per author for both insertions (underlined) and
202
+ * deletions (struck through), no fills or pilcrows, green double-lined moves, Word's default cell
203
+ * shading, and one left-margin change bar per changed paragraph. Full renders only.
204
+ */
205
+ Word = 1
206
+ }
194
207
  /**
195
208
  * Annotation label display mode
196
209
  */
@@ -264,6 +277,8 @@ export interface ConversionOptions {
264
277
  showDeletedContent?: boolean;
265
278
  /** Whether to distinguish move operations from regular insert/delete (only when renderTrackedChanges=true, default: true) */
266
279
  renderMoveOperations?: boolean;
280
+ /** How tracked changes look (only when renderTrackedChanges=true, default: RevisionPresentation.Docxodus) */
281
+ revisionPresentation?: RevisionPresentation;
267
282
  /**
268
283
  * Whether to render placeholders for unsupported content (default: false)
269
284
  * When enabled, unsupported content (WMF/EMF images, math equations, form fields, etc.)
@@ -284,12 +299,20 @@ export interface ConversionOptions {
284
299
  * `renderBlockHtml`. Default: false.
285
300
  */
286
301
  stampAnchors?: boolean;
302
+ /**
303
+ * Emit Word lists as `<ol>`/`<ul>`/`<li>` instead of paragraphs (issue #895). Adjacent list
304
+ * paragraphs of one list share a list, and a deeper level nests inside the preceding item. CSS
305
+ * draws the marker (`list-style-type`, with `start`/`value` for restarts) only where it
306
+ * reproduces Word's marker exactly; other lists keep the generated marker spans under
307
+ * `list-style-type: none`. Ignored by paginated output. Default: false.
308
+ */
309
+ semanticLists?: boolean;
287
310
  }
288
311
  /**
289
312
  * Options for document comparison
290
313
  */
291
314
  export interface CompareOptions {
292
- /** Author name for tracked changes (default: "Docxodus") */
315
+ /** Author name for tracked changes (default: the engine's, "Docxodus") */
293
316
  authorName?: string;
294
317
  /** Whether comparison is case-insensitive (default: false) */
295
318
  caseInsensitive?: boolean;
@@ -356,7 +379,7 @@ export declare enum DocxDiffFormatComparison {
356
379
  * every field is optional and an omitted field uses the engine default.
357
380
  */
358
381
  export interface DocxDiffSettings {
359
- /** Author stamped on revisions and markup (default "Open-Xml-PowerTools"). */
382
+ /** Author stamped on revisions and markup (default "Docxodus"). */
360
383
  authorForRevisions?: string;
361
384
  /** Pin revision dates to a fixed epoch for byte-identical output (default true). */
362
385
  deterministic?: boolean;
@@ -365,10 +388,13 @@ export interface DocxDiffSettings {
365
388
  /**
366
389
  * Accept every pre-existing revision on both inputs before comparing (default false).
367
390
  * This flattens prior authorship; `preserveInputRevisions` takes precedence when both are set.
391
+ * The consolidate functions (`docxDiffConsolidate` and its siblings) always pre-accept the base
392
+ * and every reviewer, whatever this says: they compare the accepted view, as Word's Compare does.
368
393
  */
369
394
  preAcceptInputRevisions?: boolean;
370
395
  /**
371
- * Preserve the inputs' existing tracked revisions Word-style (default false).
396
+ * Preserve the inputs' existing tracked revisions, as Word's Combine does (default false).
397
+ * Word's Compare pre-accepts them instead (see `preAcceptInputRevisions`).
372
398
  * This takes precedence over `preAcceptInputRevisions` when both are set.
373
399
  */
374
400
  preserveInputRevisions?: boolean;
@@ -412,6 +438,19 @@ export interface DocxDiffSettings {
412
438
  * the revision list and edit-script JSON are unaffected. Default false.
413
439
  */
414
440
  crossParagraphTokenDiff?: boolean;
441
+ /**
442
+ * Record a list item's previous label in `w:numberingChange` when an insertion, deletion or move
443
+ * elsewhere in its list renumbered it. Word's own compare never writes this; set false for output
444
+ * limited to the constructs Word writes. Default true. Consolidate honors it too.
445
+ */
446
+ trackNumberingChanges?: boolean;
447
+ /**
448
+ * Track a cell added to or removed from a paired table row with `w:cellIns`/`w:cellDel`. Word's own
449
+ * compare never writes cell-level revisions; set false and such a table is tracked as a whole (the
450
+ * original deleted, the revised inserted), in the markup and the revision list alike. Default true.
451
+ * Consolidate keeps cell-level revisions regardless.
452
+ */
453
+ trackCellInsertionsAndDeletions?: boolean;
415
454
  }
416
455
  /**
417
456
  * One revision from `docxDiffGetRevisions`. Mirrors the consumer shape of
@@ -666,6 +705,9 @@ export interface VersionInfo {
666
705
  export interface ErrorResponse {
667
706
  error: string;
668
707
  type?: string;
708
+ /**
709
+ * @deprecated Never populated: the engine stopped putting stack traces on the wire (issue #961).
710
+ */
669
711
  stackTrace?: string;
670
712
  }
671
713
  /**
@@ -1188,7 +1230,7 @@ export interface DocxodusWasmExports {
1188
1230
  ConvertDocxToHtmlWithOptions: (bytes: Uint8Array, pageTitle: string, cssPrefix: string, fabricateClasses: boolean, additionalCss: string, commentRenderMode: number, commentCssClassPrefix: string) => string;
1189
1231
  ConvertDocxToHtmlWithPagination: (bytes: Uint8Array, pageTitle: string, cssPrefix: string, fabricateClasses: boolean, additionalCss: string, commentRenderMode: number, commentCssClassPrefix: string, paginationMode: number, paginationScale: number, paginationCssClassPrefix: string) => string;
1190
1232
  ConvertDocxToHtmlFull: (bytes: Uint8Array, pageTitle: string, cssPrefix: string, fabricateClasses: boolean, additionalCss: string, commentRenderMode: number, commentCssClassPrefix: string, paginationMode: number, paginationScale: number, paginationCssClassPrefix: string, renderAnnotations: boolean, annotationLabelMode: number, annotationCssClassPrefix: string) => string;
1191
- ConvertDocxToHtmlComplete: (bytes: Uint8Array, pageTitle: string, cssPrefix: string, fabricateClasses: boolean, additionalCss: string, commentRenderMode: number, commentCssClassPrefix: string, paginationMode: number, paginationScale: number, paginationCssClassPrefix: string, renderAnnotations: boolean, annotationLabelMode: number, annotationCssClassPrefix: string, renderFootnotesAndEndnotes: boolean, renderHeadersAndFooters: boolean, renderTrackedChanges: boolean, showDeletedContent: boolean, renderMoveOperations: boolean, renderUnsupportedContentPlaceholders: boolean, documentLanguage: string | null, stampAnchors: boolean) => string;
1233
+ ConvertDocxToHtmlComplete: (bytes: Uint8Array, pageTitle: string, cssPrefix: string, fabricateClasses: boolean, additionalCss: string, commentRenderMode: number, commentCssClassPrefix: string, paginationMode: number, paginationScale: number, paginationCssClassPrefix: string, renderAnnotations: boolean, annotationLabelMode: number, annotationCssClassPrefix: string, renderFootnotesAndEndnotes: boolean, renderHeadersAndFooters: boolean, renderTrackedChanges: boolean, showDeletedContent: boolean, renderMoveOperations: boolean, renderUnsupportedContentPlaceholders: boolean, documentLanguage: string | null, stampAnchors: boolean, revisionPresentation: number, semanticLists?: boolean) => string;
1192
1234
  GetAnnotations: (bytes: Uint8Array) => string;
1193
1235
  AddAnnotation: (bytes: Uint8Array, requestJson: string) => string;
1194
1236
  AddAnnotationWithTarget: (bytes: Uint8Array, requestJson: string) => string;
@@ -1219,11 +1261,11 @@ export interface DocxodusWasmExports {
1219
1261
  * Idempotent — assemblies load only once.
1220
1262
  */
1221
1263
  Warmup: () => string;
1222
- CompareDocuments: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string) => Uint8Array;
1223
- CompareDocumentsToHtml: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string) => string;
1224
- CompareDocumentsToHtmlWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, renderTrackedChanges: boolean) => string;
1225
- CompareDocumentsToHtmlFull: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, caseInsensitive: boolean, renderTrackedChanges: boolean) => string;
1226
- CompareDocumentsWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string, caseInsensitive: boolean) => Uint8Array;
1264
+ CompareDocuments: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string | null) => Uint8Array;
1265
+ CompareDocumentsToHtml: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string | null) => string;
1266
+ CompareDocumentsToHtmlWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string | null, renderTrackedChanges: boolean) => string;
1267
+ CompareDocumentsToHtmlFull: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string | null, caseInsensitive: boolean, renderTrackedChanges: boolean) => string;
1268
+ CompareDocumentsWithOptions: (originalBytes: Uint8Array, modifiedBytes: Uint8Array, authorName: string | null, caseInsensitive: boolean) => Uint8Array;
1227
1269
  GetRevisionsJson: (comparedDocBytes: Uint8Array) => string;
1228
1270
  GetCommentsJson: (docBytes: Uint8Array) => string;
1229
1271
  };
@@ -1283,8 +1325,8 @@ export interface DocxodusWasmExports {
1283
1325
  BeginTransaction: (handle: number) => number;
1284
1326
  CommitTransaction: (transactionHandle: number) => void;
1285
1327
  RollbackTransaction: (transactionHandle: number) => void;
1286
- ProjectAnchor: (handle: number, anchorId: string, depth: number) => string;
1287
- ProjectAnchorWithCitations: (handle: number, anchorId: string, depth: number, requestJson: string) => string;
1328
+ ProjectAnchor: (handle: number, anchorId: string, depth: number | null) => string;
1329
+ ProjectAnchorWithCitations: (handle: number, anchorId: string, depth: number | null, requestJson: string) => string;
1288
1330
  /** Ordered top-level render units per scope container (JSON {@link RenderPlan}) —
1289
1331
  * what the editor's incremental reconciler diffs its DOM against. Optional:
1290
1332
  * absent on older WASM bundles. */
@@ -1305,7 +1347,7 @@ export interface DocxodusWasmExports {
1305
1347
  * true list-marker numbers. Optional: absent on older WASM bundles. */
1306
1348
  RenderBlocksHtml?: (handle: number, anchorIdsJson: string, cssPrefix: string, fabricateClasses: boolean) => string;
1307
1349
  RenderBlocksHtmlForReview?: (handle: number, anchorIdsJson: string, cssPrefix: string, fabricateClasses: boolean, renderTrackedChanges: boolean) => string;
1308
- RenderBlockHtml: (handle: number, anchorId: string, cssPrefix: string, fabricateClasses: boolean) => string;
1350
+ RenderBlockHtml: (handle: number, anchorId: string, cssPrefix: string | null, fabricateClasses: boolean | null) => string;
1309
1351
  RenderBlockHtmlForReview?: (handle: number, anchorId: string, cssPrefix: string, fabricateClasses: boolean, renderTrackedChanges: boolean) => string;
1310
1352
  RenderHtml: (handle: number, cssPrefix: string, fabricateClasses: boolean, paginated: boolean, scale: number) => string;
1311
1353
  RenderHtmlForReview?: (handle: number, cssPrefix: string, fabricateClasses: boolean, paginated: boolean, scale: number, renderTrackedChanges: boolean) => string;
@@ -1350,7 +1392,7 @@ export interface DocxodusWasmExports {
1350
1392
  SetColumnWidths: (handle: number, cellAnchor: string, widthsJson: string) => string;
1351
1393
  SetTableBorders: (handle: number, cellAnchor: string, specJson: string) => string;
1352
1394
  SetCellShading: (handle: number, cellAnchor: string, fill: string, scope: string) => string;
1353
- SetRepeatHeaderRow: (handle: number, cellAnchor: string, repeat: boolean) => string;
1395
+ SetRepeatHeaderRow: (handle: number, cellAnchor: string, repeat: boolean | null) => string;
1354
1396
  SetTableRowOptions: (handle: number, cellAnchor: string, repeatHeader: boolean | null, allowBreakAcrossPages: boolean | null, heightTwips: number | null, heightRule: string) => string;
1355
1397
  SetHeaderText: (handle: number, anchor: string, kind: string, markdown: string) => string;
1356
1398
  SetFooterText: (handle: number, anchor: string, kind: string, markdown: string) => string;
@@ -1407,6 +1449,7 @@ export interface DocxodusWasmExports {
1407
1449
  MoveBookmark: (handle: number, name: string, startAnchor: string, startOffset: number, endAnchor: string, endOffset: number) => string;
1408
1450
  RemoveBookmark: (handle: number, name: string) => string;
1409
1451
  ListRevisions: (handle: number) => string;
1452
+ ListRevisionsFiltered?: (handle: number, filterJson: string) => string;
1410
1453
  ListRevisionRepairs?: (handle: number) => string;
1411
1454
  RepairRevisions?: (handle: number, repairsJson: string) => string;
1412
1455
  AcceptRevision: (handle: number, revisionId: string) => string;
@@ -1433,11 +1476,11 @@ export interface DocxodusWasmExports {
1433
1476
  ReplaceTextAtSpan: (handle: number, anchor: string, spanStart: number, spanLength: number, replace: string) => string;
1434
1477
  ReplaceTextAtSpanWithFormat?: (handle: number, anchor: string, spanStart: number, spanLength: number, replace: string, formatJson: string) => string;
1435
1478
  ReplaceInner: (handle: number, matchText: string, anchor: string, spanStart: number, spanLength: number, newInner: string) => string;
1436
- FindPlaceholders: (handle: number, kinds: number, scope: number, contextChars: number, boundary: number) => string;
1437
- FindPlaceholdersWithCitations: (handle: number, kinds: number, scope: number, contextChars: number, boundary: number, requestJson: string) => string;
1479
+ FindPlaceholders: (handle: number, kinds: number | null, scope: number | null, contextChars: number | null, boundary: number | null) => string;
1480
+ FindPlaceholdersWithCitations: (handle: number, kinds: number | null, scope: number | null, contextChars: number | null, boundary: number | null, requestJson: string) => string;
1438
1481
  GetEditSummary: (handle: number) => string;
1439
- RemainingPlaceholders: (handle: number, kinds: number) => string;
1440
- GetDiff: (handle: number, format: number) => string;
1482
+ RemainingPlaceholders: (handle: number, kinds: number | null) => string;
1483
+ GetDiff: (handle: number, format: number | null) => string;
1441
1484
  GetSemanticChanges: (handle: number) => string;
1442
1485
  VerifyDeliverable: (handle: number) => string;
1443
1486
  VerifyDeliverableWithRequest?: (handle: number, requestJson: string) => string;
@@ -1450,7 +1493,7 @@ export interface DocxodusWasmExports {
1450
1493
  Exists: (handle: number, anchorId: string) => boolean;
1451
1494
  FindByText: (handle: number, needle: string, optionsJson: string) => string;
1452
1495
  FindAllByText: (handle: number, needle: string, optionsJson: string) => string;
1453
- FindByRegex: (handle: number, pattern: string, regexOptions: number, optionsJson: string) => string;
1496
+ FindByRegex: (handle: number, pattern: string, regexOptions: number | null, optionsJson: string) => string;
1454
1497
  FindByKind: (handle: number, kind: string, scope: string) => string;
1455
1498
  FindByKindWithCitations: (handle: number, kind: string, scope: string, requestJson: string) => string;
1456
1499
  GetAnchorInfo: (handle: number, anchorId: string) => string;
@@ -1479,7 +1522,10 @@ export interface DocxodusWasmExports {
1479
1522
  SaveWithAnchorIds: (handle: number) => Uint8Array;
1480
1523
  };
1481
1524
  }
1482
- 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" | "preview_not_found" | "preview_stale" | "revision_repair_rejected" | "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";
1525
+ 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" | "preview_not_found" | "preview_stale" | "revision_repair_rejected" | "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"
1526
+ /** A failed edit's rollback also failed, so the document may be half-changed. Every later
1527
+ * mutation is refused with this code; close the session and reopen it from known-good bytes. */
1528
+ | "session_corrupted";
1483
1529
  export interface AnchorRef {
1484
1530
  id: string;
1485
1531
  kind: string;
@@ -1643,9 +1689,40 @@ export interface MutationTransaction {
1643
1689
  /** A JSON object describing the batch (step kinds, targets, payloads). */
1644
1690
  request: Record<string, unknown>;
1645
1691
  }
1692
+ /** One changed top-level block in a {@link MarkdownPatch}. */
1693
+ export interface MarkdownPatchBlock {
1694
+ /** The block's anchor id (`kind:scope:unid`). */
1695
+ anchorId: string;
1696
+ /** The block it now follows in its scope, or `null` when it is the scope's first block. */
1697
+ afterAnchorId: string | null;
1698
+ /** The block's own markdown, without the separators the full projection puts between blocks. */
1699
+ markdown: string;
1700
+ }
1701
+ /**
1702
+ * The projection change one mutation produced. Block-scoped: it carries the markdown of the
1703
+ * top-level blocks (body paragraphs/tables, header and footer blocks, note definitions, comments)
1704
+ * that changed or were added since the previous patch, and the ids of blocks that are gone.
1705
+ * A client keeping one entry per block applies it by deleting `removedAnchorIds`, then, for each
1706
+ * of `blocks` in order, deleting that id if present and re-inserting it after `afterAnchorId`.
1707
+ *
1708
+ * When a block-local patch cannot be exact, `fullDocument` is true and `markdown` is the whole
1709
+ * projection: an edit that renumbered a list, changed a style, edited a header or footer, or added,
1710
+ * removed or renumbered a story part or a note; the first patch after an op failed and rolled back
1711
+ * or a preview was committed; any non-`FullUnid` anchor rendering. `undo()` and `redo()` return no
1712
+ * patch: re-read the projection after them; the next patch covers only later changes. Call
1713
+ * `project()` for the whole document at any time.
1714
+ */
1646
1715
  export interface MarkdownPatch {
1716
+ /** The anchor the op addressed. */
1647
1717
  scopeAnchorId: string;
1718
+ /** The changed blocks' markdown in document order, or the whole projection when `fullDocument`. */
1648
1719
  markdown: string;
1720
+ /** True when `markdown` is the whole projection; `blocks` and `removedAnchorIds` are then empty. */
1721
+ fullDocument: boolean;
1722
+ /** Blocks changed or added since the previous patch, in document order. */
1723
+ blocks: MarkdownPatchBlock[];
1724
+ /** Ids of blocks removed since the previous patch (or whose id changed). */
1725
+ removedAnchorIds: string[];
1649
1726
  }
1650
1727
  export interface EditResult {
1651
1728
  success: boolean;
@@ -2753,6 +2830,20 @@ export interface GrepOptions {
2753
2830
  boundary?: number;
2754
2831
  /** Attach citations only if this exact registered layout is still valid. */
2755
2832
  citation?: PageCitationRequest;
2833
+ /** Return at most this many matches, in document order. Omitted returns them all. */
2834
+ maxResults?: number;
2835
+ }
2836
+ /**
2837
+ * Narrows {@link DocxSession.listRevisions} to the entries matching every field set here.
2838
+ * `author`, `changeType` (the entry's `type`), `family` and `resolutionStatus` ignore case;
2839
+ * `partUri` is exact.
2840
+ */
2841
+ export interface RevisionListFilter {
2842
+ author?: string;
2843
+ changeType?: string;
2844
+ family?: string;
2845
+ resolutionStatus?: string;
2846
+ partUri?: string;
2756
2847
  }
2757
2848
  /**
2758
2849
  * Options that tune the `findBy*` helpers on {@link DocxSession}. Mirrors the
@@ -3783,8 +3874,18 @@ export interface WorkerResponseBase {
3783
3874
  */
3784
3875
  errorCode?: WorkerErrorCode;
3785
3876
  }
3786
- /** Closed set of machine-readable worker failure causes. */
3787
- export type WorkerErrorCode = "resource_limit";
3877
+ /**
3878
+ * Closed set of machine-readable worker failure causes.
3879
+ *
3880
+ * - `resource_limit`: the operation exceeded a configured size or work limit.
3881
+ * - `internal_error`: the worker threw an unexpected error while handling the request.
3882
+ * - `timeout`: the request outlived its `timeoutMs` / `requestTimeoutMs` deadline.
3883
+ * - `aborted`: the request's `AbortSignal` fired.
3884
+ * - `message_error`: a worker response could not be deserialized (`messageerror`); every request
3885
+ * in flight is rejected with this code, because the lost response cannot be matched to its request.
3886
+ * - `missing_result`: the worker reported success but sent no payload.
3887
+ */
3888
+ export type WorkerErrorCode = "resource_limit" | "internal_error" | "timeout" | "aborted" | "message_error" | "missing_result";
3788
3889
  /**
3789
3890
  * Response from init request.
3790
3891
  */
@@ -3948,6 +4049,21 @@ export interface WorkerDocxodusOptions {
3948
4049
  wasmBasePath?: string;
3949
4050
  /** Abort the owned worker, including an initialization that has not completed. */
3950
4051
  signal?: AbortSignal;
4052
+ /**
4053
+ * Reject any request, including initialization, that has not answered within this many
4054
+ * milliseconds, with a `timeout` {@link WorkerErrorCode}. Off by default: large documents can
4055
+ * legitimately take a long time. A timed-out initialization stops the worker. Any other
4056
+ * timed-out request is most likely still running on the worker's single thread, and later
4057
+ * requests queue behind it; call `terminate()` to stop it.
4058
+ */
4059
+ requestTimeoutMs?: number;
4060
+ }
4061
+ /** Per-request options for a `WorkerDocxodus.withRequestOptions` view. */
4062
+ export interface WorkerRequestOptions {
4063
+ /** Rejects each pending request of the view with an `aborted` {@link WorkerErrorCode} when it fires. */
4064
+ signal?: AbortSignal;
4065
+ /** A deadline in milliseconds that overrides the instance's `requestTimeoutMs`. */
4066
+ timeoutMs?: number;
3951
4067
  }
3952
4068
  /**
3953
4069
  * OpenContracts document export format.