@stll/folio-react 0.6.0 → 0.8.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 (30) hide show
  1. package/dist/{CommentsSidebar-_utmEkA9.js → CommentsSidebar-Byn5lyrt.js} +127 -130
  2. package/dist/{FindReplaceDialog-DLdBekSR.js → FindReplaceDialog-CqKK82nE.js} +23 -18
  3. package/dist/FootnotePropertiesDialog-CixRdIiT.js +822 -0
  4. package/dist/ImagePositionDialog-DNodkoI2.js +1065 -0
  5. package/dist/ImagePropertiesDialog-CLsDIUWb.js +613 -0
  6. package/dist/InsertSymbolDialog-DCFLmfzn.js +376 -0
  7. package/dist/PageSetupDialog-COkgeOQn.js +820 -0
  8. package/dist/TablePropertiesDialog-B_AGrPR8.js +434 -0
  9. package/dist/{TextContextMenu-CG0V37wi.js → TextContextMenu-Ci7-M4oU.js} +199 -79
  10. package/dist/compat/eigenpal.d.ts +1 -1
  11. package/dist/compat/eigenpal.js +89 -17
  12. package/dist/dialogChrome-BoGYPgeu.js +26 -0
  13. package/dist/{dialogs-CzvXYJyG.js → dialogs-Bj2PdycR.js} +608 -352
  14. package/dist/{dialogs-j7qyw17x.d.ts → dialogs-DK8OVUT_.d.ts} +13 -1
  15. package/dist/dialogs.d.ts +2 -2
  16. package/dist/dialogs.js +9 -8
  17. package/dist/editor.css +1 -1
  18. package/dist/folio-ui-BgDDRsUX.js +1013 -0
  19. package/dist/index.d.ts +5 -4
  20. package/dist/index.js +12 -11
  21. package/dist/{renderAsync-B7UJsZye.d.ts → renderAsync-BmxQE7iO.d.ts} +12 -3
  22. package/dist/{renderAsync-CwHTsxBN.js → renderAsync-BtWYvQMT.js} +5717 -3275
  23. package/dist/standalone.css +1 -1
  24. package/package.json +8 -6
  25. package/dist/FootnotePropertiesDialog-CUjq9c6H.js +0 -267
  26. package/dist/ImagePositionDialog-BMuO9rLT.js +0 -395
  27. package/dist/ImagePropertiesDialog-C8iEgdmN.js +0 -198
  28. package/dist/PageSetupDialog-BKsSMCGb.js +0 -312
  29. package/dist/TablePropertiesDialog-Dw8gvL78.js +0 -159
  30. package/dist/useFindReplace-BPBpMWS9.js +0 -842
@@ -1,4 +1,4 @@
1
- import { d as containedHandler } from "./renderAsync-CwHTsxBN.js";
1
+ import { d as containedHandler } from "./renderAsync-BtWYvQMT.js";
2
2
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { CheckIcon, MoreVerticalIcon } from "lucide-react";
4
4
  import { useLocale, useTranslations } from "use-intl";
@@ -124,16 +124,16 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
124
124
  comments.length
125
125
  ]);
126
126
  useEffect(() => {
127
- const scrollEl = editorContainerRef?.current;
128
- if (!scrollEl) return;
127
+ const scrollEl_0 = editorContainerRef?.current;
128
+ if (!scrollEl_0) return;
129
129
  const resizeObserver = new ResizeObserver(updateSidebarLeft);
130
- resizeObserver.observe(scrollEl);
130
+ resizeObserver.observe(scrollEl_0);
131
131
  const handleScroll = () => updateSidebarLeft();
132
- scrollEl.addEventListener("scroll", handleScroll, { passive: true });
132
+ scrollEl_0.addEventListener("scroll", handleScroll, { passive: true });
133
133
  window.addEventListener("resize", handleScroll);
134
134
  return () => {
135
135
  resizeObserver.disconnect();
136
- scrollEl.removeEventListener("scroll", handleScroll);
136
+ scrollEl_0.removeEventListener("scroll", handleScroll);
137
137
  window.removeEventListener("resize", handleScroll);
138
138
  };
139
139
  }, [editorContainerRef, updateSidebarLeft]);
