@portone/docx-editor 0.6.5 → 0.6.6

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 (56) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CONTRIBUTING.md +4 -4
  3. package/dist/core.d.ts +7 -0
  4. package/dist/core.js +2 -0
  5. package/dist/docx/commentOnlyChange.d.ts +4 -4
  6. package/dist/docx/comments/constants.d.ts +7 -0
  7. package/dist/docx/comments/constants.js +13 -1
  8. package/dist/docx/comments/dates.d.ts +22 -0
  9. package/dist/docx/comments/dates.js +102 -0
  10. package/dist/docx/comments/durable.d.ts +22 -0
  11. package/dist/docx/comments/durable.js +138 -0
  12. package/dist/docx/comments/grammar.d.ts +10 -1
  13. package/dist/docx/comments/grammar.js +49 -2
  14. package/dist/docx/comments/model.d.ts +10 -2
  15. package/dist/docx/comments/model.js +38 -8
  16. package/dist/docx/comments/parts.d.ts +53 -7
  17. package/dist/docx/comments/parts.js +163 -20
  18. package/dist/docx/comments/people.d.ts +1 -1
  19. package/dist/docx/comments/people.js +5 -15
  20. package/dist/docx/comments/reading.d.ts +26 -0
  21. package/dist/docx/comments/reading.js +109 -49
  22. package/dist/docx/comments/writing.d.ts +2 -7
  23. package/dist/docx/comments/writing.js +30 -43
  24. package/dist/docx/compareDocx.d.ts +154 -0
  25. package/dist/docx/compareDocx.js +218 -0
  26. package/dist/docx/importParagraph.js +5 -3
  27. package/dist/docx/invariants.js +19 -6
  28. package/dist/docx/packageParts.d.ts +2 -0
  29. package/dist/docx/packageParts.js +5 -1
  30. package/dist/docx/partPlan.d.ts +12 -0
  31. package/dist/docx/partPlan.js +19 -1
  32. package/dist/docx/protectionPolicy.d.ts +33 -5
  33. package/dist/docx/protectionPolicy.js +93 -47
  34. package/dist/docx/sequenceDiff.d.ts +56 -0
  35. package/dist/docx/sequenceDiff.js +252 -0
  36. package/dist/docx/storyProjection.d.ts +2 -0
  37. package/dist/docx/storyProjection.js +10 -9
  38. package/dist/docx/textDiff.d.ts +24 -0
  39. package/dist/docx/textDiff.js +38 -0
  40. package/dist/editor/commands/comments/editing.js +56 -20
  41. package/dist/editor/commands/comments/model.d.ts +3 -1
  42. package/dist/editor/editorDocument.d.ts +4 -0
  43. package/dist/editor/editorDocument.js +10 -0
  44. package/dist/editor/plugins/commentDecorations.js +6 -2
  45. package/dist/ooxml/errors.d.ts +1 -1
  46. package/dist/ooxml/names.d.ts +2 -0
  47. package/dist/ooxml/names.js +2 -0
  48. package/dist/ooxml/partSplice.d.ts +13 -3
  49. package/dist/ooxml/partSplice.js +45 -18
  50. package/dist/schema/attrRoles.js +3 -1
  51. package/dist/schema/docxSchema.js +10 -3
  52. package/dist/schema/protection.js +2 -1
  53. package/dist/ui/CommentsPanel.js +8 -13
  54. package/dist/ui/comments/commentDate.d.ts +7 -0
  55. package/dist/ui/comments/commentDate.js +17 -0
  56. package/package.json +6 -6
@@ -7,13 +7,24 @@ import {
7
7
  serializeXml
8
8
  } from "../../ooxml/xml.js";
9
9
  import { relatedPartPath } from "../packageParts.js";
10
- import { COMMENTS_EXTENDED_REL_TYPE, COMMENTS_REL_TYPE } from "./constants.js";
10
+ import {
11
+ COMMENTS_EXTENDED_REL_TYPE,
12
+ COMMENTS_EXTENSIBLE_REL_TYPE,
13
+ COMMENTS_IDS_REL_TYPE,
14
+ COMMENTS_REL_TYPE
15
+ } from "./constants.js";
11
16
  import { lastBodyParagraph } from "./grammar.js";
12
17
  import {
13
18
  commentAuthorId,
14
19
  NO_PEOPLE,
15
20
  readPeople
16
21
  } from "./people.js";
