feat: 第一个可以用的 ink 组件抽象 (#158)

This commit is contained in:
claude-code-best
2026-04-06 23:56:45 +08:00
committed by GitHub
parent 3ea64eeb0f
commit c445f43f8d
645 changed files with 7255 additions and 1214 deletions

View File

@@ -1,5 +1,5 @@
import * as React from 'react'
import { Text, useTheme } from '../../ink.js'
import { Text, useTheme } from '@anthropic/ink'
import { getTheme, type Theme } from '../../utils/theme.js'
import { interpolateColor, parseRGB, toRGBColor } from './utils.js'

View File

@@ -1,6 +1,5 @@
import * as React from 'react'
import { stringWidth } from '../../ink/stringWidth.js'
import { Text, useTheme } from '../../ink.js'
import { Text, stringWidth, useTheme } from '@anthropic/ink'
import { getGraphemeSegmenter } from '../../utils/intl.js'
import { getTheme, type Theme } from '../../utils/theme.js'
import type { SpinnerMode } from './types.js'

View File

@@ -1,5 +1,5 @@
import * as React from 'react'
import { Text } from '../../ink.js'
import { Text } from '@anthropic/ink'
import type { Theme } from '../../utils/theme.js'
type Props = {

View File

@@ -1,13 +1,13 @@
import figures from 'figures'
import * as React from 'react'
import { useMemo, useRef } from 'react'
import { stringWidth } from '../../ink/stringWidth.js'
import { Box, Text, useAnimationFrame } from '../../ink.js'
import { Box, Text, useAnimationFrame, stringWidth, Byline } from '@anthropic/ink'
import { toInkColor } from '../../utils/ink.js'
import type { InProcessTeammateTaskState } from '../../tasks/InProcessTeammateTask/types.js'
import { formatDuration, formatNumber } from '../../utils/format.js'
import { toInkColor } from '../../utils/ink.js'
import type { Theme } from '../../utils/theme.js'
import { Byline } from '../design-system/Byline.js'
import { GlimmerMessage } from './GlimmerMessage.js'
import { SpinnerGlyph } from './SpinnerGlyph.js'
import type { SpinnerMode } from './types.js'
@@ -236,7 +236,6 @@ export function SpinnerAnimationRow({
totalTokens > 0 &&
availableSpace > usedAfterTimer + tokensWidth
const thinkingOnly =
showThinking &&
thinkingStatus === 'thinking' &&

View File

@@ -1,5 +1,5 @@
import * as React from 'react'
import { Box, Text, useTheme } from '../../ink.js'
import { Box, Text, useTheme } from '@anthropic/ink'
import { getTheme, type Theme } from '../../utils/theme.js'
import {
getDefaultCharacters,

View File

@@ -6,8 +6,8 @@ import { getSpinnerVerbs } from '../../constants/spinnerVerbs.js'
import { TURN_COMPLETION_VERBS } from '../../constants/turnCompletionVerbs.js'
import { useElapsedTime } from '../../hooks/useElapsedTime.js'
import { useTerminalSize } from '../../hooks/useTerminalSize.js'
import { stringWidth } from '../../ink/stringWidth.js'
import { Box, Text } from '../../ink.js'
import { Box, Text, stringWidth } from '@anthropic/ink'
import { toInkColor } from '../../utils/ink.js'
import type { InProcessTeammateTaskState } from '../../tasks/InProcessTeammateTask/types.js'
import { summarizeRecentActivities } from '../../utils/collapseReadSearch.js'
import {
@@ -15,7 +15,7 @@ import {
formatNumber,
truncateToWidth,
} from '../../utils/format.js'
import { toInkColor } from '../../utils/ink.js'
import { TEAMMATE_SELECT_HINT } from './teammateSelectHint.js'
type Props = {

View File

@@ -1,6 +1,6 @@
import figures from 'figures'
import * as React from 'react'
import { Box, Text, type TextProps } from '../../ink.js'
import { Box, Text, type TextProps } from '@anthropic/ink'
import { useAppState } from '../../state/AppState.js'
import { getRunningTeammatesSorted } from '../../tasks/InProcessTeammateTask/InProcessTeammateTask.js'
import { formatNumber } from '../../utils/format.js'

View File

@@ -1,6 +1,5 @@
import { useMemo } from 'react'
import { stringWidth } from '../../ink/stringWidth.js'
import { type DOMElement, useAnimationFrame } from '../../ink.js'
import { type DOMElement, useAnimationFrame, stringWidth } from '@anthropic/ink'
import type { SpinnerMode } from './types.js'
export function useShimmerAnimation(

View File

@@ -1,4 +1,4 @@
import type { RGBColor as RGBColorString } from '../../ink/styles.js'
import type { RGBColor as RGBColorString } from '@anthropic/ink'
import type { RGBColor as RGBColorType } from './types.js'
export function getDefaultCharacters(): string[] {