docxodus 10.0.0 → 11.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 (84) hide show
  1. package/README.md +4 -4
  2. package/dist/docxodus.worker.js +6 -38
  3. package/dist/docxodus.worker.js.map +1 -1
  4. package/dist/editor.bundle.js +66 -4
  5. package/dist/embed.bundle.js +165 -128
  6. package/dist/embed.d.ts +1 -1
  7. package/dist/embed.iife.js +165 -128
  8. package/dist/embed.js +1 -1
  9. package/dist/export-assets.json +38 -44
  10. package/dist/export-browser.bundle.js +2 -3
  11. package/dist/index.d.ts +24 -63
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +65 -134
  14. package/dist/index.js.map +1 -1
  15. package/dist/react.d.ts +4 -4
  16. package/dist/react.d.ts.map +1 -1
  17. package/dist/react.js.map +1 -1
  18. package/dist/ribbon-chrome.d.ts +2 -2
  19. package/dist/ribbon-chrome.d.ts.map +1 -1
  20. package/dist/ribbon-chrome.js +27 -4
  21. package/dist/ribbon-chrome.js.map +1 -1
  22. package/dist/ribbon.js +49 -0
  23. package/dist/ribbon.js.map +1 -1
  24. package/dist/session.bundle.js +52 -0
  25. package/dist/session.d.ts +26 -1
  26. package/dist/session.d.ts.map +1 -1
  27. package/dist/session.js +31 -0
  28. package/dist/session.js.map +1 -1
  29. package/dist/types.d.ts +81 -223
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/types.js +9 -75
  32. package/dist/types.js.map +1 -1
  33. package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm +0 -0
  34. package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm.br +0 -0
  35. package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm +0 -0
  36. package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm.br +0 -0
  37. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  38. package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
  39. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  40. package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
  41. package/dist/wasm/_framework/System.Collections.Concurrent.wasm +0 -0
  42. package/dist/wasm/_framework/System.Collections.Concurrent.wasm.br +0 -0
  43. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm +0 -0
  44. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm.br +0 -0
  45. package/dist/wasm/_framework/System.IO.Compression.wasm +0 -0
  46. package/dist/wasm/_framework/System.IO.Compression.wasm.br +0 -0
  47. package/dist/wasm/_framework/System.IO.Packaging.wasm +0 -0
  48. package/dist/wasm/_framework/System.IO.Packaging.wasm.br +0 -0
  49. package/dist/wasm/_framework/System.IO.Pipelines.wasm +0 -0
  50. package/dist/wasm/_framework/System.IO.Pipelines.wasm.br +0 -0
  51. package/dist/wasm/_framework/System.Linq.wasm +0 -0
  52. package/dist/wasm/_framework/System.Linq.wasm.br +0 -0
  53. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  54. package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
  55. package/dist/wasm/_framework/System.Private.Uri.wasm +0 -0
  56. package/dist/wasm/_framework/System.Private.Uri.wasm.br +0 -0
  57. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
  58. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm.br +0 -0
  59. package/dist/wasm/_framework/System.Private.Xml.wasm +0 -0
  60. package/dist/wasm/_framework/System.Private.Xml.wasm.br +0 -0
  61. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  62. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm.br +0 -0
  63. package/dist/wasm/_framework/System.Security.Cryptography.wasm +0 -0
  64. package/dist/wasm/_framework/System.Security.Cryptography.wasm.br +0 -0
  65. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm +0 -0
  66. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm.br +0 -0
  67. package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
  68. package/dist/wasm/_framework/System.Text.Json.wasm.br +0 -0
  69. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
  70. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm.br +0 -0
  71. package/dist/wasm/_framework/dotnet.boot.js +31 -37
  72. package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
  73. package/dist/wasm/_framework/dotnet.native.js +39 -3
  74. package/dist/wasm/_framework/dotnet.native.js.br +0 -0
  75. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  76. package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
  77. package/dist/worker-proxy.bundle.js +2 -3
  78. package/dist/worker-proxy.d.ts +2 -2
  79. package/dist/worker-proxy.d.ts.map +1 -1
  80. package/dist/worker-proxy.js +1 -2
  81. package/dist/worker-proxy.js.map +1 -1
  82. package/package.json +2 -2
  83. package/dist/wasm/_framework/System.Diagnostics.Process.wasm +0 -0
  84. package/dist/wasm/_framework/System.Diagnostics.Process.wasm.br +0 -0
