@collabchron/notiq 1.1.10 → 1.1.12

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 (411) hide show
  1. package/README.md +281 -259
  2. package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +12 -0
  3. package/dist/AIDialog-RHRYHSVN.mjs +325 -0
  4. package/dist/AudioComponent-CKLMLB5T.mjs +278 -0
  5. package/dist/CodeActionMenuPlugin-FGH6HZLL.mjs +14 -0
  6. package/dist/CollaborationPlugin-TIZOQBUT.mjs +405 -0
  7. package/dist/CollaboratorsBar-AMPIAUOY.mjs +20 -0
  8. package/dist/CommentsPlugin-SDJJTUGK.mjs +19 -0
  9. package/dist/DynamicBlockComponent-2LOADZUX.mjs +221 -0
  10. package/dist/{EquationComponent-CB6DFIHV.mjs → EquationComponent-4NFG55NQ.mjs} +82 -46
  11. package/dist/ExcalidrawComponent-BMSYIPP6.mjs +662 -0
  12. package/dist/ExcalidrawPlugin-QLPGJPSX.mjs +14 -0
  13. package/dist/ExportPlugin-MJHYKQZJ.mjs +43 -0
  14. package/dist/FileComponent-Y56MX5QD.mjs +200 -0
  15. package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +12 -0
  16. package/dist/FloatingTextFormatToolbarPlugin-BXCPN3KD.mjs +45 -0
  17. package/dist/HintComponet-ET7M2Q7S.mjs +288 -0
  18. package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +360 -0
  19. package/dist/{InlineImageComponent-UWIUWBHI.mjs → InlineImageComponent-FVTA4LXZ.mjs} +129 -99
  20. package/dist/MobileToolbar-KV5DX4ED.mjs +982 -0
  21. package/dist/SlashCommand-SPR7G5EI.mjs +39 -0
  22. package/dist/StoryBuilderComponent-JN4ZPZOW.mjs +816 -0
  23. package/dist/{TableCellActionMenuPlugin-PGK2K3VG.mjs → TableCellActionMenuPlugin-YWBA64J7.mjs} +328 -157
  24. package/dist/{TableHoverActionsPlugin-GJVE6VRW.mjs → TableHoverActionsPlugin-2EIXHEXN.mjs} +43 -36
  25. package/dist/{TemplatePlugin-ZD3QEVTI.mjs → TemplatePlugin-HNTPEXBB.mjs} +2 -2
  26. package/dist/ToolbarPlugin-F52PVNXU.mjs +823 -0
  27. package/dist/VersionHistoryPlugin-YWGCREKA.mjs +371 -0
  28. package/dist/babel-RJXDAKDM.mjs +7287 -0
  29. package/dist/background-color-RW5JYLMG.mjs +425 -0
  30. package/dist/block-format-TODFREE2.mjs +14 -0
  31. package/dist/{chunk-RBWZGXPF.mjs → chunk-22ZIL6NH.mjs} +5 -5
  32. package/dist/{chunk-DSFQHA7I.mjs → chunk-2LNT36RL.mjs} +118 -295
  33. package/dist/chunk-37LC44W3.mjs +2677 -0
  34. package/dist/{chunk-GK35L7UY.mjs → chunk-3IILA3IP.mjs} +1 -1
  35. package/dist/chunk-3JN6QEJR.mjs +31 -0
  36. package/dist/{chunk-5BAKY5KN.mjs → chunk-43Z4Z2KD.mjs} +5 -8
  37. package/dist/{chunk-GXYD4VZM.mjs → chunk-4DVIYZVB.mjs} +1 -1
  38. package/dist/{chunk-7NZAPJ4G.mjs → chunk-4FFTOZGJ.mjs} +4 -3
  39. package/dist/chunk-4UMUPCDK.mjs +68 -0
  40. package/dist/chunk-5D4JF3ZZ.mjs +624 -0
  41. package/dist/{chunk-POGRR73N.mjs → chunk-5NRAXWYA.mjs} +4 -3
  42. package/dist/{chunk-PZSUSXQG.mjs → chunk-6D6QLRYR.mjs} +2 -2
  43. package/dist/chunk-6FQFPPLG.mjs +785 -0
  44. package/dist/{chunk-3CPBODXA.mjs → chunk-6UVNHT3T.mjs} +7 -27
  45. package/dist/{chunk-G53GLEAY.mjs → chunk-7QRJVZQY.mjs} +47 -22
  46. package/dist/chunk-ACV47ZKE.mjs +201 -0
  47. package/dist/{chunk-FSM26655.mjs → chunk-AMXRQ2TK.mjs} +4 -4
  48. package/dist/{chunk-YUDCJRJM.mjs → chunk-BGV62GC2.mjs} +3 -2
  49. package/dist/{chunk-2FNEAMSP.mjs → chunk-C4JWLBYN.mjs} +50 -45
  50. package/dist/{chunk-TCYK7DM7.mjs → chunk-CDAMHK63.mjs} +4 -3
  51. package/dist/chunk-CLRSETYQ.mjs +431 -0
  52. package/dist/{chunk-QHIQKMVN.mjs → chunk-D3IOUQFR.mjs} +125 -111
  53. package/dist/chunk-EEBA6OAH.mjs +59 -0
  54. package/dist/{chunk-YKC3SO4Z.mjs → chunk-EIZMKFHF.mjs} +1 -1
  55. package/dist/{chunk-N3WN46VL.mjs → chunk-ELBTVBTS.mjs} +23 -22
  56. package/dist/chunk-ENH2IOHI.mjs +1828 -0
  57. package/dist/{chunk-4EXYCTGJ.mjs → chunk-EVPWKNE4.mjs} +3 -3
  58. package/dist/{chunk-LGG4IUIA.mjs → chunk-FO7M3X2B.mjs} +2 -2
  59. package/dist/{chunk-WDG7J2DY.mjs → chunk-H3P47YXJ.mjs} +30 -19
  60. package/dist/chunk-HOZ4QRFV.mjs +536 -0
  61. package/dist/{chunk-5QSNIVIG.mjs → chunk-IAFCQV3Z.mjs} +94 -78
  62. package/dist/{chunk-64Z3FI7T.mjs → chunk-IIVB6JNE.mjs} +5 -4
  63. package/dist/chunk-IUOUIDEQ.mjs +70 -0
  64. package/dist/chunk-J6ZUY5BY.mjs +202 -0
  65. package/dist/{chunk-YHPNOWFH.mjs → chunk-JHXDLYEV.mjs} +1 -1
  66. package/dist/{chunk-ZB5LZQKC.mjs → chunk-K5OAFEVY.mjs} +1 -1
  67. package/dist/{chunk-3JVFG7ER.mjs → chunk-KNW2CGIP.mjs} +7 -64
  68. package/dist/{chunk-4HBCVSE6.mjs → chunk-KXRLARGI.mjs} +1 -1
  69. package/dist/{chunk-4GFXER7R.mjs → chunk-LBGM4VVZ.mjs} +141 -89
  70. package/dist/chunk-LLGVCM7M.mjs +809 -0
  71. package/dist/chunk-LU2XWLOE.mjs +219 -0
  72. package/dist/chunk-LVRJM45C.mjs +171 -0
  73. package/dist/{chunk-K36V4SIW.mjs → chunk-MSAO3YFB.mjs} +21 -18
  74. package/dist/chunk-N3KDPSRI.mjs +496 -0
  75. package/dist/chunk-N3WTT2U6.mjs +21 -0
  76. package/dist/{chunk-GZPNVR7L.mjs → chunk-N6ILV6NF.mjs} +7 -6
  77. package/dist/{chunk-QEIFVK5M.mjs → chunk-NBE6FF6L.mjs} +4 -4
  78. package/dist/{chunk-BIU7WTLX.mjs → chunk-OE5JRLCN.mjs} +21 -18
  79. package/dist/chunk-OXWTZV3U.mjs +174 -0
  80. package/dist/{chunk-Z4EWP7BI.mjs → chunk-PD5K4AGP.mjs} +22 -23
  81. package/dist/chunk-PFH63ZU4.mjs +33 -0
  82. package/dist/{chunk-HJPPNHYM.mjs → chunk-QNIY45SF.mjs} +4 -3
  83. package/dist/chunk-R7WFRENU.mjs +262 -0
  84. package/dist/{chunk-4VWFVWYP.mjs → chunk-RAVYEEIC.mjs} +1 -1
  85. package/dist/chunk-RJQTA6HG.mjs +358 -0
  86. package/dist/{chunk-7VUMHWWL.mjs → chunk-SAOJHVPE.mjs} +5 -4
  87. package/dist/{chunk-456TN7IM.mjs → chunk-SYUCM5G5.mjs} +15 -14
  88. package/dist/{chunk-4MEDW3T6.mjs → chunk-T2UBAZ66.mjs} +5 -4
  89. package/dist/chunk-TC3IISJZ.mjs +408 -0
  90. package/dist/chunk-VGAX6YEY.mjs +399 -0
  91. package/dist/chunk-VNDDDXGH.mjs +682 -0
  92. package/dist/{chunk-U47ABU5Z.mjs → chunk-W6VQSFE5.mjs} +2 -2
  93. package/dist/chunk-WUVIQCX7.mjs +944 -0
  94. package/dist/chunk-WYCFGRFJ.mjs +118 -0
  95. package/dist/chunk-XNJNT6PC.mjs +1701 -0
  96. package/dist/chunk-XYLTLGY5.mjs +775 -0
  97. package/dist/chunk-XYMXGU4T.mjs +129 -0
  98. package/dist/{chunk-3G37YKTV.mjs → chunk-YR2DD74C.mjs} +9 -8
  99. package/dist/chunk-ZFV2HGD3.mjs +143 -0
  100. package/dist/{chunk-77UA6HYR.mjs → chunk-ZKZ7MLSS.mjs} +1 -1
  101. package/dist/chunk-ZYJ7KABY.mjs +419 -0
  102. package/dist/color-S55XFDYQ.mjs +13 -0
  103. package/dist/components/canvas/CanvasMode.d.ts +18 -0
  104. package/dist/components/editor/Core.d.ts +19 -0
  105. package/dist/components/editor/index.d.ts +38 -0
  106. package/dist/components/editor/lexical-on-change.d.ts +1 -0
  107. package/dist/components/editor/nodes/AudioNode/AudioComponent.d.ts +15 -0
  108. package/dist/components/editor/nodes/AudioNode/index.d.ts +36 -0
  109. package/dist/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.d.ts +22 -0
  110. package/dist/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.d.ts +18 -0
  111. package/dist/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.d.ts +19 -0
  112. package/dist/components/editor/nodes/DynamicBlockNode/DynamicBlockComponent.d.ts +7 -0
  113. package/dist/components/editor/nodes/DynamicBlockNode/DynamicBlockNode.d.ts +49 -0
  114. package/dist/components/editor/nodes/EquationNode/EquationComponent.d.ts +16 -0
  115. package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +33 -0
  116. package/dist/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.d.ts +15 -0
  117. package/dist/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.d.ts +57 -0
  118. package/dist/components/editor/nodes/ExcalidrawNode/ImageResizer.d.ts +24 -0
  119. package/dist/components/editor/nodes/ExcalidrawNode/index.d.ts +39 -0
  120. package/dist/components/editor/nodes/FigmaNode/FigmaNode.d.ts +27 -0
  121. package/dist/components/editor/nodes/FileNode/FileComponent.d.ts +16 -0
  122. package/dist/components/editor/nodes/FileNode/index.d.ts +39 -0
  123. package/dist/components/editor/nodes/Hint/HintComponet.d.ts +20 -0
  124. package/dist/components/editor/nodes/Hint/index.d.ts +33 -0
  125. package/dist/components/editor/nodes/ImageNode/index.d.ts +62 -0
  126. package/dist/components/editor/nodes/InlineImageNode/InlineImageComponent.d.ts +25 -0
  127. package/dist/components/editor/nodes/InlineImageNode/InlineImageNode.d.ts +66 -0
  128. package/dist/components/editor/nodes/LayoutNode/LayoutContainerNode.d.ts +31 -0
  129. package/dist/components/editor/nodes/LayoutNode/LayoutItemNode.d.ts +21 -0
  130. package/dist/components/editor/nodes/PollNode/index.d.ts +34 -0
  131. package/dist/components/editor/nodes/Stepper/index.d.ts +66 -0
  132. package/dist/components/editor/nodes/StoryBuilderNode/StoryBuilderComponent.d.ts +10 -0
  133. package/dist/components/editor/nodes/StoryBuilderNode/StoryBuilderNode.d.ts +59 -0
  134. package/dist/components/editor/nodes/TweetNode/index.d.ts +21 -0
  135. package/dist/components/editor/nodes/index.d.ts +4 -0
  136. package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +7 -0
  137. package/dist/components/editor/plugins/AudioPlugin/index.d.ts +1 -0
  138. package/dist/components/editor/plugins/AutoEmbedPlugin/index.d.ts +19 -0
  139. package/dist/components/editor/plugins/AutoLinkPlugin/index.d.ts +1 -0
  140. package/dist/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.d.ts +8 -0
  141. package/dist/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.d.ts +9 -0
  142. package/dist/components/editor/plugins/CodeActionMenuPlugin/index.d.ts +4 -0
  143. package/dist/components/editor/plugins/CodeActionMenuPlugin/utils.d.ts +1 -0
  144. package/dist/components/editor/plugins/CodeHighlightPlugin/index.d.ts +11 -0
  145. package/dist/components/editor/plugins/CollaborationPlugin/CollaboratorsBar.d.ts +9 -0
  146. package/dist/components/editor/plugins/CollaborationPlugin/index.d.ts +8 -0
  147. package/dist/components/editor/plugins/CollapsiblePlugin/index.d.ts +4 -0
  148. package/dist/components/editor/plugins/CommentsPlugin/CommentThreadItem.d.ts +7 -0
  149. package/dist/components/editor/plugins/CommentsPlugin/CommentsSidebar.d.ts +2 -0
  150. package/dist/components/editor/plugins/CommentsPlugin/MentionsAutocomplete.d.ts +22 -0
  151. package/dist/components/editor/plugins/CommentsPlugin/NewCommentDialog.d.ts +2 -0
  152. package/dist/components/editor/plugins/CommentsPlugin/index.d.ts +5 -0
  153. package/dist/components/editor/plugins/ContentAnalyticsPlugin/index.d.ts +1 -0
  154. package/dist/components/editor/plugins/DragDropPastePlugin/index.d.ts +1 -0
  155. package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +5 -0
  156. package/dist/components/editor/plugins/DynamicBlockPlugin/index.d.ts +7 -0
  157. package/dist/components/editor/plugins/EquationsPlugin/index.d.ts +20 -0
  158. package/dist/components/editor/plugins/ExcalidrawPlugin/index.d.ts +5 -0
  159. package/dist/components/editor/plugins/ExportPlugin/ImportExportModal.d.ts +9 -0
  160. package/dist/components/editor/plugins/ExportPlugin/index.d.ts +28 -0
  161. package/dist/components/editor/plugins/FigmaPlugin/index.d.ts +11 -0
  162. package/dist/components/editor/plugins/FilePlugin/index.d.ts +1 -0
  163. package/dist/components/editor/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -0
  164. package/dist/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +6 -0
  165. package/dist/components/editor/plugins/ImagesPlugin/index.d.ts +14 -0
  166. package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +32 -0
  167. package/dist/components/editor/plugins/InlineImagePlugin/index.d.ts +16 -0
  168. package/dist/components/editor/plugins/LayoutPlugin/index.d.ts +14 -0
  169. package/dist/components/editor/plugins/LinkPlugin/index.d.ts +13 -0
  170. package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +46 -0
  171. package/dist/components/editor/plugins/MarkdownShortcutPlugin/index.d.ts +2 -0
  172. package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +12 -0
  173. package/dist/components/editor/plugins/PollPlugin/index.d.ts +4 -0
  174. package/dist/components/editor/plugins/ShortcutsPlugin/index.d.ts +13 -0
  175. package/dist/components/editor/plugins/ShortcutsPlugin/shortcuts.d.ts +58 -0
  176. package/dist/components/editor/plugins/SlashCommand/index.d.ts +25 -0
  177. package/dist/components/editor/plugins/SpeechToTextPlugin/index.d.ts +5 -0
  178. package/dist/components/editor/plugins/StoryBuilderPlugin/index.d.ts +7 -0
  179. package/dist/components/editor/plugins/TabFocusPlugin/index.d.ts +1 -0
  180. package/dist/components/editor/plugins/TableCellActionMenuPlugin/index.d.ts +5 -0
  181. package/dist/components/editor/plugins/TableCellResizer/index.d.ts +2 -0
  182. package/dist/components/editor/plugins/TableHoverActionsPlugin/index.d.ts +4 -0
  183. package/dist/components/editor/plugins/TablePlugin/index.d.ts +27 -0
  184. package/dist/components/editor/plugins/TemplatePlugin/TemplateDialog.d.ts +1 -0
  185. package/dist/components/editor/plugins/TemplatePlugin/index.d.ts +3 -0
  186. package/dist/components/editor/plugins/ToolbarPlugin/MobileToolbar.d.ts +10 -0
  187. package/dist/components/editor/plugins/ToolbarPlugin/index.d.ts +11 -0
  188. package/dist/components/editor/plugins/TwitterPlugin/index.d.ts +4 -0
  189. package/dist/components/editor/plugins/VersionHistoryPlugin/NameVersionModal.d.ts +2 -0
  190. package/dist/components/editor/plugins/VersionHistoryPlugin/VersionHistoryDrawer.d.ts +2 -0
  191. package/dist/components/editor/plugins/VersionHistoryPlugin/index.d.ts +2 -0
  192. package/dist/components/editor/plugins/YouTubeNode/index.d.ts +22 -0
  193. package/dist/components/editor/plugins/YouTubePlugin/index.d.ts +11 -0
  194. package/dist/components/editor/templates/data.d.ts +7 -0
  195. package/dist/components/editor/themes/editor-theme.d.ts +3 -0
  196. package/dist/components/editor/utils/ai.d.ts +27 -0
  197. package/dist/components/editor/utils/canUseDOM.d.ts +8 -0
  198. package/dist/components/editor/utils/codeLanguages.d.ts +3 -0
  199. package/dist/components/editor/utils/diffUtils.d.ts +10 -0
  200. package/dist/components/editor/utils/editorFormatting.d.ts +26 -0
  201. package/dist/components/editor/utils/environment.d.ts +17 -0
  202. package/dist/components/editor/utils/extract-data.d.ts +8 -0
  203. package/dist/components/editor/utils/getAllLexicalChildren.d.ts +6 -0
  204. package/dist/components/editor/utils/getDOMRangeRect.d.ts +8 -0
  205. package/dist/components/editor/utils/getSelectedNode.d.ts +2 -0
  206. package/dist/components/editor/utils/gif.d.ts +7 -0
  207. package/dist/components/editor/utils/importUtils.d.ts +27 -0
  208. package/dist/components/editor/utils/invariant.d.ts +1 -0
  209. package/dist/components/editor/utils/markdownTransformers.d.ts +20 -0
  210. package/dist/components/editor/utils/setFloatingElemPosition.d.ts +1 -0
  211. package/dist/components/editor/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
  212. package/dist/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.d.ts +2 -0
  213. package/dist/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.d.ts +2 -0
  214. package/dist/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.d.ts +5 -0
  215. package/dist/components/editor/utils/url.d.ts +11 -0
  216. package/dist/components/editor/utils/useLayoutEffect.d.ts +3 -0
  217. package/dist/components/providers/AIContext.d.ts +21 -0
  218. package/dist/components/providers/CollabContext.d.ts +92 -0
  219. package/dist/components/providers/CommentsContext.d.ts +48 -0
  220. package/dist/components/providers/QueryProvider.d.ts +5 -0
  221. package/dist/components/providers/SharedHistoryContext.d.ts +11 -0
  222. package/dist/components/providers/ToolbarContext.d.ts +61 -0
  223. package/dist/components/providers/UploadContext.d.ts +29 -0
  224. package/dist/components/providers/VersionHistoryContext.d.ts +33 -0
  225. package/dist/components/providers/theme-provider.d.ts +3 -0
  226. package/dist/components/theme/ModeToggle.d.ts +2 -0
  227. package/dist/components/ui/ContentEditable.d.ts +15 -0
  228. package/dist/components/ui/FileInput.d.ts +16 -0
  229. package/dist/components/ui/Modal.d.ts +15 -0
  230. package/dist/components/ui/Select.d.ts +14 -0
  231. package/dist/components/ui/TextInput.d.ts +19 -0
  232. package/dist/components/ui/accordion.d.ts +7 -0
  233. package/dist/components/ui/ai/AIDialog.d.ts +9 -0
  234. package/dist/components/ui/ai/ai-button.d.ts +5 -0
  235. package/dist/components/ui/ai/border.d.ts +8 -0
  236. package/dist/components/ui/ai/placeholder-input-vanish.d.ts +6 -0
  237. package/dist/components/ui/badge.d.ts +9 -0
  238. package/dist/components/ui/button.d.ts +12 -0
  239. package/dist/components/ui/card.d.ts +8 -0
  240. package/dist/components/ui/checkbox.d.ts +4 -0
  241. package/dist/components/ui/command.d.ts +80 -0
  242. package/dist/components/ui/dialog/Dialog.d.ts +16 -0
  243. package/dist/components/ui/dialog.d.ts +19 -0
  244. package/dist/components/ui/drop-downs/background-color.d.ts +12 -0
  245. package/dist/components/ui/drop-downs/block-format.d.ts +25 -0
  246. package/dist/components/ui/drop-downs/code.d.ts +6 -0
  247. package/dist/components/ui/drop-downs/codeTheme.d.ts +8 -0
  248. package/dist/components/ui/drop-downs/color.d.ts +12 -0
  249. package/dist/components/ui/drop-downs/font-size.d.ts +10 -0
  250. package/dist/components/ui/drop-downs/font.d.ts +11 -0
  251. package/dist/components/ui/drop-downs/index.d.ts +24 -0
  252. package/dist/components/ui/drop-downs/insert-node.d.ts +6 -0
  253. package/dist/components/ui/drop-downs/table-dropdown.d.ts +10 -0
  254. package/dist/components/ui/drop-downs/text-align.d.ts +8 -0
  255. package/dist/components/ui/drop-downs/text-format.d.ts +11 -0
  256. package/dist/components/ui/dropdown-menu.d.ts +27 -0
  257. package/dist/components/ui/equation/EquationEditor.d.ts +14 -0
  258. package/dist/components/ui/equation/KatexEquationAlterer.d.ts +14 -0
  259. package/dist/components/ui/equation/KatexRenderer.d.ts +13 -0
  260. package/dist/components/ui/excalidraw/ExcalidrawModal.d.ts +48 -0
  261. package/dist/components/ui/excalidraw/Modal.d.ts +16 -0
  262. package/dist/components/ui/hover-card.d.ts +6 -0
  263. package/dist/components/ui/icons/brand-icons.d.ts +5 -0
  264. package/dist/components/ui/image/error-image.d.ts +2 -0
  265. package/dist/components/ui/image/file-upload.d.ts +8 -0
  266. package/dist/components/ui/image/image-resizer.d.ts +10 -0
  267. package/dist/components/ui/image/image-toolbar.d.ts +8 -0
  268. package/dist/components/ui/image/index.d.ts +16 -0
  269. package/dist/components/ui/image/lazy-image.d.ts +10 -0
  270. package/dist/components/ui/image/lazy-video.d.ts +11 -0
  271. package/dist/components/ui/input.d.ts +3 -0
  272. package/dist/components/ui/label.d.ts +5 -0
  273. package/dist/components/ui/models/custom-dialog.d.ts +58 -0
  274. package/dist/components/ui/models/insert-audio.d.ts +7 -0
  275. package/dist/components/ui/models/insert-file.d.ts +7 -0
  276. package/dist/components/ui/models/insert-gif.d.ts +7 -0
  277. package/dist/components/ui/models/insert-image.d.ts +6 -0
  278. package/dist/components/ui/models/insert-poll.d.ts +5 -0
  279. package/dist/components/ui/models/insert-table.d.ts +6 -0
  280. package/dist/components/ui/models/use-model.d.ts +6 -0
  281. package/dist/components/ui/poll/poll-component.d.ts +8 -0
  282. package/dist/components/ui/popover.d.ts +7 -0
  283. package/dist/components/ui/progress.d.ts +4 -0
  284. package/dist/components/ui/scroll-area.d.ts +5 -0
  285. package/dist/components/ui/separator.d.ts +4 -0
  286. package/dist/components/ui/skeleton.d.ts +2 -0
  287. package/dist/components/ui/sonner.d.ts +4 -0
  288. package/dist/components/ui/stepper/step.d.ts +11 -0
  289. package/dist/components/ui/stepper/stepper.d.ts +6 -0
  290. package/dist/components/ui/tabs.d.ts +7 -0
  291. package/dist/components/ui/textarea.d.ts +3 -0
  292. package/dist/components/ui/toggle.d.ts +14 -0
  293. package/dist/components/ui/tooltip.d.ts +7 -0
  294. package/dist/components/ui/write/text-format-floating.d.ts +27 -0
  295. package/dist/components/ui/write/text-format-floting-toolbar.d.ts +26 -0
  296. package/dist/core/chain.d.ts +4 -0
  297. package/dist/core/editor.d.ts +42 -0
  298. package/dist/core/extension.d.ts +20 -0
  299. package/dist/core/extensions/blocks-kit.d.ts +14 -0
  300. package/dist/core/extensions/copilot-and-collab.d.ts +10 -0
  301. package/dist/core/extensions/nodes-and-marks.d.ts +36 -0
  302. package/dist/core/index.d.ts +10 -0
  303. package/dist/core/react/BubbleMenu.d.ts +13 -0
  304. package/dist/core/react/FloatingMenu.d.ts +12 -0
  305. package/dist/core/react/NotiqContent.d.ts +11 -0
  306. package/dist/core/react/NotiqEditor.d.ts +29 -0
  307. package/dist/core/react/context.d.ts +15 -0
  308. package/dist/core/react/index.d.ts +8 -0
  309. package/dist/core/react/useNotiq.d.ts +16 -0
  310. package/dist/core/types.d.ts +89 -0
  311. package/dist/core.d.ts +1 -0
  312. package/dist/core.js +74458 -0
  313. package/dist/core.mjs +138 -0
  314. package/dist/estree-QRALCFII.mjs +5029 -0
  315. package/dist/font-IJKFR4BM.mjs +12 -0
  316. package/dist/font-size-3HMJHKO2.mjs +15 -0
  317. package/dist/hooks/instructions-messages.d.ts +11 -0
  318. package/dist/hooks/use-mobile.d.ts +1 -0
  319. package/dist/hooks/useModal.d.ts +12 -0
  320. package/dist/hooks/useReport.d.ts +8 -0
  321. package/dist/hooks/useResizeObservert.d.ts +1 -0
  322. package/dist/html-CE2S5FIJ.mjs +3185 -0
  323. package/dist/{image-2PJIAYAT.mjs → image-QPB2CVXP.mjs} +359 -324
  324. package/dist/index.d.ts +13 -145
  325. package/dist/index.js +61491 -44350
  326. package/dist/index.mjs +466 -1569
  327. package/dist/insert-audio-I3PD6JFS.mjs +180 -0
  328. package/dist/insert-file-PHR7XL4V.mjs +190 -0
  329. package/dist/insert-gif-R5ZO4JHC.mjs +112 -0
  330. package/dist/insert-image-PLBZELHK.mjs +348 -0
  331. package/dist/insert-node-DGCZBGKG.mjs +243 -0
  332. package/dist/insert-poll-6BCIFY5G.mjs +36 -0
  333. package/dist/insert-table-ZRJP6X52.mjs +70 -0
  334. package/dist/lib/edgestore.d.ts +2 -0
  335. package/dist/lib/index.d.ts +0 -0
  336. package/dist/lib/pinecone-client.d.ts +3 -0
  337. package/dist/lib/utils.d.ts +2 -0
  338. package/dist/markdown-GMCB4RDA.mjs +6753 -0
  339. package/dist/{poll-component-2R4MDLHS.mjs → poll-component-VHMM5KKZ.mjs} +126 -95
  340. package/dist/{postcss-ONF3VDIM.mjs → postcss-GH4QXSB5.mjs} +1879 -1697
  341. package/dist/react.d.ts +1 -0
  342. package/dist/react.js +73860 -0
  343. package/dist/react.mjs +66 -0
  344. package/dist/standalone-A6VDOPCZ.mjs +2506 -0
  345. package/dist/stepper-KNITDVLG.mjs +356 -0
  346. package/dist/styles/notiq.css +2 -2
  347. package/dist/styles/tailwind-plugin.d.ts +4 -0
  348. package/dist/table-dropdown-4VCRSQB6.mjs +391 -0
  349. package/dist/{text-align-VLECWO4H.mjs → text-align-TEB4S52S.mjs} +22 -19
  350. package/dist/text-format-T3IY7FBI.mjs +15 -0
  351. package/dist/typescript-CGC67LRI.mjs +13392 -0
  352. package/dist/utils/docSerialization.d.ts +10 -0
  353. package/dist/utils/emoji-list.d.ts +27 -0
  354. package/dist/utils/getDOMRangeRect.d.ts +8 -0
  355. package/dist/utils/getSelectedNode.d.ts +2 -0
  356. package/dist/utils/getThemeSelector.d.ts +9 -0
  357. package/dist/utils/html.d.ts +9 -0
  358. package/dist/utils/htmlExport.d.ts +9 -0
  359. package/dist/utils/isMobileWidth.d.ts +7 -0
  360. package/dist/utils/joinClasses.d.ts +8 -0
  361. package/dist/utils/setFloatingElemPosition.d.ts +1 -0
  362. package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
  363. package/dist/utils/swipe.d.ts +11 -0
  364. package/dist/utils/url.d.ts +9 -0
  365. package/package.json +128 -105
  366. package/src/styles/notiq.css +1315 -1150
  367. package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +0 -15
  368. package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +0 -161
  369. package/dist/ExcalidrawComponent-LUZJNFWV.mjs +0 -528
  370. package/dist/ExcalidrawPlugin-HC2L43YG.mjs +0 -14
  371. package/dist/ExportPlugin-V2RLM63S.mjs +0 -11
  372. package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +0 -12
  373. package/dist/FloatingTextFormatToolbarPlugin-ENECEZSX.mjs +0 -30
  374. package/dist/HintComponet-BRL6EAMS.mjs +0 -217
  375. package/dist/MobileToolbar-BOOZAMQE.mjs +0 -268
  376. package/dist/SlashCommand-FHEWHFZU.mjs +0 -28
  377. package/dist/StoryBuilderComponent-JGDBM5JU.mjs +0 -562
  378. package/dist/ToolbarPlugin-2VP7FDWD.mjs +0 -1547
  379. package/dist/babel-JZ2EV6AX.mjs +0 -7233
  380. package/dist/background-color-XZTYLGO2.mjs +0 -362
  381. package/dist/block-format-YJCV2DIY.mjs +0 -15
  382. package/dist/chunk-77KXU36M.mjs +0 -64
  383. package/dist/chunk-AMMKBSST.mjs +0 -1256
  384. package/dist/chunk-EGMI62PP.mjs +0 -83
  385. package/dist/chunk-JXDPPUJI.mjs +0 -52
  386. package/dist/chunk-KJ6AJ44Q.mjs +0 -128
  387. package/dist/chunk-NOJDE3CE.mjs +0 -1906
  388. package/dist/chunk-NZXC6FGU.mjs +0 -214
  389. package/dist/chunk-PBD6LMLC.mjs +0 -366
  390. package/dist/chunk-TTHQCW5F.mjs +0 -47
  391. package/dist/chunk-V2NIZOSQ.mjs +0 -538
  392. package/dist/chunk-WAK5JGNJ.mjs +0 -315
  393. package/dist/chunk-YMBXLRW5.mjs +0 -374
  394. package/dist/chunk-YPHOEJ46.mjs +0 -64
  395. package/dist/chunk-ZJRKATOJ.mjs +0 -65
  396. package/dist/color-BPKOPQKN.mjs +0 -12
  397. package/dist/estree-XC56IUFX.mjs +0 -4414
  398. package/dist/font-FEZ3GKSF.mjs +0 -13
  399. package/dist/font-size-EK775WRH.mjs +0 -15
  400. package/dist/html-S3ACX7NI.mjs +0 -2738
  401. package/dist/index.d.mts +0 -145
  402. package/dist/insert-gif-SAIDYURE.mjs +0 -100
  403. package/dist/insert-image-U3RJN3OW.mjs +0 -259
  404. package/dist/insert-node-WXW4ZER4.mjs +0 -201
  405. package/dist/insert-poll-HCPM7MO6.mjs +0 -33
  406. package/dist/insert-table-24XYUS2W.mjs +0 -66
  407. package/dist/markdown-SNVBOSRA.mjs +0 -3487
  408. package/dist/standalone-EOIALU3M.mjs +0 -2373
  409. package/dist/stepper-JDEE26TX.mjs +0 -304
  410. package/dist/text-format-BG5WOOPZ.mjs +0 -16
  411. package/dist/typescript-AMPI6OVS.mjs +0 -13135
