@qwen-code/qwen-code 0.0.2 → 0.0.4-nightly.1
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/dist/package.json +6 -4
- package/dist/qwen-code-qwen-code-0.0.3.tgz +0 -0
- package/dist/src/acp/acp.d.ts +208 -0
- package/dist/src/acp/acp.js +193 -0
- package/dist/src/acp/acp.js.map +1 -0
- package/dist/src/acp/acpPeer.d.ts +8 -0
- package/dist/src/acp/acpPeer.js +537 -0
- package/dist/src/acp/acpPeer.js.map +1 -0
- package/dist/src/config/config.d.ts +5 -2
- package/dist/src/config/config.js +70 -28
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/extension.d.ts +2 -2
- package/dist/src/config/extension.js +21 -16
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/settings.d.ts +22 -15
- package/dist/src/config/settings.js +25 -10
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.d.ts +1 -0
- package/dist/src/gemini.js +31 -49
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +0 -67
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/patches/is-in-ci.d.ts +7 -0
- package/dist/src/patches/is-in-ci.js +15 -0
- package/dist/src/patches/is-in-ci.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
- package/dist/src/services/BuiltinCommandLoader.js +72 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
- package/dist/src/services/CommandService.d.ts +43 -5
- package/dist/src/services/CommandService.js +61 -25
- package/dist/src/services/CommandService.js.map +1 -1
- package/dist/src/services/FileCommandLoader.d.ts +37 -0
- package/dist/src/services/FileCommandLoader.js +179 -0
- package/dist/src/services/FileCommandLoader.js.map +1 -0
- package/dist/src/services/McpPromptLoader.d.ts +25 -0
- package/dist/src/services/McpPromptLoader.js +192 -0
- package/dist/src/services/McpPromptLoader.js.map +1 -0
- package/dist/src/services/prompt-processors/argumentProcessor.d.ts +21 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js +28 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/shellProcessor.d.ts +32 -0
- package/dist/src/services/prompt-processors/shellProcessor.js +77 -0
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/types.d.ts +38 -0
- package/dist/src/services/prompt-processors/types.js +14 -0
- package/dist/src/services/prompt-processors/types.js.map +1 -0
- package/dist/src/services/types.d.ts +22 -0
- package/dist/src/services/types.js +7 -0
- package/dist/src/services/types.js.map +1 -0
- package/dist/src/ui/App.js +130 -101
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/colors.js +6 -0
- package/dist/src/ui/colors.js.map +1 -1
- package/dist/src/ui/commands/aboutCommand.js +2 -0
- package/dist/src/ui/commands/aboutCommand.js.map +1 -1
- package/dist/src/ui/commands/authCommand.js +2 -0
- package/dist/src/ui/commands/authCommand.js.map +1 -1
- package/dist/src/ui/commands/bugCommand.d.ts +7 -0
- package/dist/src/ui/commands/bugCommand.js +63 -0
- package/dist/src/ui/commands/bugCommand.js.map +1 -0
- package/dist/src/ui/commands/chatCommand.d.ts +7 -0
- package/dist/src/ui/commands/chatCommand.js +179 -0
- package/dist/src/ui/commands/chatCommand.js.map +1 -0
- package/dist/src/ui/commands/clearCommand.js +14 -2
- package/dist/src/ui/commands/clearCommand.js.map +1 -1
- package/dist/src/ui/commands/compressCommand.d.ts +7 -0
- package/dist/src/ui/commands/compressCommand.js +64 -0
- package/dist/src/ui/commands/compressCommand.js.map +1 -0
- package/dist/src/ui/commands/copyCommand.d.ts +7 -0
- package/dist/src/ui/commands/copyCommand.js +59 -0
- package/dist/src/ui/commands/copyCommand.js.map +1 -0
- package/dist/src/ui/commands/corgiCommand.d.ts +7 -0
- package/dist/src/ui/commands/corgiCommand.js +15 -0
- package/dist/src/ui/commands/corgiCommand.js.map +1 -0
- package/dist/src/ui/commands/docsCommand.d.ts +7 -0
- package/dist/src/ui/commands/docsCommand.js +31 -0
- package/dist/src/ui/commands/docsCommand.js.map +1 -0
- package/dist/src/ui/commands/editorCommand.d.ts +7 -0
- package/dist/src/ui/commands/editorCommand.js +16 -0
- package/dist/src/ui/commands/editorCommand.js.map +1 -0
- package/dist/src/ui/commands/extensionsCommand.d.ts +7 -0
- package/dist/src/ui/commands/extensionsCommand.js +31 -0
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -0
- package/dist/src/ui/commands/helpCommand.js +4 -2
- package/dist/src/ui/commands/helpCommand.js.map +1 -1
- package/dist/src/ui/commands/ideCommand.d.ts +8 -0
- package/dist/src/ui/commands/ideCommand.js +121 -0
- package/dist/src/ui/commands/ideCommand.js.map +1 -0
- package/dist/src/ui/commands/mcpCommand.d.ts +7 -0
- package/dist/src/ui/commands/mcpCommand.js +425 -0
- package/dist/src/ui/commands/mcpCommand.js.map +1 -0
- package/dist/src/ui/commands/memoryCommand.js +11 -4
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/privacyCommand.js +2 -0
- package/dist/src/ui/commands/privacyCommand.js.map +1 -1
- package/dist/src/ui/commands/quitCommand.d.ts +7 -0
- package/dist/src/ui/commands/quitCommand.js +34 -0
- package/dist/src/ui/commands/quitCommand.js.map +1 -0
- package/dist/src/ui/commands/restoreCommand.d.ts +8 -0
- package/dist/src/ui/commands/restoreCommand.js +128 -0
- package/dist/src/ui/commands/restoreCommand.js.map +1 -0
- package/dist/src/ui/commands/statsCommand.d.ts +7 -0
- package/dist/src/ui/commands/statsCommand.js +54 -0
- package/dist/src/ui/commands/statsCommand.js.map +1 -0
- package/dist/src/ui/commands/themeCommand.js +2 -0
- package/dist/src/ui/commands/themeCommand.js.map +1 -1
- package/dist/src/ui/commands/toolsCommand.d.ts +7 -0
- package/dist/src/ui/commands/toolsCommand.js +56 -0
- package/dist/src/ui/commands/toolsCommand.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +76 -4
- package/dist/src/ui/commands/types.js +6 -1
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/commands/vimCommand.d.ts +7 -0
- package/dist/src/ui/commands/vimCommand.js +23 -0
- package/dist/src/ui/commands/vimCommand.js.map +1 -0
- package/dist/src/ui/components/AuthDialog.js +0 -1
- package/dist/src/ui/components/AuthDialog.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +6 -1
- package/dist/src/ui/components/ContextSummaryDisplay.js +46 -19
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/Footer.d.ts +1 -0
- package/dist/src/ui/components/Footer.js +2 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Header.js +1 -1
- package/dist/src/ui/components/Header.js.map +1 -1
- package/dist/src/ui/components/Help.d.ts +1 -1
- package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +11 -0
- package/dist/src/ui/components/IDEContextDetailDisplay.js +19 -0
- package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +3 -1
- package/dist/src/ui/components/InputPrompt.js +86 -123
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js +44 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.js +51 -25
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/Tips.js +1 -1
- package/dist/src/ui/components/Tips.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.js +12 -11
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +5 -4
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.js +3 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
- package/dist/src/ui/components/shared/MaxSizedBox.js +69 -2
- package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
- package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +3 -1
- package/dist/src/ui/components/shared/RadioButtonSelect.js +69 -50
- package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.d.ts +273 -3
- package/dist/src/ui/components/shared/text-buffer.js +426 -80
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js +565 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
- package/dist/src/ui/constants.d.ts +1 -0
- package/dist/src/ui/constants.js +1 -0
- package/dist/src/ui/constants.js.map +1 -1
- package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
- package/dist/src/ui/contexts/VimModeContext.js +48 -0
- package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +54 -15
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +2 -1
- package/dist/src/ui/hooks/shellCommandProcessor.js +154 -177
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +9 -12
- package/dist/src/ui/hooks/slashCommandProcessor.js +203 -880
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAuthCommand.js +2 -1
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
- package/dist/src/ui/hooks/useCompletion.d.ts +4 -1
- package/dist/src/ui/hooks/useCompletion.js +137 -24
- package/dist/src/ui/hooks/useCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.js +53 -37
- package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -1
- package/dist/src/ui/hooks/useFocus.d.ts +6 -0
- package/dist/src/ui/hooks/useFocus.js +41 -0
- package/dist/src/ui/hooks/useFocus.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.js +57 -11
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useInputHistory.d.ts +1 -1
- package/dist/src/ui/hooks/useKeypress.js +5 -2
- package/dist/src/ui/hooks/useKeypress.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.js +5 -5
- package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.d.ts +3 -2
- package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
- package/dist/src/ui/hooks/useThemeCommand.js +24 -23
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/vim.d.ts +28 -0
- package/dist/src/ui/hooks/vim.js +630 -0
- package/dist/src/ui/hooks/vim.js.map +1 -0
- package/dist/src/ui/themes/ansi-light.js +3 -1
- package/dist/src/ui/themes/ansi-light.js.map +1 -1
- package/dist/src/ui/themes/ansi.js +2 -0
- package/dist/src/ui/themes/ansi.js.map +1 -1
- package/dist/src/ui/themes/atom-one-dark.js +2 -0
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
- package/dist/src/ui/themes/ayu-light.js +3 -1
- package/dist/src/ui/themes/ayu-light.js.map +1 -1
- package/dist/src/ui/themes/ayu.js +3 -1
- package/dist/src/ui/themes/ayu.js.map +1 -1
- package/dist/src/ui/themes/color-utils.d.ts +21 -0
- package/dist/src/ui/themes/color-utils.js +221 -0
- package/dist/src/ui/themes/color-utils.js.map +1 -0
- package/dist/src/ui/themes/dracula.js +2 -0
- package/dist/src/ui/themes/dracula.js.map +1 -1
- package/dist/src/ui/themes/github-dark.js +2 -0
- package/dist/src/ui/themes/github-dark.js.map +1 -1
- package/dist/src/ui/themes/github-light.js +2 -0
- package/dist/src/ui/themes/github-light.js.map +1 -1
- package/dist/src/ui/themes/googlecode.js +3 -1
- package/dist/src/ui/themes/googlecode.js.map +1 -1
- package/dist/src/ui/themes/no-color.js +3 -1
- package/dist/src/ui/themes/no-color.js.map +1 -1
- package/dist/src/ui/themes/qwen-dark.js +2 -0
- package/dist/src/ui/themes/qwen-dark.js.map +1 -1
- package/dist/src/ui/themes/qwen-light.js +2 -0
- package/dist/src/ui/themes/qwen-light.js.map +1 -1
- package/dist/src/ui/themes/shades-of-purple.d.ts +1 -1
- package/dist/src/ui/themes/shades-of-purple.js +3 -1
- package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
- package/dist/src/ui/themes/theme-manager.d.ts +31 -6
- package/dist/src/ui/themes/theme-manager.js +114 -37
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/themes/theme.d.ts +23 -3
- package/dist/src/ui/themes/theme.js +244 -182
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/themes/xcode.js +3 -1
- package/dist/src/ui/themes/xcode.js.map +1 -1
- package/dist/src/ui/types.d.ts +9 -1
- package/dist/src/ui/utils/CodeColorizer.d.ts +3 -1
- package/dist/src/ui/utils/CodeColorizer.js +23 -11
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.d.ts +1 -0
- package/dist/src/ui/utils/commandUtils.js +47 -0
- package/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/dist/src/ui/utils/errorParsing.js.map +1 -1
- package/dist/src/ui/utils/markdownUtilities.js +1 -1
- package/dist/src/ui/utils/textUtils.d.ts +0 -8
- package/dist/src/ui/utils/textUtils.js +0 -22
- package/dist/src/ui/utils/textUtils.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.js +5 -1
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -0
- package/dist/src/utils/events.js +13 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/sandbox.js +7 -3
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/userStartupWarnings.js +16 -10
- package/dist/src/utils/userStartupWarnings.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.d.ts +7 -0
- package/dist/src/validateNonInterActiveAuth.js +38 -0
- package/dist/src/validateNonInterActiveAuth.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -5
|
@@ -3,31 +3,56 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Theme, ThemeType } from './theme.js';
|
|
6
|
+
import { Theme, ThemeType, CustomTheme } from './theme.js';
|
|
7
7
|
export interface ThemeDisplay {
|
|
8
8
|
name: string;
|
|
9
9
|
type: ThemeType;
|
|
10
|
+
isCustom?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const DEFAULT_THEME: Theme;
|
|
12
13
|
declare class ThemeManager {
|
|
13
14
|
private readonly availableThemes;
|
|
14
15
|
private activeTheme;
|
|
16
|
+
private customThemes;
|
|
15
17
|
constructor();
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
19
|
+
* Loads custom themes from settings.
|
|
20
|
+
* @param customThemesSettings Custom themes from settings.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
loadCustomThemes(customThemesSettings?: Record<string, CustomTheme>): void;
|
|
20
23
|
/**
|
|
21
24
|
* Sets the active theme.
|
|
22
|
-
* @param themeName The name of the theme to
|
|
25
|
+
* @param themeName The name of the theme to set as active.
|
|
23
26
|
* @returns True if the theme was successfully set, false otherwise.
|
|
24
27
|
*/
|
|
25
28
|
setActiveTheme(themeName: string | undefined): boolean;
|
|
26
|
-
findThemeByName(themeName: string | undefined): Theme | undefined;
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
30
|
+
* Gets the currently active theme.
|
|
31
|
+
* @returns The active theme.
|
|
29
32
|
*/
|
|
30
33
|
getActiveTheme(): Theme;
|
|
34
|
+
/**
|
|
35
|
+
* Gets a list of custom theme names.
|
|
36
|
+
* @returns Array of custom theme names.
|
|
37
|
+
*/
|
|
38
|
+
getCustomThemeNames(): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a theme name is a custom theme.
|
|
41
|
+
* @param themeName The theme name to check.
|
|
42
|
+
* @returns True if the theme is custom.
|
|
43
|
+
*/
|
|
44
|
+
isCustomTheme(themeName: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a list of available theme names.
|
|
47
|
+
*/
|
|
48
|
+
getAvailableThemes(): ThemeDisplay[];
|
|
49
|
+
/**
|
|
50
|
+
* Gets a theme by name.
|
|
51
|
+
* @param themeName The name of the theme to get.
|
|
52
|
+
* @returns The theme if found, undefined otherwise.
|
|
53
|
+
*/
|
|
54
|
+
getTheme(themeName: string): Theme | undefined;
|
|
55
|
+
findThemeByName(themeName: string | undefined): Theme | undefined;
|
|
31
56
|
}
|
|
32
57
|
export declare const themeManager: ThemeManager;
|
|
33
58
|
export {};
|
|
@@ -16,6 +16,7 @@ import { ShadesOfPurple } from './shades-of-purple.js';
|
|
|
16
16
|
import { XCode } from './xcode.js';
|
|
17
17
|
import { QwenLight } from './qwen-light.js';
|
|
18
18
|
import { QwenDark } from './qwen-dark.js';
|
|
19
|
+
import { createCustomTheme, validateCustomTheme, } from './theme.js';
|
|
19
20
|
import { ANSI } from './ansi.js';
|
|
20
21
|
import { ANSILight } from './ansi-light.js';
|
|
21
22
|
import { NoColorTheme } from './no-color.js';
|
|
@@ -24,6 +25,7 @@ export const DEFAULT_THEME = QwenDark;
|
|
|
24
25
|
class ThemeManager {
|
|
25
26
|
availableThemes;
|
|
26
27
|
activeTheme;
|
|
28
|
+
customThemes = new Map();
|
|
27
29
|
constructor() {
|
|
28
30
|
this.availableThemes = [
|
|
29
31
|
AyuDark,
|
|
@@ -44,23 +46,119 @@ class ThemeManager {
|
|
|
44
46
|
];
|
|
45
47
|
this.activeTheme = DEFAULT_THEME;
|
|
46
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Loads custom themes from settings.
|
|
51
|
+
* @param customThemesSettings Custom themes from settings.
|
|
52
|
+
*/
|
|
53
|
+
loadCustomThemes(customThemesSettings) {
|
|
54
|
+
this.customThemes.clear();
|
|
55
|
+
if (!customThemesSettings) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
for (const [name, customThemeConfig] of Object.entries(customThemesSettings)) {
|
|
59
|
+
const validation = validateCustomTheme(customThemeConfig);
|
|
60
|
+
if (validation.isValid) {
|
|
61
|
+
if (validation.warning) {
|
|
62
|
+
console.warn(`Theme "${name}": ${validation.warning}`);
|
|
63
|
+
}
|
|
64
|
+
const themeWithDefaults = {
|
|
65
|
+
...DEFAULT_THEME.colors,
|
|
66
|
+
...customThemeConfig,
|
|
67
|
+
name: customThemeConfig.name || name,
|
|
68
|
+
type: 'custom',
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
const theme = createCustomTheme(themeWithDefaults);
|
|
72
|
+
this.customThemes.set(name, theme);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.warn(`Failed to load custom theme "${name}":`, error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.warn(`Invalid custom theme "${name}": ${validation.error}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// If the current active theme is a custom theme, keep it if still valid
|
|
83
|
+
if (this.activeTheme &&
|
|
84
|
+
this.activeTheme.type === 'custom' &&
|
|
85
|
+
this.customThemes.has(this.activeTheme.name)) {
|
|
86
|
+
this.activeTheme = this.customThemes.get(this.activeTheme.name);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Sets the active theme.
|
|
91
|
+
* @param themeName The name of the theme to set as active.
|
|
92
|
+
* @returns True if the theme was successfully set, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
setActiveTheme(themeName) {
|
|
95
|
+
const theme = this.findThemeByName(themeName);
|
|
96
|
+
if (!theme) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
this.activeTheme = theme;
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets the currently active theme.
|
|
104
|
+
* @returns The active theme.
|
|
105
|
+
*/
|
|
106
|
+
getActiveTheme() {
|
|
107
|
+
if (process.env.NO_COLOR) {
|
|
108
|
+
return NoColorTheme;
|
|
109
|
+
}
|
|
110
|
+
// Ensure the active theme is always valid (fall back to default if not)
|
|
111
|
+
if (!this.activeTheme || !this.findThemeByName(this.activeTheme.name)) {
|
|
112
|
+
this.activeTheme = DEFAULT_THEME;
|
|
113
|
+
}
|
|
114
|
+
return this.activeTheme;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets a list of custom theme names.
|
|
118
|
+
* @returns Array of custom theme names.
|
|
119
|
+
*/
|
|
120
|
+
getCustomThemeNames() {
|
|
121
|
+
return Array.from(this.customThemes.keys());
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Checks if a theme name is a custom theme.
|
|
125
|
+
* @param themeName The theme name to check.
|
|
126
|
+
* @returns True if the theme is custom.
|
|
127
|
+
*/
|
|
128
|
+
isCustomTheme(themeName) {
|
|
129
|
+
return this.customThemes.has(themeName);
|
|
130
|
+
}
|
|
47
131
|
/**
|
|
48
132
|
* Returns a list of available theme names.
|
|
49
133
|
*/
|
|
50
134
|
getAvailableThemes() {
|
|
135
|
+
const builtInThemes = this.availableThemes.map((theme) => ({
|
|
136
|
+
name: theme.name,
|
|
137
|
+
type: theme.type,
|
|
138
|
+
isCustom: false,
|
|
139
|
+
}));
|
|
140
|
+
const customThemes = Array.from(this.customThemes.values()).map((theme) => ({
|
|
141
|
+
name: theme.name,
|
|
142
|
+
type: theme.type,
|
|
143
|
+
isCustom: true,
|
|
144
|
+
}));
|
|
51
145
|
// Separate Qwen themes
|
|
52
|
-
const qwenThemes =
|
|
53
|
-
const
|
|
146
|
+
const qwenThemes = builtInThemes.filter((theme) => theme.name === QwenLight.name || theme.name === QwenDark.name);
|
|
147
|
+
const otherBuiltInThemes = builtInThemes.filter((theme) => theme.name !== QwenLight.name && theme.name !== QwenDark.name);
|
|
54
148
|
// Sort other themes by type and then name
|
|
55
|
-
const sortedOtherThemes =
|
|
149
|
+
const sortedOtherThemes = [...otherBuiltInThemes, ...customThemes].sort((a, b) => {
|
|
56
150
|
const typeOrder = (type) => {
|
|
57
151
|
switch (type) {
|
|
58
152
|
case 'dark':
|
|
59
153
|
return 1;
|
|
60
154
|
case 'light':
|
|
61
155
|
return 2;
|
|
62
|
-
|
|
156
|
+
case 'ansi':
|
|
63
157
|
return 3;
|
|
158
|
+
case 'custom':
|
|
159
|
+
return 4; // Custom themes at the end
|
|
160
|
+
default:
|
|
161
|
+
return 5;
|
|
64
162
|
}
|
|
65
163
|
};
|
|
66
164
|
const typeComparison = typeOrder(a.type) - typeOrder(b.type);
|
|
@@ -70,48 +168,27 @@ class ThemeManager {
|
|
|
70
168
|
return a.name.localeCompare(b.name);
|
|
71
169
|
});
|
|
72
170
|
// Combine Qwen themes first, then sorted others
|
|
73
|
-
|
|
74
|
-
return sortedThemes.map((theme) => ({
|
|
75
|
-
name: theme.name,
|
|
76
|
-
type: theme.type,
|
|
77
|
-
}));
|
|
171
|
+
return [...qwenThemes, ...sortedOtherThemes];
|
|
78
172
|
}
|
|
79
173
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @param themeName The name of the theme to
|
|
82
|
-
* @returns
|
|
174
|
+
* Gets a theme by name.
|
|
175
|
+
* @param themeName The name of the theme to get.
|
|
176
|
+
* @returns The theme if found, undefined otherwise.
|
|
83
177
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (foundTheme) {
|
|
87
|
-
this.activeTheme = foundTheme;
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
// If themeName is undefined, it means we want to set the default theme.
|
|
92
|
-
// If findThemeByName returns undefined (e.g. default theme is also not found for some reason)
|
|
93
|
-
// then this will return false.
|
|
94
|
-
if (themeName === undefined) {
|
|
95
|
-
this.activeTheme = DEFAULT_THEME;
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
178
|
+
getTheme(themeName) {
|
|
179
|
+
return this.findThemeByName(themeName);
|
|
100
180
|
}
|
|
101
181
|
findThemeByName(themeName) {
|
|
102
182
|
if (!themeName) {
|
|
103
183
|
return DEFAULT_THEME;
|
|
104
184
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*/
|
|
110
|
-
getActiveTheme() {
|
|
111
|
-
if (process.env.NO_COLOR) {
|
|
112
|
-
return NoColorTheme;
|
|
185
|
+
// First check built-in themes
|
|
186
|
+
const builtInTheme = this.availableThemes.find((theme) => theme.name === themeName);
|
|
187
|
+
if (builtInTheme) {
|
|
188
|
+
return builtInTheme;
|
|
113
189
|
}
|
|
114
|
-
|
|
190
|
+
// Then check custom themes
|
|
191
|
+
return this.customThemes.get(themeName);
|
|
115
192
|
}
|
|
116
193
|
}
|
|
117
194
|
// Export an instance of the ThemeManager
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-manager.js","sourceRoot":"","sources":["../../../../src/ui/themes/theme-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,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AE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CACpC,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,2BAA2B;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;CACF;AAED,yCAAyC;AACzC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { CSSProperties } from 'react';
|
|
7
|
-
export type ThemeType = 'light' | 'dark' | 'ansi';
|
|
7
|
+
export type ThemeType = 'light' | 'dark' | 'ansi' | 'custom';
|
|
8
8
|
export interface ColorsTheme {
|
|
9
9
|
type: ThemeType;
|
|
10
10
|
Background: string;
|
|
@@ -16,10 +16,16 @@ export interface ColorsTheme {
|
|
|
16
16
|
AccentGreen: string;
|
|
17
17
|
AccentYellow: string;
|
|
18
18
|
AccentRed: string;
|
|
19
|
+
DiffAdded: string;
|
|
20
|
+
DiffRemoved: string;
|
|
19
21
|
Comment: string;
|
|
20
22
|
Gray: string;
|
|
21
23
|
GradientColors?: string[];
|
|
22
24
|
}
|
|
25
|
+
export interface CustomTheme extends ColorsTheme {
|
|
26
|
+
type: 'custom';
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
23
29
|
export declare const lightTheme: ColorsTheme;
|
|
24
30
|
export declare const darkTheme: ColorsTheme;
|
|
25
31
|
export declare const ansiTheme: ColorsTheme;
|
|
@@ -37,8 +43,6 @@ export declare class Theme {
|
|
|
37
43
|
* to Ink-compatible color strings (hex or name).
|
|
38
44
|
*/
|
|
39
45
|
protected readonly _colorMap: Readonly<Record<string, string>>;
|
|
40
|
-
private static readonly cssNameToHexMap;
|
|
41
|
-
private static readonly inkSupportedNames;
|
|
42
46
|
/**
|
|
43
47
|
* Creates a new Theme instance.
|
|
44
48
|
* @param name The name of the theme.
|
|
@@ -65,3 +69,19 @@ export declare class Theme {
|
|
|
65
69
|
*/
|
|
66
70
|
protected _buildColorMap(hljsTheme: Record<string, CSSProperties>): Record<string, string>;
|
|
67
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a Theme instance from a custom theme configuration.
|
|
74
|
+
* @param customTheme The custom theme configuration.
|
|
75
|
+
* @returns A new Theme instance.
|
|
76
|
+
*/
|
|
77
|
+
export declare function createCustomTheme(customTheme: CustomTheme): Theme;
|
|
78
|
+
/**
|
|
79
|
+
* Validates a custom theme configuration.
|
|
80
|
+
* @param customTheme The custom theme to validate.
|
|
81
|
+
* @returns An object with isValid boolean and error message if invalid.
|
|
82
|
+
*/
|
|
83
|
+
export declare function validateCustomTheme(customTheme: Partial<CustomTheme>): {
|
|
84
|
+
isValid: boolean;
|
|
85
|
+
error?: string;
|
|
86
|
+
warning?: string;
|
|
87
|
+
};
|