@@ -167,11 +167,6 @@ var RevisionType = /* @__PURE__ */ ((RevisionType2) => {
167
167
  RevisionType2["FormatChanged"] = "FormatChanged";
168
168
  return RevisionType2;
169
169
  })(RevisionType || {});
170
- var ComparisonEngine = /* @__PURE__ */ ((ComparisonEngine2) => {
171
- ComparisonEngine2[ComparisonEngine2["WmlComparer"] = 0] = "WmlComparer";
172
- ComparisonEngine2[ComparisonEngine2["DocxDiff"] = 1] = "DocxDiff";
173
- return ComparisonEngine2;
174
- })(ComparisonEngine || {});
175
170
  var CommentRenderMode = /* @__PURE__ */ ((CommentRenderMode2) => {
176
171
  CommentRenderMode2[CommentRenderMode2["Disabled"] = -1] = "Disabled";
177
172
  CommentRenderMode2[CommentRenderMode2["EndnoteStyle"] = 0] = "EndnoteStyle";
@@ -208,30 +203,16 @@ var ConflictResolution = /* @__PURE__ */ ((ConflictResolution2) => {
208
203
  return ConflictResolution2;
209
204
  })(ConflictResolution || {});
210
205
  function isInsertion(revision) {
211
- return revision.revisionType === "Inserted" /* Inserted */;
206
+ return revision.family === "content_insert";
212
207
  }
213
208
  function isDeletion(revision) {
214
- return revision.revisionType === "Deleted" /* Deleted */;
209
+ return revision.family === "content_delete";
215
210
  }
216
211
  function isMove(revision) {
217
- return revision.revisionType === "Moved" /* Moved */;
212
+ return revision.family === "move";
218
213
  }
219
214
  function isFormatChange(revision) {
220
- return revision.revisionType === "FormatChanged" /* FormatChanged */;
221
- }
222
- function isMoveSource(revision) {
223
- return isMove(revision) && revision.isMoveSource === true;
224
- }
225
- function isMoveDestination(revision) {
226
- return isMove(revision) && revision.isMoveSource === false;
227
- }
228
- function findMovePair(revision, allRevisions) {
229
- if (!isMove(revision) || revision.moveGroupId === void 0) {
230
- return void 0;
231
- }
232
- return allRevisions.find(
233
- (r) => r.moveGroupId === revision.moveGroupId && r.isMoveSource !== revision.isMoveSource
234
- );
215
+ return revision.family === "properties_change";
235
216
  }
236
217
  var PlaceholderKinds = {
237
218
  BlankFill: 1,
@@ -1028,6 +1009,58 @@ var DocxSession = class _DocxSession {
1028
1009
  this.wasm.SetPageNumbering(this.handle, anchorId, JSON.stringify(op))
1029
1010
  );
1030
1011
  }
1012
+ /**
1013
+ * Insert a **table of contents** before or after `anchorId` (issue #607). The field is written
1014
+ * dirty and the document asks for a field update on open, so Word paginates and fills the table
1015
+ * itself — nothing here ships a cached result that is stale the moment anything above it moves.
1016
+ *
1017
+ * The table is wrapped in the `w:sdt` content control Word puts around one, which is what gives
1018
+ * it the *Update Table* control in Word's UI. Word's `TOCHeading` and `TOC1` styles are
1019
+ * find-or-created; a document that already defines them keeps its own.
1020
+ *
1021
+ * Body anchors only, and refused under tracked-change recording: a generated table is regenerated
1022
+ * wholesale on every field update, so there is no reversible way to redline it.
1023
+ */
1024
+ insertTableOfContents(anchorId, pos = "before", options) {
1025
+ return JSON.parse(
1026
+ this.wasm.InsertTableOfContents(
1027
+ this.handle,
1028
+ anchorId,
1029
+ pos,
1030
+ options ? JSON.stringify(options) : ""
1031
+ )
1032
+ );
1033
+ }
1034
+ /**
1035
+ * Insert a **table of figures** — the captions carrying `options.captionLabel` and their page
1036
+ * numbers. Same field mechanics as {@link insertTableOfContents}; Word writes this one as a bare
1037
+ * paragraph rather than inside a content control, so this does too.
1038
+ */
1039
+ insertTableOfFigures(anchorId, pos = "before", options) {
1040
+ return JSON.parse(
1041
+ this.wasm.InsertTableOfFigures(
1042
+ this.handle,
1043
+ anchorId,
1044
+ pos,
1045
+ options ? JSON.stringify(options) : ""
1046
+ )
1047
+ );
1048
+ }
1049
+ /**
1050
+ * Insert a **table of authorities** — the cases, statutes or other authorities marked in the
1051
+ * document, grouped by `options.category`. The table lists entries the document has MARKED with
1052
+ * `TA` fields; a document with no marked citations produces a table that is correct and empty.
1053
+ */
1054
+ insertTableOfAuthorities(anchorId, pos = "before", options) {
1055
+ return JSON.parse(
1056
+ this.wasm.InsertTableOfAuthorities(
1057
+ this.handle,
1058
+ anchorId,
1059
+ pos,
1060
+ options ? JSON.stringify(options) : ""
1061
+ )
1062
+ );
1063
+ }
1031
1064
  /**
1032
1065
  * Remove the section's page-numbering start/format: it reverts to continuing the previous
1033
1066
  * section's numbering in Word's default `1, 2, 3`. Chapter-numbering attributes
@@ -11374,7 +11407,7 @@ var DocxEditor = class _DocxEditor {
11374
11407
  };
11375
11408
 
11376
11409
  // src/ribbon-chrome.ts
11377
- var RIBBON_STYLE_VERSION = "8";
11410
+ var RIBBON_STYLE_VERSION = "9";
11378
11411
  var RIBBON_STYLE_ATTR = "data-docxodus-ribbon-styles";
11379
11412
  var RIBBON_CSS = `
11380
11413
  .dxr {
@@ -11437,6 +11470,27 @@ var RIBBON_CSS = `
11437
11470
  /* Touch devices get bigger hit targets everywhere the token is used. */
11438
11471
  @media (pointer: coarse) { .dxr { --dxr-tap: 40px; } }
11439
11472
 
11473
+ /* \u2500\u2500 Scroll-edge affordances \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
11474
+ The chrome's strips (title bar, tabs, panels, rail) scroll horizontally
11475
+ rather than squashing or wrapping \u2014 the compact rule is "no command is
11476
+ removed, the strip scrolls". But a hard clip mid-control reads as a broken
11477
+ layout, especially on a phone, so ribbon.ts measures every strip and stamps
11478
+ data-fade with the edges that hide more content ("l", "r", or both). The
11479
+ mask dissolves content at exactly those edges \u2014 the horizontal twin of
11480
+ .dxr-scroll's gradient veils \u2014 and lifts entirely once the strip fits, so
11481
+ nothing is ever faded unless there is more behind it. */
11482
+ .dxr-titlebar, .dxr-tabs, .dxr-panel, .dxr-rail { --dxr-fade-l: 0px; --dxr-fade-r: 0px; }
11483
+ .dxr [data-fade] {
11484
+ -webkit-mask-image: linear-gradient(to right,
11485
+ transparent, #000 var(--dxr-fade-l),
11486
+ #000 calc(100% - var(--dxr-fade-r)), transparent);
11487
+ mask-image: linear-gradient(to right,
11488
+ transparent, #000 var(--dxr-fade-l),
11489
+ #000 calc(100% - var(--dxr-fade-r)), transparent);
11490
+ }
11491
+ .dxr [data-fade~="l"] { --dxr-fade-l: 28px; }
11492
+ .dxr [data-fade~="r"] { --dxr-fade-r: 28px; }
11493
+
11440
11494
  /* \u2500\u2500 Chrome shell \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
11441
11495
  .dxr-chrome {
11442
11496
  position: sticky;
@@ -11447,12 +11501,17 @@ var RIBBON_CSS = `
11447
11501
  border-bottom: 1px solid var(--dxr-rule);
11448
11502
  }
11449
11503
 
11504
+ /* Scrolls in EVERY density (compact just tightens it): the fade affordance
11505
+ marks any overflowing strip as scrollable, so it must actually be. */
11450
11506
  .dxr-titlebar {
11451
11507
  display: flex;
11452
11508
  align-items: center;
11453
11509
  gap: 10px;
11454
11510
  padding: 6px 10px 0;
11511
+ overflow-x: auto;
11512
+ scrollbar-width: none;
11455
11513
  }
11514
+ .dxr-titlebar::-webkit-scrollbar { display: none; }
11456
11515
  .dxr-brand {
11457
11516
  display: flex;
11458
11517
  align-items: baseline;
@@ -11882,10 +11941,7 @@ var RIBBON_CSS = `
11882
11941
  .dxr[data-chrome="compact"] .dxr-titlebar {
11883
11942
  gap: 6px;
11884
11943
  padding: 5px 8px 0;
11885
- overflow-x: auto;
11886
- scrollbar-width: none;
11887
11944
  }
11888
- .dxr[data-chrome="compact"] .dxr-titlebar::-webkit-scrollbar { display: none; }
11889
11945
  .dxr[data-chrome="compact"] .dxr-brandname { display: none; }
11890
11946
  .dxr[data-chrome="compact"] .dxr-brand { flex: 0 1 auto; }
11891
11947
  /* A filename clipped to "do..." tells you less than no filename at all, so it keeps a
@@ -12551,6 +12607,8 @@ var RibbonSurface = class {
12551
12607
  this.featureTimer = null;
12552
12608
  this.featureIndex = 0;
12553
12609
  this.resizeObserver = null;
12610
+ this.strips = [];
12611
+ this.stripObserver = null;
12554
12612
  this.lastAnchorText = "";
12555
12613
  this.selectionFrame = null;
12556
12614
  this.options = options;
@@ -12581,6 +12639,7 @@ var RibbonSurface = class {
12581
12639
  this.applyStaticOptions();
12582
12640
  this.buildGrid();
12583
12641
  this.wire();
12642
+ this.wireScrollFades();
12584
12643
  this.applyChrome();
12585
12644
  this.loader = this.createLoaderController();
12586
12645
  if (this.loaderOptions) this.loader.show();
@@ -12660,6 +12719,38 @@ var RibbonSurface = class {
12660
12719
  this.density = next;
12661
12720
  this.element.dataset.chrome = next;
12662
12721
  this.closePicker();
12722
+ this.syncAllStripFades();
12723
+ }
12724
+ // ── scroll-edge affordances ─────────────────────────────────────────────────
12725
+ /**
12726
+ * The chrome's strips scroll horizontally instead of squashing ("no command
12727
+ * is removed in compact"), so each one reports which edges hide more content
12728
+ * via `data-fade` and the stylesheet dissolves content at exactly those
12729
+ * edges. Without this a strip hard-clips mid-control and reads as broken.
12730
+ */
12731
+ syncStripFade(strip) {
12732
+ const max = strip.scrollWidth - strip.clientWidth;
12733
+ const tokens = max <= 1 ? "" : `${strip.scrollLeft > 1 ? "l " : ""}${strip.scrollLeft < max - 1 ? "r" : ""}`.trim();
12734
+ if (tokens) strip.setAttribute("data-fade", tokens);
12735
+ else strip.removeAttribute("data-fade");
12736
+ }
12737
+ syncAllStripFades() {
12738
+ for (const strip of this.strips) this.syncStripFade(strip);
12739
+ }
12740
+ wireScrollFades() {
12741
+ this.strips = Array.from(
12742
+ this.element.querySelectorAll(".dxr-titlebar, .dxr-tabs, .dxr-panel, .dxr-rail")
12743
+ );
12744
+ if (typeof ResizeObserver !== "undefined") {
12745
+ this.stripObserver = new ResizeObserver((entries) => {
12746
+ for (const entry of entries) this.syncStripFade(entry.target);
12747
+ });
12748
+ }
12749
+ for (const strip of this.strips) {
12750
+ strip.addEventListener("scroll", () => this.syncStripFade(strip), { passive: true });
12751
+ this.stripObserver?.observe(strip);
12752
+ this.syncStripFade(strip);
12753
+ }
12663
12754
  }
12664
12755
  // ── status ──────────────────────────────────────────────────────────────────
12665
12756
  /** Publish the lifecycle on the root, where CSS and host pages can key off it. */
@@ -12753,6 +12844,8 @@ var RibbonSurface = class {
12753
12844
  doc.removeEventListener("mousedown", this.onDocumentMouseDown);
12754
12845
  this.resizeObserver?.disconnect();
12755
12846
  this.resizeObserver = null;
12847
+ this.stripObserver?.disconnect();
12848
+ this.stripObserver = null;
12756
12849
  if (this.selectionFrame != null) cancelAnimationFrame(this.selectionFrame);
12757
12850
  this.selectionFrame = null;
12758
12851
  this.stopRotation();
@@ -13037,6 +13130,8 @@ var RibbonSurface = class {
13037
13130
  }
13038
13131
  host.appendChild(row);
13039
13132
  }
13133
+ const panel = this.element.querySelector('.dxr-panel[data-panel="review"]');
13134
+ if (panel) this.syncStripFade(panel);
13040
13135
  }
13041
13136
  // ── selection-driven state ──────────────────────────────────────────────────
13042
13137
  selectionElement() {
@@ -13470,22 +13565,18 @@ async function compareDocuments(original, modified, options) {
13470
13565
  const modifiedBytes = await toBytes(modified);
13471
13566
  await yieldToMain();
13472
13567
  let result;
13473
- const engine = options?.engine ?? 1 /* DocxDiff */;
13474
- if (options?.detailThreshold !== void 0 || options?.caseInsensitive) {
13568
+ if (options?.caseInsensitive) {
13475
13569
  result = exports.DocumentComparer.CompareDocumentsWithOptions(
13476
13570
  originalBytes,
13477
13571
  modifiedBytes,
13478
13572
  options?.authorName ?? "Docxodus",
13479
- options?.detailThreshold ?? 0.15,
13480
- options?.caseInsensitive ?? false,
13481
- engine
13573
+ options.caseInsensitive
13482
13574
  );
13483
13575
  } else {
13484
13576
  result = exports.DocumentComparer.CompareDocuments(
13485
13577
  originalBytes,
13486
13578
  modifiedBytes,
13487
- options?.authorName ?? "Docxodus",
13488
- engine
13579
+ options?.authorName ?? "Docxodus"
13489
13580
  );
13490
13581
  }
13491
13582
  if (result.length === 0) {
@@ -13499,25 +13590,21 @@ async function compareDocumentsToHtml(original, modified, options) {
13499
13590
  const modifiedBytes = await toBytes(modified);
13500
13591
  await yieldToMain();
13501
13592
  const renderTrackedChanges = options?.renderTrackedChanges ?? true;
13502
- const engine = options?.engine ?? 1 /* DocxDiff */;
13503
13593
  let result;
13504
- if (options?.detailThreshold !== void 0 || options?.caseInsensitive !== void 0) {
13594
+ if (options?.caseInsensitive !== void 0) {
13505
13595
  result = exports.DocumentComparer.CompareDocumentsToHtmlFull(
13506
13596
  originalBytes,
13507
13597
  modifiedBytes,
13508
13598
  options?.authorName ?? "Docxodus",
13509
- options?.detailThreshold ?? 0.15,
13510
- options?.caseInsensitive ?? false,
13511
- renderTrackedChanges,
13512
- engine
13599
+ options.caseInsensitive,
13600
+ renderTrackedChanges
13513
13601
  );
13514
13602
  } else {
13515
13603
  result = exports.DocumentComparer.CompareDocumentsToHtmlWithOptions(
13516
13604
  originalBytes,
13517
13605
  modifiedBytes,
13518
13606
  options?.authorName ?? "Docxodus",
13519
- renderTrackedChanges,
13520
- engine
13607
+ renderTrackedChanges
13521
13608
  );
13522
13609
  }
13523
13610
  if (isErrorResponse(result)) {
@@ -13526,93 +13613,16 @@ async function compareDocumentsToHtml(original, modified, options) {
13526
13613
  }
13527
13614
  return result;
13528
13615
  }
13529
- async function compareDocumentsWithLog(original, modified, options) {
13530
- const exports = ensureInitialized();
13531
- const originalBytes = await toBytes(original);
13532
- const modifiedBytes = await toBytes(modified);
13533
- await yieldToMain();
13534
- const result = exports.DocumentComparer.CompareDocumentsWithLog(
13535
- originalBytes,
13536
- modifiedBytes,
13537
- options?.authorName ?? "Docxodus",
13538
- options?.detailThreshold ?? 0.15,
13539
- options?.caseInsensitive ?? false
13540
- );
13541
- const parsed = JSON.parse(result);
13542
- return {
13543
- success: parsed.Success ?? parsed.success ?? false,
13544
- document: parsed.DocumentBase64 || parsed.documentBase64 ? Uint8Array.from(atob(parsed.DocumentBase64 || parsed.documentBase64), (c) => c.charCodeAt(0)) : void 0,
13545
- error: parsed.Error ?? parsed.error,
13546
- log: convertLogEntries(parsed.Log || parsed.log || []),
13547
- hasWarnings: parsed.HasWarnings ?? parsed.hasWarnings ?? false,
13548
- hasErrors: parsed.HasErrors ?? parsed.hasErrors ?? false
13549
- };
13550
- }
13551
- async function compareDocumentsToHtmlWithLog(original, modified, options) {
13552
- const exports = ensureInitialized();
13553
- const originalBytes = await toBytes(original);
13554
- const modifiedBytes = await toBytes(modified);
13555
- await yieldToMain();
13556
- const result = exports.DocumentComparer.CompareDocumentsToHtmlWithLog(
13557
- originalBytes,
13558
- modifiedBytes,
13559
- options?.authorName ?? "Docxodus",
13560
- options?.detailThreshold ?? 0.15,
13561
- options?.caseInsensitive ?? false,
13562
- options?.renderTrackedChanges ?? true
13563
- );
13564
- const parsed = JSON.parse(result);
13565
- return {
13566
- success: parsed.Success ?? parsed.success ?? false,
13567
- html: parsed.Html ?? parsed.html,
13568
- error: parsed.Error ?? parsed.error,
13569
- log: convertLogEntries(parsed.Log || parsed.log || []),
13570
- hasWarnings: parsed.HasWarnings ?? parsed.hasWarnings ?? false,
13571
- hasErrors: parsed.HasErrors ?? parsed.hasErrors ?? false
13572
- };
13573
- }
13574
- function convertLogEntries(entries) {
13575
- return entries.map((e) => ({
13576
- level: e.Level ?? e.level ?? "Info",
13577
- code: e.Code ?? e.code ?? "",
13578
- message: e.Message ?? e.message ?? "",
13579
- details: e.Details ?? e.details,
13580
- location: e.Location ?? e.location
13581
- }));
13582
- }
13583
- async function getRevisions(document2, options) {
13616
+ async function getRevisions(document2) {
13584
13617
  const exports = ensureInitialized();
13585
13618
  const bytes = await toBytes(document2);
13586
13619
  await yieldToMain();
13587
- const detectMoves = options?.detectMoves ?? true;
13588
- const moveSimilarityThreshold = options?.moveSimilarityThreshold ?? 0.8;
13589
- const moveMinimumWordCount = options?.moveMinimumWordCount ?? 3;
13590
- const caseInsensitive = options?.caseInsensitive ?? false;
13591
- const result = exports.DocumentComparer.GetRevisionsJsonWithOptions(
13592
- bytes,
13593
- detectMoves,
13594
- moveSimilarityThreshold,
13595
- moveMinimumWordCount,
13596
- caseInsensitive
13597
- );
13620
+ const result = exports.DocumentComparer.GetRevisionsJson(bytes);
13598
13621
  if (isErrorResponse(result)) {
13599
13622
  const error = parseError(result);
13600
13623
  throw new Error(`Failed to get revisions: ${error.error}`);
13601
13624
  }
13602
- const parsed = JSON.parse(result);
13603
- return (parsed.Revisions || parsed.revisions || []).map((r) => ({
13604
- author: r.Author || r.author,
13605
- date: r.Date || r.date,
13606
- revisionType: r.RevisionType || r.revisionType,
13607
- text: r.Text || r.text,
13608
- moveGroupId: r.MoveGroupId ?? r.moveGroupId,
13609
- isMoveSource: r.IsMoveSource ?? r.isMoveSource,
13610
- formatChange: r.FormatChange || r.formatChange ? {
13611
- oldProperties: r.FormatChange?.OldProperties || r.formatChange?.oldProperties,
13612
- newProperties: r.FormatChange?.NewProperties || r.formatChange?.newProperties,
13613
- changedPropertyNames: r.FormatChange?.ChangedPropertyNames || r.formatChange?.changedPropertyNames
13614
- } : void 0
13615
- }));
13625
+ return JSON.parse(result);
13616
13626
  }
13617
13627
  function docxDiffSettingsJson(settings) {
13618
13628
  return settings ? JSON.stringify(settings) : "";
@@ -13672,6 +13682,38 @@ async function docxDiffCompareProducts(left2, right2, settings, products) {
13672
13682
  semanticChanges: parsed.semanticChanges !== void 0 ? parsed.semanticChanges : void 0
13673
13683
  };
13674
13684
  }
13685
+ async function docxDiffCompareBatch(baseline, candidates, settings, products) {
13686
+ const exports = ensureInitialized();
13687
+ const baselineBytes = await toBytes(baseline);
13688
+ const payload = [];
13689
+ for (let i = 0; i < candidates.length; i++) {
13690
+ const bytes = await toBytes(candidates[i].document);
13691
+ payload.push({
13692
+ name: candidates[i].name ?? String(i),
13693
+ docB64: bytesToBase64(bytes)
13694
+ });
13695
+ }
13696
+ await yieldToMain();
13697
+ const result = exports.DocxDiffBridge.CompareBatchJson(
13698
+ baselineBytes,
13699
+ JSON.stringify(payload),
13700
+ docxDiffSettingsJson(settings),
13701
+ products ? JSON.stringify(products) : ""
13702
+ );
13703
+ if (isErrorResponse(result)) {
13704
+ const error = parseError(result);
13705
+ throw new Error(`Failed to compare batch: ${error.error}`);
13706
+ }
13707
+ const parsed = JSON.parse(result);
13708
+ return (parsed.results ?? []).map((entry) => ({
13709
+ name: String(entry.name ?? ""),
13710
+ error: typeof entry.error === "string" ? entry.error : void 0,
13711
+ redline: typeof entry.redlineB64 === "string" ? Uint8Array.from(atob(entry.redlineB64), (c) => c.charCodeAt(0)) : void 0,
13712
+ revisions: Array.isArray(entry.revisions) ? entry.revisions.map(mapDocxDiffRevision) : void 0,
13713
+ editScript: entry.editScript !== void 0 ? entry.editScript : void 0,
13714
+ semanticChanges: entry.semanticChanges !== void 0 ? entry.semanticChanges : void 0
13715
+ }));
13716
+ }
13675
13717
  async function docxDiffGetEditScript(left2, right2, settings) {
13676
13718
  const exports = ensureInitialized();
13677
13719
  const leftBytes = await toBytes(left2);
@@ -14807,7 +14849,6 @@ export {
14807
14849
  AnchorRenderMode,
14808
14850
  AnnotationLabelMode,
14809
14851
  CommentRenderMode,
14810
- ComparisonEngine,
14811
14852
  ComparisonLogCodes,
14812
14853
  ComparisonLogLevel,
14813
14854
  ConflictResolution,
@@ -14837,8 +14878,6 @@ export {
14837
14878
  clearPageCitationHighlight,
14838
14879
  compareDocuments,
14839
14880
  compareDocumentsToHtml,
14840
- compareDocumentsToHtmlWithLog,
14841
- compareDocumentsWithLog,
14842
14881
  computeDocumentHash,
14843
14882
  convertDocxToHtml,
14844
14883
  convertDocxToHtmlWithExternalAnnotations,
@@ -14853,6 +14892,7 @@ export {
14853
14892
  createViewer,
14854
14893
  docxDiffAcceptRevisions,
14855
14894
  docxDiffCompare,
14895
+ docxDiffCompareBatch,
14856
14896
  docxDiffCompareProducts,
14857
14897
  docxDiffConsolidate,
14858
14898
  docxDiffGetConflicts,
@@ -14865,7 +14905,6 @@ export {
14865
14905
  exportToOpenContract,
14866
14906
  findElementById,
14867
14907
  findElementsByType,
14868
- findMovePair,
14869
14908
  findTextOccurrences,
14870
14909
  fitScale,
14871
14910
  generateAnnotationCss,
@@ -14887,8 +14926,6 @@ export {
14887
14926
  isInitialized,
14888
14927
  isInsertion,
14889
14928
  isMove,
14890
- isMoveDestination,
14891
- isMoveSource,
14892
14929
  mountRibbon,
14893
14930
  navigateToPageCitation,
14894
14931
  openDocxSession2 as openDocxSession,
package/dist/embed.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * ```html
8
8
  * <div id="doc"></div>
9
9
  * <script type="module">
10
- * import { createViewer } from "https://cdn.jsdelivr.net/npm/docxodus@9.1.1/dist/embed.bundle.js";
10
+ * import { createViewer } from "https://cdn.jsdelivr.net/npm/docxodus@10.0.0/dist/embed.bundle.js";
11
11
  * await createViewer("#doc", "./contract.docx");
12
12
  * </script>
13
13
  * ```