@vite-hub/ui 0.1.0 → 0.4.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 (314) hide show
  1. package/README.md +247 -21
  2. package/dist/attachments-BzTwqRTU.js +90 -0
  3. package/dist/{avatar-stack-DXmCQhxd.d.ts → avatar-stack-DPRFuezh.d.ts} +1 -1
  4. package/dist/choices-input-ByXJvDn1.d.ts +94 -0
  5. package/dist/{code-view-J4OsgEdh.js → code-view-DsU-xzic.js} +20 -4
  6. package/dist/colors-BghReA9C-CjF9gnmy.js +28 -0
  7. package/dist/comment-attachments-C4yNbcx5.js +20 -0
  8. package/dist/comment-composer-fINL5bxo.d.ts +243 -0
  9. package/dist/comment-composer-jYv2ULNP.js +591 -0
  10. package/dist/comment-layer-C_sbPIR5.d.ts +176 -0
  11. package/dist/comment-list-BcSaLngS.d.ts +62 -0
  12. package/dist/comment-marks.css +234 -0
  13. package/dist/comment-panel-CfvdRUMX.d.ts +208 -0
  14. package/dist/comment-person-CLPlW_SS.js +40 -0
  15. package/dist/comment-pin-DHOdRvUw.d.ts +68 -0
  16. package/dist/comment-row-Bn3nr8l5.js +39 -0
  17. package/dist/comment-selection-bar-CyVBNYl9.d.ts +42 -0
  18. package/dist/comment-thread-DKJjmWN0.d.ts +385 -0
  19. package/dist/comment-visibility-DsVuVndP.d.ts +40 -0
  20. package/dist/{comments-C08J3z4e.js → comments-D0d26ghV.js} +210 -59
  21. package/dist/comments-D8hulVPy.d.ts +198 -0
  22. package/dist/comments-context-C2lOZyQ5.js +38 -0
  23. package/dist/config-DgxBW013.d.ts +80 -0
  24. package/dist/config-Dk67emQt.js +63 -0
  25. package/dist/copy-button-CRN3kmSD.js +253 -0
  26. package/dist/draw-DzSmD7uo-Dwz8zoH2.js +72976 -0
  27. package/dist/editor-C_wt4RRV.js +582 -0
  28. package/dist/error-diagnostics-SXtnk6bz.js +38 -0
  29. package/dist/{file-tree-C1pv4_AI.js → file-tree-C4OYgbV-.js} +292 -145
  30. package/dist/{file-tree-Ctb8hZ_g.d.ts → file-tree-DlT9RGhu.d.ts} +51 -15
  31. package/dist/format-orwcdZL_.js +39 -0
  32. package/dist/handlers-DMl-Na3x.js +182 -0
  33. package/dist/headless.d.ts +5 -176
  34. package/dist/headless.js +5 -3
  35. package/dist/icon-swap.css +69 -0
  36. package/dist/{image-preview-VfknBEFu.js → image-preview-C9tdkmEj.js} +8 -5
  37. package/dist/{index-DcH0QSI5.d.ts → index-BYRFQfCd.d.ts} +14 -0
  38. package/dist/{code-view-vDM-hph-.d.ts → index-CNY1uNTh.d.ts} +14 -228
  39. package/dist/index.d.ts +55 -57
  40. package/dist/index.js +678 -25
  41. package/dist/markdown-editor-CMbNZOdN.js +2394 -0
  42. package/dist/markdown-editor-wQF0yD5o.d.ts +195 -0
  43. package/dist/markdown-editor.d.ts +108 -0
  44. package/dist/markdown-editor.js +3 -0
  45. package/dist/message-scroller-jrYN9dG9.d.ts +175 -0
  46. package/dist/nuxt-ui-DSQFzq3s.js +38 -0
  47. package/dist/nuxt.d.ts +84 -2
  48. package/dist/nuxt.js +243 -35
  49. package/dist/parts/components/agent-session.d.ts +254 -0
  50. package/dist/parts/components/agent-session.js +640 -0
  51. package/dist/{attachment-BBndG9_P.d.ts → parts/components/attachment.d.ts} +14 -15
  52. package/dist/{attachment-B3dXC7jM.js → parts/components/attachment.js} +6 -4
  53. package/dist/{avatar-stack.d.ts → parts/components/avatar-stack.d.ts} +1 -1
  54. package/dist/{avatar-stack-DM6HRnc0.js → parts/components/avatar-stack.js} +2 -5
  55. package/dist/{bubble-BJH2rfii.d.ts → parts/components/bubble.d.ts} +7 -8
  56. package/dist/{bubble-BPyFQlW7.js → parts/components/bubble.js} +2 -2
  57. package/dist/{chat-message-mpDmZbIC.d.ts → parts/components/chat-message.d.ts} +2 -3
  58. package/dist/{chat-message-BNK9G7xF.js → parts/components/chat-message.js} +4 -4
  59. package/dist/{chat-session-D6C7VJBR.d.ts → parts/components/chat-session.d.ts} +3 -4
  60. package/dist/{chat-session-DYEHB1HC.js → parts/components/chat-session.js} +2 -2
  61. package/dist/{chat-B9HlZWA2.d.ts → parts/components/chat.d.ts} +8 -4
  62. package/dist/{chat-BoFHlu9V.js → parts/components/chat.js} +42 -9
  63. package/dist/{highlighted-code-Dzf6o54i.d.ts → parts/components/code-block.d.ts} +15 -23
  64. package/dist/{code-block-Br-02hn-.js → parts/components/code-block.js} +9 -38
  65. package/dist/parts/components/code-view.d.ts +270 -0
  66. package/dist/parts/components/code-view.js +2 -0
  67. package/dist/parts/components/comment-composer.d.ts +2 -0
  68. package/dist/parts/components/comment-composer.js +2 -0
  69. package/dist/parts/components/comment-layer.d.ts +2 -0
  70. package/dist/parts/components/comment-layer.js +631 -0
  71. package/dist/parts/components/comment-list.d.ts +2 -0
  72. package/dist/parts/components/comment-list.js +168 -0
  73. package/dist/parts/components/comment-panel.d.ts +2 -0
  74. package/dist/parts/components/comment-panel.js +311 -0
  75. package/dist/parts/components/comment-pin.d.ts +2 -0
  76. package/dist/parts/components/comment-pin.js +75 -0
  77. package/dist/parts/components/comment-selection-bar.d.ts +2 -0
  78. package/dist/parts/components/comment-selection-bar.js +116 -0
  79. package/dist/parts/components/comment-thread.d.ts +2 -0
  80. package/dist/parts/components/comment-thread.js +598 -0
  81. package/dist/parts/components/comments.d.ts +8 -0
  82. package/dist/parts/components/comments.js +9 -0
  83. package/dist/{connection-status-DjGBw6xX.d.ts → parts/components/connection-status.d.ts} +6 -7
  84. package/dist/{connection-status-CzuWBENf.js → parts/components/connection-status.js} +1 -1
  85. package/dist/parts/components/copy-button.d.ts +118 -0
  86. package/dist/parts/components/copy-button.js +2 -0
  87. package/dist/parts/components/device-frame.d.ts +130 -0
  88. package/dist/parts/components/device-frame.js +471 -0
  89. package/dist/parts/components/file-tree.d.ts +2 -0
  90. package/dist/parts/components/file-tree.js +2 -0
  91. package/dist/parts/components/filter-search.d.ts +47 -0
  92. package/dist/parts/components/filter-search.js +58 -0
  93. package/dist/parts/components/markdown-editor.d.ts +2 -0
  94. package/dist/parts/components/markdown-editor.js +2 -0
  95. package/dist/parts/components/markdown-renderer.d.ts +52 -0
  96. package/dist/parts/components/markdown-renderer.js +23077 -0
  97. package/dist/{markdown-Dse5ldJe.d.ts → parts/components/markdown.d.ts} +7 -7
  98. package/dist/parts/components/markdown.js +47 -0
  99. package/dist/{marker-ea-tvx-J.d.ts → parts/components/marker.d.ts} +6 -7
  100. package/dist/{marker-Di2ZG_k1.js → parts/components/marker.js} +2 -2
  101. package/dist/{message-parts-BBFUkluC.d.ts → parts/components/message-parts.d.ts} +2 -3
  102. package/dist/{message-parts-DQnfioAH.js → parts/components/message-parts.js} +6 -6
  103. package/dist/{message-CW_paC1k.d.ts → parts/components/message.d.ts} +8 -9
  104. package/dist/{message-DiyBthIq.js → parts/components/message.js} +2 -2
  105. package/dist/parts/components/patch-parsers.d.ts +2 -0
  106. package/dist/parts/components/patch-parsers.js +2 -0
  107. package/dist/{prompt-input-Cy_Ue6B5.d.ts → parts/components/prompt-input.d.ts} +53 -10
  108. package/dist/{prompt-input-BbnCb80O.js → parts/components/prompt-input.js} +66 -111
  109. package/dist/parts/components/relative-time.d.ts +73 -0
  110. package/dist/parts/components/relative-time.js +2 -0
  111. package/dist/parts/components/status.d.ts +60 -0
  112. package/dist/parts/components/status.js +48 -0
  113. package/dist/{sync-status-refELOZn.d.ts → parts/components/sync-status.d.ts} +5 -6
  114. package/dist/{sync-status-BpxYdZIJ.js → parts/components/sync-status.js} +1 -1
  115. package/dist/{tool-list-E7CA52rz.d.ts → parts/components/tool-list.d.ts} +3 -4
  116. package/dist/{tool-list-BdSr5CT4.js → parts/components/tool-list.js} +7 -38
  117. package/dist/{trace-run-COeXn46Z.d.ts → parts/components/trace-run.d.ts} +3 -4
  118. package/dist/{trace-run-BIQ17CED.js → parts/components/trace-run.js} +15 -23
  119. package/dist/{trace-V7rM3Pyd.d.ts → parts/components/trace.d.ts} +11 -12
  120. package/dist/{trace-llBCDiSW.js → parts/components/trace.js} +20 -13
  121. package/dist/parts/composables/attachments.d.ts +32 -0
  122. package/dist/parts/composables/attachments.js +2 -0
  123. package/dist/parts/composables/highlighted-code.d.ts +9 -0
  124. package/dist/{highlighted-code-Ck4zexJX.js → parts/composables/highlighted-code.js} +5 -2
  125. package/dist/parts/headless/choices-input.d.ts +2 -0
  126. package/dist/parts/headless/choices-input.js +162 -0
  127. package/dist/parts/headless/comment-visibility.d.ts +2 -0
  128. package/dist/parts/headless/comment-visibility.js +128 -0
  129. package/dist/parts/headless/comments.d.ts +2 -0
  130. package/dist/parts/headless/comments.js +2 -0
  131. package/dist/parts/headless/message-scroller.d.ts +2 -0
  132. package/dist/{message-scroller-CX6NJTdm.js → parts/headless/message-scroller.js} +2 -2
  133. package/dist/parts/playground/highlight.d.ts +5 -0
  134. package/dist/parts/playground/highlight.js +23 -0
  135. package/dist/parts/playground/paths.d.ts +4 -0
  136. package/dist/parts/playground/paths.js +7 -0
  137. package/dist/parts/playground/playground-render.d.ts +126 -0
  138. package/dist/parts/playground/playground-render.js +356 -0
  139. package/dist/parts/playground/share.d.ts +2 -0
  140. package/dist/parts/playground/share.js +92 -0
  141. package/dist/parts/playground/zip.d.ts +6 -0
  142. package/dist/parts/playground/zip.js +76 -0
  143. package/dist/parts/workspace/browser-support-notice.d.ts +76 -0
  144. package/dist/parts/workspace/browser-support-notice.js +105 -0
  145. package/dist/parts/workspace/codemirror.d.ts +16 -0
  146. package/dist/parts/workspace/codemirror.js +243 -0
  147. package/dist/parts/workspace/connect-panel.d.ts +129 -0
  148. package/dist/parts/workspace/connect-panel.js +285 -0
  149. package/dist/parts/workspace/connect-store.d.ts +26 -0
  150. package/dist/parts/workspace/connect-store.js +59 -0
  151. package/dist/parts/workspace/icons.d.ts +34 -0
  152. package/dist/parts/workspace/icons.js +46 -0
  153. package/dist/parts/workspace/playground-container.d.ts +192 -0
  154. package/dist/parts/workspace/playground-container.js +603 -0
  155. package/dist/parts/workspace/workspace-boot-status.d.ts +75 -0
  156. package/dist/parts/workspace/workspace-boot-status.js +207 -0
  157. package/dist/parts/workspace/workspace-editor.d.ts +43 -0
  158. package/dist/parts/workspace/workspace-editor.js +54 -0
  159. package/dist/parts/workspace/workspace-file-tree.d.ts +53 -0
  160. package/dist/parts/workspace/workspace-file-tree.js +68 -0
  161. package/dist/parts/workspace/workspace-preview.d.ts +72 -0
  162. package/dist/parts/workspace/workspace-preview.js +307 -0
  163. package/dist/parts/workspace/workspace-shell.d.ts +88 -0
  164. package/dist/parts/workspace/workspace-shell.js +291 -0
  165. package/dist/parts/workspace/workspace-terminal.d.ts +39 -0
  166. package/dist/parts/workspace/workspace-terminal.js +130 -0
  167. package/dist/payload-text-sjkYAwvw.js +32 -0
  168. package/dist/{pierre-code-view-T7V67hwT.js → pierre-code-view-NE35tkmR.js} +245 -102
  169. package/dist/{pierre-dark-DDWDl8g6.js → pierre-dark-CzUmjETS.js} +3 -1
  170. package/dist/{pierre-light-CWhW4NrH.js → pierre-light-Dn6E0sWv.js} +3 -1
  171. package/dist/playground.d.ts +4 -0
  172. package/dist/playground.js +4 -0
  173. package/dist/relative-time-BVmjOsYG.js +309 -0
  174. package/dist/rolldown-runtime-C9mWXvCC.js +29 -0
  175. package/dist/runtime/nuxt-plugin.js +23 -4
  176. package/dist/sankey-CAYwt82B-D4uDQoMR.js +2887 -0
  177. package/dist/share-DM4eNy4q.d.ts +37 -0
  178. package/dist/{slot-part-C7Ocxn3b.js → slot-part-Doic71uh.js} +7 -1
  179. package/dist/styles.css +2609 -620
  180. package/dist/temml-BilSAAws.js +12362 -0
  181. package/dist/theme-focus-ring.css +42 -0
  182. package/dist/theme.css +376 -0
  183. package/dist/theme.d.ts +355 -0
  184. package/dist/theme.js +265 -0
  185. package/dist/{types-CqDwuJAm.d.ts → types-Dj7vp0lZ.d.ts} +1 -1
  186. package/dist/vue-BDmSCtay.js +30779 -0
  187. package/dist/vue-DGstVdGn.js +2492 -0
  188. package/dist/workspace.d.ts +15 -0
  189. package/dist/workspace.js +12 -0
  190. package/package.json +135 -149
  191. package/dist/andromeeda-BASpqCeJ.js +0 -4
  192. package/dist/attachment.d.ts +0 -2
  193. package/dist/attachment.js +0 -2
  194. package/dist/aurora-x-DugsLcii.js +0 -4
  195. package/dist/avatar-stack.js +0 -2
  196. package/dist/ayu-dark-BT3qdi3o.js +0 -4
  197. package/dist/ayu-light-BVZyHoh9.js +0 -4
  198. package/dist/ayu-mirage-XFwUVZQZ.js +0 -4
  199. package/dist/bubble.d.ts +0 -2
  200. package/dist/bubble.js +0 -2
  201. package/dist/catppuccin-frappe-D20KODDN.js +0 -4
  202. package/dist/catppuccin-latte-eGLVHIUJ.js +0 -4
  203. package/dist/catppuccin-macchiato-bQGch4PY.js +0 -4
  204. package/dist/catppuccin-mocha-Bes8-0Mr.js +0 -4
  205. package/dist/chat-message.d.ts +0 -2
  206. package/dist/chat-message.js +0 -2
  207. package/dist/chat-session.d.ts +0 -2
  208. package/dist/chat-session.js +0 -2
  209. package/dist/chat.d.ts +0 -2
  210. package/dist/chat.js +0 -2
  211. package/dist/code-block.d.ts +0 -2
  212. package/dist/code-block.js +0 -3
  213. package/dist/code-view.d.ts +0 -2
  214. package/dist/code-view.js +0 -2
  215. package/dist/comment-layer-CBlxJ8eK.js +0 -1113
  216. package/dist/comments-ChNJkV1d.d.ts +0 -108
  217. package/dist/comments-Cq5eewsu.d.ts +0 -537
  218. package/dist/comments.d.ts +0 -2
  219. package/dist/comments.js +0 -2
  220. package/dist/config-Bux_AJzm.d.ts +0 -29
  221. package/dist/config-bHqE4JOs.js +0 -38
  222. package/dist/connection-status.d.ts +0 -2
  223. package/dist/connection-status.js +0 -2
  224. package/dist/dark-plus-BGuiqa1B.js +0 -4
  225. package/dist/dracula-0CVA2XY5.js +0 -4
  226. package/dist/dracula-soft-Dk9bpbVU.js +0 -4
  227. package/dist/error-diagnostics-B4hMpJRL.js +0 -13
  228. package/dist/everforest-dark-CRjTbhh5.js +0 -4
  229. package/dist/everforest-light-CEeYFLn8.js +0 -4
  230. package/dist/file-diff.d.ts +0 -2
  231. package/dist/file-diff.js +0 -2
  232. package/dist/file-tree.d.ts +0 -2
  233. package/dist/file-tree.js +0 -2
  234. package/dist/file-view.d.ts +0 -2
  235. package/dist/file-view.js +0 -2
  236. package/dist/github-dark-BXgKmOw_.js +0 -4
  237. package/dist/github-dark-default-DzJQXksd.js +0 -4
  238. package/dist/github-dark-dimmed-B1pEmGtS.js +0 -4
  239. package/dist/github-dark-high-contrast-BkHIa6jc.js +0 -4
  240. package/dist/github-light-BKRlUbaB.js +0 -4
  241. package/dist/github-light-default-BU3eYkzs.js +0 -4
  242. package/dist/github-light-high-contrast-B3MumDcI.js +0 -4
  243. package/dist/gruvbox-dark-hard-B0ecF443.js +0 -4
  244. package/dist/gruvbox-dark-medium-BQnpC39k.js +0 -4
  245. package/dist/gruvbox-dark-soft-DFZUgESr.js +0 -4
  246. package/dist/gruvbox-light-hard-CuB_LOJr.js +0 -4
  247. package/dist/gruvbox-light-medium-idDHgxjs.js +0 -4
  248. package/dist/gruvbox-light-soft-CfWH49MY.js +0 -4
  249. package/dist/horizon-bright-Ba6M8QSV.js +0 -4
  250. package/dist/horizon-h92C5OlZ.js +0 -4
  251. package/dist/houston-EQnPegWq.js +0 -4
  252. package/dist/kanagawa-dragon-DgDvwi3B.js +0 -4
  253. package/dist/kanagawa-lotus-BgoQro20.js +0 -4
  254. package/dist/kanagawa-wave-DgXEowHs.js +0 -4
  255. package/dist/laserwave-IxBH_3yW.js +0 -4
  256. package/dist/light-plus-S8JBx6is.js +0 -4
  257. package/dist/markdown-BoLBN0qH.js +0 -197
  258. package/dist/markdown.d.ts +0 -2
  259. package/dist/markdown.js +0 -2
  260. package/dist/marker.d.ts +0 -2
  261. package/dist/marker.js +0 -2
  262. package/dist/material-theme-D1f3HBq-.js +0 -4
  263. package/dist/material-theme-darker-ExzYhT0j.js +0 -4
  264. package/dist/material-theme-lighter-D6gH9nnA.js +0 -4
  265. package/dist/material-theme-ocean-D1w5BPAa.js +0 -4
  266. package/dist/material-theme-palenight-CkqWmVpF.js +0 -4
  267. package/dist/message-parts.d.ts +0 -2
  268. package/dist/message-parts.js +0 -2
  269. package/dist/message.d.ts +0 -2
  270. package/dist/message.js +0 -2
  271. package/dist/min-dark-npsJH98j.js +0 -4
  272. package/dist/min-light-DUk1XsVt.js +0 -4
  273. package/dist/monokai-CfFRWUNl.js +0 -4
  274. package/dist/multi-file-diff.d.ts +0 -2
  275. package/dist/multi-file-diff.js +0 -2
  276. package/dist/night-owl-BS7V-av_.js +0 -4
  277. package/dist/night-owl-light-CZtRawYE.js +0 -4
  278. package/dist/nord-BFh54Nqz.js +0 -4
  279. package/dist/one-dark-pro-zDovGosB.js +0 -4
  280. package/dist/one-light-gmHK3iK6.js +0 -4
  281. package/dist/patch-diff.d.ts +0 -2
  282. package/dist/patch-diff.js +0 -2
  283. package/dist/plastic-DtdaCjub.js +0 -4
  284. package/dist/poimandres-Hdda6aHK.js +0 -4
  285. package/dist/primitive-rail.d.ts +0 -222
  286. package/dist/primitive-rail.js +0 -348
  287. package/dist/prompt-input.d.ts +0 -2
  288. package/dist/prompt-input.js +0 -2
  289. package/dist/red-VqZFRByZ.js +0 -4
  290. package/dist/rose-pine-DiTkEueR.js +0 -4
  291. package/dist/rose-pine-dawn-tfo5y2X0.js +0 -4
  292. package/dist/rose-pine-moon-C0gON9XN.js +0 -4
  293. package/dist/runtime-type-DlCscMfw.js +0 -59
  294. package/dist/slack-dark-v8P_eXr6.js +0 -4
  295. package/dist/slack-ochin-D8SyEdKz.js +0 -4
  296. package/dist/snazzy-light-BtkQkvXb.js +0 -4
  297. package/dist/solarized-dark-B8nAdMfM.js +0 -4
  298. package/dist/solarized-light-B-3F1INj.js +0 -4
  299. package/dist/sync-status.d.ts +0 -2
  300. package/dist/sync-status.js +0 -2
  301. package/dist/synthwave-84-DcsXCF_c.js +0 -4
  302. package/dist/tokyo-night-Bvpqduda.js +0 -4
  303. package/dist/tool-list.d.ts +0 -2
  304. package/dist/tool-list.js +0 -2
  305. package/dist/trace-run.d.ts +0 -2
  306. package/dist/trace-run.js +0 -2
  307. package/dist/trace.d.ts +0 -2
  308. package/dist/trace.js +0 -2
  309. package/dist/unresolved-file.d.ts +0 -2
  310. package/dist/unresolved-file.js +0 -2
  311. package/dist/vesper-CfxmMOy3.js +0 -4
  312. package/dist/vitesse-black-D9-_1mjV.js +0 -4
  313. package/dist/vitesse-dark-DlSMLlr9.js +0 -4
  314. package/dist/vitesse-light-KRWWWztf.js +0 -4
