quoin-editor 1.0.2 → 1.1.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 (224) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/ai.cjs +168 -249
  3. package/dist/ai.cjs.map +1 -1
  4. package/dist/ai.js +37 -121
  5. package/dist/ai.js.map +1 -1
  6. package/dist/catalogue.cjs +28 -43
  7. package/dist/catalogue.cjs.map +1 -1
  8. package/dist/catalogue.js +20 -37
  9. package/dist/catalogue.js.map +1 -1
  10. package/dist/{chunk-DUE3HCZD.js → chunk-2EQ6FKSK.js} +19 -28
  11. package/dist/chunk-2EQ6FKSK.js.map +1 -0
  12. package/dist/{chunk-RJRX34BZ.js → chunk-3BXUGX5F.js} +4 -18
  13. package/dist/chunk-3BXUGX5F.js.map +1 -0
  14. package/dist/chunk-3QRVAI53.cjs +27 -0
  15. package/dist/chunk-3QRVAI53.cjs.map +1 -0
  16. package/dist/{chunk-U3LOLYAU.js → chunk-7FAVFJAS.js} +4 -10
  17. package/dist/chunk-7FAVFJAS.js.map +1 -0
  18. package/dist/{chunk-6V6GGBDK.cjs → chunk-7SVKLWDT.cjs} +24 -31
  19. package/dist/chunk-7SVKLWDT.cjs.map +1 -0
  20. package/dist/{chunk-EH5KXQXY.cjs → chunk-A6PGQVTR.cjs} +36 -20
  21. package/dist/chunk-A6PGQVTR.cjs.map +1 -0
  22. package/dist/{chunk-P6KYXFZC.cjs → chunk-ACSEYJJF.cjs} +426 -534
  23. package/dist/chunk-ACSEYJJF.cjs.map +1 -0
  24. package/dist/{chunk-4SLJNZSM.cjs → chunk-AIS37SL2.cjs} +201 -198
  25. package/dist/chunk-AIS37SL2.cjs.map +1 -0
  26. package/dist/{chunk-X4HDKFW5.cjs → chunk-DTQFYHDJ.cjs} +56 -105
  27. package/dist/chunk-DTQFYHDJ.cjs.map +1 -0
  28. package/dist/{chunk-O4Z2WMFF.js → chunk-HDJ653LM.js} +25 -18
  29. package/dist/chunk-HDJ653LM.js.map +1 -0
  30. package/dist/chunk-HQ43EIYO.cjs +94 -0
  31. package/dist/chunk-HQ43EIYO.cjs.map +1 -0
  32. package/dist/{chunk-6NULZPVC.js → chunk-HTLWPSMU.js} +8 -61
  33. package/dist/chunk-HTLWPSMU.js.map +1 -0
  34. package/dist/{chunk-ADSJ42DO.js → chunk-HWEK7EX5.js} +17 -69
  35. package/dist/chunk-HWEK7EX5.js.map +1 -0
  36. package/dist/{chunk-623AOJM2.js → chunk-ITXCE6KL.js} +7 -25
  37. package/dist/chunk-ITXCE6KL.js.map +1 -0
  38. package/dist/{chunk-AUOEM3SF.cjs → chunk-IXVGHH7F.cjs} +102 -155
  39. package/dist/chunk-IXVGHH7F.cjs.map +1 -0
  40. package/dist/{chunk-NEZJ7ZP5.js → chunk-JZJIWRF3.js} +4 -8
  41. package/dist/chunk-JZJIWRF3.js.map +1 -0
  42. package/dist/{chunk-C23RQVRK.js → chunk-KSF2HILJ.js} +66 -216
  43. package/dist/chunk-KSF2HILJ.js.map +1 -0
  44. package/dist/{chunk-OBMBSU2S.js → chunk-L4D23LM2.js} +5 -184
  45. package/dist/chunk-L4D23LM2.js.map +1 -0
  46. package/dist/{chunk-4XFXB37X.js → chunk-L6OW2FL3.js} +7 -90
  47. package/dist/chunk-L6OW2FL3.js.map +1 -0
  48. package/dist/chunk-LE5XMIFJ.cjs +4 -3
  49. package/dist/chunk-LE5XMIFJ.cjs.map +1 -1
  50. package/dist/{chunk-5MAYUGTE.cjs → chunk-LY2D45F2.cjs} +233 -363
  51. package/dist/chunk-LY2D45F2.cjs.map +1 -0
  52. package/dist/{chunk-VCLL5C7J.js → chunk-MGMA5PEL.js} +14 -57
  53. package/dist/chunk-MGMA5PEL.js.map +1 -0
  54. package/dist/chunk-MQUCCSWG.js +2 -3
  55. package/dist/chunk-MQUCCSWG.js.map +1 -1
  56. package/dist/chunk-NO3KTZDY.cjs +33 -0
  57. package/dist/chunk-NO3KTZDY.cjs.map +1 -0
  58. package/dist/{chunk-TLGX43P6.cjs → chunk-OM7E43ZN.cjs} +89 -86
  59. package/dist/chunk-OM7E43ZN.cjs.map +1 -0
  60. package/dist/{chunk-JHQUHFLX.js → chunk-PJCHSHM3.js} +38 -120
  61. package/dist/chunk-PJCHSHM3.js.map +1 -0
  62. package/dist/{chunk-EPARJI4V.js → chunk-QC35D2AU.js} +107 -262
  63. package/dist/chunk-QC35D2AU.js.map +1 -0
  64. package/dist/{chunk-CW3AFJBR.cjs → chunk-QEMGOL5L.cjs} +1302 -1773
  65. package/dist/chunk-QEMGOL5L.cjs.map +1 -0
  66. package/dist/chunk-QWS7KH3K.cjs +483 -0
  67. package/dist/chunk-QWS7KH3K.cjs.map +1 -0
  68. package/dist/{chunk-IQBMAE3F.js → chunk-RHQPAW4W.js} +34 -92
  69. package/dist/chunk-RHQPAW4W.js.map +1 -0
  70. package/dist/chunk-RIIXJWBR.cjs +24 -0
  71. package/dist/chunk-RIIXJWBR.cjs.map +1 -0
  72. package/dist/{chunk-VRS6WCEK.js → chunk-SAEQMDAU.js} +60 -167
  73. package/dist/chunk-SAEQMDAU.js.map +1 -0
  74. package/dist/chunk-SKZC4K5S.cjs +612 -0
  75. package/dist/chunk-SKZC4K5S.cjs.map +1 -0
  76. package/dist/{chunk-N4FGA3H4.js → chunk-TBCHYHNU.js} +38 -105
  77. package/dist/chunk-TBCHYHNU.js.map +1 -0
  78. package/dist/{chunk-OSHZQR3W.js → chunk-TNN6Z52D.js} +13 -45
  79. package/dist/chunk-TNN6Z52D.js.map +1 -0
  80. package/dist/{chunk-YBMUEEM5.js → chunk-TYZSB7JT.js} +4 -8
  81. package/dist/chunk-TYZSB7JT.js.map +1 -0
  82. package/dist/{chunk-ZKVOS57Q.cjs → chunk-VFSVN5IQ.cjs} +495 -551
  83. package/dist/chunk-VFSVN5IQ.cjs.map +1 -0
  84. package/dist/{chunk-FDRUAL3Z.cjs → chunk-WDO6DBYU.cjs} +90 -153
  85. package/dist/chunk-WDO6DBYU.cjs.map +1 -0
  86. package/dist/{chunk-WEYDDIBQ.cjs → chunk-WHV5ZSIO.cjs} +36 -64
  87. package/dist/chunk-WHV5ZSIO.cjs.map +1 -0
  88. package/dist/{chunk-T43RZTUT.js → chunk-XJDPQFPU.js} +693 -1247
  89. package/dist/chunk-XJDPQFPU.js.map +1 -0
  90. package/dist/{chunk-BQANU5BH.cjs → chunk-ZTLYHRZT.cjs} +34 -44
  91. package/dist/chunk-ZTLYHRZT.cjs.map +1 -0
  92. package/dist/chunk-ZWB7SZVI.cjs +200 -0
  93. package/dist/chunk-ZWB7SZVI.cjs.map +1 -0
  94. package/dist/comments.cjs +209 -290
  95. package/dist/comments.cjs.map +1 -1
  96. package/dist/comments.js +81 -186
  97. package/dist/comments.js.map +1 -1
  98. package/dist/diff.cjs +48 -65
  99. package/dist/diff.cjs.map +1 -1
  100. package/dist/diff.d.cts +2 -2
  101. package/dist/diff.d.ts +2 -2
  102. package/dist/diff.js +8 -32
  103. package/dist/diff.js.map +1 -1
  104. package/dist/docx.cjs +50 -63
  105. package/dist/docx.cjs.map +1 -1
  106. package/dist/docx.js +7 -22
  107. package/dist/docx.js.map +1 -1
  108. package/dist/embed.cjs +18 -12
  109. package/dist/embed.cjs.map +1 -1
  110. package/dist/embed.js +9 -16
  111. package/dist/embed.js.map +1 -1
  112. package/dist/emoji-data.cjs +7 -5
  113. package/dist/emoji-data.cjs.map +1 -1
  114. package/dist/emoji-data.js +3 -5
  115. package/dist/emoji-data.js.map +1 -1
  116. package/dist/emoji.cjs +25 -17
  117. package/dist/emoji.cjs.map +1 -1
  118. package/dist/emoji.js +8 -17
  119. package/dist/emoji.js.map +1 -1
  120. package/dist/engine.cjs +229 -118
  121. package/dist/engine.cjs.map +1 -1
  122. package/dist/engine.js +4 -118
  123. package/dist/engine.js.map +1 -1
  124. package/dist/find.cjs +29 -19
  125. package/dist/find.cjs.map +1 -1
  126. package/dist/find.js +8 -19
  127. package/dist/find.js.map +1 -1
  128. package/dist/headless.cjs +290 -151
  129. package/dist/headless.cjs.map +1 -1
  130. package/dist/headless.d.cts +5 -1
  131. package/dist/headless.d.ts +5 -1
  132. package/dist/headless.js +5 -151
  133. package/dist/headless.js.map +1 -1
  134. package/dist/index.cjs +348 -183
  135. package/dist/index.cjs.map +1 -1
  136. package/dist/index.d.cts +14 -4
  137. package/dist/index.d.ts +14 -4
  138. package/dist/index.js +7 -183
  139. package/dist/index.js.map +1 -1
  140. package/dist/math.cjs +19 -13
  141. package/dist/math.cjs.map +1 -1
  142. package/dist/math.js +10 -17
  143. package/dist/math.js.map +1 -1
  144. package/dist/mention.cjs +19 -13
  145. package/dist/mention.cjs.map +1 -1
  146. package/dist/mention.js +10 -17
  147. package/dist/mention.js.map +1 -1
  148. package/dist/presence.cjs +98 -132
  149. package/dist/presence.cjs.map +1 -1
  150. package/dist/presence.js +21 -78
  151. package/dist/presence.js.map +1 -1
  152. package/dist/{registry-CWBOSAHm.d.ts → registry-CXegaw5k.d.cts} +25 -2
  153. package/dist/{registry-CWBOSAHm.d.cts → registry-CXegaw5k.d.ts} +25 -2
  154. package/dist/stats.cjs +26 -18
  155. package/dist/stats.cjs.map +1 -1
  156. package/dist/stats.js +9 -18
  157. package/dist/stats.js.map +1 -1
  158. package/dist/styles.css +1 -1
  159. package/dist/table.cjs +89 -49
  160. package/dist/table.cjs.map +1 -1
  161. package/dist/table.js +8 -49
  162. package/dist/table.js.map +1 -1
  163. package/dist/toc.cjs +25 -17
  164. package/dist/toc.cjs.map +1 -1
  165. package/dist/toc.js +8 -17
  166. package/dist/toc.js.map +1 -1
  167. package/dist/view.cjs +13 -16
  168. package/dist/view.cjs.map +1 -1
  169. package/dist/view.d.cts +2 -2
  170. package/dist/view.d.ts +2 -2
  171. package/dist/view.js +7 -16
  172. package/dist/view.js.map +1 -1
  173. package/dist/yjs.cjs +186 -228
  174. package/dist/yjs.cjs.map +1 -1
  175. package/dist/yjs.js +12 -80
  176. package/dist/yjs.js.map +1 -1
  177. package/package.json +1 -1
  178. package/dist/chunk-4SLJNZSM.cjs.map +0 -1
  179. package/dist/chunk-4XFXB37X.js.map +0 -1
  180. package/dist/chunk-5MAYUGTE.cjs.map +0 -1
  181. package/dist/chunk-623AOJM2.js.map +0 -1
  182. package/dist/chunk-6NULZPVC.js.map +0 -1
  183. package/dist/chunk-6V6GGBDK.cjs.map +0 -1
  184. package/dist/chunk-73653CJ4.cjs +0 -34
  185. package/dist/chunk-73653CJ4.cjs.map +0 -1
  186. package/dist/chunk-ADSJ42DO.js.map +0 -1
  187. package/dist/chunk-AUOEM3SF.cjs.map +0 -1
  188. package/dist/chunk-BQANU5BH.cjs.map +0 -1
  189. package/dist/chunk-C23RQVRK.js.map +0 -1
  190. package/dist/chunk-CW3AFJBR.cjs.map +0 -1
  191. package/dist/chunk-DUE3HCZD.js.map +0 -1
  192. package/dist/chunk-EH5KXQXY.cjs.map +0 -1
  193. package/dist/chunk-EPARJI4V.js.map +0 -1
  194. package/dist/chunk-FDRUAL3Z.cjs.map +0 -1
  195. package/dist/chunk-IQBMAE3F.js.map +0 -1
  196. package/dist/chunk-JHQUHFLX.js.map +0 -1
  197. package/dist/chunk-KUYZMSMF.cjs +0 -100
  198. package/dist/chunk-KUYZMSMF.cjs.map +0 -1
  199. package/dist/chunk-LLTEGXWZ.cjs +0 -562
  200. package/dist/chunk-LLTEGXWZ.cjs.map +0 -1
  201. package/dist/chunk-N4FGA3H4.js.map +0 -1
  202. package/dist/chunk-NEZJ7ZP5.js.map +0 -1
  203. package/dist/chunk-O4Z2WMFF.js.map +0 -1
  204. package/dist/chunk-OBMBSU2S.js.map +0 -1
  205. package/dist/chunk-OSHZQR3W.js.map +0 -1
  206. package/dist/chunk-P6KYXFZC.cjs.map +0 -1
  207. package/dist/chunk-R2BLBV43.cjs +0 -239
  208. package/dist/chunk-R2BLBV43.cjs.map +0 -1
  209. package/dist/chunk-RJRX34BZ.js.map +0 -1
  210. package/dist/chunk-T43RZTUT.js.map +0 -1
  211. package/dist/chunk-TLGX43P6.cjs.map +0 -1
  212. package/dist/chunk-U3LOLYAU.js.map +0 -1
  213. package/dist/chunk-UEKXVCKC.cjs +0 -716
  214. package/dist/chunk-UEKXVCKC.cjs.map +0 -1
  215. package/dist/chunk-VCLL5C7J.js.map +0 -1
  216. package/dist/chunk-VRS6WCEK.js.map +0 -1
  217. package/dist/chunk-WEYDDIBQ.cjs.map +0 -1
  218. package/dist/chunk-X4HDKFW5.cjs.map +0 -1
  219. package/dist/chunk-X4P4TQXH.cjs +0 -30
  220. package/dist/chunk-X4P4TQXH.cjs.map +0 -1
  221. package/dist/chunk-XA3UEJIW.cjs +0 -25
  222. package/dist/chunk-XA3UEJIW.cjs.map +0 -1
  223. package/dist/chunk-YBMUEEM5.js.map +0 -1
  224. package/dist/chunk-ZKVOS57Q.cjs.map +0 -1
