mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-23 00:35:51 +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,44 +1,44 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import figures from 'figures';
|
||||
import type { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
import { useDeclaredCursor } from '../../ink/hooks/use-declared-cursor.js';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import figures from 'figures'
|
||||
import type { ReactNode } from 'react'
|
||||
import React from 'react'
|
||||
import { useDeclaredCursor } from '../../ink/hooks/use-declared-cursor.js'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
|
||||
type ListItemProps = {
|
||||
/**
|
||||
* Whether this item is currently focused (keyboard selection).
|
||||
* Shows the pointer indicator (❯) when true.
|
||||
*/
|
||||
isFocused: boolean;
|
||||
isFocused: boolean
|
||||
|
||||
/**
|
||||
* Whether this item is selected (chosen/checked).
|
||||
* Shows the checkmark indicator (✓) when true.
|
||||
* @default false
|
||||
*/
|
||||
isSelected?: boolean;
|
||||
isSelected?: boolean
|
||||
|
||||
/**
|
||||
* The content to display for this item.
|
||||
*/
|
||||
children: ReactNode;
|
||||
children: ReactNode
|
||||
|
||||
/**
|
||||
* Optional description text displayed below the main content.
|
||||
*/
|
||||
description?: string;
|
||||
description?: string
|
||||
|
||||
/**
|
||||
* Show a down arrow indicator instead of pointer (for scroll hints).
|
||||
* Only applies when not focused.
|
||||
*/
|
||||
showScrollDown?: boolean;
|
||||
showScrollDown?: boolean
|
||||
|
||||
/**
|
||||
* Show an up arrow indicator instead of pointer (for scroll hints).
|
||||
* Only applies when not focused.
|
||||
*/
|
||||
showScrollUp?: boolean;
|
||||
showScrollUp?: boolean
|
||||
|
||||
/**
|
||||
* Whether to apply automatic styling to the children based on focus/selection state.
|
||||
@@ -46,21 +46,21 @@ type ListItemProps = {
|
||||
* - When false: children are rendered as-is, allowing custom styling
|
||||
* @default true
|
||||
*/
|
||||
styled?: boolean;
|
||||
styled?: boolean
|
||||
|
||||
/**
|
||||
* Whether this item is disabled. Disabled items show dimmed text and no indicators.
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
disabled?: boolean
|
||||
|
||||
/**
|
||||
* Whether this ListItem should declare the terminal cursor position.
|
||||
* Set false when a child (e.g. BaseTextInput) declares its own cursor.
|
||||
* @default true
|
||||
*/
|
||||
declareCursor?: boolean;
|
||||
};
|
||||
declareCursor?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* A list item component for selection UIs (dropdowns, multi-selects, menus).
|
||||
@@ -101,143 +101,88 @@ type ListItemProps = {
|
||||
* <Text color="claude">Custom styled content</Text>
|
||||
* </ListItem>
|
||||
*/
|
||||
export function ListItem(t0) {
|
||||
const $ = _c(32);
|
||||
const {
|
||||
isFocused,
|
||||
isSelected: t1,
|
||||
children,
|
||||
description,
|
||||
showScrollDown,
|
||||
showScrollUp,
|
||||
styled: t2,
|
||||
disabled: t3,
|
||||
declareCursor
|
||||
} = t0;
|
||||
const isSelected = t1 === undefined ? false : t1;
|
||||
const styled = t2 === undefined ? true : t2;
|
||||
const disabled = t3 === undefined ? false : t3;
|
||||
let t4;
|
||||
if ($[0] !== disabled || $[1] !== isFocused || $[2] !== showScrollDown || $[3] !== showScrollUp) {
|
||||
t4 = function renderIndicator() {
|
||||
if (disabled) {
|
||||
return <Text> </Text>;
|
||||
}
|
||||
if (isFocused) {
|
||||
return <Text color="suggestion">{figures.pointer}</Text>;
|
||||
}
|
||||
if (showScrollDown) {
|
||||
return <Text dimColor={true}>{figures.arrowDown}</Text>;
|
||||
}
|
||||
if (showScrollUp) {
|
||||
return <Text dimColor={true}>{figures.arrowUp}</Text>;
|
||||
}
|
||||
return <Text> </Text>;
|
||||
};
|
||||
$[0] = disabled;
|
||||
$[1] = isFocused;
|
||||
$[2] = showScrollDown;
|
||||
$[3] = showScrollUp;
|
||||
$[4] = t4;
|
||||
} else {
|
||||
t4 = $[4];
|
||||
export function ListItem({
|
||||
isFocused,
|
||||
isSelected = false,
|
||||
children,
|
||||
description,
|
||||
showScrollDown,
|
||||
showScrollUp,
|
||||
styled = true,
|
||||
disabled = false,
|
||||
declareCursor,
|
||||
}: ListItemProps): React.ReactNode {
|
||||
// Determine which indicator to show
|
||||
function renderIndicator(): ReactNode {
|
||||
if (disabled) {
|
||||
return <Text> </Text>
|
||||
}
|
||||
|
||||
if (isFocused) {
|
||||
return <Text color="suggestion">{figures.pointer}</Text>
|
||||
}
|
||||
|
||||
if (showScrollDown) {
|
||||
return <Text dimColor>{figures.arrowDown}</Text>
|
||||
}
|
||||
|
||||
if (showScrollUp) {
|
||||
return <Text dimColor>{figures.arrowUp}</Text>
|
||||
}
|
||||
|
||||
return <Text> </Text>
|
||||
}
|
||||
const renderIndicator = t4;
|
||||
let t5;
|
||||
if ($[5] !== disabled || $[6] !== isFocused || $[7] !== isSelected || $[8] !== styled) {
|
||||
const getTextColor = function getTextColor() {
|
||||
if (disabled) {
|
||||
return "inactive";
|
||||
}
|
||||
if (!styled) {
|
||||
return;
|
||||
}
|
||||
if (isSelected) {
|
||||
return "success";
|
||||
}
|
||||
if (isFocused) {
|
||||
return "suggestion";
|
||||
}
|
||||
};
|
||||
t5 = getTextColor();
|
||||
$[5] = disabled;
|
||||
$[6] = isFocused;
|
||||
$[7] = isSelected;
|
||||
$[8] = styled;
|
||||
$[9] = t5;
|
||||
} else {
|
||||
t5 = $[9];
|
||||
|
||||
// Determine text color based on state
|
||||
function getTextColor(): 'success' | 'suggestion' | 'inactive' | undefined {
|
||||
if (disabled) {
|
||||
return 'inactive'
|
||||
}
|
||||
|
||||
if (!styled) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (isSelected) {
|
||||
return 'success'
|
||||
}
|
||||
|
||||
if (isFocused) {
|
||||
return 'suggestion'
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
const textColor = t5;
|
||||
const t6 = isFocused && !disabled && declareCursor !== false;
|
||||
let t7;
|
||||
if ($[10] !== t6) {
|
||||
t7 = {
|
||||
line: 0,
|
||||
column: 0,
|
||||
active: t6
|
||||
};
|
||||
$[10] = t6;
|
||||
$[11] = t7;
|
||||
} else {
|
||||
t7 = $[11];
|
||||
}
|
||||
const cursorRef = useDeclaredCursor(t7);
|
||||
let t8;
|
||||
if ($[12] !== renderIndicator) {
|
||||
t8 = renderIndicator();
|
||||
$[12] = renderIndicator;
|
||||
$[13] = t8;
|
||||
} else {
|
||||
t8 = $[13];
|
||||
}
|
||||
let t9;
|
||||
if ($[14] !== children || $[15] !== disabled || $[16] !== styled || $[17] !== textColor) {
|
||||
t9 = styled ? <Text color={textColor} dimColor={disabled}>{children}</Text> : children;
|
||||
$[14] = children;
|
||||
$[15] = disabled;
|
||||
$[16] = styled;
|
||||
$[17] = textColor;
|
||||
$[18] = t9;
|
||||
} else {
|
||||
t9 = $[18];
|
||||
}
|
||||
let t10;
|
||||
if ($[19] !== disabled || $[20] !== isSelected) {
|
||||
t10 = isSelected && !disabled && <Text color="success">{figures.tick}</Text>;
|
||||
$[19] = disabled;
|
||||
$[20] = isSelected;
|
||||
$[21] = t10;
|
||||
} else {
|
||||
t10 = $[21];
|
||||
}
|
||||
let t11;
|
||||
if ($[22] !== t10 || $[23] !== t8 || $[24] !== t9) {
|
||||
t11 = <Box flexDirection="row" gap={1}>{t8}{t9}{t10}</Box>;
|
||||
$[22] = t10;
|
||||
$[23] = t8;
|
||||
$[24] = t9;
|
||||
$[25] = t11;
|
||||
} else {
|
||||
t11 = $[25];
|
||||
}
|
||||
let t12;
|
||||
if ($[26] !== description) {
|
||||
t12 = description && <Box paddingLeft={2}><Text color="inactive">{description}</Text></Box>;
|
||||
$[26] = description;
|
||||
$[27] = t12;
|
||||
} else {
|
||||
t12 = $[27];
|
||||
}
|
||||
let t13;
|
||||
if ($[28] !== cursorRef || $[29] !== t11 || $[30] !== t12) {
|
||||
t13 = <Box ref={cursorRef} flexDirection="column">{t11}{t12}</Box>;
|
||||
$[28] = cursorRef;
|
||||
$[29] = t11;
|
||||
$[30] = t12;
|
||||
$[31] = t13;
|
||||
} else {
|
||||
t13 = $[31];
|
||||
}
|
||||
return t13;
|
||||
|
||||
const textColor = getTextColor()
|
||||
|
||||
// Park the native terminal cursor on the pointer indicator so screen
|
||||
// readers / magnifiers track the focused item. (0,0) is the top-left of
|
||||
// this Box, where the pointer renders.
|
||||
const cursorRef = useDeclaredCursor({
|
||||
line: 0,
|
||||
column: 0,
|
||||
active: isFocused && !disabled && declareCursor !== false,
|
||||
})
|
||||
|
||||
return (
|
||||
<Box ref={cursorRef} flexDirection="column">
|
||||
<Box flexDirection="row" gap={1}>
|
||||
{renderIndicator()}
|
||||
{styled ? (
|
||||
<Text color={textColor} dimColor={disabled}>
|
||||
{children}
|
||||
</Text>
|
||||
) : (
|
||||
children
|
||||
)}
|
||||
{isSelected && !disabled && <Text color="success">{figures.tick}</Text>}
|
||||
</Box>
|
||||
{description && (
|
||||
<Box paddingLeft={2}>
|
||||
<Text color="inactive">{description}</Text>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user