@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,236 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import { type JSX, useRef } from "react";
|
|
3
|
+
import { cn, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
|
|
4
|
+
import diagnosticsBannerUrl from "./assets/diagnostics-banner.webp";
|
|
5
|
+
|
|
6
|
+
/** idle:还没导出;exporting:保存对话框已确认,正在打包;done:已写到用户选的位置;error:打包或写盘失败。 */
|
|
7
|
+
export type DiagnosticsExportDialogPhase = "idle" | "exporting" | "done" | "error";
|
|
8
|
+
|
|
9
|
+
export interface DiagnosticsExportDialogViewLabels {
|
|
10
|
+
readonly eyebrow: string;
|
|
11
|
+
readonly title: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
/** 讲明 Vetta 不收集用户数据、诊断包只在用户主动附上时才被看到。 */
|
|
14
|
+
readonly noCollection: string;
|
|
15
|
+
/** 「诊断包里有什么」小标题与三项内容。 */
|
|
16
|
+
readonly contentsTitle: string;
|
|
17
|
+
readonly contentsLogs: string;
|
|
18
|
+
readonly contentsRecentLogs: string;
|
|
19
|
+
readonly contentsSystem: string;
|
|
20
|
+
/** 提醒诊断包里可能有项目路径、文件名和报错内容,由用户酌情发送。 */
|
|
21
|
+
readonly privacyNote: string;
|
|
22
|
+
/** 「怎么反馈」小标题与三步;最后一步不限渠道,GitHub Issue 与私聊都行。 */
|
|
23
|
+
readonly stepsTitle: string;
|
|
24
|
+
readonly stepExport: string;
|
|
25
|
+
readonly stepDescribe: string;
|
|
26
|
+
readonly stepAttach: string;
|
|
27
|
+
readonly export: string;
|
|
28
|
+
readonly exporting: string;
|
|
29
|
+
/** 导出成功后的提示,前缀接文件名。 */
|
|
30
|
+
readonly saved: string;
|
|
31
|
+
readonly showInFolder: string;
|
|
32
|
+
readonly failed: string;
|
|
33
|
+
/** 次要入口:打开 GitHub 的 Bug 反馈页,只是渠道之一。 */
|
|
34
|
+
readonly openIssue: string;
|
|
35
|
+
readonly close: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DiagnosticsExportDialogViewProps {
|
|
39
|
+
readonly visible: boolean;
|
|
40
|
+
readonly phase: DiagnosticsExportDialogPhase;
|
|
41
|
+
readonly labels: DiagnosticsExportDialogViewLabels;
|
|
42
|
+
/** phase 为 done 时保存下来的文件名。 */
|
|
43
|
+
readonly savedFileName?: string;
|
|
44
|
+
/** phase 为 error 时的原因。 */
|
|
45
|
+
readonly errorMessage?: string;
|
|
46
|
+
readonly onExport: () => void;
|
|
47
|
+
readonly onShowInFolder: () => void;
|
|
48
|
+
readonly onOpenIssue: () => void;
|
|
49
|
+
readonly onClose: () => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const pillClass =
|
|
53
|
+
"inline-flex h-11 w-full items-center justify-center gap-2 rounded-full bg-primary px-5 text-[14px] font-medium whitespace-nowrap text-primary-foreground shadow-lg shadow-black/15 transition-all outline-none select-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-70";
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 「导出诊断包」引导弹窗:说明 Vetta 不收集数据、包里有什么、怎么把它发给开发者。
|
|
57
|
+
* 外观沿用 Magpie 接入弹窗:大圆角面板、静态横幅、编号步骤、通栏胶囊主按钮。
|
|
58
|
+
* 主按钮随阶段变化:导出 → 正在打包 → 在文件夹中显示。
|
|
59
|
+
*/
|
|
60
|
+
export function DiagnosticsExportDialogView({
|
|
61
|
+
visible,
|
|
62
|
+
phase,
|
|
63
|
+
labels,
|
|
64
|
+
savedFileName,
|
|
65
|
+
errorMessage,
|
|
66
|
+
onExport,
|
|
67
|
+
onShowInFolder,
|
|
68
|
+
onOpenIssue,
|
|
69
|
+
onClose,
|
|
70
|
+
}: DiagnosticsExportDialogViewProps): JSX.Element {
|
|
71
|
+
const overlayRef = useRef<HTMLDivElement>(null);
|
|
72
|
+
const exporting = phase === "exporting";
|
|
73
|
+
const contents = [
|
|
74
|
+
{ icon: "icon-[mdi--file-document-outline]", text: labels.contentsLogs },
|
|
75
|
+
{ icon: "icon-[mdi--history]", text: labels.contentsRecentLogs },
|
|
76
|
+
{ icon: "icon-[mdi--monitor]", text: labels.contentsSystem },
|
|
77
|
+
];
|
|
78
|
+
const steps = [labels.stepExport, labels.stepDescribe, labels.stepAttach];
|
|
79
|
+
const close = () => {
|
|
80
|
+
if (!exporting) onClose();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<AnimatePresence>
|
|
85
|
+
{visible && (
|
|
86
|
+
<motion.div
|
|
87
|
+
ref={overlayRef}
|
|
88
|
+
initial={{ opacity: 0 }}
|
|
89
|
+
animate={{ opacity: 1 }}
|
|
90
|
+
exit={{ opacity: 0 }}
|
|
91
|
+
transition={{ duration: 0.15 }}
|
|
92
|
+
className={cn("pointer-events-auto fixed inset-0 z-[100] flex items-center justify-center", OVERLAY_BACKDROP_CLASS)}
|
|
93
|
+
onClick={(event) => {
|
|
94
|
+
if (event.target === overlayRef.current) close();
|
|
95
|
+
}}
|
|
96
|
+
onKeyDown={(event) => {
|
|
97
|
+
if (event.key === "Escape") close();
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<motion.div
|
|
101
|
+
role="dialog"
|
|
102
|
+
aria-modal="true"
|
|
103
|
+
aria-label={labels.title}
|
|
104
|
+
initial={{ opacity: 0, scale: 0.95 }}
|
|
105
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
106
|
+
exit={{ opacity: 0, scale: 0.95 }}
|
|
107
|
+
transition={{ duration: 0.15, ease: [0.25, 0.1, 0.25, 1] }}
|
|
108
|
+
className={cn(
|
|
109
|
+
"relative flex max-h-[min(780px,calc(100vh-48px))] w-[min(520px,calc(100vw-32px))] flex-col overflow-hidden rounded-3xl bg-popover",
|
|
110
|
+
PANEL_SHADOW_CLASS,
|
|
111
|
+
)}
|
|
112
|
+
>
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
onClick={close}
|
|
116
|
+
disabled={exporting}
|
|
117
|
+
aria-label={labels.close}
|
|
118
|
+
className="absolute top-4 right-4 z-20 inline-flex size-8 items-center justify-center rounded-full bg-white text-neutral-900 shadow-[0_6px_18px_rgba(0,0,0,0.28),0_1px_3px_rgba(0,0,0,0.22)] transition-transform outline-none hover:scale-105 focus-visible:ring-2 focus-visible:ring-white/70 active:scale-95 disabled:opacity-50"
|
|
119
|
+
>
|
|
120
|
+
<span className="icon-[mdi--close] h-4 w-4" />
|
|
121
|
+
</button>
|
|
122
|
+
|
|
123
|
+
<div className="no-scrollbar min-h-0 flex-1 overflow-y-auto [mask-image:linear-gradient(to_bottom,black_calc(100%-20px),transparent)]">
|
|
124
|
+
<DiagnosticsBanner />
|
|
125
|
+
|
|
126
|
+
<div className="px-7 pt-5 pb-5">
|
|
127
|
+
<p className="text-[11px] font-semibold tracking-[0.08em] text-primary uppercase">{labels.eyebrow}</p>
|
|
128
|
+
<h3 className="mt-1.5 text-[19px] leading-snug font-semibold tracking-tight text-foreground">
|
|
129
|
+
{labels.title}
|
|
130
|
+
</h3>
|
|
131
|
+
<p className="mt-2 text-[13px] leading-relaxed text-muted-foreground">{labels.description}</p>
|
|
132
|
+
|
|
133
|
+
<div className="mt-4 flex items-start gap-2.5 rounded-2xl border border-primary/25 bg-primary/8 px-4 py-3">
|
|
134
|
+
<span className="mt-0.5 icon-[mdi--shield-check-outline] h-4 w-4 shrink-0 text-primary" />
|
|
135
|
+
<p className="text-[12.5px] leading-relaxed text-foreground/90">{labels.noCollection}</p>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<p className="mt-5 text-[12px] font-medium text-muted-foreground">{labels.contentsTitle}</p>
|
|
139
|
+
<ul className="mt-2 flex flex-col gap-1.5">
|
|
140
|
+
{contents.map((item) => (
|
|
141
|
+
<li key={item.text} className="flex items-start gap-2.5 text-[13px] leading-6 text-foreground">
|
|
142
|
+
<span className={cn("mt-1 h-4 w-4 shrink-0 text-primary", item.icon)} />
|
|
143
|
+
{item.text}
|
|
144
|
+
</li>
|
|
145
|
+
))}
|
|
146
|
+
</ul>
|
|
147
|
+
|
|
148
|
+
<div className="mt-3 flex items-start gap-2.5 rounded-2xl border border-amber-500/30 bg-amber-500/10 px-4 py-3">
|
|
149
|
+
<span className="mt-0.5 icon-[mdi--information-outline] h-4 w-4 shrink-0 text-amber-500" />
|
|
150
|
+
<p className="text-[12.5px] leading-relaxed text-foreground/90">{labels.privacyNote}</p>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<p className="mt-5 text-[12px] font-medium text-muted-foreground">{labels.stepsTitle}</p>
|
|
154
|
+
<ol className="mt-2 flex flex-col gap-2">
|
|
155
|
+
{steps.map((step, index) => (
|
|
156
|
+
<li
|
|
157
|
+
key={step}
|
|
158
|
+
className="flex items-start gap-3 rounded-2xl border border-border/70 bg-muted/40 px-4 py-3"
|
|
159
|
+
>
|
|
160
|
+
<span className="mt-px inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-primary/12 text-[12px] font-semibold text-primary tabular-nums">
|
|
161
|
+
{index + 1}
|
|
162
|
+
</span>
|
|
163
|
+
<p className="min-w-0 flex-1 text-[13px] leading-6 text-foreground">{step}</p>
|
|
164
|
+
</li>
|
|
165
|
+
))}
|
|
166
|
+
</ol>
|
|
167
|
+
|
|
168
|
+
{phase === "done" && savedFileName && (
|
|
169
|
+
<div
|
|
170
|
+
role="status"
|
|
171
|
+
className="mt-3 flex items-start gap-2.5 rounded-2xl border border-emerald-500/30 bg-emerald-500/10 px-4 py-3"
|
|
172
|
+
>
|
|
173
|
+
<span className="mt-0.5 icon-[mdi--check-circle] h-4 w-4 shrink-0 text-emerald-500" />
|
|
174
|
+
<p className="min-w-0 text-[12.5px] leading-relaxed break-all text-foreground/90">
|
|
175
|
+
{labels.saved}
|
|
176
|
+
<span className="font-mono">{savedFileName}</span>
|
|
177
|
+
</p>
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
{phase === "error" && (
|
|
181
|
+
<div
|
|
182
|
+
role="alert"
|
|
183
|
+
className="mt-3 flex items-start gap-2.5 rounded-2xl border border-destructive/30 bg-destructive/10 px-4 py-3"
|
|
184
|
+
>
|
|
185
|
+
<span className="mt-0.5 icon-[mdi--alert-circle-outline] h-4 w-4 shrink-0 text-destructive" />
|
|
186
|
+
<div className="min-w-0 text-[12.5px] leading-relaxed break-words text-foreground/90">
|
|
187
|
+
<p className="font-medium">{labels.failed}</p>
|
|
188
|
+
{errorMessage && <p className="mt-0.5 text-muted-foreground">{errorMessage}</p>}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<div className="flex flex-col items-center gap-2 px-7 pt-2 pb-6">
|
|
196
|
+
{phase === "done" ? (
|
|
197
|
+
<button type="button" onClick={onShowInFolder} className={pillClass}>
|
|
198
|
+
<span className="icon-[mdi--folder-open-outline] h-4 w-4" />
|
|
199
|
+
{labels.showInFolder}
|
|
200
|
+
</button>
|
|
201
|
+
) : (
|
|
202
|
+
<button type="button" onClick={onExport} disabled={exporting} className={pillClass}>
|
|
203
|
+
{exporting && <span className="icon-[mdi--loading] h-4 w-4 animate-spin" />}
|
|
204
|
+
{exporting ? labels.exporting : labels.export}
|
|
205
|
+
</button>
|
|
206
|
+
)}
|
|
207
|
+
<button
|
|
208
|
+
type="button"
|
|
209
|
+
onClick={onOpenIssue}
|
|
210
|
+
className="inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[12.5px] text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50"
|
|
211
|
+
>
|
|
212
|
+
<span className="icon-[mdi--github] h-3.5 w-3.5" />
|
|
213
|
+
{labels.openIssue}
|
|
214
|
+
<span className="icon-[mdi--open-in-new] h-3.5 w-3.5" />
|
|
215
|
+
</button>
|
|
216
|
+
</div>
|
|
217
|
+
</motion.div>
|
|
218
|
+
</motion.div>
|
|
219
|
+
)}
|
|
220
|
+
</AnimatePresence>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** 静态横幅:海底像素风插画,小气泡拿放大镜查找故障。纯装饰,读屏跳过。 */
|
|
225
|
+
function DiagnosticsBanner(): JSX.Element {
|
|
226
|
+
return (
|
|
227
|
+
<img
|
|
228
|
+
src={diagnosticsBannerUrl}
|
|
229
|
+
alt=""
|
|
230
|
+
aria-hidden
|
|
231
|
+
draggable={false}
|
|
232
|
+
decoding="async"
|
|
233
|
+
className="block aspect-[8/3] w-full object-cover select-none"
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import { type JSX, type ReactNode, useRef } from "react";
|
|
3
|
+
import { cn, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
|
|
4
|
+
|
|
5
|
+
export interface MagpieHandoverDialogViewLabels {
|
|
6
|
+
/** 标题上方的小字,点明这是一次接入方式的变化。 */
|
|
7
|
+
readonly eyebrow: string;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly stepInstall: string;
|
|
11
|
+
readonly stepConnect: string;
|
|
12
|
+
readonly stepUse: string;
|
|
13
|
+
/** 要在 Magpie 插件页搜索的包名,做成可复制的小标签。 */
|
|
14
|
+
readonly pluginName: string;
|
|
15
|
+
/** 插件名旁的说明,让用户认准官方发布者(如「发布者 openvetta」)。 */
|
|
16
|
+
readonly pluginPublisher: string;
|
|
17
|
+
readonly copy: string;
|
|
18
|
+
readonly copied: string;
|
|
19
|
+
readonly defaultModelCleared: string;
|
|
20
|
+
/** 删掉的是用户唯一的服务商:讲明接入前发不了消息。 */
|
|
21
|
+
readonly noProvidersLeft: string;
|
|
22
|
+
readonly primary: string;
|
|
23
|
+
readonly guide: string;
|
|
24
|
+
readonly close: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface MagpieHandoverDialogViewProps {
|
|
28
|
+
readonly visible: boolean;
|
|
29
|
+
readonly labels: MagpieHandoverDialogViewLabels;
|
|
30
|
+
/** 默认模型原本是 Magpie 的,随旧配置一起被清掉了。 */
|
|
31
|
+
readonly defaultModelCleared: boolean;
|
|
32
|
+
/** 删完后没有别的可用服务商:比默认模型被清掉更要紧,两条都成立时只显示这一条。 */
|
|
33
|
+
readonly noProvidersLeft: boolean;
|
|
34
|
+
readonly copied: boolean;
|
|
35
|
+
/** 顶部两枚图标:Vetta 的应用图标与 Magpie 的服务商图标,由宿主提供。 */
|
|
36
|
+
readonly vettaIcon: ReactNode;
|
|
37
|
+
readonly magpieIcon: ReactNode;
|
|
38
|
+
readonly onCopyPluginName: () => void;
|
|
39
|
+
readonly onOpenGuide: () => void;
|
|
40
|
+
readonly onClose: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const pillClass =
|
|
44
|
+
"inline-flex h-11 w-full items-center justify-center rounded-full bg-primary px-5 text-[14px] font-medium whitespace-nowrap text-primary-foreground shadow-lg shadow-black/15 transition-all outline-none select-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/50 active:translate-y-px";
|
|
45
|
+
|
|
46
|
+
// 图标块在任何主题下都是白底,单色图标(跟随文字颜色)要固定成深色,否则深色模式下是浅灰、看不清。
|
|
47
|
+
const iconTileClass =
|
|
48
|
+
"flex size-16 items-center justify-center overflow-hidden rounded-[18px] bg-white text-neutral-900 shadow-[0_10px_28px_rgba(15,23,42,0.18),0_2px_6px_rgba(15,23,42,0.12)] ring-1 ring-black/5";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 升级后告诉老用户:Magpie 改由 Magpie 在其 Agents 页接入 Vetta。
|
|
52
|
+
* 与「版本介绍」同一套外观:大圆角面板、顶部横幅、通栏胶囊主按钮、右上角白色关闭钮。
|
|
53
|
+
* 横幅是静态的两枚图标加一条连线,表示模型从 Magpie 流向 Vetta。
|
|
54
|
+
*/
|
|
55
|
+
export function MagpieHandoverDialogView({
|
|
56
|
+
visible,
|
|
57
|
+
labels,
|
|
58
|
+
defaultModelCleared,
|
|
59
|
+
noProvidersLeft,
|
|
60
|
+
copied,
|
|
61
|
+
vettaIcon,
|
|
62
|
+
magpieIcon,
|
|
63
|
+
onCopyPluginName,
|
|
64
|
+
onOpenGuide,
|
|
65
|
+
onClose,
|
|
66
|
+
}: MagpieHandoverDialogViewProps): JSX.Element {
|
|
67
|
+
const overlayRef = useRef<HTMLDivElement>(null);
|
|
68
|
+
const steps = [
|
|
69
|
+
{ text: labels.stepInstall, extra: true },
|
|
70
|
+
{ text: labels.stepConnect, extra: false },
|
|
71
|
+
{ text: labels.stepUse, extra: false },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<AnimatePresence>
|
|
76
|
+
{visible && (
|
|
77
|
+
<motion.div
|
|
78
|
+
ref={overlayRef}
|
|
79
|
+
initial={{ opacity: 0 }}
|
|
80
|
+
animate={{ opacity: 1 }}
|
|
81
|
+
exit={{ opacity: 0 }}
|
|
82
|
+
transition={{ duration: 0.15 }}
|
|
83
|
+
className={cn("pointer-events-auto fixed inset-0 z-[100] flex items-center justify-center", OVERLAY_BACKDROP_CLASS)}
|
|
84
|
+
onClick={(event) => {
|
|
85
|
+
if (event.target === overlayRef.current) onClose();
|
|
86
|
+
}}
|
|
87
|
+
onKeyDown={(event) => {
|
|
88
|
+
if (event.key === "Escape") onClose();
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<motion.div
|
|
92
|
+
role="dialog"
|
|
93
|
+
aria-modal="true"
|
|
94
|
+
aria-label={labels.title}
|
|
95
|
+
initial={{ opacity: 0, scale: 0.95 }}
|
|
96
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
97
|
+
exit={{ opacity: 0, scale: 0.95 }}
|
|
98
|
+
transition={{ duration: 0.15, ease: [0.25, 0.1, 0.25, 1] }}
|
|
99
|
+
className={cn(
|
|
100
|
+
"relative flex max-h-[min(780px,calc(100vh-48px))] w-[min(520px,calc(100vw-32px))] flex-col overflow-hidden rounded-3xl bg-popover",
|
|
101
|
+
PANEL_SHADOW_CLASS,
|
|
102
|
+
)}
|
|
103
|
+
>
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
onClick={onClose}
|
|
107
|
+
aria-label={labels.close}
|
|
108
|
+
className="absolute top-4 right-4 z-20 inline-flex size-8 items-center justify-center rounded-full bg-white text-neutral-900 shadow-[0_6px_18px_rgba(0,0,0,0.28),0_1px_3px_rgba(0,0,0,0.22)] transition-transform outline-none hover:scale-105 focus-visible:ring-2 focus-visible:ring-white/70 active:scale-95"
|
|
109
|
+
>
|
|
110
|
+
<span className="icon-[mdi--close] h-4 w-4" />
|
|
111
|
+
</button>
|
|
112
|
+
|
|
113
|
+
<div className="no-scrollbar min-h-0 flex-1 overflow-y-auto [mask-image:linear-gradient(to_bottom,black_calc(100%-20px),transparent)]">
|
|
114
|
+
<HandoverBanner vettaIcon={vettaIcon} magpieIcon={magpieIcon} />
|
|
115
|
+
|
|
116
|
+
<div className="px-7 pt-5 pb-5">
|
|
117
|
+
<p className="text-[11px] font-semibold tracking-[0.08em] text-primary uppercase">{labels.eyebrow}</p>
|
|
118
|
+
<h3 className="mt-1.5 text-[19px] leading-snug font-semibold tracking-tight text-foreground">
|
|
119
|
+
{labels.title}
|
|
120
|
+
</h3>
|
|
121
|
+
<p className="mt-2 text-[13px] leading-relaxed text-muted-foreground">{labels.description}</p>
|
|
122
|
+
|
|
123
|
+
<ol className="mt-5 flex flex-col gap-2">
|
|
124
|
+
{steps.map((step, index) => (
|
|
125
|
+
<li
|
|
126
|
+
key={step.text}
|
|
127
|
+
className="flex items-start gap-3 rounded-2xl border border-border/70 bg-muted/40 px-4 py-3"
|
|
128
|
+
>
|
|
129
|
+
<span className="mt-px inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-primary/12 text-[12px] font-semibold text-primary tabular-nums">
|
|
130
|
+
{index + 1}
|
|
131
|
+
</span>
|
|
132
|
+
<div className="min-w-0 flex-1">
|
|
133
|
+
<p className="text-[13px] leading-6 text-foreground">{step.text}</p>
|
|
134
|
+
{step.extra && (
|
|
135
|
+
<div className="mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1">
|
|
136
|
+
<button
|
|
137
|
+
type="button"
|
|
138
|
+
onClick={onCopyPluginName}
|
|
139
|
+
title={copied ? labels.copied : labels.copy}
|
|
140
|
+
className="group inline-flex h-7 items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 font-mono text-[12px] text-foreground transition-colors outline-none hover:border-primary/50 focus-visible:ring-2 focus-visible:ring-ring/50"
|
|
141
|
+
>
|
|
142
|
+
{labels.pluginName}
|
|
143
|
+
<span
|
|
144
|
+
className={cn(
|
|
145
|
+
"h-3.5 w-3.5 transition-colors",
|
|
146
|
+
copied
|
|
147
|
+
? "icon-[mdi--check] text-emerald-500"
|
|
148
|
+
: "icon-[mdi--content-copy] text-muted-foreground group-hover:text-foreground",
|
|
149
|
+
)}
|
|
150
|
+
/>
|
|
151
|
+
<span className="sr-only">{copied ? labels.copied : labels.copy}</span>
|
|
152
|
+
</button>
|
|
153
|
+
<span className="inline-flex items-center gap-1 text-[12px] text-muted-foreground">
|
|
154
|
+
<span className="icon-[mdi--check-decagram] h-3.5 w-3.5 text-primary" />
|
|
155
|
+
{labels.pluginPublisher}
|
|
156
|
+
</span>
|
|
157
|
+
</div>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
</li>
|
|
161
|
+
))}
|
|
162
|
+
</ol>
|
|
163
|
+
|
|
164
|
+
{(noProvidersLeft || defaultModelCleared) && (
|
|
165
|
+
<div className="mt-3 flex items-start gap-2.5 rounded-2xl border border-amber-500/30 bg-amber-500/10 px-4 py-3">
|
|
166
|
+
<span className="mt-0.5 icon-[mdi--information-outline] h-4 w-4 shrink-0 text-amber-500" />
|
|
167
|
+
<p className="text-[12.5px] leading-relaxed text-foreground/90">
|
|
168
|
+
{noProvidersLeft ? labels.noProvidersLeft : labels.defaultModelCleared}
|
|
169
|
+
</p>
|
|
170
|
+
</div>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div className="flex flex-col items-center gap-2 px-7 pt-2 pb-6">
|
|
176
|
+
<button type="button" onClick={onClose} className={pillClass}>
|
|
177
|
+
{labels.primary}
|
|
178
|
+
</button>
|
|
179
|
+
<button
|
|
180
|
+
type="button"
|
|
181
|
+
onClick={onOpenGuide}
|
|
182
|
+
className="inline-flex h-8 items-center gap-1 rounded-full px-3 text-[12.5px] text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50"
|
|
183
|
+
>
|
|
184
|
+
{labels.guide}
|
|
185
|
+
<span className="icon-[mdi--open-in-new] h-3.5 w-3.5" />
|
|
186
|
+
</button>
|
|
187
|
+
</div>
|
|
188
|
+
</motion.div>
|
|
189
|
+
</motion.div>
|
|
190
|
+
)}
|
|
191
|
+
</AnimatePresence>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** 静态横幅:Magpie 在左、Vetta 在右,中间虚线与箭头表示模型由 Magpie 接入 Vetta。 */
|
|
196
|
+
function HandoverBanner({ vettaIcon, magpieIcon }: { readonly vettaIcon: ReactNode; readonly magpieIcon: ReactNode }): JSX.Element {
|
|
197
|
+
return (
|
|
198
|
+
<div className="relative flex h-[148px] items-center justify-center overflow-hidden bg-[radial-gradient(120%_90%_at_50%_0%,color-mix(in_oklab,var(--primary)_22%,transparent),transparent_70%),linear-gradient(180deg,color-mix(in_oklab,var(--primary)_10%,var(--popover)),var(--popover))]">
|
|
199
|
+
{/* 淡淡的网格底纹,呼应 Vetta 图标的蓝格背景。 */}
|
|
200
|
+
<div
|
|
201
|
+
aria-hidden
|
|
202
|
+
className="absolute inset-0 opacity-[0.35] [background-image:linear-gradient(to_right,color-mix(in_oklab,var(--primary)_18%,transparent)_1px,transparent_1px),linear-gradient(to_bottom,color-mix(in_oklab,var(--primary)_18%,transparent)_1px,transparent_1px)] [background-size:28px_28px] [mask-image:radial-gradient(70%_80%_at_50%_45%,black,transparent)]"
|
|
203
|
+
/>
|
|
204
|
+
<div className="relative flex items-center gap-4">
|
|
205
|
+
<div className={iconTileClass}>{magpieIcon}</div>
|
|
206
|
+
<div aria-hidden className="flex items-center gap-1.5 text-primary">
|
|
207
|
+
<span className="h-px w-6 border-t-2 border-dashed border-primary/45" />
|
|
208
|
+
<span className="inline-flex size-7 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-md shadow-primary/30">
|
|
209
|
+
<span className="icon-[mdi--arrow-right] h-4 w-4" />
|
|
210
|
+
</span>
|
|
211
|
+
<span className="h-px w-6 border-t-2 border-dashed border-primary/45" />
|
|
212
|
+
</div>
|
|
213
|
+
<div className={iconTileClass}>{vettaIcon}</div>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ReleaseNoteMarkdown } from "./ReleaseNoteMarkdown";
|
|
4
|
+
|
|
5
|
+
function renderNote(note: string): string {
|
|
6
|
+
return renderToStaticMarkup(<ReleaseNoteMarkdown>{note}</ReleaseNoteMarkdown>);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
describe("ReleaseNoteMarkdown", () => {
|
|
10
|
+
it("opens web links in a new window so the host hands them to the system browser", () => {
|
|
11
|
+
const html = renderNote("See [the issue](https://github.com/openvetta/open-vetta/issues/8).");
|
|
12
|
+
|
|
13
|
+
expect(html).toContain('href="https://github.com/openvetta/open-vetta/issues/8"');
|
|
14
|
+
expect(html).toContain('target="_blank"');
|
|
15
|
+
expect(html).toContain('rel="noopener noreferrer"');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("renders non-web links as plain text so clicking cannot navigate the app window", () => {
|
|
19
|
+
const html = renderNote("Read [the docs](./docs/guide.md).");
|
|
20
|
+
|
|
21
|
+
expect(html).not.toContain("<a");
|
|
22
|
+
expect(html).toContain("the docs");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import ReactMarkdown, { type Components } from "react-markdown";
|
|
3
|
+
import remarkGfm from "remark-gfm";
|
|
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
|
+
/** 更新日志的排版:标题、列表、行内代码要有层次和间距,不依赖宿主的 markdown 样式。 */
|
|
17
|
+
const releaseNoteComponents: Components = {
|
|
18
|
+
h1: ({ children }) => <h1 className="mb-2 text-[14px] font-semibold text-foreground">{children}</h1>,
|
|
19
|
+
h2: ({ children }) => (
|
|
20
|
+
<h2 className="mb-1.5 mt-4 text-[13px] font-semibold text-foreground first:mt-0">{children}</h2>
|
|
21
|
+
),
|
|
22
|
+
h3: ({ children }) => <h3 className="mb-1 mt-3 text-[12.5px] font-semibold text-foreground">{children}</h3>,
|
|
23
|
+
p: ({ children }) => <p className="my-1.5">{children}</p>,
|
|
24
|
+
ul: ({ children }) => <ul className="my-1.5 list-disc space-y-1.5 pl-5">{children}</ul>,
|
|
25
|
+
ol: ({ children }) => <ol className="my-1.5 list-decimal space-y-1.5 pl-5">{children}</ol>,
|
|
26
|
+
li: ({ children }) => <li className="pl-0.5">{children}</li>,
|
|
27
|
+
strong: ({ children }) => <strong className="font-semibold text-foreground">{children}</strong>,
|
|
28
|
+
// 普通 <a href> 会把整个主窗口导航到该网页且无法返回。外链改走 target=_blank,
|
|
29
|
+
// 由主进程的 window-open handler 交给系统浏览器;其余(相对路径、锚点)只显示文字。
|
|
30
|
+
a: ({ href, children }) =>
|
|
31
|
+
isExternalLink(href) ? (
|
|
32
|
+
<a
|
|
33
|
+
href={href}
|
|
34
|
+
target="_blank"
|
|
35
|
+
rel="noopener noreferrer"
|
|
36
|
+
className="text-primary underline decoration-primary/30 hover:decoration-primary"
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</a>
|
|
40
|
+
) : (
|
|
41
|
+
<span>{children}</span>
|
|
42
|
+
),
|
|
43
|
+
code: ({ children }) => (
|
|
44
|
+
<code className="rounded bg-muted px-1 py-0.5 font-mono text-[11.5px] text-foreground">{children}</code>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** 更新日志的 Markdown 渲染:设置页预览与更新弹窗共用。 */
|
|
49
|
+
export function ReleaseNoteMarkdown({ children }: { readonly children: string }): JSX.Element {
|
|
50
|
+
return (
|
|
51
|
+
<ReactMarkdown remarkPlugins={[remarkGfm]} components={releaseNoteComponents}>
|
|
52
|
+
{children}
|
|
53
|
+
</ReactMarkdown>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Splash 里的选项行:图标 + 标题 + 一行描述。
|
|
6
|
+
* 与 CommandMenuRow 同一套悬停底色,区别是描述另起一行——选项面板没有搜索,
|
|
7
|
+
* 描述是用户做选择的依据,不能像命令面板的副标题那样被截成半截。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface SplashOptionRowProps {
|
|
11
|
+
/** iconify 类名。 */
|
|
12
|
+
readonly icon: string;
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
readonly disabled?: boolean;
|
|
16
|
+
readonly onSelect: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function SplashOptionRow({
|
|
20
|
+
icon,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
disabled,
|
|
24
|
+
onSelect,
|
|
25
|
+
}: SplashOptionRowProps): JSX.Element {
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
onClick={onSelect}
|
|
31
|
+
className={cn(
|
|
32
|
+
"flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left outline-none transition-colors",
|
|
33
|
+
"hover:bg-primary/10 focus-visible:bg-primary/10",
|
|
34
|
+
disabled && "cursor-not-allowed opacity-45",
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<span aria-hidden="true" className={cn(icon, "mt-0.5 size-4 shrink-0 text-muted-foreground")} />
|
|
38
|
+
<span className="min-w-0 flex-1">
|
|
39
|
+
<span className="block text-[13px] text-foreground">{title}</span>
|
|
40
|
+
{description && (
|
|
41
|
+
<span className="mt-0.5 block text-[11px] leading-snug text-muted-foreground">{description}</span>
|
|
42
|
+
)}
|
|
43
|
+
</span>
|
|
44
|
+
</button>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import { useRef, type JSX, type ReactNode } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
5
|
+
import "./command-menu.css";
|
|
6
|
+
import { cn, GLASS_PANEL_CLASS, OVERLAY_BACKDROP_CLASS } from "@vetta-org/ui/utils";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 居中偏上的 Splash 面板外壳:遮罩 + 入场动效 + 高光边 + 主题 surface 槽位。
|
|
10
|
+
* ⌘T 命令面板与「添加项目」这类选项面板共用这一份,样式只在这里改一次。
|
|
11
|
+
*
|
|
12
|
+
* 自己 portal 到 body:宿主可能把它挂在侧栏之类带 transform / contain 的祖先里,
|
|
13
|
+
* 那样 `fixed` 会相对祖先定位,面板就缩在侧栏里了。
|
|
14
|
+
*
|
|
15
|
+
* 只管外壳:头部(搜索框 / 标题)、列表和底栏都由调用方通过插槽传入,
|
|
16
|
+
* 键盘导航与关闭快捷键由宿主负责,本组件只处理点击遮罩关闭。
|
|
17
|
+
* 面板顶部对齐而非垂直居中:内容条数会变,垂直居中会让头部随内容上下跳。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export interface SplashPanelProps {
|
|
21
|
+
readonly open: boolean;
|
|
22
|
+
readonly onClose: () => void;
|
|
23
|
+
/** 无障碍名称(对话框的 aria-label)。 */
|
|
24
|
+
readonly label: string;
|
|
25
|
+
/** 顶部区域,例如搜索框或标题;与列表之间由调用方自带分隔。 */
|
|
26
|
+
readonly header?: ReactNode;
|
|
27
|
+
readonly children: ReactNode;
|
|
28
|
+
/** 底部提示栏。 */
|
|
29
|
+
readonly footer?: ReactNode;
|
|
30
|
+
/** 面板宽度(CSS 值),默认 640px 与命令面板一致。 */
|
|
31
|
+
readonly width?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function SplashPanel({
|
|
35
|
+
open,
|
|
36
|
+
onClose,
|
|
37
|
+
label,
|
|
38
|
+
header,
|
|
39
|
+
children,
|
|
40
|
+
footer,
|
|
41
|
+
width = "640px",
|
|
42
|
+
}: SplashPanelProps): JSX.Element {
|
|
43
|
+
const overlayRef = useRef<HTMLDivElement | null>(null);
|
|
44
|
+
|
|
45
|
+
return createPortal(
|
|
46
|
+
<AnimatePresence>
|
|
47
|
+
{open && (
|
|
48
|
+
<motion.div
|
|
49
|
+
ref={overlayRef}
|
|
50
|
+
initial={{ opacity: 0 }}
|
|
51
|
+
animate={{ opacity: 1 }}
|
|
52
|
+
exit={{ opacity: 0 }}
|
|
53
|
+
transition={{ duration: 0.14 }}
|
|
54
|
+
// 与 ConfirmDialogView 同因:portal 到 body 后需显式恢复指针事件。
|
|
55
|
+
// 蒙层与其他弹出层统一(OVERLAY_BACKDROP_CLASS:压暗 + 模糊背景)。
|
|
56
|
+
className={cn("pointer-events-auto fixed inset-0 z-[100] flex items-start justify-center pt-[12vh]", OVERLAY_BACKDROP_CLASS)}
|
|
57
|
+
onMouseDown={(event) => {
|
|
58
|
+
if (event.target === overlayRef.current) onClose();
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<motion.div
|
|
62
|
+
role="dialog"
|
|
63
|
+
aria-modal="true"
|
|
64
|
+
aria-label={label}
|
|
65
|
+
initial={{ opacity: 0, scale: 0.96, y: -8 }}
|
|
66
|
+
animate={{ opacity: 1, scale: 1, y: 0 }}
|
|
67
|
+
exit={{ opacity: 0, scale: 0.96, y: -8 }}
|
|
68
|
+
transition={{ duration: 0.16, ease: [0.25, 0.1, 0.25, 1] }}
|
|
69
|
+
style={{ width: `min(${width}, calc(100vw - 32px))` }}
|
|
70
|
+
// 玻璃面板:与 ButtonGroup 同一套半透明叠层 + 内阴影高光边(见 GLASS_PANEL_CLASS)。
|
|
71
|
+
className={cn("command-menu-sheen relative flex flex-col rounded-2xl", GLASS_PANEL_CLASS)}
|
|
72
|
+
>
|
|
73
|
+
<ThemeSurface slot="root.commandMenu.panel" />
|
|
74
|
+
<div className="relative z-10 flex min-h-0 flex-col">
|
|
75
|
+
{header}
|
|
76
|
+
{children}
|
|
77
|
+
{footer}
|
|
78
|
+
</div>
|
|
79
|
+
</motion.div>
|
|
80
|
+
</motion.div>
|
|
81
|
+
)}
|
|
82
|
+
</AnimatePresence>,
|
|
83
|
+
document.body,
|
|
84
|
+
);
|
|
85
|
+
}
|