/** * [WHO]: Public exports from this file (see implementation below). * [FROM]: See the import block immediately after this header. * [TO]: sparkdesign package consumers; output of CLI `add` when applicable. * [HERE]: registry/chat/reasoning-step/types.ts — Spark Design source; keep aligned with the main library. * * [PROTOCOL]: * 1. Keep this P3 header in sync when the public contract changes. * 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change. * 3. Follow design tokens and explicit type exports. */ import type { ReactNode } from 'react'; export type ReasoningStepDetail = { type: 'action'; action: string; desc?: string; details?: ReasoningStepDetail[]; } | { type: 'file'; filename: string; lines?: string; path?: string; fileType?: string; details?: ReasoningStepDetail[]; }; export type ReasoningStepStatus = 'completed' | 'in-progress'; export interface ReasoningStepRootProps { /** 主文本 */ text: ReactNode; /** 描述文本 */ description?: string; /** 状态 */ status?: ReasoningStepStatus; /** 自定义图标 */ icon?: ReactNode; /** 是否显示图标 */ showIcon?: boolean; /** 详情数据 */ details?: ReasoningStepDetail[]; /** 子组件 */ children?: ReactNode; /** 动画持续时间 */ duration?: number; /** 动画扩散度 */ spread?: number; /** 禁用展开动画 */ disableExpandAnimation?: boolean; /** 默认展开 */ defaultExpanded?: boolean; /** 受控展开状态 */ expanded?: boolean; /** 展开状态变化回调 */ onExpandedChange?: (expanded: boolean) => void; /** 自定义眼睛图标 */ eyeIcon?: ReactNode; /** 自定义箭头图标 */ arrowRightIcon?: ReactNode; } export type ReasoningStepProps = ReasoningStepRootProps; export interface ReasoningStepHeaderProps { className?: string; } export interface ReasoningStepDetailsProps { className?: string; children?: ReactNode; } export interface ReasoningStepDetailRowProps { detail: ReasoningStepDetail; depth?: number; pathKey?: string; className?: string; } export interface ReasoningStepContextValue { status: ReasoningStepStatus; isExpanded: boolean; isHovered: boolean; setIsHovered: (hovered: boolean) => void; toggleExpanded: () => void; effectiveExpanded: boolean; effectiveShowIcon: boolean; hasExpandableContent: boolean; text: ReactNode; description?: string; details?: ReasoningStepDetail[]; detailsChildren?: ReactNode; duration: number; spread: number; disableExpandAnimation: boolean; detailIndent: string; expandedNestedKeys: Set; toggleNested: (pathKey: string) => void; icon?: ReactNode; eyeIcon: ReactNode; arrowRightIcon: ReactNode; } export interface ReasoningStepCompound { Root: React.FC; Header: React.FC; Details: React.FC; DetailRow: React.FC; }