@arbidocs/blocks 0.4.33 → 0.4.38

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 (78) hide show
  1. package/dist/agents/index.cjs +224 -224
  2. package/dist/agents/index.js +5 -5
  3. package/dist/chat/index.cjs +123 -123
  4. package/dist/chat/index.js +2 -2
  5. package/dist/{chunk-MZL67U2E.cjs → chunk-2EI7NCUA.cjs} +8 -3
  6. package/dist/chunk-2EI7NCUA.cjs.map +1 -0
  7. package/dist/{chunk-PXFJDX2C.js → chunk-4WWM3GQ5.js} +4 -3
  8. package/dist/chunk-4WWM3GQ5.js.map +1 -0
  9. package/dist/{chunk-6DNYPLCD.cjs → chunk-7RGLTF76.cjs} +4 -3
  10. package/dist/chunk-7RGLTF76.cjs.map +1 -0
  11. package/dist/{chunk-4AWS54US.js → chunk-CKB64Z4R.js} +4 -3
  12. package/dist/chunk-CKB64Z4R.js.map +1 -0
  13. package/dist/{chunk-6RXUMBTK.js → chunk-EA6YX3GR.js} +6 -6
  14. package/dist/{chunk-6RXUMBTK.js.map → chunk-EA6YX3GR.js.map} +1 -1
  15. package/dist/{chunk-AZ75JUIH.cjs → chunk-EEGPWOOG.cjs} +5 -5
  16. package/dist/{chunk-AZ75JUIH.cjs.map → chunk-EEGPWOOG.cjs.map} +1 -1
  17. package/dist/{chunk-6YVI74BC.js → chunk-JH25QIZW.js} +439 -12
  18. package/dist/chunk-JH25QIZW.js.map +1 -0
  19. package/dist/{chunk-DLVX6R6B.cjs → chunk-KMYLQIOH.cjs} +3 -3
  20. package/dist/{chunk-DLVX6R6B.cjs.map → chunk-KMYLQIOH.cjs.map} +1 -1
  21. package/dist/{chunk-V6U5KVAR.js → chunk-LQITIYBN.js} +3 -3
  22. package/dist/{chunk-V6U5KVAR.js.map → chunk-LQITIYBN.js.map} +1 -1
  23. package/dist/{chunk-VMCOH3AY.cjs → chunk-NUF2WGGF.cjs} +527 -96
  24. package/dist/chunk-NUF2WGGF.cjs.map +1 -0
  25. package/dist/{chunk-M2YGPC5N.cjs → chunk-SKFSJHVU.cjs} +4 -4
  26. package/dist/{chunk-M2YGPC5N.cjs.map → chunk-SKFSJHVU.cjs.map} +1 -1
  27. package/dist/{chunk-24KQJYSB.js → chunk-SWON6O45.js} +3 -3
  28. package/dist/{chunk-24KQJYSB.js.map → chunk-SWON6O45.js.map} +1 -1
  29. package/dist/{chunk-SEQWI6E4.cjs → chunk-XDTYENKC.cjs} +21 -21
  30. package/dist/{chunk-SEQWI6E4.cjs.map → chunk-XDTYENKC.cjs.map} +1 -1
  31. package/dist/{chunk-2QTT2RZE.cjs → chunk-YJQVLVBJ.cjs} +4 -3
  32. package/dist/chunk-YJQVLVBJ.cjs.map +1 -0
  33. package/dist/{chunk-C7FGONCM.js → chunk-YU2KUMGE.js} +8 -3
  34. package/dist/chunk-YU2KUMGE.js.map +1 -0
  35. package/dist/{chunk-XWEJ5LV2.js → chunk-ZXYHBQFW.js} +3 -3
  36. package/dist/{chunk-XWEJ5LV2.js.map → chunk-ZXYHBQFW.js.map} +1 -1
  37. package/dist/connect/docx.cjs +4 -4
  38. package/dist/connect/docx.js +1 -1
  39. package/dist/connect/index.cjs +12 -12
  40. package/dist/connect/index.js +3 -3
  41. package/dist/docx/NativeDocxEditor.d.ts +2 -2
  42. package/dist/docx/index.cjs +33 -30
  43. package/dist/docx/index.cjs.map +1 -1
  44. package/dist/docx/index.d.ts +2 -2
  45. package/dist/docx/index.js +3 -4
  46. package/dist/docx/index.js.map +1 -1
  47. package/dist/docx/review/DocxEditorReview.d.ts +16 -0
  48. package/dist/docx/review/index.d.ts +3 -0
  49. package/dist/docx/review/reviewModule.d.ts +6 -0
  50. package/dist/docx/review/useReview.d.ts +29 -0
  51. package/dist/facts/index.cjs +8 -8
  52. package/dist/facts/index.js +4 -4
  53. package/dist/files/ExplorerSurface.d.ts +6 -2
  54. package/dist/files/index.cjs +27 -14
  55. package/dist/files/index.cjs.map +1 -1
  56. package/dist/files/index.js +26 -13
  57. package/dist/files/index.js.map +1 -1
  58. package/dist/index.cjs +683 -683
  59. package/dist/index.js +13 -13
  60. package/dist/settings/TriStateFilterMenu.d.ts +3 -1
  61. package/dist/settings/index.cjs +9 -9
  62. package/dist/settings/index.js +2 -2
  63. package/dist/shell/FilterInput.d.ts +3 -1
  64. package/dist/shell/TabHeader.d.ts +2 -0
  65. package/dist/shell/index.cjs +7 -7
  66. package/dist/shell/index.js +2 -2
  67. package/dist/studio/index.cjs +3 -3
  68. package/dist/studio/index.js +2 -2
  69. package/package.json +9 -13
  70. package/src/docx/styles.css +488 -43
  71. package/dist/chunk-2QTT2RZE.cjs.map +0 -1
  72. package/dist/chunk-4AWS54US.js.map +0 -1
  73. package/dist/chunk-6DNYPLCD.cjs.map +0 -1
  74. package/dist/chunk-6YVI74BC.js.map +0 -1
  75. package/dist/chunk-C7FGONCM.js.map +0 -1
  76. package/dist/chunk-MZL67U2E.cjs.map +0 -1
  77. package/dist/chunk-PXFJDX2C.js.map +0 -1
  78. package/dist/chunk-VMCOH3AY.cjs.map +0 -1
