@vetta-org/theme-ui 0.1.1 → 0.1.2

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.
Files changed (301) hide show
  1. package/package.json +733 -5
  2. package/src/action-approval/AppearanceActionPickerView.tsx +2 -78
  3. package/src/action-approval/AppearanceApprovalDrawerView.tsx +2 -9
  4. package/src/action-approval/BatchTasksApprovalFrameView.tsx +4 -1
  5. package/src/action-approval/GenericActionApprovalView.tsx +2 -9
  6. package/src/action-approval/ManageActionApprovalFrameView.tsx +4 -1
  7. package/src/action-approval/NavigationOpenApprovalView.tsx +2 -9
  8. package/src/action-approval/SchedulerActionApprovalDialogView.tsx +3 -1
  9. package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +3 -10
  10. package/src/action-approval/index.ts +0 -1
  11. package/src/activity/ActivityPanel.tsx +13 -10
  12. package/src/activity/ActivityPanelFrame.test.tsx +32 -0
  13. package/src/activity/ActivityPanelFrame.tsx +3 -2
  14. package/src/activity/BackgroundTasksTabPanelView.tsx +1 -1
  15. package/src/activity/BrowserPanelView.tsx +48 -49
  16. package/src/activity/DebugTabPanelView.tsx +1 -1
  17. package/src/activity/MarkdownPreviewView.tsx +56 -59
  18. package/src/activity/PluginTabPickerView.tsx +5 -3
  19. package/src/activity/PortsTabPanelView.tsx +911 -0
  20. package/src/activity/ToolCallsSubTabView.tsx +1 -1
  21. package/src/activity/WorkflowTabPanelView.tsx +1 -1
  22. package/src/activity/index.ts +9 -0
  23. package/src/app/AppBackground.tsx +1 -1
  24. package/src/app/AppBootLoadingView.tsx +4 -2
  25. package/src/app-shell/DefaultWindowControls.tsx +1 -1
  26. package/src/app-shell/PageHeaderActionGroup.tsx +1 -1
  27. package/src/app-shell/PageHeaderContent.tsx +36 -7
  28. package/src/app-shell/PageHeaderFrame.tsx +15 -3
  29. package/src/app-shell/PageHeaderSidebarTrigger.tsx +1 -1
  30. package/src/app-shell/PageHeaderTitle.tsx +1 -1
  31. package/src/app-shell/WindowControlButton.tsx +1 -1
  32. package/src/app-shell/header-crowding.test.ts +62 -0
  33. package/src/app-shell/header-crowding.tsx +137 -0
  34. package/src/appearance/BackgroundImageFrame.tsx +1 -1
  35. package/src/appearance/CenterSliceImageFrame.tsx +1 -1
  36. package/src/appearance/CornerImageFrame.tsx +1 -1
  37. package/src/appearance/HorizontalSliceImageFrame.tsx +1 -1
  38. package/src/appearance/NineSliceImageFrame.tsx +1 -1
  39. package/src/appearance/ThemeSurface.tsx +1 -1
  40. package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +2 -1
  41. package/src/batch-tasks/BatchTaskProjectActionsView.test.tsx +97 -0
  42. package/src/batch-tasks/BatchTaskProjectActionsView.tsx +45 -35
  43. package/src/batch-tasks/batchTaskUi.tsx +0 -29
  44. package/src/bottom-panel/BottomPanelView.test.tsx +43 -0
  45. package/src/bottom-panel/BottomPanelView.tsx +222 -0
  46. package/src/bottom-panel/index.ts +26 -0
  47. package/src/chat/AgentAvatarView.tsx +1 -1
  48. package/src/chat/AnnotationViews.tsx +107 -0
  49. package/src/chat/AskUserQuestionView.tsx +18 -11
  50. package/src/chat/AssistantMessageView.tsx +48 -13
  51. package/src/chat/AtPanelView.test.tsx +61 -0
  52. package/src/chat/AtPanelView.tsx +63 -38
  53. package/src/chat/BashTerminalCard.tsx +1 -2
  54. package/src/chat/ChatHeaderActionsView.tsx +74 -18
  55. package/src/chat/CompactionStepView.test.tsx +34 -0
  56. package/src/chat/CompactionStepView.tsx +85 -0
  57. package/src/chat/ExecutionModeSelectorView.tsx +20 -5
  58. package/src/chat/HeaderActionBarView.tsx +731 -0
  59. package/src/chat/HeaderActionOverflowMenu.tsx +137 -0
  60. package/src/chat/InlineModelPicker.test.tsx +81 -0
  61. package/src/chat/InlineModelPicker.tsx +201 -0
  62. package/src/chat/InlineTokenChip.tsx +2 -68
  63. package/src/chat/InputBarBackground.tsx +1 -1
  64. package/src/chat/InputBarPlaceholder.tsx +26 -3
  65. package/src/chat/LiveThinkingView.tsx +51 -37
  66. package/src/chat/MessageBoundaryViews.tsx +21 -0
  67. package/src/chat/MessageFeedContext.tsx +13 -5
  68. package/src/chat/MessageFeedLayoutView.tsx +28 -3
  69. package/src/chat/MessageFeedView.test.tsx +81 -0
  70. package/src/chat/MessageFeedView.tsx +72 -152
  71. package/src/chat/MessageInputView.tsx +1 -1
  72. package/src/chat/MessageLayoutView.tsx +1 -1
  73. package/src/chat/MessageSelectionContextMenuView.tsx +4 -1
  74. package/src/chat/MessageTimelineView.tsx +1 -1
  75. package/src/chat/MessageView.tsx +1 -1
  76. package/src/chat/MessageVisualView.tsx +1 -1
  77. package/src/chat/ModelConfiguration.tsx +283 -0
  78. package/src/chat/ModelSelectorTrigger.tsx +63 -0
  79. package/src/chat/ModelSelectorView.tsx +1037 -223
  80. package/src/chat/NewSession.ts +1 -37
  81. package/src/chat/NewSessionPicker.tsx +3 -2
  82. package/src/chat/ProjectSelectorView.tsx +3 -2
  83. package/src/chat/ReasoningStepSlider.tsx +61 -0
  84. package/src/chat/RemoteSessionBadgeView.tsx +24 -0
  85. package/src/chat/SkillPromptAreaView.tsx +5 -19
  86. package/src/chat/TeamMemberReplyCardView.test.tsx +33 -0
  87. package/src/chat/TeamMemberReplyCardView.tsx +133 -0
  88. package/src/chat/TextBlockView.tsx +7 -770
  89. package/src/chat/TodoProgress.tsx +25 -53
  90. package/src/chat/TodoStatusBarView.tsx +14 -5
  91. package/src/chat/UserMessageView.tsx +113 -33
  92. package/src/chat/header-action-narrow.test.ts +21 -0
  93. package/src/chat/header-action-narrow.ts +38 -0
  94. package/src/chat/index.ts +32 -27
  95. package/src/chat/markdown-link.ts +7 -279
  96. package/src/chat/send-button.css +4 -22
  97. package/src/chat/streaming-reveal.test.ts +218 -0
  98. package/src/chat/streaming-reveal.ts +13 -0
  99. package/src/file-explorer/ConfirmDeleteDialogView.tsx +2 -1
  100. package/src/file-explorer/FileContextMenuView.tsx +44 -11
  101. package/src/file-explorer/FileExplorerSettingsView.tsx +97 -0
  102. package/src/file-explorer/FileTreeCreateRow.tsx +1 -1
  103. package/src/file-explorer/FileTreeNodeView.tsx +59 -18
  104. package/src/file-explorer/FileTreeView.tsx +236 -129
  105. package/src/file-explorer/file-tree-dom.ts +23 -0
  106. package/src/file-explorer/file-tree-rows.test.ts +74 -0
  107. package/src/file-explorer/file-tree-rows.ts +168 -0
  108. package/src/file-explorer/index.ts +17 -0
  109. package/src/file-explorer/types.ts +3 -0
  110. package/src/file-explorer/useFileTreeMarqueeSelection.ts +24 -16
  111. package/src/file-preview/FilePreviewDialogView.tsx +2 -2
  112. package/src/file-preview/FilePreviewView.tsx +12 -2
  113. package/src/file-preview/TextFileEditorView.tsx +2 -1
  114. package/src/index.ts +1 -0
  115. package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +1 -1
  116. package/src/layout/AppFrame.tsx +3 -2
  117. package/src/layout/MainContentFrame.tsx +7 -2
  118. package/src/layout/ResizeHandle.tsx +68 -17
  119. package/src/layout/SidebarDock.tsx +75 -19
  120. package/src/layout/SidebarOverlay.tsx +1 -1
  121. package/src/layout/index.ts +1 -1
  122. package/src/layout/resize-handle-axis.test.ts +51 -0
  123. package/src/live-indicators.test.ts +43 -0
  124. package/src/markdown/CodeBlock.tsx +123 -0
  125. package/src/markdown/InlineTokenChip.tsx +68 -0
  126. package/src/markdown/MarkdownContent.tsx +411 -0
  127. package/src/markdown/MarkdownImage.tsx +51 -0
  128. package/src/markdown/MathFormula.tsx +46 -0
  129. package/src/markdown/MermaidBlock.tsx +43 -0
  130. package/src/markdown/RichCodeBlock.tsx +127 -0
  131. package/src/markdown/SvgPreview.tsx +45 -0
  132. package/src/markdown/WebsiteIcon.tsx +94 -0
  133. package/src/markdown/builtin-renderers.tsx +43 -0
  134. package/src/markdown/definition.tsx +49 -0
  135. package/src/markdown/host.tsx +18 -0
  136. package/src/markdown/index.ts +11 -0
  137. package/src/markdown/inline-tokens.ts +187 -0
  138. package/src/markdown/markdown-link.ts +279 -0
  139. package/src/markdown/math-client.ts +116 -0
  140. package/src/markdown/math-render.ts +23 -0
  141. package/src/markdown/math-syntax.ts +80 -0
  142. package/src/markdown/math.worker.ts +16 -0
  143. package/src/markdown/nodes.ts +15 -0
  144. package/src/markdown/preview-policy.ts +43 -0
  145. package/src/markdown/rich-labels.ts +49 -0
  146. package/src/markdown/rich-syntax.ts +93 -0
  147. package/src/markdown/stable-blocks.test.ts +90 -0
  148. package/src/markdown/stable-blocks.ts +124 -0
  149. package/src/markdown/streaming-reveal.ts +297 -0
  150. package/src/markdown/streaming.test.ts +57 -0
  151. package/src/markdown/streaming.ts +211 -0
  152. package/src/markdown/use-render-snapshot.ts +24 -0
  153. package/src/markdown/use-rich-visibility.ts +24 -0
  154. package/src/overlays/CommandMenuRow.tsx +38 -9
  155. package/src/overlays/CommandMenuView.tsx +77 -117
  156. package/src/overlays/ConfirmDialogView.tsx +25 -20
  157. package/src/overlays/ReleaseNoteMarkdown.tsx +29 -0
  158. package/src/overlays/SplashOptionRow.tsx +46 -0
  159. package/src/overlays/SplashPanel.tsx +85 -0
  160. package/src/overlays/SplashParts.tsx +213 -0
  161. package/src/overlays/UpdateCheckerView.tsx +34 -18
  162. package/src/overlays/UpdateRestartDialogView.tsx +139 -54
  163. package/src/overlays/command-menu-types.ts +2 -0
  164. package/src/overlays/command-menu.css +1 -20
  165. package/src/overlays/index.ts +14 -1
  166. package/src/plugin-ui/index.ts +8 -0
  167. package/src/project/ConversationTagDotsView.tsx +1 -1
  168. package/src/project/ConversationTagEditorDialogView.tsx +4 -1
  169. package/src/project/DefaultConversationSectionView.tsx +4 -4
  170. package/src/project/DefaultSessionListView.tsx +5 -31
  171. package/src/project/DefaultSessionRowView.tsx +106 -55
  172. package/src/project/ManageSessionsSplashView.tsx +439 -0
  173. package/src/project/NewProjectDialogView.tsx +3 -10
  174. package/src/project/ProjectContextMenuView.tsx +30 -139
  175. package/src/project/ProjectDetailPageView.test.tsx +140 -0
  176. package/src/project/ProjectDetailPageView.tsx +372 -165
  177. package/src/project/ProjectGroupView.tsx +1 -1
  178. package/src/project/ProjectRowView.tsx +29 -12
  179. package/src/project/ProjectSessionsView.tsx +25 -47
  180. package/src/project/QuickScrollOverlay.tsx +1 -1
  181. package/src/project/SessionContextMenuView.tsx +15 -7
  182. package/src/project/SessionRowMoreButton.tsx +50 -0
  183. package/src/project/SessionRowView.tsx +106 -63
  184. package/src/project/SessionTitleMarquee.tsx +54 -0
  185. package/src/project/SidebarProjectDisclosure.tsx +60 -0
  186. package/src/project/SidebarProjectsSectionView.tsx +6 -1
  187. package/src/project/index.ts +12 -0
  188. package/src/project/session-row-transition.ts +9 -0
  189. package/src/project/types.ts +4 -2
  190. package/src/project/useActiveSessionAutoScroll.ts +10 -4
  191. package/src/registry.ts +0 -2
  192. package/src/scheduler/AutomationDetailPaneView.tsx +68 -0
  193. package/src/scheduler/AutomationPageView.tsx +118 -121
  194. package/src/scheduler/ExecutionHistoryView.tsx +7 -5
  195. package/src/scheduler/TaskListView.tsx +52 -201
  196. package/src/scheduler/index.ts +7 -12
  197. package/src/settings/AchievementSettingsView.tsx +0 -1
  198. package/src/settings/AppshotSettingsView.tsx +0 -1
  199. package/src/settings/BuiltinMcpSectionView.tsx +1 -1
  200. package/src/settings/EnvironmentGitRowView.tsx +156 -0
  201. package/src/settings/EnvironmentSettingsView.tsx +25 -3
  202. package/src/settings/GeneralSettingsView.tsx +17 -20
  203. package/src/settings/ImChannelGuideDialogView.tsx +2 -2
  204. package/src/settings/ImFeishuDialogView.tsx +1 -1
  205. package/src/settings/ImLegacyImportBannerView.tsx +1 -1
  206. package/src/settings/ImLogDrawerView.tsx +2 -1
  207. package/src/settings/JsonConfigInputView.tsx +171 -0
  208. package/src/settings/ModelsFetchedModelsDrawerView.tsx +292 -0
  209. package/src/settings/ModelsProvidersSectionView.tsx +26 -23
  210. package/src/settings/MotionSelect.tsx +9 -7
  211. package/src/settings/NotificationSettingsView.tsx +79 -0
  212. package/src/settings/PermissionsSettingsView.tsx +3 -7
  213. package/src/settings/PresetProviderModelsListView.tsx +141 -24
  214. package/src/settings/PresetProviderRowView.tsx +205 -182
  215. package/src/settings/ProxySettingsSectionView.tsx +182 -0
  216. package/src/settings/QrBindDialogView.tsx +1 -1
  217. package/src/settings/QuickPanelSettingsSectionView.tsx +0 -2
  218. package/src/settings/RemoteMcpSectionView.tsx +1 -1
  219. package/src/settings/SettingChrome.tsx +2 -2
  220. package/src/settings/SettingsAiAssistButtonView.tsx +9 -119
  221. package/src/settings/SettingsFormFields.tsx +4 -7
  222. package/src/settings/SettingsSidebarView.tsx +64 -3
  223. package/src/settings/ShortcutRecorderView.test.tsx +108 -0
  224. package/src/settings/ShortcutRecorderView.tsx +15 -9
  225. package/src/settings/ShortcutsSettingsView.tsx +1 -1
  226. package/src/settings/SpaceEditorDialogView.tsx +120 -0
  227. package/src/settings/SpacesSettingsView.tsx +105 -0
  228. package/src/settings/WebhookEndpointListView.tsx +4 -5
  229. package/src/settings/index.ts +41 -29
  230. package/src/shared/ActivityStatusDot.tsx +69 -0
  231. package/src/shared/AvatarStackView.tsx +13 -13
  232. package/src/shared/BotAvatar.tsx +11 -9
  233. package/src/shared/CodeBlockCopyButton.tsx +1 -1
  234. package/src/shared/ContextMenuView.tsx +4 -11
  235. package/src/shared/MarkdownTable.tsx +2 -2
  236. package/src/shared/SyntaxHighlightedCode.tsx +0 -0
  237. package/src/shared/TabBar.outline.test.tsx +59 -0
  238. package/src/shared/TabBar.tsx +22 -17
  239. package/src/shared/VettaKbd.test.tsx +52 -0
  240. package/src/shared/VettaKbd.tsx +81 -0
  241. package/src/shared/connected-tab-outline.test.ts +2 -2
  242. package/src/shared/connected-tab-outline.ts +2 -1
  243. package/src/shared/index.ts +6 -0
  244. package/src/shared/kbd-keys.test.ts +61 -0
  245. package/src/shared/kbd-keys.ts +253 -0
  246. package/src/shared/provider-icon/icons.ts +4 -2
  247. package/src/shared/provider-icon/index.tsx +1 -1
  248. package/src/shared/provider-icon/magpie.svg +1 -0
  249. package/src/sidebar/AddProjectMenuTriggerView.tsx +25 -15
  250. package/src/sidebar/DefaultSidebar.tsx +3 -1
  251. package/src/sidebar/MessageCenterDialogView.tsx +3 -2
  252. package/src/sidebar/MessageCenterEmptyState.tsx +1 -1
  253. package/src/sidebar/MessageCenterTabs.tsx +1 -1
  254. package/src/sidebar/MessageCenterToolbarButton.tsx +1 -1
  255. package/src/sidebar/MessageCenterTriggerView.tsx +2 -2
  256. package/src/sidebar/ProjectsPanelEmptyState.tsx +26 -7
  257. package/src/sidebar/SessionStatusIcon.tsx +16 -1
  258. package/src/sidebar/SettingsMenuThemeSection.tsx +1 -1
  259. package/src/sidebar/SettingsMenuTriggerView.test.tsx +42 -0
  260. package/src/sidebar/SettingsMenuTriggerView.tsx +28 -50
  261. package/src/sidebar/ShowMoreSessionsButton.tsx +1 -1
  262. package/src/sidebar/SidebarFilterSelectView.tsx +8 -16
  263. package/src/sidebar/SidebarNavBadgeView.tsx +1 -1
  264. package/src/sidebar/SidebarNavIcon.tsx +1 -1
  265. package/src/sidebar/SidebarNavItemButton.tsx +1 -1
  266. package/src/sidebar/SidebarNavMorePanel.tsx +19 -7
  267. package/src/sidebar/SidebarNavigation.tsx +24 -15
  268. package/src/sidebar/SidebarPanel.tsx +11 -2
  269. package/src/sidebar/SidebarSectionTriggerLabel.tsx +20 -0
  270. package/src/sidebar/SidebarTopBar.tsx +10 -7
  271. package/src/sidebar/WaitingPulseBadge.tsx +19 -0
  272. package/src/sidebar/index.ts +1 -16
  273. package/src/skills/index.ts +0 -19
  274. package/src/skills/skill-icon.tsx +4 -8
  275. package/src/styles.css +24 -6
  276. package/src/chat/DefaultSceneCarousel.tsx +0 -113
  277. package/src/chat/SceneCard.tsx +0 -138
  278. package/src/scheduler/HistoryDrawerView.tsx +0 -149
  279. package/src/scheduler/TaskFormDialogView.tsx +0 -60
  280. package/src/settings/SubscriptionActionsView.tsx +0 -63
  281. package/src/settings/SubscriptionCardsView.tsx +0 -212
  282. package/src/settings/TeamDetailView.tsx +0 -148
  283. package/src/settings/TeamDialogsView.tsx +0 -151
  284. package/src/settings/TeamListView.tsx +0 -57
  285. package/src/settings/TeamSettingsView.tsx +0 -51
  286. package/src/settings/TokenActivityChartView.tsx +0 -286
  287. package/src/settings/UsageStatsView.tsx +0 -101
  288. package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +0 -135
  289. package/src/settings/shouldCloseEmptyApiKeyEditor.ts +0 -40
  290. package/src/settings/token-activity.test.ts +0 -195
  291. package/src/settings/token-activity.ts +0 -320
  292. package/src/sidebar/AddProjectMenuItem.tsx +0 -21
  293. package/src/sidebar/AddProjectMenuPopoverView.tsx +0 -52
  294. package/src/sidebar/NotificationMessageListView.tsx +0 -136
  295. package/src/sidebar/SettingsMenuAccountSection.tsx +0 -32
  296. package/src/sidebar/SettingsMenuQuotaSection.tsx +0 -45
  297. package/src/skills/SceneCardView.tsx +0 -194
  298. package/src/skills/SkillCardView.tsx +0 -186
  299. package/src/skills/SkillDetailDialogView.tsx +0 -138
  300. package/src/skills/SkillTagGroupView.tsx +0 -56
  301. package/src/skills/SkillToggleSwitch.tsx +0 -31
