@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,39 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
//#region src/workspace/workspace-terminal.d.ts
|
|
3
|
+
/** Output chunks, optionally carrying the number of characters evicted from the start of a stream. */
|
|
4
|
+
export type WorkspaceTerminalOutput = readonly string[] & {
|
|
5
|
+
readonly offset?: number;
|
|
6
|
+
};
|
|
7
|
+
/** An xterm.js terminal that shows output chunks, such as `workspace.logs`. xterm loads when the terminal mounts. */
|
|
8
|
+
export declare const WorkspaceTerminal: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
/** Output chunks in order. An `offset` preserves incremental writes when old chunks are evicted. Ordinary arrays clear the terminal when replaced. */
|
|
10
|
+
output: {
|
|
11
|
+
default: () => never[];
|
|
12
|
+
type: PropType<WorkspaceTerminalOutput>;
|
|
13
|
+
};
|
|
14
|
+
label: {
|
|
15
|
+
default: string;
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
};
|
|
18
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
/** Keys that the reader types, for the stdin of a process. */
|
|
22
|
+
input: (data: string) => boolean;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
/** Output chunks in order. An `offset` preserves incremental writes when old chunks are evicted. Ordinary arrays clear the terminal when replaced. */
|
|
25
|
+
output: {
|
|
26
|
+
default: () => never[];
|
|
27
|
+
type: PropType<WorkspaceTerminalOutput>;
|
|
28
|
+
};
|
|
29
|
+
label: {
|
|
30
|
+
default: string;
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
};
|
|
33
|
+
}>> & Readonly<{
|
|
34
|
+
onInput?: ((data: string) => any) | undefined;
|
|
35
|
+
}>, {
|
|
36
|
+
label: string;
|
|
37
|
+
output: WorkspaceTerminalOutput;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
//#endregion
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
2
|
+
//#region src/workspace/workspace-terminal.ts
|
|
3
|
+
let colorProbe;
|
|
4
|
+
/**
|
|
5
|
+
* A CSS color as `#rrggbbaa`. xterm parses only hex and `rgb()` itself, and it refuses translucent colors in other
|
|
6
|
+
* formats, but the tokens are `oklch()` and `color-mix()`. A canvas reads any CSS color as RGBA bytes. Without a canvas,
|
|
7
|
+
* as on the server or in a test DOM, the color stays as it is.
|
|
8
|
+
*/
|
|
9
|
+
function toHex(color) {
|
|
10
|
+
colorProbe ??= document.createElement("canvas").getContext("2d", { willReadFrequently: true });
|
|
11
|
+
if (!colorProbe) return color;
|
|
12
|
+
colorProbe.clearRect(0, 0, 1, 1);
|
|
13
|
+
colorProbe.fillStyle = "transparent";
|
|
14
|
+
colorProbe.fillStyle = color;
|
|
15
|
+
colorProbe.fillRect(0, 0, 1, 1);
|
|
16
|
+
const bytes = colorProbe.getImageData(0, 0, 1, 1).data;
|
|
17
|
+
if (bytes[3] === 0) return color;
|
|
18
|
+
return `#${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
19
|
+
}
|
|
20
|
+
function cssColor(element, name) {
|
|
21
|
+
const value = getComputedStyle(element).getPropertyValue(name).trim();
|
|
22
|
+
return value ? toHex(value) : void 0;
|
|
23
|
+
}
|
|
24
|
+
/** The colors of the terminal, from the `--vh-ws-*` tokens of styles.css, which follow the theme and the color mode. */
|
|
25
|
+
function terminalTheme(element) {
|
|
26
|
+
return {
|
|
27
|
+
background: cssColor(element, "--vh-ws-terminal-bg"),
|
|
28
|
+
cursor: cssColor(element, "--vh-ws-terminal-fg"),
|
|
29
|
+
foreground: cssColor(element, "--vh-ws-terminal-fg"),
|
|
30
|
+
selectionBackground: cssColor(element, "--vh-ws-code-selection")
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** An xterm.js terminal that shows output chunks, such as `workspace.logs`. xterm loads when the terminal mounts. */
|
|
34
|
+
const WorkspaceTerminal = defineComponent({
|
|
35
|
+
name: "WorkspaceTerminal",
|
|
36
|
+
props: {
|
|
37
|
+
/** Output chunks in order. An `offset` preserves incremental writes when old chunks are evicted. Ordinary arrays clear the terminal when replaced. */
|
|
38
|
+
output: {
|
|
39
|
+
default: () => [],
|
|
40
|
+
type: Array
|
|
41
|
+
},
|
|
42
|
+
label: {
|
|
43
|
+
default: "Terminal output",
|
|
44
|
+
type: String
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
emits: {
|
|
48
|
+
/** Keys that the reader types, for the stdin of a process. */
|
|
49
|
+
input: (data) => typeof data === "string" },
|
|
50
|
+
setup(props, { emit, expose }) {
|
|
51
|
+
const host = ref(null);
|
|
52
|
+
let terminal;
|
|
53
|
+
let written = [];
|
|
54
|
+
let cursor;
|
|
55
|
+
let observer;
|
|
56
|
+
let themeObserver;
|
|
57
|
+
let disposed = false;
|
|
58
|
+
function write(output) {
|
|
59
|
+
if (!terminal) return;
|
|
60
|
+
if (output.offset !== void 0) {
|
|
61
|
+
const end = output.offset + output.reduce((length, chunk) => length + chunk.length, 0);
|
|
62
|
+
if (cursor !== void 0 && (cursor > end || output.offset < (written.offset ?? 0)) || cursor === void 0 && written.length > 0) {
|
|
63
|
+
terminal.reset();
|
|
64
|
+
cursor = void 0;
|
|
65
|
+
}
|
|
66
|
+
let skip = Math.max(0, (cursor ?? output.offset) - output.offset);
|
|
67
|
+
for (const chunk of output) {
|
|
68
|
+
if (skip < chunk.length) terminal.write(chunk.slice(skip));
|
|
69
|
+
skip = Math.max(0, skip - chunk.length);
|
|
70
|
+
}
|
|
71
|
+
cursor = end;
|
|
72
|
+
} else {
|
|
73
|
+
if (!(cursor === void 0 && output.length >= written.length && written.every((chunk, index) => output[index] === chunk))) {
|
|
74
|
+
terminal.reset();
|
|
75
|
+
written = [];
|
|
76
|
+
}
|
|
77
|
+
for (const chunk of output.slice(written.length)) terminal.write(chunk);
|
|
78
|
+
cursor = void 0;
|
|
79
|
+
}
|
|
80
|
+
written = output;
|
|
81
|
+
}
|
|
82
|
+
onMounted(async () => {
|
|
83
|
+
const [{ Terminal }, { FitAddon }] = await Promise.all([import("@xterm/xterm"), import("@xterm/addon-fit")]);
|
|
84
|
+
const element = host.value;
|
|
85
|
+
if (disposed || !element) return;
|
|
86
|
+
const fit = new FitAddon();
|
|
87
|
+
terminal = new Terminal({
|
|
88
|
+
convertEol: true,
|
|
89
|
+
cursorBlink: false,
|
|
90
|
+
disableStdin: false,
|
|
91
|
+
fontFamily: getComputedStyle(element).getPropertyValue("--vh-ws-font-mono").trim() || "ui-monospace, monospace",
|
|
92
|
+
fontSize: 12,
|
|
93
|
+
lineHeight: 1.4,
|
|
94
|
+
scrollback: 5e3,
|
|
95
|
+
theme: terminalTheme(element)
|
|
96
|
+
});
|
|
97
|
+
terminal.loadAddon(fit);
|
|
98
|
+
terminal.open(element);
|
|
99
|
+
terminal.textarea?.setAttribute("aria-label", props.label);
|
|
100
|
+
terminal.onData((data) => emit("input", data));
|
|
101
|
+
observer = new ResizeObserver(() => {
|
|
102
|
+
if (element.clientWidth > 0 && element.clientHeight > 0) fit.fit();
|
|
103
|
+
});
|
|
104
|
+
observer.observe(element);
|
|
105
|
+
themeObserver = new MutationObserver(() => {
|
|
106
|
+
if (terminal) terminal.options.theme = terminalTheme(element);
|
|
107
|
+
});
|
|
108
|
+
themeObserver.observe(document.documentElement, { attributeFilter: ["class", "data-theme"] });
|
|
109
|
+
write(props.output);
|
|
110
|
+
});
|
|
111
|
+
watch(() => props.output, write);
|
|
112
|
+
onBeforeUnmount(() => {
|
|
113
|
+
disposed = true;
|
|
114
|
+
observer?.disconnect();
|
|
115
|
+
themeObserver?.disconnect();
|
|
116
|
+
terminal?.dispose();
|
|
117
|
+
});
|
|
118
|
+
expose({ clear: () => {
|
|
119
|
+
terminal?.reset();
|
|
120
|
+
written = [];
|
|
121
|
+
cursor = void 0;
|
|
122
|
+
} });
|
|
123
|
+
return () => h("div", {
|
|
124
|
+
class: "vh-ws-terminal",
|
|
125
|
+
ref: host
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
//#endregion
|
|
130
|
+
export { WorkspaceTerminal };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/internal/payload-text.ts
|
|
2
|
+
function payloadText(value) {
|
|
3
|
+
if (typeof value === "string") return value;
|
|
4
|
+
const ancestors = [];
|
|
5
|
+
try {
|
|
6
|
+
return JSON.stringify(value, function(_key, item) {
|
|
7
|
+
if (typeof item === "bigint") return `${item}n`;
|
|
8
|
+
if (typeof item !== "object" || item === null) return item;
|
|
9
|
+
while (ancestors.length && ancestors.at(-1) !== this) ancestors.pop();
|
|
10
|
+
if (ancestors.includes(item)) return "[Circular]";
|
|
11
|
+
ancestors.push(item);
|
|
12
|
+
return item;
|
|
13
|
+
}, 2) ?? String(value);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
let message;
|
|
16
|
+
try {
|
|
17
|
+
const raw = error?.message;
|
|
18
|
+
if (typeof raw === "string") message = raw;
|
|
19
|
+
else if (raw !== void 0) try {
|
|
20
|
+
message = String(raw);
|
|
21
|
+
} catch {}
|
|
22
|
+
} catch {}
|
|
23
|
+
if (message === void 0) return "[Unable to display payload]";
|
|
24
|
+
try {
|
|
25
|
+
return `[Unable to display payload: ${message}]`;
|
|
26
|
+
} catch {
|
|
27
|
+
return "[Unable to display payload]";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { payloadText as t };
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-C9mWXvCC.js";
|
|
2
|
+
import { s as pierrePropTypes } from "./code-view-D0bqhogi.js";
|
|
2
3
|
import { A as SPLIT_WITH_NEWLINES, C as DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, D as HEADER_FILENAME_SUFFIX_SLOT_ID, E as EMPTY_RENDER_RANGE, M as UNSAFE_CSS_ATTRIBUTE, O as HEADER_METADATA_SLOT_ID, S as DIFFS_DEVELOPMENT_BUILD, T as DIFFS_TAG_NAME, _ as DEFAULT_RENDER_RANGE, b as DEFAULT_TOKENIZE_MAX_LENGTH, c as composeCacheKey, d as CODE_VIEW_FOOTER_ATTRIBUTE, f as CODE_VIEW_HEADER_ATTRIBUTE, g as DEFAULT_EXPANDED_REGION, h as DEFAULT_CODE_VIEW_LAYOUT, i as diffChars, j as THEME_CSS_ATTRIBUTE, k as HEADER_PREFIX_SLOT_ID, l as getHunkSideEndBoundary, m as DEFAULT_CODE_VIEW_FILE_METRICS, n as parseDiffFromFile, o as slideBlankBoundaryBlocksUp, p as CUSTOM_HEADER_SLOT_ID, r as diffWordsWithSpace, s as cleanLastNewline, t as getSingularPatch, u as getHunkSideStartBoundary, v as DEFAULT_SMOOTH_SCROLL_SETTINGS, w as DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, x as DEFAULT_VIRTUAL_FILE_METRICS, y as DEFAULT_THEMES } from "./getSingularPatch-Dsb8EgxR.js";
|
|
3
4
|
import { computed, defineComponent, h, onBeforeUnmount, toRaw, watchEffect } from "vue";
|
|
4
5
|
import { bundledLanguages, createHighlighter, createJavaScriptRegexEngine, createOnigurumaEngine } from "shiki";
|
|
5
6
|
import { normalizeTheme } from "shiki/core";
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __exportAll = (all, no_symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) __defProp(target, name, {
|
|
11
|
-
get: all[name],
|
|
12
|
-
enumerable: true
|
|
13
|
-
});
|
|
14
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
-
return target;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
7
|
//#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.2.8_react@19.2.6__react@19.2.6/node_modules/@pierre/diffs/dist/highlighter/languages/constants.js
|
|
19
8
|
const ResolvedLanguages = /* @__PURE__ */ new Map();
|
|
20
9
|
const ResolvingLanguages = /* @__PURE__ */ new Map();
|
|
@@ -386,12 +375,12 @@ const PIERRE_THEME_DISPLAY_NAMES = {
|
|
|
386
375
|
"pierre-light-tritanopia": "Pierre Light Tritanopia"
|
|
387
376
|
};
|
|
388
377
|
const PIERRE_THEME_IMPORTS = {
|
|
389
|
-
"pierre-dark": () => import("./pierre-dark-
|
|
378
|
+
"pierre-dark": () => import("./pierre-dark-CzUmjETS.js").then((n) => n.n),
|
|
390
379
|
"pierre-dark-soft": () => import("./pierre-dark-soft-Bb-4-biO.js"),
|
|
391
380
|
"pierre-dark-vibrant": () => import("./pierre-dark-vibrant-8oZzB3gw.js"),
|
|
392
381
|
"pierre-dark-protanopia-deuteranopia": () => import("./pierre-dark-protanopia-deuteranopia-C35UMuvO.js"),
|
|
393
382
|
"pierre-dark-tritanopia": () => import("./pierre-dark-tritanopia-CIJISGWF.js"),
|
|
394
|
-
"pierre-light": () => import("./pierre-light-
|
|
383
|
+
"pierre-light": () => import("./pierre-light-Dn6E0sWv.js").then((n) => n.n),
|
|
395
384
|
"pierre-light-soft": () => import("./pierre-light-soft-BCU6fuhO.js"),
|
|
396
385
|
"pierre-light-vibrant": () => import("./pierre-light-vibrant-Cwh332o_.js"),
|
|
397
386
|
"pierre-light-protanopia-deuteranopia": () => import("./pierre-light-protanopia-deuteranopia-u0U7N4Hn.js"),
|
|
@@ -485,71 +474,71 @@ function shikiColorScheme(name) {
|
|
|
485
474
|
return "dark";
|
|
486
475
|
}
|
|
487
476
|
const SHIKI_THEME_IMPORTS = {
|
|
488
|
-
andromeeda: () => import("
|
|
489
|
-
"aurora-x": () => import("
|
|
490
|
-
"ayu-dark": () => import("
|
|
491
|
-
"ayu-light": () => import("
|
|
492
|
-
"ayu-mirage": () => import("
|
|
493
|
-
"catppuccin-frappe": () => import("
|
|
494
|
-
"catppuccin-latte": () => import("
|
|
495
|
-
"catppuccin-macchiato": () => import("
|
|
496
|
-
"catppuccin-mocha": () => import("
|
|
497
|
-
"dark-plus": () => import("
|
|
498
|
-
dracula: () => import("
|
|
499
|
-
"dracula-soft": () => import("
|
|
500
|
-
"everforest-dark": () => import("
|
|
501
|
-
"everforest-light": () => import("
|
|
502
|
-
"github-dark": () => import("
|
|
503
|
-
"github-dark-default": () => import("
|
|
504
|
-
"github-dark-dimmed": () => import("
|
|
505
|
-
"github-dark-high-contrast": () => import("
|
|
506
|
-
"github-light": () => import("
|
|
507
|
-
"github-light-default": () => import("
|
|
508
|
-
"github-light-high-contrast": () => import("
|
|
509
|
-
"gruvbox-dark-hard": () => import("
|
|
510
|
-
"gruvbox-dark-medium": () => import("
|
|
511
|
-
"gruvbox-dark-soft": () => import("
|
|
512
|
-
"gruvbox-light-hard": () => import("
|
|
513
|
-
"gruvbox-light-medium": () => import("
|
|
514
|
-
"gruvbox-light-soft": () => import("
|
|
515
|
-
horizon: () => import("
|
|
516
|
-
"horizon-bright": () => import("
|
|
517
|
-
houston: () => import("
|
|
518
|
-
"kanagawa-dragon": () => import("
|
|
519
|
-
"kanagawa-lotus": () => import("
|
|
520
|
-
"kanagawa-wave": () => import("
|
|
521
|
-
laserwave: () => import("
|
|
522
|
-
"light-plus": () => import("
|
|
523
|
-
"material-theme": () => import("
|
|
524
|
-
"material-theme-darker": () => import("
|
|
525
|
-
"material-theme-lighter": () => import("
|
|
526
|
-
"material-theme-ocean": () => import("
|
|
527
|
-
"material-theme-palenight": () => import("
|
|
528
|
-
"min-dark": () => import("
|
|
529
|
-
"min-light": () => import("
|
|
530
|
-
monokai: () => import("
|
|
531
|
-
"night-owl": () => import("
|
|
532
|
-
"night-owl-light": () => import("
|
|
533
|
-
nord: () => import("
|
|
534
|
-
"one-dark-pro": () => import("
|
|
535
|
-
"one-light": () => import("
|
|
536
|
-
plastic: () => import("
|
|
537
|
-
poimandres: () => import("
|
|
538
|
-
red: () => import("
|
|
539
|
-
"rose-pine": () => import("
|
|
540
|
-
"rose-pine-dawn": () => import("
|
|
541
|
-
"rose-pine-moon": () => import("
|
|
542
|
-
"slack-dark": () => import("
|
|
543
|
-
"slack-ochin": () => import("
|
|
544
|
-
"snazzy-light": () => import("
|
|
545
|
-
"solarized-dark": () => import("
|
|
546
|
-
"solarized-light": () => import("
|
|
547
|
-
"synthwave-84": () => import("
|
|
548
|
-
"tokyo-night": () => import("
|
|
549
|
-
vesper: () => import("
|
|
550
|
-
"vitesse-black": () => import("
|
|
551
|
-
"vitesse-dark": () => import("
|
|
552
|
-
"vitesse-light": () => import("
|
|
477
|
+
andromeeda: () => import("@shikijs/themes/andromeeda"),
|
|
478
|
+
"aurora-x": () => import("@shikijs/themes/aurora-x"),
|
|
479
|
+
"ayu-dark": () => import("@shikijs/themes/ayu-dark"),
|
|
480
|
+
"ayu-light": () => import("@shikijs/themes/ayu-light"),
|
|
481
|
+
"ayu-mirage": () => import("@shikijs/themes/ayu-mirage"),
|
|
482
|
+
"catppuccin-frappe": () => import("@shikijs/themes/catppuccin-frappe"),
|
|
483
|
+
"catppuccin-latte": () => import("@shikijs/themes/catppuccin-latte"),
|
|
484
|
+
"catppuccin-macchiato": () => import("@shikijs/themes/catppuccin-macchiato"),
|
|
485
|
+
"catppuccin-mocha": () => import("@shikijs/themes/catppuccin-mocha"),
|
|
486
|
+
"dark-plus": () => import("@shikijs/themes/dark-plus"),
|
|
487
|
+
dracula: () => import("@shikijs/themes/dracula"),
|
|
488
|
+
"dracula-soft": () => import("@shikijs/themes/dracula-soft"),
|
|
489
|
+
"everforest-dark": () => import("@shikijs/themes/everforest-dark"),
|
|
490
|
+
"everforest-light": () => import("@shikijs/themes/everforest-light"),
|
|
491
|
+
"github-dark": () => import("@shikijs/themes/github-dark"),
|
|
492
|
+
"github-dark-default": () => import("@shikijs/themes/github-dark-default"),
|
|
493
|
+
"github-dark-dimmed": () => import("@shikijs/themes/github-dark-dimmed"),
|
|
494
|
+
"github-dark-high-contrast": () => import("@shikijs/themes/github-dark-high-contrast"),
|
|
495
|
+
"github-light": () => import("@shikijs/themes/github-light"),
|
|
496
|
+
"github-light-default": () => import("@shikijs/themes/github-light-default"),
|
|
497
|
+
"github-light-high-contrast": () => import("@shikijs/themes/github-light-high-contrast"),
|
|
498
|
+
"gruvbox-dark-hard": () => import("@shikijs/themes/gruvbox-dark-hard"),
|
|
499
|
+
"gruvbox-dark-medium": () => import("@shikijs/themes/gruvbox-dark-medium"),
|
|
500
|
+
"gruvbox-dark-soft": () => import("@shikijs/themes/gruvbox-dark-soft"),
|
|
501
|
+
"gruvbox-light-hard": () => import("@shikijs/themes/gruvbox-light-hard"),
|
|
502
|
+
"gruvbox-light-medium": () => import("@shikijs/themes/gruvbox-light-medium"),
|
|
503
|
+
"gruvbox-light-soft": () => import("@shikijs/themes/gruvbox-light-soft"),
|
|
504
|
+
horizon: () => import("@shikijs/themes/horizon"),
|
|
505
|
+
"horizon-bright": () => import("@shikijs/themes/horizon-bright"),
|
|
506
|
+
houston: () => import("@shikijs/themes/houston"),
|
|
507
|
+
"kanagawa-dragon": () => import("@shikijs/themes/kanagawa-dragon"),
|
|
508
|
+
"kanagawa-lotus": () => import("@shikijs/themes/kanagawa-lotus"),
|
|
509
|
+
"kanagawa-wave": () => import("@shikijs/themes/kanagawa-wave"),
|
|
510
|
+
laserwave: () => import("@shikijs/themes/laserwave"),
|
|
511
|
+
"light-plus": () => import("@shikijs/themes/light-plus"),
|
|
512
|
+
"material-theme": () => import("@shikijs/themes/material-theme"),
|
|
513
|
+
"material-theme-darker": () => import("@shikijs/themes/material-theme-darker"),
|
|
514
|
+
"material-theme-lighter": () => import("@shikijs/themes/material-theme-lighter"),
|
|
515
|
+
"material-theme-ocean": () => import("@shikijs/themes/material-theme-ocean"),
|
|
516
|
+
"material-theme-palenight": () => import("@shikijs/themes/material-theme-palenight"),
|
|
517
|
+
"min-dark": () => import("@shikijs/themes/min-dark"),
|
|
518
|
+
"min-light": () => import("@shikijs/themes/min-light"),
|
|
519
|
+
monokai: () => import("@shikijs/themes/monokai"),
|
|
520
|
+
"night-owl": () => import("@shikijs/themes/night-owl"),
|
|
521
|
+
"night-owl-light": () => import("@shikijs/themes/night-owl-light"),
|
|
522
|
+
nord: () => import("@shikijs/themes/nord"),
|
|
523
|
+
"one-dark-pro": () => import("@shikijs/themes/one-dark-pro"),
|
|
524
|
+
"one-light": () => import("@shikijs/themes/one-light"),
|
|
525
|
+
plastic: () => import("@shikijs/themes/plastic"),
|
|
526
|
+
poimandres: () => import("@shikijs/themes/poimandres"),
|
|
527
|
+
red: () => import("@shikijs/themes/red"),
|
|
528
|
+
"rose-pine": () => import("@shikijs/themes/rose-pine"),
|
|
529
|
+
"rose-pine-dawn": () => import("@shikijs/themes/rose-pine-dawn"),
|
|
530
|
+
"rose-pine-moon": () => import("@shikijs/themes/rose-pine-moon"),
|
|
531
|
+
"slack-dark": () => import("@shikijs/themes/slack-dark"),
|
|
532
|
+
"slack-ochin": () => import("@shikijs/themes/slack-ochin"),
|
|
533
|
+
"snazzy-light": () => import("@shikijs/themes/snazzy-light"),
|
|
534
|
+
"solarized-dark": () => import("@shikijs/themes/solarized-dark"),
|
|
535
|
+
"solarized-light": () => import("@shikijs/themes/solarized-light"),
|
|
536
|
+
"synthwave-84": () => import("@shikijs/themes/synthwave-84"),
|
|
537
|
+
"tokyo-night": () => import("@shikijs/themes/tokyo-night"),
|
|
538
|
+
vesper: () => import("@shikijs/themes/vesper"),
|
|
539
|
+
"vitesse-black": () => import("@shikijs/themes/vitesse-black"),
|
|
540
|
+
"vitesse-dark": () => import("@shikijs/themes/vitesse-dark"),
|
|
541
|
+
"vitesse-light": () => import("@shikijs/themes/vitesse-light")
|
|
553
542
|
};
|
|
554
543
|
function createShikiTheme(name) {
|
|
555
544
|
return createTheme({
|
|
@@ -19589,6 +19578,103 @@ const selectedLinesProp = {
|
|
|
19589
19578
|
default: void 0,
|
|
19590
19579
|
type: pierrePropTypes.selectedLines
|
|
19591
19580
|
};
|
|
19581
|
+
const scrollToSelectedLinesProp = {
|
|
19582
|
+
default: false,
|
|
19583
|
+
type: Boolean
|
|
19584
|
+
};
|
|
19585
|
+
var SelectionFileModel = class extends File {
|
|
19586
|
+
isSourceRendered() {
|
|
19587
|
+
const file = this.getLatestFile();
|
|
19588
|
+
const rendered = this.getRenderedFile();
|
|
19589
|
+
if (!file || !rendered) return false;
|
|
19590
|
+
if (file.cacheKey != null || rendered.cacheKey != null) return file.cacheKey === rendered.cacheKey;
|
|
19591
|
+
return file.name === rendered.name && file.contents === rendered.contents && file.lang === rendered.lang;
|
|
19592
|
+
}
|
|
19593
|
+
};
|
|
19594
|
+
var SelectionDiffModel = class extends FileDiff {
|
|
19595
|
+
isSourceRendered() {
|
|
19596
|
+
return sameDiffSource(this.getLatestDiff(), this.getRenderedDiff());
|
|
19597
|
+
}
|
|
19598
|
+
};
|
|
19599
|
+
var SelectionUnresolvedFileModel = class extends UnresolvedFile {
|
|
19600
|
+
isSourceRendered() {
|
|
19601
|
+
return sameDiffSource(this.getLatestDiff(), this.getRenderedDiff());
|
|
19602
|
+
}
|
|
19603
|
+
};
|
|
19604
|
+
function sameDiffSource(diff, rendered) {
|
|
19605
|
+
return diff === rendered || diff?.cacheKey != null && diff.cacheKey === rendered?.cacheKey;
|
|
19606
|
+
}
|
|
19607
|
+
/**
|
|
19608
|
+
* Centers `row` in the nearest ancestor of the view that scrolls, else in the page. `scrollIntoView` alone also moves
|
|
19609
|
+
* each `overflow: hidden` ancestor, such as an app shell.
|
|
19610
|
+
*/
|
|
19611
|
+
function scrollToRow(host, row) {
|
|
19612
|
+
let scroller = host;
|
|
19613
|
+
while (scroller && !(/auto|scroll|overlay/.test(getComputedStyle(scroller).overflowY) && scroller.scrollHeight > scroller.clientHeight)) scroller = scroller.parentElement;
|
|
19614
|
+
if (!scroller || scroller === document.body || scroller === document.documentElement) {
|
|
19615
|
+
row.scrollIntoView({
|
|
19616
|
+
block: "center",
|
|
19617
|
+
inline: "nearest"
|
|
19618
|
+
});
|
|
19619
|
+
return;
|
|
19620
|
+
}
|
|
19621
|
+
const rect = row.getBoundingClientRect();
|
|
19622
|
+
scroller.scrollTop += rect.top - scroller.getBoundingClientRect().top - (scroller.clientHeight - rect.height) / 2;
|
|
19623
|
+
}
|
|
19624
|
+
/**
|
|
19625
|
+
* Scrolls the first selected line into view, once for each new range or `source`. Pierre marks the selected rows in a
|
|
19626
|
+
* later frame and renders the file after its highlighter loads, so this waits for the row of the new selection.
|
|
19627
|
+
*/
|
|
19628
|
+
function createSelectionScroll(getHost, isSourceRendered) {
|
|
19629
|
+
let key;
|
|
19630
|
+
let observer;
|
|
19631
|
+
const stop = () => {
|
|
19632
|
+
observer?.disconnect();
|
|
19633
|
+
observer = void 0;
|
|
19634
|
+
};
|
|
19635
|
+
const sync = (range, source) => {
|
|
19636
|
+
const next = range ? [...source, ...rangeKey(range)] : void 0;
|
|
19637
|
+
const previous = key;
|
|
19638
|
+
const host = getHost();
|
|
19639
|
+
const root = host?.shadowRoot;
|
|
19640
|
+
key = root ? next : void 0;
|
|
19641
|
+
if (next && previous?.length === next.length && next.every((value, index) => Object.is(value, previous[index]))) return;
|
|
19642
|
+
stop();
|
|
19643
|
+
if (!range || !host || !root) return;
|
|
19644
|
+
const scroll = () => {
|
|
19645
|
+
if (!isSourceRendered()) return;
|
|
19646
|
+
const rows = root.querySelectorAll("[data-line][data-selected-line=\"first\"], [data-line][data-selected-line=\"single\"]");
|
|
19647
|
+
const row = Array.from(rows).find((row) => {
|
|
19648
|
+
const line = Number(row.dataset.line);
|
|
19649
|
+
const side = row.closest("[data-deletions]") || row.dataset.lineType === "change-deletion" ? "deletions" : row.closest("[data-additions]") || row.dataset.lineType === "change-addition" ? "additions" : void 0;
|
|
19650
|
+
return line === range.start && (!side || side === (range.side ?? "additions")) || line === range.end && (!side || side === (range.endSide ?? range.side ?? "additions"));
|
|
19651
|
+
});
|
|
19652
|
+
if (!row) return;
|
|
19653
|
+
stop();
|
|
19654
|
+
scrollToRow(host, row);
|
|
19655
|
+
};
|
|
19656
|
+
observer = new MutationObserver(scroll);
|
|
19657
|
+
observer.observe(root, {
|
|
19658
|
+
attributeFilter: ["data-selected-line"],
|
|
19659
|
+
attributes: true,
|
|
19660
|
+
childList: true,
|
|
19661
|
+
subtree: true
|
|
19662
|
+
});
|
|
19663
|
+
scroll();
|
|
19664
|
+
};
|
|
19665
|
+
return {
|
|
19666
|
+
stop,
|
|
19667
|
+
sync
|
|
19668
|
+
};
|
|
19669
|
+
}
|
|
19670
|
+
function rangeKey(range) {
|
|
19671
|
+
return [
|
|
19672
|
+
range.start,
|
|
19673
|
+
range.end,
|
|
19674
|
+
range.side,
|
|
19675
|
+
range.endSide
|
|
19676
|
+
];
|
|
19677
|
+
}
|
|
19592
19678
|
function controlledOptions(options, selectedLines) {
|
|
19593
19679
|
const rawOptions = trackShallow(options);
|
|
19594
19680
|
return selectedLines === void 0 ? rawOptions : {
|
|
@@ -19641,11 +19727,13 @@ const PierreDiff = defineComponent({
|
|
|
19641
19727
|
oldFile: { type: pierrePropTypes.nullableFileContents },
|
|
19642
19728
|
options: { type: pierrePropTypes.fileDiffOptions },
|
|
19643
19729
|
patch: { type: String },
|
|
19730
|
+
scrollToSelectedLines: scrollToSelectedLinesProp,
|
|
19644
19731
|
selectedLines: selectedLinesProp
|
|
19645
19732
|
},
|
|
19646
19733
|
setup(props, { attrs, expose }) {
|
|
19647
19734
|
let host = null;
|
|
19648
19735
|
let instance;
|
|
19736
|
+
const selectionScroll = createSelectionScroll(() => host, () => instance?.isSourceRendered() ?? false);
|
|
19649
19737
|
const fileDiff = computed(() => {
|
|
19650
19738
|
if (props.fileDiff) return trackShallow(props.fileDiff);
|
|
19651
19739
|
if (props.patch !== void 0) return getSingularPatch(props.patch);
|
|
@@ -19659,7 +19747,7 @@ const PierreDiff = defineComponent({
|
|
|
19659
19747
|
return;
|
|
19660
19748
|
}
|
|
19661
19749
|
const options = accessibleDiffOptions(props.options, props.selectedLines, fileDiff.value);
|
|
19662
|
-
if (!instance) instance = new
|
|
19750
|
+
if (!instance) instance = new SelectionDiffModel(options, void 0, true);
|
|
19663
19751
|
instance.setOptions(options);
|
|
19664
19752
|
instance.render({
|
|
19665
19753
|
fileContainer: host,
|
|
@@ -19668,12 +19756,23 @@ const PierreDiff = defineComponent({
|
|
|
19668
19756
|
lineAnnotations: trackArrayItems(props.lineAnnotations) ?? []
|
|
19669
19757
|
});
|
|
19670
19758
|
if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines));
|
|
19759
|
+
selectionScroll.sync(props.scrollToSelectedLines ? props.selectedLines : void 0, [
|
|
19760
|
+
toRaw(props.fileDiff),
|
|
19761
|
+
props.patch,
|
|
19762
|
+
props.oldFile?.name,
|
|
19763
|
+
props.oldFile?.contents,
|
|
19764
|
+
props.newFile?.name,
|
|
19765
|
+
props.newFile?.contents
|
|
19766
|
+
]);
|
|
19671
19767
|
};
|
|
19672
19768
|
const setHost = (node) => {
|
|
19673
19769
|
host = node instanceof HTMLElement ? node : null;
|
|
19674
19770
|
};
|
|
19675
19771
|
watchEffect(render, { flush: "post" });
|
|
19676
|
-
onBeforeUnmount(() =>
|
|
19772
|
+
onBeforeUnmount(() => {
|
|
19773
|
+
selectionScroll.stop();
|
|
19774
|
+
instance?.cleanUp();
|
|
19775
|
+
});
|
|
19677
19776
|
expose({ getInstance: () => instance });
|
|
19678
19777
|
return () => h(DIFFS_TAG_NAME, {
|
|
19679
19778
|
...attrs,
|
|
@@ -19688,11 +19787,13 @@ const PierreFile = defineComponent({
|
|
|
19688
19787
|
file: { type: pierrePropTypes.fileContents },
|
|
19689
19788
|
lineAnnotations: { type: pierrePropTypes.lineAnnotations },
|
|
19690
19789
|
options: { type: pierrePropTypes.fileOptions },
|
|
19790
|
+
scrollToSelectedLines: scrollToSelectedLinesProp,
|
|
19691
19791
|
selectedLines: selectedLinesProp
|
|
19692
19792
|
},
|
|
19693
19793
|
setup(props, { attrs, expose }) {
|
|
19694
19794
|
let host = null;
|
|
19695
19795
|
let instance;
|
|
19796
|
+
const selectionScroll = createSelectionScroll(() => host, () => instance?.isSourceRendered() ?? false);
|
|
19696
19797
|
const file = computed(() => props.file ? copyFile(props.file) : void 0);
|
|
19697
19798
|
const render = () => {
|
|
19698
19799
|
if (!host) return;
|
|
@@ -19702,7 +19803,7 @@ const PierreFile = defineComponent({
|
|
|
19702
19803
|
return;
|
|
19703
19804
|
}
|
|
19704
19805
|
const options = accessibleOptions(props.options, props.selectedLines);
|
|
19705
|
-
if (!instance) instance = new
|
|
19806
|
+
if (!instance) instance = new SelectionFileModel(options, void 0, true);
|
|
19706
19807
|
instance.setOptions(options);
|
|
19707
19808
|
instance.render({
|
|
19708
19809
|
file: file.value,
|
|
@@ -19711,12 +19812,16 @@ const PierreFile = defineComponent({
|
|
|
19711
19812
|
lineAnnotations: trackArrayItems(props.lineAnnotations) ?? []
|
|
19712
19813
|
});
|
|
19713
19814
|
if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines));
|
|
19815
|
+
selectionScroll.sync(props.scrollToSelectedLines ? props.selectedLines : void 0, [file.value.name, file.value.contents]);
|
|
19714
19816
|
};
|
|
19715
19817
|
const setHost = (node) => {
|
|
19716
19818
|
host = node instanceof HTMLElement ? node : null;
|
|
19717
19819
|
};
|
|
19718
19820
|
watchEffect(render, { flush: "post" });
|
|
19719
|
-
onBeforeUnmount(() =>
|
|
19821
|
+
onBeforeUnmount(() => {
|
|
19822
|
+
selectionScroll.stop();
|
|
19823
|
+
instance?.cleanUp();
|
|
19824
|
+
});
|
|
19720
19825
|
expose({ getInstance: () => instance });
|
|
19721
19826
|
return () => h(DIFFS_TAG_NAME, {
|
|
19722
19827
|
...attrs,
|
|
@@ -19731,11 +19836,13 @@ const PierreUnresolvedFile = defineComponent({
|
|
|
19731
19836
|
file: { type: pierrePropTypes.fileContents },
|
|
19732
19837
|
lineAnnotations: { type: pierrePropTypes.diffLineAnnotations },
|
|
19733
19838
|
options: { type: pierrePropTypes.unresolvedFileOptions },
|
|
19839
|
+
scrollToSelectedLines: scrollToSelectedLinesProp,
|
|
19734
19840
|
selectedLines: selectedLinesProp
|
|
19735
19841
|
},
|
|
19736
19842
|
setup(props, { attrs, expose }) {
|
|
19737
19843
|
let host = null;
|
|
19738
19844
|
let instance;
|
|
19845
|
+
const selectionScroll = createSelectionScroll(() => host, () => instance?.isSourceRendered() ?? false);
|
|
19739
19846
|
let renderedFile;
|
|
19740
19847
|
const file = computed(() => props.file ? copyFile(props.file) : void 0);
|
|
19741
19848
|
const render = () => {
|
|
@@ -19751,7 +19858,7 @@ const PierreUnresolvedFile = defineComponent({
|
|
|
19751
19858
|
instance = void 0;
|
|
19752
19859
|
}
|
|
19753
19860
|
const options = accessibleOptions(props.options, props.selectedLines);
|
|
19754
|
-
if (!instance) instance = new
|
|
19861
|
+
if (!instance) instance = new SelectionUnresolvedFileModel(options, void 0, true);
|
|
19755
19862
|
instance.setOptions(options);
|
|
19756
19863
|
instance.render({
|
|
19757
19864
|
file: file.value,
|
|
@@ -19761,12 +19868,16 @@ const PierreUnresolvedFile = defineComponent({
|
|
|
19761
19868
|
});
|
|
19762
19869
|
renderedFile = file.value;
|
|
19763
19870
|
if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines));
|
|
19871
|
+
selectionScroll.sync(props.scrollToSelectedLines ? props.selectedLines : void 0, [file.value.name, file.value.contents]);
|
|
19764
19872
|
};
|
|
19765
19873
|
const setHost = (node) => {
|
|
19766
19874
|
host = node instanceof HTMLElement ? node : null;
|
|
19767
19875
|
};
|
|
19768
19876
|
watchEffect(render, { flush: "post" });
|
|
19769
|
-
onBeforeUnmount(() =>
|
|
19877
|
+
onBeforeUnmount(() => {
|
|
19878
|
+
selectionScroll.stop();
|
|
19879
|
+
instance?.cleanUp();
|
|
19880
|
+
});
|
|
19770
19881
|
expose({ getInstance: () => instance });
|
|
19771
19882
|
return () => h(DIFFS_TAG_NAME, {
|
|
19772
19883
|
...attrs,
|
|
@@ -19783,6 +19894,7 @@ const PierreCodeView = defineComponent({
|
|
|
19783
19894
|
type: pierrePropTypes.codeViewItems
|
|
19784
19895
|
},
|
|
19785
19896
|
options: { type: pierrePropTypes.codeViewOptions },
|
|
19897
|
+
scrollToSelectedLines: scrollToSelectedLinesProp,
|
|
19786
19898
|
selectedLines: {
|
|
19787
19899
|
default: void 0,
|
|
19788
19900
|
type: pierrePropTypes.codeViewSelection
|
|
@@ -19791,6 +19903,7 @@ const PierreCodeView = defineComponent({
|
|
|
19791
19903
|
setup(props, { attrs, expose }) {
|
|
19792
19904
|
let host = null;
|
|
19793
19905
|
let instance;
|
|
19906
|
+
let scrolledTo;
|
|
19794
19907
|
const render = () => {
|
|
19795
19908
|
if (!host) return;
|
|
19796
19909
|
const options = accessibleOptions(props.options, props.selectedLines);
|
|
@@ -19802,6 +19915,16 @@ const PierreCodeView = defineComponent({
|
|
|
19802
19915
|
instance.setItems(trackArrayItems(props.items));
|
|
19803
19916
|
if (props.selectedLines !== void 0) instance.setSelectedLines(trackShallow(props.selectedLines), { notify: false });
|
|
19804
19917
|
instance.render(true);
|
|
19918
|
+
const selection = props.scrollToSelectedLines ? props.selectedLines : void 0;
|
|
19919
|
+
const key = selection ? [selection.id, ...rangeKey(selection.range)] : void 0;
|
|
19920
|
+
const changed = key?.some((value, index) => value !== scrolledTo?.[index]);
|
|
19921
|
+
scrolledTo = key;
|
|
19922
|
+
if (selection && changed) instance.scrollTo({
|
|
19923
|
+
align: "center",
|
|
19924
|
+
id: selection.id,
|
|
19925
|
+
range: selection.range,
|
|
19926
|
+
type: "range"
|
|
19927
|
+
});
|
|
19805
19928
|
};
|
|
19806
19929
|
const setHost = (node) => {
|
|
19807
19930
|
host = node instanceof HTMLElement ? node : null;
|