@vetta-org/theme-ui 0.1.2 → 0.2.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/package.json +8 -16
- package/src/action-approval/StorageCleanListView.test.tsx +36 -0
- package/src/action-approval/StorageCleanListView.tsx +52 -0
- package/src/action-approval/index.ts +2 -0
- package/src/activity/ActivityPanel.tsx +7 -1
- package/src/activity/ActivityPanelFrame.tsx +1 -1
- package/src/activity/BackgroundTasksTabPanelView.tsx +18 -2
- package/src/activity/BrowserPanelView.tsx +15 -1
- package/src/activity/BrowserSelectionView.tsx +199 -0
- package/src/activity/CodePreview.tsx +15 -1
- package/src/activity/MarkdownPreviewView.test.tsx +53 -0
- package/src/activity/MarkdownPreviewView.tsx +86 -10
- package/src/activity/index.ts +1 -0
- package/src/chat/ContextRingView.test.tsx +81 -0
- package/src/chat/ContextRingView.tsx +78 -62
- package/src/chat/EditDiffView.tsx +4 -4
- package/src/chat/HeaderActionBarView.tsx +135 -48
- package/src/chat/HeaderActionOverflowMenu.tsx +11 -20
- package/src/chat/MessageFeedLayoutView.tsx +6 -5
- package/src/chat/MessageInputView.tsx +5 -1
- package/src/chat/index.ts +2 -1
- package/src/chat/message-feed-fade.css +80 -0
- package/src/chat/message-feed-fade.test.tsx +75 -0
- package/src/chat/streaming-reveal.test.ts +1 -74
- package/src/chat/streaming-reveal.ts +0 -3
- package/src/file-preview/FilePreviewDialogView.tsx +2 -1
- package/src/file-preview/ReadonlyCodeView.tsx +46 -0
- package/src/file-preview/syntax-tokens.css +1 -1
- package/src/image-assets.d.ts +4 -0
- package/src/layout/ResizeHandle.tsx +4 -1
- package/src/layout/resize-handle-reset.test.tsx +50 -0
- package/src/markdown/FileLinkBadge.tsx +77 -0
- package/src/markdown/MarkdownContent.tsx +61 -31
- package/src/markdown/MarkdownImage.tsx +6 -16
- package/src/markdown/MermaidBlock.tsx +50 -11
- package/src/markdown/UrlLinkBadge.tsx +84 -0
- package/src/markdown/image-actions.ts +29 -0
- package/src/markdown/index.ts +2 -0
- package/src/markdown/nodes.ts +6 -1
- package/src/markdown/preview-policy.test.ts +31 -0
- package/src/markdown/preview-policy.ts +33 -0
- package/src/markdown/progressive-chunks.test.ts +43 -0
- package/src/markdown/progressive-chunks.ts +58 -0
- package/src/markdown/rich-labels.ts +9 -0
- package/src/markdown/streaming-fade.test.ts +83 -0
- package/src/markdown/streaming-fade.tsx +141 -0
- package/src/markdown/streaming-reveal.ts +0 -67
- package/src/markdown/streaming.ts +64 -131
- package/src/overlays/CommandMenuRow.tsx +47 -26
- package/src/overlays/CommandMenuView.tsx +107 -15
- package/src/overlays/DiagnosticsExportDialogView.tsx +236 -0
- package/src/overlays/MagpieHandoverDialogView.tsx +217 -0
- package/src/overlays/ReleaseNoteImage.test.tsx +105 -0
- package/src/overlays/ReleaseNoteMarkdown.test.tsx +49 -0
- package/src/overlays/ReleaseNoteMarkdown.tsx +120 -7
- package/src/overlays/SplashPanel.tsx +4 -4
- package/src/overlays/SplashParts.tsx +6 -2
- package/src/overlays/UpdateCheckerView.tsx +17 -15
- package/src/overlays/UpdateRestartDialogView.tsx +76 -2
- package/src/overlays/assets/diagnostics-banner.webp +0 -0
- package/src/overlays/command-menu-types.ts +15 -1
- package/src/overlays/index.ts +13 -0
- package/src/plugin-ui/index.ts +4 -0
- package/src/project/DefaultConversationSectionView.tsx +17 -22
- package/src/project/DefaultSessionRowView.tsx +8 -0
- package/src/project/ManageSessionsSplashView.tsx +0 -2
- package/src/settings/ArchivedProjectsSettingsView.tsx +122 -1
- package/src/settings/GeneralSettingsView.tsx +21 -5
- package/src/settings/LauncherSettingsView.test.tsx +95 -0
- package/src/settings/LauncherSettingsView.tsx +272 -0
- package/src/settings/PetActionGalleryView.test.tsx +163 -0
- package/src/settings/PetActionGalleryView.tsx +216 -0
- package/src/settings/PetSettingsView.test.tsx +117 -0
- package/src/settings/PetSettingsView.tsx +86 -22
- package/src/settings/PresetProviderRowView.tsx +37 -98
- package/src/settings/ShortcutsSettingsView.tsx +0 -4
- package/src/settings/SpaceEditorDialogView.tsx +94 -56
- package/src/settings/SpacesSettingsView.tsx +53 -8
- package/src/settings/StorageBar.tsx +70 -0
- package/src/settings/StorageExplorer.tsx +488 -0
- package/src/settings/StorageReadout.tsx +64 -0
- package/src/settings/StorageSettingsView.test.tsx +181 -0
- package/src/settings/StorageSettingsView.tsx +458 -0
- package/src/settings/assets/space-editor-illustration.webp +0 -0
- package/src/settings/index.ts +28 -39
- package/src/settings/storage-treemap-layout.test.ts +32 -0
- package/src/settings/storage-treemap-layout.ts +55 -0
- package/src/shared/SegmentedControl.test.tsx +68 -0
- package/src/shared/SegmentedControl.tsx +18 -11
- package/src/shared/StageDialogContent.test.tsx +61 -0
- package/src/shared/StageDialogContent.tsx +80 -0
- package/src/shared/TabBar.tsx +2 -2
- package/src/shared/VettaKbd.tsx +20 -1
- package/src/shared/index.ts +4 -1
- package/src/shared/platform.ts +9 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +13 -12
- package/src/sidebar/SettingsMenuTriggerView.tsx +2 -1
- package/src/sidebar/SidebarSectionActionButton.test.tsx +91 -0
- package/src/sidebar/SidebarSectionActionButton.tsx +52 -0
- package/src/styles.css +7 -0
- package/src/markdown/streaming.test.ts +0 -57
- package/src/settings/AchievementNavigationButtonView.tsx +0 -90
- package/src/settings/AchievementPromotionDialogView.tsx +0 -91
- package/src/settings/AchievementSettingsView.tsx +0 -43
- package/src/settings/PetBubbleStylePreviewView.tsx +0 -44
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -64
- package/src/settings/achievements/AchievementCurtains.tsx +0 -50
- package/src/settings/achievements/AchievementPromotionBadge3D.tsx +0 -350
- package/src/settings/achievements/AchievementPromotionConfetti.tsx +0 -71
- package/src/settings/achievements/AchievementTitle.tsx +0 -52
- package/src/settings/achievements/index.ts +0 -13
|
@@ -1,7 +1,86 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import ReactMarkdown, { type Components } from "react-markdown";
|
|
1
|
+
import { createContext, type JSX, type MouseEvent, useContext, useState } from "react";
|
|
2
|
+
import ReactMarkdown, { type Components, defaultUrlTransform } from "react-markdown";
|
|
3
3
|
import remarkGfm from "remark-gfm";
|
|
4
4
|
|
|
5
|
+
const EXTERNAL_LINK_PROTOCOLS = new Set(["http:", "https:", "mailto:"]);
|
|
6
|
+
|
|
7
|
+
function isExternalLink(href: string | undefined): href is string {
|
|
8
|
+
if (!href) return false;
|
|
9
|
+
try {
|
|
10
|
+
return EXTERNAL_LINK_PROTOCOLS.has(new URL(href).protocol);
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 开发态预览会把本地暂存的配图内嵌成 data URL;只放行图片类型。
|
|
17
|
+
const INLINE_IMAGE = /^data:image\/(?:webp|png|jpeg|gif|avif);base64,/;
|
|
18
|
+
|
|
19
|
+
function isWebImage(src: string | undefined): src is string {
|
|
20
|
+
if (!src) return false;
|
|
21
|
+
if (INLINE_IMAGE.test(src)) return true;
|
|
22
|
+
try {
|
|
23
|
+
return new URL(src).protocol === "https:";
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ReleaseNoteImageTarget {
|
|
30
|
+
readonly src: string;
|
|
31
|
+
readonly alt: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const OpenImageContext = createContext<((image: ReleaseNoteImageTarget) => void) | undefined>(undefined);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 发布说明的配图托管在 GitHub Release 附件里,离线、被墙或还没上传时都会加载失败。
|
|
38
|
+
* 加载成功前不占位,失败就整张不渲染:用户看到的和没配图时一样,不出现破图图标。
|
|
39
|
+
* 不用 loading="lazy":懒加载的图在 display:none 时不会发起请求,永远等不到 onLoad。
|
|
40
|
+
*/
|
|
41
|
+
function ReleaseNoteImage({ src, alt }: { readonly src?: string; readonly alt?: string }): JSX.Element {
|
|
42
|
+
const [state, setState] = useState<"loading" | "loaded" | "failed">("loading");
|
|
43
|
+
const onOpen = useContext(OpenImageContext);
|
|
44
|
+
// 失败时留一个隐藏标记,让外层段落仍认得「这里只有配图」而收起边距。
|
|
45
|
+
if (!isWebImage(src) || state === "failed") return <span hidden data-release-image="failed" />;
|
|
46
|
+
const loaded = state === "loaded";
|
|
47
|
+
const image = (
|
|
48
|
+
<img
|
|
49
|
+
src={src}
|
|
50
|
+
alt={alt ?? ""}
|
|
51
|
+
decoding="async"
|
|
52
|
+
draggable={false}
|
|
53
|
+
data-release-image={state}
|
|
54
|
+
onLoad={() => setState("loaded")}
|
|
55
|
+
onError={() => setState("failed")}
|
|
56
|
+
className={
|
|
57
|
+
!loaded ? "hidden" : onOpen ? "block h-auto w-full" : "my-2 block h-auto w-full rounded-md border border-border/60"
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
if (!onOpen) return image;
|
|
62
|
+
// 点图在宿主的灯箱里放大看;GitHub 正文会把图包在链接里,这里拦下,不跳去浏览器。
|
|
63
|
+
const open = (event: MouseEvent) => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
onOpen({ src, alt: alt ?? "" });
|
|
67
|
+
};
|
|
68
|
+
return (
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
aria-label={alt}
|
|
72
|
+
onClick={open}
|
|
73
|
+
className={
|
|
74
|
+
loaded
|
|
75
|
+
? "my-2 block w-full cursor-zoom-in overflow-hidden rounded-md border border-border/60 outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
|
|
76
|
+
: "hidden"
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
{image}
|
|
80
|
+
</button>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
5
84
|
/** 更新日志的排版:标题、列表、行内代码要有层次和间距,不依赖宿主的 markdown 样式。 */
|
|
6
85
|
const releaseNoteComponents: Components = {
|
|
7
86
|
h1: ({ children }) => <h1 className="mb-2 text-[14px] font-semibold text-foreground">{children}</h1>,
|
|
@@ -9,21 +88,55 @@ const releaseNoteComponents: Components = {
|
|
|
9
88
|
<h2 className="mb-1.5 mt-4 text-[13px] font-semibold text-foreground first:mt-0">{children}</h2>
|
|
10
89
|
),
|
|
11
90
|
h3: ({ children }) => <h3 className="mb-1 mt-3 text-[12.5px] font-semibold text-foreground">{children}</h3>,
|
|
12
|
-
|
|
91
|
+
// 只装着配图的段落不留外边距:图没加载出来时整段高度为零,和没配图一样。
|
|
92
|
+
p: ({ children }) => <p className="my-1.5 [&:has([data-release-image])]:my-0">{children}</p>,
|
|
93
|
+
img: ({ src, alt }) => <ReleaseNoteImage src={typeof src === "string" ? src : undefined} alt={alt} />,
|
|
13
94
|
ul: ({ children }) => <ul className="my-1.5 list-disc space-y-1.5 pl-5">{children}</ul>,
|
|
14
95
|
ol: ({ children }) => <ol className="my-1.5 list-decimal space-y-1.5 pl-5">{children}</ol>,
|
|
15
96
|
li: ({ children }) => <li className="pl-0.5">{children}</li>,
|
|
16
97
|
strong: ({ children }) => <strong className="font-semibold text-foreground">{children}</strong>,
|
|
98
|
+
// 普通 <a href> 会把整个主窗口导航到该网页且无法返回。外链改走 target=_blank,
|
|
99
|
+
// 由主进程的 window-open handler 交给系统浏览器;其余(相对路径、锚点)只显示文字。
|
|
100
|
+
a: ({ href, children }) =>
|
|
101
|
+
isExternalLink(href) ? (
|
|
102
|
+
<a
|
|
103
|
+
href={href}
|
|
104
|
+
target="_blank"
|
|
105
|
+
rel="noopener noreferrer"
|
|
106
|
+
className="text-primary underline decoration-primary/30 hover:decoration-primary"
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
</a>
|
|
110
|
+
) : (
|
|
111
|
+
<span>{children}</span>
|
|
112
|
+
),
|
|
17
113
|
code: ({ children }) => (
|
|
18
114
|
<code className="rounded bg-muted px-1 py-0.5 font-mono text-[11.5px] text-foreground">{children}</code>
|
|
19
115
|
),
|
|
20
116
|
};
|
|
21
117
|
|
|
118
|
+
function releaseNoteUrlTransform(url: string, key: string): string {
|
|
119
|
+
return key === "src" && INLINE_IMAGE.test(url) ? url : defaultUrlTransform(url);
|
|
120
|
+
}
|
|
121
|
+
|
|
22
122
|
/** 更新日志的 Markdown 渲染:设置页预览与更新弹窗共用。 */
|
|
23
|
-
export function ReleaseNoteMarkdown({
|
|
123
|
+
export function ReleaseNoteMarkdown({
|
|
124
|
+
children,
|
|
125
|
+
onOpenImage,
|
|
126
|
+
}: {
|
|
127
|
+
readonly children: string;
|
|
128
|
+
/** 点配图时调用,宿主据此打开灯箱;不传时配图只展示、不可点。 */
|
|
129
|
+
readonly onOpenImage?: (image: ReleaseNoteImageTarget) => void;
|
|
130
|
+
}): JSX.Element {
|
|
24
131
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
132
|
+
<OpenImageContext.Provider value={onOpenImage}>
|
|
133
|
+
<ReactMarkdown
|
|
134
|
+
remarkPlugins={[remarkGfm]}
|
|
135
|
+
components={releaseNoteComponents}
|
|
136
|
+
urlTransform={releaseNoteUrlTransform}
|
|
137
|
+
>
|
|
138
|
+
{children}
|
|
139
|
+
</ReactMarkdown>
|
|
140
|
+
</OpenImageContext.Provider>
|
|
28
141
|
);
|
|
29
142
|
}
|
|
@@ -3,11 +3,11 @@ import { useRef, type JSX, type ReactNode } from "react";
|
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
5
5
|
import "./command-menu.css";
|
|
6
|
-
import { cn,
|
|
6
|
+
import { cn, GLASS_PANEL_CLASS, OVERLAY_BACKDROP_CLASS } from "@vetta-org/ui/utils";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 居中偏上的 Splash 面板外壳:遮罩 + 入场动效 + 高光边 + 主题 surface 槽位。
|
|
10
|
-
* ⌘
|
|
10
|
+
* ⌘T 命令面板与「添加项目」这类选项面板共用这一份,样式只在这里改一次。
|
|
11
11
|
*
|
|
12
12
|
* 自己 portal 到 body:宿主可能把它挂在侧栏之类带 transform / contain 的祖先里,
|
|
13
13
|
* 那样 `fixed` 会相对祖先定位,面板就缩在侧栏里了。
|
|
@@ -67,8 +67,8 @@ export function SplashPanel({
|
|
|
67
67
|
exit={{ opacity: 0, scale: 0.96, y: -8 }}
|
|
68
68
|
transition={{ duration: 0.16, ease: [0.25, 0.1, 0.25, 1] }}
|
|
69
69
|
style={{ width: `min(${width}, calc(100vw - 32px))` }}
|
|
70
|
-
//
|
|
71
|
-
className={cn("command-menu-sheen relative flex flex-col rounded-2xl
|
|
70
|
+
// 玻璃面板:与 ButtonGroup 同一套半透明叠层 + 内阴影高光边(见 GLASS_PANEL_CLASS)。
|
|
71
|
+
className={cn("command-menu-sheen relative flex flex-col rounded-2xl", GLASS_PANEL_CLASS)}
|
|
72
72
|
>
|
|
73
73
|
<ThemeSurface slot="root.commandMenu.panel" />
|
|
74
74
|
<div className="relative z-10 flex min-h-0 flex-col">
|
|
@@ -53,6 +53,8 @@ export interface SplashInputHeaderProps {
|
|
|
53
53
|
>;
|
|
54
54
|
/** 挂载后自动聚焦,默认开启:进入这一步后的第一个动作就是打字。 */
|
|
55
55
|
readonly autoFocus?: boolean;
|
|
56
|
+
/** 输入框右侧的附加内容,例如唤起面板的快捷键提示。 */
|
|
57
|
+
readonly trailing?: ReactNode;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
export function SplashInputHeader({
|
|
@@ -69,6 +71,7 @@ export function SplashInputHeader({
|
|
|
69
71
|
inputRef,
|
|
70
72
|
inputProps,
|
|
71
73
|
autoFocus = true,
|
|
74
|
+
trailing,
|
|
72
75
|
}: SplashInputHeaderProps): JSX.Element {
|
|
73
76
|
const ownRef = useRef<HTMLInputElement | null>(null);
|
|
74
77
|
const ref = inputRef ?? ownRef;
|
|
@@ -119,6 +122,7 @@ export function SplashInputHeader({
|
|
|
119
122
|
}}
|
|
120
123
|
className="min-w-0 flex-1 bg-transparent text-[14px] text-foreground outline-none placeholder:text-muted-foreground/70 disabled:opacity-60"
|
|
121
124
|
/>
|
|
125
|
+
{trailing}
|
|
122
126
|
</div>
|
|
123
127
|
);
|
|
124
128
|
}
|
|
@@ -162,8 +166,8 @@ export function SplashFooter({ children, className }: { children: ReactNode; cla
|
|
|
162
166
|
return (
|
|
163
167
|
<div
|
|
164
168
|
className={cn(
|
|
165
|
-
//
|
|
166
|
-
"flex min-h-
|
|
169
|
+
// 唯一保留分隔线的地方;玻璃面板上不另铺底色,只用一条极淡的线把操作区分开。
|
|
170
|
+
"flex min-h-9 shrink-0 items-center gap-3 border-t border-foreground/[0.06] px-3.5 py-1.5 dark:border-white/[0.07]",
|
|
167
171
|
"text-[11px] text-muted-foreground/80",
|
|
168
172
|
className,
|
|
169
173
|
)}
|
|
@@ -31,7 +31,7 @@ export interface UpdateCheckerViewProps {
|
|
|
31
31
|
readonly currentVersion: string;
|
|
32
32
|
readonly labels: UpdateCheckerViewLabels;
|
|
33
33
|
readonly latestVersion?: string;
|
|
34
|
-
readonly onCheck
|
|
34
|
+
readonly onCheck?: () => void;
|
|
35
35
|
readonly onPrimary: () => void;
|
|
36
36
|
readonly onViewMore?: () => void;
|
|
37
37
|
readonly onViewCurrent?: () => void;
|
|
@@ -61,20 +61,22 @@ export function UpdateCheckerAction({
|
|
|
61
61
|
{labels.viewCurrent}
|
|
62
62
|
</Button>
|
|
63
63
|
)}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
{onCheck && (
|
|
65
|
+
<Button
|
|
66
|
+
variant="field"
|
|
67
|
+
onClick={onCheck}
|
|
68
|
+
disabled={busy}
|
|
69
|
+
data-testid="updater-check"
|
|
70
|
+
data-updater-phase={phase}
|
|
71
|
+
>
|
|
72
|
+
<span className={`icon-[mdi--refresh] h-3.5 w-3.5 ${busy ? "animate-spin" : ""}`} />
|
|
73
|
+
{downloading
|
|
74
|
+
? labels.downloading(Math.round((progress ?? 0) * 100))
|
|
75
|
+
: checking
|
|
76
|
+
? labels.checkingBtn
|
|
77
|
+
: labels.check}
|
|
78
|
+
</Button>
|
|
79
|
+
)}
|
|
78
80
|
</div>
|
|
79
81
|
);
|
|
80
82
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimatePresence, motion } from "motion/react";
|
|
2
2
|
import { type JSX, type RefObject, useEffect, useState } from "react";
|
|
3
3
|
import { cn, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
|
|
4
|
-
import { ReleaseNoteMarkdown } from "./ReleaseNoteMarkdown";
|
|
4
|
+
import { ReleaseNoteMarkdown, type ReleaseNoteImageTarget } from "./ReleaseNoteMarkdown";
|
|
5
5
|
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -19,6 +19,12 @@ export interface UpdateRestartDialogAction {
|
|
|
19
19
|
readonly onClick: () => void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface UpdateRestartDialogEarlierNote {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly title: string;
|
|
25
|
+
readonly note: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
export interface UpdateRestartDialogViewProps {
|
|
23
29
|
readonly bannerSrc: string;
|
|
24
30
|
/** 无正文时的占位文案(如「暂无版本介绍」);有 releaseNote 时不显示。 */
|
|
@@ -29,12 +35,20 @@ export interface UpdateRestartDialogViewProps {
|
|
|
29
35
|
/** 底部唯一的悬浮按钮;省略时不显示底栏,只能用右上角的关闭按钮离开。 */
|
|
30
36
|
readonly primary?: UpdateRestartDialogAction;
|
|
31
37
|
readonly releaseNote?: string;
|
|
38
|
+
/** 跨多个版本更新时更早的各版说明(从新到旧),逐版折叠,点开才显示正文。 */
|
|
39
|
+
readonly earlierReleaseNotes?: ReadonlyArray<UpdateRestartDialogEarlierNote>;
|
|
40
|
+
/** 「更早的版本」分组标题,有 earlierReleaseNotes 时显示。 */
|
|
41
|
+
readonly earlierTitle?: string;
|
|
42
|
+
/** 正文末尾的「查看全部更新记录」链接。 */
|
|
43
|
+
readonly viewAll?: UpdateRestartDialogAction;
|
|
32
44
|
readonly status?: UpdateRestartDialogStatus;
|
|
33
45
|
readonly subtitle?: string;
|
|
34
46
|
readonly title: string;
|
|
35
47
|
readonly visible: boolean;
|
|
36
48
|
/** 正文正在加载(版本介绍从磁盘读取时)。 */
|
|
37
49
|
readonly loading?: boolean;
|
|
50
|
+
/** 点说明里的配图时调用,宿主打开灯箱。 */
|
|
51
|
+
readonly onOpenImage?: (image: ReleaseNoteImageTarget) => void;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
// 底部主按钮:通栏胶囊,悬浮在正文之上。
|
|
@@ -44,15 +58,19 @@ const pillClass =
|
|
|
44
58
|
export function UpdateRestartDialogView({
|
|
45
59
|
bannerSrc,
|
|
46
60
|
closeLabel,
|
|
61
|
+
earlierReleaseNotes,
|
|
62
|
+
earlierTitle,
|
|
47
63
|
emptyText,
|
|
48
64
|
loading = false,
|
|
49
65
|
onClose,
|
|
66
|
+
onOpenImage,
|
|
50
67
|
overlayRef,
|
|
51
68
|
primary,
|
|
52
69
|
releaseNote,
|
|
53
70
|
status,
|
|
54
71
|
subtitle,
|
|
55
72
|
title,
|
|
73
|
+
viewAll,
|
|
56
74
|
visible,
|
|
57
75
|
}: UpdateRestartDialogViewProps): JSX.Element {
|
|
58
76
|
// 滚动后才显示顶部渐隐,初始位置横幅完整露出。
|
|
@@ -120,10 +138,33 @@ export function UpdateRestartDialogView({
|
|
|
120
138
|
{releaseNote && (
|
|
121
139
|
<div className="mt-5">
|
|
122
140
|
<div className="markdown-body text-[13px] leading-[1.6] break-words text-muted-foreground">
|
|
123
|
-
<ReleaseNoteMarkdown>{releaseNote}</ReleaseNoteMarkdown>
|
|
141
|
+
<ReleaseNoteMarkdown onOpenImage={onOpenImage}>{releaseNote}</ReleaseNoteMarkdown>
|
|
124
142
|
</div>
|
|
125
143
|
</div>
|
|
126
144
|
)}
|
|
145
|
+
{earlierReleaseNotes && earlierReleaseNotes.length > 0 && (
|
|
146
|
+
<div className="mt-7">
|
|
147
|
+
{earlierTitle && (
|
|
148
|
+
<p className="text-[12px] font-medium text-muted-foreground/80">{earlierTitle}</p>
|
|
149
|
+
)}
|
|
150
|
+
<div className="mt-2 divide-y divide-border/60 overflow-hidden rounded-xl border border-border/60">
|
|
151
|
+
{earlierReleaseNotes.map((item) => (
|
|
152
|
+
<EarlierReleaseNote key={item.id} item={item} onOpenImage={onOpenImage} />
|
|
153
|
+
))}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
)}
|
|
157
|
+
{viewAll && (
|
|
158
|
+
<button
|
|
159
|
+
type="button"
|
|
160
|
+
onClick={viewAll.onClick}
|
|
161
|
+
disabled={viewAll.disabled}
|
|
162
|
+
className="mt-4 inline-flex items-center gap-1 rounded-sm text-[13px] text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50"
|
|
163
|
+
>
|
|
164
|
+
{viewAll.label}
|
|
165
|
+
<span className="icon-[mdi--open-in-new] h-3.5 w-3.5" />
|
|
166
|
+
</button>
|
|
167
|
+
)}
|
|
127
168
|
{loading && (
|
|
128
169
|
<div className="mt-5 flex items-center gap-2 text-[13px] text-muted-foreground">
|
|
129
170
|
<span className="icon-[mdi--loading] h-4 w-4 animate-spin" />
|
|
@@ -168,6 +209,39 @@ export function UpdateRestartDialogView({
|
|
|
168
209
|
);
|
|
169
210
|
}
|
|
170
211
|
|
|
212
|
+
function EarlierReleaseNote({
|
|
213
|
+
item,
|
|
214
|
+
onOpenImage,
|
|
215
|
+
}: {
|
|
216
|
+
readonly item: UpdateRestartDialogEarlierNote;
|
|
217
|
+
readonly onOpenImage?: (image: ReleaseNoteImageTarget) => void;
|
|
218
|
+
}): JSX.Element {
|
|
219
|
+
const [open, setOpen] = useState(false);
|
|
220
|
+
return (
|
|
221
|
+
<div>
|
|
222
|
+
<button
|
|
223
|
+
type="button"
|
|
224
|
+
aria-expanded={open}
|
|
225
|
+
onClick={() => setOpen((value) => !value)}
|
|
226
|
+
className="flex w-full items-center justify-between gap-3 px-4 py-2.5 text-left text-[13px] font-medium text-foreground outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50"
|
|
227
|
+
>
|
|
228
|
+
{item.title}
|
|
229
|
+
<span
|
|
230
|
+
className={cn(
|
|
231
|
+
"icon-[mdi--chevron-down] h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-150",
|
|
232
|
+
open && "rotate-180",
|
|
233
|
+
)}
|
|
234
|
+
/>
|
|
235
|
+
</button>
|
|
236
|
+
{open && (
|
|
237
|
+
<div className="markdown-body px-4 pt-1 pb-4 text-[13px] leading-[1.6] break-words text-muted-foreground">
|
|
238
|
+
<ReleaseNoteMarkdown onOpenImage={onOpenImage}>{item.note}</ReleaseNoteMarkdown>
|
|
239
|
+
</div>
|
|
240
|
+
)}
|
|
241
|
+
</div>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
171
245
|
function StatusLine({ status }: { readonly status: UpdateRestartDialogStatus }): JSX.Element {
|
|
172
246
|
if (status.kind === "progress") {
|
|
173
247
|
const percent = Math.max(0, Math.min(100, Math.round(status.progress * 100)));
|
|
Binary file
|
|
@@ -20,6 +20,14 @@ export interface CommandMenuItemView {
|
|
|
20
20
|
/** iconify 类名,例如 `icon-[solar--folder-linear]`。 */
|
|
21
21
|
readonly icon: string;
|
|
22
22
|
readonly badge?: string;
|
|
23
|
+
/** badge 的色调:accent 用主题强调色(如「技能」),默认是中性灰。 */
|
|
24
|
+
readonly badgeTone?: "neutral" | "accent";
|
|
25
|
+
/**
|
|
26
|
+
* 会话的进行中状态:有值时行首图标换成与侧栏一致的状态图标,并在行尾显示 statusLabel。
|
|
27
|
+
* waiting 指会话正等着用户处理(提问 / 审批 / 询问 / 授权);unread 指一轮已跑完、用户还没打开看。
|
|
28
|
+
*/
|
|
29
|
+
readonly status?: "running" | "waiting" | "unread";
|
|
30
|
+
readonly statusLabel?: string;
|
|
23
31
|
/** 行尾的标签色点(管理会话用),按给定顺序排列。 */
|
|
24
32
|
readonly tagColors?: readonly string[];
|
|
25
33
|
/** 命中了但当前打不开(例如无权限的会话):显示但禁用,不静默过滤。 */
|
|
@@ -43,7 +51,13 @@ export interface CommandMenuViewLabels {
|
|
|
43
51
|
readonly emptyHint: string;
|
|
44
52
|
readonly loading: string;
|
|
45
53
|
readonly title: string;
|
|
46
|
-
|
|
54
|
+
/** 右下角操作按钮组的无障碍名称。 */
|
|
55
|
+
readonly actionsLabel: string;
|
|
56
|
+
/** 左下角「新会话」按钮文案。 */
|
|
57
|
+
readonly newSession: string;
|
|
58
|
+
/** 新会话旁「全部已读」按钮文案;宿主不支持时不传。 */
|
|
59
|
+
readonly markAllRead?: string;
|
|
60
|
+
/** 按钮文案只写动作(「打开」),键帽由视图按平台渲染。 */
|
|
47
61
|
readonly hintSelect: string;
|
|
48
62
|
readonly hintClose: string;
|
|
49
63
|
}
|
package/src/overlays/index.ts
CHANGED
|
@@ -17,9 +17,21 @@ export type {
|
|
|
17
17
|
export type { DetailDrawerProps } from "./DetailDrawer";
|
|
18
18
|
export { DetailDrawer } from "./DetailDrawer";
|
|
19
19
|
export { DetailDrawerEnter } from "./DetailDrawerEnter";
|
|
20
|
+
export type {
|
|
21
|
+
DiagnosticsExportDialogPhase,
|
|
22
|
+
DiagnosticsExportDialogViewLabels,
|
|
23
|
+
DiagnosticsExportDialogViewProps,
|
|
24
|
+
} from "./DiagnosticsExportDialogView";
|
|
25
|
+
export { DiagnosticsExportDialogView } from "./DiagnosticsExportDialogView";
|
|
20
26
|
export { shouldCloseDetailDrawer } from "./detail-drawer-guard";
|
|
21
27
|
export type { KnowledgeDropOverlayViewProps } from "./KnowledgeDropOverlayView";
|
|
22
28
|
export { KnowledgeDropOverlayView } from "./KnowledgeDropOverlayView";
|
|
29
|
+
export type {
|
|
30
|
+
MagpieHandoverDialogViewLabels,
|
|
31
|
+
MagpieHandoverDialogViewProps,
|
|
32
|
+
} from "./MagpieHandoverDialogView";
|
|
33
|
+
export { MagpieHandoverDialogView } from "./MagpieHandoverDialogView";
|
|
34
|
+
export type { ReleaseNoteImageTarget } from "./ReleaseNoteMarkdown";
|
|
23
35
|
export type {
|
|
24
36
|
RouteErrorPageViewLabels,
|
|
25
37
|
RouteErrorPageViewProps,
|
|
@@ -51,6 +63,7 @@ export type {
|
|
|
51
63
|
export { UpdateCheckerAction, UpdateCheckerDetail, UpdateCheckerView } from "./UpdateCheckerView";
|
|
52
64
|
export type {
|
|
53
65
|
UpdateRestartDialogAction,
|
|
66
|
+
UpdateRestartDialogEarlierNote,
|
|
54
67
|
UpdateRestartDialogStatus,
|
|
55
68
|
UpdateRestartDialogViewProps,
|
|
56
69
|
} from "./UpdateRestartDialogView";
|
package/src/plugin-ui/index.ts
CHANGED
|
@@ -30,5 +30,9 @@ export type { VettaKbdKey, VettaKbdPlatform } from "../shared/kbd-keys";
|
|
|
30
30
|
export type { MultiplierTagProps } from "../shared/MultiplierTag";
|
|
31
31
|
export { fmtMultiplier, MultiplierTag } from "../shared/MultiplierTag";
|
|
32
32
|
export { getProviderIcon, PROVIDER_ICONS, ProviderIcon } from "../shared/provider-icon";
|
|
33
|
+
export type { SegmentedControlItem, SegmentedControlProps } from "../shared/SegmentedControl";
|
|
34
|
+
export { SegmentedControl } from "../shared/SegmentedControl";
|
|
35
|
+
export type { StageDialogContentProps } from "../shared/StageDialogContent";
|
|
36
|
+
export { StageDialogContent } from "../shared/StageDialogContent";
|
|
33
37
|
export type { VettaKbdProps, VettaKbdSize } from "../shared/VettaKbd";
|
|
34
38
|
export { VettaKbd } from "../shared/VettaKbd";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cn } from "@vetta-org/ui/utils";
|
|
2
2
|
import type { JSX, ReactNode } from "react";
|
|
3
|
+
import { SidebarSectionActionButton } from "../sidebar/SidebarSectionActionButton";
|
|
3
4
|
|
|
4
5
|
export interface DefaultConversationSectionViewLabels {
|
|
5
6
|
more: string;
|
|
@@ -9,16 +10,15 @@ export interface DefaultConversationSectionViewLabels {
|
|
|
9
10
|
export interface DefaultConversationSectionViewProps {
|
|
10
11
|
className?: string;
|
|
11
12
|
filterSelect: ReactNode;
|
|
13
|
+
/** 标题行上额外的操作,排在「更多」之前。 */
|
|
14
|
+
headerActions?: ReactNode;
|
|
12
15
|
labels: DefaultConversationSectionViewLabels;
|
|
13
16
|
list: ReactNode;
|
|
14
17
|
onMoreClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
18
|
onNewSession?: () => void;
|
|
16
19
|
onOpenContextMenu: (event: React.MouseEvent) => void;
|
|
17
20
|
showNewSession: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* When the conversation list is empty, keep header actions visible so users
|
|
20
|
-
* can discover “new session” without hovering the row.
|
|
21
|
-
*/
|
|
21
|
+
/** 对话列表为空时常驻标题行操作,引导开始第一个对话;有对话后只在悬停标题行时出现。 */
|
|
22
22
|
actionsAlwaysVisible?: boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -28,6 +28,7 @@ export interface DefaultConversationSectionViewProps {
|
|
|
28
28
|
export function DefaultConversationSectionView({
|
|
29
29
|
className,
|
|
30
30
|
filterSelect,
|
|
31
|
+
headerActions,
|
|
31
32
|
labels,
|
|
32
33
|
list,
|
|
33
34
|
onMoreClick,
|
|
@@ -36,10 +37,7 @@ export function DefaultConversationSectionView({
|
|
|
36
37
|
showNewSession,
|
|
37
38
|
actionsAlwaysVisible = false,
|
|
38
39
|
}: DefaultConversationSectionViewProps): JSX.Element {
|
|
39
|
-
const
|
|
40
|
-
? "flex items-center justify-center rounded-md p-1.5 text-foreground opacity-70 transition-opacity hover:bg-accent hover:opacity-100"
|
|
41
|
-
: "flex items-center justify-center rounded-md p-1.5 text-foreground opacity-0 transition-opacity hover:bg-accent group-hover:opacity-60 group-hover:hover:opacity-100";
|
|
42
|
-
|
|
40
|
+
const reveal = actionsAlwaysVisible ? "always" : "hover";
|
|
43
41
|
return (
|
|
44
42
|
<div className={cn("flex flex-col", className)}>
|
|
45
43
|
<div
|
|
@@ -48,23 +46,20 @@ export function DefaultConversationSectionView({
|
|
|
48
46
|
>
|
|
49
47
|
<div className="flex min-w-0 items-center gap-0.5">{filterSelect}</div>
|
|
50
48
|
<div className="flex items-center">
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
{headerActions}
|
|
50
|
+
<SidebarSectionActionButton
|
|
51
|
+
iconClassName="icon-[solar--menu-dots-bold]"
|
|
52
|
+
label={labels.more}
|
|
54
53
|
onClick={onMoreClick}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<span className="icon-[solar--menu-dots-bold] h-4 w-4" />
|
|
58
|
-
</button>
|
|
54
|
+
reveal={reveal}
|
|
55
|
+
/>
|
|
59
56
|
{showNewSession && onNewSession && (
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
<SidebarSectionActionButton
|
|
58
|
+
iconClassName="icon-[solar--add-linear]"
|
|
59
|
+
label={labels.newSession}
|
|
63
60
|
onClick={onNewSession}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<span className="icon-[solar--add-linear] h-4 w-4" />
|
|
67
|
-
</button>
|
|
61
|
+
reveal={reveal}
|
|
62
|
+
/>
|
|
68
63
|
)}
|
|
69
64
|
</div>
|
|
70
65
|
</div>
|
|
@@ -25,6 +25,8 @@ export interface DefaultSessionRowViewProps {
|
|
|
25
25
|
sessionPath?: string;
|
|
26
26
|
/** Tooltip / secondary label (e.g. forked-from preview). */
|
|
27
27
|
titleExtra?: string;
|
|
28
|
+
/** 标题后的弱化短文本,例如平铺列表中会话所属的项目名。 */
|
|
29
|
+
secondaryLabel?: string;
|
|
28
30
|
/** Session was forked from another session. */
|
|
29
31
|
forked?: boolean;
|
|
30
32
|
/** Tag colors carried by this conversation; replaces the leading icon when present. */
|
|
@@ -57,6 +59,7 @@ export const DefaultSessionRowView = memo(function DefaultSessionRowView({
|
|
|
57
59
|
trailingAvatarUrls,
|
|
58
60
|
sessionPath,
|
|
59
61
|
titleExtra,
|
|
62
|
+
secondaryLabel,
|
|
60
63
|
forked,
|
|
61
64
|
moreLabel,
|
|
62
65
|
onOpenContextMenu,
|
|
@@ -146,6 +149,11 @@ export const DefaultSessionRowView = memo(function DefaultSessionRowView({
|
|
|
146
149
|
label={label}
|
|
147
150
|
title={title}
|
|
148
151
|
/>
|
|
152
|
+
{secondaryLabel ? (
|
|
153
|
+
<span className="max-w-[45%] shrink-0 truncate text-[11px] text-muted-foreground/60">
|
|
154
|
+
{secondaryLabel}
|
|
155
|
+
</span>
|
|
156
|
+
) : null}
|
|
149
157
|
{trailingAvatarUrls && trailingAvatarUrls.length > 0 ? (
|
|
150
158
|
<AvatarStackView avatarUrls={trailingAvatarUrls} />
|
|
151
159
|
) : null}
|
|
@@ -230,7 +230,6 @@ function VirtualRows({
|
|
|
230
230
|
<CommandMenuRow
|
|
231
231
|
item={row}
|
|
232
232
|
active={row.id === selectedId}
|
|
233
|
-
suppressSelectionAnimation={false}
|
|
234
233
|
onActivate={onOpenRow}
|
|
235
234
|
onHover={onHoverRow}
|
|
236
235
|
onMore={onMoreRow}
|
|
@@ -405,7 +404,6 @@ export function ManageSessionsSplashView(props: ManageSessionsSplashViewProps):
|
|
|
405
404
|
key={row.id}
|
|
406
405
|
item={row}
|
|
407
406
|
active={row.id === selectedId}
|
|
408
|
-
suppressSelectionAnimation={false}
|
|
409
407
|
onActivate={onOpenRow}
|
|
410
408
|
onHover={onHoverRow}
|
|
411
409
|
onMore={onMoreRow}
|