@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,105 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import { Button } from "@vetta-org/ui";
|
|
3
|
+
import { SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
4
|
+
|
|
5
|
+
export interface SpacesSettingsViewItem {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly icon: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SpacesSettingsViewLabels {
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly newSpace: string;
|
|
14
|
+
readonly edit: (name: string) => string;
|
|
15
|
+
readonly remove: (name: string) => string;
|
|
16
|
+
/** 主工作空间固定存在,只有名称与图标,没有移动、编辑和移除动作。 */
|
|
17
|
+
readonly main: SpacesSettingsViewItem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface SpacesSettingsViewProps {
|
|
21
|
+
readonly labels: SpacesSettingsViewLabels;
|
|
22
|
+
readonly section: SettingSectionMeta;
|
|
23
|
+
readonly spaces: readonly SpacesSettingsViewItem[];
|
|
24
|
+
readonly onCreate: () => void;
|
|
25
|
+
readonly onEdit: (id: string) => void;
|
|
26
|
+
readonly onRemove: (id: string) => void;
|
|
27
|
+
readonly onReorder: (sourceId: string, targetId: string) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function SpaceIconBadge({ children }: { children: ReactNode }): JSX.Element {
|
|
31
|
+
return (
|
|
32
|
+
<span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground">
|
|
33
|
+
{children}
|
|
34
|
+
</span>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function SpacesSettingsView({
|
|
39
|
+
labels,
|
|
40
|
+
section,
|
|
41
|
+
spaces,
|
|
42
|
+
onCreate,
|
|
43
|
+
onEdit,
|
|
44
|
+
onRemove,
|
|
45
|
+
onReorder,
|
|
46
|
+
}: SpacesSettingsViewProps): JSX.Element {
|
|
47
|
+
return (
|
|
48
|
+
<div className="mx-auto w-full max-w-[680px] px-8 pt-2 pb-4">
|
|
49
|
+
<div className="mb-6 flex items-center justify-between gap-3">
|
|
50
|
+
<h1 className="text-[20px] font-bold text-foreground">{labels.title}</h1>
|
|
51
|
+
<Button size="sm" onClick={onCreate}>
|
|
52
|
+
<span className="icon-[solar--add-circle-linear] size-4" aria-hidden="true" />
|
|
53
|
+
{labels.newSpace}
|
|
54
|
+
</Button>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<SettingSection section={section} title={null}>
|
|
58
|
+
<div className="flex items-center gap-3 border-b border-border px-5 py-3.5">
|
|
59
|
+
<SpaceIconBadge>{labels.main.icon}</SpaceIconBadge>
|
|
60
|
+
<div className="min-w-0 flex-1 text-[13px] font-medium text-foreground">{labels.main.name}</div>
|
|
61
|
+
</div>
|
|
62
|
+
{spaces.map((space) => (
|
|
63
|
+
<div
|
|
64
|
+
key={space.id}
|
|
65
|
+
className="flex items-center gap-2 border-b border-border px-5 py-3 last:border-b-0"
|
|
66
|
+
draggable
|
|
67
|
+
onDragStart={(event) => event.dataTransfer.setData("application/x-vetta-space", space.id)}
|
|
68
|
+
onDragOver={(event) => event.preventDefault()}
|
|
69
|
+
onDrop={(event) => {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
onReorder(event.dataTransfer.getData("application/x-vetta-space"), space.id);
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<span
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
className="icon-[tabler--grip-vertical] size-4 shrink-0 cursor-grab text-muted-foreground/60"
|
|
77
|
+
/>
|
|
78
|
+
<SpaceIconBadge>{space.icon}</SpaceIconBadge>
|
|
79
|
+
<div className="min-w-0 flex-1 truncate text-[13px] font-medium text-foreground">{space.name}</div>
|
|
80
|
+
<div className="flex shrink-0 items-center gap-0.5">
|
|
81
|
+
<Button
|
|
82
|
+
variant="ghost"
|
|
83
|
+
size="icon-xs"
|
|
84
|
+
aria-label={labels.edit(space.name)}
|
|
85
|
+
title={labels.edit(space.name)}
|
|
86
|
+
onClick={() => onEdit(space.id)}
|
|
87
|
+
>
|
|
88
|
+
<span className="icon-[solar--pen-2-linear] size-3.5" aria-hidden="true" />
|
|
89
|
+
</Button>
|
|
90
|
+
<Button
|
|
91
|
+
variant="ghost"
|
|
92
|
+
size="icon-xs"
|
|
93
|
+
aria-label={labels.remove(space.name)}
|
|
94
|
+
title={labels.remove(space.name)}
|
|
95
|
+
onClick={() => onRemove(space.id)}
|
|
96
|
+
>
|
|
97
|
+
<span className="icon-[solar--trash-bin-minimalistic-linear] size-3.5" aria-hidden="true" />
|
|
98
|
+
</Button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
))}
|
|
102
|
+
</SettingSection>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
|
-
import { Switch } from "@vetta-org/ui";
|
|
2
|
+
import { Button, Switch } from "@vetta-org/ui";
|
|
3
3
|
import { cn } from "@vetta-org/ui";
|
|
4
4
|
|
|
5
5
|
export interface WebhookEndpointRowView {
|
|
@@ -59,15 +59,14 @@ export function WebhookEndpointListView({
|
|
|
59
59
|
checked={endpoint.enabled}
|
|
60
60
|
onCheckedChange={(value) => onToggle(endpoint.id, value)}
|
|
61
61
|
/>
|
|
62
|
-
<
|
|
63
|
-
|
|
62
|
+
<Button
|
|
63
|
+
variant="field"
|
|
64
64
|
onClick={() => onTest(endpoint.id)}
|
|
65
65
|
disabled={testingId === endpoint.id}
|
|
66
|
-
className="whitespace-nowrap rounded-md border border-input bg-secondary px-2.5 py-1 text-[11px] text-foreground transition-colors hover:bg-accent disabled:opacity-50"
|
|
67
66
|
title={labels.test}
|
|
68
67
|
>
|
|
69
68
|
{testingId === endpoint.id ? labels.testing : labels.test}
|
|
70
|
-
</
|
|
69
|
+
</Button>
|
|
71
70
|
<button
|
|
72
71
|
type="button"
|
|
73
72
|
onClick={() => onEdit(endpoint.id)}
|
package/src/settings/index.ts
CHANGED
|
@@ -53,6 +53,13 @@ export type {
|
|
|
53
53
|
BuiltinMcpSectionViewProps,
|
|
54
54
|
} from "./BuiltinMcpSectionView";
|
|
55
55
|
export { BuiltinMcpSectionView } from "./BuiltinMcpSectionView";
|
|
56
|
+
export type {
|
|
57
|
+
EnvironmentGitInstallGuideView,
|
|
58
|
+
EnvironmentGitRowViewProps,
|
|
59
|
+
EnvironmentGitStatusView,
|
|
60
|
+
EnvironmentGitViewLabels,
|
|
61
|
+
} from "./EnvironmentGitRowView";
|
|
62
|
+
export { EnvironmentGitRowView } from "./EnvironmentGitRowView";
|
|
56
63
|
export type {
|
|
57
64
|
EnvironmentRuntimeKindView,
|
|
58
65
|
EnvironmentRuntimeStatusView,
|
|
@@ -90,9 +97,18 @@ export type {
|
|
|
90
97
|
export { ImLogDrawerView } from "./ImLogDrawerView";
|
|
91
98
|
export type { ImStatusBadgeStatus, ImStatusBadgeViewProps } from "./ImStatusBadgeView";
|
|
92
99
|
export { ImStatusBadgeView } from "./ImStatusBadgeView";
|
|
100
|
+
export type { JsonConfigInputViewProps } from "./JsonConfigInputView";
|
|
101
|
+
export { JsonConfigInputView } from "./JsonConfigInputView";
|
|
93
102
|
export { McpDefaultIcon } from "./McpDefaultIcon";
|
|
94
103
|
export type { McpJsonEditorViewProps } from "./McpJsonEditorView";
|
|
95
104
|
export { McpJsonEditorView } from "./McpJsonEditorView";
|
|
105
|
+
export type {
|
|
106
|
+
FetchedModelRowView,
|
|
107
|
+
FetchedModelTestView,
|
|
108
|
+
ModelsFetchedModelsDrawerViewLabels,
|
|
109
|
+
ModelsFetchedModelsDrawerViewProps,
|
|
110
|
+
} from "./ModelsFetchedModelsDrawerView";
|
|
111
|
+
export { ModelsFetchedModelsDrawerView } from "./ModelsFetchedModelsDrawerView";
|
|
96
112
|
export type {
|
|
97
113
|
ModelsProviderFormStateView,
|
|
98
114
|
ModelsProviderFormViewLabels,
|
|
@@ -106,6 +122,12 @@ export type {
|
|
|
106
122
|
export { ModelsProvidersSectionView } from "./ModelsProvidersSectionView";
|
|
107
123
|
export type { MotionSelectOption, MotionSelectProps } from "./MotionSelect";
|
|
108
124
|
export { MotionSelect } from "./MotionSelect";
|
|
125
|
+
export type {
|
|
126
|
+
NotificationScopeView,
|
|
127
|
+
NotificationSettingsViewLabels,
|
|
128
|
+
NotificationSettingsViewProps,
|
|
129
|
+
} from "./NotificationSettingsView";
|
|
130
|
+
export { NotificationSettingsView } from "./NotificationSettingsView";
|
|
109
131
|
export type {
|
|
110
132
|
PermissionItemView,
|
|
111
133
|
PermissionStatusView,
|
|
@@ -126,6 +148,7 @@ export type {
|
|
|
126
148
|
PresetProviderModelRowView,
|
|
127
149
|
PresetProviderModelsListViewLabels,
|
|
128
150
|
PresetProviderModelsListViewProps,
|
|
151
|
+
PresetProviderModelTestView,
|
|
129
152
|
} from "./PresetProviderModelsListView";
|
|
130
153
|
export { PresetProviderModelsListView } from "./PresetProviderModelsListView";
|
|
131
154
|
export type {
|
|
@@ -139,6 +162,12 @@ export type {
|
|
|
139
162
|
PresetProvidersSectionViewProps,
|
|
140
163
|
} from "./PresetProvidersSectionView";
|
|
141
164
|
export { PresetProvidersSectionView } from "./PresetProvidersSectionView";
|
|
165
|
+
export type {
|
|
166
|
+
ProxyProviderRowView,
|
|
167
|
+
ProxySettingsSectionViewLabels,
|
|
168
|
+
ProxySettingsSectionViewProps,
|
|
169
|
+
} from "./ProxySettingsSectionView";
|
|
170
|
+
export { ProxySettingsSectionView } from "./ProxySettingsSectionView";
|
|
142
171
|
export type {
|
|
143
172
|
QrBindDialogBodyKind,
|
|
144
173
|
QrBindDialogDetail,
|
|
@@ -183,35 +212,18 @@ export type { ShortcutRecorderViewProps } from "./ShortcutRecorderView";
|
|
|
183
212
|
export { ShortcutRecorderView } from "./ShortcutRecorderView";
|
|
184
213
|
export type { ShortcutActionRowView, ShortcutsSettingsViewProps } from "./ShortcutsSettingsView";
|
|
185
214
|
export { ShortcutsSettingsView } from "./ShortcutsSettingsView";
|
|
186
|
-
export {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
} from "./
|
|
192
|
-
export {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
} from "./TeamDetailView";
|
|
199
|
-
export { TeamDetailView } from "./TeamDetailView";
|
|
200
|
-
export type {
|
|
201
|
-
CreateTeamDialogViewProps,
|
|
202
|
-
JoinTeamDialogViewProps,
|
|
203
|
-
TeamDialogLabelsView,
|
|
204
|
-
} from "./TeamDialogsView";
|
|
205
|
-
export { CreateTeamDialogView, JoinTeamDialogView } from "./TeamDialogsView";
|
|
206
|
-
export type { TeamListItemView, TeamListViewProps } from "./TeamListView";
|
|
207
|
-
export { TeamListView } from "./TeamListView";
|
|
208
|
-
export type { TeamSettingsViewProps } from "./TeamSettingsView";
|
|
209
|
-
export { TeamSettingsView } from "./TeamSettingsView";
|
|
210
|
-
export type { TokenActivityChartViewProps } from "./TokenActivityChartView";
|
|
211
|
-
export { TokenActivityChartView } from "./TokenActivityChartView";
|
|
212
|
-
export * from "./token-activity";
|
|
213
|
-
export type { UsageStatsMetric, UsageStatsRange, UsageStatsViewProps } from "./UsageStatsView";
|
|
214
|
-
export { USAGE_STATS_RANGES, UsageStatsView } from "./UsageStatsView";
|
|
215
|
+
export type {
|
|
216
|
+
SpaceEditorDialogViewLabels,
|
|
217
|
+
SpaceEditorDialogViewProps,
|
|
218
|
+
SpaceEditorIconOption,
|
|
219
|
+
} from "./SpaceEditorDialogView";
|
|
220
|
+
export { SpaceEditorDialogView } from "./SpaceEditorDialogView";
|
|
221
|
+
export type {
|
|
222
|
+
SpacesSettingsViewItem,
|
|
223
|
+
SpacesSettingsViewLabels,
|
|
224
|
+
SpacesSettingsViewProps,
|
|
225
|
+
} from "./SpacesSettingsView";
|
|
226
|
+
export { SpacesSettingsView } from "./SpacesSettingsView";
|
|
215
227
|
export type {
|
|
216
228
|
WebhookEndpointListViewLabels,
|
|
217
229
|
WebhookEndpointListViewProps,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 「有事在跑 / 没事」的状态点,待办条与底部面板 tab、折叠 pill 共用一个实现。
|
|
6
|
+
*
|
|
7
|
+
* 之前这套呼吸动画只存在于 `TodoProgress.tsx`,底部面板要同样的视觉,复制一份就会
|
|
8
|
+
* 出现两个事实源——改一处闪法两边不一致。抽到这里后两者同源,只靠 tone 区分语义色。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type ActivityStatusDotTone = "primary" | "emerald" | "muted";
|
|
12
|
+
|
|
13
|
+
export interface ActivityStatusDotProps {
|
|
14
|
+
/** true = 呼吸脉冲(运行中 / 未完成);false = 静止点(空闲 / 已完成)。 */
|
|
15
|
+
readonly pulse: boolean;
|
|
16
|
+
readonly tone: ActivityStatusDotTone;
|
|
17
|
+
readonly className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Tailwind 只认字面量类名,所以 tone 映射写成常量表而不是拼串。 */
|
|
21
|
+
const TONE_BACKGROUND: Record<ActivityStatusDotTone, string> = {
|
|
22
|
+
primary: "bg-primary",
|
|
23
|
+
emerald: "bg-emerald-500",
|
|
24
|
+
muted: "bg-muted-foreground/60",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const TONE_COLOR: Record<ActivityStatusDotTone, string> = {
|
|
28
|
+
primary: "var(--primary)",
|
|
29
|
+
emerald: "var(--color-emerald-500)",
|
|
30
|
+
muted: "var(--muted-foreground)",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 光晕(.activity-dot-halo)扩散淡出、核心点(.activity-dot-core)同拍呼吸——动画不写在 CSS 里:
|
|
35
|
+
* 毛玻璃窗口每出一帧都要整窗重合成,一个 6px 的点 60fps 逐帧插值就足以让 GPU 常年不闲。
|
|
36
|
+
* 由宿主(desktop 的 live-animations)按类名挂 steps(16) 的合成器动画并与其它指示器锁同一相位;
|
|
37
|
+
* 没有宿主动画时光晕保持不可见、核心点全亮。
|
|
38
|
+
*/
|
|
39
|
+
export const ACTIVITY_STATUS_DOT_CSS = `
|
|
40
|
+
.activity-dot-halo { opacity: 0; }
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
/** 关键帧注入点:每个用到状态点的根节点渲染一次,内容相同不会互相干扰。 */
|
|
44
|
+
export function ActivityStatusDotStyles(): JSX.Element {
|
|
45
|
+
return <style>{ACTIVITY_STATUS_DOT_CSS}</style>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function ActivityStatusDot({ pulse, tone, className }: ActivityStatusDotProps): JSX.Element {
|
|
49
|
+
const background = TONE_BACKGROUND[tone];
|
|
50
|
+
return (
|
|
51
|
+
<span
|
|
52
|
+
aria-hidden
|
|
53
|
+
data-status={pulse ? "active" : "idle"}
|
|
54
|
+
className={cn("relative flex h-2 w-2 shrink-0 items-center justify-center", className)}
|
|
55
|
+
>
|
|
56
|
+
{pulse ? (
|
|
57
|
+
<>
|
|
58
|
+
<span className={cn("activity-dot-halo absolute h-1.5 w-1.5 rounded-full", background)} />
|
|
59
|
+
<span className={cn("activity-dot-core relative h-1.5 w-1.5 rounded-full", background)} />
|
|
60
|
+
</>
|
|
61
|
+
) : (
|
|
62
|
+
<span
|
|
63
|
+
className={cn("h-1.5 w-1.5 rounded-full", background)}
|
|
64
|
+
style={{ boxShadow: `0 0 0 2px color-mix(in srgb, ${TONE_COLOR[tone]} 18%, transparent)` }}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</span>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn } from "@vetta-org/ui";
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
|
|
4
4
|
export interface AvatarStackViewProps {
|
|
@@ -22,24 +22,24 @@ export function AvatarStackView({
|
|
|
22
22
|
data-avatar-stack="true"
|
|
23
23
|
>
|
|
24
24
|
{visibleAvatarUrls.map((avatarUrl, index) => (
|
|
25
|
-
<
|
|
25
|
+
<span
|
|
26
26
|
key={`${avatarUrl}:${index}`}
|
|
27
|
-
src={avatarUrl}
|
|
28
|
-
alt=""
|
|
29
27
|
className={cn(
|
|
30
|
-
"h-4 w-4 shrink-0 rounded-full
|
|
28
|
+
"relative h-4 w-4 shrink-0 rounded-full ring-1 ring-border",
|
|
31
29
|
index > 0 && "-ml-1.5",
|
|
32
30
|
)}
|
|
33
|
-
/>
|
|
34
|
-
))}
|
|
35
|
-
{hiddenAvatarCount > 0 ? (
|
|
36
|
-
<span
|
|
37
|
-
className="-ml-1.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-muted px-1 text-[9px] tabular-nums text-muted-foreground ring-1 ring-background"
|
|
38
|
-
data-avatar-overflow={hiddenAvatarCount}
|
|
39
31
|
>
|
|
40
|
-
|
|
32
|
+
<img src={avatarUrl} alt="" className="h-4 w-4 rounded-full object-cover" />
|
|
33
|
+
{index === MAX_VISIBLE_AVATARS - 1 && hiddenAvatarCount > 0 ? (
|
|
34
|
+
<span
|
|
35
|
+
className="absolute inset-0 inline-flex items-center justify-center rounded-full bg-background/60 text-[9px] tabular-nums text-foreground"
|
|
36
|
+
data-avatar-overflow={hiddenAvatarCount}
|
|
37
|
+
>
|
|
38
|
+
+{hiddenAvatarCount}
|
|
39
|
+
</span>
|
|
40
|
+
) : null}
|
|
41
41
|
</span>
|
|
42
|
-
)
|
|
42
|
+
))}
|
|
43
43
|
</span>
|
|
44
44
|
);
|
|
45
45
|
}
|
package/src/shared/BotAvatar.tsx
CHANGED
|
@@ -120,7 +120,9 @@ export const BotAvatar = memo(function BotAvatar({
|
|
|
120
120
|
ro.observe(parent);
|
|
121
121
|
}, []);
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
// 流式中(active)不再自动做小动作:每个动作都是 motion 逐帧改写 transform,毛玻璃窗口每帧都要
|
|
124
|
+
// 整窗重合成;「还在进行」由静态光晕表达。autoplay 仍用于欢迎页这类本就该活泼的场景。
|
|
125
|
+
const shouldSchedule = !pacing && autoplay;
|
|
124
126
|
|
|
125
127
|
const pickRandomMood = useCallback((): AvatarMood => {
|
|
126
128
|
const choices = ACTIVE_MOODS.filter((m) => m !== lastPlayedRef.current);
|
|
@@ -139,11 +141,13 @@ export const BotAvatar = memo(function BotAvatar({
|
|
|
139
141
|
return () => clearTimeout(id);
|
|
140
142
|
}, [mood]);
|
|
141
143
|
|
|
144
|
+
// 自动小动作(仅 autoplay)之间留 1.4~3s 的空档:每个动作都是 motion 逐帧改写 transform,
|
|
145
|
+
// 毛玻璃窗口每帧都要整窗重合成。
|
|
142
146
|
useEffect(() => {
|
|
143
147
|
if (!shouldSchedule || mood !== "idle") return;
|
|
144
148
|
const id = setTimeout(
|
|
145
149
|
() => triggerMood(pickRandomMood()),
|
|
146
|
-
|
|
150
|
+
1400 + Math.random() * 1600,
|
|
147
151
|
);
|
|
148
152
|
return () => clearTimeout(id);
|
|
149
153
|
}, [shouldSchedule, mood, triggerMood, pickRandomMood]);
|
|
@@ -273,12 +277,8 @@ export const BotAvatar = memo(function BotAvatar({
|
|
|
273
277
|
className={`no-drag relative flex shrink-0 items-center justify-center focus:outline-none ${cfg.wrapper} ${className}`}
|
|
274
278
|
>
|
|
275
279
|
{active && (
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
className={`absolute ${cfg.glowInset} rounded-[20px] bg-primary/30 ${cfg.glowBlur}`}
|
|
279
|
-
animate={{ opacity: [0.35, 0.65, 0.35], scale: [0.95, 1.05, 0.95] }}
|
|
280
|
-
transition={{ duration: 1.6, repeat: Infinity, ease: "easeInOut" }}
|
|
281
|
-
/>
|
|
280
|
+
// 光晕是静态的:模糊层一旦跟着无限动画缩放/变透明,流式全程每帧都要重新模糊一遍。
|
|
281
|
+
<span aria-hidden className={`absolute ${cfg.glowInset} rounded-[20px] bg-primary/30 opacity-50 ${cfg.glowBlur}`} />
|
|
282
282
|
)}
|
|
283
283
|
<motion.div
|
|
284
284
|
className={`relative flex items-center justify-center ${cfg.body} bg-gradient-to-br from-primary to-primary/85 text-primary-foreground ${cfg.shadow}`}
|
|
@@ -366,7 +366,9 @@ export const BotAvatar = memo(function BotAvatar({
|
|
|
366
366
|
y: [0, -3 * f, -7 * f, -11 * f],
|
|
367
367
|
x: [0, 1 * f, -1 * f, 1 * f],
|
|
368
368
|
}}
|
|
369
|
-
|
|
369
|
+
// 退场必须自带有限 transition:否则会继承下方的 repeat: Infinity,
|
|
370
|
+
// 退场永远结束不了,「z」不卸载并一直以 60fps 驱动整窗重绘。
|
|
371
|
+
exit={{ opacity: 0, transition: { duration: 0.2 } }}
|
|
370
372
|
transition={{
|
|
371
373
|
duration: 1.4,
|
|
372
374
|
ease: "easeOut",
|
|
@@ -38,7 +38,7 @@ export function CodeBlockCopyButtonView({
|
|
|
38
38
|
onClick={handleCopy}
|
|
39
39
|
aria-label={copied ? labels.copied : labels.copy}
|
|
40
40
|
title={copied ? labels.copied : labels.copy}
|
|
41
|
-
className="absolute right-2 top-2 z-20 inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border border-
|
|
41
|
+
className="absolute right-2 top-2 z-20 inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border border-border/60 bg-background/90 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover/code-block:opacity-100"
|
|
42
42
|
>
|
|
43
43
|
<span className={copied ? "icon-[mdi--check] h-4 w-4" : "icon-[solar--copy-linear] h-4 w-4"} />
|
|
44
44
|
</button>
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
DropdownMenu,
|
|
4
|
-
DropdownMenuContent,
|
|
5
|
-
DropdownMenuItem,
|
|
6
|
-
DropdownMenuSeparator,
|
|
7
|
-
DropdownMenuSub,
|
|
8
|
-
DropdownMenuSubContent,
|
|
9
|
-
DropdownMenuSubTrigger,
|
|
10
|
-
DropdownMenuTrigger,
|
|
11
|
-
} from "@vetta-org/ui";
|
|
1
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
2
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "@vetta-org/ui/dropdown-menu";
|
|
12
3
|
import type { JSX } from "react";
|
|
13
4
|
|
|
14
5
|
/**
|
|
@@ -28,6 +19,7 @@ export type ContextMenuNode =
|
|
|
28
19
|
checked?: boolean;
|
|
29
20
|
danger?: boolean;
|
|
30
21
|
disabled?: boolean;
|
|
22
|
+
title?: string;
|
|
31
23
|
onSelect: () => void;
|
|
32
24
|
}
|
|
33
25
|
| {
|
|
@@ -91,6 +83,7 @@ function renderNodes(nodes: readonly ContextMenuNode[]): JSX.Element[] {
|
|
|
91
83
|
<DropdownMenuItem
|
|
92
84
|
key={node.id}
|
|
93
85
|
disabled={node.disabled}
|
|
86
|
+
title={node.title}
|
|
94
87
|
onSelect={node.onSelect}
|
|
95
88
|
className={cn("px-2 py-[5px]", node.danger && "text-destructive")}
|
|
96
89
|
>
|
|
@@ -118,7 +118,7 @@ export const MarkdownTable = memo(function MarkdownTable({
|
|
|
118
118
|
<div className="md-table-shadow-host relative" data-md-table-frame="">
|
|
119
119
|
<div
|
|
120
120
|
ref={scrollRef}
|
|
121
|
-
className="max-h-[70vh] overflow-auto overscroll-x-contain rounded-xl border border-border/60 bg-muted p-[3px]"
|
|
121
|
+
className="max-h-[70vh] overflow-auto overscroll-x-contain rounded-xl border border-border/60 bg-[color-mix(in_srgb,var(--foreground)_8%,var(--background))] dark:bg-muted p-[3px]"
|
|
122
122
|
style={{ boxShadow: overflowShadow(overflow) }}
|
|
123
123
|
>
|
|
124
124
|
<table
|
|
@@ -187,7 +187,7 @@ export function MarkdownTableHeaderCell({
|
|
|
187
187
|
CELL_CLASS,
|
|
188
188
|
// -top-[3px] 抵消容器的 3px 内边距:表头吸顶时要贴住外框上边缘,
|
|
189
189
|
// 否则滚动内容会从它上方那条缝里穿过去。
|
|
190
|
-
"sticky -top-[3px] z-[1] whitespace-nowrap bg-muted py-2.5 text-[12px] font-medium text-muted-foreground/80",
|
|
190
|
+
"sticky -top-[3px] z-[1] whitespace-nowrap bg-[color-mix(in_srgb,var(--foreground)_8%,var(--background))] dark:bg-muted py-2.5 text-[12px] font-medium text-muted-foreground/80",
|
|
191
191
|
)}
|
|
192
192
|
>
|
|
193
193
|
{children}
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { act, type ReactNode } from "react";
|
|
4
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { TabBar } from "./TabBar";
|
|
7
|
+
|
|
8
|
+
describe("TabBar active outline", () => {
|
|
9
|
+
let root: Root;
|
|
10
|
+
let host: HTMLDivElement;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
|
|
14
|
+
vi.spyOn(HTMLElement.prototype, "offsetWidth", "get").mockReturnValue(96);
|
|
15
|
+
vi.stubGlobal(
|
|
16
|
+
"ResizeObserver",
|
|
17
|
+
class {
|
|
18
|
+
observe(): void {}
|
|
19
|
+
disconnect(): void {}
|
|
20
|
+
unobserve(): void {}
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
host = document.createElement("div");
|
|
24
|
+
document.body.append(host);
|
|
25
|
+
root = createRoot(host);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
act(() => root.unmount());
|
|
30
|
+
host.remove();
|
|
31
|
+
vi.restoreAllMocks();
|
|
32
|
+
vi.unstubAllGlobals();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function renderBar(suppressLayoutAnimation: boolean): void {
|
|
36
|
+
const view: ReactNode = (
|
|
37
|
+
<TabBar
|
|
38
|
+
items={[{ key: "files", label: "文件" }]}
|
|
39
|
+
onChange={() => undefined}
|
|
40
|
+
suppressLayoutAnimation={suppressLayoutAnimation}
|
|
41
|
+
value="files"
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
act(() => {
|
|
45
|
+
root.render(view);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
it("keeps the three-sided outline after resizing stops changing the tab width", () => {
|
|
50
|
+
renderBar(false);
|
|
51
|
+
expect(host.querySelector("[data-connected-tab-outline]")).not.toBeNull();
|
|
52
|
+
|
|
53
|
+
renderBar(true);
|
|
54
|
+
expect(host.querySelector("[data-connected-tab-outline]")).not.toBeNull();
|
|
55
|
+
|
|
56
|
+
renderBar(false);
|
|
57
|
+
expect(host.querySelector("[data-connected-tab-outline]")).not.toBeNull();
|
|
58
|
+
});
|
|
59
|
+
});
|
package/src/shared/TabBar.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import { motion } from "motion/react";
|
|
|
2
2
|
import {
|
|
3
3
|
useCallback,
|
|
4
4
|
useEffect,
|
|
5
|
-
useId,
|
|
6
5
|
useLayoutEffect,
|
|
6
|
+
useId,
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
9
9
|
type JSX,
|
|
@@ -129,6 +129,8 @@ function ActiveTabIndicator({
|
|
|
129
129
|
const indicatorRef = useRef<HTMLSpanElement>(null);
|
|
130
130
|
const [tabWidth, setTabWidth] = useState(0);
|
|
131
131
|
|
|
132
|
+
// 宽度必须在绘制前量到。拖动面板时指示器会暂时关掉布局动画,若这时把节点拆掉重建,
|
|
133
|
+
// 宽度状态会回到 0,而 ResizeObserver 在尺寸不再变化时不一定再回调,三边轮廓就再也画不出来。
|
|
132
134
|
useLayoutEffect(() => {
|
|
133
135
|
const indicator = indicatorRef.current;
|
|
134
136
|
if (!indicator) return;
|
|
@@ -137,6 +139,7 @@ function ActiveTabIndicator({
|
|
|
137
139
|
setTabWidth((currentWidth) => (currentWidth === nextWidth ? currentWidth : nextWidth));
|
|
138
140
|
};
|
|
139
141
|
updateWidth();
|
|
142
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
140
143
|
const observer = new ResizeObserver(updateWidth);
|
|
141
144
|
observer.observe(indicator);
|
|
142
145
|
return () => observer.disconnect();
|
|
@@ -166,31 +169,29 @@ function ActiveTabIndicator({
|
|
|
166
169
|
strokeLinecap="square"
|
|
167
170
|
strokeLinejoin="round"
|
|
168
171
|
strokeWidth="1"
|
|
169
|
-
vectorEffect="non-scaling-stroke"
|
|
170
172
|
/>
|
|
171
173
|
</svg>
|
|
172
174
|
)}
|
|
173
175
|
</>
|
|
174
176
|
);
|
|
177
|
+
// 页签按钮带 1px 透明边框,绝对定位默认贴的是 padding box;用负偏移拉回边框盒,
|
|
178
|
+
// 否则轮廓整体下移 1px,下探量会多出一像素压到内容卡片上。
|
|
175
179
|
const indicatorProps = {
|
|
176
180
|
"aria-hidden": true,
|
|
177
|
-
className: "pointer-events-none absolute inset-x-
|
|
181
|
+
className: "pointer-events-none absolute -inset-x-px -top-px -bottom-px rounded-t-lg bg-muted",
|
|
178
182
|
"data-active-tab-indicator": true,
|
|
179
183
|
};
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<span ref={indicatorRef} {...indicatorProps}>
|
|
184
|
-
{content}
|
|
185
|
-
</span>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
185
|
+
// 始终用同一个节点。拖动面板宽度时只关掉 layoutId,避免换成另一种元素后轮廓宽度被清掉。
|
|
189
186
|
return (
|
|
190
187
|
<motion.span
|
|
191
188
|
ref={indicatorRef}
|
|
192
|
-
layoutId={`tabbar-active-${layoutId}`}
|
|
193
|
-
transition={
|
|
189
|
+
layoutId={suppressLayoutAnimation ? undefined : `tabbar-active-${layoutId}`}
|
|
190
|
+
transition={
|
|
191
|
+
suppressLayoutAnimation
|
|
192
|
+
? { duration: 0 }
|
|
193
|
+
: { type: "spring", stiffness: 480, damping: 36, mass: 0.8 }
|
|
194
|
+
}
|
|
194
195
|
{...indicatorProps}
|
|
195
196
|
>
|
|
196
197
|
{content}
|
|
@@ -554,13 +555,17 @@ export function TabBar<T extends string>({
|
|
|
554
555
|
|
|
555
556
|
useEffect(() => {
|
|
556
557
|
if (!responsive) return;
|
|
557
|
-
recompute();
|
|
558
558
|
const row = rowRef.current;
|
|
559
559
|
if (!row) return;
|
|
560
|
-
|
|
560
|
+
recompute();
|
|
561
|
+
const scheduleRecompute = () => {
|
|
561
562
|
if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
|
|
562
|
-
rafRef.current = requestAnimationFrame(
|
|
563
|
-
|
|
563
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
564
|
+
rafRef.current = undefined;
|
|
565
|
+
recompute();
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
const ro = new ResizeObserver(scheduleRecompute);
|
|
564
569
|
ro.observe(row);
|
|
565
570
|
return () => {
|
|
566
571
|
ro.disconnect();
|