mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 06:45: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,161 +1,91 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import figures from 'figures';
|
||||
import * as React from 'react';
|
||||
import { useContext } from 'react';
|
||||
import { useQueuedMessage } from '../../context/QueuedMessageContext.js';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { formatBriefTimestamp } from '../../utils/formatBriefTimestamp.js';
|
||||
import { findThinkingTriggerPositions, getRainbowColor, isUltrathinkEnabled } from '../../utils/thinking.js';
|
||||
import { MessageActionsSelectedContext } from '../messageActions.js';
|
||||
import figures from 'figures'
|
||||
import * as React from 'react'
|
||||
import { useContext } from 'react'
|
||||
import { useQueuedMessage } from '../../context/QueuedMessageContext.js'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import { formatBriefTimestamp } from '../../utils/formatBriefTimestamp.js'
|
||||
import {
|
||||
findThinkingTriggerPositions,
|
||||
getRainbowColor,
|
||||
isUltrathinkEnabled,
|
||||
} from '../../utils/thinking.js'
|
||||
import { MessageActionsSelectedContext } from '../messageActions.js'
|
||||
|
||||
type Props = {
|
||||
text: string;
|
||||
useBriefLayout?: boolean;
|
||||
timestamp?: string;
|
||||
};
|
||||
export function HighlightedThinkingText(t0) {
|
||||
const $ = _c(31);
|
||||
const {
|
||||
text,
|
||||
useBriefLayout,
|
||||
timestamp
|
||||
} = t0;
|
||||
const isQueued = useQueuedMessage()?.isQueued ?? false;
|
||||
const isSelected = useContext(MessageActionsSelectedContext);
|
||||
const pointerColor = isSelected ? "suggestion" : "subtle";
|
||||
if (useBriefLayout) {
|
||||
let t1;
|
||||
if ($[0] !== timestamp) {
|
||||
t1 = timestamp ? formatBriefTimestamp(timestamp) : "";
|
||||
$[0] = timestamp;
|
||||
$[1] = t1;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
}
|
||||
const ts = t1;
|
||||
const t2 = isQueued ? "subtle" : "briefLabelYou";
|
||||
let t3;
|
||||
if ($[2] !== t2) {
|
||||
t3 = <Text color={t2}>You</Text>;
|
||||
$[2] = t2;
|
||||
$[3] = t3;
|
||||
} else {
|
||||
t3 = $[3];
|
||||
}
|
||||
let t4;
|
||||
if ($[4] !== ts) {
|
||||
t4 = ts ? <Text dimColor={true}> {ts}</Text> : null;
|
||||
$[4] = ts;
|
||||
$[5] = t4;
|
||||
} else {
|
||||
t4 = $[5];
|
||||
}
|
||||
let t5;
|
||||
if ($[6] !== t3 || $[7] !== t4) {
|
||||
t5 = <Box flexDirection="row">{t3}{t4}</Box>;
|
||||
$[6] = t3;
|
||||
$[7] = t4;
|
||||
$[8] = t5;
|
||||
} else {
|
||||
t5 = $[8];
|
||||
}
|
||||
const t6 = isQueued ? "subtle" : "text";
|
||||
let t7;
|
||||
if ($[9] !== t6 || $[10] !== text) {
|
||||
t7 = <Text color={t6}>{text}</Text>;
|
||||
$[9] = t6;
|
||||
$[10] = text;
|
||||
$[11] = t7;
|
||||
} else {
|
||||
t7 = $[11];
|
||||
}
|
||||
let t8;
|
||||
if ($[12] !== t5 || $[13] !== t7) {
|
||||
t8 = <Box flexDirection="column" paddingLeft={2}>{t5}{t7}</Box>;
|
||||
$[12] = t5;
|
||||
$[13] = t7;
|
||||
$[14] = t8;
|
||||
} else {
|
||||
t8 = $[14];
|
||||
}
|
||||
return t8;
|
||||
}
|
||||
let parts;
|
||||
let t1;
|
||||
if ($[15] !== pointerColor || $[16] !== text) {
|
||||
t1 = Symbol.for("react.early_return_sentinel");
|
||||
bb0: {
|
||||
const triggers = isUltrathinkEnabled() ? findThinkingTriggerPositions(text) : [];
|
||||
if (triggers.length === 0) {
|
||||
let t2;
|
||||
if ($[19] !== pointerColor) {
|
||||
t2 = <Text color={pointerColor}>{figures.pointer} </Text>;
|
||||
$[19] = pointerColor;
|
||||
$[20] = t2;
|
||||
} else {
|
||||
t2 = $[20];
|
||||
}
|
||||
let t3;
|
||||
if ($[21] !== text) {
|
||||
t3 = <Text color="text">{text}</Text>;
|
||||
$[21] = text;
|
||||
$[22] = t3;
|
||||
} else {
|
||||
t3 = $[22];
|
||||
}
|
||||
let t4;
|
||||
if ($[23] !== t2 || $[24] !== t3) {
|
||||
t4 = <Text>{t2}{t3}</Text>;
|
||||
$[23] = t2;
|
||||
$[24] = t3;
|
||||
$[25] = t4;
|
||||
} else {
|
||||
t4 = $[25];
|
||||
}
|
||||
t1 = t4;
|
||||
break bb0;
|
||||
}
|
||||
parts = [];
|
||||
let cursor = 0;
|
||||
for (const t of triggers) {
|
||||
if (t.start > cursor) {
|
||||
parts.push(<Text key={`plain-${cursor}`} color="text">{text.slice(cursor, t.start)}</Text>);
|
||||
}
|
||||
for (let i = t.start; i < t.end; i++) {
|
||||
parts.push(<Text key={`rb-${i}`} color={getRainbowColor(i - t.start)}>{text[i]}</Text>);
|
||||
}
|
||||
cursor = t.end;
|
||||
}
|
||||
if (cursor < text.length) {
|
||||
parts.push(<Text key={`plain-${cursor}`} color="text">{text.slice(cursor)}</Text>);
|
||||
}
|
||||
}
|
||||
$[15] = pointerColor;
|
||||
$[16] = text;
|
||||
$[17] = parts;
|
||||
$[18] = t1;
|
||||
} else {
|
||||
parts = $[17];
|
||||
t1 = $[18];
|
||||
}
|
||||
if (t1 !== Symbol.for("react.early_return_sentinel")) {
|
||||
return t1;
|
||||
}
|
||||
let t2;
|
||||
if ($[26] !== pointerColor) {
|
||||
t2 = <Text color={pointerColor}>{figures.pointer} </Text>;
|
||||
$[26] = pointerColor;
|
||||
$[27] = t2;
|
||||
} else {
|
||||
t2 = $[27];
|
||||
}
|
||||
let t3;
|
||||
if ($[28] !== parts || $[29] !== t2) {
|
||||
t3 = <Text>{t2}{parts}</Text>;
|
||||
$[28] = parts;
|
||||
$[29] = t2;
|
||||
$[30] = t3;
|
||||
} else {
|
||||
t3 = $[30];
|
||||
}
|
||||
return t3;
|
||||
text: string
|
||||
useBriefLayout?: boolean
|
||||
timestamp?: string
|
||||
}
|
||||
|
||||
export function HighlightedThinkingText({
|
||||
text,
|
||||
useBriefLayout,
|
||||
timestamp,
|
||||
}: Props): React.ReactNode {
|
||||
// Brief/assistant mode: chat-style "You" label instead of the ❯ highlight.
|
||||
// Parent drops its backgroundColor when this is true, so no grey shows
|
||||
// through. No manual wrap needed — Ink wraps inside the parent Box.
|
||||
const isQueued = useQueuedMessage()?.isQueued ?? false
|
||||
const isSelected = useContext(MessageActionsSelectedContext)
|
||||
const pointerColor = isSelected ? 'suggestion' : 'subtle'
|
||||
if (useBriefLayout) {
|
||||
const ts = timestamp ? formatBriefTimestamp(timestamp) : ''
|
||||
return (
|
||||
<Box flexDirection="column" paddingLeft={2}>
|
||||
<Box flexDirection="row">
|
||||
<Text color={isQueued ? 'subtle' : 'briefLabelYou'}>You</Text>
|
||||
{ts ? <Text dimColor> {ts}</Text> : null}
|
||||
</Box>
|
||||
<Text color={isQueued ? 'subtle' : 'text'}>{text}</Text>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
const triggers = isUltrathinkEnabled()
|
||||
? findThinkingTriggerPositions(text)
|
||||
: []
|
||||
|
||||
if (triggers.length === 0) {
|
||||
return (
|
||||
<Text>
|
||||
<Text color={pointerColor}>{figures.pointer} </Text>
|
||||
<Text color="text">{text}</Text>
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
|
||||
// Static rainbow (no shimmer — transcript messages don't animate)
|
||||
const parts: React.ReactNode[] = []
|
||||
let cursor = 0
|
||||
for (const t of triggers) {
|
||||
if (t.start > cursor) {
|
||||
parts.push(
|
||||
<Text key={`plain-${cursor}`} color="text">
|
||||
{text.slice(cursor, t.start)}
|
||||
</Text>,
|
||||
)
|
||||
}
|
||||
for (let i = t.start; i < t.end; i++) {
|
||||
parts.push(
|
||||
<Text key={`rb-${i}`} color={getRainbowColor(i - t.start)}>
|
||||
{text[i]}
|
||||
</Text>,
|
||||
)
|
||||
}
|
||||
cursor = t.end
|
||||
}
|
||||
if (cursor < text.length) {
|
||||
parts.push(
|
||||
<Text key={`plain-${cursor}`} color="text">
|
||||
{text.slice(cursor)}
|
||||
</Text>,
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Text>
|
||||
<Text color={pointerColor}>{figures.pointer} </Text>
|
||||
{parts}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user