@ant-design/agentic-ui 2.30.6 → 2.30.7
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/MarkdownRenderer/MarkdownRenderer.js +2 -1
- package/dist/MarkdownRenderer/index.d.ts +2 -0
- package/dist/MarkdownRenderer/index.js +1 -0
- package/dist/MarkdownRenderer/markdownReactShared.d.ts +93 -0
- package/dist/MarkdownRenderer/markdownReactShared.js +1159 -0
- package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.d.ts +15 -0
- package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.js +61 -0
- package/dist/MarkdownRenderer/streaming/lastBlockThrottle.d.ts +4 -0
- package/dist/MarkdownRenderer/streaming/lastBlockThrottle.js +14 -0
- package/dist/MarkdownRenderer/streaming/revisionPolicy.d.ts +5 -0
- package/dist/MarkdownRenderer/streaming/revisionPolicy.js +10 -0
- package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.d.ts +6 -0
- package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +70 -0
- package/dist/MarkdownRenderer/useMarkdownToReact.d.ts +3 -22
- package/dist/MarkdownRenderer/useMarkdownToReact.js +3 -1286
- package/package.json +2 -1
|
@@ -357,7 +357,8 @@ var SCHEMA_LANGUAGES = new Set([
|
|
|
357
357
|
prefixCls: prefixCls,
|
|
358
358
|
linkConfig: linkConfig,
|
|
359
359
|
streaming: streaming,
|
|
360
|
-
streamingParagraphAnimation: streamingParagraphAnimation
|
|
360
|
+
streamingParagraphAnimation: streamingParagraphAnimation,
|
|
361
|
+
contentRevisionSource: streaming ? displayedContent : undefined
|
|
361
362
|
});
|
|
362
363
|
return wrapVarSSR(wrapSSR(wrapContentSSR(/*#__PURE__*/ React.createElement("div", {
|
|
363
364
|
ref: containerRef,
|
|
@@ -7,5 +7,7 @@ export { CodeBlockRenderer } from './renderers/CodeRenderer';
|
|
|
7
7
|
export { MermaidBlockRenderer } from './renderers/MermaidRenderer';
|
|
8
8
|
export { SchemaBlockRenderer } from './renderers/SchemaRenderer';
|
|
9
9
|
export type { CharacterQueueOptions, MarkdownRendererProps, MarkdownRendererRef, RenderMode, RendererBlockProps, } from './types';
|
|
10
|
+
export type { UseMarkdownToReactOptions } from './markdownReactShared';
|
|
10
11
|
export { markdownToReactSync, useMarkdownToReact } from './useMarkdownToReact';
|
|
12
|
+
export { useStreamingMarkdownReact } from './streaming/useStreamingMarkdownReact';
|
|
11
13
|
export { useStreaming } from './useStreaming';
|
|
@@ -6,4 +6,5 @@ export { CodeBlockRenderer } from "./renderers/CodeRenderer";
|
|
|
6
6
|
export { MermaidBlockRenderer } from "./renderers/MermaidRenderer";
|
|
7
7
|
export { SchemaBlockRenderer } from "./renderers/SchemaRenderer";
|
|
8
8
|
export { markdownToReactSync, useMarkdownToReact } from "./useMarkdownToReact";
|
|
9
|
+
export { useStreamingMarkdownReact } from "./streaming/useStreamingMarkdownReact";
|
|
9
10
|
export { useStreaming } from "./useStreaming";
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Processor } from 'unified';
|
|
3
|
+
import { type MarkdownRemarkPlugin, type MarkdownToHtmlConfig } from '../MarkdownEditor/editor/utils/markdownToHtml';
|
|
4
|
+
import type { RendererBlockProps } from './types';
|
|
5
|
+
declare const createHastProcessor: (extraRemarkPlugins?: MarkdownRemarkPlugin[], config?: MarkdownToHtmlConfig) => Processor;
|
|
6
|
+
/**
|
|
7
|
+
* 构建与 MarkdownEditor Readonly 组件对齐的 hast→React 组件映射。
|
|
8
|
+
*
|
|
9
|
+
* MarkdownEditor 的 Slate 元素使用 data-be 属性和 prefixCls 类名,
|
|
10
|
+
* 这里为原生 HTML 标签添加相同的属性,使共用的 CSS 能正确命中。
|
|
11
|
+
*/
|
|
12
|
+
declare const buildEditorAlignedComponents: (prefixCls: string, userComponents: Record<string, React.ComponentType<RendererBlockProps>>, streaming?: boolean, linkConfig?: {
|
|
13
|
+
openInNewTab?: boolean | undefined;
|
|
14
|
+
onClick?: ((url?: string) => boolean | void) | undefined;
|
|
15
|
+
} | undefined, streamingParagraphAnimation?: boolean) => {
|
|
16
|
+
p: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
17
|
+
h1: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
18
|
+
h2: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
19
|
+
h3: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
20
|
+
h4: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
21
|
+
h5: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
22
|
+
h6: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
23
|
+
blockquote: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
24
|
+
ul: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
25
|
+
ol: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
26
|
+
li: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
27
|
+
table: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
28
|
+
thead: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
29
|
+
tbody: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
30
|
+
tr: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
31
|
+
th: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
32
|
+
td: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
33
|
+
input: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
34
|
+
a: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
35
|
+
strong: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
36
|
+
em: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
37
|
+
del: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
38
|
+
code: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
39
|
+
mark: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
40
|
+
kbd: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
41
|
+
sub: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
42
|
+
pre: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
43
|
+
img: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
44
|
+
video: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
45
|
+
audio: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
46
|
+
iframe: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
47
|
+
hr: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
48
|
+
sup: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
49
|
+
span: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
50
|
+
section: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
51
|
+
think: (props: any) => React.FunctionComponentElement<import("../ToolUseBarThink").ToolUseBarThinkProps>;
|
|
52
|
+
answer: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* 在 hast 上标记「最后一个 p」,用于流式时仅该段落播放入场(单块长文时避免全页 p 一起闪)
|
|
56
|
+
*/
|
|
57
|
+
declare const markLastParagraphStreamingTail: (hast: any) => void;
|
|
58
|
+
/**
|
|
59
|
+
* 将单个 markdown 片段转为 React 元素(内部函数)
|
|
60
|
+
*/
|
|
61
|
+
declare const renderMarkdownBlock: (blockContent: string, processor: Processor, components: Record<string, any>, blockOpts?: {
|
|
62
|
+
markStreamingTailParagraph?: boolean;
|
|
63
|
+
}) => React.ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* 将 markdown 按块(双换行)拆分,尊重代码围栏边界。
|
|
66
|
+
* 返回的每个块是一个独立的 markdown 片段,可单独解析。
|
|
67
|
+
*/
|
|
68
|
+
declare const splitMarkdownBlocks: (content: string) => string[];
|
|
69
|
+
export interface UseMarkdownToReactOptions {
|
|
70
|
+
remarkPlugins?: MarkdownRemarkPlugin[];
|
|
71
|
+
htmlConfig?: MarkdownToHtmlConfig;
|
|
72
|
+
components?: Record<string, React.ComponentType<RendererBlockProps>>;
|
|
73
|
+
/** MarkdownEditor 的 CSS 前缀,用于生成对齐的 className */
|
|
74
|
+
prefixCls?: string;
|
|
75
|
+
/** 链接配置:onClick 拦截、openInNewTab 控制 */
|
|
76
|
+
linkConfig?: {
|
|
77
|
+
openInNewTab?: boolean;
|
|
78
|
+
onClick?: (url?: string) => boolean | void;
|
|
79
|
+
};
|
|
80
|
+
/** 是否处于流式状态,用于最后一个块的打字动画 */
|
|
81
|
+
streaming?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 流式时是否对「生长中的末段」启用段落淡入(AnimationText)。
|
|
84
|
+
* 默认 false:重解析时频繁触发动画易导致整页闪动;需要时再显式传入 true。
|
|
85
|
+
*/
|
|
86
|
+
streamingParagraphAnimation?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 单调增长的原始流字符串,仅用于判断是否应保留分块缓存。
|
|
89
|
+
* 与 `content`(常为 useStreaming 输出的可解析串)分离,避免占位符与正文切换时误判为非前缀修订。
|
|
90
|
+
*/
|
|
91
|
+
contentRevisionSource?: string;
|
|
92
|
+
}
|
|
93
|
+
export { createHastProcessor, buildEditorAlignedComponents, markLastParagraphStreamingTail, renderMarkdownBlock, splitMarkdownBlocks, };
|