@vite-hub/ui 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -45
- package/dist/AttachmentTitle-BWw0ck0T.js +110 -0
- package/dist/BubbleContent-B1a4e3vE.js +45 -0
- package/dist/Chat-BZxkf3Tt.js +112 -0
- package/dist/ChatMessage-Blr5F-zi.js +94 -0
- package/dist/CodeBlockContent-BjXJm8lO.js +92 -0
- package/dist/CodeBlockTitle-DYrYpc1U.js +99 -0
- package/dist/CommentRow-ViZ7r8nr.js +86 -0
- package/dist/CopyButton-Dtg_Oc9_.js +115 -0
- package/dist/Markdown-_w7feFzl.js +70 -0
- package/dist/MarkdownCodeBlock-B4j7x0H6.js +127 -0
- package/dist/MarkdownImage-CJN3myt4.js +111 -0
- package/dist/MessageHeader-CJ9eBHSS.js +61 -0
- package/dist/MessageParts-FVyYZNsn.js +57 -0
- package/dist/MessageScrollerViewport-BaTlWLki.js +142 -0
- package/dist/MorphText-CYTndbyp.js +36 -0
- package/dist/RollNumber-Bo2tzfAp.js +49 -0
- package/dist/TraceTitle-Cp0y7RRD.js +133 -0
- package/dist/agent-session-BwZSMi4S.d.ts +312 -0
- package/dist/agent-session-DhlTKCQG.js +875 -0
- package/dist/{announce-B0DLwflT.js → announce-CJNXaYbT.js} +1 -3
- package/dist/appendItems-hQ4aBd9Q.js +4047 -0
- package/dist/attachment-BllgHx9Q.d.ts +124 -0
- package/dist/attachment-DQMJNfj0.js +35 -0
- package/dist/avatar-stack-Bj1xUkzY.d.ts +4 -0
- package/dist/avatar-stack-nQErr0qn.js +72 -0
- package/dist/bubble-D3M2_InY.js +32 -0
- package/dist/bubble-DmplVxLr.d.ts +64 -0
- package/dist/chat-DWdyMSuj.d.ts +13 -0
- package/dist/chat-message-QLHnX_ED.d.ts +11 -0
- package/dist/chat-session-BOj5L3Ey.d.ts +29 -0
- package/dist/chat-session-hjZRL6jY.js +43 -0
- package/dist/choices-input-DqgXl5a-.d.ts +97 -0
- package/dist/{vue-d2Td6uu2.js → client-BG-oCUtv-5i4sRwXP.js} +4156 -4156
- package/dist/code-block-Bp8y-XJp.d.ts +182 -0
- package/dist/code-block-CMERLfew.js +14 -0
- package/dist/code-view-26RY6dX8.js +137 -0
- package/dist/code-view-D8yYdFUc.d.ts +184 -0
- package/dist/{comment-composer-X7vJKh5b.js → comment-composer-BUt6vbnr.js} +175 -37
- package/dist/{comment-composer-DmDM3XYP.d.ts → comment-composer-CIsbz-78.d.ts} +7 -7
- package/dist/{comment-layer-KnnVfdRV.d.ts → comment-layer-BlVNORgj.d.ts} +17 -8
- package/dist/comment-layer-Ck2H24oJ.js +1206 -0
- package/dist/{comment-panel-DoLDOw3E.d.ts → comment-panel-Djx-KxVa.d.ts} +28 -21
- package/dist/comment-selection-bar-CbOEI98x.d.ts +33 -0
- package/dist/comment-selection-bar-CxPkJxVl.js +145 -0
- package/dist/comment-send.css +2 -2
- package/dist/{comment-thread-jqPx6aJ8.js → comment-thread-C_Q4UDaV.js} +74 -49
- package/dist/{comment-thread-DPV2kqA4.d.ts → comment-thread-X6gYMNay.d.ts} +11 -10
- package/dist/comments-B1itauwb.d.ts +52 -0
- package/dist/{comments-9MDSNm-9.js → comments-BaSrroRV.js} +32 -4
- package/dist/comments-BtD28xEn.js +390 -0
- package/dist/{comments-OWjNidkP.d.ts → comments-ZfV6IZs8.d.ts} +9 -2
- package/dist/components-CM5mZe0a.js +269 -0
- package/dist/{config-LRonN53j.js → config-CFwvNt4Y.js} +11 -30
- package/dist/{config-COSdO-ay.d.ts → config-JmsTI7gs.d.ts} +20 -33
- package/dist/connection-status-BVSH2ZVo.js +72 -0
- package/dist/connection-status-g62BTn44.d.ts +37 -0
- package/dist/copy-button-CRiXUFsl.d.ts +17 -0
- package/dist/device-frame-BW6IjB6P.d.ts +78 -0
- package/dist/device-frame-DDWoyB-G.js +515 -0
- package/dist/diffs-BTKaVnsb.d.ts +272 -0
- package/dist/diffs.d.ts +3 -0
- package/dist/{pierre-code-view-C49BVDrc.js → diffs.js} +147 -4223
- package/dist/drop-field-C0bXv1J-.d.ts +35 -0
- package/dist/drop-field-DKpYQ3tO.js +77 -0
- package/dist/editor-BsOTjnnN.d.ts +540 -0
- package/dist/{markdown-editor-D1irG9Xl.js → editor-DJPUs1nt.js} +833 -106
- package/dist/editor.d.ts +2 -0
- package/dist/editor.js +3 -0
- package/dist/element-BpjNQvZ0.js +6 -0
- package/dist/{file-tree-CRFIdtzw.js → file-tree-B4JKbp4r.js} +19 -18
- package/dist/{file-tree-DOtkeBaq.d.ts → file-tree-BdnKA6UA.d.ts} +33 -8
- package/dist/file-tree-DDSIafDn.d.ts +22 -0
- package/dist/file-tree-DS5shGSL.js +46 -0
- package/dist/file-tree.d.ts +2 -0
- package/dist/file-tree.js +1 -0
- package/dist/files-cuVXzWlx.js +30 -0
- package/dist/filter-search-C9e6sGij.d.ts +28 -0
- package/dist/filter-search-COZsoRiR.js +73 -0
- package/dist/formatCSSVariablePrefix-DLS1Ed1_.js +5 -0
- package/dist/headless-2IcUWHMq.d.ts +51 -0
- package/dist/headless.d.ts +7 -4
- package/dist/headless.js +5 -3
- package/dist/highlight.d.ts +2 -0
- package/dist/highlight.js +1 -0
- package/dist/{highlights-C2AbEdDI.js → highlights-8Al0-h-v.js} +3 -2
- package/dist/{hold-to-delete-BSMrpE-i.d.ts → hold-to-delete-CQc1JaG_.d.ts} +7 -0
- package/dist/{hold-to-delete-Cludb56v.js → hold-to-delete-CcQbfiQx.js} +111 -20
- package/dist/hold-to-delete-cOPqQ9FJ.js +85 -0
- package/dist/hold-to-delete-ksBE7wxc.d.ts +58 -0
- package/dist/index-9Z6Gwtnf.d.ts +77 -0
- package/dist/{index-B2cbt3py.d.ts → index-D3-uYBqH.d.ts} +1 -1
- package/dist/index.d.ts +165 -52
- package/dist/index.js +127 -671
- package/dist/markdown-BLALLOc0.d.ts +45 -0
- package/dist/{markdown-renderer-DMyYKeil.js → markdown-DDyOdYq_.js} +125 -127
- package/dist/{parts/components/markdown-renderer.d.ts → markdown-DkDxdpMU.d.ts} +10 -7
- package/dist/markdown-editor.d.ts +51 -98
- package/dist/markdown-editor.js +70 -3
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +1 -0
- package/dist/marker-CvcWZ3Zp.d.ts +59 -0
- package/dist/marker-DNL6QR3L.js +63 -0
- package/dist/message-BwivYIEl.js +13 -0
- package/dist/message-DEq4K5cQ.d.ts +72 -0
- package/dist/message-parts-B1BZFVKe.d.ts +3 -0
- package/dist/message-parts-CG3gNWn8.d.ts +11 -0
- package/dist/message-parts.d.ts +2 -0
- package/dist/message-parts.js +1 -0
- package/dist/message-scroller-D7AvM31v.d.ts +41 -0
- package/dist/motion/core.d.ts +4 -4
- package/dist/motion/core.js +5 -11
- package/dist/motion-BH6ShUam.d.ts +12 -0
- package/dist/{effects-C1zYpSpg.js → motion-core-BdTfxAhY.js} +1779 -55
- package/dist/{motion-core-Dh20n5Se.d.ts → motion-core-BfIefToe.d.ts} +30 -73
- package/dist/motion-dPwxx3Wk.js +76 -0
- package/dist/{install-C4LwcJda.js → motion-itHFtXwA.js} +1 -1
- package/dist/motion-list-BBbz93WT.js +49 -0
- package/dist/motion.d.ts +5 -14
- package/dist/motion.js +6 -13
- package/dist/nuxt-ui-CPdiTwwD.js +22 -0
- package/dist/nuxt.d.ts +9 -5
- package/dist/nuxt.js +28 -32
- package/dist/parts/components/agent-session.d.ts +2 -295
- package/dist/parts/components/agent-session.js +1 -659
- package/dist/parts/components/attachment.d.ts +2 -85
- package/dist/parts/components/attachment.js +3 -72
- package/dist/parts/components/avatar-stack.d.ts +3 -2
- package/dist/parts/components/avatar-stack.js +1 -60
- package/dist/parts/components/bubble.d.ts +2 -69
- package/dist/parts/components/bubble.js +3 -52
- package/dist/parts/components/chat-message.d.ts +3 -25
- package/dist/parts/components/chat-message.js +1 -50
- package/dist/parts/components/chat-session.d.ts +2 -26
- package/dist/parts/components/chat-session.js +1 -37
- package/dist/parts/components/chat.d.ts +3 -52
- package/dist/parts/components/chat.js +1 -105
- package/dist/parts/components/code-block.d.ts +2 -102
- package/dist/parts/components/code-block.js +4 -109
- package/dist/parts/components/code-view.d.ts +3 -268
- package/dist/parts/components/code-view.js +1 -1
- package/dist/parts/components/comment-composer.d.ts +1 -1
- package/dist/parts/components/comment-composer.js +1 -1
- package/dist/parts/components/comment-layer.d.ts +1 -1
- package/dist/parts/components/comment-layer.js +1 -634
- package/dist/parts/components/comment-panel.d.ts +2 -2
- package/dist/parts/components/comment-panel.js +22 -16
- package/dist/parts/components/comment-selection-bar.d.ts +2 -2
- package/dist/parts/components/comment-selection-bar.js +1 -116
- package/dist/parts/components/comment-thread.d.ts +1 -1
- package/dist/parts/components/comment-thread.js +1 -3
- package/dist/parts/components/comments.d.ts +8 -9
- package/dist/parts/components/comments.js +6 -9
- package/dist/parts/components/connection-status.d.ts +2 -36
- package/dist/parts/components/connection-status.js +1 -64
- package/dist/parts/components/copy-button.d.ts +3 -126
- package/dist/parts/components/copy-button.js +3 -226
- package/dist/parts/components/device-frame.d.ts +2 -128
- package/dist/parts/components/device-frame.js +1 -470
- package/dist/parts/components/drop-field.d.ts +2 -67
- package/dist/parts/components/drop-field.js +1 -76
- package/dist/parts/components/file-tree.d.ts +3 -2
- package/dist/parts/components/file-tree.js +3 -1
- package/dist/parts/components/filter-search.d.ts +2 -45
- package/dist/parts/components/filter-search.js +1 -57
- package/dist/parts/components/hold-to-delete.d.ts +2 -80
- package/dist/parts/components/hold-to-delete.js +1 -75
- package/dist/parts/components/markdown.d.ts +3 -45
- package/dist/parts/components/markdown.js +1 -46
- package/dist/parts/components/marker.d.ts +2 -32
- package/dist/parts/components/marker.js +1 -22
- package/dist/parts/components/message-parts.d.ts +3 -25
- package/dist/parts/components/message-parts.js +1 -45
- package/dist/parts/components/message.d.ts +2 -32
- package/dist/parts/components/message.js +3 -22
- package/dist/parts/components/motion-list.d.ts +2 -40
- package/dist/parts/components/motion-list.js +1 -41
- package/dist/parts/components/motion.d.ts +5 -118
- package/dist/parts/components/motion.js +4 -171
- package/dist/parts/components/patch-parsers.d.ts +1 -1
- package/dist/parts/components/progress.d.ts +2 -39
- package/dist/parts/components/progress.js +1 -53
- package/dist/parts/components/prompt-input.d.ts +2 -134
- package/dist/parts/components/prompt-input.js +1 -253
- package/dist/parts/components/relative-time.d.ts +2 -71
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/status.d.ts +2 -58
- package/dist/parts/components/status.js +1 -47
- package/dist/parts/components/sync-status.d.ts +2 -22
- package/dist/parts/components/sync-status.js +1 -48
- package/dist/parts/components/tool-list.d.ts +2 -28
- package/dist/parts/components/tool-list.js +1 -118
- package/dist/parts/components/trace-run.d.ts +2 -25
- package/dist/parts/components/trace-run.js +1 -89
- package/dist/parts/components/trace.d.ts +2 -59
- package/dist/parts/components/trace.js +1 -76
- package/dist/parts/composables/attachments.js +75 -1
- package/dist/parts/headless/choices-input.d.ts +2 -2
- package/dist/parts/headless/choices-input.js +49 -37
- package/dist/parts/headless/comments.d.ts +1 -1
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/headless/message-scroller.d.ts +2 -2
- package/dist/parts/headless/message-scroller.js +211 -309
- package/dist/parts/headless/relative-time.d.ts +2 -0
- package/dist/parts/headless/relative-time.js +1 -0
- package/dist/parts/workspace/browser-support-notice.js +6 -5
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/runners/web-container.js +2 -2
- package/dist/parts/workspace/workspace-bar.d.ts +1 -1
- package/dist/parts/workspace/workspace-bar.js +1 -1
- package/dist/parts/workspace/workspace-boot-status.d.ts +1 -1
- package/dist/parts/workspace/workspace-boot-status.js +1 -206
- package/dist/parts/workspace/workspace-editor-head.d.ts +1 -1
- package/dist/parts/workspace/workspace-editor-head.js +1 -1
- package/dist/parts/workspace/workspace-editor.d.ts +2 -2
- package/dist/parts/workspace/workspace-examples.js +1 -1
- package/dist/parts/workspace/workspace-file-tree.d.ts +1 -1
- package/dist/parts/workspace/workspace-file-tree.js +3 -2
- package/dist/parts/workspace/workspace-guide.js +1 -1
- package/dist/parts/workspace/workspace-preview.d.ts +1 -1
- package/dist/parts/workspace/workspace-preview.js +14 -12
- package/dist/parts/workspace/workspace-shell.d.ts +1 -1
- package/dist/parts/workspace/workspace-shell.js +11 -11
- package/dist/parts/workspace/workspace-sidebar.d.ts +2 -2
- package/dist/parts/workspace/workspace-sidebar.js +2 -2
- package/dist/parts/workspace/workspace-start.js +1 -1
- package/dist/parts/workspace/workspace-steps.js +1 -1
- package/dist/parts/workspace/workspace.d.ts +3 -3
- package/dist/parts/workspace/workspace.js +5 -5
- package/dist/press-BuEC-XvZ.d.ts +83 -0
- package/dist/progress-Ch0fA-bf.d.ts +8 -0
- package/dist/progress-D_9sG648.js +47 -0
- package/dist/prompt-input-CRXEJBAK.js +412 -0
- package/dist/prompt-input-j4OFTF5p.d.ts +116 -0
- package/dist/relative-time-BnJfjeEm.js +131 -0
- package/dist/relative-time-BuP-Gvzn.d.ts +43 -0
- package/dist/{relative-time-DJnw45tr.js → relative-time-Dz2DR4eb.js} +64 -114
- package/dist/relative-time-grHFu1kY.d.ts +11 -0
- package/dist/{ring-GaJsg32c.js → ring-DoL9jivj.js} +1 -2
- package/dist/runtime/nuxt-plugin.js +2 -5
- package/dist/{shiki-CbfEu_Az.js → shiki-CxzM_xNo.js} +3 -2
- package/dist/stand-ins-CuKM1UH1.js +339 -0
- package/dist/status-B2Yhrwv8.js +67 -0
- package/dist/status-ySiRa-8O.d.ts +38 -0
- package/dist/{stream-tokenizer-ByC3l0HQ.js → stream-tokenizer-BsjV6wxW.js} +1 -1
- package/dist/styles.css +4343 -3403
- package/dist/sync-status-BRroyOre.js +59 -0
- package/dist/sync-status-D4KdGO6y.d.ts +35 -0
- package/dist/theme.css +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/theme.js +19 -8
- package/dist/{themes-DKugPHlg.js → themes-B0_ioVT0.js} +1 -1
- package/dist/tool-list-DDaCqpR6.js +209 -0
- package/dist/tool-list-DMRPM0Yi.d.ts +50 -0
- package/dist/trace-KCBvOsw_.d.ts +113 -0
- package/dist/trace-run-Dk962P5a.d.ts +49 -0
- package/dist/trace-run-nh6FIsl6.js +202 -0
- package/dist/{opt-out-D66l60sg.js → tween-lVMRCUEv.js} +60 -1
- package/dist/types-BF_U0tgp.d.ts +74 -0
- package/dist/types-CTk3aNb5.d.ts +15 -0
- package/dist/types-D0a3i4Fw.d.ts +21 -0
- package/dist/types-DTecvcsZ.d.ts +35 -0
- package/dist/types-D_BWab7g.d.ts +75 -0
- package/dist/types-RHaQ4gj1.d.ts +27 -0
- package/dist/ui-components-CKQAPI-W.js +7 -0
- package/dist/unwrapDefault-CExq-4rm.js +5 -0
- package/dist/use-copy-DK1SSZkh.js +66 -0
- package/dist/utils-hi9-xROt.js +37 -0
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +8 -14
- package/dist/{vue-vUGpdMct.js → vue-DdYvDVOr.js} +1 -1
- package/dist/workspace-boot-status-CyGlJS06.js +216 -0
- package/dist/{workspace-shell-ChCwWPyv.d.ts → workspace-shell-B4A7CINd.d.ts} +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +1 -2
- package/package.json +48 -14
- package/dist/attachments-DgwoQZKY.js +0 -88
- package/dist/avatar-stack-C0IKwj6g.d.ts +0 -57
- package/dist/choices-input-BUf-QqGj.d.ts +0 -92
- package/dist/code-view-Cg4nyTNA.js +0 -172
- package/dist/comment-attachments-DAzUbRmJ.js +0 -23
- package/dist/comment-list-ncwaCSVX.d.ts +0 -60
- package/dist/comment-person-D_IyIjXo.js +0 -39
- package/dist/comment-pin-hBJFiSYW.d.ts +0 -66
- package/dist/comment-row-DPMWI5Z0.js +0 -38
- package/dist/comment-selection-bar-CVuS-FNL.d.ts +0 -40
- package/dist/comment-send-CUkL3TbZ.js +0 -275
- package/dist/comment-send-MmxFsOQf.d.ts +0 -23
- package/dist/comment-status-nsCdrRk_.js +0 -20
- package/dist/drop-field-CNZgwFVO.js +0 -162
- package/dist/editor-Dmk3k6f6.js +0 -620
- package/dist/format-CPipR1FP.js +0 -19
- package/dist/handlers-CnbkvXjX.js +0 -181
- package/dist/icon-XZaCUZTG.d.ts +0 -29
- package/dist/image-preview-BKVUtfwQ.js +0 -104
- package/dist/index-B_PSX-5h.d.ts +0 -69
- package/dist/list-DUTAo0uC.js +0 -270
- package/dist/markdown-editor-B7gD60tp.d.ts +0 -189
- package/dist/message-scroller-BZqS63IX.d.ts +0 -173
- package/dist/nuxt-ui-7ByUrymx.js +0 -43
- package/dist/parts/components/comment-list.d.ts +0 -2
- package/dist/parts/components/comment-list.js +0 -173
- package/dist/parts/components/comment-pin.d.ts +0 -2
- package/dist/parts/components/comment-pin.js +0 -74
- package/dist/parts/components/comment-send.d.ts +0 -2
- package/dist/parts/components/comment-send.js +0 -1
- package/dist/parts/components/markdown-editor.d.ts +0 -2
- package/dist/parts/components/markdown-editor.js +0 -1
- package/dist/parts/components/markdown-renderer.js +0 -1
- package/dist/payload-text-DQNRbJY5.js +0 -31
- package/dist/progress-DL9k-ERG.js +0 -265
- package/dist/registry-DAIjCjWd.js +0 -77
- package/dist/slot-part-BWHvQ3mK.js +0 -25
- package/dist/text-gacox6bp.js +0 -822
- package/dist/travel-BliEidau.js +0 -180
- package/dist/tween-Dv3IIIQG.js +0 -61
- package/dist/types-Ceh7h7NT.d.ts +0 -31
- package/dist/visual-copy-CHHBfJ6O.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./markdown-
|
|
1
|
+
import "./markdown-DDyOdYq_.js";
|
|
2
2
|
import { defineComponent, h, onBeforeUnmount, onMounted, ref, useId, watch } from "vue";
|
|
3
3
|
import { escapeHtml } from "comark/utils";
|
|
4
4
|
// ../../node_modules/.pnpm/pele@1.12.0/node_modules/pele/dist/pele.js
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { icon } from "./parts/workspace/icons.js";
|
|
2
|
+
import { computed, defineComponent, h, onBeforeUnmount, ref, watch } from "vue";
|
|
3
|
+
// src/internal/format.ts
|
|
4
|
+
/** "320ms", "1.2s", "30s", or "1m 35s". Seconds round down, so a running counter never shows "60s". */
|
|
5
|
+
function formatDuration(ms) {
|
|
6
|
+
const whole = Math.round(ms);
|
|
7
|
+
if (whole < 1e3) return `${whole}ms`;
|
|
8
|
+
const elapsed = Math.max(ms, 1e3);
|
|
9
|
+
const seconds = Math.floor(elapsed / 1e3);
|
|
10
|
+
if (seconds < 10) return `${seconds}.${Math.floor(elapsed % 1e3 / 100)}s`;
|
|
11
|
+
if (seconds < 60) return `${seconds}s`;
|
|
12
|
+
return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
13
|
+
}
|
|
14
|
+
// src/workspace/workspace-boot-status.ts
|
|
15
|
+
const checklist = [
|
|
16
|
+
{
|
|
17
|
+
label: "Check browser support",
|
|
18
|
+
stage: "checking"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Start WebContainer",
|
|
22
|
+
stage: "booting"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "Load project files",
|
|
26
|
+
stage: "mounting"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Install dependencies",
|
|
30
|
+
stage: "installing"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "Start dev server",
|
|
34
|
+
stage: "starting"
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
/** The install hint shows after this many milliseconds. */
|
|
38
|
+
const slowInstallMs = 2e4;
|
|
39
|
+
/** Maps the steps of `@vite-hub/web-container` to the five rows of the checklist. */
|
|
40
|
+
function bootChecklist(steps, status, now) {
|
|
41
|
+
const failed = status === "error" || status === "unsupported";
|
|
42
|
+
const last = [...steps].reverse().find((step) => step.stage !== "error" && step.stage !== "unsupported" && step.stage !== "ready");
|
|
43
|
+
const reached = last ? checklist.findIndex((row) => row.stage === last.stage) : -1;
|
|
44
|
+
return checklist.map((row, index) => {
|
|
45
|
+
const step = [...steps].reverse().find((candidate) => candidate.stage === row.stage);
|
|
46
|
+
if (!step) return {
|
|
47
|
+
...row,
|
|
48
|
+
state: index < reached ? "skipped" : "pending"
|
|
49
|
+
};
|
|
50
|
+
const ms = step.ms ?? Math.max(0, now - step.startedAt);
|
|
51
|
+
if (failed && step === last) return {
|
|
52
|
+
...row,
|
|
53
|
+
ms,
|
|
54
|
+
state: "failed"
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
...row,
|
|
58
|
+
ms,
|
|
59
|
+
state: step.ms === void 0 ? "running" : "done"
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const stateIcon = {
|
|
64
|
+
done: () => icon("check", "vh-ws-icon vh-ws-step-icon"),
|
|
65
|
+
failed: () => icon("circle-alert", "vh-ws-icon vh-ws-step-icon"),
|
|
66
|
+
pending: () => h("span", {
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
class: "vh-ws-step-dot"
|
|
69
|
+
}),
|
|
70
|
+
running: () => h("span", {
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
class: "vh-ws-step-dot is-running"
|
|
73
|
+
}),
|
|
74
|
+
skipped: () => h("span", {
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
class: "vh-ws-step-dot"
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
const stateText = {
|
|
80
|
+
done: "Done",
|
|
81
|
+
failed: "Failed",
|
|
82
|
+
pending: "Waiting",
|
|
83
|
+
running: "Running",
|
|
84
|
+
skipped: "Skipped"
|
|
85
|
+
};
|
|
86
|
+
function failureCopy(failure) {
|
|
87
|
+
switch (failure.kind) {
|
|
88
|
+
case "install": return {
|
|
89
|
+
body: failure.exitCode === void 0 ? failure.error.message : `npm install exited with code ${failure.exitCode}. The output shows which package failed.`,
|
|
90
|
+
title: "Install failed"
|
|
91
|
+
};
|
|
92
|
+
case "server": return {
|
|
93
|
+
body: failure.exitCode === void 0 ? failure.error.message : `The dev server exited with code ${failure.exitCode}. Your edits are kept.`,
|
|
94
|
+
title: "The dev server stopped"
|
|
95
|
+
};
|
|
96
|
+
case "unsupported": return {
|
|
97
|
+
body: failure.error.message,
|
|
98
|
+
title: "The live workspace does not run here"
|
|
99
|
+
};
|
|
100
|
+
case "boot": return {
|
|
101
|
+
body: failure.error.message,
|
|
102
|
+
title: "The workspace did not start"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A checklist of the boot stages with live elapsed times. It shows no progress bar,
|
|
108
|
+
* because an install has no reliable total.
|
|
109
|
+
*/
|
|
110
|
+
const WorkspaceBootStatus = defineComponent({
|
|
111
|
+
name: "WorkspaceBootStatus",
|
|
112
|
+
props: {
|
|
113
|
+
status: {
|
|
114
|
+
required: true,
|
|
115
|
+
type: String
|
|
116
|
+
},
|
|
117
|
+
steps: {
|
|
118
|
+
default: () => [],
|
|
119
|
+
type: Array
|
|
120
|
+
},
|
|
121
|
+
failure: {
|
|
122
|
+
default: void 0,
|
|
123
|
+
type: Object
|
|
124
|
+
},
|
|
125
|
+
online: {
|
|
126
|
+
default: true,
|
|
127
|
+
type: Boolean
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
emits: {
|
|
131
|
+
/** Boot again after `failure.kind` is `boot`. */
|
|
132
|
+
retry: () => true,
|
|
133
|
+
/** Run the install again after `failure.kind` is `install`. */
|
|
134
|
+
"retry-install": () => true,
|
|
135
|
+
/** Start the dev server again after `failure.kind` is `server`. */
|
|
136
|
+
restart: () => true,
|
|
137
|
+
/** Show the terminal output. */
|
|
138
|
+
"show-output": () => true
|
|
139
|
+
},
|
|
140
|
+
setup(props, { emit }) {
|
|
141
|
+
const now = ref(typeof performance === "undefined" ? 0 : performance.now());
|
|
142
|
+
let timer;
|
|
143
|
+
const rows = computed(() => bootChecklist(props.steps, props.status, now.value));
|
|
144
|
+
const running = computed(() => rows.value.find((row) => row.state === "running"));
|
|
145
|
+
watch(running, (row) => {
|
|
146
|
+
if (row && !timer) timer = setInterval(() => {
|
|
147
|
+
now.value = performance.now();
|
|
148
|
+
}, 100);
|
|
149
|
+
if (!row && timer) {
|
|
150
|
+
clearInterval(timer);
|
|
151
|
+
timer = void 0;
|
|
152
|
+
now.value = performance.now();
|
|
153
|
+
}
|
|
154
|
+
}, { immediate: true });
|
|
155
|
+
onBeforeUnmount(() => {
|
|
156
|
+
if (timer) clearInterval(timer);
|
|
157
|
+
});
|
|
158
|
+
const showOutput = () => h("button", {
|
|
159
|
+
class: "vh-ws-button",
|
|
160
|
+
type: "button",
|
|
161
|
+
onClick: () => emit("show-output")
|
|
162
|
+
}, "Show output");
|
|
163
|
+
return () => {
|
|
164
|
+
const slowInstall = running.value?.stage === "installing" && (running.value.ms ?? 0) > slowInstallMs;
|
|
165
|
+
const failure = props.failure;
|
|
166
|
+
const ready = props.status === "ready" && !failure;
|
|
167
|
+
const heading = failure ? failureCopy(failure).title : ready ? "The workspace is ready" : "Starting the workspace";
|
|
168
|
+
return h("div", {
|
|
169
|
+
"aria-busy": running.value ? "true" : "false",
|
|
170
|
+
class: "vh-ws-boot",
|
|
171
|
+
"data-status": props.status
|
|
172
|
+
}, [
|
|
173
|
+
h("p", {
|
|
174
|
+
class: "vh-ws-boot-title",
|
|
175
|
+
role: "status"
|
|
176
|
+
}, heading),
|
|
177
|
+
h("ol", {
|
|
178
|
+
"aria-label": "Workspace start steps",
|
|
179
|
+
class: "vh-ws-steps"
|
|
180
|
+
}, rows.value.map((row) => h("li", {
|
|
181
|
+
class: "vh-ws-step",
|
|
182
|
+
"data-stage": row.stage,
|
|
183
|
+
"data-state": row.state,
|
|
184
|
+
key: row.stage
|
|
185
|
+
}, [
|
|
186
|
+
stateIcon[row.state](),
|
|
187
|
+
h("span", { class: "vh-ws-step-label" }, row.label),
|
|
188
|
+
h("span", { class: "vh-ws-sr-only" }, `, ${stateText[row.state]}`),
|
|
189
|
+
h("span", { class: "vh-ws-step-time" }, row.ms === void 0 ? "" : formatDuration(row.ms))
|
|
190
|
+
]))),
|
|
191
|
+
slowInstall ? h("p", { class: "vh-ws-muted vh-ws-boot-hint" }, "First install downloads packages. Later steps reuse them.") : void 0,
|
|
192
|
+
props.online ? void 0 : h("p", {
|
|
193
|
+
class: "vh-ws-notice",
|
|
194
|
+
role: "alert"
|
|
195
|
+
}, [icon("wifi-off"), h("span", "You are offline. Installing packages needs a connection. Your edits are kept.")]),
|
|
196
|
+
failure ? h("div", {
|
|
197
|
+
class: "vh-ws-failure",
|
|
198
|
+
role: "alert"
|
|
199
|
+
}, [h("p", { class: "vh-ws-failure-body" }, failureCopy(failure).body), h("div", { class: "vh-ws-actions" }, failure.kind === "install" ? [h("button", {
|
|
200
|
+
class: "vh-ws-button vh-ws-button--primary",
|
|
201
|
+
type: "button",
|
|
202
|
+
onClick: () => emit("retry-install")
|
|
203
|
+
}, "Retry install"), showOutput()] : failure.kind === "server" ? [h("button", {
|
|
204
|
+
class: "vh-ws-button vh-ws-button--primary",
|
|
205
|
+
type: "button",
|
|
206
|
+
onClick: () => emit("restart")
|
|
207
|
+
}, "Restart server"), showOutput()] : failure.kind === "boot" ? [h("button", {
|
|
208
|
+
class: "vh-ws-button vh-ws-button--primary",
|
|
209
|
+
type: "button",
|
|
210
|
+
onClick: () => emit("retry")
|
|
211
|
+
}, "Try again"), showOutput()] : [])]) : h("div", { class: "vh-ws-actions" }, [showOutput()])
|
|
212
|
+
]);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
export { bootChecklist as n, formatDuration as r, WorkspaceBootStatus as t };
|
|
@@ -100,9 +100,9 @@ declare const WorkspaceShell: import("vue").DefineComponent<import("vue").Extrac
|
|
|
100
100
|
}>> & Readonly<{
|
|
101
101
|
"onUpdate:tab"?: ((tab: WorkspaceTab) => any) | undefined;
|
|
102
102
|
}>, {
|
|
103
|
-
storageKey: string | false;
|
|
104
103
|
label: string;
|
|
105
104
|
layout: WorkspaceLayout;
|
|
105
|
+
storageKey: string | false;
|
|
106
106
|
tab: WorkspaceTab;
|
|
107
107
|
tabs: readonly WorkspaceTabItem[];
|
|
108
108
|
covered: boolean;
|
package/dist/workspace.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { WorkspaceFileTree } from "./parts/workspace/workspace-file-tree.js";
|
|
|
14
14
|
import { WorkspaceGuide } from "./parts/workspace/workspace-guide.js";
|
|
15
15
|
import { WorkspaceIssue, WorkspaceIssues } from "./parts/workspace/workspace-issues.js";
|
|
16
16
|
import { WorkspacePreview, WorkspacePreviewDevice, workspacePreviewScript } from "./parts/workspace/workspace-preview.js";
|
|
17
|
-
import { a as WorkspaceTabItem, i as WorkspaceTab, n as WorkspaceShell, r as WorkspaceSplits, t as WorkspaceLayout } from "./workspace-shell-
|
|
17
|
+
import { a as WorkspaceTabItem, i as WorkspaceTab, n as WorkspaceShell, r as WorkspaceSplits, t as WorkspaceLayout } from "./workspace-shell-B4A7CINd.js";
|
|
18
18
|
import { WorkspaceSidebar, WorkspaceSidebarAction } from "./parts/workspace/workspace-sidebar.js";
|
|
19
19
|
import { WorkspaceStart } from "./parts/workspace/workspace-start.js";
|
|
20
20
|
import { WorkspaceCursor, WorkspaceStatus, workspaceLanguage } from "./parts/workspace/workspace-status.js";
|
package/dist/workspace.js
CHANGED
|
@@ -5,8 +5,7 @@ import { render } from "./parts/workspace/runners/render.js";
|
|
|
5
5
|
import { webContainer } from "./parts/workspace/runners/web-container.js";
|
|
6
6
|
import { Workspace, useWorkspace, useWorkspaceDevice } from "./parts/workspace/workspace.js";
|
|
7
7
|
import { WorkspaceBar } from "./parts/workspace/workspace-bar.js";
|
|
8
|
-
import {
|
|
9
|
-
import { t as formatDuration } from "./format-CPipR1FP.js";
|
|
8
|
+
import { n as bootChecklist, r as formatDuration, t as WorkspaceBootStatus } from "./workspace-boot-status-CyGlJS06.js";
|
|
10
9
|
import { WorkspaceEditor } from "./parts/workspace/workspace-editor.js";
|
|
11
10
|
import { WorkspaceEditorHead } from "./parts/workspace/workspace-editor-head.js";
|
|
12
11
|
import { WorkspaceExamples, groupExamples } from "./parts/workspace/workspace-examples.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "AI interface primitives for Vue and Nuxt.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"sideEffects": [
|
|
30
30
|
"./dist/comment-marks.css",
|
|
31
|
+
"./dist/comment-send.css",
|
|
31
32
|
"./dist/styles.css",
|
|
32
33
|
"./dist/theme.css"
|
|
33
34
|
],
|
|
@@ -38,16 +39,46 @@
|
|
|
38
39
|
"import": "./dist/index.js",
|
|
39
40
|
"default": "./dist/index.js"
|
|
40
41
|
},
|
|
42
|
+
"./diffs": {
|
|
43
|
+
"types": "./dist/diffs.d.ts",
|
|
44
|
+
"import": "./dist/diffs.js",
|
|
45
|
+
"default": "./dist/diffs.js"
|
|
46
|
+
},
|
|
47
|
+
"./editor": {
|
|
48
|
+
"types": "./dist/editor.d.ts",
|
|
49
|
+
"import": "./dist/editor.js",
|
|
50
|
+
"default": "./dist/editor.js"
|
|
51
|
+
},
|
|
52
|
+
"./file-tree": {
|
|
53
|
+
"types": "./dist/file-tree.d.ts",
|
|
54
|
+
"import": "./dist/file-tree.js",
|
|
55
|
+
"default": "./dist/file-tree.js"
|
|
56
|
+
},
|
|
41
57
|
"./headless": {
|
|
42
58
|
"types": "./dist/headless.d.ts",
|
|
43
59
|
"import": "./dist/headless.js",
|
|
44
60
|
"default": "./dist/headless.js"
|
|
45
61
|
},
|
|
62
|
+
"./highlight": {
|
|
63
|
+
"types": "./dist/highlight.d.ts",
|
|
64
|
+
"import": "./dist/highlight.js",
|
|
65
|
+
"default": "./dist/highlight.js"
|
|
66
|
+
},
|
|
67
|
+
"./markdown": {
|
|
68
|
+
"types": "./dist/markdown.d.ts",
|
|
69
|
+
"import": "./dist/markdown.js",
|
|
70
|
+
"default": "./dist/markdown.js"
|
|
71
|
+
},
|
|
46
72
|
"./markdown-editor": {
|
|
47
73
|
"types": "./dist/markdown-editor.d.ts",
|
|
48
74
|
"import": "./dist/markdown-editor.js",
|
|
49
75
|
"default": "./dist/markdown-editor.js"
|
|
50
76
|
},
|
|
77
|
+
"./message-parts": {
|
|
78
|
+
"types": "./dist/message-parts.d.ts",
|
|
79
|
+
"import": "./dist/message-parts.js",
|
|
80
|
+
"default": "./dist/message-parts.js"
|
|
81
|
+
},
|
|
51
82
|
"./motion": {
|
|
52
83
|
"types": "./dist/motion.d.ts",
|
|
53
84
|
"import": "./dist/motion.js",
|
|
@@ -84,8 +115,9 @@
|
|
|
84
115
|
"default": "./dist/workspace.js"
|
|
85
116
|
},
|
|
86
117
|
"./package.json": "./package.json",
|
|
87
|
-
"./comment-marks.css": "./dist/comment-marks.css",
|
|
88
118
|
"./styles.css": "./dist/styles.css",
|
|
119
|
+
"./comment-marks.css": "./dist/comment-marks.css",
|
|
120
|
+
"./comment-send.css": "./dist/comment-send.css",
|
|
89
121
|
"./theme.css": "./dist/theme.css"
|
|
90
122
|
},
|
|
91
123
|
"dependencies": {
|
|
@@ -96,9 +128,9 @@
|
|
|
96
128
|
"@shikijs/langs": "4.6.0",
|
|
97
129
|
"@shikijs/themes": "4.6.0",
|
|
98
130
|
"@types/node": "^24.19.2",
|
|
99
|
-
"@vite-hub/comments": "0.
|
|
100
|
-
"@ui-sdk/core": "0.1.0-beta.
|
|
101
|
-
"@ui-sdk/vue": "0.1.0-beta.
|
|
131
|
+
"@vite-hub/comments": "0.7.0",
|
|
132
|
+
"@ui-sdk/core": "0.1.0-beta.20",
|
|
133
|
+
"@ui-sdk/vue": "0.1.0-beta.20",
|
|
102
134
|
"nostics": "1.4.0",
|
|
103
135
|
"katex": "^0.19.1",
|
|
104
136
|
"shiki": "^4.6.0",
|
|
@@ -116,12 +148,14 @@
|
|
|
116
148
|
"@codemirror/state": "6.7.6",
|
|
117
149
|
"@codemirror/view": "6.43.15",
|
|
118
150
|
"@lezer/highlight": "1.2.5",
|
|
119
|
-
"@
|
|
151
|
+
"@lucide/vue": "1.80.0",
|
|
152
|
+
"@vite-hub/web-container": "0.7.0",
|
|
120
153
|
"@xterm/addon-fit": "0.11.0",
|
|
121
154
|
"@xterm/xterm": "6.0.0"
|
|
122
155
|
},
|
|
123
156
|
"devDependencies": {
|
|
124
157
|
"@ai-sdk/vue": "4.0.179",
|
|
158
|
+
"@cfworker/json-schema": "4.1.6",
|
|
125
159
|
"@floating-ui/dom": "1.8.0",
|
|
126
160
|
"@fontsource-variable/geist": "^5.3.0",
|
|
127
161
|
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
@@ -135,7 +169,7 @@
|
|
|
135
169
|
"@vitejs/plugin-vue": "^6.0.11",
|
|
136
170
|
"@vite-hub/icons": "0.1.0",
|
|
137
171
|
"@vite-hub/internal": "0.0.1",
|
|
138
|
-
"@vite-hub/runtime": "0.
|
|
172
|
+
"@vite-hub/runtime": "0.7.0",
|
|
139
173
|
"@vue/server-renderer": "3.5.46",
|
|
140
174
|
"@vue/test-utils": "2.6.0",
|
|
141
175
|
"ai": "7.0.179",
|
|
@@ -149,9 +183,11 @@
|
|
|
149
183
|
"vite-plus": "^1.7.0",
|
|
150
184
|
"vitest": "5.1.0",
|
|
151
185
|
"vue": "3.5.46",
|
|
186
|
+
"vue-component-meta": "3.3.14",
|
|
187
|
+
"vue-tsc": "^3.3.14",
|
|
152
188
|
"@types/markdown-it": "^14.2.0",
|
|
153
189
|
"comark-ui": "^0.14.3",
|
|
154
|
-
"@vite-hub/content": "0.
|
|
190
|
+
"@vite-hub/content": "0.7.0",
|
|
155
191
|
"playwright-core": "^1.65.1",
|
|
156
192
|
"@tiptap/core": "^3.35.0",
|
|
157
193
|
"@tiptap/extension-drag-handle": "3.35.0",
|
|
@@ -162,12 +198,11 @@
|
|
|
162
198
|
"@tiptap/pm": "^3.35.0",
|
|
163
199
|
"@tiptap/starter-kit": "^3.35.0",
|
|
164
200
|
"@tiptap/vue-3": "3.35.0",
|
|
165
|
-
"@vite-hub/blob": "0.
|
|
201
|
+
"@vite-hub/blob": "0.7.0"
|
|
166
202
|
},
|
|
167
203
|
"peerDependencies": {
|
|
168
204
|
"@floating-ui/dom": "^1.0.0",
|
|
169
205
|
"@iconify-json/lucide": "^1.2.158",
|
|
170
|
-
"@nuxt/ui": "^4.11.0",
|
|
171
206
|
"@tiptap/core": "^3.35.0",
|
|
172
207
|
"@tiptap/extension-drag-handle": "^3.23.6",
|
|
173
208
|
"@tiptap/extension-drag-handle-vue-3": "^3.23.6",
|
|
@@ -188,9 +223,6 @@
|
|
|
188
223
|
"@iconify-json/lucide": {
|
|
189
224
|
"optional": true
|
|
190
225
|
},
|
|
191
|
-
"@nuxt/ui": {
|
|
192
|
-
"optional": true
|
|
193
|
-
},
|
|
194
226
|
"@tiptap/core": {
|
|
195
227
|
"optional": true
|
|
196
228
|
},
|
|
@@ -227,9 +259,11 @@
|
|
|
227
259
|
},
|
|
228
260
|
"scripts": {
|
|
229
261
|
"bench:headless": "node scripts/headless-weight.ts",
|
|
262
|
+
"contract:api": "node contract/generate.ts",
|
|
230
263
|
"build": "vp pack",
|
|
264
|
+
"build:registry": "node registry/build.ts",
|
|
231
265
|
"dev": "vp pack --watch",
|
|
232
|
-
"typecheck": "vp run --cache -t @vite-hub/ui#build && node ../../test/package-typecheck.mjs --noEmit -p ./tsconfig.json",
|
|
266
|
+
"typecheck": "vp run --cache -t @vite-hub/ui#build && node ../../test/package-typecheck.mjs --noEmit -p ./tsconfig.json && vue-tsc --noEmit -p ./tsconfig.vue.json",
|
|
233
267
|
"test": "vp run --cache -t @vite-hub/runtime#build && vp run --cache -t @vite-hub/ui#build && vp test",
|
|
234
268
|
"test:browser": "vp run --cache -t @vite-hub/ui#build && node --test test/browser/workspace.browser.mjs",
|
|
235
269
|
"test:bridge": "node --test test/browser/tailwind-bridge.browser.mjs",
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { t as uiErrorDiagnostics } from "./error-diagnostics-BlgA9rI2.js";
|
|
2
|
-
import { computed, onScopeDispose, ref } from "vue";
|
|
3
|
-
// src/internal/prompt-files.ts
|
|
4
|
-
function nextPromptFiles(current, selected, multiple) {
|
|
5
|
-
return multiple ? [...current, ...selected] : selected.slice(-1);
|
|
6
|
-
}
|
|
7
|
-
/** Whether a file matches an `accept` list of the file input, such as `image/*,.pdf`. */
|
|
8
|
-
function matchesAccept(file, accept) {
|
|
9
|
-
if (!accept) return true;
|
|
10
|
-
return accept.split(",").some((entry) => {
|
|
11
|
-
const value = entry.trim();
|
|
12
|
-
if (value.startsWith(".")) return file.name.toLowerCase().endsWith(value.toLowerCase());
|
|
13
|
-
if (value.endsWith("/*")) return file.type.startsWith(value.slice(0, -1));
|
|
14
|
-
return file.type === value;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
// src/composables/attachments.ts
|
|
18
|
-
function fileToDataUrl(file) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
const reader = new FileReader();
|
|
21
|
-
reader.onerror = () => reject(reader.error ?? uiErrorDiagnostics.UI_R0001({ message: `Could not read ${file.name}.` }));
|
|
22
|
-
reader.onload = () => resolve(String(reader.result));
|
|
23
|
-
reader.readAsDataURL(file);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async function fileToUIPart(file) {
|
|
27
|
-
return {
|
|
28
|
-
filename: file.name,
|
|
29
|
-
mediaType: file.type || "application/octet-stream",
|
|
30
|
-
type: "file",
|
|
31
|
-
url: await fileToDataUrl(file)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function useAgentAttachments(options = {}) {
|
|
35
|
-
const files = ref([]);
|
|
36
|
-
const accept = computed(() => options.accept);
|
|
37
|
-
const revoke = (attachment) => {
|
|
38
|
-
if (attachment.previewUrl?.startsWith("blob:")) URL.revokeObjectURL(attachment.previewUrl);
|
|
39
|
-
};
|
|
40
|
-
const remove = (id) => {
|
|
41
|
-
const attachment = files.value.find((item) => item.id === id);
|
|
42
|
-
if (attachment) revoke(attachment);
|
|
43
|
-
files.value = files.value.filter((item) => item.id !== id);
|
|
44
|
-
};
|
|
45
|
-
const clear = () => {
|
|
46
|
-
files.value.forEach(revoke);
|
|
47
|
-
files.value = [];
|
|
48
|
-
};
|
|
49
|
-
const add = (input) => {
|
|
50
|
-
for (const file of Array.from(input)) {
|
|
51
|
-
if (!matchesAccept(file, options.accept)) {
|
|
52
|
-
options.onReject?.(file, "type");
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (options.maxSize !== void 0 && file.size > options.maxSize) {
|
|
56
|
-
options.onReject?.(file, "size");
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (options.multiple === false && files.value.length > 0 || options.maxFiles !== void 0 && files.value.length >= options.maxFiles) {
|
|
60
|
-
options.onReject?.(file, "count");
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
const previewUrl = file.type.startsWith("image/") && typeof URL.createObjectURL === "function" ? URL.createObjectURL(file) : void 0;
|
|
64
|
-
files.value.push({
|
|
65
|
-
file,
|
|
66
|
-
id: globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${file.name}`,
|
|
67
|
-
previewUrl
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
onScopeDispose(clear);
|
|
72
|
-
return {
|
|
73
|
-
accept,
|
|
74
|
-
add,
|
|
75
|
-
clear,
|
|
76
|
-
files,
|
|
77
|
-
inputProps: computed(() => ({
|
|
78
|
-
accept: options.accept,
|
|
79
|
-
multiple: options.multiple ?? true,
|
|
80
|
-
type: "file"
|
|
81
|
-
})),
|
|
82
|
-
remove,
|
|
83
|
-
async toFileParts() {
|
|
84
|
-
return Promise.all(files.value.map(({ file }) => fileToUIPart(file)));
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
export { nextPromptFiles as a, matchesAccept as i, fileToUIPart as n, useAgentAttachments as r, fileToDataUrl as t };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { PropType } from "vue";
|
|
2
|
-
/** One person in the stack. A Realtime `people` entry fits as it is. */
|
|
3
|
-
interface AvatarStackPerson {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
image?: string;
|
|
7
|
-
/** The person's presence color, `#RRGGBB`. The `outline` variant rings the avatar with it, to match their caret. */
|
|
8
|
-
color?: string;
|
|
9
|
-
}
|
|
10
|
-
type AvatarStackSize = "sm" | "default" | "lg";
|
|
11
|
-
type AvatarStackVariant = "default" | "outline";
|
|
12
|
-
declare const AvatarStack: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
-
/** Each person once: entries with the same `id` (a person in two tabs) show one avatar. */
|
|
14
|
-
people: {
|
|
15
|
-
required: true;
|
|
16
|
-
type: PropType<AvatarStackPerson[]>;
|
|
17
|
-
};
|
|
18
|
-
/** The most items to show, counting the "+N" item. `null` shows everyone. */
|
|
19
|
-
max: {
|
|
20
|
-
default: number;
|
|
21
|
-
type: PropType<number | null>;
|
|
22
|
-
};
|
|
23
|
-
size: {
|
|
24
|
-
default: string;
|
|
25
|
-
type: PropType<AvatarStackSize>;
|
|
26
|
-
};
|
|
27
|
-
variant: {
|
|
28
|
-
default: string;
|
|
29
|
-
type: PropType<AvatarStackVariant>;
|
|
30
|
-
};
|
|
31
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
|
-
/** Each person once: entries with the same `id` (a person in two tabs) show one avatar. */
|
|
35
|
-
people: {
|
|
36
|
-
required: true;
|
|
37
|
-
type: PropType<AvatarStackPerson[]>;
|
|
38
|
-
};
|
|
39
|
-
/** The most items to show, counting the "+N" item. `null` shows everyone. */
|
|
40
|
-
max: {
|
|
41
|
-
default: number;
|
|
42
|
-
type: PropType<number | null>;
|
|
43
|
-
};
|
|
44
|
-
size: {
|
|
45
|
-
default: string;
|
|
46
|
-
type: PropType<AvatarStackSize>;
|
|
47
|
-
};
|
|
48
|
-
variant: {
|
|
49
|
-
default: string;
|
|
50
|
-
type: PropType<AvatarStackVariant>;
|
|
51
|
-
};
|
|
52
|
-
}>> & Readonly<{}>, {
|
|
53
|
-
size: AvatarStackSize;
|
|
54
|
-
max: number | null;
|
|
55
|
-
variant: AvatarStackVariant;
|
|
56
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
-
export { AvatarStackVariant as i, AvatarStackPerson as n, AvatarStackSize as r, AvatarStack as t };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Component, PropType, Ref } from "vue";
|
|
2
|
-
type ChoicesInputState = "idle" | "thinking" | "ready" | "error";
|
|
3
|
-
/**
|
|
4
|
-
* What the parts need from `useChoices()`. The type is structural, so any object of this shape works and no server
|
|
5
|
-
* code reaches the browser.
|
|
6
|
-
*/
|
|
7
|
-
interface ChoicesInputSource {
|
|
8
|
-
abort: () => void;
|
|
9
|
-
clear: () => void;
|
|
10
|
-
error: Readonly<Ref<Error | undefined>>;
|
|
11
|
-
status: Readonly<Ref<ChoicesInputState>>;
|
|
12
|
-
submit: () => Promise<void> | void;
|
|
13
|
-
text: Ref<string>;
|
|
14
|
-
}
|
|
15
|
-
declare const ChoicesInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
16
|
-
/** The object that `useChoices()` returns. */
|
|
17
|
-
choices: {
|
|
18
|
-
required: true;
|
|
19
|
-
type: PropType<ChoicesInputSource>;
|
|
20
|
-
};
|
|
21
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
-
[key: string]: any;
|
|
23
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
-
/** The object that `useChoices()` returns. */
|
|
25
|
-
choices: {
|
|
26
|
-
required: true;
|
|
27
|
-
type: PropType<ChoicesInputSource>;
|
|
28
|
-
};
|
|
29
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
30
|
-
declare const ChoicesInputField: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
31
|
-
/** The element or component to render. A component receives `modelValue` and `onUpdate:modelValue`. Default `input`. */
|
|
32
|
-
as: {
|
|
33
|
-
default: string;
|
|
34
|
-
type: PropType<string | Component>;
|
|
35
|
-
};
|
|
36
|
-
/** The accessible name of the input. Default `"Search"`. */
|
|
37
|
-
label: {
|
|
38
|
-
default: string;
|
|
39
|
-
type: StringConstructor;
|
|
40
|
-
};
|
|
41
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
-
/** The element or component to render. A component receives `modelValue` and `onUpdate:modelValue`. Default `input`. */
|
|
45
|
-
as: {
|
|
46
|
-
default: string;
|
|
47
|
-
type: PropType<string | Component>;
|
|
48
|
-
};
|
|
49
|
-
/** The accessible name of the input. Default `"Search"`. */
|
|
50
|
-
label: {
|
|
51
|
-
default: string;
|
|
52
|
-
type: StringConstructor;
|
|
53
|
-
};
|
|
54
|
-
}>> & Readonly<{}>, {
|
|
55
|
-
label: string;
|
|
56
|
-
as: string | Component;
|
|
57
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
58
|
-
declare const ChoicesInputClear: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
59
|
-
/** The element or component to render, for example a button of your design system. Default `button`. */
|
|
60
|
-
as: {
|
|
61
|
-
default: string;
|
|
62
|
-
type: PropType<string | Component>;
|
|
63
|
-
};
|
|
64
|
-
/** The accessible name of the button. Default `"Clear"`. */
|
|
65
|
-
label: {
|
|
66
|
-
default: string;
|
|
67
|
-
type: StringConstructor;
|
|
68
|
-
};
|
|
69
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
70
|
-
[key: string]: any;
|
|
71
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
72
|
-
/** The element or component to render, for example a button of your design system. Default `button`. */
|
|
73
|
-
as: {
|
|
74
|
-
default: string;
|
|
75
|
-
type: PropType<string | Component>;
|
|
76
|
-
};
|
|
77
|
-
/** The accessible name of the button. Default `"Clear"`. */
|
|
78
|
-
label: {
|
|
79
|
-
default: string;
|
|
80
|
-
type: StringConstructor;
|
|
81
|
-
};
|
|
82
|
-
}>> & Readonly<{}>, {
|
|
83
|
-
label: string;
|
|
84
|
-
as: string | Component;
|
|
85
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
86
|
-
declare const ChoicesInputStatus: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
87
|
-
[key: string]: any;
|
|
88
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
89
|
-
declare const ChoicesInputError: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
90
|
-
[key: string]: any;
|
|
91
|
-
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
92
|
-
export { ChoicesInputSource as a, ChoicesInputField as i, ChoicesInputClear as n, ChoicesInputState as o, ChoicesInputError as r, ChoicesInputStatus as s, ChoicesInput as t };
|