@vite-hub/ui 0.4.1 → 0.5.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 (360) hide show
  1. package/README.md +102 -76
  2. package/dist/andromeeda-DaUPZ4_A.js +147 -0
  3. package/dist/announce-B0DLwflT.js +31 -0
  4. package/dist/{attachments-BzTwqRTU.js → attachments-DgwoQZKY.js} +3 -5
  5. package/dist/aurora-x-B5RPZ9i5.js +162 -0
  6. package/dist/{avatar-stack-DPRFuezh.d.ts → avatar-stack-C0IKwj6g.d.ts} +1 -3
  7. package/dist/ayu-dark-DXTaGA7I.js +137 -0
  8. package/dist/ayu-light-BCYi80Fe.js +137 -0
  9. package/dist/ayu-mirage-CgbXz-N5.js +137 -0
  10. package/dist/catppuccin-frappe-MV2xzv44.js +266 -0
  11. package/dist/catppuccin-latte-CL6jjlVD.js +266 -0
  12. package/dist/catppuccin-macchiato-Bp6oZJVK.js +266 -0
  13. package/dist/catppuccin-mocha-DOHrQ4dw.js +266 -0
  14. package/dist/{choices-input-ByXJvDn1.d.ts → choices-input-BUf-QqGj.d.ts} +0 -2
  15. package/dist/{code-view-DsU-xzic.js → code-view-Cg4nyTNA.js} +6 -8
  16. package/dist/{colors-BghReA9C-CjF9gnmy.js → colors-BghReA9C-DEq4bhEP.js} +1 -2
  17. package/dist/{comment-attachments-C4yNbcx5.js → comment-attachments-CMpYOJod.js} +1 -2
  18. package/dist/{comment-composer-fINL5bxo.d.ts → comment-composer-BI6CNJyO.d.ts} +3 -5
  19. package/dist/{comment-composer-jYv2ULNP.js → comment-composer-CzU7DdfD.js} +260 -16
  20. package/dist/{comment-layer-C_sbPIR5.d.ts → comment-layer-DyVstrs-.d.ts} +5 -7
  21. package/dist/{comment-list-BcSaLngS.d.ts → comment-list-CSK5o-Ua.d.ts} +3 -5
  22. package/dist/comment-marks.css +18 -22
  23. package/dist/{comment-panel-CfvdRUMX.d.ts → comment-panel-CEvOI3gk.d.ts} +3 -5
  24. package/dist/{comment-person-CLPlW_SS.js → comment-person-D_IyIjXo.js} +1 -2
  25. package/dist/{comment-pin-DHOdRvUw.d.ts → comment-pin-C5UeLPTa.d.ts} +1 -3
  26. package/dist/{comment-row-Bn3nr8l5.js → comment-row-DPMWI5Z0.js} +3 -4
  27. package/dist/{comment-selection-bar-CyVBNYl9.d.ts → comment-selection-bar-CVuS-FNL.d.ts} +0 -2
  28. package/dist/comment-send-DPzV9B8S.js +275 -0
  29. package/dist/comment-send-MmxFsOQf.d.ts +23 -0
  30. package/dist/comment-send.css +267 -0
  31. package/dist/comment-thread-CbPtoi8-.js +796 -0
  32. package/dist/{comment-thread-DKJjmWN0.d.ts → comment-thread-DGm1cGJt.d.ts} +4 -8
  33. package/dist/{comment-visibility-DsVuVndP.d.ts → comment-visibility-CYctacNx.d.ts} +0 -2
  34. package/dist/{comments-D0d26ghV.js → comments-C0OdHh_F.js} +5 -8
  35. package/dist/{comments-D8hulVPy.d.ts → comments-DrE9DU-E.d.ts} +1 -3
  36. package/dist/{comments-context-C2lOZyQ5.js → comments-context-CrjhleVA.js} +4 -5
  37. package/dist/{config-Dk67emQt.js → config-DztmAYYn.js} +9 -3
  38. package/dist/{config-DgxBW013.d.ts → config-xL4EBeXw.d.ts} +11 -4
  39. package/dist/dark-plus-CXEBSjk4.js +148 -0
  40. package/dist/dracula-Bvyz6eCo.js +165 -0
  41. package/dist/dracula-soft-a9indxAQ.js +115 -0
  42. package/dist/{draw-DzSmD7uo-Dwz8zoH2.js → draw-DzSmD7uo-Cb7s9kxJ.js} +359 -708
  43. package/dist/drop-field-CNZgwFVO.js +162 -0
  44. package/dist/{editor-C_wt4RRV.js → editor-CGiEVOnB.js} +44 -6
  45. package/dist/effects-g4QucvgO.js +2955 -0
  46. package/dist/{error-diagnostics-SXtnk6bz.js → error-diagnostics-BlgA9rI2.js} +1 -2
  47. package/dist/everforest-dark-9sVAxG7I.js +99 -0
  48. package/dist/everforest-light-BocTn_Hd.js +99 -0
  49. package/dist/{file-tree-C4OYgbV-.js → file-tree-CRFIdtzw.js} +58 -116
  50. package/dist/{file-tree-DlT9RGhu.d.ts → file-tree-DOtkeBaq.d.ts} +0 -14
  51. package/dist/{format-orwcdZL_.js → format-Bc9m7-r0.js} +1 -2
  52. package/dist/{getSingularPatch-Dsb8EgxR.js → getSingularPatch-C7LmmBrW.js} +375 -79
  53. package/dist/github-dark-BO9SXswM.js +142 -0
  54. package/dist/github-dark-default-XB_RHfBI.js +90 -0
  55. package/dist/github-dark-dimmed-BoGxaWUQ.js +137 -0
  56. package/dist/github-dark-high-contrast-B3X6t2fG.js +137 -0
  57. package/dist/github-light-D7VHHlUH.js +142 -0
  58. package/dist/github-light-default-BuDsGtcR.js +137 -0
  59. package/dist/github-light-high-contrast-GodZiAwh.js +137 -0
  60. package/dist/gruvbox-dark-hard-CU4LuKJc.js +140 -0
  61. package/dist/gruvbox-dark-medium-DjAsuXuH.js +140 -0
  62. package/dist/gruvbox-dark-soft-D3Zttj6R.js +140 -0
  63. package/dist/gruvbox-light-hard-4M_9onwE.js +140 -0
  64. package/dist/gruvbox-light-medium-D9QwS4kQ.js +140 -0
  65. package/dist/gruvbox-light-soft-DhYcfQql.js +140 -0
  66. package/dist/{handlers-DMl-Na3x.js → handlers-CnbkvXjX.js} +1 -2
  67. package/dist/headless.d.ts +4 -4
  68. package/dist/headless.js +1 -1
  69. package/dist/highlights-C2AbEdDI.js +2630 -0
  70. package/dist/hold-to-delete-BSMrpE-i.d.ts +49 -0
  71. package/dist/hold-to-delete-Cludb56v.js +433 -0
  72. package/dist/horizon-bright-B9u59onx.js +97 -0
  73. package/dist/horizon-tItY9ATR.js +97 -0
  74. package/dist/houston-BqKrKNQv.js +207 -0
  75. package/dist/icon-XZaCUZTG.d.ts +29 -0
  76. package/dist/{image-preview-C9tdkmEj.js → image-preview-DrLXrHpp.js} +3 -4
  77. package/dist/{index-CNY1uNTh.d.ts → index-B2cbt3py.d.ts} +3945 -2445
  78. package/dist/{index-BYRFQfCd.d.ts → index-B_PSX-5h.d.ts} +5 -11
  79. package/dist/index.d.ts +35 -32
  80. package/dist/index.js +71 -73
  81. package/dist/install-Ba9mkkqI.js +16 -0
  82. package/dist/kanagawa-dragon-BH1K3aMw.js +159 -0
  83. package/dist/kanagawa-lotus-C-4JB2io.js +159 -0
  84. package/dist/kanagawa-wave-DTQqNe5k.js +159 -0
  85. package/dist/laserwave-BkV0uIaG.js +84 -0
  86. package/dist/light-plus-CxYgEz7U.js +149 -0
  87. package/dist/list-DUTAo0uC.js +270 -0
  88. package/dist/loader-CYMEjzwc.js +79 -0
  89. package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-3gY9MLvy.js} +237 -38
  90. package/dist/{markdown-editor-wQF0yD5o.d.ts → markdown-editor-B7gD60tp.d.ts} +0 -6
  91. package/dist/markdown-editor.d.ts +1 -5
  92. package/dist/markdown-editor.js +2 -2
  93. package/dist/markdown-renderer-DFS1vf1h.js +26578 -0
  94. package/dist/material-theme-Xdm37UUJ.js +105 -0
  95. package/dist/material-theme-darker-Blaz0cgN.js +105 -0
  96. package/dist/material-theme-lighter-BddVxBVA.js +105 -0
  97. package/dist/material-theme-ocean-C4qhfFHi.js +105 -0
  98. package/dist/material-theme-palenight-ChHDqoiA.js +105 -0
  99. package/dist/{message-scroller-jrYN9dG9.d.ts → message-scroller-a6qaYHno.d.ts} +2 -4
  100. package/dist/min-dark-DpGSNjaW.js +125 -0
  101. package/dist/min-light-BMfJUsU2.js +122 -0
  102. package/dist/monokai-DW19E-zg.js +162 -0
  103. package/dist/motion/core.d.ts +4 -0
  104. package/dist/motion/core.js +11 -0
  105. package/dist/motion-core-DNl7TR1T.d.ts +402 -0
  106. package/dist/motion.d.ts +14 -0
  107. package/dist/motion.js +13 -0
  108. package/dist/night-owl-B7Of8ee9.js +188 -0
  109. package/dist/night-owl-light-Vu9tTNpS.js +189 -0
  110. package/dist/nord-CDzJumeN.js +128 -0
  111. package/dist/nuxt-ui-7ByUrymx.js +43 -0
  112. package/dist/nuxt.d.ts +1 -7
  113. package/dist/nuxt.js +16 -11
  114. package/dist/one-dark-pro-hS_sNo5p.js +124 -0
  115. package/dist/one-light-CD4ItzSC.js +153 -0
  116. package/dist/opt-out-D66l60sg.js +205 -0
  117. package/dist/parts/components/agent-session.d.ts +1 -3
  118. package/dist/parts/components/agent-session.js +3 -4
  119. package/dist/parts/components/attachment.d.ts +2 -4
  120. package/dist/parts/components/attachment.js +3 -4
  121. package/dist/parts/components/avatar-stack.d.ts +1 -1
  122. package/dist/parts/components/avatar-stack.js +4 -4
  123. package/dist/parts/components/bubble.d.ts +2 -4
  124. package/dist/parts/components/bubble.js +2 -3
  125. package/dist/parts/components/chat-message.d.ts +1 -3
  126. package/dist/parts/components/chat-message.js +1 -2
  127. package/dist/parts/components/chat-session.d.ts +2 -4
  128. package/dist/parts/components/chat-session.js +1 -2
  129. package/dist/parts/components/chat.d.ts +1 -3
  130. package/dist/parts/components/chat.js +4 -5
  131. package/dist/parts/components/code-block.d.ts +2 -4
  132. package/dist/parts/components/code-block.js +3 -4
  133. package/dist/parts/components/code-view.d.ts +1 -3
  134. package/dist/parts/components/code-view.js +1 -2
  135. package/dist/parts/components/comment-composer.d.ts +1 -1
  136. package/dist/parts/components/comment-composer.js +1 -2
  137. package/dist/parts/components/comment-layer.d.ts +1 -1
  138. package/dist/parts/components/comment-layer.js +28 -11
  139. package/dist/parts/components/comment-list.d.ts +1 -1
  140. package/dist/parts/components/comment-list.js +13 -9
  141. package/dist/parts/components/comment-panel.d.ts +1 -1
  142. package/dist/parts/components/comment-panel.js +27 -14
  143. package/dist/parts/components/comment-pin.d.ts +1 -1
  144. package/dist/parts/components/comment-pin.js +2 -3
  145. package/dist/parts/components/comment-selection-bar.d.ts +1 -1
  146. package/dist/parts/components/comment-selection-bar.js +4 -4
  147. package/dist/parts/components/comment-send.d.ts +2 -0
  148. package/dist/parts/components/comment-send.js +1 -0
  149. package/dist/parts/components/comment-thread.d.ts +1 -1
  150. package/dist/parts/components/comment-thread.js +2 -597
  151. package/dist/parts/components/comments.d.ts +9 -8
  152. package/dist/parts/components/comments.js +7 -6
  153. package/dist/parts/components/connection-status.d.ts +1 -3
  154. package/dist/parts/components/connection-status.js +1 -2
  155. package/dist/parts/components/copy-button.d.ts +14 -6
  156. package/dist/parts/components/copy-button.js +225 -1
  157. package/dist/parts/components/device-frame.d.ts +3 -5
  158. package/dist/parts/components/device-frame.js +1 -2
  159. package/dist/parts/components/drop-field.d.ts +67 -0
  160. package/dist/parts/components/drop-field.js +76 -0
  161. package/dist/parts/components/file-tree.d.ts +1 -1
  162. package/dist/parts/components/file-tree.js +1 -2
  163. package/dist/parts/components/filter-search.d.ts +2 -4
  164. package/dist/parts/components/filter-search.js +2 -3
  165. package/dist/parts/components/hold-to-delete.d.ts +80 -0
  166. package/dist/parts/components/hold-to-delete.js +75 -0
  167. package/dist/parts/components/markdown-editor.d.ts +1 -1
  168. package/dist/parts/components/markdown-editor.js +1 -2
  169. package/dist/parts/components/markdown-renderer.d.ts +1 -3
  170. package/dist/parts/components/markdown-renderer.js +1 -23077
  171. package/dist/parts/components/markdown.d.ts +1 -3
  172. package/dist/parts/components/markdown.js +2 -3
  173. package/dist/parts/components/marker.d.ts +2 -4
  174. package/dist/parts/components/marker.js +2 -3
  175. package/dist/parts/components/message-parts.d.ts +1 -3
  176. package/dist/parts/components/message-parts.js +14 -7
  177. package/dist/parts/components/message.d.ts +1 -3
  178. package/dist/parts/components/message.js +2 -3
  179. package/dist/parts/components/motion-list.d.ts +40 -0
  180. package/dist/parts/components/motion-list.js +41 -0
  181. package/dist/parts/components/motion.d.ts +122 -0
  182. package/dist/parts/components/motion.js +171 -0
  183. package/dist/parts/components/patch-parsers.d.ts +1 -1
  184. package/dist/parts/components/patch-parsers.js +1 -2
  185. package/dist/parts/components/progress.d.ts +39 -0
  186. package/dist/parts/components/progress.js +53 -0
  187. package/dist/parts/components/prompt-input.d.ts +5 -7
  188. package/dist/parts/components/prompt-input.js +5 -6
  189. package/dist/parts/components/relative-time.d.ts +1 -3
  190. package/dist/parts/components/relative-time.js +1 -2
  191. package/dist/parts/components/status.d.ts +1 -3
  192. package/dist/parts/components/status.js +1 -2
  193. package/dist/parts/components/sync-status.d.ts +1 -3
  194. package/dist/parts/components/sync-status.js +3 -3
  195. package/dist/parts/components/tool-list.d.ts +2 -4
  196. package/dist/parts/components/tool-list.js +2 -3
  197. package/dist/parts/components/trace-run.d.ts +2 -4
  198. package/dist/parts/components/trace-run.js +4 -5
  199. package/dist/parts/components/trace.d.ts +2 -4
  200. package/dist/parts/components/trace.js +2 -3
  201. package/dist/parts/composables/attachments.d.ts +1 -3
  202. package/dist/parts/composables/attachments.js +1 -2
  203. package/dist/parts/composables/highlighted-code.d.ts +1 -3
  204. package/dist/parts/composables/highlighted-code.js +1 -2
  205. package/dist/parts/headless/choices-input.d.ts +1 -1
  206. package/dist/parts/headless/choices-input.js +3 -4
  207. package/dist/parts/headless/comment-visibility.d.ts +1 -1
  208. package/dist/parts/headless/comment-visibility.js +1 -2
  209. package/dist/parts/headless/comments.d.ts +1 -1
  210. package/dist/parts/headless/comments.js +1 -2
  211. package/dist/parts/headless/message-scroller.d.ts +1 -1
  212. package/dist/parts/headless/message-scroller.js +2 -3
  213. package/dist/parts/playground/paths.d.ts +1 -3
  214. package/dist/parts/playground/paths.js +1 -2
  215. package/dist/parts/playground/share.d.ts +34 -2
  216. package/dist/parts/playground/share.js +1 -2
  217. package/dist/parts/playground/zip.d.ts +1 -3
  218. package/dist/parts/playground/zip.js +2 -3
  219. package/dist/parts/workspace/browser-support-notice.d.ts +2 -4
  220. package/dist/parts/workspace/browser-support-notice.js +13 -6
  221. package/dist/parts/workspace/codemirror.d.ts +10 -3
  222. package/dist/parts/workspace/codemirror.js +40 -8
  223. package/dist/parts/workspace/connect-panel.d.ts +2 -4
  224. package/dist/parts/workspace/connect-panel.js +2 -3
  225. package/dist/parts/workspace/connect-store.d.ts +1 -3
  226. package/dist/parts/workspace/connect-store.js +1 -2
  227. package/dist/parts/workspace/file-icons.d.ts +14 -0
  228. package/dist/parts/workspace/file-icons.js +81 -0
  229. package/dist/parts/workspace/icons.d.ts +2 -2
  230. package/dist/parts/workspace/icons.js +2 -2
  231. package/dist/parts/workspace/runners/render.d.ts +24 -0
  232. package/dist/parts/workspace/runners/render.js +123 -0
  233. package/dist/parts/workspace/runners/web-container.d.ts +27 -0
  234. package/dist/parts/workspace/runners/web-container.js +185 -0
  235. package/dist/parts/workspace/workspace-bar.d.ts +49 -0
  236. package/dist/parts/workspace/workspace-bar.js +50 -0
  237. package/dist/parts/workspace/workspace-boot-status.d.ts +1 -2
  238. package/dist/parts/workspace/workspace-boot-status.js +2 -3
  239. package/dist/parts/workspace/workspace-editor-head.d.ts +45 -0
  240. package/dist/parts/workspace/workspace-editor-head.js +65 -0
  241. package/dist/parts/workspace/workspace-editor.d.ts +18 -3
  242. package/dist/parts/workspace/workspace-editor.js +30 -5
  243. package/dist/parts/workspace/workspace-examples.d.ts +72 -0
  244. package/dist/parts/workspace/workspace-examples.js +71 -0
  245. package/dist/parts/workspace/workspace-file-link.d.ts +33 -0
  246. package/dist/parts/workspace/workspace-file-link.js +38 -0
  247. package/dist/parts/workspace/workspace-file-tree.d.ts +9 -11
  248. package/dist/parts/workspace/workspace-file-tree.js +28 -22
  249. package/dist/parts/workspace/workspace-guide.d.ts +50 -0
  250. package/dist/parts/workspace/workspace-guide.js +90 -0
  251. package/dist/parts/workspace/workspace-issues.d.ts +44 -0
  252. package/dist/parts/workspace/workspace-issues.js +48 -0
  253. package/dist/parts/workspace/workspace-preview.d.ts +1 -3
  254. package/dist/parts/workspace/workspace-preview.js +2 -3
  255. package/dist/parts/workspace/workspace-shell.d.ts +2 -88
  256. package/dist/parts/workspace/workspace-shell.js +132 -80
  257. package/dist/parts/workspace/workspace-sidebar.d.ts +73 -0
  258. package/dist/parts/workspace/workspace-sidebar.js +131 -0
  259. package/dist/parts/workspace/workspace-start.d.ts +45 -0
  260. package/dist/parts/workspace/workspace-start.js +59 -0
  261. package/dist/parts/workspace/workspace-status.d.ts +67 -0
  262. package/dist/parts/workspace/workspace-status.js +73 -0
  263. package/dist/parts/workspace/workspace-steps.d.ts +2 -0
  264. package/dist/parts/workspace/workspace-steps.js +127 -0
  265. package/dist/parts/workspace/workspace-task.d.ts +18 -0
  266. package/dist/parts/workspace/workspace-task.js +19 -0
  267. package/dist/parts/workspace/workspace-terminal.d.ts +1 -3
  268. package/dist/parts/workspace/workspace-terminal.js +1 -2
  269. package/dist/parts/workspace/workspace.d.ts +249 -0
  270. package/dist/parts/workspace/workspace.js +664 -0
  271. package/dist/{payload-text-sjkYAwvw.js → payload-text-DQNRbJY5.js} +1 -2
  272. package/dist/{pierre-code-view-NE35tkmR.js → pierre-code-view-C49BVDrc.js} +11333 -6718
  273. package/dist/pierre-dark-BtKHt2e4.js +166 -0
  274. package/dist/pierre-dark-CXW3KeKO.js +5 -0
  275. package/dist/pierre-dark-protanopia-deuteranopia-CS0Gs25Q.js +166 -0
  276. package/dist/pierre-dark-protanopia-deuteranopia-DajNv_A3.js +3 -0
  277. package/dist/pierre-dark-soft-BUFoeBEf.js +3 -0
  278. package/dist/pierre-dark-soft-D__0FtYP.js +166 -0
  279. package/dist/pierre-dark-tritanopia-C6fHROmA.js +166 -0
  280. package/dist/pierre-dark-tritanopia-oa3gpgIR.js +3 -0
  281. package/dist/pierre-dark-vibrant-COXpyAHb.js +166 -0
  282. package/dist/pierre-dark-vibrant-CYRHyDoW.js +3 -0
  283. package/dist/pierre-light-BD28C_vh.js +166 -0
  284. package/dist/pierre-light-BN0rL1e5.js +5 -0
  285. package/dist/pierre-light-protanopia-deuteranopia-CYsDHJt0.js +3 -0
  286. package/dist/pierre-light-protanopia-deuteranopia-CwWH1xGL.js +166 -0
  287. package/dist/pierre-light-soft-BkKY4pMj.js +166 -0
  288. package/dist/pierre-light-soft-F2QIpNbb.js +3 -0
  289. package/dist/pierre-light-tritanopia-BbKKIkua.js +3 -0
  290. package/dist/pierre-light-tritanopia-Mpubahl7.js +166 -0
  291. package/dist/pierre-light-vibrant-CdV9Besm.js +3 -0
  292. package/dist/pierre-light-vibrant-x11J3_aO.js +166 -0
  293. package/dist/plastic-BQnXkmvK.js +137 -0
  294. package/dist/playground.d.ts +1 -1
  295. package/dist/poimandres-DEfG-8RI.js +124 -0
  296. package/dist/progress-DL9k-ERG.js +265 -0
  297. package/dist/red-BfKrAjYG.js +169 -0
  298. package/dist/registry-DAIjCjWd.js +77 -0
  299. package/dist/{relative-time-BVmjOsYG.js → relative-time-DJnw45tr.js} +5 -8
  300. package/dist/ring-BN4d8vtw.js +173 -0
  301. package/dist/{rolldown-runtime-C9mWXvCC.js → rolldown-runtime-CahUhzF3.js} +2 -3
  302. package/dist/rose-pine-D0rhGGFg.js +136 -0
  303. package/dist/rose-pine-dawn-7jVaYUiD.js +136 -0
  304. package/dist/rose-pine-moon-CFyS0Mvu.js +136 -0
  305. package/dist/runtime/nuxt-plugin.d.ts +0 -2
  306. package/dist/runtime/nuxt-plugin.js +3 -4
  307. package/dist/{sankey-CAYwt82B-D4uDQoMR.js → sankey-CAYwt82B-BAAk7WkJ.js} +147 -151
  308. package/dist/shiki-CbfEu_Az.js +607 -0
  309. package/dist/slack-dark-Bv-KFSBD.js +87 -0
  310. package/dist/slack-ochin-Dg2BAv1D.js +107 -0
  311. package/dist/{slot-part-Doic71uh.js → slot-part-BWHvQ3mK.js} +1 -2
  312. package/dist/snazzy-light-sYDdR9rx.js +93 -0
  313. package/dist/solarized-dark-COt2tTmN.js +160 -0
  314. package/dist/solarized-light-BJrwFarZ.js +160 -0
  315. package/dist/stream-tokenizer-ByC3l0HQ.js +263 -0
  316. package/dist/styles.css +590 -573
  317. package/dist/synthwave-84-NUDBykTM.js +410 -0
  318. package/dist/{temml-BilSAAws.js → temml-m3ad3bfq.js} +2 -3
  319. package/dist/text-BWzZFnGY.js +822 -0
  320. package/dist/theme.d.ts +44 -3
  321. package/dist/theme.js +23 -9
  322. package/dist/themes-DKugPHlg.js +323 -0
  323. package/dist/tokyo-night-DD3B2QcO.js +153 -0
  324. package/dist/travel-CwVhU_GS.js +180 -0
  325. package/dist/tween-Dv3IIIQG.js +61 -0
  326. package/dist/{types-Dj7vp0lZ.d.ts → types-Ceh7h7NT.d.ts} +1 -3
  327. package/dist/vesper-oVQYrv8Y.js +99 -0
  328. package/dist/visual-copy-CHHBfJ6O.js +14 -0
  329. package/dist/vite.d.ts +1 -3
  330. package/dist/vite.js +13 -3
  331. package/dist/vitesse-black-D84DQZAP.js +196 -0
  332. package/dist/vitesse-dark-CMZ6olk_.js +196 -0
  333. package/dist/vitesse-light-D9d8hLOY.js +196 -0
  334. package/dist/{vue-DGstVdGn.js → vue-BlknIGIm.js} +43 -34
  335. package/dist/{vue-BDmSCtay.js → vue-kCdzBu0N.js} +4 -7
  336. package/dist/workspace-shell-ChCwWPyv.d.ts +110 -0
  337. package/dist/workspace-steps-BKByX9DW.d.ts +70 -0
  338. package/dist/workspace.d.ts +16 -5
  339. package/dist/workspace.js +16 -3
  340. package/package.json +66 -55
  341. package/dist/copy-button-CRN3kmSD.js +0 -253
  342. package/dist/icon-swap.css +0 -69
  343. package/dist/nuxt-ui-DSQFzq3s.js +0 -38
  344. package/dist/parts/playground/highlight.d.ts +0 -5
  345. package/dist/parts/playground/highlight.js +0 -23
  346. package/dist/parts/playground/playground-render.d.ts +0 -126
  347. package/dist/parts/playground/playground-render.js +0 -356
  348. package/dist/parts/workspace/playground-container.d.ts +0 -192
  349. package/dist/parts/workspace/playground-container.js +0 -603
  350. package/dist/pierre-dark-CzUmjETS.js +0 -6
  351. package/dist/pierre-dark-protanopia-deuteranopia-C35UMuvO.js +0 -4
  352. package/dist/pierre-dark-soft-Bb-4-biO.js +0 -4
  353. package/dist/pierre-dark-tritanopia-CIJISGWF.js +0 -4
  354. package/dist/pierre-dark-vibrant-8oZzB3gw.js +0 -4
  355. package/dist/pierre-light-Dn6E0sWv.js +0 -6
  356. package/dist/pierre-light-protanopia-deuteranopia-u0U7N4Hn.js +0 -4
  357. package/dist/pierre-light-soft-BCU6fuhO.js +0 -4
  358. package/dist/pierre-light-tritanopia-3c8Yx3co.js +0 -4
  359. package/dist/pierre-light-vibrant-Cwh332o_.js +0 -4
  360. package/dist/share-DM4eNy4q.d.ts +0 -37
