@vite-hub/ui 0.1.0 → 0.3.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 (308) hide show
  1. package/README.md +244 -18
  2. package/dist/attachments-BzTwqRTU.js +90 -0
  3. package/dist/choices-input-ByXJvDn1.d.ts +94 -0
  4. package/dist/{code-view-J4OsgEdh.js → code-view-D0bqhogi.js} +20 -4
  5. package/dist/colors-BghReA9C-CjF9gnmy.js +28 -0
  6. package/dist/comment-composer-Cc8Jvu6u.d.ts +243 -0
  7. package/dist/comment-composer-jYv2ULNP.js +591 -0
  8. package/dist/comment-layer-ClH4MLj4.d.ts +165 -0
  9. package/dist/comment-list-B8hphLfS.d.ts +62 -0
  10. package/dist/comment-marks.css +234 -0
  11. package/dist/comment-panel-fcKSKwLC.d.ts +197 -0
  12. package/dist/comment-person-CLPlW_SS.js +40 -0
  13. package/dist/comment-pin-CvwgRSDR.d.ts +68 -0
  14. package/dist/comment-row-Bbm9WwuF.js +39 -0
  15. package/dist/comment-thread-CoTLrdal.d.ts +368 -0
  16. package/dist/comment-visibility-DsVuVndP.d.ts +40 -0
  17. package/dist/{comments-ChNJkV1d.d.ts → comments-Bx2WRsYy.d.ts} +69 -7
  18. package/dist/{comments-C08J3z4e.js → comments-CkWc2Khc.js} +155 -60
  19. package/dist/comments-context-C2lOZyQ5.js +38 -0
  20. package/dist/config-DgxBW013.d.ts +80 -0
  21. package/dist/config-Dk67emQt.js +63 -0
  22. package/dist/copy-button-CRN3kmSD.js +253 -0
  23. package/dist/draw-DzSmD7uo-Dwz8zoH2.js +72976 -0
  24. package/dist/editor-C_wt4RRV.js +582 -0
  25. package/dist/error-diagnostics-SXtnk6bz.js +38 -0
  26. package/dist/{file-tree-C1pv4_AI.js → file-tree-C4OYgbV-.js} +292 -145
  27. package/dist/{file-tree-Ctb8hZ_g.d.ts → file-tree-DlT9RGhu.d.ts} +51 -15
  28. package/dist/format-Du58PlsG.js +18 -0
  29. package/dist/handlers-DMl-Na3x.js +182 -0
  30. package/dist/headless.d.ts +5 -176
  31. package/dist/headless.js +5 -3
  32. package/dist/icon-swap.css +69 -0
  33. package/dist/{image-preview-VfknBEFu.js → image-preview-C9tdkmEj.js} +8 -5
  34. package/dist/{index-DcH0QSI5.d.ts → index-BD1e8vx5.d.ts} +8 -0
  35. package/dist/{code-view-vDM-hph-.d.ts → index-CNY1uNTh.d.ts} +14 -228
  36. package/dist/index.d.ts +53 -56
  37. package/dist/index.js +677 -25
  38. package/dist/markdown-editor-CMbNZOdN.js +2394 -0
  39. package/dist/markdown-editor-DqdZfIEn.d.ts +195 -0
  40. package/dist/markdown-editor.d.ts +108 -0
  41. package/dist/markdown-editor.js +3 -0
  42. package/dist/message-scroller-Bm1YWTeY.d.ts +175 -0
  43. package/dist/nuxt-ui-DSQFzq3s.js +38 -0
  44. package/dist/nuxt.d.ts +84 -2
  45. package/dist/nuxt.js +237 -35
  46. package/dist/parts/components/agent-session.d.ts +254 -0
  47. package/dist/parts/components/agent-session.js +640 -0
  48. package/dist/{attachment-BBndG9_P.d.ts → parts/components/attachment.d.ts} +13 -14
  49. package/dist/{attachment-B3dXC7jM.js → parts/components/attachment.js} +6 -4
  50. package/dist/{avatar-stack.d.ts → parts/components/avatar-stack.d.ts} +1 -1
  51. package/dist/{avatar-stack-DM6HRnc0.js → parts/components/avatar-stack.js} +2 -5
  52. package/dist/{bubble-BJH2rfii.d.ts → parts/components/bubble.d.ts} +8 -9
  53. package/dist/{bubble-BPyFQlW7.js → parts/components/bubble.js} +2 -2
  54. package/dist/{chat-message-mpDmZbIC.d.ts → parts/components/chat-message.d.ts} +2 -3
  55. package/dist/{chat-message-BNK9G7xF.js → parts/components/chat-message.js} +4 -4
  56. package/dist/{chat-session-D6C7VJBR.d.ts → parts/components/chat-session.d.ts} +3 -4
  57. package/dist/{chat-session-DYEHB1HC.js → parts/components/chat-session.js} +2 -2
  58. package/dist/{chat-B9HlZWA2.d.ts → parts/components/chat.d.ts} +8 -4
  59. package/dist/{chat-BoFHlu9V.js → parts/components/chat.js} +42 -9
  60. package/dist/{highlighted-code-Dzf6o54i.d.ts → parts/components/code-block.d.ts} +16 -24
  61. package/dist/{code-block-Br-02hn-.js → parts/components/code-block.js} +9 -38
  62. package/dist/parts/components/code-view.d.ts +270 -0
  63. package/dist/parts/components/code-view.js +2 -0
  64. package/dist/parts/components/comment-composer.d.ts +2 -0
  65. package/dist/parts/components/comment-composer.js +2 -0
  66. package/dist/parts/components/comment-layer.d.ts +2 -0
  67. package/dist/parts/components/comment-layer.js +618 -0
  68. package/dist/parts/components/comment-list.d.ts +2 -0
  69. package/dist/parts/components/comment-list.js +167 -0
  70. package/dist/parts/components/comment-panel.d.ts +2 -0
  71. package/dist/parts/components/comment-panel.js +299 -0
  72. package/dist/parts/components/comment-pin.d.ts +2 -0
  73. package/dist/parts/components/comment-pin.js +75 -0
  74. package/dist/parts/components/comment-thread.d.ts +2 -0
  75. package/dist/parts/components/comment-thread.js +571 -0
  76. package/dist/parts/components/comments.d.ts +7 -0
  77. package/dist/parts/components/comments.js +8 -0
  78. package/dist/{connection-status-DjGBw6xX.d.ts → parts/components/connection-status.d.ts} +6 -7
  79. package/dist/{connection-status-CzuWBENf.js → parts/components/connection-status.js} +1 -1
  80. package/dist/parts/components/copy-button.d.ts +118 -0
  81. package/dist/parts/components/copy-button.js +2 -0
  82. package/dist/parts/components/device-frame.d.ts +130 -0
  83. package/dist/parts/components/device-frame.js +471 -0
  84. package/dist/parts/components/file-tree.d.ts +2 -0
  85. package/dist/parts/components/file-tree.js +2 -0
  86. package/dist/parts/components/filter-search.d.ts +47 -0
  87. package/dist/parts/components/filter-search.js +58 -0
  88. package/dist/parts/components/markdown-editor.d.ts +2 -0
  89. package/dist/parts/components/markdown-editor.js +2 -0
  90. package/dist/parts/components/markdown-renderer.d.ts +52 -0
  91. package/dist/parts/components/markdown-renderer.js +23077 -0
  92. package/dist/{markdown-Dse5ldJe.d.ts → parts/components/markdown.d.ts} +7 -7
  93. package/dist/parts/components/markdown.js +47 -0
  94. package/dist/{marker-ea-tvx-J.d.ts → parts/components/marker.d.ts} +5 -6
  95. package/dist/{marker-Di2ZG_k1.js → parts/components/marker.js} +2 -2
  96. package/dist/{message-parts-BBFUkluC.d.ts → parts/components/message-parts.d.ts} +2 -3
  97. package/dist/{message-parts-DQnfioAH.js → parts/components/message-parts.js} +6 -6
  98. package/dist/{message-CW_paC1k.d.ts → parts/components/message.d.ts} +8 -9
  99. package/dist/{message-DiyBthIq.js → parts/components/message.js} +2 -2
  100. package/dist/parts/components/patch-parsers.d.ts +2 -0
  101. package/dist/parts/components/patch-parsers.js +2 -0
  102. package/dist/{prompt-input-Cy_Ue6B5.d.ts → parts/components/prompt-input.d.ts} +54 -11
  103. package/dist/{prompt-input-BbnCb80O.js → parts/components/prompt-input.js} +66 -111
  104. package/dist/parts/components/relative-time.d.ts +73 -0
  105. package/dist/parts/components/relative-time.js +2 -0
  106. package/dist/parts/components/status.d.ts +60 -0
  107. package/dist/parts/components/status.js +48 -0
  108. package/dist/{sync-status-refELOZn.d.ts → parts/components/sync-status.d.ts} +5 -6
  109. package/dist/{sync-status-BpxYdZIJ.js → parts/components/sync-status.js} +1 -1
  110. package/dist/{tool-list-E7CA52rz.d.ts → parts/components/tool-list.d.ts} +3 -4
  111. package/dist/{tool-list-BdSr5CT4.js → parts/components/tool-list.js} +7 -38
  112. package/dist/{trace-run-COeXn46Z.d.ts → parts/components/trace-run.d.ts} +3 -4
  113. package/dist/{trace-run-BIQ17CED.js → parts/components/trace-run.js} +15 -23
  114. package/dist/{trace-V7rM3Pyd.d.ts → parts/components/trace.d.ts} +10 -11
  115. package/dist/{trace-llBCDiSW.js → parts/components/trace.js} +20 -13
  116. package/dist/parts/composables/attachments.d.ts +32 -0
  117. package/dist/parts/composables/attachments.js +2 -0
  118. package/dist/parts/composables/highlighted-code.d.ts +9 -0
  119. package/dist/{highlighted-code-Ck4zexJX.js → parts/composables/highlighted-code.js} +5 -2
  120. package/dist/parts/headless/choices-input.d.ts +2 -0
  121. package/dist/parts/headless/choices-input.js +162 -0
  122. package/dist/parts/headless/comment-visibility.d.ts +2 -0
  123. package/dist/parts/headless/comment-visibility.js +128 -0
  124. package/dist/parts/headless/comments.d.ts +2 -0
  125. package/dist/parts/headless/comments.js +2 -0
  126. package/dist/parts/headless/message-scroller.d.ts +2 -0
  127. package/dist/{message-scroller-CX6NJTdm.js → parts/headless/message-scroller.js} +2 -2
  128. package/dist/parts/playground/highlight.d.ts +5 -0
  129. package/dist/parts/playground/highlight.js +23 -0
  130. package/dist/parts/playground/paths.d.ts +4 -0
  131. package/dist/parts/playground/paths.js +7 -0
  132. package/dist/parts/playground/playground-render.d.ts +126 -0
  133. package/dist/parts/playground/playground-render.js +356 -0
  134. package/dist/parts/playground/share.d.ts +2 -0
  135. package/dist/parts/playground/share.js +92 -0
  136. package/dist/parts/playground/zip.d.ts +6 -0
  137. package/dist/parts/playground/zip.js +76 -0
  138. package/dist/parts/workspace/browser-support-notice.d.ts +76 -0
  139. package/dist/parts/workspace/browser-support-notice.js +105 -0
  140. package/dist/parts/workspace/codemirror.d.ts +16 -0
  141. package/dist/parts/workspace/codemirror.js +243 -0
  142. package/dist/parts/workspace/connect-panel.d.ts +129 -0
  143. package/dist/parts/workspace/connect-panel.js +285 -0
  144. package/dist/parts/workspace/connect-store.d.ts +26 -0
  145. package/dist/parts/workspace/connect-store.js +59 -0
  146. package/dist/parts/workspace/icons.d.ts +34 -0
  147. package/dist/parts/workspace/icons.js +46 -0
  148. package/dist/parts/workspace/playground-container.d.ts +192 -0
  149. package/dist/parts/workspace/playground-container.js +603 -0
  150. package/dist/parts/workspace/workspace-boot-status.d.ts +75 -0
  151. package/dist/parts/workspace/workspace-boot-status.js +207 -0
  152. package/dist/parts/workspace/workspace-editor.d.ts +43 -0
  153. package/dist/parts/workspace/workspace-editor.js +54 -0
  154. package/dist/parts/workspace/workspace-file-tree.d.ts +53 -0
  155. package/dist/parts/workspace/workspace-file-tree.js +68 -0
  156. package/dist/parts/workspace/workspace-preview.d.ts +72 -0
  157. package/dist/parts/workspace/workspace-preview.js +307 -0
  158. package/dist/parts/workspace/workspace-shell.d.ts +88 -0
  159. package/dist/parts/workspace/workspace-shell.js +291 -0
  160. package/dist/parts/workspace/workspace-terminal.d.ts +39 -0
  161. package/dist/parts/workspace/workspace-terminal.js +130 -0
  162. package/dist/payload-text-sjkYAwvw.js +32 -0
  163. package/dist/{pierre-code-view-T7V67hwT.js → pierre-code-view-xgBL6DO7.js} +209 -86
  164. package/dist/{pierre-dark-DDWDl8g6.js → pierre-dark-CzUmjETS.js} +3 -1
  165. package/dist/{pierre-light-CWhW4NrH.js → pierre-light-Dn6E0sWv.js} +3 -1
  166. package/dist/playground.d.ts +4 -0
  167. package/dist/playground.js +4 -0
  168. package/dist/relative-time-BVmjOsYG.js +309 -0
  169. package/dist/rolldown-runtime-C9mWXvCC.js +29 -0
  170. package/dist/runtime/nuxt-plugin.js +23 -4
  171. package/dist/sankey-CAYwt82B-D4uDQoMR.js +2887 -0
  172. package/dist/share-DM4eNy4q.d.ts +37 -0
  173. package/dist/{slot-part-C7Ocxn3b.js → slot-part-Doic71uh.js} +7 -1
  174. package/dist/styles.css +2465 -594
  175. package/dist/temml-BilSAAws.js +12362 -0
  176. package/dist/theme-focus-ring.css +42 -0
  177. package/dist/theme.css +376 -0
  178. package/dist/theme.d.ts +355 -0
  179. package/dist/theme.js +265 -0
  180. package/dist/{types-CqDwuJAm.d.ts → types-Dyr6CfBW.d.ts} +1 -1
  181. package/dist/vue-BDmSCtay.js +30779 -0
  182. package/dist/vue-DGstVdGn.js +2492 -0
  183. package/dist/workspace.d.ts +15 -0
  184. package/dist/workspace.js +12 -0
  185. package/package.json +136 -150
  186. package/dist/andromeeda-BASpqCeJ.js +0 -4
  187. package/dist/attachment.d.ts +0 -2
  188. package/dist/attachment.js +0 -2
  189. package/dist/aurora-x-DugsLcii.js +0 -4
  190. package/dist/avatar-stack.js +0 -2
  191. package/dist/ayu-dark-BT3qdi3o.js +0 -4
  192. package/dist/ayu-light-BVZyHoh9.js +0 -4
  193. package/dist/ayu-mirage-XFwUVZQZ.js +0 -4
  194. package/dist/bubble.d.ts +0 -2
  195. package/dist/bubble.js +0 -2
  196. package/dist/catppuccin-frappe-D20KODDN.js +0 -4
  197. package/dist/catppuccin-latte-eGLVHIUJ.js +0 -4
  198. package/dist/catppuccin-macchiato-bQGch4PY.js +0 -4
  199. package/dist/catppuccin-mocha-Bes8-0Mr.js +0 -4
  200. package/dist/chat-message.d.ts +0 -2
  201. package/dist/chat-message.js +0 -2
  202. package/dist/chat-session.d.ts +0 -2
  203. package/dist/chat-session.js +0 -2
  204. package/dist/chat.d.ts +0 -2
  205. package/dist/chat.js +0 -2
  206. package/dist/code-block.d.ts +0 -2
  207. package/dist/code-block.js +0 -3
  208. package/dist/code-view.d.ts +0 -2
  209. package/dist/code-view.js +0 -2
  210. package/dist/comment-layer-CBlxJ8eK.js +0 -1113
  211. package/dist/comments-Cq5eewsu.d.ts +0 -537
  212. package/dist/comments.d.ts +0 -2
  213. package/dist/comments.js +0 -2
  214. package/dist/config-Bux_AJzm.d.ts +0 -29
  215. package/dist/config-bHqE4JOs.js +0 -38
  216. package/dist/connection-status.d.ts +0 -2
  217. package/dist/connection-status.js +0 -2
  218. package/dist/dark-plus-BGuiqa1B.js +0 -4
  219. package/dist/dracula-0CVA2XY5.js +0 -4
  220. package/dist/dracula-soft-Dk9bpbVU.js +0 -4
  221. package/dist/error-diagnostics-B4hMpJRL.js +0 -13
  222. package/dist/everforest-dark-CRjTbhh5.js +0 -4
  223. package/dist/everforest-light-CEeYFLn8.js +0 -4
  224. package/dist/file-diff.d.ts +0 -2
  225. package/dist/file-diff.js +0 -2
  226. package/dist/file-tree.d.ts +0 -2
  227. package/dist/file-tree.js +0 -2
  228. package/dist/file-view.d.ts +0 -2
  229. package/dist/file-view.js +0 -2
  230. package/dist/github-dark-BXgKmOw_.js +0 -4
  231. package/dist/github-dark-default-DzJQXksd.js +0 -4
  232. package/dist/github-dark-dimmed-B1pEmGtS.js +0 -4
  233. package/dist/github-dark-high-contrast-BkHIa6jc.js +0 -4
  234. package/dist/github-light-BKRlUbaB.js +0 -4
  235. package/dist/github-light-default-BU3eYkzs.js +0 -4
  236. package/dist/github-light-high-contrast-B3MumDcI.js +0 -4
  237. package/dist/gruvbox-dark-hard-B0ecF443.js +0 -4
  238. package/dist/gruvbox-dark-medium-BQnpC39k.js +0 -4
  239. package/dist/gruvbox-dark-soft-DFZUgESr.js +0 -4
  240. package/dist/gruvbox-light-hard-CuB_LOJr.js +0 -4
  241. package/dist/gruvbox-light-medium-idDHgxjs.js +0 -4
  242. package/dist/gruvbox-light-soft-CfWH49MY.js +0 -4
  243. package/dist/horizon-bright-Ba6M8QSV.js +0 -4
  244. package/dist/horizon-h92C5OlZ.js +0 -4
  245. package/dist/houston-EQnPegWq.js +0 -4
  246. package/dist/kanagawa-dragon-DgDvwi3B.js +0 -4
  247. package/dist/kanagawa-lotus-BgoQro20.js +0 -4
  248. package/dist/kanagawa-wave-DgXEowHs.js +0 -4
  249. package/dist/laserwave-IxBH_3yW.js +0 -4
  250. package/dist/light-plus-S8JBx6is.js +0 -4
  251. package/dist/markdown-BoLBN0qH.js +0 -197
  252. package/dist/markdown.d.ts +0 -2
  253. package/dist/markdown.js +0 -2
  254. package/dist/marker.d.ts +0 -2
  255. package/dist/marker.js +0 -2
  256. package/dist/material-theme-D1f3HBq-.js +0 -4
  257. package/dist/material-theme-darker-ExzYhT0j.js +0 -4
  258. package/dist/material-theme-lighter-D6gH9nnA.js +0 -4
  259. package/dist/material-theme-ocean-D1w5BPAa.js +0 -4
  260. package/dist/material-theme-palenight-CkqWmVpF.js +0 -4
  261. package/dist/message-parts.d.ts +0 -2
  262. package/dist/message-parts.js +0 -2
  263. package/dist/message.d.ts +0 -2
  264. package/dist/message.js +0 -2
  265. package/dist/min-dark-npsJH98j.js +0 -4
  266. package/dist/min-light-DUk1XsVt.js +0 -4
  267. package/dist/monokai-CfFRWUNl.js +0 -4
  268. package/dist/multi-file-diff.d.ts +0 -2
  269. package/dist/multi-file-diff.js +0 -2
  270. package/dist/night-owl-BS7V-av_.js +0 -4
  271. package/dist/night-owl-light-CZtRawYE.js +0 -4
  272. package/dist/nord-BFh54Nqz.js +0 -4
  273. package/dist/one-dark-pro-zDovGosB.js +0 -4
  274. package/dist/one-light-gmHK3iK6.js +0 -4
  275. package/dist/patch-diff.d.ts +0 -2
  276. package/dist/patch-diff.js +0 -2
  277. package/dist/plastic-DtdaCjub.js +0 -4
  278. package/dist/poimandres-Hdda6aHK.js +0 -4
  279. package/dist/primitive-rail.d.ts +0 -222
  280. package/dist/primitive-rail.js +0 -348
  281. package/dist/prompt-input.d.ts +0 -2
  282. package/dist/prompt-input.js +0 -2
  283. package/dist/red-VqZFRByZ.js +0 -4
  284. package/dist/rose-pine-DiTkEueR.js +0 -4
  285. package/dist/rose-pine-dawn-tfo5y2X0.js +0 -4
  286. package/dist/rose-pine-moon-C0gON9XN.js +0 -4
  287. package/dist/runtime-type-DlCscMfw.js +0 -59
  288. package/dist/slack-dark-v8P_eXr6.js +0 -4
  289. package/dist/slack-ochin-D8SyEdKz.js +0 -4
  290. package/dist/snazzy-light-BtkQkvXb.js +0 -4
  291. package/dist/solarized-dark-B8nAdMfM.js +0 -4
  292. package/dist/solarized-light-B-3F1INj.js +0 -4
  293. package/dist/sync-status.d.ts +0 -2
  294. package/dist/sync-status.js +0 -2
  295. package/dist/synthwave-84-DcsXCF_c.js +0 -4
  296. package/dist/tokyo-night-Bvpqduda.js +0 -4
  297. package/dist/tool-list.d.ts +0 -2
  298. package/dist/tool-list.js +0 -2
  299. package/dist/trace-run.d.ts +0 -2
  300. package/dist/trace-run.js +0 -2
  301. package/dist/trace.d.ts +0 -2
  302. package/dist/trace.js +0 -2
  303. package/dist/unresolved-file.d.ts +0 -2
  304. package/dist/unresolved-file.js +0 -2
  305. package/dist/vesper-CfxmMOy3.js +0 -4
  306. package/dist/vitesse-black-D9-_1mjV.js +0 -4
  307. package/dist/vitesse-dark-DlSMLlr9.js +0 -4
  308. package/dist/vitesse-light-KRWWWztf.js +0 -4
