@vite-hub/ui 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (433) hide show
  1. package/README.md +27 -7
  2. package/dist/{andromeeda-DnSv6o6l.js → andromeeda-BASpqCeJ.js} +1 -1
  3. package/dist/attachment-B3dXC7jM.js +71 -0
  4. package/dist/attachment-BBndG9_P.d.ts +88 -0
  5. package/dist/attachment.d.ts +2 -0
  6. package/dist/attachment.js +2 -0
  7. package/dist/{aurora-x-XJ5I8rFc.js → aurora-x-DugsLcii.js} +1 -1
  8. package/dist/avatar-stack-DM6HRnc0.js +63 -0
  9. package/dist/avatar-stack-DXmCQhxd.d.ts +59 -0
  10. package/dist/avatar-stack.d.ts +2 -0
  11. package/dist/avatar-stack.js +2 -0
  12. package/dist/{ayu-dark-CBRGL64-.js → ayu-dark-BT3qdi3o.js} +1 -1
  13. package/dist/{ayu-light-BlrCS3Ih.js → ayu-light-BVZyHoh9.js} +1 -1
  14. package/dist/{ayu-mirage-CqpTmLcF.js → ayu-mirage-XFwUVZQZ.js} +1 -1
  15. package/dist/bubble-BJH2rfii.d.ts +72 -0
  16. package/dist/bubble-BPyFQlW7.js +53 -0
  17. package/dist/bubble.d.ts +2 -0
  18. package/dist/bubble.js +2 -0
  19. package/dist/catppuccin-frappe-D20KODDN.js +4 -0
  20. package/dist/catppuccin-latte-eGLVHIUJ.js +4 -0
  21. package/dist/catppuccin-macchiato-bQGch4PY.js +4 -0
  22. package/dist/catppuccin-mocha-Bes8-0Mr.js +4 -0
  23. package/dist/chat-B9HlZWA2.d.ts +50 -0
  24. package/dist/chat-BoFHlu9V.js +73 -0
  25. package/dist/chat-message-BNK9G7xF.js +51 -0
  26. package/dist/chat-message-mpDmZbIC.d.ts +28 -0
  27. package/dist/chat-message.d.ts +2 -0
  28. package/dist/chat-message.js +2 -0
  29. package/dist/chat-session-D6C7VJBR.d.ts +29 -0
  30. package/dist/chat-session-DYEHB1HC.js +38 -0
  31. package/dist/chat-session.d.ts +2 -0
  32. package/dist/chat-session.js +2 -0
  33. package/dist/chat.d.ts +2 -0
  34. package/dist/chat.js +2 -0
  35. package/dist/code-block-Br-02hn-.js +139 -0
  36. package/dist/code-block.d.ts +2 -0
  37. package/dist/code-block.js +3 -0
  38. package/dist/code-view-J4OsgEdh.js +158 -0
  39. package/dist/code-view-vDM-hph-.d.ts +4091 -0
  40. package/dist/code-view.d.ts +2 -0
  41. package/dist/code-view.js +2 -0
  42. package/dist/comment-layer-CBlxJ8eK.js +1113 -0
  43. package/dist/comments-C08J3z4e.js +456 -0
  44. package/dist/comments-ChNJkV1d.d.ts +108 -0
  45. package/dist/comments-Cq5eewsu.d.ts +537 -0
  46. package/dist/comments.d.ts +2 -0
  47. package/dist/comments.js +2 -0
  48. package/dist/{config-BwhBDTjC.d.ts → config-Bux_AJzm.d.ts} +0 -1
  49. package/dist/{config-CzOjpPth.js → config-bHqE4JOs.js} +2 -7
  50. package/dist/connection-status-CzuWBENf.js +65 -0
  51. package/dist/connection-status-DjGBw6xX.d.ts +39 -0
  52. package/dist/connection-status.d.ts +2 -0
  53. package/dist/connection-status.js +2 -0
  54. package/dist/{dark-plus-BCxGtnt0.js → dark-plus-BGuiqa1B.js} +1 -1
  55. package/dist/{dracula-fPErIccy.js → dracula-0CVA2XY5.js} +1 -1
  56. package/dist/{dracula-soft-BrQbqXs8.js → dracula-soft-Dk9bpbVU.js} +1 -1
  57. package/dist/error-diagnostics-B4hMpJRL.js +13 -0
  58. package/dist/{everforest-dark-gTeBQCos.js → everforest-dark-CRjTbhh5.js} +1 -1
  59. package/dist/{everforest-light-DUjxsp-2.js → everforest-light-CEeYFLn8.js} +1 -1
  60. package/dist/file-diff.d.ts +2 -0
  61. package/dist/file-diff.js +2 -0
  62. package/dist/file-tree-C1pv4_AI.js +9307 -0
  63. package/dist/file-tree-Ctb8hZ_g.d.ts +459 -0
  64. package/dist/file-tree.d.ts +2 -0
  65. package/dist/file-tree.js +2 -0
  66. package/dist/file-view.d.ts +2 -0
  67. package/dist/file-view.js +2 -0
  68. package/dist/{getSingularPatch-D0VFiyjB.js → getSingularPatch-Dsb8EgxR.js} +191 -116
  69. package/dist/{github-dark-Dg1hl_QD.js → github-dark-BXgKmOw_.js} +1 -1
  70. package/dist/{github-dark-default-Dym2P842.js → github-dark-default-DzJQXksd.js} +1 -1
  71. package/dist/{github-dark-dimmed-7iDMx266.js → github-dark-dimmed-B1pEmGtS.js} +1 -1
  72. package/dist/{github-dark-high-contrast-DkV2fyPG.js → github-dark-high-contrast-BkHIa6jc.js} +1 -1
  73. package/dist/{github-light-BQKYgor9.js → github-light-BKRlUbaB.js} +1 -1
  74. package/dist/{github-light-default-BZhIfzqQ.js → github-light-default-BU3eYkzs.js} +1 -1
  75. package/dist/{github-light-high-contrast-C7zHfx4C.js → github-light-high-contrast-B3MumDcI.js} +1 -1
  76. package/dist/{gruvbox-dark-hard-CQiwpF03.js → gruvbox-dark-hard-B0ecF443.js} +1 -1
  77. package/dist/{gruvbox-dark-medium-BKe6XKBS.js → gruvbox-dark-medium-BQnpC39k.js} +1 -1
  78. package/dist/{gruvbox-dark-soft-Cz6U6pa4.js → gruvbox-dark-soft-DFZUgESr.js} +1 -1
  79. package/dist/{gruvbox-light-hard-DgU_i19B.js → gruvbox-light-hard-CuB_LOJr.js} +1 -1
  80. package/dist/{gruvbox-light-medium-D64I06ER.js → gruvbox-light-medium-idDHgxjs.js} +1 -1
  81. package/dist/{gruvbox-light-soft-B-YxAs1L.js → gruvbox-light-soft-CfWH49MY.js} +1 -1
  82. package/dist/headless.d.ts +14 -14
  83. package/dist/headless.js +3 -333
  84. package/dist/highlighted-code-Ck4zexJX.js +90 -0
  85. package/dist/highlighted-code-Dzf6o54i.d.ts +112 -0
  86. package/dist/{horizon-bright-CPyV7XIA.js → horizon-bright-Ba6M8QSV.js} +1 -1
  87. package/dist/{horizon-DYoumREk.js → horizon-h92C5OlZ.js} +1 -1
  88. package/dist/{houston-B3NWfq0V.js → houston-EQnPegWq.js} +1 -1
  89. package/dist/image-preview-VfknBEFu.js +102 -0
  90. package/dist/index-DcH0QSI5.d.ts +61 -0
  91. package/dist/index.d.ts +34 -6378
  92. package/dist/index.js +27 -12338
  93. package/dist/kanagawa-dragon-DgDvwi3B.js +4 -0
  94. package/dist/kanagawa-lotus-BgoQro20.js +4 -0
  95. package/dist/kanagawa-wave-DgXEowHs.js +4 -0
  96. package/dist/{laserwave-DkfjiLxA.js → laserwave-IxBH_3yW.js} +1 -1
  97. package/dist/{light-plus-DuO6rXxZ.js → light-plus-S8JBx6is.js} +1 -1
  98. package/dist/markdown-BoLBN0qH.js +197 -0
  99. package/dist/markdown-Dse5ldJe.d.ts +47 -0
  100. package/dist/markdown.d.ts +2 -0
  101. package/dist/markdown.js +2 -0
  102. package/dist/marker-Di2ZG_k1.js +23 -0
  103. package/dist/marker-ea-tvx-J.d.ts +35 -0
  104. package/dist/marker.d.ts +2 -0
  105. package/dist/marker.js +2 -0
  106. package/dist/{material-theme-C_YrwKEa.js → material-theme-D1f3HBq-.js} +1 -1
  107. package/dist/{material-theme-darker-DB3YVCla.js → material-theme-darker-ExzYhT0j.js} +1 -1
  108. package/dist/{material-theme-lighter-D2fgNrBK.js → material-theme-lighter-D6gH9nnA.js} +1 -1
  109. package/dist/{material-theme-ocean-DVy172Rs.js → material-theme-ocean-D1w5BPAa.js} +1 -1
  110. package/dist/{material-theme-palenight-uMMwIfpG.js → material-theme-palenight-CkqWmVpF.js} +1 -1
  111. package/dist/message-CW_paC1k.d.ts +35 -0
  112. package/dist/message-DiyBthIq.js +23 -0
  113. package/dist/message-parts-BBFUkluC.d.ts +28 -0
  114. package/dist/message-parts-DQnfioAH.js +38 -0
  115. package/dist/message-parts.d.ts +2 -0
  116. package/dist/message-parts.js +2 -0
  117. package/dist/message-scroller-CX6NJTdm.js +335 -0
  118. package/dist/message.d.ts +2 -0
  119. package/dist/message.js +2 -0
  120. package/dist/{min-dark-C7Ec8I_2.js → min-dark-npsJH98j.js} +1 -1
  121. package/dist/{min-light-Be6foA7m.js → min-light-DUk1XsVt.js} +1 -1
  122. package/dist/monokai-CfFRWUNl.js +4 -0
  123. package/dist/multi-file-diff.d.ts +2 -0
  124. package/dist/multi-file-diff.js +2 -0
  125. package/dist/{night-owl-CqqbiLON.js → night-owl-BS7V-av_.js} +1 -1
  126. package/dist/{night-owl-light-B9vYgGRt.js → night-owl-light-CZtRawYE.js} +1 -1
  127. package/dist/{nord-BZ9DVmcN.js → nord-BFh54Nqz.js} +1 -1
  128. package/dist/nuxt.d.ts +8 -5
  129. package/dist/nuxt.js +136 -22
  130. package/dist/one-dark-pro-zDovGosB.js +4 -0
  131. package/dist/{one-light-CzxBC38_.js → one-light-gmHK3iK6.js} +1 -1
  132. package/dist/patch-diff.d.ts +2 -0
  133. package/dist/patch-diff.js +2 -0
  134. package/dist/{pierre-code-view-DYpF5M8R.js → pierre-code-view-T7V67hwT.js} +7209 -15318
  135. package/dist/{plastic-BGkJ2das.js → plastic-DtdaCjub.js} +1 -1
  136. package/dist/{poimandres-CpnMgZuc.js → poimandres-Hdda6aHK.js} +1 -1
  137. package/dist/primitive-rail.d.ts +222 -0
  138. package/dist/primitive-rail.js +348 -0
  139. package/dist/prompt-input-BbnCb80O.js +299 -0
  140. package/dist/prompt-input-Cy_Ue6B5.d.ts +93 -0
  141. package/dist/prompt-input.d.ts +2 -0
  142. package/dist/prompt-input.js +2 -0
  143. package/dist/red-VqZFRByZ.js +4 -0
  144. package/dist/rose-pine-DiTkEueR.js +4 -0
  145. package/dist/rose-pine-dawn-tfo5y2X0.js +4 -0
  146. package/dist/rose-pine-moon-C0gON9XN.js +4 -0
  147. package/dist/runtime/nuxt-plugin.js +3 -1
  148. package/dist/runtime-type-DlCscMfw.js +59 -0
  149. package/dist/{slack-dark-BS2AOOdo.js → slack-dark-v8P_eXr6.js} +1 -1
  150. package/dist/{slack-ochin-Nc7Cucwk.js → slack-ochin-D8SyEdKz.js} +1 -1
  151. package/dist/slot-part-C7Ocxn3b.js +20 -0
  152. package/dist/{snazzy-light-C2ghKZXY.js → snazzy-light-BtkQkvXb.js} +1 -1
  153. package/dist/solarized-dark-B8nAdMfM.js +4 -0
  154. package/dist/solarized-light-B-3F1INj.js +4 -0
  155. package/dist/styles.css +2134 -2034
  156. package/dist/sync-status-BpxYdZIJ.js +48 -0
  157. package/dist/sync-status-refELOZn.d.ts +25 -0
  158. package/dist/sync-status.d.ts +2 -0
  159. package/dist/sync-status.js +2 -0
  160. package/dist/{synthwave-84-CPtGYwOz.js → synthwave-84-DcsXCF_c.js} +1 -1
  161. package/dist/{tokyo-night-BKYoawWu.js → tokyo-night-Bvpqduda.js} +1 -1
  162. package/dist/tool-list-BdSr5CT4.js +150 -0
  163. package/dist/tool-list-E7CA52rz.d.ts +31 -0
  164. package/dist/tool-list.d.ts +2 -0
  165. package/dist/tool-list.js +2 -0
  166. package/dist/trace-V7rM3Pyd.d.ts +62 -0
  167. package/dist/trace-llBCDiSW.js +70 -0
  168. package/dist/trace-run-BIQ17CED.js +98 -0
  169. package/dist/trace-run-COeXn46Z.d.ts +28 -0
  170. package/dist/trace-run.d.ts +2 -0
  171. package/dist/trace-run.js +2 -0
  172. package/dist/trace.d.ts +2 -0
  173. package/dist/trace.js +2 -0
  174. package/dist/types-CqDwuJAm.d.ts +33 -0
  175. package/dist/unresolved-file.d.ts +2 -0
  176. package/dist/unresolved-file.js +2 -0
  177. package/dist/{vesper-ClvmKzqD.js → vesper-CfxmMOy3.js} +1 -1
  178. package/dist/vite.d.ts +3 -5
  179. package/dist/{vitesse-black-BY6Qtyq-.js → vitesse-black-D9-_1mjV.js} +1 -1
  180. package/dist/{vitesse-dark-BT-v_EgR.js → vitesse-dark-DlSMLlr9.js} +1 -1
  181. package/dist/{vitesse-light-Box8ZFz6.js → vitesse-light-KRWWWztf.js} +1 -1
  182. package/package.json +176 -26
  183. package/dist/abap-LtYK6g-v.js +0 -3
  184. package/dist/actionscript-3-Czo0lKSf.js +0 -3
  185. package/dist/ada-twHwrVWN.js +0 -3
  186. package/dist/angular-html-Ct-40ew8.js +0 -33
  187. package/dist/angular-ts-D6akBVit.js +0 -27
  188. package/dist/apache-BIl2qPOf.js +0 -3
  189. package/dist/apex-BkQQFAhi.js +0 -3
  190. package/dist/apl-Cxjn4xYu.js +0 -17
  191. package/dist/applescript-CJ80B5XJ.js +0 -3
  192. package/dist/ara-IxnQjO6j.js +0 -3
  193. package/dist/asciidoc-Dsw6zvwf.js +0 -3
  194. package/dist/asm-wBDSgBbA.js +0 -3
  195. package/dist/astro-BPVTb8uX.js +0 -19
  196. package/dist/awk-D6dA05Ye.js +0 -3
  197. package/dist/ballerina-DIdXD2KH.js +0 -3
  198. package/dist/bat-hQslfzu-.js +0 -3
  199. package/dist/beancount-CXtOQ8oS.js +0 -3
  200. package/dist/berry-CgA2ea0_.js +0 -3
  201. package/dist/bibtex-BzgdqG3s.js +0 -3
  202. package/dist/bicep-CZ338dSk.js +0 -3
  203. package/dist/bird2-GLyzhwkD.js +0 -3
  204. package/dist/blade-0LMawyyw.js +0 -21
  205. package/dist/bsl-0NWGiiFE.js +0 -6
  206. package/dist/c-Dc0_AVM6.js +0 -6
  207. package/dist/c3-BLXk7BLN.js +0 -3
  208. package/dist/cadence-B1ELWULD.js +0 -3
  209. package/dist/cairo-DjG4M3vq.js +0 -6
  210. package/dist/catppuccin-frappe-COUg_LSX.js +0 -4
  211. package/dist/catppuccin-latte-r30LFfsa.js +0 -4
  212. package/dist/catppuccin-macchiato-D-EwZyPh.js +0 -4
  213. package/dist/catppuccin-mocha-C6RD5yh3.js +0 -4
  214. package/dist/clarity-2iIoRiLx.js +0 -3
  215. package/dist/clojure-DDsQ0FaV.js +0 -3
  216. package/dist/cmake-DPsCB_V6.js +0 -3
  217. package/dist/cobol-CocL1RYn.js +0 -11
  218. package/dist/codeowners-CxEKPWu0.js +0 -3
  219. package/dist/codeql-BwdvwJnv.js +0 -3
  220. package/dist/coffee-DtqnQNu5.js +0 -6
  221. package/dist/common-lisp-DJtwvW4V.js +0 -3
  222. package/dist/coq-Ds6Ye5el.js +0 -3
  223. package/dist/cpp-Mb4ikSI3.js +0 -25
  224. package/dist/crystal-D4OMbAh_.js +0 -19
  225. package/dist/csharp-CFKaLbHg.js +0 -3
  226. package/dist/css-DTzmO9U0.js +0 -6
  227. package/dist/csv-DqIVFkK7.js +0 -3
  228. package/dist/cue-B5KneM5p.js +0 -3
  229. package/dist/cypher-D8Bb8Cq2.js +0 -3
  230. package/dist/d-BQY8TDgQ.js +0 -3
  231. package/dist/dart-C6DUdjib.js +0 -3
  232. package/dist/dax-S-Noo-ku.js +0 -3
  233. package/dist/desktop-BgOb7Aj4.js +0 -3
  234. package/dist/diff-Blb4MjsC.js +0 -3
  235. package/dist/docker-PC1tuYpa.js +0 -3
  236. package/dist/dotenv-Dkdv7Sm2.js +0 -3
  237. package/dist/dream-maker-CngiPd8U.js +0 -3
  238. package/dist/edge-DrFNu-N9.js +0 -13
  239. package/dist/elixir-OpZyQ8Ht.js +0 -6
  240. package/dist/elm-CjX_545P.js +0 -6
  241. package/dist/emacs-lisp-DxhFFVu_.js +0 -3
  242. package/dist/erb-trZRdc47.js +0 -11
  243. package/dist/erlang-BJeTH9QH.js +0 -6
  244. package/dist/fennel-B3wtZRne.js +0 -3
  245. package/dist/fish-D7qAeWQz.js +0 -3
  246. package/dist/fluent-BjfpB34g.js +0 -3
  247. package/dist/fortran-fixed-form-B_eBTsj9.js +0 -6
  248. package/dist/fortran-free-form-yxJ7igsv.js +0 -3
  249. package/dist/fsharp-UvrT6oWG.js +0 -6
  250. package/dist/gdresource-Dl9wvKCd.js +0 -11
  251. package/dist/gdscript-jjgTGGzd.js +0 -3
  252. package/dist/gdshader-D7JfdFV3.js +0 -3
  253. package/dist/genie-DnK2KWIP.js +0 -3
  254. package/dist/gherkin-D6Lr12YQ.js +0 -3
  255. package/dist/git-commit-2LMniMoO.js +0 -6
  256. package/dist/git-rebase-DUOURRPN.js +0 -6
  257. package/dist/gleam-CTllUdfC.js +0 -3
  258. package/dist/glimmer-js-D_32hFh8.js +0 -15
  259. package/dist/glimmer-ts-CVt002zd.js +0 -15
  260. package/dist/glsl-pHhzolba.js +0 -8
  261. package/dist/gn-DDjbVPF4.js +0 -3
  262. package/dist/gnuplot-DgWvVXI8.js +0 -3
  263. package/dist/go-aXtTCanQ.js +0 -3
  264. package/dist/graphql-BjqekQIR.js +0 -17
  265. package/dist/groovy-Bw2Ku4bU.js +0 -3
  266. package/dist/hack-BITNGzgt.js +0 -11
  267. package/dist/haml-DVwRP8W9.js +0 -13
  268. package/dist/handlebars-T3TJj8Il.js +0 -15
  269. package/dist/haskell-CfGsE1Cf.js +0 -3
  270. package/dist/haxe-B0odltAZ.js +0 -3
  271. package/dist/hcl-DHg_Osgo.js +0 -3
  272. package/dist/hjson-Cuaphql8.js +0 -3
  273. package/dist/hlsl-BJLUNfne.js +0 -3
  274. package/dist/html-CamevgpM.js +0 -13
  275. package/dist/html-derivative-jMOJf6rB.js +0 -6
  276. package/dist/http-BEHztmFP.js +0 -15
  277. package/dist/hurl-LmFBxrwm.js +0 -13
  278. package/dist/hxml-BQ4V4Tez.js +0 -6
  279. package/dist/hy-CJKxDzbh.js +0 -3
  280. package/dist/imba-96qKoJCa.js +0 -3
  281. package/dist/ini-C24lZfdM.js +0 -3
  282. package/dist/java-Cfowl-Ex.js +0 -6
  283. package/dist/javascript-C4sF7sej.js +0 -6
  284. package/dist/jinja-CCAEwzP4.js +0 -10
  285. package/dist/jison-BKCoBkyT.js +0 -6
  286. package/dist/json-E4f3l6hr.js +0 -6
  287. package/dist/json5-xULSgPQI.js +0 -3
  288. package/dist/jsonc-Cu6rqcrJ.js +0 -3
  289. package/dist/jsonl-Bp0qqr10.js +0 -3
  290. package/dist/jsonnet-BafgE6cE.js +0 -3
  291. package/dist/jssm-Dx5A5sBR.js +0 -3
  292. package/dist/jsx-BZjOirBP.js +0 -6
  293. package/dist/julia-nEdJo0dp.js +0 -17
  294. package/dist/just-Brtw3q7S.js +0 -19
  295. package/dist/kanagawa-dragon-DExkuQAs.js +0 -4
  296. package/dist/kanagawa-lotus-qdYh7_RY.js +0 -4
  297. package/dist/kanagawa-wave-CSW_hADG.js +0 -4
  298. package/dist/kdl-DkTyxPcj.js +0 -3
  299. package/dist/kotlin-BHE8CoV9.js +0 -3
  300. package/dist/kusto-6FdaWTzR.js +0 -3
  301. package/dist/latex-QHQNiZDD.js +0 -6
  302. package/dist/lean-BwOKScIt.js +0 -3
  303. package/dist/less-BzbdhFUi.js +0 -3
  304. package/dist/liquid-DYQ7uW5u.js +0 -15
  305. package/dist/llvm-uY68ROGz.js +0 -3
  306. package/dist/log-Dad54gsi.js +0 -3
  307. package/dist/logo-DTXV8SKw.js +0 -3
  308. package/dist/lua-BhkUWs1q.js +0 -8
  309. package/dist/luau-YC4aaMmR.js +0 -3
  310. package/dist/make-B2ukzWs3.js +0 -3
  311. package/dist/markdown-CkmxmzqY.js +0 -3
  312. package/dist/marko-BHWvxp04.js +0 -15
  313. package/dist/matlab-CfRK6IMC.js +0 -3
  314. package/dist/mdc-Dg7VPYLa.js +0 -13
  315. package/dist/mdx-BK9ZufRc.js +0 -3
  316. package/dist/mermaid-r7OoIYpE.js +0 -3
  317. package/dist/mipsasm-EL46Y4Xg.js +0 -3
  318. package/dist/mojo-YCzvCoMT.js +0 -3
  319. package/dist/monokai-CREPpJ3k.js +0 -4
  320. package/dist/moonbit-B_9L5rST.js +0 -3
  321. package/dist/move-Dqi5fhOb.js +0 -3
  322. package/dist/narrat-D9rrR0H5.js +0 -3
  323. package/dist/nextflow-CgUAk9iA.js +0 -6
  324. package/dist/nextflow-groovy-CdFFX-gF.js +0 -3
  325. package/dist/nginx-Q-E8IJvs.js +0 -6
  326. package/dist/nim-CNcTuF14.js +0 -21
  327. package/dist/nix-Bm1Ax-Z3.js +0 -7
  328. package/dist/nushell-r7hBzeS_.js +0 -3
  329. package/dist/objective-c-6dJF64Dt.js +0 -3
  330. package/dist/objective-cpp-_ooRQ-PY.js +0 -3
  331. package/dist/ocaml-vm1Y8An6.js +0 -3
  332. package/dist/odin-vjOJSyfV.js +0 -3
  333. package/dist/one-dark-pro-Ev8UPkf4.js +0 -4
  334. package/dist/openscad-jn-f1Ocl.js +0 -3
  335. package/dist/pascal-D8-gNZ2I.js +0 -3
  336. package/dist/perl-Bbgb6Twx.js +0 -17
  337. package/dist/php-CBOR45_G.js +0 -19
  338. package/dist/pkl-C7lWzykI.js +0 -3
  339. package/dist/plsql-DCNXypXO.js +0 -3
  340. package/dist/po-IjpR1yHO.js +0 -3
  341. package/dist/polar-4pN1JrJ8.js +0 -3
  342. package/dist/postcss-D1gKt4z_.js +0 -3
  343. package/dist/powerquery-SrvS_NBM.js +0 -3
  344. package/dist/powershell-CpTLv_ai.js +0 -3
  345. package/dist/prisma-BWfa4-tI.js +0 -3
  346. package/dist/prolog-Bacii3Ue.js +0 -3
  347. package/dist/proto-ClkOcAW0.js +0 -3
  348. package/dist/pug-Cn_U_o_I.js +0 -13
  349. package/dist/puppet-CQlPp728.js +0 -3
  350. package/dist/purescript-CLpaGMbw.js +0 -3
  351. package/dist/python-BjnOIxPe.js +0 -3
  352. package/dist/qml-DNlrbxJT.js +0 -6
  353. package/dist/qmldir-Dz8ttxjf.js +0 -3
  354. package/dist/qss-Iltvkn1C.js +0 -3
  355. package/dist/r-VqTZMNY_.js +0 -6
  356. package/dist/racket-DRv7j6nv.js +0 -3
  357. package/dist/raku-DI9yGpeW.js +0 -3
  358. package/dist/razor-Bw2un3e8.js +0 -11
  359. package/dist/red-EHiRGXSv.js +0 -4
  360. package/dist/reg-DpJf71oO.js +0 -3
  361. package/dist/regexp-5HbFqwky.js +0 -6
  362. package/dist/rel-BT0iIKKw.js +0 -3
  363. package/dist/riscv-CvzikGLb.js +0 -3
  364. package/dist/ron-DzAo6FTJ.js +0 -3
  365. package/dist/rose-pine-DTI-z1Qp.js +0 -4
  366. package/dist/rose-pine-dawn-BIiGXpWs.js +0 -4
  367. package/dist/rose-pine-moon-DU4wt90U.js +0 -4
  368. package/dist/rosmsg-CyYq6XdT.js +0 -3
  369. package/dist/rst-BZPDb03W.js +0 -23
  370. package/dist/ruby-BbVp0_gQ.js +0 -31
  371. package/dist/rust-COBzcmTx.js +0 -3
  372. package/dist/sas-DSkdG4wF.js +0 -6
  373. package/dist/sass-DI2zJwx7.js +0 -3
  374. package/dist/scala-CtSYTRYT.js +0 -3
  375. package/dist/scheme-D3A2QBtM.js +0 -3
  376. package/dist/scss-BQ7uffpQ.js +0 -8
  377. package/dist/sdbl-CdQg5gu1.js +0 -3
  378. package/dist/shaderlab-CWP9wBCf.js +0 -6
  379. package/dist/shellscript-B42c0JAn.js +0 -6
  380. package/dist/shellsession-Oc9-NqAv.js +0 -6
  381. package/dist/smalltalk-BEQkVl4K.js +0 -3
  382. package/dist/solarized-dark-UHgjRWhr.js +0 -4
  383. package/dist/solarized-light-B-Zcwve2.js +0 -4
  384. package/dist/solidity-lB9VjfB9.js +0 -3
  385. package/dist/soy-tgh9u9aW.js +0 -6
  386. package/dist/sparql-B4t0ZbEe.js +0 -6
  387. package/dist/splunk-xP_ZjUH2.js +0 -3
  388. package/dist/sql-CrPlEQn4.js +0 -6
  389. package/dist/ssh-config-DXFPABYp.js +0 -3
  390. package/dist/stata-D_KqT8cj.js +0 -6
  391. package/dist/stylus-ZZDn1yUO.js +0 -3
  392. package/dist/surrealql-C0KhgoyZ.js +0 -6
  393. package/dist/svelte-DuHT0xxw.js +0 -15
  394. package/dist/swift-BTPQlRLK.js +0 -3
  395. package/dist/system-verilog-BEoxaBuU.js +0 -3
  396. package/dist/systemd-DFbUltlW.js +0 -3
  397. package/dist/talonscript-CLxaFu-b.js +0 -3
  398. package/dist/tasl-_AAbKiWM.js +0 -3
  399. package/dist/tcl-DLe0Tsfm.js +0 -3
  400. package/dist/templ-DF54artD.js +0 -13
  401. package/dist/terraform-v0KN9QQh.js +0 -3
  402. package/dist/tex-Bbhb8xAP.js +0 -6
  403. package/dist/toml-B7BHZIqX.js +0 -3
  404. package/dist/ts-tags-DH1AB-Ri.js +0 -59
  405. package/dist/tsv-BorGVq2Z.js +0 -3
  406. package/dist/tsx-BR8s1Lhs.js +0 -6
  407. package/dist/turtle-BEG5g_eT.js +0 -3
  408. package/dist/twig-DziFF7iU.js +0 -19
  409. package/dist/typescript-D8TR6ff2.js +0 -6
  410. package/dist/typespec-C_R5TbvO.js +0 -3
  411. package/dist/typst-BV9w0z8-.js +0 -3
  412. package/dist/v-DfbeXLo8.js +0 -3
  413. package/dist/vala-BnnASFsX.js +0 -3
  414. package/dist/vb-DU29mvss.js +0 -3
  415. package/dist/verilog-BW5U03XW.js +0 -3
  416. package/dist/vhdl-Co2XFKY7.js +0 -3
  417. package/dist/viml-BReTXeDA.js +0 -3
  418. package/dist/vue-BRy8iDCZ.js +0 -31
  419. package/dist/vue-html-B24bjO_3.js +0 -6
  420. package/dist/vue-vine-l7O7Mg81.js +0 -19
  421. package/dist/vyper-C6KGx0YU.js +0 -3
  422. package/dist/wasm-BRCjOXGL.js +0 -7
  423. package/dist/wasm-gNIKwGlD.js +0 -3
  424. package/dist/wenyan-BeysbCrW.js +0 -3
  425. package/dist/wgsl-1s5rV5xS.js +0 -3
  426. package/dist/wikitext-wjhjmmzD.js +0 -3
  427. package/dist/wit-CeQiCbz_.js +0 -3
  428. package/dist/wolfram-CcZPfnLd.js +0 -3
  429. package/dist/xml-CduVPlYa.js +0 -8
  430. package/dist/xsl-BeH_vLTK.js +0 -6
  431. package/dist/yaml-Cb0uRU1q.js +0 -6
  432. package/dist/zenscript-BoijL7rl.js +0 -3
  433. package/dist/zig-lTQvxhLD.js +0 -3