@@ -1,12 +1,12 @@
1
- import { t as pierre_dark_default } from "../../pierre-dark-CzUmjETS.js";
2
- import { t as pierre_light_default } from "../../pierre-light-Dn6E0sWv.js";
1
+ import { t as pierre_dark_default } from "../../pierre-dark-CXW3KeKO.js";
2
+ import { t as pierre_light_default } from "../../pierre-light-BN0rL1e5.js";
3
3
  import { closeBrackets, closeBracketsKeymap } from "@codemirror/autocomplete";
4
4
  import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
5
5
  import { HighlightStyle, bracketMatching, indentOnInput, syntaxHighlighting } from "@codemirror/language";
6
6
  import { Compartment, EditorState } from "@codemirror/state";
7
7
  import { EditorView, drawSelection, highlightActiveLine, highlightActiveLineGutter, keymap, lineNumbers } from "@codemirror/view";
8
8
  import { tags } from "@lezer/highlight";
9
- //#region src/workspace/codemirror.ts
9
+ // src/workspace/codemirror.ts
10
10
  const syntaxScopes = {
11
11
  attribute: "entity.other.attribute-name",
12
12
  function: "entity.name.function",
@@ -110,14 +110,14 @@ const theme = EditorView.theme({
110
110
  ...syntaxColors(pierre_light_default),
111
111
  backgroundColor: "var(--vh-ws-code-bg)",
112
112
  color: "var(--vh-ws-code-fg)",
113
- fontSize: "13px",
113
+ fontSize: "12.5px",
114
114
  height: "100%"
115
115
  },
116
116
  ".dark &": syntaxColors(pierre_dark_default),
117
117
  "&.cm-focused": { outline: "none" },
118
118
  ".cm-scroller": {
119
119
  fontFamily: "var(--vh-ws-font-mono)",
120
- lineHeight: "1.6"
120
+ lineHeight: "1.65"
121
121
  },
122
122
  ".cm-content": {
123
123
  caretColor: "var(--vh-ws-code-cursor)",
@@ -136,9 +136,11 @@ const theme = EditorView.theme({
136
136
  color: "var(--vh-ws-code-gutter-active)"
137
137
  },
138
138
  ".cm-lineNumbers .cm-gutterElement": {
139
- minWidth: "3ch",
140
- paddingInline: "12px 8px"
139
+ boxSizing: "content-box",
140
+ minWidth: "28px",
141
+ padding: "0 16px 0 0"
141
142
  },
143
+ ".cm-line": { padding: "0 16px 0 0" },
142
144
  ".cm-matchingBracket": {
143
145
  backgroundColor: "var(--vh-ws-code-selection)",
144
146
  outline: "none"
@@ -167,12 +169,21 @@ async function languageFor(path) {
167
169
  default: return;
168
170
  }
169
171
  }
172
+ /**
173
+ * Match the layout's Z key or the US Mac Option+Z chord (`Ω` on `KeyZ`). A physical `KeyZ` alone can be a typing key.
174
+ */
175
+ function isToggleWrap(event) {
176
+ if (!event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return false;
177
+ return event.key.toLowerCase() === "z" || event.key === "Ω" && event.code === "KeyZ";
178
+ }
170
179
  function createCodeEditor(options) {
171
180
  const language = new Compartment();
172
181
  const editable = new Compartment();
182
+ const wrapping = new Compartment();
173
183
  let path = options.path;
174
184
  let applying = false;
175
185
  let readonly = options.readonly;
186
+ let wrap = options.wrap;
176
187
  const editableExtension = () => [EditorState.readOnly.of(readonly), EditorView.editable.of(!readonly)];
177
188
  const extensions = () => [
178
189
  lineNumbers(),
@@ -184,6 +195,12 @@ function createCodeEditor(options) {
184
195
  closeBrackets(),
185
196
  highlightActiveLine(),
186
197
  syntaxHighlighting(pierreHighlight),
198
+ EditorView.domEventHandlers({ keydown: (event) => {
199
+ if (!isToggleWrap(event)) return false;
200
+ event.preventDefault();
201
+ options.onToggleWrap();
202
+ return true;
203
+ } }),
187
204
  keymap.of([
188
205
  ...closeBracketsKeymap,
189
206
  ...defaultKeymap,
@@ -193,11 +210,21 @@ function createCodeEditor(options) {
193
210
  theme,
194
211
  language.of([]),
195
212
  editable.of(editableExtension()),
213
+ wrapping.of(wrap ? EditorView.lineWrapping : []),
196
214
  EditorView.contentAttributes.of({ "aria-label": `Edit ${path}` }),
197
215
  EditorView.updateListener.of((update) => {
198
216
  if (update.docChanged && !applying) options.onChange(update.state.doc.toString());
217
+ if (update.docChanged || update.selectionSet) reportCursor(update.state);
199
218
  })
200
219
  ];
220
+ function reportCursor(state) {
221
+ const head = state.selection.main.head;
222
+ const line = state.doc.lineAt(head);
223
+ options.onCursor({
224
+ column: head - line.from + 1,
225
+ line: line.number
226
+ });
227
+ }
201
228
  const view = new EditorView({
202
229
  doc: options.doc,
203
230
  extensions: extensions(),
@@ -219,6 +246,7 @@ function createCodeEditor(options) {
219
246
  extensions: extensions()
220
247
  }));
221
248
  applying = false;
249
+ reportCursor(view.state);
222
250
  loadLanguage(path);
223
251
  return;
224
252
  }
@@ -235,9 +263,13 @@ function createCodeEditor(options) {
235
263
  readonly = next;
236
264
  view.dispatch({ effects: editable.reconfigure(editableExtension()) });
237
265
  },
266
+ setWrap(next) {
267
+ if (next === wrap) return;
268
+ wrap = next;
269
+ view.dispatch({ effects: wrapping.reconfigure(wrap ? EditorView.lineWrapping : []) });
270
+ },
238
271
  focus: () => view.focus(),
239
272
  destroy: () => view.destroy()
240
273
  };
241
274
  }
242
- //#endregion
243
275
  export { createCodeEditor };
@@ -1,6 +1,5 @@
1
1
  import { PropType, VNode } from "vue";
2
2
  import { Connect, ConnectProvider, ConnectProviderName } from "@vite-hub/web-container/connect";
3
- //#region src/workspace/connect-panel.d.ts
4
3
  /**
5
4
  * - `idle`: no token yet.
6
5
  * - `connecting`: the app checks the token.
@@ -122,8 +121,7 @@ export declare const ConnectPanel: import("vue").DefineComponent<import("vue").E
122
121
  "onCopy-command"?: ((command: string) => any) | undefined;
123
122
  "onRemove-all"?: (() => any) | undefined;
124
123
  }>, {
124
+ empty: string;
125
125
  relayUrl: string;
126
126
  states: Partial<Record<ConnectProviderName, ConnectProviderState>>;
127
- empty: string;
128
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
129
- //#endregion
127
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,7 +1,7 @@
1
- import { r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
1
+ import { r as useUIComponent } from "../../nuxt-ui-7ByUrymx.js";
2
2
  import { icon, providerLogo } from "./icons.js";
3
3
  import { computed, defineComponent, h, ref, useId } from "vue";
4
- //#region src/workspace/connect-panel.ts
4
+ // src/workspace/connect-panel.ts
5
5
  const providerInfo = {
6
6
  anthropic: {
7
7
  label: "Anthropic",
@@ -281,5 +281,4 @@ const ConnectPanel = defineComponent({
281
281
  ])]);
282
282
  }
283
283
  });
284
- //#endregion
285
284
  export { ConnectPanel, ConnectProviderRow, connectProviderLabel };
@@ -1,6 +1,5 @@
1
1
  import { ComputedRef, Ref } from "vue";
2
2
  import { Connect, ConnectCredentials, ConnectProviderName } from "@vite-hub/web-container/connect";
3
- //#region src/workspace/connect-store.d.ts
4
3
  export interface UseConnectStoreOptions {
5
4
  /**
6
5
  * Where tokens are kept. `session` forgets them when the tab closes. `memory` forgets them on reload.
@@ -22,5 +21,4 @@ export interface ConnectStore {
22
21
  * A small token store for `ConnectPanel`. Tokens stay in this browser and never go to a server. Called in a component,
23
22
  * it loads the stored tokens when the component mounts.
24
23
  */
25
- export declare function useConnectStore(options?: UseConnectStoreOptions): ConnectStore;
26
- //#endregion
24
+ export declare function useConnectStore(options?: UseConnectStoreOptions): ConnectStore;
@@ -1,6 +1,6 @@
1
1
  import { computed, getCurrentInstance, onMounted, readonly, ref } from "vue";
2
2
  import { connectEnv } from "@vite-hub/web-container/connect";
3
- //#region src/workspace/connect-store.ts
3
+ // src/workspace/connect-store.ts
4
4
  function browserStorage(kind) {
5
5
  if (kind === "memory" || typeof window === "undefined") return void 0;
6
6
  try {
@@ -55,5 +55,4 @@ function useConnectStore(options = {}) {
55
55
  env: (connect) => computed(() => connectEnv(connect, credentials.value))
56
56
  };
57
57
  }
58
- //#endregion
59
58
  export { useConnectStore };
@@ -0,0 +1,14 @@
1
+ import { VNode } from "vue";
2
+ /** The `icons` option of a Pierre tree that draws these icons. A file of another type gets a muted dot. */
3
+ export declare const fileTreeIcons: {
4
+ readonly byFileExtension: {
5
+ [k: string]: string;
6
+ };
7
+ readonly remap: {
8
+ readonly "file-tree-icon-file": string;
9
+ };
10
+ readonly set: "minimal";
11
+ readonly spriteSheet: string;
12
+ };
13
+ /** The icon of `path` as an inline SVG, the same one that `WorkspaceFileTree` draws. */
14
+ export declare function fileIcon(path: string, className?: string): VNode;
@@ -0,0 +1,81 @@
1
+ import { h } from "vue";
2
+ // src/workspace/file-icons.ts
3
+ /**
4
+ * The colors of the file types: the brand colors of the languages, as in the Seti theme of VS Code, for light and dark
5
+ * pages. They are data, like brand logos, so they live here and not in the theme. A `--vh-ws-file-<type>` token on the
6
+ * page replaces one.
7
+ */
8
+ const colors = {
9
+ astro: ["#7c3aed", "#a78bfa"],
10
+ js: ["#a16207", "#eab308"],
11
+ json: ["#a16207", "#eab308"],
12
+ md: ["#0284c7", "#38bdf8"],
13
+ svelte: ["#ea580c", "#fb923c"],
14
+ ts: ["#3178c6", "#60a5fa"],
15
+ tsx: ["#0891b2", "#22d3ee"],
16
+ vue: ["#41b883", "#41b883"],
17
+ "vue-dark": ["#35495e", "#a3b8cc"]
18
+ };
19
+ function color(type) {
20
+ const [light, dark] = colors[type];
21
+ return `var(--vh-ws-file-${type}, light-dark(${light}, ${dark}))`;
22
+ }
23
+ /** The glyph and its color, by file extension. */
24
+ const glyphs = {
25
+ astro: ["A", "astro"],
26
+ cjs: ["JS", "js"],
27
+ js: ["JS", "js"],
28
+ json: ["{}", "json"],
29
+ jsonc: ["{}", "json"],
30
+ jsonl: ["{}", "json"],
31
+ jsx: ["JS", "js"],
32
+ md: ["M", "md"],
33
+ mdx: ["M", "md"],
34
+ mjs: ["JS", "js"],
35
+ mts: ["TS", "ts"],
36
+ svelte: ["S", "svelte"],
37
+ ts: ["TS", "ts"],
38
+ tsx: ["TS", "tsx"]
39
+ };
40
+ const vueLogo = `<svg x="1" y="1" width="14" height="14" viewBox="0 0 24 24"><path d="M2 4h4.2L12 14l5.8-10H22L12 21z" style="fill: ${color("vue")}"/><path d="M6.2 4h3.4L12 8.2 14.4 4h3.4L12 14z" style="fill: ${color("vue-dark")}"/></svg>`;
41
+ function glyph(text, color) {
42
+ return `<text x="8" y="8.5" dominant-baseline="central" text-anchor="middle" style="fill: ${color}; font: 600 9px/1 var(--vh-ws-font-mono); letter-spacing: -0.03em">${text}</text>`;
43
+ }
44
+ function extension(path) {
45
+ const name = path.slice(path.lastIndexOf("/") + 1);
46
+ const dot = name.lastIndexOf(".");
47
+ return dot > 0 ? name.slice(dot + 1).toLowerCase() : "";
48
+ }
49
+ /** The inner SVG of the icon of `path`, in a 16x16 box. */
50
+ function iconBody(path) {
51
+ const type = extension(path);
52
+ if (type === "vue") return vueLogo;
53
+ const entry = Object.hasOwn(glyphs, type) ? glyphs[type] : void 0;
54
+ return entry ? glyph(entry[0], color(entry[1])) : glyph("·", "var(--vh-muted)");
55
+ }
56
+ const symbolIds = {
57
+ other: "vh-ws-file-other",
58
+ vue: "vh-ws-file-vue",
59
+ ...Object.fromEntries(Object.keys(glyphs).map((type) => [type, `vh-ws-file-${type}`]))
60
+ };
61
+ /** The symbols that `fileTreeIcons` names, for the `spriteSheet` of a Pierre tree. */
62
+ const spriteSheet = `<svg xmlns="http://www.w3.org/2000/svg" style="display: none">${Object.entries(symbolIds).map(([type, id]) => `<symbol id="${id}" viewBox="0 0 16 16">${iconBody(type === "other" ? "" : `file.${type}`)}</symbol>`).join("")}</svg>`;
63
+ /** The `icons` option of a Pierre tree that draws these icons. A file of another type gets a muted dot. */
64
+ const fileTreeIcons = {
65
+ byFileExtension: Object.fromEntries(Object.keys(glyphs).concat("vue").map((type) => [type, symbolIds[type]])),
66
+ remap: { "file-tree-icon-file": symbolIds.other },
67
+ set: "minimal",
68
+ spriteSheet
69
+ };
70
+ /** The icon of `path` as an inline SVG, the same one that `WorkspaceFileTree` draws. */
71
+ function fileIcon(path, className = "vh-ws-file-icon") {
72
+ return h("svg", {
73
+ "aria-hidden": "true",
74
+ class: className,
75
+ "data-file-type": extension(path) || void 0,
76
+ innerHTML: iconBody(path),
77
+ viewBox: "0 0 16 16",
78
+ xmlns: "http://www.w3.org/2000/svg"
79
+ });
80
+ }
81
+ export { fileIcon, fileTreeIcons };
@@ -1,7 +1,7 @@
1
1
  import { VNode } from "vue";
2
- //#region src/workspace/icons.d.ts
3
2
  declare const icons: {
4
3
  readonly lock: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/></g>";
4
+ readonly "chevron-right": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m9 18l6-6l-6-6\"/>";
5
5
  readonly check: "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M20 6L9 17l-5-5\"/>";
6
6
  readonly monitor: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\"/><path d=\"M8 21h8m-4-4v4\"/></g>";
7
7
  readonly "rotate-cw": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/></g>";
@@ -31,4 +31,4 @@ export type WorkspaceIconName = keyof typeof icons;
31
31
  export type ProviderLogoName = keyof typeof logos;
32
32
  export declare function icon(name: WorkspaceIconName, className?: string): VNode;
33
33
  export declare function providerLogo(name: ProviderLogoName, className?: string): VNode;
34
- //#endregion
34
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { h } from "vue";
2
- //#region src/workspace/icons.ts
2
+ // src/workspace/icons.ts
3
3
  const icons = {
4
4
  "lock": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/></g>",
5
+ "chevron-right": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m9 18l6-6l-6-6\"/>",
5
6
  "check": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M20 6L9 17l-5-5\"/>",
6
7
  "monitor": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\"/><path d=\"M8 21h8m-4-4v4\"/></g>",
7
8
  "rotate-cw": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/></g>",
@@ -42,5 +43,4 @@ function icon(name, className = "vh-ws-icon") {
42
43
  function providerLogo(name, className = "vh-ws-logo") {
43
44
  return svg(logos[name], className);
44
45
  }
45
- //#endregion
46
46
  export { icon, providerLogo };
@@ -0,0 +1,24 @@
1
+ import { WorkspaceIssue } from "../workspace-issues.js";
2
+ import { WorkspaceExample } from "../workspace-examples.js";
3
+ import { WorkspaceFiles, WorkspaceRunner } from "../workspace.js";
4
+ /** What `render()` gets back from its function: the HTML of the output, and the problems that it found. */
5
+ export interface WorkspaceRenderResult {
6
+ html: string;
7
+ issues?: readonly WorkspaceIssue[];
8
+ }
9
+ /** What `render()` gives its function with the files. */
10
+ export interface WorkspaceRenderContext {
11
+ /** The open example. Read binary files, such as model weights, from `example.assets`. */
12
+ example: WorkspaceExample;
13
+ }
14
+ export interface RenderRunnerOptions {
15
+ /** Wraps the HTML in the document of the output, with its stylesheets and theme. Defaults to a plain page. */
16
+ document?: (html: string, files: WorkspaceFiles) => string;
17
+ }
18
+ /**
19
+ * Runs the files of a `Workspace` through `fn` in the page, 200 ms after the last edit, and shows the HTML in an
20
+ * Output tab and the problems in an Issues tab. `fn` gets the open example too, with its `assets`. A result for older
21
+ * files never replaces a newer one, and a thrown error becomes an issue. The file of an issue opens in the editor on a
22
+ * click. Every device can run it.
23
+ */
24
+ export declare function render(fn: (files: WorkspaceFiles, context: WorkspaceRenderContext) => Promise<WorkspaceRenderResult>, options?: RenderRunnerOptions): WorkspaceRunner;
@@ -0,0 +1,123 @@
1
+ import { WorkspaceIssues } from "../workspace-issues.js";
2
+ import { computed, h, onScopeDispose, ref, shallowRef } from "vue";
3
+ // src/workspace/runners/render.ts
4
+ const debounce = 200;
5
+ function plainDocument(html) {
6
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>:root{color-scheme:light}body{margin:0;padding:1.5rem;font:1rem/1.6 system-ui,sans-serif}</style></head><body>${html}</body></html>`;
7
+ }
8
+ function keepScroll(document, top) {
9
+ const script = `<script>(()=>{const y=${Math.round(top)};const go=()=>scrollTo(0,y);go();addEventListener("load",go);addEventListener("scroll",()=>parent.postMessage({vhWorkspaceScroll:scrollY},"*"),{passive:true})})()<\/script>`;
10
+ const end = document.lastIndexOf("</body>");
11
+ return end === -1 ? document + script : document.slice(0, end) + script + document.slice(end);
12
+ }
13
+ function scrollFrom(data) {
14
+ if (!data || typeof data !== "object" || !("vhWorkspaceScroll" in data)) return void 0;
15
+ return typeof data.vhWorkspaceScroll === "number" ? data.vhWorkspaceScroll : void 0;
16
+ }
17
+ const message = (error) => error instanceof Error ? error.message : String(error);
18
+ /**
19
+ * Runs the files of a `Workspace` through `fn` in the page, 200 ms after the last edit, and shows the HTML in an
20
+ * Output tab and the problems in an Issues tab. `fn` gets the open example too, with its `assets`. A result for older
21
+ * files never replaces a newer one, and a thrown error becomes an issue. The file of an issue opens in the editor on a
22
+ * click. Every device can run it.
23
+ */
24
+ function render(fn, options = {}) {
25
+ const wrap = options.document ?? plainDocument;
26
+ function start({ example: booted, files: initial, show }) {
27
+ const files = shallowRef({ ...initial });
28
+ let example = booted;
29
+ const issues = ref([]);
30
+ const html = ref();
31
+ const running = ref(true);
32
+ let frame;
33
+ let timer;
34
+ let runs = 0;
35
+ let scrollTop = 0;
36
+ let stopped = false;
37
+ async function run() {
38
+ clearTimeout(timer);
39
+ const current = ++runs;
40
+ const snapshot = files.value;
41
+ running.value = true;
42
+ try {
43
+ const result = await fn(snapshot, { example });
44
+ if (current !== runs || stopped) return;
45
+ issues.value = result.issues ?? [];
46
+ html.value = keepScroll(wrap(result.html, snapshot), scrollTop);
47
+ } catch (error) {
48
+ if (current === runs && !stopped) issues.value = [{ message: message(error) }];
49
+ } finally {
50
+ if (current === runs) running.value = false;
51
+ }
52
+ }
53
+ const listen = (event) => {
54
+ const top = frame && event.source === frame.contentWindow ? scrollFrom(event.data) : void 0;
55
+ if (top !== void 0) scrollTop = top;
56
+ };
57
+ if (typeof window !== "undefined") {
58
+ window.addEventListener("message", listen);
59
+ run();
60
+ }
61
+ onScopeDispose(() => {
62
+ stopped = true;
63
+ clearTimeout(timer);
64
+ if (typeof window !== "undefined") window.removeEventListener("message", listen);
65
+ });
66
+ const state = computed(() => running.value ? {
67
+ label: "Rendering",
68
+ tone: "busy"
69
+ } : issues.value.length ? {
70
+ label: issues.value.length === 1 ? "1 issue" : `${issues.value.length} issues`,
71
+ tone: "error"
72
+ } : {
73
+ label: "Rendered",
74
+ tone: "ready"
75
+ });
76
+ return {
77
+ files,
78
+ async setFiles(next, setOptions = {}) {
79
+ files.value = setOptions.mode === "replace" ? { ...next } : {
80
+ ...files.value,
81
+ ...next
82
+ };
83
+ runs++;
84
+ clearTimeout(timer);
85
+ timer = setTimeout(() => void run(), debounce);
86
+ },
87
+ keeps: () => true,
88
+ async open(opened, next) {
89
+ example = opened;
90
+ scrollTop = 0;
91
+ files.value = { ...next };
92
+ await run();
93
+ },
94
+ tabs: computed(() => [{
95
+ label: "Output",
96
+ value: "output"
97
+ }, {
98
+ badge: issues.value.length || void 0,
99
+ label: "Issues",
100
+ value: "issues"
101
+ }]),
102
+ panel(tab) {
103
+ if (tab === "output") return h("iframe", {
104
+ class: "vh-workspace-frame",
105
+ ref: (element) => {
106
+ frame = element instanceof HTMLIFrameElement ? element : void 0;
107
+ },
108
+ sandbox: "allow-scripts allow-popups",
109
+ srcdoc: html.value,
110
+ title: "Output"
111
+ });
112
+ if (tab === "issues") return h("div", { class: "vh-workspace-scroll" }, h(WorkspaceIssues, {
113
+ empty: "No issues.",
114
+ issues: issues.value,
115
+ onShow: show
116
+ }));
117
+ },
118
+ state
119
+ };
120
+ }
121
+ return { start };
122
+ }
123
+ export { render };
@@ -0,0 +1,27 @@
1
+ import { WorkspaceExample } from "../workspace-examples.js";
2
+ import { WorkspaceRunner } from "../workspace.js";
3
+ import { ShallowRef } from "vue";
4
+ import { Connect } from "@vite-hub/web-container/connect";
5
+ import { UseWebContainerReturn } from "@vite-hub/web-container/vue";
6
+ /** Loads a `node_modules` snapshot, such as `() => fetchSnapshot(parts)`. */
7
+ export type WorkspaceSnapshot = () => Promise<Uint8Array | ArrayBuffer>;
8
+ export interface WebContainerRunnerOptions {
9
+ /** The port of the dev server, such as `3000` for `vite --port 3000`. Other servers do not become the preview. */
10
+ port?: number;
11
+ /**
12
+ * The `node_modules` snapshot of an example. Without one, the runner runs `npm install`. Give examples with the same
13
+ * dependencies the same function, so the runner opens them without a new boot.
14
+ */
15
+ snapshot?: (example: WorkspaceExample) => WorkspaceSnapshot | undefined;
16
+ /** The providers of `defineConnect()`. Their tokens reach the dev server as environment variables. */
17
+ connect?: Connect;
18
+ }
19
+ /** The runner of `webContainer()`. `workspace` is the WebContainer of the current run, for code outside the workspace. */
20
+ export interface WebContainerRunner extends WorkspaceRunner {
21
+ readonly workspace: Readonly<ShallowRef<UseWebContainerReturn | undefined>>;
22
+ }
23
+ /**
24
+ * Runs the files of a `Workspace` as an app in a WebContainer, with a dev server, a Preview tab, a Terminal tab, and a
25
+ * Connect tab for `connect`. Only desktops start it on their own.
26
+ */
27
+ export declare function webContainer(options?: WebContainerRunnerOptions): WebContainerRunner;