@vetta-org/theme-ui 0.1.1 → 0.2.0
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 +740 -20
- package/src/action-approval/AppearanceActionPickerView.tsx +2 -78
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +2 -9
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +4 -1
- package/src/action-approval/GenericActionApprovalView.tsx +2 -9
- package/src/action-approval/ManageActionApprovalFrameView.tsx +4 -1
- package/src/action-approval/NavigationOpenApprovalView.tsx +2 -9
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +3 -1
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +3 -10
- package/src/action-approval/index.ts +0 -1
- package/src/activity/ActivityPanel.tsx +13 -10
- package/src/activity/ActivityPanelFrame.test.tsx +32 -0
- package/src/activity/ActivityPanelFrame.tsx +3 -2
- package/src/activity/BackgroundTasksTabPanelView.tsx +1 -1
- package/src/activity/BrowserPanelView.tsx +48 -49
- package/src/activity/CodePreview.tsx +15 -1
- package/src/activity/DebugTabPanelView.tsx +1 -1
- package/src/activity/MarkdownPreviewView.test.tsx +53 -0
- package/src/activity/MarkdownPreviewView.tsx +135 -62
- package/src/activity/PluginTabPickerView.tsx +5 -3
- package/src/activity/PortsTabPanelView.tsx +911 -0
- package/src/activity/ToolCallsSubTabView.tsx +1 -1
- package/src/activity/WorkflowTabPanelView.tsx +1 -1
- package/src/activity/index.ts +9 -0
- package/src/app/AppBackground.tsx +1 -1
- package/src/app/AppBootLoadingView.tsx +4 -2
- package/src/app-shell/DefaultWindowControls.tsx +1 -1
- package/src/app-shell/PageHeaderActionGroup.tsx +1 -1
- package/src/app-shell/PageHeaderContent.tsx +36 -7
- package/src/app-shell/PageHeaderFrame.tsx +15 -3
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +1 -1
- package/src/app-shell/PageHeaderTitle.tsx +1 -1
- package/src/app-shell/WindowControlButton.tsx +1 -1
- package/src/app-shell/header-crowding.test.ts +62 -0
- package/src/app-shell/header-crowding.tsx +137 -0
- package/src/appearance/BackgroundImageFrame.tsx +1 -1
- package/src/appearance/CenterSliceImageFrame.tsx +1 -1
- package/src/appearance/CornerImageFrame.tsx +1 -1
- package/src/appearance/HorizontalSliceImageFrame.tsx +1 -1
- package/src/appearance/NineSliceImageFrame.tsx +1 -1
- package/src/appearance/ThemeSurface.tsx +1 -1
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +2 -1
- package/src/batch-tasks/BatchTaskProjectActionsView.test.tsx +97 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +45 -35
- package/src/batch-tasks/batchTaskUi.tsx +0 -29
- package/src/bottom-panel/BottomPanelView.test.tsx +43 -0
- package/src/bottom-panel/BottomPanelView.tsx +222 -0
- package/src/bottom-panel/index.ts +26 -0
- package/src/chat/AgentAvatarView.tsx +1 -1
- package/src/chat/AnnotationViews.tsx +107 -0
- package/src/chat/AskUserQuestionView.tsx +18 -11
- package/src/chat/AssistantMessageView.tsx +48 -13
- package/src/chat/AtPanelView.test.tsx +61 -0
- package/src/chat/AtPanelView.tsx +63 -38
- package/src/chat/BashTerminalCard.tsx +1 -2
- package/src/chat/ChatHeaderActionsView.tsx +74 -18
- package/src/chat/CompactionStepView.test.tsx +34 -0
- package/src/chat/CompactionStepView.tsx +85 -0
- package/src/chat/ContextRingView.test.tsx +81 -0
- package/src/chat/ContextRingView.tsx +78 -62
- package/src/chat/ExecutionModeSelectorView.tsx +20 -5
- package/src/chat/HeaderActionBarView.tsx +806 -0
- package/src/chat/HeaderActionOverflowMenu.tsx +128 -0
- package/src/chat/InlineModelPicker.test.tsx +81 -0
- package/src/chat/InlineModelPicker.tsx +201 -0
- package/src/chat/InlineTokenChip.tsx +2 -68
- package/src/chat/InputBarBackground.tsx +1 -1
- package/src/chat/InputBarPlaceholder.tsx +26 -3
- package/src/chat/LiveThinkingView.tsx +51 -37
- package/src/chat/MessageBoundaryViews.tsx +21 -0
- package/src/chat/MessageFeedContext.tsx +13 -5
- package/src/chat/MessageFeedLayoutView.tsx +29 -3
- package/src/chat/MessageFeedView.test.tsx +81 -0
- package/src/chat/MessageFeedView.tsx +72 -152
- package/src/chat/MessageInputView.tsx +6 -2
- package/src/chat/MessageLayoutView.tsx +1 -1
- package/src/chat/MessageSelectionContextMenuView.tsx +4 -1
- package/src/chat/MessageTimelineView.tsx +1 -1
- package/src/chat/MessageView.tsx +1 -1
- package/src/chat/MessageVisualView.tsx +1 -1
- package/src/chat/ModelConfiguration.tsx +283 -0
- package/src/chat/ModelSelectorTrigger.tsx +63 -0
- package/src/chat/ModelSelectorView.tsx +1037 -223
- package/src/chat/NewSession.ts +1 -37
- package/src/chat/NewSessionPicker.tsx +3 -2
- package/src/chat/ProjectSelectorView.tsx +3 -2
- package/src/chat/ReasoningStepSlider.tsx +61 -0
- package/src/chat/RemoteSessionBadgeView.tsx +24 -0
- package/src/chat/SkillPromptAreaView.tsx +5 -19
- package/src/chat/TeamMemberReplyCardView.test.tsx +33 -0
- package/src/chat/TeamMemberReplyCardView.tsx +133 -0
- package/src/chat/TextBlockView.tsx +7 -770
- package/src/chat/TodoProgress.tsx +25 -53
- package/src/chat/TodoStatusBarView.tsx +14 -5
- package/src/chat/UserMessageView.tsx +113 -33
- package/src/chat/header-action-narrow.test.ts +21 -0
- package/src/chat/header-action-narrow.ts +38 -0
- package/src/chat/index.ts +33 -27
- package/src/chat/markdown-link.ts +7 -279
- package/src/chat/message-feed-fade.css +80 -0
- package/src/chat/message-feed-fade.test.tsx +75 -0
- package/src/chat/send-button.css +4 -22
- package/src/chat/streaming-reveal.test.ts +218 -0
- package/src/chat/streaming-reveal.ts +13 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +2 -1
- package/src/file-explorer/FileContextMenuView.tsx +44 -11
- package/src/file-explorer/FileExplorerSettingsView.tsx +97 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +1 -1
- package/src/file-explorer/FileTreeNodeView.tsx +59 -18
- package/src/file-explorer/FileTreeView.tsx +236 -129
- package/src/file-explorer/file-tree-dom.ts +23 -0
- package/src/file-explorer/file-tree-rows.test.ts +74 -0
- package/src/file-explorer/file-tree-rows.ts +168 -0
- package/src/file-explorer/index.ts +17 -0
- package/src/file-explorer/types.ts +3 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +24 -16
- package/src/file-preview/FilePreviewDialogView.tsx +2 -2
- package/src/file-preview/FilePreviewView.tsx +12 -2
- package/src/file-preview/ReadonlyCodeView.tsx +46 -0
- package/src/file-preview/TextFileEditorView.tsx +2 -1
- package/src/file-preview/syntax-tokens.css +1 -1
- package/src/image-assets.d.ts +4 -0
- package/src/index.ts +1 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +1 -1
- package/src/layout/AppFrame.tsx +3 -2
- package/src/layout/MainContentFrame.tsx +7 -2
- package/src/layout/ResizeHandle.tsx +68 -17
- package/src/layout/SidebarDock.tsx +75 -19
- package/src/layout/SidebarOverlay.tsx +1 -1
- package/src/layout/index.ts +1 -1
- package/src/layout/resize-handle-axis.test.ts +51 -0
- package/src/live-indicators.test.ts +43 -0
- package/src/markdown/CodeBlock.tsx +123 -0
- package/src/markdown/FileLinkBadge.tsx +77 -0
- package/src/markdown/InlineTokenChip.tsx +68 -0
- package/src/markdown/MarkdownContent.tsx +418 -0
- package/src/markdown/MarkdownImage.tsx +41 -0
- package/src/markdown/MathFormula.tsx +46 -0
- package/src/markdown/MermaidBlock.tsx +82 -0
- package/src/markdown/RichCodeBlock.tsx +127 -0
- package/src/markdown/SvgPreview.tsx +45 -0
- package/src/markdown/WebsiteIcon.tsx +94 -0
- package/src/markdown/builtin-renderers.tsx +43 -0
- package/src/markdown/definition.tsx +49 -0
- package/src/markdown/host.tsx +18 -0
- package/src/markdown/image-actions.ts +29 -0
- package/src/markdown/index.ts +12 -0
- package/src/markdown/inline-tokens.ts +187 -0
- package/src/markdown/markdown-link.ts +279 -0
- package/src/markdown/math-client.ts +116 -0
- package/src/markdown/math-render.ts +23 -0
- package/src/markdown/math-syntax.ts +80 -0
- package/src/markdown/math.worker.ts +16 -0
- package/src/markdown/nodes.ts +15 -0
- package/src/markdown/preview-policy.test.ts +31 -0
- package/src/markdown/preview-policy.ts +76 -0
- package/src/markdown/progressive-chunks.test.ts +43 -0
- package/src/markdown/progressive-chunks.ts +58 -0
- package/src/markdown/rich-labels.ts +55 -0
- package/src/markdown/rich-syntax.ts +93 -0
- package/src/markdown/stable-blocks.test.ts +90 -0
- package/src/markdown/stable-blocks.ts +124 -0
- package/src/markdown/streaming-reveal.ts +297 -0
- package/src/markdown/streaming.test.ts +57 -0
- package/src/markdown/streaming.ts +211 -0
- package/src/markdown/use-render-snapshot.ts +24 -0
- package/src/markdown/use-rich-visibility.ts +24 -0
- package/src/overlays/CommandMenuRow.tsx +77 -17
- package/src/overlays/CommandMenuView.tsx +163 -118
- package/src/overlays/ConfirmDialogView.tsx +25 -20
- package/src/overlays/DiagnosticsExportDialogView.tsx +236 -0
- package/src/overlays/MagpieHandoverDialogView.tsx +217 -0
- package/src/overlays/ReleaseNoteMarkdown.test.tsx +24 -0
- package/src/overlays/ReleaseNoteMarkdown.tsx +55 -0
- package/src/overlays/SplashOptionRow.tsx +46 -0
- package/src/overlays/SplashPanel.tsx +85 -0
- package/src/overlays/SplashParts.tsx +217 -0
- package/src/overlays/UpdateCheckerView.tsx +34 -18
- package/src/overlays/UpdateRestartDialogView.tsx +203 -53
- package/src/overlays/assets/diagnostics-banner.webp +0 -0
- package/src/overlays/command-menu-types.ts +15 -1
- package/src/overlays/command-menu.css +1 -20
- package/src/overlays/index.ts +26 -1
- package/src/plugin-ui/index.ts +10 -0
- package/src/project/ConversationTagDotsView.tsx +1 -1
- package/src/project/ConversationTagEditorDialogView.tsx +4 -1
- package/src/project/DefaultConversationSectionView.tsx +15 -24
- package/src/project/DefaultSessionListView.tsx +5 -31
- package/src/project/DefaultSessionRowView.tsx +114 -55
- package/src/project/ManageSessionsSplashView.tsx +439 -0
- package/src/project/NewProjectDialogView.tsx +3 -10
- package/src/project/ProjectContextMenuView.tsx +30 -139
- package/src/project/ProjectDetailPageView.test.tsx +140 -0
- package/src/project/ProjectDetailPageView.tsx +372 -165
- package/src/project/ProjectGroupView.tsx +1 -1
- package/src/project/ProjectRowView.tsx +29 -12
- package/src/project/ProjectSessionsView.tsx +25 -47
- package/src/project/QuickScrollOverlay.tsx +1 -1
- package/src/project/SessionContextMenuView.tsx +15 -7
- package/src/project/SessionRowMoreButton.tsx +50 -0
- package/src/project/SessionRowView.tsx +106 -63
- package/src/project/SessionTitleMarquee.tsx +54 -0
- package/src/project/SidebarProjectDisclosure.tsx +60 -0
- package/src/project/SidebarProjectsSectionView.tsx +6 -1
- package/src/project/index.ts +12 -0
- package/src/project/session-row-transition.ts +9 -0
- package/src/project/types.ts +4 -2
- package/src/project/useActiveSessionAutoScroll.ts +10 -4
- package/src/registry.ts +0 -2
- package/src/scheduler/AutomationDetailPaneView.tsx +68 -0
- package/src/scheduler/AutomationPageView.tsx +118 -121
- package/src/scheduler/ExecutionHistoryView.tsx +7 -5
- package/src/scheduler/TaskListView.tsx +52 -201
- package/src/scheduler/index.ts +7 -12
- package/src/settings/AppshotSettingsView.tsx +0 -1
- package/src/settings/ArchivedProjectsSettingsView.tsx +122 -1
- package/src/settings/BuiltinMcpSectionView.tsx +1 -1
- package/src/settings/EnvironmentGitRowView.tsx +156 -0
- package/src/settings/EnvironmentSettingsView.tsx +25 -3
- package/src/settings/GeneralSettingsView.tsx +18 -24
- package/src/settings/ImChannelGuideDialogView.tsx +2 -2
- package/src/settings/ImFeishuDialogView.tsx +1 -1
- package/src/settings/ImLegacyImportBannerView.tsx +1 -1
- package/src/settings/ImLogDrawerView.tsx +2 -1
- package/src/settings/JsonConfigInputView.tsx +171 -0
- package/src/settings/LauncherSettingsView.test.tsx +95 -0
- package/src/settings/LauncherSettingsView.tsx +273 -0
- package/src/settings/ModelsFetchedModelsDrawerView.tsx +292 -0
- package/src/settings/ModelsProvidersSectionView.tsx +26 -23
- package/src/settings/MotionSelect.tsx +9 -7
- package/src/settings/NotificationSettingsView.tsx +79 -0
- package/src/settings/PermissionsSettingsView.tsx +3 -7
- 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/PresetProviderModelsListView.tsx +141 -24
- package/src/settings/PresetProviderRowView.tsx +147 -185
- package/src/settings/ProxySettingsSectionView.tsx +182 -0
- package/src/settings/QrBindDialogView.tsx +1 -1
- package/src/settings/RemoteMcpSectionView.tsx +1 -1
- package/src/settings/SettingChrome.tsx +2 -2
- package/src/settings/SettingsAiAssistButtonView.tsx +9 -119
- package/src/settings/SettingsFormFields.tsx +4 -7
- package/src/settings/SettingsSidebarView.tsx +64 -3
- package/src/settings/ShortcutRecorderView.test.tsx +108 -0
- package/src/settings/ShortcutRecorderView.tsx +15 -9
- package/src/settings/ShortcutsSettingsView.tsx +1 -5
- package/src/settings/SpaceEditorDialogView.tsx +158 -0
- package/src/settings/SpacesSettingsView.tsx +150 -0
- package/src/settings/WebhookEndpointListView.tsx +4 -5
- package/src/settings/assets/space-editor-illustration.webp +0 -0
- package/src/settings/index.ts +59 -68
- package/src/shared/ActivityStatusDot.tsx +69 -0
- package/src/shared/AvatarStackView.tsx +13 -13
- package/src/shared/BotAvatar.tsx +11 -9
- package/src/shared/CodeBlockCopyButton.tsx +1 -1
- package/src/shared/ContextMenuView.tsx +4 -11
- package/src/shared/MarkdownTable.tsx +2 -2
- package/src/shared/SegmentedControl.test.tsx +68 -0
- package/src/shared/SegmentedControl.tsx +10 -2
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.outline.test.tsx +59 -0
- package/src/shared/TabBar.tsx +23 -18
- package/src/shared/VettaKbd.test.tsx +52 -0
- package/src/shared/VettaKbd.tsx +100 -0
- package/src/shared/connected-tab-outline.test.ts +2 -2
- package/src/shared/connected-tab-outline.ts +2 -1
- package/src/shared/index.ts +7 -0
- package/src/shared/kbd-keys.test.ts +61 -0
- package/src/shared/kbd-keys.ts +253 -0
- package/src/shared/platform.ts +9 -0
- package/src/shared/provider-icon/icons.ts +4 -2
- package/src/shared/provider-icon/index.tsx +1 -1
- package/src/shared/provider-icon/magpie.svg +1 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +33 -24
- package/src/sidebar/DefaultSidebar.tsx +3 -1
- package/src/sidebar/MessageCenterDialogView.tsx +3 -2
- package/src/sidebar/MessageCenterEmptyState.tsx +1 -1
- package/src/sidebar/MessageCenterTabs.tsx +1 -1
- package/src/sidebar/MessageCenterToolbarButton.tsx +1 -1
- package/src/sidebar/MessageCenterTriggerView.tsx +2 -2
- package/src/sidebar/ProjectsPanelEmptyState.tsx +26 -7
- package/src/sidebar/SessionStatusIcon.tsx +16 -1
- package/src/sidebar/SettingsMenuThemeSection.tsx +1 -1
- package/src/sidebar/SettingsMenuTriggerView.test.tsx +42 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +29 -50
- package/src/sidebar/ShowMoreSessionsButton.tsx +1 -1
- package/src/sidebar/SidebarFilterSelectView.tsx +8 -16
- package/src/sidebar/SidebarNavBadgeView.tsx +1 -1
- package/src/sidebar/SidebarNavIcon.tsx +1 -1
- package/src/sidebar/SidebarNavItemButton.tsx +1 -1
- package/src/sidebar/SidebarNavMorePanel.tsx +19 -7
- package/src/sidebar/SidebarNavigation.tsx +24 -15
- package/src/sidebar/SidebarPanel.tsx +11 -2
- package/src/sidebar/SidebarSectionActionButton.test.tsx +91 -0
- package/src/sidebar/SidebarSectionActionButton.tsx +52 -0
- package/src/sidebar/SidebarSectionTriggerLabel.tsx +20 -0
- package/src/sidebar/SidebarTopBar.tsx +10 -7
- package/src/sidebar/WaitingPulseBadge.tsx +19 -0
- package/src/sidebar/index.ts +1 -16
- package/src/skills/index.ts +0 -19
- package/src/skills/skill-icon.tsx +4 -8
- package/src/styles.css +26 -6
- package/src/chat/DefaultSceneCarousel.tsx +0 -113
- package/src/chat/SceneCard.tsx +0 -138
- package/src/scheduler/HistoryDrawerView.tsx +0 -149
- package/src/scheduler/TaskFormDialogView.tsx +0 -60
- package/src/settings/AchievementNavigationButtonView.tsx +0 -90
- package/src/settings/AchievementPromotionDialogView.tsx +0 -91
- package/src/settings/AchievementSettingsView.tsx +0 -44
- package/src/settings/PetBubbleStylePreviewView.tsx +0 -44
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -66
- package/src/settings/SubscriptionActionsView.tsx +0 -63
- package/src/settings/SubscriptionCardsView.tsx +0 -212
- package/src/settings/TeamDetailView.tsx +0 -148
- package/src/settings/TeamDialogsView.tsx +0 -151
- package/src/settings/TeamListView.tsx +0 -57
- package/src/settings/TeamSettingsView.tsx +0 -51
- package/src/settings/TokenActivityChartView.tsx +0 -286
- package/src/settings/UsageStatsView.tsx +0 -101
- 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
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +0 -135
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +0 -40
- package/src/settings/token-activity.test.ts +0 -195
- package/src/settings/token-activity.ts +0 -320
- package/src/sidebar/AddProjectMenuItem.tsx +0 -21
- package/src/sidebar/AddProjectMenuPopoverView.tsx +0 -52
- package/src/sidebar/NotificationMessageListView.tsx +0 -136
- package/src/sidebar/SettingsMenuAccountSection.tsx +0 -32
- package/src/sidebar/SettingsMenuQuotaSection.tsx +0 -45
- package/src/skills/SceneCardView.tsx +0 -194
- package/src/skills/SkillCardView.tsx +0 -186
- package/src/skills/SkillDetailDialogView.tsx +0 -138
- package/src/skills/SkillTagGroupView.tsx +0 -56
- package/src/skills/SkillToggleSwitch.tsx +0 -31
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VettaKbd 的键位解析:把快捷键串或键位 token 解析成各平台的显示文案。
|
|
3
|
+
*
|
|
4
|
+
* 约定:
|
|
5
|
+
* - 快捷键串用 "+" 连接("mod+shift+k"),token 大小写不敏感,多单词写法按去空格匹配
|
|
6
|
+
* ("CmdOrCtrl" / "page up")。
|
|
7
|
+
* - "mod" 是平台主修饰键:mac 显示 ⌘,windows/linux 显示 Ctrl;"ctrl" 始终指物理 Control 键,
|
|
8
|
+
* 因此 mac 上显示 ⌃、windows 上显示 Ctrl。需要完全分系统时,把该项写成
|
|
9
|
+
* { mac: "⌃", windows: "Ctrl" } 这类对象。
|
|
10
|
+
* - mac 的修饰键与功能键按硬件印字显示符号(⌘ ⌥ ⌃ ⇧ ⏎ ⎋ ⌫ …),windows/linux 显示单词。
|
|
11
|
+
* 键盘印字不随界面语言翻译,故这里不接 i18n。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type VettaKbdPlatform = "mac" | "windows" | "linux";
|
|
15
|
+
|
|
16
|
+
/** 单项键位:token 字符串按平台解析;对象按平台直接给出文案。 */
|
|
17
|
+
export type VettaKbdKey = string | Partial<Record<VettaKbdPlatform, string>>;
|
|
18
|
+
|
|
19
|
+
type LabelTable = Record<string, string>;
|
|
20
|
+
|
|
21
|
+
const ARROW_LABELS: LabelTable = {
|
|
22
|
+
up: "↑",
|
|
23
|
+
arrowup: "↑",
|
|
24
|
+
down: "↓",
|
|
25
|
+
arrowdown: "↓",
|
|
26
|
+
left: "←",
|
|
27
|
+
arrowleft: "←",
|
|
28
|
+
right: "→",
|
|
29
|
+
arrowright: "→",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const MOD_ALIASES = ["mod", "cmdorctrl", "cmdorcontrol", "commandorcontrol", "controlormeta"];
|
|
33
|
+
|
|
34
|
+
function withMod(table: LabelTable, modLabel: string): LabelTable {
|
|
35
|
+
const out: LabelTable = { ...table };
|
|
36
|
+
for (const alias of MOD_ALIASES) out[alias] = modLabel;
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const MAC_LABELS: LabelTable = withMod(
|
|
41
|
+
{
|
|
42
|
+
...ARROW_LABELS,
|
|
43
|
+
cmd: "⌘",
|
|
44
|
+
command: "⌘",
|
|
45
|
+
meta: "⌘",
|
|
46
|
+
win: "⌘",
|
|
47
|
+
ctrl: "⌃",
|
|
48
|
+
control: "⌃",
|
|
49
|
+
alt: "⌥",
|
|
50
|
+
option: "⌥",
|
|
51
|
+
opt: "⌥",
|
|
52
|
+
shift: "⇧",
|
|
53
|
+
enter: "⏎",
|
|
54
|
+
return: "⏎",
|
|
55
|
+
backspace: "⌫",
|
|
56
|
+
delete: "⌦",
|
|
57
|
+
del: "⌦",
|
|
58
|
+
esc: "⎋",
|
|
59
|
+
escape: "⎋",
|
|
60
|
+
tab: "⇥",
|
|
61
|
+
capslock: "⇪",
|
|
62
|
+
caps: "⇪",
|
|
63
|
+
space: "Space",
|
|
64
|
+
spacebar: "Space",
|
|
65
|
+
home: "↖",
|
|
66
|
+
end: "↘",
|
|
67
|
+
pageup: "⇞",
|
|
68
|
+
pagedown: "⇟",
|
|
69
|
+
fn: "fn",
|
|
70
|
+
plus: "+",
|
|
71
|
+
minus: "-",
|
|
72
|
+
},
|
|
73
|
+
"⌘",
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const WINDOWS_LABELS: LabelTable = withMod(
|
|
77
|
+
{
|
|
78
|
+
...ARROW_LABELS,
|
|
79
|
+
cmd: "Win",
|
|
80
|
+
command: "Win",
|
|
81
|
+
meta: "Win",
|
|
82
|
+
win: "Win",
|
|
83
|
+
ctrl: "Ctrl",
|
|
84
|
+
control: "Ctrl",
|
|
85
|
+
alt: "Alt",
|
|
86
|
+
option: "Alt",
|
|
87
|
+
opt: "Alt",
|
|
88
|
+
shift: "Shift",
|
|
89
|
+
enter: "Enter",
|
|
90
|
+
return: "Enter",
|
|
91
|
+
backspace: "Backspace",
|
|
92
|
+
delete: "Del",
|
|
93
|
+
del: "Del",
|
|
94
|
+
esc: "Esc",
|
|
95
|
+
escape: "Esc",
|
|
96
|
+
tab: "Tab",
|
|
97
|
+
capslock: "Caps",
|
|
98
|
+
caps: "Caps",
|
|
99
|
+
space: "Space",
|
|
100
|
+
spacebar: "Space",
|
|
101
|
+
home: "Home",
|
|
102
|
+
end: "End",
|
|
103
|
+
pageup: "PgUp",
|
|
104
|
+
pagedown: "PgDn",
|
|
105
|
+
fn: "Fn",
|
|
106
|
+
plus: "+",
|
|
107
|
+
minus: "-",
|
|
108
|
+
},
|
|
109
|
+
"Ctrl",
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const LINUX_LABELS: LabelTable = {
|
|
113
|
+
...WINDOWS_LABELS,
|
|
114
|
+
cmd: "Super",
|
|
115
|
+
command: "Super",
|
|
116
|
+
meta: "Super",
|
|
117
|
+
win: "Super",
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const KEY_LABELS: Record<VettaKbdPlatform, LabelTable> = {
|
|
121
|
+
mac: MAC_LABELS,
|
|
122
|
+
windows: WINDOWS_LABELS,
|
|
123
|
+
linux: LINUX_LABELS,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const SPOKEN_MAC: LabelTable = {
|
|
127
|
+
...ARROW_LABELS,
|
|
128
|
+
up: "Up Arrow",
|
|
129
|
+
arrowup: "Up Arrow",
|
|
130
|
+
down: "Down Arrow",
|
|
131
|
+
arrowdown: "Down Arrow",
|
|
132
|
+
left: "Left Arrow",
|
|
133
|
+
arrowleft: "Left Arrow",
|
|
134
|
+
right: "Right Arrow",
|
|
135
|
+
arrowright: "Right Arrow",
|
|
136
|
+
cmd: "Command",
|
|
137
|
+
command: "Command",
|
|
138
|
+
meta: "Command",
|
|
139
|
+
win: "Command",
|
|
140
|
+
ctrl: "Control",
|
|
141
|
+
control: "Control",
|
|
142
|
+
alt: "Option",
|
|
143
|
+
option: "Option",
|
|
144
|
+
opt: "Option",
|
|
145
|
+
shift: "Shift",
|
|
146
|
+
enter: "Return",
|
|
147
|
+
return: "Return",
|
|
148
|
+
backspace: "Delete",
|
|
149
|
+
delete: "Forward Delete",
|
|
150
|
+
del: "Forward Delete",
|
|
151
|
+
esc: "Escape",
|
|
152
|
+
escape: "Escape",
|
|
153
|
+
tab: "Tab",
|
|
154
|
+
capslock: "Caps Lock",
|
|
155
|
+
caps: "Caps Lock",
|
|
156
|
+
space: "Space",
|
|
157
|
+
spacebar: "Space",
|
|
158
|
+
home: "Home",
|
|
159
|
+
end: "End",
|
|
160
|
+
pageup: "Page Up",
|
|
161
|
+
pagedown: "Page Down",
|
|
162
|
+
fn: "Fn",
|
|
163
|
+
plus: "Plus",
|
|
164
|
+
minus: "Minus",
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const SPOKEN_WINDOWS: LabelTable = {
|
|
168
|
+
...SPOKEN_MAC,
|
|
169
|
+
up: "Up Arrow",
|
|
170
|
+
cmd: "Windows",
|
|
171
|
+
command: "Windows",
|
|
172
|
+
meta: "Windows",
|
|
173
|
+
win: "Windows",
|
|
174
|
+
alt: "Alt",
|
|
175
|
+
option: "Alt",
|
|
176
|
+
opt: "Alt",
|
|
177
|
+
backspace: "Backspace",
|
|
178
|
+
delete: "Delete",
|
|
179
|
+
del: "Delete",
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const SPOKEN_LABELS: Record<VettaKbdPlatform, LabelTable> = {
|
|
183
|
+
mac: withMod(SPOKEN_MAC, "Command"),
|
|
184
|
+
windows: withMod(SPOKEN_WINDOWS, "Control"),
|
|
185
|
+
linux: withMod({ ...SPOKEN_WINDOWS, cmd: "Super", command: "Super", meta: "Super", win: "Super" }, "Control"),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/** 当前窗口所在平台;只在宿主确实拿不到平台信息时回落到 windows。 */
|
|
189
|
+
export function detectKbdPlatform(): VettaKbdPlatform {
|
|
190
|
+
if (typeof navigator === "undefined") return "windows";
|
|
191
|
+
const platform = navigator.platform?.toUpperCase() ?? "";
|
|
192
|
+
if (platform.includes("MAC")) return "mac";
|
|
193
|
+
if (platform.includes("WIN")) return "windows";
|
|
194
|
+
if (platform.includes("LINUX")) return "linux";
|
|
195
|
+
const ua = navigator.userAgent ?? "";
|
|
196
|
+
if (/Mac OS X|Macintosh/.test(ua)) return "mac";
|
|
197
|
+
if (/Windows/.test(ua)) return "windows";
|
|
198
|
+
return "linux";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function normalizeToken(token: string): string {
|
|
202
|
+
return token.trim().toLowerCase().replace(/\s+/g, "");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** 把快捷键串拆成键位;数组输入原样返回(保留分系统对象)。 */
|
|
206
|
+
export function splitKbdKeys(keys: string | readonly VettaKbdKey[]): VettaKbdKey[] {
|
|
207
|
+
if (typeof keys !== "string") return [...keys];
|
|
208
|
+
const trimmed = keys.trim();
|
|
209
|
+
if (!trimmed) return [];
|
|
210
|
+
return trimmed
|
|
211
|
+
.split("+")
|
|
212
|
+
.map((part) => part.trim())
|
|
213
|
+
.filter((part) => part.length > 0);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** 解析单个键位的显示文案。未知 token 原样返回,避免静默吞掉按键。 */
|
|
217
|
+
export function resolveKbdKey(key: VettaKbdKey, platform: VettaKbdPlatform = detectKbdPlatform()): string {
|
|
218
|
+
if (typeof key !== "string") {
|
|
219
|
+
return key[platform] ?? key.windows ?? key.mac ?? key.linux ?? "";
|
|
220
|
+
}
|
|
221
|
+
const token = normalizeToken(key);
|
|
222
|
+
if (!token) return "";
|
|
223
|
+
const label = KEY_LABELS[platform][token];
|
|
224
|
+
if (label !== undefined) return label;
|
|
225
|
+
if (/^f([1-9]|1[0-2])$/.test(token)) return token.toUpperCase();
|
|
226
|
+
if (token.length === 1) return token.toUpperCase();
|
|
227
|
+
return key.trim();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** 解析整串快捷键的显示文案(逐键)。 */
|
|
231
|
+
export function resolveKbdKeys(
|
|
232
|
+
keys: string | readonly VettaKbdKey[],
|
|
233
|
+
platform: VettaKbdPlatform = detectKbdPlatform(),
|
|
234
|
+
): string[] {
|
|
235
|
+
return splitKbdKeys(keys).map((key) => resolveKbdKey(key, platform));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** 逐键的读屏文案(键帽符号本身读不出含义)。 */
|
|
239
|
+
export function describeKbdKeys(
|
|
240
|
+
keys: string | readonly VettaKbdKey[],
|
|
241
|
+
platform: VettaKbdPlatform = detectKbdPlatform(),
|
|
242
|
+
): string {
|
|
243
|
+
const spoken = splitKbdKeys(keys).map((key) => {
|
|
244
|
+
if (typeof key !== "string") return resolveKbdKey(key, platform);
|
|
245
|
+
const token = normalizeToken(key);
|
|
246
|
+
const label = SPOKEN_LABELS[platform][token];
|
|
247
|
+
if (label !== undefined) return label;
|
|
248
|
+
if (/^f([1-9]|1[0-2])$/.test(token)) return token.toUpperCase();
|
|
249
|
+
if (token.length === 1) return token.toUpperCase();
|
|
250
|
+
return key.trim();
|
|
251
|
+
});
|
|
252
|
+
return spoken.filter((part) => part.length > 0).join(" ");
|
|
253
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ButtonGroupVariant } from "@vetta-org/ui/button-group";
|
|
2
|
+
import { detectKbdPlatform } from "./kbd-keys";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 侧边栏底部与标题栏右侧这两处常驻按钮组的外观。
|
|
6
|
+
* Windows 的窗口 chrome 由 DWM 平涂,常驻的胶囊底贴在纯色墙面上会显得像一块贴片,
|
|
7
|
+
* 所以那里用幽灵按钮组,只有悬停 / 选中项有底色;其余平台维持玻璃(openvetta/open-vetta#88)。
|
|
8
|
+
*/
|
|
9
|
+
export const chromeButtonGroupVariant: ButtonGroupVariant = detectKbdPlatform() === "windows" ? "ghost" : "glass";
|
|
@@ -2,7 +2,7 @@ import claudeIcon from "@lobehub/icons-static-svg/icons/claude-color.svg?url";
|
|
|
2
2
|
import deepseekIcon from "@lobehub/icons-static-svg/icons/deepseek-color.svg?url";
|
|
3
3
|
import geminiIcon from "@lobehub/icons-static-svg/icons/gemini-color.svg?url";
|
|
4
4
|
import grokIcon from "@lobehub/icons-static-svg/icons/grok.svg?url";
|
|
5
|
-
import kimiIcon from "@lobehub/icons-static-svg/icons/kimi
|
|
5
|
+
import kimiIcon from "@lobehub/icons-static-svg/icons/kimi.svg?url";
|
|
6
6
|
import minimaxIcon from "@lobehub/icons-static-svg/icons/minimax-color.svg?url";
|
|
7
7
|
import nvidiaIcon from "@lobehub/icons-static-svg/icons/nvidia-color.svg?url";
|
|
8
8
|
import ollamaIcon from "@lobehub/icons-static-svg/icons/ollama.svg?url";
|
|
@@ -12,6 +12,7 @@ import qwenIcon from "@lobehub/icons-static-svg/icons/qwen-color.svg?url";
|
|
|
12
12
|
import xiaomiMimoIcon from "@lobehub/icons-static-svg/icons/xiaomimimo.svg?url";
|
|
13
13
|
import zaiIcon from "@lobehub/icons-static-svg/icons/zai.svg?url";
|
|
14
14
|
import zhipuIcon from "@lobehub/icons-static-svg/icons/zhipu-color.svg?url";
|
|
15
|
+
import magpieIcon from "./magpie.svg?url";
|
|
15
16
|
|
|
16
17
|
type ProviderIconAppearance = "color" | "monochrome";
|
|
17
18
|
|
|
@@ -27,7 +28,8 @@ const PROVIDER_ICON_ASSETS = {
|
|
|
27
28
|
deepseek: { src: deepseekIcon, appearance: "color" },
|
|
28
29
|
grok: { src: grokIcon, appearance: "monochrome" },
|
|
29
30
|
qwen: { src: qwenIcon, appearance: "color" },
|
|
30
|
-
kimi: { src: kimiIcon, appearance: "
|
|
31
|
+
kimi: { src: kimiIcon, appearance: "monochrome" },
|
|
32
|
+
magpie: { src: magpieIcon, appearance: "monochrome" },
|
|
31
33
|
minimax: { src: minimaxIcon, appearance: "color" },
|
|
32
34
|
nvidia: { src: nvidiaIcon, appearance: "color" },
|
|
33
35
|
ollama: { src: ollamaIcon, appearance: "monochrome" },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" fill="#000"><path fill-rule="evenodd" d="M1.5 5.5C1.3 5.7 1.2 6.5 1.2 6.9C1.2 6.9 1.2 7 1.2 7.1C1.1 7.4 1.3 8 1.4 8.3C1.4 8.4 1.5 8.5 1.5 8.7C1.5 8.9 1.7 9 1.8 9.3C2.2 9.9 2.2 10 2.3 10.1C2.4 10.2 2.5 10.3 2.6 10.5C2.8 10.8 3 11.1 3.2 11.3C3.3 11.3 3.4 11.6 3.6 11.8C3.8 12 4.1 12.4 4.2 12.5C4.7 13 5.2 13.7 5.4 13.9C6 14.5 6.5 15.1 6.7 15.3C6.7 15.4 6.9 15.5 6.9 15.7C7.3 15.9 7.7 16.5 7.9 16.8C7.9 16.8 8 16.9 8 16.9C8.1 16.9 8.2 17.2 8.2 17.3C8.2 17.3 8.1 17.2 8.1 17.1C7.9 16.9 7.9 16.9 7.6 16.6C7.5 16.5 7.4 16.5 7.4 16.3C7.2 16.2 6.7 15.7 6.3 15.2C6.1 15.1 6 14.9 6 14.9C5.9 14.8 5.7 14.7 5.7 14.6C5.6 14.5 5.4 14.3 5.3 14.2C5.1 14.1 4.9 13.8 4.7 13.5C4.5 13.3 4.2 13.1 4.1 12.9C4.1 12.9 3.8 12.7 3.8 12.5C3.5 12.3 3 11.8 2.8 11.4C1.8 10.5 0.9 9.6 0.7 9.6C0.6 9.7 0.6 9.8 0.5 10C0.5 10.1 0.6 10.2 0.5 10.3C0.5 10.4 0.6 10.5 0.6 10.6C0.5 10.7 0.5 10.9 0.6 11C0.5 11.1 0.6 11.4 0.6 11.5C0.9 12.9 1.3 13.8 2.8 14.9C2.9 15.1 3.3 15.3 3.4 15.4C3.4 15.5 3.6 15.6 3.7 15.7C4.2 16 6.4 17.8 7 18.4C7.4 18.8 7.4 18.8 7.5 18.9C7.6 19 7.7 19 7.7 19.1C7.7 19.2 7.8 19.2 7.9 19.2C7.9 19.3 8.1 19.4 8.1 19.5C8.2 19.6 8.2 19.7 8.3 19.7C8.3 19.7 8.3 19.7 8.2 19.7C8.2 19.6 8.1 19.6 8 19.6C7.9 19.5 7.9 19.4 7.8 19.4C7.7 19.3 7.6 19.2 7.6 19.2C7.6 19.1 7.5 19 7.3 18.9C7.2 18.9 6.9 18.6 6.7 18.4C6.1 17.8 4.5 16.6 3.5 16C3.4 15.8 3 15.6 2.9 15.5C2.6 15.3 1.5 14.6 0.9 14.3C0.7 14.1 0.6 14.1 0.6 14.2C0.5 14.5 0.8 15.9 0.9 16.1C0.9 16.2 1 16.2 0.9 16.3C1.2 16.8 1.9 17.6 2.7 18.3C2.8 18.5 4 19.2 4.7 19.5C6.2 20.5 6.6 20.7 7.4 21.5C8.2 22.2 8.7 22.7 9.3 23.6C9.5 24.1 9.9 24.4 10.3 25.3C10.4 25.5 10.5 25.8 10.5 25.8C10.7 25.8 10.8 25.7 11 25.4C11.6 25 11.9 24.6 12.3 24.3C12.8 24 13 23.8 13 23.7C13.1 23.7 13.1 23.8 13 24C12 24.8 11 26 10.2 26.9C10.1 27.1 9.9 27.5 9.7 27.7C9.5 27.8 9.4 28 9.4 28C9.4 28 9.3 28.3 9.1 28.5C8.6 29.2 7.7 30.8 7.7 30.9C7.7 31 7.8 31 8.3 30.8C9 30.4 9.5 30.2 10.4 30C11.7 29.6 12.5 29.6 11.6 30C10.5 30.2 9.7 30.6 9.2 31.2C8.8 31.7 8.8 31.7 9.3 31.7C10.1 31.8 10.9 31.9 11.6 32.2C12.8 32.7 13.5 33.1 15.5 34.8C16.4 35.5 17.3 36.2 17.8 36.4C17.9 36.5 18.1 36.7 18.2 36.8C19.1 37.3 21.2 38.1 22.3 38.3C22.4 38.3 22.7 38.3 22.8 38.3C22.8 38.5 23 38.5 23 38.5C23.1 38.5 23.2 38.5 23.3 38.5C23.6 38.6 25.9 38.6 26.1 38.5C26.2 38.5 26.3 38.5 26.4 38.5C26.5 38.5 26.6 38.5 26.7 38.3C26.7 38.3 27 38.3 27.1 38.3C28.3 38.1 30.2 37.3 31.4 36.7C31.5 36.7 31.7 36.4 31.8 36.4C32.2 36.2 33.2 35.4 33.4 35.2C34.2 34.5 35.5 33 35.8 32.6C35.8 32.5 36 32.2 36.1 32C36.4 31.8 36.6 31.4 36.6 31.2C36.7 31.1 36.8 30.9 36.9 30.8C37.2 30.4 37.5 29.6 37.7 29.2C37.7 29.1 37.8 28.7 37.9 28.7C38.1 28.5 38.4 27.1 38.5 26.8C39 25.2 39.1 23.7 39 22.4C39 22.2 38.9 21.9 38.9 21.8C38.9 21.7 38.9 21.6 38.9 21.4C38.6 20.5 38.5 19.9 38.2 19C37.9 18.5 37.5 17.5 37.3 17.2C37 16.8 36.8 15.8 36.8 15.2C36.8 13.8 37.7 12.7 39.6 12.2C40.1 12.1 41.3 11.8 42.1 11.7C43.5 11.5 43.5 11.5 43.4 11.3C42.9 10.7 40.9 9.9 39.2 9.7C37.9 9.5 38.1 9.5 37.6 9C37 8.6 36.4 8 36 7.9C36 7.8 35.8 7.8 35.7 7.7C35.1 7.3 34.2 7 33.1 6.9C32.6 6.7 31.6 6.9 31 7C29.6 7.3 28.3 8 27.3 9.2C26.7 9.8 26.2 10.8 25.7 11.7C25.5 12.1 24.8 13.4 24.7 13.7C24.6 13.9 24.5 14.1 24.1 14.7C23.5 15.7 22.1 16.9 20.6 17.8C20.5 18 20.3 18.2 20.1 18.3C19.7 18.5 19.4 18.8 19.1 19C18.9 19.1 18.7 19.3 18.5 19.4C18 19.8 17.2 20.3 17 20.5C16.9 20.5 16.8 20.6 16.7 20.7C16.3 20.8 16.1 20.9 16 20.9C15.5 20.8 14.9 20.5 14.2 20.2C13.7 19.8 12.7 18.9 12.4 18.6C12.3 18.5 12.2 18.4 12.1 18.2C11.9 18 11.2 17.1 11 16.6C10.9 16.5 10.8 16.4 10.7 16.3C10.7 16.2 10.6 16.1 10.6 15.9C10.5 15.9 10.4 15.7 10.4 15.6C10.3 15.5 10.2 15.2 10.1 15C10 14.8 9.8 14.4 9.7 14.2C9.6 14 9.5 13.7 9.4 13.6C9.4 13.4 9.3 13.2 9.2 13C9.2 12.8 9 12.6 9 12.5C8.9 12.3 8.7 12.1 8.7 12C8.7 12 8.5 11.7 8.5 11.7C8.3 11.2 8.2 10.9 7.5 10C6.4 8.3 4.2 6.4 2.7 5.8C2 5.5 1.6 5.4 1.5 5.5ZM28.4 16.7C29.2 16.9 29.7 17.2 29.9 17.7C30.1 18.2 30 18.9 29.6 19.4C29.2 19.9 28.2 20.9 27.6 21.2C26.8 21.7 25.3 22.4 24.2 22.7C23.9 22.8 23.6 22.9 23.5 22.9C22.8 23.2 20.7 23.7 19.6 24C19 24.2 18.4 24.3 18.1 24.4C17.9 24.4 16.1 24.9 15.3 25.1C14.6 25.2 14.7 25.1 15.7 23.6C16.4 22.7 18.5 20.6 19.4 19.9C20.8 18.8 21.4 18.4 23.2 17.6C23.8 17.4 25.6 16.8 25.9 16.8C25.9 16.8 26.3 16.8 26.6 16.7C26.8 16.7 28.2 16.7 28.4 16.7ZM30.4 20.2C30.5 20.3 30.6 20.6 30.6 20.7C31.7 23.1 33.4 24.6 35.6 25.3C36.1 25.5 36.7 25.7 37.2 25.8C37.7 25.8 37.8 25.9 37.8 26.1C37.7 26.2 37.7 26.3 37.7 26.5C37.7 26.6 37.7 26.8 37.6 27C37.4 28.5 36.8 29.9 36.1 31C36.1 31.2 35.9 31.4 35.9 31.6C35.7 31.9 35.2 32.6 34.7 33.3C32.6 35.6 29.7 37.3 26.6 37.8C26.5 37.8 26.3 37.9 26.2 37.9C25.8 37.9 23.7 37.9 23.3 37.9C23.2 37.9 23 37.8 22.9 37.8C21.1 37.6 19.3 36.8 18 35.7C17.7 35.4 17 34.7 16.8 34.5C16.3 33.8 16.1 33 16.3 32.5C16.5 31.8 16.8 31.6 17.9 31.1C19.1 30.5 19.4 30.4 20.2 30C21.4 29.4 23.2 28.4 23.9 27.9C23.9 27.8 24.2 27.7 24.5 27.6C26.3 26.3 28 24.6 28.9 22.9C29.5 22.2 29.7 21.6 29.9 20.7C30.1 20 30.2 19.9 30.4 20.2Z"/></svg>
|
|
@@ -1,50 +1,59 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button } from "@vetta-org/ui/button";
|
|
2
|
+
import { forwardRef, type ComponentPropsWithoutRef, type JSX } from "react";
|
|
3
|
+
import { SidebarSectionActionButton } from "./SidebarSectionActionButton";
|
|
2
4
|
|
|
3
5
|
function cn(...parts: Array<string | false | null | undefined>): string {
|
|
4
6
|
return parts.filter(Boolean).join(" ");
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
export interface AddProjectMenuTriggerViewProps {
|
|
9
|
+
export interface AddProjectMenuTriggerViewProps extends ComponentPropsWithoutRef<"button"> {
|
|
8
10
|
label: string;
|
|
9
|
-
onClick: () => void;
|
|
10
11
|
open: boolean;
|
|
11
|
-
variant: "icon" | "navItem";
|
|
12
|
+
variant: "icon" | "navItem" | "primary" | "secondary";
|
|
13
|
+
/** 仅 `icon` 变体生效:还没有项目时常驻引导,有项目后改为悬停标题行才出现。 */
|
|
14
|
+
reveal?: "hover" | "always";
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// 作为 PopoverTrigger asChild 的子节点:需要转发 ref 并透传 Radix 注入的属性。
|
|
18
|
+
export const AddProjectMenuTriggerView = forwardRef<HTMLButtonElement, AddProjectMenuTriggerViewProps>(
|
|
19
|
+
function AddProjectMenuTriggerView({ label, open, reveal = "hover", variant, ...props }, ref): JSX.Element {
|
|
20
|
+
if (variant === "secondary") {
|
|
21
|
+
return (
|
|
22
|
+
<Button variant="secondary" size="lg" className="no-drag w-full text-[13px]" ref={ref}
|
|
23
|
+
{...props}>
|
|
24
|
+
<span className="icon-[solar--add-folder-linear] h-4 w-4 shrink-0" />
|
|
25
|
+
{label}
|
|
26
|
+
</Button>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
if (variant === "navItem") {
|
|
21
31
|
return (
|
|
22
32
|
<button
|
|
23
33
|
type="button"
|
|
24
34
|
title={label}
|
|
25
|
-
|
|
35
|
+
ref={ref}
|
|
36
|
+
{...props}
|
|
26
37
|
className={cn(
|
|
27
38
|
"no-drag flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-[13px] transition-colors",
|
|
28
39
|
open ? "bg-accent text-foreground" : "text-foreground hover:bg-accent",
|
|
29
40
|
)}
|
|
30
41
|
>
|
|
31
|
-
<span className="icon-[solar--add-
|
|
42
|
+
<span className="icon-[solar--add-linear] h-4 w-4 shrink-0" />
|
|
32
43
|
{label}
|
|
33
44
|
</button>
|
|
34
45
|
);
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
>
|
|
47
|
-
<span className="icon-[solar--add-square-outline] h-4 w-4" />
|
|
48
|
-
</button>
|
|
49
|
+
<SidebarSectionActionButton
|
|
50
|
+
ref={ref}
|
|
51
|
+
{...props}
|
|
52
|
+
expanded={open}
|
|
53
|
+
iconClassName="icon-[solar--add-linear]"
|
|
54
|
+
label={label}
|
|
55
|
+
reveal={reveal}
|
|
56
|
+
/>
|
|
49
57
|
);
|
|
50
|
-
}
|
|
58
|
+
},
|
|
59
|
+
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSX, ReactNode } from "react";
|
|
2
2
|
import { useThemeComponent } from "@vetta-org/theme-sdk";
|
|
3
3
|
import type { SidebarClassNames, SidebarModel } from "@vetta-org/theme-sdk/sidebar";
|
|
4
|
-
import { cn } from "@vetta-org/ui";
|
|
4
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
5
5
|
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
6
6
|
import { SidebarNavigation } from "./SidebarNavigation";
|
|
7
7
|
import type { SidebarNavMorePanelLabels } from "./SidebarNavMorePanel";
|
|
@@ -35,6 +35,7 @@ export function DefaultSidebar({
|
|
|
35
35
|
<SidebarPanel
|
|
36
36
|
className={classNames?.panel}
|
|
37
37
|
contentClassName={classNames?.panelContent}
|
|
38
|
+
panelRef={model.setPanelRef}
|
|
38
39
|
width={model.width}
|
|
39
40
|
onResize={model.actions.resize}
|
|
40
41
|
onResizeEnd={model.actions.resizeEnd}
|
|
@@ -63,6 +64,7 @@ export function DefaultSidebar({
|
|
|
63
64
|
moreLabel={model.moreLabel}
|
|
64
65
|
moreOpen={model.moreOpen}
|
|
65
66
|
onItemClick={model.actions.openNavItem}
|
|
67
|
+
onItemIntent={model.actions.prefetchNavItem}
|
|
66
68
|
onMoreOpenChange={model.actions.setMoreOpen}
|
|
67
69
|
onNavMove={model.actions.moveNavItem}
|
|
68
70
|
onPinNavItem={model.actions.pinNavItem}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { JSX, ReactNode } from "react";
|
|
2
2
|
import { AnimatePresence, motion } from "motion/react";
|
|
3
3
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
4
|
-
import { Button } from "@vetta-org/ui";
|
|
4
|
+
import { Button } from "@vetta-org/ui/button";
|
|
5
|
+
import { cn, OVERLAY_BACKDROP_CLASS } from "@vetta-org/ui/utils";
|
|
5
6
|
|
|
6
7
|
export const MESSAGE_CENTER_DIALOG_SPRING = {
|
|
7
8
|
type: "spring" as const,
|
|
@@ -37,7 +38,7 @@ export function MessageCenterDialogView({
|
|
|
37
38
|
animate={{ opacity: 1 }}
|
|
38
39
|
exit={{ opacity: 0 }}
|
|
39
40
|
transition={{ duration: 0.18 }}
|
|
40
|
-
className="no-drag fixed inset-0 z-50
|
|
41
|
+
className={cn("no-drag fixed inset-0 z-50", OVERLAY_BACKDROP_CLASS)}
|
|
41
42
|
/>
|
|
42
43
|
</DialogPrimitive.Overlay>
|
|
43
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
|
-
import { Button } from "@vetta-org/ui";
|
|
3
|
-
import { cn } from "@vetta-org/ui";
|
|
2
|
+
import { Button } from "@vetta-org/ui/button";
|
|
3
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
4
4
|
|
|
5
5
|
export interface MessageCenterTriggerViewProps {
|
|
6
6
|
readonly open: boolean;
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button } from "@vetta-org/ui/button";
|
|
2
|
+
import type { JSX, ReactNode } from "react";
|
|
2
3
|
|
|
3
4
|
export interface ProjectsPanelEmptyStateLabels {
|
|
4
|
-
title: string;
|
|
5
5
|
description: string;
|
|
6
|
+
newConversation: string;
|
|
7
|
+
title: string;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export interface ProjectsPanelEmptyStateProps {
|
|
9
11
|
labels: ProjectsPanelEmptyStateLabels;
|
|
12
|
+
onNewConversation: () => void;
|
|
13
|
+
/** Secondary action slot, e.g. the add-project menu. */
|
|
14
|
+
projectAction: ReactNode;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
export function ProjectsPanelEmptyState({
|
|
17
|
+
export function ProjectsPanelEmptyState({
|
|
18
|
+
labels,
|
|
19
|
+
onNewConversation,
|
|
20
|
+
projectAction,
|
|
21
|
+
}: ProjectsPanelEmptyStateProps): JSX.Element {
|
|
13
22
|
return (
|
|
14
|
-
<div className="
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
<div className="px-1 py-2">
|
|
24
|
+
<div className="flex flex-col gap-3 rounded-2xl bg-card p-3.5">
|
|
25
|
+
<div className="flex flex-col gap-1">
|
|
26
|
+
<p className="text-[14px] font-semibold text-foreground">{labels.title}</p>
|
|
27
|
+
<p className="text-[12px] leading-relaxed text-muted-foreground">{labels.description}</p>
|
|
28
|
+
</div>
|
|
29
|
+
<div className="flex flex-col gap-2">
|
|
30
|
+
<Button variant="primary" size="lg" className="w-full text-[13px]" onClick={onNewConversation}>
|
|
31
|
+
<span className="icon-[solar--chat-round-line-linear] h-4 w-4 shrink-0" />
|
|
32
|
+
{labels.newConversation}
|
|
33
|
+
</Button>
|
|
34
|
+
{projectAction}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
18
37
|
</div>
|
|
19
38
|
);
|
|
20
39
|
}
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
|
-
import { cn } from "@vetta-org/ui";
|
|
2
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
3
3
|
|
|
4
4
|
export interface SessionStatusIconProps {
|
|
5
5
|
active: boolean;
|
|
6
6
|
running: boolean;
|
|
7
7
|
scheduled: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 会话正等着用户处理(提问 / 审批 / 询问 / 授权)。优先于其它状态:
|
|
10
|
+
* 「在转」说明 agent 还在干活,「停住 + 问号」才说明它在等人,两者同时出现会互相盖住信息。
|
|
11
|
+
*/
|
|
12
|
+
waiting?: boolean;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
export function SessionStatusIcon({
|
|
11
16
|
active,
|
|
12
17
|
running,
|
|
13
18
|
scheduled,
|
|
19
|
+
waiting = false,
|
|
14
20
|
}: SessionStatusIconProps): JSX.Element {
|
|
21
|
+
if (waiting) {
|
|
22
|
+
return (
|
|
23
|
+
<span
|
|
24
|
+
data-session-leading-icon="true"
|
|
25
|
+
data-session-waiting="true"
|
|
26
|
+
className="icon-[solar--question-circle-bold] h-3.5 w-3.5 shrink-0 text-amber-500 motion-safe:animate-pulse"
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
15
30
|
if (running) {
|
|
16
31
|
return (
|
|
17
32
|
<span
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRef } from "react";
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import { SettingsMenuTriggerView } from "./SettingsMenuTriggerView";
|
|
5
|
+
|
|
6
|
+
describe("SettingsMenuTriggerView", () => {
|
|
7
|
+
it("renders one button of the sidebar button group with the settings glyph", () => {
|
|
8
|
+
const markup = renderToStaticMarkup(
|
|
9
|
+
<SettingsMenuTriggerView active={false} iconOnly settingsFallbackLabel="设置" />,
|
|
10
|
+
);
|
|
11
|
+
expect(markup).toContain('data-slot="button-group"');
|
|
12
|
+
expect(markup).toContain('aria-label="设置"');
|
|
13
|
+
expect(markup).toContain("icon-[solar--settings-minimalistic-linear]");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("marks the item as pressed while the settings page is open", () => {
|
|
17
|
+
const markup = renderToStaticMarkup(
|
|
18
|
+
<SettingsMenuTriggerView active iconOnly settingsFallbackLabel="Settings" />,
|
|
19
|
+
);
|
|
20
|
+
expect(markup).toContain('aria-pressed="true"');
|
|
21
|
+
expect(markup).toContain("data-active");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("forwards the button ref so the sidebar can anchor the trigger", () => {
|
|
25
|
+
const ref = createRef<HTMLButtonElement>();
|
|
26
|
+
expect(() =>
|
|
27
|
+
renderToStaticMarkup(<SettingsMenuTriggerView ref={ref} active={false} iconOnly settingsFallbackLabel="设置" />),
|
|
28
|
+
).not.toThrow();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("shows the claw state in the label and keeps a badge only while online", () => {
|
|
32
|
+
const offline = renderToStaticMarkup(
|
|
33
|
+
<SettingsMenuTriggerView active={false} iconOnly settingsFallbackLabel="设置" />,
|
|
34
|
+
);
|
|
35
|
+
const online = renderToStaticMarkup(
|
|
36
|
+
<SettingsMenuTriggerView active={false} iconOnly settingsFallbackLabel="设置" clawOnline clawTitle="Claw 在线" />,
|
|
37
|
+
);
|
|
38
|
+
expect(offline).not.toContain("bg-primary");
|
|
39
|
+
expect(online).toContain("设置 · Claw 在线");
|
|
40
|
+
expect(online).toContain("bg-primary");
|
|
41
|
+
});
|
|
42
|
+
});
|