@vetta-org/theme-ui 0.1.0 → 0.1.2
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 +735 -7
- 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/DebugTabPanelView.tsx +1 -1
- package/src/activity/MarkdownPreviewView.tsx +56 -59
- 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/ExecutionModeSelectorView.tsx +20 -5
- package/src/chat/HeaderActionBarView.tsx +731 -0
- package/src/chat/HeaderActionOverflowMenu.tsx +137 -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 +28 -3
- package/src/chat/MessageFeedView.test.tsx +81 -0
- package/src/chat/MessageFeedView.tsx +72 -152
- package/src/chat/MessageInputView.tsx +1 -1
- 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 +32 -27
- package/src/chat/markdown-link.ts +7 -279
- 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/TextFileEditorView.tsx +2 -1
- 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/InlineTokenChip.tsx +68 -0
- package/src/markdown/MarkdownContent.tsx +411 -0
- package/src/markdown/MarkdownImage.tsx +51 -0
- package/src/markdown/MathFormula.tsx +46 -0
- package/src/markdown/MermaidBlock.tsx +43 -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/index.ts +11 -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.ts +43 -0
- package/src/markdown/rich-labels.ts +49 -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 +38 -9
- package/src/overlays/CommandMenuView.tsx +77 -117
- package/src/overlays/ConfirmDialogView.tsx +25 -20
- package/src/overlays/ReleaseNoteMarkdown.tsx +29 -0
- package/src/overlays/SplashOptionRow.tsx +46 -0
- package/src/overlays/SplashPanel.tsx +85 -0
- package/src/overlays/SplashParts.tsx +213 -0
- package/src/overlays/UpdateCheckerView.tsx +34 -18
- package/src/overlays/UpdateRestartDialogView.tsx +139 -54
- package/src/overlays/command-menu-types.ts +2 -0
- package/src/overlays/command-menu.css +1 -20
- package/src/overlays/index.ts +14 -1
- package/src/plugin-ui/index.ts +8 -0
- package/src/project/ConversationTagDotsView.tsx +1 -1
- package/src/project/ConversationTagEditorDialogView.tsx +4 -1
- package/src/project/DefaultConversationSectionView.tsx +4 -4
- package/src/project/DefaultSessionListView.tsx +5 -31
- package/src/project/DefaultSessionRowView.tsx +106 -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/AchievementSettingsView.tsx +0 -1
- package/src/settings/AppshotSettingsView.tsx +0 -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 +17 -20
- 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/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/PresetProviderModelsListView.tsx +141 -24
- package/src/settings/PresetProviderRowView.tsx +205 -182
- package/src/settings/ProxySettingsSectionView.tsx +182 -0
- package/src/settings/QrBindDialogView.tsx +1 -1
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -2
- 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 -1
- package/src/settings/SpaceEditorDialogView.tsx +120 -0
- package/src/settings/SpacesSettingsView.tsx +105 -0
- package/src/settings/WebhookEndpointListView.tsx +4 -5
- package/src/settings/index.ts +41 -29
- 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/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.outline.test.tsx +59 -0
- package/src/shared/TabBar.tsx +22 -17
- package/src/shared/VettaKbd.test.tsx +52 -0
- package/src/shared/VettaKbd.tsx +81 -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 +6 -0
- package/src/shared/kbd-keys.test.ts +61 -0
- package/src/shared/kbd-keys.ts +253 -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 +25 -15
- 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 +28 -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/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 +24 -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/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/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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Button } from "@vetta-org/ui/button";
|
|
2
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@vetta-org/ui/popover";
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@vetta-org/ui/select";
|
|
4
|
+
import { Switch } from "@vetta-org/ui/switch";
|
|
5
|
+
import { useId, type JSX } from "react";
|
|
6
|
+
|
|
7
|
+
export interface FileExplorerSettingsViewProps {
|
|
8
|
+
showHidden: boolean;
|
|
9
|
+
exclude: string;
|
|
10
|
+
iconTheme: string;
|
|
11
|
+
themes: readonly { id: string; label: string }[];
|
|
12
|
+
error: string | null;
|
|
13
|
+
labels: {
|
|
14
|
+
title: string;
|
|
15
|
+
showHidden: string;
|
|
16
|
+
exclude: string;
|
|
17
|
+
excludeHint: string;
|
|
18
|
+
iconTheme: string;
|
|
19
|
+
save: string;
|
|
20
|
+
reset: string;
|
|
21
|
+
};
|
|
22
|
+
onShowHiddenChange(value: boolean): void;
|
|
23
|
+
onExcludeChange(value: string): void;
|
|
24
|
+
onSaveExclude(): void;
|
|
25
|
+
onIconThemeChange(value: string): void;
|
|
26
|
+
onReset(): void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function FileExplorerSettingsView(props: FileExplorerSettingsViewProps): JSX.Element {
|
|
30
|
+
const id = useId();
|
|
31
|
+
return (
|
|
32
|
+
<Popover>
|
|
33
|
+
<PopoverTrigger asChild>
|
|
34
|
+
<Button variant="ghost" size="icon-xs" title={props.labels.title} aria-label={props.labels.title}>
|
|
35
|
+
<span className="icon-[solar--settings-linear] h-3.5 w-3.5" aria-hidden />
|
|
36
|
+
</Button>
|
|
37
|
+
</PopoverTrigger>
|
|
38
|
+
<PopoverContent
|
|
39
|
+
align="end"
|
|
40
|
+
aria-label={props.labels.title}
|
|
41
|
+
className="w-72 max-w-[calc(100vw-2rem)] space-y-3 p-3"
|
|
42
|
+
>
|
|
43
|
+
<p className="text-[13px] font-medium">{props.labels.title}</p>
|
|
44
|
+
<div className="flex items-center justify-between gap-3">
|
|
45
|
+
<label htmlFor={`${id}-hidden`} className="text-[12px]">
|
|
46
|
+
{props.labels.showHidden}
|
|
47
|
+
</label>
|
|
48
|
+
<Switch id={`${id}-hidden`} checked={props.showHidden} onCheckedChange={props.onShowHiddenChange} />
|
|
49
|
+
</div>
|
|
50
|
+
<div className="space-y-1.5">
|
|
51
|
+
<label htmlFor={`${id}-theme`} className="text-[12px]">
|
|
52
|
+
{props.labels.iconTheme}
|
|
53
|
+
</label>
|
|
54
|
+
<Select value={props.iconTheme} onValueChange={props.onIconThemeChange}>
|
|
55
|
+
<SelectTrigger id={`${id}-theme`}>
|
|
56
|
+
<SelectValue />
|
|
57
|
+
</SelectTrigger>
|
|
58
|
+
<SelectContent>
|
|
59
|
+
{props.themes.map((theme) => (
|
|
60
|
+
<SelectItem key={theme.id} value={theme.id}>
|
|
61
|
+
{theme.label}
|
|
62
|
+
</SelectItem>
|
|
63
|
+
))}
|
|
64
|
+
</SelectContent>
|
|
65
|
+
</Select>
|
|
66
|
+
</div>
|
|
67
|
+
<div className="space-y-1.5">
|
|
68
|
+
<label htmlFor={`${id}-exclude`} className="text-[12px]">
|
|
69
|
+
{props.labels.exclude}
|
|
70
|
+
</label>
|
|
71
|
+
<textarea
|
|
72
|
+
id={`${id}-exclude`}
|
|
73
|
+
rows={4}
|
|
74
|
+
value={props.exclude}
|
|
75
|
+
onChange={(event) => props.onExcludeChange(event.target.value)}
|
|
76
|
+
aria-describedby={`${id}-hint`}
|
|
77
|
+
className="w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 text-[12px] outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
78
|
+
/>
|
|
79
|
+
<p id={`${id}-hint`} className="text-[11px] text-muted-foreground">
|
|
80
|
+
{props.labels.excludeHint}
|
|
81
|
+
</p>
|
|
82
|
+
<Button variant="outline" size="sm" onClick={props.onSaveExclude}>
|
|
83
|
+
{props.labels.save}
|
|
84
|
+
</Button>
|
|
85
|
+
</div>
|
|
86
|
+
{props.error ? (
|
|
87
|
+
<p role="alert" className="text-[12px] text-destructive">
|
|
88
|
+
{props.error}
|
|
89
|
+
</p>
|
|
90
|
+
) : null}
|
|
91
|
+
<Button variant="ghost" size="sm" onClick={props.onReset}>
|
|
92
|
+
{props.labels.reset}
|
|
93
|
+
</Button>
|
|
94
|
+
</PopoverContent>
|
|
95
|
+
</Popover>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn } from "@vetta-org/ui";
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
2
|
import { useEffect, useRef, useState, type JSX } from "react";
|
|
3
3
|
import { FILE_TREE_NODE_DROP_CLASS, isDragLeavingElement } from "./drag-target";
|
|
4
4
|
import { getFileIcon } from "./fileIcons";
|
|
@@ -11,8 +11,18 @@ import type {
|
|
|
11
11
|
} from "./types";
|
|
12
12
|
|
|
13
13
|
const DRAG_MIME = "application/vetta-path";
|
|
14
|
+
const DECORATION_COLORS = {
|
|
15
|
+
foreground: "text-foreground",
|
|
16
|
+
muted: "text-muted-foreground",
|
|
17
|
+
accent: "text-primary",
|
|
18
|
+
success: "text-emerald-400",
|
|
19
|
+
warning: "text-amber-400",
|
|
20
|
+
error: "text-destructive",
|
|
21
|
+
} as const;
|
|
14
22
|
|
|
15
23
|
export interface FileTreeNodeViewProps {
|
|
24
|
+
/** DOM id referenced by the tree's `aria-activedescendant`; rows themselves are not focusable. */
|
|
25
|
+
rowId?: string;
|
|
16
26
|
entry: FileExplorerEntry;
|
|
17
27
|
depth: number;
|
|
18
28
|
isExpanded: boolean;
|
|
@@ -20,6 +30,12 @@ export interface FileTreeNodeViewProps {
|
|
|
20
30
|
isSelected: boolean;
|
|
21
31
|
isFocused?: boolean;
|
|
22
32
|
isRenaming: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Tree-owned rename draft. When set, the input is controlled and a remount
|
|
35
|
+
* (virtual list recycling) restores the draft instead of resetting to `entry.name`.
|
|
36
|
+
*/
|
|
37
|
+
renameValue?: string;
|
|
38
|
+
onRenameValueChange?: (value: string) => void;
|
|
23
39
|
decoration?: FileExplorerNodeDecoration | null;
|
|
24
40
|
/** Entries included in the active multi-select when dragging this row. */
|
|
25
41
|
dragEntries?: readonly FileExplorerDragEntry[];
|
|
@@ -54,6 +70,19 @@ function isSubPath(path: string, parent: string): boolean {
|
|
|
54
70
|
return p === base || p.startsWith(`${base}/`);
|
|
55
71
|
}
|
|
56
72
|
|
|
73
|
+
/**
|
|
74
|
+
* After a recycled rename row remounts, focus is idle if it fell back to the body or
|
|
75
|
+
* sits on the tree chrome; a focus the user moved elsewhere (editor, dialog) is left alone.
|
|
76
|
+
*/
|
|
77
|
+
function shouldReclaimRenameFocus(input: HTMLInputElement): boolean {
|
|
78
|
+
const doc = input.ownerDocument;
|
|
79
|
+
const active = doc.activeElement;
|
|
80
|
+
if (!active || active === doc.body) return true;
|
|
81
|
+
if (active === input) return false;
|
|
82
|
+
const tree = input.closest('[role="tree"]');
|
|
83
|
+
return tree !== null && tree.contains(active);
|
|
84
|
+
}
|
|
85
|
+
|
|
57
86
|
function parseInternalDragPaths(raw: string): string[] {
|
|
58
87
|
if (!raw) return [];
|
|
59
88
|
try {
|
|
@@ -71,6 +100,7 @@ function parseInternalDragPaths(raw: string): string[] {
|
|
|
71
100
|
* Single file-tree row: chevron, icon, name / rename input, drag-drop.
|
|
72
101
|
*/
|
|
73
102
|
export function FileTreeNodeView({
|
|
103
|
+
rowId,
|
|
74
104
|
entry,
|
|
75
105
|
depth,
|
|
76
106
|
isExpanded,
|
|
@@ -78,6 +108,8 @@ export function FileTreeNodeView({
|
|
|
78
108
|
isSelected,
|
|
79
109
|
isFocused = false,
|
|
80
110
|
isRenaming,
|
|
111
|
+
renameValue: draftValue,
|
|
112
|
+
onRenameValueChange,
|
|
81
113
|
decoration,
|
|
82
114
|
dragEntries,
|
|
83
115
|
onToggleDir,
|
|
@@ -91,20 +123,35 @@ export function FileTreeNodeView({
|
|
|
91
123
|
onPrefetchNativeDragIcons,
|
|
92
124
|
}: FileTreeNodeViewProps): JSX.Element {
|
|
93
125
|
const [dragOver, setDragOver] = useState(false);
|
|
94
|
-
const [
|
|
126
|
+
const [localRenameValue, setLocalRenameValue] = useState(entry.name);
|
|
127
|
+
const renameValue = draftValue ?? localRenameValue;
|
|
95
128
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
96
129
|
const icon = getFileIcon(entry.name, entry.isDirectory, isExpanded);
|
|
97
130
|
|
|
131
|
+
const hasDraftRef = useRef(draftValue !== undefined);
|
|
132
|
+
hasDraftRef.current = draftValue !== undefined;
|
|
133
|
+
|
|
98
134
|
useEffect(() => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
135
|
+
const input = inputRef.current;
|
|
136
|
+
if (!isRenaming || !input) return;
|
|
137
|
+
if (hasDraftRef.current) {
|
|
138
|
+
// Remounted mid-rename (row scrolled back into the virtual window): keep the draft and
|
|
139
|
+
// only take focus back if nothing else claimed it while the row was unmounted.
|
|
140
|
+
if (shouldReclaimRenameFocus(input)) input.focus({ preventScroll: true });
|
|
141
|
+
return;
|
|
105
142
|
}
|
|
143
|
+
input.focus();
|
|
144
|
+
const dotIdx = entry.name.lastIndexOf(".");
|
|
145
|
+
const end = entry.isDirectory || dotIdx <= 0 ? entry.name.length : dotIdx;
|
|
146
|
+
input.setSelectionRange(0, end);
|
|
147
|
+
setLocalRenameValue(entry.name);
|
|
106
148
|
}, [isRenaming, entry.name, entry.isDirectory]);
|
|
107
149
|
|
|
150
|
+
function setRenameValue(value: string): void {
|
|
151
|
+
setLocalRenameValue(value);
|
|
152
|
+
onRenameValueChange?.(value);
|
|
153
|
+
}
|
|
154
|
+
|
|
108
155
|
function handleClick(e: React.MouseEvent) {
|
|
109
156
|
const toggle = e.ctrlKey || e.metaKey;
|
|
110
157
|
const range = e.shiftKey && !toggle;
|
|
@@ -193,10 +240,10 @@ export function FileTreeNodeView({
|
|
|
193
240
|
|
|
194
241
|
return (
|
|
195
242
|
<div
|
|
243
|
+
id={rowId}
|
|
196
244
|
role="treeitem"
|
|
197
245
|
aria-selected={isSelected}
|
|
198
246
|
data-file-path={entry.path}
|
|
199
|
-
tabIndex={isFocused || isSelected ? 0 : -1}
|
|
200
247
|
draggable={!isRenaming}
|
|
201
248
|
onClick={handleClick}
|
|
202
249
|
onContextMenu={handleContextMenu}
|
|
@@ -205,13 +252,6 @@ export function FileTreeNodeView({
|
|
|
205
252
|
onDragOver={handleDragOver}
|
|
206
253
|
onDragLeave={handleDragLeave}
|
|
207
254
|
onDrop={handleDrop}
|
|
208
|
-
onKeyDown={(e) => {
|
|
209
|
-
if (e.key === "Enter") {
|
|
210
|
-
e.preventDefault();
|
|
211
|
-
onSelectEntry(entry, { toggle: false, range: false, activate: true });
|
|
212
|
-
if (entry.isDirectory) onToggleDir(entry.path);
|
|
213
|
-
}
|
|
214
|
-
}}
|
|
215
255
|
className={cn(
|
|
216
256
|
"flex items-center gap-1.5 rounded-md px-1.5 py-[3px] text-[12px] cursor-default select-none transition-colors",
|
|
217
257
|
isSelected && !isRenaming ? "bg-accent text-foreground" : "text-foreground hover:bg-accent/50",
|
|
@@ -220,6 +260,7 @@ export function FileTreeNodeView({
|
|
|
220
260
|
)}
|
|
221
261
|
style={{ paddingLeft: `${depth * 16 + 6}px` }}
|
|
222
262
|
title={decoration?.tooltip}
|
|
263
|
+
aria-description={decoration?.tooltip}
|
|
223
264
|
>
|
|
224
265
|
{entry.isDirectory ? (
|
|
225
266
|
<span
|
|
@@ -261,9 +302,9 @@ export function FileTreeNodeView({
|
|
|
261
302
|
/>
|
|
262
303
|
) : (
|
|
263
304
|
<>
|
|
264
|
-
<span className="min-w-0 flex-1 truncate">{entry.name}</span>
|
|
305
|
+
<span className={cn("min-w-0 flex-1 truncate", decoration?.color && DECORATION_COLORS[decoration.color], decoration?.faded && "opacity-60", decoration?.strikethrough && "line-through")}>{entry.name}</span>
|
|
265
306
|
{decoration?.badge ? (
|
|
266
|
-
<span className="max-w-8 shrink-0 truncate rounded-full bg-accent px-1.5 text-[10px] text-muted-foreground">
|
|
307
|
+
<span className={cn("max-w-8 shrink-0 truncate rounded-full bg-accent px-1.5 text-[10px]", decoration?.color ? DECORATION_COLORS[decoration.color] : "text-muted-foreground")}>
|
|
267
308
|
{decoration.badge}
|
|
268
309
|
</span>
|
|
269
310
|
) : null}
|