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>
This commit is contained in:
claude-code-best
2026-04-04 21:56:58 +08:00
parent 141ed7a76e
commit ae7b92f673
104 changed files with 15977 additions and 18419 deletions

View File

@@ -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>
)
}