@@ -1,17 +1,16 @@
1
1
  "use client";
2
2
  import { filterMentionCandidates, MentionMenu, findMentionQuery, extractMentions } from './chunk-AA3PT6KR.js';
3
3
  import { unzipSync, strFromU8, strToU8, zipSync } from 'fflate';
4
- import React2, { createContext, useContext, useState, useRef, useEffect, useLayoutEffect } from 'react';
4
+ import { collectReviewItems, revisionItemsOf } from '@docx-editor.dev/core/store';
5
+ import React3, { createContext, useContext, useState, useRef, useCallback, useEffect, useLayoutEffect, useMemo } from 'react';
6
+ import { useDocxEditor, ReviewRailContext, useEditorSnapshot, useChromeTranslate, DocxEditor, createFontSource } from '@docx-editor.dev/react';
7
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
8
  import { createPortal } from 'react-dom';
6
- import { useReviewItem, useReview, DocxEditorReview, reviewModule } from '@docx-editor.dev/pro/react';
7
9
  import { Dialog, DialogContent, DialogHeader, DialogTitle, splitMarkdownBlocks, AiMarkdown } from '@arbidocs/react/ui';
8
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
10
  import { renderToStaticMarkup } from 'react-dom/server';
10
11
  import * as Y from 'yjs';
11
- import { useChromeTranslate, DocxEditor, createFontSource } from '@docx-editor.dev/react';
12
- import { collaborationModule } from '@docx-editor.dev/pro';
13
- import { DOCUMENT_COLLABORATION_VERSIONS } from '@docx-editor.dev/pro/collaboration';
14
- import { createHocuspocusCollaboration } from '@docx-editor.dev/pro/collaboration/hocuspocus';
12
+ import { DOCUMENT_COLLABORATION_VERSIONS, collaborationModule } from '@arbidocs/coedit';
13
+ import { createHocuspocusCollaboration } from '@arbidocs/coedit/hocuspocus';
15
14
  import { Type, Ellipsis, WifiOff, Check, Download, Save, RefreshCw } from 'lucide-react';
