@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
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
|
|
2
|
+
import { icon, providerLogo } from "./icons.js";
|
|
3
|
+
import { computed, defineComponent, h, ref, useId } from "vue";
|
|
4
|
+
//#region src/workspace/connect-panel.ts
|
|
5
|
+
const providerInfo = {
|
|
6
|
+
anthropic: {
|
|
7
|
+
label: "Anthropic",
|
|
8
|
+
tokenUrl: "https://console.anthropic.com/settings/keys"
|
|
9
|
+
},
|
|
10
|
+
cloudflare: {
|
|
11
|
+
label: "Cloudflare",
|
|
12
|
+
tokenUrl: "https://dash.cloudflare.com/profile/api-tokens"
|
|
13
|
+
},
|
|
14
|
+
github: {
|
|
15
|
+
label: "GitHub",
|
|
16
|
+
tokenUrl: "https://github.com/settings/personal-access-tokens/new"
|
|
17
|
+
},
|
|
18
|
+
netlify: {
|
|
19
|
+
label: "Netlify",
|
|
20
|
+
tokenUrl: "https://app.netlify.com/user/applications#personal-access-tokens"
|
|
21
|
+
},
|
|
22
|
+
openai: {
|
|
23
|
+
label: "OpenAI",
|
|
24
|
+
tokenUrl: "https://platform.openai.com/api-keys"
|
|
25
|
+
},
|
|
26
|
+
vercel: {
|
|
27
|
+
label: "Vercel",
|
|
28
|
+
tokenUrl: "https://vercel.com/account/settings/tokens"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const groups = [
|
|
32
|
+
{
|
|
33
|
+
kind: "deploy",
|
|
34
|
+
label: "Deploy"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
kind: "source",
|
|
38
|
+
label: "Source"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
kind: "model",
|
|
42
|
+
label: "Model keys"
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
function connectProviderLabel(name) {
|
|
46
|
+
return providerInfo[name].label;
|
|
47
|
+
}
|
|
48
|
+
function defaultState(provider) {
|
|
49
|
+
return { status: provider.reach === "relay" ? "needs-relay" : "idle" };
|
|
50
|
+
}
|
|
51
|
+
function copyButton(text, onCopy) {
|
|
52
|
+
return h("button", {
|
|
53
|
+
class: "vh-ws-button",
|
|
54
|
+
type: "button",
|
|
55
|
+
onClick: () => onCopy(text)
|
|
56
|
+
}, [icon("copy"), "Copy command"]);
|
|
57
|
+
}
|
|
58
|
+
/** One provider: logo, label, one status line, and one action. */
|
|
59
|
+
const ConnectProviderRow = defineComponent({
|
|
60
|
+
name: "ConnectProviderRow",
|
|
61
|
+
props: {
|
|
62
|
+
provider: {
|
|
63
|
+
required: true,
|
|
64
|
+
type: Object
|
|
65
|
+
},
|
|
66
|
+
state: {
|
|
67
|
+
default: void 0,
|
|
68
|
+
type: Object
|
|
69
|
+
},
|
|
70
|
+
/** Where the reader learns to deploy a relay. */
|
|
71
|
+
relayUrl: {
|
|
72
|
+
default: void 0,
|
|
73
|
+
type: String
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
emits: {
|
|
77
|
+
connect: (token) => typeof token === "string",
|
|
78
|
+
oauth: (provider) => provider.auth === "oauth",
|
|
79
|
+
disconnect: () => true,
|
|
80
|
+
"copy-command": (command) => typeof command === "string"
|
|
81
|
+
},
|
|
82
|
+
setup(props, { emit }) {
|
|
83
|
+
const open = ref(false);
|
|
84
|
+
const token = ref("");
|
|
85
|
+
const inputId = useId();
|
|
86
|
+
const UInput = useUIComponent("UInput");
|
|
87
|
+
const state = computed(() => props.state ?? defaultState(props.provider));
|
|
88
|
+
const label = computed(() => connectProviderLabel(props.provider.name));
|
|
89
|
+
function startEdit() {
|
|
90
|
+
open.value = true;
|
|
91
|
+
}
|
|
92
|
+
function submit(event) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
const value = token.value.trim();
|
|
95
|
+
if (!value) return;
|
|
96
|
+
emit("connect", value);
|
|
97
|
+
token.value = "";
|
|
98
|
+
open.value = false;
|
|
99
|
+
}
|
|
100
|
+
const copy = (command) => emit("copy-command", command);
|
|
101
|
+
function statusLine() {
|
|
102
|
+
const { status, account, message } = state.value;
|
|
103
|
+
const env = h("code", { class: "vh-ws-env" }, props.provider.env);
|
|
104
|
+
switch (status) {
|
|
105
|
+
case "connecting": return h("span", "Checking the token...");
|
|
106
|
+
case "connected": return h("span", { class: "vh-ws-connected" }, [
|
|
107
|
+
icon("check"),
|
|
108
|
+
h("span", { class: "vh-ws-sr-only" }, "Connected: "),
|
|
109
|
+
account ? `${account} · ` : "",
|
|
110
|
+
env
|
|
111
|
+
]);
|
|
112
|
+
case "error": return h("span", { class: "vh-ws-error" }, message ?? (props.provider.auth === "oauth" ? `${label.value} connection failed. Sign in again.` : `${label.value} rejected the token. Paste a new one.`));
|
|
113
|
+
case "blocked": return h("span", { class: "vh-ws-error" }, message ?? `${label.value} blocked the request.`);
|
|
114
|
+
case "needs-relay": return h("span", message ?? `Needs a relay. ${label.value} does not accept browser requests.`);
|
|
115
|
+
case "unavailable": return h("span", message ?? "Run this step on your machine.");
|
|
116
|
+
case "idle": return h("span", message ?? (props.provider.auth === "oauth" ? "Sign in to connect" : "Paste a token"));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function action() {
|
|
120
|
+
const { status, command } = state.value;
|
|
121
|
+
const relay = props.relayUrl ? h("a", {
|
|
122
|
+
class: "vh-ws-button",
|
|
123
|
+
href: props.relayUrl,
|
|
124
|
+
rel: "noopener",
|
|
125
|
+
target: "_blank"
|
|
126
|
+
}, "Set up relay") : void 0;
|
|
127
|
+
switch (status) {
|
|
128
|
+
case "connected": return h("button", {
|
|
129
|
+
"aria-label": `Disconnect ${label.value}`,
|
|
130
|
+
class: "vh-ws-button",
|
|
131
|
+
type: "button",
|
|
132
|
+
onClick: () => emit("disconnect")
|
|
133
|
+
}, "Disconnect");
|
|
134
|
+
case "connecting": return h("button", {
|
|
135
|
+
class: "vh-ws-button",
|
|
136
|
+
disabled: true,
|
|
137
|
+
type: "button"
|
|
138
|
+
}, "Connecting");
|
|
139
|
+
case "blocked": return [relay, command ? copyButton(command, copy) : void 0].filter((node) => node !== void 0);
|
|
140
|
+
case "needs-relay": return relay;
|
|
141
|
+
case "unavailable": return command ? copyButton(command, copy) : void 0;
|
|
142
|
+
case "error":
|
|
143
|
+
case "idle":
|
|
144
|
+
if (props.provider.auth === "oauth") return h("button", {
|
|
145
|
+
"aria-label": `Connect ${label.value}`,
|
|
146
|
+
class: "vh-ws-button",
|
|
147
|
+
type: "button",
|
|
148
|
+
onClick: () => emit("oauth", props.provider)
|
|
149
|
+
}, "Connect");
|
|
150
|
+
return open.value ? void 0 : h("button", {
|
|
151
|
+
"aria-label": `Connect ${label.value}`,
|
|
152
|
+
class: "vh-ws-button",
|
|
153
|
+
type: "button",
|
|
154
|
+
onClick: startEdit
|
|
155
|
+
}, status === "error" ? "Paste a new token" : "Connect");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return () => h("li", {
|
|
159
|
+
class: "vh-ws-provider",
|
|
160
|
+
"data-provider": props.provider.name,
|
|
161
|
+
"data-status": state.value.status
|
|
162
|
+
}, [h("div", { class: "vh-ws-provider-row" }, [
|
|
163
|
+
providerLogo(props.provider.name),
|
|
164
|
+
h("div", { class: "vh-ws-provider-text" }, [h("span", { class: "vh-ws-provider-label" }, label.value), h("span", { class: "vh-ws-provider-status" }, [statusLine()])]),
|
|
165
|
+
h("div", { class: "vh-ws-provider-action" }, action())
|
|
166
|
+
]), open.value && props.provider.auth === "token" ? h("form", {
|
|
167
|
+
class: "vh-ws-token-form",
|
|
168
|
+
onSubmit: submit
|
|
169
|
+
}, [
|
|
170
|
+
h("label", {
|
|
171
|
+
class: "vh-ws-token-label",
|
|
172
|
+
for: inputId
|
|
173
|
+
}, `${label.value} token`),
|
|
174
|
+
h("div", { class: "vh-ws-token-row" }, [
|
|
175
|
+
h(UInput, {
|
|
176
|
+
autocapitalize: "off",
|
|
177
|
+
autocomplete: "off",
|
|
178
|
+
autofocus: true,
|
|
179
|
+
class: "vh-ws-input",
|
|
180
|
+
"data-1p-ignore": "",
|
|
181
|
+
id: inputId,
|
|
182
|
+
modelValue: token.value,
|
|
183
|
+
spellcheck: false,
|
|
184
|
+
type: "password",
|
|
185
|
+
"onUpdate:modelValue": (value) => {
|
|
186
|
+
token.value = String(value);
|
|
187
|
+
},
|
|
188
|
+
onKeydown: (event) => {
|
|
189
|
+
if (event.key === "Escape") open.value = false;
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
192
|
+
h("button", {
|
|
193
|
+
class: "vh-ws-button vh-ws-button--primary",
|
|
194
|
+
disabled: !token.value.trim(),
|
|
195
|
+
type: "submit"
|
|
196
|
+
}, "Save"),
|
|
197
|
+
h("button", {
|
|
198
|
+
class: "vh-ws-button",
|
|
199
|
+
type: "button",
|
|
200
|
+
onClick: () => {
|
|
201
|
+
open.value = false;
|
|
202
|
+
token.value = "";
|
|
203
|
+
}
|
|
204
|
+
}, "Cancel")
|
|
205
|
+
]),
|
|
206
|
+
h("a", {
|
|
207
|
+
class: "vh-ws-link",
|
|
208
|
+
href: providerInfo[props.provider.name].tokenUrl,
|
|
209
|
+
rel: "noopener",
|
|
210
|
+
target: "_blank"
|
|
211
|
+
}, "Create a token")
|
|
212
|
+
]) : void 0]);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
/**
|
|
216
|
+
* The accounts a reader can connect, from `defineConnect()`. It renders state and emits events.
|
|
217
|
+
* The application stores tokens, for example with `useConnectStore()`.
|
|
218
|
+
*/
|
|
219
|
+
const ConnectPanel = defineComponent({
|
|
220
|
+
name: "ConnectPanel",
|
|
221
|
+
props: {
|
|
222
|
+
connect: {
|
|
223
|
+
required: true,
|
|
224
|
+
type: Object
|
|
225
|
+
},
|
|
226
|
+
/** The state of each provider. A provider without state is `idle`, or `needs-relay` when it needs one. */
|
|
227
|
+
states: {
|
|
228
|
+
default: () => ({}),
|
|
229
|
+
type: Object
|
|
230
|
+
},
|
|
231
|
+
relayUrl: {
|
|
232
|
+
default: void 0,
|
|
233
|
+
type: String
|
|
234
|
+
},
|
|
235
|
+
/** The text when `connect` has no providers. */
|
|
236
|
+
empty: {
|
|
237
|
+
default: "No accounts needed.",
|
|
238
|
+
type: String
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
emits: {
|
|
242
|
+
connect: (provider, token) => typeof provider === "string" && typeof token === "string",
|
|
243
|
+
oauth: (provider) => provider.auth === "oauth",
|
|
244
|
+
disconnect: (provider) => typeof provider === "string",
|
|
245
|
+
"remove-all": () => true,
|
|
246
|
+
"copy-command": (command) => typeof command === "string"
|
|
247
|
+
},
|
|
248
|
+
setup(props, { emit }) {
|
|
249
|
+
const panelId = useId();
|
|
250
|
+
const anyConnected = computed(() => Object.values(props.states).some((state) => state?.status === "connected"));
|
|
251
|
+
return () => props.connect.providers.length === 0 ? h("div", { class: "vh-ws-connect vh-ws-connect--empty" }, [icon("check"), h("p", props.empty)]) : h("div", { class: "vh-ws-connect" }, [...groups.map(({ kind, label }) => {
|
|
252
|
+
const providers = props.connect.providers.filter((provider) => provider.kind === kind);
|
|
253
|
+
if (providers.length === 0) return void 0;
|
|
254
|
+
const headingId = `${panelId}-${kind}`;
|
|
255
|
+
return h("section", {
|
|
256
|
+
"aria-labelledby": headingId,
|
|
257
|
+
class: "vh-ws-connect-group",
|
|
258
|
+
key: kind
|
|
259
|
+
}, [h("h3", {
|
|
260
|
+
class: "vh-ws-connect-heading",
|
|
261
|
+
id: headingId
|
|
262
|
+
}, label), h("ul", { class: "vh-ws-providers" }, providers.map((provider) => h(ConnectProviderRow, {
|
|
263
|
+
key: provider.name,
|
|
264
|
+
provider,
|
|
265
|
+
relayUrl: props.relayUrl,
|
|
266
|
+
state: props.states[provider.name],
|
|
267
|
+
onConnect: (token) => emit("connect", provider.name, token),
|
|
268
|
+
onOauth: (provider) => emit("oauth", provider),
|
|
269
|
+
onDisconnect: () => emit("disconnect", provider.name),
|
|
270
|
+
"onCopy-command": (command) => emit("copy-command", command)
|
|
271
|
+
})))]);
|
|
272
|
+
}), h("footer", { class: "vh-ws-connect-footer" }, [
|
|
273
|
+
icon("lock"),
|
|
274
|
+
h("p", "Tokens stay in this browser. They are passed to the workspace as environment variables. ViteHub servers never receive them."),
|
|
275
|
+
h("button", {
|
|
276
|
+
class: "vh-ws-button",
|
|
277
|
+
disabled: !anyConnected.value,
|
|
278
|
+
type: "button",
|
|
279
|
+
onClick: () => emit("remove-all")
|
|
280
|
+
}, "Remove all")
|
|
281
|
+
])]);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
//#endregion
|
|
285
|
+
export { ConnectPanel, ConnectProviderRow, connectProviderLabel };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from "vue";
|
|
2
|
+
import { Connect, ConnectCredentials, ConnectProviderName } from "@vite-hub/web-container/connect";
|
|
3
|
+
//#region src/workspace/connect-store.d.ts
|
|
4
|
+
export interface UseConnectStoreOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Where tokens are kept. `session` forgets them when the tab closes. `memory` forgets them on reload.
|
|
7
|
+
* @default "session"
|
|
8
|
+
*/
|
|
9
|
+
storage?: "session" | "local" | "memory";
|
|
10
|
+
/** @default "vitehub:connect" */
|
|
11
|
+
key?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ConnectStore {
|
|
14
|
+
credentials: Readonly<Ref<ConnectCredentials>>;
|
|
15
|
+
set: (provider: ConnectProviderName, token: string) => void;
|
|
16
|
+
remove: (provider: ConnectProviderName) => void;
|
|
17
|
+
clear: () => void;
|
|
18
|
+
/** The `env` of a workspace run, such as `useWebContainer({ env: store.env(connect) })`. */
|
|
19
|
+
env: (connect: Connect) => ComputedRef<Record<string, string>>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A small token store for `ConnectPanel`. Tokens stay in this browser and never go to a server. Called in a component,
|
|
23
|
+
* it loads the stored tokens when the component mounts.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useConnectStore(options?: UseConnectStoreOptions): ConnectStore;
|
|
26
|
+
//#endregion
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { computed, getCurrentInstance, onMounted, readonly, ref } from "vue";
|
|
2
|
+
import { connectEnv } from "@vite-hub/web-container/connect";
|
|
3
|
+
//#region src/workspace/connect-store.ts
|
|
4
|
+
function browserStorage(kind) {
|
|
5
|
+
if (kind === "memory" || typeof window === "undefined") return void 0;
|
|
6
|
+
try {
|
|
7
|
+
return kind === "local" ? window.localStorage : window.sessionStorage;
|
|
8
|
+
} catch {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function read(storage, key) {
|
|
13
|
+
try {
|
|
14
|
+
const raw = storage?.getItem(key);
|
|
15
|
+
if (!raw) return {};
|
|
16
|
+
const value = JSON.parse(raw);
|
|
17
|
+
if (!value || typeof value !== "object") return {};
|
|
18
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
|
|
19
|
+
} catch {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A small token store for `ConnectPanel`. Tokens stay in this browser and never go to a server. Called in a component,
|
|
25
|
+
* it loads the stored tokens when the component mounts.
|
|
26
|
+
*/
|
|
27
|
+
function useConnectStore(options = {}) {
|
|
28
|
+
const key = options.key ?? "vitehub:connect";
|
|
29
|
+
const storage = browserStorage(options.storage ?? "session");
|
|
30
|
+
const credentials = ref({});
|
|
31
|
+
const load = () => {
|
|
32
|
+
credentials.value = read(storage, key);
|
|
33
|
+
};
|
|
34
|
+
if (getCurrentInstance()) onMounted(load);
|
|
35
|
+
else load();
|
|
36
|
+
function save(next) {
|
|
37
|
+
credentials.value = next;
|
|
38
|
+
if (!storage) return;
|
|
39
|
+
try {
|
|
40
|
+
if (Object.keys(next).length === 0) storage.removeItem(key);
|
|
41
|
+
else storage.setItem(key, JSON.stringify(next));
|
|
42
|
+
} catch {}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
credentials: readonly(credentials),
|
|
46
|
+
set: (provider, token) => save({
|
|
47
|
+
...credentials.value,
|
|
48
|
+
[provider]: token
|
|
49
|
+
}),
|
|
50
|
+
remove(provider) {
|
|
51
|
+
const { [provider]: _removed, ...rest } = credentials.value;
|
|
52
|
+
save(rest);
|
|
53
|
+
},
|
|
54
|
+
clear: () => save({}),
|
|
55
|
+
env: (connect) => computed(() => connectEnv(connect, credentials.value))
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { useConnectStore };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VNode } from "vue";
|
|
2
|
+
//#region src/workspace/icons.d.ts
|
|
3
|
+
declare const icons: {
|
|
4
|
+
readonly lock: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/></g>";
|
|
5
|
+
readonly check: "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M20 6L9 17l-5-5\"/>";
|
|
6
|
+
readonly monitor: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\"/><path d=\"M8 21h8m-4-4v4\"/></g>";
|
|
7
|
+
readonly "rotate-cw": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/></g>";
|
|
8
|
+
readonly "external-link": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/>";
|
|
9
|
+
readonly copy: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></g>";
|
|
10
|
+
readonly "square-terminal": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m7 11l2-2l-2-2m4 6h4\"/><rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\"/></g>";
|
|
11
|
+
readonly "circle-alert": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 8v4m0 4h.01\"/></g>";
|
|
12
|
+
readonly "wifi-off": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 20h.01M8.5 16.429a5 5 0 0 1 7 0M5 12.859a10 10 0 0 1 5.17-2.69m8.83 2.69a10 10 0 0 0-2.007-1.523M2 8.82a15 15 0 0 1 4.177-2.643M22 8.82a15 15 0 0 0-11.288-3.764M2 2l20 20\"/>";
|
|
13
|
+
readonly download: "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4m4-5l5 5l5-5\"/>";
|
|
14
|
+
readonly link: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></g>";
|
|
15
|
+
readonly "rotate-ccw": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/></g>";
|
|
16
|
+
readonly x: "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M18 6L6 18M6 6l12 12\"/>";
|
|
17
|
+
readonly "arrow-left": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m12 19l-7-7l7-7m7 7H5\"/>";
|
|
18
|
+
readonly "arrow-right": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 12h14m-7-7l7 7l-7 7\"/>";
|
|
19
|
+
readonly tablet: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\"/><path d=\"M12 18h.01\"/></g>";
|
|
20
|
+
readonly smartphone: "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"14\" height=\"20\" x=\"5\" y=\"2\" rx=\"2\" ry=\"2\"/><path d=\"M12 18h.01\"/></g>";
|
|
21
|
+
};
|
|
22
|
+
declare const logos: {
|
|
23
|
+
readonly anthropic: "<path fill=\"currentColor\" d=\"M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z\"/>";
|
|
24
|
+
readonly cloudflare: "<path fill=\"currentColor\" d=\"M16.509 16.845c.147-.507.09-.971-.155-1.316c-.225-.316-.605-.499-1.062-.52l-8.66-.113a.16.16 0 0 1-.133-.07a.2.2 0 0 1-.02-.156a.24.24 0 0 1 .203-.156l8.736-.113c1.035-.049 2.16-.886 2.554-1.913l.499-1.302a.27.27 0 0 0 .014-.168a5.689 5.689 0 0 0-10.937-.584a2.58 2.58 0 0 0-1.794-.498a2.56 2.56 0 0 0-2.223 3.18A3.634 3.634 0 0 0 0 16.751q.002.264.035.527a.174.174 0 0 0 .17.148h15.98a.22.22 0 0 0 .204-.155zm2.757-5.564c-.077 0-.161 0-.239.011c-.056 0-.105.042-.127.098l-.337 1.174c-.148.507-.092.971.154 1.317c.225.316.605.498 1.062.52l1.844.113c.056 0 .105.026.133.07a.2.2 0 0 1 .021.156a.24.24 0 0 1-.204.156l-1.92.112c-1.042.049-2.159.887-2.553 1.914l-.141.358c-.028.072.021.142.099.142h6.597a.174.174 0 0 0 .17-.126a5 5 0 0 0 .175-1.28a4.74 4.74 0 0 0-4.734-4.727\"/>";
|
|
25
|
+
readonly github: "<path fill=\"currentColor\" d=\"M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\"/>";
|
|
26
|
+
readonly netlify: "<path fill=\"currentColor\" d=\"M6.49 19.04h-.23L5.13 17.9v-.23l1.73-1.71h1.2l.15.15v1.2L6.5 19.04ZM5.13 6.31V6.1l1.13-1.13h.23L8.2 6.68v1.2l-.15.15h-1.2zm9.96 9.09h-1.65l-.14-.13v-3.83c0-.68-.27-1.2-1.1-1.23c-.42 0-.9 0-1.43.02l-.07.08v4.96l-.14.14H8.9l-.13-.14V8.73l.13-.14h3.7a2.6 2.6 0 0 1 2.61 2.6v4.08l-.13.14Zm-8.37-2.44H.14L0 12.82v-1.64l.14-.14h6.58l.14.14v1.64zm17.14 0h-6.58l-.14-.14v-1.64l.14-.14h6.58l.14.14v1.64zM11.05 6.55V1.64l.14-.14h1.65l.14.14v4.9l-.14.14h-1.65zm0 15.81v-4.9l.14-.14h1.65l.14.13v4.91l-.14.14h-1.65z\"/>";
|
|
27
|
+
readonly openai: "<path fill=\"currentColor\" d=\"M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z\"/>";
|
|
28
|
+
readonly vercel: "<path fill=\"currentColor\" d=\"m12 1.608l12 20.784H0Z\"/>";
|
|
29
|
+
};
|
|
30
|
+
export type WorkspaceIconName = keyof typeof icons;
|
|
31
|
+
export type ProviderLogoName = keyof typeof logos;
|
|
32
|
+
export declare function icon(name: WorkspaceIconName, className?: string): VNode;
|
|
33
|
+
export declare function providerLogo(name: ProviderLogoName, className?: string): VNode;
|
|
34
|
+
//#endregion
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
//#region src/workspace/icons.ts
|
|
3
|
+
const icons = {
|
|
4
|
+
"lock": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/></g>",
|
|
5
|
+
"check": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M20 6L9 17l-5-5\"/>",
|
|
6
|
+
"monitor": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\"/><path d=\"M8 21h8m-4-4v4\"/></g>",
|
|
7
|
+
"rotate-cw": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/></g>",
|
|
8
|
+
"external-link": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/>",
|
|
9
|
+
"copy": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></g>",
|
|
10
|
+
"square-terminal": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m7 11l2-2l-2-2m4 6h4\"/><rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\"/></g>",
|
|
11
|
+
"circle-alert": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 8v4m0 4h.01\"/></g>",
|
|
12
|
+
"wifi-off": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 20h.01M8.5 16.429a5 5 0 0 1 7 0M5 12.859a10 10 0 0 1 5.17-2.69m8.83 2.69a10 10 0 0 0-2.007-1.523M2 8.82a15 15 0 0 1 4.177-2.643M22 8.82a15 15 0 0 0-11.288-3.764M2 2l20 20\"/>",
|
|
13
|
+
"download": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4m4-5l5 5l5-5\"/>",
|
|
14
|
+
"link": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></g>",
|
|
15
|
+
"rotate-ccw": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/></g>",
|
|
16
|
+
"x": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M18 6L6 18M6 6l12 12\"/>",
|
|
17
|
+
"arrow-left": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m12 19l-7-7l7-7m7 7H5\"/>",
|
|
18
|
+
"arrow-right": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 12h14m-7-7l7 7l-7 7\"/>",
|
|
19
|
+
"tablet": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\"/><path d=\"M12 18h.01\"/></g>",
|
|
20
|
+
"smartphone": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><rect width=\"14\" height=\"20\" x=\"5\" y=\"2\" rx=\"2\" ry=\"2\"/><path d=\"M12 18h.01\"/></g>"
|
|
21
|
+
};
|
|
22
|
+
const logos = {
|
|
23
|
+
"anthropic": "<path fill=\"currentColor\" d=\"M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z\"/>",
|
|
24
|
+
"cloudflare": "<path fill=\"currentColor\" d=\"M16.509 16.845c.147-.507.09-.971-.155-1.316c-.225-.316-.605-.499-1.062-.52l-8.66-.113a.16.16 0 0 1-.133-.07a.2.2 0 0 1-.02-.156a.24.24 0 0 1 .203-.156l8.736-.113c1.035-.049 2.16-.886 2.554-1.913l.499-1.302a.27.27 0 0 0 .014-.168a5.689 5.689 0 0 0-10.937-.584a2.58 2.58 0 0 0-1.794-.498a2.56 2.56 0 0 0-2.223 3.18A3.634 3.634 0 0 0 0 16.751q.002.264.035.527a.174.174 0 0 0 .17.148h15.98a.22.22 0 0 0 .204-.155zm2.757-5.564c-.077 0-.161 0-.239.011c-.056 0-.105.042-.127.098l-.337 1.174c-.148.507-.092.971.154 1.317c.225.316.605.498 1.062.52l1.844.113c.056 0 .105.026.133.07a.2.2 0 0 1 .021.156a.24.24 0 0 1-.204.156l-1.92.112c-1.042.049-2.159.887-2.553 1.914l-.141.358c-.028.072.021.142.099.142h6.597a.174.174 0 0 0 .17-.126a5 5 0 0 0 .175-1.28a4.74 4.74 0 0 0-4.734-4.727\"/>",
|
|
25
|
+
"github": "<path fill=\"currentColor\" d=\"M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\"/>",
|
|
26
|
+
"netlify": "<path fill=\"currentColor\" d=\"M6.49 19.04h-.23L5.13 17.9v-.23l1.73-1.71h1.2l.15.15v1.2L6.5 19.04ZM5.13 6.31V6.1l1.13-1.13h.23L8.2 6.68v1.2l-.15.15h-1.2zm9.96 9.09h-1.65l-.14-.13v-3.83c0-.68-.27-1.2-1.1-1.23c-.42 0-.9 0-1.43.02l-.07.08v4.96l-.14.14H8.9l-.13-.14V8.73l.13-.14h3.7a2.6 2.6 0 0 1 2.61 2.6v4.08l-.13.14Zm-8.37-2.44H.14L0 12.82v-1.64l.14-.14h6.58l.14.14v1.64zm17.14 0h-6.58l-.14-.14v-1.64l.14-.14h6.58l.14.14v1.64zM11.05 6.55V1.64l.14-.14h1.65l.14.14v4.9l-.14.14h-1.65zm0 15.81v-4.9l.14-.14h1.65l.14.13v4.91l-.14.14h-1.65z\"/>",
|
|
27
|
+
"openai": "<path fill=\"currentColor\" d=\"M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z\"/>",
|
|
28
|
+
"vercel": "<path fill=\"currentColor\" d=\"m12 1.608l12 20.784H0Z\"/>"
|
|
29
|
+
};
|
|
30
|
+
function svg(body, className) {
|
|
31
|
+
return h("svg", {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
class: className,
|
|
34
|
+
innerHTML: body,
|
|
35
|
+
viewBox: "0 0 24 24",
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function icon(name, className = "vh-ws-icon") {
|
|
40
|
+
return svg(icons[name], className);
|
|
41
|
+
}
|
|
42
|
+
function providerLogo(name, className = "vh-ws-logo") {
|
|
43
|
+
return svg(logos[name], className);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { icon, providerLogo };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { t as PlaygroundFiles } from "../../share-DM4eNy4q.js";
|
|
2
|
+
import { WorkspaceLayout, WorkspaceTab, WorkspaceTabItem } from "./workspace-shell.js";
|
|
3
|
+
import { PropType, VNode } from "vue";
|
|
4
|
+
import { Connect } from "@vite-hub/web-container/connect";
|
|
5
|
+
import { UseWebContainerReturn } from "@vite-hub/web-container/vue";
|
|
6
|
+
//#region src/workspace/playground-container.d.ts
|
|
7
|
+
/** An app that the container can open. A playground has a menu of them. A tutorial has one, with the files of its step. */
|
|
8
|
+
export interface PlaygroundContainerTemplate {
|
|
9
|
+
/** The id in share links and in `update:template`. */
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
files: PlaygroundFiles;
|
|
14
|
+
/** The file that the editor opens first. Defaults to the first file. */
|
|
15
|
+
open?: string;
|
|
16
|
+
/** The path that the preview opens. Defaults to `/`. */
|
|
17
|
+
preview?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Downloads a `node_modules` snapshot for these files, such as `() => fetchSnapshot(parts)`. Without it, the
|
|
20
|
+
* workspace runs `npm install`. Give templates with the same dependencies the same function, so the container
|
|
21
|
+
* switches between them without a new boot.
|
|
22
|
+
*/
|
|
23
|
+
snapshot?: () => Promise<Uint8Array | ArrayBuffer>;
|
|
24
|
+
}
|
|
25
|
+
/** What the slots get, and what `context` gives to code outside the container. */
|
|
26
|
+
export interface PlaygroundContext {
|
|
27
|
+
workspace: UseWebContainerReturn;
|
|
28
|
+
/** The template that is open. */
|
|
29
|
+
template: PlaygroundContainerTemplate;
|
|
30
|
+
/** Paths whose contents differ from the files of the open template, sorted. */
|
|
31
|
+
edited: readonly string[];
|
|
32
|
+
/** Opens `path` in the editor. */
|
|
33
|
+
show: (path: string) => void;
|
|
34
|
+
/** Shows a tab, such as `"terminal"`. */
|
|
35
|
+
showTab: (tab: WorkspaceTab) => void;
|
|
36
|
+
/** Runs `action` at once when nothing is edited. Otherwise it asks the reader first, with `confirm` on the button. */
|
|
37
|
+
guard: (title: string, confirm: string, action: () => void) => void;
|
|
38
|
+
}
|
|
39
|
+
/** Where the page runs: `pending` before mount, then by the viewport width. */
|
|
40
|
+
export type PlaygroundDevice = "pending" | "phone" | "tablet" | "desktop";
|
|
41
|
+
/**
|
|
42
|
+
* The device of the page and the WebContainer support of the browser, known after mount. Desktops are 64rem wide or
|
|
43
|
+
* more, and tablets 48rem. Use it to place the container, as a page with a lesson next to it does.
|
|
44
|
+
*/
|
|
45
|
+
export declare function usePlaygroundDevice(): {
|
|
46
|
+
device: import("vue").Ref<PlaygroundDevice, PlaygroundDevice>;
|
|
47
|
+
supported: import("vue").Ref<boolean | undefined, boolean | undefined>;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A complete browser playground: the toolbar, file tree, editor, preview, and dev server console of an app that runs
|
|
51
|
+
* in a WebContainer. It tracks edits, restarts the dev server, asks before it discards edits, copies share links,
|
|
52
|
+
* downloads zips, and shows the workspace only on devices that can run it.
|
|
53
|
+
*/
|
|
54
|
+
export declare const PlaygroundContainer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
55
|
+
/** The apps to open. More than one shows a template menu. */
|
|
56
|
+
templates: {
|
|
57
|
+
required: true;
|
|
58
|
+
type: PropType<readonly PlaygroundContainerTemplate[]>;
|
|
59
|
+
};
|
|
60
|
+
/** The id of the template to open first, such as from `?template=`. Defaults to the first template. */
|
|
61
|
+
template: {
|
|
62
|
+
default: undefined;
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
};
|
|
65
|
+
/** `playground` puts the preview at the side. `tutorial` puts it in a tab under the editor. */
|
|
66
|
+
layout: {
|
|
67
|
+
default: string;
|
|
68
|
+
type: PropType<WorkspaceLayout>;
|
|
69
|
+
};
|
|
70
|
+
/** What the reader calls this, in lowercase, such as `"playground"`. It names the Open button and the notices. */
|
|
71
|
+
label: {
|
|
72
|
+
default: string;
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
};
|
|
75
|
+
/** The start of the zip name. The template id follows it, as in `vitehub-kv.zip`. */
|
|
76
|
+
name: {
|
|
77
|
+
default: string;
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
};
|
|
80
|
+
/** The port of the dev server, such as `3000` for `vite --port 3000`. Other servers do not become the preview. */
|
|
81
|
+
port: {
|
|
82
|
+
default: undefined;
|
|
83
|
+
type: NumberConstructor;
|
|
84
|
+
};
|
|
85
|
+
/** The providers of `defineConnect()`. Their tokens reach the dev server as environment variables. */
|
|
86
|
+
connect: {
|
|
87
|
+
default: undefined;
|
|
88
|
+
type: PropType<Connect>;
|
|
89
|
+
};
|
|
90
|
+
/** More tabs next to Console and Connect. Each one shows the slot with the name of its `value`. */
|
|
91
|
+
tabs: {
|
|
92
|
+
default: () => never[];
|
|
93
|
+
type: PropType<readonly WorkspaceTabItem[]>;
|
|
94
|
+
};
|
|
95
|
+
/** Copy link and Download in the toolbar, and opening `#code=` links. */
|
|
96
|
+
share: {
|
|
97
|
+
default: boolean;
|
|
98
|
+
type: BooleanConstructor;
|
|
99
|
+
};
|
|
100
|
+
/** The file in the editor. Use `v-model:selected`. */
|
|
101
|
+
selected: {
|
|
102
|
+
default: undefined;
|
|
103
|
+
type: StringConstructor;
|
|
104
|
+
};
|
|
105
|
+
/** Whether the workspace shows. Desktops show it on their own. Set it to `true` to show it on a tablet. Use `v-model:open`. */
|
|
106
|
+
open: {
|
|
107
|
+
default: boolean;
|
|
108
|
+
type: BooleanConstructor;
|
|
109
|
+
};
|
|
110
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
111
|
+
[key: string]: any;
|
|
112
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
113
|
+
/** The reader opened a template, or discarded the changes to one. */
|
|
114
|
+
"update:template": (id: string) => boolean;
|
|
115
|
+
"update:selected": (path: string) => boolean;
|
|
116
|
+
"update:open": (open: boolean) => boolean;
|
|
117
|
+
/** A workspace booted. It gives the context that the slots get, for code outside the container. */
|
|
118
|
+
context: (context: PlaygroundContext) => true;
|
|
119
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
120
|
+
/** The apps to open. More than one shows a template menu. */
|
|
121
|
+
templates: {
|
|
122
|
+
required: true;
|
|
123
|
+
type: PropType<readonly PlaygroundContainerTemplate[]>;
|
|
124
|
+
};
|
|
125
|
+
/** The id of the template to open first, such as from `?template=`. Defaults to the first template. */
|
|
126
|
+
template: {
|
|
127
|
+
default: undefined;
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
};
|
|
130
|
+
/** `playground` puts the preview at the side. `tutorial` puts it in a tab under the editor. */
|
|
131
|
+
layout: {
|
|
132
|
+
default: string;
|
|
133
|
+
type: PropType<WorkspaceLayout>;
|
|
134
|
+
};
|
|
135
|
+
/** What the reader calls this, in lowercase, such as `"playground"`. It names the Open button and the notices. */
|
|
136
|
+
label: {
|
|
137
|
+
default: string;
|
|
138
|
+
type: StringConstructor;
|
|
139
|
+
};
|
|
140
|
+
/** The start of the zip name. The template id follows it, as in `vitehub-kv.zip`. */
|
|
141
|
+
name: {
|
|
142
|
+
default: string;
|
|
143
|
+
type: StringConstructor;
|
|
144
|
+
};
|
|
145
|
+
/** The port of the dev server, such as `3000` for `vite --port 3000`. Other servers do not become the preview. */
|
|
146
|
+
port: {
|
|
147
|
+
default: undefined;
|
|
148
|
+
type: NumberConstructor;
|
|
149
|
+
};
|
|
150
|
+
/** The providers of `defineConnect()`. Their tokens reach the dev server as environment variables. */
|
|
151
|
+
connect: {
|
|
152
|
+
default: undefined;
|
|
153
|
+
type: PropType<Connect>;
|
|
154
|
+
};
|
|
155
|
+
/** More tabs next to Console and Connect. Each one shows the slot with the name of its `value`. */
|
|
156
|
+
tabs: {
|
|
157
|
+
default: () => never[];
|
|
158
|
+
type: PropType<readonly WorkspaceTabItem[]>;
|
|
159
|
+
};
|
|
160
|
+
/** Copy link and Download in the toolbar, and opening `#code=` links. */
|
|
161
|
+
share: {
|
|
162
|
+
default: boolean;
|
|
163
|
+
type: BooleanConstructor;
|
|
164
|
+
};
|
|
165
|
+
/** The file in the editor. Use `v-model:selected`. */
|
|
166
|
+
selected: {
|
|
167
|
+
default: undefined;
|
|
168
|
+
type: StringConstructor;
|
|
169
|
+
};
|
|
170
|
+
/** Whether the workspace shows. Desktops show it on their own. Set it to `true` to show it on a tablet. Use `v-model:open`. */
|
|
171
|
+
open: {
|
|
172
|
+
default: boolean;
|
|
173
|
+
type: BooleanConstructor;
|
|
174
|
+
};
|
|
175
|
+
}>> & Readonly<{
|
|
176
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
177
|
+
"onUpdate:selected"?: ((path: string) => any) | undefined;
|
|
178
|
+
onContext?: ((context: PlaygroundContext) => any) | undefined;
|
|
179
|
+
"onUpdate:template"?: ((id: string) => any) | undefined;
|
|
180
|
+
}>, {
|
|
181
|
+
name: string;
|
|
182
|
+
label: string;
|
|
183
|
+
template: string;
|
|
184
|
+
layout: WorkspaceLayout;
|
|
185
|
+
open: boolean;
|
|
186
|
+
selected: string;
|
|
187
|
+
connect: Connect;
|
|
188
|
+
tabs: readonly WorkspaceTabItem[];
|
|
189
|
+
port: number;
|
|
190
|
+
share: boolean;
|
|
191
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
192
|
+
//#endregion
|