@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,4 +1,11 @@
|
|
|
1
|
+
import { Button } from "@vetta-org/ui";
|
|
1
2
|
import type { JSX, ReactNode } from "react";
|
|
3
|
+
import {
|
|
4
|
+
type EnvironmentGitRowViewProps,
|
|
5
|
+
EnvironmentGitRowView,
|
|
6
|
+
type EnvironmentGitStatusView,
|
|
7
|
+
type EnvironmentGitViewLabels,
|
|
8
|
+
} from "./EnvironmentGitRowView";
|
|
2
9
|
import { SettingRow, SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
3
10
|
|
|
4
11
|
export type EnvironmentRuntimeKindView = "node" | "python";
|
|
@@ -14,6 +21,7 @@ export interface EnvironmentSettingsViewLabels {
|
|
|
14
21
|
readonly fetch: string;
|
|
15
22
|
readonly fetchAgain: string;
|
|
16
23
|
readonly fetching: string;
|
|
24
|
+
readonly git: EnvironmentGitViewLabels;
|
|
17
25
|
readonly loading: string;
|
|
18
26
|
readonly notReady: string;
|
|
19
27
|
readonly npmRegistry: string;
|
|
@@ -26,6 +34,7 @@ export interface EnvironmentSettingsViewLabels {
|
|
|
26
34
|
readonly sections: {
|
|
27
35
|
readonly mirrors: string;
|
|
28
36
|
readonly runtime: string;
|
|
37
|
+
readonly tools: string;
|
|
29
38
|
};
|
|
30
39
|
readonly title: string;
|
|
31
40
|
}
|
|
@@ -33,6 +42,8 @@ export interface EnvironmentSettingsViewLabels {
|
|
|
33
42
|
export interface EnvironmentSettingsViewProps {
|
|
34
43
|
readonly busy: EnvironmentRuntimeKindView | null;
|
|
35
44
|
readonly error: string | null;
|
|
45
|
+
/** Git 行的交互状态与回调;状态与文案分别来自 status.git 与 labels.git。 */
|
|
46
|
+
readonly git: Omit<EnvironmentGitRowViewProps, "labels" | "status">;
|
|
36
47
|
readonly headerAction?: ReactNode;
|
|
37
48
|
readonly labels: EnvironmentSettingsViewLabels;
|
|
38
49
|
readonly mirrors?: {
|
|
@@ -41,10 +52,12 @@ export interface EnvironmentSettingsViewProps {
|
|
|
41
52
|
} | null;
|
|
42
53
|
readonly onReinstall: (kind: EnvironmentRuntimeKindView) => void;
|
|
43
54
|
readonly runtimeSection: SettingSectionMeta;
|
|
55
|
+
readonly toolsSection: SettingSectionMeta;
|
|
44
56
|
readonly mirrorsSection: SettingSectionMeta;
|
|
45
57
|
readonly status: {
|
|
46
58
|
readonly node: EnvironmentRuntimeStatusView;
|
|
47
59
|
readonly python: EnvironmentRuntimeStatusView;
|
|
60
|
+
readonly git: EnvironmentGitStatusView;
|
|
48
61
|
} | null;
|
|
49
62
|
}
|
|
50
63
|
|
|
@@ -94,11 +107,10 @@ function RuntimeCard({
|
|
|
94
107
|
<span className={`text-[12px] ${stateClass}`}>{stateText}</span>
|
|
95
108
|
</div>
|
|
96
109
|
{status.supported && (
|
|
97
|
-
<
|
|
110
|
+
<Button variant="field"
|
|
98
111
|
type="button"
|
|
99
112
|
disabled={busy}
|
|
100
113
|
onClick={onReinstall}
|
|
101
|
-
className="flex items-center gap-1.5 rounded-lg border border-input bg-secondary px-3 py-1.5 text-[12px] text-foreground transition-colors hover:bg-accent disabled:opacity-50"
|
|
102
114
|
>
|
|
103
115
|
{busy ? (
|
|
104
116
|
<span className="icon-[mdi--loading] h-3.5 w-3.5 animate-spin" />
|
|
@@ -106,7 +118,7 @@ function RuntimeCard({
|
|
|
106
118
|
<span className="icon-[mdi--download-outline] h-3.5 w-3.5 text-muted-foreground" />
|
|
107
119
|
)}
|
|
108
120
|
{status.ready ? labels.fetchAgain : labels.fetch}
|
|
109
|
-
</
|
|
121
|
+
</Button>
|
|
110
122
|
)}
|
|
111
123
|
</div>
|
|
112
124
|
</SettingRow>
|
|
@@ -116,6 +128,7 @@ function RuntimeCard({
|
|
|
116
128
|
export function EnvironmentSettingsView({
|
|
117
129
|
busy,
|
|
118
130
|
error,
|
|
131
|
+
git,
|
|
119
132
|
headerAction,
|
|
120
133
|
labels,
|
|
121
134
|
mirrors,
|
|
@@ -123,6 +136,7 @@ export function EnvironmentSettingsView({
|
|
|
123
136
|
onReinstall,
|
|
124
137
|
runtimeSection,
|
|
125
138
|
status,
|
|
139
|
+
toolsSection,
|
|
126
140
|
}: EnvironmentSettingsViewProps): JSX.Element {
|
|
127
141
|
return (
|
|
128
142
|
<div className="mx-auto w-full max-w-[680px] px-8 pt-2 pb-4">
|
|
@@ -163,6 +177,14 @@ export function EnvironmentSettingsView({
|
|
|
163
177
|
)}
|
|
164
178
|
</SettingSection>
|
|
165
179
|
|
|
180
|
+
<SettingSection title={labels.sections.tools} section={toolsSection}>
|
|
181
|
+
{status ? (
|
|
182
|
+
<EnvironmentGitRowView {...git} labels={labels.git} status={status.git} />
|
|
183
|
+
) : (
|
|
184
|
+
<div className="px-5 py-4 text-[12px] text-muted-foreground">{labels.loading}</div>
|
|
185
|
+
)}
|
|
186
|
+
</SettingSection>
|
|
187
|
+
|
|
166
188
|
<SettingSection title={labels.sections.mirrors} section={mirrorsSection}>
|
|
167
189
|
<SettingRow title={labels.npmRegistry} description={labels.npmRegistryDescription} border>
|
|
168
190
|
<span className="text-[12px] text-muted-foreground">{mirrors?.npmRegistry ?? "—"}</span>
|
|
@@ -2,6 +2,7 @@ import type { JSX, ReactNode } from "react";
|
|
|
2
2
|
import { Button, Switch } from "@vetta-org/ui";
|
|
3
3
|
import { MotionSelect } from "./MotionSelect";
|
|
4
4
|
import { SettingRow, SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
5
|
+
import { NotificationSettingsView, type NotificationSettingsViewProps } from "./NotificationSettingsView";
|
|
5
6
|
|
|
6
7
|
export interface GeneralSettingsViewLabels {
|
|
7
8
|
readonly title: string;
|
|
@@ -14,8 +15,6 @@ export interface GeneralSettingsViewLabels {
|
|
|
14
15
|
readonly workspaceDescription: string;
|
|
15
16
|
readonly sandboxTitle: string;
|
|
16
17
|
readonly sandboxDescription: string;
|
|
17
|
-
readonly systemNotifications: string;
|
|
18
|
-
readonly systemNotificationsDescription: string;
|
|
19
18
|
readonly debugMode: string;
|
|
20
19
|
readonly debugModeDescription: string;
|
|
21
20
|
readonly exportDiagnostics: string;
|
|
@@ -28,7 +27,6 @@ export interface GeneralSettingsViewLabels {
|
|
|
28
27
|
readonly fullAccess: string;
|
|
29
28
|
readonly useSandbox: string;
|
|
30
29
|
readonly export: string;
|
|
31
|
-
readonly exporting: string;
|
|
32
30
|
readonly reset: string;
|
|
33
31
|
}
|
|
34
32
|
|
|
@@ -36,6 +34,7 @@ export interface GeneralSettingsViewProps {
|
|
|
36
34
|
readonly labels: GeneralSettingsViewLabels;
|
|
37
35
|
readonly sections: {
|
|
38
36
|
readonly basics: SettingSectionMeta;
|
|
37
|
+
readonly notifications: SettingSectionMeta;
|
|
39
38
|
readonly app: SettingSectionMeta;
|
|
40
39
|
readonly developer: SettingSectionMeta;
|
|
41
40
|
};
|
|
@@ -45,17 +44,17 @@ export interface GeneralSettingsViewProps {
|
|
|
45
44
|
/** 与 App 引导同构:description + 右侧 action;有更新时 detail 挂在行下。 */
|
|
46
45
|
readonly updatesDescription: string;
|
|
47
46
|
readonly updatesAction: ReactNode;
|
|
48
|
-
readonly updatesDetail
|
|
47
|
+
readonly updatesDetail?: ReactNode;
|
|
49
48
|
readonly executionMode: string;
|
|
50
49
|
readonly onExecutionModeChange: (mode: string) => void;
|
|
51
50
|
readonly sandboxUnavailableReason: string | null;
|
|
52
|
-
readonly
|
|
53
|
-
readonly onNotificationsChange: (checked: boolean) => void;
|
|
51
|
+
readonly notifications: Omit<NotificationSettingsViewProps, "section">;
|
|
54
52
|
readonly debugMode: boolean;
|
|
55
53
|
readonly onDebugChange: (checked: boolean) => void;
|
|
56
|
-
readonly exportingDiagnostics: boolean;
|
|
57
54
|
readonly onExportDiagnostics: () => void;
|
|
58
55
|
readonly onStartAppGuide: () => void;
|
|
56
|
+
/** 网络代理区块,由宿主注入(需要读 models.json 的服务商列表)。 */
|
|
57
|
+
readonly networkSection?: ReactNode;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
/**
|
|
@@ -64,6 +63,7 @@ export interface GeneralSettingsViewProps {
|
|
|
64
63
|
*
|
|
65
64
|
* Grouped into 3 sections to reduce one-setting-per-card scatter:
|
|
66
65
|
* - basics: workspace, sandbox, notifications
|
|
66
|
+
* - network: 应用代理(宿主注入)
|
|
67
67
|
* - app: updates, setup guide
|
|
68
68
|
* - developer: debug mode, diagnostics export
|
|
69
69
|
*/
|
|
@@ -79,13 +79,12 @@ export function GeneralSettingsView({
|
|
|
79
79
|
executionMode,
|
|
80
80
|
onExecutionModeChange,
|
|
81
81
|
sandboxUnavailableReason,
|
|
82
|
-
|
|
83
|
-
onNotificationsChange,
|
|
82
|
+
notifications,
|
|
84
83
|
debugMode,
|
|
85
84
|
onDebugChange,
|
|
86
|
-
exportingDiagnostics,
|
|
87
85
|
onExportDiagnostics,
|
|
88
86
|
onStartAppGuide,
|
|
87
|
+
networkSection,
|
|
89
88
|
}: GeneralSettingsViewProps): JSX.Element {
|
|
90
89
|
return (
|
|
91
90
|
<div className="mx-auto w-full max-w-[680px] px-8 pt-2 pb-4">
|
|
@@ -94,15 +93,14 @@ export function GeneralSettingsView({
|
|
|
94
93
|
<SettingSection title={labels.sections.basics} section={sections.basics}>
|
|
95
94
|
<SettingRow title={labels.workspaceTitle} description={labels.workspaceDescription}>
|
|
96
95
|
<div className="flex items-center gap-2">
|
|
97
|
-
<
|
|
96
|
+
<Button variant="field"
|
|
98
97
|
type="button"
|
|
99
98
|
onClick={onSelectWorkspace}
|
|
100
|
-
className="flex items-center gap-2 rounded-lg border border-input bg-secondary px-3 py-1.5 text-[12px] text-foreground transition-colors hover:bg-accent"
|
|
101
99
|
>
|
|
102
100
|
<span className="icon-[mdi--folder-outline] h-3.5 w-3.5 shrink-0 text-muted-foreground" />
|
|
103
101
|
<span className="max-w-[180px] truncate">{workspacePath}</span>
|
|
104
102
|
<span className="icon-[mdi--chevron-down] h-3.5 w-3.5 shrink-0 text-muted-foreground" />
|
|
105
|
-
</
|
|
103
|
+
</Button>
|
|
106
104
|
<button
|
|
107
105
|
type="button"
|
|
108
106
|
onClick={onResetWorkspace}
|
|
@@ -117,7 +115,6 @@ export function GeneralSettingsView({
|
|
|
117
115
|
<MotionSelect
|
|
118
116
|
value={executionMode}
|
|
119
117
|
onValueChange={onExecutionModeChange}
|
|
120
|
-
triggerClassName="min-w-[120px]"
|
|
121
118
|
options={[
|
|
122
119
|
{ value: "full-access", label: labels.fullAccess },
|
|
123
120
|
{
|
|
@@ -129,15 +126,12 @@ export function GeneralSettingsView({
|
|
|
129
126
|
]}
|
|
130
127
|
/>
|
|
131
128
|
</SettingRow>
|
|
132
|
-
<SettingRow
|
|
133
|
-
title={labels.systemNotifications}
|
|
134
|
-
description={labels.systemNotificationsDescription}
|
|
135
|
-
border={false}
|
|
136
|
-
>
|
|
137
|
-
<Switch checked={notificationsEnabled} onCheckedChange={onNotificationsChange} />
|
|
138
|
-
</SettingRow>
|
|
139
129
|
</SettingSection>
|
|
140
130
|
|
|
131
|
+
<NotificationSettingsView {...notifications} section={sections.notifications} />
|
|
132
|
+
|
|
133
|
+
{networkSection}
|
|
134
|
+
|
|
141
135
|
<SettingSection title={labels.sections.app} section={sections.app}>
|
|
142
136
|
{/* 与下方 App 引导同一 SettingRow:左标题+描述,右 outline sm 按钮。 */}
|
|
143
137
|
<SettingRow
|
|
@@ -149,7 +143,7 @@ export function GeneralSettingsView({
|
|
|
149
143
|
</SettingRow>
|
|
150
144
|
{updatesDetail ? <div className="border-b border-border px-5 pb-4">{updatesDetail}</div> : null}
|
|
151
145
|
<SettingRow title={labels.startAppGuide} description={labels.startAppGuideDescription} border={false}>
|
|
152
|
-
<Button
|
|
146
|
+
<Button variant="field" onClick={onStartAppGuide}>
|
|
153
147
|
{labels.startAppGuideAction}
|
|
154
148
|
</Button>
|
|
155
149
|
</SettingRow>
|
|
@@ -164,8 +158,8 @@ export function GeneralSettingsView({
|
|
|
164
158
|
description={labels.exportDiagnosticsDescription}
|
|
165
159
|
border={false}
|
|
166
160
|
>
|
|
167
|
-
<Button
|
|
168
|
-
{
|
|
161
|
+
<Button variant="field" onClick={onExportDiagnostics}>
|
|
162
|
+
{labels.export}
|
|
169
163
|
</Button>
|
|
170
164
|
</SettingRow>
|
|
171
165
|
</SettingSection>
|
|
@@ -49,7 +49,7 @@ export function ImChannelGuideDialogView({
|
|
|
49
49
|
{/* 弹窗本体固定高度、不滚动:滚动条只出现在下面的内容区,
|
|
50
50
|
页头与页脚始终可见;overflow-x-hidden 杜绝横向滚动条。 */}
|
|
51
51
|
<DialogContent className="flex max-h-[min(90vh,760px)] flex-col gap-0 overflow-hidden p-0 sm:max-w-[560px]">
|
|
52
|
-
<DialogHeader className="shrink-0 gap-3
|
|
52
|
+
<DialogHeader className="shrink-0 gap-3 px-6 pt-6 pb-5">
|
|
53
53
|
<div className="flex items-start gap-3.5">
|
|
54
54
|
<div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary ring-1 ring-primary/15 ring-inset">
|
|
55
55
|
<span className="icon-[mdi--book-open-page-variant-outline] h-5 w-5" />
|
|
@@ -115,7 +115,7 @@ export function ImChannelGuideDialogView({
|
|
|
115
115
|
))}
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
|
-
<DialogFooter className="
|
|
118
|
+
<DialogFooter className="mx-0 mb-0 shrink-0 px-6 py-4">
|
|
119
119
|
<Button variant="primary" onClick={onClose}>
|
|
120
120
|
{labels.close}
|
|
121
121
|
</Button>
|
|
@@ -142,7 +142,7 @@ export function ImFeishuDialogView({
|
|
|
142
142
|
{/* 动作按钮成组,justify-between 才是「说明 | 动作」两端分布,
|
|
143
143
|
而不是把每个按钮都摊开。 */}
|
|
144
144
|
<div className="flex items-center gap-2">
|
|
145
|
-
<Button variant="
|
|
145
|
+
<Button variant="field" onClick={onTest} disabled={testing || !canTest}>
|
|
146
146
|
{testing ? labels.testing : labels.testConnection}
|
|
147
147
|
</Button>
|
|
148
148
|
<Button variant="primary" onClick={onSave} disabled={!canSave || saving}>
|
|
@@ -35,7 +35,7 @@ export function ImLegacyImportBannerView({
|
|
|
35
35
|
<Button variant="primary" size="sm" onClick={onImport} disabled={importDisabled}>
|
|
36
36
|
{importLabel}
|
|
37
37
|
</Button>
|
|
38
|
-
<Button variant="
|
|
38
|
+
<Button variant="field" onClick={onSkip}>
|
|
39
39
|
{skipLabel}
|
|
40
40
|
</Button>
|
|
41
41
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
2
|
import { Button, cn } from "@vetta-org/ui";
|
|
3
3
|
import { SettingHeading, type SettingSectionMeta } from "./SettingChrome";
|
|
4
|
+
import { OVERLAY_BACKDROP_CLASS } from "@vetta-org/ui/utils";
|
|
4
5
|
|
|
5
6
|
export interface ImLogEventView {
|
|
6
7
|
readonly time: string;
|
|
@@ -37,7 +38,7 @@ export function ImLogDrawerView({
|
|
|
37
38
|
labels,
|
|
38
39
|
}: ImLogDrawerViewProps): JSX.Element {
|
|
39
40
|
return (
|
|
40
|
-
<div className="fixed inset-0 z-50 flex justify-end
|
|
41
|
+
<div className={cn("fixed inset-0 z-50 flex justify-end", OVERLAY_BACKDROP_CLASS)} onClick={onClose}>
|
|
41
42
|
<div
|
|
42
43
|
className="flex h-full w-[520px] flex-col border-l border-border bg-background shadow-xl"
|
|
43
44
|
onClick={(event) => event.stopPropagation()}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { json } from "@codemirror/lang-json";
|
|
2
|
+
import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
3
|
+
import { Compartment, EditorState } from "@codemirror/state";
|
|
4
|
+
import { EditorView, placeholder as editorPlaceholder } from "@codemirror/view";
|
|
5
|
+
import { tags } from "@lezer/highlight";
|
|
6
|
+
import { minimalSetup } from "codemirror";
|
|
7
|
+
import { useEffect, useRef, type JSX } from "react";
|
|
8
|
+
|
|
9
|
+
const jsonConfigHighlightStyle = HighlightStyle.define([
|
|
10
|
+
{
|
|
11
|
+
tag: [tags.propertyName, tags.definition(tags.propertyName)],
|
|
12
|
+
color: "var(--foreground)",
|
|
13
|
+
fontWeight: "500",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
tag: [tags.string, tags.number, tags.bool, tags.null],
|
|
17
|
+
color: "color-mix(in srgb, var(--foreground) 82%, var(--primary))",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
tag: [tags.punctuation, tags.brace, tags.squareBracket, tags.separator],
|
|
21
|
+
color: "color-mix(in srgb, var(--muted-foreground) 78%, transparent)",
|
|
22
|
+
},
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
const jsonConfigInputTheme = EditorView.theme({
|
|
26
|
+
"&": {
|
|
27
|
+
height: "100%",
|
|
28
|
+
color: "var(--foreground)",
|
|
29
|
+
backgroundColor: "transparent",
|
|
30
|
+
fontSize: "13px",
|
|
31
|
+
},
|
|
32
|
+
"&.cm-focused": {
|
|
33
|
+
outline: "none",
|
|
34
|
+
},
|
|
35
|
+
".cm-scroller": {
|
|
36
|
+
overflow: "auto",
|
|
37
|
+
overscrollBehavior: "contain",
|
|
38
|
+
fontFamily: "var(--font-sans)",
|
|
39
|
+
lineHeight: "1.55",
|
|
40
|
+
},
|
|
41
|
+
".cm-content": {
|
|
42
|
+
minHeight: "100%",
|
|
43
|
+
padding: "10px 12px",
|
|
44
|
+
caretColor: "var(--primary)",
|
|
45
|
+
},
|
|
46
|
+
".cm-line": {
|
|
47
|
+
padding: "0",
|
|
48
|
+
},
|
|
49
|
+
".cm-placeholder": {
|
|
50
|
+
color: "color-mix(in srgb, var(--muted-foreground) 40%, transparent)",
|
|
51
|
+
fontStyle: "normal",
|
|
52
|
+
},
|
|
53
|
+
".cm-selectionBackground, &.cm-focused .cm-selectionBackground": {
|
|
54
|
+
backgroundColor: "color-mix(in srgb, var(--primary) 15%, transparent) !important",
|
|
55
|
+
},
|
|
56
|
+
".cm-cursor, .cm-dropCursor": {
|
|
57
|
+
borderLeftColor: "var(--primary)",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export interface JsonConfigInputViewProps {
|
|
62
|
+
readonly value: string;
|
|
63
|
+
readonly onValueChange: (value: string) => void;
|
|
64
|
+
readonly placeholder: string;
|
|
65
|
+
readonly ariaLabel: string;
|
|
66
|
+
readonly ariaInvalid?: boolean;
|
|
67
|
+
readonly ariaDescribedBy?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A restrained, theme-aware JSON field without IDE chrome or editor-only tools. */
|
|
71
|
+
export function JsonConfigInputView({
|
|
72
|
+
value,
|
|
73
|
+
onValueChange,
|
|
74
|
+
placeholder,
|
|
75
|
+
ariaLabel,
|
|
76
|
+
ariaInvalid = false,
|
|
77
|
+
ariaDescribedBy,
|
|
78
|
+
}: JsonConfigInputViewProps): JSX.Element {
|
|
79
|
+
const hostRef = useRef<HTMLDivElement>(null);
|
|
80
|
+
const viewRef = useRef<EditorView | null>(null);
|
|
81
|
+
const onValueChangeRef = useRef(onValueChange);
|
|
82
|
+
const applyingExternalValueRef = useRef(false);
|
|
83
|
+
const initialValueRef = useRef(value);
|
|
84
|
+
const initialPlaceholderRef = useRef(placeholder);
|
|
85
|
+
const initialAccessibilityRef = useRef({ ariaLabel, ariaInvalid, ariaDescribedBy });
|
|
86
|
+
const accessibilityCompartmentRef = useRef(new Compartment());
|
|
87
|
+
const placeholderCompartmentRef = useRef(new Compartment());
|
|
88
|
+
onValueChangeRef.current = onValueChange;
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const host = hostRef.current;
|
|
92
|
+
if (!host) return;
|
|
93
|
+
|
|
94
|
+
const initialAccessibility = initialAccessibilityRef.current;
|
|
95
|
+
const accessibilityAttributes: Record<string, string> = {
|
|
96
|
+
"aria-label": initialAccessibility.ariaLabel,
|
|
97
|
+
"aria-invalid": String(initialAccessibility.ariaInvalid),
|
|
98
|
+
spellcheck: "false",
|
|
99
|
+
autocapitalize: "off",
|
|
100
|
+
autocomplete: "off",
|
|
101
|
+
};
|
|
102
|
+
if (initialAccessibility.ariaDescribedBy) {
|
|
103
|
+
accessibilityAttributes["aria-describedby"] = initialAccessibility.ariaDescribedBy;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const state = EditorState.create({
|
|
107
|
+
doc: initialValueRef.current,
|
|
108
|
+
extensions: [
|
|
109
|
+
minimalSetup,
|
|
110
|
+
json(),
|
|
111
|
+
EditorView.lineWrapping,
|
|
112
|
+
jsonConfigInputTheme,
|
|
113
|
+
syntaxHighlighting(jsonConfigHighlightStyle),
|
|
114
|
+
accessibilityCompartmentRef.current.of(EditorView.contentAttributes.of(accessibilityAttributes)),
|
|
115
|
+
placeholderCompartmentRef.current.of(editorPlaceholder(initialPlaceholderRef.current)),
|
|
116
|
+
EditorView.updateListener.of((update) => {
|
|
117
|
+
if (update.docChanged && !applyingExternalValueRef.current) {
|
|
118
|
+
onValueChangeRef.current(update.state.doc.toString());
|
|
119
|
+
}
|
|
120
|
+
}),
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
const view = new EditorView({ state, parent: host });
|
|
124
|
+
viewRef.current = view;
|
|
125
|
+
|
|
126
|
+
return () => {
|
|
127
|
+
view.destroy();
|
|
128
|
+
viewRef.current = null;
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const view = viewRef.current;
|
|
134
|
+
if (!view) return;
|
|
135
|
+
const currentValue = view.state.doc.toString();
|
|
136
|
+
if (currentValue === value) return;
|
|
137
|
+
applyingExternalValueRef.current = true;
|
|
138
|
+
try {
|
|
139
|
+
view.dispatch({ changes: { from: 0, to: currentValue.length, insert: value } });
|
|
140
|
+
} finally {
|
|
141
|
+
applyingExternalValueRef.current = false;
|
|
142
|
+
}
|
|
143
|
+
}, [value]);
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
const view = viewRef.current;
|
|
147
|
+
if (!view) return;
|
|
148
|
+
const accessibilityAttributes: Record<string, string> = {
|
|
149
|
+
"aria-label": ariaLabel,
|
|
150
|
+
"aria-invalid": String(ariaInvalid),
|
|
151
|
+
spellcheck: "false",
|
|
152
|
+
autocapitalize: "off",
|
|
153
|
+
autocomplete: "off",
|
|
154
|
+
};
|
|
155
|
+
if (ariaDescribedBy) accessibilityAttributes["aria-describedby"] = ariaDescribedBy;
|
|
156
|
+
view.dispatch({
|
|
157
|
+
effects: [
|
|
158
|
+
accessibilityCompartmentRef.current.reconfigure(EditorView.contentAttributes.of(accessibilityAttributes)),
|
|
159
|
+
placeholderCompartmentRef.current.reconfigure(editorPlaceholder(placeholder)),
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
}, [ariaDescribedBy, ariaInvalid, ariaLabel, placeholder]);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div
|
|
166
|
+
ref={hostRef}
|
|
167
|
+
data-invalid={ariaInvalid ? "true" : "false"}
|
|
168
|
+
className="h-72 min-h-40 w-full resize-y overflow-hidden rounded-lg border border-input bg-card text-foreground transition-colors focus-within:border-ring data-[invalid=true]:border-destructive"
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { act } from "react";
|
|
4
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
5
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
6
|
+
import { LauncherSettingsView, type LauncherSettingsViewProps } from "./LauncherSettingsView";
|
|
7
|
+
|
|
8
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
9
|
+
|
|
10
|
+
const mounted: Array<{ root: Root; container: HTMLDivElement }> = [];
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
for (const { root, container } of mounted.splice(0)) {
|
|
14
|
+
act(() => root.unmount());
|
|
15
|
+
container.remove();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function render(overrides: Partial<LauncherSettingsViewProps> = {}): HTMLDivElement {
|
|
20
|
+
const props: LauncherSettingsViewProps = {
|
|
21
|
+
labels: {
|
|
22
|
+
title: "Launcher",
|
|
23
|
+
subtitle: "One entry point",
|
|
24
|
+
pressBefore: "Press",
|
|
25
|
+
pressAfter: "to open",
|
|
26
|
+
tryNow: "Try it now",
|
|
27
|
+
previewPlaceholder: "Search…",
|
|
28
|
+
previewNewSession: "New session",
|
|
29
|
+
previewOpen: "Open",
|
|
30
|
+
previewClose: "Close",
|
|
31
|
+
status: { waiting: "Needs you", running: "Running", unread: "Just finished" },
|
|
32
|
+
featuresTitle: "What it does",
|
|
33
|
+
shortcutSectionTitle: "Shortcut",
|
|
34
|
+
shortcutTitle: "Open the launcher",
|
|
35
|
+
shortcutDescription: "Works anywhere",
|
|
36
|
+
shortcutPlaceholder: "Press keys",
|
|
37
|
+
resetLabel: "Reset",
|
|
38
|
+
sidebarHint: "Sidebar search opens it too",
|
|
39
|
+
},
|
|
40
|
+
previewGroups: [
|
|
41
|
+
{
|
|
42
|
+
label: "In progress",
|
|
43
|
+
rows: [{ icon: "icon-x", title: "Refactor sign-in", meta: "2 min ago", status: "waiting" }],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
features: [{ icon: "icon-y", title: "Search everything", description: "Find anything" }],
|
|
47
|
+
featuresSection: { id: "launcher-features" },
|
|
48
|
+
shortcutSection: { id: "launcher-shortcut" },
|
|
49
|
+
shortcut: "mod+t",
|
|
50
|
+
shortcutIsDefault: true,
|
|
51
|
+
onShortcutChange: () => {},
|
|
52
|
+
onShortcutReset: () => {},
|
|
53
|
+
eventToShortcut: () => null,
|
|
54
|
+
onOpenLauncher: () => {},
|
|
55
|
+
...overrides,
|
|
56
|
+
};
|
|
57
|
+
const container = document.createElement("div");
|
|
58
|
+
document.body.append(container);
|
|
59
|
+
const root = createRoot(container);
|
|
60
|
+
act(() => root.render(<LauncherSettingsView {...props} />));
|
|
61
|
+
mounted.push({ root, container });
|
|
62
|
+
return container;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
describe("LauncherSettingsView", () => {
|
|
66
|
+
it("opens the launcher from the try-it button", () => {
|
|
67
|
+
let opened = 0;
|
|
68
|
+
const container = render({ onOpenLauncher: () => (opened += 1) });
|
|
69
|
+
const button = Array.from(container.querySelectorAll("button")).find((el) => el.textContent?.includes("Try it now"));
|
|
70
|
+
expect(button).toBeDefined();
|
|
71
|
+
act(() => button?.click());
|
|
72
|
+
expect(opened).toBe(1);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("renders the real panel parts but keeps them inert and hidden from assistive tech", () => {
|
|
76
|
+
let opened = 0;
|
|
77
|
+
const container = render({ onOpenLauncher: () => (opened += 1) });
|
|
78
|
+
const preview = container.querySelector("[inert]");
|
|
79
|
+
expect(preview).not.toBeNull();
|
|
80
|
+
expect(preview?.getAttribute("aria-hidden")).toBe("true");
|
|
81
|
+
expect(preview?.textContent).toContain("Refactor sign-in");
|
|
82
|
+
expect(preview?.textContent).toContain("Needs you");
|
|
83
|
+
// 预览里的输入框不能被聚焦或输入:它只是示意图。
|
|
84
|
+
expect(preview?.querySelector("input")?.readOnly).toBe(true);
|
|
85
|
+
// 渲染预览不会顺带触发打开启动器。
|
|
86
|
+
expect(opened).toBe(0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("shows the user's current shortcut, not a hard-coded default", () => {
|
|
90
|
+
const container = render({ shortcut: "mod+shift+k", shortcutIsDefault: false });
|
|
91
|
+
const hint = Array.from(container.querySelectorAll('[role="img"]')).map((el) => el.getAttribute("aria-label"));
|
|
92
|
+
expect(hint.some((label) => label?.toLowerCase().includes("k"))).toBe(true);
|
|
93
|
+
expect(hint.some((label) => label?.toLowerCase().endsWith("t"))).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
});
|