@vetta-org/theme-ui 0.2.0 → 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 +1 -1
- 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/BackgroundTasksTabPanelView.tsx +18 -2
- package/src/activity/BrowserPanelView.tsx +15 -1
- package/src/activity/BrowserSelectionView.tsx +199 -0
- package/src/activity/index.ts +1 -0
- package/src/chat/EditDiffView.tsx +4 -4
- package/src/chat/HeaderActionBarView.tsx +16 -4
- 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/layout/ResizeHandle.tsx +4 -1
- package/src/layout/resize-handle-reset.test.tsx +50 -0
- package/src/markdown/MarkdownContent.tsx +49 -26
- package/src/markdown/UrlLinkBadge.tsx +84 -0
- package/src/markdown/index.ts +1 -0
- package/src/markdown/nodes.ts +6 -1
- package/src/markdown/rich-labels.ts +3 -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 +4 -14
- package/src/overlays/CommandMenuView.tsx +11 -4
- package/src/overlays/ReleaseNoteImage.test.tsx +105 -0
- package/src/overlays/ReleaseNoteMarkdown.test.tsx +25 -0
- package/src/overlays/ReleaseNoteMarkdown.tsx +94 -7
- package/src/overlays/UpdateCheckerView.tsx +17 -15
- package/src/overlays/UpdateRestartDialogView.tsx +14 -5
- package/src/overlays/command-menu-types.ts +2 -0
- package/src/overlays/index.ts +1 -0
- package/src/plugin-ui/index.ts +2 -0
- package/src/project/DefaultConversationSectionView.tsx +4 -0
- package/src/project/ManageSessionsSplashView.tsx +0 -2
- package/src/settings/GeneralSettingsView.tsx +19 -0
- package/src/settings/LauncherSettingsView.tsx +0 -1
- 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/index.ts +10 -0
- package/src/settings/storage-treemap-layout.test.ts +32 -0
- package/src/settings/storage-treemap-layout.ts +55 -0
- package/src/shared/SegmentedControl.tsx +10 -11
- package/src/shared/StageDialogContent.test.tsx +61 -0
- package/src/shared/StageDialogContent.tsx +80 -0
- package/src/shared/index.ts +2 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +4 -2
- package/src/styles.css +5 -0
- package/src/markdown/streaming.test.ts +0 -57
|
@@ -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
|
/**
|
|
@@ -47,6 +47,8 @@ export interface UpdateRestartDialogViewProps {
|
|
|
47
47
|
readonly visible: boolean;
|
|
48
48
|
/** 正文正在加载(版本介绍从磁盘读取时)。 */
|
|
49
49
|
readonly loading?: boolean;
|
|
50
|
+
/** 点说明里的配图时调用,宿主打开灯箱。 */
|
|
51
|
+
readonly onOpenImage?: (image: ReleaseNoteImageTarget) => void;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
// 底部主按钮:通栏胶囊,悬浮在正文之上。
|
|
@@ -61,6 +63,7 @@ export function UpdateRestartDialogView({
|
|
|
61
63
|
emptyText,
|
|
62
64
|
loading = false,
|
|
63
65
|
onClose,
|
|
66
|
+
onOpenImage,
|
|
64
67
|
overlayRef,
|
|
65
68
|
primary,
|
|
66
69
|
releaseNote,
|
|
@@ -135,7 +138,7 @@ export function UpdateRestartDialogView({
|
|
|
135
138
|
{releaseNote && (
|
|
136
139
|
<div className="mt-5">
|
|
137
140
|
<div className="markdown-body text-[13px] leading-[1.6] break-words text-muted-foreground">
|
|
138
|
-
<ReleaseNoteMarkdown>{releaseNote}</ReleaseNoteMarkdown>
|
|
141
|
+
<ReleaseNoteMarkdown onOpenImage={onOpenImage}>{releaseNote}</ReleaseNoteMarkdown>
|
|
139
142
|
</div>
|
|
140
143
|
</div>
|
|
141
144
|
)}
|
|
@@ -146,7 +149,7 @@ export function UpdateRestartDialogView({
|
|
|
146
149
|
)}
|
|
147
150
|
<div className="mt-2 divide-y divide-border/60 overflow-hidden rounded-xl border border-border/60">
|
|
148
151
|
{earlierReleaseNotes.map((item) => (
|
|
149
|
-
<EarlierReleaseNote key={item.id} item={item} />
|
|
152
|
+
<EarlierReleaseNote key={item.id} item={item} onOpenImage={onOpenImage} />
|
|
150
153
|
))}
|
|
151
154
|
</div>
|
|
152
155
|
</div>
|
|
@@ -206,7 +209,13 @@ export function UpdateRestartDialogView({
|
|
|
206
209
|
);
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
function EarlierReleaseNote({
|
|
212
|
+
function EarlierReleaseNote({
|
|
213
|
+
item,
|
|
214
|
+
onOpenImage,
|
|
215
|
+
}: {
|
|
216
|
+
readonly item: UpdateRestartDialogEarlierNote;
|
|
217
|
+
readonly onOpenImage?: (image: ReleaseNoteImageTarget) => void;
|
|
218
|
+
}): JSX.Element {
|
|
210
219
|
const [open, setOpen] = useState(false);
|
|
211
220
|
return (
|
|
212
221
|
<div>
|
|
@@ -226,7 +235,7 @@ function EarlierReleaseNote({ item }: { readonly item: UpdateRestartDialogEarlie
|
|
|
226
235
|
</button>
|
|
227
236
|
{open && (
|
|
228
237
|
<div className="markdown-body px-4 pt-1 pb-4 text-[13px] leading-[1.6] break-words text-muted-foreground">
|
|
229
|
-
<ReleaseNoteMarkdown>{item.note}</ReleaseNoteMarkdown>
|
|
238
|
+
<ReleaseNoteMarkdown onOpenImage={onOpenImage}>{item.note}</ReleaseNoteMarkdown>
|
|
230
239
|
</div>
|
|
231
240
|
)}
|
|
232
241
|
</div>
|
|
@@ -55,6 +55,8 @@ export interface CommandMenuViewLabels {
|
|
|
55
55
|
readonly actionsLabel: string;
|
|
56
56
|
/** 左下角「新会话」按钮文案。 */
|
|
57
57
|
readonly newSession: string;
|
|
58
|
+
/** 新会话旁「全部已读」按钮文案;宿主不支持时不传。 */
|
|
59
|
+
readonly markAllRead?: string;
|
|
58
60
|
/** 按钮文案只写动作(「打开」),键帽由视图按平台渲染。 */
|
|
59
61
|
readonly hintSelect: string;
|
|
60
62
|
readonly hintClose: string;
|
package/src/overlays/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type {
|
|
|
31
31
|
MagpieHandoverDialogViewProps,
|
|
32
32
|
} from "./MagpieHandoverDialogView";
|
|
33
33
|
export { MagpieHandoverDialogView } from "./MagpieHandoverDialogView";
|
|
34
|
+
export type { ReleaseNoteImageTarget } from "./ReleaseNoteMarkdown";
|
|
34
35
|
export type {
|
|
35
36
|
RouteErrorPageViewLabels,
|
|
36
37
|
RouteErrorPageViewProps,
|
package/src/plugin-ui/index.ts
CHANGED
|
@@ -32,5 +32,7 @@ export { fmtMultiplier, MultiplierTag } from "../shared/MultiplierTag";
|
|
|
32
32
|
export { getProviderIcon, PROVIDER_ICONS, ProviderIcon } from "../shared/provider-icon";
|
|
33
33
|
export type { SegmentedControlItem, SegmentedControlProps } from "../shared/SegmentedControl";
|
|
34
34
|
export { SegmentedControl } from "../shared/SegmentedControl";
|
|
35
|
+
export type { StageDialogContentProps } from "../shared/StageDialogContent";
|
|
36
|
+
export { StageDialogContent } from "../shared/StageDialogContent";
|
|
35
37
|
export type { VettaKbdProps, VettaKbdSize } from "../shared/VettaKbd";
|
|
36
38
|
export { VettaKbd } from "../shared/VettaKbd";
|
|
@@ -10,6 +10,8 @@ export interface DefaultConversationSectionViewLabels {
|
|
|
10
10
|
export interface DefaultConversationSectionViewProps {
|
|
11
11
|
className?: string;
|
|
12
12
|
filterSelect: ReactNode;
|
|
13
|
+
/** 标题行上额外的操作,排在「更多」之前。 */
|
|
14
|
+
headerActions?: ReactNode;
|
|
13
15
|
labels: DefaultConversationSectionViewLabels;
|
|
14
16
|
list: ReactNode;
|
|
15
17
|
onMoreClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -26,6 +28,7 @@ export interface DefaultConversationSectionViewProps {
|
|
|
26
28
|
export function DefaultConversationSectionView({
|
|
27
29
|
className,
|
|
28
30
|
filterSelect,
|
|
31
|
+
headerActions,
|
|
29
32
|
labels,
|
|
30
33
|
list,
|
|
31
34
|
onMoreClick,
|
|
@@ -43,6 +46,7 @@ export function DefaultConversationSectionView({
|
|
|
43
46
|
>
|
|
44
47
|
<div className="flex min-w-0 items-center gap-0.5">{filterSelect}</div>
|
|
45
48
|
<div className="flex items-center">
|
|
49
|
+
{headerActions}
|
|
46
50
|
<SidebarSectionActionButton
|
|
47
51
|
iconClassName="icon-[solar--menu-dots-bold]"
|
|
48
52
|
label={labels.more}
|
|
@@ -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}
|
|
@@ -15,6 +15,10 @@ export interface GeneralSettingsViewLabels {
|
|
|
15
15
|
readonly workspaceDescription: string;
|
|
16
16
|
readonly sandboxTitle: string;
|
|
17
17
|
readonly sandboxDescription: string;
|
|
18
|
+
readonly linkOpenTarget: string;
|
|
19
|
+
readonly linkOpenTargetDescription: string;
|
|
20
|
+
readonly linkOpenTargetBuiltin: string;
|
|
21
|
+
readonly linkOpenTargetSystem: string;
|
|
18
22
|
readonly debugMode: string;
|
|
19
23
|
readonly debugModeDescription: string;
|
|
20
24
|
readonly exportDiagnostics: string;
|
|
@@ -48,6 +52,9 @@ export interface GeneralSettingsViewProps {
|
|
|
48
52
|
readonly executionMode: string;
|
|
49
53
|
readonly onExecutionModeChange: (mode: string) => void;
|
|
50
54
|
readonly sandboxUnavailableReason: string | null;
|
|
55
|
+
/** 对话里网址链接的默认打开位置。 */
|
|
56
|
+
readonly linkOpenTarget: "builtin" | "system";
|
|
57
|
+
readonly onLinkOpenTargetChange: (target: "builtin" | "system") => void;
|
|
51
58
|
readonly notifications: Omit<NotificationSettingsViewProps, "section">;
|
|
52
59
|
readonly debugMode: boolean;
|
|
53
60
|
readonly onDebugChange: (checked: boolean) => void;
|
|
@@ -79,6 +86,8 @@ export function GeneralSettingsView({
|
|
|
79
86
|
executionMode,
|
|
80
87
|
onExecutionModeChange,
|
|
81
88
|
sandboxUnavailableReason,
|
|
89
|
+
linkOpenTarget,
|
|
90
|
+
onLinkOpenTargetChange,
|
|
82
91
|
notifications,
|
|
83
92
|
debugMode,
|
|
84
93
|
onDebugChange,
|
|
@@ -126,6 +135,16 @@ export function GeneralSettingsView({
|
|
|
126
135
|
]}
|
|
127
136
|
/>
|
|
128
137
|
</SettingRow>
|
|
138
|
+
<SettingRow title={labels.linkOpenTarget} description={labels.linkOpenTargetDescription} border={false}>
|
|
139
|
+
<MotionSelect
|
|
140
|
+
value={linkOpenTarget}
|
|
141
|
+
onValueChange={(value) => onLinkOpenTargetChange(value === "system" ? "system" : "builtin")}
|
|
142
|
+
options={[
|
|
143
|
+
{ value: "builtin", label: labels.linkOpenTargetBuiltin },
|
|
144
|
+
{ value: "system", label: labels.linkOpenTargetSystem },
|
|
145
|
+
]}
|
|
146
|
+
/>
|
|
147
|
+
</SettingRow>
|
|
129
148
|
</SettingSection>
|
|
130
149
|
|
|
131
150
|
<NotificationSettingsView {...notifications} section={sections.notifications} />
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
|
|
4
|
+
export interface StorageBarSegment {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly bytes: number;
|
|
7
|
+
/** 只用主题变量拼出来的颜色。 */
|
|
8
|
+
readonly color: string;
|
|
9
|
+
/** 用斜线纹理代替实色,表示这部分可以腾出来。 */
|
|
10
|
+
readonly hatched?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 斜线纹理:color 为线条色,底色由调用方决定。 */
|
|
14
|
+
export const hatch = (color: string): string =>
|
|
15
|
+
`repeating-linear-gradient(135deg, ${color} 0 2px, transparent 2px 7px)`;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 分段占用条:一段一类,宽度按体积分配。纯示意图,信息与键盘操作都在图例里。
|
|
19
|
+
* 清理后各段按比例回缩,右侧用浅底露出空出来的部分。
|
|
20
|
+
*/
|
|
21
|
+
export function StorageBar({
|
|
22
|
+
segments,
|
|
23
|
+
capacityBytes,
|
|
24
|
+
activeId,
|
|
25
|
+
onActiveChange,
|
|
26
|
+
}: {
|
|
27
|
+
readonly segments: readonly StorageBarSegment[];
|
|
28
|
+
/** 整条代表的体积;比各段之和大时,右侧露出空的部分。 */
|
|
29
|
+
readonly capacityBytes: number;
|
|
30
|
+
readonly activeId: string | null;
|
|
31
|
+
readonly onActiveChange: (id: string | null) => void;
|
|
32
|
+
}): JSX.Element {
|
|
33
|
+
const visible = capacityBytes > 0 ? segments.filter((segment) => segment.bytes > 0) : [];
|
|
34
|
+
const used = visible.reduce((sum, segment) => sum + segment.bytes, 0);
|
|
35
|
+
const free = visible.length === 0 ? 1 : Math.max(0, 1 - used / capacityBytes);
|
|
36
|
+
return (
|
|
37
|
+
<div aria-hidden="true" className="flex h-5 w-full" onMouseLeave={() => onActiveChange(null)}>
|
|
38
|
+
{visible.map((segment) => (
|
|
39
|
+
// 间隙算在段内,指针从一段移到另一段时不会落空。
|
|
40
|
+
<div
|
|
41
|
+
key={segment.id}
|
|
42
|
+
className="min-w-2.5 basis-0 pr-1 transition-[flex-grow] duration-500 ease-out last:pr-0 motion-reduce:transition-none"
|
|
43
|
+
style={{ flexGrow: (segment.bytes / capacityBytes) * 1000 }}
|
|
44
|
+
onMouseEnter={() => onActiveChange(segment.id)}
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
className={cn(
|
|
48
|
+
"h-full rounded-md transition-opacity duration-200",
|
|
49
|
+
activeId !== null && activeId !== segment.id && "opacity-35",
|
|
50
|
+
)}
|
|
51
|
+
style={
|
|
52
|
+
segment.hatched
|
|
53
|
+
? {
|
|
54
|
+
backgroundColor: `color-mix(in srgb, ${segment.color} 22%, transparent)`,
|
|
55
|
+
backgroundImage: hatch(segment.color),
|
|
56
|
+
}
|
|
57
|
+
: { backgroundColor: segment.color }
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
))}
|
|
62
|
+
{free > 0.001 && (
|
|
63
|
+
<div
|
|
64
|
+
className="basis-0 rounded-md bg-muted-foreground/12"
|
|
65
|
+
style={{ flexGrow: free * 1000 }}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|