@@ -0,0 +1,944 @@
1
+ import {
2
+ Textarea
3
+ } from "./chunk-3JN6QEJR.mjs";
4
+ import {
5
+ Tabs,
6
+ TabsList,
7
+ TabsTrigger
8
+ } from "./chunk-6UVNHT3T.mjs";
9
+ import {
10
+ DropdownMenu,
11
+ DropdownMenuContent,
12
+ DropdownMenuItem,
13
+ DropdownMenuTrigger
14
+ } from "./chunk-OXWTZV3U.mjs";
15
+ import {
16
+ useComments
17
+ } from "./chunk-R7WFRENU.mjs";
18
+ import {
19
+ useCollab
20
+ } from "./chunk-RJQTA6HG.mjs";
21
+ import {
22
+ Button
23
+ } from "./chunk-OE5JRLCN.mjs";
24
+ import {
25
+ cn
26
+ } from "./chunk-JHXDLYEV.mjs";
27
+ import {
28
+ init_react_shim
29
+ } from "./chunk-WYCFGRFJ.mjs";
30
+
31
+ // src/components/editor/plugins/CommentsPlugin/index.tsx
32
+ init_react_shim();
33
+ import { useEffect as useEffect2 } from "react";
34
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
35
+ import {
36
+ $getSelection,
37
+ $isRangeSelection,
38
+ COMMAND_PRIORITY_LOW,
39
+ createCommand
40
+ } from "lexical";
41
+
42
+ // src/components/editor/plugins/CommentsPlugin/NewCommentDialog.tsx
43
+ init_react_shim();
44
+ import { useState, useRef, useEffect, useMemo as useMemo2 } from "react";
45
+
46
+ // src/components/editor/plugins/CommentsPlugin/MentionsAutocomplete.tsx
47
+ init_react_shim();
48
+ import { useMemo } from "react";
49
+ import { Users } from "lucide-react";
50
+ import { jsx, jsxs } from "react/jsx-runtime";
51
+ function getMentionCandidates(users, query) {
52
+ const clean = query.trim().toLowerCase();
53
+ const results = [];
54
+ if (!clean || "everyone".includes(clean) || "all".includes(clean)) {
55
+ results.push({
56
+ id: "special-everyone",
57
+ name: "everyone",
58
+ color: "#8b5cf6",
59
+ description: "Notify all collaborators",
60
+ isSpecial: true
61
+ });
62
+ }
63
+ for (const u of users) {
64
+ if (!clean || u.name.toLowerCase().includes(clean)) {
65
+ results.push({
66
+ id: u.clientId,
67
+ name: u.name,
68
+ color: u.color,
69
+ avatar: u.avatar,
70
+ isSelf: u.isSelf
71
+ });
72
+ }
73
+ }
74
+ return results;
75
+ }
76
+ function MentionsAutocomplete({
77
+ query,
78
+ users,
79
+ selectedIndex = 0,
80
+ onSelect,
81
+ onHoverIndex,
82
+ className
83
+ }) {
84
+ const items = useMemo(() => getMentionCandidates(users, query), [users, query]);
85
+ if (items.length === 0) return null;
86
+ const safeIndex = Math.min(Math.max(0, selectedIndex), items.length - 1);
87
+ return /* @__PURE__ */ jsxs(
88
+ "div",
89
+ {
90
+ role: "listbox",
91
+ "aria-label": "Mention options",
92
+ className: cn(
93
+ "absolute z-50 w-60 max-h-52 overflow-y-auto rounded-xl border border-border bg-popover/95 p-1 text-popover-foreground shadow-xl backdrop-blur-md text-xs",
94
+ "animate-in fade-in-50 zoom-in-95 duration-100",
95
+ className
96
+ ),
97
+ children: [
98
+ /* @__PURE__ */ jsxs("div", { className: "px-2.5 py-1 text-[10px] font-semibold tracking-wider text-muted-foreground uppercase flex items-center justify-between", children: [
99
+ /* @__PURE__ */ jsx("span", { children: "Mention in thread" }),
100
+ /* @__PURE__ */ jsx("span", { className: "text-[9px] font-mono opacity-70", children: "\u2191\u2193 navigate \u21B5 select" })
101
+ ] }),
102
+ /* @__PURE__ */ jsx("div", { className: "space-y-0.5 mt-0.5", children: items.map((item, index) => {
103
+ const isSelected = index === safeIndex;
104
+ return /* @__PURE__ */ jsxs(
105
+ "button",
106
+ {
107
+ id: `mention-option-${index}`,
108
+ role: "option",
109
+ "aria-selected": isSelected,
110
+ type: "button",
111
+ onMouseEnter: () => onHoverIndex == null ? void 0 : onHoverIndex(index),
112
+ onClick: (e) => {
113
+ e.preventDefault();
114
+ e.stopPropagation();
115
+ onSelect(item);
116
+ },
117
+ className: cn(
118
+ "w-full flex items-center gap-2.5 px-2.5 py-1.5 rounded-lg text-left transition-colors cursor-pointer group select-none",
119
+ isSelected ? "bg-accent text-accent-foreground ring-1 ring-primary/40 font-medium" : "hover:bg-muted/70 text-foreground"
120
+ ),
121
+ children: [
122
+ item.isSpecial ? /* @__PURE__ */ jsx("span", { className: "h-5 w-5 rounded-full flex items-center justify-center bg-purple-600 text-white shrink-0 shadow-xs", children: /* @__PURE__ */ jsx(Users, { className: "h-3 w-3" }) }) : /* @__PURE__ */ jsx(
123
+ "span",
124
+ {
125
+ className: "h-5 w-5 rounded-full flex items-center justify-center text-[10px] font-bold text-white shrink-0 shadow-xs",
126
+ style: { backgroundColor: item.color },
127
+ children: item.name.slice(0, 1).toUpperCase()
128
+ }
129
+ ),
130
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
131
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
132
+ /* @__PURE__ */ jsxs("span", { className: "truncate font-semibold text-foreground group-hover:text-primary", children: [
133
+ "@",
134
+ item.name
135
+ ] }),
136
+ item.isSelf && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "(You)" })
137
+ ] }),
138
+ item.description && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground truncate", children: item.description })
139
+ ] })
140
+ ]
141
+ },
142
+ item.id
143
+ );
144
+ }) })
145
+ ]
146
+ }
147
+ );
148
+ }
149
+
150
+ // src/components/editor/plugins/CommentsPlugin/NewCommentDialog.tsx
151
+ import { MessageSquarePlus, X, Send } from "lucide-react";
152
+ import { motion, AnimatePresence } from "framer-motion";
153
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
154
+ function NewCommentDialog() {
155
+ const { draftComment, setDraftComment, addThread } = useComments();
156
+ const { users, username, cursorColor } = useCollab();
157
+ const [commentText, setCommentText] = useState("");
158
+ const [mentionQuery, setMentionQuery] = useState(null);
159
+ const [mentionIndex, setMentionIndex] = useState(0);
160
+ const textareaRef = useRef(null);
161
+ const backdropRef = useRef(null);
162
+ const mentionCandidates = useMemo2(
163
+ () => mentionQuery !== null ? getMentionCandidates(users, mentionQuery) : [],
164
+ [users, mentionQuery]
165
+ );
166
+ useEffect(() => {
167
+ if (draftComment == null ? void 0 : draftComment.isOpen) {
168
+ setCommentText("");
169
+ setMentionQuery(null);
170
+ setMentionIndex(0);
171
+ setTimeout(() => {
172
+ var _a;
173
+ return (_a = textareaRef.current) == null ? void 0 : _a.focus();
174
+ }, 50);
175
+ }
176
+ }, [draftComment == null ? void 0 : draftComment.isOpen]);
177
+ if (!(draftComment == null ? void 0 : draftComment.isOpen)) return null;
178
+ const handleTextChange = (e) => {
179
+ const val = e.target.value;
180
+ setCommentText(val);
181
+ const cursorPos = e.target.selectionStart || 0;
182
+ const textBeforeCursor = val.slice(0, cursorPos);
183
+ const mentionMatch = textBeforeCursor.match(/@([A-Za-z0-9_]*)$/);
184
+ if (mentionMatch) {
185
+ setMentionQuery(mentionMatch[1]);
186
+ setMentionIndex(0);
187
+ } else {
188
+ setMentionQuery(null);
189
+ }
190
+ };
191
+ const handleSelectMention = (item) => {
192
+ if (!textareaRef.current) return;
193
+ const cursorPos = textareaRef.current.selectionStart || 0;
194
+ const textBeforeCursor = commentText.slice(0, cursorPos);
195
+ const textAfterCursor = commentText.slice(cursorPos);
196
+ const updatedBefore = textBeforeCursor.replace(/@([A-Za-z0-9_]*)$/, `@${item.name} `);
197
+ setCommentText(updatedBefore + textAfterCursor);
198
+ setMentionQuery(null);
199
+ setMentionIndex(0);
200
+ textareaRef.current.focus();
201
+ };
202
+ const handleSubmit = (e) => {
203
+ e == null ? void 0 : e.preventDefault();
204
+ if (!commentText.trim()) return;
205
+ addThread(draftComment.quote, commentText);
206
+ };
207
+ const handleKeyDown = (e) => {
208
+ if (mentionQuery !== null && mentionCandidates.length > 0) {
209
+ if (e.key === "ArrowDown") {
210
+ e.preventDefault();
211
+ setMentionIndex((prev) => (prev + 1) % mentionCandidates.length);
212
+ return;
213
+ }
214
+ if (e.key === "ArrowUp") {
215
+ e.preventDefault();
216
+ setMentionIndex((prev) => (prev - 1 + mentionCandidates.length) % mentionCandidates.length);
217
+ return;
218
+ }
219
+ if (e.key === "Enter" || e.key === "Tab") {
220
+ e.preventDefault();
221
+ const candidate = mentionCandidates[mentionIndex] || mentionCandidates[0];
222
+ if (candidate) {
223
+ handleSelectMention(candidate);
224
+ }
225
+ return;
226
+ }
227
+ if (e.key === "Escape") {
228
+ e.preventDefault();
229
+ setMentionQuery(null);
230
+ return;
231
+ }
232
+ }
233
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
234
+ e.preventDefault();
235
+ handleSubmit(e);
236
+ return;
237
+ }
238
+ if (e.key === "Escape" && mentionQuery === null) {
239
+ e.preventDefault();
240
+ setDraftComment(null);
241
+ }
242
+ };
243
+ return /* @__PURE__ */ jsx2(AnimatePresence, { children: /* @__PURE__ */ jsx2(
244
+ "div",
245
+ {
246
+ ref: backdropRef,
247
+ onClick: (e) => {
248
+ if (e.target === backdropRef.current) {
249
+ setDraftComment(null);
250
+ }
251
+ },
252
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/50 backdrop-blur-xs",
253
+ children: /* @__PURE__ */ jsxs2(
254
+ motion.div,
255
+ {
256
+ initial: { opacity: 0, scale: 0.95, y: 10 },
257
+ animate: { opacity: 1, scale: 1, y: 0 },
258
+ exit: { opacity: 0, scale: 0.95, y: 10 },
259
+ transition: { duration: 0.15 },
260
+ className: "w-full max-w-md rounded-2xl border border-border bg-card p-4 shadow-xl text-xs space-y-3",
261
+ children: [
262
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pb-1 border-b border-border/50", children: [
263
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 font-semibold text-foreground", children: [
264
+ /* @__PURE__ */ jsx2(MessageSquarePlus, { className: "h-4 w-4 text-primary" }),
265
+ /* @__PURE__ */ jsx2("span", { children: "New Comment Discussion" })
266
+ ] }),
267
+ /* @__PURE__ */ jsx2(
268
+ "button",
269
+ {
270
+ type: "button",
271
+ onClick: () => setDraftComment(null),
272
+ className: "text-muted-foreground hover:text-foreground p-1 rounded-md transition-colors cursor-pointer",
273
+ "aria-label": "Close comment dialog",
274
+ children: /* @__PURE__ */ jsx2(X, { className: "h-4 w-4" })
275
+ }
276
+ )
277
+ ] }),
278
+ draftComment.quote && /* @__PURE__ */ jsxs2("div", { className: "pl-3 py-1.5 border-l-2 border-primary bg-muted/40 rounded-r-lg text-muted-foreground italic line-clamp-3 font-serif", children: [
279
+ "\u201C",
280
+ draftComment.quote,
281
+ "\u201D"
282
+ ] }),
283
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-muted-foreground text-[11px]", children: [
284
+ /* @__PURE__ */ jsx2(
285
+ "span",
286
+ {
287
+ className: "h-4 w-4 rounded-full flex items-center justify-center text-[9px] font-bold text-white shadow-xs",
288
+ style: { backgroundColor: cursorColor },
289
+ children: username.slice(0, 1).toUpperCase()
290
+ }
291
+ ),
292
+ /* @__PURE__ */ jsxs2("span", { children: [
293
+ "Commenting as ",
294
+ /* @__PURE__ */ jsx2("strong", { className: "text-foreground", children: username })
295
+ ] })
296
+ ] }),
297
+ /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "relative space-y-3", children: [
298
+ /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
299
+ /* @__PURE__ */ jsx2(
300
+ Textarea,
301
+ {
302
+ ref: textareaRef,
303
+ value: commentText,
304
+ onChange: handleTextChange,
305
+ onKeyDown: handleKeyDown,
306
+ placeholder: "Write your thought... (Type @ to mention collaborators)",
307
+ className: "min-h-[85px] resize-none text-xs rounded-xl focus-visible:ring-1"
308
+ }
309
+ ),
310
+ mentionQuery !== null && /* @__PURE__ */ jsx2(
311
+ MentionsAutocomplete,
312
+ {
313
+ query: mentionQuery,
314
+ users,
315
+ selectedIndex: mentionIndex,
316
+ onHoverIndex: setMentionIndex,
317
+ onSelect: handleSelectMention,
318
+ className: "bottom-full mb-1 left-0"
319
+ }
320
+ )
321
+ ] }),
322
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pt-1", children: [
323
+ /* @__PURE__ */ jsxs2("span", { className: "text-[10px] text-muted-foreground", children: [
324
+ "Tip: Press ",
325
+ /* @__PURE__ */ jsx2("kbd", { className: "px-1 py-0.5 rounded bg-muted border border-border/80", children: "Ctrl" }),
326
+ " + ",
327
+ /* @__PURE__ */ jsx2("kbd", { className: "px-1 py-0.5 rounded bg-muted border border-border/80", children: "Enter" }),
328
+ " to submit"
329
+ ] }),
330
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
331
+ /* @__PURE__ */ jsx2(
332
+ Button,
333
+ {
334
+ type: "button",
335
+ variant: "ghost",
336
+ size: "sm",
337
+ onClick: () => setDraftComment(null),
338
+ className: "h-7 px-3 text-xs",
339
+ children: "Cancel"
340
+ }
341
+ ),
342
+ /* @__PURE__ */ jsxs2(
343
+ Button,
344
+ {
345
+ type: "submit",
346
+ size: "sm",
347
+ disabled: !commentText.trim(),
348
+ className: "h-7 px-3 text-xs gap-1.5 shadow-xs",
349
+ children: [
350
+ /* @__PURE__ */ jsx2(Send, { className: "h-3 w-3" }),
351
+ "Comment"
352
+ ]
353
+ }
354
+ )
355
+ ] })
356
+ ] })
357
+ ] })
358
+ ]
359
+ }
360
+ )
361
+ }
362
+ ) });
363
+ }
364
+
365
+ // src/components/editor/plugins/CommentsPlugin/CommentsSidebar.tsx
366
+ init_react_shim();
367
+ import { useState as useState3, useMemo as useMemo4 } from "react";
368
+
369
+ // src/components/editor/plugins/CommentsPlugin/CommentThreadItem.tsx
370
+ init_react_shim();
371
+ import { useState as useState2, useRef as useRef2, useMemo as useMemo3 } from "react";
372
+ import {
373
+ Check,
374
+ RotateCcw,
375
+ Trash2,
376
+ CornerDownRight,
377
+ Send as Send2,
378
+ MoreVertical,
379
+ Crosshair
380
+ } from "lucide-react";
381
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
382
+ function formatRelativeTime(timestamp) {
383
+ const seconds = Math.floor((Date.now() - timestamp) / 1e3);
384
+ if (seconds < 60) return "Just now";
385
+ const minutes = Math.floor(seconds / 60);
386
+ if (minutes < 60) return `${minutes}m ago`;
387
+ const hours = Math.floor(minutes / 60);
388
+ if (hours < 24) return `${hours}h ago`;
389
+ const days = Math.floor(hours / 24);
390
+ return `${days}d ago`;
391
+ }
392
+ function renderMessageContent(content) {
393
+ const parts = content.split(/(@[A-Za-z0-9_\s-]+)/g);
394
+ return parts.map((part, i) => {
395
+ if (part.startsWith("@")) {
396
+ const isEveryone = part.toLowerCase().includes("@everyone") || part.toLowerCase().includes("@all");
397
+ return /* @__PURE__ */ jsx3(
398
+ "span",
399
+ {
400
+ className: cn(
401
+ "inline-flex items-center px-1.5 py-0.2 mx-0.5 rounded-md font-semibold text-[11px] shadow-2xs font-mono",
402
+ isEveryone ? "bg-purple-500/15 text-purple-600 dark:text-purple-300 border border-purple-500/20" : "bg-primary/10 text-primary dark:text-primary-foreground border border-primary/20"
403
+ ),
404
+ children: part
405
+ },
406
+ i
407
+ );
408
+ }
409
+ return /* @__PURE__ */ jsx3("span", { children: part }, i);
410
+ });
411
+ }
412
+ function CommentThreadItem({
413
+ thread,
414
+ isActive,
415
+ onSelect
416
+ }) {
417
+ const { addReply, toggleResolveThread, deleteThread, jumpToQuote } = useComments();
418
+ const { users } = useCollab();
419
+ const [replyText, setReplyText] = useState2("");
420
+ const [isReplying, setIsReplying] = useState2(false);
421
+ const [mentionQuery, setMentionQuery] = useState2(null);
422
+ const [mentionIndex, setMentionIndex] = useState2(0);
423
+ const textareaRef = useRef2(null);
424
+ const mentionCandidates = useMemo3(
425
+ () => mentionQuery !== null ? getMentionCandidates(users, mentionQuery) : [],
426
+ [users, mentionQuery]
427
+ );
428
+ const handleReplyChange = (e) => {
429
+ const val = e.target.value;
430
+ setReplyText(val);
431
+ const cursorPos = e.target.selectionStart || 0;
432
+ const textBeforeCursor = val.slice(0, cursorPos);
433
+ const mentionMatch = textBeforeCursor.match(/@([A-Za-z0-9_]*)$/);
434
+ if (mentionMatch) {
435
+ setMentionQuery(mentionMatch[1]);
436
+ setMentionIndex(0);
437
+ } else {
438
+ setMentionQuery(null);
439
+ }
440
+ };
441
+ const handleSelectMention = (item) => {
442
+ if (!textareaRef.current) return;
443
+ const cursorPos = textareaRef.current.selectionStart || 0;
444
+ const textBeforeCursor = replyText.slice(0, cursorPos);
445
+ const textAfterCursor = replyText.slice(cursorPos);
446
+ const updatedBefore = textBeforeCursor.replace(/@([A-Za-z0-9_]*)$/, `@${item.name} `);
447
+ setReplyText(updatedBefore + textAfterCursor);
448
+ setMentionQuery(null);
449
+ setMentionIndex(0);
450
+ textareaRef.current.focus();
451
+ };
452
+ const handleSubmitReply = (e) => {
453
+ e.preventDefault();
454
+ if (!replyText.trim()) return;
455
+ addReply(thread.id, replyText);
456
+ setReplyText("");
457
+ setIsReplying(false);
458
+ setMentionQuery(null);
459
+ setMentionIndex(0);
460
+ };
461
+ const handleKeyDown = (e) => {
462
+ if (mentionQuery !== null && mentionCandidates.length > 0) {
463
+ if (e.key === "ArrowDown") {
464
+ e.preventDefault();
465
+ setMentionIndex((prev) => (prev + 1) % mentionCandidates.length);
466
+ return;
467
+ }
468
+ if (e.key === "ArrowUp") {
469
+ e.preventDefault();
470
+ setMentionIndex((prev) => (prev - 1 + mentionCandidates.length) % mentionCandidates.length);
471
+ return;
472
+ }
473
+ if (e.key === "Enter" || e.key === "Tab") {
474
+ e.preventDefault();
475
+ const candidate = mentionCandidates[mentionIndex] || mentionCandidates[0];
476
+ if (candidate) {
477
+ handleSelectMention(candidate);
478
+ }
479
+ return;
480
+ }
481
+ if (e.key === "Escape") {
482
+ e.preventDefault();
483
+ setMentionQuery(null);
484
+ return;
485
+ }
486
+ }
487
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
488
+ e.preventDefault();
489
+ handleSubmitReply(e);
490
+ }
491
+ };
492
+ const handleCardClick = () => {
493
+ onSelect == null ? void 0 : onSelect();
494
+ if (thread.quote) {
495
+ jumpToQuote(thread.quote, thread.id);
496
+ }
497
+ };
498
+ return /* @__PURE__ */ jsxs3(
499
+ "div",
500
+ {
501
+ onClick: handleCardClick,
502
+ className: cn(
503
+ "rounded-xl border p-3.5 transition-all text-xs bg-card shadow-xs group cursor-pointer",
504
+ isActive ? "border-primary ring-1 ring-primary/40 shadow-sm" : "border-border/60 hover:border-border/90",
505
+ thread.resolved && "opacity-75 bg-muted/30"
506
+ ),
507
+ children: [
508
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-2 mb-2", children: [
509
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 min-w-0", children: [
510
+ /* @__PURE__ */ jsx3(
511
+ "span",
512
+ {
513
+ className: "h-5 w-5 rounded-full flex items-center justify-center text-[10px] font-bold text-white shrink-0 shadow-xs",
514
+ style: { backgroundColor: thread.author.color },
515
+ children: thread.author.name.slice(0, 1).toUpperCase()
516
+ }
517
+ ),
518
+ /* @__PURE__ */ jsx3("span", { className: "font-semibold text-foreground truncate", children: thread.author.name }),
519
+ /* @__PURE__ */ jsx3("span", { className: "text-[10px] text-muted-foreground shrink-0", children: formatRelativeTime(thread.createdAt) })
520
+ ] }),
521
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 opacity-90 group-hover:opacity-100", children: [
522
+ /* @__PURE__ */ jsx3(
523
+ Button,
524
+ {
525
+ variant: "ghost",
526
+ size: "sm",
527
+ onClick: (e) => {
528
+ e.stopPropagation();
529
+ toggleResolveThread(thread.id);
530
+ },
531
+ className: cn(
532
+ "h-6 px-1.5 text-[11px] gap-1 rounded-md cursor-pointer",
533
+ thread.resolved ? "text-emerald-600 hover:text-emerald-700 hover:bg-emerald-50 dark:hover:bg-emerald-950/40" : "text-muted-foreground hover:text-foreground hover:bg-muted"
534
+ ),
535
+ title: thread.resolved ? "Reopen discussion" : "Resolve discussion",
536
+ children: thread.resolved ? /* @__PURE__ */ jsxs3(Fragment, { children: [
537
+ /* @__PURE__ */ jsx3(RotateCcw, { className: "h-3 w-3" }),
538
+ /* @__PURE__ */ jsx3("span", { children: "Reopen" })
539
+ ] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
540
+ /* @__PURE__ */ jsx3(Check, { className: "h-3 w-3" }),
541
+ /* @__PURE__ */ jsx3("span", { children: "Resolve" })
542
+ ] })
543
+ }
544
+ ),
545
+ /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
546
+ /* @__PURE__ */ jsx3(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(
547
+ Button,
548
+ {
549
+ variant: "ghost",
550
+ size: "sm",
551
+ className: "h-6 w-6 p-0 hover:bg-muted rounded-md text-muted-foreground cursor-pointer",
552
+ children: /* @__PURE__ */ jsx3(MoreVertical, { className: "h-3 w-3" })
553
+ }
554
+ ) }),
555
+ /* @__PURE__ */ jsx3(DropdownMenuContent, { align: "end", className: "text-xs", children: /* @__PURE__ */ jsxs3(
556
+ DropdownMenuItem,
557
+ {
558
+ onClick: (e) => {
559
+ e.stopPropagation();
560
+ deleteThread(thread.id);
561
+ },
562
+ className: "text-destructive focus:text-destructive gap-1.5 cursor-pointer",
563
+ children: [
564
+ /* @__PURE__ */ jsx3(Trash2, { className: "h-3.5 w-3.5" }),
565
+ "Delete thread"
566
+ ]
567
+ }
568
+ ) })
569
+ ] })
570
+ ] })
571
+ ] }),
572
+ thread.quote && /* @__PURE__ */ jsxs3(
573
+ "button",
574
+ {
575
+ type: "button",
576
+ onClick: (e) => {
577
+ e.stopPropagation();
578
+ jumpToQuote(thread.quote, thread.id);
579
+ },
580
+ className: "w-full text-left relative mb-2.5 pl-2.5 py-1.5 pr-2 border-l-2 border-primary/60 bg-muted/40 hover:bg-muted/70 rounded-r-lg text-muted-foreground hover:text-foreground font-serif text-[11px] italic transition-all flex items-center justify-between group/quote cursor-pointer",
581
+ title: "Click to jump to quoted text in document",
582
+ children: [
583
+ /* @__PURE__ */ jsxs3("span", { className: "line-clamp-2 flex-1", children: [
584
+ "\u201C",
585
+ thread.quote,
586
+ "\u201D"
587
+ ] }),
588
+ /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-1 text-[10px] text-primary font-sans font-medium not-italic opacity-70 group-hover/quote:opacity-100 ml-2 shrink-0", children: [
589
+ /* @__PURE__ */ jsx3(Crosshair, { className: "h-3 w-3" }),
590
+ /* @__PURE__ */ jsx3("span", { className: "hidden sm:inline", children: "Jump" })
591
+ ] })
592
+ ]
593
+ }
594
+ ),
595
+ /* @__PURE__ */ jsx3("div", { className: "space-y-2 mb-3", children: thread.messages.map((msg, index) => /* @__PURE__ */ jsxs3("div", { className: "space-y-0.5", children: [
596
+ index > 0 && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground pt-1", children: [
597
+ /* @__PURE__ */ jsx3(
598
+ "span",
599
+ {
600
+ className: "h-3.5 w-3.5 rounded-full flex items-center justify-center text-[8px] font-bold text-white shrink-0",
601
+ style: { backgroundColor: msg.author.color },
602
+ children: msg.author.name.slice(0, 1).toUpperCase()
603
+ }
604
+ ),
605
+ /* @__PURE__ */ jsx3("span", { className: "font-semibold text-foreground/80", children: msg.author.name }),
606
+ /* @__PURE__ */ jsx3("span", { children: "\u2022" }),
607
+ /* @__PURE__ */ jsx3("span", { children: formatRelativeTime(msg.createdAt) })
608
+ ] }),
609
+ /* @__PURE__ */ jsx3("p", { className: "text-foreground/90 leading-relaxed whitespace-pre-wrap break-words pl-0.5", children: renderMessageContent(msg.content) })
610
+ ] }, msg.id)) }),
611
+ !thread.resolved && /* @__PURE__ */ jsx3(Fragment, { children: isReplying ? /* @__PURE__ */ jsxs3(
612
+ "form",
613
+ {
614
+ onSubmit: handleSubmitReply,
615
+ onClick: (e) => e.stopPropagation(),
616
+ className: "relative mt-2",
617
+ children: [
618
+ /* @__PURE__ */ jsx3(
619
+ Textarea,
620
+ {
621
+ ref: textareaRef,
622
+ value: replyText,
623
+ onChange: handleReplyChange,
624
+ onKeyDown: handleKeyDown,
625
+ placeholder: "Write a reply... (use @ to mention)",
626
+ className: "min-h-[58px] text-xs resize-none pr-14 py-1.5 rounded-lg border-border/80 focus-visible:ring-1",
627
+ autoFocus: true
628
+ }
629
+ ),
630
+ mentionQuery !== null && /* @__PURE__ */ jsx3(
631
+ MentionsAutocomplete,
632
+ {
633
+ query: mentionQuery,
634
+ users,
635
+ selectedIndex: mentionIndex,
636
+ onHoverIndex: setMentionIndex,
637
+ onSelect: handleSelectMention,
638
+ className: "bottom-full mb-1 left-0"
639
+ }
640
+ ),
641
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-1.5 mt-1.5", children: [
642
+ /* @__PURE__ */ jsx3(
643
+ Button,
644
+ {
645
+ type: "button",
646
+ variant: "ghost",
647
+ size: "sm",
648
+ onClick: () => setIsReplying(false),
649
+ className: "h-6 px-2 text-[11px]",
650
+ children: "Cancel"
651
+ }
652
+ ),
653
+ /* @__PURE__ */ jsxs3(
654
+ Button,
655
+ {
656
+ type: "submit",
657
+ size: "sm",
658
+ disabled: !replyText.trim(),
659
+ className: "h-6 px-2.5 text-[11px] gap-1 cursor-pointer",
660
+ children: [
661
+ /* @__PURE__ */ jsx3(Send2, { className: "h-2.5 w-2.5" }),
662
+ "Reply"
663
+ ]
664
+ }
665
+ )
666
+ ] })
667
+ ]
668
+ }
669
+ ) : /* @__PURE__ */ jsxs3(
670
+ "button",
671
+ {
672
+ type: "button",
673
+ onClick: (e) => {
674
+ e.stopPropagation();
675
+ setIsReplying(true);
676
+ },
677
+ className: "flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground font-medium transition-colors pt-1 cursor-pointer",
678
+ children: [
679
+ /* @__PURE__ */ jsx3(CornerDownRight, { className: "h-3 w-3 text-muted-foreground/70" }),
680
+ "Reply to thread..."
681
+ ]
682
+ }
683
+ ) })
684
+ ]
685
+ }
686
+ );
687
+ }
688
+
689
+ // src/components/editor/plugins/CommentsPlugin/CommentsSidebar.tsx
690
+ import { MessageSquare, X as X2, Inbox, Search, Sparkles } from "lucide-react";
691
+ import { motion as motion2, AnimatePresence as AnimatePresence2 } from "framer-motion";
692
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
693
+ function CommentsSidebar() {
694
+ const {
695
+ threads,
696
+ activeThreadId,
697
+ setActiveThreadId,
698
+ isSidebarOpen,
699
+ setIsSidebarOpen,
700
+ unresolvedCount
701
+ } = useComments();
702
+ const [filter, setFilter] = useState3("open");
703
+ const [searchQuery, setSearchQuery] = useState3("");
704
+ const openThreads = useMemo4(() => threads.filter((t) => !t.resolved), [threads]);
705
+ const resolvedThreads = useMemo4(() => threads.filter((t) => t.resolved), [threads]);
706
+ const baseThreads = filter === "open" ? openThreads : filter === "resolved" ? resolvedThreads : threads;
707
+ const displayedThreads = useMemo4(() => {
708
+ if (!searchQuery.trim()) return baseThreads;
709
+ const clean = searchQuery.toLowerCase().trim();
710
+ return baseThreads.filter((t) => {
711
+ var _a, _b, _c, _d;
712
+ const matchQuote = (_a = t.quote) == null ? void 0 : _a.toLowerCase().includes(clean);
713
+ const matchAuthor = (_c = (_b = t.author) == null ? void 0 : _b.name) == null ? void 0 : _c.toLowerCase().includes(clean);
714
+ const matchMessage = (_d = t.messages) == null ? void 0 : _d.some(
715
+ (m) => {
716
+ var _a2, _b2, _c2;
717
+ return ((_a2 = m.content) == null ? void 0 : _a2.toLowerCase().includes(clean)) || ((_c2 = (_b2 = m.author) == null ? void 0 : _b2.name) == null ? void 0 : _c2.toLowerCase().includes(clean));
718
+ }
719
+ );
720
+ return matchQuote || matchAuthor || matchMessage;
721
+ });
722
+ }, [baseThreads, searchQuery]);
723
+ const sortedThreads = useMemo4(
724
+ () => [...displayedThreads].sort((a, b) => b.createdAt - a.createdAt),
725
+ [displayedThreads]
726
+ );
727
+ return /* @__PURE__ */ jsx4(AnimatePresence2, { children: isSidebarOpen && /* @__PURE__ */ jsxs4(Fragment2, { children: [
728
+ /* @__PURE__ */ jsx4(
729
+ motion2.div,
730
+ {
731
+ initial: { opacity: 0 },
732
+ animate: { opacity: 1 },
733
+ exit: { opacity: 0 },
734
+ onClick: () => setIsSidebarOpen(false),
735
+ className: "fixed inset-0 z-39 bg-black/40 backdrop-blur-2xs sm:hidden",
736
+ "aria-hidden": "true"
737
+ }
738
+ ),
739
+ /* @__PURE__ */ jsxs4(
740
+ motion2.aside,
741
+ {
742
+ initial: { x: "100%", opacity: 0 },
743
+ animate: { x: 0, opacity: 1 },
744
+ exit: { x: "100%", opacity: 0 },
745
+ transition: { duration: 0.22, ease: "easeOut" },
746
+ className: cn(
747
+ "fixed top-14 right-0 bottom-0 z-40 w-full sm:w-80 md:w-96 max-w-full",
748
+ "border-l border-border/80 bg-background/95 backdrop-blur-xl shadow-2xl",
749
+ "flex flex-col select-none"
750
+ ),
751
+ children: [
752
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-4 py-3 border-b border-border/60", children: [
753
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 font-semibold text-sm", children: [
754
+ /* @__PURE__ */ jsx4(MessageSquare, { className: "h-4 w-4 text-primary" }),
755
+ /* @__PURE__ */ jsx4("span", { children: "Discussions & Comments" }),
756
+ unresolvedCount > 0 && /* @__PURE__ */ jsx4("span", { className: "px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-primary text-primary-foreground", children: unresolvedCount })
757
+ ] }),
758
+ /* @__PURE__ */ jsx4(
759
+ Button,
760
+ {
761
+ variant: "ghost",
762
+ size: "sm",
763
+ onClick: () => setIsSidebarOpen(false),
764
+ className: "h-7 w-7 p-0 rounded-full hover:bg-muted text-muted-foreground hover:text-foreground cursor-pointer",
765
+ "aria-label": "Close discussions sidebar",
766
+ children: /* @__PURE__ */ jsx4(X2, { className: "h-4 w-4" })
767
+ }
768
+ )
769
+ ] }),
770
+ /* @__PURE__ */ jsxs4("div", { className: "px-4 py-2 border-b border-border/40 bg-muted/20 space-y-2", children: [
771
+ /* @__PURE__ */ jsx4(
772
+ Tabs,
773
+ {
774
+ value: filter,
775
+ onValueChange: (val) => setFilter(val),
776
+ className: "w-full",
777
+ children: /* @__PURE__ */ jsxs4(TabsList, { className: "grid grid-cols-3 h-7 text-xs p-0.5", children: [
778
+ /* @__PURE__ */ jsxs4(TabsTrigger, { value: "open", className: "text-[11px] py-1 cursor-pointer", children: [
779
+ "Open (",
780
+ openThreads.length,
781
+ ")"
782
+ ] }),
783
+ /* @__PURE__ */ jsxs4(TabsTrigger, { value: "resolved", className: "text-[11px] py-1 cursor-pointer", children: [
784
+ "Resolved (",
785
+ resolvedThreads.length,
786
+ ")"
787
+ ] }),
788
+ /* @__PURE__ */ jsxs4(TabsTrigger, { value: "all", className: "text-[11px] py-1 cursor-pointer", children: [
789
+ "All (",
790
+ threads.length,
791
+ ")"
792
+ ] })
793
+ ] })
794
+ }
795
+ ),
796
+ threads.length > 2 && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
797
+ /* @__PURE__ */ jsx4(Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none" }),
798
+ /* @__PURE__ */ jsx4(
799
+ "input",
800
+ {
801
+ type: "text",
802
+ value: searchQuery,
803
+ onChange: (e) => setSearchQuery(e.target.value),
804
+ placeholder: "Search comments or @mentions...",
805
+ className: "w-full pl-8 pr-7 py-1 text-xs rounded-md bg-background border border-border/70 placeholder:text-muted-foreground/60 focus:outline-none focus:ring-1 focus:ring-primary"
806
+ }
807
+ ),
808
+ searchQuery && /* @__PURE__ */ jsx4(
809
+ "button",
810
+ {
811
+ type: "button",
812
+ onClick: () => setSearchQuery(""),
813
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground p-0.5",
814
+ children: /* @__PURE__ */ jsx4(X2, { className: "h-3 w-3" })
815
+ }
816
+ )
817
+ ] })
818
+ ] }),
819
+ /* @__PURE__ */ jsx4("div", { className: "flex-1 overflow-y-auto p-4 space-y-3", children: sortedThreads.length > 0 ? sortedThreads.map((thread) => /* @__PURE__ */ jsx4(
820
+ CommentThreadItem,
821
+ {
822
+ thread,
823
+ isActive: activeThreadId === thread.id,
824
+ onSelect: () => setActiveThreadId(thread.id)
825
+ },
826
+ thread.id
827
+ )) : /* @__PURE__ */ jsxs4("div", { className: "h-full min-h-[220px] flex flex-col items-center justify-center text-center p-6 text-muted-foreground space-y-2.5", children: [
828
+ /* @__PURE__ */ jsx4("div", { className: "h-10 w-10 rounded-full bg-muted flex items-center justify-center shadow-2xs", children: searchQuery ? /* @__PURE__ */ jsx4(Search, { className: "h-5 w-5 text-muted-foreground/60" }) : /* @__PURE__ */ jsx4(Inbox, { className: "h-5 w-5 text-muted-foreground/60" }) }),
829
+ /* @__PURE__ */ jsx4("p", { className: "text-xs font-semibold text-foreground", children: searchQuery ? `No discussions matching "${searchQuery}"` : filter === "resolved" ? "No resolved discussions yet" : "All caught up! No open comments" }),
830
+ /* @__PURE__ */ jsx4("p", { className: "text-[11px] text-muted-foreground leading-normal max-w-[220px]", children: searchQuery ? "Try searching for a different keyword, author, or quoted text." : "Highlight any text in the document and press Ctrl+Alt+M (or click Comment in toolbar) to start a discussion." }),
831
+ !searchQuery && /* @__PURE__ */ jsxs4("div", { className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-muted/60 text-[10px] text-muted-foreground font-mono mt-1 border border-border/50", children: [
832
+ /* @__PURE__ */ jsx4(Sparkles, { className: "h-3 w-3 text-primary" }),
833
+ /* @__PURE__ */ jsx4("span", { children: "Ctrl+Alt+M to comment" })
834
+ ] })
835
+ ] }) })
836
+ ]
837
+ }
838
+ )
839
+ ] }) });
840
+ }
841
+
842
+ // src/components/editor/plugins/CommentsPlugin/index.tsx
843
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
844
+ var INSERT_COMMENT_COMMAND = createCommand(
845
+ "INSERT_COMMENT_COMMAND"
846
+ );
847
+ function findDOMElementForQuote(root, quote) {
848
+ var _a, _b, _c;
849
+ const clean = quote.trim().toLowerCase();
850
+ if (!clean) return null;
851
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
852
+ let node;
853
+ while (node = walker.nextNode()) {
854
+ const text = ((_a = node.textContent) == null ? void 0 : _a.toLowerCase()) || "";
855
+ if (text.includes(clean)) {
856
+ return node.parentElement || null;
857
+ }
858
+ }
859
+ const blockCandidates = root.querySelectorAll(
860
+ "p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th"
861
+ );
862
+ for (const el of Array.from(blockCandidates)) {
863
+ const text = ((_b = el.textContent) == null ? void 0 : _b.toLowerCase()) || "";
864
+ if (text.includes(clean)) {
865
+ return el;
866
+ }
867
+ }
868
+ if (clean.length > 25) {
869
+ const prefix = clean.slice(0, 25);
870
+ for (const el of Array.from(blockCandidates)) {
871
+ if ((_c = el.textContent) == null ? void 0 : _c.toLowerCase().includes(prefix)) {
872
+ return el;
873
+ }
874
+ }
875
+ }
876
+ return null;
877
+ }
878
+ function CommentsPlugin() {
879
+ const [editor] = useLexicalComposerContext();
880
+ const { setDraftComment } = useComments();
881
+ useEffect2(() => {
882
+ const handleJump = (e) => {
883
+ var _a;
884
+ const customEvent = e;
885
+ const quote = (_a = customEvent.detail) == null ? void 0 : _a.quote;
886
+ if (!quote) return;
887
+ const root = editor.getRootElement();
888
+ if (!root) return;
889
+ const target = findDOMElementForQuote(root, quote);
890
+ if (target) {
891
+ target.scrollIntoView({ behavior: "smooth", block: "center" });
892
+ target.classList.remove("notiq-pulse-highlight");
893
+ void target.offsetWidth;
894
+ target.classList.add("notiq-pulse-highlight");
895
+ setTimeout(() => {
896
+ target.classList.remove("notiq-pulse-highlight");
897
+ }, 2600);
898
+ }
899
+ };
900
+ window.addEventListener("notiq:jump-to-quote", handleJump);
901
+ return () => window.removeEventListener("notiq:jump-to-quote", handleJump);
902
+ }, [editor]);
903
+ useEffect2(() => {
904
+ return editor.registerCommand(
905
+ INSERT_COMMENT_COMMAND,
906
+ () => {
907
+ editor.getEditorState().read(() => {
908
+ const selection = $getSelection();
909
+ if ($isRangeSelection(selection)) {
910
+ const quote = selection.getTextContent();
911
+ if (quote.trim()) {
912
+ setDraftComment({
913
+ quote: quote.trim(),
914
+ isOpen: true
915
+ });
916
+ }
917
+ }
918
+ });
919
+ return true;
920
+ },
921
+ COMMAND_PRIORITY_LOW
922
+ );
923
+ }, [editor, setDraftComment]);
924
+ useEffect2(() => {
925
+ const handleKeyDown = (e) => {
926
+ if ((e.ctrlKey || e.metaKey) && e.altKey && (e.key === "m" || e.key === "M")) {
927
+ e.preventDefault();
928
+ editor.dispatchCommand(INSERT_COMMENT_COMMAND, void 0);
929
+ }
930
+ };
931
+ window.addEventListener("keydown", handleKeyDown);
932
+ return () => window.removeEventListener("keydown", handleKeyDown);
933
+ }, [editor]);
934
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
935
+ /* @__PURE__ */ jsx5(NewCommentDialog, {}),
936
+ /* @__PURE__ */ jsx5(CommentsSidebar, {})
937
+ ] });
938
+ }
939
+
940
+ export {
941
+ INSERT_COMMENT_COMMAND,
942
+ findDOMElementForQuote,
943
+ CommentsPlugin
944
+ };