@vetta-org/theme-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +195 -0
- package/src/action-approval/AppearanceActionPickerView.tsx +291 -0
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +69 -0
- package/src/action-approval/AppearancePickerApprovalView.tsx +31 -0
- package/src/action-approval/ApprovalParts.tsx +376 -0
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +138 -0
- package/src/action-approval/BatchTasksExecutionApprovalView.tsx +158 -0
- package/src/action-approval/BatchTasksTaskApprovalView.tsx +152 -0
- package/src/action-approval/GeneralSetExecutionModeApprovalView.tsx +76 -0
- package/src/action-approval/GenericActionApprovalView.tsx +127 -0
- package/src/action-approval/ManageActionApprovalFrameTypes.ts +27 -0
- package/src/action-approval/ManageActionApprovalFrameView.tsx +136 -0
- package/src/action-approval/NavigationOpenApprovalView.tsx +119 -0
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +191 -0
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +113 -0
- package/src/action-approval/SchedulerUpdateApprovalView.tsx +14 -0
- package/src/action-approval/ThemeChangeApprovalView.tsx +30 -0
- package/src/action-approval/WebhookDeleteApprovalView.tsx +56 -0
- package/src/action-approval/WebhookTestApprovalView.tsx +51 -0
- package/src/action-approval/cn.ts +4 -0
- package/src/action-approval/index.ts +88 -0
- package/src/activity/ActivityPanel.tsx +269 -0
- package/src/activity/ActivityPanelFrame.tsx +36 -0
- package/src/activity/BackgroundTasksTabPanelView.tsx +382 -0
- package/src/activity/BatchProgressTabPanelView.tsx +22 -0
- package/src/activity/BrowserPanelView.tsx +169 -0
- package/src/activity/ChatTabPanelView.tsx +36 -0
- package/src/activity/CodePreview.tsx +57 -0
- package/src/activity/DebugTabPanelView.tsx +67 -0
- package/src/activity/FileTabContentView.tsx +46 -0
- package/src/activity/FloatingActivityTabView.tsx +107 -0
- package/src/activity/HtmlPreviewView.tsx +135 -0
- package/src/activity/JourneyPanelView.tsx +327 -0
- package/src/activity/KnowledgeHistoryPanelView.tsx +93 -0
- package/src/activity/MarkdownPreviewView.tsx +217 -0
- package/src/activity/PluginTabPickerView.tsx +182 -0
- package/src/activity/RequestHistorySubTabView.tsx +102 -0
- package/src/activity/ScheduleExecutionTabPanelView.tsx +162 -0
- package/src/activity/TodoTabPanelView.tsx +66 -0
- package/src/activity/ToolCallsSubTabView.tsx +184 -0
- package/src/activity/WorkflowTabPanelView.tsx +129 -0
- package/src/activity/index.ts +110 -0
- package/src/app/AppBackground.tsx +24 -0
- package/src/app/AppBootLoadingView.tsx +51 -0
- package/src/app/RouteContentLoadingView.tsx +20 -0
- package/src/app/index.ts +13 -0
- package/src/app-boot.ts +1 -0
- package/src/app-shell/DefaultPageHeader.tsx +46 -0
- package/src/app-shell/DefaultWindowControls.tsx +32 -0
- package/src/app-shell/PageHeaderActionGroup.tsx +15 -0
- package/src/app-shell/PageHeaderContent.tsx +70 -0
- package/src/app-shell/PageHeaderFrame.tsx +53 -0
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +21 -0
- package/src/app-shell/PageHeaderTitle.tsx +25 -0
- package/src/app-shell/PageHeaderWindowActions.tsx +22 -0
- package/src/app-shell/WindowControlButton.tsx +35 -0
- package/src/app-shell/index.ts +49 -0
- package/src/appearance/BackgroundImageFrame.tsx +57 -0
- package/src/appearance/CenterSliceImageFrame.tsx +64 -0
- package/src/appearance/CornerImageFrame.tsx +63 -0
- package/src/appearance/HorizontalSliceImageFrame.tsx +97 -0
- package/src/appearance/NineSliceImageFrame.tsx +65 -0
- package/src/appearance/ThemeSurface.tsx +91 -0
- package/src/appearance/index.ts +12 -0
- package/src/batch-tasks/BatchProjectArtifactFieldView.tsx +36 -0
- package/src/batch-tasks/BatchProjectDialogView.tsx +61 -0
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +108 -0
- package/src/batch-tasks/BatchProjectGroupView.tsx +77 -0
- package/src/batch-tasks/BatchProjectNameFieldView.tsx +29 -0
- package/src/batch-tasks/BatchProjectNotificationFieldView.tsx +42 -0
- package/src/batch-tasks/BatchProjectRuntimeFieldsView.tsx +67 -0
- package/src/batch-tasks/BatchTaskActionButtonsView.tsx +67 -0
- package/src/batch-tasks/BatchTaskCardView.tsx +142 -0
- package/src/batch-tasks/BatchTaskGridView.tsx +95 -0
- package/src/batch-tasks/BatchTaskListView.tsx +10 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +73 -0
- package/src/batch-tasks/BatchTaskProjectBlockView.tsx +117 -0
- package/src/batch-tasks/BatchTaskProjectHeaderView.tsx +74 -0
- package/src/batch-tasks/BatchTasksPageView.tsx +126 -0
- package/src/batch-tasks/batchTaskUi.tsx +101 -0
- package/src/batch-tasks/index.ts +70 -0
- package/src/batch-tasks/types.ts +120 -0
- package/src/chat/ActionButtonBarView.tsx +45 -0
- package/src/chat/AgentAvatarView.tsx +59 -0
- package/src/chat/AppshotCardView.tsx +89 -0
- package/src/chat/AskUserQuestionView.tsx +177 -0
- package/src/chat/AssistantMessageView.tsx +147 -0
- package/src/chat/AtPanelView.tsx +220 -0
- package/src/chat/BackgroundTasksBadgeView.tsx +28 -0
- package/src/chat/BashTerminalCard.tsx +225 -0
- package/src/chat/ChatExportHostView.tsx +17 -0
- package/src/chat/ChatHeaderActionsView.tsx +75 -0
- package/src/chat/ContextRingView.tsx +100 -0
- package/src/chat/CopyIconButton.tsx +61 -0
- package/src/chat/DefaultGuidingWords.tsx +75 -0
- package/src/chat/DefaultSceneCarousel.tsx +113 -0
- package/src/chat/DefaultSkillBadgeRow.tsx +103 -0
- package/src/chat/DrawerCard.tsx +149 -0
- package/src/chat/EditDiffView.tsx +137 -0
- package/src/chat/ExecutionModeSelectorView.tsx +124 -0
- package/src/chat/ExportMessageListView.tsx +20 -0
- package/src/chat/GuideBadgeSwiperView.tsx +79 -0
- package/src/chat/InlineTokenChip.tsx +68 -0
- package/src/chat/InputActionBarView.tsx +112 -0
- package/src/chat/InputBarBackground.tsx +25 -0
- package/src/chat/InputBarCapsule.tsx +56 -0
- package/src/chat/InputBarContextMenuView.tsx +79 -0
- package/src/chat/InputBarPlaceholder.tsx +84 -0
- package/src/chat/InputBarToolbarButton.tsx +42 -0
- package/src/chat/KnowledgeToolViews.tsx +119 -0
- package/src/chat/LiveThinkingView.tsx +102 -0
- package/src/chat/MessageActions.tsx +109 -0
- package/src/chat/MessageBlockSegmentsView.tsx +203 -0
- package/src/chat/MessageBoundaryViews.tsx +93 -0
- package/src/chat/MessageCardsView.tsx +126 -0
- package/src/chat/MessageFeedContext.tsx +14 -0
- package/src/chat/MessageFeedLayoutView.tsx +97 -0
- package/src/chat/MessageFeedView.tsx +228 -0
- package/src/chat/MessageInputView.tsx +193 -0
- package/src/chat/MessageLayoutView.tsx +156 -0
- package/src/chat/MessageListFooterView.tsx +127 -0
- package/src/chat/MessageSelectionContextMenuView.tsx +66 -0
- package/src/chat/MessageTimelineView.tsx +261 -0
- package/src/chat/MessageView.tsx +82 -0
- package/src/chat/MessageVisualView.tsx +43 -0
- package/src/chat/ModelSelectorView.tsx +407 -0
- package/src/chat/NewSession.ts +107 -0
- package/src/chat/NewSessionBackground.tsx +54 -0
- package/src/chat/NewSessionPageLayoutView.tsx +96 -0
- package/src/chat/NewSessionPicker.tsx +270 -0
- package/src/chat/ProgressGroupView.tsx +323 -0
- package/src/chat/ProjectSelectorView.tsx +253 -0
- package/src/chat/QueueCardView.tsx +151 -0
- package/src/chat/ReadImageView.tsx +73 -0
- package/src/chat/SandboxGrantsBadgeView.tsx +101 -0
- package/src/chat/SandboxPermissionCard.tsx +64 -0
- package/src/chat/SceneCard.tsx +138 -0
- package/src/chat/SendButton.tsx +135 -0
- package/src/chat/SessionDropZoneView.tsx +85 -0
- package/src/chat/SessionViewerPageView.tsx +56 -0
- package/src/chat/SkillCard.tsx +56 -0
- package/src/chat/SkillPromptAreaView.tsx +129 -0
- package/src/chat/SuggestionBubblesView.tsx +58 -0
- package/src/chat/TextBlockView.tsx +770 -0
- package/src/chat/TextPreview.tsx +37 -0
- package/src/chat/ThinkingBlockView.tsx +183 -0
- package/src/chat/TodoCard.tsx +243 -0
- package/src/chat/TodoProgress.tsx +205 -0
- package/src/chat/TodoStatusBarView.tsx +140 -0
- package/src/chat/ToolCallBlockView.tsx +188 -0
- package/src/chat/UsageBarView.tsx +19 -0
- package/src/chat/UserMessageContextMenuView.tsx +87 -0
- package/src/chat/UserMessageView.tsx +241 -0
- package/src/chat/WorkflowFooterItemsView.tsx +170 -0
- package/src/chat/WriteContentView.tsx +12 -0
- package/src/chat/index.ts +524 -0
- package/src/chat/markdown-link.test.ts +238 -0
- package/src/chat/markdown-link.ts +279 -0
- package/src/chat/send-button.css +318 -0
- package/src/chat/useHorizontalDragScroll.ts +146 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +62 -0
- package/src/file-explorer/FileContextMenuView.tsx +209 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +82 -0
- package/src/file-explorer/FileTreeNodeView.tsx +274 -0
- package/src/file-explorer/FileTreeView.tsx +301 -0
- package/src/file-explorer/FilesPanelView.tsx +91 -0
- package/src/file-explorer/drag-target.test.ts +34 -0
- package/src/file-explorer/drag-target.ts +26 -0
- package/src/file-explorer/fileIcons.ts +1 -0
- package/src/file-explorer/index.ts +28 -0
- package/src/file-explorer/nativeFileDrag.test.ts +30 -0
- package/src/file-explorer/nativeFileDrag.ts +14 -0
- package/src/file-explorer/types.ts +40 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +115 -0
- package/src/file-preview/FilePreviewDialogView.tsx +241 -0
- package/src/file-preview/FilePreviewView.tsx +162 -0
- package/src/file-preview/LightboxImageView.tsx +131 -0
- package/src/file-preview/PluginFilePreviewView.tsx +24 -0
- package/src/file-preview/PreviewBodyView.tsx +99 -0
- package/src/file-preview/PreviewErrorBoundary.tsx +51 -0
- package/src/file-preview/TextCodeEditorView.tsx +72 -0
- package/src/file-preview/TextFileEditorView.tsx +213 -0
- package/src/file-preview/index.ts +56 -0
- package/src/file-preview/keyboard-target.test.ts +49 -0
- package/src/file-preview/keyboard-target.ts +33 -0
- package/src/file-preview/syntax-tokens.css +77 -0
- package/src/file-preview/syntax-tokens.test.ts +31 -0
- package/src/file-preview/syntax-tokens.ts +155 -0
- package/src/file-preview/text-code-editor-theme.ts +321 -0
- package/src/file-preview/text-editor-language.test.ts +58 -0
- package/src/file-preview/text-editor-language.ts +182 -0
- package/src/file-preview/types.ts +29 -0
- package/src/flowing/FlowingPanelView.tsx +79 -0
- package/src/flowing/FlowingWorkflowView.tsx +54 -0
- package/src/flowing/UserNodeView.tsx +148 -0
- package/src/flowing/WorkflowBindDialogView.tsx +145 -0
- package/src/flowing/WorkflowProgressView.tsx +149 -0
- package/src/flowing/index.ts +27 -0
- package/src/flowing-chat/ChatBubbleView.tsx +219 -0
- package/src/flowing-chat/ChatComposerView.tsx +362 -0
- package/src/flowing-chat/ChatMembersBarView.tsx +86 -0
- package/src/flowing-chat/ChatPanelView.tsx +73 -0
- package/src/flowing-chat/index.ts +21 -0
- package/src/index.ts +22 -0
- package/src/knowledge/KnowledgeBaseSwitcherView.tsx +154 -0
- package/src/knowledge/KnowledgeBreadcrumbView.tsx +92 -0
- package/src/knowledge/KnowledgeContentsPanelView.tsx +77 -0
- package/src/knowledge/KnowledgeContextMenuView.tsx +70 -0
- package/src/knowledge/KnowledgeFilesSkeleton.tsx +22 -0
- package/src/knowledge/KnowledgeGridView.tsx +113 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +85 -0
- package/src/knowledge/KnowledgeImportDialogView.tsx +153 -0
- package/src/knowledge/KnowledgeListView.tsx +107 -0
- package/src/knowledge/KnowledgePendingFilesDialogView.tsx +76 -0
- package/src/knowledge/KnowledgeProcessingBadgeView.tsx +18 -0
- package/src/knowledge/KnowledgeRenameDialogView.tsx +66 -0
- package/src/knowledge/KnowledgeSourcePickerView.tsx +60 -0
- package/src/knowledge/KnowledgeViewShared.tsx +103 -0
- package/src/knowledge/cn.ts +4 -0
- package/src/knowledge/coloredFileIcons.ts +1 -0
- package/src/knowledge/index.ts +66 -0
- package/src/knowledge/types.ts +31 -0
- package/src/knowledge/useMarqueeSelection.ts +95 -0
- package/src/layout/AppFrame.tsx +34 -0
- package/src/layout/MainContentFrame.tsx +54 -0
- package/src/layout/ResizeHandle.tsx +91 -0
- package/src/layout/SidebarDock.tsx +33 -0
- package/src/layout/SidebarOverlay.tsx +36 -0
- package/src/layout/index.ts +10 -0
- package/src/overlays/CommandMenuRow.tsx +119 -0
- package/src/overlays/CommandMenuView.tsx +183 -0
- package/src/overlays/ConfirmDialogView.tsx +109 -0
- package/src/overlays/DetailDrawer.tsx +63 -0
- package/src/overlays/DetailDrawerEnter.tsx +37 -0
- package/src/overlays/KnowledgeDropOverlayView.tsx +43 -0
- package/src/overlays/RouteErrorPageView.tsx +72 -0
- package/src/overlays/ToasterView.tsx +76 -0
- package/src/overlays/UpdateCheckerView.tsx +206 -0
- package/src/overlays/UpdateRestartDialogView.tsx +107 -0
- package/src/overlays/command-menu-types.ts +47 -0
- package/src/overlays/command-menu.css +69 -0
- package/src/overlays/detail-drawer-guard.test.ts +16 -0
- package/src/overlays/detail-drawer-guard.ts +13 -0
- package/src/overlays/index.ts +44 -0
- package/src/plugin-ui/index.ts +26 -0
- package/src/project/BatchQueueStatusView.tsx +352 -0
- package/src/project/ConversationTagDotsView.tsx +130 -0
- package/src/project/ConversationTagEditorDialogView.tsx +273 -0
- package/src/project/DefaultConversationSectionView.tsx +74 -0
- package/src/project/DefaultSessionListView.tsx +128 -0
- package/src/project/DefaultSessionRowView.tsx +125 -0
- package/src/project/NewProjectDialogView.tsx +140 -0
- package/src/project/ProjectContextMenuView.tsx +187 -0
- package/src/project/ProjectDetailPageView.tsx +351 -0
- package/src/project/ProjectGroupView.tsx +37 -0
- package/src/project/ProjectRowView.tsx +111 -0
- package/src/project/ProjectSessionsLoadingView.tsx +14 -0
- package/src/project/ProjectSessionsView.tsx +96 -0
- package/src/project/ProjectsLoadingView.tsx +15 -0
- package/src/project/ProjectsPanelMenusView.tsx +23 -0
- package/src/project/ProjectsPanelView.tsx +56 -0
- package/src/project/QuickScrollOverlay.tsx +188 -0
- package/src/project/ScheduleStatusView.tsx +110 -0
- package/src/project/SessionContextMenuView.tsx +71 -0
- package/src/project/SessionRenameInputView.tsx +49 -0
- package/src/project/SessionRowView.tsx +119 -0
- package/src/project/SidebarProjectsSectionView.tsx +35 -0
- package/src/project/index.ts +87 -0
- package/src/project/types.ts +21 -0
- package/src/project/useActiveSessionAutoScroll.ts +171 -0
- package/src/registry.ts +62 -0
- package/src/scheduler/AutomationPageView.tsx +159 -0
- package/src/scheduler/ExecutionHistoryView.tsx +179 -0
- package/src/scheduler/HistoryDrawerView.tsx +149 -0
- package/src/scheduler/TaskFormDialogView.tsx +60 -0
- package/src/scheduler/TaskListView.tsx +219 -0
- package/src/scheduler/index.ts +30 -0
- package/src/settings/AchievementNavigationButtonView.tsx +90 -0
- package/src/settings/AchievementPromotionDialogView.tsx +91 -0
- package/src/settings/AchievementSettingsView.tsx +44 -0
- package/src/settings/AppshotSettingsView.tsx +132 -0
- package/src/settings/ArchivedProjectsSettingsView.tsx +80 -0
- package/src/settings/BuiltinMcpSecretsDialogView.tsx +278 -0
- package/src/settings/BuiltinMcpSectionView.tsx +164 -0
- package/src/settings/EnvironmentSettingsView.tsx +176 -0
- package/src/settings/GeneralSettingsView.tsx +174 -0
- package/src/settings/ImChannelCardView.tsx +152 -0
- package/src/settings/ImChannelGuideDialogView.tsx +126 -0
- package/src/settings/ImFeishuDialogView.tsx +156 -0
- package/src/settings/ImLegacyImportBannerView.tsx +44 -0
- package/src/settings/ImLogDrawerView.tsx +75 -0
- package/src/settings/ImStatusBadgeView.tsx +39 -0
- package/src/settings/McpDefaultIcon.tsx +27 -0
- package/src/settings/McpJsonEditorView.tsx +56 -0
- package/src/settings/ModelsProviderFormView.tsx +128 -0
- package/src/settings/ModelsProvidersSectionView.tsx +52 -0
- package/src/settings/MotionSelect.tsx +125 -0
- package/src/settings/PermissionsSettingsView.tsx +106 -0
- package/src/settings/PetBubbleStylePreviewView.tsx +44 -0
- package/src/settings/PetSettingsView.tsx +165 -0
- package/src/settings/PresetProviderModelsListView.tsx +58 -0
- package/src/settings/PresetProviderRowView.tsx +302 -0
- package/src/settings/PresetProvidersSectionView.tsx +70 -0
- package/src/settings/QrBindDialogView.tsx +165 -0
- package/src/settings/QuickPanelSettingsSectionView.tsx +66 -0
- package/src/settings/RemoteMcpSectionView.tsx +192 -0
- package/src/settings/SettingChrome.tsx +104 -0
- package/src/settings/SettingsAiAssistButtonView.tsx +150 -0
- package/src/settings/SettingsAiAssistDialogView.tsx +251 -0
- package/src/settings/SettingsFormFields.tsx +121 -0
- package/src/settings/SettingsPageShellView.tsx +84 -0
- package/src/settings/SettingsSidebarView.tsx +133 -0
- package/src/settings/ShortcutRecorderView.tsx +88 -0
- package/src/settings/ShortcutsSettingsView.tsx +66 -0
- package/src/settings/SubscriptionActionsView.tsx +63 -0
- package/src/settings/SubscriptionCardsView.tsx +212 -0
- package/src/settings/TeamDetailView.tsx +148 -0
- package/src/settings/TeamDialogsView.tsx +151 -0
- package/src/settings/TeamListView.tsx +57 -0
- package/src/settings/TeamSettingsView.tsx +51 -0
- package/src/settings/TokenActivityChartView.tsx +286 -0
- package/src/settings/UsageStatsView.tsx +101 -0
- package/src/settings/WebhookEndpointListView.tsx +123 -0
- package/src/settings/WechatBindDialogView.tsx +45 -0
- package/src/settings/achievements/AchievementCurtains.tsx +50 -0
- package/src/settings/achievements/AchievementPromotionBadge3D.tsx +350 -0
- package/src/settings/achievements/AchievementPromotionConfetti.tsx +71 -0
- package/src/settings/achievements/AchievementTitle.tsx +52 -0
- package/src/settings/achievements/index.ts +13 -0
- package/src/settings/index.ts +226 -0
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +135 -0
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +40 -0
- package/src/settings/token-activity.test.ts +195 -0
- package/src/settings/token-activity.ts +320 -0
- package/src/shared/AvatarStackView.tsx +45 -0
- package/src/shared/BotAvatar.tsx +395 -0
- package/src/shared/CodeBlockCopyButton.tsx +48 -0
- package/src/shared/CollapsePanel.tsx +125 -0
- package/src/shared/ContextMenuView.tsx +134 -0
- package/src/shared/MacKeyboardPreview.tsx +260 -0
- package/src/shared/MarkdownTable.tsx +216 -0
- package/src/shared/MultiplierTag.tsx +15 -0
- package/src/shared/ScrollFade.tsx +114 -0
- package/src/shared/SegmentedControl.tsx +82 -0
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.tsx +696 -0
- package/src/shared/TimePicker.tsx +96 -0
- package/src/shared/connected-tab-outline.test.ts +22 -0
- package/src/shared/connected-tab-outline.ts +39 -0
- package/src/shared/fileIcons.test.ts +28 -0
- package/src/shared/fileIcons.ts +322 -0
- package/src/shared/index.ts +38 -0
- package/src/shared/markdown-table-clipboard.ts +31 -0
- package/src/shared/provider-icon/icons.ts +56 -0
- package/src/shared/provider-icon/index.tsx +42 -0
- package/src/shared/provider-icon/svg-url.d.ts +4 -0
- package/src/shared/tab-drag.test.ts +14 -0
- package/src/shared/tab-drag.ts +15 -0
- package/src/shared/useDelayedUnmount.ts +36 -0
- package/src/sidebar/AddProjectMenuItem.tsx +21 -0
- package/src/sidebar/AddProjectMenuPopoverView.tsx +52 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +50 -0
- package/src/sidebar/ChatMessageListView.tsx +66 -0
- package/src/sidebar/DefaultSidebar.tsx +91 -0
- package/src/sidebar/FlowingMessageListView.tsx +111 -0
- package/src/sidebar/MessageCenterDialogView.tsx +81 -0
- package/src/sidebar/MessageCenterEmptyState.tsx +24 -0
- package/src/sidebar/MessageCenterTabs.tsx +86 -0
- package/src/sidebar/MessageCenterToolbarButton.tsx +25 -0
- package/src/sidebar/MessageCenterTriggerView.tsx +39 -0
- package/src/sidebar/NotificationMessageListView.tsx +136 -0
- package/src/sidebar/ProjectsPanelEmptyState.tsx +20 -0
- package/src/sidebar/RunningPulseDot.tsx +10 -0
- package/src/sidebar/SessionStatusIcon.tsx +43 -0
- package/src/sidebar/SettingsMenuAccountSection.tsx +32 -0
- package/src/sidebar/SettingsMenuActionButton.tsx +24 -0
- package/src/sidebar/SettingsMenuDivider.tsx +5 -0
- package/src/sidebar/SettingsMenuQuotaSection.tsx +45 -0
- package/src/sidebar/SettingsMenuSettingsItem.tsx +18 -0
- package/src/sidebar/SettingsMenuThemeSection.tsx +51 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +65 -0
- package/src/sidebar/ShowMoreSessionsButton.tsx +37 -0
- package/src/sidebar/SidebarFilterSelectView.tsx +95 -0
- package/src/sidebar/SidebarNavBadgeView.tsx +58 -0
- package/src/sidebar/SidebarNavIcon.tsx +33 -0
- package/src/sidebar/SidebarNavItemButton.tsx +59 -0
- package/src/sidebar/SidebarNavMorePanel.tsx +199 -0
- package/src/sidebar/SidebarNavigation.tsx +223 -0
- package/src/sidebar/SidebarPanel.tsx +48 -0
- package/src/sidebar/SidebarTopBar.tsx +103 -0
- package/src/sidebar/SidebarUpdateIcon.tsx +79 -0
- package/src/sidebar/index.ts +118 -0
- package/src/sidebar/nav-badge-text.test.ts +23 -0
- package/src/sidebar/nav-badge-text.ts +19 -0
- package/src/sidebar/useSidebarNavDrag.ts +139 -0
- package/src/skills/PluginCardView.tsx +150 -0
- package/src/skills/SceneCardView.tsx +194 -0
- package/src/skills/SkillCardView.tsx +186 -0
- package/src/skills/SkillDetailDialogView.tsx +138 -0
- package/src/skills/SkillTagGroupView.tsx +56 -0
- package/src/skills/SkillToggleSwitch.tsx +31 -0
- package/src/skills/index.ts +29 -0
- package/src/skills/skill-icon.test.ts +38 -0
- package/src/skills/skill-icon.tsx +126 -0
- package/src/styles.css +75 -0
- package/src/utils/platform.ts +2 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EditorState } from "@codemirror/state";
|
|
2
|
+
import { EditorView } from "@codemirror/view";
|
|
3
|
+
import { basicSetup } from "codemirror";
|
|
4
|
+
import { useEffect, useRef, type JSX } from "react";
|
|
5
|
+
import { textCodeEditorTheme } from "./text-code-editor-theme";
|
|
6
|
+
import {
|
|
7
|
+
getTextEditorLanguageExtension,
|
|
8
|
+
normalizeFileExtension,
|
|
9
|
+
} from "./text-editor-language";
|
|
10
|
+
|
|
11
|
+
export interface TextCodeEditorViewProps {
|
|
12
|
+
documentKey: string;
|
|
13
|
+
initialValue: string;
|
|
14
|
+
extension: string;
|
|
15
|
+
lineEnding: "lf" | "crlf";
|
|
16
|
+
onChange: (content: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* When false, the host keeps this editor mounted but hidden (e.g. preview mode).
|
|
19
|
+
* Becoming true again remeasures layout and restores focus without wiping undo history.
|
|
20
|
+
*/
|
|
21
|
+
active?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function TextCodeEditorView({
|
|
25
|
+
documentKey,
|
|
26
|
+
initialValue,
|
|
27
|
+
extension,
|
|
28
|
+
lineEnding,
|
|
29
|
+
onChange,
|
|
30
|
+
active = true,
|
|
31
|
+
}: TextCodeEditorViewProps): JSX.Element {
|
|
32
|
+
const hostRef = useRef<HTMLDivElement>(null);
|
|
33
|
+
const viewRef = useRef<EditorView | null>(null);
|
|
34
|
+
const initialValueRef = useRef(initialValue);
|
|
35
|
+
const onChangeRef = useRef(onChange);
|
|
36
|
+
initialValueRef.current = initialValue;
|
|
37
|
+
onChangeRef.current = onChange;
|
|
38
|
+
const languageKey = normalizeFileExtension(extension);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const host = hostRef.current;
|
|
42
|
+
if (!host) return;
|
|
43
|
+
const state = EditorState.create({
|
|
44
|
+
doc: initialValueRef.current,
|
|
45
|
+
extensions: [
|
|
46
|
+
basicSetup,
|
|
47
|
+
EditorState.lineSeparator.of(lineEnding === "crlf" ? "\r\n" : "\n"),
|
|
48
|
+
getTextEditorLanguageExtension(languageKey),
|
|
49
|
+
textCodeEditorTheme,
|
|
50
|
+
EditorView.updateListener.of((update) => {
|
|
51
|
+
if (update.docChanged) onChangeRef.current(update.state.doc.toString());
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
const view = new EditorView({ state, parent: host });
|
|
56
|
+
viewRef.current = view;
|
|
57
|
+
return () => {
|
|
58
|
+
view.destroy();
|
|
59
|
+
viewRef.current = null;
|
|
60
|
+
};
|
|
61
|
+
}, [documentKey, languageKey, lineEnding]);
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const view = viewRef.current;
|
|
65
|
+
if (!view || !active) return;
|
|
66
|
+
// Hidden→visible: geometry was 0 or stale; remeasure so scrollbars/cursor align.
|
|
67
|
+
view.requestMeasure();
|
|
68
|
+
view.focus();
|
|
69
|
+
}, [active, documentKey, languageKey, lineEnding]);
|
|
70
|
+
|
|
71
|
+
return <div ref={hostRef} className="min-h-0 h-full w-full flex-1 overflow-hidden bg-background" />;
|
|
72
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Button, cn } from "@vetta-org/ui";
|
|
2
|
+
import type { JSX, ReactNode } from "react";
|
|
3
|
+
import { TextCodeEditorView } from "./TextCodeEditorView";
|
|
4
|
+
|
|
5
|
+
export type TextFileEditorMode = "edit" | "preview";
|
|
6
|
+
|
|
7
|
+
export interface TextFileEditorViewLabels {
|
|
8
|
+
loading: string;
|
|
9
|
+
edit: string;
|
|
10
|
+
preview: string;
|
|
11
|
+
save: string;
|
|
12
|
+
reload: string;
|
|
13
|
+
overwrite: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type TextFileEditorViewState =
|
|
17
|
+
| { status: "loading" }
|
|
18
|
+
| { status: "error"; message: string }
|
|
19
|
+
| {
|
|
20
|
+
status: "ready";
|
|
21
|
+
mode: TextFileEditorMode;
|
|
22
|
+
statusLabel: string;
|
|
23
|
+
dirty: boolean;
|
|
24
|
+
saving: boolean;
|
|
25
|
+
hasConflict: boolean;
|
|
26
|
+
conflictMessage: string;
|
|
27
|
+
inlineError?: string;
|
|
28
|
+
documentKey: string;
|
|
29
|
+
content: string;
|
|
30
|
+
extension: string;
|
|
31
|
+
lineEnding: "lf" | "crlf";
|
|
32
|
+
/**
|
|
33
|
+
* When set, host can switch to a rendered preview surface.
|
|
34
|
+
* When omitted, the toolbar has no edit/preview toggle (source-only).
|
|
35
|
+
*/
|
|
36
|
+
previewContent?: ReactNode;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface TextFileEditorViewProps {
|
|
40
|
+
state: TextFileEditorViewState;
|
|
41
|
+
labels: TextFileEditorViewLabels;
|
|
42
|
+
onModeChange: (mode: TextFileEditorMode) => void;
|
|
43
|
+
onChange: (content: string) => void;
|
|
44
|
+
onSave: () => void;
|
|
45
|
+
onReload: () => void;
|
|
46
|
+
onOverwrite: () => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function TextFileEditorView({
|
|
50
|
+
state,
|
|
51
|
+
labels,
|
|
52
|
+
onModeChange,
|
|
53
|
+
onChange,
|
|
54
|
+
onSave,
|
|
55
|
+
onReload,
|
|
56
|
+
onOverwrite,
|
|
57
|
+
}: TextFileEditorViewProps): JSX.Element {
|
|
58
|
+
if (state.status === "loading") {
|
|
59
|
+
return (
|
|
60
|
+
<div className="flex min-h-0 flex-1 items-center justify-center gap-2 text-[13px] text-muted-foreground">
|
|
61
|
+
<span className="icon-[solar--refresh-linear] h-3.5 w-3.5 animate-spin text-primary" />
|
|
62
|
+
{labels.loading}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (state.status === "error") {
|
|
68
|
+
return (
|
|
69
|
+
<div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-4 text-center">
|
|
70
|
+
<div className="flex size-10 items-center justify-center rounded-xl border border-destructive/20 bg-destructive/10">
|
|
71
|
+
<span className="icon-[solar--danger-triangle-linear] h-5 w-5 text-destructive" />
|
|
72
|
+
</div>
|
|
73
|
+
<p className="max-w-72 text-[13px] leading-relaxed text-muted-foreground">{state.message}</p>
|
|
74
|
+
<Button variant="outline" size="sm" onClick={onReload}>
|
|
75
|
+
<span className="icon-[solar--refresh-linear] h-3.5 w-3.5" />
|
|
76
|
+
{labels.reload}
|
|
77
|
+
</Button>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const hasPreview = state.previewContent != null;
|
|
83
|
+
const showPreview = hasPreview && state.mode === "preview";
|
|
84
|
+
|
|
85
|
+
const editor = (
|
|
86
|
+
<TextCodeEditorView
|
|
87
|
+
documentKey={state.documentKey}
|
|
88
|
+
initialValue={state.content}
|
|
89
|
+
extension={state.extension}
|
|
90
|
+
lineEnding={state.lineEnding}
|
|
91
|
+
onChange={onChange}
|
|
92
|
+
active={!showPreview}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div className="flex min-h-0 flex-1 flex-col bg-background">
|
|
98
|
+
<div className="flex min-h-9 shrink-0 items-center gap-1.5 border-b border-border/40 bg-card/30 px-2">
|
|
99
|
+
{hasPreview ? (
|
|
100
|
+
<div className="flex items-center rounded-lg border border-border/40 bg-muted/40 p-0.5">
|
|
101
|
+
<Button
|
|
102
|
+
variant="ghost"
|
|
103
|
+
size="xs"
|
|
104
|
+
aria-pressed={state.mode === "edit"}
|
|
105
|
+
className={
|
|
106
|
+
state.mode === "edit"
|
|
107
|
+
? "bg-background text-foreground shadow-xs hover:bg-background"
|
|
108
|
+
: "text-muted-foreground"
|
|
109
|
+
}
|
|
110
|
+
onClick={() => onModeChange("edit")}
|
|
111
|
+
>
|
|
112
|
+
<span className="icon-[solar--pen-2-linear] h-3 w-3" />
|
|
113
|
+
{labels.edit}
|
|
114
|
+
</Button>
|
|
115
|
+
<Button
|
|
116
|
+
variant="ghost"
|
|
117
|
+
size="xs"
|
|
118
|
+
aria-pressed={state.mode === "preview"}
|
|
119
|
+
className={
|
|
120
|
+
state.mode === "preview"
|
|
121
|
+
? "bg-background text-foreground shadow-xs hover:bg-background"
|
|
122
|
+
: "text-muted-foreground"
|
|
123
|
+
}
|
|
124
|
+
onClick={() => onModeChange("preview")}
|
|
125
|
+
>
|
|
126
|
+
<span className="icon-[solar--eye-linear] h-3 w-3" />
|
|
127
|
+
{labels.preview}
|
|
128
|
+
</Button>
|
|
129
|
+
</div>
|
|
130
|
+
) : null}
|
|
131
|
+
<div
|
|
132
|
+
className={`flex min-w-0 flex-1 items-center gap-1.5 ${state.dirty || state.saving ? "text-primary" : "text-muted-foreground"}`}
|
|
133
|
+
aria-live="polite"
|
|
134
|
+
>
|
|
135
|
+
<span
|
|
136
|
+
className={
|
|
137
|
+
state.saving
|
|
138
|
+
? "icon-[solar--refresh-linear] size-3 shrink-0 animate-spin"
|
|
139
|
+
: state.dirty
|
|
140
|
+
? "icon-[solar--pen-new-square-linear] size-3 shrink-0"
|
|
141
|
+
: "icon-[solar--check-circle-linear] size-3 shrink-0"
|
|
142
|
+
}
|
|
143
|
+
/>
|
|
144
|
+
<span className="truncate text-[11px]">{state.statusLabel}</span>
|
|
145
|
+
</div>
|
|
146
|
+
<Button
|
|
147
|
+
variant={state.dirty ? "primary" : "ghost"}
|
|
148
|
+
size="xs"
|
|
149
|
+
disabled={!state.dirty || state.saving || state.hasConflict}
|
|
150
|
+
onClick={onSave}
|
|
151
|
+
>
|
|
152
|
+
<span className="icon-[solar--diskette-linear] h-3 w-3" />
|
|
153
|
+
{labels.save}
|
|
154
|
+
</Button>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{state.hasConflict ? (
|
|
158
|
+
<div
|
|
159
|
+
className="mx-2 mt-2 shrink-0 rounded-lg border border-destructive/30 bg-destructive/10 p-2"
|
|
160
|
+
role="alert"
|
|
161
|
+
>
|
|
162
|
+
<div className="flex items-start gap-2">
|
|
163
|
+
<span className="icon-[solar--danger-triangle-linear] mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive" />
|
|
164
|
+
<p className="min-w-0 flex-1 text-[11px] leading-relaxed text-destructive">
|
|
165
|
+
{state.conflictMessage}
|
|
166
|
+
</p>
|
|
167
|
+
</div>
|
|
168
|
+
<div className="mt-1.5 flex justify-end gap-1">
|
|
169
|
+
<Button variant="outline" size="xs" onClick={onReload}>
|
|
170
|
+
{labels.reload}
|
|
171
|
+
</Button>
|
|
172
|
+
<Button variant="destructive" size="xs" onClick={onOverwrite}>
|
|
173
|
+
{labels.overwrite}
|
|
174
|
+
</Button>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
) : null}
|
|
178
|
+
|
|
179
|
+
{state.inlineError ? (
|
|
180
|
+
<div
|
|
181
|
+
className="mx-2 mt-2 flex shrink-0 items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-[11px] leading-relaxed text-destructive"
|
|
182
|
+
role="alert"
|
|
183
|
+
>
|
|
184
|
+
<span className="icon-[solar--danger-circle-linear] mt-0.5 size-3.5 shrink-0" />
|
|
185
|
+
<span>{state.inlineError}</span>
|
|
186
|
+
</div>
|
|
187
|
+
) : null}
|
|
188
|
+
|
|
189
|
+
{/*
|
|
190
|
+
* Keep CodeMirror mounted under preview so undo/redo survives mode switches.
|
|
191
|
+
* Stack with absolute + invisible (not display:none) so the editor keeps a real size.
|
|
192
|
+
*/}
|
|
193
|
+
{hasPreview ? (
|
|
194
|
+
<div className="relative min-h-0 flex-1">
|
|
195
|
+
<div
|
|
196
|
+
className={cn(
|
|
197
|
+
"absolute inset-0 flex min-h-0 flex-col",
|
|
198
|
+
showPreview && "invisible pointer-events-none",
|
|
199
|
+
)}
|
|
200
|
+
aria-hidden={showPreview}
|
|
201
|
+
>
|
|
202
|
+
{editor}
|
|
203
|
+
</div>
|
|
204
|
+
{showPreview ? (
|
|
205
|
+
<div className="absolute inset-0 flex min-h-0 flex-col">{state.previewContent}</div>
|
|
206
|
+
) : null}
|
|
207
|
+
</div>
|
|
208
|
+
) : (
|
|
209
|
+
editor
|
|
210
|
+
)}
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
FilePreviewDialogViewLabels,
|
|
3
|
+
FilePreviewDialogViewProps,
|
|
4
|
+
} from "./FilePreviewDialogView";
|
|
5
|
+
export {
|
|
6
|
+
FilePreviewDialogView,
|
|
7
|
+
OverlayArrow,
|
|
8
|
+
OverlayButton,
|
|
9
|
+
ThumbnailView,
|
|
10
|
+
} from "./FilePreviewDialogView";
|
|
11
|
+
export type { FilePreviewViewLabels, FilePreviewViewProps } from "./FilePreviewView";
|
|
12
|
+
export { FilePreviewView } from "./FilePreviewView";
|
|
13
|
+
export { isEditableKeyboardTarget } from "./keyboard-target";
|
|
14
|
+
export type { LightboxImageViewProps } from "./LightboxImageView";
|
|
15
|
+
export { LightboxImageView } from "./LightboxImageView";
|
|
16
|
+
export type { PluginFilePreviewViewProps } from "./PluginFilePreviewView";
|
|
17
|
+
export { PluginFilePreviewView } from "./PluginFilePreviewView";
|
|
18
|
+
export type {
|
|
19
|
+
PreviewBodyViewLabels,
|
|
20
|
+
PreviewBodyViewProps,
|
|
21
|
+
PreviewBodyViewState,
|
|
22
|
+
} from "./PreviewBodyView";
|
|
23
|
+
export { PreviewBodyView } from "./PreviewBodyView";
|
|
24
|
+
export type { PreviewErrorBoundaryProps } from "./PreviewErrorBoundary";
|
|
25
|
+
export { PreviewErrorBoundary } from "./PreviewErrorBoundary";
|
|
26
|
+
export type { SyntaxTokenId } from "./syntax-tokens";
|
|
27
|
+
export {
|
|
28
|
+
SYNTAX_PALETTE_VSCODE_DARK,
|
|
29
|
+
SYNTAX_PALETTE_VSCODE_LIGHT,
|
|
30
|
+
SYNTAX_TOKEN_CSS_VARS,
|
|
31
|
+
SYNTAX_TOKEN_IDS,
|
|
32
|
+
syntaxPaletteToCssDeclarations,
|
|
33
|
+
syntaxVar,
|
|
34
|
+
} from "./syntax-tokens";
|
|
35
|
+
export type { TextCodeEditorViewProps } from "./TextCodeEditorView";
|
|
36
|
+
export { TextCodeEditorView } from "./TextCodeEditorView";
|
|
37
|
+
export type {
|
|
38
|
+
TextFileEditorMode,
|
|
39
|
+
TextFileEditorViewLabels,
|
|
40
|
+
TextFileEditorViewProps,
|
|
41
|
+
TextFileEditorViewState,
|
|
42
|
+
} from "./TextFileEditorView";
|
|
43
|
+
export { TextFileEditorView } from "./TextFileEditorView";
|
|
44
|
+
export {
|
|
45
|
+
getTextEditorLanguageExtension,
|
|
46
|
+
getTextEditorLanguageId,
|
|
47
|
+
normalizeFileExtension,
|
|
48
|
+
} from "./text-editor-language";
|
|
49
|
+
export type { FilePreviewContext, FilePreviewItem, FilePreviewKind } from "./types";
|
|
50
|
+
export {
|
|
51
|
+
AUDIO_EXTENSIONS,
|
|
52
|
+
getExtension,
|
|
53
|
+
getPreviewLabel,
|
|
54
|
+
IMAGE_EXTENSIONS,
|
|
55
|
+
VIDEO_EXTENSIONS,
|
|
56
|
+
} from "./types";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { isEditableKeyboardTarget } from "./keyboard-target";
|
|
3
|
+
|
|
4
|
+
describe("isEditableKeyboardTarget", () => {
|
|
5
|
+
test("null / non-object → false", () => {
|
|
6
|
+
expect(isEditableKeyboardTarget(null)).toBe(false);
|
|
7
|
+
expect(isEditableKeyboardTarget("x" as unknown as EventTarget)).toBe(false);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test("input and textarea", () => {
|
|
11
|
+
expect(isEditableKeyboardTarget({ tagName: "INPUT" } as unknown as EventTarget)).toBe(true);
|
|
12
|
+
expect(isEditableKeyboardTarget({ tagName: "TEXTAREA" } as unknown as EventTarget)).toBe(true);
|
|
13
|
+
expect(isEditableKeyboardTarget({ tagName: "INPUT", readOnly: true } as unknown as EventTarget)).toBe(false);
|
|
14
|
+
expect(isEditableKeyboardTarget({ tagName: "INPUT", disabled: true } as unknown as EventTarget)).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("contenteditable and CodeMirror surfaces", () => {
|
|
18
|
+
expect(
|
|
19
|
+
isEditableKeyboardTarget({
|
|
20
|
+
tagName: "DIV",
|
|
21
|
+
isContentEditable: true,
|
|
22
|
+
} as unknown as EventTarget),
|
|
23
|
+
).toBe(true);
|
|
24
|
+
|
|
25
|
+
expect(
|
|
26
|
+
isEditableKeyboardTarget({
|
|
27
|
+
tagName: "SPAN",
|
|
28
|
+
isContentEditable: false,
|
|
29
|
+
closest: (sel: string) => (sel.includes(".cm-editor") ? ({} as Element) : null),
|
|
30
|
+
} as unknown as EventTarget),
|
|
31
|
+
).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("plain div is not editable", () => {
|
|
35
|
+
expect(
|
|
36
|
+
isEditableKeyboardTarget({
|
|
37
|
+
tagName: "DIV",
|
|
38
|
+
isContentEditable: false,
|
|
39
|
+
closest: () => null,
|
|
40
|
+
} as unknown as EventTarget),
|
|
41
|
+
).toBe(false);
|
|
42
|
+
expect(
|
|
43
|
+
isEditableKeyboardTarget({
|
|
44
|
+
tagName: "BUTTON",
|
|
45
|
+
closest: () => null,
|
|
46
|
+
} as unknown as EventTarget),
|
|
47
|
+
).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a keydown target is (or is inside) an editable surface.
|
|
3
|
+
* Used so preview/gallery shortcuts do not steal arrow keys from CodeMirror / inputs.
|
|
4
|
+
*
|
|
5
|
+
* Duck-typed so unit tests can run in node without a DOM environment.
|
|
6
|
+
*/
|
|
7
|
+
export function isEditableKeyboardTarget(target: EventTarget | null): boolean {
|
|
8
|
+
if (target == null || typeof target !== "object") return false;
|
|
9
|
+
|
|
10
|
+
const node = target as {
|
|
11
|
+
tagName?: string;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
isContentEditable?: boolean;
|
|
15
|
+
closest?: (selector: string) => Element | null;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const tag = typeof node.tagName === "string" ? node.tagName.toUpperCase() : "";
|
|
19
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") {
|
|
20
|
+
return !node.readOnly && !node.disabled;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (node.isContentEditable === true) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// CodeMirror 6 uses contenteditable .cm-content; also cover role=textbox hosts.
|
|
28
|
+
if (typeof node.closest === "function") {
|
|
29
|
+
return Boolean(node.closest(".cm-editor, .cm-content, [contenteditable='true'], [role='textbox']"));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default syntax palettes for the file text editor (CodeMirror).
|
|
3
|
+
* Inspired by VS Code Dark+ / Light+.
|
|
4
|
+
*
|
|
5
|
+
* Hosts that already define `[data-mode]` can rely on these as baselines.
|
|
6
|
+
* Themes override any subset, e.g.:
|
|
7
|
+
*
|
|
8
|
+
* [data-theme="xianxia"] {
|
|
9
|
+
* --syntax-keyword: #c9a227;
|
|
10
|
+
* --syntax-string: #7d9b76;
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
:root,
|
|
15
|
+
[data-mode="dark"] {
|
|
16
|
+
/* VS Code Dark+ */
|
|
17
|
+
--syntax-comment: #6a9955;
|
|
18
|
+
--syntax-keyword: #569cd6;
|
|
19
|
+
--syntax-keyword-control: #c586c0;
|
|
20
|
+
--syntax-storage: #569cd6;
|
|
21
|
+
--syntax-string: #ce9178;
|
|
22
|
+
--syntax-number: #b5cea8;
|
|
23
|
+
--syntax-bool: #569cd6;
|
|
24
|
+
--syntax-regexp: #d16969;
|
|
25
|
+
--syntax-type: #4ec9b0;
|
|
26
|
+
--syntax-class: #4ec9b0;
|
|
27
|
+
--syntax-function: #dcdcaa;
|
|
28
|
+
--syntax-variable: #9cdcfe;
|
|
29
|
+
--syntax-constant: #4fc1ff;
|
|
30
|
+
--syntax-property: #9cdcfe;
|
|
31
|
+
--syntax-parameter: #9cdcfe;
|
|
32
|
+
--syntax-operator: #d4d4d4;
|
|
33
|
+
--syntax-punctuation: #d4d4d4;
|
|
34
|
+
--syntax-tag: #569cd6;
|
|
35
|
+
--syntax-attribute: #9cdcfe;
|
|
36
|
+
--syntax-attribute-value: #ce9178;
|
|
37
|
+
--syntax-angle: #808080;
|
|
38
|
+
--syntax-meta: #569cd6;
|
|
39
|
+
--syntax-escape: #d7ba7d;
|
|
40
|
+
--syntax-link: #3794ff;
|
|
41
|
+
--syntax-heading: #569cd6;
|
|
42
|
+
--syntax-invalid: #f44747;
|
|
43
|
+
--syntax-inserted: #b5cea8;
|
|
44
|
+
--syntax-deleted: #f44747;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-mode="light"] {
|
|
48
|
+
/* VS Code Light+ */
|
|
49
|
+
--syntax-comment: #008000;
|
|
50
|
+
--syntax-keyword: #0000ff;
|
|
51
|
+
--syntax-keyword-control: #af00db;
|
|
52
|
+
--syntax-storage: #0000ff;
|
|
53
|
+
--syntax-string: #a31515;
|
|
54
|
+
--syntax-number: #098658;
|
|
55
|
+
--syntax-bool: #0000ff;
|
|
56
|
+
--syntax-regexp: #811f3f;
|
|
57
|
+
--syntax-type: #267f99;
|
|
58
|
+
--syntax-class: #267f99;
|
|
59
|
+
--syntax-function: #795e26;
|
|
60
|
+
--syntax-variable: #001080;
|
|
61
|
+
--syntax-constant: #0070c1;
|
|
62
|
+
--syntax-property: #001080;
|
|
63
|
+
--syntax-parameter: #001080;
|
|
64
|
+
--syntax-operator: #000000;
|
|
65
|
+
--syntax-punctuation: #000000;
|
|
66
|
+
--syntax-tag: #800000;
|
|
67
|
+
--syntax-attribute: #e50000;
|
|
68
|
+
--syntax-attribute-value: #0000ff;
|
|
69
|
+
--syntax-angle: #800000;
|
|
70
|
+
--syntax-meta: #0000ff;
|
|
71
|
+
--syntax-escape: #ee0000;
|
|
72
|
+
--syntax-link: #0000ff;
|
|
73
|
+
--syntax-heading: #800000;
|
|
74
|
+
--syntax-invalid: #cd3131;
|
|
75
|
+
--syntax-inserted: #098658;
|
|
76
|
+
--syntax-deleted: #cd3131;
|
|
77
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
SYNTAX_PALETTE_VSCODE_DARK,
|
|
4
|
+
SYNTAX_PALETTE_VSCODE_LIGHT,
|
|
5
|
+
SYNTAX_TOKEN_CSS_VARS,
|
|
6
|
+
SYNTAX_TOKEN_IDS,
|
|
7
|
+
syntaxPaletteToCssDeclarations,
|
|
8
|
+
syntaxVar,
|
|
9
|
+
} from "./syntax-tokens";
|
|
10
|
+
|
|
11
|
+
describe("syntax tokens", () => {
|
|
12
|
+
test("every token has a CSS var and both palettes", () => {
|
|
13
|
+
for (const id of SYNTAX_TOKEN_IDS) {
|
|
14
|
+
expect(SYNTAX_TOKEN_CSS_VARS[id]).toMatch(/^--syntax-/);
|
|
15
|
+
expect(SYNTAX_PALETTE_VSCODE_DARK[id]).toMatch(/^#/);
|
|
16
|
+
expect(SYNTAX_PALETTE_VSCODE_LIGHT[id]).toMatch(/^#/);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("syntaxVar wraps the custom property", () => {
|
|
21
|
+
expect(syntaxVar("keyword")).toBe("var(--syntax-keyword)");
|
|
22
|
+
expect(syntaxVar("tag")).toBe("var(--syntax-tag)");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("palette serializes to CSS declarations", () => {
|
|
26
|
+
const css = syntaxPaletteToCssDeclarations(SYNTAX_PALETTE_VSCODE_DARK);
|
|
27
|
+
expect(css).toContain("--syntax-keyword: #569CD6;");
|
|
28
|
+
expect(css).toContain("--syntax-string: #CE9178;");
|
|
29
|
+
expect(css.split("\n").length).toBe(SYNTAX_TOKEN_IDS.length);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax highlight tokens for the file text editor (CodeMirror).
|
|
3
|
+
*
|
|
4
|
+
* Design:
|
|
5
|
+
* - Colors are CSS custom properties (`--syntax-*`), so any host theme can override
|
|
6
|
+
* a subset without touching CodeMirror code.
|
|
7
|
+
* - Defaults (VS Code Dark+ / Light+) live in host CSS (`:root` / `[data-mode="light"]`).
|
|
8
|
+
* - HighlightStyle only references `var(--syntax-…)`; changing theme mode updates live.
|
|
9
|
+
*
|
|
10
|
+
* Theme authors: set any of {@link SYNTAX_TOKEN_CSS_VARS} on `:root`, `[data-mode]`,
|
|
11
|
+
* or `[data-theme="…"]`. Unset tokens fall back to the host defaults.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const SYNTAX_TOKEN_CSS_VARS = {
|
|
15
|
+
/** Line / block comments */
|
|
16
|
+
comment: "--syntax-comment",
|
|
17
|
+
/** Language keywords (import, return, const, …) */
|
|
18
|
+
keyword: "--syntax-keyword",
|
|
19
|
+
/** Control-flow keywords (if, else, for, while, …) */
|
|
20
|
+
keywordControl: "--syntax-keyword-control",
|
|
21
|
+
/** Storage / definition keywords (class, function, type, …) */
|
|
22
|
+
storage: "--syntax-storage",
|
|
23
|
+
/** String literals */
|
|
24
|
+
string: "--syntax-string",
|
|
25
|
+
/** Numbers */
|
|
26
|
+
number: "--syntax-number",
|
|
27
|
+
/** Boolean / null / undefined atoms */
|
|
28
|
+
bool: "--syntax-bool",
|
|
29
|
+
/** Regular expressions */
|
|
30
|
+
regexp: "--syntax-regexp",
|
|
31
|
+
/** Type names, interfaces, type params */
|
|
32
|
+
type: "--syntax-type",
|
|
33
|
+
/** Class names */
|
|
34
|
+
className: "--syntax-class",
|
|
35
|
+
/** Function / method names */
|
|
36
|
+
function: "--syntax-function",
|
|
37
|
+
/** Variables */
|
|
38
|
+
variable: "--syntax-variable",
|
|
39
|
+
/** Constants / enum members */
|
|
40
|
+
constant: "--syntax-constant",
|
|
41
|
+
/** Object / struct properties */
|
|
42
|
+
property: "--syntax-property",
|
|
43
|
+
/** Function parameters */
|
|
44
|
+
parameter: "--syntax-parameter",
|
|
45
|
+
/** Operators (+, ===, =>, …) */
|
|
46
|
+
operator: "--syntax-operator",
|
|
47
|
+
/** Punctuation and brackets */
|
|
48
|
+
punctuation: "--syntax-punctuation",
|
|
49
|
+
/** HTML/XML/JSX tag names */
|
|
50
|
+
tag: "--syntax-tag",
|
|
51
|
+
/** HTML/XML/JSX attribute names */
|
|
52
|
+
attribute: "--syntax-attribute",
|
|
53
|
+
/** Attribute values */
|
|
54
|
+
attributeValue: "--syntax-attribute-value",
|
|
55
|
+
/** Angle brackets around tags: < > </> */
|
|
56
|
+
angle: "--syntax-angle",
|
|
57
|
+
/** Meta / preprocessor / annotations / doctype */
|
|
58
|
+
meta: "--syntax-meta",
|
|
59
|
+
/** Escape sequences inside strings */
|
|
60
|
+
escape: "--syntax-escape",
|
|
61
|
+
/** Links (markdown / urls) */
|
|
62
|
+
link: "--syntax-link",
|
|
63
|
+
/** Markdown headings */
|
|
64
|
+
heading: "--syntax-heading",
|
|
65
|
+
/** Invalid / error tokens */
|
|
66
|
+
invalid: "--syntax-invalid",
|
|
67
|
+
/** Diff inserted */
|
|
68
|
+
inserted: "--syntax-inserted",
|
|
69
|
+
/** Diff deleted */
|
|
70
|
+
deleted: "--syntax-deleted",
|
|
71
|
+
} as const;
|
|
72
|
+
|
|
73
|
+
export type SyntaxTokenId = keyof typeof SYNTAX_TOKEN_CSS_VARS;
|
|
74
|
+
|
|
75
|
+
/** Ordered list of token ids — useful for docs / theme pickers. */
|
|
76
|
+
export const SYNTAX_TOKEN_IDS = Object.keys(SYNTAX_TOKEN_CSS_VARS) as SyntaxTokenId[];
|
|
77
|
+
|
|
78
|
+
export function syntaxVar(token: SyntaxTokenId): string {
|
|
79
|
+
return `var(${SYNTAX_TOKEN_CSS_VARS[token]})`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* VS Code Dark+ inspired defaults (dark_vs / dark_plus).
|
|
84
|
+
* Hosts should inject these under `:root` / `[data-mode="dark"]`.
|
|
85
|
+
*/
|
|
86
|
+
export const SYNTAX_PALETTE_VSCODE_DARK: Record<SyntaxTokenId, string> = {
|
|
87
|
+
comment: "#6A9955",
|
|
88
|
+
keyword: "#569CD6",
|
|
89
|
+
keywordControl: "#C586C0",
|
|
90
|
+
storage: "#569CD6",
|
|
91
|
+
string: "#CE9178",
|
|
92
|
+
number: "#B5CEA8",
|
|
93
|
+
bool: "#569CD6",
|
|
94
|
+
regexp: "#D16969",
|
|
95
|
+
type: "#4EC9B0",
|
|
96
|
+
className: "#4EC9B0",
|
|
97
|
+
function: "#DCDCAA",
|
|
98
|
+
variable: "#9CDCFE",
|
|
99
|
+
constant: "#4FC1FF",
|
|
100
|
+
property: "#9CDCFE",
|
|
101
|
+
parameter: "#9CDCFE",
|
|
102
|
+
operator: "#D4D4D4",
|
|
103
|
+
punctuation: "#D4D4D4",
|
|
104
|
+
tag: "#569CD6",
|
|
105
|
+
attribute: "#9CDCFE",
|
|
106
|
+
attributeValue: "#CE9178",
|
|
107
|
+
angle: "#808080",
|
|
108
|
+
meta: "#569CD6",
|
|
109
|
+
escape: "#D7BA7D",
|
|
110
|
+
link: "#3794FF",
|
|
111
|
+
heading: "#569CD6",
|
|
112
|
+
invalid: "#F44747",
|
|
113
|
+
inserted: "#B5CEA8",
|
|
114
|
+
deleted: "#F44747",
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* VS Code Light+ inspired defaults (light_vs / light_plus).
|
|
119
|
+
* Hosts should inject these under `[data-mode="light"]`.
|
|
120
|
+
*/
|
|
121
|
+
export const SYNTAX_PALETTE_VSCODE_LIGHT: Record<SyntaxTokenId, string> = {
|
|
122
|
+
comment: "#008000",
|
|
123
|
+
keyword: "#0000FF",
|
|
124
|
+
keywordControl: "#AF00DB",
|
|
125
|
+
storage: "#0000FF",
|
|
126
|
+
string: "#A31515",
|
|
127
|
+
number: "#098658",
|
|
128
|
+
bool: "#0000FF",
|
|
129
|
+
regexp: "#811F3F",
|
|
130
|
+
type: "#267F99",
|
|
131
|
+
className: "#267F99",
|
|
132
|
+
function: "#795E26",
|
|
133
|
+
variable: "#001080",
|
|
134
|
+
constant: "#0070C1",
|
|
135
|
+
property: "#001080",
|
|
136
|
+
parameter: "#001080",
|
|
137
|
+
operator: "#000000",
|
|
138
|
+
punctuation: "#000000",
|
|
139
|
+
tag: "#800000",
|
|
140
|
+
attribute: "#E50000",
|
|
141
|
+
attributeValue: "#0000FF",
|
|
142
|
+
angle: "#800000",
|
|
143
|
+
meta: "#0000FF",
|
|
144
|
+
escape: "#EE0000",
|
|
145
|
+
link: "#0000FF",
|
|
146
|
+
heading: "#800000",
|
|
147
|
+
invalid: "#CD3131",
|
|
148
|
+
inserted: "#098658",
|
|
149
|
+
deleted: "#CD3131",
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/** Serialize a palette to CSS custom-property declarations (no surrounding block). */
|
|
153
|
+
export function syntaxPaletteToCssDeclarations(palette: Record<SyntaxTokenId, string>): string {
|
|
154
|
+
return SYNTAX_TOKEN_IDS.map((id) => `\t${SYNTAX_TOKEN_CSS_VARS[id]}: ${palette[id]};`).join("\n");
|
|
155
|
+
}
|