react-ai-renderer 0.1.21 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -51,6 +51,8 @@ interface ComponentHandler extends BaseComponentHandler {
51
51
  skeleton?: SkeletonConfig;
52
52
  /** 组件的显示标签,用于在占位组件中显示 */
53
53
  label?: string;
54
+ /** 流式渲染:为 true 时组件在 isComplete=false 阶段即渲染实际内容而非 loader */
55
+ streamable?: boolean;
54
56
  }
55
57
  /** 增强模式的组件配置 */
56
58
  interface EnhancedComponentConfig {
@@ -70,6 +72,8 @@ interface EnhancedComponentConfig {
70
72
  onRenderFinished?: (item: ComponentData$1, scope: any) => void;
71
73
  /** 是否自闭合 */
72
74
  selfClosing?: boolean;
75
+ /** 流式渲染:为 true 时组件在流式解析未完成阶段即渲染实际内容而非 loader */
76
+ streamable?: boolean;
73
77
  }
74
78
  /** 组件值类型:可以是组件本身,也可以是增强配置对象 */
75
79
  type ComponentValue = React.ComponentType<any> | EnhancedComponentConfig;
@@ -110,6 +114,12 @@ interface ReactAIRendererProps {
110
114
  mdxLayoutClassName?: string;
111
115
  /** MdxLayout 的自定义样式 */
112
116
  mdxLayoutStyle?: React.CSSProperties;
117
+ /** 为 true 时未完成组件优先走 loader,避免 remount 后跳过骨架 */
118
+ streaming?: boolean;
119
+ /** 整体主题:dark(默认)/ light / 自定义字符串 */
120
+ theme?: "dark" | "light" | string;
121
+ /** 代码语法主题:github / atom / 或 react-syntax-highlighter prism 样式名(如 dracula、one-dark 等) */
122
+ codeTheme?: "github" | "atom" | string;
113
123
  /** 其他传递给组件的属性 */
114
124
  [key: string]: any;
115
125
  }
@@ -159,7 +169,7 @@ declare class MDXStreamingParser {
159
169
  private messages;
160
170
  constructor(components: any[]);
161
171
  isComponentRegistered(name: string): boolean;
162
- parse(messageId: string, input: string): ComponentData[];
172
+ parse(_messageId: string, input: string): ComponentData[];
163
173
  private findComponentClose;
164
174
  private parseComponentTag;
165
175
  private parsePropsCommon;
@@ -167,6 +177,6 @@ declare class MDXStreamingParser {
167
177
  reset(): void;
168
178
  }
169
179
 
170
- declare function ReactAIRenderer({ content, scope, components, children, componentHandlers, useGithubStyles, mdxLayoutClassName, mdxLayoutStyle }: ReactAIRendererProps): React.JSX.Element | null;
180
+ declare function ReactAIRenderer({ content, scope, components, children, componentHandlers, useGithubStyles, mdxLayoutClassName, mdxLayoutStyle, theme, codeTheme, }: ReactAIRendererProps): React.JSX.Element | null;
171
181
 
172
182
  export { ComponentData$1 as ComponentData, ComponentHandler, ComponentValue, EnhancedComponentConfig, MDXStreamingParser, MdxLayout, MdxLayoutProps, ParseResult, ParserState, ReactAIRendererProps, ReactMarkdownProps, Think, ThinkProps, ToolCall, ToolCallProps, ReactAIRenderer as default };