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
@@ -127,7 +127,6 @@ var Docxodus = (() => {
127
127
  AnchorRenderMode: () => AnchorRenderMode,
128
128
  AnnotationLabelMode: () => AnnotationLabelMode,
129
129
  CommentRenderMode: () => CommentRenderMode,
130
- ComparisonEngine: () => ComparisonEngine,
131
130
  ComparisonLogCodes: () => ComparisonLogCodes,
132
131
  ComparisonLogLevel: () => ComparisonLogLevel,
133
132
  ConflictResolution: () => ConflictResolution,
@@ -157,8 +156,6 @@ var Docxodus = (() => {
157
156
  clearPageCitationHighlight: () => clearPageCitationHighlight,
158
157
  compareDocuments: () => compareDocuments,
159
158
  compareDocumentsToHtml: () => compareDocumentsToHtml,
160
- compareDocumentsToHtmlWithLog: () => compareDocumentsToHtmlWithLog,
161
- compareDocumentsWithLog: () => compareDocumentsWithLog,
162
159
  computeDocumentHash: () => computeDocumentHash,
163
160
  convertDocxToHtml: () => convertDocxToHtml,
164
161
  convertDocxToHtmlWithExternalAnnotations: () => convertDocxToHtmlWithExternalAnnotations,
@@ -173,6 +170,7 @@ var Docxodus = (() => {
173
170
  createViewer: () => createViewer,
174
171
  docxDiffAcceptRevisions: () => docxDiffAcceptRevisions,
175
172
  docxDiffCompare: () => docxDiffCompare,
173
+ docxDiffCompareBatch: () => docxDiffCompareBatch,
176
174
  docxDiffCompareProducts: () => docxDiffCompareProducts,
177
175
  docxDiffConsolidate: () => docxDiffConsolidate,
178
176
  docxDiffGetConflicts: () => docxDiffGetConflicts,
@@ -185,7 +183,6 @@ var Docxodus = (() => {
185
183
  exportToOpenContract: () => exportToOpenContract,
186
184
  findElementById: () => findElementById,
187
185
  findElementsByType: () => findElementsByType,
188
- findMovePair: () => findMovePair,
189
186
  findTextOccurrences: () => findTextOccurrences,
190
187
  fitScale: () => fitScale,
191
188
  generateAnnotationCss: () => generateAnnotationCss,
@@ -207,8 +204,6 @@ var Docxodus = (() => {
207
204
  isInitialized: () => isInitialized,
208
205
  isInsertion: () => isInsertion,
209
206
  isMove: () => isMove,
210
- isMoveDestination: () => isMoveDestination,
211
- isMoveSource: () => isMoveSource,
212
207
  mountRibbon: () => mountRibbon,
213
208
  navigateToPageCitation: () => navigateToPageCitation,
214
209
  openDocxSession: () => openDocxSession2,
@@ -294,11 +289,6 @@ var Docxodus = (() => {
294
289
  RevisionType2["FormatChanged"] = "FormatChanged";
295
290
  return RevisionType2;
296
291
  })(RevisionType || {});
297
- var ComparisonEngine = /* @__PURE__ */ ((ComparisonEngine2) => {
298
- ComparisonEngine2[ComparisonEngine2["WmlComparer"] = 0] = "WmlComparer";
299
- ComparisonEngine2[ComparisonEngine2["DocxDiff"] = 1] = "DocxDiff";
300
- return ComparisonEngine2;
301
- })(ComparisonEngine || {});
302
292
  var CommentRenderMode = /* @__PURE__ */ ((CommentRenderMode2) => {
303
293
  CommentRenderMode2[CommentRenderMode2["Disabled"] = -1] = "Disabled";
304
294
  CommentRenderMode2[CommentRenderMode2["EndnoteStyle"] = 0] = "EndnoteStyle";
@@ -335,30 +325,16 @@ var Docxodus = (() => {
335
325
  return ConflictResolution2;
336
326
  })(ConflictResolution || {});
337
327
  function isInsertion(revision) {
338
- return revision.revisionType === "Inserted" /* Inserted */;
328
+ return revision.family === "content_insert";
339
329
  }
340
330
  function isDeletion(revision) {
341
- return revision.revisionType === "Deleted" /* Deleted */;
331
+ return revision.family === "content_delete";
342
332
  }
343
333
  function isMove(revision) {
344
- return revision.revisionType === "Moved" /* Moved */;
334
+ return revision.family === "move";
345
335
  }
346
336
  function isFormatChange(revision) {
347
- return revision.revisionType === "FormatChanged" /* FormatChanged */;
348
- }
349
- function isMoveSource(revision) {
350
- return isMove(revision) && revision.isMoveSource === true;
351
- }
352
- function isMoveDestination(revision) {
353
- return isMove(revision) && revision.isMoveSource === false;
354
- }
355
- function findMovePair(revision, allRevisions) {
356
- if (!isMove(revision) || revision.moveGroupId === void 0) {
357
- return void 0;
358
- }
359
- return allRevisions.find(
360
- (r) => r.moveGroupId === revision.moveGroupId && r.isMoveSource !== revision.isMoveSource
361
- );
337
+ return revision.family === "properties_change";
362
338
  }
363
339
  var PlaceholderKinds = {
364
340
  BlankFill: 1,
@@ -1155,6 +1131,58 @@ var Docxodus = (() => {
1155
1131
  this.wasm.SetPageNumbering(this.handle, anchorId, JSON.stringify(op))
1156
1132
  );
1157
1133
  }
1134
+ /**
1135
+ * Insert a **table of contents** before or after `anchorId` (issue #607). The field is written
1136
+ * dirty and the document asks for a field update on open, so Word paginates and fills the table
1137
+ * itself — nothing here ships a cached result that is stale the moment anything above it moves.
1138
+ *
1139
+ * The table is wrapped in the `w:sdt` content control Word puts around one, which is what gives
1140
+ * it the *Update Table* control in Word's UI. Word's `TOCHeading` and `TOC1` styles are
1141
+ * find-or-created; a document that already defines them keeps its own.
1142
+ *
1143
+ * Body anchors only, and refused under tracked-change recording: a generated table is regenerated
1144
+ * wholesale on every field update, so there is no reversible way to redline it.
1145
+ */
1146
+ insertTableOfContents(anchorId, pos = "before", options) {
1147
+ return JSON.parse(
1148
+ this.wasm.InsertTableOfContents(
1149
+ this.handle,
1150
+ anchorId,
1151
+ pos,
1152
+ options ? JSON.stringify(options) : ""
1153
+ )
1154
+ );
1155
+ }
1156
+ /**
1157
+ * Insert a **table of figures** — the captions carrying `options.captionLabel` and their page
1158
+ * numbers. Same field mechanics as {@link insertTableOfContents}; Word writes this one as a bare
1159
+ * paragraph rather than inside a content control, so this does too.
1160
+ */
1161
+ insertTableOfFigures(anchorId, pos = "before", options) {
1162
+ return JSON.parse(
1163
+ this.wasm.InsertTableOfFigures(
1164
+ this.handle,
1165
+ anchorId,
1166
+ pos,
1167
+ options ? JSON.stringify(options) : ""
1168
+ )
1169
+ );
1170
+ }
1171
+ /**
1172
+ * Insert a **table of authorities** — the cases, statutes or other authorities marked in the
1173
+ * document, grouped by `options.category`. The table lists entries the document has MARKED with
1174
+ * `TA` fields; a document with no marked citations produces a table that is correct and empty.
1175
+ */
1176
+ insertTableOfAuthorities(anchorId, pos = "before", options) {
1177
+ return JSON.parse(
1178
+ this.wasm.InsertTableOfAuthorities(
1179
+ this.handle,
1180
+ anchorId,
1181
+ pos,
1182
+ options ? JSON.stringify(options) : ""
1183
+ )
1184
+ );
1185
+ }
1158
1186
  /**
1159
1187
  * Remove the section's page-numbering start/format: it reverts to continuing the previous
1160
1188
  * section's numbering in Word's default `1, 2, 3`. Chapter-numbering attributes
@@ -11501,7 +11529,7 @@ var Docxodus = (() => {
11501
11529
  };
11502
11530
 
11503
11531
  // src/ribbon-chrome.ts
11504
- var RIBBON_STYLE_VERSION = "8";
11532
+ var RIBBON_STYLE_VERSION = "9";
11505
11533
  var RIBBON_STYLE_ATTR = "data-docxodus-ribbon-styles";
11506
11534
  var RIBBON_CSS = `
11507
11535
  .dxr {
@@ -11564,6 +11592,27 @@ var Docxodus = (() => {
11564
11592
  /* Touch devices get bigger hit targets everywhere the token is used. */
11565
11593
  @media (pointer: coarse) { .dxr { --dxr-tap: 40px; } }
11566
11594
 
11595
+ /* \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
11596
+ The chrome's strips (title bar, tabs, panels, rail) scroll horizontally
11597
+ rather than squashing or wrapping \u2014 the compact rule is "no command is
11598
+ removed, the strip scrolls". But a hard clip mid-control reads as a broken
11599
+ layout, especially on a phone, so ribbon.ts measures every strip and stamps
11600
+ data-fade with the edges that hide more content ("l", "r", or both). The
11601
+ mask dissolves content at exactly those edges \u2014 the horizontal twin of
11602
+ .dxr-scroll's gradient veils \u2014 and lifts entirely once the strip fits, so
11603
+ nothing is ever faded unless there is more behind it. */
11604
+ .dxr-titlebar, .dxr-tabs, .dxr-panel, .dxr-rail { --dxr-fade-l: 0px; --dxr-fade-r: 0px; }
11605
+ .dxr [data-fade] {
11606
+ -webkit-mask-image: linear-gradient(to right,
11607
+ transparent, #000 var(--dxr-fade-l),
11608
+ #000 calc(100% - var(--dxr-fade-r)), transparent);
11609
+ mask-image: linear-gradient(to right,
11610
+ transparent, #000 var(--dxr-fade-l),
11611
+ #000 calc(100% - var(--dxr-fade-r)), transparent);
11612
+ }
11613
+ .dxr [data-fade~="l"] { --dxr-fade-l: 28px; }
11614
+ .dxr [data-fade~="r"] { --dxr-fade-r: 28px; }
11615
+
11567
11616
  /* \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 */
11568
11617
  .dxr-chrome {
11569
11618
  position: sticky;
@@ -11574,12 +11623,17 @@ var Docxodus = (() => {
11574
11623
  border-bottom: 1px solid var(--dxr-rule);
11575
11624
  }
11576
11625
 
11626
+ /* Scrolls in EVERY density (compact just tightens it): the fade affordance
11627
+ marks any overflowing strip as scrollable, so it must actually be. */
11577
11628
  .dxr-titlebar {
11578
11629
  display: flex;
11579
11630
  align-items: center;
11580
11631
  gap: 10px;
11581
11632
  padding: 6px 10px 0;
11633
+ overflow-x: auto;
11634
+ scrollbar-width: none;
11582
11635
  }
11636
+ .dxr-titlebar::-webkit-scrollbar { display: none; }
11583
11637
  .dxr-brand {
11584
11638
  display: flex;
11585
11639
  align-items: baseline;
@@ -12009,10 +12063,7 @@ var Docxodus = (() => {
12009
12063
  .dxr[data-chrome="compact"] .dxr-titlebar {
12010
12064
  gap: 6px;
12011
12065
  padding: 5px 8px 0;
12012
- overflow-x: auto;
12013
- scrollbar-width: none;
12014
12066
  }
12015
- .dxr[data-chrome="compact"] .dxr-titlebar::-webkit-scrollbar { display: none; }
12016
12067
  .dxr[data-chrome="compact"] .dxr-brandname { display: none; }
12017
12068
  .dxr[data-chrome="compact"] .dxr-brand { flex: 0 1 auto; }
12018
12069
  /* A filename clipped to "do..." tells you less than no filename at all, so it keeps a
@@ -12678,6 +12729,8 @@ var Docxodus = (() => {
12678
12729
  this.featureTimer = null;
12679
12730
  this.featureIndex = 0;
12680
12731
  this.resizeObserver = null;
12732
+ this.strips = [];
12733
+ this.stripObserver = null;
12681
12734
  this.lastAnchorText = "";
12682
12735
  this.selectionFrame = null;
12683
12736
  this.options = options;
@@ -12708,6 +12761,7 @@ var Docxodus = (() => {
12708
12761
  this.applyStaticOptions();
12709
12762
  this.buildGrid();
12710
12763
  this.wire();
12764
+ this.wireScrollFades();
12711
12765
  this.applyChrome();
12712
12766
  this.loader = this.createLoaderController();
12713
12767
  if (this.loaderOptions) this.loader.show();
@@ -12787,6 +12841,38 @@ var Docxodus = (() => {
12787
12841
  this.density = next;
12788
12842
  this.element.dataset.chrome = next;
12789
12843
  this.closePicker();
12844
+ this.syncAllStripFades();
12845
+ }
12846
+ // ── scroll-edge affordances ─────────────────────────────────────────────────
12847
+ /**
12848
+ * The chrome's strips scroll horizontally instead of squashing ("no command
12849
+ * is removed in compact"), so each one reports which edges hide more content
12850
+ * via `data-fade` and the stylesheet dissolves content at exactly those
12851
+ * edges. Without this a strip hard-clips mid-control and reads as broken.
12852
+ */
12853
+ syncStripFade(strip) {
12854
+ const max = strip.scrollWidth - strip.clientWidth;
12855
+ const tokens = max <= 1 ? "" : `${strip.scrollLeft > 1 ? "l " : ""}${strip.scrollLeft < max - 1 ? "r" : ""}`.trim();
12856
+ if (tokens) strip.setAttribute("data-fade", tokens);
12857
+ else strip.removeAttribute("data-fade");
12858
+ }
12859
+ syncAllStripFades() {
12860
+ for (const strip of this.strips) this.syncStripFade(strip);
12861
+ }
12862
+ wireScrollFades() {
12863
+ this.strips = Array.from(
12864
+ this.element.querySelectorAll(".dxr-titlebar, .dxr-tabs, .dxr-panel, .dxr-rail")
12865
+ );
12866
+ if (typeof ResizeObserver !== "undefined") {
12867
+ this.stripObserver = new ResizeObserver((entries) => {
12868
+ for (const entry of entries) this.syncStripFade(entry.target);
12869
+ });
12870
+ }
12871
+ for (const strip of this.strips) {
12872
+ strip.addEventListener("scroll", () => this.syncStripFade(strip), { passive: true });
12873
+ this.stripObserver?.observe(strip);
12874
+ this.syncStripFade(strip);
12875
+ }
12790
12876
  }
12791
12877
  // ── status ──────────────────────────────────────────────────────────────────
12792
12878
  /** Publish the lifecycle on the root, where CSS and host pages can key off it. */
@@ -12880,6 +12966,8 @@ var Docxodus = (() => {
12880
12966
  doc.removeEventListener("mousedown", this.onDocumentMouseDown);
12881
12967
  this.resizeObserver?.disconnect();
12882
12968
  this.resizeObserver = null;
12969
+ this.stripObserver?.disconnect();
12970
+ this.stripObserver = null;
12883
12971
  if (this.selectionFrame != null) cancelAnimationFrame(this.selectionFrame);
12884
12972
  this.selectionFrame = null;
12885
12973
  this.stopRotation();
@@ -13164,6 +13252,8 @@ var Docxodus = (() => {
13164
13252
  }
13165
13253
  host.appendChild(row);
13166
13254
  }
13255
+ const panel = this.element.querySelector('.dxr-panel[data-panel="review"]');
13256
+ if (panel) this.syncStripFade(panel);
13167
13257
  }
13168
13258
  // ── selection-driven state ──────────────────────────────────────────────────
13169
13259
  selectionElement() {
@@ -13598,22 +13688,18 @@ var Docxodus = (() => {
13598
13688
  const modifiedBytes = await toBytes(modified);
13599
13689
  await yieldToMain();
13600
13690
  let result;
13601
- const engine = options?.engine ?? 1 /* DocxDiff */;
13602
- if (options?.detailThreshold !== void 0 || options?.caseInsensitive) {
13691
+ if (options?.caseInsensitive) {
13603
13692
  result = exports.DocumentComparer.CompareDocumentsWithOptions(
13604
13693
  originalBytes,
13605
13694
  modifiedBytes,
13606
13695
  options?.authorName ?? "Docxodus",
13607
- options?.detailThreshold ?? 0.15,
13608
- options?.caseInsensitive ?? false,
13609
- engine
13696
+ options.caseInsensitive
13610
13697
  );
13611
13698
  } else {
13612
13699
  result = exports.DocumentComparer.CompareDocuments(
13613
13700
  originalBytes,
13614
13701
  modifiedBytes,
13615
- options?.authorName ?? "Docxodus",
13616
- engine
13702
+ options?.authorName ?? "Docxodus"
13617
13703
  );
13618
13704
  }
13619
13705
  if (result.length === 0) {
@@ -13627,25 +13713,21 @@ var Docxodus = (() => {
13627
13713
  const modifiedBytes = await toBytes(modified);
13628
13714
  await yieldToMain();
13629
13715
  const renderTrackedChanges = options?.renderTrackedChanges ?? true;
13630
- const engine = options?.engine ?? 1 /* DocxDiff */;
13631
13716
  let result;
13632
- if (options?.detailThreshold !== void 0 || options?.caseInsensitive !== void 0) {
13717
+ if (options?.caseInsensitive !== void 0) {
13633
13718
  result = exports.DocumentComparer.CompareDocumentsToHtmlFull(
13634
13719
  originalBytes,
13635
13720
  modifiedBytes,
13636
13721
  options?.authorName ?? "Docxodus",
13637
- options?.detailThreshold ?? 0.15,
13638
- options?.caseInsensitive ?? false,
13639
- renderTrackedChanges,
13640
- engine
13722
+ options.caseInsensitive,
13723
+ renderTrackedChanges
13641
13724
  );
13642
13725
  } else {
13643
13726
  result = exports.DocumentComparer.CompareDocumentsToHtmlWithOptions(
13644
13727
  originalBytes,
13645
13728
  modifiedBytes,
13646
13729
  options?.authorName ?? "Docxodus",
13647
- renderTrackedChanges,
13648
- engine
13730
+ renderTrackedChanges
13649
13731
  );
13650
13732
  }
13651
13733
  if (isErrorResponse(result)) {
@@ -13654,93 +13736,16 @@ var Docxodus = (() => {
13654
13736
  }
13655
13737
  return result;
13656
13738
  }
13657
- async function compareDocumentsWithLog(original, modified, options) {
13658
- const exports = ensureInitialized();
13659
- const originalBytes = await toBytes(original);
13660
- const modifiedBytes = await toBytes(modified);
13661
- await yieldToMain();
13662
- const result = exports.DocumentComparer.CompareDocumentsWithLog(
13663
- originalBytes,
13664
- modifiedBytes,
13665
- options?.authorName ?? "Docxodus",
13666
- options?.detailThreshold ?? 0.15,
13667
- options?.caseInsensitive ?? false
13668
- );
13669
- const parsed = JSON.parse(result);
13670
- return {
13671
- success: parsed.Success ?? parsed.success ?? false,
13672
- document: parsed.DocumentBase64 || parsed.documentBase64 ? Uint8Array.from(atob(parsed.DocumentBase64 || parsed.documentBase64), (c) => c.charCodeAt(0)) : void 0,
13673
- error: parsed.Error ?? parsed.error,
13674
- log: convertLogEntries(parsed.Log || parsed.log || []),
13675
- hasWarnings: parsed.HasWarnings ?? parsed.hasWarnings ?? false,
13676
- hasErrors: parsed.HasErrors ?? parsed.hasErrors ?? false
13677
- };
13678
- }
13679
- async function compareDocumentsToHtmlWithLog(original, modified, options) {
13680
- const exports = ensureInitialized();
13681
- const originalBytes = await toBytes(original);
13682
- const modifiedBytes = await toBytes(modified);
13683
- await yieldToMain();
13684
- const result = exports.DocumentComparer.CompareDocumentsToHtmlWithLog(
13685
- originalBytes,
13686
- modifiedBytes,
13687
- options?.authorName ?? "Docxodus",
13688
- options?.detailThreshold ?? 0.15,
13689
- options?.caseInsensitive ?? false,
13690
- options?.renderTrackedChanges ?? true
13691
- );
13692
- const parsed = JSON.parse(result);
13693
- return {
13694
- success: parsed.Success ?? parsed.success ?? false,
13695
- html: parsed.Html ?? parsed.html,
13696
- error: parsed.Error ?? parsed.error,
13697
- log: convertLogEntries(parsed.Log || parsed.log || []),
13698
- hasWarnings: parsed.HasWarnings ?? parsed.hasWarnings ?? false,
13699
- hasErrors: parsed.HasErrors ?? parsed.hasErrors ?? false
13700
- };
13701
- }
13702
- function convertLogEntries(entries) {
13703
- return entries.map((e) => ({
13704
- level: e.Level ?? e.level ?? "Info",
13705
- code: e.Code ?? e.code ?? "",
13706
- message: e.Message ?? e.message ?? "",
13707
- details: e.Details ?? e.details,
13708
- location: e.Location ?? e.location
13709
- }));
13710
- }
13711
- async function getRevisions(document2, options) {
13739
+ async function getRevisions(document2) {
13712
13740
  const exports = ensureInitialized();
13713
13741
  const bytes = await toBytes(document2);
13714
13742
  await yieldToMain();
13715
- const detectMoves = options?.detectMoves ?? true;
13716
- const moveSimilarityThreshold = options?.moveSimilarityThreshold ?? 0.8;
13717
- const moveMinimumWordCount = options?.moveMinimumWordCount ?? 3;
13718
- const caseInsensitive = options?.caseInsensitive ?? false;
13719
- const result = exports.DocumentComparer.GetRevisionsJsonWithOptions(
13720
- bytes,
13721
- detectMoves,
13722
- moveSimilarityThreshold,
13723
- moveMinimumWordCount,
13724
- caseInsensitive
13725
- );
13743
+ const result = exports.DocumentComparer.GetRevisionsJson(bytes);
13726
13744
  if (isErrorResponse(result)) {
13727
13745
  const error = parseError(result);
13728
13746
  throw new Error(`Failed to get revisions: ${error.error}`);
13729
13747
  }
13730
- const parsed = JSON.parse(result);
13731
- return (parsed.Revisions || parsed.revisions || []).map((r) => ({
13732
- author: r.Author || r.author,
13733
- date: r.Date || r.date,
13734
- revisionType: r.RevisionType || r.revisionType,
13735
- text: r.Text || r.text,
13736
- moveGroupId: r.MoveGroupId ?? r.moveGroupId,
13737
- isMoveSource: r.IsMoveSource ?? r.isMoveSource,
13738
- formatChange: r.FormatChange || r.formatChange ? {
13739
- oldProperties: r.FormatChange?.OldProperties || r.formatChange?.oldProperties,
13740
- newProperties: r.FormatChange?.NewProperties || r.formatChange?.newProperties,
13741
- changedPropertyNames: r.FormatChange?.ChangedPropertyNames || r.formatChange?.changedPropertyNames
13742
- } : void 0
13743
- }));
13748
+ return JSON.parse(result);
13744
13749
  }
13745
13750
  function docxDiffSettingsJson(settings) {
13746
13751
  return settings ? JSON.stringify(settings) : "";
@@ -13800,6 +13805,38 @@ var Docxodus = (() => {
13800
13805
  semanticChanges: parsed.semanticChanges !== void 0 ? parsed.semanticChanges : void 0
13801
13806
  };
13802
13807
  }
13808
+ async function docxDiffCompareBatch(baseline, candidates, settings, products) {
13809
+ const exports = ensureInitialized();
13810
+ const baselineBytes = await toBytes(baseline);
13811
+ const payload = [];
13812
+ for (let i = 0; i < candidates.length; i++) {
13813
+ const bytes = await toBytes(candidates[i].document);
13814
+ payload.push({
13815
+ name: candidates[i].name ?? String(i),
13816
+ docB64: bytesToBase64(bytes)
13817
+ });
13818
+ }
13819
+ await yieldToMain();
13820
+ const result = exports.DocxDiffBridge.CompareBatchJson(
13821
+ baselineBytes,
13822
+ JSON.stringify(payload),
13823
+ docxDiffSettingsJson(settings),
13824
+ products ? JSON.stringify(products) : ""
13825
+ );
13826
+ if (isErrorResponse(result)) {
13827
+ const error = parseError(result);
13828
+ throw new Error(`Failed to compare batch: ${error.error}`);
13829
+ }
13830
+ const parsed = JSON.parse(result);
13831
+ return (parsed.results ?? []).map((entry) => ({
13832
+ name: String(entry.name ?? ""),
13833
+ error: typeof entry.error === "string" ? entry.error : void 0,
13834
+ redline: typeof entry.redlineB64 === "string" ? Uint8Array.from(atob(entry.redlineB64), (c) => c.charCodeAt(0)) : void 0,
13835
+ revisions: Array.isArray(entry.revisions) ? entry.revisions.map(mapDocxDiffRevision) : void 0,
13836
+ editScript: entry.editScript !== void 0 ? entry.editScript : void 0,
13837
+ semanticChanges: entry.semanticChanges !== void 0 ? entry.semanticChanges : void 0
13838
+ }));
13839
+ }
13803
13840
  async function docxDiffGetEditScript(left2, right2, settings) {
13804
13841
  const exports = ensureInitialized();
13805
13842
  const leftBytes = await toBytes(left2);
package/dist/embed.js 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
  * ```