@@ -145,12 +145,12 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
145
145
  }), [comments, showResolved]);
146
146
  const repliesByParent = useMemo(() => {
147
147
  const map = /* @__PURE__ */ new Map();
148
- for (const c of comments) {
149
- const parentId = getCommentParentId(c);
150
- if (parentId !== null && parentId !== void 0) {
151
- const arr = map.get(parentId);
152
- if (arr) arr.push(c);
153
- else map.set(parentId, [c]);
148
+ for (const c_0 of comments) {
149
+ const parentId_0 = getCommentParentId(c_0);
150
+ if (parentId_0 !== null && parentId_0 !== void 0) {
151
+ const arr = map.get(parentId_0);
152
+ if (arr) arr.push(c_0);
153
+ else map.set(parentId_0, [c_0]);
154
154
  }
155
155
  }
156
156
  return map;
@@ -227,15 +227,15 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
227
227
  activeCommentId
228
228
  ]);
229
229
  useEffect(() => {
230
- const container = editorContainerRef?.current;
231
- if (!container) return;
232
- const pagesEl = container.querySelector(".paged-editor__pages");
233
- if (!pagesEl) return;
230
+ const container_0 = editorContainerRef?.current;
231
+ if (!container_0) return;
232
+ const pagesEl_0 = container_0.querySelector(".paged-editor__pages");
233
+ if (!pagesEl_0) return;
234
234
  const handleDocClick = (e) => {
235
235
  const target = e.target;
236
236
  if (!(target instanceof Element)) return;
237
237
  if (sidebarRef.current?.contains(target)) return;
238
- if (pagesEl.contains(target)) {
238
+ if (pagesEl_0.contains(target)) {
239
239
  const commentEl = closestHtmlElement(target, "[data-comment-id]");
240
240
  if (commentEl?.dataset["commentId"]) {
241
241
  setExpandedCard(`comment-${commentEl.dataset["commentId"]}`);
@@ -246,30 +246,30 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
246
246
  setExpandedCard(null);
247
247
  setMenuOpenFor(null);
248
248
  };
249
- container.addEventListener("click", handleDocClick);
250
- return () => container.removeEventListener("click", handleDocClick);
249
+ container_0.addEventListener("click", handleDocClick);
250
+ return () => container_0.removeEventListener("click", handleDocClick);
251
251
  }, [editorContainerRef, onCommentClick]);
252
252
  useEffect(() => {
253
- const container = editorContainerRef?.current;
254
- if (!container) return;
253
+ const container_1 = editorContainerRef?.current;
254
+ if (!container_1) return;
255
255
  const timerQuick = setTimeout(updateCardPositions, 50);
256
256
  const timerFull = setTimeout(() => {
257
257
  updateCardPositions();
258
258
  setInitialPositionsDone(true);
259
259
  }, 400);
260
- const resizeObserver = new ResizeObserver(() => {
260
+ const resizeObserver_0 = new ResizeObserver(() => {
261
261
  requestAnimationFrame(updateCardPositions);
262
262
  });
263
- resizeObserver.observe(container);
263
+ resizeObserver_0.observe(container_1);
264
264
  return () => {
265
265
  clearTimeout(timerQuick);
266
266
  clearTimeout(timerFull);
267
- resizeObserver.disconnect();
267
+ resizeObserver_0.disconnect();
268
268
  };
269
269
  }, [updateCardPositions, editorContainerRef]);
270
270
  useEffect(() => {
271
- const container = editorContainerRef?.current;
272
- if (!container) return;
271
+ const container_2 = editorContainerRef?.current;
272
+ if (!container_2) return;
273
273
  let rafId = null;
274
274
  const scheduleUpdate = () => {
275
275
  if (rafId !== null) return;
@@ -278,10 +278,10 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
278
278
  updateCardPositions();
279
279
  });
280
280
  };
281
- container.addEventListener("scroll", scheduleUpdate, { passive: true });
281
+ container_2.addEventListener("scroll", scheduleUpdate, { passive: true });
282
282
  return () => {
283
283
  if (rafId !== null) cancelAnimationFrame(rafId);
284
- container.removeEventListener("scroll", scheduleUpdate);
284
+ container_2.removeEventListener("scroll", scheduleUpdate);
285
285
  };
286
286
  }, [editorContainerRef, updateCardPositions]);
287
287
  useEffect(() => {
@@ -295,20 +295,20 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
295
295
  useEffect(() => {
296
296
  const targets = [];
297
297
  if (expandedCard) {
298
- const el = cardRefs.current.get(expandedCard);
299
- if (el) targets.push(el);
298
+ const el_0 = cardRefs.current.get(expandedCard);
299
+ if (el_0) targets.push(el_0);
300
300
  }
301
301
  const addEl = cardRefs.current.get("new-comment-input");
302
302
  if (addEl) targets.push(addEl);
303
303
  if (targets.length === 0) return;
304
- let rafId;
304
+ let rafId_0;
305
305
  const observer = new ResizeObserver(() => {
306
- cancelAnimationFrame(rafId);
307
- rafId = requestAnimationFrame(updateCardPositions);
306
+ cancelAnimationFrame(rafId_0);
307
+ rafId_0 = requestAnimationFrame(updateCardPositions);
308
308
  });
309
- for (const el of targets) observer.observe(el);
309
+ for (const el_1 of targets) observer.observe(el_1);
310
310
  return () => {
311
- cancelAnimationFrame(rafId);
311
+ cancelAnimationFrame(rafId_0);
312
312
  observer.disconnect();
313
313
  };
314
314
  }, [expandedCard, updateCardPositions]);
@@ -321,11 +321,11 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
321
321
  if (activeCommentId === null) return;
322
322
  setExpandedCard(`comment-${activeCommentId}`);
323
323
  }, [activeCommentId]);
324
- const handleCardClick = (cardId, commentId) => {
325
- const nextExpandedCard = expandedCard === cardId ? null : cardId;
324
+ const handleCardClick = (cardId_0, commentId_0) => {
325
+ const nextExpandedCard = expandedCard === cardId_0 ? null : cardId_0;
326
326
  setExpandedCard(nextExpandedCard);
327
327
  setMenuOpenFor(null);
328
- if (commentId !== void 0) onCommentClick?.(nextExpandedCard === null && activeCommentId === commentId ? null : commentId);
328
+ if (commentId_0 !== void 0) onCommentClick?.(nextExpandedCard === null && activeCommentId === commentId_0 ? null : commentId_0);
329
329
  };
330
330
  const hasPositions = cardPositions.size > 0;
331
331
  const avatarStyle = (name, size = 28) => ({
@@ -353,9 +353,9 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
353
353
  fontWeight: 500,
354
354
  fontFamily: "inherit"
355
355
  });
356
- const cardContainerStyle = (cardId, isExpanded, yPos) => {
357
- const isKnown = knownCardsRef.current.has(cardId);
358
- if (yPos !== void 0) knownCardsRef.current.add(cardId);
356
+ const cardContainerStyle = (cardId_1, isExpanded, yPos) => {
357
+ const isKnown = knownCardsRef.current.has(cardId_1);
358
+ if (yPos !== void 0) knownCardsRef.current.add(cardId_1);
359
359
  const isNewCard = !isKnown && yPos !== void 0;
360
360
  const noPosition = hasPositions && yPos === void 0;
361
361
  const positionStyle = (() => {
@@ -389,13 +389,13 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
389
389
  transition
390
390
  };
391
391
  };
392
- const renderReplies = (replies, isExpanded) => {
392
+ const renderReplies = (replies, isExpanded_0) => {
393
393
  if (replies.length === 0) return null;
394
394
  return /* @__PURE__ */ jsxs("div", {
395
395
  style: { marginTop: 8 },
396
- children: [(isExpanded ? replies : replies.slice(-1)).map((reply) => /* @__PURE__ */ jsxs("div", {
396
+ children: [(isExpanded_0 ? replies : replies.slice(-1)).map((reply) => /* @__PURE__ */ jsxs("div", {
397
397
  style: {
398
- marginBottom: isExpanded ? 6 : 0,
398
+ marginBottom: isExpanded_0 ? 6 : 0,
399
399
  paddingTop: 6,
400
400
  borderTop: "1px solid var(--doc-border)"
401
401
  },
@@ -434,7 +434,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
434
434
  color: "var(--doc-text)",
435
435
  lineHeight: "17px",
436
436
  marginTop: 4,
437
- ...!isExpanded ? {
437
+ ...!isExpanded_0 ? {
438
438
  overflow: "hidden",
439
439
  display: "-webkit-box",
440
440
  WebkitLineClamp: 2,
@@ -443,7 +443,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
443
443
  },
444
444
  children: getCommentText(reply.content)
445
445
  })]
446
- }, reply.id)), !isExpanded && replies.length > 1 && /* @__PURE__ */ jsx("div", {
446
+ }, reply.id)), !isExpanded_0 && replies.length > 1 && /* @__PURE__ */ jsx("div", {
447
447
  style: {
448
448
  fontSize: 11,
449
449
  color: "var(--doc-text-muted)",
@@ -454,25 +454,25 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
454
454
  });
455
455
  };
456
456
  const renderReplySection = (replyKey, submitFn) => /* @__PURE__ */ jsx("div", {
457
- onClick: (e) => e.stopPropagation(),
457
+ onClick: (e_0) => e_0.stopPropagation(),
458
458
  role: "presentation",
459
- onKeyDown: (e) => e.stopPropagation(),
459
+ onKeyDown: (e_1) => e_1.stopPropagation(),
460
460
  style: { marginTop: 8 },
461
461
  children: replyingTo === replyKey ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("input", {
462
- ref: (el) => el?.focus({ preventScroll: true }),
462
+ ref: (el_2) => el_2?.focus({ preventScroll: true }),
463
463
  type: "text",
464
464
  value: replyText,
465
- onChange: (e) => setReplyText(e.target.value),
466
- onMouseDown: (e) => e.stopPropagation(),
467
- onKeyDown: (e) => {
468
- e.stopPropagation();
469
- if (e.key === "Enter") {
470
- e.preventDefault();
465
+ onChange: (e_2) => setReplyText(e_2.target.value),
466
+ onMouseDown: (e_3) => e_3.stopPropagation(),
467
+ onKeyDown: (e_4) => {
468
+ e_4.stopPropagation();
469
+ if (e_4.key === "Enter") {
470
+ e_4.preventDefault();
471
471
  if (replyText.trim() && submitFn) submitFn(replyKey, replyText.trim());
472
472
  setReplyText("");
473
473
  setReplyingTo(null);
474
474
  }
475
- if (e.key === "Escape") {
475
+ if (e_4.key === "Escape") {
476
476
  setReplyingTo(null);
477
477
  setReplyText("");
478
478
  }
@@ -498,8 +498,8 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
498
498
  },
499
499
  children: [/* @__PURE__ */ jsx("button", {
500
500
  type: "button",
501
- onClick: (e) => {
502
- e.stopPropagation();
501
+ onClick: (e_5) => {
502
+ e_5.stopPropagation();
503
503
  setReplyingTo(null);
504
504
  setReplyText("");
505
505
  },
@@ -507,8 +507,8 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
507
507
  children: t("comments.cancel")
508
508
  }), /* @__PURE__ */ jsx("button", {
509
509
  type: "button",
510
- onClick: (e) => {
511
- e.stopPropagation();
510
+ onClick: (e_6) => {
511
+ e_6.stopPropagation();
512
512
  if (replyText.trim() && submitFn) submitFn(replyKey, replyText.trim());
513
513
  setReplyText("");
514
514
  setReplyingTo(null);
@@ -519,9 +519,9 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
519
519
  })]
520
520
  })] }) : /* @__PURE__ */ jsx("input", {
521
521
  readOnly: true,
522
- onMouseDown: (e) => e.stopPropagation(),
523
- onClick: (e) => {
524
- e.stopPropagation();
522
+ onMouseDown: (e_7) => e_7.stopPropagation(),
523
+ onClick: (e_8) => {
524
+ e_8.stopPropagation();
525
525
  setReplyingTo(replyKey);
526
526
  },
527
527
  placeholder: t("comments.replyPlaceholder"),
@@ -539,30 +539,27 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
539
539
  }
540
540
  })
541
541
  });
542
- const renderCommentCard = (comment) => {
543
- const replies = getReplies(comment.id);
544
- const cardId = `comment-${comment.id}`;
545
- const isExpanded = expandedCard === cardId;
546
- const isActive = activeCommentId === comment.id;
547
- const yPos = cardPositions.get(cardId) ?? lastKnownCardPositionsRef.current.get(cardId);
548
- const cardRef = { get current() {
549
- return cardRefs.current.get(cardId) ?? null;
550
- } };
542
+ const renderCommentCard = (comment_0) => {
543
+ const replies_0 = getReplies(comment_0.id);
544
+ const cardId_2 = `comment-${comment_0.id}`;
545
+ const isExpanded_1 = expandedCard === cardId_2;
546
+ const isActive = activeCommentId === comment_0.id;
547
+ const yPos_0 = cardPositions.get(cardId_2) ?? lastKnownCardPositionsRef.current.get(cardId_2);
551
548
  return /* @__PURE__ */ jsxs("div", {
552
- ref: (el) => {
553
- if (el) cardRefs.current.set(cardId, el);
554
- else cardRefs.current.delete(cardId);
549
+ ref: (el_3) => {
550
+ if (el_3) cardRefs.current.set(cardId_2, el_3);
551
+ else cardRefs.current.delete(cardId_2);
555
552
  },
556
- "data-comment-id": comment.id,
553
+ "data-comment-id": comment_0.id,
557
554
  className: "docx-comment-card",
558
- onClick: containedHandler(cardRef, () => handleCardClick(cardId, comment.id)),
559
- onKeyDown: (e) => {
560
- if (e.key === "Enter" || e.key === " ") handleCardClick(cardId, comment.id);
555
+ onClick: containedHandler(() => handleCardClick(cardId_2, comment_0.id)),
556
+ onKeyDown: (e_9) => {
557
+ if (e_9.key === "Enter" || e_9.key === " ") handleCardClick(cardId_2, comment_0.id);
561
558
  },
562
- onMouseDown: containedHandler(cardRef, (e) => e.stopPropagation()),
559
+ onMouseDown: containedHandler((e_10) => e_10.stopPropagation()),
563
560
  style: {
564
- ...cardContainerStyle(cardId, isExpanded, yPos),
565
- opacity: comment.done ? .6 : 1,
561
+ ...cardContainerStyle(cardId_2, isExpanded_1, yPos_0),
562
+ opacity: comment_0.done ? .6 : 1,
566
563
  outline: isActive ? "2px solid var(--doc-primary, var(--primary))" : "none",
567
564
  outlineOffset: 2
568
565
  },
@@ -575,8 +572,8 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
575
572
  },
576
573
  children: [
577
574
  /* @__PURE__ */ jsx("div", {
578
- style: avatarStyle(comment.author || "U"),
579
- children: getInitials(comment.author || "U")
575
+ style: avatarStyle(comment_0.author || "U"),
576
+ children: getInitials(comment_0.author || "U")
580
577
  }),
581
578
  /* @__PURE__ */ jsxs("div", {
582
579
  style: {
@@ -589,16 +586,16 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
589
586
  fontWeight: 600,
590
587
  color: "var(--doc-text)"
591
588
  },
592
- children: comment.author || "Unknown"
589
+ children: comment_0.author || "Unknown"
593
590
  }), /* @__PURE__ */ jsx("div", {
594
591
  style: {
595
592
  fontSize: 10,
596
593
  color: "var(--doc-text-muted)"
597
594
  },
598
- children: formatDate(comment.date, locale)
595
+ children: formatDate(comment_0.date, locale)
599
596
  })]
600
597
  }),
601
- isExpanded && /* @__PURE__ */ jsxs("div", {
598
+ isExpanded_1 && /* @__PURE__ */ jsxs("div", {
602
599
  style: {
603
600
  display: "flex",
604
601
  gap: 2,
@@ -608,9 +605,9 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
608
605
  children: [
609
606
  /* @__PURE__ */ jsx("button", {
610
607
  type: "button",
611
- onClick: (e) => {
612
- e.stopPropagation();
613
- onCommentResolve?.(comment.id);
608
+ onClick: (e_11) => {
609
+ e_11.stopPropagation();
610
+ onCommentResolve?.(comment_0.id);
614
611
  },
615
612
  title: "Resolve",
616
613
  style: ICON_BUTTON_STYLE,
@@ -618,18 +615,18 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
618
615
  }),
619
616
  /* @__PURE__ */ jsx("button", {
620
617
  type: "button",
621
- onClick: (e) => {
622
- e.stopPropagation();
623
- setMenuOpenFor(menuOpenFor === cardId ? null : cardId);
618
+ onClick: (e_12) => {
619
+ e_12.stopPropagation();
620
+ setMenuOpenFor(menuOpenFor === cardId_2 ? null : cardId_2);
624
621
  },
625
622
  title: "More options",
626
623
  style: ICON_BUTTON_STYLE,
627
624
  children: /* @__PURE__ */ jsx(MoreVerticalIcon, { size: 16 })
628
625
  }),
629
- menuOpenFor === cardId && /* @__PURE__ */ jsx("div", {
630
- onClick: (e) => e.stopPropagation(),
631
- onKeyDown: (e) => e.stopPropagation(),
632
- onMouseDown: (e) => e.stopPropagation(),
626
+ menuOpenFor === cardId_2 && /* @__PURE__ */ jsx("div", {
627
+ onClick: (e_13) => e_13.stopPropagation(),
628
+ onKeyDown: (e_14) => e_14.stopPropagation(),
629
+ onMouseDown: (e_15) => e_15.stopPropagation(),
633
630
  role: "menu",
634
631
  tabIndex: -1,
635
632
  style: {
@@ -647,7 +644,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
647
644
  type: "button",
648
645
  onClick: () => {
649
646
  setMenuOpenFor(null);
650
- onCommentDelete?.(comment.id);
647
+ onCommentDelete?.(comment_0.id);
651
648
  },
652
649
  style: {
653
650
  display: "block",
@@ -661,19 +658,19 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
661
658
  cursor: "pointer",
662
659
  fontFamily: "inherit"
663
660
  },
664
- onMouseOver: (e) => {
665
- e.currentTarget.style.backgroundColor = "var(--doc-primary-light)";
661
+ onMouseOver: (e_16) => {
662
+ e_16.currentTarget.style.backgroundColor = "var(--doc-primary-light)";
666
663
  },
667
- onFocus: (e) => {
668
- e.currentTarget.style.backgroundColor = "var(--doc-primary-light)";
664
+ onFocus: (e_17) => {
665
+ e_17.currentTarget.style.backgroundColor = "var(--doc-primary-light)";
669
666
  },
670
- onMouseOut: (e) => {
671
- e.currentTarget.style.backgroundColor = "transparent";
667
+ onMouseOut: (e_18) => {
668
+ e_18.currentTarget.style.backgroundColor = "transparent";
672
669
  },
673
- onBlur: (e) => {
674
- e.currentTarget.style.backgroundColor = "transparent";
670
+ onBlur: (e_19) => {
671
+ e_19.currentTarget.style.backgroundColor = "transparent";
675
672
  },
676
- children: "Delete"
673
+ children: t("delete")
677
674
  })
678
675
  })
679
676
  ]
@@ -687,12 +684,12 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
687
684
  lineHeight: "17px",
688
685
  marginTop: 5
689
686
  },
690
- children: getCommentText(comment.content)
687
+ children: getCommentText(comment_0.content)
691
688
  }),
692
- renderReplies(replies, isExpanded),
693
- isExpanded && !comment.done && renderReplySection(comment.id, onCommentReply)
689
+ renderReplies(replies_0, isExpanded_1),
690
+ isExpanded_1 && !comment_0.done && renderReplySection(comment_0.id, onCommentReply)
694
691
  ]
695
- }, comment.id);
692
+ }, comment_0.id);
696
693
  };
697
694
  return /* @__PURE__ */ jsx("aside", {
698
695
  ref: sidebarRef,
@@ -713,22 +710,22 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
713
710
  pointerEvents: initialPositionsDone || cardPositions.size > 0 ? "auto" : "none",
714
711
  transition: "opacity 0.15s ease"
715
712
  },
716
- onMouseDown: containedHandler(sidebarRef, (e) => e.stopPropagation()),
713
+ onMouseDown: containedHandler((e_20) => e_20.stopPropagation()),
717
714
  children: /* @__PURE__ */ jsxs("div", {
718
715
  style: { position: "relative" },
719
716
  children: [
720
717
  isAddingComment && /* @__PURE__ */ jsxs("div", {
721
- ref: (el) => {
722
- if (el) cardRefs.current.set("new-comment-input", el);
718
+ ref: (el_4) => {
719
+ if (el_4) cardRefs.current.set("new-comment-input", el_4);
723
720
  else cardRefs.current.delete("new-comment-input");
724
721
  },
725
722
  style: {
726
723
  ...(() => {
727
- const yPos = cardPositions.get("new-comment-input");
724
+ const yPos_1 = cardPositions.get("new-comment-input");
728
725
  if (!hasPositions) return { marginBottom: 8 };
729
- if (yPos !== void 0) return {
726
+ if (yPos_1 !== void 0) return {
730
727
  position: "absolute",
731
- top: yPos,
728
+ top: yPos_1,
732
729
  left: 0,
733
730
  right: 0
734
731
  };
@@ -746,17 +743,17 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
746
743
  zIndex: 50
747
744
  },
748
745
  children: [/* @__PURE__ */ jsx("textarea", {
749
- ref: (el) => el?.focus({ preventScroll: true }),
746
+ ref: (el_5) => el_5?.focus({ preventScroll: true }),
750
747
  value: newCommentText,
751
- onChange: (e) => setNewCommentText(e.target.value),
752
- onMouseDown: (e) => e.stopPropagation(),
753
- onKeyDown: (e) => {
754
- e.stopPropagation();
755
- if (e.key === "Enter" && !e.shiftKey) {
756
- e.preventDefault();
748
+ onChange: (e_21) => setNewCommentText(e_21.target.value),
749
+ onMouseDown: (e_22) => e_22.stopPropagation(),
750
+ onKeyDown: (e_23) => {
751
+ e_23.stopPropagation();
752
+ if (e_23.key === "Enter" && !e_23.shiftKey) {
753
+ e_23.preventDefault();
757
754
  handleNewCommentSubmit();
758
755
  }
759
- if (e.key === "Escape") {
756
+ if (e_23.key === "Escape") {
760
757
  onCancelAddComment?.();
761
758
  setNewCommentText("");
762
759
  }
@@ -786,8 +783,8 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
786
783
  },
787
784
  children: [/* @__PURE__ */ jsx("button", {
788
785
  type: "button",
789
- onClick: (e) => {
790
- e.stopPropagation();
786
+ onClick: (e_24) => {
787
+ e_24.stopPropagation();
791
788
  onCancelAddComment?.();
792
789
  setNewCommentText("");
793
790
  },
@@ -795,8 +792,8 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
795
792
  children: t("comments.cancel")
796
793
  }), /* @__PURE__ */ jsx("button", {
797
794
  type: "button",
798
- onClick: (e) => {
799
- e.stopPropagation();
795
+ onClick: (e_25) => {
796
+ e_25.stopPropagation();
800
797
  handleNewCommentSubmit();
801
798
  },
802
799
  disabled: !newCommentText.trim(),
@@ -805,7 +802,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
805
802
  })]
806
803
  })]
807
804
  }),
808
- visibleComments.map((comment) => renderCommentCard(comment)),
805
+ visibleComments.map((comment_1) => renderCommentCard(comment_1)),
809
806
  visibleComments.length === 0 && !isAddingComment && /* @__PURE__ */ jsx("div", {
810
807
  style: {
811
808
  padding: "24px 16px",
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
- import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
2
+ import { r as useFolioUI } from "./folio-ui-BgDDRsUX.js";
3
3
  import React, { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { ChevronDownIcon, ChevronUpIcon, SearchIcon, XIcon } from "lucide-react";
5
5
  import { useTranslations } from "use-intl";
@@ -123,12 +123,12 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
123
123
  if (onClearHighlights) onClearHighlights();
124
124
  return;
125
125
  }
126
- const searchResult = onFind(searchText, {
126
+ const searchResult_0 = onFind(searchText, {
127
127
  matchCase,
128
128
  matchWholeWord
129
129
  });
130
- setResult(searchResult);
131
- if (searchResult?.matches && onHighlightMatches) onHighlightMatches(searchResult.matches);
130
+ setResult(searchResult_0);
131
+ if (searchResult_0?.matches && onHighlightMatches) onHighlightMatches(searchResult_0.matches);
132
132
  else if (onClearHighlights) onClearHighlights();
133
133
  }, [
134
134
  searchText,
@@ -194,10 +194,10 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
194
194
  return;
195
195
  }
196
196
  if (onFindPrevious()) {
197
- const newIndex = result.currentIndex === 0 ? result.totalCount - 1 : result.currentIndex - 1;
197
+ const newIndex_0 = result.currentIndex === 0 ? result.totalCount - 1 : result.currentIndex - 1;
198
198
  setResult({
199
199
  ...result,
200
- currentIndex: newIndex
200
+ currentIndex: newIndex_0
201
201
  });
202
202
  }
203
203
  }, [
@@ -206,13 +206,13 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
206
206
  performSearch,
207
207
  onFindPrevious
208
208
  ]);
209
- const handleSearchKeyDown = useCallback((e) => {
210
- if (e.key === "Enter") {
211
- e.preventDefault();
209
+ const handleSearchKeyDown = useCallback((e_0) => {
210
+ if (e_0.key === "Enter") {
211
+ e_0.preventDefault();
212
212
  const action = getFindEnterAction({
213
213
  searchText,
214
214
  result,
215
- shiftKey: e.shiftKey
215
+ shiftKey: e_0.shiftKey
216
216
  });
217
217
  if (action === "search") {
218
218
  performSearch();
@@ -223,7 +223,7 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
223
223
  return;
224
224
  }
225
225
  handleFindNext();
226
- } else if (e.key === "Escape") onClose();
226
+ } else if (e_0.key === "Escape") onClose();
227
227
  }, [
228
228
  searchText,
229
229
  result,
@@ -232,11 +232,18 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
232
232
  handleFindNext,
233
233
  onClose
234
234
  ]);
235
- const handleOverlayClick = useCallback((e) => {
236
- if (e.target === e.currentTarget) {}
235
+ const handleSearchBlur = useCallback(() => {
236
+ if (searchText.trim() && !result) performSearch();
237
+ }, [
238
+ performSearch,
239
+ result,
240
+ searchText
241
+ ]);
242
+ const handleOverlayClick = useCallback((e_1) => {
243
+ if (e_1.target === e_1.currentTarget) {}
237
244
  }, []);
238
- const handleDialogKeyDown = useCallback((e) => {
239
- if (e.key === "Escape") onClose();
245
+ const handleDialogKeyDown = useCallback((e_2) => {
246
+ if (e_2.key === "Escape") onClose();
240
247
  }, [onClose]);
241
248
  if (!isOpen) return null;
242
249
  const hasMatches = result && result.totalCount > 0;
@@ -295,9 +302,7 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
295
302
  value: searchText,
296
303
  onChange: handleSearchChange,
297
304
  onKeyDown: handleSearchKeyDown,
298
- onBlur: () => {
299
- if (searchText.trim() && !result) performSearch();
300
- },
305
+ onBlur: handleSearchBlur,
301
306
  placeholder: t("findReplace.findPlaceholder"),
302
307
  "aria-label": t("findReplace.findText")
303
308
  }),