package/dist/comments.js CHANGED
@@ -1,52 +1,15 @@
1
- "use client";
2
- import {
3
- webAddress
4
- } from "./chunk-YBMUEEM5.js";
5
- import {
6
- ownsNode
7
- } from "./chunk-NEZJ7ZP5.js";
8
- import {
9
- Button,
10
- FOCUS_RING,
11
- Popover,
12
- PopoverAnchor,
13
- PopoverContent,
14
- cn,
15
- rangeRect,
16
- toError,
17
- useQuoin,
18
- virtualAnchor
19
- } from "./chunk-T43RZTUT.js";
20
- import {
21
- useEditorState,
22
- useIsomorphicLayoutEffect,
23
- useReadOnly
24
- } from "./chunk-EPARJI4V.js";
25
- import "./chunk-O4Z2WMFF.js";
26
- import {
27
- Transaction,
28
- addMarkStep,
29
- comparePos,
30
- createPluginKey,
31
- defineExtension,
32
- getPluginState,
33
- isCollapsed,
34
- markRanges,
35
- removeMarkStep,
36
- sameSelection,
37
- textSelection
38
- } from "./chunk-OBMBSU2S.js";
39
- import "./chunk-RJRX34BZ.js";
40
- import {
41
- blockById,
42
- indexOfBlock,
43
- inlineText,
44
- nodeLength,
45
- sliceInline
46
- } from "./chunk-4XFXB37X.js";
47
-
48
- // src/extensions/comments/comments-extension.tsx
49
- import { MessageSquarePlus } from "lucide-react";
1
+ 'use client';import { webAddress } from './chunk-TYZSB7JT.js';
2
+ import { ownsNode } from './chunk-JZJIWRF3.js';
3
+ import { useQuoin, cn, FOCUS_RING, Button, virtualAnchor, rangeRect, Popover, PopoverAnchor, PopoverContent, toError } from './chunk-XJDPQFPU.js';
4
+ import { useIsomorphicLayoutEffect, useEditorState, useReadOnly } from './chunk-QC35D2AU.js';
5
+ import './chunk-HDJ653LM.js';
6
+ import { createPluginKey, defineExtension, getPluginState, isCollapsed, markRanges, Transaction, comparePos, textSelection, addMarkStep, sameSelection, removeMarkStep } from './chunk-L4D23LM2.js';
7
+ import './chunk-3BXUGX5F.js';
8
+ import { blockById, nodeLength, inlineText, sliceInline, indexOfBlock } from './chunk-L6OW2FL3.js';
9
+ import { MessageSquarePlus, MessageSquare, XIcon, SendHorizontal } from 'lucide-react';
10
+ import { useMemo, useRef, useState, useEffect, useCallback, useSyncExternalStore } from 'react';
11
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
50
13
 
