@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,327 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
|
|
3
|
+
export interface JourneyUserIdentity {
|
|
4
|
+
name: string;
|
|
5
|
+
avatar: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface JourneyFileItem {
|
|
9
|
+
key: string;
|
|
10
|
+
name: string;
|
|
11
|
+
title: string;
|
|
12
|
+
storageKey: string;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface JourneyTransferViewItem {
|
|
17
|
+
id: number;
|
|
18
|
+
statusLabel: string;
|
|
19
|
+
statusClassName: string;
|
|
20
|
+
sender: JourneyUserIdentity;
|
|
21
|
+
receiver: JourneyUserIdentity;
|
|
22
|
+
sentAtLabel: string;
|
|
23
|
+
isExpanded: boolean;
|
|
24
|
+
expandToggleLabel: string;
|
|
25
|
+
subtitleDetail: string;
|
|
26
|
+
message: string;
|
|
27
|
+
files: readonly JourneyFileItem[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface JourneyStageViewItem {
|
|
31
|
+
key: string;
|
|
32
|
+
index: number;
|
|
33
|
+
isLast: boolean;
|
|
34
|
+
name: string;
|
|
35
|
+
subtitle: string;
|
|
36
|
+
statusLabel: string;
|
|
37
|
+
statusClassName: string;
|
|
38
|
+
members: readonly (JourneyUserIdentity & { id: number })[];
|
|
39
|
+
enteredAt: string;
|
|
40
|
+
completedAt: string;
|
|
41
|
+
resultFiles: readonly JourneyFileItem[];
|
|
42
|
+
transfers: readonly JourneyTransferViewItem[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface JourneyPanelViewLabels {
|
|
46
|
+
badge: string;
|
|
47
|
+
stageCount: string;
|
|
48
|
+
transferCount: string;
|
|
49
|
+
memberLabel: string;
|
|
50
|
+
noMembers: string;
|
|
51
|
+
enteredAt: string;
|
|
52
|
+
completedAt: string;
|
|
53
|
+
stageOutputFiles: string;
|
|
54
|
+
senderReceiver: string;
|
|
55
|
+
subtitle: string;
|
|
56
|
+
attachedMessage: string;
|
|
57
|
+
attachedFiles: string;
|
|
58
|
+
none: string;
|
|
59
|
+
noTransfers: string;
|
|
60
|
+
notWorkflow: string;
|
|
61
|
+
empty: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type JourneyPanelViewState =
|
|
65
|
+
| { kind: "loading" }
|
|
66
|
+
| { kind: "notWorkflow"; labels: Pick<JourneyPanelViewLabels, "notWorkflow"> }
|
|
67
|
+
| { kind: "error"; message: string }
|
|
68
|
+
| { kind: "empty"; labels: Pick<JourneyPanelViewLabels, "empty"> }
|
|
69
|
+
| {
|
|
70
|
+
kind: "ready";
|
|
71
|
+
workflowName: string;
|
|
72
|
+
labels: JourneyPanelViewLabels;
|
|
73
|
+
stages: readonly JourneyStageViewItem[];
|
|
74
|
+
onToggleTransfer: (transferId: number) => void;
|
|
75
|
+
onOpenFile: (storageKey: string, displayName: string) => void;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
function UserIdentity({
|
|
79
|
+
name,
|
|
80
|
+
avatar,
|
|
81
|
+
className = "",
|
|
82
|
+
}: {
|
|
83
|
+
name: string;
|
|
84
|
+
avatar: string;
|
|
85
|
+
className?: string;
|
|
86
|
+
}): JSX.Element {
|
|
87
|
+
return (
|
|
88
|
+
<div className={`flex min-w-0 items-center gap-1.5 ${className}`}>
|
|
89
|
+
{avatar ? (
|
|
90
|
+
<img src={avatar} alt={name} className="h-5 w-5 shrink-0 rounded-full border border-border object-cover" />
|
|
91
|
+
) : (
|
|
92
|
+
<div className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-border bg-muted/40">
|
|
93
|
+
<span className="icon-[mdi--account-outline] text-[11px] text-muted-foreground/70" />
|
|
94
|
+
</div>
|
|
95
|
+
)}
|
|
96
|
+
<span className="truncate text-[11px] text-foreground/90">{name}</span>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Workflow journey timeline UI. Host pre-resolves users, status labels, and file handlers.
|
|
103
|
+
*/
|
|
104
|
+
export function JourneyPanelView(props: JourneyPanelViewState): JSX.Element {
|
|
105
|
+
if (props.kind === "loading") {
|
|
106
|
+
return (
|
|
107
|
+
<div className="flex h-full items-center justify-center">
|
|
108
|
+
<span className="icon-[mdi--loading] h-5 w-5 animate-spin text-muted-foreground/50" />
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (props.kind === "notWorkflow") {
|
|
114
|
+
return (
|
|
115
|
+
<div className="flex h-full flex-col items-center justify-center gap-2 text-muted-foreground/50">
|
|
116
|
+
<span className="icon-[mdi--timeline-outline] text-[28px]" />
|
|
117
|
+
<span className="text-[12px]">{props.labels.notWorkflow}</span>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (props.kind === "error") {
|
|
123
|
+
return (
|
|
124
|
+
<div className="flex h-full items-center justify-center px-4 text-center text-[12px] text-muted-foreground/60">
|
|
125
|
+
{props.message}
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (props.kind === "empty") {
|
|
131
|
+
return (
|
|
132
|
+
<div className="flex h-full flex-col items-center justify-center gap-2 text-muted-foreground/50">
|
|
133
|
+
<span className="icon-[mdi--timeline-outline] text-[28px]" />
|
|
134
|
+
<span className="text-[12px]">{props.labels.empty}</span>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const { workflowName, labels, stages, onToggleTransfer, onOpenFile } = props;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<div className="flex h-full min-h-0 flex-col">
|
|
143
|
+
<div className="border-b border-border px-4 py-3">
|
|
144
|
+
<div className="rounded-xl border border-border bg-gradient-to-b from-background to-muted/30 p-3">
|
|
145
|
+
<div className="mb-1 flex items-center justify-between">
|
|
146
|
+
<h3 className="text-[13px] font-semibold text-foreground">{workflowName}</h3>
|
|
147
|
+
<span className="rounded-full bg-accent/70 px-2 py-0.5 text-[10px] text-muted-foreground">
|
|
148
|
+
{labels.badge}
|
|
149
|
+
</span>
|
|
150
|
+
</div>
|
|
151
|
+
<div className="flex items-center gap-2 text-[11px] text-muted-foreground/70">
|
|
152
|
+
<span>{labels.stageCount}</span>
|
|
153
|
+
<span className="text-muted-foreground/40">•</span>
|
|
154
|
+
<span>{labels.transferCount}</span>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div className="min-h-0 flex-1 overflow-y-auto px-4 py-3">
|
|
160
|
+
<div className="space-y-3">
|
|
161
|
+
{stages.map((stage) => (
|
|
162
|
+
<div key={stage.key} className="relative pl-8">
|
|
163
|
+
{!stage.isLast && <div className="absolute left-[11px] top-6 h-[calc(100%-6px)] w-px bg-border" />}
|
|
164
|
+
<div className="absolute left-0 top-1 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-background text-[10px] font-semibold text-muted-foreground">
|
|
165
|
+
{stage.index + 1}
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<div className="rounded-lg border border-border bg-background/90 p-3">
|
|
169
|
+
<div className="mb-2 flex items-start justify-between gap-2">
|
|
170
|
+
<div className="min-w-0">
|
|
171
|
+
<div className="truncate text-[13px] font-semibold text-foreground">{stage.name}</div>
|
|
172
|
+
<div className="mt-0.5 text-[11px] text-muted-foreground/70">{stage.subtitle}</div>
|
|
173
|
+
</div>
|
|
174
|
+
<span className={`shrink-0 rounded-full px-2 py-0.5 text-[10px] ${stage.statusClassName}`}>
|
|
175
|
+
{stage.statusLabel}
|
|
176
|
+
</span>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<div className="mb-2 flex flex-wrap gap-1.5">
|
|
180
|
+
{stage.members.length > 0 ? (
|
|
181
|
+
stage.members.map((member) => (
|
|
182
|
+
<div className="flex items-center px-2" key={member.id}>
|
|
183
|
+
<div className="text-[11px]">{labels.memberLabel}</div>
|
|
184
|
+
<div className="max-w-full">
|
|
185
|
+
<UserIdentity name={member.name} avatar={member.avatar} />
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
))
|
|
189
|
+
) : (
|
|
190
|
+
<span className="text-[10px] text-muted-foreground/50">{labels.noMembers}</span>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<div className="grid grid-cols-1 gap-1.5 text-[11px] text-muted-foreground/70">
|
|
195
|
+
<div className="rounded-md bg-muted/35 px-2 py-1.5">
|
|
196
|
+
<div className="mb-px text-[10px] uppercase tracking-wide text-muted-foreground/45">
|
|
197
|
+
{labels.enteredAt}
|
|
198
|
+
</div>
|
|
199
|
+
<div className="font-medium text-foreground/80">{stage.enteredAt}</div>
|
|
200
|
+
</div>
|
|
201
|
+
<div className="rounded-md bg-muted/35 px-2 py-1.5">
|
|
202
|
+
<div className="mb-px text-[10px] uppercase tracking-wide text-muted-foreground/45">
|
|
203
|
+
{labels.completedAt}
|
|
204
|
+
</div>
|
|
205
|
+
<div className="font-medium text-foreground/80">{stage.completedAt}</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
{stage.resultFiles.length > 0 && (
|
|
210
|
+
<div className="mt-2 rounded-md border border-emerald-500 bg-emerald-500/5 px-2 py-1.5">
|
|
211
|
+
<div className="mb-1 text-[10px] font-medium text-emerald-400">{labels.stageOutputFiles}</div>
|
|
212
|
+
<div className="flex flex-wrap gap-1">
|
|
213
|
+
{stage.resultFiles.map((file) => (
|
|
214
|
+
<button
|
|
215
|
+
type="button"
|
|
216
|
+
key={file.key}
|
|
217
|
+
onClick={() => onOpenFile(file.storageKey, file.name)}
|
|
218
|
+
disabled={file.disabled}
|
|
219
|
+
className="max-w-full truncate rounded bg-background/60 px-1.5 py-0.5 text-[10px] text-foreground/80 transition-colors hover:bg-background hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60"
|
|
220
|
+
title={file.title}
|
|
221
|
+
>
|
|
222
|
+
{file.name}
|
|
223
|
+
</button>
|
|
224
|
+
))}
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
228
|
+
|
|
229
|
+
{stage.transfers.length > 0 ? (
|
|
230
|
+
<div className="relative mt-2 pl-4">
|
|
231
|
+
<div className="absolute bottom-2 left-[3px] top-2 w-px bg-border" />
|
|
232
|
+
<div className="space-y-2">
|
|
233
|
+
{stage.transfers.map((transfer) => (
|
|
234
|
+
<div key={transfer.id} className="relative">
|
|
235
|
+
<div className="absolute -left-4 top-[12px] h-2 w-2 rounded-full bg-muted-foreground/45" />
|
|
236
|
+
<div className="rounded-md border border-border bg-background/70 p-2">
|
|
237
|
+
<div className="flex items-center gap-1.5">
|
|
238
|
+
<div className="flex shrink-0 items-center gap-1.5">
|
|
239
|
+
<span
|
|
240
|
+
className={`rounded-full px-1.5 py-0.5 text-[9px] ${transfer.statusClassName}`}
|
|
241
|
+
>
|
|
242
|
+
{transfer.statusLabel}
|
|
243
|
+
</span>
|
|
244
|
+
<button
|
|
245
|
+
type="button"
|
|
246
|
+
onClick={() => onToggleTransfer(transfer.id)}
|
|
247
|
+
className="rounded bg-muted/45 px-1.5 py-0.5 text-[9px] text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground"
|
|
248
|
+
>
|
|
249
|
+
{transfer.expandToggleLabel}
|
|
250
|
+
</button>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
<div className="mt-1 text-[10px] text-muted-foreground/55">{labels.senderReceiver}</div>
|
|
254
|
+
<div className="mt-1 flex min-w-0 items-center gap-2">
|
|
255
|
+
<UserIdentity
|
|
256
|
+
name={transfer.sender.name}
|
|
257
|
+
avatar={transfer.sender.avatar}
|
|
258
|
+
className="max-w-[40%]"
|
|
259
|
+
/>
|
|
260
|
+
<span className="icon-[mdi--arrow-right] shrink-0 text-[13px] text-muted-foreground/45" />
|
|
261
|
+
<UserIdentity
|
|
262
|
+
name={transfer.receiver.name}
|
|
263
|
+
avatar={transfer.receiver.avatar}
|
|
264
|
+
className="max-w-[40%]"
|
|
265
|
+
/>
|
|
266
|
+
</div>
|
|
267
|
+
<div className="mt-1 text-[10px] text-muted-foreground/65">{transfer.sentAtLabel}</div>
|
|
268
|
+
|
|
269
|
+
{transfer.isExpanded && (
|
|
270
|
+
<div className="mt-2 space-y-1">
|
|
271
|
+
<div className="rounded bg-muted/30 px-1.5 py-1">
|
|
272
|
+
<div className="text-[10px] text-muted-foreground/55">{labels.subtitle}</div>
|
|
273
|
+
<div className="mt-0.5 text-[10px] text-foreground/85">
|
|
274
|
+
{transfer.subtitleDetail}
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
<div className="rounded bg-muted/30 px-1.5 py-1">
|
|
278
|
+
<div className="flex items-center gap-1 text-[10px] text-muted-foreground/55">
|
|
279
|
+
<span className="icon-[mdi--message-text-outline] text-[11px]" />
|
|
280
|
+
{labels.attachedMessage}
|
|
281
|
+
</div>
|
|
282
|
+
<div className="mt-0.5 text-[10px] text-foreground/85">{transfer.message}</div>
|
|
283
|
+
</div>
|
|
284
|
+
<div className="rounded bg-muted/30 px-1.5 py-1">
|
|
285
|
+
<div className="mb-0.5 flex items-center gap-1 text-[10px] text-muted-foreground/55">
|
|
286
|
+
<span className="icon-[mdi--paperclip] text-[11px]" />
|
|
287
|
+
{labels.attachedFiles}
|
|
288
|
+
</div>
|
|
289
|
+
{transfer.files.length > 0 ? (
|
|
290
|
+
<div className="flex flex-wrap gap-1">
|
|
291
|
+
{transfer.files.map((file) => (
|
|
292
|
+
<button
|
|
293
|
+
type="button"
|
|
294
|
+
key={file.key}
|
|
295
|
+
onClick={() => onOpenFile(file.storageKey, file.name)}
|
|
296
|
+
disabled={file.disabled}
|
|
297
|
+
className="max-w-full truncate rounded bg-background/70 px-1.5 py-0.5 text-[10px] text-foreground/75 transition-colors hover:bg-background hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60"
|
|
298
|
+
title={file.title}
|
|
299
|
+
>
|
|
300
|
+
{file.name}
|
|
301
|
+
</button>
|
|
302
|
+
))}
|
|
303
|
+
</div>
|
|
304
|
+
) : (
|
|
305
|
+
<div className="text-[10px] text-muted-foreground/50">{labels.none}</div>
|
|
306
|
+
)}
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
)}
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
))}
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
) : (
|
|
316
|
+
<div className="mt-2 rounded bg-muted/20 px-2 py-1.5 text-[10px] text-muted-foreground/55">
|
|
317
|
+
{labels.noTransfers}
|
|
318
|
+
</div>
|
|
319
|
+
)}
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
))}
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
|
|
3
|
+
export interface KnowledgeHistorySessionItem {
|
|
4
|
+
path: string;
|
|
5
|
+
/** Pre-formatted time label (host owns locale). */
|
|
6
|
+
label: string;
|
|
7
|
+
active: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface KnowledgeHistoryPanelViewLabels {
|
|
11
|
+
loading: string;
|
|
12
|
+
empty: string;
|
|
13
|
+
clear: string;
|
|
14
|
+
loadAll: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface KnowledgeHistoryPanelViewProps {
|
|
18
|
+
loading: boolean;
|
|
19
|
+
sessions: readonly KnowledgeHistorySessionItem[];
|
|
20
|
+
hasMore: boolean;
|
|
21
|
+
clearing: boolean;
|
|
22
|
+
labels: KnowledgeHistoryPanelViewLabels;
|
|
23
|
+
onOpen: (path: string) => void;
|
|
24
|
+
onClearRequest: () => void;
|
|
25
|
+
onExpand: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function KnowledgeHistoryPanelView({
|
|
29
|
+
loading,
|
|
30
|
+
sessions,
|
|
31
|
+
hasMore,
|
|
32
|
+
clearing,
|
|
33
|
+
labels,
|
|
34
|
+
onOpen,
|
|
35
|
+
onClearRequest,
|
|
36
|
+
onExpand,
|
|
37
|
+
}: KnowledgeHistoryPanelViewProps): JSX.Element {
|
|
38
|
+
if (loading) {
|
|
39
|
+
return (
|
|
40
|
+
<div className="flex items-center justify-center py-8 text-[12px] text-muted-foreground/50">
|
|
41
|
+
<span className="icon-[mdi--loading] mr-1.5 h-3.5 w-3.5 animate-spin" />
|
|
42
|
+
{labels.loading}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (sessions.length === 0 && !hasMore) {
|
|
47
|
+
return (
|
|
48
|
+
<div className="py-8 text-center text-[12px] text-muted-foreground/50">{labels.empty}</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className="flex h-full flex-col overflow-hidden">
|
|
54
|
+
<div className="flex items-center justify-end px-2 pt-2">
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
onClick={onClearRequest}
|
|
58
|
+
disabled={clearing}
|
|
59
|
+
className="flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-50"
|
|
60
|
+
>
|
|
61
|
+
<span
|
|
62
|
+
className={`h-3.5 w-3.5 ${clearing ? "icon-[mdi--loading] animate-spin" : "icon-[mdi--delete-sweep-outline]"}`}
|
|
63
|
+
/>
|
|
64
|
+
{labels.clear}
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
67
|
+
<div className="flex flex-1 flex-col gap-0.5 overflow-y-auto p-2 pt-1">
|
|
68
|
+
{sessions.map((s) => (
|
|
69
|
+
<button
|
|
70
|
+
key={s.path}
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={() => onOpen(s.path)}
|
|
73
|
+
className={`flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[12px] transition-colors ${
|
|
74
|
+
s.active ? "bg-primary/10 text-primary" : "text-foreground hover:bg-accent/50"
|
|
75
|
+
}`}
|
|
76
|
+
>
|
|
77
|
+
<span className="icon-[mdi--history] h-3.5 w-3.5 shrink-0 opacity-60" />
|
|
78
|
+
<span className="truncate">{s.label}</span>
|
|
79
|
+
</button>
|
|
80
|
+
))}
|
|
81
|
+
{hasMore && (
|
|
82
|
+
<button
|
|
83
|
+
type="button"
|
|
84
|
+
onClick={onExpand}
|
|
85
|
+
className="mt-1 rounded-lg px-2.5 py-1.5 text-center text-[12px] text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
|
|
86
|
+
>
|
|
87
|
+
{labels.loadAll}
|
|
88
|
+
</button>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { memo, useEffect, useMemo, useState, type JSX, type MouseEvent } from "react";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
|
+
import type { Components } from "react-markdown";
|
|
4
|
+
import remarkGfm from "remark-gfm";
|
|
5
|
+
import { CodeBlockCopyButtonView } from "../shared/CodeBlockCopyButton";
|
|
6
|
+
import {
|
|
7
|
+
MarkdownTable,
|
|
8
|
+
MarkdownTableBody,
|
|
9
|
+
MarkdownTableCell,
|
|
10
|
+
MarkdownTableHead,
|
|
11
|
+
MarkdownTableHeaderCell,
|
|
12
|
+
MarkdownTableRow,
|
|
13
|
+
} from "../shared/MarkdownTable";
|
|
14
|
+
import { SyntaxHighlightedCode } from "../shared/SyntaxHighlightedCode";
|
|
15
|
+
|
|
16
|
+
export interface MarkdownPreviewViewProps {
|
|
17
|
+
content: string;
|
|
18
|
+
theme: "light" | "dark";
|
|
19
|
+
/** Host opens http(s)/mailto/tel links (e.g. via shell.openExternal). */
|
|
20
|
+
onOpenExternal: (href: string) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
|
|
24
|
+
|
|
25
|
+
type FrontmatterEntry = { key: string; value: string; depth: number };
|
|
26
|
+
|
|
27
|
+
function parseFrontmatter(raw: string): { entries: FrontmatterEntry[]; body: string } | null {
|
|
28
|
+
const match = raw.match(FRONTMATTER_RE);
|
|
29
|
+
if (!match) return null;
|
|
30
|
+
const block = match[1] ?? "";
|
|
31
|
+
const entries: FrontmatterEntry[] = [];
|
|
32
|
+
for (const line of block.split(/\r?\n/)) {
|
|
33
|
+
if (!line.trim()) continue;
|
|
34
|
+
const indent = line.match(/^\s*/)?.[0].length ?? 0;
|
|
35
|
+
const depth = Math.floor(indent / 2);
|
|
36
|
+
const rest = line.slice(indent);
|
|
37
|
+
const colon = rest.indexOf(":");
|
|
38
|
+
if (colon === -1) {
|
|
39
|
+
entries.push({ key: "", value: rest.trim(), depth });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const key = rest.slice(0, colon).trim();
|
|
43
|
+
const value = rest
|
|
44
|
+
.slice(colon + 1)
|
|
45
|
+
.trim()
|
|
46
|
+
.replace(/^["']|["']$/g, "");
|
|
47
|
+
entries.push({ key, value, depth });
|
|
48
|
+
}
|
|
49
|
+
return { entries, body: raw.slice(match[0].length) };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function Frontmatter({ entries }: { entries: FrontmatterEntry[] }): JSX.Element {
|
|
53
|
+
return (
|
|
54
|
+
<div className="mb-4 overflow-hidden rounded-lg border border-border bg-muted/40">
|
|
55
|
+
<div className="border-b border-border/60 px-3 py-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70">
|
|
56
|
+
Frontmatter
|
|
57
|
+
</div>
|
|
58
|
+
<div className="px-3 py-2">
|
|
59
|
+
<dl className="grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[12px] leading-[1.6]">
|
|
60
|
+
{entries.map((entry, i) => (
|
|
61
|
+
<div key={i} className="contents">
|
|
62
|
+
<dt
|
|
63
|
+
className="font-medium text-muted-foreground"
|
|
64
|
+
style={{ paddingLeft: `${entry.depth * 12}px` }}
|
|
65
|
+
>
|
|
66
|
+
{entry.key || "-"}
|
|
67
|
+
</dt>
|
|
68
|
+
<dd className="break-words text-foreground">
|
|
69
|
+
{entry.value || <span className="text-muted-foreground/40">—</span>}
|
|
70
|
+
</dd>
|
|
71
|
+
</div>
|
|
72
|
+
))}
|
|
73
|
+
</dl>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const EXTERNAL_LINK_PROTOCOLS = new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
80
|
+
const MARKDOWN_REMARK_PLUGINS = [remarkGfm];
|
|
81
|
+
|
|
82
|
+
function isExternalLink(href: string | undefined): href is string {
|
|
83
|
+
if (!href) return false;
|
|
84
|
+
try {
|
|
85
|
+
return EXTERNAL_LINK_PROTOCOLS.has(new URL(href).protocol);
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function MarkdownCodeBlock({
|
|
92
|
+
lang,
|
|
93
|
+
code,
|
|
94
|
+
theme,
|
|
95
|
+
}: {
|
|
96
|
+
lang: string;
|
|
97
|
+
code: string;
|
|
98
|
+
theme: "light" | "dark";
|
|
99
|
+
}): JSX.Element {
|
|
100
|
+
const [copied, setCopied] = useState(false);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!copied) return;
|
|
104
|
+
const id = window.setTimeout(() => setCopied(false), 1500);
|
|
105
|
+
return () => window.clearTimeout(id);
|
|
106
|
+
}, [copied]);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<CodeBlockCopyButtonView
|
|
110
|
+
copied={copied}
|
|
111
|
+
onCopy={() => {
|
|
112
|
+
void navigator.clipboard.writeText(code).then(() => setCopied(true));
|
|
113
|
+
}}
|
|
114
|
+
labels={{ copy: "Copy code", copied: "Copied" }}
|
|
115
|
+
>
|
|
116
|
+
<div className="my-2 overflow-hidden rounded-lg border border-border bg-muted">
|
|
117
|
+
{lang && (
|
|
118
|
+
<div className="border-b border-border px-3 py-1 text-[10px] font-medium text-muted-foreground/50">
|
|
119
|
+
{lang}
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
<SyntaxHighlightedCode code={code} lang={lang} theme={theme} />
|
|
123
|
+
</div>
|
|
124
|
+
</CodeBlockCopyButtonView>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const MarkdownPreviewView = memo(function MarkdownPreviewView({
|
|
129
|
+
content,
|
|
130
|
+
theme,
|
|
131
|
+
onOpenExternal,
|
|
132
|
+
}: MarkdownPreviewViewProps): JSX.Element {
|
|
133
|
+
const parsed = parseFrontmatter(content);
|
|
134
|
+
const body = parsed?.body ?? content;
|
|
135
|
+
|
|
136
|
+
const components = useMemo<Components>(() => {
|
|
137
|
+
const handleLinkClick = (event: MouseEvent<HTMLAnchorElement>, href: string | undefined) => {
|
|
138
|
+
if (!isExternalLink(href)) return;
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
onOpenExternal(href);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
h1: ({ children }) => (
|
|
145
|
+
<h1 className="mb-3 mt-4 text-[18px] font-bold leading-tight text-foreground">{children}</h1>
|
|
146
|
+
),
|
|
147
|
+
h2: ({ children }) => (
|
|
148
|
+
<h2 className="mb-2 mt-3.5 text-[16px] font-bold leading-tight text-foreground">{children}</h2>
|
|
149
|
+
),
|
|
150
|
+
h3: ({ children }) => (
|
|
151
|
+
<h3 className="mb-2 mt-3 text-[14px] font-semibold leading-tight text-foreground">{children}</h3>
|
|
152
|
+
),
|
|
153
|
+
h4: ({ children }) => (
|
|
154
|
+
<h4 className="mb-1.5 mt-2.5 text-[13px] font-semibold text-foreground">{children}</h4>
|
|
155
|
+
),
|
|
156
|
+
p: ({ children }) => <p className="my-1.5 text-[13px] leading-[1.6] text-foreground">{children}</p>,
|
|
157
|
+
ul: ({ children }) => (
|
|
158
|
+
<ul className="md-bullet-list my-1.5 text-[13px] leading-[1.6] text-foreground">{children}</ul>
|
|
159
|
+
),
|
|
160
|
+
ol: ({ children }) => (
|
|
161
|
+
<ol className="my-1.5 ml-4 list-decimal space-y-0.5 text-[13px] leading-[1.6] text-foreground marker:text-primary">
|
|
162
|
+
{children}
|
|
163
|
+
</ol>
|
|
164
|
+
),
|
|
165
|
+
li: ({ children }) => <li>{children}</li>,
|
|
166
|
+
code: ({ className, children }) => {
|
|
167
|
+
const raw = String(children);
|
|
168
|
+
const isBlock = (className?.startsWith("language-") ?? false) || raw.includes("\n");
|
|
169
|
+
if (isBlock) {
|
|
170
|
+
const lang = className?.replace("language-", "") ?? "";
|
|
171
|
+
const code = raw.replace(/\n$/, "");
|
|
172
|
+
return <MarkdownCodeBlock lang={lang} code={code} theme={theme} />;
|
|
173
|
+
}
|
|
174
|
+
return <code className="rounded bg-muted px-1 py-0.5 text-[12px] text-foreground">{children}</code>;
|
|
175
|
+
},
|
|
176
|
+
pre: ({ children }) => <>{children}</>,
|
|
177
|
+
blockquote: ({ children }) => (
|
|
178
|
+
<blockquote className="my-2 border-l-2 border-primary/10 pl-3 text-[13px] italic text-muted-foreground">
|
|
179
|
+
{children}
|
|
180
|
+
</blockquote>
|
|
181
|
+
),
|
|
182
|
+
table: ({ children }) => (
|
|
183
|
+
<MarkdownTable fontSizeClass="text-[12px]">{children}</MarkdownTable>
|
|
184
|
+
),
|
|
185
|
+
thead: ({ children }) => <MarkdownTableHead>{children}</MarkdownTableHead>,
|
|
186
|
+
tbody: ({ children }) => <MarkdownTableBody>{children}</MarkdownTableBody>,
|
|
187
|
+
tr: ({ children }) => <MarkdownTableRow>{children}</MarkdownTableRow>,
|
|
188
|
+
th: ({ children, style }) => (
|
|
189
|
+
<MarkdownTableHeaderCell style={style}>{children}</MarkdownTableHeaderCell>
|
|
190
|
+
),
|
|
191
|
+
td: ({ children, style }) => <MarkdownTableCell style={style}>{children}</MarkdownTableCell>,
|
|
192
|
+
hr: () => <hr className="my-3 border-border" />,
|
|
193
|
+
a: ({ href, children }) => (
|
|
194
|
+
<a
|
|
195
|
+
href={href}
|
|
196
|
+
className="text-primary underline decoration-primary/30 hover:decoration-primary"
|
|
197
|
+
target={isExternalLink(href) ? "_blank" : undefined}
|
|
198
|
+
rel={isExternalLink(href) ? "noopener noreferrer" : undefined}
|
|
199
|
+
onClick={(event) => handleLinkClick(event, href)}
|
|
200
|
+
>
|
|
201
|
+
{children}
|
|
202
|
+
</a>
|
|
203
|
+
),
|
|
204
|
+
strong: ({ children }) => <strong className="font-semibold text-foreground">{children}</strong>,
|
|
205
|
+
em: ({ children }) => <em className="italic">{children}</em>,
|
|
206
|
+
};
|
|
207
|
+
}, [theme, onOpenExternal]);
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<div className="markdown-body break-words p-4">
|
|
211
|
+
{parsed && parsed.entries.length > 0 && <Frontmatter entries={parsed.entries} />}
|
|
212
|
+
<ReactMarkdown remarkPlugins={MARKDOWN_REMARK_PLUGINS} components={components}>
|
|
213
|
+
{body}
|
|
214
|
+
</ReactMarkdown>
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
});
|