@@ -0,0 +1,39 @@
1
+ import { PropType } from "vue";
2
+ //#region src/workspace/workspace-terminal.d.ts
3
+ /** Output chunks, optionally carrying the number of characters evicted from the start of a stream. */
4
+ export type WorkspaceTerminalOutput = readonly string[] & {
5
+ readonly offset?: number;
6
+ };
7
+ /** An xterm.js terminal that shows output chunks, such as `workspace.logs`. xterm loads when the terminal mounts. */
8
+ export declare const WorkspaceTerminal: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
9
+ /** Output chunks in order. An `offset` preserves incremental writes when old chunks are evicted. Ordinary arrays clear the terminal when replaced. */
10
+ output: {
11
+ default: () => never[];
12
+ type: PropType<WorkspaceTerminalOutput>;
13
+ };
14
+ label: {
15
+ default: string;
16
+ type: StringConstructor;
17
+ };
18
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
19
+ [key: string]: any;
20
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ /** Keys that the reader types, for the stdin of a process. */
22
+ input: (data: string) => boolean;
23
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
24
+ /** Output chunks in order. An `offset` preserves incremental writes when old chunks are evicted. Ordinary arrays clear the terminal when replaced. */
25
+ output: {
26
+ default: () => never[];
27
+ type: PropType<WorkspaceTerminalOutput>;
28
+ };
29
+ label: {
30
+ default: string;
31
+ type: StringConstructor;
32
+ };
33
+ }>> & Readonly<{
34
+ onInput?: ((data: string) => any) | undefined;
35
+ }>, {
36
+ label: string;
37
+ output: WorkspaceTerminalOutput;
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
+ //#endregion
@@ -0,0 +1,130 @@
1
+ import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from "vue";
2
+ //#region src/workspace/workspace-terminal.ts
3
+ let colorProbe;
4
+ /**
5
+ * A CSS color as `#rrggbbaa`. xterm parses only hex and `rgb()` itself, and it refuses translucent colors in other
6
+ * formats, but the tokens are `oklch()` and `color-mix()`. A canvas reads any CSS color as RGBA bytes. Without a canvas,
7
+ * as on the server or in a test DOM, the color stays as it is.
8
+ */
9
+ function toHex(color) {
10
+ colorProbe ??= document.createElement("canvas").getContext("2d", { willReadFrequently: true });
11
+ if (!colorProbe) return color;
12
+ colorProbe.clearRect(0, 0, 1, 1);
13
+ colorProbe.fillStyle = "transparent";
14
+ colorProbe.fillStyle = color;
15
+ colorProbe.fillRect(0, 0, 1, 1);
16
+ const bytes = colorProbe.getImageData(0, 0, 1, 1).data;
17
+ if (bytes[3] === 0) return color;
18
+ return `#${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
19
+ }
20
+ function cssColor(element, name) {
21
+ const value = getComputedStyle(element).getPropertyValue(name).trim();
22
+ return value ? toHex(value) : void 0;
23
+ }
24
+ /** The colors of the terminal, from the `--vh-ws-*` tokens of styles.css, which follow the theme and the color mode. */
25
+ function terminalTheme(element) {
26
+ return {
27
+ background: cssColor(element, "--vh-ws-terminal-bg"),
28
+ cursor: cssColor(element, "--vh-ws-terminal-fg"),
29
+ foreground: cssColor(element, "--vh-ws-terminal-fg"),
30
+ selectionBackground: cssColor(element, "--vh-ws-code-selection")
31
+ };
32
+ }
33
+ /** An xterm.js terminal that shows output chunks, such as `workspace.logs`. xterm loads when the terminal mounts. */
34
+ const WorkspaceTerminal = defineComponent({
35
+ name: "WorkspaceTerminal",
36
+ props: {
37
+ /** Output chunks in order. An `offset` preserves incremental writes when old chunks are evicted. Ordinary arrays clear the terminal when replaced. */
38
+ output: {
39
+ default: () => [],
40
+ type: Array
41
+ },
42
+ label: {
43
+ default: "Terminal output",
44
+ type: String
45
+ }
46
+ },
47
+ emits: {
48
+ /** Keys that the reader types, for the stdin of a process. */
49
+ input: (data) => typeof data === "string" },
50
+ setup(props, { emit, expose }) {
51
+ const host = ref(null);
52
+ let terminal;
53
+ let written = [];
54
+ let cursor;
55
+ let observer;
56
+ let themeObserver;
57
+ let disposed = false;
58
+ function write(output) {
59
+ if (!terminal) return;
60
+ if (output.offset !== void 0) {
61
+ const end = output.offset + output.reduce((length, chunk) => length + chunk.length, 0);
62
+ if (cursor !== void 0 && (cursor > end || output.offset < (written.offset ?? 0)) || cursor === void 0 && written.length > 0) {
63
+ terminal.reset();
64
+ cursor = void 0;
65
+ }
66
+ let skip = Math.max(0, (cursor ?? output.offset) - output.offset);
67
+ for (const chunk of output) {
68
+ if (skip < chunk.length) terminal.write(chunk.slice(skip));
69
+ skip = Math.max(0, skip - chunk.length);
70
+ }
71
+ cursor = end;
72
+ } else {
73
+ if (!(cursor === void 0 && output.length >= written.length && written.every((chunk, index) => output[index] === chunk))) {
74
+ terminal.reset();
75
+ written = [];
76
+ }
77
+ for (const chunk of output.slice(written.length)) terminal.write(chunk);
78
+ cursor = void 0;
79
+ }
80
+ written = output;
81
+ }
82
+ onMounted(async () => {
83
+ const [{ Terminal }, { FitAddon }] = await Promise.all([import("@xterm/xterm"), import("@xterm/addon-fit")]);
84
+ const element = host.value;
85
+ if (disposed || !element) return;
86
+ const fit = new FitAddon();
87
+ terminal = new Terminal({
88
+ convertEol: true,
89
+ cursorBlink: false,
90
+ disableStdin: false,
91
+ fontFamily: getComputedStyle(element).getPropertyValue("--vh-ws-font-mono").trim() || "ui-monospace, monospace",
92
+ fontSize: 12,
93
+ lineHeight: 1.4,
94
+ scrollback: 5e3,
95
+ theme: terminalTheme(element)
96
+ });
97
+ terminal.loadAddon(fit);
98
+ terminal.open(element);
99
+ terminal.textarea?.setAttribute("aria-label", props.label);
100
+ terminal.onData((data) => emit("input", data));
101
+ observer = new ResizeObserver(() => {
102
+ if (element.clientWidth > 0 && element.clientHeight > 0) fit.fit();
103
+ });
104
+ observer.observe(element);
105
+ themeObserver = new MutationObserver(() => {
106
+ if (terminal) terminal.options.theme = terminalTheme(element);
107
+ });
108
+ themeObserver.observe(document.documentElement, { attributeFilter: ["class", "data-theme"] });
109
+ write(props.output);
110
+ });
111
+ watch(() => props.output, write);
112
+ onBeforeUnmount(() => {
113
+ disposed = true;
114
+ observer?.disconnect();
115
+ themeObserver?.disconnect();
116
+ terminal?.dispose();
117
+ });
118
+ expose({ clear: () => {
119
+ terminal?.reset();
120
+ written = [];
121
+ cursor = void 0;
122
+ } });
123
+ return () => h("div", {
124
+ class: "vh-ws-terminal",
125
+ ref: host
126
+ });
127
+ }
128
+ });
129
+ //#endregion
130
+ export { WorkspaceTerminal };
@@ -0,0 +1,32 @@
1
+ //#region src/internal/payload-text.ts
2
+ function payloadText(value) {
3
+ if (typeof value === "string") return value;
4
+ const ancestors = [];
5
+ try {
6
+ return JSON.stringify(value, function(_key, item) {
7
+ if (typeof item === "bigint") return `${item}n`;
8
+ if (typeof item !== "object" || item === null) return item;
9
+ while (ancestors.length && ancestors.at(-1) !== this) ancestors.pop();
10
+ if (ancestors.includes(item)) return "[Circular]";
11
+ ancestors.push(item);
12
+ return item;
13
+ }, 2) ?? String(value);
14
+ } catch (error) {
15
+ let message;
16
+ try {
17
+ const raw = error?.message;
18
+ if (typeof raw === "string") message = raw;
19
+ else if (raw !== void 0) try {
20
+ message = String(raw);
21
+ } catch {}
22
+ } catch {}
23
+ if (message === void 0) return "[Unable to display payload]";
24
+ try {
25
+ return `[Unable to display payload: ${message}]`;
26
+ } catch {
27
+ return "[Unable to display payload]";
28
+ }
29
+ }
30
+ }
31
+ //#endregion
32
+ export { payloadText as t };
@@ -1,20 +1,9 @@
1
- import { s as pierrePropTypes } from "./code-view-J4OsgEdh.js";
1
+ import { n as __exportAll } from "./rolldown-runtime-C9mWXvCC.js";
2
+ import { s as pierrePropTypes } from "./code-view-D0bqhogi.js";
2
3
  import { A as SPLIT_WITH_NEWLINES, C as DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, D as HEADER_FILENAME_SUFFIX_SLOT_ID, E as EMPTY_RENDER_RANGE, M as UNSAFE_CSS_ATTRIBUTE, O as HEADER_METADATA_SLOT_ID, S as DIFFS_DEVELOPMENT_BUILD, T as DIFFS_TAG_NAME, _ as DEFAULT_RENDER_RANGE, b as DEFAULT_TOKENIZE_MAX_LENGTH, c as composeCacheKey, d as CODE_VIEW_FOOTER_ATTRIBUTE, f as CODE_VIEW_HEADER_ATTRIBUTE, g as DEFAULT_EXPANDED_REGION, h as DEFAULT_CODE_VIEW_LAYOUT, i as diffChars, j as THEME_CSS_ATTRIBUTE, k as HEADER_PREFIX_SLOT_ID, l as getHunkSideEndBoundary, m as DEFAULT_CODE_VIEW_FILE_METRICS, n as parseDiffFromFile, o as slideBlankBoundaryBlocksUp, p as CUSTOM_HEADER_SLOT_ID, r as diffWordsWithSpace, s as cleanLastNewline, t as getSingularPatch, u as getHunkSideStartBoundary, v as DEFAULT_SMOOTH_SCROLL_SETTINGS, w as DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, x as DEFAULT_VIRTUAL_FILE_METRICS, y as DEFAULT_THEMES } from "./getSingularPatch-Dsb8EgxR.js";
3
4
  import { computed, defineComponent, h, onBeforeUnmount, toRaw, watchEffect } from "vue";
4
5
  import { bundledLanguages, createHighlighter, createJavaScriptRegexEngine, createOnigurumaEngine } from "shiki";
5
6
  import { normalizeTheme } from "shiki/core";
6
- //#region \0rolldown/runtime.js
7
- var __defProp = Object.defineProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- return target;
16
- };
17
- //#endregion
18
7
  //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.2.8_react@19.2.6__react@19.2.6/node_modules/@pierre/diffs/dist/highlighter/languages/constants.js
19
8
  const ResolvedLanguages = /* @__PURE__ */ new Map();
20
9
  const ResolvingLanguages = /* @__PURE__ */ new Map();
@@ -386,12 +375,12 @@ const PIERRE_THEME_DISPLAY_NAMES = {
386
375
  "pierre-light-tritanopia": "Pierre Light Tritanopia"
387
376
  };
388
377
  const PIERRE_THEME_IMPORTS = {
389
- "pierre-dark": () => import("./pierre-dark-DDWDl8g6.js"),
378
+ "pierre-dark": () => import("./pierre-dark-CzUmjETS.js").then((n) => n.n),
390
379
  "pierre-dark-soft": () => import("./pierre-dark-soft-Bb-4-biO.js"),
391
380
  "pierre-dark-vibrant": () => import("./pierre-dark-vibrant-8oZzB3gw.js"),
392
381
  "pierre-dark-protanopia-deuteranopia": () => import("./pierre-dark-protanopia-deuteranopia-C35UMuvO.js"),
393
382
  "pierre-dark-tritanopia": () => import("./pierre-dark-tritanopia-CIJISGWF.js"),
394
- "pierre-light": () => import("./pierre-light-CWhW4NrH.js"),
383
+ "pierre-light": () => import("./pierre-light-Dn6E0sWv.js").then((n) => n.n),
395
384
  "pierre-light-soft": () => import("./pierre-light-soft-BCU6fuhO.js"),
396
385
  "pierre-light-vibrant": () => import("./pierre-light-vibrant-Cwh332o_.js"),
397
386
  "pierre-light-protanopia-deuteranopia": () => import("./pierre-light-protanopia-deuteranopia-u0U7N4Hn.js"),
@@ -485,71 +474,71 @@ function shikiColorScheme(name) {
485
474
  return "dark";
486
475
  }
487
476
  const SHIKI_THEME_IMPORTS = {
488
- andromeeda: () => import("./andromeeda-BASpqCeJ.js"),
489
- "aurora-x": () => import("./aurora-x-DugsLcii.js"),
490
- "ayu-dark": () => import("./ayu-dark-BT3qdi3o.js"),
491
- "ayu-light": () => import("./ayu-light-BVZyHoh9.js"),
492
- "ayu-mirage": () => import("./ayu-mirage-XFwUVZQZ.js"),
493
- "catppuccin-frappe": () => import("./catppuccin-frappe-D20KODDN.js"),
494
- "catppuccin-latte": () => import("./catppuccin-latte-eGLVHIUJ.js"),
495
- "catppuccin-macchiato": () => import("./catppuccin-macchiato-bQGch4PY.js"),
496
- "catppuccin-mocha": () => import("./catppuccin-mocha-Bes8-0Mr.js"),
497
- "dark-plus": () => import("./dark-plus-BGuiqa1B.js"),
498
- dracula: () => import("./dracula-0CVA2XY5.js"),
499
- "dracula-soft": () => import("./dracula-soft-Dk9bpbVU.js"),
500
- "everforest-dark": () => import("./everforest-dark-CRjTbhh5.js"),
501
- "everforest-light": () => import("./everforest-light-CEeYFLn8.js"),
502
- "github-dark": () => import("./github-dark-BXgKmOw_.js"),
503
- "github-dark-default": () => import("./github-dark-default-DzJQXksd.js"),
504
- "github-dark-dimmed": () => import("./github-dark-dimmed-B1pEmGtS.js"),
505
- "github-dark-high-contrast": () => import("./github-dark-high-contrast-BkHIa6jc.js"),
506
- "github-light": () => import("./github-light-BKRlUbaB.js"),
507
- "github-light-default": () => import("./github-light-default-BU3eYkzs.js"),
508
- "github-light-high-contrast": () => import("./github-light-high-contrast-B3MumDcI.js"),
509
- "gruvbox-dark-hard": () => import("./gruvbox-dark-hard-B0ecF443.js"),
510
- "gruvbox-dark-medium": () => import("./gruvbox-dark-medium-BQnpC39k.js"),
511
- "gruvbox-dark-soft": () => import("./gruvbox-dark-soft-DFZUgESr.js"),
512
- "gruvbox-light-hard": () => import("./gruvbox-light-hard-CuB_LOJr.js"),
513
- "gruvbox-light-medium": () => import("./gruvbox-light-medium-idDHgxjs.js"),
514
- "gruvbox-light-soft": () => import("./gruvbox-light-soft-CfWH49MY.js"),
515
- horizon: () => import("./horizon-h92C5OlZ.js"),
516
- "horizon-bright": () => import("./horizon-bright-Ba6M8QSV.js"),
517
- houston: () => import("./houston-EQnPegWq.js"),
518
- "kanagawa-dragon": () => import("./kanagawa-dragon-DgDvwi3B.js"),
519
- "kanagawa-lotus": () => import("./kanagawa-lotus-BgoQro20.js"),
520
- "kanagawa-wave": () => import("./kanagawa-wave-DgXEowHs.js"),
521
- laserwave: () => import("./laserwave-IxBH_3yW.js"),
522
- "light-plus": () => import("./light-plus-S8JBx6is.js"),
523
- "material-theme": () => import("./material-theme-D1f3HBq-.js"),
524
- "material-theme-darker": () => import("./material-theme-darker-ExzYhT0j.js"),
525
- "material-theme-lighter": () => import("./material-theme-lighter-D6gH9nnA.js"),
526
- "material-theme-ocean": () => import("./material-theme-ocean-D1w5BPAa.js"),
527
- "material-theme-palenight": () => import("./material-theme-palenight-CkqWmVpF.js"),
528
- "min-dark": () => import("./min-dark-npsJH98j.js"),
529
- "min-light": () => import("./min-light-DUk1XsVt.js"),
530
- monokai: () => import("./monokai-CfFRWUNl.js"),
531
- "night-owl": () => import("./night-owl-BS7V-av_.js"),
532
- "night-owl-light": () => import("./night-owl-light-CZtRawYE.js"),
533
- nord: () => import("./nord-BFh54Nqz.js"),
534
- "one-dark-pro": () => import("./one-dark-pro-zDovGosB.js"),
535
- "one-light": () => import("./one-light-gmHK3iK6.js"),
536
- plastic: () => import("./plastic-DtdaCjub.js"),
537
- poimandres: () => import("./poimandres-Hdda6aHK.js"),
538
- red: () => import("./red-VqZFRByZ.js"),
539
- "rose-pine": () => import("./rose-pine-DiTkEueR.js"),
540
- "rose-pine-dawn": () => import("./rose-pine-dawn-tfo5y2X0.js"),
541
- "rose-pine-moon": () => import("./rose-pine-moon-C0gON9XN.js"),
542
- "slack-dark": () => import("./slack-dark-v8P_eXr6.js"),
543
- "slack-ochin": () => import("./slack-ochin-D8SyEdKz.js"),
544
- "snazzy-light": () => import("./snazzy-light-BtkQkvXb.js"),
545
- "solarized-dark": () => import("./solarized-dark-B8nAdMfM.js"),
546
- "solarized-light": () => import("./solarized-light-B-3F1INj.js"),
547
- "synthwave-84": () => import("./synthwave-84-DcsXCF_c.js"),
548
- "tokyo-night": () => import("./tokyo-night-Bvpqduda.js"),
549
- vesper: () => import("./vesper-CfxmMOy3.js"),
550
- "vitesse-black": () => import("./vitesse-black-D9-_1mjV.js"),
551
- "vitesse-dark": () => import("./vitesse-dark-DlSMLlr9.js"),
552
- "vitesse-light": () => import("./vitesse-light-KRWWWztf.js")
477
+ andromeeda: () => import("@shikijs/themes/andromeeda"),
478
+ "aurora-x": () => import("@shikijs/themes/aurora-x"),
479
+ "ayu-dark": () => import("@shikijs/themes/ayu-dark"),
480
+ "ayu-light": () => import("@shikijs/themes/ayu-light"),
481
+ "ayu-mirage": () => import("@shikijs/themes/ayu-mirage"),
482
+ "catppuccin-frappe": () => import("@shikijs/themes/catppuccin-frappe"),
483
+ "catppuccin-latte": () => import("@shikijs/themes/catppuccin-latte"),
484
+ "catppuccin-macchiato": () => import("@shikijs/themes/catppuccin-macchiato"),
485
+ "catppuccin-mocha": () => import("@shikijs/themes/catppuccin-mocha"),
486
+ "dark-plus": () => import("@shikijs/themes/dark-plus"),
487
+ dracula: () => import("@shikijs/themes/dracula"),
488
+ "dracula-soft": () => import("@shikijs/themes/dracula-soft"),
489
+ "everforest-dark": () => import("@shikijs/themes/everforest-dark"),
490
+ "everforest-light": () => import("@shikijs/themes/everforest-light"),
491
+ "github-dark": () => import("@shikijs/themes/github-dark"),
492
+ "github-dark-default": () => import("@shikijs/themes/github-dark-default"),
493
+ "github-dark-dimmed": () => import("@shikijs/themes/github-dark-dimmed"),
494
+ "github-dark-high-contrast": () => import("@shikijs/themes/github-dark-high-contrast"),
495
+ "github-light": () => import("@shikijs/themes/github-light"),
496
+ "github-light-default": () => import("@shikijs/themes/github-light-default"),
497
+ "github-light-high-contrast": () => import("@shikijs/themes/github-light-high-contrast"),
498
+ "gruvbox-dark-hard": () => import("@shikijs/themes/gruvbox-dark-hard"),
499
+ "gruvbox-dark-medium": () => import("@shikijs/themes/gruvbox-dark-medium"),
500
+ "gruvbox-dark-soft": () => import("@shikijs/themes/gruvbox-dark-soft"),
501
+ "gruvbox-light-hard": () => import("@shikijs/themes/gruvbox-light-hard"),
502
+ "gruvbox-light-medium": () => import("@shikijs/themes/gruvbox-light-medium"),
503
+ "gruvbox-light-soft": () => import("@shikijs/themes/gruvbox-light-soft"),
504
+ horizon: () => import("@shikijs/themes/horizon"),
505
+ "horizon-bright": () => import("@shikijs/themes/horizon-bright"),
506
+ houston: () => import("@shikijs/themes/houston"),
507
+ "kanagawa-dragon": () => import("@shikijs/themes/kanagawa-dragon"),
508
+ "kanagawa-lotus": () => import("@shikijs/themes/kanagawa-lotus"),
509
+ "kanagawa-wave": () => import("@shikijs/themes/kanagawa-wave"),
510
+ laserwave: () => import("@shikijs/themes/laserwave"),
511
+ "light-plus": () => import("@shikijs/themes/light-plus"),
512
+ "material-theme": () => import("@shikijs/themes/material-theme"),
513
+ "material-theme-darker": () => import("@shikijs/themes/material-theme-darker"),
514
+ "material-theme-lighter": () => import("@shikijs/themes/material-theme-lighter"),
515
+ "material-theme-ocean": () => import("@shikijs/themes/material-theme-ocean"),
516
+ "material-theme-palenight": () => import("@shikijs/themes/material-theme-palenight"),
517
+ "min-dark": () => import("@shikijs/themes/min-dark"),
518
+ "min-light": () => import("@shikijs/themes/min-light"),
519
+ monokai: () => import("@shikijs/themes/monokai"),
520
+ "night-owl": () => import("@shikijs/themes/night-owl"),
521
+ "night-owl-light": () => import("@shikijs/themes/night-owl-light"),
522
+ nord: () => import("@shikijs/themes/nord"),
523
+ "one-dark-pro": () => import("@shikijs/themes/one-dark-pro"),
524
+ "one-light": () => import("@shikijs/themes/one-light"),
525
+ plastic: () => import("@shikijs/themes/plastic"),
526
+ poimandres: () => import("@shikijs/themes/poimandres"),
527
+ red: () => import("@shikijs/themes/red"),
528
+ "rose-pine": () => import("@shikijs/themes/rose-pine"),
529
+ "rose-pine-dawn": () => import("@shikijs/themes/rose-pine-dawn"),
530
+ "rose-pine-moon": () => import("@shikijs/themes/rose-pine-moon"),
531
+ "slack-dark": () => import("@shikijs/themes/slack-dark"),
532
+ "slack-ochin": () => import("@shikijs/themes/slack-ochin"),
533
+ "snazzy-light": () => import("@shikijs/themes/snazzy-light"),
534
+ "solarized-dark": () => import("@shikijs/themes/solarized-dark"),
535
+ "solarized-light": () => import("@shikijs/themes/solarized-light"),
536
+ "synthwave-84": () => import("@shikijs/themes/synthwave-84"),
537
+ "tokyo-night": () => import("@shikijs/themes/tokyo-night"),
538
+ vesper: () => import("@shikijs/themes/vesper"),
539
+ "vitesse-black": () => import("@shikijs/themes/vitesse-black"),
540
+ "vitesse-dark": () => import("@shikijs/themes/vitesse-dark"),
541
+ "vitesse-light": () => import("@shikijs/themes/vitesse-light")
553
542
  };
554
543
  function createShikiTheme(name) {
555
544
  return createTheme({
@@ -19589,6 +19578,103 @@ const selectedLinesProp = {
19589
19578
  default: void 0,
19590
19579
  type: pierrePropTypes.selectedLines
19591
19580
  };
19581
+ const scrollToSelectedLinesProp = {
19582
+ default: false,
19583
+ type: Boolean
19584
+ };
19585
+ var SelectionFileModel = class extends File {
19586
+ isSourceRendered() {
19587
+ const file = this.getLatestFile();
19588
+ const rendered = this.getRenderedFile();
19589
+ if (!file || !rendered) return false;
19590
+ if (file.cacheKey != null || rendered.cacheKey != null) return file.cacheKey === rendered.cacheKey;
19591
+ return file.name === rendered.name && file.contents === rendered.contents && file.lang === rendered.lang;
19592
+ }
19593
+ };
19594
+ var SelectionDiffModel = class extends FileDiff {
19595
+ isSourceRendered() {
19596
+ return sameDiffSource(this.getLatestDiff(), this.getRenderedDiff());
19597
+ }
19598
+ };
19599
+ var SelectionUnresolvedFileModel = class extends UnresolvedFile {
19600
+ isSourceRendered() {
19601
+ return sameDiffSource(this.getLatestDiff(), this.getRenderedDiff());
19602
+ }
19603
+ };
19604
+ function sameDiffSource(diff, rendered) {
19605
+ return diff === rendered || diff?.cacheKey != null && diff.cacheKey === rendered?.cacheKey;
19606
+ }
19607
+ /**
19608
+ * Centers `row` in the nearest ancestor of the view that scrolls, else in the page. `scrollIntoView` alone also moves
19609
+ * each `overflow: hidden` ancestor, such as an app shell.
19610
+ */
19611
+ function scrollToRow(host, row) {
19612
+ let scroller = host;
19613
+ while (scroller && !(/auto|scroll|overlay/.test(getComputedStyle(scroller).overflowY) && scroller.scrollHeight > scroller.clientHeight)) scroller = scroller.parentElement;
19614
+ if (!scroller || scroller === document.body || scroller === document.documentElement) {
19615
+ row.scrollIntoView({
19616
+ block: "center",
19617
+ inline: "nearest"
19618
+ });
19619
+ return;
19620
+ }
19621
+ const rect = row.getBoundingClientRect();
19622
+ scroller.scrollTop += rect.top - scroller.getBoundingClientRect().top - (scroller.clientHeight - rect.height) / 2;
19623
+ }
19624
+ /**
19625
+ * Scrolls the first selected line into view, once for each new range or `source`. Pierre marks the selected rows in a
19626
+ * later frame and renders the file after its highlighter loads, so this waits for the row of the new selection.
19627
+ */
19628
+ function createSelectionScroll(getHost, isSourceRendered) {
19629
+ let key;
19630
+ let observer;
19631
+ const stop = () => {
19632
+ observer?.disconnect();
19633
+ observer = void 0;
19634
+ };
19635
+ const sync = (range, source) => {
19636
+ const next = range ? [...source, ...rangeKey(range)] : void 0;
19637
+ const previous = key;
19638
+ const host = getHost();
19639
+ const root = host?.shadowRoot;
19640
+ key = root ? next : void 0;
19641
+ if (next && previous?.length === next.length && next.every((value, index) => Object.is(value, previous[index]))) return;
19642
+ stop();
19643
+ if (!range || !host || !root) return;
19644
+ const scroll = () => {
19645
+ if (!isSourceRendered()) return;
19646
+ const rows = root.querySelectorAll("[data-line][data-selected-line=\"first\"], [data-line][data-selected-line=\"single\"]");
19647
+ const row = Array.from(rows).find((row) => {
19648
+ const line = Number(row.dataset.line);
19649
+ const side = row.closest("[data-deletions]") || row.dataset.lineType === "change-deletion" ? "deletions" : row.closest("[data-additions]") || row.dataset.lineType === "change-addition" ? "additions" : void 0;
19650
+ return line === range.start && (!side || side === (range.side ?? "additions")) || line === range.end && (!side || side === (range.endSide ?? range.side ?? "additions"));
19651
+ });
19652
+ if (!row) return;
19653
+ stop();
19654
+ scrollToRow(host, row);
19655
+ };
19656
+ observer = new MutationObserver(scroll);
19657
+ observer.observe(root, {
19658
+ attributeFilter: ["data-selected-line"],
19659
+ attributes: true,
19660
+ childList: true,
19661
+ subtree: true
19662
+ });
19663
+ scroll();
19664
+ };
19665
+ return {
19666
+ stop,
19667
+ sync
19668
+ };
19669
+ }
19670
+ function rangeKey(range) {
19671
+ return [
19672
+ range.start,
19673
+ range.end,
19674
+ range.side,
19675
+ range.endSide
19676
+ ];
19677
+ }
19592
19678
  function controlledOptions(options, selectedLines) {
19593
19679
  const rawOptions = trackShallow(options);
19594
19680
  return selectedLines === void 0 ? rawOptions : {
@@ -19641,11 +19727,13 @@ const PierreDiff = defineComponent({
19641
19727
  oldFile: { type: pierrePropTypes.nullableFileContents },
19642
19728
  options: { type: pierrePropTypes.fileDiffOptions },
19643
19729
  patch: { type: String },
19730
+ scrollToSelectedLines: scrollToSelectedLinesProp,
19644
19731
  selectedLines: selectedLinesProp
19645
19732
  },
19646
19733
  setup(props, { attrs, expose }) {
19647
19734
  let host = null;
19648
19735
  let instance;
19736
+ const selectionScroll = createSelectionScroll(() => host, () => instance?.isSourceRendered() ?? false);
19649
19737
  const fileDiff = computed(() => {
19650
19738
  if (props.fileDiff) return trackShallow(props.fileDiff);
19651
19739
  if (props.patch !== void 0) return getSingularPatch(props.patch);
@@ -19659,7 +19747,7 @@ const PierreDiff = defineComponent({
19659
19747
  return;
19660
19748
  }
19661
19749
  const options = accessibleDiffOptions(props.options, props.selectedLines, fileDiff.value);
19662
- if (!instance) instance = new FileDiff(options, void 0, true);
19750
+ if (!instance) instance = new SelectionDiffModel(options, void 0, true);
19663
19751
  instance.setOptions(options);
19664
19752
  instance.render({
19665
19753
  fileContainer: host,
@@ -19668,12 +19756,23 @@ const PierreDiff = defineComponent({
19668
19756
  lineAnnotations: trackArrayItems(props.lineAnnotations) ?? []
19669
19757
  });
19670
19758
  if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines));
19759
+ selectionScroll.sync(props.scrollToSelectedLines ? props.selectedLines : void 0, [
19760
+ toRaw(props.fileDiff),
19761
+ props.patch,
19762
+ props.oldFile?.name,
19763
+ props.oldFile?.contents,
19764
+ props.newFile?.name,
19765
+ props.newFile?.contents
19766
+ ]);
19671
19767
  };
19672
19768
  const setHost = (node) => {
19673
19769
  host = node instanceof HTMLElement ? node : null;
19674
19770
  };
19675
19771
  watchEffect(render, { flush: "post" });
19676
- onBeforeUnmount(() => instance?.cleanUp());
19772
+ onBeforeUnmount(() => {
19773
+ selectionScroll.stop();
19774
+ instance?.cleanUp();
19775
+ });
19677
19776
  expose({ getInstance: () => instance });
19678
19777
  return () => h(DIFFS_TAG_NAME, {
19679
19778
  ...attrs,
@@ -19688,11 +19787,13 @@ const PierreFile = defineComponent({
19688
19787
  file: { type: pierrePropTypes.fileContents },
19689
19788
  lineAnnotations: { type: pierrePropTypes.lineAnnotations },
19690
19789
  options: { type: pierrePropTypes.fileOptions },
19790
+ scrollToSelectedLines: scrollToSelectedLinesProp,
19691
19791
  selectedLines: selectedLinesProp
19692
19792
  },
19693
19793
  setup(props, { attrs, expose }) {
19694
19794
  let host = null;
19695
19795
  let instance;
19796
+ const selectionScroll = createSelectionScroll(() => host, () => instance?.isSourceRendered() ?? false);
19696
19797
  const file = computed(() => props.file ? copyFile(props.file) : void 0);
19697
19798
  const render = () => {
19698
19799
  if (!host) return;
@@ -19702,7 +19803,7 @@ const PierreFile = defineComponent({
19702
19803
  return;
19703
19804
  }
19704
19805
  const options = accessibleOptions(props.options, props.selectedLines);
19705
- if (!instance) instance = new File(options, void 0, true);
19806
+ if (!instance) instance = new SelectionFileModel(options, void 0, true);
19706
19807
  instance.setOptions(options);
19707
19808
  instance.render({
19708
19809
  file: file.value,
@@ -19711,12 +19812,16 @@ const PierreFile = defineComponent({
19711
19812
  lineAnnotations: trackArrayItems(props.lineAnnotations) ?? []
19712
19813
  });
19713
19814
  if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines));
19815
+ selectionScroll.sync(props.scrollToSelectedLines ? props.selectedLines : void 0, [file.value.name, file.value.contents]);
19714
19816
  };
19715
19817
  const setHost = (node) => {
19716
19818
  host = node instanceof HTMLElement ? node : null;
19717
19819
  };
19718
19820
  watchEffect(render, { flush: "post" });
19719
- onBeforeUnmount(() => instance?.cleanUp());
19821
+ onBeforeUnmount(() => {
19822
+ selectionScroll.stop();
19823
+ instance?.cleanUp();
19824
+ });
19720
19825
  expose({ getInstance: () => instance });
19721
19826
  return () => h(DIFFS_TAG_NAME, {
19722
19827
  ...attrs,
@@ -19731,11 +19836,13 @@ const PierreUnresolvedFile = defineComponent({
19731
19836
  file: { type: pierrePropTypes.fileContents },
19732
19837
  lineAnnotations: { type: pierrePropTypes.diffLineAnnotations },
19733
19838
  options: { type: pierrePropTypes.unresolvedFileOptions },
19839
+ scrollToSelectedLines: scrollToSelectedLinesProp,
19734
19840
  selectedLines: selectedLinesProp
19735
19841
  },
19736
19842
  setup(props, { attrs, expose }) {
19737
19843
  let host = null;
19738
19844
  let instance;
19845
+ const selectionScroll = createSelectionScroll(() => host, () => instance?.isSourceRendered() ?? false);
19739
19846
  let renderedFile;
19740
19847
  const file = computed(() => props.file ? copyFile(props.file) : void 0);
19741
19848
  const render = () => {
@@ -19751,7 +19858,7 @@ const PierreUnresolvedFile = defineComponent({
19751
19858
  instance = void 0;
19752
19859
  }
19753
19860
  const options = accessibleOptions(props.options, props.selectedLines);
19754
- if (!instance) instance = new UnresolvedFile(options, void 0, true);
19861
+ if (!instance) instance = new SelectionUnresolvedFileModel(options, void 0, true);
19755
19862
  instance.setOptions(options);
19756
19863
  instance.render({
19757
19864
  file: file.value,
@@ -19761,12 +19868,16 @@ const PierreUnresolvedFile = defineComponent({
19761
19868
  });
19762
19869
  renderedFile = file.value;
19763
19870
  if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines));
19871
+ selectionScroll.sync(props.scrollToSelectedLines ? props.selectedLines : void 0, [file.value.name, file.value.contents]);
19764
19872
  };
19765
19873
  const setHost = (node) => {
19766
19874
  host = node instanceof HTMLElement ? node : null;
19767
19875
  };
19768
19876
  watchEffect(render, { flush: "post" });
19769
- onBeforeUnmount(() => instance?.cleanUp());
19877
+ onBeforeUnmount(() => {
19878
+ selectionScroll.stop();
19879
+ instance?.cleanUp();
19880
+ });
19770
19881
  expose({ getInstance: () => instance });
19771
19882
  return () => h(DIFFS_TAG_NAME, {
19772
19883
  ...attrs,
@@ -19783,6 +19894,7 @@ const PierreCodeView = defineComponent({
19783
19894
  type: pierrePropTypes.codeViewItems
19784
19895
  },
19785
19896
  options: { type: pierrePropTypes.codeViewOptions },
19897
+ scrollToSelectedLines: scrollToSelectedLinesProp,
19786
19898
  selectedLines: {
19787
19899
  default: void 0,
19788
19900
  type: pierrePropTypes.codeViewSelection
@@ -19791,6 +19903,7 @@ const PierreCodeView = defineComponent({
19791
19903
  setup(props, { attrs, expose }) {
19792
19904
  let host = null;
19793
19905
  let instance;
19906
+ let scrolledTo;
19794
19907
  const render = () => {
19795
19908
  if (!host) return;
19796
19909
  const options = accessibleOptions(props.options, props.selectedLines);
@@ -19802,6 +19915,16 @@ const PierreCodeView = defineComponent({
19802
19915
  instance.setItems(trackArrayItems(props.items));
19803
19916
  if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines), { notify: false });
19804
19917
  instance.render(true);
19918
+ const selection = props.scrollToSelectedLines ? props.selectedLines : void 0;
19919
+ const key = selection ? [selection.id, ...rangeKey(selection.range)] : void 0;
19920
+ const changed = key?.some((value, index) => value !== scrolledTo?.[index]);
19921
+ scrolledTo = key;
19922
+ if (selection && changed) instance.scrollTo({
19923
+ align: "center",
19924
+ id: selection.id,
19925
+ range: selection.range,
19926
+ type: "range"
19927
+ });
19805
19928
  };
19806
19929
  const setHost = (node) => {
19807
19930
  host = node instanceof HTMLElement ? node : null;