@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.
- package/package.json +195 -0
- package/src/action-approval/AppearanceActionPickerView.tsx +291 -0
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +69 -0
- package/src/action-approval/AppearancePickerApprovalView.tsx +31 -0
- package/src/action-approval/ApprovalParts.tsx +376 -0
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +138 -0
- package/src/action-approval/BatchTasksExecutionApprovalView.tsx +158 -0
- package/src/action-approval/BatchTasksTaskApprovalView.tsx +152 -0
- package/src/action-approval/GeneralSetExecutionModeApprovalView.tsx +76 -0
- package/src/action-approval/GenericActionApprovalView.tsx +127 -0
- package/src/action-approval/ManageActionApprovalFrameTypes.ts +27 -0
- package/src/action-approval/ManageActionApprovalFrameView.tsx +136 -0
- package/src/action-approval/NavigationOpenApprovalView.tsx +119 -0
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +191 -0
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +113 -0
- package/src/action-approval/SchedulerUpdateApprovalView.tsx +14 -0
- package/src/action-approval/ThemeChangeApprovalView.tsx +30 -0
- package/src/action-approval/WebhookDeleteApprovalView.tsx +56 -0
- package/src/action-approval/WebhookTestApprovalView.tsx +51 -0
- package/src/action-approval/cn.ts +4 -0
- package/src/action-approval/index.ts +88 -0
- package/src/activity/ActivityPanel.tsx +269 -0
- package/src/activity/ActivityPanelFrame.tsx +36 -0
- package/src/activity/BackgroundTasksTabPanelView.tsx +382 -0
- package/src/activity/BatchProgressTabPanelView.tsx +22 -0
- package/src/activity/BrowserPanelView.tsx +169 -0
- package/src/activity/ChatTabPanelView.tsx +36 -0
- package/src/activity/CodePreview.tsx +57 -0
- package/src/activity/DebugTabPanelView.tsx +67 -0
- package/src/activity/FileTabContentView.tsx +46 -0
- package/src/activity/FloatingActivityTabView.tsx +107 -0
- package/src/activity/HtmlPreviewView.tsx +135 -0
- package/src/activity/JourneyPanelView.tsx +327 -0
- package/src/activity/KnowledgeHistoryPanelView.tsx +93 -0
- package/src/activity/MarkdownPreviewView.tsx +217 -0
- package/src/activity/PluginTabPickerView.tsx +182 -0
- package/src/activity/RequestHistorySubTabView.tsx +102 -0
- package/src/activity/ScheduleExecutionTabPanelView.tsx +162 -0
- package/src/activity/TodoTabPanelView.tsx +66 -0
- package/src/activity/ToolCallsSubTabView.tsx +184 -0
- package/src/activity/WorkflowTabPanelView.tsx +129 -0
- package/src/activity/index.ts +110 -0
- package/src/app/AppBackground.tsx +24 -0
- package/src/app/AppBootLoadingView.tsx +51 -0
- package/src/app/RouteContentLoadingView.tsx +20 -0
- package/src/app/index.ts +13 -0
- package/src/app-boot.ts +1 -0
- package/src/app-shell/DefaultPageHeader.tsx +46 -0
- package/src/app-shell/DefaultWindowControls.tsx +32 -0
- package/src/app-shell/PageHeaderActionGroup.tsx +15 -0
- package/src/app-shell/PageHeaderContent.tsx +70 -0
- package/src/app-shell/PageHeaderFrame.tsx +53 -0
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +21 -0
- package/src/app-shell/PageHeaderTitle.tsx +25 -0
- package/src/app-shell/PageHeaderWindowActions.tsx +22 -0
- package/src/app-shell/WindowControlButton.tsx +35 -0
- package/src/app-shell/index.ts +49 -0
- package/src/appearance/BackgroundImageFrame.tsx +57 -0
- package/src/appearance/CenterSliceImageFrame.tsx +64 -0
- package/src/appearance/CornerImageFrame.tsx +63 -0
- package/src/appearance/HorizontalSliceImageFrame.tsx +97 -0
- package/src/appearance/NineSliceImageFrame.tsx +65 -0
- package/src/appearance/ThemeSurface.tsx +91 -0
- package/src/appearance/index.ts +12 -0
- package/src/batch-tasks/BatchProjectArtifactFieldView.tsx +36 -0
- package/src/batch-tasks/BatchProjectDialogView.tsx +61 -0
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +108 -0
- package/src/batch-tasks/BatchProjectGroupView.tsx +77 -0
- package/src/batch-tasks/BatchProjectNameFieldView.tsx +29 -0
- package/src/batch-tasks/BatchProjectNotificationFieldView.tsx +42 -0
- package/src/batch-tasks/BatchProjectRuntimeFieldsView.tsx +67 -0
- package/src/batch-tasks/BatchTaskActionButtonsView.tsx +67 -0
- package/src/batch-tasks/BatchTaskCardView.tsx +142 -0
- package/src/batch-tasks/BatchTaskGridView.tsx +95 -0
- package/src/batch-tasks/BatchTaskListView.tsx +10 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +73 -0
- package/src/batch-tasks/BatchTaskProjectBlockView.tsx +117 -0
- package/src/batch-tasks/BatchTaskProjectHeaderView.tsx +74 -0
- package/src/batch-tasks/BatchTasksPageView.tsx +126 -0
- package/src/batch-tasks/batchTaskUi.tsx +101 -0
- package/src/batch-tasks/index.ts +70 -0
- package/src/batch-tasks/types.ts +120 -0
- package/src/chat/ActionButtonBarView.tsx +45 -0
- package/src/chat/AgentAvatarView.tsx +59 -0
- package/src/chat/AppshotCardView.tsx +89 -0
- package/src/chat/AskUserQuestionView.tsx +177 -0
- package/src/chat/AssistantMessageView.tsx +147 -0
- package/src/chat/AtPanelView.tsx +220 -0
- package/src/chat/BackgroundTasksBadgeView.tsx +28 -0
- package/src/chat/BashTerminalCard.tsx +225 -0
- package/src/chat/ChatExportHostView.tsx +17 -0
- package/src/chat/ChatHeaderActionsView.tsx +75 -0
- package/src/chat/ContextRingView.tsx +100 -0
- package/src/chat/CopyIconButton.tsx +61 -0
- package/src/chat/DefaultGuidingWords.tsx +75 -0
- package/src/chat/DefaultSceneCarousel.tsx +113 -0
- package/src/chat/DefaultSkillBadgeRow.tsx +103 -0
- package/src/chat/DrawerCard.tsx +149 -0
- package/src/chat/EditDiffView.tsx +137 -0
- package/src/chat/ExecutionModeSelectorView.tsx +124 -0
- package/src/chat/ExportMessageListView.tsx +20 -0
- package/src/chat/GuideBadgeSwiperView.tsx +79 -0
- package/src/chat/InlineTokenChip.tsx +68 -0
- package/src/chat/InputActionBarView.tsx +112 -0
- package/src/chat/InputBarBackground.tsx +25 -0
- package/src/chat/InputBarCapsule.tsx +56 -0
- package/src/chat/InputBarContextMenuView.tsx +79 -0
- package/src/chat/InputBarPlaceholder.tsx +84 -0
- package/src/chat/InputBarToolbarButton.tsx +42 -0
- package/src/chat/KnowledgeToolViews.tsx +119 -0
- package/src/chat/LiveThinkingView.tsx +102 -0
- package/src/chat/MessageActions.tsx +109 -0
- package/src/chat/MessageBlockSegmentsView.tsx +203 -0
- package/src/chat/MessageBoundaryViews.tsx +93 -0
- package/src/chat/MessageCardsView.tsx +126 -0
- package/src/chat/MessageFeedContext.tsx +14 -0
- package/src/chat/MessageFeedLayoutView.tsx +97 -0
- package/src/chat/MessageFeedView.tsx +228 -0
- package/src/chat/MessageInputView.tsx +193 -0
- package/src/chat/MessageLayoutView.tsx +156 -0
- package/src/chat/MessageListFooterView.tsx +127 -0
- package/src/chat/MessageSelectionContextMenuView.tsx +66 -0
- package/src/chat/MessageTimelineView.tsx +261 -0
- package/src/chat/MessageView.tsx +82 -0
- package/src/chat/MessageVisualView.tsx +43 -0
- package/src/chat/ModelSelectorView.tsx +407 -0
- package/src/chat/NewSession.ts +107 -0
- package/src/chat/NewSessionBackground.tsx +54 -0
- package/src/chat/NewSessionPageLayoutView.tsx +96 -0
- package/src/chat/NewSessionPicker.tsx +270 -0
- package/src/chat/ProgressGroupView.tsx +323 -0
- package/src/chat/ProjectSelectorView.tsx +253 -0
- package/src/chat/QueueCardView.tsx +151 -0
- package/src/chat/ReadImageView.tsx +73 -0
- package/src/chat/SandboxGrantsBadgeView.tsx +101 -0
- package/src/chat/SandboxPermissionCard.tsx +64 -0
- package/src/chat/SceneCard.tsx +138 -0
- package/src/chat/SendButton.tsx +135 -0
- package/src/chat/SessionDropZoneView.tsx +85 -0
- package/src/chat/SessionViewerPageView.tsx +56 -0
- package/src/chat/SkillCard.tsx +56 -0
- package/src/chat/SkillPromptAreaView.tsx +129 -0
- package/src/chat/SuggestionBubblesView.tsx +58 -0
- package/src/chat/TextBlockView.tsx +770 -0
- package/src/chat/TextPreview.tsx +37 -0
- package/src/chat/ThinkingBlockView.tsx +183 -0
- package/src/chat/TodoCard.tsx +243 -0
- package/src/chat/TodoProgress.tsx +205 -0
- package/src/chat/TodoStatusBarView.tsx +140 -0
- package/src/chat/ToolCallBlockView.tsx +188 -0
- package/src/chat/UsageBarView.tsx +19 -0
- package/src/chat/UserMessageContextMenuView.tsx +87 -0
- package/src/chat/UserMessageView.tsx +241 -0
- package/src/chat/WorkflowFooterItemsView.tsx +170 -0
- package/src/chat/WriteContentView.tsx +12 -0
- package/src/chat/index.ts +524 -0
- package/src/chat/markdown-link.test.ts +238 -0
- package/src/chat/markdown-link.ts +279 -0
- package/src/chat/send-button.css +318 -0
- package/src/chat/useHorizontalDragScroll.ts +146 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +62 -0
- package/src/file-explorer/FileContextMenuView.tsx +209 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +82 -0
- package/src/file-explorer/FileTreeNodeView.tsx +274 -0
- package/src/file-explorer/FileTreeView.tsx +301 -0
- package/src/file-explorer/FilesPanelView.tsx +91 -0
- package/src/file-explorer/drag-target.test.ts +34 -0
- package/src/file-explorer/drag-target.ts +26 -0
- package/src/file-explorer/fileIcons.ts +1 -0
- package/src/file-explorer/index.ts +28 -0
- package/src/file-explorer/nativeFileDrag.test.ts +30 -0
- package/src/file-explorer/nativeFileDrag.ts +14 -0
- package/src/file-explorer/types.ts +40 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +115 -0
- package/src/file-preview/FilePreviewDialogView.tsx +241 -0
- package/src/file-preview/FilePreviewView.tsx +162 -0
- package/src/file-preview/LightboxImageView.tsx +131 -0
- package/src/file-preview/PluginFilePreviewView.tsx +24 -0
- package/src/file-preview/PreviewBodyView.tsx +99 -0
- package/src/file-preview/PreviewErrorBoundary.tsx +51 -0
- package/src/file-preview/TextCodeEditorView.tsx +72 -0
- package/src/file-preview/TextFileEditorView.tsx +213 -0
- package/src/file-preview/index.ts +56 -0
- package/src/file-preview/keyboard-target.test.ts +49 -0
- package/src/file-preview/keyboard-target.ts +33 -0
- package/src/file-preview/syntax-tokens.css +77 -0
- package/src/file-preview/syntax-tokens.test.ts +31 -0
- package/src/file-preview/syntax-tokens.ts +155 -0
- package/src/file-preview/text-code-editor-theme.ts +321 -0
- package/src/file-preview/text-editor-language.test.ts +58 -0
- package/src/file-preview/text-editor-language.ts +182 -0
- package/src/file-preview/types.ts +29 -0
- package/src/flowing/FlowingPanelView.tsx +79 -0
- package/src/flowing/FlowingWorkflowView.tsx +54 -0
- package/src/flowing/UserNodeView.tsx +148 -0
- package/src/flowing/WorkflowBindDialogView.tsx +145 -0
- package/src/flowing/WorkflowProgressView.tsx +149 -0
- package/src/flowing/index.ts +27 -0
- package/src/flowing-chat/ChatBubbleView.tsx +219 -0
- package/src/flowing-chat/ChatComposerView.tsx +362 -0
- package/src/flowing-chat/ChatMembersBarView.tsx +86 -0
- package/src/flowing-chat/ChatPanelView.tsx +73 -0
- package/src/flowing-chat/index.ts +21 -0
- package/src/index.ts +22 -0
- package/src/knowledge/KnowledgeBaseSwitcherView.tsx +154 -0
- package/src/knowledge/KnowledgeBreadcrumbView.tsx +92 -0
- package/src/knowledge/KnowledgeContentsPanelView.tsx +77 -0
- package/src/knowledge/KnowledgeContextMenuView.tsx +70 -0
- package/src/knowledge/KnowledgeFilesSkeleton.tsx +22 -0
- package/src/knowledge/KnowledgeGridView.tsx +113 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +85 -0
- package/src/knowledge/KnowledgeImportDialogView.tsx +153 -0
- package/src/knowledge/KnowledgeListView.tsx +107 -0
- package/src/knowledge/KnowledgePendingFilesDialogView.tsx +76 -0
- package/src/knowledge/KnowledgeProcessingBadgeView.tsx +18 -0
- package/src/knowledge/KnowledgeRenameDialogView.tsx +66 -0
- package/src/knowledge/KnowledgeSourcePickerView.tsx +60 -0
- package/src/knowledge/KnowledgeViewShared.tsx +103 -0
- package/src/knowledge/cn.ts +4 -0
- package/src/knowledge/coloredFileIcons.ts +1 -0
- package/src/knowledge/index.ts +66 -0
- package/src/knowledge/types.ts +31 -0
- package/src/knowledge/useMarqueeSelection.ts +95 -0
- package/src/layout/AppFrame.tsx +34 -0
- package/src/layout/MainContentFrame.tsx +54 -0
- package/src/layout/ResizeHandle.tsx +91 -0
- package/src/layout/SidebarDock.tsx +33 -0
- package/src/layout/SidebarOverlay.tsx +36 -0
- package/src/layout/index.ts +10 -0
- package/src/overlays/CommandMenuRow.tsx +119 -0
- package/src/overlays/CommandMenuView.tsx +183 -0
- package/src/overlays/ConfirmDialogView.tsx +109 -0
- package/src/overlays/DetailDrawer.tsx +63 -0
- package/src/overlays/DetailDrawerEnter.tsx +37 -0
- package/src/overlays/KnowledgeDropOverlayView.tsx +43 -0
- package/src/overlays/RouteErrorPageView.tsx +72 -0
- package/src/overlays/ToasterView.tsx +76 -0
- package/src/overlays/UpdateCheckerView.tsx +206 -0
- package/src/overlays/UpdateRestartDialogView.tsx +107 -0
- package/src/overlays/command-menu-types.ts +47 -0
- package/src/overlays/command-menu.css +69 -0
- package/src/overlays/detail-drawer-guard.test.ts +16 -0
- package/src/overlays/detail-drawer-guard.ts +13 -0
- package/src/overlays/index.ts +44 -0
- package/src/plugin-ui/index.ts +26 -0
- package/src/project/BatchQueueStatusView.tsx +352 -0
- package/src/project/ConversationTagDotsView.tsx +130 -0
- package/src/project/ConversationTagEditorDialogView.tsx +273 -0
- package/src/project/DefaultConversationSectionView.tsx +74 -0
- package/src/project/DefaultSessionListView.tsx +128 -0
- package/src/project/DefaultSessionRowView.tsx +125 -0
- package/src/project/NewProjectDialogView.tsx +140 -0
- package/src/project/ProjectContextMenuView.tsx +187 -0
- package/src/project/ProjectDetailPageView.tsx +351 -0
- package/src/project/ProjectGroupView.tsx +37 -0
- package/src/project/ProjectRowView.tsx +111 -0
- package/src/project/ProjectSessionsLoadingView.tsx +14 -0
- package/src/project/ProjectSessionsView.tsx +96 -0
- package/src/project/ProjectsLoadingView.tsx +15 -0
- package/src/project/ProjectsPanelMenusView.tsx +23 -0
- package/src/project/ProjectsPanelView.tsx +56 -0
- package/src/project/QuickScrollOverlay.tsx +188 -0
- package/src/project/ScheduleStatusView.tsx +110 -0
- package/src/project/SessionContextMenuView.tsx +71 -0
- package/src/project/SessionRenameInputView.tsx +49 -0
- package/src/project/SessionRowView.tsx +119 -0
- package/src/project/SidebarProjectsSectionView.tsx +35 -0
- package/src/project/index.ts +87 -0
- package/src/project/types.ts +21 -0
- package/src/project/useActiveSessionAutoScroll.ts +171 -0
- package/src/registry.ts +62 -0
- package/src/scheduler/AutomationPageView.tsx +159 -0
- package/src/scheduler/ExecutionHistoryView.tsx +179 -0
- package/src/scheduler/HistoryDrawerView.tsx +149 -0
- package/src/scheduler/TaskFormDialogView.tsx +60 -0
- package/src/scheduler/TaskListView.tsx +219 -0
- package/src/scheduler/index.ts +30 -0
- package/src/settings/AchievementNavigationButtonView.tsx +90 -0
- package/src/settings/AchievementPromotionDialogView.tsx +91 -0
- package/src/settings/AchievementSettingsView.tsx +44 -0
- package/src/settings/AppshotSettingsView.tsx +132 -0
- package/src/settings/ArchivedProjectsSettingsView.tsx +80 -0
- package/src/settings/BuiltinMcpSecretsDialogView.tsx +278 -0
- package/src/settings/BuiltinMcpSectionView.tsx +164 -0
- package/src/settings/EnvironmentSettingsView.tsx +176 -0
- package/src/settings/GeneralSettingsView.tsx +174 -0
- package/src/settings/ImChannelCardView.tsx +152 -0
- package/src/settings/ImChannelGuideDialogView.tsx +126 -0
- package/src/settings/ImFeishuDialogView.tsx +156 -0
- package/src/settings/ImLegacyImportBannerView.tsx +44 -0
- package/src/settings/ImLogDrawerView.tsx +75 -0
- package/src/settings/ImStatusBadgeView.tsx +39 -0
- package/src/settings/McpDefaultIcon.tsx +27 -0
- package/src/settings/McpJsonEditorView.tsx +56 -0
- package/src/settings/ModelsProviderFormView.tsx +128 -0
- package/src/settings/ModelsProvidersSectionView.tsx +52 -0
- package/src/settings/MotionSelect.tsx +125 -0
- package/src/settings/PermissionsSettingsView.tsx +106 -0
- package/src/settings/PetBubbleStylePreviewView.tsx +44 -0
- package/src/settings/PetSettingsView.tsx +165 -0
- package/src/settings/PresetProviderModelsListView.tsx +58 -0
- package/src/settings/PresetProviderRowView.tsx +302 -0
- package/src/settings/PresetProvidersSectionView.tsx +70 -0
- package/src/settings/QrBindDialogView.tsx +165 -0
- package/src/settings/QuickPanelSettingsSectionView.tsx +66 -0
- package/src/settings/RemoteMcpSectionView.tsx +192 -0
- package/src/settings/SettingChrome.tsx +104 -0
- package/src/settings/SettingsAiAssistButtonView.tsx +150 -0
- package/src/settings/SettingsAiAssistDialogView.tsx +251 -0
- package/src/settings/SettingsFormFields.tsx +121 -0
- package/src/settings/SettingsPageShellView.tsx +84 -0
- package/src/settings/SettingsSidebarView.tsx +133 -0
- package/src/settings/ShortcutRecorderView.tsx +88 -0
- package/src/settings/ShortcutsSettingsView.tsx +66 -0
- package/src/settings/SubscriptionActionsView.tsx +63 -0
- package/src/settings/SubscriptionCardsView.tsx +212 -0
- package/src/settings/TeamDetailView.tsx +148 -0
- package/src/settings/TeamDialogsView.tsx +151 -0
- package/src/settings/TeamListView.tsx +57 -0
- package/src/settings/TeamSettingsView.tsx +51 -0
- package/src/settings/TokenActivityChartView.tsx +286 -0
- package/src/settings/UsageStatsView.tsx +101 -0
- package/src/settings/WebhookEndpointListView.tsx +123 -0
- package/src/settings/WechatBindDialogView.tsx +45 -0
- package/src/settings/achievements/AchievementCurtains.tsx +50 -0
- package/src/settings/achievements/AchievementPromotionBadge3D.tsx +350 -0
- package/src/settings/achievements/AchievementPromotionConfetti.tsx +71 -0
- package/src/settings/achievements/AchievementTitle.tsx +52 -0
- package/src/settings/achievements/index.ts +13 -0
- package/src/settings/index.ts +226 -0
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +135 -0
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +40 -0
- package/src/settings/token-activity.test.ts +195 -0
- package/src/settings/token-activity.ts +320 -0
- package/src/shared/AvatarStackView.tsx +45 -0
- package/src/shared/BotAvatar.tsx +395 -0
- package/src/shared/CodeBlockCopyButton.tsx +48 -0
- package/src/shared/CollapsePanel.tsx +125 -0
- package/src/shared/ContextMenuView.tsx +134 -0
- package/src/shared/MacKeyboardPreview.tsx +260 -0
- package/src/shared/MarkdownTable.tsx +216 -0
- package/src/shared/MultiplierTag.tsx +15 -0
- package/src/shared/ScrollFade.tsx +114 -0
- package/src/shared/SegmentedControl.tsx +82 -0
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.tsx +696 -0
- package/src/shared/TimePicker.tsx +96 -0
- package/src/shared/connected-tab-outline.test.ts +22 -0
- package/src/shared/connected-tab-outline.ts +39 -0
- package/src/shared/fileIcons.test.ts +28 -0
- package/src/shared/fileIcons.ts +322 -0
- package/src/shared/index.ts +38 -0
- package/src/shared/markdown-table-clipboard.ts +31 -0
- package/src/shared/provider-icon/icons.ts +56 -0
- package/src/shared/provider-icon/index.tsx +42 -0
- package/src/shared/provider-icon/svg-url.d.ts +4 -0
- package/src/shared/tab-drag.test.ts +14 -0
- package/src/shared/tab-drag.ts +15 -0
- package/src/shared/useDelayedUnmount.ts +36 -0
- package/src/sidebar/AddProjectMenuItem.tsx +21 -0
- package/src/sidebar/AddProjectMenuPopoverView.tsx +52 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +50 -0
- package/src/sidebar/ChatMessageListView.tsx +66 -0
- package/src/sidebar/DefaultSidebar.tsx +91 -0
- package/src/sidebar/FlowingMessageListView.tsx +111 -0
- package/src/sidebar/MessageCenterDialogView.tsx +81 -0
- package/src/sidebar/MessageCenterEmptyState.tsx +24 -0
- package/src/sidebar/MessageCenterTabs.tsx +86 -0
- package/src/sidebar/MessageCenterToolbarButton.tsx +25 -0
- package/src/sidebar/MessageCenterTriggerView.tsx +39 -0
- package/src/sidebar/NotificationMessageListView.tsx +136 -0
- package/src/sidebar/ProjectsPanelEmptyState.tsx +20 -0
- package/src/sidebar/RunningPulseDot.tsx +10 -0
- package/src/sidebar/SessionStatusIcon.tsx +43 -0
- package/src/sidebar/SettingsMenuAccountSection.tsx +32 -0
- package/src/sidebar/SettingsMenuActionButton.tsx +24 -0
- package/src/sidebar/SettingsMenuDivider.tsx +5 -0
- package/src/sidebar/SettingsMenuQuotaSection.tsx +45 -0
- package/src/sidebar/SettingsMenuSettingsItem.tsx +18 -0
- package/src/sidebar/SettingsMenuThemeSection.tsx +51 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +65 -0
- package/src/sidebar/ShowMoreSessionsButton.tsx +37 -0
- package/src/sidebar/SidebarFilterSelectView.tsx +95 -0
- package/src/sidebar/SidebarNavBadgeView.tsx +58 -0
- package/src/sidebar/SidebarNavIcon.tsx +33 -0
- package/src/sidebar/SidebarNavItemButton.tsx +59 -0
- package/src/sidebar/SidebarNavMorePanel.tsx +199 -0
- package/src/sidebar/SidebarNavigation.tsx +223 -0
- package/src/sidebar/SidebarPanel.tsx +48 -0
- package/src/sidebar/SidebarTopBar.tsx +103 -0
- package/src/sidebar/SidebarUpdateIcon.tsx +79 -0
- package/src/sidebar/index.ts +118 -0
- package/src/sidebar/nav-badge-text.test.ts +23 -0
- package/src/sidebar/nav-badge-text.ts +19 -0
- package/src/sidebar/useSidebarNavDrag.ts +139 -0
- package/src/skills/PluginCardView.tsx +150 -0
- package/src/skills/SceneCardView.tsx +194 -0
- package/src/skills/SkillCardView.tsx +186 -0
- package/src/skills/SkillDetailDialogView.tsx +138 -0
- package/src/skills/SkillTagGroupView.tsx +56 -0
- package/src/skills/SkillToggleSwitch.tsx +31 -0
- package/src/skills/index.ts +29 -0
- package/src/skills/skill-icon.test.ts +38 -0
- package/src/skills/skill-icon.tsx +126 -0
- package/src/styles.css +75 -0
- package/src/utils/platform.ts +2 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
|
|
3
|
+
function TagChip({ label, count }: { label: string; count?: number }): JSX.Element {
|
|
4
|
+
return (
|
|
5
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-primary/25 bg-primary/10 px-2 py-0.5 text-[11px] text-primary">
|
|
6
|
+
<span className="icon-[mdi--tag-outline] h-3 w-3 opacity-70" />
|
|
7
|
+
{label}
|
|
8
|
+
{count !== undefined && <span className="text-[10px] text-primary/60">{count}</span>}
|
|
9
|
+
</span>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface KbFilterPageItem {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
summary: string | null;
|
|
17
|
+
tags: readonly string[];
|
|
18
|
+
absolutePath: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface KbFilterByTagsViewProps {
|
|
22
|
+
emptyLabel: string;
|
|
23
|
+
hitCountLabel: string;
|
|
24
|
+
pages: readonly KbFilterPageItem[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** kb_filter_by_tags:命中页列表(标题 + 摘要 + 标签 + 路径)。 */
|
|
28
|
+
export function KbFilterByTagsView({
|
|
29
|
+
emptyLabel,
|
|
30
|
+
hitCountLabel,
|
|
31
|
+
pages,
|
|
32
|
+
}: KbFilterByTagsViewProps): JSX.Element {
|
|
33
|
+
if (pages.length === 0) {
|
|
34
|
+
return <div className="py-1 text-[11px] text-muted-foreground/50">{emptyLabel}</div>;
|
|
35
|
+
}
|
|
36
|
+
return (
|
|
37
|
+
<div className="flex flex-col gap-1.5">
|
|
38
|
+
<div className="text-[11px] text-muted-foreground/60">{hitCountLabel}</div>
|
|
39
|
+
{pages.map((p) => (
|
|
40
|
+
<div key={p.id} className="rounded-lg border border-input/60 bg-muted/20 px-2.5 py-1.5">
|
|
41
|
+
<div className="text-[12px] font-medium text-foreground">{p.title}</div>
|
|
42
|
+
{p.summary && <div className="mt-0.5 text-[11px] text-muted-foreground/70">{p.summary}</div>}
|
|
43
|
+
{p.tags.length > 0 && (
|
|
44
|
+
<div className="mt-1 flex flex-wrap gap-1">
|
|
45
|
+
{p.tags.map((tag) => (
|
|
46
|
+
<TagChip key={tag} label={tag} />
|
|
47
|
+
))}
|
|
48
|
+
</div>
|
|
49
|
+
)}
|
|
50
|
+
<div className="mt-1 truncate text-[10px] text-muted-foreground/40" title={p.absolutePath}>
|
|
51
|
+
{p.absolutePath}
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface KbTagItem {
|
|
60
|
+
tag: string;
|
|
61
|
+
count: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface KbListTagsViewProps {
|
|
65
|
+
emptyLabel: string;
|
|
66
|
+
tagCountLabel: string;
|
|
67
|
+
tags: readonly KbTagItem[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** kb_list_available_tags:标签云(带页数)。 */
|
|
71
|
+
export function KbListTagsView({ emptyLabel, tagCountLabel, tags }: KbListTagsViewProps): JSX.Element {
|
|
72
|
+
if (tags.length === 0) {
|
|
73
|
+
return <div className="py-1 text-[11px] text-muted-foreground/50">{emptyLabel}</div>;
|
|
74
|
+
}
|
|
75
|
+
return (
|
|
76
|
+
<div className="flex flex-col gap-1.5">
|
|
77
|
+
<div className="text-[11px] text-muted-foreground/60">{tagCountLabel}</div>
|
|
78
|
+
<div className="flex flex-wrap gap-1.5">
|
|
79
|
+
{tags.map((item) => (
|
|
80
|
+
<TagChip key={item.tag} label={item.tag} count={item.count} />
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface KbWritePageViewProps {
|
|
88
|
+
emptyLabel: string;
|
|
89
|
+
actionLabel: string;
|
|
90
|
+
actionIcon: string;
|
|
91
|
+
absolutePath: string;
|
|
92
|
+
movedFromLabel: string | null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** kb_write_page:写入结果(动作 + 路径)。 */
|
|
96
|
+
export function KbWritePageView({
|
|
97
|
+
emptyLabel,
|
|
98
|
+
actionLabel,
|
|
99
|
+
actionIcon,
|
|
100
|
+
absolutePath,
|
|
101
|
+
movedFromLabel,
|
|
102
|
+
isEmpty,
|
|
103
|
+
}: KbWritePageViewProps & { isEmpty?: boolean }): JSX.Element {
|
|
104
|
+
if (isEmpty) {
|
|
105
|
+
return <div className="py-1 text-[11px] text-muted-foreground/50">{emptyLabel}</div>;
|
|
106
|
+
}
|
|
107
|
+
return (
|
|
108
|
+
<div className="flex flex-col gap-1 rounded-lg border border-input/60 bg-muted/20 px-2.5 py-1.5">
|
|
109
|
+
<div className="flex items-center gap-1.5 text-[12px] font-medium text-foreground">
|
|
110
|
+
<span className={`${actionIcon} h-3.5 w-3.5 text-primary`} />
|
|
111
|
+
{actionLabel}
|
|
112
|
+
</div>
|
|
113
|
+
<div className="truncate text-[11px] text-muted-foreground/70" title={absolutePath}>
|
|
114
|
+
{absolutePath}
|
|
115
|
+
</div>
|
|
116
|
+
{movedFromLabel && <div className="text-[10px] text-muted-foreground/40">{movedFromLabel}</div>}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { motion } from "motion/react";
|
|
2
|
+
import type { Transition } from "motion/react";
|
|
3
|
+
import type { CSSProperties, JSX } from "react";
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
|
+
|
|
6
|
+
/** 卡片内滚动窗口高度(px),约 3 行正文。 */
|
|
7
|
+
const VIEWPORT_HEIGHT = 64;
|
|
8
|
+
/** 上下渐隐高度(px)。 */
|
|
9
|
+
const FADE_SIZE = 16;
|
|
10
|
+
/** 每帧向目标位置逼近的比例,越小拖尾越长。 */
|
|
11
|
+
const SCROLL_EASING = 0.14;
|
|
12
|
+
|
|
13
|
+
/** 入场:从零高度展开并轻微上浮。 */
|
|
14
|
+
const CARD_INITIAL = { opacity: 0, height: 0, y: 8 };
|
|
15
|
+
const CARD_ANIMATE = { opacity: 1, height: "auto", y: 0 };
|
|
16
|
+
const CARD_TRANSITION = {
|
|
17
|
+
duration: 0.32,
|
|
18
|
+
ease: [0.22, 1, 0.36, 1] as const,
|
|
19
|
+
} satisfies Transition;
|
|
20
|
+
|
|
21
|
+
function prefersReducedMotion(): boolean {
|
|
22
|
+
return typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 让滚动容器持续缓动追随内容底部:思考文本每次追加都会拉长内容,
|
|
27
|
+
* rAF 逐帧逼近目标位置,形成连续上滚而不是逐段跳变。
|
|
28
|
+
*/
|
|
29
|
+
function useTrailingScrollToBottom(el: HTMLDivElement | null): boolean {
|
|
30
|
+
const [overflowing, setOverflowing] = useState(false);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!el) {
|
|
34
|
+
setOverflowing(false);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const reduced = prefersReducedMotion();
|
|
39
|
+
let frame = requestAnimationFrame(function step() {
|
|
40
|
+
const target = el.scrollHeight - el.clientHeight;
|
|
41
|
+
setOverflowing((prev) => {
|
|
42
|
+
const next = target > 1;
|
|
43
|
+
return prev === next ? prev : next;
|
|
44
|
+
});
|
|
45
|
+
if (reduced) {
|
|
46
|
+
el.scrollTop = target;
|
|
47
|
+
} else {
|
|
48
|
+
const delta = target - el.scrollTop;
|
|
49
|
+
el.scrollTop = Math.abs(delta) < 0.5 ? target : el.scrollTop + delta * SCROLL_EASING;
|
|
50
|
+
}
|
|
51
|
+
frame = requestAnimationFrame(step);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return () => cancelAnimationFrame(frame);
|
|
55
|
+
}, [el]);
|
|
56
|
+
|
|
57
|
+
return overflowing;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface LiveThinkingViewProps {
|
|
61
|
+
/** 正在追加的思考正文。 */
|
|
62
|
+
readonly text: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 正在进行中的思考卡片:渲染在该 thinking block 原本所在的位置(可能在某个阶段组内),
|
|
67
|
+
* 正文在卡片内的固定高度窗口里随流式内容缓动上滚、上下边缘渐隐。思考结束后由宿主
|
|
68
|
+
* 换回原位的折叠条。
|
|
69
|
+
*/
|
|
70
|
+
export function LiveThinkingView({ text }: LiveThinkingViewProps): JSX.Element {
|
|
71
|
+
const [el, setEl] = useState<HTMLDivElement | null>(null);
|
|
72
|
+
const setRef = useCallback((node: HTMLDivElement | null) => setEl(node), []);
|
|
73
|
+
const overflowing = useTrailingScrollToBottom(el);
|
|
74
|
+
|
|
75
|
+
// 内容不足一屏时不加遮罩,否则首行会被无谓地压暗。
|
|
76
|
+
const maskImage = overflowing
|
|
77
|
+
? `linear-gradient(to bottom, transparent 0, black ${FADE_SIZE}px, black calc(100% - ${FADE_SIZE}px), transparent 100%)`
|
|
78
|
+
: undefined;
|
|
79
|
+
const viewportStyle: CSSProperties = {
|
|
80
|
+
maxHeight: VIEWPORT_HEIGHT,
|
|
81
|
+
...(maskImage ? { WebkitMaskImage: maskImage, maskImage } : undefined),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<motion.div
|
|
86
|
+
className="overflow-hidden pt-1"
|
|
87
|
+
initial={CARD_INITIAL}
|
|
88
|
+
animate={CARD_ANIMATE}
|
|
89
|
+
transition={CARD_TRANSITION}
|
|
90
|
+
>
|
|
91
|
+
<div
|
|
92
|
+
ref={setRef}
|
|
93
|
+
className="min-w-0 max-w-full overflow-hidden rounded-xl bg-muted/25 px-3 py-2"
|
|
94
|
+
style={viewportStyle}
|
|
95
|
+
>
|
|
96
|
+
<div className="whitespace-pre-wrap break-words text-[12px] leading-[1.6] text-muted-foreground/55">
|
|
97
|
+
{text}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</motion.div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
|
|
4
|
+
function cn(...parts: Array<string | false | null | undefined>): string {
|
|
5
|
+
return parts.filter(Boolean).join(" ");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function formatTime(timestamp: number): string {
|
|
9
|
+
return new Date(timestamp).toLocaleTimeString("zh-CN", {
|
|
10
|
+
hour12: false,
|
|
11
|
+
hour: "2-digit",
|
|
12
|
+
minute: "2-digit",
|
|
13
|
+
second: "2-digit",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function formatRelativeTime(timestamp: number, now: number): string | null {
|
|
18
|
+
const diffMinutes = Math.floor((now - timestamp) / 60000);
|
|
19
|
+
if (diffMinutes < 5) return null;
|
|
20
|
+
if (diffMinutes < 60) return `${diffMinutes}分钟前`;
|
|
21
|
+
if (diffMinutes < 120) {
|
|
22
|
+
const minutes = diffMinutes % 60;
|
|
23
|
+
return minutes > 0 ? `1小时${minutes}分钟前` : "1小时前";
|
|
24
|
+
}
|
|
25
|
+
if (diffMinutes < 1440) return `${Math.floor(diffMinutes / 60)}小时前`;
|
|
26
|
+
return `${Math.floor(diffMinutes / 1440)}天前`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function formatDuration(seconds: number): string {
|
|
30
|
+
if (seconds < 60) return `${Math.round(seconds)}秒`;
|
|
31
|
+
return `${Math.floor(seconds / 60)}分${Math.round(seconds % 60)}秒`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function RelativeTimeLabel({ endedAt }: { endedAt: number }): JSX.Element | null {
|
|
35
|
+
const [now, setNow] = useState(() => Date.now());
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const timer = window.setInterval(() => setNow(Date.now()), 30000);
|
|
38
|
+
return () => window.clearInterval(timer);
|
|
39
|
+
}, []);
|
|
40
|
+
const label = formatRelativeTime(endedAt, now);
|
|
41
|
+
if (!label) return null;
|
|
42
|
+
return (
|
|
43
|
+
<span className="text-[11px] text-muted-foreground/40" title={formatTime(endedAt)}>
|
|
44
|
+
{label}
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface CopyButtonLabels {
|
|
50
|
+
readonly copy: string;
|
|
51
|
+
readonly copied: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function CopyButton({
|
|
55
|
+
getText,
|
|
56
|
+
onCopy,
|
|
57
|
+
labels,
|
|
58
|
+
}: {
|
|
59
|
+
getText: () => string;
|
|
60
|
+
onCopy?: () => void | Promise<void>;
|
|
61
|
+
labels: CopyButtonLabels;
|
|
62
|
+
}): JSX.Element {
|
|
63
|
+
const [copied, setCopied] = useState(false);
|
|
64
|
+
const timerRef = useRef<number | null>(null);
|
|
65
|
+
|
|
66
|
+
useEffect(
|
|
67
|
+
() => () => {
|
|
68
|
+
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
69
|
+
},
|
|
70
|
+
[],
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const onClick = useCallback(() => {
|
|
74
|
+
const text = getText();
|
|
75
|
+
if (!text && !onCopy) return;
|
|
76
|
+
const copy = onCopy ? Promise.resolve().then(onCopy) : navigator.clipboard.writeText(text);
|
|
77
|
+
void copy.then(
|
|
78
|
+
() => {
|
|
79
|
+
setCopied(true);
|
|
80
|
+
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
81
|
+
timerRef.current = window.setTimeout(() => {
|
|
82
|
+
setCopied(false);
|
|
83
|
+
timerRef.current = null;
|
|
84
|
+
}, 1500);
|
|
85
|
+
},
|
|
86
|
+
(error) => {
|
|
87
|
+
console.warn("[MessageActions] copy failed", error);
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
}, [getText, onCopy]);
|
|
91
|
+
|
|
92
|
+
const label = copied ? labels.copied : labels.copy;
|
|
93
|
+
return (
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
onClick={onClick}
|
|
97
|
+
title={label}
|
|
98
|
+
aria-label={label}
|
|
99
|
+
className="inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground/45 transition-colors hover:bg-muted/60 hover:text-foreground"
|
|
100
|
+
>
|
|
101
|
+
<span
|
|
102
|
+
className={cn(
|
|
103
|
+
"h-3.5 w-3.5",
|
|
104
|
+
copied ? "icon-[mdi--check]" : "icon-[solar--copy-linear]",
|
|
105
|
+
)}
|
|
106
|
+
/>
|
|
107
|
+
</button>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { motion } from "motion/react";
|
|
2
|
+
import type { Transition } from "motion/react";
|
|
3
|
+
import type { JSX, ReactNode } from "react";
|
|
4
|
+
import { memo, useId, useState } from "react";
|
|
5
|
+
import { CollapsePanel } from "../shared/CollapsePanel";
|
|
6
|
+
import { CopyIconButton } from "./CopyIconButton";
|
|
7
|
+
|
|
8
|
+
/** Slide-up + fade for new message segments (not typewriter). */
|
|
9
|
+
const SEGMENT_INITIAL = { opacity: 0, y: 16 };
|
|
10
|
+
const SEGMENT_ANIMATE = { opacity: 1, y: 0 };
|
|
11
|
+
const SEGMENT_TRANSITION = {
|
|
12
|
+
duration: 0.36,
|
|
13
|
+
ease: [0.22, 1, 0.36, 1] as const,
|
|
14
|
+
} satisfies Transition;
|
|
15
|
+
|
|
16
|
+
export interface ToolCallGroupViewLabels {
|
|
17
|
+
summary: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ToolCallGroupViewProps {
|
|
21
|
+
blockCount: number;
|
|
22
|
+
summary: string;
|
|
23
|
+
allDone: boolean;
|
|
24
|
+
exportMode?: boolean;
|
|
25
|
+
/** Force open (e.g. marketing story while tools stream in). */
|
|
26
|
+
forceExpanded?: boolean;
|
|
27
|
+
/** Expanded tool/thinking rows. */
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function ToolCallGroupView({
|
|
32
|
+
blockCount,
|
|
33
|
+
summary,
|
|
34
|
+
allDone,
|
|
35
|
+
exportMode = false,
|
|
36
|
+
forceExpanded = false,
|
|
37
|
+
children,
|
|
38
|
+
}: ToolCallGroupViewProps): JSX.Element {
|
|
39
|
+
const [expanded, setExpanded] = useState(forceExpanded);
|
|
40
|
+
const generatedId = useId();
|
|
41
|
+
const panelId = exportMode ? `export-tool-group-${generatedId}` : undefined;
|
|
42
|
+
const open = expanded || exportMode || forceExpanded;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="min-w-0 w-full">
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
onClick={() => setExpanded(!expanded)}
|
|
49
|
+
data-export-toggle={panelId}
|
|
50
|
+
aria-expanded={open}
|
|
51
|
+
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"
|
|
52
|
+
>
|
|
53
|
+
<span className="flex h-3.5 min-w-3.5 shrink-0 items-center justify-center rounded bg-muted px-1 text-[10px] font-medium tabular-nums text-muted-foreground/60">
|
|
54
|
+
{blockCount}
|
|
55
|
+
</span>
|
|
56
|
+
<span
|
|
57
|
+
className={`min-w-0 truncate text-[12px] text-muted-foreground/70 ${allDone ? "" : "tool-call-shimmer-text"}`}
|
|
58
|
+
>
|
|
59
|
+
{summary}
|
|
60
|
+
</span>
|
|
61
|
+
<span
|
|
62
|
+
className={`icon-[solar--alt-arrow-right-linear] h-3.5 w-3.5 shrink-0 text-muted-foreground/40 transition-transform duration-200 ${open ? "rotate-90" : ""}`}
|
|
63
|
+
/>
|
|
64
|
+
</button>
|
|
65
|
+
<CollapsePanel
|
|
66
|
+
open={open}
|
|
67
|
+
id={panelId}
|
|
68
|
+
exportPanel={exportMode}
|
|
69
|
+
hidden={exportMode && !expanded && !forceExpanded}
|
|
70
|
+
>
|
|
71
|
+
<div className="ml-4 flex flex-col gap-0.5 border-l border-border/50 pb-1 pl-3">{children}</div>
|
|
72
|
+
</CollapsePanel>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface SegmentShellProps {
|
|
78
|
+
animateIn?: boolean;
|
|
79
|
+
children: ReactNode;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const SegmentShell = memo(function SegmentShell({
|
|
83
|
+
animateIn = false,
|
|
84
|
+
children,
|
|
85
|
+
}: SegmentShellProps): JSX.Element | null {
|
|
86
|
+
if (!children) return null;
|
|
87
|
+
// Always the same wrapper so flipping animateIn does not remount children
|
|
88
|
+
// (that remount dumped the whole segment as one flash).
|
|
89
|
+
return (
|
|
90
|
+
<motion.div
|
|
91
|
+
initial={animateIn ? SEGMENT_INITIAL : false}
|
|
92
|
+
animate={SEGMENT_ANIMATE}
|
|
93
|
+
transition={SEGMENT_TRANSITION}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</motion.div>
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export interface ErrorBlockViewLabels {
|
|
101
|
+
/** 一句人话的现象描述,如「请求太频繁了」。 */
|
|
102
|
+
title: string;
|
|
103
|
+
/** 一句建议,如「稍等片刻再发一次」。可省。 */
|
|
104
|
+
hint?: string;
|
|
105
|
+
/** 副标题补充,如「已自动重试 3 次」「重复出现 4 次」。可省。 */
|
|
106
|
+
note?: string;
|
|
107
|
+
showDetail: string;
|
|
108
|
+
hideDetail: string;
|
|
109
|
+
copy: string;
|
|
110
|
+
copied: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ErrorBlockViewProps {
|
|
114
|
+
/** iconify 类名,如 "icon-[mdi--timer-sand]"。 */
|
|
115
|
+
iconClass: string;
|
|
116
|
+
labels: ErrorBlockViewLabels;
|
|
117
|
+
/** provider 原文,只出现在折叠区。 */
|
|
118
|
+
detail: string;
|
|
119
|
+
/** Optional safe diagnostics, already localized/formatted by the host app. */
|
|
120
|
+
diagnostics?: string;
|
|
121
|
+
expanded: boolean;
|
|
122
|
+
onToggleExpanded: () => void;
|
|
123
|
+
/** 需要用户离开对话去处理时给一个落点(配额、鉴权)。 */
|
|
124
|
+
action?: { label: string; onClick: () => void };
|
|
125
|
+
/** 导出态没有交互,原文直接展开。 */
|
|
126
|
+
exportMode?: boolean;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 对话流里的错误卡。刻意不用 destructive 红:这里绝大多数是限流 / 网络抖动一类
|
|
131
|
+
* 的暂时性状况,红底红框会把每次抖动都渲染成事故。紧迫性交给图标、文案和动作
|
|
132
|
+
* 按钮表达。分类与文案由调用方决定,本组件只负责呈现。
|
|
133
|
+
*/
|
|
134
|
+
export function ErrorBlockView({
|
|
135
|
+
iconClass,
|
|
136
|
+
labels,
|
|
137
|
+
detail,
|
|
138
|
+
diagnostics,
|
|
139
|
+
expanded,
|
|
140
|
+
onToggleExpanded,
|
|
141
|
+
action,
|
|
142
|
+
exportMode = false,
|
|
143
|
+
}: ErrorBlockViewProps): JSX.Element {
|
|
144
|
+
const generatedId = useId();
|
|
145
|
+
const panelId = `error-detail-${generatedId}`;
|
|
146
|
+
const open = expanded || exportMode;
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div className="w-full rounded-xl border border-border/40 bg-secondary px-3 py-2.5 dark:bg-input-bar-bg">
|
|
150
|
+
<div className="flex items-start gap-2.5">
|
|
151
|
+
<span className={`${iconClass} mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/70`} />
|
|
152
|
+
<div className="min-w-0 flex-1">
|
|
153
|
+
<div className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5">
|
|
154
|
+
<span className="text-[13px] font-medium leading-[1.5] text-foreground/85">{labels.title}</span>
|
|
155
|
+
{labels.note ? <span className="text-[12px] text-muted-foreground/60">{labels.note}</span> : null}
|
|
156
|
+
</div>
|
|
157
|
+
{labels.hint ? (
|
|
158
|
+
<p className="mt-0.5 text-[12.5px] leading-[1.6] text-muted-foreground/80">{labels.hint}</p>
|
|
159
|
+
) : null}
|
|
160
|
+
<div className="mt-1.5 flex flex-wrap items-center gap-1">
|
|
161
|
+
{action ? (
|
|
162
|
+
<button
|
|
163
|
+
type="button"
|
|
164
|
+
onClick={action.onClick}
|
|
165
|
+
className="inline-flex h-6 items-center rounded px-1.5 text-[12px] font-medium text-foreground/75 transition-colors hover:bg-muted/70 hover:text-foreground"
|
|
166
|
+
>
|
|
167
|
+
{action.label}
|
|
168
|
+
</button>
|
|
169
|
+
) : null}
|
|
170
|
+
<button
|
|
171
|
+
type="button"
|
|
172
|
+
onClick={onToggleExpanded}
|
|
173
|
+
data-export-toggle={exportMode ? panelId : undefined}
|
|
174
|
+
aria-expanded={open}
|
|
175
|
+
aria-controls={panelId}
|
|
176
|
+
className="inline-flex h-6 items-center gap-1 rounded px-1.5 text-[12px] text-muted-foreground/60 transition-colors hover:bg-muted/70 hover:text-foreground/80"
|
|
177
|
+
>
|
|
178
|
+
<span
|
|
179
|
+
className={`icon-[mdi--chevron-right] h-3.5 w-3.5 transition-transform duration-200 ${open ? "rotate-90" : ""}`}
|
|
180
|
+
/>
|
|
181
|
+
{open ? labels.hideDetail : labels.showDetail}
|
|
182
|
+
</button>
|
|
183
|
+
<CopyIconButton
|
|
184
|
+
getText={() => (diagnostics ? `${diagnostics}\n\n${detail}` : detail)}
|
|
185
|
+
label={labels.copy}
|
|
186
|
+
labels={{ label: labels.copy, copied: labels.copied }}
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
<CollapsePanel open={open} id={panelId} exportPanel={exportMode}>
|
|
192
|
+
{diagnostics ? (
|
|
193
|
+
<pre className="mt-2 overflow-auto rounded border border-border/50 bg-background/60 px-2 py-1.5 font-mono text-[11.5px] leading-[1.55] text-muted-foreground/75">
|
|
194
|
+
{diagnostics}
|
|
195
|
+
</pre>
|
|
196
|
+
) : null}
|
|
197
|
+
<pre className="mt-2 max-h-60 overflow-auto rounded border border-border/50 bg-background/60 px-2 py-1.5 font-mono text-[11.5px] leading-[1.55] text-muted-foreground/75">
|
|
198
|
+
{detail}
|
|
199
|
+
</pre>
|
|
200
|
+
</CollapsePanel>
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
|
|
3
|
+
export interface CompactionBoundaryViewProps {
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function CompactionBoundaryView({ label }: CompactionBoundaryViewProps): JSX.Element {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex items-center gap-3 py-1">
|
|
10
|
+
<div className="h-px flex-1 bg-muted-foreground/15" />
|
|
11
|
+
<span className="flex items-center gap-1.5 text-[11px] text-muted-foreground/40">
|
|
12
|
+
<span className="icon-[mdi--compress] h-3 w-3" />
|
|
13
|
+
{label}
|
|
14
|
+
</span>
|
|
15
|
+
<div className="h-px flex-1 bg-muted-foreground/15" />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ModelSwitchBoundaryViewProps {
|
|
21
|
+
prefix: string;
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function ModelSwitchBoundaryView({
|
|
26
|
+
prefix,
|
|
27
|
+
label,
|
|
28
|
+
}: ModelSwitchBoundaryViewProps): JSX.Element {
|
|
29
|
+
return (
|
|
30
|
+
<div className="flex items-center gap-3 py-1">
|
|
31
|
+
<div className="h-px flex-1 bg-muted-foreground/8" />
|
|
32
|
+
<span className="flex items-center gap-1.5 text-[11px] text-primary/70">
|
|
33
|
+
<span className="icon-[mdi--swap-horizontal] h-3 w-3" />
|
|
34
|
+
{prefix}
|
|
35
|
+
{label}
|
|
36
|
+
</span>
|
|
37
|
+
<div className="h-px flex-1 bg-muted-foreground/8" />
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ForkOriginBannerViewProps {
|
|
43
|
+
/** Full accessible label / title. */
|
|
44
|
+
label: string;
|
|
45
|
+
/** Optional short preview of the source message. */
|
|
46
|
+
preview?: string;
|
|
47
|
+
/** When set, banner is clickable. */
|
|
48
|
+
onClick?: () => void;
|
|
49
|
+
/** Disabled state (e.g. parent session missing). */
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Inline hint under the forked turn’s AI reply: no chrome, centered text. */
|
|
54
|
+
export function ForkOriginBannerView({
|
|
55
|
+
label,
|
|
56
|
+
preview,
|
|
57
|
+
onClick,
|
|
58
|
+
disabled,
|
|
59
|
+
}: ForkOriginBannerViewProps): JSX.Element {
|
|
60
|
+
const interactive = Boolean(onClick) && !disabled;
|
|
61
|
+
const title = preview ? `${label} · ${preview}` : label;
|
|
62
|
+
const text = preview ? (
|
|
63
|
+
<>
|
|
64
|
+
{label}
|
|
65
|
+
<span className="text-muted-foreground/50"> · </span>
|
|
66
|
+
{preview}
|
|
67
|
+
</>
|
|
68
|
+
) : (
|
|
69
|
+
label
|
|
70
|
+
);
|
|
71
|
+
// mt-4: leave clear gap under the assistant bubble; py keeps hit area usable.
|
|
72
|
+
const className =
|
|
73
|
+
"mx-auto mt-4 flex max-w-full items-center justify-center gap-1 px-2 py-1.5 text-center text-[11px] text-muted-foreground/60";
|
|
74
|
+
if (interactive) {
|
|
75
|
+
return (
|
|
76
|
+
<button
|
|
77
|
+
type="button"
|
|
78
|
+
onClick={onClick}
|
|
79
|
+
className={`${className} cursor-pointer transition-colors hover:text-primary/70`}
|
|
80
|
+
title={title}
|
|
81
|
+
>
|
|
82
|
+
<span className="icon-[mdi--source-fork] h-3 w-3 shrink-0" />
|
|
83
|
+
<span className="min-w-0 truncate">{text}</span>
|
|
84
|
+
</button>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return (
|
|
88
|
+
<div className={className} title={title}>
|
|
89
|
+
<span className="icon-[mdi--source-fork] h-3 w-3 shrink-0" />
|
|
90
|
+
<span className="min-w-0 truncate">{text}</span>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|