@@ -0,0 +1,456 @@
1
+ import { t as uiErrorDiagnostics } from "./error-diagnostics-B4hMpJRL.js";
2
+ import { computed, getCurrentInstance, inject, onBeforeUnmount, onMounted, provide, reactive, ref, shallowRef, toRaw, toValue, watch } from "vue";
3
+ import { createAnchor, resolveAnchor } from "@vite-hub/comments/client";
4
+ //#region src/internal/comment-outside.ts
5
+ const consumedPointerEvents = /* @__PURE__ */ new WeakSet();
6
+ function swallowNextClick() {
7
+ const stop = (event) => {
8
+ event.stopPropagation();
9
+ event.preventDefault();
10
+ cleanup();
11
+ };
12
+ const cleanup = () => {
13
+ document.removeEventListener("click", stop, true);
14
+ document.removeEventListener("pointerdown", cleanup, true);
15
+ };
16
+ document.addEventListener("click", stop, true);
17
+ document.addEventListener("pointerdown", cleanup, true);
18
+ }
19
+ function useDocumentPointerDown(handler) {
20
+ onMounted(() => document.addEventListener("pointerdown", handler, true));
21
+ onBeforeUnmount(() => document.removeEventListener("pointerdown", handler, true));
22
+ }
23
+ const shakeEventName = "comments:shake";
24
+ const dirtySelector = "[data-slot='comment-composer'][data-dirty='true']";
25
+ function hasDirtyComposer(root = document) {
26
+ return root.querySelector(dirtySelector) !== null;
27
+ }
28
+ function shakeDirtyComposers(root = document) {
29
+ const dirty = [...root.querySelectorAll(dirtySelector)];
30
+ for (const composer of dirty) composer.dispatchEvent(new CustomEvent(shakeEventName));
31
+ return dirty.length > 0;
32
+ }
33
+ const pathOf = (event) => event.composedPath().filter((node) => node instanceof Element);
34
+ //#endregion
35
+ //#region src/headless/comments.ts
36
+ const commentsKey = Symbol("ViteHubComments");
37
+ const draftPositionKey = "draft";
38
+ const uiSelector = "[data-comments-ui]";
39
+ function defaultIgnore(element) {
40
+ for (let node = element; node;) {
41
+ if (node.closest(uiSelector)) return true;
42
+ const root = node.getRootNode();
43
+ node = root instanceof ShadowRoot ? root.host : null;
44
+ }
45
+ return false;
46
+ }
47
+ const elementsOf = (event) => event.composedPath().filter((node) => node instanceof Element);
48
+ function sameSubject(a, b) {
49
+ return a.kind === b.kind && a.id === b.id;
50
+ }
51
+ function samePosition(a, b) {
52
+ if (!a || !b) return a === b;
53
+ if (a.detached || b.detached) return a.detached === b.detached;
54
+ return a.element === b.element && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height && a.clipped === b.clipped;
55
+ }
56
+ const editableSelector = "input, textarea, select, [contenteditable]:not([contenteditable='false']), [role='textbox'], [role='combobox'], [role='searchbox']";
57
+ const isEditable = (path) => path.some((element) => element.matches(editableSelector));
58
+ function describeError(error) {
59
+ return error instanceof Error ? error.message : "The comment could not be sent. Try again.";
60
+ }
61
+ /** The comment state of one page. The styled parts, `CommentLayer` and the others, are built on it. */
62
+ function useComments(options) {
63
+ const { client } = options;
64
+ const param = options.param ?? "comment";
65
+ const hotkey = options.hotkey === void 0 ? "c" : options.hotkey === false ? false : options.hotkey.toLowerCase();
66
+ const ignore = options.ignore ?? defaultIgnore;
67
+ const subject = computed(() => toValue(options.subject));
68
+ const user = computed(() => toValue(options.user) ?? client.user);
69
+ const active = ref(false);
70
+ const scopeValue = ref("page");
71
+ const scope = computed({
72
+ get: () => scopeValue.value,
73
+ set: (value) => {
74
+ if (value === scopeValue.value) return;
75
+ if (hasText()) return block();
76
+ scopeValue.value = value;
77
+ }
78
+ });
79
+ const filters = reactive({
80
+ open: true,
81
+ resolved: false,
82
+ mine: false
83
+ });
84
+ const status = ref(client.status);
85
+ const threads = shallowRef(client.threads);
86
+ const positions = shallowRef(/* @__PURE__ */ new Map());
87
+ const draft = ref(null);
88
+ const openId = ref(null);
89
+ const hoverId = ref(null);
90
+ const listOpen = ref(false);
91
+ const blocked = ref(0);
92
+ const passes = (thread) => {
93
+ if (thread.status === "open" ? !filters.open : !filters.resolved) return false;
94
+ return !filters.mine || thread.author.id === user.value?.id;
95
+ };
96
+ const onPage = (thread) => sameSubject(thread.subject, subject.value);
97
+ const pageThreads = computed(() => threads.value.filter((thread) => onPage(thread) && passes(thread)));
98
+ const listed = computed(() => threads.value.filter((thread) => (scope.value === "site" || onPage(thread)) && passes(thread)));
99
+ const counts = computed(() => {
100
+ const scoped = threads.value.filter((thread) => scope.value === "site" || onPage(thread));
101
+ return {
102
+ open: scoped.filter((thread) => thread.status === "open").length,
103
+ resolved: scoped.filter((thread) => thread.status === "resolved").length
104
+ };
105
+ });
106
+ const opened = computed(() => threads.value.find((thread) => thread.id === openId.value));
107
+ const root = () => toValue(options.root) ?? document;
108
+ const uiRoot = () => toValue(options.uiRoot) ?? document;
109
+ function measure() {
110
+ const next = /* @__PURE__ */ new Map();
111
+ for (const thread of pageThreads.value) next.set(thread.id, resolveAnchor(thread.anchor, root()));
112
+ const current = opened.value;
113
+ if (current && onPage(current) && !next.has(current.id)) next.set(current.id, resolveAnchor(current.anchor, root()));
114
+ if (draft.value) next.set(draftPositionKey, resolveAnchor(draft.value.anchor, root()));
115
+ const previous = positions.value;
116
+ if (!(next.size === previous.size && [...next].every(([key, position]) => samePosition(position, previous.get(key))))) positions.value = next;
117
+ }
118
+ const hasText = () => (draft.value?.body.trim().length ?? 0) > 0 || hasDirtyComposer(uiRoot());
119
+ const block = () => {
120
+ blocked.value++;
121
+ shakeDirtyComposers(uiRoot());
122
+ };
123
+ function enter() {
124
+ active.value = true;
125
+ const selection = typeof window === "undefined" ? void 0 : window.getSelection();
126
+ if (selection && !selection.isCollapsed && selection.rangeCount > 0) {
127
+ const container = selection.getRangeAt(0).commonAncestorContainer;
128
+ const element = container instanceof Element ? container : container.parentElement;
129
+ if (element && !ignore(element)) {
130
+ const rect = selection.getRangeAt(0).getBoundingClientRect();
131
+ startDraft(selection, { point: {
132
+ x: rect.left,
133
+ y: rect.top
134
+ } });
135
+ selection.removeAllRanges();
136
+ }
137
+ }
138
+ }
139
+ function cancelDraft() {
140
+ draft.value = null;
141
+ }
142
+ function close() {
143
+ if (hasText()) {
144
+ block();
145
+ return false;
146
+ }
147
+ openId.value = null;
148
+ hoverId.value = null;
149
+ return true;
150
+ }
151
+ function exit() {
152
+ if (hasText()) return block();
153
+ cancelDraft();
154
+ close();
155
+ active.value = false;
156
+ }
157
+ function toggle() {
158
+ if (active.value) exit();
159
+ else enter();
160
+ }
161
+ function startDraft(target, anchorOptions = {}) {
162
+ if (hasText()) return block();
163
+ close();
164
+ const anchor = createAnchor(target, {
165
+ root: root(),
166
+ ignore,
167
+ ...anchorOptions
168
+ });
169
+ let point = anchorOptions.point ?? {
170
+ x: 0,
171
+ y: 0
172
+ };
173
+ if (target === "page") point = {
174
+ x: Math.max(16, window.innerWidth / 2 - 180),
175
+ y: 96
176
+ };
177
+ else if ("nodeType" in target) {
178
+ const box = target.getBoundingClientRect();
179
+ point = anchorOptions.point ?? {
180
+ x: box.left + box.width / 2,
181
+ y: box.top + box.height / 2
182
+ };
183
+ } else if (!("rangeCount" in target) && !("startContainer" in target)) point = target;
184
+ draft.value = {
185
+ anchor,
186
+ point,
187
+ body: "",
188
+ mentions: [],
189
+ busy: false,
190
+ error: void 0
191
+ };
192
+ measure();
193
+ }
194
+ async function send() {
195
+ const current = draft.value;
196
+ const body = current?.body.trim() ?? "";
197
+ if (!current || current.busy || !body) return void 0;
198
+ const submittedBody = current.body;
199
+ const mentions = [...current.mentions];
200
+ current.busy = true;
201
+ current.error = void 0;
202
+ try {
203
+ const thread = await client.create({
204
+ subject: subject.value,
205
+ anchor: toRaw(current.anchor),
206
+ body,
207
+ mentions
208
+ });
209
+ current.busy = false;
210
+ if (draft.value === current && current.body === submittedBody && current.mentions.length === mentions.length && current.mentions.every((id, index) => id === mentions[index])) draft.value = null;
211
+ return thread;
212
+ } catch (error) {
213
+ current.busy = false;
214
+ current.error = describeError(error);
215
+ return;
216
+ }
217
+ }
218
+ let revealTimer;
219
+ function reveal(id) {
220
+ clearTimeout(revealTimer);
221
+ let attempts = 0;
222
+ const tick = () => {
223
+ measure();
224
+ const position = positions.value.get(id);
225
+ if (position && !position.detached) {
226
+ position.element?.scrollIntoView?.({ block: "center" });
227
+ measure();
228
+ } else if (++attempts < 20) revealTimer = setTimeout(tick, 150);
229
+ };
230
+ tick();
231
+ }
232
+ function open(thread, openOptions = {}) {
233
+ const id = typeof thread === "string" ? thread : thread.id;
234
+ if (hasText()) return block();
235
+ cancelDraft();
236
+ openId.value = id;
237
+ hoverId.value = null;
238
+ const found = threads.value.find((entry) => entry.id === id);
239
+ if (found && onPage(found)) {
240
+ if (openOptions.scroll) reveal(id);
241
+ else measure();
242
+ }
243
+ }
244
+ function link(thread) {
245
+ const location = options.location?.() ?? window.location;
246
+ const base = options.subjectUrl?.(thread.subject) ?? (thread.subject.kind === "page" ? thread.subject.id : location.href);
247
+ const url = new URL(base, location.origin);
248
+ url.searchParams.set(param, String(thread.n));
249
+ return `${url.pathname.startsWith("//") ? `/%2F${url.pathname.slice(2)}` : url.pathname}${url.search}${url.hash}`;
250
+ }
251
+ let deepLinked = false;
252
+ function applyDeepLink() {
253
+ if (deepLinked || status.value !== "ready") return;
254
+ deepLinked = true;
255
+ const location = options.location?.() ?? window.location;
256
+ const n = Number(new URLSearchParams(location.search).get(param));
257
+ if (!Number.isInteger(n) || n < 1) return;
258
+ const thread = threads.value.find((entry) => entry.n === n && onPage(entry));
259
+ if (!thread) return;
260
+ if (thread.status === "resolved") filters.resolved = true;
261
+ filters.mine = false;
262
+ open(thread, { scroll: true });
263
+ }
264
+ function onKeydown(event) {
265
+ if (event.defaultPrevented || event.isComposing || event.repeat) return;
266
+ const path = elementsOf(event);
267
+ const origin = path[0];
268
+ if (event.key === "Escape") {
269
+ if (path.some((element) => element.matches("[data-slot='comment-composer']"))) return;
270
+ if (active.value || draft.value || openId.value) exit();
271
+ return;
272
+ }
273
+ if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || isEditable(path)) return;
274
+ if (event.key === "Enter" && active.value && origin && !path.some(ignore) && origin !== document.body && origin !== document.documentElement) {
275
+ event.preventDefault();
276
+ try {
277
+ startDraft(origin);
278
+ } catch {}
279
+ return;
280
+ }
281
+ if (hotkey === false || event.key.toLowerCase() !== hotkey) return;
282
+ event.preventDefault();
283
+ toggle();
284
+ }
285
+ function start() {
286
+ const stops = [];
287
+ client.query = scope.value === "page" ? { subject: subject.value } : {};
288
+ stops.push(client.onChange(() => {
289
+ status.value = client.status;
290
+ threads.value = client.threads;
291
+ }));
292
+ status.value = client.status;
293
+ threads.value = client.threads;
294
+ stops.push(client.start());
295
+ document.addEventListener("keydown", onKeydown);
296
+ stops.push(() => document.removeEventListener("keydown", onKeydown));
297
+ let frame = 0;
298
+ const schedule = () => {
299
+ if (frame) return;
300
+ frame = requestAnimationFrame(() => {
301
+ frame = 0;
302
+ measure();
303
+ });
304
+ };
305
+ window.addEventListener("scroll", schedule, {
306
+ capture: true,
307
+ passive: true
308
+ });
309
+ window.addEventListener("resize", schedule);
310
+ window.addEventListener("load", schedule, { capture: true });
311
+ document.fonts?.addEventListener("loadingdone", schedule);
312
+ const onPopstate = () => {
313
+ deepLinked = false;
314
+ applyDeepLink();
315
+ };
316
+ window.addEventListener("popstate", onPopstate);
317
+ const observer = new MutationObserver((records) => {
318
+ if (records.every((record) => record.target instanceof Element && defaultIgnore(record.target))) return;
319
+ schedule();
320
+ });
321
+ const observeOptions = {
322
+ attributes: true,
323
+ characterData: true,
324
+ childList: true,
325
+ subtree: true
326
+ };
327
+ stops.push(watch(root, (value) => {
328
+ observer.disconnect();
329
+ observer.observe(document.documentElement, observeOptions);
330
+ if (value !== document) observer.observe(value, observeOptions);
331
+ schedule();
332
+ }, {
333
+ immediate: true,
334
+ flush: "post"
335
+ }));
336
+ const resizes = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(schedule);
337
+ const watched = /* @__PURE__ */ new Set();
338
+ const follow = () => {
339
+ const now = /* @__PURE__ */ new Set();
340
+ for (const position of positions.value.values()) if (!position.detached && position.element) now.add(position.element);
341
+ for (const element of watched) if (!now.has(element)) {
342
+ resizes?.unobserve(element);
343
+ watched.delete(element);
344
+ }
345
+ for (const element of now) if (!watched.has(element)) {
346
+ resizes?.observe(element);
347
+ watched.add(element);
348
+ }
349
+ };
350
+ stops.push(() => {
351
+ window.removeEventListener("scroll", schedule, { capture: true });
352
+ window.removeEventListener("resize", schedule);
353
+ window.removeEventListener("load", schedule, { capture: true });
354
+ window.removeEventListener("popstate", onPopstate);
355
+ document.fonts?.removeEventListener("loadingdone", schedule);
356
+ observer.disconnect();
357
+ resizes?.disconnect();
358
+ clearTimeout(revealTimer);
359
+ if (frame) cancelAnimationFrame(frame);
360
+ });
361
+ stops.push(watch(positions, follow, { flush: "post" }));
362
+ stops.push(watch([
363
+ pageThreads,
364
+ () => draft.value?.anchor,
365
+ openId
366
+ ], () => measure(), { flush: "post" }));
367
+ stops.push(watch(() => status.value === "ready", (ready) => ready && applyDeepLink(), { immediate: true }));
368
+ stops.push(watch(() => `${subject.value.kind}\u0000${subject.value.id}\u0000${scope.value}`, () => {
369
+ client.query = scope.value === "page" ? { subject: subject.value } : {};
370
+ cancelDraft();
371
+ openId.value = null;
372
+ hoverId.value = null;
373
+ deepLinked = false;
374
+ client.refresh().catch(() => void 0);
375
+ }));
376
+ return () => {
377
+ for (const stop of stops.splice(0)) stop();
378
+ };
379
+ }
380
+ const state = {
381
+ client,
382
+ subject,
383
+ user,
384
+ active,
385
+ scope,
386
+ filters,
387
+ status,
388
+ threads,
389
+ pageThreads,
390
+ listed,
391
+ counts,
392
+ positions,
393
+ draft,
394
+ openId,
395
+ hoverId,
396
+ opened,
397
+ listOpen,
398
+ blocked,
399
+ enter,
400
+ exit,
401
+ toggle,
402
+ startDraft,
403
+ cancelDraft,
404
+ send,
405
+ open,
406
+ close,
407
+ reply: (threadId, body, mentions) => client.reply({
408
+ threadId,
409
+ body,
410
+ mentions
411
+ }),
412
+ edit: (threadId, messageId, body, mentions) => client.edit({
413
+ threadId,
414
+ messageId,
415
+ body,
416
+ mentions
417
+ }),
418
+ remove: async (threadId, messageId) => {
419
+ const next = await client.delete({
420
+ threadId,
421
+ messageId
422
+ });
423
+ if (!next && openId.value === threadId) {
424
+ openId.value = null;
425
+ hoverId.value = null;
426
+ }
427
+ return next;
428
+ },
429
+ resolve: (threadId) => client.resolve({ threadId }),
430
+ reopen: (threadId) => client.reopen({ threadId }),
431
+ users: (query) => client.users({ query }),
432
+ link,
433
+ measure,
434
+ start
435
+ };
436
+ if (options.autoStart !== false && getCurrentInstance()) {
437
+ let stop;
438
+ onMounted(() => {
439
+ stop = start();
440
+ });
441
+ onBeforeUnmount(() => stop?.());
442
+ }
443
+ return state;
444
+ }
445
+ /** Makes `state` the one that `CommentToolbar`, `CommentList`, and `CommentFilters` use inside this component tree. */
446
+ function provideComments(state) {
447
+ provide(commentsKey, state);
448
+ }
449
+ /** The state that a comment part uses: the one you pass, else the one of the nearest `CommentLayer` or `provideComments()`. Call it in `setup()`. */
450
+ function useCommentsContext(state) {
451
+ const found = state ?? inject(commentsKey, null);
452
+ if (!found) throw uiErrorDiagnostics.UI_R0002({ message: "Comment parts need a comments state. Put them inside CommentLayer, or pass the result of useComments() as the `comments` prop." });
453
+ return found;
454
+ }
455
+ //#endregion
456
+ export { consumedPointerEvents as a, shakeEventName as c, useCommentsContext as i, swallowNextClick as l, provideComments as n, pathOf as o, useComments as r, shakeDirtyComposers as s, draftPositionKey as t, useDocumentPointerDown as u };
@@ -0,0 +1,108 @@
1
+ import { ComputedRef, MaybeRefOrGetter, Ref, ShallowRef } from "vue";
2
+ import { AnchorPoint, AnchorPosition, AnchorTarget, CommentAnchor, CommentSubject, CommentThread, CommentUser, CommentsClient, CommentsClientStatus, CreateAnchorOptions } from "@vite-hub/comments/client";
3
+ //#region src/headless/comments.d.ts
4
+ /** Each switch shows one kind of thread. Resolved threads stay hidden until `resolved` is on. */
5
+ interface CommentFilterState {
6
+ open: boolean;
7
+ resolved: boolean;
8
+ /** Only threads that the signed-in user started. */
9
+ mine: boolean;
10
+ }
11
+ /** `page` lists the threads of this page. `site` lists the threads of every page. */
12
+ type CommentScope = "page" | "site";
13
+ /** A comment that is being written. It becomes a thread when it is sent. */
14
+ interface CommentDraft {
15
+ anchor: CommentAnchor;
16
+ /** Where the click landed in client coordinates. The pin sits here until its element is measured. */
17
+ point: AnchorPoint;
18
+ body: string;
19
+ mentions: string[];
20
+ busy: boolean;
21
+ error: string | undefined;
22
+ }
23
+ interface UseCommentsOptions {
24
+ client: CommentsClient;
25
+ /** What the threads of this page are about. For a page, `{ kind: "page", id: location.pathname }`. */
26
+ subject: MaybeRefOrGetter<CommentSubject>;
27
+ /** The signed-in user. Defaults to `client.user`. */
28
+ user?: MaybeRefOrGetter<CommentUser | undefined>;
29
+ /** Where anchors are looked up. Defaults to the document. */
30
+ root?: MaybeRefOrGetter<ParentNode | undefined>;
31
+ /** The query parameter that deep-links a thread. Default `"comment"`. */
32
+ param?: string;
33
+ /** The key that toggles comment mode. Default `"c"`. `false` turns the key off. */
34
+ hotkey?: string | false;
35
+ /** Elements that anchors skip. Defaults to the comment UI. */
36
+ ignore?: (element: Element) => boolean;
37
+ /** Where the comment UI lives: the document, or the shadow root of the overlay. Composers are looked up there. Defaults to the document. */
38
+ uiRoot?: MaybeRefOrGetter<ParentNode | undefined>;
39
+ /** The URL of the page that a subject lives on, for a link to a thread. Page subjects use their id as the path. Other subjects need this, or their link is the current page. */
40
+ subjectUrl?: (subject: CommentSubject) => string | undefined;
41
+ /** Where the deep link is read. Defaults to `window.location`. */
42
+ location?: () => Pick<Location, "href" | "origin" | "search">;
43
+ /** Load the threads and listen for keys when the component mounts. Default `true`. Call `start()` yourself when `false`. */
44
+ autoStart?: boolean;
45
+ }
46
+ interface CommentsState {
47
+ readonly client: CommentsClient;
48
+ readonly subject: ComputedRef<CommentSubject>;
49
+ readonly user: ComputedRef<CommentUser | undefined>;
50
+ /** Comment mode: a click drops a pin. */
51
+ readonly active: Ref<boolean>;
52
+ readonly scope: Ref<CommentScope>;
53
+ readonly filters: CommentFilterState;
54
+ readonly status: Ref<CommentsClientStatus>;
55
+ /** Every thread that the client holds. */
56
+ readonly threads: ShallowRef<readonly CommentThread[]>;
57
+ /** The threads of this page that pass the filters. They get pins. */
58
+ readonly pageThreads: ComputedRef<CommentThread[]>;
59
+ /** The threads that pass the filters, for the page or the whole site as `scope` says. The list shows them. */
60
+ readonly listed: ComputedRef<CommentThread[]>;
61
+ readonly counts: ComputedRef<{
62
+ open: number;
63
+ resolved: number;
64
+ }>;
65
+ /** Pin positions by thread id, and `"draft"` for the comment being written. */
66
+ readonly positions: ShallowRef<ReadonlyMap<string, AnchorPosition>>;
67
+ readonly draft: Ref<CommentDraft | null>;
68
+ readonly openId: Ref<string | null>;
69
+ readonly hoverId: Ref<string | null>;
70
+ readonly opened: ComputedRef<CommentThread | undefined>;
71
+ readonly listOpen: Ref<boolean>;
72
+ /** Goes up when a composer with text stopped a click or a key. The composer shakes by itself. */
73
+ readonly blocked: Ref<number>;
74
+ enter: () => void;
75
+ exit: () => void;
76
+ toggle: () => void;
77
+ /** Starts a draft on a point, an element, a selection, or `"page"`. Ends an empty draft first, and keeps one with text. A pin has no number until the server assigns one. */
78
+ startDraft: (target: AnchorTarget, options?: CreateAnchorOptions) => void;
79
+ cancelDraft: () => void;
80
+ /** Sends the draft. Resolves with the new thread, or `undefined` when there is nothing to send or the send failed. */
81
+ send: () => Promise<CommentThread | undefined>;
82
+ open: (thread: CommentThread | string, options?: {
83
+ scroll?: boolean;
84
+ }) => void;
85
+ /** Closes the thread, returning false when unsent text prevents closing or navigation. */
86
+ close: () => boolean;
87
+ reply: (threadId: string, body: string, mentions?: string[]) => Promise<CommentThread>;
88
+ edit: (threadId: string, messageId: string, body: string, mentions?: string[]) => Promise<CommentThread>;
89
+ remove: (threadId: string, messageId?: string) => Promise<CommentThread | null>;
90
+ resolve: (threadId: string) => Promise<CommentThread>;
91
+ reopen: (threadId: string) => Promise<CommentThread>;
92
+ users: (query: string) => Promise<CommentUser[]>;
93
+ /** The URL that opens the thread: its page with `?comment=<n>`. */
94
+ link: (thread: CommentThread) => string;
95
+ /** Measures every pin again. The state does it on scroll, resize, and DOM changes. */
96
+ measure: () => void;
97
+ /** Loads the threads and starts the key, layout, and deep-link handling. Returns a function that stops them. */
98
+ start: () => () => void;
99
+ }
100
+ declare const draftPositionKey = "draft";
101
+ /** The comment state of one page. The styled parts, `CommentLayer` and the others, are built on it. */
102
+ declare function useComments(options: UseCommentsOptions): CommentsState;
103
+ /** Makes `state` the one that `CommentToolbar`, `CommentList`, and `CommentFilters` use inside this component tree. */
104
+ declare function provideComments(state: CommentsState): void;
105
+ /** The state that a comment part uses: the one you pass, else the one of the nearest `CommentLayer` or `provideComments()`. Call it in `setup()`. */
106
+ declare function useCommentsContext(state?: CommentsState): CommentsState;
107
+ //#endregion
108
+ export { UseCommentsOptions as a, useComments as c, CommentsState as i, useCommentsContext as l, CommentFilterState as n, draftPositionKey as o, CommentScope as r, provideComments as s, CommentDraft as t };