@vetta-org/theme-ui 0.1.1 → 0.2.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 +740 -20
- package/src/action-approval/AppearanceActionPickerView.tsx +2 -78
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +2 -9
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +4 -1
- package/src/action-approval/GenericActionApprovalView.tsx +2 -9
- package/src/action-approval/ManageActionApprovalFrameView.tsx +4 -1
- package/src/action-approval/NavigationOpenApprovalView.tsx +2 -9
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +3 -1
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +3 -10
- package/src/action-approval/index.ts +0 -1
- package/src/activity/ActivityPanel.tsx +13 -10
- package/src/activity/ActivityPanelFrame.test.tsx +32 -0
- package/src/activity/ActivityPanelFrame.tsx +3 -2
- package/src/activity/BackgroundTasksTabPanelView.tsx +1 -1
- package/src/activity/BrowserPanelView.tsx +48 -49
- package/src/activity/CodePreview.tsx +15 -1
- package/src/activity/DebugTabPanelView.tsx +1 -1
- package/src/activity/MarkdownPreviewView.test.tsx +53 -0
- package/src/activity/MarkdownPreviewView.tsx +135 -62
- package/src/activity/PluginTabPickerView.tsx +5 -3
- package/src/activity/PortsTabPanelView.tsx +911 -0
- package/src/activity/ToolCallsSubTabView.tsx +1 -1
- package/src/activity/WorkflowTabPanelView.tsx +1 -1
- package/src/activity/index.ts +9 -0
- package/src/app/AppBackground.tsx +1 -1
- package/src/app/AppBootLoadingView.tsx +4 -2
- package/src/app-shell/DefaultWindowControls.tsx +1 -1
- package/src/app-shell/PageHeaderActionGroup.tsx +1 -1
- package/src/app-shell/PageHeaderContent.tsx +36 -7
- package/src/app-shell/PageHeaderFrame.tsx +15 -3
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +1 -1
- package/src/app-shell/PageHeaderTitle.tsx +1 -1
- package/src/app-shell/WindowControlButton.tsx +1 -1
- package/src/app-shell/header-crowding.test.ts +62 -0
- package/src/app-shell/header-crowding.tsx +137 -0
- package/src/appearance/BackgroundImageFrame.tsx +1 -1
- package/src/appearance/CenterSliceImageFrame.tsx +1 -1
- package/src/appearance/CornerImageFrame.tsx +1 -1
- package/src/appearance/HorizontalSliceImageFrame.tsx +1 -1
- package/src/appearance/NineSliceImageFrame.tsx +1 -1
- package/src/appearance/ThemeSurface.tsx +1 -1
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +2 -1
- package/src/batch-tasks/BatchTaskProjectActionsView.test.tsx +97 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +45 -35
- package/src/batch-tasks/batchTaskUi.tsx +0 -29
- package/src/bottom-panel/BottomPanelView.test.tsx +43 -0
- package/src/bottom-panel/BottomPanelView.tsx +222 -0
- package/src/bottom-panel/index.ts +26 -0
- package/src/chat/AgentAvatarView.tsx +1 -1
- package/src/chat/AnnotationViews.tsx +107 -0
- package/src/chat/AskUserQuestionView.tsx +18 -11
- package/src/chat/AssistantMessageView.tsx +48 -13
- package/src/chat/AtPanelView.test.tsx +61 -0
- package/src/chat/AtPanelView.tsx +63 -38
- package/src/chat/BashTerminalCard.tsx +1 -2
- package/src/chat/ChatHeaderActionsView.tsx +74 -18
- package/src/chat/CompactionStepView.test.tsx +34 -0
- package/src/chat/CompactionStepView.tsx +85 -0
- package/src/chat/ContextRingView.test.tsx +81 -0
- package/src/chat/ContextRingView.tsx +78 -62
- package/src/chat/ExecutionModeSelectorView.tsx +20 -5
- package/src/chat/HeaderActionBarView.tsx +806 -0
- package/src/chat/HeaderActionOverflowMenu.tsx +128 -0
- package/src/chat/InlineModelPicker.test.tsx +81 -0
- package/src/chat/InlineModelPicker.tsx +201 -0
- package/src/chat/InlineTokenChip.tsx +2 -68
- package/src/chat/InputBarBackground.tsx +1 -1
- package/src/chat/InputBarPlaceholder.tsx +26 -3
- package/src/chat/LiveThinkingView.tsx +51 -37
- package/src/chat/MessageBoundaryViews.tsx +21 -0
- package/src/chat/MessageFeedContext.tsx +13 -5
- package/src/chat/MessageFeedLayoutView.tsx +29 -3
- package/src/chat/MessageFeedView.test.tsx +81 -0
- package/src/chat/MessageFeedView.tsx +72 -152
- package/src/chat/MessageInputView.tsx +6 -2
- package/src/chat/MessageLayoutView.tsx +1 -1
- package/src/chat/MessageSelectionContextMenuView.tsx +4 -1
- package/src/chat/MessageTimelineView.tsx +1 -1
- package/src/chat/MessageView.tsx +1 -1
- package/src/chat/MessageVisualView.tsx +1 -1
- package/src/chat/ModelConfiguration.tsx +283 -0
- package/src/chat/ModelSelectorTrigger.tsx +63 -0
- package/src/chat/ModelSelectorView.tsx +1037 -223
- package/src/chat/NewSession.ts +1 -37
- package/src/chat/NewSessionPicker.tsx +3 -2
- package/src/chat/ProjectSelectorView.tsx +3 -2
- package/src/chat/ReasoningStepSlider.tsx +61 -0
- package/src/chat/RemoteSessionBadgeView.tsx +24 -0
- package/src/chat/SkillPromptAreaView.tsx +5 -19
- package/src/chat/TeamMemberReplyCardView.test.tsx +33 -0
- package/src/chat/TeamMemberReplyCardView.tsx +133 -0
- package/src/chat/TextBlockView.tsx +7 -770
- package/src/chat/TodoProgress.tsx +25 -53
- package/src/chat/TodoStatusBarView.tsx +14 -5
- package/src/chat/UserMessageView.tsx +113 -33
- package/src/chat/header-action-narrow.test.ts +21 -0
- package/src/chat/header-action-narrow.ts +38 -0
- package/src/chat/index.ts +33 -27
- package/src/chat/markdown-link.ts +7 -279
- package/src/chat/message-feed-fade.css +80 -0
- package/src/chat/message-feed-fade.test.tsx +75 -0
- package/src/chat/send-button.css +4 -22
- package/src/chat/streaming-reveal.test.ts +218 -0
- package/src/chat/streaming-reveal.ts +13 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +2 -1
- package/src/file-explorer/FileContextMenuView.tsx +44 -11
- package/src/file-explorer/FileExplorerSettingsView.tsx +97 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +1 -1
- package/src/file-explorer/FileTreeNodeView.tsx +59 -18
- package/src/file-explorer/FileTreeView.tsx +236 -129
- package/src/file-explorer/file-tree-dom.ts +23 -0
- package/src/file-explorer/file-tree-rows.test.ts +74 -0
- package/src/file-explorer/file-tree-rows.ts +168 -0
- package/src/file-explorer/index.ts +17 -0
- package/src/file-explorer/types.ts +3 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +24 -16
- package/src/file-preview/FilePreviewDialogView.tsx +2 -2
- package/src/file-preview/FilePreviewView.tsx +12 -2
- package/src/file-preview/ReadonlyCodeView.tsx +46 -0
- package/src/file-preview/TextFileEditorView.tsx +2 -1
- package/src/file-preview/syntax-tokens.css +1 -1
- package/src/image-assets.d.ts +4 -0
- package/src/index.ts +1 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +1 -1
- package/src/layout/AppFrame.tsx +3 -2
- package/src/layout/MainContentFrame.tsx +7 -2
- package/src/layout/ResizeHandle.tsx +68 -17
- package/src/layout/SidebarDock.tsx +75 -19
- package/src/layout/SidebarOverlay.tsx +1 -1
- package/src/layout/index.ts +1 -1
- package/src/layout/resize-handle-axis.test.ts +51 -0
- package/src/live-indicators.test.ts +43 -0
- package/src/markdown/CodeBlock.tsx +123 -0
- package/src/markdown/FileLinkBadge.tsx +77 -0
- package/src/markdown/InlineTokenChip.tsx +68 -0
- package/src/markdown/MarkdownContent.tsx +418 -0
- package/src/markdown/MarkdownImage.tsx +41 -0
- package/src/markdown/MathFormula.tsx +46 -0
- package/src/markdown/MermaidBlock.tsx +82 -0
- package/src/markdown/RichCodeBlock.tsx +127 -0
- package/src/markdown/SvgPreview.tsx +45 -0
- package/src/markdown/WebsiteIcon.tsx +94 -0
- package/src/markdown/builtin-renderers.tsx +43 -0
- package/src/markdown/definition.tsx +49 -0
- package/src/markdown/host.tsx +18 -0
- package/src/markdown/image-actions.ts +29 -0
- package/src/markdown/index.ts +12 -0
- package/src/markdown/inline-tokens.ts +187 -0
- package/src/markdown/markdown-link.ts +279 -0
- package/src/markdown/math-client.ts +116 -0
- package/src/markdown/math-render.ts +23 -0
- package/src/markdown/math-syntax.ts +80 -0
- package/src/markdown/math.worker.ts +16 -0
- package/src/markdown/nodes.ts +15 -0
- package/src/markdown/preview-policy.test.ts +31 -0
- package/src/markdown/preview-policy.ts +76 -0
- package/src/markdown/progressive-chunks.test.ts +43 -0
- package/src/markdown/progressive-chunks.ts +58 -0
- package/src/markdown/rich-labels.ts +55 -0
- package/src/markdown/rich-syntax.ts +93 -0
- package/src/markdown/stable-blocks.test.ts +90 -0
- package/src/markdown/stable-blocks.ts +124 -0
- package/src/markdown/streaming-reveal.ts +297 -0
- package/src/markdown/streaming.test.ts +57 -0
- package/src/markdown/streaming.ts +211 -0
- package/src/markdown/use-render-snapshot.ts +24 -0
- package/src/markdown/use-rich-visibility.ts +24 -0
- package/src/overlays/CommandMenuRow.tsx +77 -17
- package/src/overlays/CommandMenuView.tsx +163 -118
- package/src/overlays/ConfirmDialogView.tsx +25 -20
- package/src/overlays/DiagnosticsExportDialogView.tsx +236 -0
- package/src/overlays/MagpieHandoverDialogView.tsx +217 -0
- package/src/overlays/ReleaseNoteMarkdown.test.tsx +24 -0
- package/src/overlays/ReleaseNoteMarkdown.tsx +55 -0
- package/src/overlays/SplashOptionRow.tsx +46 -0
- package/src/overlays/SplashPanel.tsx +85 -0
- package/src/overlays/SplashParts.tsx +217 -0
- package/src/overlays/UpdateCheckerView.tsx +34 -18
- package/src/overlays/UpdateRestartDialogView.tsx +203 -53
- package/src/overlays/assets/diagnostics-banner.webp +0 -0
- package/src/overlays/command-menu-types.ts +15 -1
- package/src/overlays/command-menu.css +1 -20
- package/src/overlays/index.ts +26 -1
- package/src/plugin-ui/index.ts +10 -0
- package/src/project/ConversationTagDotsView.tsx +1 -1
- package/src/project/ConversationTagEditorDialogView.tsx +4 -1
- package/src/project/DefaultConversationSectionView.tsx +15 -24
- package/src/project/DefaultSessionListView.tsx +5 -31
- package/src/project/DefaultSessionRowView.tsx +114 -55
- package/src/project/ManageSessionsSplashView.tsx +439 -0
- package/src/project/NewProjectDialogView.tsx +3 -10
- package/src/project/ProjectContextMenuView.tsx +30 -139
- package/src/project/ProjectDetailPageView.test.tsx +140 -0
- package/src/project/ProjectDetailPageView.tsx +372 -165
- package/src/project/ProjectGroupView.tsx +1 -1
- package/src/project/ProjectRowView.tsx +29 -12
- package/src/project/ProjectSessionsView.tsx +25 -47
- package/src/project/QuickScrollOverlay.tsx +1 -1
- package/src/project/SessionContextMenuView.tsx +15 -7
- package/src/project/SessionRowMoreButton.tsx +50 -0
- package/src/project/SessionRowView.tsx +106 -63
- package/src/project/SessionTitleMarquee.tsx +54 -0
- package/src/project/SidebarProjectDisclosure.tsx +60 -0
- package/src/project/SidebarProjectsSectionView.tsx +6 -1
- package/src/project/index.ts +12 -0
- package/src/project/session-row-transition.ts +9 -0
- package/src/project/types.ts +4 -2
- package/src/project/useActiveSessionAutoScroll.ts +10 -4
- package/src/registry.ts +0 -2
- package/src/scheduler/AutomationDetailPaneView.tsx +68 -0
- package/src/scheduler/AutomationPageView.tsx +118 -121
- package/src/scheduler/ExecutionHistoryView.tsx +7 -5
- package/src/scheduler/TaskListView.tsx +52 -201
- package/src/scheduler/index.ts +7 -12
- package/src/settings/AppshotSettingsView.tsx +0 -1
- package/src/settings/ArchivedProjectsSettingsView.tsx +122 -1
- package/src/settings/BuiltinMcpSectionView.tsx +1 -1
- package/src/settings/EnvironmentGitRowView.tsx +156 -0
- package/src/settings/EnvironmentSettingsView.tsx +25 -3
- package/src/settings/GeneralSettingsView.tsx +18 -24
- package/src/settings/ImChannelGuideDialogView.tsx +2 -2
- package/src/settings/ImFeishuDialogView.tsx +1 -1
- package/src/settings/ImLegacyImportBannerView.tsx +1 -1
- package/src/settings/ImLogDrawerView.tsx +2 -1
- package/src/settings/JsonConfigInputView.tsx +171 -0
- package/src/settings/LauncherSettingsView.test.tsx +95 -0
- package/src/settings/LauncherSettingsView.tsx +273 -0
- package/src/settings/ModelsFetchedModelsDrawerView.tsx +292 -0
- package/src/settings/ModelsProvidersSectionView.tsx +26 -23
- package/src/settings/MotionSelect.tsx +9 -7
- package/src/settings/NotificationSettingsView.tsx +79 -0
- package/src/settings/PermissionsSettingsView.tsx +3 -7
- package/src/settings/PetActionGalleryView.test.tsx +163 -0
- package/src/settings/PetActionGalleryView.tsx +216 -0
- package/src/settings/PetSettingsView.test.tsx +117 -0
- package/src/settings/PetSettingsView.tsx +86 -22
- package/src/settings/PresetProviderModelsListView.tsx +141 -24
- package/src/settings/PresetProviderRowView.tsx +147 -185
- package/src/settings/ProxySettingsSectionView.tsx +182 -0
- package/src/settings/QrBindDialogView.tsx +1 -1
- package/src/settings/RemoteMcpSectionView.tsx +1 -1
- package/src/settings/SettingChrome.tsx +2 -2
- package/src/settings/SettingsAiAssistButtonView.tsx +9 -119
- package/src/settings/SettingsFormFields.tsx +4 -7
- package/src/settings/SettingsSidebarView.tsx +64 -3
- package/src/settings/ShortcutRecorderView.test.tsx +108 -0
- package/src/settings/ShortcutRecorderView.tsx +15 -9
- package/src/settings/ShortcutsSettingsView.tsx +1 -5
- package/src/settings/SpaceEditorDialogView.tsx +158 -0
- package/src/settings/SpacesSettingsView.tsx +150 -0
- package/src/settings/WebhookEndpointListView.tsx +4 -5
- package/src/settings/assets/space-editor-illustration.webp +0 -0
- package/src/settings/index.ts +59 -68
- package/src/shared/ActivityStatusDot.tsx +69 -0
- package/src/shared/AvatarStackView.tsx +13 -13
- package/src/shared/BotAvatar.tsx +11 -9
- package/src/shared/CodeBlockCopyButton.tsx +1 -1
- package/src/shared/ContextMenuView.tsx +4 -11
- package/src/shared/MarkdownTable.tsx +2 -2
- package/src/shared/SegmentedControl.test.tsx +68 -0
- package/src/shared/SegmentedControl.tsx +10 -2
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.outline.test.tsx +59 -0
- package/src/shared/TabBar.tsx +23 -18
- package/src/shared/VettaKbd.test.tsx +52 -0
- package/src/shared/VettaKbd.tsx +100 -0
- package/src/shared/connected-tab-outline.test.ts +2 -2
- package/src/shared/connected-tab-outline.ts +2 -1
- package/src/shared/index.ts +7 -0
- package/src/shared/kbd-keys.test.ts +61 -0
- package/src/shared/kbd-keys.ts +253 -0
- package/src/shared/platform.ts +9 -0
- package/src/shared/provider-icon/icons.ts +4 -2
- package/src/shared/provider-icon/index.tsx +1 -1
- package/src/shared/provider-icon/magpie.svg +1 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +33 -24
- package/src/sidebar/DefaultSidebar.tsx +3 -1
- package/src/sidebar/MessageCenterDialogView.tsx +3 -2
- package/src/sidebar/MessageCenterEmptyState.tsx +1 -1
- package/src/sidebar/MessageCenterTabs.tsx +1 -1
- package/src/sidebar/MessageCenterToolbarButton.tsx +1 -1
- package/src/sidebar/MessageCenterTriggerView.tsx +2 -2
- package/src/sidebar/ProjectsPanelEmptyState.tsx +26 -7
- package/src/sidebar/SessionStatusIcon.tsx +16 -1
- package/src/sidebar/SettingsMenuThemeSection.tsx +1 -1
- package/src/sidebar/SettingsMenuTriggerView.test.tsx +42 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +29 -50
- package/src/sidebar/ShowMoreSessionsButton.tsx +1 -1
- package/src/sidebar/SidebarFilterSelectView.tsx +8 -16
- package/src/sidebar/SidebarNavBadgeView.tsx +1 -1
- package/src/sidebar/SidebarNavIcon.tsx +1 -1
- package/src/sidebar/SidebarNavItemButton.tsx +1 -1
- package/src/sidebar/SidebarNavMorePanel.tsx +19 -7
- package/src/sidebar/SidebarNavigation.tsx +24 -15
- package/src/sidebar/SidebarPanel.tsx +11 -2
- package/src/sidebar/SidebarSectionActionButton.test.tsx +91 -0
- package/src/sidebar/SidebarSectionActionButton.tsx +52 -0
- package/src/sidebar/SidebarSectionTriggerLabel.tsx +20 -0
- package/src/sidebar/SidebarTopBar.tsx +10 -7
- package/src/sidebar/WaitingPulseBadge.tsx +19 -0
- package/src/sidebar/index.ts +1 -16
- package/src/skills/index.ts +0 -19
- package/src/skills/skill-icon.tsx +4 -8
- package/src/styles.css +26 -6
- package/src/chat/DefaultSceneCarousel.tsx +0 -113
- package/src/chat/SceneCard.tsx +0 -138
- package/src/scheduler/HistoryDrawerView.tsx +0 -149
- package/src/scheduler/TaskFormDialogView.tsx +0 -60
- package/src/settings/AchievementNavigationButtonView.tsx +0 -90
- package/src/settings/AchievementPromotionDialogView.tsx +0 -91
- package/src/settings/AchievementSettingsView.tsx +0 -44
- package/src/settings/PetBubbleStylePreviewView.tsx +0 -44
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -66
- package/src/settings/SubscriptionActionsView.tsx +0 -63
- package/src/settings/SubscriptionCardsView.tsx +0 -212
- package/src/settings/TeamDetailView.tsx +0 -148
- package/src/settings/TeamDialogsView.tsx +0 -151
- package/src/settings/TeamListView.tsx +0 -57
- package/src/settings/TeamSettingsView.tsx +0 -51
- package/src/settings/TokenActivityChartView.tsx +0 -286
- package/src/settings/UsageStatsView.tsx +0 -101
- package/src/settings/achievements/AchievementCurtains.tsx +0 -50
- package/src/settings/achievements/AchievementPromotionBadge3D.tsx +0 -350
- package/src/settings/achievements/AchievementPromotionConfetti.tsx +0 -71
- package/src/settings/achievements/AchievementTitle.tsx +0 -52
- package/src/settings/achievements/index.ts +0 -13
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +0 -135
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +0 -40
- package/src/settings/token-activity.test.ts +0 -195
- package/src/settings/token-activity.ts +0 -320
- package/src/sidebar/AddProjectMenuItem.tsx +0 -21
- package/src/sidebar/AddProjectMenuPopoverView.tsx +0 -52
- package/src/sidebar/NotificationMessageListView.tsx +0 -136
- package/src/sidebar/SettingsMenuAccountSection.tsx +0 -32
- package/src/sidebar/SettingsMenuQuotaSection.tsx +0 -45
- package/src/skills/SceneCardView.tsx +0 -194
- package/src/skills/SkillCardView.tsx +0 -186
- package/src/skills/SkillDetailDialogView.tsx +0 -138
- package/src/skills/SkillTagGroupView.tsx +0 -56
- package/src/skills/SkillToggleSwitch.tsx +0 -31
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { cn } from "@vetta-org/ui";
|
|
2
|
-
import type
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import { useId, type JSX, type Ref } from "react";
|
|
3
3
|
import { RunningPulseDot } from "../sidebar/RunningPulseDot";
|
|
4
|
-
import {
|
|
4
|
+
import { WaitingPulseBadge } from "../sidebar/WaitingPulseBadge";
|
|
5
|
+
import { PROJECT_TYPE_ICONS, type ProjectTypeIconKey, REMOTE_PROJECT_ICON } from "./types";
|
|
5
6
|
|
|
6
7
|
export interface ProjectRowViewProps {
|
|
7
8
|
badge?: string;
|
|
8
9
|
displayName: string;
|
|
9
10
|
expanded: boolean;
|
|
10
11
|
hasRunning: boolean;
|
|
12
|
+
/** 组内有会话正等着用户处理;优先于运行灯。 */
|
|
13
|
+
hasWaiting?: boolean;
|
|
11
14
|
isActive: boolean;
|
|
15
|
+
loading?: boolean;
|
|
12
16
|
newSessionTitle: string;
|
|
13
17
|
onCollapse: () => void;
|
|
14
18
|
onExpand: () => void;
|
|
@@ -18,6 +22,8 @@ export interface ProjectRowViewProps {
|
|
|
18
22
|
onOpenContextMenu: (event: React.MouseEvent) => void;
|
|
19
23
|
projectCwd: string;
|
|
20
24
|
projectType: ProjectTypeIconKey;
|
|
25
|
+
/** 远程(SSH)项目:折叠态用服务器图标替代项目类型图标。 */
|
|
26
|
+
remote?: boolean;
|
|
21
27
|
rowRef?: Ref<HTMLDivElement>;
|
|
22
28
|
}
|
|
23
29
|
|
|
@@ -26,7 +32,9 @@ export function ProjectRowView({
|
|
|
26
32
|
displayName,
|
|
27
33
|
expanded,
|
|
28
34
|
hasRunning,
|
|
35
|
+
hasWaiting = false,
|
|
29
36
|
isActive,
|
|
37
|
+
loading = false,
|
|
30
38
|
newSessionTitle,
|
|
31
39
|
onCollapse,
|
|
32
40
|
onExpand,
|
|
@@ -36,8 +44,11 @@ export function ProjectRowView({
|
|
|
36
44
|
onOpenContextMenu,
|
|
37
45
|
projectCwd,
|
|
38
46
|
projectType,
|
|
47
|
+
remote = false,
|
|
39
48
|
rowRef,
|
|
40
49
|
}: ProjectRowViewProps): JSX.Element {
|
|
50
|
+
const labelId = useId();
|
|
51
|
+
|
|
41
52
|
return (
|
|
42
53
|
<div
|
|
43
54
|
ref={rowRef}
|
|
@@ -50,26 +61,32 @@ export function ProjectRowView({
|
|
|
50
61
|
>
|
|
51
62
|
<button
|
|
52
63
|
type="button"
|
|
64
|
+
aria-labelledby={labelId}
|
|
65
|
+
aria-expanded={expanded}
|
|
66
|
+
aria-busy={expanded && loading}
|
|
53
67
|
onClick={() => {
|
|
54
68
|
onInteract?.();
|
|
55
|
-
if (expanded)
|
|
56
|
-
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
onExpand();
|
|
60
|
-
onNavigateProject();
|
|
69
|
+
if (expanded) onCollapse();
|
|
70
|
+
else onExpand();
|
|
61
71
|
}}
|
|
62
72
|
className="relative flex shrink-0 items-center justify-center"
|
|
63
73
|
>
|
|
64
74
|
<span
|
|
65
75
|
className={cn(
|
|
66
|
-
expanded
|
|
76
|
+
expanded && loading
|
|
77
|
+
? "icon-[mdi--loading] motion-safe:animate-spin"
|
|
78
|
+
: expanded
|
|
79
|
+
? "icon-[solar--alt-arrow-down-linear]"
|
|
80
|
+
: remote
|
|
81
|
+
? REMOTE_PROJECT_ICON
|
|
82
|
+
: PROJECT_TYPE_ICONS[projectType],
|
|
67
83
|
"h-4 w-4 text-foreground",
|
|
68
84
|
)}
|
|
69
85
|
/>
|
|
70
|
-
{hasRunning
|
|
86
|
+
{hasWaiting ? <WaitingPulseBadge /> : hasRunning ? <RunningPulseDot /> : null}
|
|
71
87
|
</button>
|
|
72
88
|
<button
|
|
89
|
+
id={labelId}
|
|
73
90
|
type="button"
|
|
74
91
|
onClick={() => {
|
|
75
92
|
onInteract?.();
|
|
@@ -103,7 +120,7 @@ export function ProjectRowView({
|
|
|
103
120
|
badge ? "hidden group-hover:flex" : "opacity-0 group-hover:opacity-100",
|
|
104
121
|
)}
|
|
105
122
|
>
|
|
106
|
-
<span className="icon-[solar--add-
|
|
123
|
+
<span className="icon-[solar--add-linear] h-3 w-3" />
|
|
107
124
|
</button>
|
|
108
125
|
</div>
|
|
109
126
|
</div>
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { useRef, type JSX, type ReactNode } from "react";
|
|
2
2
|
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso";
|
|
3
|
-
import { useDelayedUnmount } from "../shared/useDelayedUnmount";
|
|
4
3
|
import { ShowMoreSessionsButton } from "../sidebar/ShowMoreSessionsButton";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
VIRTUAL_SESSION_OVERSCAN,
|
|
8
|
-
VIRTUAL_SESSION_ROW_HEIGHT,
|
|
9
|
-
} from "./types";
|
|
4
|
+
import { VIRTUAL_SESSION_OVERSCAN, VIRTUAL_SESSION_ROW_HEIGHT } from "./types";
|
|
10
5
|
import { useActiveSessionAutoScroll } from "./useActiveSessionAutoScroll";
|
|
11
6
|
|
|
12
7
|
export interface ProjectSessionsViewItem {
|
|
@@ -47,50 +42,33 @@ export function ProjectSessionsView<T extends ProjectSessionsViewItem>({
|
|
|
47
42
|
}: ProjectSessionsViewProps<T>): JSX.Element {
|
|
48
43
|
const useVirtual = showAll && sessions.length > 0 && scrollParent != null;
|
|
49
44
|
const virtuosoRef = useRef<VirtuosoHandle>(null);
|
|
50
|
-
const
|
|
45
|
+
const showSessions = expanded && !loading;
|
|
46
|
+
const activeIndex = showSessions ? sessions.findIndex((session) => session.active) : -1;
|
|
51
47
|
const activeKey = activeIndex >= 0 ? sessions[activeIndex]?.key : undefined;
|
|
52
|
-
useActiveSessionAutoScroll({ activeIndex, activeKey, enabled:
|
|
53
|
-
// 纯 CSS grid-rows 过渡替代 motion 的 height:auto 动画:折叠动画播完(200ms)后才卸载
|
|
54
|
-
// 子树,动画期间没有任何逐帧 JS 测量/写高度。
|
|
55
|
-
const renderContent = useDelayedUnmount(expanded, 220);
|
|
48
|
+
useActiveSessionAutoScroll({ activeIndex, activeKey, enabled: showSessions, scrollParent, virtuosoRef });
|
|
56
49
|
|
|
50
|
+
// Commit space in the shared scroller immediately. Only the list surface animates.
|
|
57
51
|
return (
|
|
58
|
-
<div
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<div className="pb-px">{renderSession(session)}</div>
|
|
79
|
-
)}
|
|
80
|
-
/>
|
|
81
|
-
) : (
|
|
82
|
-
sessions.map((session) => renderSession(session))
|
|
83
|
-
)}
|
|
84
|
-
{hasMore && (
|
|
85
|
-
<ShowMoreSessionsButton
|
|
86
|
-
labels={labels}
|
|
87
|
-
onClick={onToggleShowAll}
|
|
88
|
-
showAll={showAll}
|
|
89
|
-
/>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
)}
|
|
93
|
-
</div>
|
|
52
|
+
<div className="overflow-clip" hidden={!showSessions}>
|
|
53
|
+
{showSessions && (
|
|
54
|
+
<div className="mt-px space-y-px animate-in fade-in slide-in-from-top-1 duration-150 ease-out motion-reduce:animate-none">
|
|
55
|
+
{sessions.length === 0 ? (
|
|
56
|
+
empty
|
|
57
|
+
) : useVirtual ? (
|
|
58
|
+
<Virtuoso
|
|
59
|
+
ref={virtuosoRef}
|
|
60
|
+
customScrollParent={scrollParent}
|
|
61
|
+
data={sessions as T[]}
|
|
62
|
+
defaultItemHeight={VIRTUAL_SESSION_ROW_HEIGHT}
|
|
63
|
+
overscan={VIRTUAL_SESSION_OVERSCAN}
|
|
64
|
+
itemContent={(_, session) => <div className="pb-px">{renderSession(session)}</div>}
|
|
65
|
+
/>
|
|
66
|
+
) : (
|
|
67
|
+
sessions.map((session) => renderSession(session))
|
|
68
|
+
)}
|
|
69
|
+
{hasMore && <ShowMoreSessionsButton labels={labels} onClick={onToggleShowAll} showAll={showAll} />}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
94
72
|
</div>
|
|
95
73
|
);
|
|
96
74
|
}
|
|
@@ -10,6 +10,11 @@ export interface SessionContextMenuViewLabels {
|
|
|
10
10
|
|
|
11
11
|
export interface SessionContextMenuViewProps {
|
|
12
12
|
canDelete: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* False when the session's project has no counterpart on this computer (a remote
|
|
15
|
+
* project): there is nothing for the system file manager to show. Defaults to true.
|
|
16
|
+
*/
|
|
17
|
+
canOpenInFolder?: boolean;
|
|
13
18
|
canRename: boolean;
|
|
14
19
|
labels: SessionContextMenuViewLabels;
|
|
15
20
|
/** 挂在「重命名」之后的附加节点,例如标签二级菜单。 */
|
|
@@ -25,6 +30,7 @@ export interface SessionContextMenuViewProps {
|
|
|
25
30
|
|
|
26
31
|
export function SessionContextMenuView({
|
|
27
32
|
canDelete,
|
|
33
|
+
canOpenInFolder = true,
|
|
28
34
|
canRename,
|
|
29
35
|
labels,
|
|
30
36
|
extraItems,
|
|
@@ -49,13 +55,15 @@ export function SessionContextMenuView({
|
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
if (extraItems && extraItems.length > 0) items.push(...extraItems);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
if (canOpenInFolder) {
|
|
59
|
+
items.push({
|
|
60
|
+
kind: "item",
|
|
61
|
+
id: "open-in-folder",
|
|
62
|
+
label: labels.openInFolder,
|
|
63
|
+
iconClassName: "icon-[solar--folder-open-linear]",
|
|
64
|
+
onSelect: onOpenInFolder,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
59
67
|
if (canDelete) {
|
|
60
68
|
items.push({
|
|
61
69
|
kind: "item",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
|
|
4
|
+
export interface SessionRowMoreButtonProps {
|
|
5
|
+
/** Tailwind radius class matching the row it overlays. */
|
|
6
|
+
className?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
onOpen: (event: React.MouseEvent) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 会话行右侧的「更多」入口,hover 时淡入,点开的菜单与右键完全一致。
|
|
13
|
+
*
|
|
14
|
+
* 之所以是行的兄弟节点而不是行内子节点:行本身就是 <button>,按钮不能嵌套按钮。
|
|
15
|
+
* 渐隐底色用 --accent 而非实色——mac 经典侧边栏是原生毛玻璃,任何不透明底色都会在
|
|
16
|
+
* 那里糊出一块死板的方块(见 styles.css 里侧边栏 --accent 的改写)。
|
|
17
|
+
*/
|
|
18
|
+
export function SessionRowMoreButton({
|
|
19
|
+
className,
|
|
20
|
+
label,
|
|
21
|
+
onOpen,
|
|
22
|
+
}: SessionRowMoreButtonProps): JSX.Element {
|
|
23
|
+
const open = (event: React.MouseEvent) => {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
onOpen(event);
|
|
27
|
+
};
|
|
28
|
+
return (
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
aria-label={label}
|
|
32
|
+
title={label}
|
|
33
|
+
data-session-more-trigger="true"
|
|
34
|
+
onClick={open}
|
|
35
|
+
onContextMenu={open}
|
|
36
|
+
className={cn(
|
|
37
|
+
"absolute inset-y-0 right-0 flex w-10 items-center justify-end pr-2",
|
|
38
|
+
"bg-gradient-to-l from-accent via-accent/80 to-transparent",
|
|
39
|
+
"opacity-0 transition-opacity group-hover/session-row:opacity-100 focus-visible:opacity-100",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
<span className="icon-[solar--menu-dots-bold] h-4 w-4 text-muted-foreground" />
|
|
44
|
+
</button>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** hover 时把行内容向右淡出,保证「更多」图标下面的文字不会和图标叠在一起。 */
|
|
49
|
+
export const SESSION_ROW_CONTENT_FADE_CLASS =
|
|
50
|
+
"group-hover/session-row:[mask-image:linear-gradient(to_left,transparent_10px,#000_42px)]";
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { cn } from "@vetta-org/ui";
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
2
|
import { memo, type JSX } from "react";
|
|
3
3
|
import { SessionStatusIcon } from "../sidebar/SessionStatusIcon";
|
|
4
4
|
import { AvatarStackView } from "../shared/AvatarStackView";
|
|
5
|
+
import { IMMEDIATE_SESSION_SELECTION_STYLE } from "./session-row-transition";
|
|
5
6
|
import { SessionRenameInputView } from "./SessionRenameInputView";
|
|
7
|
+
import {
|
|
8
|
+
SESSION_ROW_CONTENT_FADE_CLASS,
|
|
9
|
+
SessionRowMoreButton,
|
|
10
|
+
} from "./SessionRowMoreButton";
|
|
11
|
+
import { SessionTitleMarquee } from "./SessionTitleMarquee";
|
|
6
12
|
import { prepareSidebarSelection } from "./useActiveSessionAutoScroll";
|
|
7
13
|
|
|
8
14
|
export interface SessionRowViewProps {
|
|
@@ -18,6 +24,8 @@ export interface SessionRowViewProps {
|
|
|
18
24
|
titleExtra?: string;
|
|
19
25
|
/** Session was forked from another session. */
|
|
20
26
|
forked?: boolean;
|
|
27
|
+
/** Accessible name for the hover "more" trigger. */
|
|
28
|
+
moreLabel?: string;
|
|
21
29
|
onOpenContextMenu: (event: React.MouseEvent) => void;
|
|
22
30
|
onRename: (name: string) => void;
|
|
23
31
|
onRenameDone: () => void;
|
|
@@ -26,6 +34,13 @@ export interface SessionRowViewProps {
|
|
|
26
34
|
renaming: boolean;
|
|
27
35
|
running: boolean;
|
|
28
36
|
scheduled: boolean;
|
|
37
|
+
/** 会话正等着用户处理;优先于 running/scheduled,左侧换成停转的琥珀色问号。 */
|
|
38
|
+
waiting?: boolean;
|
|
39
|
+
/** 自动化会话组组头:本组运行次数。存在时整行点击即展开/收起,不提供更多菜单。 */
|
|
40
|
+
groupCount?: number;
|
|
41
|
+
groupExpanded?: boolean;
|
|
42
|
+
/** 会话组展开后的组员行,缩进一级。 */
|
|
43
|
+
nested?: boolean;
|
|
29
44
|
}
|
|
30
45
|
|
|
31
46
|
/**
|
|
@@ -40,6 +55,7 @@ export const SessionRowView = memo(function SessionRowView({
|
|
|
40
55
|
sessionPath,
|
|
41
56
|
titleExtra,
|
|
42
57
|
forked,
|
|
58
|
+
moreLabel,
|
|
43
59
|
onOpenContextMenu,
|
|
44
60
|
onRename,
|
|
45
61
|
onRenameDone,
|
|
@@ -48,72 +64,99 @@ export const SessionRowView = memo(function SessionRowView({
|
|
|
48
64
|
renaming,
|
|
49
65
|
running,
|
|
50
66
|
scheduled,
|
|
67
|
+
waiting = false,
|
|
68
|
+
groupCount,
|
|
69
|
+
groupExpanded,
|
|
70
|
+
nested = false,
|
|
51
71
|
}: SessionRowViewProps): JSX.Element {
|
|
52
72
|
const title = renaming ? undefined : titleExtra ? `${label}\n${titleExtra}` : label;
|
|
53
73
|
return (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
<div className="group/session-row relative">
|
|
75
|
+
<button
|
|
76
|
+
type="button"
|
|
77
|
+
data-session-active={active ? "true" : undefined}
|
|
78
|
+
aria-expanded={groupCount !== undefined ? groupExpanded === true : undefined}
|
|
79
|
+
data-session-path={sessionPath || undefined}
|
|
80
|
+
onClick={(event) => {
|
|
81
|
+
if (renaming) return;
|
|
82
|
+
prepareSidebarSelection(event.currentTarget);
|
|
83
|
+
onSelect();
|
|
84
|
+
}}
|
|
85
|
+
onContextMenu={groupCount !== undefined ? (event) => event.preventDefault() : onOpenContextMenu}
|
|
86
|
+
className={cn(
|
|
87
|
+
// 34px matches ProjectRowView's 10px padding, 16px icon and 8px gap.
|
|
88
|
+
"relative grid w-full grid-cols-[34px_minmax(0,1fr)] items-center rounded-lg py-[6px] pr-2.5 text-left",
|
|
89
|
+
nested && "pl-4",
|
|
90
|
+
active ? "bg-accent text-foreground" : "hover:bg-accent/50",
|
|
91
|
+
)}
|
|
92
|
+
style={IMMEDIATE_SESSION_SELECTION_STYLE}
|
|
93
|
+
>
|
|
94
|
+
{renaming ? (
|
|
95
|
+
<SessionRenameInputView
|
|
96
|
+
className="col-start-2 min-w-0 truncate rounded-[3px] border border-input bg-accent/50 text-[13px] text-foreground outline-none"
|
|
97
|
+
initialValue={label}
|
|
98
|
+
onCancel={onRenameDone}
|
|
99
|
+
onCommit={onRename}
|
|
100
|
+
/>
|
|
101
|
+
) : (
|
|
102
|
+
<>
|
|
103
|
+
<span aria-hidden="true" className="flex items-center justify-end gap-0.5 pr-1">
|
|
104
|
+
{pinned ? <span className="icon-[solar--pin-linear] h-3.5 w-3.5 shrink-0 text-primary/80" /> : null}
|
|
105
|
+
{waiting ? (
|
|
106
|
+
<SessionStatusIcon active={active} running={running} scheduled={scheduled} waiting />
|
|
107
|
+
) : forked && !running && !scheduled ? (
|
|
108
|
+
<span
|
|
109
|
+
data-session-leading-icon="true"
|
|
110
|
+
className={cn(
|
|
111
|
+
"icon-[mdi--source-fork] h-3.5 w-3.5 shrink-0",
|
|
112
|
+
active ? "text-primary/80" : "text-muted-foreground/60",
|
|
113
|
+
)}
|
|
114
|
+
/>
|
|
115
|
+
) : iconClassName && !running && !scheduled ? (
|
|
116
|
+
<span
|
|
117
|
+
data-session-leading-icon="true"
|
|
118
|
+
className={cn(
|
|
119
|
+
iconClassName,
|
|
120
|
+
"h-3.5 w-3.5 shrink-0",
|
|
121
|
+
active ? "text-foreground/70" : "text-muted-foreground/50",
|
|
122
|
+
)}
|
|
123
|
+
/>
|
|
124
|
+
) : running || scheduled ? (
|
|
125
|
+
<SessionStatusIcon active={active} running={running} scheduled={scheduled} />
|
|
126
|
+
) : null}
|
|
127
|
+
</span>
|
|
128
|
+
<div className={cn("flex min-w-0 items-center gap-2", SESSION_ROW_CONTENT_FADE_CLASS)}>
|
|
129
|
+
<SessionTitleMarquee
|
|
130
|
+
className={cn("text-[13px]", active ? "font-semibold text-foreground" : "text-foreground")}
|
|
131
|
+
label={label}
|
|
132
|
+
title={title}
|
|
133
|
+
/>
|
|
134
|
+
{trailingAvatarUrls && trailingAvatarUrls.length > 0 ? (
|
|
135
|
+
<AvatarStackView avatarUrls={trailingAvatarUrls} />
|
|
136
|
+
) : null}
|
|
137
|
+
{groupCount !== undefined ? (
|
|
138
|
+
<>
|
|
139
|
+
<span className="shrink-0 text-[11px] tabular-nums text-muted-foreground/60">{groupCount}</span>
|
|
140
|
+
<span
|
|
141
|
+
aria-hidden="true"
|
|
142
|
+
className={cn(
|
|
143
|
+
"icon-[mdi--chevron-right] h-3.5 w-3.5 shrink-0 text-muted-foreground/60 transition-transform",
|
|
144
|
+
groupExpanded && "rotate-90",
|
|
145
|
+
)}
|
|
146
|
+
/>
|
|
147
|
+
</>
|
|
148
|
+
) : null}
|
|
149
|
+
</div>
|
|
150
|
+
</>
|
|
151
|
+
)}
|
|
152
|
+
</button>
|
|
153
|
+
{renaming || groupCount !== undefined ? null : (
|
|
154
|
+
<SessionRowMoreButton
|
|
155
|
+
className="rounded-r-lg"
|
|
156
|
+
label={moreLabel}
|
|
157
|
+
onOpen={onOpenContextMenu}
|
|
76
158
|
/>
|
|
77
|
-
) : (
|
|
78
|
-
<>
|
|
79
|
-
{pinned ? (
|
|
80
|
-
<span className="icon-[solar--pin-linear] h-3.5 w-3.5 shrink-0 text-primary/80" />
|
|
81
|
-
) : null}
|
|
82
|
-
{forked && !running && !scheduled ? (
|
|
83
|
-
<span
|
|
84
|
-
data-session-leading-icon="true"
|
|
85
|
-
className={cn(
|
|
86
|
-
"icon-[mdi--source-fork] h-3.5 w-3.5 shrink-0",
|
|
87
|
-
active ? "text-primary/80" : "text-muted-foreground/60",
|
|
88
|
-
)}
|
|
89
|
-
/>
|
|
90
|
-
) : iconClassName && !running && !scheduled ? (
|
|
91
|
-
<span
|
|
92
|
-
data-session-leading-icon="true"
|
|
93
|
-
aria-hidden="true"
|
|
94
|
-
className={cn(
|
|
95
|
-
iconClassName,
|
|
96
|
-
"h-3.5 w-3.5 shrink-0",
|
|
97
|
-
active ? "text-foreground/70" : "text-muted-foreground/50",
|
|
98
|
-
)}
|
|
99
|
-
/>
|
|
100
|
-
) : (
|
|
101
|
-
<SessionStatusIcon active={active} running={running} scheduled={scheduled} />
|
|
102
|
-
)}
|
|
103
|
-
<span
|
|
104
|
-
className={cn(
|
|
105
|
-
"min-w-0 flex-1 truncate text-[13px]",
|
|
106
|
-
running && "pl-1",
|
|
107
|
-
active ? "font-semibold text-foreground" : "text-foreground",
|
|
108
|
-
)}
|
|
109
|
-
>
|
|
110
|
-
{label}
|
|
111
|
-
</span>
|
|
112
|
-
{trailingAvatarUrls && trailingAvatarUrls.length > 0 ? (
|
|
113
|
-
<AvatarStackView avatarUrls={trailingAvatarUrls} />
|
|
114
|
-
) : null}
|
|
115
|
-
</>
|
|
116
159
|
)}
|
|
117
|
-
</
|
|
160
|
+
</div>
|
|
118
161
|
);
|
|
119
162
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import { type CSSProperties, type JSX, useRef, useState } from "react";
|
|
3
|
+
|
|
4
|
+
interface SessionTitleMarqueeProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type MarqueeStyle = CSSProperties & {
|
|
11
|
+
"--session-title-marquee-distance": string;
|
|
12
|
+
"--session-title-marquee-duration": string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Keeps the compact sidebar label truncated until the user points at an overflowing title. */
|
|
16
|
+
export function SessionTitleMarquee({
|
|
17
|
+
className,
|
|
18
|
+
label,
|
|
19
|
+
title = label,
|
|
20
|
+
}: SessionTitleMarqueeProps): JSX.Element {
|
|
21
|
+
const labelRef = useRef<HTMLSpanElement>(null);
|
|
22
|
+
const [marqueeStyle, setMarqueeStyle] = useState<MarqueeStyle | undefined>();
|
|
23
|
+
|
|
24
|
+
const startMarquee = (): void => {
|
|
25
|
+
const labelElement = labelRef.current;
|
|
26
|
+
if (!labelElement) return;
|
|
27
|
+
const overflowDistance = Math.ceil(labelElement.scrollWidth - labelElement.clientWidth);
|
|
28
|
+
if (overflowDistance <= 1) return;
|
|
29
|
+
|
|
30
|
+
setMarqueeStyle({
|
|
31
|
+
"--session-title-marquee-distance": `-${overflowDistance}px`,
|
|
32
|
+
"--session-title-marquee-duration": `${Math.max(2.5, overflowDistance / 72 + 1.2)}s`,
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<span
|
|
38
|
+
className={cn("min-w-0 flex-1 overflow-hidden", className)}
|
|
39
|
+
data-session-title="true"
|
|
40
|
+
data-session-title-scrolling={marqueeStyle ? "true" : undefined}
|
|
41
|
+
onMouseEnter={startMarquee}
|
|
42
|
+
onMouseLeave={() => setMarqueeStyle(undefined)}
|
|
43
|
+
title={title}
|
|
44
|
+
>
|
|
45
|
+
<span
|
|
46
|
+
ref={labelRef}
|
|
47
|
+
className={cn("block whitespace-nowrap", marqueeStyle ? "session-title-marquee-track w-max" : "truncate")}
|
|
48
|
+
style={marqueeStyle}
|
|
49
|
+
>
|
|
50
|
+
{label}
|
|
51
|
+
</span>
|
|
52
|
+
</span>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import type { JSX, ReactNode } from "react";
|
|
3
|
+
import { SIDEBAR_SECTION_TRIGGER_CLASS, SidebarSectionTriggerLabel } from "../sidebar/SidebarSectionTriggerLabel";
|
|
4
|
+
|
|
5
|
+
interface SidebarProjectDisclosureTriggerProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
contentId: string;
|
|
8
|
+
label: string;
|
|
9
|
+
open: boolean;
|
|
10
|
+
onOpenChange: (open: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function SidebarProjectDisclosureTrigger({
|
|
14
|
+
className,
|
|
15
|
+
contentId,
|
|
16
|
+
label,
|
|
17
|
+
open,
|
|
18
|
+
onOpenChange,
|
|
19
|
+
}: SidebarProjectDisclosureTriggerProps): JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
aria-expanded={open}
|
|
24
|
+
aria-controls={contentId}
|
|
25
|
+
className={cn(SIDEBAR_SECTION_TRIGGER_CLASS, className)}
|
|
26
|
+
onClick={(event) => {
|
|
27
|
+
event.currentTarget.focus();
|
|
28
|
+
onOpenChange(!open);
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<SidebarSectionTriggerLabel label={label} open={open} />
|
|
32
|
+
</button>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function SidebarProjectDisclosureContent({
|
|
37
|
+
children,
|
|
38
|
+
id,
|
|
39
|
+
open,
|
|
40
|
+
}: {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
id: string;
|
|
43
|
+
open: boolean;
|
|
44
|
+
}): JSX.Element {
|
|
45
|
+
return (
|
|
46
|
+
// Commit the scroll layout once and keep the column within the sidebar width.
|
|
47
|
+
<div className={cn("grid grid-cols-1", open ? "grid-rows-[1fr]" : "grid-rows-[0fr]")}>
|
|
48
|
+
<div id={id} inert={!open} aria-hidden={!open} className="min-h-0 overflow-clip">
|
|
49
|
+
<div
|
|
50
|
+
className={cn(
|
|
51
|
+
"transition-[translate,opacity] duration-150 ease-out motion-reduce:transition-none",
|
|
52
|
+
open ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0",
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn } from "@vetta-org/ui";
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
2
|
import type { JSX, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
export interface SidebarProjectsSectionViewProps {
|
|
@@ -10,6 +10,8 @@ export interface SidebarProjectsSectionViewProps {
|
|
|
10
10
|
filterSelect: ReactNode;
|
|
11
11
|
addProjectMenu: ReactNode;
|
|
12
12
|
panel: ReactNode;
|
|
13
|
+
/** 没有任何项目时隐藏筛选抬头和新建入口。 */
|
|
14
|
+
showToolbar?: boolean;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export function SidebarProjectsSectionView({
|
|
@@ -18,10 +20,12 @@ export function SidebarProjectsSectionView({
|
|
|
18
20
|
filterSelect,
|
|
19
21
|
addProjectMenu,
|
|
20
22
|
panel,
|
|
23
|
+
showToolbar = true,
|
|
21
24
|
}: SidebarProjectsSectionViewProps): JSX.Element {
|
|
22
25
|
return (
|
|
23
26
|
<div className={cn("flex min-h-0 flex-1 flex-col", className)}>
|
|
24
27
|
{/* Inline z-index keeps the dropdown above the project list below. */}
|
|
28
|
+
{showToolbar && (
|
|
25
29
|
<div
|
|
26
30
|
className={cn("group flex items-center justify-between pb-1 pl-2 pr-3 pt-1", classNames?.toolbar)}
|
|
27
31
|
style={{ position: "relative", zIndex: 20 }}
|
|
@@ -29,6 +33,7 @@ export function SidebarProjectsSectionView({
|
|
|
29
33
|
{filterSelect}
|
|
30
34
|
{addProjectMenu}
|
|
31
35
|
</div>
|
|
36
|
+
)}
|
|
32
37
|
{panel}
|
|
33
38
|
</div>
|
|
34
39
|
);
|