51
14
  // src/extensions/comments/comment-anchors.ts
52
15
  var idsOf = (node) => node?.marks.flatMap((mark) => mark.type === "comment" && mark.attrs?.id ? [mark.attrs.id] : []) ?? [];
@@ -276,12 +239,6 @@ function linkOf(editor) {
276
239
  return link;
277
240
  }
278
241
 
279
- // src/extensions/comments/CommentsOverlay.tsx
280
- import { useCallback, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef6, useState as useState5 } from "react";
281
-
282
- // src/extensions/comments/CommentMarkers.tsx
283
- import { MessageSquare } from "lucide-react";
284
-
285
242
  // src/extensions/comments/rail-layout.ts
286
243
  function stackTops(items, gap) {
287
244
  let next = 0;
@@ -335,9 +292,6 @@ function useBlockAligned(controller, box, gap, key) {
335
292
  };
336
293
  }, [controller, box, gap, key]);
337
294
  }
338
-
339
- // src/extensions/comments/CommentMarkers.tsx
340
- import { jsx, jsxs } from "react/jsx-runtime";
341
295
  var GAP = 4;
342
296
  function groupsOf(entries) {
343
297
  const groups = /* @__PURE__ */ new Map();
@@ -370,12 +324,6 @@ function CommentMarkers({ env, box, entries, onOpen }) {
370
324
  )) });
