@vetta-org/theme-ui 0.1.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.
Files changed (406) hide show
  1. package/package.json +195 -0
  2. package/src/action-approval/AppearanceActionPickerView.tsx +291 -0
  3. package/src/action-approval/AppearanceApprovalDrawerView.tsx +69 -0
  4. package/src/action-approval/AppearancePickerApprovalView.tsx +31 -0
  5. package/src/action-approval/ApprovalParts.tsx +376 -0
  6. package/src/action-approval/BatchTasksApprovalFrameView.tsx +138 -0
  7. package/src/action-approval/BatchTasksExecutionApprovalView.tsx +158 -0
  8. package/src/action-approval/BatchTasksTaskApprovalView.tsx +152 -0
  9. package/src/action-approval/GeneralSetExecutionModeApprovalView.tsx +76 -0
  10. package/src/action-approval/GenericActionApprovalView.tsx +127 -0
  11. package/src/action-approval/ManageActionApprovalFrameTypes.ts +27 -0
  12. package/src/action-approval/ManageActionApprovalFrameView.tsx +136 -0
  13. package/src/action-approval/NavigationOpenApprovalView.tsx +119 -0
  14. package/src/action-approval/SchedulerActionApprovalDialogView.tsx +191 -0
  15. package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +113 -0
  16. package/src/action-approval/SchedulerUpdateApprovalView.tsx +14 -0
  17. package/src/action-approval/ThemeChangeApprovalView.tsx +30 -0
  18. package/src/action-approval/WebhookDeleteApprovalView.tsx +56 -0
  19. package/src/action-approval/WebhookTestApprovalView.tsx +51 -0
  20. package/src/action-approval/cn.ts +4 -0
  21. package/src/action-approval/index.ts +88 -0
  22. package/src/activity/ActivityPanel.tsx +269 -0
  23. package/src/activity/ActivityPanelFrame.tsx +36 -0
  24. package/src/activity/BackgroundTasksTabPanelView.tsx +382 -0
  25. package/src/activity/BatchProgressTabPanelView.tsx +22 -0
  26. package/src/activity/BrowserPanelView.tsx +169 -0
  27. package/src/activity/ChatTabPanelView.tsx +36 -0
  28. package/src/activity/CodePreview.tsx +57 -0
  29. package/src/activity/DebugTabPanelView.tsx +67 -0
  30. package/src/activity/FileTabContentView.tsx +46 -0
  31. package/src/activity/FloatingActivityTabView.tsx +107 -0
  32. package/src/activity/HtmlPreviewView.tsx +135 -0
  33. package/src/activity/JourneyPanelView.tsx +327 -0
  34. package/src/activity/KnowledgeHistoryPanelView.tsx +93 -0
  35. package/src/activity/MarkdownPreviewView.tsx +217 -0
  36. package/src/activity/PluginTabPickerView.tsx +182 -0
  37. package/src/activity/RequestHistorySubTabView.tsx +102 -0
  38. package/src/activity/ScheduleExecutionTabPanelView.tsx +162 -0
  39. package/src/activity/TodoTabPanelView.tsx +66 -0
  40. package/src/activity/ToolCallsSubTabView.tsx +184 -0
  41. package/src/activity/WorkflowTabPanelView.tsx +129 -0
  42. package/src/activity/index.ts +110 -0
  43. package/src/app/AppBackground.tsx +24 -0
  44. package/src/app/AppBootLoadingView.tsx +51 -0
  45. package/src/app/RouteContentLoadingView.tsx +20 -0
  46. package/src/app/index.ts +13 -0
  47. package/src/app-boot.ts +1 -0
  48. package/src/app-shell/DefaultPageHeader.tsx +46 -0
  49. package/src/app-shell/DefaultWindowControls.tsx +32 -0
  50. package/src/app-shell/PageHeaderActionGroup.tsx +15 -0
  51. package/src/app-shell/PageHeaderContent.tsx +70 -0
  52. package/src/app-shell/PageHeaderFrame.tsx +53 -0
  53. package/src/app-shell/PageHeaderSidebarTrigger.tsx +21 -0
  54. package/src/app-shell/PageHeaderTitle.tsx +25 -0
  55. package/src/app-shell/PageHeaderWindowActions.tsx +22 -0
  56. package/src/app-shell/WindowControlButton.tsx +35 -0
  57. package/src/app-shell/index.ts +49 -0
  58. package/src/appearance/BackgroundImageFrame.tsx +57 -0
  59. package/src/appearance/CenterSliceImageFrame.tsx +64 -0
  60. package/src/appearance/CornerImageFrame.tsx +63 -0
  61. package/src/appearance/HorizontalSliceImageFrame.tsx +97 -0
  62. package/src/appearance/NineSliceImageFrame.tsx +65 -0
  63. package/src/appearance/ThemeSurface.tsx +91 -0
  64. package/src/appearance/index.ts +12 -0
  65. package/src/batch-tasks/BatchProjectArtifactFieldView.tsx +36 -0
  66. package/src/batch-tasks/BatchProjectDialogView.tsx +61 -0
  67. package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +108 -0
  68. package/src/batch-tasks/BatchProjectGroupView.tsx +77 -0
  69. package/src/batch-tasks/BatchProjectNameFieldView.tsx +29 -0
  70. package/src/batch-tasks/BatchProjectNotificationFieldView.tsx +42 -0
  71. package/src/batch-tasks/BatchProjectRuntimeFieldsView.tsx +67 -0
  72. package/src/batch-tasks/BatchTaskActionButtonsView.tsx +67 -0
  73. package/src/batch-tasks/BatchTaskCardView.tsx +142 -0
  74. package/src/batch-tasks/BatchTaskGridView.tsx +95 -0
  75. package/src/batch-tasks/BatchTaskListView.tsx +10 -0
  76. package/src/batch-tasks/BatchTaskProjectActionsView.tsx +73 -0
  77. package/src/batch-tasks/BatchTaskProjectBlockView.tsx +117 -0
  78. package/src/batch-tasks/BatchTaskProjectHeaderView.tsx +74 -0
  79. package/src/batch-tasks/BatchTasksPageView.tsx +126 -0
  80. package/src/batch-tasks/batchTaskUi.tsx +101 -0
  81. package/src/batch-tasks/index.ts +70 -0
  82. package/src/batch-tasks/types.ts +120 -0
  83. package/src/chat/ActionButtonBarView.tsx +45 -0
  84. package/src/chat/AgentAvatarView.tsx +59 -0
  85. package/src/chat/AppshotCardView.tsx +89 -0
  86. package/src/chat/AskUserQuestionView.tsx +177 -0
  87. package/src/chat/AssistantMessageView.tsx +147 -0
  88. package/src/chat/AtPanelView.tsx +220 -0
  89. package/src/chat/BackgroundTasksBadgeView.tsx +28 -0
  90. package/src/chat/BashTerminalCard.tsx +225 -0
  91. package/src/chat/ChatExportHostView.tsx +17 -0
  92. package/src/chat/ChatHeaderActionsView.tsx +75 -0
  93. package/src/chat/ContextRingView.tsx +100 -0
  94. package/src/chat/CopyIconButton.tsx +61 -0
  95. package/src/chat/DefaultGuidingWords.tsx +75 -0
  96. package/src/chat/DefaultSceneCarousel.tsx +113 -0
  97. package/src/chat/DefaultSkillBadgeRow.tsx +103 -0
  98. package/src/chat/DrawerCard.tsx +149 -0
  99. package/src/chat/EditDiffView.tsx +137 -0
  100. package/src/chat/ExecutionModeSelectorView.tsx +124 -0
  101. package/src/chat/ExportMessageListView.tsx +20 -0
  102. package/src/chat/GuideBadgeSwiperView.tsx +79 -0
  103. package/src/chat/InlineTokenChip.tsx +68 -0
  104. package/src/chat/InputActionBarView.tsx +112 -0
  105. package/src/chat/InputBarBackground.tsx +25 -0
  106. package/src/chat/InputBarCapsule.tsx +56 -0
  107. package/src/chat/InputBarContextMenuView.tsx +79 -0
  108. package/src/chat/InputBarPlaceholder.tsx +84 -0
  109. package/src/chat/InputBarToolbarButton.tsx +42 -0
  110. package/src/chat/KnowledgeToolViews.tsx +119 -0
  111. package/src/chat/LiveThinkingView.tsx +102 -0
  112. package/src/chat/MessageActions.tsx +109 -0
  113. package/src/chat/MessageBlockSegmentsView.tsx +203 -0
  114. package/src/chat/MessageBoundaryViews.tsx +93 -0
  115. package/src/chat/MessageCardsView.tsx +126 -0
  116. package/src/chat/MessageFeedContext.tsx +14 -0
  117. package/src/chat/MessageFeedLayoutView.tsx +97 -0
  118. package/src/chat/MessageFeedView.tsx +228 -0
  119. package/src/chat/MessageInputView.tsx +193 -0
  120. package/src/chat/MessageLayoutView.tsx +156 -0
  121. package/src/chat/MessageListFooterView.tsx +127 -0
  122. package/src/chat/MessageSelectionContextMenuView.tsx +66 -0
  123. package/src/chat/MessageTimelineView.tsx +261 -0
  124. package/src/chat/MessageView.tsx +82 -0
  125. package/src/chat/MessageVisualView.tsx +43 -0
  126. package/src/chat/ModelSelectorView.tsx +407 -0
  127. package/src/chat/NewSession.ts +107 -0
  128. package/src/chat/NewSessionBackground.tsx +54 -0
  129. package/src/chat/NewSessionPageLayoutView.tsx +96 -0
  130. package/src/chat/NewSessionPicker.tsx +270 -0
  131. package/src/chat/ProgressGroupView.tsx +323 -0
  132. package/src/chat/ProjectSelectorView.tsx +253 -0
  133. package/src/chat/QueueCardView.tsx +151 -0
  134. package/src/chat/ReadImageView.tsx +73 -0
  135. package/src/chat/SandboxGrantsBadgeView.tsx +101 -0
  136. package/src/chat/SandboxPermissionCard.tsx +64 -0
  137. package/src/chat/SceneCard.tsx +138 -0
  138. package/src/chat/SendButton.tsx +135 -0
  139. package/src/chat/SessionDropZoneView.tsx +85 -0
  140. package/src/chat/SessionViewerPageView.tsx +56 -0
  141. package/src/chat/SkillCard.tsx +56 -0
  142. package/src/chat/SkillPromptAreaView.tsx +129 -0
  143. package/src/chat/SuggestionBubblesView.tsx +58 -0
  144. package/src/chat/TextBlockView.tsx +770 -0
  145. package/src/chat/TextPreview.tsx +37 -0
  146. package/src/chat/ThinkingBlockView.tsx +183 -0
  147. package/src/chat/TodoCard.tsx +243 -0
  148. package/src/chat/TodoProgress.tsx +205 -0
  149. package/src/chat/TodoStatusBarView.tsx +140 -0
  150. package/src/chat/ToolCallBlockView.tsx +188 -0
  151. package/src/chat/UsageBarView.tsx +19 -0
  152. package/src/chat/UserMessageContextMenuView.tsx +87 -0
  153. package/src/chat/UserMessageView.tsx +241 -0
  154. package/src/chat/WorkflowFooterItemsView.tsx +170 -0
  155. package/src/chat/WriteContentView.tsx +12 -0
  156. package/src/chat/index.ts +524 -0
  157. package/src/chat/markdown-link.test.ts +238 -0
  158. package/src/chat/markdown-link.ts +279 -0
  159. package/src/chat/send-button.css +318 -0
  160. package/src/chat/useHorizontalDragScroll.ts +146 -0
  161. package/src/file-explorer/ConfirmDeleteDialogView.tsx +62 -0
  162. package/src/file-explorer/FileContextMenuView.tsx +209 -0
  163. package/src/file-explorer/FileTreeCreateRow.tsx +82 -0
  164. package/src/file-explorer/FileTreeNodeView.tsx +274 -0
  165. package/src/file-explorer/FileTreeView.tsx +301 -0
  166. package/src/file-explorer/FilesPanelView.tsx +91 -0
  167. package/src/file-explorer/drag-target.test.ts +34 -0
  168. package/src/file-explorer/drag-target.ts +26 -0
  169. package/src/file-explorer/fileIcons.ts +1 -0
  170. package/src/file-explorer/index.ts +28 -0
  171. package/src/file-explorer/nativeFileDrag.test.ts +30 -0
  172. package/src/file-explorer/nativeFileDrag.ts +14 -0
  173. package/src/file-explorer/types.ts +40 -0
  174. package/src/file-explorer/useFileTreeMarqueeSelection.ts +115 -0
  175. package/src/file-preview/FilePreviewDialogView.tsx +241 -0
  176. package/src/file-preview/FilePreviewView.tsx +162 -0
  177. package/src/file-preview/LightboxImageView.tsx +131 -0
  178. package/src/file-preview/PluginFilePreviewView.tsx +24 -0
  179. package/src/file-preview/PreviewBodyView.tsx +99 -0
  180. package/src/file-preview/PreviewErrorBoundary.tsx +51 -0
  181. package/src/file-preview/TextCodeEditorView.tsx +72 -0
  182. package/src/file-preview/TextFileEditorView.tsx +213 -0
  183. package/src/file-preview/index.ts +56 -0
  184. package/src/file-preview/keyboard-target.test.ts +49 -0
  185. package/src/file-preview/keyboard-target.ts +33 -0
  186. package/src/file-preview/syntax-tokens.css +77 -0
  187. package/src/file-preview/syntax-tokens.test.ts +31 -0
  188. package/src/file-preview/syntax-tokens.ts +155 -0
  189. package/src/file-preview/text-code-editor-theme.ts +321 -0
  190. package/src/file-preview/text-editor-language.test.ts +58 -0
  191. package/src/file-preview/text-editor-language.ts +182 -0
  192. package/src/file-preview/types.ts +29 -0
  193. package/src/flowing/FlowingPanelView.tsx +79 -0
  194. package/src/flowing/FlowingWorkflowView.tsx +54 -0
  195. package/src/flowing/UserNodeView.tsx +148 -0
  196. package/src/flowing/WorkflowBindDialogView.tsx +145 -0
  197. package/src/flowing/WorkflowProgressView.tsx +149 -0
  198. package/src/flowing/index.ts +27 -0
  199. package/src/flowing-chat/ChatBubbleView.tsx +219 -0
  200. package/src/flowing-chat/ChatComposerView.tsx +362 -0
  201. package/src/flowing-chat/ChatMembersBarView.tsx +86 -0
  202. package/src/flowing-chat/ChatPanelView.tsx +73 -0
  203. package/src/flowing-chat/index.ts +21 -0
  204. package/src/index.ts +22 -0
  205. package/src/knowledge/KnowledgeBaseSwitcherView.tsx +154 -0
  206. package/src/knowledge/KnowledgeBreadcrumbView.tsx +92 -0
  207. package/src/knowledge/KnowledgeContentsPanelView.tsx +77 -0
  208. package/src/knowledge/KnowledgeContextMenuView.tsx +70 -0
  209. package/src/knowledge/KnowledgeFilesSkeleton.tsx +22 -0
  210. package/src/knowledge/KnowledgeGridView.tsx +113 -0
  211. package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +85 -0
  212. package/src/knowledge/KnowledgeImportDialogView.tsx +153 -0
  213. package/src/knowledge/KnowledgeListView.tsx +107 -0
  214. package/src/knowledge/KnowledgePendingFilesDialogView.tsx +76 -0
  215. package/src/knowledge/KnowledgeProcessingBadgeView.tsx +18 -0
  216. package/src/knowledge/KnowledgeRenameDialogView.tsx +66 -0
  217. package/src/knowledge/KnowledgeSourcePickerView.tsx +60 -0
  218. package/src/knowledge/KnowledgeViewShared.tsx +103 -0
  219. package/src/knowledge/cn.ts +4 -0
  220. package/src/knowledge/coloredFileIcons.ts +1 -0
  221. package/src/knowledge/index.ts +66 -0
  222. package/src/knowledge/types.ts +31 -0
  223. package/src/knowledge/useMarqueeSelection.ts +95 -0
  224. package/src/layout/AppFrame.tsx +34 -0
  225. package/src/layout/MainContentFrame.tsx +54 -0
  226. package/src/layout/ResizeHandle.tsx +91 -0
  227. package/src/layout/SidebarDock.tsx +33 -0
  228. package/src/layout/SidebarOverlay.tsx +36 -0
  229. package/src/layout/index.ts +10 -0
  230. package/src/overlays/CommandMenuRow.tsx +119 -0
  231. package/src/overlays/CommandMenuView.tsx +183 -0
  232. package/src/overlays/ConfirmDialogView.tsx +109 -0
  233. package/src/overlays/DetailDrawer.tsx +63 -0
  234. package/src/overlays/DetailDrawerEnter.tsx +37 -0
  235. package/src/overlays/KnowledgeDropOverlayView.tsx +43 -0
  236. package/src/overlays/RouteErrorPageView.tsx +72 -0
  237. package/src/overlays/ToasterView.tsx +76 -0
  238. package/src/overlays/UpdateCheckerView.tsx +206 -0
  239. package/src/overlays/UpdateRestartDialogView.tsx +107 -0
  240. package/src/overlays/command-menu-types.ts +47 -0
  241. package/src/overlays/command-menu.css +69 -0
  242. package/src/overlays/detail-drawer-guard.test.ts +16 -0
  243. package/src/overlays/detail-drawer-guard.ts +13 -0
  244. package/src/overlays/index.ts +44 -0
  245. package/src/plugin-ui/index.ts +26 -0
  246. package/src/project/BatchQueueStatusView.tsx +352 -0
  247. package/src/project/ConversationTagDotsView.tsx +130 -0
  248. package/src/project/ConversationTagEditorDialogView.tsx +273 -0
  249. package/src/project/DefaultConversationSectionView.tsx +74 -0
  250. package/src/project/DefaultSessionListView.tsx +128 -0
  251. package/src/project/DefaultSessionRowView.tsx +125 -0
  252. package/src/project/NewProjectDialogView.tsx +140 -0
  253. package/src/project/ProjectContextMenuView.tsx +187 -0
  254. package/src/project/ProjectDetailPageView.tsx +351 -0
  255. package/src/project/ProjectGroupView.tsx +37 -0
  256. package/src/project/ProjectRowView.tsx +111 -0
  257. package/src/project/ProjectSessionsLoadingView.tsx +14 -0
  258. package/src/project/ProjectSessionsView.tsx +96 -0
  259. package/src/project/ProjectsLoadingView.tsx +15 -0
  260. package/src/project/ProjectsPanelMenusView.tsx +23 -0
  261. package/src/project/ProjectsPanelView.tsx +56 -0
  262. package/src/project/QuickScrollOverlay.tsx +188 -0
  263. package/src/project/ScheduleStatusView.tsx +110 -0
  264. package/src/project/SessionContextMenuView.tsx +71 -0
  265. package/src/project/SessionRenameInputView.tsx +49 -0
  266. package/src/project/SessionRowView.tsx +119 -0
  267. package/src/project/SidebarProjectsSectionView.tsx +35 -0
  268. package/src/project/index.ts +87 -0
  269. package/src/project/types.ts +21 -0
  270. package/src/project/useActiveSessionAutoScroll.ts +171 -0
  271. package/src/registry.ts +62 -0
  272. package/src/scheduler/AutomationPageView.tsx +159 -0
  273. package/src/scheduler/ExecutionHistoryView.tsx +179 -0
  274. package/src/scheduler/HistoryDrawerView.tsx +149 -0
  275. package/src/scheduler/TaskFormDialogView.tsx +60 -0
  276. package/src/scheduler/TaskListView.tsx +219 -0
  277. package/src/scheduler/index.ts +30 -0
  278. package/src/settings/AchievementNavigationButtonView.tsx +90 -0
  279. package/src/settings/AchievementPromotionDialogView.tsx +91 -0
  280. package/src/settings/AchievementSettingsView.tsx +44 -0
  281. package/src/settings/AppshotSettingsView.tsx +132 -0
  282. package/src/settings/ArchivedProjectsSettingsView.tsx +80 -0
  283. package/src/settings/BuiltinMcpSecretsDialogView.tsx +278 -0
  284. package/src/settings/BuiltinMcpSectionView.tsx +164 -0
  285. package/src/settings/EnvironmentSettingsView.tsx +176 -0
  286. package/src/settings/GeneralSettingsView.tsx +174 -0
  287. package/src/settings/ImChannelCardView.tsx +152 -0
  288. package/src/settings/ImChannelGuideDialogView.tsx +126 -0
  289. package/src/settings/ImFeishuDialogView.tsx +156 -0
  290. package/src/settings/ImLegacyImportBannerView.tsx +44 -0
  291. package/src/settings/ImLogDrawerView.tsx +75 -0
  292. package/src/settings/ImStatusBadgeView.tsx +39 -0
  293. package/src/settings/McpDefaultIcon.tsx +27 -0
  294. package/src/settings/McpJsonEditorView.tsx +56 -0
  295. package/src/settings/ModelsProviderFormView.tsx +128 -0
  296. package/src/settings/ModelsProvidersSectionView.tsx +52 -0
  297. package/src/settings/MotionSelect.tsx +125 -0
  298. package/src/settings/PermissionsSettingsView.tsx +106 -0
  299. package/src/settings/PetBubbleStylePreviewView.tsx +44 -0
  300. package/src/settings/PetSettingsView.tsx +165 -0
  301. package/src/settings/PresetProviderModelsListView.tsx +58 -0
  302. package/src/settings/PresetProviderRowView.tsx +302 -0
  303. package/src/settings/PresetProvidersSectionView.tsx +70 -0
  304. package/src/settings/QrBindDialogView.tsx +165 -0
  305. package/src/settings/QuickPanelSettingsSectionView.tsx +66 -0
  306. package/src/settings/RemoteMcpSectionView.tsx +192 -0
  307. package/src/settings/SettingChrome.tsx +104 -0
  308. package/src/settings/SettingsAiAssistButtonView.tsx +150 -0
  309. package/src/settings/SettingsAiAssistDialogView.tsx +251 -0
  310. package/src/settings/SettingsFormFields.tsx +121 -0
  311. package/src/settings/SettingsPageShellView.tsx +84 -0
  312. package/src/settings/SettingsSidebarView.tsx +133 -0
  313. package/src/settings/ShortcutRecorderView.tsx +88 -0
  314. package/src/settings/ShortcutsSettingsView.tsx +66 -0
  315. package/src/settings/SubscriptionActionsView.tsx +63 -0
  316. package/src/settings/SubscriptionCardsView.tsx +212 -0
  317. package/src/settings/TeamDetailView.tsx +148 -0
  318. package/src/settings/TeamDialogsView.tsx +151 -0
  319. package/src/settings/TeamListView.tsx +57 -0
  320. package/src/settings/TeamSettingsView.tsx +51 -0
  321. package/src/settings/TokenActivityChartView.tsx +286 -0
  322. package/src/settings/UsageStatsView.tsx +101 -0
  323. package/src/settings/WebhookEndpointListView.tsx +123 -0
  324. package/src/settings/WechatBindDialogView.tsx +45 -0
  325. package/src/settings/achievements/AchievementCurtains.tsx +50 -0
  326. package/src/settings/achievements/AchievementPromotionBadge3D.tsx +350 -0
  327. package/src/settings/achievements/AchievementPromotionConfetti.tsx +71 -0
  328. package/src/settings/achievements/AchievementTitle.tsx +52 -0
  329. package/src/settings/achievements/index.ts +13 -0
  330. package/src/settings/index.ts +226 -0
  331. package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +135 -0
  332. package/src/settings/shouldCloseEmptyApiKeyEditor.ts +40 -0
  333. package/src/settings/token-activity.test.ts +195 -0
  334. package/src/settings/token-activity.ts +320 -0
  335. package/src/shared/AvatarStackView.tsx +45 -0
  336. package/src/shared/BotAvatar.tsx +395 -0
  337. package/src/shared/CodeBlockCopyButton.tsx +48 -0
  338. package/src/shared/CollapsePanel.tsx +125 -0
  339. package/src/shared/ContextMenuView.tsx +134 -0
  340. package/src/shared/MacKeyboardPreview.tsx +260 -0
  341. package/src/shared/MarkdownTable.tsx +216 -0
  342. package/src/shared/MultiplierTag.tsx +15 -0
  343. package/src/shared/ScrollFade.tsx +114 -0
  344. package/src/shared/SegmentedControl.tsx +82 -0
  345. package/src/shared/SyntaxHighlightedCode.tsx +0 -0
  346. package/src/shared/TabBar.tsx +696 -0
  347. package/src/shared/TimePicker.tsx +96 -0
  348. package/src/shared/connected-tab-outline.test.ts +22 -0
  349. package/src/shared/connected-tab-outline.ts +39 -0
  350. package/src/shared/fileIcons.test.ts +28 -0
  351. package/src/shared/fileIcons.ts +322 -0
  352. package/src/shared/index.ts +38 -0
  353. package/src/shared/markdown-table-clipboard.ts +31 -0
  354. package/src/shared/provider-icon/icons.ts +56 -0
  355. package/src/shared/provider-icon/index.tsx +42 -0
  356. package/src/shared/provider-icon/svg-url.d.ts +4 -0
  357. package/src/shared/tab-drag.test.ts +14 -0
  358. package/src/shared/tab-drag.ts +15 -0
  359. package/src/shared/useDelayedUnmount.ts +36 -0
  360. package/src/sidebar/AddProjectMenuItem.tsx +21 -0
  361. package/src/sidebar/AddProjectMenuPopoverView.tsx +52 -0
  362. package/src/sidebar/AddProjectMenuTriggerView.tsx +50 -0
  363. package/src/sidebar/ChatMessageListView.tsx +66 -0
  364. package/src/sidebar/DefaultSidebar.tsx +91 -0
  365. package/src/sidebar/FlowingMessageListView.tsx +111 -0
  366. package/src/sidebar/MessageCenterDialogView.tsx +81 -0
  367. package/src/sidebar/MessageCenterEmptyState.tsx +24 -0
  368. package/src/sidebar/MessageCenterTabs.tsx +86 -0
  369. package/src/sidebar/MessageCenterToolbarButton.tsx +25 -0
  370. package/src/sidebar/MessageCenterTriggerView.tsx +39 -0
  371. package/src/sidebar/NotificationMessageListView.tsx +136 -0
  372. package/src/sidebar/ProjectsPanelEmptyState.tsx +20 -0
  373. package/src/sidebar/RunningPulseDot.tsx +10 -0
  374. package/src/sidebar/SessionStatusIcon.tsx +43 -0
  375. package/src/sidebar/SettingsMenuAccountSection.tsx +32 -0
  376. package/src/sidebar/SettingsMenuActionButton.tsx +24 -0
  377. package/src/sidebar/SettingsMenuDivider.tsx +5 -0
  378. package/src/sidebar/SettingsMenuQuotaSection.tsx +45 -0
  379. package/src/sidebar/SettingsMenuSettingsItem.tsx +18 -0
  380. package/src/sidebar/SettingsMenuThemeSection.tsx +51 -0
  381. package/src/sidebar/SettingsMenuTriggerView.tsx +65 -0
  382. package/src/sidebar/ShowMoreSessionsButton.tsx +37 -0
  383. package/src/sidebar/SidebarFilterSelectView.tsx +95 -0
  384. package/src/sidebar/SidebarNavBadgeView.tsx +58 -0
  385. package/src/sidebar/SidebarNavIcon.tsx +33 -0
  386. package/src/sidebar/SidebarNavItemButton.tsx +59 -0
  387. package/src/sidebar/SidebarNavMorePanel.tsx +199 -0
  388. package/src/sidebar/SidebarNavigation.tsx +223 -0
  389. package/src/sidebar/SidebarPanel.tsx +48 -0
  390. package/src/sidebar/SidebarTopBar.tsx +103 -0
  391. package/src/sidebar/SidebarUpdateIcon.tsx +79 -0
  392. package/src/sidebar/index.ts +118 -0
  393. package/src/sidebar/nav-badge-text.test.ts +23 -0
  394. package/src/sidebar/nav-badge-text.ts +19 -0
  395. package/src/sidebar/useSidebarNavDrag.ts +139 -0
  396. package/src/skills/PluginCardView.tsx +150 -0
  397. package/src/skills/SceneCardView.tsx +194 -0
  398. package/src/skills/SkillCardView.tsx +186 -0
  399. package/src/skills/SkillDetailDialogView.tsx +138 -0
  400. package/src/skills/SkillTagGroupView.tsx +56 -0
  401. package/src/skills/SkillToggleSwitch.tsx +31 -0
  402. package/src/skills/index.ts +29 -0
  403. package/src/skills/skill-icon.test.ts +38 -0
  404. package/src/skills/skill-icon.tsx +126 -0
  405. package/src/styles.css +75 -0
  406. package/src/utils/platform.ts +2 -0