16
15
 
17
16
  function normalizeDocxExport(data) {
@@ -78,6 +77,435 @@ function normalizeDocxExport(data) {
78
77
  if (!changed) return data;
79
78
  return zipSync(files).slice().buffer;
80
79
  }
80
+ function findNode(node, id) {
81
+ if (node.id === id) return node;
82
+ for (const child of node.children ?? []) {
83
+ const found = findNode(child, id);
84
+ if (found) return found;
85
+ }
86
+ return void 0;
87
+ }
88
+ function revisionItemsOfParagraph(part, paragraphId) {
89
+ const paragraph = findNode(part.root, paragraphId);
90
+ if (!paragraph) return [];
91
+ return revisionItemsOf({ ...part, root: paragraph });
92
+ }
93
+ function reviewModule() {
94
+ return {
95
+ id: "review",
96
+ review: {
97
+ displayModes: ["all-markup", "simple-markup", "proposed", "original"],
98
+ collectReviewItems,
99
+ revisionItemsOfParagraph
100
+ }
101
+ };
102
+ }
103
+ var NONE = [];
104
+ var ok = (result) => result?.ok === true;
105
+ function useReview() {
106
+ const editor = useDocxEditor();
107
+ const version = useEditorSnapshot(editor);
108
+ const revision = editor?.getReviewRevision() ?? 0;
109
+ const items = useMemo(() => editor ? editor.getReviewItems() : NONE, [editor, revision]);
110
+ const paneOpen = editor?.isReviewPaneOpen() ?? false;
111
+ const activeKey = items.find((item) => item.isActive)?.key ?? null;
112
+ return useMemo(
113
+ () => ({
114
+ ready: editor !== null,
115
+ items,
116
+ activeKey,
117
+ paneOpen,
118
+ setPaneOpen: (open) => {
119
+ if (editor && editor.isReviewPaneOpen() !== open) editor.exec({ type: "toggleReviewPane" });
120
+ },
121
+ setActive: (key, options) => ok(editor?.setActiveReviewItem(key, options)),
122
+ reply: (entry, text) => ok(editor?.replyToReviewItem(entry.key, text)),
123
+ accept: (entry) => ok(editor?.acceptReviewItem(entry.key)),
124
+ reject: (entry) => ok(editor?.rejectReviewItem(entry.key)),
125
+ resolve: (entry, resolved) => ok(editor?.setCommentResolved(entry.key, resolved)),
126
+ remove: (entry) => ok(editor?.deleteReviewItem(entry.key)),
127
+ addComment: (text) => ok(editor?.addComment(text)),
128
+ navigate: (direction) => ok(editor?.exec({ type: "navigateReviewChange", direction })),
129
+ resolveAll: (action) => ok(editor?.exec({ type: "resolveAllReviewChanges", action }))
130
+ }),
131
+ [editor, items, activeKey, paneOpen, version]
132
+ );
133
+ }
134
+ var ReviewItemContext = createContext(null);
135
+ function useReviewItem() {
136
+ return useContext(ReviewItemContext);
137
+ }
138
+ var CARD_GAP = 8;
139
+ var REVISION_LABELS = {
140
+ insert: "Inserted",
141
+ delete: "Deleted",
142
+ replace: "Replaced",
143
+ moveFrom: "Moved from here",
144
+ moveTo: "Moved to here",
145
+ format: "Formatted",
146
+ paragraphMark: "Paragraph break",
147
+ structural: "Table change"
148
+ };
149
+ function isTopLevel(entry) {
150
+ if (entry.kind === "comment") return !entry.parentId && !entry.parentRevisionId;
151
+ if (entry.kind === "custom") return entry.item.carded;
152
+ return true;
153
+ }
154
+ function formatDate(value) {
155
+ if (!value) return "";
156
+ const date = new Date(value);
157
+ return Number.isNaN(date.getTime()) ? "" : date.toLocaleString();
158
+ }
159
+ function Avatar({ entry }) {
160
+ return /* @__PURE__ */ jsx("span", { className: "native-docx-review-avatar", "aria-hidden": "true", children: entry.initials });
161
+ }
162
+ function Message({ entry }) {
163
+ return /* @__PURE__ */ jsxs("div", { className: "native-docx-review-message", children: [
164
+ /* @__PURE__ */ jsxs("div", { className: "native-docx-review-byline", children: [
165
+ /* @__PURE__ */ jsx(Avatar, { entry }),
166
+ /* @__PURE__ */ jsx("span", { className: "native-docx-review-author", children: entry.author || "Reviewer" }),
167
+ /* @__PURE__ */ jsx("time", { className: "native-docx-review-date", children: formatDate(entry.date) })
168
+ ] }),
169
+ /* @__PURE__ */ jsx("p", { className: "native-docx-review-text", "data-testid": "review-text", children: entry.text })
170
+ ] });
171
+ }
172
+ function ReplyForm({
173
+ entry,
174
+ review
175
+ }) {
176
+ const [text, setText] = useState("");
177
+ return /* @__PURE__ */ jsxs(
178
+ "form",
179
+ {
180
+ className: "native-docx-review-reply",
181
+ onSubmit: (event) => {
182
+ event.preventDefault();
183
+ const value = text.trim();
184
+ if (value && review.reply(entry, value)) setText("");
185
+ },
186
+ children: [
187
+ /* @__PURE__ */ jsx(
188
+ "input",
189
+ {
190
+ "data-testid": "review-reply-input",
191
+ "aria-label": "Reply",
192
+ placeholder: "Reply",
193
+ value: text,
194
+ onChange: (event) => setText(event.target.value),
195
+ onKeyDown: (event) => {
196
+ if (event.key === "Escape") {
197
+ event.stopPropagation();
198
+ review.setActive(null);
199
+ }
200
+ }
201
+ }
202
+ ),
203
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: !text.trim(), children: "Reply" }),
204
+ /* @__PURE__ */ jsx(
205
+ "button",
206
+ {
207
+ type: "button",
208
+ "data-testid": "review-reply-cancel",
209
+ onClick: () => review.setActive(null),
210
+ children: "Cancel"
211
+ }
212
+ )
213
+ ]
214
+ }
215
+ );
216
+ }
217
+ function Card({
218
+ entry,
219
+ replies,
220
+ review,
221
+ extra,
222
+ cardRef,
223
+ top
224
+ }) {
225
+ const resolved = entry.kind === "comment" && entry.resolved;
226
+ return /* @__PURE__ */ jsx(ReviewItemContext.Provider, { value: entry, children: /* @__PURE__ */ jsxs(
227
+ "article",
228
+ {
229
+ ref: cardRef,
230
+ className: "native-docx-review-card",
231
+ tabIndex: 0,
232
+ "aria-label": `${entry.kind === "revision" ? "Change" : "Comment"} by ${entry.author || "reviewer"}`,
233
+ onKeyDown: (event) => {
234
+ if (event.target !== event.currentTarget) return;
235
+ if ((event.key === "Enter" || event.key === " ") && entry.activatable) {
236
+ event.preventDefault();
237
+ review.setActive(entry.key);
238
+ }
239
+ },
240
+ "data-testid": "review-card",
241
+ "data-kind": entry.kind,
242
+ "data-active": entry.isActive || void 0,
243
+ "data-resolved": resolved || void 0,
244
+ style: { top },
245
+ onClick: () => {
246
+ if (entry.activatable && !entry.isActive) review.setActive(entry.key);
247
+ },
248
+ children: [
249
+ entry.kind === "revision" && /* @__PURE__ */ jsx("div", { className: "native-docx-review-kind", children: REVISION_LABELS[entry.revisionKind] ?? "Change" }),
250
+ /* @__PURE__ */ jsx(Message, { entry }),
251
+ replies.map((reply) => /* @__PURE__ */ jsx(Message, { entry: reply }, reply.key)),
252
+ extra,
253
+ /* @__PURE__ */ jsxs("div", { className: "native-docx-review-actions", children: [
254
+ entry.kind === "revision" && !entry.readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
255
+ /* @__PURE__ */ jsx(
256
+ "button",
257
+ {
258
+ type: "button",
259
+ "data-testid": "review-accept",
260
+ onClick: () => review.accept(entry),
261
+ children: "Accept"
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsx(
265
+ "button",
266
+ {
267
+ type: "button",
268
+ "data-testid": "review-reject",
269
+ onClick: () => review.reject(entry),
270
+ children: "Reject"
271
+ }
272
+ )
273
+ ] }),
274
+ entry.kind === "comment" && /* @__PURE__ */ jsxs(Fragment, { children: [
275
+ /* @__PURE__ */ jsx(
276
+ "button",
277
+ {
278
+ type: "button",
279
+ "data-testid": "review-resolve",
280
+ onClick: () => review.resolve(entry, !entry.resolved),
281
+ children: entry.resolved ? "Reopen" : "Resolve"
282
+ }
283
+ ),
284
+ /* @__PURE__ */ jsx(
285
+ "button",
286
+ {
287
+ type: "button",
288
+ "data-testid": "review-delete",
289
+ onClick: () => review.remove(entry),
290
+ children: "Delete"
291
+ }
292
+ )
293
+ ] })
294
+ ] }),
295
+ entry.isActive && entry.kind !== "custom" && /* @__PURE__ */ jsx(ReplyForm, { entry, review })
296
+ ]
297
+ }
298
+ ) });
299
+ }
300
+ function Draft({
301
+ top,
302
+ onSubmit,
303
+ onCancel,
304
+ formRef
305
+ }) {
306
+ const [text, setText] = useState("");
307
+ const input = useRef(null);
308
+ useEffect(() => input.current?.focus(), []);
309
+ return /* @__PURE__ */ jsxs(
310
+ "form",
311
+ {
312
+ ref: formRef,
313
+ className: "native-docx-review-card native-docx-review-draft",
314
+ "data-testid": "review-draft",
315
+ style: { top },
316
+ onSubmit: (event) => {
317
+ event.preventDefault();
318
+ if (text.trim()) onSubmit(text.trim());
319
+ },
320
+ children: [
321
+ /* @__PURE__ */ jsx(
322
+ "input",
323
+ {
324
+ ref: input,
325
+ "data-testid": "review-draft-input",
326
+ "aria-label": "Comment",
327
+ placeholder: "Add a comment",
328
+ value: text,
329
+ onChange: (event) => setText(event.target.value),
330
+ onKeyDown: (event) => {
331
+ if (event.key === "Escape") onCancel();
332
+ }
333
+ }
334
+ ),
335
+ /* @__PURE__ */ jsxs("div", { className: "native-docx-review-actions", children: [
336
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: !text.trim(), children: "Comment" }),
337
+ /* @__PURE__ */ jsx("button", { type: "button", "data-testid": "review-draft-cancel", onClick: onCancel, children: "Cancel" })
338
+ ] })
339
+ ]
340
+ }
341
+ );
342
+ }
343
+ function DocxEditorReviewRail({
344
+ children
345
+ }) {
346
+ const editor = useDocxEditor();
347
+ const registry = useContext(ReviewRailContext);
348
+ const review = useReview();
349
+ const [draft, setDraft] = useState(null);
350
+ const [tops, setTops] = useState({});
351
+ const [showResolved, setShowResolved] = useState(true);
352
+ const elements = useRef(/* @__PURE__ */ new Map());
353
+ const openDraft = useCallback(() => {
354
+ const placement = editor?.getSelectionPlacement();
355
+ if (!placement) return;
356
+ review.setPaneOpen(true);
357
+ setDraft({ anchorY: placement.anchorY });
358
+ }, [editor, review.setPaneOpen]);
359
+ useEffect(() => registry?.register(), [registry]);
360
+ useEffect(() => registry?.registerCommentDraft(openDraft), [registry, openDraft]);
361
+ const scale = editor?.getRenderScale() ?? 1;
362
+ const top = review.items.filter(isTopLevel).filter((entry) => entry.anchorY !== null).filter((entry) => showResolved || entry.kind !== "comment" || !entry.resolved);
363
+ const hasChanges = review.items.some((entry) => entry.kind === "revision");
364
+ const hasResolved = review.items.some((entry) => entry.kind === "comment" && entry.resolved);
365
+ const repliesOf = useCallback(
366
+ (entry) => review.items.filter(
367
+ (other) => other.kind === "comment" && (other.parentId === entry.id || other.parentRevisionId === entry.id)
368
+ ),
369
+ [review.items]
370
+ );
371
+ useLayoutEffect(() => {
372
+ if (!review.paneOpen) return;
373
+ const next = {};
374
+ let floor = 0;
375
+ const rows = top.map((entry) => ({
376
+ key: entry.key,
377
+ y: (entry.anchorY ?? 0) * scale
378
+ }));
379
+ if (draft) rows.push({ key: "__draft", y: draft.anchorY * scale });
380
+ rows.sort((a, b) => a.y - b.y);
381
+ for (const row of rows) {
382
+ const y = Math.max(row.y, floor);
383
+ next[row.key] = y;
384
+ const height = elements.current.get(row.key)?.offsetHeight ?? 96;
385
+ floor = y + height + CARD_GAP;
386
+ }
387
+ setTops((previous) => {
388
+ const same = Object.keys(next).length === Object.keys(previous).length && Object.entries(next).every(([key, value]) => previous[key] === value);
389
+ return same ? previous : next;
390
+ });
391
+ });
392
+ if (!review.ready) return null;
393
+ const selection = editor?.getSelectionPlacement();
394
+ const addComment = selection && /* @__PURE__ */ jsx(
395
+ "button",
396
+ {
397
+ type: "button",
398
+ className: "native-docx-review-add",
399
+ "data-testid": "review-add-comment",
400
+ "aria-label": "Add comment",
401
+ style: { top: selection.anchorY * scale },
402
+ onMouseDown: (event) => event.preventDefault(),
403
+ onClick: openDraft,
404
+ children: "+"
405
+ }
406
+ );
407
+ if (!review.paneOpen) {
408
+ return /* @__PURE__ */ jsxs("div", { className: "native-docx-review-markers", "data-testid": "review-markers", children: [
409
+ addComment,
410
+ top.map((entry) => /* @__PURE__ */ jsx(
411
+ "button",
412
+ {
413
+ type: "button",
414
+ className: "native-docx-review-marker",
415
+ "data-testid": "review-marker",
416
+ "data-kind": entry.kind,
417
+ "aria-label": `${entry.author}: ${entry.text.slice(0, 60)}`,
418
+ style: { top: (entry.anchorY ?? 0) * scale },
419
+ onClick: () => {
420
+ review.setPaneOpen(true);
421
+ review.setActive(entry.key);
422
+ }
423
+ },
424
+ entry.key
425
+ ))
426
+ ] });
427
+ }
428
+ return /* @__PURE__ */ jsxs("aside", { className: "native-docx-review-pane", "data-testid": "review-pane", "aria-label": "Review", children: [
429
+ addComment,
430
+ /* @__PURE__ */ jsxs("div", { className: "native-docx-review-toolbar", "data-testid": "review-toolbar", children: [
431
+ hasChanges && /* @__PURE__ */ jsxs(Fragment, { children: [
432
+ /* @__PURE__ */ jsx(
433
+ "button",
434
+ {
435
+ type: "button",
436
+ "data-testid": "review-previous",
437
+ onClick: () => review.navigate("previous"),
438
+ children: "Previous change"
439
+ }
440
+ ),
441
+ /* @__PURE__ */ jsx("button", { type: "button", "data-testid": "review-next", onClick: () => review.navigate("next"), children: "Next change" }),
442
+ /* @__PURE__ */ jsx(
443
+ "button",
444
+ {
445
+ type: "button",
446
+ "data-testid": "review-accept-all",
447
+ onClick: () => review.resolveAll("accept"),
448
+ children: "Accept all"
449
+ }
450
+ ),
451
+ /* @__PURE__ */ jsx(
452
+ "button",
453
+ {
454
+ type: "button",
455
+ "data-testid": "review-reject-all",
456
+ onClick: () => review.resolveAll("reject"),
457
+ children: "Reject all"
458
+ }
459
+ )
460
+ ] }),
461
+ hasResolved && /* @__PURE__ */ jsxs("label", { children: [
462
+ /* @__PURE__ */ jsx(
463
+ "input",
464
+ {
465
+ type: "checkbox",
466
+ "data-testid": "review-show-resolved",
467
+ checked: showResolved,
468
+ onChange: (event) => setShowResolved(event.target.checked)
469
+ }
470
+ ),
471
+ "Show resolved"
472
+ ] })
473
+ ] }),
474
+ draft && /* @__PURE__ */ jsx(
475
+ Draft,
476
+ {
477
+ top: tops.__draft ?? draft.anchorY * scale,
478
+ formRef: (element) => {
479
+ if (element) elements.current.set("__draft", element);
480
+ },
481
+ onCancel: () => setDraft(null),
482
+ onSubmit: (text) => {
483
+ if (review.addComment(text)) setDraft(null);
484
+ }
485
+ }
486
+ ),
487
+ top.map((entry) => /* @__PURE__ */ jsx(
488
+ Card,
489
+ {
490
+ entry,
491
+ replies: repliesOf(entry),
492
+ review,
493
+ extra: children?.(entry),
494
+ top: tops[entry.key] ?? (entry.anchorY ?? 0) * scale,
495
+ cardRef: (element) => {
496
+ if (element) elements.current.set(entry.key, element);
497
+ else elements.current.delete(entry.key);
498
+ }
499
+ },
500
+ entry.key
501
+ )),
502
+ top.length === 0 && !draft && /* @__PURE__ */ jsx("p", { className: "native-docx-review-empty", "data-testid": "review-empty", children: "No comments or changes." })
503
+ ] });
504
+ }
505
+ function ReviewCardSlot({ children }) {
506
+ return /* @__PURE__ */ jsx("div", { className: "native-docx-review-extra", children });
507
+ }
508
+ var DocxEditorReview = Object.assign(DocxEditorReviewRail, { Card: ReviewCardSlot });
81
509
 