371
325
  }
372
326
 
373
- // src/extensions/comments/ThreadCard.tsx
374
- import { useRef as useRef3 } from "react";
375
-
376
- // src/extensions/comments/ThreadView.tsx
377
- import { useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
378
-
379
327
  // src/extensions/comments/comment-actions.ts
380
328
  async function called(link, call) {
381
329
  try {
@@ -395,16 +343,12 @@ async function endThread(editor, link, call, id, threads) {
395
343
  function sendReply(link, call, id, body) {
396
344
  return called(link, () => call(id, body));
397
345
  }
398
-
399
- // src/extensions/comments/CommentAvatar.tsx
400
- import { useState } from "react";
401
- import { jsx as jsx2 } from "react/jsx-runtime";
402
346
  var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((word) => Array.from(word)[0]?.toUpperCase() ?? "").join("");
403
347
  function CommentAvatar({ author }) {
404
348
  const picture = webAddress(author.avatarUrl);
405
349
  const [failed, setFailed] = useState(null);
406
350
  if (picture !== null && picture !== failed) {
407
- return /* @__PURE__ */ jsx2(
351
+ return /* @__PURE__ */ jsx(
408
352
  "img",
409
353
  {
410
354
  src: picture,
@@ -417,33 +361,25 @@ function CommentAvatar({ author }) {
417
361
  }
418
362
  );
419
363
  }
420
- return /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "quoin-comments-initials", children: initials(author.name) });
364
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "quoin-comments-initials", children: initials(author.name) });
421
365
  }
422
-
423
- // src/extensions/comments/CommentItem.tsx
424
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
425
366
  function CommentItem({ comment, labels }) {
426
- return /* @__PURE__ */ jsxs2("li", { className: "flex gap-2", children: [
427
- /* @__PURE__ */ jsx3(CommentAvatar, { author: comment.author }),
428
- /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
429
- /* @__PURE__ */ jsxs2("p", { className: "flex flex-wrap items-baseline gap-x-2 text-sm", children: [
430
- /* @__PURE__ */ jsx3("span", { className: "font-medium", children: comment.author.name }),
431
- /* @__PURE__ */ jsx3("time", { dateTime: comment.createdAt, className: "text-xs text-muted-foreground", children: labels.postedAt(comment.createdAt) })
367
+ return /* @__PURE__ */ jsxs("li", { className: "flex gap-2", children: [
368
+ /* @__PURE__ */ jsx(CommentAvatar, { author: comment.author }),
369
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
370
+ /* @__PURE__ */ jsxs("p", { className: "flex flex-wrap items-baseline gap-x-2 text-sm", children: [
371
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: comment.author.name }),
372
+ /* @__PURE__ */ jsx("time", { dateTime: comment.createdAt, className: "text-xs text-muted-foreground", children: labels.postedAt(comment.createdAt) })
432
373
  ] }),
433
- /* @__PURE__ */ jsx3("p", { className: "quoin-comments-body text-sm", children: comment.body })
374
+ /* @__PURE__ */ jsx("p", { className: "quoin-comments-body text-sm", children: comment.body })
434
375
  ] })
435
376
  ] });
436
377
  }
437
-
438
- // src/extensions/comments/ReplyBox.tsx
439
- import { SendHorizontal } from "lucide-react";
440
- import { useEffect, useRef, useState as useState2 } from "react";
441
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
442
378
  var REPLY_FIELD = "data-comments-field";
443
379
  function ReplyBox({ env, threadId, first }) {
444
380
  const { controller, host, labels, link } = env;
445
- const [body, setBody] = useState2("");
446
- const [sending, setSending] = useState2(false);
381
+ const [body, setBody] = useState("");
382
+ const [sending, setSending] = useState(false);
447
383
  const alive = useRef(true);
448
384
  useEffect(() => {
449
385
  alive.current = true;
@@ -471,9 +407,9 @@ function ReplyBox({ env, threadId, first }) {
471
407
  event.preventDefault();
472
408
  void send();
473
409
  };
474
- return /* @__PURE__ */ jsxs3("form", { className: "flex items-start gap-2", onSubmit, children: [
475
- /* @__PURE__ */ jsx4(CommentAvatar, { author: host.currentUser }),
476
- /* @__PURE__ */ jsx4(
410
+ return /* @__PURE__ */ jsxs("form", { className: "flex items-start gap-2", onSubmit, children: [
411
+ /* @__PURE__ */ jsx(CommentAvatar, { author: host.currentUser }),
412
+ /* @__PURE__ */ jsx(
477
413
  "textarea",
478
414
  {
479
415
  ...{ [REPLY_FIELD]: "" },
@@ -486,7 +422,7 @@ function ReplyBox({ env, threadId, first }) {
486
422
  className: "quoin-comments-field"
487
423
  }
488
424
  ),
489
- /* @__PURE__ */ jsx4(
425
+ /* @__PURE__ */ jsx(
490
426
  Button,
491
427
  {
492
428
  type: "submit",
@@ -494,21 +430,18 @@ function ReplyBox({ env, threadId, first }) {
494
430
  size: "icon-sm",
495
431
  "aria-label": labels.send,
496
432
  "aria-disabled": text === "" || sending || void 0,
497
- children: /* @__PURE__ */ jsx4(SendHorizontal, {})
433
+ children: /* @__PURE__ */ jsx(SendHorizontal, {})
498
434
  }
499
435
  )
500
436
  ] });
501
437
  }
502
-
503
- // src/extensions/comments/ThreadView.tsx
504
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
505
438
  function ThreadView({ env, id, thread, onEnded }) {
506
439
  const { controller, host, labels, link } = env;
507
440
  const readOnly = useReadOnly(controller);
508
- const [busy, setBusy] = useState3(false);
509
- const alive = useRef2(true);
510
- const root = useRef2(null);
511
- useEffect2(() => {
441
+ const [busy, setBusy] = useState(false);
442
+ const alive = useRef(true);
443
+ const root = useRef(null);
444
+ useEffect(() => {
512
445
  alive.current = true;
513
446
  return () => {
514
447
  alive.current = false;
@@ -524,11 +457,11 @@ function ThreadView({ env, id, thread, onEnded }) {
524
457
  const stayed = active === null || active === document.body || root.current?.contains(active) === true;
525
458
  if (ended && stayed) onEnded();
526
459
  };
527
- return /* @__PURE__ */ jsxs4("div", { ref: root, className: "flex flex-col gap-3", children: [
528
- comments.length > 0 && /* @__PURE__ */ jsx5("ol", { className: "flex flex-col gap-3", children: comments.map((comment) => /* @__PURE__ */ jsx5(CommentItem, { comment, labels }, comment.id)) }),
529
- /* @__PURE__ */ jsx5(ReplyBox, { env, threadId: id, first: comments.length === 0 }),
530
- !readOnly && /* @__PURE__ */ jsxs4("div", { className: "flex justify-end gap-1", children: [
531
- /* @__PURE__ */ jsx5(
460
+ return /* @__PURE__ */ jsxs("div", { ref: root, className: "flex flex-col gap-3", children: [
461
+ comments.length > 0 && /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-3", children: comments.map((comment) => /* @__PURE__ */ jsx(CommentItem, { comment, labels }, comment.id)) }),
462
+ /* @__PURE__ */ jsx(ReplyBox, { env, threadId: id, first: comments.length === 0 }),
463
+ !readOnly && /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-1", children: [
464
+ /* @__PURE__ */ jsx(
532
465
  Button,
533
466
  {
534
467
  type: "button",
@@ -539,7 +472,7 @@ function ThreadView({ env, id, thread, onEnded }) {
539
472
  children: labels.resolve
540
473
  }
541
474
  ),
542
- /* @__PURE__ */ jsx5(
475
+ /* @__PURE__ */ jsx(
543
476
  Button,
544
477
  {
545
478
  type: "button",
@@ -553,13 +486,10 @@ function ThreadView({ env, id, thread, onEnded }) {
553
486
  ] })
554
487
  ] });
555
488
  }
556
-
557
- // src/extensions/comments/ThreadCard.tsx
558
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
559
489
  function ThreadCard({ env, entry, active, expanded, onToggle }) {
560
490
  const { labels, controller } = env;
561
491
  const { thread, anchorText: anchorText2, ranges } = entry;
562
- const header = useRef3(null);
492
+ const header = useRef(null);
563
493
  const [first] = thread.comments;
564
494
  const removed = ranges.length === 0;
565
495
  const backToHeader = () => {
@@ -573,8 +503,8 @@ function ThreadCard({ env, entry, active, expanded, onToggle }) {
573
503
  onToggle(null);
574
504
  header.current?.focus();
575
505
  };
576
- return /* @__PURE__ */ jsxs5("div", { className: "quoin-comments-card", "data-active": active || void 0, onKeyDown, children: [
577
- /* @__PURE__ */ jsxs5(
506
+ return /* @__PURE__ */ jsxs("div", { className: "quoin-comments-card", "data-active": active || void 0, onKeyDown, children: [
507
+ /* @__PURE__ */ jsxs(
578
508
  "button",
579
509
  {
580
510
  ref: header,
@@ -583,27 +513,24 @@ function ThreadCard({ env, entry, active, expanded, onToggle }) {
583
513
  className: cn("flex w-full flex-col items-start gap-1 rounded-sm text-start", FOCUS_RING),
584
514
  onClick: () => onToggle(expanded ? null : thread.id),
585
515
  children: [
586
- /* @__PURE__ */ jsx6("span", { className: removed ? "text-xs text-muted-foreground italic" : "quoin-comments-quote", children: removed ? labels.textRemoved : anchorText2 }),
587
- first !== void 0 && /* @__PURE__ */ jsxs5("span", { className: "line-clamp-2 text-sm", children: [
588
- /* @__PURE__ */ jsx6("span", { className: "font-medium", children: first.author.name }),
516
+ /* @__PURE__ */ jsx("span", { className: removed ? "text-xs text-muted-foreground italic" : "quoin-comments-quote", children: removed ? labels.textRemoved : anchorText2 }),
517
+ first !== void 0 && /* @__PURE__ */ jsxs("span", { className: "line-clamp-2 text-sm", children: [
518
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: first.author.name }),
589
519
  " ",
590
520
  first.body
591
521
  ] }),
592
- /* @__PURE__ */ jsx6("span", { className: "text-xs text-muted-foreground", children: labels.commentCount(thread.comments.length) })
522
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: labels.commentCount(thread.comments.length) })
593
523
  ]
594
524
  }
595
525
  ),
596
- expanded && /* @__PURE__ */ jsx6("div", { className: "mt-3", role: "group", "aria-label": removed ? labels.textRemoved : labels.thread(anchorText2), children: /* @__PURE__ */ jsx6(ThreadView, { env, id: thread.id, thread, onEnded: backToHeader }) })
526
+ expanded && /* @__PURE__ */ jsx("div", { className: "mt-3", role: "group", "aria-label": removed ? labels.textRemoved : labels.thread(anchorText2), children: /* @__PURE__ */ jsx(ThreadView, { env, id: thread.id, thread, onEnded: backToHeader }) })
597
527
  ] });
598
528
  }
599
-
600
- // src/extensions/comments/CommentsRail.tsx
601
- import { jsx as jsx7 } from "react/jsx-runtime";
602
529
  var GAP2 = 8;
603
530
  var layoutKey = (entries, value) => `${value.active} ${value.open !== null} ${entries.map(({ thread, ranges }) => `${thread.id}:${ranges[0]?.block}`)}`;
604
531
  function CommentsRail({ env, box, entries, value, onToggle }) {
605
532
  useBlockAligned(env.controller, box, GAP2, layoutKey(entries, value));
606
- return /* @__PURE__ */ jsx7("div", { ref: box, className: "quoin-comments-rail", children: /* @__PURE__ */ jsx7("ul", { "aria-label": env.labels.comments, children: entries.map((entry) => /* @__PURE__ */ jsx7("li", { "data-rail-item": "", "data-block": entry.ranges[0]?.block ?? "", children: /* @__PURE__ */ jsx7(
533
+ return /* @__PURE__ */ jsx("div", { ref: box, className: "quoin-comments-rail", children: /* @__PURE__ */ jsx("ul", { "aria-label": env.labels.comments, children: entries.map((entry) => /* @__PURE__ */ jsx("li", { "data-rail-item": "", "data-block": entry.ranges[0]?.block ?? "", children: /* @__PURE__ */ jsx(
607
534
  ThreadCard,
608
535
  {
609
536
  env,
@@ -614,23 +541,17 @@ function CommentsRail({ env, box, entries, value, onToggle }) {
614
541
  }
615
542
  ) }, entry.thread.id)) }) });
616
543
  }
617
-
618
- // src/extensions/comments/CommentsSheet.tsx
619
- import * as DialogPrimitive from "@radix-ui/react-dialog";
620
- import { XIcon } from "lucide-react";
621
- import { useRef as useRef4 } from "react";
622
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
623
544
  function CommentsSheet({ env, entries, value, onToggle, onClose, returnFocus }) {
624
545
  const { labels } = env;
625
- const content = useRef4(null);
626
- const outside = useRef4(false);
546
+ const content = useRef(null);
547
+ const outside = useRef(false);
627
548
  const focusOpened = (event) => {
628
549
  const opened = content.current?.querySelector('[aria-expanded="true"]');
629
550
  if (!opened) return;
630
551
  event.preventDefault();
631
552
  opened.focus();
632
553
  };
633
- return /* @__PURE__ */ jsx8(
554
+ return /* @__PURE__ */ jsx(
634
555
  DialogPrimitive.Root,
635
556
  {
636
557
  open: true,
@@ -638,7 +559,7 @@ function CommentsSheet({ env, entries, value, onToggle, onClose, returnFocus })
638
559
  onOpenChange: (open) => {
639
560
  if (!open) onClose();
640
561
  },
641
- children: /* @__PURE__ */ jsx8(DialogPrimitive.Portal, { children: /* @__PURE__ */ jsxs6(
562
+ children: /* @__PURE__ */ jsx(DialogPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
642
563
  DialogPrimitive.Content,
643
564
  {
644
565
  ref: content,
@@ -653,11 +574,11 @@ function CommentsSheet({ env, entries, value, onToggle, onClose, returnFocus })
653
574
  if (!outside.current) returnFocus();
654
575
  },
655
576
  children: [
656
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
657
- /* @__PURE__ */ jsx8(DialogPrimitive.Title, { className: "text-sm font-semibold", children: labels.comments }),
658
- /* @__PURE__ */ jsx8(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx8(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": labels.close, children: /* @__PURE__ */ jsx8(XIcon, {}) }) })
577
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
578
+ /* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "text-sm font-semibold", children: labels.comments }),
579
+ /* @__PURE__ */ jsx(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": labels.close, children: /* @__PURE__ */ jsx(XIcon, {}) }) })
659
580
  ] }),
660
- /* @__PURE__ */ jsx8("ul", { "aria-label": labels.comments, className: "flex flex-col gap-2", children: entries.map((entry) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsx8(
581
+ /* @__PURE__ */ jsx("ul", { "aria-label": labels.comments, className: "flex flex-col gap-2", children: entries.map((entry) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
661
582
  ThreadCard,
662
583
  {
663
584
  env,
@@ -685,29 +606,20 @@ function railEntries(doc, threads, ended = []) {
685
606
  const place2 = ({ ranges: [first] }) => first === void 0 ? [Infinity, 0] : [indexOfBlock(doc, first.block), first.from];
686
607
  return entries.map((entry, order) => ({ entry, order, at: place2(entry) })).sort((a, b) => a.at[0] - b.at[0] || a.at[1] - b.at[1] || a.order - b.order).map(({ entry }) => entry);
687
608
  }
688
-
689
- // src/extensions/comments/ThreadPopover.tsx
690
- import { useMemo, useRef as useRef5 } from "react";
691
-
692
- // src/extensions/comments/ThreadChooser.tsx
693
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
694
609
  function ThreadChooser({ env, choices, onChoose }) {
695
- return /* @__PURE__ */ jsx9("ul", { "aria-label": env.labels.threadsHere, className: "flex flex-col gap-1", children: choices.map(({ id, anchorText: anchorText2, preview }) => /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsxs7(
610
+ return /* @__PURE__ */ jsx("ul", { "aria-label": env.labels.threadsHere, className: "flex flex-col gap-1", children: choices.map(({ id, anchorText: anchorText2, preview }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
696
611
  "button",
697
612
  {
698
613
  type: "button",
699
614
  className: "quoin-comments-choice",
700
615
  onClick: () => onChoose(id),
701
616
  children: [
702
- /* @__PURE__ */ jsx9("span", { className: "quoin-comments-quote", children: anchorText2 }),
703
- preview && /* @__PURE__ */ jsx9("span", { className: "line-clamp-1 text-sm", children: preview })
617
+ /* @__PURE__ */ jsx("span", { className: "quoin-comments-quote", children: anchorText2 }),
618
+ preview && /* @__PURE__ */ jsx("span", { className: "line-clamp-1 text-sm", children: preview })
704
619
  ]
705
620
  }
706
621
  ) }, id)) });
707
622
  }
708
-
709
- // src/extensions/comments/ThreadPopover.tsx
710
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
711
623
  var docOf = (state) => state.doc;
712
624
  function focusIsOurs(controller, content) {
713
625
  const active = content?.ownerDocument.activeElement ?? null;
@@ -719,7 +631,7 @@ function ThreadPopover({ env, open, threads, onChoose, onClose }) {
719
631
  const anchors = commentAnchors(doc);
720
632
  const { ids } = open;
721
633
  const first = ids.map((id) => anchors.get(id)?.[0]).find(Boolean);
722
- const latest = useRef5(first);
634
+ const latest = useRef(first);
723
635
  useIsomorphicLayoutEffect(() => {
724
636
  if (first) latest.current = first;
725
637
  });
@@ -732,7 +644,7 @@ function ThreadPopover({ env, open, threads, onChoose, onClose }) {
732
644
  }),
733
645
  [controller]
734
646
  );
735
- const content = useRef5(null);
647
+ const content = useRef(null);
736
648
  const focusField = () => {
737
649
  const target = content.current?.querySelector(`[${REPLY_FIELD}], button`);
738
650
  if (focusIsOurs(controller, content.current) && !content.current?.contains(content.current.ownerDocument.activeElement)) {
@@ -759,7 +671,7 @@ function ThreadPopover({ env, open, threads, onChoose, onClose }) {
759
671
  if (inside) backToText();
760
672
  };
761
673
  const choices = ids.map((id) => ({ id, anchorText: textOf(id), preview: threads.find(id)?.comments[0]?.body ?? "" }));
762
- return /* @__PURE__ */ jsxs8(
674
+ return /* @__PURE__ */ jsxs(
763
675
  Popover,
764
676
  {
765
677
  open: true,
@@ -768,8 +680,8 @@ function ThreadPopover({ env, open, threads, onChoose, onClose }) {
768
680
  if (!next) onClose();
769
681
  },
770
682
  children: [
771
- /* @__PURE__ */ jsx10(PopoverAnchor, { virtualRef: anchor }),
772
- /* @__PURE__ */ jsxs8(
683
+ /* @__PURE__ */ jsx(PopoverAnchor, { virtualRef: anchor }),
684
+ /* @__PURE__ */ jsxs(
773
685
  PopoverContent,
774
686
  {
775
687
  ref: content,
@@ -781,8 +693,8 @@ function ThreadPopover({ env, open, threads, onChoose, onClose }) {
781
693
  onCloseAutoFocus: (event) => event.preventDefault(),
782
694
  onEscapeKeyDown: onEscape,
783
695
  children: [
784
- gone && /* @__PURE__ */ jsx10("p", { className: "mb-2 text-xs text-muted-foreground italic", children: labels.textRemoved }),
785
- single ? /* @__PURE__ */ jsx10(ThreadView, { env, id: ids[0], thread: threads.find(ids[0]), onEnded: backToText }) : /* @__PURE__ */ jsx10(ThreadChooser, { env, choices, onChoose })
696
+ gone && /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-muted-foreground italic", children: labels.textRemoved }),
697
+ single ? /* @__PURE__ */ jsx(ThreadView, { env, id: ids[0], thread: threads.find(ids[0]), onEnded: backToText }) : /* @__PURE__ */ jsx(ThreadChooser, { env, choices, onChoose })
786
698
  ]
787
699
  },
788
700
  ids.join(" ")
@@ -791,9 +703,6 @@ function ThreadPopover({ env, open, threads, onChoose, onClose }) {
791
703
  }
792
704
  );
793
705
  }
794
-
795
- // src/extensions/comments/use-anchor-clicks.ts
796
- import { useEffect as useEffect3 } from "react";
797
706
  function idsUnder(root, target) {
798
707
  const ids = [];
799
708
  let element = target instanceof Element ? target.closest("[data-comment]") : null;
@@ -805,7 +714,7 @@ function idsUnder(root, target) {
805
714
  return ids;
806
715
  }
807
716
  function useAnchorClicks(controller, threads) {
808
- useEffect3(() => {
717
+ useEffect(() => {
809
718
  const onClick = (event) => {
810
719
  const root = controller.root;
811
720
  if (root === null || event.defaultPrevented || !root.ownerDocument.getSelection()?.isCollapsed) return;
@@ -818,12 +727,9 @@ function useAnchorClicks(controller, threads) {
818
727
  return () => document.removeEventListener("click", onClick);
819
728
  }, [controller, threads]);
820
729
  }
821
-
822
- // src/extensions/comments/use-canvas-wide.ts
823
- import { useState as useState4 } from "react";
824
730
  var WIDE_CANVAS = 800;
825
731
  function useCanvasWide(box, initial) {
826
- const [wide, setWide] = useState4(initial);
732
+ const [wide, setWide] = useState(initial);
827
733
  useIsomorphicLayoutEffect(() => {
828
734
  const canvas = box.current?.parentElement;
829
735
  if (!canvas) return void 0;
@@ -835,15 +741,9 @@ function useCanvasWide(box, initial) {
835
741
  }, [box]);
836
742
  return wide;
837
743
  }
838
-
839
- // src/extensions/comments/use-threads.ts
840
- import { useSyncExternalStore } from "react";
841
744
  function useThreads(threads) {
842
745
  return useSyncExternalStore(threads.subscribe, threads.get, threads.get);
843
746
  }
844
-
845
- // src/extensions/comments/CommentsOverlay.tsx
846
- import { Fragment, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
847
747
  var commentsOf = (state) => getPluginState(state, commentsKey);
848
748
  var docOf2 = (state) => state.doc;
849
749
  function CommentsOverlay({ controller, host, labels }) {
@@ -856,15 +756,15 @@ function CommentsOverlay({ controller, host, labels }) {
856
756
  const threads = useThreads(host.threads);
857
757
  const value = useEditorState(controller, commentsOf);
858
758
  const doc = useEditorState(controller, docOf2);
859
- const entries = useMemo2(() => railEntries(doc, threads, value.ended), [doc, threads, value.ended]);
860
- const box = useRef6(null);
759
+ const entries = useMemo(() => railEntries(doc, threads, value.ended), [doc, threads, value.ended]);
760
+ const box = useRef(null);
861
761
  const wide = useCanvasWide(box, host.initialLayout === "wide");
862
- const [sheet, setSheet] = useState5(false);
863
- const opener = useRef6(null);
864
- useEffect4(() => {
762
+ const [sheet, setSheet] = useState(false);
763
+ const opener = useRef(null);
764
+ useEffect(() => {
865
765
  if (wide) setSheet(false);
866
766
  }, [wide]);
867
- const env = useMemo2(() => ({ controller, host, labels, link }), [controller, host, labels, link]);
767
+ const env = useMemo(() => ({ controller, host, labels, link }), [controller, host, labels, link]);
868
768
  const act2 = useCallback(
869
769
  (action) => controller.editor.dispatch(commentsTransaction(controller.editor.state, action)),
870
770
  [controller]
@@ -883,9 +783,9 @@ function CommentsOverlay({ controller, host, labels }) {
883
783
  setSheet(false);
884
784
  toggle(null);
885
785
  };
886
- return /* @__PURE__ */ jsxs9(Fragment, { children: [
887
- wide ? /* @__PURE__ */ jsx11(CommentsRail, { env, box, entries, value, onToggle: toggle }) : /* @__PURE__ */ jsx11(CommentMarkers, { env, box, entries, onOpen: openSheet }),
888
- !wide && sheet && /* @__PURE__ */ jsx11(
786
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
787
+ wide ? /* @__PURE__ */ jsx(CommentsRail, { env, box, entries, value, onToggle: toggle }) : /* @__PURE__ */ jsx(CommentMarkers, { env, box, entries, onOpen: openSheet }),
788
+ !wide && sheet && /* @__PURE__ */ jsx(
889
789
  CommentsSheet,
890
790
  {
891
791
  env,
@@ -896,7 +796,7 @@ function CommentsOverlay({ controller, host, labels }) {
896
796
  returnFocus
897
797
  }
898
798
  ),
899
- value.open && /* @__PURE__ */ jsx11(
799
+ value.open && /* @__PURE__ */ jsx(
900
800
  ThreadPopover,
901
801
  {
902
802
  env,
@@ -932,9 +832,6 @@ function watchEnded(editor, threads) {
932
832
  if (kept.length < ended.length) editor.dispatch(commentsTransaction(editor.state, { type: "caught", kept }));
933
833
  });
934
834
  }
935
-
936
- // src/extensions/comments/comments-extension.tsx
937
- import { jsx as jsx12 } from "react/jsx-runtime";
938
835
  var commentItem = (labels) => ({
939
836
  id: "comment",
940
837
  title: labels.comment,
@@ -951,7 +848,7 @@ function commentsExtension(options) {
951
848
  const { labels: overrides, ...host } = options;
952
849
  const labels = resolveCommentsLabels(overrides);
953
850
  function Overlay({ controller }) {
954
- return /* @__PURE__ */ jsx12(CommentsOverlay, { controller, host, labels });
851
+ return /* @__PURE__ */ jsx(CommentsOverlay, { controller, host, labels });
955
852
  }
956
853
  const ui = { bubbleItems: [commentItem(labels)], overlays: [Overlay] };
957
854
  return defineExtension({
@@ -1000,9 +897,7 @@ function createCommentThreads(initial = NO_THREADS) {
1000
897
  }
1001
898
  };
1002
899
  }
1003
- export {
1004
- commentsExtension,
1005
- createCommentThreads,
1006
- englishCommentsLabels
1007
- };
900
+
901
+ export { commentsExtension, createCommentThreads, englishCommentsLabels };
902
+ //# sourceMappingURL=comments.js.map
1008
903
  //# sourceMappingURL=comments.js.map