quoin-editor 1.0.2 → 1.1.1

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