mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 15:55:50 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,111 +1,106 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import figures from 'figures';
|
||||
import React, { useState } from 'react';
|
||||
import type { KeyboardEvent } from '../../ink/events/keyboard-event.js';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { AGENT_COLOR_TO_THEME_COLOR, AGENT_COLORS, type AgentColorName } from '../../tools/AgentTool/agentColorManager.js';
|
||||
import { capitalize } from '../../utils/stringUtils.js';
|
||||
type ColorOption = AgentColorName | 'automatic';
|
||||
const COLOR_OPTIONS: ColorOption[] = ['automatic', ...AGENT_COLORS];
|
||||
import figures from 'figures'
|
||||
import React, { useState } from 'react'
|
||||
import type { KeyboardEvent } from '../../ink/events/keyboard-event.js'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import {
|
||||
AGENT_COLOR_TO_THEME_COLOR,
|
||||
AGENT_COLORS,
|
||||
type AgentColorName,
|
||||
} from '../../tools/AgentTool/agentColorManager.js'
|
||||
import { capitalize } from '../../utils/stringUtils.js'
|
||||
|
||||
type ColorOption = AgentColorName | 'automatic'
|
||||
|
||||
const COLOR_OPTIONS: ColorOption[] = ['automatic', ...AGENT_COLORS]
|
||||
|
||||
type Props = {
|
||||
agentName: string;
|
||||
currentColor?: AgentColorName | 'automatic';
|
||||
onConfirm: (color: AgentColorName | undefined) => void;
|
||||
};
|
||||
export function ColorPicker(t0) {
|
||||
const $ = _c(17);
|
||||
const {
|
||||
agentName,
|
||||
currentColor: t1,
|
||||
onConfirm
|
||||
} = t0;
|
||||
const currentColor = t1 === undefined ? "automatic" : t1;
|
||||
let t2;
|
||||
if ($[0] !== currentColor) {
|
||||
t2 = COLOR_OPTIONS.findIndex(opt => opt === currentColor);
|
||||
$[0] = currentColor;
|
||||
$[1] = t2;
|
||||
} else {
|
||||
t2 = $[1];
|
||||
}
|
||||
const [selectedIndex, setSelectedIndex] = useState(Math.max(0, t2));
|
||||
let t3;
|
||||
if ($[2] !== onConfirm || $[3] !== selectedIndex) {
|
||||
t3 = e => {
|
||||
if (e.key === "up") {
|
||||
e.preventDefault();
|
||||
setSelectedIndex(_temp);
|
||||
} else {
|
||||
if (e.key === "down") {
|
||||
e.preventDefault();
|
||||
setSelectedIndex(_temp2);
|
||||
} else {
|
||||
if (e.key === "return") {
|
||||
e.preventDefault();
|
||||
const selected = COLOR_OPTIONS[selectedIndex];
|
||||
onConfirm(selected === "automatic" ? undefined : selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$[2] = onConfirm;
|
||||
$[3] = selectedIndex;
|
||||
$[4] = t3;
|
||||
} else {
|
||||
t3 = $[4];
|
||||
}
|
||||
const handleKeyDown = t3;
|
||||
const selectedValue = COLOR_OPTIONS[selectedIndex];
|
||||
let t4;
|
||||
if ($[5] !== selectedIndex) {
|
||||
t4 = COLOR_OPTIONS.map((option, index) => {
|
||||
const isSelected = index === selectedIndex;
|
||||
return <Box key={option} flexDirection="row" gap={1}><Text color={isSelected ? "suggestion" : undefined}>{isSelected ? figures.pointer : " "}</Text>{option === "automatic" ? <Text bold={isSelected}>Automatic color</Text> : <Box gap={1}><Text backgroundColor={AGENT_COLOR_TO_THEME_COLOR[option]} color="inverseText">{" "}</Text><Text bold={isSelected}>{capitalize(option)}</Text></Box>}</Box>;
|
||||
});
|
||||
$[5] = selectedIndex;
|
||||
$[6] = t4;
|
||||
} else {
|
||||
t4 = $[6];
|
||||
}
|
||||
let t5;
|
||||
if ($[7] !== t4) {
|
||||
t5 = <Box flexDirection="column">{t4}</Box>;
|
||||
$[7] = t4;
|
||||
$[8] = t5;
|
||||
} else {
|
||||
t5 = $[8];
|
||||
}
|
||||
let t6;
|
||||
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t6 = <Text>Preview: </Text>;
|
||||
$[9] = t6;
|
||||
} else {
|
||||
t6 = $[9];
|
||||
}
|
||||
let t7;
|
||||
if ($[10] !== agentName || $[11] !== selectedValue) {
|
||||
t7 = <Box marginTop={1}>{t6}{selectedValue === undefined || selectedValue === "automatic" ? <Text inverse={true} bold={true}>{" "}@{agentName}{" "}</Text> : <Text backgroundColor={AGENT_COLOR_TO_THEME_COLOR[selectedValue]} color="inverseText" bold={true}>{" "}@{agentName}{" "}</Text>}</Box>;
|
||||
$[10] = agentName;
|
||||
$[11] = selectedValue;
|
||||
$[12] = t7;
|
||||
} else {
|
||||
t7 = $[12];
|
||||
}
|
||||
let t8;
|
||||
if ($[13] !== handleKeyDown || $[14] !== t5 || $[15] !== t7) {
|
||||
t8 = <Box flexDirection="column" gap={1} tabIndex={0} autoFocus={true} onKeyDown={handleKeyDown}>{t5}{t7}</Box>;
|
||||
$[13] = handleKeyDown;
|
||||
$[14] = t5;
|
||||
$[15] = t7;
|
||||
$[16] = t8;
|
||||
} else {
|
||||
t8 = $[16];
|
||||
}
|
||||
return t8;
|
||||
agentName: string
|
||||
currentColor?: AgentColorName | 'automatic'
|
||||
onConfirm: (color: AgentColorName | undefined) => void
|
||||
}
|
||||
function _temp2(prev_0) {
|
||||
return prev_0 < COLOR_OPTIONS.length - 1 ? prev_0 + 1 : 0;
|
||||
}
|
||||
function _temp(prev) {
|
||||
return prev > 0 ? prev - 1 : COLOR_OPTIONS.length - 1;
|
||||
|
||||
export function ColorPicker({
|
||||
agentName,
|
||||
currentColor = 'automatic',
|
||||
onConfirm,
|
||||
}: Props): React.ReactNode {
|
||||
const [selectedIndex, setSelectedIndex] = useState(
|
||||
Math.max(
|
||||
0,
|
||||
COLOR_OPTIONS.findIndex(opt => opt === currentColor),
|
||||
),
|
||||
)
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 'up') {
|
||||
e.preventDefault()
|
||||
setSelectedIndex(prev => (prev > 0 ? prev - 1 : COLOR_OPTIONS.length - 1))
|
||||
} else if (e.key === 'down') {
|
||||
e.preventDefault()
|
||||
setSelectedIndex(prev => (prev < COLOR_OPTIONS.length - 1 ? prev + 1 : 0))
|
||||
} else if (e.key === 'return') {
|
||||
e.preventDefault()
|
||||
const selected = COLOR_OPTIONS[selectedIndex]
|
||||
onConfirm(selected === 'automatic' ? undefined : selected)
|
||||
}
|
||||
}
|
||||
|
||||
const selectedValue = COLOR_OPTIONS[selectedIndex]
|
||||
|
||||
return (
|
||||
<Box
|
||||
flexDirection="column"
|
||||
gap={1}
|
||||
tabIndex={0}
|
||||
autoFocus
|
||||
onKeyDown={handleKeyDown}
|
||||
>
|
||||
<Box flexDirection="column">
|
||||
{COLOR_OPTIONS.map((option, index) => {
|
||||
const isSelected = index === selectedIndex
|
||||
|
||||
return (
|
||||
<Box key={option} flexDirection="row" gap={1}>
|
||||
<Text color={isSelected ? 'suggestion' : undefined}>
|
||||
{isSelected ? figures.pointer : ' '}
|
||||
</Text>
|
||||
|
||||
{option === 'automatic' ? (
|
||||
<Text bold={isSelected}>Automatic color</Text>
|
||||
) : (
|
||||
<Box gap={1}>
|
||||
<Text
|
||||
backgroundColor={AGENT_COLOR_TO_THEME_COLOR[option]}
|
||||
color="inverseText"
|
||||
>
|
||||
{' '}
|
||||
</Text>
|
||||
<Text bold={isSelected}>{capitalize(option)}</Text>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
})}
|
||||
</Box>
|
||||
|
||||
<Box marginTop={1}>
|
||||
<Text>Preview: </Text>
|
||||
{selectedValue === undefined || selectedValue === 'automatic' ? (
|
||||
<Text inverse bold>
|
||||
{' '}
|
||||
@{agentName}{' '}
|
||||
</Text>
|
||||
) : (
|
||||
<Text
|
||||
backgroundColor={AGENT_COLOR_TO_THEME_COLOR[selectedValue]}
|
||||
color="inverseText"
|
||||
bold
|
||||
>
|
||||
{' '}
|
||||
@{agentName}{' '}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user