@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,124 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger, cn } from "@vetta-org/ui";
|
|
4
|
+
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
5
|
+
|
|
6
|
+
export interface ExecutionModeOptionView {
|
|
7
|
+
readonly mode: string;
|
|
8
|
+
readonly icon: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly disabled: boolean;
|
|
12
|
+
readonly selected: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ExecutionModeSelectorViewProps {
|
|
16
|
+
readonly open: boolean;
|
|
17
|
+
readonly disabled: boolean;
|
|
18
|
+
readonly selectedOption: ExecutionModeOptionView;
|
|
19
|
+
readonly options: readonly ExecutionModeOptionView[];
|
|
20
|
+
readonly className?: string;
|
|
21
|
+
readonly classNames?: {
|
|
22
|
+
readonly root?: string;
|
|
23
|
+
readonly trigger?: string;
|
|
24
|
+
readonly content?: string;
|
|
25
|
+
readonly contentInner?: string;
|
|
26
|
+
readonly item?: string;
|
|
27
|
+
};
|
|
28
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
29
|
+
readonly onSelect: (mode: string) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function ExecutionModeSelectorView({
|
|
33
|
+
open,
|
|
34
|
+
disabled,
|
|
35
|
+
selectedOption,
|
|
36
|
+
options,
|
|
37
|
+
className,
|
|
38
|
+
classNames,
|
|
39
|
+
onOpenChange,
|
|
40
|
+
onSelect,
|
|
41
|
+
}: ExecutionModeSelectorViewProps): JSX.Element {
|
|
42
|
+
return (
|
|
43
|
+
<div className={cn("ml-1 min-w-0", className, classNames?.root)}>
|
|
44
|
+
<Popover open={open} onOpenChange={disabled ? undefined : onOpenChange}>
|
|
45
|
+
<PopoverTrigger asChild>
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
title={selectedOption.title}
|
|
50
|
+
className={cn(
|
|
51
|
+
// 窄容器只保留图标(title 仍可悬停查看模式名),宽了再显示文案
|
|
52
|
+
"no-drag flex h-7 max-w-full min-w-0 items-center gap-1 rounded-lg px-1.5 text-[12px] font-medium transition-colors disabled:pointer-events-none disabled:opacity-40 @[22rem]:gap-1.5 @[22rem]:px-2",
|
|
53
|
+
open
|
|
54
|
+
? "bg-accent text-foreground"
|
|
55
|
+
: "text-foreground hover:bg-accent/60",
|
|
56
|
+
classNames?.trigger,
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<span className={cn(selectedOption.icon, "h-3.5 w-3.5 shrink-0")} />
|
|
60
|
+
<span className="hidden min-w-0 max-w-[5.5rem] truncate @[22rem]:inline">{selectedOption.label}</span>
|
|
61
|
+
</button>
|
|
62
|
+
</PopoverTrigger>
|
|
63
|
+
<AnimatePresence>
|
|
64
|
+
{open && (
|
|
65
|
+
<PopoverContent
|
|
66
|
+
forceMount
|
|
67
|
+
asChild
|
|
68
|
+
side="top"
|
|
69
|
+
align="start"
|
|
70
|
+
sideOffset={6}
|
|
71
|
+
className={cn(
|
|
72
|
+
"w-[148px] gap-0 overflow-visible rounded-lg border border-border p-0",
|
|
73
|
+
classNames?.content,
|
|
74
|
+
)}
|
|
75
|
+
style={{ animation: "none" }}
|
|
76
|
+
>
|
|
77
|
+
<motion.div
|
|
78
|
+
initial={{ opacity: 0 }}
|
|
79
|
+
animate={{ opacity: 1 }}
|
|
80
|
+
exit={{ opacity: 0 }}
|
|
81
|
+
transition={{ duration: 0.12, ease: "easeOut" }}
|
|
82
|
+
className="relative overflow-visible rounded-[inherit]"
|
|
83
|
+
>
|
|
84
|
+
<ThemeSurface slot="chat.executionModeMenu" />
|
|
85
|
+
<div
|
|
86
|
+
className={cn(
|
|
87
|
+
"relative z-10 overflow-hidden rounded-[inherit] p-1",
|
|
88
|
+
classNames?.contentInner,
|
|
89
|
+
)}
|
|
90
|
+
>
|
|
91
|
+
{options.map((option) => (
|
|
92
|
+
<button
|
|
93
|
+
key={option.mode}
|
|
94
|
+
type="button"
|
|
95
|
+
title={option.title}
|
|
96
|
+
disabled={option.disabled}
|
|
97
|
+
onClick={() => {
|
|
98
|
+
onOpenChange(false);
|
|
99
|
+
onSelect(option.mode);
|
|
100
|
+
}}
|
|
101
|
+
className={cn(
|
|
102
|
+
"flex w-full items-center gap-2 rounded-md px-2 py-[5px] text-[12px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-45",
|
|
103
|
+
option.selected
|
|
104
|
+
? "bg-accent text-foreground"
|
|
105
|
+
: "text-foreground hover:bg-accent",
|
|
106
|
+
classNames?.item,
|
|
107
|
+
)}
|
|
108
|
+
>
|
|
109
|
+
<span className={cn(option.icon, "h-3.5 w-3.5 shrink-0")} />
|
|
110
|
+
<span className="truncate">{option.label}</span>
|
|
111
|
+
{option.selected && (
|
|
112
|
+
<span className="icon-[solar--check-circle-linear] ml-auto h-3.5 w-3.5 text-primary" />
|
|
113
|
+
)}
|
|
114
|
+
</button>
|
|
115
|
+
))}
|
|
116
|
+
</div>
|
|
117
|
+
</motion.div>
|
|
118
|
+
</PopoverContent>
|
|
119
|
+
)}
|
|
120
|
+
</AnimatePresence>
|
|
121
|
+
</Popover>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { JSX, ReactNode, Ref } from "react";
|
|
2
|
+
|
|
3
|
+
export interface ExportMessageListViewProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
listRef?: Ref<HTMLDivElement>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function ExportMessageListView({
|
|
9
|
+
children,
|
|
10
|
+
listRef,
|
|
11
|
+
}: ExportMessageListViewProps): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
ref={listRef}
|
|
15
|
+
className="chat-export-document mx-auto flex w-full max-w-3xl flex-col px-5 py-5"
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
|
|
4
|
+
const easeOut = [0.16, 1, 0.3, 1] as const;
|
|
5
|
+
|
|
6
|
+
export interface GuideBadgeViewItem {
|
|
7
|
+
id: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
text: string;
|
|
10
|
+
dismissible: boolean;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface GuideBadgeSwiperViewLabels {
|
|
15
|
+
dismissTooltip: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface GuideBadgeSwiperViewProps {
|
|
19
|
+
mounted: boolean;
|
|
20
|
+
current: GuideBadgeViewItem;
|
|
21
|
+
labels: GuideBadgeSwiperViewLabels;
|
|
22
|
+
onDismiss: (badgeId: string) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Rotating feature-hint badges under the composer / new-session hero.
|
|
27
|
+
* Host pre-resolves navigation handlers and i18n labels.
|
|
28
|
+
*/
|
|
29
|
+
export function GuideBadgeSwiperView({
|
|
30
|
+
mounted,
|
|
31
|
+
current,
|
|
32
|
+
labels,
|
|
33
|
+
onDismiss,
|
|
34
|
+
}: GuideBadgeSwiperViewProps): JSX.Element {
|
|
35
|
+
return (
|
|
36
|
+
<motion.div
|
|
37
|
+
initial={{ opacity: 0, y: 8 }}
|
|
38
|
+
animate={{ opacity: mounted ? 1 : 0, y: mounted ? 0 : 8 }}
|
|
39
|
+
transition={{ duration: 0.5, ease: easeOut }}
|
|
40
|
+
className="mb-3 flex h-8 w-full items-center"
|
|
41
|
+
>
|
|
42
|
+
<AnimatePresence mode="wait">
|
|
43
|
+
<motion.div
|
|
44
|
+
key={current.id}
|
|
45
|
+
initial={{ opacity: 0, y: 6 }}
|
|
46
|
+
animate={{ opacity: 1, y: 0 }}
|
|
47
|
+
exit={{ opacity: 0, y: -6 }}
|
|
48
|
+
transition={{ duration: 0.32, ease: easeOut }}
|
|
49
|
+
className="flex items-center"
|
|
50
|
+
>
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
onClick={current.onClick}
|
|
54
|
+
title={current.text}
|
|
55
|
+
className="group flex h-7 items-center gap-1.5 rounded-full border border-primary/30 bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] pl-2.5 pr-2 text-[11px] font-medium text-primary transition-colors hover:border-primary/50 hover:bg-[color-mix(in_srgb,var(--primary)_14%,var(--card))]"
|
|
56
|
+
>
|
|
57
|
+
<span className={`${current.icon} h-3 w-3 shrink-0`} />
|
|
58
|
+
<span className="whitespace-nowrap">{current.text}</span>
|
|
59
|
+
{current.dismissible && (
|
|
60
|
+
<span
|
|
61
|
+
role="button"
|
|
62
|
+
tabIndex={-1}
|
|
63
|
+
aria-label={labels.dismissTooltip}
|
|
64
|
+
title={labels.dismissTooltip}
|
|
65
|
+
onClick={(e) => {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
onDismiss(current.id);
|
|
68
|
+
}}
|
|
69
|
+
className="ml-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-primary/60 transition-colors hover:bg-primary/15 hover:text-primary"
|
|
70
|
+
>
|
|
71
|
+
<span className="icon-[mdi--close] h-3 w-3" />
|
|
72
|
+
</span>
|
|
73
|
+
)}
|
|
74
|
+
</button>
|
|
75
|
+
</motion.div>
|
|
76
|
+
</AnimatePresence>
|
|
77
|
+
</motion.div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
function cn(...parts: Array<string | false | null | undefined>): string {
|
|
4
|
+
return parts.filter(Boolean).join(" ");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface InlineTokenChipProps {
|
|
8
|
+
readonly icon?: string;
|
|
9
|
+
readonly iconUrl?: string;
|
|
10
|
+
readonly iconNode?: ReactNode;
|
|
11
|
+
readonly label: string;
|
|
12
|
+
readonly title?: string;
|
|
13
|
+
readonly tone?: "primary" | "member";
|
|
14
|
+
readonly className?: string;
|
|
15
|
+
readonly asButton?: boolean;
|
|
16
|
+
readonly onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Shared read/write representation for inline composer and user-message tokens. */
|
|
20
|
+
export function InlineTokenChip({
|
|
21
|
+
icon,
|
|
22
|
+
iconUrl,
|
|
23
|
+
iconNode,
|
|
24
|
+
label,
|
|
25
|
+
title,
|
|
26
|
+
tone = "primary",
|
|
27
|
+
className,
|
|
28
|
+
asButton = false,
|
|
29
|
+
onClick,
|
|
30
|
+
}: InlineTokenChipProps): JSX.Element {
|
|
31
|
+
const classes = cn(
|
|
32
|
+
"mx-px inline-block max-w-full select-none whitespace-pre rounded-md border px-1.5 align-baseline text-[12px] font-medium leading-[1.6]",
|
|
33
|
+
tone === "member"
|
|
34
|
+
? "border-sky-400/30 bg-sky-400/10 text-sky-200"
|
|
35
|
+
: "border-primary/25 bg-primary/10 text-primary",
|
|
36
|
+
asButton && "cursor-pointer hover:bg-primary/20",
|
|
37
|
+
className,
|
|
38
|
+
);
|
|
39
|
+
const content = (
|
|
40
|
+
<>
|
|
41
|
+
{iconNode ? (
|
|
42
|
+
<span className="mr-1 inline-flex h-3 w-3 items-center justify-center overflow-hidden align-[-0.15em]">
|
|
43
|
+
{iconNode}
|
|
44
|
+
</span>
|
|
45
|
+
) : iconUrl ? (
|
|
46
|
+
<img
|
|
47
|
+
src={iconUrl}
|
|
48
|
+
alt=""
|
|
49
|
+
draggable={false}
|
|
50
|
+
className="mr-1 inline-block h-3 w-3 rounded-sm align-[-0.15em] object-contain"
|
|
51
|
+
/>
|
|
52
|
+
) : icon ? (
|
|
53
|
+
<span className={`${icon} mr-1 inline-block h-3 w-3 align-[-0.15em]`} />
|
|
54
|
+
) : null}
|
|
55
|
+
{label}
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return asButton ? (
|
|
60
|
+
<button type="button" className={classes} title={title ?? label} onClick={onClick} data-inline-token="true">
|
|
61
|
+
{content}
|
|
62
|
+
</button>
|
|
63
|
+
) : (
|
|
64
|
+
<span className={classes} title={title ?? label} data-inline-token="true">
|
|
65
|
+
{content}
|
|
66
|
+
</span>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useThemeSurface } from "@vetta-org/theme-sdk";
|
|
2
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
3
|
+
import type { JSX, ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
function cn(...parts: Array<string | false | null | undefined>): string {
|
|
6
|
+
return parts.filter(Boolean).join(" ");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface InputActionBarItemView {
|
|
10
|
+
readonly active: boolean;
|
|
11
|
+
readonly icon?: ReactNode;
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface InputActionBarViewModel {
|
|
17
|
+
readonly actions: {
|
|
18
|
+
readonly toggleItem: (id: string) => void;
|
|
19
|
+
readonly toggleKnowledge: () => void;
|
|
20
|
+
};
|
|
21
|
+
readonly items: readonly InputActionBarItemView[];
|
|
22
|
+
readonly knowledge: {
|
|
23
|
+
readonly active: boolean;
|
|
24
|
+
readonly label: string;
|
|
25
|
+
readonly tooltip: string;
|
|
26
|
+
} | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface InputActionBarViewProps {
|
|
30
|
+
readonly className?: string;
|
|
31
|
+
readonly model: InputActionBarViewModel;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function InputActionBarView({ className, model }: InputActionBarViewProps): JSX.Element {
|
|
35
|
+
const surface = useThemeSurface("chat.inputActionBar");
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<motion.div
|
|
39
|
+
initial={{ y: "-100%", opacity: 0 }}
|
|
40
|
+
animate={{ y: 0, opacity: 1 }}
|
|
41
|
+
transition={{ type: "spring", stiffness: 440, damping: 36, mass: 0.9 }}
|
|
42
|
+
className={cn(
|
|
43
|
+
// 单行:窄宽隐藏文案只留图标,避免阶梯区折行
|
|
44
|
+
"input-ledge relative z-0 mx-auto flex w-[93%] flex-nowrap gap-0.5 overflow-x-auto rounded-b-[14px] bg-input-bar-bg/70 px-3 pt-1 pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
45
|
+
surface?.rootClassName,
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
data-theme-surface-root="chat.inputActionBar"
|
|
49
|
+
>
|
|
50
|
+
<AnimatePresence initial={false}>
|
|
51
|
+
{model.knowledge ? (
|
|
52
|
+
<motion.button
|
|
53
|
+
key="__builtin_knowledge_retrieval__"
|
|
54
|
+
type="button"
|
|
55
|
+
layout
|
|
56
|
+
initial={{ scale: 0.7, opacity: 0, y: -6 }}
|
|
57
|
+
animate={{ scale: 1, opacity: 1, y: 0 }}
|
|
58
|
+
exit={{ scale: 0.7, opacity: 0, y: -4 }}
|
|
59
|
+
transition={{ type: "spring", stiffness: 520, damping: 30 }}
|
|
60
|
+
whileTap={{ scale: 0.95 }}
|
|
61
|
+
onClick={model.actions.toggleKnowledge}
|
|
62
|
+
title={model.knowledge.tooltip}
|
|
63
|
+
className={cn(
|
|
64
|
+
"flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-0.5 text-[12px] font-medium transition-colors",
|
|
65
|
+
model.knowledge.active
|
|
66
|
+
? "bg-primary/10 text-primary"
|
|
67
|
+
: "text-muted-foreground hover:bg-foreground/5 hover:text-foreground",
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
70
|
+
<motion.span
|
|
71
|
+
className="icon-[mdi--book-search-outline] flex h-3.5 w-3.5 items-center justify-center"
|
|
72
|
+
animate={model.knowledge.active ? { rotate: [0, -8, 8, 0] } : { rotate: 0 }}
|
|
73
|
+
transition={{ duration: 0.4 }}
|
|
74
|
+
/>
|
|
75
|
+
<span className="hidden @[22rem]:inline">{model.knowledge.label}</span>
|
|
76
|
+
</motion.button>
|
|
77
|
+
) : null}
|
|
78
|
+
{model.items.map((item, index) => (
|
|
79
|
+
<motion.button
|
|
80
|
+
key={item.id}
|
|
81
|
+
type="button"
|
|
82
|
+
layout
|
|
83
|
+
initial={{ scale: 0.7, opacity: 0, y: -6 }}
|
|
84
|
+
animate={{ scale: 1, opacity: 1, y: 0 }}
|
|
85
|
+
exit={{ scale: 0.7, opacity: 0, y: -4 }}
|
|
86
|
+
transition={{ type: "spring", stiffness: 520, damping: 30, delay: index * 0.03 }}
|
|
87
|
+
whileTap={{ scale: 0.95 }}
|
|
88
|
+
onClick={() => model.actions.toggleItem(item.id)}
|
|
89
|
+
title={item.label}
|
|
90
|
+
className={cn(
|
|
91
|
+
"flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-0.5 text-[12px] font-medium transition-colors",
|
|
92
|
+
item.active
|
|
93
|
+
? "bg-primary/10 text-primary"
|
|
94
|
+
: "text-muted-foreground hover:bg-foreground/5 hover:text-foreground",
|
|
95
|
+
)}
|
|
96
|
+
>
|
|
97
|
+
{item.icon ? (
|
|
98
|
+
<motion.span
|
|
99
|
+
className="flex h-3.5 w-3.5 items-center justify-center"
|
|
100
|
+
animate={item.active ? { rotate: [0, -8, 8, 0] } : { rotate: 0 }}
|
|
101
|
+
transition={{ duration: 0.4 }}
|
|
102
|
+
>
|
|
103
|
+
{item.icon}
|
|
104
|
+
</motion.span>
|
|
105
|
+
) : null}
|
|
106
|
+
<span className="hidden @[22rem]:inline">{item.label}</span>
|
|
107
|
+
</motion.button>
|
|
108
|
+
))}
|
|
109
|
+
</AnimatePresence>
|
|
110
|
+
</motion.div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui";
|
|
2
|
+
import type { ComponentPropsWithoutRef, JSX, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface InputBarBackgroundProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function InputBarBackground({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: InputBarBackgroundProps): JSX.Element {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
className={cn(
|
|
17
|
+
"pointer-events-none absolute inset-0 z-[1] overflow-hidden rounded-[inherit]",
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { memo, type JSX } from "react";
|
|
2
|
+
import { motion } from "motion/react";
|
|
3
|
+
|
|
4
|
+
const SPRING = { type: "spring" as const, stiffness: 460, damping: 32, mass: 0.9 };
|
|
5
|
+
const CAPSULE_INITIAL = { scale: 0.85, opacity: 0, y: 4 };
|
|
6
|
+
const CAPSULE_ANIMATE = { scale: 1, opacity: 1, y: 0 };
|
|
7
|
+
const CAPSULE_EXIT = { scale: 0.85, opacity: 0, y: -2 };
|
|
8
|
+
const CAPSULE_HOVER = { y: -1 };
|
|
9
|
+
const CAPSULE_TAP = { scale: 0.96 };
|
|
10
|
+
|
|
11
|
+
export interface InputBarCapsuleLabels {
|
|
12
|
+
removeDefault: string;
|
|
13
|
+
removeTooltip: (path: string) => string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface InputBarCapsuleProps {
|
|
17
|
+
icon: string;
|
|
18
|
+
label: string;
|
|
19
|
+
labels: InputBarCapsuleLabels;
|
|
20
|
+
title?: string;
|
|
21
|
+
tone: "primary" | "muted";
|
|
22
|
+
onRemove: () => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const InputBarCapsule = memo(function InputBarCapsule({
|
|
26
|
+
icon,
|
|
27
|
+
label,
|
|
28
|
+
labels,
|
|
29
|
+
title,
|
|
30
|
+
tone,
|
|
31
|
+
onRemove,
|
|
32
|
+
}: InputBarCapsuleProps): JSX.Element {
|
|
33
|
+
const toneClass =
|
|
34
|
+
tone === "primary"
|
|
35
|
+
? "bg-primary/10 text-primary border-primary/20"
|
|
36
|
+
: "bg-muted text-muted-foreground border-border/60";
|
|
37
|
+
return (
|
|
38
|
+
<motion.button
|
|
39
|
+
type="button"
|
|
40
|
+
layout
|
|
41
|
+
initial={CAPSULE_INITIAL}
|
|
42
|
+
animate={CAPSULE_ANIMATE}
|
|
43
|
+
exit={CAPSULE_EXIT}
|
|
44
|
+
transition={SPRING}
|
|
45
|
+
whileHover={CAPSULE_HOVER}
|
|
46
|
+
whileTap={CAPSULE_TAP}
|
|
47
|
+
onClick={onRemove}
|
|
48
|
+
title={title ? labels.removeTooltip(title) : labels.removeDefault}
|
|
49
|
+
className={`group flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[11px] font-medium transition-colors ${toneClass}`}
|
|
50
|
+
>
|
|
51
|
+
<span className={`${icon} h-3 w-3 shrink-0`} />
|
|
52
|
+
<span className="max-w-[140px] truncate">{label}</span>
|
|
53
|
+
<span className="icon-[solar--close-circle-linear] h-3 w-3 opacity-50 transition-opacity group-hover:opacity-100" />
|
|
54
|
+
</motion.button>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { motion } from "motion/react";
|
|
2
|
+
import { useEffect, useRef, type JSX } from "react";
|
|
3
|
+
|
|
4
|
+
export interface InputBarContextMenuViewLabels {
|
|
5
|
+
copy: string;
|
|
6
|
+
cut: string;
|
|
7
|
+
paste: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface InputBarContextMenuViewProps {
|
|
11
|
+
canCopy: boolean;
|
|
12
|
+
canCut: boolean;
|
|
13
|
+
canPaste: boolean;
|
|
14
|
+
labels: InputBarContextMenuViewLabels;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
onCopy: () => void;
|
|
17
|
+
onCut: () => void;
|
|
18
|
+
onPaste: () => void;
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const menuItemClass =
|
|
24
|
+
"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-[12px] font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-40";
|
|
25
|
+
|
|
26
|
+
export function InputBarContextMenuView({
|
|
27
|
+
canCopy,
|
|
28
|
+
canCut,
|
|
29
|
+
canPaste,
|
|
30
|
+
labels,
|
|
31
|
+
onClose,
|
|
32
|
+
onCopy,
|
|
33
|
+
onCut,
|
|
34
|
+
onPaste,
|
|
35
|
+
x,
|
|
36
|
+
y,
|
|
37
|
+
}: InputBarContextMenuViewProps): JSX.Element {
|
|
38
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
function handlePointerDown(event: MouseEvent): void {
|
|
42
|
+
if (menuRef.current && !menuRef.current.contains(event.target as Node)) onClose();
|
|
43
|
+
}
|
|
44
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
45
|
+
return () => document.removeEventListener("mousedown", handlePointerDown);
|
|
46
|
+
}, [onClose]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
function handleKeyDown(event: KeyboardEvent): void {
|
|
50
|
+
if (event.key === "Escape") onClose();
|
|
51
|
+
}
|
|
52
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
53
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
54
|
+
}, [onClose]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<motion.div
|
|
58
|
+
ref={menuRef}
|
|
59
|
+
initial={{ opacity: 0, scale: 0.95 }}
|
|
60
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
61
|
+
transition={{ duration: 0.12, ease: [0.25, 0.1, 0.25, 1] }}
|
|
62
|
+
className="fixed z-[1000] w-[160px] overflow-hidden rounded-lg border border-border bg-popover p-1 shadow-lg"
|
|
63
|
+
style={{ left: `${x}px`, top: `${y}px` }}
|
|
64
|
+
>
|
|
65
|
+
<button type="button" onClick={onCut} disabled={!canCut} className={menuItemClass}>
|
|
66
|
+
<span className="icon-[solar--scissors-linear] h-3.5 w-3.5" />
|
|
67
|
+
{labels.cut}
|
|
68
|
+
</button>
|
|
69
|
+
<button type="button" onClick={onCopy} disabled={!canCopy} className={menuItemClass}>
|
|
70
|
+
<span className="icon-[solar--copy-linear] h-3.5 w-3.5" />
|
|
71
|
+
{labels.copy}
|
|
72
|
+
</button>
|
|
73
|
+
<button type="button" onClick={onPaste} disabled={!canPaste} className={menuItemClass}>
|
|
74
|
+
<span className="icon-[solar--clipboard-linear] h-3.5 w-3.5" />
|
|
75
|
+
{labels.paste}
|
|
76
|
+
</button>
|
|
77
|
+
</motion.div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui";
|
|
2
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
3
|
+
import { useEffect, useMemo, useState, type JSX } from "react";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_ROTATE_MS = 4000;
|
|
6
|
+
const SLIDE = { duration: 0.28, ease: [0.22, 0.61, 0.36, 1] as const };
|
|
7
|
+
|
|
8
|
+
export interface InputBarPlaceholderClassNames {
|
|
9
|
+
/** 当前展示的文案节点 */
|
|
10
|
+
text?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface InputBarPlaceholderProps {
|
|
14
|
+
/** Host 已完成 i18n 解析的文案;仅 1 条时不轮播 */
|
|
15
|
+
texts: readonly string[];
|
|
16
|
+
/** 输入框无任何字符时展示(含空格即应 false,与原生 placeholder 一致) */
|
|
17
|
+
visible: boolean;
|
|
18
|
+
/** 多条文案时是否自动上下切换(suggestion / thinking 等静态态应关) */
|
|
19
|
+
rotating?: boolean;
|
|
20
|
+
/** 轮播间隔,默认 4000ms */
|
|
21
|
+
intervalMs?: number;
|
|
22
|
+
className?: string;
|
|
23
|
+
classNames?: InputBarPlaceholderClassNames;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 输入框占位文案纯视图:覆盖在 textarea 上,不可选中、不拦截点击。
|
|
28
|
+
* 文案与是否轮播由 host model 决定;本组件不访问 store / i18n。
|
|
29
|
+
*/
|
|
30
|
+
export function InputBarPlaceholder({
|
|
31
|
+
texts,
|
|
32
|
+
visible,
|
|
33
|
+
rotating = true,
|
|
34
|
+
intervalMs = DEFAULT_ROTATE_MS,
|
|
35
|
+
className,
|
|
36
|
+
classNames,
|
|
37
|
+
}: InputBarPlaceholderProps): JSX.Element | null {
|
|
38
|
+
const [index, setIndex] = useState(0);
|
|
39
|
+
const safeTexts = useMemo(
|
|
40
|
+
() => texts.filter((item) => typeof item === "string" && item.length > 0),
|
|
41
|
+
[texts],
|
|
42
|
+
);
|
|
43
|
+
const canRotate = rotating && safeTexts.length > 1;
|
|
44
|
+
const textsKey = safeTexts.join("\0");
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setIndex(0);
|
|
48
|
+
}, [textsKey]);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!visible || !canRotate) return;
|
|
52
|
+
const id = window.setInterval(() => {
|
|
53
|
+
setIndex((i) => (i + 1) % safeTexts.length);
|
|
54
|
+
}, intervalMs);
|
|
55
|
+
return () => window.clearInterval(id);
|
|
56
|
+
}, [visible, canRotate, safeTexts.length, intervalMs]);
|
|
57
|
+
|
|
58
|
+
if (!visible || safeTexts.length === 0) return null;
|
|
59
|
+
|
|
60
|
+
const text = safeTexts[index % safeTexts.length] ?? safeTexts[0];
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
className={cn("pointer-events-none absolute inset-0 overflow-hidden select-none", className)}
|
|
65
|
+
aria-hidden
|
|
66
|
+
>
|
|
67
|
+
<AnimatePresence mode="wait" initial={false}>
|
|
68
|
+
<motion.span
|
|
69
|
+
key={`${index}-${text}`}
|
|
70
|
+
initial={canRotate ? { opacity: 0, y: 10 } : false}
|
|
71
|
+
animate={{ opacity: 1, y: 0 }}
|
|
72
|
+
exit={canRotate ? { opacity: 0, y: -10 } : undefined}
|
|
73
|
+
transition={SLIDE}
|
|
74
|
+
className={cn(
|
|
75
|
+
"absolute inset-0 truncate text-[13.5px] leading-[1.6] text-muted-foreground/45 select-none",
|
|
76
|
+
classNames?.text,
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
{text}
|
|
80
|
+
</motion.span>
|
|
81
|
+
</AnimatePresence>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { memo, type JSX } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* hover / press 的缩放走 CSS transform:这些按钮常驻在输入栏里,用 motion 组件
|
|
5
|
+
* 等于每次输入栏重渲都要重建一份动画状态机,而效果 CSS 一行就能给到。
|
|
6
|
+
*/
|
|
7
|
+
const INTERACTION_CLASS =
|
|
8
|
+
"transition-transform duration-150 ease-out will-change-transform hover:scale-[1.06] active:scale-[0.92]";
|
|
9
|
+
|
|
10
|
+
export interface InputBarToolbarButtonProps {
|
|
11
|
+
icon: string;
|
|
12
|
+
title: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const InputBarToolbarButton = memo(function InputBarToolbarButton({
|
|
19
|
+
icon,
|
|
20
|
+
title,
|
|
21
|
+
disabled,
|
|
22
|
+
onClick,
|
|
23
|
+
active,
|
|
24
|
+
}: InputBarToolbarButtonProps): JSX.Element {
|
|
25
|
+
return (
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
title={title}
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
onClick={onClick}
|
|
31
|
+
className={`flex h-7 w-7 items-center justify-center rounded-lg transition-colors disabled:pointer-events-none disabled:opacity-30 ${
|
|
32
|
+
disabled ? "" : INTERACTION_CLASS
|
|
33
|
+
} ${
|
|
34
|
+
active
|
|
35
|
+
? "bg-primary/10 text-primary"
|
|
36
|
+
: "text-foreground hover:bg-accent/60"
|
|
37
|
+
}`}
|
|
38
|
+
>
|
|
39
|
+
<span className={`${icon} h-[17px] w-[17px]`} />
|
|
40
|
+
</button>
|
|
41
|
+
);
|
|
42
|
+
});
|