@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,217 @@
|
|
|
1
|
+
import { motion } from "motion/react";
|
|
2
|
+
import {
|
|
3
|
+
type ComponentPropsWithoutRef,
|
|
4
|
+
type JSX,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
type RefObject,
|
|
7
|
+
useEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SplashPanel 的配套部件:头部(输入框 / 标题)、底栏、提示行、步骤过渡。
|
|
14
|
+
* 多步流程在同一个 Splash 里完成时,每一步只需要换这几块,外壳不动。
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const HEADER_CLASS = "relative flex h-12 shrink-0 items-center gap-2.5 px-3.5";
|
|
18
|
+
|
|
19
|
+
function BackButton({ label, onClick }: { label: string; onClick: () => void }): JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
aria-label={label}
|
|
24
|
+
title={label}
|
|
25
|
+
onClick={onClick}
|
|
26
|
+
className="-ml-1 flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
|
27
|
+
>
|
|
28
|
+
<span aria-hidden="true" className="icon-[solar--alt-arrow-left-linear] size-4" />
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SplashInputHeaderProps {
|
|
34
|
+
/** 无返回键时显示在输入框前的图标(iconify 类名)。 */
|
|
35
|
+
readonly icon: string;
|
|
36
|
+
readonly value: string;
|
|
37
|
+
readonly placeholder: string;
|
|
38
|
+
/** 输入框的无障碍名称。 */
|
|
39
|
+
readonly label: string;
|
|
40
|
+
readonly onChange: (value: string) => void;
|
|
41
|
+
/** Enter 提交;输入法组合中的 Enter 是选词,不会触发。 */
|
|
42
|
+
readonly onSubmit?: () => void;
|
|
43
|
+
/** 给了就在输入框前显示返回键(替换图标),用于进入了二级步骤的场景。 */
|
|
44
|
+
readonly onBack?: () => void;
|
|
45
|
+
readonly backLabel?: string;
|
|
46
|
+
readonly disabled?: boolean;
|
|
47
|
+
readonly invalid?: boolean;
|
|
48
|
+
readonly inputRef?: RefObject<HTMLInputElement | null>;
|
|
49
|
+
/** 透传给 input 的其余属性,例如命令面板的 combobox 无障碍属性。 */
|
|
50
|
+
readonly inputProps?: Omit<
|
|
51
|
+
ComponentPropsWithoutRef<"input">,
|
|
52
|
+
"value" | "onChange" | "placeholder" | "disabled" | "aria-label" | "aria-invalid"
|
|
53
|
+
>;
|
|
54
|
+
/** 挂载后自动聚焦,默认开启:进入这一步后的第一个动作就是打字。 */
|
|
55
|
+
readonly autoFocus?: boolean;
|
|
56
|
+
/** 输入框右侧的附加内容,例如唤起面板的快捷键提示。 */
|
|
57
|
+
readonly trailing?: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function SplashInputHeader({
|
|
61
|
+
icon,
|
|
62
|
+
value,
|
|
63
|
+
placeholder,
|
|
64
|
+
label,
|
|
65
|
+
onChange,
|
|
66
|
+
onSubmit,
|
|
67
|
+
onBack,
|
|
68
|
+
backLabel,
|
|
69
|
+
disabled,
|
|
70
|
+
invalid,
|
|
71
|
+
inputRef,
|
|
72
|
+
inputProps,
|
|
73
|
+
autoFocus = true,
|
|
74
|
+
trailing,
|
|
75
|
+
}: SplashInputHeaderProps): JSX.Element {
|
|
76
|
+
const ownRef = useRef<HTMLInputElement | null>(null);
|
|
77
|
+
const ref = inputRef ?? ownRef;
|
|
78
|
+
// 中日文输入法:确认候选词的那下 Enter,keydown 与 compositionend 的先后各引擎不一致,
|
|
79
|
+
// 所以除了 isComposing 再用 compositionend 之后的一小段时间兜底。
|
|
80
|
+
const composingRef = useRef(false);
|
|
81
|
+
const composedAtRef = useRef(0);
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!autoFocus) return;
|
|
85
|
+
const frame = requestAnimationFrame(() => ref.current?.focus());
|
|
86
|
+
return () => cancelAnimationFrame(frame);
|
|
87
|
+
}, [autoFocus, ref]);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div className={HEADER_CLASS}>
|
|
91
|
+
{onBack ? (
|
|
92
|
+
<BackButton label={backLabel ?? ""} onClick={onBack} />
|
|
93
|
+
) : (
|
|
94
|
+
<span aria-hidden="true" className={cn(icon, "size-4 shrink-0 text-muted-foreground")} />
|
|
95
|
+
)}
|
|
96
|
+
<input
|
|
97
|
+
{...inputProps}
|
|
98
|
+
ref={ref}
|
|
99
|
+
type="text"
|
|
100
|
+
autoComplete="off"
|
|
101
|
+
spellCheck={false}
|
|
102
|
+
aria-label={label}
|
|
103
|
+
aria-invalid={invalid || undefined}
|
|
104
|
+
disabled={disabled}
|
|
105
|
+
value={value}
|
|
106
|
+
placeholder={placeholder}
|
|
107
|
+
onChange={(event) => onChange(event.target.value)}
|
|
108
|
+
onCompositionStart={() => {
|
|
109
|
+
composingRef.current = true;
|
|
110
|
+
}}
|
|
111
|
+
onCompositionEnd={() => {
|
|
112
|
+
composingRef.current = false;
|
|
113
|
+
composedAtRef.current = Date.now();
|
|
114
|
+
}}
|
|
115
|
+
onKeyDown={(event) => {
|
|
116
|
+
inputProps?.onKeyDown?.(event);
|
|
117
|
+
if (event.key !== "Enter" || !onSubmit) return;
|
|
118
|
+
if (composingRef.current || event.nativeEvent.isComposing || Date.now() - composedAtRef.current < 80) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
onSubmit();
|
|
122
|
+
}}
|
|
123
|
+
className="min-w-0 flex-1 bg-transparent text-[14px] text-foreground outline-none placeholder:text-muted-foreground/70 disabled:opacity-60"
|
|
124
|
+
/>
|
|
125
|
+
{trailing}
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface SplashTitleHeaderProps {
|
|
131
|
+
readonly title: string;
|
|
132
|
+
readonly onBack?: () => void;
|
|
133
|
+
readonly backLabel?: string;
|
|
134
|
+
/** 标题右侧的附加内容,例如当前路径。 */
|
|
135
|
+
readonly trailing?: ReactNode;
|
|
136
|
+
/** title 是面板的标题(大而粗);plain 用于路径之类的辅助信息,保持常规字重。 */
|
|
137
|
+
readonly variant?: "title" | "plain";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** 没有输入框的步骤用它做头部:与输入头部同高同位,切步骤时外壳不跳。 */
|
|
141
|
+
export function SplashTitleHeader({
|
|
142
|
+
title,
|
|
143
|
+
onBack,
|
|
144
|
+
backLabel,
|
|
145
|
+
trailing,
|
|
146
|
+
variant = "title",
|
|
147
|
+
}: SplashTitleHeaderProps): JSX.Element {
|
|
148
|
+
return (
|
|
149
|
+
<div className={HEADER_CLASS}>
|
|
150
|
+
{onBack && <BackButton label={backLabel ?? ""} onClick={onBack} />}
|
|
151
|
+
<span
|
|
152
|
+
className={cn(
|
|
153
|
+
"min-w-0 flex-1 truncate text-foreground",
|
|
154
|
+
variant === "title" ? "text-[17px] font-semibold tracking-tight" : "text-[14px]",
|
|
155
|
+
)}
|
|
156
|
+
>
|
|
157
|
+
{title}
|
|
158
|
+
</span>
|
|
159
|
+
{trailing}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** 底栏:快捷键提示或主操作按钮。 */
|
|
165
|
+
export function SplashFooter({ children, className }: { children: ReactNode; className?: string }): JSX.Element {
|
|
166
|
+
return (
|
|
167
|
+
<div
|
|
168
|
+
className={cn(
|
|
169
|
+
// 唯一保留分隔线的地方;玻璃面板上不另铺底色,只用一条极淡的线把操作区分开。
|
|
170
|
+
"flex min-h-9 shrink-0 items-center gap-3 border-t border-foreground/[0.06] px-3.5 py-1.5 dark:border-white/[0.07]",
|
|
171
|
+
"text-[11px] text-muted-foreground/80",
|
|
172
|
+
className,
|
|
173
|
+
)}
|
|
174
|
+
>
|
|
175
|
+
{children}
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** 输入下方的一行提示;tone=error 时用红色并作为 alert 播报。 */
|
|
181
|
+
export function SplashNotice({
|
|
182
|
+
tone = "muted",
|
|
183
|
+
children,
|
|
184
|
+
}: {
|
|
185
|
+
tone?: "muted" | "error";
|
|
186
|
+
children: ReactNode;
|
|
187
|
+
}): JSX.Element {
|
|
188
|
+
return (
|
|
189
|
+
<p
|
|
190
|
+
role={tone === "error" ? "alert" : undefined}
|
|
191
|
+
className={cn(
|
|
192
|
+
"whitespace-pre-wrap break-words px-4 py-2.5 text-[12px] leading-snug",
|
|
193
|
+
tone === "error" ? "text-destructive" : "text-muted-foreground",
|
|
194
|
+
)}
|
|
195
|
+
>
|
|
196
|
+
{children}
|
|
197
|
+
</p>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 步骤切换的淡入:用 stepKey 区分步骤。只做入场,不做离场——
|
|
203
|
+
* 离场动画要同时保留两步的 DOM,在高度不同的两步之间会让面板抖动。
|
|
204
|
+
*/
|
|
205
|
+
export function SplashStep({ stepKey, children }: { stepKey: string; children: ReactNode }): JSX.Element {
|
|
206
|
+
return (
|
|
207
|
+
<motion.div
|
|
208
|
+
key={stepKey}
|
|
209
|
+
initial={{ opacity: 0 }}
|
|
210
|
+
animate={{ opacity: 1 }}
|
|
211
|
+
transition={{ duration: 0.12, ease: "easeOut" }}
|
|
212
|
+
className="flex min-h-0 flex-col"
|
|
213
|
+
>
|
|
214
|
+
{children}
|
|
215
|
+
</motion.div>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState, type JSX } from "react";
|
|
2
|
-
import ReactMarkdown from "react-markdown";
|
|
3
|
-
import remarkGfm from "remark-gfm";
|
|
4
2
|
import { Button } from "@vetta-org/ui";
|
|
3
|
+
import { ReleaseNoteMarkdown } from "./ReleaseNoteMarkdown";
|
|
5
4
|
|
|
6
5
|
export interface UpdateCheckerViewLabels {
|
|
7
6
|
readonly check: string;
|
|
@@ -14,6 +13,8 @@ export interface UpdateCheckerViewLabels {
|
|
|
14
13
|
readonly newVersion: (version: string) => string;
|
|
15
14
|
readonly restart: string;
|
|
16
15
|
readonly viewMore?: string;
|
|
16
|
+
/** 「版本介绍」按钮文案;与 onViewCurrent 同时提供才显示按钮。 */
|
|
17
|
+
readonly viewCurrent?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export type UpdateCheckerPhase =
|
|
@@ -33,31 +34,48 @@ export interface UpdateCheckerViewProps {
|
|
|
33
34
|
readonly onCheck: () => void;
|
|
34
35
|
readonly onPrimary: () => void;
|
|
35
36
|
readonly onViewMore?: () => void;
|
|
37
|
+
readonly onViewCurrent?: () => void;
|
|
36
38
|
readonly phase: UpdateCheckerPhase;
|
|
37
39
|
readonly progress?: number;
|
|
38
40
|
readonly releaseNote?: string;
|
|
39
41
|
readonly statusText: string;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
/** Settings
|
|
44
|
+
/** Settings 行右侧:「版本介绍」(可选)+ 与 App 引导同款 outline sm 的检查更新按钮。 */
|
|
43
45
|
export function UpdateCheckerAction({
|
|
44
46
|
checking,
|
|
45
47
|
labels,
|
|
46
48
|
onCheck,
|
|
49
|
+
onViewCurrent,
|
|
47
50
|
phase,
|
|
48
|
-
|
|
51
|
+
progress,
|
|
52
|
+
}: Pick<UpdateCheckerViewProps, "checking" | "labels" | "onCheck" | "onViewCurrent" | "phase" | "progress">): JSX.Element {
|
|
53
|
+
// 下载中不能再点检查更新:按钮直接变成不可点的下载进度,重新进入设置页也一致。
|
|
54
|
+
const downloading = phase === "downloading";
|
|
55
|
+
const busy = checking || downloading;
|
|
49
56
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
<div className="flex items-center gap-2">
|
|
58
|
+
{onViewCurrent && labels.viewCurrent && (
|
|
59
|
+
<Button variant="field" onClick={onViewCurrent} data-testid="updater-view-current">
|
|
60
|
+
<span className="icon-[mdi--sparkles-outline] h-3.5 w-3.5" />
|
|
61
|
+
{labels.viewCurrent}
|
|
62
|
+
</Button>
|
|
63
|
+
)}
|
|
64
|
+
<Button
|
|
65
|
+
variant="field"
|
|
66
|
+
onClick={onCheck}
|
|
67
|
+
disabled={busy}
|
|
68
|
+
data-testid="updater-check"
|
|
69
|
+
data-updater-phase={phase}
|
|
70
|
+
>
|
|
71
|
+
<span className={`icon-[mdi--refresh] h-3.5 w-3.5 ${busy ? "animate-spin" : ""}`} />
|
|
72
|
+
{downloading
|
|
73
|
+
? labels.downloading(Math.round((progress ?? 0) * 100))
|
|
74
|
+
: checking
|
|
75
|
+
? labels.checkingBtn
|
|
76
|
+
: labels.check}
|
|
77
|
+
</Button>
|
|
78
|
+
</div>
|
|
61
79
|
);
|
|
62
80
|
}
|
|
63
81
|
|
|
@@ -159,9 +177,7 @@ function ReleaseNotePreview({
|
|
|
159
177
|
}`}
|
|
160
178
|
style={isOverflowing ? { maxHeight: `${MAX_HEIGHT_PX}px` } : undefined}
|
|
161
179
|
>
|
|
162
|
-
<
|
|
163
|
-
{releaseNote}
|
|
164
|
-
</ReactMarkdown>
|
|
180
|
+
<ReleaseNoteMarkdown>{releaseNote}</ReleaseNoteMarkdown>
|
|
165
181
|
</div>
|
|
166
182
|
{isOverflowing && (
|
|
167
183
|
<div className="pt-6 -mt-6 bg-gradient-to-t from-secondary via-secondary/85 to-transparent flex items-center justify-center relative z-10">
|
|
@@ -1,38 +1,83 @@
|
|
|
1
1
|
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
-
import type
|
|
3
|
-
import { cn } from "@vetta-org/ui";
|
|
2
|
+
import { type JSX, type RefObject, useEffect, useState } from "react";
|
|
3
|
+
import { cn, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
|
|
4
|
+
import { ReleaseNoteMarkdown } from "./ReleaseNoteMarkdown";
|
|
4
5
|
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 更新对话框的底部状态条:检查中 / 下载进度 / 出错。
|
|
9
|
+
* 其余阶段(有新版本、已就绪、已是最新、版本介绍)不需要状态条,直接展示正文。
|
|
10
|
+
*/
|
|
11
|
+
export type UpdateRestartDialogStatus =
|
|
12
|
+
| { readonly kind: "checking"; readonly text: string }
|
|
13
|
+
| { readonly kind: "progress"; readonly text: string; readonly progress: number }
|
|
14
|
+
| { readonly kind: "error"; readonly text: string };
|
|
15
|
+
|
|
16
|
+
export interface UpdateRestartDialogAction {
|
|
17
|
+
readonly disabled?: boolean;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly onClick: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface UpdateRestartDialogEarlierNote {
|
|
23
|
+
readonly id: string;
|
|
10
24
|
readonly title: string;
|
|
25
|
+
readonly note: string;
|
|
11
26
|
}
|
|
12
27
|
|
|
13
28
|
export interface UpdateRestartDialogViewProps {
|
|
14
|
-
readonly
|
|
29
|
+
readonly bannerSrc: string;
|
|
30
|
+
/** 无正文时的占位文案(如「暂无版本介绍」);有 releaseNote 时不显示。 */
|
|
31
|
+
readonly emptyText?: string;
|
|
32
|
+
readonly closeLabel: string;
|
|
15
33
|
readonly onClose: () => void;
|
|
16
|
-
readonly onInstall: () => void;
|
|
17
34
|
readonly overlayRef: RefObject<HTMLDivElement | null>;
|
|
35
|
+
/** 底部唯一的悬浮按钮;省略时不显示底栏,只能用右上角的关闭按钮离开。 */
|
|
36
|
+
readonly primary?: UpdateRestartDialogAction;
|
|
18
37
|
readonly releaseNote?: string;
|
|
38
|
+
/** 跨多个版本更新时更早的各版说明(从新到旧),逐版折叠,点开才显示正文。 */
|
|
39
|
+
readonly earlierReleaseNotes?: ReadonlyArray<UpdateRestartDialogEarlierNote>;
|
|
40
|
+
/** 「更早的版本」分组标题,有 earlierReleaseNotes 时显示。 */
|
|
41
|
+
readonly earlierTitle?: string;
|
|
42
|
+
/** 正文末尾的「查看全部更新记录」链接。 */
|
|
43
|
+
readonly viewAll?: UpdateRestartDialogAction;
|
|
44
|
+
readonly status?: UpdateRestartDialogStatus;
|
|
45
|
+
readonly subtitle?: string;
|
|
46
|
+
readonly title: string;
|
|
19
47
|
readonly visible: boolean;
|
|
48
|
+
/** 正文正在加载(版本介绍从磁盘读取时)。 */
|
|
49
|
+
readonly loading?: boolean;
|
|
20
50
|
}
|
|
21
51
|
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
"
|
|
25
|
-
const buttonSm =
|
|
26
|
-
"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem]";
|
|
52
|
+
// 底部主按钮:通栏胶囊,悬浮在正文之上。
|
|
53
|
+
const pillClass =
|
|
54
|
+
"pointer-events-auto 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 disabled:pointer-events-none disabled:opacity-50";
|
|
27
55
|
|
|
28
56
|
export function UpdateRestartDialogView({
|
|
29
|
-
|
|
57
|
+
bannerSrc,
|
|
58
|
+
closeLabel,
|
|
59
|
+
earlierReleaseNotes,
|
|
60
|
+
earlierTitle,
|
|
61
|
+
emptyText,
|
|
62
|
+
loading = false,
|
|
30
63
|
onClose,
|
|
31
|
-
onInstall,
|
|
32
64
|
overlayRef,
|
|
65
|
+
primary,
|
|
33
66
|
releaseNote,
|
|
67
|
+
status,
|
|
68
|
+
subtitle,
|
|
69
|
+
title,
|
|
70
|
+
viewAll,
|
|
34
71
|
visible,
|
|
35
72
|
}: UpdateRestartDialogViewProps): JSX.Element {
|
|
73
|
+
// 滚动后才显示顶部渐隐,初始位置横幅完整露出。
|
|
74
|
+
const [scrolled, setScrolled] = useState(false);
|
|
75
|
+
// 关闭后再打开,滚动位置回到顶部,渐隐也要复位。
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!visible) setScrolled(false);
|
|
78
|
+
}, [visible]);
|
|
79
|
+
const showEmpty = !loading && !releaseNote && !!emptyText;
|
|
80
|
+
|
|
36
81
|
return (
|
|
37
82
|
<AnimatePresence>
|
|
38
83
|
{visible && (
|
|
@@ -42,61 +87,116 @@ export function UpdateRestartDialogView({
|
|
|
42
87
|
animate={{ opacity: 1 }}
|
|
43
88
|
exit={{ opacity: 0 }}
|
|
44
89
|
transition={{ duration: 0.15 }}
|
|
45
|
-
className="fixed inset-0 z-[100] flex items-center justify-center
|
|
90
|
+
className={cn("pointer-events-auto fixed inset-0 z-[100] flex items-center justify-center", OVERLAY_BACKDROP_CLASS)}
|
|
46
91
|
onClick={(e) => {
|
|
47
92
|
if (e.target === overlayRef.current) onClose();
|
|
48
93
|
}}
|
|
49
94
|
>
|
|
50
95
|
<motion.div
|
|
96
|
+
role="dialog"
|
|
97
|
+
aria-modal="true"
|
|
98
|
+
aria-label={title}
|
|
51
99
|
initial={{ opacity: 0, scale: 0.95 }}
|
|
52
100
|
animate={{ opacity: 1, scale: 1 }}
|
|
53
101
|
exit={{ opacity: 0, scale: 0.95 }}
|
|
54
102
|
transition={{ duration: 0.15, ease: [0.25, 0.1, 0.25, 1] }}
|
|
55
|
-
className=
|
|
103
|
+
className={cn(
|
|
104
|
+
"relative flex max-h-[min(720px,calc(100vh-48px))] w-[min(600px,calc(100vw-32px))] flex-col overflow-hidden rounded-3xl bg-popover",
|
|
105
|
+
PANEL_SHADOW_CLASS,
|
|
106
|
+
)}
|
|
56
107
|
>
|
|
57
108
|
<ThemeSurface slot="root.updateRestartDialog.panel" />
|
|
58
|
-
<div className="relative z-10
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
109
|
+
<div className="relative z-10 flex min-h-0 flex-1 flex-col">
|
|
110
|
+
<button
|
|
111
|
+
type="button"
|
|
112
|
+
onClick={onClose}
|
|
113
|
+
aria-label={closeLabel}
|
|
114
|
+
// 纯白圆形:深浅色下都不随主题变色,靠双层投影从横幅和正文上浮起来。
|
|
115
|
+
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"
|
|
116
|
+
>
|
|
117
|
+
<span className="icon-[mdi--close] h-4 w-4" />
|
|
118
|
+
</button>
|
|
119
|
+
<div className="relative flex min-h-0 flex-1 flex-col">
|
|
120
|
+
<div
|
|
121
|
+
// no-scrollbar:全局 overlay 滚动条规则无 layer,Tailwind 的隐藏写法压不过它。
|
|
122
|
+
className="no-scrollbar min-h-0 flex-1 overflow-y-auto"
|
|
123
|
+
onScroll={(e) => setScrolled(e.currentTarget.scrollTop > 4)}
|
|
124
|
+
>
|
|
125
|
+
<img
|
|
126
|
+
src={bannerSrc}
|
|
127
|
+
alt=""
|
|
128
|
+
draggable={false}
|
|
129
|
+
className="h-[176px] w-full object-cover select-none"
|
|
130
|
+
/>
|
|
131
|
+
<div className={cn("px-7 pt-6", primary ? "pb-32" : "pb-12")}>
|
|
132
|
+
<h3 className="text-[19px] leading-snug font-semibold tracking-tight text-foreground">{title}</h3>
|
|
133
|
+
{subtitle && <p className="mt-1.5 text-[13px] leading-relaxed text-muted-foreground">{subtitle}</p>}
|
|
134
|
+
{status && <StatusLine status={status} />}
|
|
135
|
+
{releaseNote && (
|
|
136
|
+
<div className="mt-5">
|
|
137
|
+
<div className="markdown-body text-[13px] leading-[1.6] break-words text-muted-foreground">
|
|
138
|
+
<ReleaseNoteMarkdown>{releaseNote}</ReleaseNoteMarkdown>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
{earlierReleaseNotes && earlierReleaseNotes.length > 0 && (
|
|
143
|
+
<div className="mt-7">
|
|
144
|
+
{earlierTitle && (
|
|
145
|
+
<p className="text-[12px] font-medium text-muted-foreground/80">{earlierTitle}</p>
|
|
146
|
+
)}
|
|
147
|
+
<div className="mt-2 divide-y divide-border/60 overflow-hidden rounded-xl border border-border/60">
|
|
148
|
+
{earlierReleaseNotes.map((item) => (
|
|
149
|
+
<EarlierReleaseNote key={item.id} item={item} />
|
|
150
|
+
))}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
154
|
+
{viewAll && (
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
onClick={viewAll.onClick}
|
|
158
|
+
disabled={viewAll.disabled}
|
|
159
|
+
className="mt-4 inline-flex items-center gap-1 rounded-sm text-[13px] text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50"
|
|
160
|
+
>
|
|
161
|
+
{viewAll.label}
|
|
162
|
+
<span className="icon-[mdi--open-in-new] h-3.5 w-3.5" />
|
|
163
|
+
</button>
|
|
164
|
+
)}
|
|
165
|
+
{loading && (
|
|
166
|
+
<div className="mt-5 flex items-center gap-2 text-[13px] text-muted-foreground">
|
|
167
|
+
<span className="icon-[mdi--loading] h-4 w-4 animate-spin" />
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
{showEmpty && <p className="mt-5 text-[13px] text-muted-foreground">{emptyText}</p>}
|
|
171
|
+
</div>
|
|
69
172
|
</div>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<button
|
|
73
|
-
type="button"
|
|
74
|
-
data-slot="button"
|
|
75
|
-
data-variant="ghost"
|
|
76
|
-
data-size="sm"
|
|
173
|
+
<div
|
|
174
|
+
aria-hidden
|
|
77
175
|
className={cn(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"text-muted-foreground hover:bg-accent/50 hover:text-foreground",
|
|
176
|
+
"pointer-events-none absolute inset-x-0 top-0 h-12 bg-gradient-to-b from-popover to-transparent transition-opacity duration-150",
|
|
177
|
+
scrolled ? "opacity-100" : "opacity-0",
|
|
81
178
|
)}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</button>
|
|
86
|
-
<button
|
|
87
|
-
type="button"
|
|
88
|
-
data-slot="button"
|
|
89
|
-
data-variant="primary"
|
|
90
|
-
data-size="sm"
|
|
179
|
+
/>
|
|
180
|
+
{/* 底部渐隐常驻:有按钮时更厚(按钮下方一段是实色),没按钮时只是一道薄薄的收边。 */}
|
|
181
|
+
<div
|
|
91
182
|
className={cn(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
183
|
+
"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-popover",
|
|
184
|
+
primary
|
|
185
|
+
? "via-popover/90 from-[55%] to-transparent px-7 pt-20 pb-7"
|
|
186
|
+
: "h-10 to-transparent",
|
|
95
187
|
)}
|
|
96
|
-
onClick={onInstall}
|
|
97
188
|
>
|
|
98
|
-
{
|
|
99
|
-
|
|
189
|
+
{primary && (
|
|
190
|
+
<button
|
|
191
|
+
type="button"
|
|
192
|
+
onClick={primary.onClick}
|
|
193
|
+
disabled={primary.disabled}
|
|
194
|
+
className={pillClass}
|
|
195
|
+
>
|
|
196
|
+
{primary.label}
|
|
197
|
+
</button>
|
|
198
|
+
)}
|
|
199
|
+
</div>
|
|
100
200
|
</div>
|
|
101
201
|
</div>
|
|
102
202
|
</motion.div>
|
|
@@ -105,3 +205,53 @@ export function UpdateRestartDialogView({
|
|
|
105
205
|
</AnimatePresence>
|
|
106
206
|
);
|
|
107
207
|
}
|
|
208
|
+
|
|
209
|
+
function EarlierReleaseNote({ item }: { readonly item: UpdateRestartDialogEarlierNote }): JSX.Element {
|
|
210
|
+
const [open, setOpen] = useState(false);
|
|
211
|
+
return (
|
|
212
|
+
<div>
|
|
213
|
+
<button
|
|
214
|
+
type="button"
|
|
215
|
+
aria-expanded={open}
|
|
216
|
+
onClick={() => setOpen((value) => !value)}
|
|
217
|
+
className="flex w-full items-center justify-between gap-3 px-4 py-2.5 text-left text-[13px] font-medium text-foreground outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50"
|
|
218
|
+
>
|
|
219
|
+
{item.title}
|
|
220
|
+
<span
|
|
221
|
+
className={cn(
|
|
222
|
+
"icon-[mdi--chevron-down] h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-150",
|
|
223
|
+
open && "rotate-180",
|
|
224
|
+
)}
|
|
225
|
+
/>
|
|
226
|
+
</button>
|
|
227
|
+
{open && (
|
|
228
|
+
<div className="markdown-body px-4 pt-1 pb-4 text-[13px] leading-[1.6] break-words text-muted-foreground">
|
|
229
|
+
<ReleaseNoteMarkdown>{item.note}</ReleaseNoteMarkdown>
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function StatusLine({ status }: { readonly status: UpdateRestartDialogStatus }): JSX.Element {
|
|
237
|
+
if (status.kind === "progress") {
|
|
238
|
+
const percent = Math.max(0, Math.min(100, Math.round(status.progress * 100)));
|
|
239
|
+
return (
|
|
240
|
+
<div className="mt-4">
|
|
241
|
+
<div className="h-1.5 w-full overflow-hidden rounded-full bg-muted">
|
|
242
|
+
<div className="h-full rounded-full bg-primary transition-[width] duration-300" style={{ width: `${percent}%` }} />
|
|
243
|
+
</div>
|
|
244
|
+
<p className="mt-2 text-[12px] text-muted-foreground">{status.text}</p>
|
|
245
|
+
</div>
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
if (status.kind === "checking") {
|
|
249
|
+
return (
|
|
250
|
+
<p className="mt-4 flex items-center gap-2 text-[13px] text-muted-foreground">
|
|
251
|
+
<span className="icon-[mdi--loading] h-4 w-4 animate-spin" />
|
|
252
|
+
{status.text}
|
|
253
|
+
</p>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return <p className="mt-4 text-[13px] break-words text-destructive">{status.text}</p>;
|
|
257
|
+
}
|
|
Binary file
|
|
@@ -20,6 +20,16 @@ export interface CommandMenuItemView {
|
|
|
20
20
|
/** iconify 类名,例如 `icon-[solar--folder-linear]`。 */
|
|
21
21
|
readonly icon: string;
|
|
22
22
|
readonly badge?: string;
|
|
23
|
+
/** badge 的色调:accent 用主题强调色(如「技能」),默认是中性灰。 */
|
|
24
|
+
readonly badgeTone?: "neutral" | "accent";
|
|
25
|
+
/**
|
|
26
|
+
* 会话的进行中状态:有值时行首图标换成与侧栏一致的状态图标,并在行尾显示 statusLabel。
|
|
27
|
+
* waiting 指会话正等着用户处理(提问 / 审批 / 询问 / 授权);unread 指一轮已跑完、用户还没打开看。
|
|
28
|
+
*/
|
|
29
|
+
readonly status?: "running" | "waiting" | "unread";
|
|
30
|
+
readonly statusLabel?: string;
|
|
31
|
+
/** 行尾的标签色点(管理会话用),按给定顺序排列。 */
|
|
32
|
+
readonly tagColors?: readonly string[];
|
|
23
33
|
/** 命中了但当前打不开(例如无权限的会话):显示但禁用,不静默过滤。 */
|
|
24
34
|
readonly disabled?: boolean;
|
|
25
35
|
readonly disabledReason?: string;
|
|
@@ -41,7 +51,11 @@ export interface CommandMenuViewLabels {
|
|
|
41
51
|
readonly emptyHint: string;
|
|
42
52
|
readonly loading: string;
|
|
43
53
|
readonly title: string;
|
|
44
|
-
|
|
54
|
+
/** 右下角操作按钮组的无障碍名称。 */
|
|
55
|
+
readonly actionsLabel: string;
|
|
56
|
+
/** 左下角「新会话」按钮文案。 */
|
|
57
|
+
readonly newSession: string;
|
|
58
|
+
/** 按钮文案只写动作(「打开」),键帽由视图按平台渲染。 */
|
|
45
59
|
readonly hintSelect: string;
|
|
46
60
|
readonly hintClose: string;
|
|
47
61
|
}
|
|
@@ -39,27 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/* 输入框聚焦时下沿的一次性点亮,收束后保持静止。 */
|
|
43
|
-
.command-menu-input-underline {
|
|
44
|
-
transform-origin: center;
|
|
45
|
-
animation: command-menu-underline-in 240ms cubic-bezier(0.25, 0.1, 0.25, 1) 1 both;
|
|
46
|
-
will-change: transform, opacity;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes command-menu-underline-in {
|
|
50
|
-
from {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
transform: scaleX(0.6);
|
|
53
|
-
}
|
|
54
|
-
to {
|
|
55
|
-
opacity: 1;
|
|
56
|
-
transform: scaleX(1);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
42
|
@media (prefers-reduced-motion: reduce) {
|
|
61
|
-
.command-menu-sheen::after
|
|
62
|
-
.command-menu-input-underline {
|
|
43
|
+
.command-menu-sheen::after {
|
|
63
44
|
animation: none;
|
|
64
45
|
}
|
|
65
46
|
|