@@ -0,0 +1,631 @@
1
+ import { t as uiErrorDiagnostics } from "../../error-diagnostics-SXtnk6bz.js";
2
+ import { r as consumedPointerEvents } from "../../comments-context-C2lOZyQ5.js";
3
+ import { n as excerpt } from "../../comment-person-CLPlW_SS.js";
4
+ import { t as CommentComposer } from "../../comment-composer-jYv2ULNP.js";
5
+ import { i as useComments, n as draftPositionKey, o as commentTitle, r as provideComments, s as deliveryAttributes, u as commentThreadKey } from "../../comments-D0d26ghV.js";
6
+ import { t as useCommentAttachments } from "../../comment-attachments-C4yNbcx5.js";
7
+ import { n as threadRow } from "../../comment-row-Bn3nr8l5.js";
8
+ import { CommentList, CommentToolbar } from "./comment-list.js";
9
+ import { CommentPin } from "./comment-pin.js";
10
+ import { CommentThread } from "./comment-thread.js";
11
+ import { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, reactive, ref, shallowRef, watch } from "vue";
12
+ //#region src/components/comment-layer.ts
13
+ const popoverWidth = 360;
14
+ const popoverHeight = 420;
15
+ function placeDraft(point, page, width, viewport) {
16
+ const inset = (Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize) || 16) / 2;
17
+ const x = page ? (viewport - width) / 2 - inset : point.x;
18
+ const flipX = x > viewport / 2 && x + inset + width > viewport - inset;
19
+ const left = Math.max(inset, Math.min(flipX ? x - inset - width : x + inset, viewport - inset - width));
20
+ return {
21
+ x,
22
+ y: point.y,
23
+ flipX,
24
+ left: left - x
25
+ };
26
+ }
27
+ /** A pin on an area or an image is round. Elsewhere it is a drop whose small corner points at the spot. */
28
+ const pinShape = (kind) => kind === "area" || kind === "image" ? "round" : "point";
29
+ const clickSlop = 6;
30
+ const pinSpacing = 32;
31
+ const minimumArea = 8;
32
+ const marginMinWidth = 900;
33
+ const marginGap = 8;
34
+ const marginCardHeight = 72;
35
+ function containerOf(box) {
36
+ const center = {
37
+ x: box.left + box.width / 2,
38
+ y: box.top + box.height / 2
39
+ };
40
+ const under = document.elementsFromPoint(center.x, center.y).find((element) => !element.closest("[data-comments-ui]") && !element.localName.startsWith("vitehub-") && element !== document.documentElement);
41
+ for (let element = under ?? null; element && element !== document.documentElement; element = element.parentElement) {
42
+ const rect = element.getBoundingClientRect();
43
+ if (rect.left <= box.left + 1 && rect.top <= box.top + 1 && rect.right >= box.left + box.width - 1 && rect.bottom >= box.top + box.height - 1) return element;
44
+ }
45
+ }
46
+ const CommentLayer = defineComponent({
47
+ name: "CommentLayer",
48
+ props: {
49
+ client: { type: Object },
50
+ /** What the threads of this page are about. For a page, `{ kind: "page", id: "/pricing" }`. */
51
+ subject: { type: Object },
52
+ /** The signed-in user. Defaults to the client's user. */
53
+ user: { type: Object },
54
+ /** A state from `useComments()`, instead of `client` and `subject`. */
55
+ comments: { type: Object },
56
+ /** The people on this page, shown in the toolbar. */
57
+ people: {
58
+ default: () => [],
59
+ type: Array
60
+ },
61
+ /** The key that toggles comment mode. `false` turns it off. */
62
+ hotkey: {
63
+ default: "c",
64
+ type: [String, Boolean]
65
+ },
66
+ /** Hide thread mutation controls when the viewer may only read. */
67
+ readOnly: {
68
+ default: false,
69
+ type: Boolean
70
+ },
71
+ /** The URL of the page that a subject lives on, for the links of threads that are not page threads. */
72
+ subjectUrl: { type: Function },
73
+ /** Navigates to the page of a thread from the list. Defaults to `location.assign`. */
74
+ navigate: { type: Function },
75
+ /** What the signed-in user may do in a thread. Defaults to the `can` of the comments state. */
76
+ can: { type: Function },
77
+ /** Turns attached files into attachment keys before the comment is saved or sent. */
78
+ upload: { type: Function },
79
+ /** Save raw files with outbox entries. Set only when the server accepts file uploads. `upload` takes precedence. */
80
+ queueFiles: {
81
+ default: false,
82
+ type: Boolean
83
+ },
84
+ /** The file types that the boxes take, such as `image/*`. */
85
+ accept: { type: String },
86
+ /** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
87
+ attachmentUrl: { type: Function },
88
+ /**
89
+ * Where threads open. `"pin"` opens a thread in a card beside its pin. `"margin"` shows every thread as a card in a
90
+ * column on the right edge of the screen, level with its pin, and opens it in that card, with the reply box there.
91
+ * A new comment is written there too. On a screen narrower than 900px, `"margin"` works as `"pin"`.
92
+ */
93
+ placement: {
94
+ default: "pin",
95
+ type: String
96
+ },
97
+ /**
98
+ * The size of the thread cards and of the box for a new comment. `"sm"`, the default, is Drop's floating card: 14px
99
+ * text, tight rows, and Edit and Delete over the name's row. `"md"` is the size of a thread in a panel.
100
+ */
101
+ size: {
102
+ default: "sm",
103
+ type: String
104
+ }
105
+ },
106
+ setup(props, { slots }) {
107
+ const { client, subject } = props;
108
+ if (!props.comments && (!client || !subject)) throw uiErrorDiagnostics.UI_R0002({ message: "CommentLayer needs a `client` and a `subject`, or the `comments` state from useComments()." });
109
+ const layer = ref(null);
110
+ const uiRoot = () => {
111
+ const node = layer.value?.getRootNode();
112
+ return node instanceof ShadowRoot ? node : document;
113
+ };
114
+ const state = props.comments ?? useComments({
115
+ client,
116
+ hotkey: props.hotkey,
117
+ subject: () => props.subject,
118
+ subjectUrl: props.subjectUrl,
119
+ uiRoot,
120
+ user: () => props.user
121
+ });
122
+ provideComments(state);
123
+ const draftFiles = ref([]);
124
+ const uploadingDraft = shallowRef(null);
125
+ watch(() => state.draft.value, (next, previous) => {
126
+ if (next !== previous) draftFiles.value = next?.files ? [...next.files] : [];
127
+ });
128
+ const { enabled: attachmentsOn, prepare } = useCommentAttachments(state, props);
129
+ const user = computed(() => state.user.value);
130
+ const pinned = computed(() => state.threads.value.filter((thread) => state.pageThreads.value.includes(thread) || state.shown.value.has(thread.id) || state.leaving.value.has(thread.id)));
131
+ const drawn = computed(() => pinned.value.filter((thread) => state.shown.value.has(thread.id) || state.leaving.value.has(thread.id)));
132
+ let down = null;
133
+ const drawing = ref(null);
134
+ const boxFrom = (start, event) => ({
135
+ left: Math.min(start.x, event.clientX),
136
+ top: Math.min(start.y, event.clientY),
137
+ width: Math.abs(event.clientX - start.x),
138
+ height: Math.abs(event.clientY - start.y)
139
+ });
140
+ const press = (event) => {
141
+ drawing.value = null;
142
+ down = consumedPointerEvents.has(event) || event.button !== 0 ? null : {
143
+ x: event.clientX,
144
+ y: event.clientY,
145
+ draw: event.pointerType !== "touch"
146
+ };
147
+ if (down?.draw && event.target instanceof Element) event.target.setPointerCapture?.(event.pointerId);
148
+ };
149
+ const move = (event) => {
150
+ if (!down?.draw) return;
151
+ if (!drawing.value && Math.hypot(event.clientX - down.x, event.clientY - down.y) <= clickSlop) return;
152
+ drawing.value = boxFrom(down, event);
153
+ };
154
+ const release = (event) => {
155
+ const start = down;
156
+ const drawn = drawing.value;
157
+ down = null;
158
+ drawing.value = null;
159
+ if (!start) return;
160
+ if (drawn) {
161
+ const box = boxFrom(start, event);
162
+ const element = box.width >= minimumArea && box.height >= minimumArea ? containerOf(box) : void 0;
163
+ if (!element) return;
164
+ event.preventDefault();
165
+ try {
166
+ state.startDraft(element, {
167
+ area: box,
168
+ point: {
169
+ x: box.left,
170
+ y: box.top
171
+ }
172
+ });
173
+ } catch {}
174
+ return;
175
+ }
176
+ if (Math.hypot(event.clientX - start.x, event.clientY - start.y) > clickSlop) return;
177
+ event.preventDefault();
178
+ try {
179
+ state.startDraft({
180
+ x: event.clientX,
181
+ y: event.clientY
182
+ });
183
+ } catch {}
184
+ };
185
+ let returnTo = null;
186
+ let restoring = false;
187
+ watch(() => state.opened.value && commentThreadKey(state.opened.value), (key) => {
188
+ if (key) nextTick(() => layer.value?.querySelector("[data-slot='comment-thread']:not([data-preview])")?.focus());
189
+ });
190
+ watch(() => state.openId.value, (id, previous) => {
191
+ if (id) return;
192
+ returnTo = null;
193
+ const active = uiRoot().activeElement;
194
+ const thread = layer.value?.querySelector("[data-slot='comment-thread']:not([data-preview])");
195
+ if (previous && (!active || active === document.body || thread?.contains(active))) returnTo = previous;
196
+ }, { flush: "pre" });
197
+ watch(() => state.openId.value, (id) => {
198
+ if (id || !returnTo) return;
199
+ const target = returnTo;
200
+ returnTo = null;
201
+ nextTick(() => {
202
+ const pins = layer.value?.querySelectorAll("[data-slot='comment-pin']") ?? [];
203
+ restoring = true;
204
+ ([...pins].find((pin) => pin.getAttribute("data-thread-id") === target) ?? layer.value?.querySelector("[data-slot='comment-toolbar-mode']"))?.focus();
205
+ restoring = false;
206
+ });
207
+ }, { flush: "post" });
208
+ let draftReturn = null;
209
+ watch(() => state.draft.value, (next, previous) => {
210
+ if (next && !previous) {
211
+ const active = document.activeElement;
212
+ const root = uiRoot();
213
+ draftReturn = active instanceof HTMLElement && active !== document.body && !(root instanceof ShadowRoot && active === root.host) && !layer.value?.contains(active) ? active : null;
214
+ return;
215
+ }
216
+ if (next || !previous) return;
217
+ const target = draftReturn;
218
+ draftReturn = null;
219
+ nextTick(() => {
220
+ const focused = uiRoot().activeElement;
221
+ if (target?.isConnected && (!focused || focused === document.body)) target.focus({ preventScroll: true });
222
+ });
223
+ }, { flush: "sync" });
224
+ const draftAboveRoom = 72;
225
+ const draftCard = ref(null);
226
+ const draftBelow = ref(false);
227
+ const draftWidth = ref(0);
228
+ const measureDraft = () => {
229
+ draftWidth.value = draftCard.value?.offsetWidth ?? 0;
230
+ };
231
+ watch(() => state.draft.value, (next, previous) => {
232
+ if (next !== previous) draftBelow.value = false;
233
+ });
234
+ const fits = typeof ResizeObserver === "function" ? new ResizeObserver(() => {
235
+ measureDraft();
236
+ const card = draftCard.value;
237
+ if (card?.parentElement?.hasAttribute("data-above") && card.getBoundingClientRect().top < 8) draftBelow.value = true;
238
+ }) : void 0;
239
+ watch(draftCard, (card, previous) => {
240
+ if (previous) fits?.unobserve(previous);
241
+ if (card) fits?.observe(card);
242
+ measureDraft();
243
+ });
244
+ onBeforeUnmount(() => fits?.disconnect());
245
+ const place = ({ x, y }) => ({
246
+ left: `${x}px`,
247
+ top: `${y}px`,
248
+ "--vh-comment-x": `${x}px`
249
+ });
250
+ const picked = reactive(/* @__PURE__ */ new Map());
251
+ const placedItems = /* @__PURE__ */ new Map();
252
+ const observedCards = /* @__PURE__ */ new Map();
253
+ const observeCard = (key, card) => {
254
+ const previous = observedCards.get(key);
255
+ if (previous === card) return;
256
+ if (previous) cardSizes?.unobserve(previous);
257
+ observedCards.delete(key);
258
+ if (card) {
259
+ observedCards.set(key, card);
260
+ cardSizes?.observe(card);
261
+ }
262
+ };
263
+ const readSides = () => {
264
+ for (const [key, item] of placedItems) {
265
+ const card = item.querySelector(":scope > [data-slot='comment-layer-popover']");
266
+ const area = card ? getComputedStyle(card).getPropertyValue("position-area") : "";
267
+ observeCard(key, card && area && area !== "none" ? card : null);
268
+ if (!card || !area || area === "none") {
269
+ picked.delete(key);
270
+ continue;
271
+ }
272
+ const spot = item.getBoundingClientRect();
273
+ const box = card.getBoundingClientRect();
274
+ const next = {
275
+ x: box.left + box.right < spot.left * 2,
276
+ y: box.top + box.bottom < spot.top * 2
277
+ };
278
+ const now = picked.get(key);
279
+ if (now?.x !== next.x || now?.y !== next.y) picked.set(key, next);
280
+ }
281
+ };
282
+ const cardSizes = typeof ResizeObserver === "function" ? new ResizeObserver(readSides) : void 0;
283
+ let sideFrame = 0;
284
+ const readSidesSoon = () => {
285
+ if (!sideFrame) sideFrame = requestAnimationFrame(() => {
286
+ sideFrame = 0;
287
+ readSides();
288
+ });
289
+ };
290
+ onMounted(() => {
291
+ readSides();
292
+ window.addEventListener("resize", readSidesSoon, { passive: true });
293
+ window.visualViewport?.addEventListener("resize", readSidesSoon, { passive: true });
294
+ });
295
+ onUpdated(readSides);
296
+ onBeforeUnmount(() => {
297
+ cardSizes?.disconnect();
298
+ cancelAnimationFrame(sideFrame);
299
+ window.removeEventListener("resize", readSidesSoon);
300
+ window.visualViewport?.removeEventListener("resize", readSidesSoon);
301
+ });
302
+ const placedItem = (key) => (element) => {
303
+ if (element instanceof HTMLElement) placedItems.set(key, element);
304
+ else {
305
+ placedItems.delete(key);
306
+ observeCard(key, null);
307
+ picked.delete(key);
308
+ }
309
+ };
310
+ const side = (x, y, key) => {
311
+ const seen = key === void 0 ? void 0 : picked.get(key);
312
+ const flipX = seen ? seen.x : x + popoverWidth > window.innerWidth;
313
+ const flipY = seen ? seen.y : y + popoverHeight > window.innerHeight;
314
+ return {
315
+ "data-flip-x": flipX ? "true" : void 0,
316
+ "data-flip-y": flipY ? "true" : void 0
317
+ };
318
+ };
319
+ const composerView = (draft) => h(CommentComposer, {
320
+ accept: props.accept,
321
+ attachments: attachmentsOn.value,
322
+ busy: draft.busy || uploadingDraft.value === draft,
323
+ error: draft.error,
324
+ mentions: draft.mentions,
325
+ modelValue: draft.body,
326
+ onCancel: () => state.cancelDraft(),
327
+ files: draftFiles.value,
328
+ frame: "none",
329
+ layout: "row",
330
+ onSubmit: async (submit) => {
331
+ if (draft.busy || uploadingDraft.value === draft || state.draft.value !== draft) return;
332
+ uploadingDraft.value = draft;
333
+ draft.error = void 0;
334
+ draft.mentions = submit.mentions;
335
+ const submitted = draftFiles.value;
336
+ const body = draft.body;
337
+ const mentions = draft.mentions;
338
+ try {
339
+ const { attachments, files } = await prepare(submit.files);
340
+ if (state.draft.value !== draft || draft.body !== body || draft.mentions !== mentions || draftFiles.value !== submitted) return;
341
+ draft.attachments = attachments;
342
+ if (await state.send({ files }) && draftFiles.value === submitted) draftFiles.value = [];
343
+ } catch (error) {
344
+ draft.error = error instanceof Error ? error.message : "The files could not be uploaded. Try again.";
345
+ } finally {
346
+ if (uploadingDraft.value === draft) uploadingDraft.value = null;
347
+ }
348
+ },
349
+ "onUpdate:files": (value) => draftFiles.value = value,
350
+ "onUpdate:mentions": (value) => draft.mentions = value,
351
+ "onUpdate:modelValue": (value) => draft.body = value,
352
+ people: user.value ? [user.value] : [],
353
+ size: props.size,
354
+ user: user.value,
355
+ users: state.users
356
+ });
357
+ const screenWidth = ref(0);
358
+ const onResize = () => {
359
+ screenWidth.value = window.innerWidth;
360
+ measureDraft();
361
+ };
362
+ onMounted(() => {
363
+ screenWidth.value = window.innerWidth;
364
+ window.addEventListener("resize", onResize, { passive: true });
365
+ });
366
+ onBeforeUnmount(() => window.removeEventListener("resize", onResize));
367
+ const inMargin = computed(() => props.placement === "margin" && screenWidth.value >= marginMinWidth);
368
+ const cardHeights = reactive(/* @__PURE__ */ new Map());
369
+ const cards = /* @__PURE__ */ new Map();
370
+ const measure = typeof ResizeObserver === "function" ? new ResizeObserver((entries) => {
371
+ for (const entry of entries) {
372
+ const key = entry.target.getAttribute("data-margin-key");
373
+ const height = Math.round(entry.target.getBoundingClientRect().height);
374
+ if (key && height && cardHeights.get(key) !== height) cardHeights.set(key, height);
375
+ }
376
+ }) : void 0;
377
+ onBeforeUnmount(() => measure?.disconnect());
378
+ const measured = (key) => (element) => {
379
+ const before = cards.get(key);
380
+ if (before && before !== element) measure?.unobserve(before);
381
+ if (element instanceof Element) {
382
+ cards.set(key, element);
383
+ measure?.observe(element);
384
+ } else cards.delete(key);
385
+ };
386
+ const statusSlot = () => slots.status ? { status: slots.status } : void 0;
387
+ const threadView = (thread) => h(CommentThread, {
388
+ accept: props.accept,
389
+ attachmentUrl: props.attachmentUrl,
390
+ attachments: attachmentsOn.value,
391
+ can: props.can,
392
+ key: commentThreadKey(thread),
393
+ detached: state.positions.value.get(thread.id)?.detached === true,
394
+ readOnly: props.readOnly,
395
+ size: props.size,
396
+ onClose: () => state.close(),
397
+ onDelete: (messageId) => state.remove(thread.id, messageId),
398
+ onEdit: (messageId, body, mentions) => state.edit(thread.id, messageId, body, mentions),
399
+ onReopen: () => state.reopen(thread.id),
400
+ onReply: async (body, mentions, list) => {
401
+ const { attachments, files } = await prepare(list);
402
+ return state.reply(thread.id, body, mentions, attachments, files);
403
+ },
404
+ onResolve: async () => {
405
+ await state.resolve(thread.id);
406
+ state.close();
407
+ },
408
+ thread,
409
+ user: user.value
410
+ }, statusSlot());
411
+ const marginLayout = (spots, draftY) => {
412
+ const entries = pinned.value.flatMap((thread) => {
413
+ const spot = state.shown.value.has(thread.id) ? spots.get(thread.id) : void 0;
414
+ return spot ? [{
415
+ active: state.openId.value === thread.id,
416
+ key: thread.id,
417
+ thread,
418
+ y: spot.y
419
+ }] : [];
420
+ });
421
+ if (draftY !== void 0) entries.push({
422
+ active: true,
423
+ key: draftPositionKey,
424
+ y: draftY
425
+ });
426
+ entries.sort((a, b) => a.y - b.y);
427
+ const height = (entry) => cardHeights.get(entry.key) ?? (entry.active ? popoverHeight : marginCardHeight);
428
+ const tops = [];
429
+ let below = -Infinity;
430
+ for (const entry of entries) {
431
+ const top = Math.max(entry.y - 16, below + marginGap);
432
+ tops.push(top);
433
+ below = top + height(entry);
434
+ }
435
+ const edge = window.innerHeight - 16;
436
+ entries.forEach((entry, index) => {
437
+ if (!entry.active || tops[index] + height(entry) <= edge) return;
438
+ tops[index] = Math.max(16, edge - height(entry));
439
+ for (let before = index - 1; before >= 0; before--) tops[before] = Math.min(tops[before], tops[before + 1] - marginGap - height(entries[before]));
440
+ for (let after = index + 1; after < entries.length; after++) tops[after] = Math.max(tops[after], tops[after - 1] + marginGap + height(entries[after - 1]));
441
+ });
442
+ const at = new Map(entries.map((entry, index) => [entry.key, tops[index]]));
443
+ const cards = entries.flatMap((entry, index) => {
444
+ const thread = entry.thread;
445
+ if (!thread || entry.active) return [];
446
+ return [h("button", {
447
+ "aria-label": `${commentTitle(thread)}: ${excerpt(thread.messages[0]?.body ?? "")}`,
448
+ "data-margin-key": entry.key,
449
+ "data-slot": "comment-margin-card",
450
+ "data-status": thread.status,
451
+ ...deliveryAttributes(thread.delivery),
452
+ key: entry.key,
453
+ onClick: () => state.open(thread),
454
+ onPointerenter: () => {
455
+ if (!state.draft.value) state.hoverId.value = thread.id;
456
+ },
457
+ onPointerleave: () => {
458
+ if (state.hoverId.value === thread.id) state.hoverId.value = null;
459
+ },
460
+ ref: measured(entry.key),
461
+ style: { top: `${tops[index]}px` },
462
+ type: "button"
463
+ }, threadRow(thread))];
464
+ });
465
+ return {
466
+ at,
467
+ node: h("div", { "data-slot": "comment-margin" }, cards)
468
+ };
469
+ };
470
+ return () => {
471
+ const spots = /* @__PURE__ */ new Map();
472
+ for (const thread of drawn.value) {
473
+ const position = state.positions.value.get(thread.id);
474
+ if (!position || position.detached || position.clipped || thread.anchor.kind === "page") continue;
475
+ const taken = (y) => [...spots.values()].some((spot) => Math.abs(spot.x - position.x) < pinSpacing && Math.abs(spot.y - y) < pinSpacing);
476
+ let y = position.y;
477
+ while (taken(y)) y += pinSpacing;
478
+ if (y !== position.y && y > window.innerHeight - pinSpacing) {
479
+ y = position.y - pinSpacing;
480
+ while (taken(y)) y -= pinSpacing;
481
+ }
482
+ spots.set(thread.id, {
483
+ ...position,
484
+ y
485
+ });
486
+ }
487
+ const items = drawn.value.flatMap((thread) => {
488
+ const position = spots.get(thread.id);
489
+ if (!position) return [];
490
+ const leaving = !state.shown.value.has(thread.id);
491
+ const open = state.openId.value === thread.id;
492
+ const hover = state.hoverId.value === thread.id && !leaving && !open && !state.draft.value && !inMargin.value;
493
+ return [h("div", {
494
+ ...side(position.x, position.y, thread.id),
495
+ "data-kind": thread.anchor.kind,
496
+ "data-leaving": leaving ? "true" : void 0,
497
+ "data-slot": "comment-layer-item",
498
+ inert: leaving || void 0,
499
+ key: thread.id,
500
+ ref: placedItem(thread.id),
501
+ style: place(position)
502
+ }, [h(CommentPin, {
503
+ active: open,
504
+ author: thread.author,
505
+ "data-shape": pinShape(thread.anchor.kind),
506
+ "data-thread-id": thread.id,
507
+ excerpt: excerpt(thread.messages[0]?.body ?? ""),
508
+ ...thread.n ? { n: thread.n } : {},
509
+ onHover: () => {
510
+ if (!open && !restoring && !state.draft.value) state.hoverId.value = thread.id;
511
+ },
512
+ onLeave: () => {
513
+ if (state.hoverId.value === thread.id) state.hoverId.value = null;
514
+ },
515
+ onSelect: () => open ? state.close() : state.open(thread),
516
+ status: thread.status
517
+ }), hover ? h("div", {
518
+ "data-preview": "true",
519
+ "data-slot": "comment-layer-popover"
520
+ }, h(CommentThread, {
521
+ preview: true,
522
+ size: props.size,
523
+ thread
524
+ }, statusSlot())) : null])];
525
+ });
526
+ const draft = state.draft.value;
527
+ const draftPosition = draft && state.positions.value.get("draft");
528
+ const point = draftPosition && !draftPosition.detached && draft?.anchor.kind !== "page" ? draftPosition : draft?.point;
529
+ const draftInMargin = Boolean(inMargin.value && draft && point && draft.anchor.kind !== "page");
530
+ const margin = inMargin.value ? marginLayout(spots, draftInMargin ? point.y : void 0) : null;
531
+ const inColumn = (key) => {
532
+ const top = margin?.at.get(key);
533
+ return top === void 0 ? void 0 : {
534
+ "data-margin": "true",
535
+ "data-margin-key": key,
536
+ style: { top: `${top}px` }
537
+ };
538
+ };
539
+ const opened = state.opened.value;
540
+ const openedPosition = opened && state.positions.value.get(opened.id);
541
+ const pointForThread = openedPosition && !openedPosition.detached && !openedPosition.clipped && opened?.anchor.kind !== "page" ? spots.get(opened.id) ?? openedPosition : void 0;
542
+ const openedColumn = opened && pointForThread ? inColumn(opened.id) : void 0;
543
+ const openThread = opened ? h("div", {
544
+ ...pointForThread ? side(pointForThread.x, pointForThread.y, "opened-thread") : {},
545
+ "data-kind": opened.anchor.kind,
546
+ "data-slot": "comment-layer-item",
547
+ key: "opened-thread",
548
+ ref: placedItem("opened-thread"),
549
+ style: pointForThread ? place(pointForThread) : void 0
550
+ }, h("div", {
551
+ ...openedColumn,
552
+ "data-floating": pointForThread ? void 0 : "true",
553
+ "data-slot": "comment-layer-popover",
554
+ ref: (element) => openedColumn && measured(opened.id)(element)
555
+ }, threadView(opened))) : null;
556
+ const placement = draft && point ? placeDraft(point, draft.anchor.kind === "page", draftWidth.value, screenWidth.value) : void 0;
557
+ const draftColumn = draftInMargin ? inColumn(draftPositionKey) : void 0;
558
+ const composing = draft && placement ? h("div", {
559
+ ...side(placement.x, placement.y),
560
+ "data-flip-x": placement.flipX ? "true" : void 0,
561
+ ...(draft.anchor.kind === "area" || draft.anchor.kind === "image") && placement.y > draftAboveRoom && !draftBelow.value ? { "data-above": "true" } : {},
562
+ "data-draft": "true",
563
+ "data-kind": draft.anchor.kind,
564
+ "data-slot": "comment-layer-item",
565
+ style: place(placement)
566
+ }, [h(CommentPin, {
567
+ author: user.value,
568
+ "data-shape": pinShape(draft.anchor.kind),
569
+ draft: true
570
+ }), h("div", {
571
+ ...draftColumn,
572
+ "data-slot": "comment-layer-popover",
573
+ style: draftColumn?.style ?? {
574
+ left: `${placement.left}px`,
575
+ right: "auto"
576
+ },
577
+ ref: (element) => {
578
+ draftCard.value = element instanceof HTMLElement ? element : null;
579
+ if (draftColumn) measured(draftPositionKey)(element);
580
+ }
581
+ }, composerView(draft))]) : null;
582
+ return h("div", {
583
+ "data-active": state.active.value ? "true" : void 0,
584
+ "data-comments-ui": "",
585
+ "data-slot": "comment-layer",
586
+ ref: layer
587
+ }, [
588
+ state.active.value ? h("div", {
589
+ "data-slot": "comment-layer-overlay",
590
+ onPointercancel: () => {
591
+ down = null;
592
+ drawing.value = null;
593
+ },
594
+ onPointerdown: press,
595
+ onPointermove: move,
596
+ onPointerup: release
597
+ }, drawing.value ? [h("div", {
598
+ "data-slot": "comment-layer-area",
599
+ style: {
600
+ left: `${drawing.value.left}px`,
601
+ top: `${drawing.value.top}px`,
602
+ width: `${drawing.value.width}px`,
603
+ height: `${drawing.value.height}px`
604
+ }
605
+ }, [...[
606
+ "top-left",
607
+ "top-right",
608
+ "bottom-left",
609
+ "bottom-right"
610
+ ].map((corner) => h("span", {
611
+ "data-corner": corner,
612
+ "data-slot": "comment-layer-area-handle",
613
+ key: corner
614
+ })), h("span", { "data-slot": "comment-layer-area-size" }, `${Math.round(drawing.value.width)} × ${Math.round(drawing.value.height)}`)])] : []) : null,
615
+ ...items,
616
+ composing,
617
+ openThread,
618
+ margin?.node,
619
+ slots.default?.({ comments: state }) ?? [h(CommentToolbar, {
620
+ comments: state,
621
+ people: props.people
622
+ }), state.listOpen.value ? h(CommentList, {
623
+ comments: state,
624
+ navigate: props.navigate
625
+ }) : null]
626
+ ]);
627
+ };
628
+ }
629
+ });
630
+ //#endregion
631
+ export { CommentLayer };
@@ -0,0 +1,2 @@
1
+ import { n as CommentList, r as CommentToolbar, t as CommentFilters } from "../../comment-list-BcSaLngS.js";
2
+ export { CommentFilters, CommentList, CommentToolbar };