@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.
- package/README.md +102 -76
- package/dist/andromeeda-DaUPZ4_A.js +147 -0
- package/dist/announce-B0DLwflT.js +31 -0
- package/dist/{attachments-BzTwqRTU.js → attachments-DgwoQZKY.js} +3 -5
- package/dist/aurora-x-B5RPZ9i5.js +162 -0
- package/dist/{avatar-stack-DPRFuezh.d.ts → avatar-stack-C0IKwj6g.d.ts} +1 -3
- package/dist/ayu-dark-DXTaGA7I.js +137 -0
- package/dist/ayu-light-BCYi80Fe.js +137 -0
- package/dist/ayu-mirage-CgbXz-N5.js +137 -0
- package/dist/catppuccin-frappe-MV2xzv44.js +266 -0
- package/dist/catppuccin-latte-CL6jjlVD.js +266 -0
- package/dist/catppuccin-macchiato-Bp6oZJVK.js +266 -0
- package/dist/catppuccin-mocha-DOHrQ4dw.js +266 -0
- package/dist/{choices-input-ByXJvDn1.d.ts → choices-input-BUf-QqGj.d.ts} +0 -2
- package/dist/{code-view-DsU-xzic.js → code-view-Cg4nyTNA.js} +6 -8
- package/dist/{colors-BghReA9C-CjF9gnmy.js → colors-BghReA9C-DEq4bhEP.js} +1 -2
- package/dist/{comment-attachments-C4yNbcx5.js → comment-attachments-CMpYOJod.js} +1 -2
- package/dist/{comment-composer-fINL5bxo.d.ts → comment-composer-BI6CNJyO.d.ts} +3 -5
- package/dist/{comment-composer-jYv2ULNP.js → comment-composer-CzU7DdfD.js} +260 -16
- package/dist/{comment-layer-C_sbPIR5.d.ts → comment-layer-DyVstrs-.d.ts} +5 -7
- package/dist/{comment-list-BcSaLngS.d.ts → comment-list-CSK5o-Ua.d.ts} +3 -5
- package/dist/comment-marks.css +18 -22
- package/dist/{comment-panel-CfvdRUMX.d.ts → comment-panel-CEvOI3gk.d.ts} +3 -5
- package/dist/{comment-person-CLPlW_SS.js → comment-person-D_IyIjXo.js} +1 -2
- package/dist/{comment-pin-DHOdRvUw.d.ts → comment-pin-C5UeLPTa.d.ts} +1 -3
- package/dist/{comment-row-Bn3nr8l5.js → comment-row-DPMWI5Z0.js} +3 -4
- package/dist/{comment-selection-bar-CyVBNYl9.d.ts → comment-selection-bar-CVuS-FNL.d.ts} +0 -2
- package/dist/comment-send-DPzV9B8S.js +275 -0
- package/dist/comment-send-MmxFsOQf.d.ts +23 -0
- package/dist/comment-send.css +267 -0
- package/dist/comment-thread-CbPtoi8-.js +796 -0
- package/dist/{comment-thread-DKJjmWN0.d.ts → comment-thread-DGm1cGJt.d.ts} +4 -8
- package/dist/{comment-visibility-DsVuVndP.d.ts → comment-visibility-CYctacNx.d.ts} +0 -2
- package/dist/{comments-D0d26ghV.js → comments-C0OdHh_F.js} +5 -8
- package/dist/{comments-D8hulVPy.d.ts → comments-DrE9DU-E.d.ts} +1 -3
- package/dist/{comments-context-C2lOZyQ5.js → comments-context-CrjhleVA.js} +4 -5
- package/dist/{config-Dk67emQt.js → config-DztmAYYn.js} +9 -3
- package/dist/{config-DgxBW013.d.ts → config-xL4EBeXw.d.ts} +11 -4
- package/dist/dark-plus-CXEBSjk4.js +148 -0
- package/dist/dracula-Bvyz6eCo.js +165 -0
- package/dist/dracula-soft-a9indxAQ.js +115 -0
- package/dist/{draw-DzSmD7uo-Dwz8zoH2.js → draw-DzSmD7uo-Cb7s9kxJ.js} +359 -708
- package/dist/drop-field-CNZgwFVO.js +162 -0
- package/dist/{editor-C_wt4RRV.js → editor-CGiEVOnB.js} +44 -6
- package/dist/effects-g4QucvgO.js +2955 -0
- package/dist/{error-diagnostics-SXtnk6bz.js → error-diagnostics-BlgA9rI2.js} +1 -2
- package/dist/everforest-dark-9sVAxG7I.js +99 -0
- package/dist/everforest-light-BocTn_Hd.js +99 -0
- package/dist/{file-tree-C4OYgbV-.js → file-tree-CRFIdtzw.js} +58 -116
- package/dist/{file-tree-DlT9RGhu.d.ts → file-tree-DOtkeBaq.d.ts} +0 -14
- package/dist/{format-orwcdZL_.js → format-Bc9m7-r0.js} +1 -2
- package/dist/{getSingularPatch-Dsb8EgxR.js → getSingularPatch-C7LmmBrW.js} +375 -79
- package/dist/github-dark-BO9SXswM.js +142 -0
- package/dist/github-dark-default-XB_RHfBI.js +90 -0
- package/dist/github-dark-dimmed-BoGxaWUQ.js +137 -0
- package/dist/github-dark-high-contrast-B3X6t2fG.js +137 -0
- package/dist/github-light-D7VHHlUH.js +142 -0
- package/dist/github-light-default-BuDsGtcR.js +137 -0
- package/dist/github-light-high-contrast-GodZiAwh.js +137 -0
- package/dist/gruvbox-dark-hard-CU4LuKJc.js +140 -0
- package/dist/gruvbox-dark-medium-DjAsuXuH.js +140 -0
- package/dist/gruvbox-dark-soft-D3Zttj6R.js +140 -0
- package/dist/gruvbox-light-hard-4M_9onwE.js +140 -0
- package/dist/gruvbox-light-medium-D9QwS4kQ.js +140 -0
- package/dist/gruvbox-light-soft-DhYcfQql.js +140 -0
- package/dist/{handlers-DMl-Na3x.js → handlers-CnbkvXjX.js} +1 -2
- package/dist/headless.d.ts +4 -4
- package/dist/headless.js +1 -1
- package/dist/highlights-C2AbEdDI.js +2630 -0
- package/dist/hold-to-delete-BSMrpE-i.d.ts +49 -0
- package/dist/hold-to-delete-Cludb56v.js +433 -0
- package/dist/horizon-bright-B9u59onx.js +97 -0
- package/dist/horizon-tItY9ATR.js +97 -0
- package/dist/houston-BqKrKNQv.js +207 -0
- package/dist/icon-XZaCUZTG.d.ts +29 -0
- package/dist/{image-preview-C9tdkmEj.js → image-preview-DrLXrHpp.js} +3 -4
- package/dist/{index-CNY1uNTh.d.ts → index-B2cbt3py.d.ts} +3945 -2445
- package/dist/{index-BYRFQfCd.d.ts → index-B_PSX-5h.d.ts} +5 -11
- package/dist/index.d.ts +35 -32
- package/dist/index.js +71 -73
- package/dist/install-Ba9mkkqI.js +16 -0
- package/dist/kanagawa-dragon-BH1K3aMw.js +159 -0
- package/dist/kanagawa-lotus-C-4JB2io.js +159 -0
- package/dist/kanagawa-wave-DTQqNe5k.js +159 -0
- package/dist/laserwave-BkV0uIaG.js +84 -0
- package/dist/light-plus-CxYgEz7U.js +149 -0
- package/dist/list-DUTAo0uC.js +270 -0
- package/dist/loader-CYMEjzwc.js +79 -0
- package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-3gY9MLvy.js} +237 -38
- package/dist/{markdown-editor-wQF0yD5o.d.ts → markdown-editor-B7gD60tp.d.ts} +0 -6
- package/dist/markdown-editor.d.ts +1 -5
- package/dist/markdown-editor.js +2 -2
- package/dist/markdown-renderer-DFS1vf1h.js +26578 -0
- package/dist/material-theme-Xdm37UUJ.js +105 -0
- package/dist/material-theme-darker-Blaz0cgN.js +105 -0
- package/dist/material-theme-lighter-BddVxBVA.js +105 -0
- package/dist/material-theme-ocean-C4qhfFHi.js +105 -0
- package/dist/material-theme-palenight-ChHDqoiA.js +105 -0
- package/dist/{message-scroller-jrYN9dG9.d.ts → message-scroller-a6qaYHno.d.ts} +2 -4
- package/dist/min-dark-DpGSNjaW.js +125 -0
- package/dist/min-light-BMfJUsU2.js +122 -0
- package/dist/monokai-DW19E-zg.js +162 -0
- package/dist/motion/core.d.ts +4 -0
- package/dist/motion/core.js +11 -0
- package/dist/motion-core-DNl7TR1T.d.ts +402 -0
- package/dist/motion.d.ts +14 -0
- package/dist/motion.js +13 -0
- package/dist/night-owl-B7Of8ee9.js +188 -0
- package/dist/night-owl-light-Vu9tTNpS.js +189 -0
- package/dist/nord-CDzJumeN.js +128 -0
- package/dist/nuxt-ui-7ByUrymx.js +43 -0
- package/dist/nuxt.d.ts +1 -7
- package/dist/nuxt.js +16 -11
- package/dist/one-dark-pro-hS_sNo5p.js +124 -0
- package/dist/one-light-CD4ItzSC.js +153 -0
- package/dist/opt-out-D66l60sg.js +205 -0
- package/dist/parts/components/agent-session.d.ts +1 -3
- package/dist/parts/components/agent-session.js +3 -4
- package/dist/parts/components/attachment.d.ts +2 -4
- package/dist/parts/components/attachment.js +3 -4
- package/dist/parts/components/avatar-stack.d.ts +1 -1
- package/dist/parts/components/avatar-stack.js +4 -4
- package/dist/parts/components/bubble.d.ts +2 -4
- package/dist/parts/components/bubble.js +2 -3
- package/dist/parts/components/chat-message.d.ts +1 -3
- package/dist/parts/components/chat-message.js +1 -2
- package/dist/parts/components/chat-session.d.ts +2 -4
- package/dist/parts/components/chat-session.js +1 -2
- package/dist/parts/components/chat.d.ts +1 -3
- package/dist/parts/components/chat.js +4 -5
- package/dist/parts/components/code-block.d.ts +2 -4
- package/dist/parts/components/code-block.js +3 -4
- package/dist/parts/components/code-view.d.ts +1 -3
- package/dist/parts/components/code-view.js +1 -2
- package/dist/parts/components/comment-composer.d.ts +1 -1
- package/dist/parts/components/comment-composer.js +1 -2
- package/dist/parts/components/comment-layer.d.ts +1 -1
- package/dist/parts/components/comment-layer.js +28 -11
- package/dist/parts/components/comment-list.d.ts +1 -1
- package/dist/parts/components/comment-list.js +13 -9
- package/dist/parts/components/comment-panel.d.ts +1 -1
- package/dist/parts/components/comment-panel.js +27 -14
- package/dist/parts/components/comment-pin.d.ts +1 -1
- package/dist/parts/components/comment-pin.js +2 -3
- package/dist/parts/components/comment-selection-bar.d.ts +1 -1
- package/dist/parts/components/comment-selection-bar.js +4 -4
- package/dist/parts/components/comment-send.d.ts +2 -0
- package/dist/parts/components/comment-send.js +1 -0
- package/dist/parts/components/comment-thread.d.ts +1 -1
- package/dist/parts/components/comment-thread.js +2 -597
- package/dist/parts/components/comments.d.ts +9 -8
- package/dist/parts/components/comments.js +7 -6
- package/dist/parts/components/connection-status.d.ts +1 -3
- package/dist/parts/components/connection-status.js +1 -2
- package/dist/parts/components/copy-button.d.ts +14 -6
- package/dist/parts/components/copy-button.js +225 -1
- package/dist/parts/components/device-frame.d.ts +3 -5
- package/dist/parts/components/device-frame.js +1 -2
- package/dist/parts/components/drop-field.d.ts +67 -0
- package/dist/parts/components/drop-field.js +76 -0
- package/dist/parts/components/file-tree.d.ts +1 -1
- package/dist/parts/components/file-tree.js +1 -2
- package/dist/parts/components/filter-search.d.ts +2 -4
- package/dist/parts/components/filter-search.js +2 -3
- package/dist/parts/components/hold-to-delete.d.ts +80 -0
- package/dist/parts/components/hold-to-delete.js +75 -0
- package/dist/parts/components/markdown-editor.d.ts +1 -1
- package/dist/parts/components/markdown-editor.js +1 -2
- package/dist/parts/components/markdown-renderer.d.ts +1 -3
- package/dist/parts/components/markdown-renderer.js +1 -23077
- package/dist/parts/components/markdown.d.ts +1 -3
- package/dist/parts/components/markdown.js +2 -3
- package/dist/parts/components/marker.d.ts +2 -4
- package/dist/parts/components/marker.js +2 -3
- package/dist/parts/components/message-parts.d.ts +1 -3
- package/dist/parts/components/message-parts.js +14 -7
- package/dist/parts/components/message.d.ts +1 -3
- package/dist/parts/components/message.js +2 -3
- package/dist/parts/components/motion-list.d.ts +40 -0
- package/dist/parts/components/motion-list.js +41 -0
- package/dist/parts/components/motion.d.ts +122 -0
- package/dist/parts/components/motion.js +171 -0
- package/dist/parts/components/patch-parsers.d.ts +1 -1
- package/dist/parts/components/patch-parsers.js +1 -2
- package/dist/parts/components/progress.d.ts +39 -0
- package/dist/parts/components/progress.js +53 -0
- package/dist/parts/components/prompt-input.d.ts +5 -7
- package/dist/parts/components/prompt-input.js +5 -6
- package/dist/parts/components/relative-time.d.ts +1 -3
- package/dist/parts/components/relative-time.js +1 -2
- package/dist/parts/components/status.d.ts +1 -3
- package/dist/parts/components/status.js +1 -2
- package/dist/parts/components/sync-status.d.ts +1 -3
- package/dist/parts/components/sync-status.js +3 -3
- package/dist/parts/components/tool-list.d.ts +2 -4
- package/dist/parts/components/tool-list.js +2 -3
- package/dist/parts/components/trace-run.d.ts +2 -4
- package/dist/parts/components/trace-run.js +4 -5
- package/dist/parts/components/trace.d.ts +2 -4
- package/dist/parts/components/trace.js +2 -3
- package/dist/parts/composables/attachments.d.ts +1 -3
- package/dist/parts/composables/attachments.js +1 -2
- package/dist/parts/composables/highlighted-code.d.ts +1 -3
- package/dist/parts/composables/highlighted-code.js +1 -2
- package/dist/parts/headless/choices-input.d.ts +1 -1
- package/dist/parts/headless/choices-input.js +3 -4
- package/dist/parts/headless/comment-visibility.d.ts +1 -1
- package/dist/parts/headless/comment-visibility.js +1 -2
- package/dist/parts/headless/comments.d.ts +1 -1
- package/dist/parts/headless/comments.js +1 -2
- package/dist/parts/headless/message-scroller.d.ts +1 -1
- package/dist/parts/headless/message-scroller.js +2 -3
- package/dist/parts/playground/paths.d.ts +1 -3
- package/dist/parts/playground/paths.js +1 -2
- package/dist/parts/playground/share.d.ts +34 -2
- package/dist/parts/playground/share.js +1 -2
- package/dist/parts/playground/zip.d.ts +1 -3
- package/dist/parts/playground/zip.js +2 -3
- package/dist/parts/workspace/browser-support-notice.d.ts +2 -4
- package/dist/parts/workspace/browser-support-notice.js +13 -6
- package/dist/parts/workspace/codemirror.d.ts +10 -3
- package/dist/parts/workspace/codemirror.js +40 -8
- package/dist/parts/workspace/connect-panel.d.ts +2 -4
- package/dist/parts/workspace/connect-panel.js +2 -3
- package/dist/parts/workspace/connect-store.d.ts +1 -3
- package/dist/parts/workspace/connect-store.js +1 -2
- package/dist/parts/workspace/file-icons.d.ts +14 -0
- package/dist/parts/workspace/file-icons.js +81 -0
- package/dist/parts/workspace/icons.d.ts +2 -2
- package/dist/parts/workspace/icons.js +2 -2
- package/dist/parts/workspace/runners/render.d.ts +24 -0
- package/dist/parts/workspace/runners/render.js +123 -0
- package/dist/parts/workspace/runners/web-container.d.ts +27 -0
- package/dist/parts/workspace/runners/web-container.js +185 -0
- package/dist/parts/workspace/workspace-bar.d.ts +49 -0
- package/dist/parts/workspace/workspace-bar.js +50 -0
- package/dist/parts/workspace/workspace-boot-status.d.ts +1 -2
- package/dist/parts/workspace/workspace-boot-status.js +2 -3
- package/dist/parts/workspace/workspace-editor-head.d.ts +45 -0
- package/dist/parts/workspace/workspace-editor-head.js +65 -0
- package/dist/parts/workspace/workspace-editor.d.ts +18 -3
- package/dist/parts/workspace/workspace-editor.js +30 -5
- package/dist/parts/workspace/workspace-examples.d.ts +72 -0
- package/dist/parts/workspace/workspace-examples.js +71 -0
- package/dist/parts/workspace/workspace-file-link.d.ts +33 -0
- package/dist/parts/workspace/workspace-file-link.js +38 -0
- package/dist/parts/workspace/workspace-file-tree.d.ts +9 -11
- package/dist/parts/workspace/workspace-file-tree.js +28 -22
- package/dist/parts/workspace/workspace-guide.d.ts +50 -0
- package/dist/parts/workspace/workspace-guide.js +90 -0
- package/dist/parts/workspace/workspace-issues.d.ts +44 -0
- package/dist/parts/workspace/workspace-issues.js +48 -0
- package/dist/parts/workspace/workspace-preview.d.ts +1 -3
- package/dist/parts/workspace/workspace-preview.js +2 -3
- package/dist/parts/workspace/workspace-shell.d.ts +2 -88
- package/dist/parts/workspace/workspace-shell.js +132 -80
- package/dist/parts/workspace/workspace-sidebar.d.ts +73 -0
- package/dist/parts/workspace/workspace-sidebar.js +131 -0
- package/dist/parts/workspace/workspace-start.d.ts +45 -0
- package/dist/parts/workspace/workspace-start.js +59 -0
- package/dist/parts/workspace/workspace-status.d.ts +67 -0
- package/dist/parts/workspace/workspace-status.js +73 -0
- package/dist/parts/workspace/workspace-steps.d.ts +2 -0
- package/dist/parts/workspace/workspace-steps.js +127 -0
- package/dist/parts/workspace/workspace-task.d.ts +18 -0
- package/dist/parts/workspace/workspace-task.js +19 -0
- package/dist/parts/workspace/workspace-terminal.d.ts +1 -3
- package/dist/parts/workspace/workspace-terminal.js +1 -2
- package/dist/parts/workspace/workspace.d.ts +249 -0
- package/dist/parts/workspace/workspace.js +664 -0
- package/dist/{payload-text-sjkYAwvw.js → payload-text-DQNRbJY5.js} +1 -2
- package/dist/{pierre-code-view-NE35tkmR.js → pierre-code-view-C49BVDrc.js} +11333 -6718
- package/dist/pierre-dark-BtKHt2e4.js +166 -0
- package/dist/pierre-dark-CXW3KeKO.js +5 -0
- package/dist/pierre-dark-protanopia-deuteranopia-CS0Gs25Q.js +166 -0
- package/dist/pierre-dark-protanopia-deuteranopia-DajNv_A3.js +3 -0
- package/dist/pierre-dark-soft-BUFoeBEf.js +3 -0
- package/dist/pierre-dark-soft-D__0FtYP.js +166 -0
- package/dist/pierre-dark-tritanopia-C6fHROmA.js +166 -0
- package/dist/pierre-dark-tritanopia-oa3gpgIR.js +3 -0
- package/dist/pierre-dark-vibrant-COXpyAHb.js +166 -0
- package/dist/pierre-dark-vibrant-CYRHyDoW.js +3 -0
- package/dist/pierre-light-BD28C_vh.js +166 -0
- package/dist/pierre-light-BN0rL1e5.js +5 -0
- package/dist/pierre-light-protanopia-deuteranopia-CYsDHJt0.js +3 -0
- package/dist/pierre-light-protanopia-deuteranopia-CwWH1xGL.js +166 -0
- package/dist/pierre-light-soft-BkKY4pMj.js +166 -0
- package/dist/pierre-light-soft-F2QIpNbb.js +3 -0
- package/dist/pierre-light-tritanopia-BbKKIkua.js +3 -0
- package/dist/pierre-light-tritanopia-Mpubahl7.js +166 -0
- package/dist/pierre-light-vibrant-CdV9Besm.js +3 -0
- package/dist/pierre-light-vibrant-x11J3_aO.js +166 -0
- package/dist/plastic-BQnXkmvK.js +137 -0
- package/dist/playground.d.ts +1 -1
- package/dist/poimandres-DEfG-8RI.js +124 -0
- package/dist/progress-DL9k-ERG.js +265 -0
- package/dist/red-BfKrAjYG.js +169 -0
- package/dist/registry-DAIjCjWd.js +77 -0
- package/dist/{relative-time-BVmjOsYG.js → relative-time-DJnw45tr.js} +5 -8
- package/dist/ring-BN4d8vtw.js +173 -0
- package/dist/{rolldown-runtime-C9mWXvCC.js → rolldown-runtime-CahUhzF3.js} +2 -3
- package/dist/rose-pine-D0rhGGFg.js +136 -0
- package/dist/rose-pine-dawn-7jVaYUiD.js +136 -0
- package/dist/rose-pine-moon-CFyS0Mvu.js +136 -0
- package/dist/runtime/nuxt-plugin.d.ts +0 -2
- package/dist/runtime/nuxt-plugin.js +3 -4
- package/dist/{sankey-CAYwt82B-D4uDQoMR.js → sankey-CAYwt82B-BAAk7WkJ.js} +147 -151
- package/dist/shiki-CbfEu_Az.js +607 -0
- package/dist/slack-dark-Bv-KFSBD.js +87 -0
- package/dist/slack-ochin-Dg2BAv1D.js +107 -0
- package/dist/{slot-part-Doic71uh.js → slot-part-BWHvQ3mK.js} +1 -2
- package/dist/snazzy-light-sYDdR9rx.js +93 -0
- package/dist/solarized-dark-COt2tTmN.js +160 -0
- package/dist/solarized-light-BJrwFarZ.js +160 -0
- package/dist/stream-tokenizer-ByC3l0HQ.js +263 -0
- package/dist/styles.css +590 -573
- package/dist/synthwave-84-NUDBykTM.js +410 -0
- package/dist/{temml-BilSAAws.js → temml-m3ad3bfq.js} +2 -3
- package/dist/text-BWzZFnGY.js +822 -0
- package/dist/theme.d.ts +44 -3
- package/dist/theme.js +23 -9
- package/dist/themes-DKugPHlg.js +323 -0
- package/dist/tokyo-night-DD3B2QcO.js +153 -0
- package/dist/travel-CwVhU_GS.js +180 -0
- package/dist/tween-Dv3IIIQG.js +61 -0
- package/dist/{types-Dj7vp0lZ.d.ts → types-Ceh7h7NT.d.ts} +1 -3
- package/dist/vesper-oVQYrv8Y.js +99 -0
- package/dist/visual-copy-CHHBfJ6O.js +14 -0
- package/dist/vite.d.ts +1 -3
- package/dist/vite.js +13 -3
- package/dist/vitesse-black-D84DQZAP.js +196 -0
- package/dist/vitesse-dark-CMZ6olk_.js +196 -0
- package/dist/vitesse-light-D9d8hLOY.js +196 -0
- package/dist/{vue-DGstVdGn.js → vue-BlknIGIm.js} +43 -34
- package/dist/{vue-BDmSCtay.js → vue-kCdzBu0N.js} +4 -7
- package/dist/workspace-shell-ChCwWPyv.d.ts +110 -0
- package/dist/workspace-steps-BKByX9DW.d.ts +70 -0
- package/dist/workspace.d.ts +16 -5
- package/dist/workspace.js +16 -3
- package/package.json +66 -55
- package/dist/copy-button-CRN3kmSD.js +0 -253
- package/dist/icon-swap.css +0 -69
- package/dist/nuxt-ui-DSQFzq3s.js +0 -38
- package/dist/parts/playground/highlight.d.ts +0 -5
- package/dist/parts/playground/highlight.js +0 -23
- package/dist/parts/playground/playground-render.d.ts +0 -126
- package/dist/parts/playground/playground-render.js +0 -356
- package/dist/parts/workspace/playground-container.d.ts +0 -192
- package/dist/parts/workspace/playground-container.js +0 -603
- package/dist/pierre-dark-CzUmjETS.js +0 -6
- package/dist/pierre-dark-protanopia-deuteranopia-C35UMuvO.js +0 -4
- package/dist/pierre-dark-soft-Bb-4-biO.js +0 -4
- package/dist/pierre-dark-tritanopia-CIJISGWF.js +0 -4
- package/dist/pierre-dark-vibrant-8oZzB3gw.js +0 -4
- package/dist/pierre-light-Dn6E0sWv.js +0 -6
- package/dist/pierre-light-protanopia-deuteranopia-u0U7N4Hn.js +0 -4
- package/dist/pierre-light-soft-BCU6fuhO.js +0 -4
- package/dist/pierre-light-tritanopia-3c8Yx3co.js +0 -4
- package/dist/pierre-light-vibrant-Cwh332o_.js +0 -4
- package/dist/share-DM4eNy4q.d.ts +0 -37
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
import { RollNumber } from "./parts/components/motion.js";
|
|
2
|
+
import { i as consumedPointerEvents, l as swallowNextClick, n as injectComments, o as pathOf, r as commentThreadPortals, s as shakeDirtyComposers, u as useDocumentPointerDown } from "./comments-context-CrjhleVA.js";
|
|
3
|
+
import { n as mentionPlugin, r as mentionTag, t as CommentComposer } from "./comment-composer-CzU7DdfD.js";
|
|
4
|
+
import { a as writerName, o as writerPerson, t as displayName } from "./comment-person-D_IyIjXo.js";
|
|
5
|
+
import { c as messagesSinceResolved, o as commentTitle, s as deliveryAttributes, t as defaultCommentCan } from "./comments-C0OdHh_F.js";
|
|
6
|
+
import { a as useViteHubUIIcons } from "./config-DztmAYYn.js";
|
|
7
|
+
import { t as travel } from "./travel-CwVhU_GS.js";
|
|
8
|
+
import { r as useUIComponent } from "./nuxt-ui-7ByUrymx.js";
|
|
9
|
+
import { Attachment, AttachmentContent, AttachmentGroup, AttachmentMedia, AttachmentTitle } from "./parts/components/attachment.js";
|
|
10
|
+
import { AvatarStack } from "./parts/components/avatar-stack.js";
|
|
11
|
+
import { Markdown } from "./parts/components/markdown.js";
|
|
12
|
+
import { Marker, MarkerContent } from "./parts/components/marker.js";
|
|
13
|
+
import { MotionList } from "./parts/components/motion-list.js";
|
|
14
|
+
import { t as RelativeTime } from "./relative-time-DJnw45tr.js";
|
|
15
|
+
import { computed, defineComponent, h, inject, nextTick, onBeforeUnmount, provide, ref, watch } from "vue";
|
|
16
|
+
// src/internal/image-gallery.ts
|
|
17
|
+
const tileCount = 4;
|
|
18
|
+
/** The box of `width` by `height` that covers `box`, centered on it: the picture with the shape it has full size. */
|
|
19
|
+
function cover(box, width, height) {
|
|
20
|
+
if (!width || !height || !box.width || !box.height) return box;
|
|
21
|
+
const scale = Math.max(box.width / width, box.height / height);
|
|
22
|
+
const w = width * scale;
|
|
23
|
+
const h = height * scale;
|
|
24
|
+
return {
|
|
25
|
+
left: box.left + (box.width - w) / 2,
|
|
26
|
+
top: box.top + (box.height - h) / 2,
|
|
27
|
+
width: w,
|
|
28
|
+
height: h
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The pictures of a comment as a mosaic: one keeps its own shape, two split the width, three put the first beside the
|
|
33
|
+
* other two, and four or more show a grid of four whose last tile says how many more. A click opens the picture full
|
|
34
|
+
* size, travelling from its tile, and the arrow keys and buttons step through every picture of the message. Closing
|
|
35
|
+
* sends the picture back to its tile (docs/design/motion.md, "Something moves to a new place: a picture that zooms").
|
|
36
|
+
*/
|
|
37
|
+
const ImageGallery = defineComponent({
|
|
38
|
+
name: "ImageGallery",
|
|
39
|
+
props: { images: {
|
|
40
|
+
required: true,
|
|
41
|
+
type: Array
|
|
42
|
+
} },
|
|
43
|
+
setup(props) {
|
|
44
|
+
const UModal = useUIComponent("UModal");
|
|
45
|
+
const UButton = useUIComponent("UButton");
|
|
46
|
+
const icons = useViteHubUIIcons();
|
|
47
|
+
const current = ref(null);
|
|
48
|
+
const closing = ref(false);
|
|
49
|
+
const failed = ref(/* @__PURE__ */ new Map());
|
|
50
|
+
const body = ref();
|
|
51
|
+
const portals = inject(commentThreadPortals, void 0);
|
|
52
|
+
portals?.add(body);
|
|
53
|
+
const tiles = [];
|
|
54
|
+
const picture = ref(null);
|
|
55
|
+
let flight;
|
|
56
|
+
const tileOf = (index) => tiles[Math.min(index, 3)];
|
|
57
|
+
const shown = computed(() => current.value === null ? void 0 : props.images[current.value]);
|
|
58
|
+
watch(() => props.images, (images) => {
|
|
59
|
+
failed.value = new Map(images.filter(({ key, src }) => failed.value.get(key) === src).map(({ key, src }) => [key, src]));
|
|
60
|
+
});
|
|
61
|
+
const markFailed = ({ key, src }) => {
|
|
62
|
+
if (props.images.some((image) => image.key === key && image.src === src)) failed.value.set(key, src);
|
|
63
|
+
};
|
|
64
|
+
async function flyIn(index) {
|
|
65
|
+
await nextTick();
|
|
66
|
+
const image = picture.value;
|
|
67
|
+
const tile = tileOf(index);
|
|
68
|
+
if (!image || !tile || current.value !== index) return;
|
|
69
|
+
if (!image.complete) await new Promise((resolve) => image.addEventListener("load", resolve, { once: true }));
|
|
70
|
+
if (current.value !== index || !image.isConnected) return;
|
|
71
|
+
flight = travel(image, { from: cover(tile.getBoundingClientRect(), image.offsetWidth, image.offsetHeight) });
|
|
72
|
+
}
|
|
73
|
+
function open(index) {
|
|
74
|
+
flight?.stop();
|
|
75
|
+
closing.value = false;
|
|
76
|
+
current.value = index;
|
|
77
|
+
flyIn(index);
|
|
78
|
+
}
|
|
79
|
+
async function close() {
|
|
80
|
+
if (current.value === null || closing.value) return;
|
|
81
|
+
const image = picture.value;
|
|
82
|
+
const tile = tileOf(current.value);
|
|
83
|
+
closing.value = true;
|
|
84
|
+
if (image && tile && image.complete && image.naturalWidth) {
|
|
85
|
+
flight = travel(image, { to: cover(tile.getBoundingClientRect(), image.offsetWidth, image.offsetHeight) });
|
|
86
|
+
await flight.done;
|
|
87
|
+
}
|
|
88
|
+
flight?.stop();
|
|
89
|
+
if (!closing.value) return;
|
|
90
|
+
closing.value = false;
|
|
91
|
+
current.value = null;
|
|
92
|
+
}
|
|
93
|
+
function go(step) {
|
|
94
|
+
if (current.value === null || closing.value || props.images.length < 2) return;
|
|
95
|
+
flight?.stop();
|
|
96
|
+
current.value = (current.value + step + props.images.length) % props.images.length;
|
|
97
|
+
}
|
|
98
|
+
onBeforeUnmount(() => {
|
|
99
|
+
flight?.stop();
|
|
100
|
+
portals?.delete(body);
|
|
101
|
+
});
|
|
102
|
+
return () => {
|
|
103
|
+
const count = props.images.length;
|
|
104
|
+
tiles.length = 0;
|
|
105
|
+
const many = count > 1;
|
|
106
|
+
const active = shown.value;
|
|
107
|
+
return h("div", {
|
|
108
|
+
"data-count": Math.min(count, tileCount),
|
|
109
|
+
"data-slot": "comment-reply-images"
|
|
110
|
+
}, [...props.images.slice(0, tileCount).map((image, index) => h("button", {
|
|
111
|
+
"aria-label": `Preview ${image.name}`,
|
|
112
|
+
"data-open": current.value !== null && Math.min(current.value, 3) === index ? "true" : void 0,
|
|
113
|
+
"data-slot": "comment-reply-image",
|
|
114
|
+
key: image.key,
|
|
115
|
+
onClick: () => open(index),
|
|
116
|
+
ref: (element) => {
|
|
117
|
+
if (element instanceof HTMLElement) tiles[index] = element;
|
|
118
|
+
},
|
|
119
|
+
title: image.name,
|
|
120
|
+
type: "button"
|
|
121
|
+
}, [failed.value.get(image.key) === image.src ? h("span", { class: "vh-image-unavailable" }, "Image unavailable") : h("img", {
|
|
122
|
+
alt: "",
|
|
123
|
+
loading: "lazy",
|
|
124
|
+
key: image.src,
|
|
125
|
+
onError: () => markFailed(image),
|
|
126
|
+
src: image.src
|
|
127
|
+
}), index === 3 && count > tileCount ? h("span", {
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
"data-slot": "comment-reply-image-more"
|
|
130
|
+
}, `+${count - tileCount + 1}`) : null])), h(UModal, {
|
|
131
|
+
open: current.value !== null,
|
|
132
|
+
title: shown.value?.name ?? "Image",
|
|
133
|
+
transition: false,
|
|
134
|
+
ui: {
|
|
135
|
+
content: "vh-image-dialog vh-image-gallery",
|
|
136
|
+
overlay: closing.value ? "vh-image-overlay vh-image-overlay--closing" : "vh-image-overlay"
|
|
137
|
+
},
|
|
138
|
+
"onUpdate:open": (value) => {
|
|
139
|
+
if (!value) close();
|
|
140
|
+
}
|
|
141
|
+
}, { content: () => h("div", {
|
|
142
|
+
class: "vh-image-gallery__body",
|
|
143
|
+
ref: body,
|
|
144
|
+
onKeydown: (event) => {
|
|
145
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
go(event.key === "ArrowLeft" ? -1 : 1);
|
|
148
|
+
}
|
|
149
|
+
}, [h("div", {
|
|
150
|
+
class: "vh-image-dialog__toolbar",
|
|
151
|
+
"data-closing": closing.value ? "true" : void 0
|
|
152
|
+
}, [
|
|
153
|
+
h("span", {
|
|
154
|
+
class: "vh-image-dialog__name",
|
|
155
|
+
title: shown.value?.name
|
|
156
|
+
}, shown.value?.name),
|
|
157
|
+
many ? h("span", { class: "vh-image-gallery__count" }, [h(RollNumber, { value: (current.value ?? 0) + 1 }), ` of ${count}`]) : null,
|
|
158
|
+
h(UButton, {
|
|
159
|
+
"aria-label": "Open original image",
|
|
160
|
+
class: "vh-image-dialog__action",
|
|
161
|
+
color: "neutral",
|
|
162
|
+
external: true,
|
|
163
|
+
icon: icons.value.external,
|
|
164
|
+
rel: "noreferrer",
|
|
165
|
+
target: "_blank",
|
|
166
|
+
to: shown.value?.src,
|
|
167
|
+
variant: "ghost"
|
|
168
|
+
}),
|
|
169
|
+
h(UButton, {
|
|
170
|
+
"aria-label": "Close image preview",
|
|
171
|
+
class: "vh-image-dialog__action",
|
|
172
|
+
color: "neutral",
|
|
173
|
+
icon: icons.value.close,
|
|
174
|
+
onClick: () => void close(),
|
|
175
|
+
variant: "ghost"
|
|
176
|
+
})
|
|
177
|
+
]), h("div", { class: "vh-image-gallery__stage" }, [
|
|
178
|
+
many ? h(UButton, {
|
|
179
|
+
"aria-label": "Previous picture",
|
|
180
|
+
class: "vh-image-gallery__step vh-image-gallery__step--previous rounded-full",
|
|
181
|
+
color: "neutral",
|
|
182
|
+
icon: icons.value.chevronLeft,
|
|
183
|
+
onClick: () => go(-1),
|
|
184
|
+
variant: "solid"
|
|
185
|
+
}) : null,
|
|
186
|
+
active && failed.value.get(active.key) === active.src ? h("p", {
|
|
187
|
+
class: "vh-image-dialog__error",
|
|
188
|
+
role: "status"
|
|
189
|
+
}, "Image unavailable. The file may have been moved or deleted.") : h("img", {
|
|
190
|
+
alt: active?.name ?? "",
|
|
191
|
+
class: "vh-image-dialog__image",
|
|
192
|
+
key: active?.src,
|
|
193
|
+
onError: () => active && markFailed(active),
|
|
194
|
+
ref: picture,
|
|
195
|
+
src: active?.src
|
|
196
|
+
}),
|
|
197
|
+
many ? h(UButton, {
|
|
198
|
+
"aria-label": "Next picture",
|
|
199
|
+
class: "vh-image-gallery__step vh-image-gallery__step--next rounded-full",
|
|
200
|
+
color: "neutral",
|
|
201
|
+
icon: icons.value.chevronRight,
|
|
202
|
+
onClick: () => go(1),
|
|
203
|
+
variant: "solid"
|
|
204
|
+
}) : null
|
|
205
|
+
])]) })]);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
// src/components/comment-thread.ts
|
|
210
|
+
const imageExtensions = /* @__PURE__ */ new Set([
|
|
211
|
+
"apng",
|
|
212
|
+
"avif",
|
|
213
|
+
"bmp",
|
|
214
|
+
"gif",
|
|
215
|
+
"heic",
|
|
216
|
+
"jpeg",
|
|
217
|
+
"jpg",
|
|
218
|
+
"png",
|
|
219
|
+
"svg",
|
|
220
|
+
"webp"
|
|
221
|
+
]);
|
|
222
|
+
function reason(error) {
|
|
223
|
+
return error instanceof Error ? error.message : "That did not work. Try again.";
|
|
224
|
+
}
|
|
225
|
+
const fileName = (key) => key.split(/[/\\]/).at(-1) || key;
|
|
226
|
+
function attachmentHref(value) {
|
|
227
|
+
if (!value) return void 0;
|
|
228
|
+
try {
|
|
229
|
+
const { protocol } = new URL(value, "https://vitehub.invalid");
|
|
230
|
+
return protocol === "http:" || protocol === "https:" || protocol === "blob:" ? value : void 0;
|
|
231
|
+
} catch {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function attachmentList(message, url, icon, fileIcon) {
|
|
236
|
+
if (message.attachments.length === 0) return null;
|
|
237
|
+
const items = message.attachments.map((key) => {
|
|
238
|
+
const found = url?.(key);
|
|
239
|
+
const link = typeof found === "string" ? { url: found } : found;
|
|
240
|
+
const name = link?.name || fileName(key);
|
|
241
|
+
const extension = /\.([a-z0-9]+)$/i.exec(name)?.[1]?.toLowerCase();
|
|
242
|
+
const href = attachmentHref(link?.url);
|
|
243
|
+
return {
|
|
244
|
+
href,
|
|
245
|
+
image: href !== void 0 && (link?.type ? link.type.startsWith("image/") : extension === void 0 || imageExtensions.has(extension)),
|
|
246
|
+
key,
|
|
247
|
+
name
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
const images = items.flatMap((item) => item.image && item.href ? [{
|
|
251
|
+
key: item.key,
|
|
252
|
+
name: item.name,
|
|
253
|
+
src: item.href
|
|
254
|
+
}] : []);
|
|
255
|
+
const files = items.filter((item) => !item.image);
|
|
256
|
+
return [images.length > 0 ? h(ImageGallery, { images }) : null, files.length > 0 ? h(AttachmentGroup, { "data-slot": "comment-reply-attachments" }, () => files.map((item) => h(Attachment, {
|
|
257
|
+
key: item.key,
|
|
258
|
+
size: "xs"
|
|
259
|
+
}, () => [h(AttachmentMedia, { variant: "icon" }, () => h(icon, { name: fileIcon })), h(AttachmentContent, () => h(AttachmentTitle, () => item.href ? h("a", {
|
|
260
|
+
href: item.href,
|
|
261
|
+
rel: "noreferrer",
|
|
262
|
+
target: "_blank"
|
|
263
|
+
}, item.name) : item.name))]))) : null];
|
|
264
|
+
}
|
|
265
|
+
const CommentReply = defineComponent({
|
|
266
|
+
name: "CommentReply",
|
|
267
|
+
props: {
|
|
268
|
+
message: {
|
|
269
|
+
required: true,
|
|
270
|
+
type: Object
|
|
271
|
+
},
|
|
272
|
+
/** The signed-in user. A mention of them looks different. Defaults to the user of the comments state. */
|
|
273
|
+
user: { type: Object },
|
|
274
|
+
/** The signed-in user may edit this message. */
|
|
275
|
+
editable: {
|
|
276
|
+
default: false,
|
|
277
|
+
type: Boolean
|
|
278
|
+
},
|
|
279
|
+
/** The signed-in user may delete this message. Defaults to `editable`. */
|
|
280
|
+
deletable: {
|
|
281
|
+
default: void 0,
|
|
282
|
+
type: Boolean
|
|
283
|
+
},
|
|
284
|
+
/** The message, and its author, show in one line without actions. */
|
|
285
|
+
compact: {
|
|
286
|
+
default: false,
|
|
287
|
+
type: Boolean
|
|
288
|
+
},
|
|
289
|
+
/** Deleting asks first. Deleting the first message of a thread deletes the whole thread, so a thread sets it there. */
|
|
290
|
+
confirmDelete: {
|
|
291
|
+
default: false,
|
|
292
|
+
type: Boolean
|
|
293
|
+
},
|
|
294
|
+
/** `sm` sets 14px text and shows Edit and Delete over the end of the name's row. The edit box gets the same size. */
|
|
295
|
+
size: {
|
|
296
|
+
default: "md",
|
|
297
|
+
type: String
|
|
298
|
+
},
|
|
299
|
+
/** People whose `@name` the message may hold, so an edit keeps their mentions and the body marks them. */
|
|
300
|
+
people: {
|
|
301
|
+
default: () => [],
|
|
302
|
+
type: Array
|
|
303
|
+
},
|
|
304
|
+
users: { type: Function },
|
|
305
|
+
/** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
|
|
306
|
+
attachmentUrl: { type: Function },
|
|
307
|
+
/** Saves an edit. Gets `(messageId, body, mentions)`. */
|
|
308
|
+
onEdit: { type: Function },
|
|
309
|
+
/** Deletes the message. Gets `(messageId)`. */
|
|
310
|
+
onDelete: { type: Function }
|
|
311
|
+
},
|
|
312
|
+
slots: Object,
|
|
313
|
+
setup(props, { slots }) {
|
|
314
|
+
const UButton = useUIComponent("UButton");
|
|
315
|
+
const UIcon = useUIComponent("UIcon");
|
|
316
|
+
const icons = useViteHubUIIcons();
|
|
317
|
+
const comments = injectComments();
|
|
318
|
+
const editing = ref(false);
|
|
319
|
+
const confirming = ref(false);
|
|
320
|
+
const busy = ref(false);
|
|
321
|
+
const error = ref();
|
|
322
|
+
const draft = ref("");
|
|
323
|
+
const mentions = ref([]);
|
|
324
|
+
const self = () => props.user?.id ?? comments?.user.value?.id;
|
|
325
|
+
const MentionChip = defineComponent({
|
|
326
|
+
props: {
|
|
327
|
+
label: {
|
|
328
|
+
default: "",
|
|
329
|
+
type: String
|
|
330
|
+
},
|
|
331
|
+
user: {
|
|
332
|
+
default: "",
|
|
333
|
+
type: String
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
setup(chip) {
|
|
337
|
+
return () => props.message.mentions.includes(chip.user) ? h("span", {
|
|
338
|
+
"data-self": chip.user === self() ? "true" : void 0,
|
|
339
|
+
"data-slot": "comment-mention"
|
|
340
|
+
}, `@${chip.label}`) : `@${chip.label}`;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
const bodyComponents = { [mentionTag]: MentionChip };
|
|
344
|
+
const bodyPlugins = computed(() => {
|
|
345
|
+
const known = /* @__PURE__ */ new Map();
|
|
346
|
+
for (const person of [
|
|
347
|
+
...comments?.people.value ?? [],
|
|
348
|
+
...props.people,
|
|
349
|
+
...props.user ? [props.user] : []
|
|
350
|
+
]) known.set(person.id, person);
|
|
351
|
+
const named = props.message.mentions.flatMap((id) => {
|
|
352
|
+
const person = known.get(id);
|
|
353
|
+
return person ? [{
|
|
354
|
+
id,
|
|
355
|
+
name: displayName(person)
|
|
356
|
+
}] : [];
|
|
357
|
+
});
|
|
358
|
+
return [mentionPlugin(named)];
|
|
359
|
+
});
|
|
360
|
+
async function run(task) {
|
|
361
|
+
if (busy.value) return false;
|
|
362
|
+
busy.value = true;
|
|
363
|
+
error.value = void 0;
|
|
364
|
+
try {
|
|
365
|
+
await task();
|
|
366
|
+
return true;
|
|
367
|
+
} catch (cause) {
|
|
368
|
+
error.value = reason(cause);
|
|
369
|
+
return false;
|
|
370
|
+
} finally {
|
|
371
|
+
busy.value = false;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function startEdit() {
|
|
375
|
+
draft.value = props.message.body;
|
|
376
|
+
mentions.value = [...props.message.mentions];
|
|
377
|
+
error.value = void 0;
|
|
378
|
+
editing.value = true;
|
|
379
|
+
}
|
|
380
|
+
async function save(submit) {
|
|
381
|
+
if (!props.onEdit) return;
|
|
382
|
+
const submitted = draft.value;
|
|
383
|
+
const submittedMentions = mentions.value;
|
|
384
|
+
const savedMentions = submit.body === props.message.body ? [.../* @__PURE__ */ new Set([...props.message.mentions, ...submit.mentions])] : submit.mentions;
|
|
385
|
+
if (await run(() => props.onEdit?.(props.message.id, submit.body, savedMentions)) && draft.value === submitted && mentions.value === submittedMentions) editing.value = false;
|
|
386
|
+
}
|
|
387
|
+
const canEdit = () => props.editable && props.onEdit !== void 0;
|
|
388
|
+
const canDelete = () => (props.deletable ?? props.editable) && props.onDelete !== void 0;
|
|
389
|
+
async function remove() {
|
|
390
|
+
if (!props.onDelete) return;
|
|
391
|
+
if (await run(() => props.onDelete?.(props.message.id))) confirming.value = false;
|
|
392
|
+
}
|
|
393
|
+
const statusOf = (message, delivery) => {
|
|
394
|
+
if (!slots.status) return null;
|
|
395
|
+
const outbox = comments?.outbox;
|
|
396
|
+
const current = () => !props.compact && props.message.id === message.id && props.message.delivery !== void 0;
|
|
397
|
+
const mayEdit = () => current() && props.editable;
|
|
398
|
+
const mayDelete = () => current() && (props.deletable ?? props.editable);
|
|
399
|
+
return h("div", { "data-slot": "comment-reply-status" }, slots.status({
|
|
400
|
+
delivery,
|
|
401
|
+
dismiss: outbox?.enabled && mayDelete() ? async () => mayDelete() && await outbox.dismiss(message.id) : void 0,
|
|
402
|
+
edit: outbox?.enabled && mayEdit() ? async (body, mentions) => mayEdit() && await outbox.edit(message.id, body, mentions) : void 0,
|
|
403
|
+
message,
|
|
404
|
+
retry: outbox?.enabled && mayEdit() ? async () => {
|
|
405
|
+
if (mayEdit()) await outbox.retry(message.id);
|
|
406
|
+
} : void 0
|
|
407
|
+
}));
|
|
408
|
+
};
|
|
409
|
+
return () => {
|
|
410
|
+
const { message } = props;
|
|
411
|
+
return h("div", {
|
|
412
|
+
"data-compact": props.compact ? "true" : void 0,
|
|
413
|
+
"data-editing": editing.value ? "true" : void 0,
|
|
414
|
+
...deliveryAttributes(message.delivery),
|
|
415
|
+
"data-size": props.size,
|
|
416
|
+
"data-slot": "comment-reply"
|
|
417
|
+
}, [h("div", { "data-slot": "comment-reply-content" }, [
|
|
418
|
+
h("div", { "data-slot": "comment-reply-header" }, [
|
|
419
|
+
h(AvatarStack, {
|
|
420
|
+
"aria-hidden": "true",
|
|
421
|
+
people: [writerPerson(message)],
|
|
422
|
+
size: "sm"
|
|
423
|
+
}),
|
|
424
|
+
h("span", {
|
|
425
|
+
"data-agent": message.actor ? "true" : void 0,
|
|
426
|
+
"data-slot": "comment-reply-author"
|
|
427
|
+
}, writerName(message)),
|
|
428
|
+
h(RelativeTime, {
|
|
429
|
+
at: message.createdAt,
|
|
430
|
+
"data-slot": "comment-reply-time"
|
|
431
|
+
}),
|
|
432
|
+
message.editedAt ? h("span", { "data-slot": "comment-reply-edited" }, "edited") : null
|
|
433
|
+
]),
|
|
434
|
+
editing.value ? h(CommentComposer, {
|
|
435
|
+
autofocus: true,
|
|
436
|
+
busy: busy.value,
|
|
437
|
+
error: error.value,
|
|
438
|
+
layout: "row",
|
|
439
|
+
mentions: mentions.value,
|
|
440
|
+
modelValue: draft.value,
|
|
441
|
+
onCancel: () => {
|
|
442
|
+
if (!busy.value) editing.value = false;
|
|
443
|
+
},
|
|
444
|
+
onSubmit: save,
|
|
445
|
+
"onUpdate:mentions": (value) => mentions.value = value,
|
|
446
|
+
"onUpdate:modelValue": (value) => draft.value = value,
|
|
447
|
+
people: props.people,
|
|
448
|
+
size: props.size,
|
|
449
|
+
users: props.users,
|
|
450
|
+
variant: "edit"
|
|
451
|
+
}, {
|
|
452
|
+
...slots["mention-item"] ? { "mention-item": slots["mention-item"] } : {},
|
|
453
|
+
...slots["mention-empty"] ? { "mention-empty": slots["mention-empty"] } : {}
|
|
454
|
+
}) : slots.body?.({ message }) ?? h(Markdown, {
|
|
455
|
+
components: bodyComponents,
|
|
456
|
+
"data-slot": "comment-reply-body",
|
|
457
|
+
plugins: bodyPlugins.value,
|
|
458
|
+
value: message.body
|
|
459
|
+
}),
|
|
460
|
+
editing.value || props.compact ? null : slots.attachments?.({ message }) ?? attachmentList(message, props.attachmentUrl, UIcon, icons.value.file),
|
|
461
|
+
!editing.value && message.delivery ? statusOf(message, message.delivery) : null,
|
|
462
|
+
confirming.value ? h("div", {
|
|
463
|
+
"aria-label": "Confirm delete",
|
|
464
|
+
"data-slot": "comment-reply-confirm",
|
|
465
|
+
role: "group"
|
|
466
|
+
}, [
|
|
467
|
+
h("p", "Delete this comment and every reply to it?"),
|
|
468
|
+
h(UButton, {
|
|
469
|
+
color: "error",
|
|
470
|
+
label: "Delete thread",
|
|
471
|
+
loading: busy.value,
|
|
472
|
+
onClick: remove,
|
|
473
|
+
size: "xs"
|
|
474
|
+
}),
|
|
475
|
+
h(UButton, {
|
|
476
|
+
color: "neutral",
|
|
477
|
+
label: "Cancel",
|
|
478
|
+
onClick: () => confirming.value = false,
|
|
479
|
+
size: "xs",
|
|
480
|
+
variant: "ghost"
|
|
481
|
+
})
|
|
482
|
+
]) : null,
|
|
483
|
+
!editing.value && error.value ? h("p", {
|
|
484
|
+
"data-slot": "comment-reply-error",
|
|
485
|
+
role: "alert"
|
|
486
|
+
}, error.value) : null
|
|
487
|
+
]), (canEdit() || canDelete()) && !editing.value && !confirming.value && !props.compact ? h("div", { "data-slot": "comment-reply-actions" }, [canEdit() ? h(UButton, {
|
|
488
|
+
"aria-label": "Edit",
|
|
489
|
+
color: "neutral",
|
|
490
|
+
icon: icons.value.edit,
|
|
491
|
+
onClick: startEdit,
|
|
492
|
+
size: "xs",
|
|
493
|
+
variant: "ghost"
|
|
494
|
+
}) : null, canDelete() ? h(UButton, {
|
|
495
|
+
"aria-label": "Delete",
|
|
496
|
+
color: "neutral",
|
|
497
|
+
icon: icons.value.delete,
|
|
498
|
+
onClick: () => props.confirmDelete ? confirming.value = true : void remove(),
|
|
499
|
+
size: "xs",
|
|
500
|
+
variant: "ghost"
|
|
501
|
+
}) : null]) : null]);
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
/** "Resolved by Ana", or "Resolved by Claude (Ana)" when her agent did, as a line across the thread. */
|
|
506
|
+
const resolvedMarker = (thread) => h(Marker, {
|
|
507
|
+
key: "resolved",
|
|
508
|
+
variant: "separator"
|
|
509
|
+
}, () => h(MarkerContent, () => `Resolved${thread.resolvedBy ? ` by ${writerName({
|
|
510
|
+
author: thread.resolvedBy,
|
|
511
|
+
...thread.resolvedActor ? { actor: thread.resolvedActor } : {}
|
|
512
|
+
})}` : ""}`));
|
|
513
|
+
const CommentThread = defineComponent({
|
|
514
|
+
name: "CommentThread",
|
|
515
|
+
props: {
|
|
516
|
+
thread: {
|
|
517
|
+
required: true,
|
|
518
|
+
type: Object
|
|
519
|
+
},
|
|
520
|
+
/** The signed-in user. Their messages can be edited and deleted. */
|
|
521
|
+
user: { type: Object },
|
|
522
|
+
/** A read-only card for hovering a pin. */
|
|
523
|
+
preview: {
|
|
524
|
+
default: false,
|
|
525
|
+
type: Boolean
|
|
526
|
+
},
|
|
527
|
+
/** Keep the full thread readable without reply, edit, delete, or status controls. */
|
|
528
|
+
readOnly: {
|
|
529
|
+
default: false,
|
|
530
|
+
type: Boolean
|
|
531
|
+
},
|
|
532
|
+
/** What the signed-in user may do: reply, resolve, edit, or delete. Defaults to the `can` of the comments state. */
|
|
533
|
+
can: { type: Function },
|
|
534
|
+
/** Show a reply as being sent, on top of the thread's own tracking. */
|
|
535
|
+
busy: {
|
|
536
|
+
default: false,
|
|
537
|
+
type: Boolean
|
|
538
|
+
},
|
|
539
|
+
/** An error to show, on top of the ones from the handlers. */
|
|
540
|
+
error: { type: String },
|
|
541
|
+
/** The thread is no longer on the page, so no pin shows where it was. */
|
|
542
|
+
detached: {
|
|
543
|
+
default: false,
|
|
544
|
+
type: Boolean
|
|
545
|
+
},
|
|
546
|
+
/** People that messages may mention, on top of the authors of the thread. Their mentions show as chips. */
|
|
547
|
+
people: {
|
|
548
|
+
default: () => [],
|
|
549
|
+
type: Array
|
|
550
|
+
},
|
|
551
|
+
/** Finds people for `@mentions`. Defaults to the comments state, searching the people who may be mentioned in this thread. */
|
|
552
|
+
users: { type: Function },
|
|
553
|
+
/** The reply box takes files. `onReply` gets them. */
|
|
554
|
+
attachments: {
|
|
555
|
+
default: true,
|
|
556
|
+
type: Boolean
|
|
557
|
+
},
|
|
558
|
+
/** The file types that the reply box takes, such as `image/*`. */
|
|
559
|
+
accept: { type: String },
|
|
560
|
+
/** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
|
|
561
|
+
attachmentUrl: { type: Function },
|
|
562
|
+
/** `"back"` shows a Back button at the start of the header instead of Close, for a thread inside a list. Both emit `close`. */
|
|
563
|
+
navigation: {
|
|
564
|
+
default: "close",
|
|
565
|
+
type: String
|
|
566
|
+
},
|
|
567
|
+
/** A click outside the thread closes it. Turn it off when the thread is part of a panel. */
|
|
568
|
+
dismissible: {
|
|
569
|
+
default: true,
|
|
570
|
+
type: Boolean
|
|
571
|
+
},
|
|
572
|
+
/** `sm` is a compact thread for a small floating card: 14px text, tighter rows, and a compact reply box. */
|
|
573
|
+
size: {
|
|
574
|
+
default: "md",
|
|
575
|
+
type: String
|
|
576
|
+
},
|
|
577
|
+
/** Sends a reply. Gets `(body, mentions, files)`. */
|
|
578
|
+
onReply: { type: Function },
|
|
579
|
+
/** Saves an edited message. Gets `(messageId, body, mentions)`. */
|
|
580
|
+
onEdit: { type: Function },
|
|
581
|
+
/** Deletes a message. Gets `(messageId)`. Deleting the first message deletes the thread. */
|
|
582
|
+
onDelete: { type: Function },
|
|
583
|
+
onResolve: { type: Function },
|
|
584
|
+
onReopen: { type: Function }
|
|
585
|
+
},
|
|
586
|
+
emits: ["close"],
|
|
587
|
+
slots: Object,
|
|
588
|
+
setup(props, { emit, expose, slots }) {
|
|
589
|
+
const UButton = useUIComponent("UButton");
|
|
590
|
+
const icons = useViteHubUIIcons();
|
|
591
|
+
const comments = injectComments();
|
|
592
|
+
const root = ref(null);
|
|
593
|
+
const reply = ref("");
|
|
594
|
+
const mentions = ref([]);
|
|
595
|
+
const files = ref([]);
|
|
596
|
+
const sending = ref(false);
|
|
597
|
+
const failure = ref();
|
|
598
|
+
const composer = ref(null);
|
|
599
|
+
const portals = /* @__PURE__ */ new Set();
|
|
600
|
+
provide(commentThreadPortals, portals);
|
|
601
|
+
const user = computed(() => props.user ?? comments?.user.value);
|
|
602
|
+
const users = computed(() => props.users ?? (comments ? (query) => comments.users(query, props.thread.id) : void 0));
|
|
603
|
+
const allowed = (action, message) => !props.readOnly && (props.can ?? comments?.can ?? defaultCommentCan(user.value))(action, {
|
|
604
|
+
message,
|
|
605
|
+
thread: props.thread
|
|
606
|
+
});
|
|
607
|
+
const people = computed(() => {
|
|
608
|
+
const seen = /* @__PURE__ */ new Map();
|
|
609
|
+
for (const person of [
|
|
610
|
+
...props.people,
|
|
611
|
+
props.thread.author,
|
|
612
|
+
...props.thread.messages.map((message) => message.author),
|
|
613
|
+
...user.value ? [user.value] : []
|
|
614
|
+
]) seen.set(person.id, person);
|
|
615
|
+
return [...seen.values()];
|
|
616
|
+
});
|
|
617
|
+
const participants = computed(() => [.../* @__PURE__ */ new Set([props.thread.author.id, ...props.thread.messages.map((message) => message.author.id)])]);
|
|
618
|
+
useDocumentPointerDown((event) => {
|
|
619
|
+
const path = pathOf(event);
|
|
620
|
+
if (props.preview || !props.dismissible || !root.value || path.includes(root.value)) return;
|
|
621
|
+
for (const portal of portals) if (portal.value && path.includes(portal.value)) return;
|
|
622
|
+
if (path.some((element) => element.matches("[data-slot='comment-pin']")) || consumedPointerEvents.has(event)) return;
|
|
623
|
+
consumedPointerEvents.add(event);
|
|
624
|
+
const where = root.value.getRootNode();
|
|
625
|
+
if (shakeDirtyComposers(where instanceof ShadowRoot ? where : document)) {
|
|
626
|
+
event.stopPropagation();
|
|
627
|
+
swallowNextClick();
|
|
628
|
+
} else emit("close");
|
|
629
|
+
});
|
|
630
|
+
async function send(submit) {
|
|
631
|
+
if (sending.value || !props.onReply) return;
|
|
632
|
+
sending.value = true;
|
|
633
|
+
failure.value = void 0;
|
|
634
|
+
const submitted = reply.value;
|
|
635
|
+
const submittedMentions = mentions.value;
|
|
636
|
+
const submittedFiles = files.value;
|
|
637
|
+
try {
|
|
638
|
+
await props.onReply(submit.body, [...submit.mentions], [...submit.files]);
|
|
639
|
+
if (reply.value === submitted && mentions.value === submittedMentions && files.value === submittedFiles) {
|
|
640
|
+
reply.value = "";
|
|
641
|
+
mentions.value = [];
|
|
642
|
+
files.value = [];
|
|
643
|
+
}
|
|
644
|
+
nextTick(() => composer.value?.focus());
|
|
645
|
+
} catch (cause) {
|
|
646
|
+
failure.value = reason(cause);
|
|
647
|
+
} finally {
|
|
648
|
+
sending.value = false;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
async function act(task) {
|
|
652
|
+
if (root.value && shakeDirtyComposers(root.value)) return;
|
|
653
|
+
failure.value = void 0;
|
|
654
|
+
try {
|
|
655
|
+
await task?.();
|
|
656
|
+
} catch (cause) {
|
|
657
|
+
failure.value = reason(cause);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function close() {
|
|
661
|
+
if (root.value && shakeDirtyComposers(root.value)) return;
|
|
662
|
+
emit("close");
|
|
663
|
+
}
|
|
664
|
+
expose({ close });
|
|
665
|
+
const replySlots = () => ({
|
|
666
|
+
...slots.body ? { body: slots.body } : {},
|
|
667
|
+
...slots.attachments ? { attachments: slots.attachments } : {},
|
|
668
|
+
...slots.status ? { status: slots.status } : {},
|
|
669
|
+
...slots["mention-item"] ? { "mention-item": slots["mention-item"] } : {},
|
|
670
|
+
...slots["mention-empty"] ? { "mention-empty": slots["mention-empty"] } : {}
|
|
671
|
+
});
|
|
672
|
+
const composerSlots = () => ({
|
|
673
|
+
...slots.extra ? { extra: slots.extra } : {},
|
|
674
|
+
...slots["mention-item"] ? { "mention-item": slots["mention-item"] } : {},
|
|
675
|
+
...slots["mention-empty"] ? { "mention-empty": slots["mention-empty"] } : {}
|
|
676
|
+
});
|
|
677
|
+
return () => {
|
|
678
|
+
const { thread } = props;
|
|
679
|
+
const resolved = thread.status === "resolved";
|
|
680
|
+
const later = messagesSinceResolved(thread);
|
|
681
|
+
const resolvable = !resolved || later.length > 0;
|
|
682
|
+
const first = thread.messages[0];
|
|
683
|
+
const quote = thread.anchor.kind === "text" ? thread.anchor.exact : void 0;
|
|
684
|
+
if (props.preview) {
|
|
685
|
+
const replies = thread.messages.length - 1;
|
|
686
|
+
return h("div", {
|
|
687
|
+
...deliveryAttributes(thread.delivery),
|
|
688
|
+
"data-preview": "true",
|
|
689
|
+
"data-size": props.size,
|
|
690
|
+
"data-slot": "comment-thread",
|
|
691
|
+
"data-status": thread.status
|
|
692
|
+
}, [first ? h(CommentReply, {
|
|
693
|
+
compact: true,
|
|
694
|
+
message: first,
|
|
695
|
+
people: people.value,
|
|
696
|
+
size: props.size,
|
|
697
|
+
user: user.value
|
|
698
|
+
}, {
|
|
699
|
+
...slots.body ? { body: slots.body } : {},
|
|
700
|
+
...slots.status ? { status: slots.status } : {}
|
|
701
|
+
}) : null, replies > 0 ? h("p", { "data-slot": "comment-thread-count" }, [h(RollNumber, { value: replies }), replies === 1 ? " reply" : " replies"]) : null]);
|
|
702
|
+
}
|
|
703
|
+
const back = props.navigation === "back";
|
|
704
|
+
const anchor = slots.anchor ? slots.anchor({ thread }) : quote ? h("blockquote", { "data-slot": "comment-thread-quote" }, quote) : null;
|
|
705
|
+
return h("section", {
|
|
706
|
+
"aria-label": commentTitle(thread),
|
|
707
|
+
...deliveryAttributes(thread.delivery),
|
|
708
|
+
"data-size": props.size,
|
|
709
|
+
"data-slot": "comment-thread",
|
|
710
|
+
"data-status": thread.status,
|
|
711
|
+
ref: root,
|
|
712
|
+
role: "dialog",
|
|
713
|
+
tabindex: -1
|
|
714
|
+
}, [
|
|
715
|
+
h("header", { "data-slot": "comment-thread-header" }, [
|
|
716
|
+
back ? h(UButton, {
|
|
717
|
+
"aria-label": "Back to comments",
|
|
718
|
+
color: "neutral",
|
|
719
|
+
icon: icons.value.arrowLeft,
|
|
720
|
+
onClick: close,
|
|
721
|
+
size: "xs",
|
|
722
|
+
variant: "ghost"
|
|
723
|
+
}) : null,
|
|
724
|
+
h("span", { "data-slot": "comment-thread-title" }, commentTitle(thread)),
|
|
725
|
+
h("span", { "data-slot": "comment-thread-spacer" }),
|
|
726
|
+
slots.actions ? h("div", { "data-slot": "comment-thread-actions" }, slots.actions({ thread })) : null,
|
|
727
|
+
!allowed("resolve") ? null : h(UButton, {
|
|
728
|
+
"aria-label": resolvable ? "Resolve" : "Reopen",
|
|
729
|
+
color: "neutral",
|
|
730
|
+
icon: resolvable ? icons.value.check : icons.value.reopen,
|
|
731
|
+
onClick: () => void act(resolvable ? props.onResolve : props.onReopen),
|
|
732
|
+
size: "xs",
|
|
733
|
+
variant: "ghost"
|
|
734
|
+
}),
|
|
735
|
+
back ? null : h(UButton, {
|
|
736
|
+
"aria-label": "Close",
|
|
737
|
+
color: "neutral",
|
|
738
|
+
icon: icons.value.close,
|
|
739
|
+
onClick: close,
|
|
740
|
+
size: "xs",
|
|
741
|
+
variant: "ghost"
|
|
742
|
+
})
|
|
743
|
+
]),
|
|
744
|
+
h(MotionList, { "data-slot": "comment-thread-messages" }, () => [
|
|
745
|
+
anchor,
|
|
746
|
+
props.detached ? h("p", {
|
|
747
|
+
"data-slot": "comment-thread-detached",
|
|
748
|
+
role: "status"
|
|
749
|
+
}, "The place of this comment is no longer on the page.") : null,
|
|
750
|
+
...thread.messages.flatMap((message, index) => [resolved && message === later[0] ? resolvedMarker(thread) : null, h(CommentReply, {
|
|
751
|
+
attachmentUrl: props.attachmentUrl,
|
|
752
|
+
confirmDelete: index === 0,
|
|
753
|
+
deletable: allowed("delete", message),
|
|
754
|
+
editable: allowed("edit", message),
|
|
755
|
+
key: message.id,
|
|
756
|
+
message,
|
|
757
|
+
onDelete: props.onDelete,
|
|
758
|
+
onEdit: props.onEdit,
|
|
759
|
+
people: people.value,
|
|
760
|
+
size: props.size,
|
|
761
|
+
user: user.value,
|
|
762
|
+
users: users.value
|
|
763
|
+
}, replySlots())]),
|
|
764
|
+
resolved && later.length === 0 ? resolvedMarker(thread) : null,
|
|
765
|
+
slots.after ? h("div", { "data-slot": "comment-thread-after" }, slots.after({ thread })) : null
|
|
766
|
+
]),
|
|
767
|
+
!allowed("reply") && (failure.value ?? props.error) ? h("p", { role: "alert" }, failure.value ?? props.error) : null,
|
|
768
|
+
!allowed("reply") ? null : h(CommentComposer, {
|
|
769
|
+
accept: props.accept,
|
|
770
|
+
attachments: props.attachments,
|
|
771
|
+
autofocus: false,
|
|
772
|
+
busy: props.busy || sending.value,
|
|
773
|
+
error: failure.value ?? props.error,
|
|
774
|
+
files: files.value,
|
|
775
|
+
guard: false,
|
|
776
|
+
layout: "row",
|
|
777
|
+
mentions: mentions.value,
|
|
778
|
+
modelValue: reply.value,
|
|
779
|
+
onCancel: close,
|
|
780
|
+
onSubmit: send,
|
|
781
|
+
participants: participants.value,
|
|
782
|
+
"onUpdate:files": (value) => files.value = value,
|
|
783
|
+
"onUpdate:mentions": (value) => mentions.value = value,
|
|
784
|
+
"onUpdate:modelValue": (value) => reply.value = value,
|
|
785
|
+
people: people.value,
|
|
786
|
+
ref: composer,
|
|
787
|
+
size: props.size,
|
|
788
|
+
user: user.value,
|
|
789
|
+
users: users.value,
|
|
790
|
+
variant: "reply"
|
|
791
|
+
}, composerSlots())
|
|
792
|
+
]);
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
export { CommentThread as n, CommentReply as t };
|