@@ -0,0 +1,37 @@
1
+ import type { JSX } from "react";
2
+
3
+ export interface TextPreviewLabels {
4
+ characterUnit: string;
5
+ emptyLabel: string;
6
+ lineUnit: string;
7
+ }
8
+
9
+ export interface TextPreviewProps {
10
+ label: string;
11
+ text: string;
12
+ emptyLabel?: string;
13
+ labels: TextPreviewLabels;
14
+ }
15
+
16
+ function lineCount(text: string): number {
17
+ if (text.length === 0) return 0;
18
+ return text.split("\n").length;
19
+ }
20
+
21
+ export function TextPreview({ label, text, emptyLabel, labels }: TextPreviewProps): JSX.Element {
22
+ const lines = lineCount(text);
23
+ const resolvedEmptyLabel = emptyLabel ?? labels.emptyLabel;
24
+ return (
25
+ <div className="space-y-1.5">
26
+ <div className="flex items-center gap-2 text-[10px] text-muted-foreground/50">
27
+ <span className="font-medium text-muted-foreground/60">{label}</span>
28
+ <span>
29
+ {lines} {labels.lineUnit} · {text.length} {labels.characterUnit}
30
+ </span>
31
+ </div>
32
+ <pre className="max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/25 p-2 text-[11px] leading-[1.5] text-foreground/70">
33
+ {text.length > 0 ? text : resolvedEmptyLabel}
34
+ </pre>
35
+ </div>
36
+ );
37
+ }
@@ -0,0 +1,183 @@
1
+ import { Slot } from "radix-ui";
2
+ import {
3
+ createContext,
4
+ forwardRef,
5
+ type ButtonHTMLAttributes,
6
+ type ComponentPropsWithoutRef,
7
+ type ReactNode,
8
+ useContext,
9
+ useId,
10
+ useMemo,
11
+ useState,
12
+ } from "react";
13
+ import { CollapsePanel } from "../shared/CollapsePanel";
14
+
15
+ interface ThinkingBlockContextValue {
16
+ readonly expanded: boolean;
17
+ readonly exportMode: boolean;
18
+ readonly panelId?: string;
19
+ readonly toggle: () => void;
20
+ }
21
+
22
+ const ThinkingBlockContext = createContext<ThinkingBlockContextValue | null>(null);
23
+
24
+ export interface ThinkingBlockRootProps {
25
+ readonly children: ReactNode;
26
+ readonly exportMode?: boolean;
27
+ readonly expanded?: boolean;
28
+ readonly onExpandedChange?: (expanded: boolean) => void;
29
+ }
30
+
31
+ export function ThinkingBlockRoot({
32
+ children,
33
+ exportMode = false,
34
+ expanded: controlledExpanded,
35
+ onExpandedChange,
36
+ }: ThinkingBlockRootProps): JSX.Element {
37
+ const [uncontrolledExpanded, setUncontrolledExpanded] = useState(false);
38
+ const expanded = controlledExpanded ?? uncontrolledExpanded;
39
+ const generatedId = useId();
40
+ const panelId = exportMode ? `export-thinking-${generatedId}` : undefined;
41
+ const value = useMemo(
42
+ () => ({
43
+ expanded,
44
+ exportMode,
45
+ panelId,
46
+ toggle: () => {
47
+ const nextExpanded = !expanded;
48
+ if (controlledExpanded === undefined) setUncontrolledExpanded(nextExpanded);
49
+ onExpandedChange?.(nextExpanded);
50
+ },
51
+ }),
52
+ [controlledExpanded, expanded, exportMode, onExpandedChange, panelId],
53
+ );
54
+ return <ThinkingBlockContext.Provider value={value}>{children}</ThinkingBlockContext.Provider>;
55
+ }
56
+
57
+ function useThinkingBlockContext(part: string): ThinkingBlockContextValue {
58
+ const context = useContext(ThinkingBlockContext);
59
+ if (!context) throw new Error(`${part} must be used within ThinkingBlock.Root`);
60
+ return context;
61
+ }
62
+
63
+ export interface ThinkingBlockPrimitiveProps extends ComponentPropsWithoutRef<"div"> {
64
+ readonly asChild?: boolean;
65
+ }
66
+
67
+ function createPrimitive(displayName: string, baseClassName: string) {
68
+ const Primitive = forwardRef<HTMLDivElement, ThinkingBlockPrimitiveProps>(function Primitive(
69
+ { asChild = false, className, ...props },
70
+ forwardedRef,
71
+ ) {
72
+ const Comp = asChild ? Slot.Root : "div";
73
+ return (
74
+ <Comp
75
+ ref={forwardedRef}
76
+ className={`${baseClassName}${className ? ` ${className}` : ""}`}
77
+ {...props}
78
+ />
79
+ );
80
+ });
81
+ Primitive.displayName = displayName;
82
+ return Primitive;
83
+ }
84
+
85
+ interface ThinkingBlockTextPrimitiveProps extends ComponentPropsWithoutRef<"span"> {
86
+ readonly asChild?: boolean;
87
+ }
88
+
89
+ function createTextPrimitive(displayName: string, baseClassName: string) {
90
+ const Primitive = forwardRef<HTMLSpanElement, ThinkingBlockTextPrimitiveProps>(function Primitive(
91
+ { asChild = false, className, ...props },
92
+ forwardedRef,
93
+ ) {
94
+ const Comp = asChild ? Slot.Root : "span";
95
+ return (
96
+ <Comp
97
+ ref={forwardedRef}
98
+ className={`${baseClassName}${className ? ` ${className}` : ""}`}
99
+ {...props}
100
+ />
101
+ );
102
+ });
103
+ Primitive.displayName = displayName;
104
+ return Primitive;
105
+ }
106
+
107
+ export const ThinkingBlockFrame = createPrimitive("ThinkingBlock.Frame", "min-w-0 w-full");
108
+
109
+ export interface ThinkingBlockTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
110
+ readonly asChild?: boolean;
111
+ }
112
+
113
+ export const ThinkingBlockTrigger = forwardRef<HTMLButtonElement, ThinkingBlockTriggerProps>(
114
+ function ThinkingBlockTrigger({ asChild = false, className, onClick, type, ...props }, forwardedRef) {
115
+ const { expanded, panelId, toggle } = useThinkingBlockContext("ThinkingBlock.Trigger");
116
+ const Comp = asChild ? Slot.Root : "button";
117
+ return (
118
+ <Comp
119
+ ref={forwardedRef}
120
+ type={asChild ? undefined : (type ?? "button")}
121
+ onClick={(event) => {
122
+ onClick?.(event);
123
+ if (!event.defaultPrevented) toggle();
124
+ }}
125
+ data-export-toggle={panelId}
126
+ aria-expanded={expanded}
127
+ className={`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-lg px-1.5 py-1 text-left transition-colors hover:bg-muted/60${className ? ` ${className}` : ""}`}
128
+ {...props}
129
+ />
130
+ );
131
+ },
132
+ );
133
+
134
+ export function ThinkingBlockIcon(): JSX.Element {
135
+ return <span className="icon-[solar--lightbulb-bolt-linear] h-3.5 w-3.5 shrink-0 text-muted-foreground/50" />;
136
+ }
137
+
138
+ export const ThinkingBlockTitle = createTextPrimitive(
139
+ "ThinkingBlock.Title",
140
+ "min-w-0 truncate text-[12px] text-muted-foreground/70",
141
+ );
142
+ export const ThinkingBlockLineCount = createTextPrimitive(
143
+ "ThinkingBlock.LineCount",
144
+ "shrink-0 text-[11px] text-muted-foreground/40",
145
+ );
146
+
147
+ export function ThinkingBlockChevron(): JSX.Element {
148
+ const { expanded } = useThinkingBlockContext("ThinkingBlock.Chevron");
149
+ return (
150
+ <span
151
+ className={`icon-[solar--alt-arrow-right-linear] h-3.5 w-3.5 shrink-0 text-muted-foreground/40 transition-transform duration-200 ${expanded ? "rotate-90" : ""}`}
152
+ />
153
+ );
154
+ }
155
+
156
+ export function ThinkingBlockContent({ children }: { readonly children: ReactNode }): JSX.Element {
157
+ const { expanded, exportMode, panelId } = useThinkingBlockContext("ThinkingBlock.Content");
158
+ return (
159
+ <CollapsePanel
160
+ open={expanded || exportMode}
161
+ id={panelId}
162
+ exportPanel={exportMode}
163
+ hidden={exportMode && !expanded}
164
+ >
165
+ <div className="ml-4 border-l border-border/50 pl-3 pt-1 pb-2">
166
+ <div className="whitespace-pre-wrap break-words text-[12px] leading-[1.6] text-muted-foreground/70">
167
+ {children}
168
+ </div>
169
+ </div>
170
+ </CollapsePanel>
171
+ );
172
+ }
173
+
174
+ export const ThinkingBlock = {
175
+ Root: ThinkingBlockRoot,
176
+ Frame: ThinkingBlockFrame,
177
+ Trigger: ThinkingBlockTrigger,
178
+ Icon: ThinkingBlockIcon,
179
+ Title: ThinkingBlockTitle,
180
+ LineCount: ThinkingBlockLineCount,
181
+ Chevron: ThinkingBlockChevron,
182
+ Content: ThinkingBlockContent,
183
+ } as const;
@@ -0,0 +1,243 @@
1
+ import { AnimatePresence, motion } from "motion/react";
2
+ import { useRef, useState, type JSX } from "react";
3
+
4
+ const COMPACT_VISIBLE_COUNT = 5;
5
+
6
+ export interface TodoCardItem {
7
+ id: number;
8
+ content: string;
9
+ status: "pending" | "in_progress" | "done";
10
+ }
11
+
12
+ export interface TodoCardLabels {
13
+ allDone: string;
14
+ pending: string;
15
+ viewMore: string;
16
+ collapse: string;
17
+ /** Host formats remaining count into full expand label. */
18
+ expandRemaining: (hiddenCount: number) => string;
19
+ }
20
+
21
+ export interface TodoCardProps {
22
+ items: readonly TodoCardItem[];
23
+ /** Compact mode for inline display in message list */
24
+ compact?: boolean;
25
+ /** When provided in compact mode, replaces expand/collapse with view-more that calls this */
26
+ onViewMore?: () => void;
27
+ labels: TodoCardLabels;
28
+ }
29
+
30
+ export function TodoCard({
31
+ items,
32
+ compact = false,
33
+ onViewMore,
34
+ labels,
35
+ }: TodoCardProps): JSX.Element | null {
36
+ if (items.length === 0) return null;
37
+
38
+ const doneCount = items.filter((i) => i.status === "done").length;
39
+ const total = items.length;
40
+ const allDone = doneCount === total;
41
+
42
+ if (compact) {
43
+ return (
44
+ <CompactTodoCard
45
+ items={items}
46
+ doneCount={doneCount}
47
+ total={total}
48
+ allDone={allDone}
49
+ onViewMore={onViewMore}
50
+ labels={labels}
51
+ />
52
+ );
53
+ }
54
+
55
+ return (
56
+ <div className="flex flex-1 flex-col overflow-y-auto">
57
+ <div className="border-b border-border px-4 py-3">
58
+ <ProgressHeader doneCount={doneCount} total={total} allDone={allDone} labels={labels} />
59
+ <ProgressBar doneCount={doneCount} total={total} height="h-1.5" />
60
+ </div>
61
+ <ul className="flex flex-col p-1.5">
62
+ {items.map((item) => (
63
+ <TodoItemRow key={item.id} item={item} size="md" />
64
+ ))}
65
+ </ul>
66
+ </div>
67
+ );
68
+ }
69
+
70
+ function CompactTodoCard({
71
+ items,
72
+ doneCount,
73
+ total,
74
+ allDone,
75
+ onViewMore,
76
+ labels,
77
+ }: {
78
+ items: readonly TodoCardItem[];
79
+ doneCount: number;
80
+ total: number;
81
+ allDone: boolean;
82
+ onViewMore?: () => void;
83
+ labels: TodoCardLabels;
84
+ }): JSX.Element {
85
+ const [expanded, setExpanded] = useState(false);
86
+ const canCollapse = total > COMPACT_VISIBLE_COUNT;
87
+ const hiddenCount = total - COMPACT_VISIBLE_COUNT;
88
+
89
+ const sliceStartRef = useRef(-1);
90
+ const inProgressIdx = items.findIndex((i) => i.status === "in_progress");
91
+ const prev = sliceStartRef.current;
92
+ const needsRecalc =
93
+ prev === -1 ||
94
+ (inProgressIdx >= 0 && (inProgressIdx < prev || inProgressIdx >= prev + COMPACT_VISIBLE_COUNT)) ||
95
+ prev > total - COMPACT_VISIBLE_COUNT;
96
+ if (needsRecalc) {
97
+ const idealStart = inProgressIdx >= 0 ? inProgressIdx - 1 : total - COMPACT_VISIBLE_COUNT;
98
+ sliceStartRef.current = Math.max(0, Math.min(idealStart, total - COMPACT_VISIBLE_COUNT));
99
+ }
100
+ const sliceStart = sliceStartRef.current;
101
+ const visibleItems = canCollapse && !expanded ? items.slice(sliceStart, sliceStart + COMPACT_VISIBLE_COUNT) : items;
102
+
103
+ return (
104
+ <div>
105
+ <ProgressHeader doneCount={doneCount} total={total} allDone={allDone} labels={labels} />
106
+ <ProgressBar doneCount={doneCount} total={total} height="h-1" animated />
107
+ <ul className="mt-1.5 flex flex-col">
108
+ <AnimatePresence initial={false}>
109
+ {visibleItems.map((item) => (
110
+ <TodoItemRow key={item.id} item={item} size="sm" />
111
+ ))}
112
+ </AnimatePresence>
113
+ </ul>
114
+ {canCollapse &&
115
+ (onViewMore ? (
116
+ <button
117
+ type="button"
118
+ onClick={onViewMore}
119
+ className="mt-1.5 flex w-full items-center justify-center gap-1 rounded-md py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground"
120
+ >
121
+ <span className="icon-[solar--arrow-right-linear] text-sm" />
122
+ {labels.viewMore}
123
+ </button>
124
+ ) : (
125
+ <button
126
+ type="button"
127
+ onClick={() => setExpanded((v) => !v)}
128
+ className="mt-1.5 flex w-full items-center justify-center gap-1 rounded-md py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground"
129
+ >
130
+ <span
131
+ className={`${expanded ? "icon-[solar--alt-arrow-up-linear]" : "icon-[solar--alt-arrow-down-linear]"} text-sm`}
132
+ />
133
+ {expanded ? labels.collapse : labels.expandRemaining(hiddenCount)}
134
+ </button>
135
+ ))}
136
+ </div>
137
+ );
138
+ }
139
+
140
+ function ProgressHeader({
141
+ doneCount,
142
+ total,
143
+ allDone,
144
+ labels,
145
+ }: {
146
+ doneCount: number;
147
+ total: number;
148
+ allDone: boolean;
149
+ labels: TodoCardLabels;
150
+ }): JSX.Element {
151
+ return (
152
+ <div className="mb-1.5 flex items-center justify-between text-xs text-muted-foreground">
153
+ <span>{allDone ? labels.allDone : labels.pending}</span>
154
+ <span>
155
+ {doneCount}/{total}
156
+ </span>
157
+ </div>
158
+ );
159
+ }
160
+
161
+ function ProgressBar({
162
+ doneCount,
163
+ total,
164
+ height,
165
+ animated,
166
+ }: {
167
+ doneCount: number;
168
+ total: number;
169
+ height: string;
170
+ animated?: boolean;
171
+ }): JSX.Element {
172
+ const pct = total > 0 ? (doneCount / total) * 100 : 0;
173
+ return (
174
+ <div className={`${height} overflow-hidden rounded-full bg-muted/50`}>
175
+ {animated ? (
176
+ <motion.div
177
+ className={`${height} rounded-full bg-primary`}
178
+ initial={{ width: 0 }}
179
+ animate={{ width: `${pct}%` }}
180
+ transition={{ duration: 0.4, ease: "easeOut" }}
181
+ />
182
+ ) : (
183
+ <div
184
+ className={`${height} rounded-full bg-primary transition-all duration-500 ease-out`}
185
+ style={{ width: `${pct}%` }}
186
+ />
187
+ )}
188
+ </div>
189
+ );
190
+ }
191
+
192
+ function TodoItemRow({ item, size }: { item: TodoCardItem; size: "sm" | "md" }): JSX.Element {
193
+ const isDone = item.status === "done";
194
+ const isInProgress = item.status === "in_progress";
195
+ const iconSize = size === "sm" ? "h-3 w-3" : "h-3.5 w-3.5";
196
+ const iconRadius = size === "sm" ? "rounded-[6px]" : "rounded-[7px]";
197
+ const textSize = size === "sm" ? "text-[11px] leading-snug" : "text-[12px] leading-snug";
198
+ const padding = size === "sm" ? "px-1.5 py-0.5" : "px-2 py-1";
199
+ const checkGlyph = size === "sm" ? "text-[8px]" : "text-[9px]";
200
+
201
+ return (
202
+ <motion.li
203
+ initial={{ opacity: 0, height: 0 }}
204
+ animate={{ opacity: 1, height: "auto" }}
205
+ exit={{ opacity: 0, height: 0 }}
206
+ transition={{ duration: 0.15 }}
207
+ className={`flex items-start gap-1.5 rounded-md ${padding} transition-colors hover:bg-muted/30`}
208
+ >
209
+ <div className="mt-px shrink-0">
210
+ {isDone ? (
211
+ <motion.div
212
+ initial={{ scale: 0 }}
213
+ animate={{ scale: 1 }}
214
+ transition={{ type: "spring", stiffness: 500, damping: 25 }}
215
+ className={`flex ${iconSize} ${iconRadius} items-center justify-center bg-primary text-primary-foreground shadow-[0_2px_6px_-2px_var(--primary)]`}
216
+ style={{ borderRadius: size === "sm" ? "30%" : "32%" }}
217
+ >
218
+ <span className={`icon-[mdi--check] ${checkGlyph}`} />
219
+ </motion.div>
220
+ ) : isInProgress ? (
221
+ <div
222
+ className={`flex ${iconSize} ${iconRadius} items-center justify-center border border-primary/50 text-primary`}
223
+ style={{ borderRadius: size === "sm" ? "30%" : "32%" }}
224
+ >
225
+ <span className={`icon-[solar--refresh-linear] animate-spin ${checkGlyph}`} />
226
+ </div>
227
+ ) : (
228
+ <div
229
+ className={`${iconSize} ${iconRadius} border border-muted-foreground/30`}
230
+ style={{ borderRadius: size === "sm" ? "30%" : "32%" }}
231
+ />
232
+ )}
233
+ </div>
234
+ <span
235
+ className={`${textSize} transition-all duration-300 ${
236
+ isDone ? "text-muted-foreground line-through decoration-muted-foreground/50" : "text-foreground"
237
+ }`}
238
+ >
239
+ {item.content}
240
+ </span>
241
+ </motion.li>
242
+ );
243
+ }
@@ -0,0 +1,205 @@
1
+ import type { CSSProperties, JSX } from "react";
2
+ import { cn } from "@vetta-org/ui";
3
+
4
+ export interface TodoStatusItem {
5
+ readonly id: number;
6
+ readonly content: string;
7
+ readonly status: "pending" | "in_progress" | "done";
8
+ }
9
+
10
+ export interface TodoStatusSummary {
11
+ readonly total: number;
12
+ readonly done: number;
13
+ readonly allDone: boolean;
14
+ /** 形如 `2/5`,供触发器与面板共用。 */
15
+ readonly progressLabel: string;
16
+ readonly percent: number;
17
+ /** 进行中的条目优先,其次第一条待办;全部完成时为 null。 */
18
+ readonly activeContent: string | null;
19
+ }
20
+
21
+ /** 纯派生:触发器与活动面板共用同一套进度语义。 */
22
+ export function selectTodoStatusSummary(items: readonly TodoStatusItem[]): TodoStatusSummary {
23
+ const total = items.length;
24
+ const done = items.filter((item) => item.status === "done").length;
25
+ const active =
26
+ items.find((item) => item.status === "in_progress") ?? items.find((item) => item.status === "pending");
27
+ return {
28
+ total,
29
+ done,
30
+ allDone: total > 0 && done === total,
31
+ progressLabel: `${done}/${total}`,
32
+ percent: total > 0 ? (done / total) * 100 : 0,
33
+ activeContent: active?.content ?? null,
34
+ };
35
+ }
36
+
37
+ export interface TodoTimelineLabels {
38
+ readonly statusDone: string;
39
+ readonly statusInProgress: string;
40
+ readonly statusPending: string;
41
+ }
42
+
43
+ /**
44
+ * 待办视觉基元共用的关键帧:
45
+ * - `todo-dot-halo` / `todo-dot-core`:未完成时的呼吸点
46
+ * - `todo-label-sheen`:标签上扫过的光斑
47
+ * - `todo-marker-spin`:进行中条目的转动弧
48
+ */
49
+ export const TODO_PROGRESS_CSS = `
50
+ @keyframes todo-dot-halo {
51
+ 0% { transform: scale(0.7); opacity: 0.55; }
52
+ 70% { transform: scale(2.1); opacity: 0; }
53
+ 100% { transform: scale(2.1); opacity: 0; }
54
+ }
55
+ @keyframes todo-dot-core {
56
+ 0%, 100% { opacity: 1; }
57
+ 50% { opacity: 0.55; }
58
+ }
59
+ @keyframes todo-label-sheen { from { background-position: 160% 0; } to { background-position: -160% 0; } }
60
+ @keyframes todo-marker-spin { to { transform: rotate(360deg); } }
61
+ `;
62
+
63
+ /** 关键帧注入点:每个待办根节点渲染一次,样式内容相同不会互相干扰。 */
64
+ export function TodoProgressStyles(): JSX.Element {
65
+ return <style>{TODO_PROGRESS_CSS}</style>;
66
+ }
67
+
68
+ const SHEEN_BASE = "var(--primary)";
69
+ const SHEEN_HIGHLIGHT = "color-mix(in srgb, var(--primary) 35%, white)";
70
+
71
+ /** 标签光斑:以主色为底、高光横向扫过;静态时退回纯色,避免完成态还在闪。 */
72
+ export function todoLabelSheenStyle(active: boolean): CSSProperties {
73
+ if (!active) return { color: "var(--muted-foreground)" };
74
+ return {
75
+ backgroundImage: `linear-gradient(90deg, ${SHEEN_BASE} 0%, ${SHEEN_BASE} 38%, ${SHEEN_HIGHLIGHT} 50%, ${SHEEN_BASE} 62%, ${SHEEN_BASE} 100%)`,
76
+ backgroundSize: "160% 100%",
77
+ WebkitBackgroundClip: "text",
78
+ backgroundClip: "text",
79
+ color: "transparent",
80
+ animation: "todo-label-sheen 2.6s linear infinite",
81
+ };
82
+ }
83
+
84
+ /**
85
+ * 状态点:未完成时是呼吸的主色点,全部完成时是静止的绿点。
86
+ * 取代了原先的数字徽标。
87
+ */
88
+ export function TodoStatusDot({ allDone, className }: { allDone: boolean; className?: string }): JSX.Element {
89
+ return (
90
+ <span aria-hidden className={cn("relative flex h-2 w-2 shrink-0 items-center justify-center", className)}>
91
+ {allDone ? (
92
+ <span className="h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-emerald-500)_18%,transparent)]" />
93
+ ) : (
94
+ <>
95
+ <span
96
+ className="absolute h-1.5 w-1.5 rounded-full bg-primary"
97
+ style={{ animation: "todo-dot-halo 2.2s ease-out infinite" }}
98
+ />
99
+ <span
100
+ className="relative h-1.5 w-1.5 rounded-full bg-primary"
101
+ style={{ animation: "todo-dot-core 2.2s ease-in-out infinite" }}
102
+ />
103
+ </>
104
+ )}
105
+ </span>
106
+ );
107
+ }
108
+
109
+ /** 细进度条:popover 头部与活动面板头部共用。 */
110
+ export function TodoProgressBar({ percent, className }: { percent: number; className?: string }): JSX.Element {
111
+ return (
112
+ <div className={cn("h-1 overflow-hidden rounded-full bg-muted/60", className)}>
113
+ <div
114
+ className="h-full rounded-full bg-primary transition-[width] duration-500 ease-out"
115
+ style={{ width: `${percent}%` }}
116
+ />
117
+ </div>
118
+ );
119
+ }
120
+
121
+ function TodoMarker({ status }: { status: TodoStatusItem["status"] }): JSX.Element {
122
+ if (status === "done") {
123
+ return (
124
+ <span className="flex h-[15px] w-[15px] items-center justify-center rounded-full bg-primary text-primary-foreground">
125
+ <span aria-hidden className="icon-[mdi--check] h-2.5 w-2.5" />
126
+ </span>
127
+ );
128
+ }
129
+ if (status === "in_progress") {
130
+ return (
131
+ <span className="relative flex h-[15px] w-[15px] items-center justify-center">
132
+ <span className="absolute inset-0 rounded-full border border-primary/25" />
133
+ <span
134
+ className="absolute inset-0 rounded-full border border-transparent border-t-primary border-r-primary"
135
+ style={{ animation: "todo-marker-spin 1.1s linear infinite" }}
136
+ />
137
+ <span className="h-1 w-1 rounded-full bg-primary" />
138
+ </span>
139
+ );
140
+ }
141
+ return <span className="h-[15px] w-[15px] rounded-full border border-muted-foreground/30" />;
142
+ }
143
+
144
+ export interface TodoTimelineProps {
145
+ readonly items: readonly TodoStatusItem[];
146
+ readonly labels: TodoTimelineLabels;
147
+ /** `sm` 用于 popover,`md` 用于活动面板。 */
148
+ readonly size?: "sm" | "md";
149
+ readonly className?: string;
150
+ }
151
+
152
+ /** 待办清单本体:左侧连成一条时间线,进行中条目高亮并带光斑。 */
153
+ export function TodoTimeline({ items, labels, size = "sm", className }: TodoTimelineProps): JSX.Element {
154
+ const text = size === "sm" ? "text-[12px]" : "text-[13px]";
155
+ const rowPadding = size === "sm" ? "px-2 py-1.5" : "px-2.5 py-2";
156
+ // 连接线要跨过行间距接上下一个圆点:向下溢出正好一个行内边距。
157
+ const connectorBottom = size === "sm" ? "-6px" : "-8px";
158
+ return (
159
+ <ul className={cn("flex flex-col", className)}>
160
+ {items.map((item, index) => {
161
+ const isDone = item.status === "done";
162
+ const isActive = item.status === "in_progress";
163
+ const statusLabel = isDone
164
+ ? labels.statusDone
165
+ : isActive
166
+ ? labels.statusInProgress
167
+ : labels.statusPending;
168
+ return (
169
+ <li
170
+ key={item.id}
171
+ className={cn(
172
+ "group relative flex items-start gap-2.5 rounded-lg transition-colors",
173
+ rowPadding,
174
+ isActive ? "bg-primary/[0.06]" : "hover:bg-muted/40",
175
+ )}
176
+ >
177
+ <span className="relative flex w-[15px] shrink-0 flex-col items-center self-stretch">
178
+ <TodoMarker status={item.status} />
179
+ {index < items.length - 1 && (
180
+ <span
181
+ aria-hidden
182
+ className="absolute left-1/2 top-[17px] w-px -translate-x-1/2 bg-border"
183
+ style={{ bottom: connectorBottom }}
184
+ />
185
+ )}
186
+ </span>
187
+ <span
188
+ className={cn(
189
+ "min-w-0 flex-1 leading-snug transition-colors",
190
+ text,
191
+ isDone && "text-muted-foreground line-through decoration-muted-foreground/40",
192
+ !isDone && !isActive && "text-foreground",
193
+ )}
194
+ style={isActive ? todoLabelSheenStyle(true) : undefined}
195
+ title={item.content}
196
+ >
197
+ {item.content}
198
+ </span>
199
+ <span className="sr-only">{statusLabel}</span>
200
+ </li>
201
+ );
202
+ })}
203
+ </ul>
204
+ );
205
+ }