22
+ var NO_PART = {
23
+ partPath: null,
24
+ xml: null,
25
+ hadBom: false,
26
+ ordered: []
27
+ };
17
28
  var NO_COMMENTS = {
18
29
  partPath: null,
19
30
  xml: null,
@@ -25,68 +36,112 @@ var NO_COMMENTS = {
25
36
  extendedXml: null,
26
37
  extendedHadBom: false,
27
38
  extendedOrdered: [],
28
- people: NO_PEOPLE
39
+ people: NO_PEOPLE,
40
+ ids: NO_PART,
41
+ extensible: NO_PART
29
42
  };
30
43
  function lastParagraphId(comment) {
31
44
  const last = lastBodyParagraph(comment);
32
45
  return last === null ? null : attributeByLocalName(last, "paraId");
33
46
  }
34
- function readCommentExtensions(parts, mainPartPath) {
35
- const partPath = relatedPartPath(
36
- parts,
37
- mainPartPath,
38
- COMMENTS_EXTENDED_REL_TYPE
39
- );
40
- if (partPath === null) {
41
- return {
42
- partPath: null,
43
- xml: null,
44
- hadBom: false,
45
- byParaId: /* @__PURE__ */ new Map(),
46
- ordered: []
47
- };
48
- }
47
+ function readCommentPart(parts, mainPartPath, relType, localName, entryOf) {
48
+ const partPath = relatedPartPath(parts, mainPartPath, relType);
49
+ if (partPath === null) return NO_PART;
49
50
  const bytes = parts.get(partPath);
50
- if (!bytes) {
51
- return {
52
- partPath,
53
- xml: null,
54
- hadBom: false,
55
- byParaId: /* @__PURE__ */ new Map(),
56
- ordered: []
57
- };
58
- }
51
+ if (!bytes) return { ...NO_PART, partPath };
59
52
  const { text, hadBom } = decodeUtf8(bytes);
60
- const root = parseXml(text).documentElement;
61
- const byParaId = /* @__PURE__ */ new Map();
62
- const ordered = [];
63
- for (const el of elementChildren(root)) {
64
- if (el.localName !== "commentEx") continue;
65
- const paraId = attributeByLocalName(el, "paraId");
66
- if (paraId === null) continue;
67
- const extension = {
68
- paraId,
69
- parentParaId: attributeByLocalName(el, "paraIdParent"),
70
- resolved: ["1", "true", "on"].includes(
71
- attributeByLocalName(el, "done")?.toLowerCase() ?? ""
72
- ),
73
- xml: serializeXml(el)
74
- };
75
- ordered.push(extension);
76
- if (!byParaId.has(paraId)) byParaId.set(paraId, extension);
53
+ const ordered = elementChildren(parseXml(text).documentElement).flatMap(
54
+ (el) => {
55
+ const entry = el.localName === localName ? entryOf(el) : null;
56
+ return entry === null ? [] : [entry];
57
+ }
58
+ );
59
+ return { partPath, xml: text, hadBom, ordered };
60
+ }
61
+ function commentExtensionOf(el) {
62
+ const paraId = attributeByLocalName(el, "paraId");
63
+ return paraId === null ? null : {
64
+ paraId,
65
+ parentParaId: attributeByLocalName(el, "paraIdParent"),
66
+ resolved: ["1", "true", "on"].includes(
67
+ attributeByLocalName(el, "done")?.toLowerCase() ?? ""
68
+ ),
69
+ xml: serializeXml(el)
70
+ };
71
+ }
72
+ function commentIdOf(el) {
73
+ const paraId = attributeByLocalName(el, "paraId");
74
+ const durableId = attributeByLocalName(el, "durableId");
75
+ return paraId === null || durableId === null ? null : { paraId, durableId };
76
+ }
77
+ function commentDateOf(el) {
78
+ const durableId = attributeByLocalName(el, "durableId");
79
+ return durableId === null ? null : { durableId, dateUtc: attributeByLocalName(el, "dateUtc") };
80
+ }
81
+ function firstByKey(entries, key, value) {
82
+ const found = /* @__PURE__ */ new Map();
83
+ for (const entry of entries) {
84
+ if (!found.has(key(entry))) found.set(key(entry), value(entry));
77
85
  }
78
- return { partPath, xml: text, hadBom, byParaId, ordered };
86
+ return found;
87
+ }
88
+ function durableIdKey(durableId) {
89
+ return durableId.toUpperCase();
90
+ }
91
+ function spentDurableIds(comments) {
92
+ return new Set(
93
+ [...comments.ids.ordered, ...comments.extensible.ordered].map(
94
+ (entry) => durableIdKey(entry.durableId)
95
+ )
96
+ );
79
97
  }
80
98
  function readComments(parts, mainPartPath) {
81
99
  const people = readPeople(parts, mainPartPath);
82
- const extensions = readCommentExtensions(parts, mainPartPath);
100
+ const extensions = readCommentPart(
101
+ parts,
102
+ mainPartPath,
103
+ COMMENTS_EXTENDED_REL_TYPE,
104
+ "commentEx",
105
+ commentExtensionOf
106
+ );
107
+ const extensionsByParaId = firstByKey(
108
+ extensions.ordered,
109
+ (entry) => entry.paraId,
110
+ (entry) => entry
111
+ );
112
+ const ids = readCommentPart(
113
+ parts,
114
+ mainPartPath,
115
+ COMMENTS_IDS_REL_TYPE,
116
+ "commentId",
117
+ commentIdOf
118
+ );
119
+ const extensible = readCommentPart(
120
+ parts,
121
+ mainPartPath,
122
+ COMMENTS_EXTENSIBLE_REL_TYPE,
123
+ "commentExtensible",
124
+ commentDateOf
125
+ );
83
126
  const aside = {
84
127
  people,
85
128
  extendedPartPath: extensions.partPath,
86
129
  extendedXml: extensions.xml,
87
130
  extendedHadBom: extensions.hadBom,
88
- extendedOrdered: extensions.ordered
131
+ extendedOrdered: extensions.ordered,
132
+ ids,
133
+ extensible
89
134
  };
135
+ const durableIds = firstByKey(
136
+ ids.ordered,
137
+ (entry) => entry.paraId,
138
+ (entry) => entry.durableId
139
+ );
140
+ const utcDates = firstByKey(
141
+ extensible.ordered,
142
+ (entry) => durableIdKey(entry.durableId),
143
+ (entry) => entry.dateUtc
144
+ );
90
145
  const partPath = relatedPartPath(parts, mainPartPath, COMMENTS_REL_TYPE);
91
146
  if (partPath === null) return { ...NO_COMMENTS, ...aside };
92
147
  const bytes = parts.get(partPath);
@@ -97,8 +152,9 @@ function readComments(parts, mainPartPath) {
97
152
  const id = attributeByLocalName(el, "id");
98
153
  if (id === null) return [];
99
154
  const paraId = lastParagraphId(el);
100
- const extension = paraId ? extensions.byParaId.get(paraId) : void 0;
155
+ const extension = paraId ? extensionsByParaId.get(paraId) : void 0;
101
156
  const author = attributeByLocalName(el, "author");
157
+ const durableId = paraId === null ? null : durableIds.get(paraId) ?? null;
102
158
  return [
103
159
  {
104
160
  id,
@@ -109,7 +165,9 @@ function readComments(parts, mainPartPath) {
109
165
  paraId,
110
166
  parentParaId: extension?.parentParaId ?? null,
111
167
  resolved: extension?.resolved ?? false,
112
- extensionXml: extension?.xml ?? null
168
+ extensionXml: extension?.xml ?? null,
169
+ durableId,
170
+ dateUtc: durableId === null ? null : utcDates.get(durableIdKey(durableId)) ?? null
113
171
  }
114
172
  ];
115
173
  });
@@ -142,6 +200,8 @@ function readComments(parts, mainPartPath) {
142
200
  }
143
201
  export {
144
202
  NO_COMMENTS,
203
+ durableIdKey,
145
204
  lastParagraphId,
146
- readComments
205
+ readComments,
206
+ spentDurableIds
147
207
  };
@@ -5,7 +5,6 @@ import type { Node as PMNode } from "prosemirror-model";
5
5
  import { type RootDeclarations } from "../../ooxml/partSplice";
6
6
  import type { PartPlanner } from "../partPlan";
7
7
  import type { SessionStore } from "../session";
8
- import { type CommentReferenceData, type CommentReplyData } from "./model";
9
8
  /**
10
9
  * Whether the Comments part has to be rewritten: a comment or reply came, went, or changed, or an
11
10
  * entry has to gain the key its thread state hangs off. The export invariants ask this as well, so
@@ -23,12 +22,8 @@ export declare function commentsRootProblem(xml: string): string | null;
23
22
  export declare function extensionsRootProblem(xml: string): string | null;
24
23
  /** Whether the extended part has to be rewritten: thread state arrived, changed, or went with a deleted comment */
25
24
  export declare function extensionsChanged(doc: PMNode, session: SessionStore): boolean;
26
- /**
27
- * What a part carrying comments this editor wrote has to declare. Every entry it writes is spelled
28
- * under `w`, so the root binds it rather than each entry declaring it again.
29
- */
30
- export declare const COMMENT_MARKUP: RootDeclarations;
25
+ /** What the Comments part is written declaring, which the export invariants check its root against */
26
+ export declare function commentsMarkup(doc: PMNode, session: SessionStore): RootDeclarations;
31
27
  /** What a part carrying the thread an entry belongs to has to declare, its keys being `w15` ones */
32
28
  export declare const EXTENSIONS_MARKUP: RootDeclarations;
33
- export declare function currentCommentBodies(references: ReadonlyMap<string, CommentReferenceData>): ReadonlyMap<string, CommentReferenceData | CommentReplyData>;
34
29
  export declare const commentsPlanner: PartPlanner;
@@ -17,13 +17,16 @@ import {
17
17
  storyOf,
18
18
  withThreadKeyOn
19
19
  } from "../story.js";
20
+ import { planDurableParts } from "./durable.js";
20
21
  import {
21
22
  arrivedEntries,
22
23
  renderCommentExtension,
23
24
  withThreadKey
24
25
  } from "./grammar.js";
25
26
  import {
26
- commentReferencesIn
27
+ commentReferencesIn,
28
+ currentCommentBodies,
29
+ originalThreadIds
27
30
  } from "./model.js";
28
31
  import { commentsExtendedPart, commentsPart, peoplePart } from "./parts.js";
29
32
  import { planPeoplePart } from "./people.js";
@@ -132,7 +135,7 @@ function carriesThreadMetadata(comment) {
132
135
  return comment.extensionXml !== null || "threadImported" in comment && !comment.threadImported || "parentParaId" in comment;
133
136
  }
134
137
  function keyedEntry(comment, arrivedKeyed) {
135
- return carriesThreadMetadata(comment) || arrivedKeyed.has(comment.id);
138
+ return carriesThreadMetadata(comment) || comment.durableId !== null || arrivedKeyed.has(comment.id);
136
139
  }
137
140
  function writtenContainer(comment) {
138
141
  const attrs = [
@@ -170,42 +173,30 @@ var THREAD_MARKUP = {
170
173
  namespaces: { w: NAMESPACES.w, w14: NAMESPACES.w14, mc: NAMESPACES.mc },
171
174
  ignorable: ["w14"]
172
175
  };
176
+ function arrivedKeyedIds(comments) {
177
+ return new Set(
178
+ Array.from(comments.byId.values()).flatMap(
179
+ (entry) => entry.paraId === null ? [] : [entry.id]
180
+ )
181
+ );
182
+ }
183
+ function markupFor(bodies, arrivedKeyed) {
184
+ return Array.from(bodies).some((comment) => keyedEntry(comment, arrivedKeyed)) ? THREAD_MARKUP : COMMENT_MARKUP;
185
+ }
186
+ function commentsMarkup(doc, session) {
187
+ return markupFor(
188
+ currentCommentBodies(commentReferencesIn(doc)).values(),
189
+ arrivedKeyedIds(session.comments)
190
+ );
191
+ }
173
192
  var EXTENSIONS_MARKUP = {
174
193
  namespaces: { w15: NAMESPACES.w15 }
175
194
  };
176
- function currentCommentBodies(references) {
177
- const comments = /* @__PURE__ */ new Map();
178
- for (const [id, comment] of references) {
179
- comments.set(id, comment);
180
- for (const reply of comment.replies) comments.set(reply.id, reply);
181
- }
182
- return comments;
183
- }
184
- function originalThreadIds(comments, rootIds) {
185
- const ids = new Set(rootIds);
186
- const pending = Array.from(rootIds);
187
- while (pending.length > 0) {
188
- const parent = pending.shift();
189
- if (parent === void 0) break;
190
- for (const reply of comments.repliesByParentId.get(parent) ?? []) {
191
- if (ids.has(reply.id)) continue;
192
- ids.add(reply.id);
193
- pending.push(reply.id);
194
- }
195
- }
196
- return ids;
197
- }
198
195
  function commentsXml(doc, session, references, originallyReferenced) {
199
196
  const comments = session.comments;
200
197
  const currentBodies = currentCommentBodies(references);
201
- const arrivedKeyed = new Set(
202
- Array.from(comments.byId.values()).flatMap(
203
- (entry) => entry.paraId === null ? [] : [entry.id]
204
- )
205
- );
206
- const hasThreadMetadata = Array.from(currentBodies.values()).some(
207
- (comment) => keyedEntry(comment, arrivedKeyed)
208
- );
198
+ const arrivedKeyed = arrivedKeyedIds(comments);
199
+ const markup = markupFor(currentBodies.values(), arrivedKeyed);
209
200
  const arrived = arrivedEntries(comments.xml);
210
201
  const originalThreads = originalThreadIds(comments, originallyReferenced);
211
202
  const pieces = [];
@@ -233,18 +224,12 @@ function commentsXml(doc, session, references, originallyReferenced) {
233
224
  );
234
225
  }
235
226
  }
236
- if (comments.xml === null) {
237
- const compatibility = hasThreadMetadata ? ` ${xmlnsDecl("w14")} ${xmlnsDecl("mc")} mc:Ignorable="w14"` : "";
238
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${xmlnsDecl("w")}${compatibility}>${pieces.join("")}</w:comments>`;
239
- }
240
- const rewritten = splicePart(comments.xml, {
227
+ const part = comments.xml ?? `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${xmlnsDecl("w")}></w:comments>`;
228
+ const rewritten = splicePart(part, {
241
229
  root: COMMENTS_ROOT,
242
230
  replaceChildren: pieces.join("")
243
231
  });
244
- return ensureRootDeclarations(
245
- rewritten,
246
- hasThreadMetadata ? THREAD_MARKUP : COMMENT_MARKUP
247
- );
232
+ return ensureRootDeclarations(rewritten, markup);
248
233
  }
249
234
  function planCommentParts(doc, session, context) {
250
235
  const bodyChanged = commentsChanged(doc, session);
@@ -306,6 +291,9 @@ function planCommentParts(doc, session, context) {
306
291
  context
307
292
  );
308
293
  for (const [path, bytes] of people ?? []) parts.set(path, bytes);
294
+ for (const [path, bytes] of planDurableParts(doc, session, context)) {
295
+ parts.set(path, bytes);
296
+ }
309
297
  }
310
298
  return parts;
311
299
  }
@@ -314,12 +302,11 @@ var commentsPlanner = {
314
302
  plan: planCommentParts
315
303
  };
316
304
  export {
317
- COMMENT_MARKUP,
318
305
  EXTENSIONS_MARKUP,
319
306
  commentsChanged,
307
+ commentsMarkup,
320
308
  commentsPlanner,
321
309
  commentsRootProblem,
322
- currentCommentBodies,
323
310
  extensionsChanged,
324
311
  extensionsRootProblem
325
312
  };
@@ -0,0 +1,154 @@
1
+ /**
2
+ * What changed between two files, block by block: the answer `onlyCommentsChangedBy` withholds
3
+ * when all it says is whether anything but comments did.
4
+ *
5
+ * Two files opened side by side share no block key, and a wrapper's key counts through the
6
+ * document it was opened from, so the model's own `sameSource` calls every block of the second
7
+ * file changed. Blocks are compared as the writer puts them out instead (`./storyProjection`),
8
+ * which is the comparison the returned-file verifier holds a story to, and the package around
9
+ * them is read through the verifier's own pieces (`./protectionPolicy`).
10
+ */
11
+ import { type XmlParser } from "../ooxml/xml";
12
+ import { type DocxBytes } from "./importDocx";
13
+ import { type TextEdit } from "./textDiff";
14
+ /** What stands at the top level of a body: `control` is a block-level content control, `preserved` a block kept as the XML it arrived as */
15
+ export type BlockKind = "paragraph" | "table" | "control" | "preserved";
16
+ /** A row of a changed table: an added row by its index in the revised table, a removed one by its index in the original */
17
+ export type RowChange = {
18
+ kind: "added";
19
+ index: number;
20
+ cells: string[];
21
+ } | {
22
+ kind: "removed";
23
+ index: number;
24
+ cells: string[];
25
+ } | {
26
+ kind: "changed";
27
+ original: {
28
+ index: number;
29
+ cells: string[];
30
+ };
31
+ revised: {
32
+ index: number;
33
+ cells: string[];
34
+ };
35
+ };
36
+ /**
37
+ * A top-level block of the body that differs. An added block is placed by its `pos` in the revised
38
+ * document, a removed one by its `pos` in the original. A changed block is `formatting` where its
39
+ * text reads the same on both sides, and `text` otherwise, with the `edits` that turn one text
40
+ * into the other. A changed table also lists its `rows` whose cells read differently.
41
+ */
42
+ export type BlockChange = {
43
+ kind: "added";
44
+ block: BlockKind;
45
+ pos: number;
46
+ text: string;
47
+ } | {
48
+ kind: "removed";
49
+ block: BlockKind;
50
+ pos: number;
51
+ text: string;
52
+ } | {
53
+ kind: "changed";
54
+ block: Exclude<BlockKind, "table">;
55
+ original: {
56
+ pos: number;
57
+ text: string;
58
+ };
59
+ revised: {
60
+ pos: number;
61
+ text: string;
62
+ };
63
+ change: "text";
64
+ edits: TextEdit[];
65
+ } | {
66
+ kind: "changed";
67
+ block: Exclude<BlockKind, "table">;
68
+ original: {
69
+ pos: number;
70
+ text: string;
71
+ };
72
+ revised: {
73
+ pos: number;
74
+ text: string;
75
+ };
76
+ change: "formatting";
77
+ } | {
78
+ kind: "changed";
79
+ block: "table";
80
+ original: {
81
+ pos: number;
82
+ text: string;
83
+ };
84
+ revised: {
85
+ pos: number;
86
+ text: string;
87
+ };
88
+ change: "text";
89
+ edits: TextEdit[];
90
+ rows: RowChange[];
91
+ } | {
92
+ kind: "changed";
93
+ block: "table";
94
+ original: {
95
+ pos: number;
96
+ text: string;
97
+ };
98
+ revised: {
99
+ pos: number;
100
+ text: string;
101
+ };
102
+ change: "formatting";
103
+ rows: RowChange[];
104
+ };
105
+ /**
106
+ * A comment or reply that differs. Comments are matched by id, and one whose author differs
107
+ * between the two files is a different comment under a reused id, so it is removed and added.
108
+ */
109
+ export type CommentChange = {
110
+ kind: "added";
111
+ id: string;
112
+ author: string | null;
113
+ authorId: string | null;
114
+ text: string;
115
+ } | {
116
+ kind: "removed";
117
+ id: string;
118
+ author: string | null;
119
+ authorId: string | null;
120
+ text: string;
121
+ } | {
122
+ kind: "changed";
123
+ id: string;
124
+ author: string | null;
125
+ authorId: string | null;
126
+ original: string;
127
+ revised: string;
128
+ };
129
+ /** A package part beside the body and the comment parts whose bytes differ, or the main part where it differs outside the body blocks */
130
+ export interface PartChange {
131
+ part: string;
132
+ kind: "added" | "removed" | "changed";
133
+ }
134
+ /** What `compareDocx` found: the body's blocks in document order, the comments, and the parts sorted by path */
135
+ export interface DocxComparison {
136
+ blocks: BlockChange[];
137
+ comments: CommentChange[];
138
+ parts: PartChange[];
139
+ }
140
+ /** Every top-level node type the schema holds; one it gains fails the test that walks the block group */
141
+ export declare const BLOCK_KINDS: Readonly<Record<string, BlockKind>>;
142
+ /**
143
+ * Lists what differs between two DOCX files: the top-level blocks of the body, the comments and
144
+ * replies, and the package parts beside them. A block is compared with its comment markers taken
145
+ * out, so a comment added or removed is reported among the comments alone.
146
+ *
147
+ * @param original - the file to compare against, as an `ArrayBuffer` or `Uint8Array`
148
+ * @param revised - the file to compare, as an `ArrayBuffer` or `Uint8Array`
149
+ * @param options - `xmlParser` for a runtime with no `DOMParser` global
150
+ * @throws `DocxImportError` when either file is not a readable DOCX
151
+ */
152
+ export declare function compareDocx(original: DocxBytes, revised: DocxBytes, { xmlParser }?: {
153
+ xmlParser?: XmlParser;
154
+ }): DocxComparison;