82
510
  // src/docx/mentions.ts
83
511
  function mentionCandidates(mentions) {
@@ -585,7 +1013,7 @@ function covered(room, vector, receipt) {
585
1013
  }
586
1014
  return true;
587
1015
  }
588
- var EditorBoundary = class extends React2.Component {
1016
+ var EditorBoundary = class extends React3.Component {
589
1017
  state = {};
590
1018
  static getDerivedStateFromError(error) {
591
1019
  return { error };
@@ -802,7 +1230,6 @@ function NativeDocxEditor({
802
1230
  url: ws.toString(),
803
1231
  roomId: session.room_id,
804
1232
  identity: session.identity,
805
- bootstrap: { kind: "join" },
806
1233
  offlineEditing: true,
807
1234
  token: async () => {
808
1235
  const next = initial ? session : await adapter.open(documentId);
@@ -1231,6 +1658,6 @@ function StreamedWordArtifact({
1231
1658
  );
1232
1659
  }
1233
1660
 
1234
- export { DocxCommentActivity, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, StreamedWordArtifact, loadDocxFonts, normalizeDocxExport };
1235
- //# sourceMappingURL=chunk-6YVI74BC.js.map
1236
- //# sourceMappingURL=chunk-6YVI74BC.js.map
1661
+ export { DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, StreamedWordArtifact, loadDocxFonts, normalizeDocxExport, reviewModule, useReview, useReviewItem };
1662
+ //# sourceMappingURL=chunk-JH25QIZW.js.map
1663
+ //# sourceMappingURL=chunk-JH25QIZW.js.map