@vite-hub/ui 0.1.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +244 -18
- package/dist/attachments-BzTwqRTU.js +90 -0
- package/dist/choices-input-ByXJvDn1.d.ts +94 -0
- package/dist/{code-view-J4OsgEdh.js → code-view-D0bqhogi.js} +20 -4
- package/dist/colors-BghReA9C-CjF9gnmy.js +28 -0
- package/dist/comment-composer-Cc8Jvu6u.d.ts +243 -0
- package/dist/comment-composer-jYv2ULNP.js +591 -0
- package/dist/comment-layer-ClH4MLj4.d.ts +165 -0
- package/dist/comment-list-B8hphLfS.d.ts +62 -0
- package/dist/comment-marks.css +234 -0
- package/dist/comment-panel-fcKSKwLC.d.ts +197 -0
- package/dist/comment-person-CLPlW_SS.js +40 -0
- package/dist/comment-pin-CvwgRSDR.d.ts +68 -0
- package/dist/comment-row-Bbm9WwuF.js +39 -0
- package/dist/comment-thread-CoTLrdal.d.ts +368 -0
- package/dist/comment-visibility-DsVuVndP.d.ts +40 -0
- package/dist/{comments-ChNJkV1d.d.ts → comments-Bx2WRsYy.d.ts} +69 -7
- package/dist/{comments-C08J3z4e.js → comments-CkWc2Khc.js} +155 -60
- package/dist/comments-context-C2lOZyQ5.js +38 -0
- package/dist/config-DgxBW013.d.ts +80 -0
- package/dist/config-Dk67emQt.js +63 -0
- package/dist/copy-button-CRN3kmSD.js +253 -0
- package/dist/draw-DzSmD7uo-Dwz8zoH2.js +72976 -0
- package/dist/editor-C_wt4RRV.js +582 -0
- package/dist/error-diagnostics-SXtnk6bz.js +38 -0
- package/dist/{file-tree-C1pv4_AI.js → file-tree-C4OYgbV-.js} +292 -145
- package/dist/{file-tree-Ctb8hZ_g.d.ts → file-tree-DlT9RGhu.d.ts} +51 -15
- package/dist/format-Du58PlsG.js +18 -0
- package/dist/handlers-DMl-Na3x.js +182 -0
- package/dist/headless.d.ts +5 -176
- package/dist/headless.js +5 -3
- package/dist/icon-swap.css +69 -0
- package/dist/{image-preview-VfknBEFu.js → image-preview-C9tdkmEj.js} +8 -5
- package/dist/{index-DcH0QSI5.d.ts → index-BD1e8vx5.d.ts} +8 -0
- package/dist/{code-view-vDM-hph-.d.ts → index-CNY1uNTh.d.ts} +14 -228
- package/dist/index.d.ts +53 -56
- package/dist/index.js +677 -25
- package/dist/markdown-editor-CMbNZOdN.js +2394 -0
- package/dist/markdown-editor-DqdZfIEn.d.ts +195 -0
- package/dist/markdown-editor.d.ts +108 -0
- package/dist/markdown-editor.js +3 -0
- package/dist/message-scroller-Bm1YWTeY.d.ts +175 -0
- package/dist/nuxt-ui-DSQFzq3s.js +38 -0
- package/dist/nuxt.d.ts +84 -2
- package/dist/nuxt.js +237 -35
- package/dist/parts/components/agent-session.d.ts +254 -0
- package/dist/parts/components/agent-session.js +640 -0
- package/dist/{attachment-BBndG9_P.d.ts → parts/components/attachment.d.ts} +13 -14
- package/dist/{attachment-B3dXC7jM.js → parts/components/attachment.js} +6 -4
- package/dist/{avatar-stack.d.ts → parts/components/avatar-stack.d.ts} +1 -1
- package/dist/{avatar-stack-DM6HRnc0.js → parts/components/avatar-stack.js} +2 -5
- package/dist/{bubble-BJH2rfii.d.ts → parts/components/bubble.d.ts} +8 -9
- package/dist/{bubble-BPyFQlW7.js → parts/components/bubble.js} +2 -2
- package/dist/{chat-message-mpDmZbIC.d.ts → parts/components/chat-message.d.ts} +2 -3
- package/dist/{chat-message-BNK9G7xF.js → parts/components/chat-message.js} +4 -4
- package/dist/{chat-session-D6C7VJBR.d.ts → parts/components/chat-session.d.ts} +3 -4
- package/dist/{chat-session-DYEHB1HC.js → parts/components/chat-session.js} +2 -2
- package/dist/{chat-B9HlZWA2.d.ts → parts/components/chat.d.ts} +8 -4
- package/dist/{chat-BoFHlu9V.js → parts/components/chat.js} +42 -9
- package/dist/{highlighted-code-Dzf6o54i.d.ts → parts/components/code-block.d.ts} +16 -24
- package/dist/{code-block-Br-02hn-.js → parts/components/code-block.js} +9 -38
- package/dist/parts/components/code-view.d.ts +270 -0
- package/dist/parts/components/code-view.js +2 -0
- package/dist/parts/components/comment-composer.d.ts +2 -0
- package/dist/parts/components/comment-composer.js +2 -0
- package/dist/parts/components/comment-layer.d.ts +2 -0
- package/dist/parts/components/comment-layer.js +618 -0
- package/dist/parts/components/comment-list.d.ts +2 -0
- package/dist/parts/components/comment-list.js +167 -0
- package/dist/parts/components/comment-panel.d.ts +2 -0
- package/dist/parts/components/comment-panel.js +299 -0
- package/dist/parts/components/comment-pin.d.ts +2 -0
- package/dist/parts/components/comment-pin.js +75 -0
- package/dist/parts/components/comment-thread.d.ts +2 -0
- package/dist/parts/components/comment-thread.js +571 -0
- package/dist/parts/components/comments.d.ts +7 -0
- package/dist/parts/components/comments.js +8 -0
- package/dist/{connection-status-DjGBw6xX.d.ts → parts/components/connection-status.d.ts} +6 -7
- package/dist/{connection-status-CzuWBENf.js → parts/components/connection-status.js} +1 -1
- package/dist/parts/components/copy-button.d.ts +118 -0
- package/dist/parts/components/copy-button.js +2 -0
- package/dist/parts/components/device-frame.d.ts +130 -0
- package/dist/parts/components/device-frame.js +471 -0
- package/dist/parts/components/file-tree.d.ts +2 -0
- package/dist/parts/components/file-tree.js +2 -0
- package/dist/parts/components/filter-search.d.ts +47 -0
- package/dist/parts/components/filter-search.js +58 -0
- package/dist/parts/components/markdown-editor.d.ts +2 -0
- package/dist/parts/components/markdown-editor.js +2 -0
- package/dist/parts/components/markdown-renderer.d.ts +52 -0
- package/dist/parts/components/markdown-renderer.js +23077 -0
- package/dist/{markdown-Dse5ldJe.d.ts → parts/components/markdown.d.ts} +7 -7
- package/dist/parts/components/markdown.js +47 -0
- package/dist/{marker-ea-tvx-J.d.ts → parts/components/marker.d.ts} +5 -6
- package/dist/{marker-Di2ZG_k1.js → parts/components/marker.js} +2 -2
- package/dist/{message-parts-BBFUkluC.d.ts → parts/components/message-parts.d.ts} +2 -3
- package/dist/{message-parts-DQnfioAH.js → parts/components/message-parts.js} +6 -6
- package/dist/{message-CW_paC1k.d.ts → parts/components/message.d.ts} +8 -9
- package/dist/{message-DiyBthIq.js → parts/components/message.js} +2 -2
- package/dist/parts/components/patch-parsers.d.ts +2 -0
- package/dist/parts/components/patch-parsers.js +2 -0
- package/dist/{prompt-input-Cy_Ue6B5.d.ts → parts/components/prompt-input.d.ts} +54 -11
- package/dist/{prompt-input-BbnCb80O.js → parts/components/prompt-input.js} +66 -111
- package/dist/parts/components/relative-time.d.ts +73 -0
- package/dist/parts/components/relative-time.js +2 -0
- package/dist/parts/components/status.d.ts +60 -0
- package/dist/parts/components/status.js +48 -0
- package/dist/{sync-status-refELOZn.d.ts → parts/components/sync-status.d.ts} +5 -6
- package/dist/{sync-status-BpxYdZIJ.js → parts/components/sync-status.js} +1 -1
- package/dist/{tool-list-E7CA52rz.d.ts → parts/components/tool-list.d.ts} +3 -4
- package/dist/{tool-list-BdSr5CT4.js → parts/components/tool-list.js} +7 -38
- package/dist/{trace-run-COeXn46Z.d.ts → parts/components/trace-run.d.ts} +3 -4
- package/dist/{trace-run-BIQ17CED.js → parts/components/trace-run.js} +15 -23
- package/dist/{trace-V7rM3Pyd.d.ts → parts/components/trace.d.ts} +10 -11
- package/dist/{trace-llBCDiSW.js → parts/components/trace.js} +20 -13
- package/dist/parts/composables/attachments.d.ts +32 -0
- package/dist/parts/composables/attachments.js +2 -0
- package/dist/parts/composables/highlighted-code.d.ts +9 -0
- package/dist/{highlighted-code-Ck4zexJX.js → parts/composables/highlighted-code.js} +5 -2
- package/dist/parts/headless/choices-input.d.ts +2 -0
- package/dist/parts/headless/choices-input.js +162 -0
- package/dist/parts/headless/comment-visibility.d.ts +2 -0
- package/dist/parts/headless/comment-visibility.js +128 -0
- package/dist/parts/headless/comments.d.ts +2 -0
- package/dist/parts/headless/comments.js +2 -0
- package/dist/parts/headless/message-scroller.d.ts +2 -0
- package/dist/{message-scroller-CX6NJTdm.js → parts/headless/message-scroller.js} +2 -2
- package/dist/parts/playground/highlight.d.ts +5 -0
- package/dist/parts/playground/highlight.js +23 -0
- package/dist/parts/playground/paths.d.ts +4 -0
- package/dist/parts/playground/paths.js +7 -0
- package/dist/parts/playground/playground-render.d.ts +126 -0
- package/dist/parts/playground/playground-render.js +356 -0
- package/dist/parts/playground/share.d.ts +2 -0
- package/dist/parts/playground/share.js +92 -0
- package/dist/parts/playground/zip.d.ts +6 -0
- package/dist/parts/playground/zip.js +76 -0
- package/dist/parts/workspace/browser-support-notice.d.ts +76 -0
- package/dist/parts/workspace/browser-support-notice.js +105 -0
- package/dist/parts/workspace/codemirror.d.ts +16 -0
- package/dist/parts/workspace/codemirror.js +243 -0
- package/dist/parts/workspace/connect-panel.d.ts +129 -0
- package/dist/parts/workspace/connect-panel.js +285 -0
- package/dist/parts/workspace/connect-store.d.ts +26 -0
- package/dist/parts/workspace/connect-store.js +59 -0
- package/dist/parts/workspace/icons.d.ts +34 -0
- package/dist/parts/workspace/icons.js +46 -0
- package/dist/parts/workspace/playground-container.d.ts +192 -0
- package/dist/parts/workspace/playground-container.js +603 -0
- package/dist/parts/workspace/workspace-boot-status.d.ts +75 -0
- package/dist/parts/workspace/workspace-boot-status.js +207 -0
- package/dist/parts/workspace/workspace-editor.d.ts +43 -0
- package/dist/parts/workspace/workspace-editor.js +54 -0
- package/dist/parts/workspace/workspace-file-tree.d.ts +53 -0
- package/dist/parts/workspace/workspace-file-tree.js +68 -0
- package/dist/parts/workspace/workspace-preview.d.ts +72 -0
- package/dist/parts/workspace/workspace-preview.js +307 -0
- package/dist/parts/workspace/workspace-shell.d.ts +88 -0
- package/dist/parts/workspace/workspace-shell.js +291 -0
- package/dist/parts/workspace/workspace-terminal.d.ts +39 -0
- package/dist/parts/workspace/workspace-terminal.js +130 -0
- package/dist/payload-text-sjkYAwvw.js +32 -0
- package/dist/{pierre-code-view-T7V67hwT.js → pierre-code-view-xgBL6DO7.js} +209 -86
- package/dist/{pierre-dark-DDWDl8g6.js → pierre-dark-CzUmjETS.js} +3 -1
- package/dist/{pierre-light-CWhW4NrH.js → pierre-light-Dn6E0sWv.js} +3 -1
- package/dist/playground.d.ts +4 -0
- package/dist/playground.js +4 -0
- package/dist/relative-time-BVmjOsYG.js +309 -0
- package/dist/rolldown-runtime-C9mWXvCC.js +29 -0
- package/dist/runtime/nuxt-plugin.js +23 -4
- package/dist/sankey-CAYwt82B-D4uDQoMR.js +2887 -0
- package/dist/share-DM4eNy4q.d.ts +37 -0
- package/dist/{slot-part-C7Ocxn3b.js → slot-part-Doic71uh.js} +7 -1
- package/dist/styles.css +2465 -594
- package/dist/temml-BilSAAws.js +12362 -0
- package/dist/theme-focus-ring.css +42 -0
- package/dist/theme.css +376 -0
- package/dist/theme.d.ts +355 -0
- package/dist/theme.js +265 -0
- package/dist/{types-CqDwuJAm.d.ts → types-Dyr6CfBW.d.ts} +1 -1
- package/dist/vue-BDmSCtay.js +30779 -0
- package/dist/vue-DGstVdGn.js +2492 -0
- package/dist/workspace.d.ts +15 -0
- package/dist/workspace.js +12 -0
- package/package.json +136 -150
- package/dist/andromeeda-BASpqCeJ.js +0 -4
- package/dist/attachment.d.ts +0 -2
- package/dist/attachment.js +0 -2
- package/dist/aurora-x-DugsLcii.js +0 -4
- package/dist/avatar-stack.js +0 -2
- package/dist/ayu-dark-BT3qdi3o.js +0 -4
- package/dist/ayu-light-BVZyHoh9.js +0 -4
- package/dist/ayu-mirage-XFwUVZQZ.js +0 -4
- package/dist/bubble.d.ts +0 -2
- package/dist/bubble.js +0 -2
- package/dist/catppuccin-frappe-D20KODDN.js +0 -4
- package/dist/catppuccin-latte-eGLVHIUJ.js +0 -4
- package/dist/catppuccin-macchiato-bQGch4PY.js +0 -4
- package/dist/catppuccin-mocha-Bes8-0Mr.js +0 -4
- package/dist/chat-message.d.ts +0 -2
- package/dist/chat-message.js +0 -2
- package/dist/chat-session.d.ts +0 -2
- package/dist/chat-session.js +0 -2
- package/dist/chat.d.ts +0 -2
- package/dist/chat.js +0 -2
- package/dist/code-block.d.ts +0 -2
- package/dist/code-block.js +0 -3
- package/dist/code-view.d.ts +0 -2
- package/dist/code-view.js +0 -2
- package/dist/comment-layer-CBlxJ8eK.js +0 -1113
- package/dist/comments-Cq5eewsu.d.ts +0 -537
- package/dist/comments.d.ts +0 -2
- package/dist/comments.js +0 -2
- package/dist/config-Bux_AJzm.d.ts +0 -29
- package/dist/config-bHqE4JOs.js +0 -38
- package/dist/connection-status.d.ts +0 -2
- package/dist/connection-status.js +0 -2
- package/dist/dark-plus-BGuiqa1B.js +0 -4
- package/dist/dracula-0CVA2XY5.js +0 -4
- package/dist/dracula-soft-Dk9bpbVU.js +0 -4
- package/dist/error-diagnostics-B4hMpJRL.js +0 -13
- package/dist/everforest-dark-CRjTbhh5.js +0 -4
- package/dist/everforest-light-CEeYFLn8.js +0 -4
- package/dist/file-diff.d.ts +0 -2
- package/dist/file-diff.js +0 -2
- package/dist/file-tree.d.ts +0 -2
- package/dist/file-tree.js +0 -2
- package/dist/file-view.d.ts +0 -2
- package/dist/file-view.js +0 -2
- package/dist/github-dark-BXgKmOw_.js +0 -4
- package/dist/github-dark-default-DzJQXksd.js +0 -4
- package/dist/github-dark-dimmed-B1pEmGtS.js +0 -4
- package/dist/github-dark-high-contrast-BkHIa6jc.js +0 -4
- package/dist/github-light-BKRlUbaB.js +0 -4
- package/dist/github-light-default-BU3eYkzs.js +0 -4
- package/dist/github-light-high-contrast-B3MumDcI.js +0 -4
- package/dist/gruvbox-dark-hard-B0ecF443.js +0 -4
- package/dist/gruvbox-dark-medium-BQnpC39k.js +0 -4
- package/dist/gruvbox-dark-soft-DFZUgESr.js +0 -4
- package/dist/gruvbox-light-hard-CuB_LOJr.js +0 -4
- package/dist/gruvbox-light-medium-idDHgxjs.js +0 -4
- package/dist/gruvbox-light-soft-CfWH49MY.js +0 -4
- package/dist/horizon-bright-Ba6M8QSV.js +0 -4
- package/dist/horizon-h92C5OlZ.js +0 -4
- package/dist/houston-EQnPegWq.js +0 -4
- package/dist/kanagawa-dragon-DgDvwi3B.js +0 -4
- package/dist/kanagawa-lotus-BgoQro20.js +0 -4
- package/dist/kanagawa-wave-DgXEowHs.js +0 -4
- package/dist/laserwave-IxBH_3yW.js +0 -4
- package/dist/light-plus-S8JBx6is.js +0 -4
- package/dist/markdown-BoLBN0qH.js +0 -197
- package/dist/markdown.d.ts +0 -2
- package/dist/markdown.js +0 -2
- package/dist/marker.d.ts +0 -2
- package/dist/marker.js +0 -2
- package/dist/material-theme-D1f3HBq-.js +0 -4
- package/dist/material-theme-darker-ExzYhT0j.js +0 -4
- package/dist/material-theme-lighter-D6gH9nnA.js +0 -4
- package/dist/material-theme-ocean-D1w5BPAa.js +0 -4
- package/dist/material-theme-palenight-CkqWmVpF.js +0 -4
- package/dist/message-parts.d.ts +0 -2
- package/dist/message-parts.js +0 -2
- package/dist/message.d.ts +0 -2
- package/dist/message.js +0 -2
- package/dist/min-dark-npsJH98j.js +0 -4
- package/dist/min-light-DUk1XsVt.js +0 -4
- package/dist/monokai-CfFRWUNl.js +0 -4
- package/dist/multi-file-diff.d.ts +0 -2
- package/dist/multi-file-diff.js +0 -2
- package/dist/night-owl-BS7V-av_.js +0 -4
- package/dist/night-owl-light-CZtRawYE.js +0 -4
- package/dist/nord-BFh54Nqz.js +0 -4
- package/dist/one-dark-pro-zDovGosB.js +0 -4
- package/dist/one-light-gmHK3iK6.js +0 -4
- package/dist/patch-diff.d.ts +0 -2
- package/dist/patch-diff.js +0 -2
- package/dist/plastic-DtdaCjub.js +0 -4
- package/dist/poimandres-Hdda6aHK.js +0 -4
- package/dist/primitive-rail.d.ts +0 -222
- package/dist/primitive-rail.js +0 -348
- package/dist/prompt-input.d.ts +0 -2
- package/dist/prompt-input.js +0 -2
- package/dist/red-VqZFRByZ.js +0 -4
- package/dist/rose-pine-DiTkEueR.js +0 -4
- package/dist/rose-pine-dawn-tfo5y2X0.js +0 -4
- package/dist/rose-pine-moon-C0gON9XN.js +0 -4
- package/dist/runtime-type-DlCscMfw.js +0 -59
- package/dist/slack-dark-v8P_eXr6.js +0 -4
- package/dist/slack-ochin-D8SyEdKz.js +0 -4
- package/dist/snazzy-light-BtkQkvXb.js +0 -4
- package/dist/solarized-dark-B8nAdMfM.js +0 -4
- package/dist/solarized-light-B-3F1INj.js +0 -4
- package/dist/sync-status.d.ts +0 -2
- package/dist/sync-status.js +0 -2
- package/dist/synthwave-84-DcsXCF_c.js +0 -4
- package/dist/tokyo-night-Bvpqduda.js +0 -4
- package/dist/tool-list.d.ts +0 -2
- package/dist/tool-list.js +0 -2
- package/dist/trace-run.d.ts +0 -2
- package/dist/trace-run.js +0 -2
- package/dist/trace.d.ts +0 -2
- package/dist/trace.js +0 -2
- package/dist/unresolved-file.d.ts +0 -2
- package/dist/unresolved-file.js +0 -2
- package/dist/vesper-CfxmMOy3.js +0 -4
- package/dist/vitesse-black-D9-_1mjV.js +0 -4
- package/dist/vitesse-dark-DlSMLlr9.js +0 -4
- package/dist/vitesse-light-KRWWWztf.js +0 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { PropType } from "vue";
|
|
2
|
-
import { MarkdownProps } from "@comark/vue";
|
|
2
|
+
import { MarkdownDocumentProps, MarkdownProps } from "@comark/vue";
|
|
3
3
|
//#region src/components/markdown.d.ts
|
|
4
|
-
|
|
4
|
+
export type MarkdownValue = string | NonNullable<MarkdownDocumentProps["value"]>;
|
|
5
|
+
export declare const Markdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
6
|
components: {
|
|
6
7
|
type: PropType<MarkdownProps["components"]>;
|
|
7
8
|
};
|
|
@@ -17,7 +18,7 @@ declare const Markdown$1: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
17
18
|
};
|
|
18
19
|
value: {
|
|
19
20
|
default: string;
|
|
20
|
-
type:
|
|
21
|
+
type: PropType<MarkdownValue>;
|
|
21
22
|
};
|
|
22
23
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
24
|
[key: string]: any;
|
|
@@ -37,11 +38,10 @@ declare const Markdown$1: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
37
38
|
};
|
|
38
39
|
value: {
|
|
39
40
|
default: string;
|
|
40
|
-
type:
|
|
41
|
+
type: PropType<MarkdownValue>;
|
|
41
42
|
};
|
|
42
43
|
}>> & Readonly<{}>, {
|
|
44
|
+
value: MarkdownValue;
|
|
43
45
|
streaming: boolean;
|
|
44
|
-
value: string;
|
|
45
46
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { Markdown$1 as t };
|
|
47
|
+
//#endregion
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { i as useViteHubUI } from "../../config-Dk67emQt.js";
|
|
2
|
+
import { Suspense, defineAsyncComponent, defineComponent, getCurrentInstance, h } from "vue";
|
|
3
|
+
//#region src/components/markdown.ts
|
|
4
|
+
const MarkdownRenderer = defineAsyncComponent(() => import("./markdown-renderer.js").then((module) => module.MarkdownRenderer));
|
|
5
|
+
const Markdown = defineComponent({
|
|
6
|
+
name: "Markdown",
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
props: {
|
|
9
|
+
components: { type: Object },
|
|
10
|
+
options: { type: Object },
|
|
11
|
+
plugins: { type: Array },
|
|
12
|
+
streaming: {
|
|
13
|
+
default: false,
|
|
14
|
+
type: Boolean
|
|
15
|
+
},
|
|
16
|
+
value: {
|
|
17
|
+
default: "",
|
|
18
|
+
type: [String, Object]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
setup(props, { attrs }) {
|
|
22
|
+
const instance = getCurrentInstance();
|
|
23
|
+
const hasParentSuspense = Boolean(instance && "suspense" in instance && instance.suspense);
|
|
24
|
+
const defaults = useViteHubUI();
|
|
25
|
+
return () => {
|
|
26
|
+
const markdown = () => h(MarkdownRenderer, {
|
|
27
|
+
...attrs,
|
|
28
|
+
class: [defaults.markdown.class, attrs.class],
|
|
29
|
+
components: props.components,
|
|
30
|
+
options: props.options,
|
|
31
|
+
plugins: props.plugins,
|
|
32
|
+
streaming: props.streaming,
|
|
33
|
+
value: props.value
|
|
34
|
+
});
|
|
35
|
+
if (hasParentSuspense) return markdown();
|
|
36
|
+
return h(Suspense, null, {
|
|
37
|
+
default: markdown,
|
|
38
|
+
fallback: () => h("div", {
|
|
39
|
+
...attrs,
|
|
40
|
+
class: [defaults.markdown.class, attrs.class]
|
|
41
|
+
}, typeof props.value === "string" ? props.value : "")
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { Markdown };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropType } from "vue";
|
|
2
2
|
//#region src/components/marker.d.ts
|
|
3
|
-
type MarkerVariant = "default" | "border" | "separator";
|
|
4
|
-
declare const Marker: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
export type MarkerVariant = "default" | "border" | "separator";
|
|
4
|
+
export declare const Marker: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
as: {
|
|
6
6
|
default: string;
|
|
7
7
|
type: PropType<string | import("vue").Component>;
|
|
@@ -25,11 +25,10 @@ declare const Marker: import("vue").DefineComponent<import("vue").ExtractPropTyp
|
|
|
25
25
|
as: string | import("vue").Component;
|
|
26
26
|
variant: MarkerVariant;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
-
declare const MarkerIcon: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
28
|
+
export declare const MarkerIcon: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
29
29
|
[key: string]: any;
|
|
30
30
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
-
declare const MarkerContent: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
31
|
+
export declare const MarkerContent: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
32
|
[key: string]: any;
|
|
33
33
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { MarkerVariant as i, MarkerContent as n, MarkerIcon as r, Marker as t };
|
|
34
|
+
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as slotPart, t as asProp } from "../../slot-part-Doic71uh.js";
|
|
2
2
|
import { defineComponent, h } from "vue";
|
|
3
3
|
//#region src/components/marker.ts
|
|
4
4
|
const Marker = defineComponent({
|
|
@@ -20,4 +20,4 @@ const Marker = defineComponent({
|
|
|
20
20
|
const MarkerIcon = slotPart("MarkerIcon", "marker-icon", "span", { "aria-hidden": "true" });
|
|
21
21
|
const MarkerContent = slotPart("MarkerContent", "marker-content", "span");
|
|
22
22
|
//#endregion
|
|
23
|
-
export { MarkerContent
|
|
23
|
+
export { Marker, MarkerContent, MarkerIcon };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropType } from "vue";
|
|
2
2
|
import { UIMessage } from "ai";
|
|
3
3
|
//#region src/components/message-parts.d.ts
|
|
4
|
-
declare const MessageParts: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
export declare const MessageParts: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
parts: {
|
|
6
6
|
required: true;
|
|
7
7
|
type: PropType<UIMessage["parts"]>;
|
|
@@ -24,5 +24,4 @@ declare const MessageParts: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
24
24
|
}>> & Readonly<{}>, {
|
|
25
25
|
streaming: boolean;
|
|
26
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { MessageParts as t };
|
|
27
|
+
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
1
|
+
import { Markdown } from "./markdown.js";
|
|
2
|
+
import { t as ImagePreview } from "../../image-preview-C9tdkmEj.js";
|
|
3
3
|
import { defineComponent, h } from "vue";
|
|
4
|
-
import { MessageParts } from "comark-chat/vue";
|
|
4
|
+
import { MessageParts as MessageParts$1 } from "comark-chat/vue";
|
|
5
5
|
//#region src/components/message-parts.ts
|
|
6
|
-
const MessageParts
|
|
6
|
+
const MessageParts = defineComponent({
|
|
7
7
|
name: "MessageParts",
|
|
8
8
|
props: {
|
|
9
9
|
parts: {
|
|
@@ -16,7 +16,7 @@ const MessageParts$1 = defineComponent({
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
setup(props, { slots }) {
|
|
19
|
-
return () => h(MessageParts, {
|
|
19
|
+
return () => h(MessageParts$1, {
|
|
20
20
|
class: "vh-message-parts",
|
|
21
21
|
"data-slot": "message-parts",
|
|
22
22
|
parts: props.parts,
|
|
@@ -35,4 +35,4 @@ const MessageParts$1 = defineComponent({
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
//#endregion
|
|
38
|
-
export { MessageParts
|
|
38
|
+
export { MessageParts };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PropType } from "vue";
|
|
2
2
|
//#region src/components/message.d.ts
|
|
3
|
-
type MessageAlign = "start" | "end";
|
|
4
|
-
declare const MessageGroup: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
+
export type MessageAlign = "start" | "end";
|
|
4
|
+
export declare const MessageGroup: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
-
declare const Message: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
+
export declare const Message: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
align: {
|
|
9
9
|
default: string;
|
|
10
10
|
type: PropType<MessageAlign>;
|
|
@@ -19,17 +19,16 @@ declare const Message: import("vue").DefineComponent<import("vue").ExtractPropTy
|
|
|
19
19
|
}>> & Readonly<{}>, {
|
|
20
20
|
align: MessageAlign;
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
-
declare const MessageAvatar: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
export declare const MessageAvatar: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
|
-
declare const MessageContent: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
|
+
export declare const MessageContent: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
26
|
[key: string]: any;
|
|
27
27
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
-
declare const MessageHeader: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
28
|
+
export declare const MessageHeader: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
29
29
|
[key: string]: any;
|
|
30
30
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
-
declare const MessageFooter: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
31
|
+
export declare const MessageFooter: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
32
|
[key: string]: any;
|
|
33
33
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { MessageFooter as a, MessageContent as i, MessageAlign as n, MessageGroup as o, MessageAvatar as r, MessageHeader as s, Message as t };
|
|
34
|
+
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as slotPart } from "../../slot-part-Doic71uh.js";
|
|
2
2
|
import { defineComponent, h } from "vue";
|
|
3
3
|
//#region src/components/message.ts
|
|
4
4
|
const MessageGroup = slotPart("MessageGroup", "message-group");
|
|
@@ -20,4 +20,4 @@ const MessageContent = slotPart("MessageContent", "message-content");
|
|
|
20
20
|
const MessageHeader = slotPart("MessageHeader", "message-header");
|
|
21
21
|
const MessageFooter = slotPart("MessageFooter", "message-footer");
|
|
22
22
|
//#endregion
|
|
23
|
-
export {
|
|
23
|
+
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PropType } from "vue";
|
|
2
2
|
import { ChatStatus, FileUIPart } from "ai";
|
|
3
3
|
//#region src/components/prompt-input.d.ts
|
|
4
|
-
interface PromptInputSubmit {
|
|
4
|
+
export interface PromptInputSubmit {
|
|
5
5
|
files: readonly FileUIPart[];
|
|
6
6
|
text: string;
|
|
7
7
|
}
|
|
8
|
-
declare const PromptInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
export declare const PromptInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
9
|
accept: {
|
|
10
10
|
type: StringConstructor;
|
|
11
11
|
};
|
|
@@ -13,13 +13,33 @@ declare const PromptInput: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
13
13
|
default: boolean;
|
|
14
14
|
type: BooleanConstructor;
|
|
15
15
|
};
|
|
16
|
+
/** The attach button's look: `outline`, or `ghost` for a muted icon in a box that has its own frame. */
|
|
17
|
+
attachVariant: {
|
|
18
|
+
default: string;
|
|
19
|
+
type: PropType<"outline" | "ghost">;
|
|
20
|
+
};
|
|
21
|
+
/** The prompt takes no input: the field, the attach button, Send, and Retry are disabled. Stop stays pressable. */
|
|
22
|
+
disabled: {
|
|
23
|
+
default: boolean;
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
};
|
|
16
26
|
files: {
|
|
17
27
|
default: () => never[];
|
|
18
28
|
type: PropType<readonly FileUIPart[]>;
|
|
19
29
|
};
|
|
30
|
+
/** Prevent adding and removing files while a consumer submits them. Text stays editable. */
|
|
31
|
+
filesDisabled: {
|
|
32
|
+
default: boolean;
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
};
|
|
20
35
|
filterFiles: {
|
|
21
36
|
type: PropType<(files: readonly File[]) => readonly File[]>;
|
|
22
37
|
};
|
|
38
|
+
/** The text is being sent: the field is read-only, Enter does nothing, and Send shows a spinner. */
|
|
39
|
+
readonly: {
|
|
40
|
+
default: boolean;
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
};
|
|
23
43
|
modelValue: {
|
|
24
44
|
default: string;
|
|
25
45
|
type: StringConstructor;
|
|
@@ -41,7 +61,7 @@ declare const PromptInput: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
41
61
|
};
|
|
42
62
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
43
63
|
[key: string]: any;
|
|
44
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("error" | "submit" | "
|
|
64
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("error" | "submit" | "stop" | "update:modelValue" | "reload" | "update:files")[], "error" | "submit" | "stop" | "update:modelValue" | "reload" | "update:files", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
65
|
accept: {
|
|
46
66
|
type: StringConstructor;
|
|
47
67
|
};
|
|
@@ -49,13 +69,33 @@ declare const PromptInput: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
49
69
|
default: boolean;
|
|
50
70
|
type: BooleanConstructor;
|
|
51
71
|
};
|
|
72
|
+
/** The attach button's look: `outline`, or `ghost` for a muted icon in a box that has its own frame. */
|
|
73
|
+
attachVariant: {
|
|
74
|
+
default: string;
|
|
75
|
+
type: PropType<"outline" | "ghost">;
|
|
76
|
+
};
|
|
77
|
+
/** The prompt takes no input: the field, the attach button, Send, and Retry are disabled. Stop stays pressable. */
|
|
78
|
+
disabled: {
|
|
79
|
+
default: boolean;
|
|
80
|
+
type: BooleanConstructor;
|
|
81
|
+
};
|
|
52
82
|
files: {
|
|
53
83
|
default: () => never[];
|
|
54
84
|
type: PropType<readonly FileUIPart[]>;
|
|
55
85
|
};
|
|
86
|
+
/** Prevent adding and removing files while a consumer submits them. Text stays editable. */
|
|
87
|
+
filesDisabled: {
|
|
88
|
+
default: boolean;
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
};
|
|
56
91
|
filterFiles: {
|
|
57
92
|
type: PropType<(files: readonly File[]) => readonly File[]>;
|
|
58
93
|
};
|
|
94
|
+
/** The text is being sent: the field is read-only, Enter does nothing, and Send shows a spinner. */
|
|
95
|
+
readonly: {
|
|
96
|
+
default: boolean;
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
};
|
|
59
99
|
modelValue: {
|
|
60
100
|
default: string;
|
|
61
101
|
type: StringConstructor;
|
|
@@ -78,16 +118,19 @@ declare const PromptInput: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
78
118
|
}>> & Readonly<{
|
|
79
119
|
onError?: ((...args: any[]) => any) | undefined;
|
|
80
120
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
81
|
-
onReload?: ((...args: any[]) => any) | undefined;
|
|
82
|
-
onStop?: ((...args: any[]) => any) | undefined;
|
|
83
|
-
"onUpdate:files"?: ((...args: any[]) => any) | undefined;
|
|
84
121
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
122
|
+
"onUpdate:files"?: ((...args: any[]) => any) | undefined;
|
|
123
|
+
onStop?: ((...args: any[]) => any) | undefined;
|
|
124
|
+
onReload?: ((...args: any[]) => any) | undefined;
|
|
85
125
|
}>, {
|
|
126
|
+
multiple: boolean;
|
|
127
|
+
disabled: boolean;
|
|
128
|
+
modelValue: string;
|
|
129
|
+
readonly: boolean;
|
|
86
130
|
status: ChatStatus;
|
|
87
|
-
attachments: boolean;
|
|
88
131
|
files: readonly FileUIPart[];
|
|
89
|
-
|
|
90
|
-
|
|
132
|
+
attachments: boolean;
|
|
133
|
+
attachVariant: "ghost" | "outline";
|
|
134
|
+
filesDisabled: boolean;
|
|
91
135
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
92
|
-
//#endregion
|
|
93
|
-
export { PromptInputSubmit as n, PromptInput as t };
|
|
136
|
+
//#endregion
|
|
@@ -1,93 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (!accept) return true;
|
|
8
|
-
return accept.split(",").some((entry) => {
|
|
9
|
-
const value = entry.trim();
|
|
10
|
-
if (value.startsWith(".")) return file.name.toLowerCase().endsWith(value.toLowerCase());
|
|
11
|
-
if (value.endsWith("/*")) return file.type.startsWith(value.slice(0, -1));
|
|
12
|
-
return file.type === value;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function fileToDataUrl(file) {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
const reader = new FileReader();
|
|
18
|
-
reader.onerror = () => reject(reader.error ?? uiErrorDiagnostics.UI_R0001({ message: `Could not read ${file.name}.` }));
|
|
19
|
-
reader.onload = () => resolve(String(reader.result));
|
|
20
|
-
reader.readAsDataURL(file);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
async function fileToUIPart(file) {
|
|
24
|
-
return {
|
|
25
|
-
filename: file.name,
|
|
26
|
-
mediaType: file.type || "application/octet-stream",
|
|
27
|
-
type: "file",
|
|
28
|
-
url: await fileToDataUrl(file)
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function useAgentAttachments(options = {}) {
|
|
32
|
-
const files = ref([]);
|
|
33
|
-
const accept = computed(() => options.accept);
|
|
34
|
-
const revoke = (attachment) => {
|
|
35
|
-
if (attachment.previewUrl?.startsWith("blob:")) URL.revokeObjectURL(attachment.previewUrl);
|
|
36
|
-
};
|
|
37
|
-
const remove = (id) => {
|
|
38
|
-
const attachment = files.value.find((item) => item.id === id);
|
|
39
|
-
if (attachment) revoke(attachment);
|
|
40
|
-
files.value = files.value.filter((item) => item.id !== id);
|
|
41
|
-
};
|
|
42
|
-
const clear = () => {
|
|
43
|
-
files.value.forEach(revoke);
|
|
44
|
-
files.value = [];
|
|
45
|
-
};
|
|
46
|
-
const add = (input) => {
|
|
47
|
-
for (const file of Array.from(input)) {
|
|
48
|
-
if (!matchesAccept(file, options.accept)) {
|
|
49
|
-
options.onReject?.(file, "type");
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (options.maxSize !== void 0 && file.size > options.maxSize) {
|
|
53
|
-
options.onReject?.(file, "size");
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (options.multiple === false && files.value.length > 0 || options.maxFiles !== void 0 && files.value.length >= options.maxFiles) {
|
|
57
|
-
options.onReject?.(file, "count");
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
const previewUrl = file.type.startsWith("image/") && typeof URL.createObjectURL === "function" ? URL.createObjectURL(file) : void 0;
|
|
61
|
-
files.value.push({
|
|
62
|
-
file,
|
|
63
|
-
id: globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${file.name}`,
|
|
64
|
-
previewUrl
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
onScopeDispose(clear);
|
|
69
|
-
return {
|
|
70
|
-
accept,
|
|
71
|
-
add,
|
|
72
|
-
clear,
|
|
73
|
-
files,
|
|
74
|
-
inputProps: computed(() => ({
|
|
75
|
-
accept: options.accept,
|
|
76
|
-
multiple: options.multiple ?? true,
|
|
77
|
-
type: "file"
|
|
78
|
-
})),
|
|
79
|
-
remove,
|
|
80
|
-
async toFileParts() {
|
|
81
|
-
return Promise.all(files.value.map(({ file }) => fileToUIPart(file)));
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/internal/prompt-files.ts
|
|
87
|
-
function nextPromptFiles(current, selected, multiple) {
|
|
88
|
-
return multiple ? [...current, ...selected] : selected.slice(-1);
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
|
|
2
|
+
import { a as useViteHubUIIcons } from "../../config-Dk67emQt.js";
|
|
3
|
+
import { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentGroup, AttachmentMedia, AttachmentTitle } from "./attachment.js";
|
|
4
|
+
import { t as ImagePreview } from "../../image-preview-C9tdkmEj.js";
|
|
5
|
+
import { a as nextPromptFiles, n as fileToUIPart } from "../../attachments-BzTwqRTU.js";
|
|
6
|
+
import { computed, defineComponent, h, onBeforeUnmount, onMounted, ref } from "vue";
|
|
91
7
|
//#region src/components/prompt-input.ts
|
|
92
8
|
const submitLabels = {
|
|
93
9
|
error: "Retry prompt",
|
|
@@ -96,10 +12,10 @@ const submitLabels = {
|
|
|
96
12
|
submitted: "Stop response"
|
|
97
13
|
};
|
|
98
14
|
const submitIcons = {
|
|
99
|
-
error: "
|
|
100
|
-
ready: "
|
|
101
|
-
streaming: "
|
|
102
|
-
submitted: "
|
|
15
|
+
error: "reload",
|
|
16
|
+
ready: "arrowUp",
|
|
17
|
+
streaming: "stop",
|
|
18
|
+
submitted: "stop"
|
|
103
19
|
};
|
|
104
20
|
/** Whether the device has only coarse pointers, such as a phone. A tablet with a trackpad or a mouse is not touch only. */
|
|
105
21
|
function touchOnly() {
|
|
@@ -114,11 +30,31 @@ const PromptInput = defineComponent({
|
|
|
114
30
|
default: true,
|
|
115
31
|
type: Boolean
|
|
116
32
|
},
|
|
33
|
+
/** The attach button's look: `outline`, or `ghost` for a muted icon in a box that has its own frame. */
|
|
34
|
+
attachVariant: {
|
|
35
|
+
default: "outline",
|
|
36
|
+
type: String
|
|
37
|
+
},
|
|
38
|
+
/** The prompt takes no input: the field, the attach button, Send, and Retry are disabled. Stop stays pressable. */
|
|
39
|
+
disabled: {
|
|
40
|
+
default: false,
|
|
41
|
+
type: Boolean
|
|
42
|
+
},
|
|
117
43
|
files: {
|
|
118
44
|
default: () => [],
|
|
119
45
|
type: Array
|
|
120
46
|
},
|
|
47
|
+
/** Prevent adding and removing files while a consumer submits them. Text stays editable. */
|
|
48
|
+
filesDisabled: {
|
|
49
|
+
default: false,
|
|
50
|
+
type: Boolean
|
|
51
|
+
},
|
|
121
52
|
filterFiles: { type: Function },
|
|
53
|
+
/** The text is being sent: the field is read-only, Enter does nothing, and Send shows a spinner. */
|
|
54
|
+
readonly: {
|
|
55
|
+
default: false,
|
|
56
|
+
type: Boolean
|
|
57
|
+
},
|
|
122
58
|
modelValue: {
|
|
123
59
|
default: "",
|
|
124
60
|
type: String
|
|
@@ -148,17 +84,26 @@ const PromptInput = defineComponent({
|
|
|
148
84
|
const form = ref(null);
|
|
149
85
|
const pendingFiles = ref(0);
|
|
150
86
|
const preparingFiles = computed(() => pendingFiles.value > 0);
|
|
151
|
-
const canSubmit = computed(() => props.status === "ready" && !preparingFiles.value && (props.modelValue.trim().length > 0 || props.files.length > 0));
|
|
87
|
+
const canSubmit = computed(() => props.status === "ready" && !props.disabled && !props.readonly && !preparingFiles.value && (props.modelValue.trim().length > 0 || props.files.length > 0));
|
|
88
|
+
const touch = ref(false);
|
|
89
|
+
onMounted(() => {
|
|
90
|
+
touch.value = touchOnly();
|
|
91
|
+
});
|
|
152
92
|
let disposed = false;
|
|
153
93
|
let nextBatch = 0;
|
|
154
94
|
const convertedBatches = /* @__PURE__ */ new Map();
|
|
155
95
|
onBeforeUnmount(() => {
|
|
156
96
|
disposed = true;
|
|
157
97
|
});
|
|
158
|
-
const UButton =
|
|
159
|
-
const UIcon =
|
|
160
|
-
const
|
|
98
|
+
const UButton = useUIComponent("UButton");
|
|
99
|
+
const UIcon = useUIComponent("UIcon");
|
|
100
|
+
const icons = useViteHubUIIcons();
|
|
101
|
+
const filesDisabled = computed(() => props.disabled || props.filesDisabled);
|
|
102
|
+
const remove = (index) => {
|
|
103
|
+
if (!filesDisabled.value) emit("update:files", props.files.filter((_, current) => current !== index));
|
|
104
|
+
};
|
|
161
105
|
const addFiles = async (input, onAccepted) => {
|
|
106
|
+
if (filesDisabled.value) return;
|
|
162
107
|
const batch = nextBatch++;
|
|
163
108
|
pendingFiles.value++;
|
|
164
109
|
try {
|
|
@@ -211,11 +156,12 @@ const PromptInput = defineComponent({
|
|
|
211
156
|
alt: label,
|
|
212
157
|
compact: true,
|
|
213
158
|
src: file.url
|
|
214
|
-
}) : h(UIcon, { name:
|
|
159
|
+
}) : h(UIcon, { name: icons.value.file })),
|
|
215
160
|
h(AttachmentContent, () => h(AttachmentTitle, () => label)),
|
|
216
161
|
h(AttachmentActions, () => h(AttachmentAction, {
|
|
217
162
|
"aria-label": `Remove ${file.filename ?? "attachment"}`,
|
|
218
|
-
|
|
163
|
+
disabled: filesDisabled.value,
|
|
164
|
+
icon: icons.value.close,
|
|
219
165
|
onClick: () => remove(index)
|
|
220
166
|
}))
|
|
221
167
|
]);
|
|
@@ -225,7 +171,10 @@ const PromptInput = defineComponent({
|
|
|
225
171
|
"data-slot": "prompt-input",
|
|
226
172
|
onSubmit: submit,
|
|
227
173
|
ref: form
|
|
228
|
-
}, [h("div", {
|
|
174
|
+
}, [h("div", {
|
|
175
|
+
"data-focus-frame": "",
|
|
176
|
+
"data-slot": "prompt-input-group"
|
|
177
|
+
}, [
|
|
229
178
|
props.files.length > 0 || slots.files ? slots.files?.({
|
|
230
179
|
files: props.files,
|
|
231
180
|
remove
|
|
@@ -233,15 +182,19 @@ const PromptInput = defineComponent({
|
|
|
233
182
|
h("textarea", {
|
|
234
183
|
"aria-label": attrs["aria-label"] ?? "Message",
|
|
235
184
|
"data-slot": "prompt-input-textarea",
|
|
185
|
+
enterkeyhint: touch.value ? "enter" : "send",
|
|
236
186
|
onInput: (event) => emit("update:modelValue", event.target.value),
|
|
237
187
|
onKeydown: (event) => {
|
|
238
188
|
if (event.key !== "Enter" || event.shiftKey || event.ctrlKey || event.metaKey || event.altKey || event.isComposing) return;
|
|
239
189
|
if (touchOnly()) return;
|
|
240
190
|
event.preventDefault();
|
|
241
|
-
if (props.status === "ready") form.value?.requestSubmit();
|
|
191
|
+
if (props.status === "ready" && !props.disabled && !props.readonly) form.value?.requestSubmit();
|
|
242
192
|
},
|
|
243
193
|
onPaste: paste,
|
|
244
194
|
placeholder: props.placeholder,
|
|
195
|
+
"aria-busy": props.readonly ? "true" : void 0,
|
|
196
|
+
disabled: props.disabled,
|
|
197
|
+
readonly: props.readonly,
|
|
245
198
|
rows: 1,
|
|
246
199
|
value: props.modelValue
|
|
247
200
|
}),
|
|
@@ -249,7 +202,8 @@ const PromptInput = defineComponent({
|
|
|
249
202
|
props.attachments && h("input", {
|
|
250
203
|
accept: props.accept,
|
|
251
204
|
"aria-label": "Add attachment",
|
|
252
|
-
|
|
205
|
+
"data-slot": "visually-hidden",
|
|
206
|
+
disabled: filesDisabled.value,
|
|
253
207
|
multiple: props.multiple,
|
|
254
208
|
onChange: async (event) => {
|
|
255
209
|
const target = event.currentTarget;
|
|
@@ -263,14 +217,15 @@ const PromptInput = defineComponent({
|
|
|
263
217
|
}),
|
|
264
218
|
slots.actions?.() ?? (props.attachments && h(UButton, {
|
|
265
219
|
"aria-label": "Add attachment",
|
|
266
|
-
class: "rounded-full",
|
|
220
|
+
class: props.attachVariant === "ghost" ? "rounded-full text-muted hover:text-default" : "rounded-full",
|
|
267
221
|
color: "neutral",
|
|
268
|
-
|
|
222
|
+
disabled: filesDisabled.value,
|
|
223
|
+
icon: icons.value.plus,
|
|
269
224
|
onClick: () => input.value?.click(),
|
|
270
225
|
size: "sm",
|
|
271
226
|
square: true,
|
|
272
227
|
type: "button",
|
|
273
|
-
variant:
|
|
228
|
+
variant: props.attachVariant
|
|
274
229
|
})),
|
|
275
230
|
slots["footer-leading"]?.(),
|
|
276
231
|
h("span", { "data-slot": "prompt-input-spacer" }),
|
|
@@ -282,18 +237,18 @@ const PromptInput = defineComponent({
|
|
|
282
237
|
"aria-label": props.status === "ready" && props.submitLabel ? props.submitLabel : submitLabels[props.status],
|
|
283
238
|
class: "rounded-full",
|
|
284
239
|
color: "neutral",
|
|
285
|
-
disabled: props.status === "ready" && !canSubmit.value,
|
|
286
|
-
icon: submitIcons[props.status],
|
|
287
|
-
loading: props.status === "ready" && preparingFiles.value,
|
|
240
|
+
disabled: props.status === "ready" && !canSubmit.value || props.disabled && props.status === "error",
|
|
241
|
+
icon: icons.value[submitIcons[props.status]],
|
|
242
|
+
loading: props.status === "ready" && (preparingFiles.value || props.readonly),
|
|
288
243
|
onClick: pressSubmit,
|
|
289
244
|
size: "sm",
|
|
290
245
|
square: true,
|
|
291
246
|
type: "button",
|
|
292
|
-
variant: "solid"
|
|
247
|
+
variant: props.status === "ready" && !canSubmit.value ? "soft" : "solid"
|
|
293
248
|
})
|
|
294
249
|
])
|
|
295
250
|
])]);
|
|
296
251
|
}
|
|
297
252
|
});
|
|
298
253
|
//#endregion
|
|
299
|
-
export {
|
|
254
|
+
export { PromptInput };
|