@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,251 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Popover,
|
|
6
|
+
PopoverContent,
|
|
7
|
+
PopoverTrigger,
|
|
8
|
+
cn,
|
|
9
|
+
} from "@vetta-org/ui";
|
|
10
|
+
import { SettingsAiAssistButtonView } from "./SettingsAiAssistButtonView";
|
|
11
|
+
|
|
12
|
+
export interface SettingsAiAssistDialogViewLabels {
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly description: string;
|
|
15
|
+
readonly approvalHint: string;
|
|
16
|
+
readonly cancel: string;
|
|
17
|
+
readonly start: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface SettingsAiAssistDialogViewProps {
|
|
21
|
+
readonly open: boolean;
|
|
22
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
23
|
+
readonly triggerLabel: string;
|
|
24
|
+
readonly examples: readonly string[];
|
|
25
|
+
readonly intent: string;
|
|
26
|
+
readonly placeholder: string;
|
|
27
|
+
readonly submitError: string | null;
|
|
28
|
+
readonly onApplyExample: (text: string) => void;
|
|
29
|
+
readonly onIntentChange: (value: string) => void;
|
|
30
|
+
/** Optional origin rect (submit button) so the fly-orb starts at the click point. */
|
|
31
|
+
readonly onSubmit: (originRect?: DOMRect | null) => void;
|
|
32
|
+
readonly labels: SettingsAiAssistDialogViewLabels;
|
|
33
|
+
readonly className?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const springPop = { type: "spring" as const, stiffness: 380, damping: 26 };
|
|
37
|
+
const springChip = { type: "spring" as const, stiffness: 420, damping: 22 };
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* AI-assist intent entry as a solid-surface popover under the CTA.
|
|
41
|
+
* Header icon peeks above the panel edge.
|
|
42
|
+
*/
|
|
43
|
+
export function SettingsAiAssistDialogView({
|
|
44
|
+
open,
|
|
45
|
+
onOpenChange,
|
|
46
|
+
triggerLabel,
|
|
47
|
+
examples,
|
|
48
|
+
intent,
|
|
49
|
+
placeholder,
|
|
50
|
+
submitError,
|
|
51
|
+
onApplyExample,
|
|
52
|
+
onIntentChange,
|
|
53
|
+
onSubmit,
|
|
54
|
+
labels,
|
|
55
|
+
className,
|
|
56
|
+
}: SettingsAiAssistDialogViewProps): JSX.Element {
|
|
57
|
+
const reduceMotion = useReducedMotion();
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Popover open={open} onOpenChange={onOpenChange}>
|
|
61
|
+
<PopoverTrigger asChild>
|
|
62
|
+
<SettingsAiAssistButtonView label={triggerLabel} className={className} />
|
|
63
|
+
</PopoverTrigger>
|
|
64
|
+
|
|
65
|
+
<PopoverContent
|
|
66
|
+
side="bottom"
|
|
67
|
+
align="end"
|
|
68
|
+
sideOffset={14}
|
|
69
|
+
collisionPadding={12}
|
|
70
|
+
onOpenAutoFocus={(event) => {
|
|
71
|
+
const root = event.currentTarget as HTMLElement | null;
|
|
72
|
+
const field = root?.querySelector("textarea");
|
|
73
|
+
if (field instanceof HTMLTextAreaElement) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
field.focus();
|
|
76
|
+
}
|
|
77
|
+
}}
|
|
78
|
+
className={cn(
|
|
79
|
+
// Solid surface; overflow-visible so the badge can sit on the top edge.
|
|
80
|
+
"w-[min(21rem,calc(100vw-1.5rem))] gap-0 overflow-visible border-border bg-popover p-0 text-popover-foreground shadow-md",
|
|
81
|
+
// Shell enter/leave (children also have motion springs). Requires tw-animate-css +
|
|
82
|
+
// data-open/data-closed → data-state mapping in the host stylesheet.
|
|
83
|
+
"origin-(--radix-popover-content-transform-origin)",
|
|
84
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-top-1",
|
|
85
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-top-1",
|
|
86
|
+
"data-[state=open]:duration-200 data-[state=closed]:duration-220",
|
|
87
|
+
"ease-out",
|
|
88
|
+
)}
|
|
89
|
+
>
|
|
90
|
+
{/* Floating badge — peeks above the border */}
|
|
91
|
+
<motion.div
|
|
92
|
+
aria-hidden
|
|
93
|
+
initial={reduceMotion ? false : { opacity: 0, y: 6, scale: 0.88 }}
|
|
94
|
+
animate={{ opacity: 1, y: 0, scale: 1 }}
|
|
95
|
+
transition={reduceMotion ? { duration: 0 } : springPop}
|
|
96
|
+
className="absolute top-0 left-4 z-10 -translate-y-1/2"
|
|
97
|
+
>
|
|
98
|
+
<div className="relative flex size-10 items-center justify-center">
|
|
99
|
+
{!reduceMotion && (
|
|
100
|
+
<motion.span
|
|
101
|
+
className="absolute inset-0 rounded-full bg-primary/25"
|
|
102
|
+
animate={{ scale: [1, 1.4, 1], opacity: [0.5, 0, 0.5] }}
|
|
103
|
+
transition={{ duration: 2.4, repeat: Number.POSITIVE_INFINITY, ease: "easeOut" }}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
106
|
+
<span className="relative flex size-10 items-center justify-center rounded-full border border-border bg-popover text-primary shadow-md ring-2 ring-popover">
|
|
107
|
+
<motion.span
|
|
108
|
+
className="icon-[solar--magic-stick-3-bold] h-[18px] w-[18px]"
|
|
109
|
+
animate={reduceMotion ? undefined : { rotate: [0, -10, 10, 0] }}
|
|
110
|
+
transition={
|
|
111
|
+
reduceMotion
|
|
112
|
+
? undefined
|
|
113
|
+
: {
|
|
114
|
+
duration: 2.6,
|
|
115
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
116
|
+
ease: "easeInOut",
|
|
117
|
+
repeatDelay: 0.7,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/>
|
|
121
|
+
</span>
|
|
122
|
+
</div>
|
|
123
|
+
</motion.div>
|
|
124
|
+
|
|
125
|
+
<motion.div
|
|
126
|
+
initial={reduceMotion ? false : { opacity: 0, y: -6, scale: 0.98 }}
|
|
127
|
+
animate={{ opacity: 1, y: 0, scale: 1 }}
|
|
128
|
+
transition={reduceMotion ? { duration: 0 } : springPop}
|
|
129
|
+
className="relative flex flex-col overflow-hidden rounded-[inherit]"
|
|
130
|
+
>
|
|
131
|
+
{/* Title block */}
|
|
132
|
+
<div className="relative border-b border-border bg-popover px-3.5 pt-6 pb-3">
|
|
133
|
+
{/* Subtle primary accent strip under the badge line */}
|
|
134
|
+
<div
|
|
135
|
+
aria-hidden
|
|
136
|
+
className="pointer-events-none absolute inset-x-0 top-0 h-10 bg-gradient-to-b from-primary/10 to-transparent"
|
|
137
|
+
/>
|
|
138
|
+
{/* Icon floats above the border — title stays left-aligned in content padding */}
|
|
139
|
+
<div className="relative min-w-0 text-left">
|
|
140
|
+
<div className="flex items-center gap-2">
|
|
141
|
+
<h2 className="truncate text-[14px] font-semibold tracking-tight text-foreground">
|
|
142
|
+
{labels.title}
|
|
143
|
+
</h2>
|
|
144
|
+
<span className="relative mt-px flex size-1.5 shrink-0" aria-hidden>
|
|
145
|
+
{!reduceMotion && (
|
|
146
|
+
<span className="absolute inline-flex size-full animate-ping rounded-full bg-primary opacity-40" />
|
|
147
|
+
)}
|
|
148
|
+
<span className="relative inline-flex size-1.5 rounded-full bg-primary" />
|
|
149
|
+
</span>
|
|
150
|
+
</div>
|
|
151
|
+
<p className="mt-1 text-[11px] leading-relaxed text-muted-foreground">
|
|
152
|
+
{labels.description}
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{/* Body */}
|
|
158
|
+
<div className="relative flex flex-col gap-3 bg-popover p-3.5">
|
|
159
|
+
{examples.length > 0 && (
|
|
160
|
+
<div className="flex flex-col items-start gap-1.5">
|
|
161
|
+
{examples.map((example, index) => (
|
|
162
|
+
<motion.button
|
|
163
|
+
key={example}
|
|
164
|
+
type="button"
|
|
165
|
+
onClick={() => onApplyExample(example)}
|
|
166
|
+
initial={reduceMotion ? false : { opacity: 0, x: -8, scale: 0.96 }}
|
|
167
|
+
animate={{ opacity: 1, x: 0, scale: 1 }}
|
|
168
|
+
transition={
|
|
169
|
+
reduceMotion
|
|
170
|
+
? { duration: 0 }
|
|
171
|
+
: { ...springChip, delay: 0.06 + index * 0.05 }
|
|
172
|
+
}
|
|
173
|
+
whileHover={reduceMotion ? undefined : { x: 2, scale: 1.02 }}
|
|
174
|
+
whileTap={reduceMotion ? undefined : { scale: 0.98 }}
|
|
175
|
+
className={cn(
|
|
176
|
+
"max-w-full rounded-2xl rounded-bl-md border border-border bg-muted px-2.5 py-1.5 text-left text-[11px] leading-snug text-foreground/90",
|
|
177
|
+
"transition-colors hover:border-primary/40 hover:bg-primary/10 hover:text-foreground",
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
<span className="mr-1 text-primary">✦</span>
|
|
181
|
+
{example}
|
|
182
|
+
</motion.button>
|
|
183
|
+
))}
|
|
184
|
+
</div>
|
|
185
|
+
)}
|
|
186
|
+
|
|
187
|
+
<div
|
|
188
|
+
className={cn(
|
|
189
|
+
"relative rounded-xl border border-input bg-background",
|
|
190
|
+
"transition-[border-color]",
|
|
191
|
+
"focus-within:border-primary/50",
|
|
192
|
+
)}
|
|
193
|
+
>
|
|
194
|
+
<textarea
|
|
195
|
+
value={intent}
|
|
196
|
+
onChange={(event) => onIntentChange(event.target.value)}
|
|
197
|
+
placeholder={placeholder}
|
|
198
|
+
rows={3}
|
|
199
|
+
className={cn(
|
|
200
|
+
"field-sizing-content min-h-[4.5rem] w-full resize-none bg-transparent px-2.5 py-2 pr-11 pb-10 text-[13px] text-foreground outline-none",
|
|
201
|
+
"placeholder:text-muted-foreground",
|
|
202
|
+
)}
|
|
203
|
+
onKeyDown={(event) => {
|
|
204
|
+
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
// Keyboard path: no click rect; consumer falls back to DOM snapshot.
|
|
207
|
+
onSubmit(null);
|
|
208
|
+
}
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
<div className="absolute right-1.5 bottom-1.5">
|
|
212
|
+
<Button
|
|
213
|
+
type="button"
|
|
214
|
+
variant="primary"
|
|
215
|
+
size="icon-sm"
|
|
216
|
+
data-settings-ai-assist-submit=""
|
|
217
|
+
onClick={(event) => {
|
|
218
|
+
onSubmit(event.currentTarget.getBoundingClientRect());
|
|
219
|
+
}}
|
|
220
|
+
title={labels.start}
|
|
221
|
+
aria-label={labels.start}
|
|
222
|
+
className="size-8 rounded-full"
|
|
223
|
+
>
|
|
224
|
+
<span className="icon-[solar--arrow-to-top-left-linear] h-3.5 w-3.5" />
|
|
225
|
+
</Button>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<p className="text-[10px] leading-relaxed text-muted-foreground">{labels.approvalHint}</p>
|
|
230
|
+
|
|
231
|
+
<AnimatePresence>
|
|
232
|
+
{submitError ? (
|
|
233
|
+
<motion.div
|
|
234
|
+
initial={reduceMotion ? false : { opacity: 0, height: 0 }}
|
|
235
|
+
animate={{ opacity: 1, height: "auto" }}
|
|
236
|
+
exit={reduceMotion ? undefined : { opacity: 0, height: 0 }}
|
|
237
|
+
className="overflow-hidden"
|
|
238
|
+
>
|
|
239
|
+
<div className="flex items-start gap-2 rounded-lg bg-destructive/10 px-2.5 py-2 text-[12px] text-destructive">
|
|
240
|
+
<span className="icon-[solar--danger-circle-linear] mt-0.5 h-3.5 w-3.5 shrink-0" />
|
|
241
|
+
<span>{submitError}</span>
|
|
242
|
+
</div>
|
|
243
|
+
</motion.div>
|
|
244
|
+
) : null}
|
|
245
|
+
</AnimatePresence>
|
|
246
|
+
</div>
|
|
247
|
+
</motion.div>
|
|
248
|
+
</PopoverContent>
|
|
249
|
+
</Popover>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { FocusEventHandler, JSX, KeyboardEvent } from "react";
|
|
2
|
+
import { cn } from "@vetta-org/ui";
|
|
3
|
+
import { MotionSelect } from "./MotionSelect";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated 基础 Select 已产品化;设置页请优先 {@link MotionSelect}。
|
|
7
|
+
* 保留空串兼容旧 `cn(SETTINGS_SELECT_TRIGGER_CLASS, …)` 调用。
|
|
8
|
+
*/
|
|
9
|
+
export const SETTINGS_SELECT_TRIGGER_CLASS = "";
|
|
10
|
+
|
|
11
|
+
/** @deprecated 见上。 */
|
|
12
|
+
export const SETTINGS_SELECT_ITEM_CLASS = "";
|
|
13
|
+
|
|
14
|
+
export function SelectField({
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
options,
|
|
18
|
+
}: {
|
|
19
|
+
value: string;
|
|
20
|
+
onChange: (v: string) => void;
|
|
21
|
+
options: { value: string; label: string }[];
|
|
22
|
+
}): JSX.Element {
|
|
23
|
+
return (
|
|
24
|
+
<MotionSelect
|
|
25
|
+
value={value}
|
|
26
|
+
onValueChange={onChange}
|
|
27
|
+
options={options}
|
|
28
|
+
triggerClassName="w-full"
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function InputField({
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
placeholder,
|
|
37
|
+
type = "text",
|
|
38
|
+
disabled,
|
|
39
|
+
onBlur,
|
|
40
|
+
onKeyDown,
|
|
41
|
+
autoFocus,
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
className,
|
|
44
|
+
}: {
|
|
45
|
+
value: string;
|
|
46
|
+
onChange: (v: string) => void;
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
51
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
52
|
+
autoFocus?: boolean;
|
|
53
|
+
"aria-label"?: string;
|
|
54
|
+
className?: string;
|
|
55
|
+
}): JSX.Element {
|
|
56
|
+
return (
|
|
57
|
+
<input
|
|
58
|
+
type={type}
|
|
59
|
+
value={value}
|
|
60
|
+
disabled={disabled}
|
|
61
|
+
onChange={(e) => onChange(e.target.value)}
|
|
62
|
+
onBlur={onBlur}
|
|
63
|
+
onKeyDown={onKeyDown}
|
|
64
|
+
placeholder={placeholder}
|
|
65
|
+
autoFocus={autoFocus}
|
|
66
|
+
aria-label={ariaLabel}
|
|
67
|
+
className={cn(
|
|
68
|
+
"h-8 w-full rounded-lg border border-border bg-card px-2.5 text-[12px] font-medium text-foreground placeholder:text-muted-foreground/40 outline-none transition-colors hover:bg-accent focus-visible:border-primary/50 disabled:cursor-not-allowed disabled:opacity-50",
|
|
69
|
+
className,
|
|
70
|
+
)}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function TextareaField({
|
|
76
|
+
value,
|
|
77
|
+
onChange,
|
|
78
|
+
placeholder,
|
|
79
|
+
rows = 3,
|
|
80
|
+
}: {
|
|
81
|
+
value: string;
|
|
82
|
+
onChange: (v: string) => void;
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
rows?: number;
|
|
85
|
+
}): JSX.Element {
|
|
86
|
+
return (
|
|
87
|
+
<textarea
|
|
88
|
+
value={value}
|
|
89
|
+
onChange={(e) => onChange(e.target.value)}
|
|
90
|
+
placeholder={placeholder}
|
|
91
|
+
rows={rows}
|
|
92
|
+
className="w-full resize-none rounded-lg border border-border bg-card px-2.5 py-2 font-mono text-[12px] text-foreground placeholder:text-muted-foreground/40 outline-none transition-colors hover:bg-accent focus-visible:border-primary/50"
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function CheckboxField({
|
|
98
|
+
checked,
|
|
99
|
+
onChange,
|
|
100
|
+
label,
|
|
101
|
+
}: {
|
|
102
|
+
checked: boolean;
|
|
103
|
+
onChange: (v: boolean) => void;
|
|
104
|
+
label: string;
|
|
105
|
+
}): JSX.Element {
|
|
106
|
+
return (
|
|
107
|
+
<label className="flex cursor-pointer select-none items-center gap-2">
|
|
108
|
+
<button
|
|
109
|
+
type="button"
|
|
110
|
+
onClick={() => onChange(!checked)}
|
|
111
|
+
className={cn(
|
|
112
|
+
"flex h-4 w-4 items-center justify-center rounded border transition-colors",
|
|
113
|
+
checked ? "border-primary bg-primary" : "border-border bg-card hover:bg-accent",
|
|
114
|
+
)}
|
|
115
|
+
>
|
|
116
|
+
{checked && <span className="icon-[mdi--check] h-3 w-3 text-primary-foreground" />}
|
|
117
|
+
</button>
|
|
118
|
+
<span className="text-[12px] text-foreground">{label}</span>
|
|
119
|
+
</label>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface SettingsPageShellViewProps {
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly description?: string;
|
|
6
|
+
readonly headerAction?: ReactNode;
|
|
7
|
+
readonly loading?: boolean;
|
|
8
|
+
readonly loadingLabel?: string;
|
|
9
|
+
readonly children?: ReactNode;
|
|
10
|
+
readonly footer?: ReactNode;
|
|
11
|
+
readonly pb?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Shared settings tab page chrome (title / description / optional header action). */
|
|
15
|
+
export function SettingsPageShellView({
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
headerAction,
|
|
19
|
+
loading = false,
|
|
20
|
+
loadingLabel,
|
|
21
|
+
children,
|
|
22
|
+
footer,
|
|
23
|
+
pb = false,
|
|
24
|
+
}: SettingsPageShellViewProps): JSX.Element {
|
|
25
|
+
if (loading) {
|
|
26
|
+
return (
|
|
27
|
+
<div className="mx-auto w-full max-w-[680px] px-8 pt-2 pb-4">
|
|
28
|
+
{description ? (
|
|
29
|
+
<>
|
|
30
|
+
<h1 className="mb-2 text-[20px] font-bold text-foreground">{title}</h1>
|
|
31
|
+
{description && <p className="mb-6 text-[12px] text-muted-foreground">{description}</p>}
|
|
32
|
+
</>
|
|
33
|
+
) : (
|
|
34
|
+
<h1 className="mb-6 text-[20px] font-bold text-foreground">{title}</h1>
|
|
35
|
+
)}
|
|
36
|
+
<div className="flex items-center justify-center py-16">
|
|
37
|
+
<span className="text-[13px] text-muted-foreground">{loadingLabel}</span>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={`mx-auto w-full max-w-[680px] px-8 pt-2 pb-4${pb ? " pb-10" : ""}`}>
|
|
45
|
+
<div className="mb-6">
|
|
46
|
+
<div
|
|
47
|
+
className={
|
|
48
|
+
headerAction
|
|
49
|
+
? "mb-1 flex flex-wrap items-center justify-between gap-3"
|
|
50
|
+
: description
|
|
51
|
+
? "mb-1.5"
|
|
52
|
+
: "mb-6 flex flex-wrap items-center justify-between gap-3"
|
|
53
|
+
}
|
|
54
|
+
>
|
|
55
|
+
{headerAction ? (
|
|
56
|
+
<>
|
|
57
|
+
<h1 className="text-[20px] font-bold text-foreground">{title}</h1>
|
|
58
|
+
{headerAction}
|
|
59
|
+
</>
|
|
60
|
+
) : description ? (
|
|
61
|
+
<h1 className="text-[20px] font-bold text-foreground">{title}</h1>
|
|
62
|
+
) : (
|
|
63
|
+
<>
|
|
64
|
+
<h1 className="text-[20px] font-bold text-foreground">{title}</h1>
|
|
65
|
+
</>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
{description && (
|
|
69
|
+
<p
|
|
70
|
+
className={
|
|
71
|
+
description.includes("\n")
|
|
72
|
+
? "text-[12px] leading-relaxed text-muted-foreground"
|
|
73
|
+
: "text-[12px] text-muted-foreground"
|
|
74
|
+
}
|
|
75
|
+
>
|
|
76
|
+
{description}
|
|
77
|
+
</p>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
{children}
|
|
81
|
+
{footer}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { cn } from "@vetta-org/ui";
|
|
3
|
+
|
|
4
|
+
export interface SettingsSidebarChildItem {
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly icon: string;
|
|
8
|
+
readonly iconUrl?: string;
|
|
9
|
+
readonly title?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SettingsSidebarTabItem {
|
|
13
|
+
readonly beta?: boolean;
|
|
14
|
+
readonly icon: string;
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly label: string;
|
|
17
|
+
readonly title?: string;
|
|
18
|
+
/** 可就地展开的下级入口;有值时点该行会在进入页面的同时就地展开。 */
|
|
19
|
+
readonly children?: readonly SettingsSidebarChildItem[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SettingsSidebarViewProps {
|
|
23
|
+
readonly activeTab: string;
|
|
24
|
+
readonly betaBadgeLabel: string;
|
|
25
|
+
readonly narrow: boolean;
|
|
26
|
+
readonly onSelectTab: (tab: string) => void;
|
|
27
|
+
/** 下级入口不是设置标签,导航由宿主决定。 */
|
|
28
|
+
readonly onSelectChild?: (key: string) => void;
|
|
29
|
+
/** 当前正在显示的下级入口;它所属的标签会自动展开并高亮该项。 */
|
|
30
|
+
readonly activeChildKey?: string;
|
|
31
|
+
readonly tabs: readonly SettingsSidebarTabItem[];
|
|
32
|
+
readonly title: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function ChildIcon({ item }: { item: SettingsSidebarChildItem }): JSX.Element {
|
|
36
|
+
if (item.iconUrl) return <img src={item.iconUrl} alt="" className="h-3.5 w-3.5 shrink-0 object-contain" />;
|
|
37
|
+
return <span className={cn(item.icon, "h-3.5 w-3.5 shrink-0")} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function SettingsSidebarView({
|
|
41
|
+
activeTab,
|
|
42
|
+
betaBadgeLabel,
|
|
43
|
+
narrow,
|
|
44
|
+
onSelectTab,
|
|
45
|
+
onSelectChild,
|
|
46
|
+
activeChildKey,
|
|
47
|
+
tabs,
|
|
48
|
+
title,
|
|
49
|
+
}: SettingsSidebarViewProps): JSX.Element {
|
|
50
|
+
// 展开态不是独立状态,而是「当前停在这个标签里」的表现:选中即展开,切走即收起。
|
|
51
|
+
// 深链直接进到某个下级入口时也一样——它所属的标签就是当前标签。
|
|
52
|
+
const activeParentKey = activeChildKey
|
|
53
|
+
? (tabs.find((tab) => tab.children?.some((child) => child.key === activeChildKey))?.key ?? null)
|
|
54
|
+
: null;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={cn("flex shrink-0 flex-col", narrow ? "w-14" : "w-[200px]")}>
|
|
58
|
+
<div className={cn("drag-region", narrow ? "h-12" : "px-5 pb-2 pt-2")}>
|
|
59
|
+
{!narrow && <h1 className="text-[20px] font-bold text-foreground">{title}</h1>}
|
|
60
|
+
</div>
|
|
61
|
+
<nav className={cn("flex flex-col gap-0.5", narrow ? "px-2" : "px-2.5")}>
|
|
62
|
+
{tabs.map((item) => {
|
|
63
|
+
// 窄侧栏没有文字位置,展开的清单读不出来,此时只保留「点进页面」。
|
|
64
|
+
const expandable = !narrow && (item.children?.length ?? 0) > 0;
|
|
65
|
+
const expanded = expandable && (activeTab === item.key || activeParentKey === item.key);
|
|
66
|
+
return (
|
|
67
|
+
<div key={item.key} className="flex flex-col">
|
|
68
|
+
<div
|
|
69
|
+
className={cn(
|
|
70
|
+
"flex items-center rounded-lg text-[13px] font-medium transition-colors",
|
|
71
|
+
activeTab === item.key
|
|
72
|
+
? "bg-accent text-foreground"
|
|
73
|
+
: "text-foreground hover:bg-accent/50",
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
<button
|
|
77
|
+
type="button"
|
|
78
|
+
title={item.title}
|
|
79
|
+
aria-expanded={expandable ? expanded : undefined}
|
|
80
|
+
// 进页面与展开清单合成一个动作:点行即导航,清单跟着选中态展开。
|
|
81
|
+
onClick={() => onSelectTab(item.key)}
|
|
82
|
+
className={cn(
|
|
83
|
+
"flex min-w-0 flex-1 items-center rounded-lg outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",
|
|
84
|
+
narrow ? "justify-center px-0 py-2" : "gap-2.5 py-[7px] ps-2.5 pe-2.5",
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
<span className={cn(item.icon, "h-4 w-4 shrink-0")} />
|
|
88
|
+
{!narrow && <span className="flex-1 truncate text-left">{item.label}</span>}
|
|
89
|
+
{!narrow && item.beta && (
|
|
90
|
+
<span className="rounded-full border border-primary/40 px-1.5 py-px text-[9px] font-semibold uppercase leading-tight tracking-wide text-primary">
|
|
91
|
+
{betaBadgeLabel}
|
|
92
|
+
</span>
|
|
93
|
+
)}
|
|
94
|
+
{expandable && (
|
|
95
|
+
<span
|
|
96
|
+
aria-hidden
|
|
97
|
+
className={cn(
|
|
98
|
+
"icon-[solar--alt-arrow-down-linear] h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",
|
|
99
|
+
expanded && "rotate-180",
|
|
100
|
+
)}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
103
|
+
</button>
|
|
104
|
+
</div>
|
|
105
|
+
{expanded && (
|
|
106
|
+
<div className="mt-0.5 flex flex-col gap-0.5 ps-3.5">
|
|
107
|
+
{item.children?.map((child) => (
|
|
108
|
+
<button
|
|
109
|
+
key={child.key}
|
|
110
|
+
type="button"
|
|
111
|
+
title={child.title ?? child.label}
|
|
112
|
+
aria-current={child.key === activeChildKey ? "page" : undefined}
|
|
113
|
+
onClick={() => onSelectChild?.(child.key)}
|
|
114
|
+
className={cn(
|
|
115
|
+
"flex min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2.5 pe-2 text-[12px] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",
|
|
116
|
+
child.key === activeChildKey
|
|
117
|
+
? "bg-accent/70 text-foreground"
|
|
118
|
+
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground",
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<ChildIcon item={child} />
|
|
122
|
+
<span className="min-w-0 flex-1 truncate text-left">{child.label}</span>
|
|
123
|
+
</button>
|
|
124
|
+
))}
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
})}
|
|
130
|
+
</nav>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, type JSX } from "react";
|
|
2
|
+
import { Button, cn } from "@vetta-org/ui";
|
|
3
|
+
|
|
4
|
+
export interface ShortcutRecorderViewProps {
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly onChange: (shortcut: string) => void;
|
|
7
|
+
readonly onReset: () => void;
|
|
8
|
+
readonly isDefault: boolean;
|
|
9
|
+
readonly placeholder: string;
|
|
10
|
+
readonly resetLabel: string;
|
|
11
|
+
/** Host provides platform-specific key → shortcut parsing. */
|
|
12
|
+
readonly eventToShortcut: (event: KeyboardEvent) => string | null;
|
|
13
|
+
/** Host provides display formatting for a stored shortcut. */
|
|
14
|
+
readonly formatShortcut: (shortcut: string) => string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function ShortcutRecorderView({
|
|
18
|
+
value,
|
|
19
|
+
onChange,
|
|
20
|
+
onReset,
|
|
21
|
+
isDefault,
|
|
22
|
+
placeholder,
|
|
23
|
+
resetLabel,
|
|
24
|
+
eventToShortcut,
|
|
25
|
+
formatShortcut,
|
|
26
|
+
}: ShortcutRecorderViewProps): JSX.Element {
|
|
27
|
+
const [recording, setRecording] = useState(false);
|
|
28
|
+
const [pendingKeys, setPendingKeys] = useState<string | null>(null);
|
|
29
|
+
const inputRef = useRef<HTMLButtonElement>(null);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!recording) return;
|
|
33
|
+
|
|
34
|
+
function handleKeyDown(e: KeyboardEvent) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
|
|
38
|
+
const shortcut = eventToShortcut(e);
|
|
39
|
+
if (!shortcut) return;
|
|
40
|
+
|
|
41
|
+
setPendingKeys(shortcut);
|
|
42
|
+
onChange(shortcut);
|
|
43
|
+
setRecording(false);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleBlur() {
|
|
47
|
+
setRecording(false);
|
|
48
|
+
setPendingKeys(null);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
52
|
+
inputRef.current?.addEventListener("blur", handleBlur);
|
|
53
|
+
const btn = inputRef.current;
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
57
|
+
btn?.removeEventListener("blur", handleBlur);
|
|
58
|
+
};
|
|
59
|
+
}, [recording, onChange, eventToShortcut]);
|
|
60
|
+
|
|
61
|
+
const displayValue = pendingKeys ? formatShortcut(pendingKeys) : formatShortcut(value);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div className="flex items-center gap-2">
|
|
65
|
+
<button
|
|
66
|
+
ref={inputRef}
|
|
67
|
+
type="button"
|
|
68
|
+
onClick={() => {
|
|
69
|
+
setRecording(true);
|
|
70
|
+
setPendingKeys(null);
|
|
71
|
+
}}
|
|
72
|
+
className={cn(
|
|
73
|
+
"flex h-[30px] min-w-[120px] items-center justify-center rounded-lg border px-3 text-[12px] font-mono transition-colors",
|
|
74
|
+
recording
|
|
75
|
+
? "animate-pulse border-primary bg-primary/10 text-foreground"
|
|
76
|
+
: "border-input bg-muted text-foreground hover:bg-secondary",
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
{recording ? placeholder : displayValue}
|
|
80
|
+
</button>
|
|
81
|
+
{!isDefault && (
|
|
82
|
+
<Button variant="ghost" size="icon-xs" onClick={onReset} title={resetLabel}>
|
|
83
|
+
<span className="icon-[mdi--restore] h-3.5 w-3.5" />
|
|
84
|
+
</Button>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|