@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,168 @@
1
+ import { r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
2
+ import { a as useViteHubUIIcons } from "../../config-Dk67emQt.js";
3
+ import { AvatarStack } from "./avatar-stack.js";
4
+ import { a as useCommentsContext, s as deliveryAttributes } from "../../comments-D0d26ghV.js";
5
+ import { n as threadRow, t as rowSlotScope } from "../../comment-row-Bn3nr8l5.js";
6
+ import { defineComponent, h } from "vue";
7
+ //#region src/components/comment-list.ts
8
+ const commentsProp = { type: Object };
9
+ const CommentFilters = defineComponent({
10
+ name: "CommentFilters",
11
+ props: { comments: commentsProp },
12
+ setup(props) {
13
+ const UButton = useUIComponent("UButton");
14
+ const comments = useCommentsContext(props.comments);
15
+ return () => {
16
+ const button = (key, label, count) => h(UButton, {
17
+ "aria-pressed": String(comments.filters[key]),
18
+ color: "neutral",
19
+ "data-slot": "comment-filter",
20
+ "data-state": comments.filters[key] ? "on" : "off",
21
+ key,
22
+ label: count === void 0 ? label : `${label} ${count}`,
23
+ onClick: () => comments.filters[key] = !comments.filters[key],
24
+ size: "xs",
25
+ variant: comments.filters[key] ? "soft" : "ghost"
26
+ });
27
+ return h("div", {
28
+ "aria-label": "Filter comments",
29
+ "data-slot": "comment-filters",
30
+ role: "group"
31
+ }, [
32
+ button("open", "Open", comments.counts.value.open),
33
+ button("resolved", "Resolved", comments.counts.value.resolved),
34
+ button("mine", "Mine")
35
+ ]);
36
+ };
37
+ }
38
+ });
39
+ const CommentList = defineComponent({
40
+ name: "CommentList",
41
+ props: {
42
+ comments: commentsProp,
43
+ /** Goes to the page of a thread that is not on this page. Defaults to `location.assign`. */
44
+ navigate: { type: Function }
45
+ },
46
+ emits: ["select"],
47
+ slots: Object,
48
+ setup(props, { emit, slots }) {
49
+ const UButton = useUIComponent("UButton");
50
+ const comments = useCommentsContext(props.comments);
51
+ function select(thread, event) {
52
+ emit("select", thread);
53
+ if (event && (event.ctrlKey || event.metaKey || event.shiftKey || event.button !== 0)) return;
54
+ event?.preventDefault();
55
+ if (thread.subject.kind === comments.subject.value.kind && thread.subject.id === comments.subject.value.id) comments.open(thread, { scroll: true });
56
+ else if (comments.close()) (props.navigate ?? ((href) => window.location.assign(href)))(comments.link(thread));
57
+ }
58
+ return () => {
59
+ const scopeButton = (value, label) => h(UButton, {
60
+ "aria-pressed": String(comments.scope.value === value),
61
+ color: "neutral",
62
+ "data-slot": "comment-list-scope",
63
+ label,
64
+ onClick: () => comments.scope.value = value,
65
+ size: "xs",
66
+ variant: comments.scope.value === value ? "soft" : "ghost"
67
+ });
68
+ const rows = comments.listed.value;
69
+ return h("section", {
70
+ "aria-label": "Comments",
71
+ "data-comments-ui": "",
72
+ "data-slot": "comment-list"
73
+ }, [h("header", { "data-slot": "comment-list-header" }, [h("div", {
74
+ "data-slot": "comment-list-scopes",
75
+ role: "group",
76
+ "aria-label": "Scope"
77
+ }, [scopeButton("page", "This page"), scopeButton("site", "All pages")]), h(CommentFilters, { comments })]), rows.length === 0 ? h("p", {
78
+ "data-slot": "comment-list-empty",
79
+ role: "status"
80
+ }, comments.status.value === "loading" && comments.threads.value.length === 0 ? "Loading comments." : comments.status.value === "error" ? "The comments could not load." : "No comments here.") : h("ol", { "data-slot": "comment-list-items" }, rows.map((thread) => {
81
+ const detached = comments.positions.value.get(thread.id)?.detached === true;
82
+ return h("li", { key: thread.id }, [h("a", {
83
+ "aria-current": comments.openId.value === thread.id ? "true" : void 0,
84
+ "data-detached": detached ? "true" : void 0,
85
+ "data-focus-inset": "",
86
+ "data-slot": "comment-list-item",
87
+ "data-status": thread.status,
88
+ ...deliveryAttributes(thread.delivery),
89
+ href: comments.link(thread),
90
+ onClick: (event) => select(thread, event)
91
+ }, slots.row?.(rowSlotScope(thread)) ?? threadRow(thread, {
92
+ detached,
93
+ preview: slots.preview?.(rowSlotScope(thread)),
94
+ site: comments.scope.value === "site"
95
+ }))]);
96
+ }))]);
97
+ };
98
+ }
99
+ });
100
+ const CommentToolbar = defineComponent({
101
+ name: "CommentToolbar",
102
+ props: {
103
+ comments: commentsProp,
104
+ /** The people on this page, from Realtime. Shown as a stack of avatars. */
105
+ people: {
106
+ default: () => [],
107
+ type: Array
108
+ }
109
+ },
110
+ setup(props, { slots }) {
111
+ const UButton = useUIComponent("UButton");
112
+ const icons = useViteHubUIIcons();
113
+ const comments = useCommentsContext(props.comments);
114
+ return () => {
115
+ const open = comments.pageThreads.value.length;
116
+ return h("div", {
117
+ "aria-label": "Comments",
118
+ "data-comments-ui": "",
119
+ "data-slot": "comment-toolbar",
120
+ role: "toolbar"
121
+ }, [
122
+ h(UButton, {
123
+ "aria-keyshortcuts": "C",
124
+ "aria-label": "Comment mode",
125
+ "aria-pressed": String(comments.active.value),
126
+ color: "neutral",
127
+ "data-slot": "comment-toolbar-mode",
128
+ icon: icons.value.comment,
129
+ onClick: comments.toggle,
130
+ size: "sm",
131
+ title: "Comment (C)",
132
+ variant: comments.active.value ? "solid" : "ghost"
133
+ }),
134
+ h(UButton, {
135
+ "aria-label": `Comment list, ${open} on this page`,
136
+ "aria-pressed": String(comments.listOpen.value),
137
+ color: "neutral",
138
+ "data-slot": "comment-toolbar-list",
139
+ icon: icons.value.commentList,
140
+ label: String(open),
141
+ onClick: () => comments.listOpen.value = !comments.listOpen.value,
142
+ size: "sm",
143
+ variant: comments.listOpen.value ? "solid" : "ghost"
144
+ }),
145
+ h(UButton, {
146
+ "aria-label": "Comment on page",
147
+ color: "neutral",
148
+ "data-slot": "comment-toolbar-page",
149
+ icon: icons.value.commentPage,
150
+ onClick: () => {
151
+ comments.startDraft("page");
152
+ },
153
+ size: "sm",
154
+ title: "Comment on the whole page",
155
+ variant: "ghost"
156
+ }),
157
+ props.people.length > 0 ? h(AvatarStack, {
158
+ people: props.people,
159
+ size: "sm",
160
+ variant: "outline"
161
+ }) : null,
162
+ slots.default?.()
163
+ ]);
164
+ };
165
+ }
166
+ });
167
+ //#endregion
168
+ export { CommentFilters, CommentList, CommentToolbar };
@@ -0,0 +1,2 @@
1
+ import { a as CommentPanelVariant, c as CommentUpload, i as CommentPanelSlots, n as CommentGroupSlotScope, o as CommentRowSlotScope, r as CommentPanel, s as CommentRowSlots, t as CommentGroup } from "../../comment-panel-CfvdRUMX.js";
2
+ export { CommentGroup, CommentGroupSlotScope, CommentPanel, CommentPanelSlots, CommentPanelVariant, CommentRowSlotScope, CommentRowSlots, CommentUpload };
@@ -0,0 +1,311 @@
1
+ import { r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
2
+ import { t as uiErrorDiagnostics } from "../../error-diagnostics-SXtnk6bz.js";
3
+ import { n as injectComments } from "../../comments-context-C2lOZyQ5.js";
4
+ import { t as CommentComposer } from "../../comment-composer-jYv2ULNP.js";
5
+ import { a as useCommentsContext, d as useSelectedComment, i as useComments, l as repliedSinceResolved, 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, t as rowSlotScope } from "../../comment-row-Bn3nr8l5.js";
8
+ import { CommentThread } from "./comment-thread.js";
9
+ import { computed, defineComponent, h, nextTick, ref, watch } from "vue";
10
+ //#region src/components/comment-panel.ts
11
+ const listSlots = /* @__PURE__ */ new Set([
12
+ "row",
13
+ "preview",
14
+ "group-header",
15
+ "list-actions"
16
+ ]);
17
+ function reason(error) {
18
+ return error instanceof Error ? error.message : "The comment could not be sent. Try again.";
19
+ }
20
+ const sameSubject = (a, b) => a.kind === b.kind && a.id === b.id;
21
+ const CommentPanel = defineComponent({
22
+ name: "CommentPanel",
23
+ props: {
24
+ /** A state from `useComments()`. Defaults to the state of the nearest `CommentLayer` or `provideComments()`. */
25
+ comments: { type: Object },
26
+ /** The client, for a panel that is not inside a `CommentLayer`. Give it with `subject`. */
27
+ client: { type: Object },
28
+ /** What the threads are about, with `client`. */
29
+ subject: { type: Object },
30
+ /** The signed-in user, with `client`. Defaults to the client's user. */
31
+ user: { type: Object },
32
+ /** `docked` fills its container, such as a side column. `floating` is a card over the page. */
33
+ variant: {
34
+ default: "docked",
35
+ type: String
36
+ },
37
+ /** The id of the open thread. Use `v-model:thread`. `null` shows the list. */
38
+ thread: {
39
+ default: void 0,
40
+ type: [String, null]
41
+ },
42
+ /** Which threads the list shows. Use `v-model:status`. */
43
+ status: { type: String },
44
+ /** The heading of the list. */
45
+ title: {
46
+ default: "Comments",
47
+ type: String
48
+ },
49
+ /** Hide the page box and every reply, edit, delete, and status control. */
50
+ readOnly: {
51
+ default: false,
52
+ type: Boolean
53
+ },
54
+ /** Turns attached files into attachment keys before the comment is saved or sent. */
55
+ upload: { type: Function },
56
+ /** Save raw files with outbox entries. Set only when the server accepts file uploads. `upload` takes precedence. */
57
+ queueFiles: {
58
+ default: false,
59
+ type: Boolean
60
+ },
61
+ /** The file types that the boxes take, such as `image/*`. */
62
+ accept: { type: String },
63
+ /** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
64
+ attachmentUrl: { type: Function },
65
+ /** Send a new page comment that has files and no text. */
66
+ allowEmpty: {
67
+ default: false,
68
+ type: Boolean
69
+ },
70
+ /** People that messages may mention, on top of the people that the comments state knows. */
71
+ people: {
72
+ default: () => [],
73
+ type: Array
74
+ },
75
+ /** What the signed-in user may do in a thread. Defaults to the `can` of the comments state. */
76
+ can: { type: Function },
77
+ /**
78
+ * Groups the rows under headings, in the order the groups first appear. Threads without a group come first. Without a
79
+ * group callback, a resolved thread that Open lists for a later reply goes under "Replied since resolved".
80
+ */
81
+ group: { type: Function }
82
+ },
83
+ emits: [
84
+ "update:thread",
85
+ "update:status",
86
+ "select"
87
+ ],
88
+ slots: Object,
89
+ setup(props, { emit, slots }) {
90
+ const UButton = useUIComponent("UButton");
91
+ const inherited = props.comments ?? injectComments();
92
+ if (!inherited && (!props.client || !props.subject)) throw uiErrorDiagnostics.UI_R0002({ message: "CommentPanel needs a comments state: put it inside CommentLayer, pass `comments`, or pass a `client` and a `subject`." });
93
+ const state = useCommentsContext(inherited ?? useComments({
94
+ client: props.client,
95
+ hotkey: false,
96
+ subject: () => props.subject,
97
+ user: () => props.user
98
+ }));
99
+ provideComments(state);
100
+ const root = ref(null);
101
+ const localThread = ref(null);
102
+ const localStatus = ref("open");
103
+ const threadId = computed(() => props.thread === void 0 ? localThread.value : props.thread);
104
+ const status = computed(() => props.status ?? localStatus.value);
105
+ const scoped = computed(() => state.threads.value.filter((thread) => state.scope.value === "site" || sameSubject(thread.subject, state.subject.value)));
106
+ const rows = computed(() => scoped.value.filter((thread) => thread.status === status.value || status.value === "open" && repliedSinceResolved(thread)));
107
+ const opened = useSelectedComment(state.threads, threadId);
108
+ watch(opened, (thread, _previous, onCleanup) => {
109
+ if (thread) onCleanup(state.retainMark(thread.id));
110
+ }, {
111
+ immediate: true,
112
+ flush: "sync"
113
+ });
114
+ watch(opened, (thread) => {
115
+ if (thread && thread.id !== threadId.value) setThread(thread.id);
116
+ });
117
+ const body = ref("");
118
+ const mentions = ref([]);
119
+ const files = ref([]);
120
+ const busy = ref(false);
121
+ const failure = ref();
122
+ function setThread(id) {
123
+ localThread.value = id;
124
+ emit("update:thread", id);
125
+ }
126
+ function setStatus(value) {
127
+ localStatus.value = value;
128
+ emit("update:status", value);
129
+ }
130
+ function select(thread) {
131
+ emit("select", thread);
132
+ setThread(thread.id);
133
+ nextTick(() => root.value?.querySelector("[data-slot='comment-thread']")?.focus());
134
+ }
135
+ function back() {
136
+ const id = opened.value?.id;
137
+ setThread(null);
138
+ nextTick(() => {
139
+ [...root.value?.querySelectorAll("[data-slot='comment-panel-item']") ?? []].find((row) => row.dataset.threadId === id)?.focus();
140
+ });
141
+ }
142
+ const { enabled: attachmentsOn, prepare } = useCommentAttachments(state, props);
143
+ const subjectKey = () => `${state.subject.value.kind}\u0000${state.subject.value.id}`;
144
+ let sending = 0;
145
+ watch(subjectKey, () => {
146
+ sending++;
147
+ body.value = "";
148
+ mentions.value = [];
149
+ files.value = [];
150
+ failure.value = void 0;
151
+ busy.value = false;
152
+ });
153
+ async function send(submit) {
154
+ if (busy.value) return;
155
+ const run = ++sending;
156
+ busy.value = true;
157
+ failure.value = void 0;
158
+ const submitted = {
159
+ body: body.value,
160
+ files: files.value,
161
+ mentions: mentions.value
162
+ };
163
+ try {
164
+ const attached = await prepare(submit.files);
165
+ if (run !== sending) return;
166
+ await state.create({
167
+ ...attached,
168
+ body: submit.body,
169
+ mentions: submit.mentions
170
+ });
171
+ if (run === sending && body.value === submitted.body && files.value === submitted.files && mentions.value === submitted.mentions) {
172
+ body.value = "";
173
+ mentions.value = [];
174
+ files.value = [];
175
+ }
176
+ } catch (cause) {
177
+ if (run === sending) failure.value = reason(cause);
178
+ } finally {
179
+ if (run === sending) busy.value = false;
180
+ }
181
+ }
182
+ const threadSlots = () => Object.fromEntries(Object.entries(slots).filter(([name, slot]) => slot !== void 0 && !listSlots.has(name)));
183
+ const groups = computed(() => {
184
+ const found = [];
185
+ for (const thread of rows.value) {
186
+ const label = props.group ? props.group(thread) : status.value === "open" && thread.status === "resolved" ? "Replied since resolved" : void 0;
187
+ let entry = found.find((group) => group.label === label);
188
+ if (!entry) found.push(entry = {
189
+ label,
190
+ threads: []
191
+ });
192
+ entry.threads.push(thread);
193
+ }
194
+ return found.sort((a, b) => Number(a.label !== void 0) - Number(b.label !== void 0));
195
+ });
196
+ const row = (thread) => h("li", { key: thread.id }, [h("button", {
197
+ "data-focus-inset": "",
198
+ "data-slot": "comment-panel-item",
199
+ "data-status": thread.status,
200
+ ...deliveryAttributes(thread.delivery),
201
+ "data-thread-id": thread.id,
202
+ onClick: () => select(thread),
203
+ type: "button"
204
+ }, slots.row?.(rowSlotScope(thread)) ?? threadRow(thread, {
205
+ detached: state.positions.value.get(thread.id)?.detached === true,
206
+ preview: slots.preview?.(rowSlotScope(thread)),
207
+ site: state.scope.value === "site"
208
+ }))]);
209
+ const items = (threads, label, key) => h("ol", {
210
+ "aria-label": label,
211
+ "data-slot": "comment-panel-items",
212
+ key
213
+ }, threads.map(row));
214
+ const grouped = () => groups.value.map(({ label, threads }) => label === void 0 ? items(threads, props.title, "ungrouped") : h("section", {
215
+ "aria-label": label,
216
+ "data-slot": "comment-panel-group",
217
+ key: label
218
+ }, [h("h3", { "data-slot": "comment-panel-group-header" }, slots["group-header"]?.({
219
+ group: label,
220
+ threads
221
+ }) ?? label), items(threads, label)]));
222
+ const list = () => {
223
+ const counts = state.counts.value;
224
+ const filter = (value, label, count) => h(UButton, {
225
+ "aria-pressed": String(status.value === value),
226
+ color: "neutral",
227
+ "data-slot": "comment-panel-filter",
228
+ "data-state": status.value === value ? "on" : "off",
229
+ label: `${label} ${count}`,
230
+ onClick: () => setStatus(value),
231
+ size: "xs",
232
+ variant: status.value === value ? "soft" : "ghost"
233
+ });
234
+ const empty = state.status.value === "loading" && state.threads.value.length === 0 ? "Loading comments." : state.status.value === "error" ? "The comments could not load." : status.value === "open" ? "No open comments." : "No resolved comments.";
235
+ return [
236
+ h("header", { "data-slot": "comment-panel-header" }, [
237
+ h("h2", { "data-slot": "comment-panel-title" }, props.title),
238
+ h("div", {
239
+ "aria-label": "Filter comments",
240
+ "data-slot": "comment-panel-filters",
241
+ role: "group"
242
+ }, [filter("open", "Open", counts.open), filter("resolved", "Resolved", counts.resolved)]),
243
+ slots["list-actions"] ? h("div", { "data-slot": "comment-panel-actions" }, slots["list-actions"]()) : null
244
+ ]),
245
+ rows.value.length === 0 ? h("p", {
246
+ "data-slot": "comment-panel-empty",
247
+ role: "status"
248
+ }, empty) : props.group || groups.value.some((group) => group.label !== void 0) ? h("div", { "data-slot": "comment-panel-groups" }, grouped()) : items(rows.value, props.title),
249
+ props.readOnly ? null : h("div", { "data-slot": "comment-panel-composer" }, [h(CommentComposer, {
250
+ accept: props.accept,
251
+ allowEmpty: props.allowEmpty,
252
+ attachments: attachmentsOn.value,
253
+ autofocus: false,
254
+ busy: busy.value,
255
+ error: failure.value,
256
+ files: files.value,
257
+ guard: false,
258
+ layout: "row",
259
+ mentions: mentions.value,
260
+ modelValue: body.value,
261
+ onSubmit: send,
262
+ "onUpdate:files": (value) => files.value = value,
263
+ "onUpdate:mentions": (value) => mentions.value = value,
264
+ "onUpdate:modelValue": (value) => body.value = value,
265
+ people: props.people,
266
+ placeholder: "Comment on this page",
267
+ user: state.user.value
268
+ }, {
269
+ ...slots.extra ? { extra: slots.extra } : {},
270
+ ...slots["mention-item"] ? { "mention-item": slots["mention-item"] } : {},
271
+ ...slots["mention-empty"] ? { "mention-empty": slots["mention-empty"] } : {}
272
+ })])
273
+ ];
274
+ };
275
+ const threadView = (thread) => h(CommentThread, {
276
+ accept: props.accept,
277
+ attachmentUrl: props.attachmentUrl,
278
+ attachments: attachmentsOn.value,
279
+ can: props.can,
280
+ detached: state.positions.value.get(thread.id)?.detached === true,
281
+ dismissible: false,
282
+ key: commentThreadKey(thread),
283
+ navigation: "back",
284
+ onClose: back,
285
+ onDelete: async (messageId) => {
286
+ if (!await state.remove(thread.id, messageId)) back();
287
+ },
288
+ onEdit: (messageId, text, ids) => state.edit(thread.id, messageId, text, ids),
289
+ onReopen: () => state.reopen(thread.id),
290
+ onReply: async (text, ids, list) => {
291
+ const { attachments, files } = await prepare(list);
292
+ return state.reply(thread.id, text, ids, attachments, files);
293
+ },
294
+ onResolve: () => state.resolve(thread.id),
295
+ people: props.people,
296
+ readOnly: props.readOnly,
297
+ thread,
298
+ user: state.user.value
299
+ }, threadSlots());
300
+ return () => h("section", {
301
+ "aria-label": opened.value ? commentTitle(opened.value) : props.title,
302
+ "data-comments-ui": "",
303
+ "data-slot": "comment-panel",
304
+ "data-variant": props.variant,
305
+ "data-view": opened.value ? "thread" : "list",
306
+ ref: root
307
+ }, opened.value ? threadView(opened.value) : list());
308
+ }
309
+ });
310
+ //#endregion
311
+ export { CommentPanel };
@@ -0,0 +1,2 @@
1
+ import { t as CommentPin } from "../../comment-pin-DHOdRvUw.js";
2
+ export { CommentPin };
@@ -0,0 +1,75 @@
1
+ import { AvatarStack } from "./avatar-stack.js";
2
+ import { i as toPerson, t as displayName } from "../../comment-person-CLPlW_SS.js";
3
+ import { defineComponent, h } from "vue";
4
+ //#region src/components/comment-pin.ts
5
+ const CommentPin = defineComponent({
6
+ name: "CommentPin",
7
+ props: {
8
+ /** The thread number. A draft has none. */
9
+ n: { type: Number },
10
+ author: { type: Object },
11
+ status: {
12
+ default: "open",
13
+ type: String
14
+ },
15
+ /** A short piece of the comment. It is part of the label that a screen reader says. */
16
+ excerpt: { type: String },
17
+ /** The thread of this pin is open. */
18
+ active: {
19
+ default: false,
20
+ type: Boolean
21
+ },
22
+ /** The comment is still being written. */
23
+ draft: {
24
+ default: false,
25
+ type: Boolean
26
+ }
27
+ },
28
+ emits: [
29
+ "select",
30
+ "hover",
31
+ "leave"
32
+ ],
33
+ setup(props, { emit }) {
34
+ const label = () => {
35
+ if (props.draft) return "New comment";
36
+ const by = props.author ? ` by ${displayName(props.author)}` : "";
37
+ const text = props.excerpt ? `: ${props.excerpt}` : "";
38
+ return `Comment${props.n === void 0 ? "" : ` ${props.n}`}${by}${text}${props.status === "resolved" ? ", resolved" : ""}`;
39
+ };
40
+ let pointed = false;
41
+ let focused = false;
42
+ return () => h("button", {
43
+ "aria-expanded": props.draft ? void 0 : String(props.active),
44
+ "aria-label": label(),
45
+ "data-active": props.active ? "true" : void 0,
46
+ "data-draft": props.draft ? "true" : void 0,
47
+ "data-slot": "comment-pin",
48
+ "data-status": props.status,
49
+ onBlur: () => {
50
+ focused = false;
51
+ if (!pointed) emit("leave");
52
+ },
53
+ onClick: () => emit("select"),
54
+ onFocus: () => {
55
+ focused = true;
56
+ emit("hover");
57
+ },
58
+ onPointerenter: () => {
59
+ pointed = true;
60
+ emit("hover");
61
+ },
62
+ onPointerleave: () => {
63
+ pointed = false;
64
+ if (!focused) emit("leave");
65
+ },
66
+ type: "button"
67
+ }, [props.author ? h(AvatarStack, {
68
+ "aria-hidden": "true",
69
+ people: [toPerson(props.author)],
70
+ size: "sm"
71
+ }) : null, props.draft || props.n === void 0 ? null : h("span", { "data-slot": "comment-pin-number" }, String(props.n))]);
72
+ }
73
+ });
74
+ //#endregion
75
+ export { CommentPin };
@@ -0,0 +1,2 @@
1
+ import { n as CommentSelectionBarSide, t as CommentSelectionBar } from "../../comment-selection-bar-CyVBNYl9.js";
2
+ export { CommentSelectionBar, CommentSelectionBarSide };
@@ -0,0 +1,116 @@
1
+ import { n as useTooltipComponent, r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
2
+ import { a as useViteHubUIIcons } from "../../config-Dk67emQt.js";
3
+ import { defineComponent, h, onErrorCaptured, onMounted, ref } from "vue";
4
+ //#region src/components/comment-selection-bar.ts
5
+ const TooltipOrTitle = defineComponent({
6
+ name: "CommentSelectionBarTooltip",
7
+ props: {
8
+ tooltip: {
9
+ required: true,
10
+ type: [Object, Function]
11
+ },
12
+ side: {
13
+ required: true,
14
+ type: String
15
+ },
16
+ content: {
17
+ required: true,
18
+ type: Function
19
+ },
20
+ trigger: {
21
+ required: true,
22
+ type: Function
23
+ },
24
+ title: {
25
+ required: true,
26
+ type: String
27
+ }
28
+ },
29
+ setup(props) {
30
+ const failed = ref(false);
31
+ let mounted = false;
32
+ onMounted(() => mounted = true);
33
+ onErrorCaptured(() => {
34
+ if (mounted || failed.value) return;
35
+ failed.value = true;
36
+ return false;
37
+ });
38
+ return () => failed.value ? props.trigger(props.title) : h(props.tooltip, { content: {
39
+ side: props.side,
40
+ sideOffset: 8
41
+ } }, {
42
+ content: props.content,
43
+ default: () => props.trigger()
44
+ });
45
+ }
46
+ });
47
+ /**
48
+ * The bar over selected text: Comment, and Suggest when the page takes suggested changes. It is the dark surface on a
49
+ * light page and its light twin on a dark one, so it stands out from the text. The page places it and listens for the
50
+ * keys. A press on the bar keeps the selection on the page.
51
+ */
52
+ const CommentSelectionBar = defineComponent({
53
+ name: "CommentSelectionBar",
54
+ props: {
55
+ /** Show Suggest (E), for a page that takes suggested changes. */
56
+ suggest: {
57
+ default: false,
58
+ type: Boolean
59
+ },
60
+ /** The side of the text that the bar is on. The bar grows from that side, and its tooltips open away from the text. */
61
+ side: {
62
+ default: "top",
63
+ type: String
64
+ }
65
+ },
66
+ emits: ["comment", "suggest"],
67
+ setup(props, { emit }) {
68
+ const UIcon = useUIComponent("UIcon");
69
+ const UTooltip = useTooltipComponent();
70
+ const icons = useViteHubUIIcons();
71
+ const actions = () => [{
72
+ name: "comment",
73
+ label: "Comment",
74
+ hint: "Comment on the selected text",
75
+ key: "C",
76
+ icon: icons.value.comment
77
+ }, ...props.suggest ? [{
78
+ name: "suggest",
79
+ label: "Suggest",
80
+ hint: "Suggest new words",
81
+ key: "E",
82
+ icon: icons.value.edit
83
+ }] : []];
84
+ const button = (action, title) => h("button", {
85
+ "aria-keyshortcuts": action.key,
86
+ "data-action": action.name,
87
+ "data-slot": "comment-selection-bar-action",
88
+ onClick: () => action.name === "comment" ? emit("comment") : emit("suggest"),
89
+ title,
90
+ type: "button"
91
+ }, [h(UIcon, {
92
+ "aria-hidden": "true",
93
+ name: action.icon
94
+ }), action.label]);
95
+ return () => h("div", {
96
+ "aria-label": "Selected text",
97
+ "data-side": props.side,
98
+ "data-slot": "comment-selection-bar",
99
+ onMousedown: (event) => event.preventDefault(),
100
+ role: "group"
101
+ }, actions().map((action) => {
102
+ const title = `${action.hint} (${action.key})`;
103
+ if (!UTooltip) return button(action, title);
104
+ return h(TooltipOrTitle, {
105
+ content: () => [action.hint, h("kbd", { "data-slot": "comment-selection-bar-kbd" }, action.key)],
106
+ key: action.name,
107
+ side: props.side,
108
+ title,
109
+ tooltip: UTooltip,
110
+ trigger: (fallback) => button(action, fallback)
111
+ });
112
+ }));
113
+ }
114
+ });
115
+ //#endregion
116
+ export { CommentSelectionBar };
@@ -0,0 +1,2 @@
1
+ import { a as CommentReplySlots, c as CommentThreadSlotScope, d as repliedSinceResolved, i as CommentReplySlotScope, l as CommentThreadSlots, n as CommentAttachmentUrl, o as CommentStatusSlotScope, r as CommentReply, s as CommentThread, t as CommentAttachmentLink, u as messagesSinceResolved } from "../../comment-thread-DKJjmWN0.js";
2
+ export { CommentAttachmentLink, CommentAttachmentUrl, CommentReply, CommentReplySlotScope, CommentReplySlots, CommentStatusSlotScope, CommentThread, CommentThreadSlotScope, CommentThreadSlots, messagesSinceResolved, repliedSinceResolved };