@@ -0,0 +1,29 @@
1
+ import type { JSX } from "react";
2
+ import ReactMarkdown, { type Components } from "react-markdown";
3
+ import remarkGfm from "remark-gfm";
4
+
5
+ /** 更新日志的排版:标题、列表、行内代码要有层次和间距,不依赖宿主的 markdown 样式。 */
6
+ const releaseNoteComponents: Components = {
7
+ h1: ({ children }) => <h1 className="mb-2 text-[14px] font-semibold text-foreground">{children}</h1>,
8
+ h2: ({ children }) => (
9
+ <h2 className="mb-1.5 mt-4 text-[13px] font-semibold text-foreground first:mt-0">{children}</h2>
10
+ ),
11
+ h3: ({ children }) => <h3 className="mb-1 mt-3 text-[12.5px] font-semibold text-foreground">{children}</h3>,
12
+ p: ({ children }) => <p className="my-1.5">{children}</p>,
13
+ ul: ({ children }) => <ul className="my-1.5 list-disc space-y-1.5 pl-5">{children}</ul>,
14
+ ol: ({ children }) => <ol className="my-1.5 list-decimal space-y-1.5 pl-5">{children}</ol>,
15
+ li: ({ children }) => <li className="pl-0.5">{children}</li>,
16
+ strong: ({ children }) => <strong className="font-semibold text-foreground">{children}</strong>,
17
+ code: ({ children }) => (
18
+ <code className="rounded bg-muted px-1 py-0.5 font-mono text-[11.5px] text-foreground">{children}</code>
19
+ ),
20
+ };
21
+
22
+ /** 更新日志的 Markdown 渲染:设置页预览与更新弹窗共用。 */
23
+ export function ReleaseNoteMarkdown({ children }: { readonly children: string }): JSX.Element {
24
+ return (
25
+ <ReactMarkdown remarkPlugins={[remarkGfm]} components={releaseNoteComponents}>
26
+ {children}
27
+ </ReactMarkdown>
28
+ );
29
+ }
@@ -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, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
7
+
8
+ /**
9
+ * 居中偏上的 Splash 面板外壳:遮罩 + 入场动效 + 高光边 + 主题 surface 槽位。
10
+ * ⌘K 命令面板与「添加项目」这类选项面板共用这一份,样式只在这里改一次。
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
+ // 不用边框线,靠柔和的大半径投影把面板托起来(与 Dialog 共用 PANEL_SHADOW_CLASS)。
71
+ className={cn("command-menu-sheen relative flex flex-col rounded-2xl bg-popover", PANEL_SHADOW_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
+ }
@@ -0,0 +1,213 @@
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
+
58
+ export function SplashInputHeader({
59
+ icon,
60
+ value,
61
+ placeholder,
62
+ label,
63
+ onChange,
64
+ onSubmit,
65
+ onBack,
66
+ backLabel,
67
+ disabled,
68
+ invalid,
69
+ inputRef,
70
+ inputProps,
71
+ autoFocus = true,
72
+ }: SplashInputHeaderProps): JSX.Element {
73
+ const ownRef = useRef<HTMLInputElement | null>(null);
74
+ const ref = inputRef ?? ownRef;
75
+ // 中日文输入法:确认候选词的那下 Enter,keydown 与 compositionend 的先后各引擎不一致,
76
+ // 所以除了 isComposing 再用 compositionend 之后的一小段时间兜底。
77
+ const composingRef = useRef(false);
78
+ const composedAtRef = useRef(0);
79
+
80
+ useEffect(() => {
81
+ if (!autoFocus) return;
82
+ const frame = requestAnimationFrame(() => ref.current?.focus());
83
+ return () => cancelAnimationFrame(frame);
84
+ }, [autoFocus, ref]);
85
+
86
+ return (
87
+ <div className={HEADER_CLASS}>
88
+ {onBack ? (
89
+ <BackButton label={backLabel ?? ""} onClick={onBack} />
90
+ ) : (
91
+ <span aria-hidden="true" className={cn(icon, "size-4 shrink-0 text-muted-foreground")} />
92
+ )}
93
+ <input
94
+ {...inputProps}
95
+ ref={ref}
96
+ type="text"
97
+ autoComplete="off"
98
+ spellCheck={false}
99
+ aria-label={label}
100
+ aria-invalid={invalid || undefined}
101
+ disabled={disabled}
102
+ value={value}
103
+ placeholder={placeholder}
104
+ onChange={(event) => onChange(event.target.value)}
105
+ onCompositionStart={() => {
106
+ composingRef.current = true;
107
+ }}
108
+ onCompositionEnd={() => {
109
+ composingRef.current = false;
110
+ composedAtRef.current = Date.now();
111
+ }}
112
+ onKeyDown={(event) => {
113
+ inputProps?.onKeyDown?.(event);
114
+ if (event.key !== "Enter" || !onSubmit) return;
115
+ if (composingRef.current || event.nativeEvent.isComposing || Date.now() - composedAtRef.current < 80) {
116
+ return;
117
+ }
118
+ onSubmit();
119
+ }}
120
+ className="min-w-0 flex-1 bg-transparent text-[14px] text-foreground outline-none placeholder:text-muted-foreground/70 disabled:opacity-60"
121
+ />
122
+ </div>
123
+ );
124
+ }
125
+
126
+ export interface SplashTitleHeaderProps {
127
+ readonly title: string;
128
+ readonly onBack?: () => void;
129
+ readonly backLabel?: string;
130
+ /** 标题右侧的附加内容,例如当前路径。 */
131
+ readonly trailing?: ReactNode;
132
+ /** title 是面板的标题(大而粗);plain 用于路径之类的辅助信息,保持常规字重。 */
133
+ readonly variant?: "title" | "plain";
134
+ }
135
+
136
+ /** 没有输入框的步骤用它做头部:与输入头部同高同位,切步骤时外壳不跳。 */
137
+ export function SplashTitleHeader({
138
+ title,
139
+ onBack,
140
+ backLabel,
141
+ trailing,
142
+ variant = "title",
143
+ }: SplashTitleHeaderProps): JSX.Element {
144
+ return (
145
+ <div className={HEADER_CLASS}>
146
+ {onBack && <BackButton label={backLabel ?? ""} onClick={onBack} />}
147
+ <span
148
+ className={cn(
149
+ "min-w-0 flex-1 truncate text-foreground",
150
+ variant === "title" ? "text-[17px] font-semibold tracking-tight" : "text-[14px]",
151
+ )}
152
+ >
153
+ {title}
154
+ </span>
155
+ {trailing}
156
+ </div>
157
+ );
158
+ }
159
+
160
+ /** 底栏:快捷键提示或主操作按钮。 */
161
+ export function SplashFooter({ children, className }: { children: ReactNode; className?: string }): JSX.Element {
162
+ return (
163
+ <div
164
+ className={cn(
165
+ // 唯一保留分隔线的地方,并用与面板不同的底色把操作区托出来。
166
+ "flex min-h-8 shrink-0 items-center gap-3 border-t border-border/60 bg-muted/50 px-3.5 py-1",
167
+ "text-[11px] text-muted-foreground/80",
168
+ className,
169
+ )}
170
+ >
171
+ {children}
172
+ </div>
173
+ );
174
+ }
175
+
176
+ /** 输入下方的一行提示;tone=error 时用红色并作为 alert 播报。 */
177
+ export function SplashNotice({
178
+ tone = "muted",
179
+ children,
180
+ }: {
181
+ tone?: "muted" | "error";
182
+ children: ReactNode;
183
+ }): JSX.Element {
184
+ return (
185
+ <p
186
+ role={tone === "error" ? "alert" : undefined}
187
+ className={cn(
188
+ "whitespace-pre-wrap break-words px-4 py-2.5 text-[12px] leading-snug",
189
+ tone === "error" ? "text-destructive" : "text-muted-foreground",
190
+ )}
191
+ >
192
+ {children}
193
+ </p>
194
+ );
195
+ }
196
+
197
+ /**
198
+ * 步骤切换的淡入:用 stepKey 区分步骤。只做入场,不做离场——
199
+ * 离场动画要同时保留两步的 DOM,在高度不同的两步之间会让面板抖动。
200
+ */
201
+ export function SplashStep({ stepKey, children }: { stepKey: string; children: ReactNode }): JSX.Element {
202
+ return (
203
+ <motion.div
204
+ key={stepKey}
205
+ initial={{ opacity: 0 }}
206
+ animate={{ opacity: 1 }}
207
+ transition={{ duration: 0.12, ease: "easeOut" }}
208
+ className="flex min-h-0 flex-col"
209
+ >
210
+ {children}
211
+ </motion.div>
212
+ );
213
+ }
@@ -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 行右侧:与 App 引导同款 outline sm 按钮。 */
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
- }: Pick<UpdateCheckerViewProps, "checking" | "labels" | "onCheck" | "phase">): JSX.Element {
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
- <Button
51
- size="sm"
52
- variant="outline"
53
- onClick={onCheck}
54
- disabled={checking}
55
- data-testid="updater-check"
56
- data-updater-phase={phase}
57
- >
58
- <span className={`icon-[mdi--refresh] h-3.5 w-3.5 ${checking ? "animate-spin" : ""}`} />
59
- {checking ? labels.checkingBtn : labels.check}
60
- </Button>
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
- <ReactMarkdown remarkPlugins={[remarkGfm]}>
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">