@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,61 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, type JSX } from "react";
|
|
2
|
+
|
|
3
|
+
export interface CopyIconButtonLabels {
|
|
4
|
+
label: string;
|
|
5
|
+
copied: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CopyIconButtonProps {
|
|
9
|
+
getText: () => string;
|
|
10
|
+
/** Optional override for the idle label; defaults to labels.label. */
|
|
11
|
+
label?: string;
|
|
12
|
+
labels: CopyIconButtonLabels;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function CopyIconButton({ getText, label, labels }: CopyIconButtonProps): JSX.Element {
|
|
16
|
+
const resolvedLabel = label ?? labels.label;
|
|
17
|
+
const [copied, setCopied] = useState(false);
|
|
18
|
+
const timerRef = useRef<number | null>(null);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
return () => {
|
|
22
|
+
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
const onClick = useCallback(
|
|
27
|
+
(event: { stopPropagation: () => void }) => {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
const text = getText();
|
|
30
|
+
if (!text) return;
|
|
31
|
+
void navigator.clipboard.writeText(text).then(
|
|
32
|
+
() => {
|
|
33
|
+
setCopied(true);
|
|
34
|
+
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
35
|
+
timerRef.current = window.setTimeout(() => {
|
|
36
|
+
setCopied(false);
|
|
37
|
+
timerRef.current = null;
|
|
38
|
+
}, 1500);
|
|
39
|
+
},
|
|
40
|
+
(err) => {
|
|
41
|
+
console.warn("[CopyIconButton] copy failed", err);
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
[getText],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const aria = copied ? labels.copied : resolvedLabel;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
onClick={onClick}
|
|
54
|
+
title={aria}
|
|
55
|
+
aria-label={aria}
|
|
56
|
+
className="inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground/55 transition-colors hover:bg-muted/60 hover:text-foreground"
|
|
57
|
+
>
|
|
58
|
+
<span className={`h-3.5 w-3.5 ${copied ? "icon-[mdi--check]" : "icon-[mdi--content-copy]"}`} />
|
|
59
|
+
</button>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { motion } from "motion/react";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
import type { NewSessionGuidingWordsProps } from "./NewSession";
|
|
4
|
+
|
|
5
|
+
const easeOut = [0.16, 1, 0.3, 1] as const;
|
|
6
|
+
const guidingEase = [0.22, 1, 0.36, 1] as const;
|
|
7
|
+
|
|
8
|
+
// 与桌面端 GUIDING_WORD_PAGE=3 对齐:固定 3 槽位高度,轮播切换时不改组件高度。
|
|
9
|
+
// 单槽 = 1 行 text-[12px]/leading-relaxed + py-1.5(12*1.625 + 12 ≈ 31.5px)。
|
|
10
|
+
const WORD_SLOT_CLASS = "h-8";
|
|
11
|
+
const WORD_LIST_MIN_H_CLASS = "min-h-24";
|
|
12
|
+
|
|
13
|
+
/** 整块引导词区(含 mt-5 + 组标题 + 3 词槽)的外层预留高度,供 host 加载占位使用。 */
|
|
14
|
+
export const NEW_SESSION_GUIDING_WORDS_SLOT_MIN_H_CLASS = "min-h-[9.5rem]";
|
|
15
|
+
|
|
16
|
+
export function DefaultGuidingWords({
|
|
17
|
+
className,
|
|
18
|
+
groups,
|
|
19
|
+
mounted,
|
|
20
|
+
onPick,
|
|
21
|
+
...props
|
|
22
|
+
}: NewSessionGuidingWordsProps): JSX.Element {
|
|
23
|
+
const columnsClass = groups.length <= 1 ? "grid-cols-1" : "grid-cols-2";
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={["mt-5 w-full", className].filter(Boolean).join(" ")} {...props}>
|
|
27
|
+
<motion.div
|
|
28
|
+
initial={{ opacity: 0, y: 8 }}
|
|
29
|
+
animate={{ opacity: mounted ? 1 : 0, y: mounted ? 0 : 8 }}
|
|
30
|
+
transition={{ duration: 0.5, delay: 0.35, ease: easeOut }}
|
|
31
|
+
className={`grid w-full ${columnsClass} items-start gap-x-4`}
|
|
32
|
+
>
|
|
33
|
+
{groups.map((group) => (
|
|
34
|
+
<div key={group.id} className="flex w-full min-w-0 flex-col gap-1.5">
|
|
35
|
+
<div className="truncate px-0.5 text-[12px] font-semibold text-foreground/80" title={group.name}>
|
|
36
|
+
{group.name}
|
|
37
|
+
</div>
|
|
38
|
+
<motion.div
|
|
39
|
+
key={group.pageKey}
|
|
40
|
+
initial="initial"
|
|
41
|
+
animate="animate"
|
|
42
|
+
variants={{ animate: { transition: { staggerChildren: 0.05, delayChildren: 0.04 } } }}
|
|
43
|
+
className={`flex min-w-0 flex-col ${WORD_LIST_MIN_H_CLASS}`}
|
|
44
|
+
>
|
|
45
|
+
{group.words.map((word, index) => {
|
|
46
|
+
const isLast = index === group.words.length - 1;
|
|
47
|
+
return (
|
|
48
|
+
<motion.button
|
|
49
|
+
key={`${group.pageKey}-${index}-${word}`}
|
|
50
|
+
type="button"
|
|
51
|
+
onClick={() => onPick(word)}
|
|
52
|
+
variants={{
|
|
53
|
+
initial: { opacity: 0, x: -6 },
|
|
54
|
+
animate: { opacity: 1, x: 0 },
|
|
55
|
+
}}
|
|
56
|
+
transition={{ duration: 0.55, ease: guidingEase }}
|
|
57
|
+
whileTap={{ scale: 0.98 }}
|
|
58
|
+
title={word}
|
|
59
|
+
className={`relative flex ${WORD_SLOT_CLASS} w-full min-w-0 shrink-0 items-center overflow-hidden py-1.5 pl-3 text-left text-[12px] leading-relaxed text-muted-foreground transition-colors hover:text-primary before:absolute before:left-0 before:border-l before:border-muted-foreground/30 before:content-[''] ${
|
|
60
|
+
isLast
|
|
61
|
+
? "before:top-0 before:h-4 before:w-2.5 before:rounded-bl-[7px] before:border-b"
|
|
62
|
+
: "before:inset-y-0 before:w-0 after:absolute after:left-0 after:top-1/2 after:w-2.5 after:border-t after:border-muted-foreground/30 after:content-['']"
|
|
63
|
+
}`}
|
|
64
|
+
>
|
|
65
|
+
<span className="block min-w-0 flex-1 truncate">{word}</span>
|
|
66
|
+
</motion.button>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</motion.div>
|
|
70
|
+
</div>
|
|
71
|
+
))}
|
|
72
|
+
</motion.div>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, type JSX } from "react";
|
|
2
|
+
import { motion } from "motion/react";
|
|
3
|
+
import { useThemeComponent } from "@vetta-org/theme-sdk";
|
|
4
|
+
import { cn } from "@vetta-org/ui";
|
|
5
|
+
import type { NewSessionSceneCarouselProps } from "./NewSession";
|
|
6
|
+
import { SceneCard } from "./SceneCard";
|
|
7
|
+
|
|
8
|
+
const easeOut = [0.16, 1, 0.3, 1] as const;
|
|
9
|
+
|
|
10
|
+
/** 场景卡常见高度(标题 + 两行描述 + meta)占位,与 DefaultNewSessionHero 预留槽对齐。 */
|
|
11
|
+
export const NEW_SESSION_SCENE_SLOT_MIN_H_CLASS = "min-h-[5.75rem]";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Props-driven scene carousel (3 cards per view). Host resolves i18n labels.
|
|
15
|
+
* Width follows outer left-aligned column (max-w-2xl); horizontal scroll + hover arrows.
|
|
16
|
+
*/
|
|
17
|
+
export function DefaultSceneCarousel({
|
|
18
|
+
actions,
|
|
19
|
+
className,
|
|
20
|
+
labels,
|
|
21
|
+
onSceneClick,
|
|
22
|
+
scenes,
|
|
23
|
+
selected,
|
|
24
|
+
...props
|
|
25
|
+
}: NewSessionSceneCarouselProps): JSX.Element {
|
|
26
|
+
const ThemedSceneCard = useThemeComponent("chat.newSessionSceneCard", SceneCard);
|
|
27
|
+
const scrollRef = useRef<HTMLDivElement>(null);
|
|
28
|
+
const [canPrev, setCanPrev] = useState(false);
|
|
29
|
+
const [canNext, setCanNext] = useState(false);
|
|
30
|
+
|
|
31
|
+
const updateEdges = useCallback(() => {
|
|
32
|
+
const el = scrollRef.current;
|
|
33
|
+
if (!el) return;
|
|
34
|
+
setCanPrev(el.scrollLeft > 1);
|
|
35
|
+
setCanNext(el.scrollLeft < el.scrollWidth - el.clientWidth - 1);
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
updateEdges();
|
|
40
|
+
const el = scrollRef.current;
|
|
41
|
+
if (!el) return;
|
|
42
|
+
const ro = new ResizeObserver(updateEdges);
|
|
43
|
+
ro.observe(el);
|
|
44
|
+
return () => ro.disconnect();
|
|
45
|
+
}, [updateEdges, scenes.length]);
|
|
46
|
+
|
|
47
|
+
const scrollByView = useCallback((dir: -1 | 1) => {
|
|
48
|
+
const el = scrollRef.current;
|
|
49
|
+
if (!el) return;
|
|
50
|
+
el.scrollBy({ left: dir * el.clientWidth, behavior: "smooth" });
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={cn("group relative mt-6 w-full", className)} {...props}>
|
|
55
|
+
<motion.div
|
|
56
|
+
initial={{ opacity: 0, y: 8 }}
|
|
57
|
+
animate={{ opacity: 1, y: 0 }}
|
|
58
|
+
transition={{ duration: 0.5, delay: 0.25, ease: easeOut }}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
ref={scrollRef}
|
|
62
|
+
onScroll={updateEdges}
|
|
63
|
+
className={`no-scrollbar flex snap-x snap-mandatory gap-2 overflow-x-auto py-1 ${NEW_SESSION_SCENE_SLOT_MIN_H_CLASS}`}
|
|
64
|
+
>
|
|
65
|
+
{scenes.map((s) => {
|
|
66
|
+
const action = actions[s.name] ?? "idle";
|
|
67
|
+
return (
|
|
68
|
+
<ThemedSceneCard
|
|
69
|
+
key={s.name}
|
|
70
|
+
action={action}
|
|
71
|
+
item={s}
|
|
72
|
+
selected={selected?.name === s.name && selected?.type === "scene"}
|
|
73
|
+
onClick={() => onSceneClick(s)}
|
|
74
|
+
title={s.state === "uninstalled" ? labels.installPrompt : s.description || s.name}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{canPrev && (
|
|
81
|
+
<>
|
|
82
|
+
<div className="pointer-events-none absolute inset-y-0 left-0 w-10 bg-gradient-to-r from-background to-transparent" />
|
|
83
|
+
<motion.button
|
|
84
|
+
type="button"
|
|
85
|
+
onClick={() => scrollByView(-1)}
|
|
86
|
+
whileHover={{ scale: 1.08 }}
|
|
87
|
+
whileTap={{ scale: 0.92 }}
|
|
88
|
+
className="absolute -left-3 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-border/60 bg-card text-muted-foreground opacity-0 shadow-md transition-opacity group-hover:opacity-100 hover:border-primary/40 hover:text-primary"
|
|
89
|
+
title={labels.previous}
|
|
90
|
+
>
|
|
91
|
+
<span className="icon-[mdi--chevron-left] h-4 w-4" />
|
|
92
|
+
</motion.button>
|
|
93
|
+
</>
|
|
94
|
+
)}
|
|
95
|
+
{canNext && (
|
|
96
|
+
<>
|
|
97
|
+
<div className="pointer-events-none absolute inset-y-0 right-0 w-10 bg-gradient-to-l from-background to-transparent" />
|
|
98
|
+
<motion.button
|
|
99
|
+
type="button"
|
|
100
|
+
onClick={() => scrollByView(1)}
|
|
101
|
+
whileHover={{ scale: 1.08 }}
|
|
102
|
+
whileTap={{ scale: 0.92 }}
|
|
103
|
+
className="absolute -right-3 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-border/60 bg-card text-muted-foreground opacity-0 shadow-md transition-opacity group-hover:opacity-100 hover:border-primary/40 hover:text-primary"
|
|
104
|
+
title={labels.next}
|
|
105
|
+
>
|
|
106
|
+
<span className="icon-[mdi--chevron-right] h-4 w-4" />
|
|
107
|
+
</motion.button>
|
|
108
|
+
</>
|
|
109
|
+
)}
|
|
110
|
+
</motion.div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { motion } from "motion/react";
|
|
3
|
+
import { useThemeComponent } from "@vetta-org/theme-sdk";
|
|
4
|
+
import { cn } from "@vetta-org/ui";
|
|
5
|
+
import type { NewSessionSkillBadgeRowProps } from "./NewSession";
|
|
6
|
+
import { SkillCard } from "./SkillCard";
|
|
7
|
+
import { useHorizontalDragScroll } from "./useHorizontalDragScroll";
|
|
8
|
+
|
|
9
|
+
/** 技能徽章行高度占位(与加载中预留槽对齐)。 */
|
|
10
|
+
export const NEW_SESSION_SKILL_BADGE_SLOT_MIN_H_CLASS = "min-h-9";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Skill pill row with horizontal scroll, pointer drag, and edge arrows.
|
|
14
|
+
* No enter animation (sits above input bar).
|
|
15
|
+
*/
|
|
16
|
+
export function DefaultSkillBadgeRow({
|
|
17
|
+
className,
|
|
18
|
+
labels,
|
|
19
|
+
skills,
|
|
20
|
+
selected,
|
|
21
|
+
onSelect,
|
|
22
|
+
...props
|
|
23
|
+
}: NewSessionSkillBadgeRowProps): JSX.Element {
|
|
24
|
+
const ThemedSkillCard = useThemeComponent("chat.newSessionSkillCard", SkillCard);
|
|
25
|
+
const {
|
|
26
|
+
canNext,
|
|
27
|
+
canPrev,
|
|
28
|
+
onLostPointerCapture,
|
|
29
|
+
onPointerCancel,
|
|
30
|
+
onPointerDown,
|
|
31
|
+
onPointerMove,
|
|
32
|
+
onPointerUp,
|
|
33
|
+
onScroll,
|
|
34
|
+
scrollByPage,
|
|
35
|
+
scrollRef,
|
|
36
|
+
shouldSuppressClick,
|
|
37
|
+
} = useHorizontalDragScroll({ itemCount: skills.length });
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className={cn("group relative mt-4 w-full", className)} {...props}>
|
|
41
|
+
<div
|
|
42
|
+
ref={scrollRef}
|
|
43
|
+
onScroll={onScroll}
|
|
44
|
+
onPointerDown={onPointerDown}
|
|
45
|
+
onPointerMove={onPointerMove}
|
|
46
|
+
onPointerUp={onPointerUp}
|
|
47
|
+
onPointerCancel={onPointerCancel}
|
|
48
|
+
onLostPointerCapture={onLostPointerCapture}
|
|
49
|
+
className={cn(
|
|
50
|
+
"no-scrollbar flex items-center gap-1.5 overflow-x-auto px-1 py-1 select-none touch-pan-y",
|
|
51
|
+
NEW_SESSION_SKILL_BADGE_SLOT_MIN_H_CLASS,
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
{skills.map((s) => {
|
|
55
|
+
const active = selected?.name === s.name && selected?.type === "skill";
|
|
56
|
+
return (
|
|
57
|
+
<ThemedSkillCard
|
|
58
|
+
key={s.name}
|
|
59
|
+
active={active}
|
|
60
|
+
item={s}
|
|
61
|
+
onClick={() => {
|
|
62
|
+
if (shouldSuppressClick()) return;
|
|
63
|
+
onSelect(s);
|
|
64
|
+
}}
|
|
65
|
+
title={s.description || s.name}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
{canPrev && (
|
|
72
|
+
<>
|
|
73
|
+
<div className="pointer-events-none absolute inset-y-0 left-0 w-10 bg-gradient-to-r from-background to-transparent" />
|
|
74
|
+
<motion.button
|
|
75
|
+
type="button"
|
|
76
|
+
onClick={() => scrollByPage(-1)}
|
|
77
|
+
whileHover={{ scale: 1.08 }}
|
|
78
|
+
whileTap={{ scale: 0.92 }}
|
|
79
|
+
className="absolute -left-3 top-1/2 z-10 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-border/60 bg-card text-muted-foreground opacity-0 shadow-md transition-opacity group-hover:opacity-100 hover:border-primary/40 hover:text-primary"
|
|
80
|
+
title={labels.scrollLeft}
|
|
81
|
+
>
|
|
82
|
+
<span className="icon-[mdi--chevron-left] h-4 w-4" />
|
|
83
|
+
</motion.button>
|
|
84
|
+
</>
|
|
85
|
+
)}
|
|
86
|
+
{canNext && (
|
|
87
|
+
<>
|
|
88
|
+
<div className="pointer-events-none absolute inset-y-0 right-0 w-10 bg-gradient-to-l from-background to-transparent" />
|
|
89
|
+
<motion.button
|
|
90
|
+
type="button"
|
|
91
|
+
onClick={() => scrollByPage(1)}
|
|
92
|
+
whileHover={{ scale: 1.08 }}
|
|
93
|
+
whileTap={{ scale: 0.92 }}
|
|
94
|
+
className="absolute -right-3 top-1/2 z-10 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-border/60 bg-card text-muted-foreground opacity-0 shadow-md transition-opacity group-hover:opacity-100 hover:border-primary/40 hover:text-primary"
|
|
95
|
+
title={labels.scrollRight}
|
|
96
|
+
>
|
|
97
|
+
<span className="icon-[mdi--chevron-right] h-4 w-4" />
|
|
98
|
+
</motion.button>
|
|
99
|
+
</>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import { type JSX, type ReactNode, useState } from "react";
|
|
3
|
+
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
4
|
+
|
|
5
|
+
export interface DrawerTab {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
/** Tailwind bg color class for the dot, e.g. "bg-emerald-400" */
|
|
9
|
+
color: string;
|
|
10
|
+
/** Extra description shown next to the label, e.g. "1/4 xxx..." */
|
|
11
|
+
desc?: string;
|
|
12
|
+
/** Whether the dot should pulse (e.g. has in_progress items) */
|
|
13
|
+
pulsing?: boolean;
|
|
14
|
+
/** Content rendered when this tab is expanded */
|
|
15
|
+
content: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DrawerCardProps {
|
|
19
|
+
tabs: DrawerTab[];
|
|
20
|
+
/** Controlled active tab id. null = collapsed. */
|
|
21
|
+
activeTabId?: string | null;
|
|
22
|
+
/** Called when active tab changes (click to expand/collapse). */
|
|
23
|
+
onActiveTabChange?: (tabId: string | null) => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
classNames?: {
|
|
26
|
+
root?: string;
|
|
27
|
+
panel?: string;
|
|
28
|
+
content?: string;
|
|
29
|
+
tabBar?: string;
|
|
30
|
+
tab?: string;
|
|
31
|
+
body?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Floating drawer that sits above the input card.
|
|
37
|
+
* Absolutely positioned, narrower than parent, centered.
|
|
38
|
+
* Renders nothing when tabs array is empty.
|
|
39
|
+
*/
|
|
40
|
+
export function DrawerCard({
|
|
41
|
+
tabs,
|
|
42
|
+
activeTabId: controlledId,
|
|
43
|
+
onActiveTabChange,
|
|
44
|
+
className,
|
|
45
|
+
classNames,
|
|
46
|
+
}: DrawerCardProps): JSX.Element | null {
|
|
47
|
+
const [internalId, setInternalId] = useState<string | null>(null);
|
|
48
|
+
|
|
49
|
+
const isControlled = controlledId !== undefined;
|
|
50
|
+
const activeId = isControlled ? controlledId : internalId;
|
|
51
|
+
const setActiveId = isControlled
|
|
52
|
+
? (id: string | null) => onActiveTabChange?.(id)
|
|
53
|
+
: setInternalId;
|
|
54
|
+
|
|
55
|
+
if (tabs.length === 0) return null;
|
|
56
|
+
|
|
57
|
+
const activeTab = tabs.find((t) => t.id === activeId);
|
|
58
|
+
|
|
59
|
+
function handleTabClick(tabId: string): void {
|
|
60
|
+
setActiveId(activeId === tabId ? null : tabId);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
className={[
|
|
66
|
+
"absolute bottom-full left-1/2 z-10 w-[92%] -translate-x-1/2 overflow-visible",
|
|
67
|
+
className,
|
|
68
|
+
classNames?.root,
|
|
69
|
+
]
|
|
70
|
+
.filter(Boolean)
|
|
71
|
+
.join(" ")}
|
|
72
|
+
>
|
|
73
|
+
<motion.div
|
|
74
|
+
initial={{ opacity: 0, y: 10 }}
|
|
75
|
+
animate={{ opacity: 1, y: 0 }}
|
|
76
|
+
transition={{ duration: 0.22, ease: [0.22, 0.61, 0.36, 1] }}
|
|
77
|
+
className={[
|
|
78
|
+
"relative overflow-visible rounded-t-2xl border-x border-t border-border bg-card/95 backdrop-blur",
|
|
79
|
+
classNames?.panel,
|
|
80
|
+
]
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.join(" ")}
|
|
83
|
+
>
|
|
84
|
+
<ThemeSurface slot="chat.inputDrawer" />
|
|
85
|
+
<div className={["relative z-10 overflow-hidden rounded-[inherit]", classNames?.content].filter(Boolean).join(" ")}>
|
|
86
|
+
<div className={["flex items-center gap-0.5 px-2.5 py-1.5", classNames?.tabBar].filter(Boolean).join(" ")}>
|
|
87
|
+
{tabs.map((tab, i) => {
|
|
88
|
+
const isActive = activeId === tab.id;
|
|
89
|
+
return (
|
|
90
|
+
<div key={tab.id} className="flex items-center">
|
|
91
|
+
{i > 0 && <span className="mx-1.5 h-3 w-px bg-border/70" />}
|
|
92
|
+
<motion.button
|
|
93
|
+
type="button"
|
|
94
|
+
onClick={() => handleTabClick(tab.id)}
|
|
95
|
+
whileHover={{ y: -1 }}
|
|
96
|
+
whileTap={{ scale: 0.97 }}
|
|
97
|
+
transition={{ type: "spring", stiffness: 480, damping: 28 }}
|
|
98
|
+
className={[
|
|
99
|
+
"relative flex items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors",
|
|
100
|
+
isActive
|
|
101
|
+
? "bg-muted/60 text-foreground"
|
|
102
|
+
: "text-muted-foreground hover:bg-muted/40",
|
|
103
|
+
classNames?.tab,
|
|
104
|
+
]
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.join(" ")}
|
|
107
|
+
>
|
|
108
|
+
<span className="relative flex h-2 w-2 shrink-0 items-center justify-center">
|
|
109
|
+
{tab.pulsing && (
|
|
110
|
+
<motion.span
|
|
111
|
+
className={`absolute inset-0 rounded-full ${tab.color}`}
|
|
112
|
+
animate={{ scale: [1, 1.9], opacity: [0, 0.5, 0] }}
|
|
113
|
+
transition={{
|
|
114
|
+
duration: 1.4,
|
|
115
|
+
times: [0, 0.15, 1],
|
|
116
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
117
|
+
ease: "easeOut",
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
)}
|
|
121
|
+
<span className={`relative h-2 w-2 rounded-full ${tab.color}`} />
|
|
122
|
+
</span>
|
|
123
|
+
<span className="font-medium">{tab.label}</span>
|
|
124
|
+
{tab.desc && <span className="max-w-[180px] truncate text-muted-foreground/60">{tab.desc}</span>}
|
|
125
|
+
</motion.button>
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
})}
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<AnimatePresence initial={false}>
|
|
132
|
+
{activeTab && (
|
|
133
|
+
<motion.div
|
|
134
|
+
key={activeTab.id}
|
|
135
|
+
initial={{ height: 0, opacity: 0 }}
|
|
136
|
+
animate={{ height: "auto", opacity: 1 }}
|
|
137
|
+
exit={{ height: 0, opacity: 0 }}
|
|
138
|
+
transition={{ duration: 0.22, ease: [0.22, 0.61, 0.36, 1] }}
|
|
139
|
+
className="overflow-hidden border-t border-border/70"
|
|
140
|
+
>
|
|
141
|
+
<div className={["p-3", classNames?.body].filter(Boolean).join(" ")}>{activeTab.content}</div>
|
|
142
|
+
</motion.div>
|
|
143
|
+
)}
|
|
144
|
+
</AnimatePresence>
|
|
145
|
+
</div>
|
|
146
|
+
</motion.div>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { TextPreview, type TextPreviewLabels } from "./TextPreview";
|
|
3
|
+
|
|
4
|
+
export type DiffLineKind = "added" | "removed" | "context" | "meta";
|
|
5
|
+
|
|
6
|
+
export interface DiffLineView {
|
|
7
|
+
text: string;
|
|
8
|
+
kind: DiffLineKind;
|
|
9
|
+
marker: string;
|
|
10
|
+
content: string;
|
|
11
|
+
rowClass: string;
|
|
12
|
+
markerClass: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface DiffPreviewViewProps {
|
|
16
|
+
lines: readonly DiffLineView[];
|
|
17
|
+
statsAdded: number;
|
|
18
|
+
statsRemoved: number;
|
|
19
|
+
netLabel: string;
|
|
20
|
+
/** 编辑模式徽标(如「锚点编辑」)。undefined = 不显示。 */
|
|
21
|
+
modeBadge?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function DiffPreviewView({
|
|
25
|
+
lines,
|
|
26
|
+
statsAdded,
|
|
27
|
+
statsRemoved,
|
|
28
|
+
netLabel,
|
|
29
|
+
modeBadge,
|
|
30
|
+
}: DiffPreviewViewProps): JSX.Element {
|
|
31
|
+
return (
|
|
32
|
+
<div className="space-y-1.5">
|
|
33
|
+
<div className="flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground/50">
|
|
34
|
+
<span className="font-medium text-muted-foreground/60">diff</span>
|
|
35
|
+
{modeBadge !== undefined && (
|
|
36
|
+
<span className="rounded bg-violet-500/10 px-1.5 py-0.5 font-medium text-violet-600 dark:text-violet-400">
|
|
37
|
+
{modeBadge}
|
|
38
|
+
</span>
|
|
39
|
+
)}
|
|
40
|
+
<span className="rounded bg-emerald-500/10 px-1.5 py-0.5 font-medium text-emerald-600 dark:text-emerald-400">
|
|
41
|
+
+{statsAdded}
|
|
42
|
+
</span>
|
|
43
|
+
<span className="rounded bg-red-500/10 px-1.5 py-0.5 font-medium text-red-600 dark:text-red-400">
|
|
44
|
+
-{statsRemoved}
|
|
45
|
+
</span>
|
|
46
|
+
<span className="rounded bg-muted px-1.5 py-0.5 text-muted-foreground/60">{netLabel}</span>
|
|
47
|
+
</div>
|
|
48
|
+
<div className="max-h-[420px] overflow-auto rounded-md bg-muted/25 py-2 font-mono text-[11px] leading-[1.5]">
|
|
49
|
+
{lines.map((line, index) => (
|
|
50
|
+
<div key={`${index}-${line.text}`} className={`flex min-w-max px-2 ${line.rowClass}`}>
|
|
51
|
+
<span className={`w-4 shrink-0 select-none ${line.markerClass}`}>{line.marker}</span>
|
|
52
|
+
<span className="whitespace-pre">{line.content}</span>
|
|
53
|
+
</div>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface AnchorEditItemView {
|
|
61
|
+
/** 锚点串(如 "42:ab",区间为 "42:ab – 50:cd") */
|
|
62
|
+
anchorLabel: string;
|
|
63
|
+
/** 动作描述(替换/插入/删除,已本地化) */
|
|
64
|
+
actionLabel: string;
|
|
65
|
+
/** 新文本;null = 删除(无新文本) */
|
|
66
|
+
text: string | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface AnchorEditsFallbackViewProps {
|
|
70
|
+
/** 模式徽标(如「锚点编辑」) */
|
|
71
|
+
badge: string;
|
|
72
|
+
items: readonly AnchorEditItemView[];
|
|
73
|
+
textPreviewLabels: TextPreviewLabels;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** 锚点模式的流式降级视图:diff 尚未产出时展示每条锚点编辑的目标与新文本。 */
|
|
77
|
+
export function AnchorEditsFallbackView({
|
|
78
|
+
badge,
|
|
79
|
+
items,
|
|
80
|
+
textPreviewLabels,
|
|
81
|
+
}: AnchorEditsFallbackViewProps): JSX.Element | null {
|
|
82
|
+
if (items.length === 0) return null;
|
|
83
|
+
return (
|
|
84
|
+
<div className="space-y-3">
|
|
85
|
+
<div className="flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground/50">
|
|
86
|
+
<span className="rounded bg-violet-500/10 px-1.5 py-0.5 font-medium text-violet-600 dark:text-violet-400">
|
|
87
|
+
{badge}
|
|
88
|
+
</span>
|
|
89
|
+
<span className="rounded bg-muted px-1.5 py-0.5 text-muted-foreground/60">×{items.length}</span>
|
|
90
|
+
</div>
|
|
91
|
+
{items.map((item, index) => (
|
|
92
|
+
<div key={`${index}-${item.anchorLabel}`} className="space-y-1.5">
|
|
93
|
+
<div className="flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground/50">
|
|
94
|
+
<span className="rounded bg-violet-500/10 px-1.5 py-0.5 font-mono font-medium text-violet-600 dark:text-violet-400">
|
|
95
|
+
{item.anchorLabel}
|
|
96
|
+
</span>
|
|
97
|
+
<span className="text-muted-foreground/60">{item.actionLabel}</span>
|
|
98
|
+
</div>
|
|
99
|
+
{item.text !== null && (
|
|
100
|
+
<pre className="max-h-[200px] overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/25 p-2 text-[11px] leading-[1.5] text-foreground/70">
|
|
101
|
+
{item.text.length > 0 ? item.text : textPreviewLabels.emptyLabel}
|
|
102
|
+
</pre>
|
|
103
|
+
)}
|
|
104
|
+
</div>
|
|
105
|
+
))}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface EditTextFallbackViewProps {
|
|
111
|
+
oldText: string | null;
|
|
112
|
+
newText: string | null;
|
|
113
|
+
oldTextEmptyLabel: string;
|
|
114
|
+
newTextEmptyLabel: string;
|
|
115
|
+
textPreviewLabels: TextPreviewLabels;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function EditTextFallbackView({
|
|
119
|
+
oldText,
|
|
120
|
+
newText,
|
|
121
|
+
oldTextEmptyLabel,
|
|
122
|
+
newTextEmptyLabel,
|
|
123
|
+
textPreviewLabels,
|
|
124
|
+
}: EditTextFallbackViewProps): JSX.Element | null {
|
|
125
|
+
if (oldText === null && newText === null) return null;
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div className="space-y-3">
|
|
129
|
+
{oldText !== null && (
|
|
130
|
+
<TextPreview label="oldText" text={oldText} emptyLabel={oldTextEmptyLabel} labels={textPreviewLabels} />
|
|
131
|
+
)}
|
|
132
|
+
{newText !== null && (
|
|
133
|
+
<TextPreview label="newText" text={newText} emptyLabel={newTextEmptyLabel} labels={textPreviewLabels} />
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|