@ant-design/agentic-ui 2.30.6 → 2.30.8

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.
Files changed (27) hide show
  1. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +1 -3
  2. package/dist/MarkdownEditor/editor/parser/remarkDirectiveContainersOnly.d.ts +14 -0
  3. package/dist/MarkdownEditor/editor/parser/remarkDirectiveContainersOnly.js +26 -0
  4. package/dist/MarkdownEditor/editor/parser/remarkParse.d.ts +1 -1
  5. package/dist/MarkdownEditor/editor/parser/remarkParse.js +2 -2
  6. package/dist/MarkdownEditor/editor/style.js +7 -5
  7. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +2 -2
  8. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +54 -16
  9. package/dist/MarkdownInputField/FileMapView/index.js +8 -2
  10. package/dist/MarkdownInputField/FileMapView/style.js +5 -1
  11. package/dist/MarkdownRenderer/MarkdownRenderer.js +2 -1
  12. package/dist/MarkdownRenderer/index.d.ts +2 -0
  13. package/dist/MarkdownRenderer/index.js +1 -0
  14. package/dist/MarkdownRenderer/markdownReactShared.d.ts +93 -0
  15. package/dist/MarkdownRenderer/markdownReactShared.js +1159 -0
  16. package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.d.ts +15 -0
  17. package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.js +61 -0
  18. package/dist/MarkdownRenderer/streaming/lastBlockThrottle.d.ts +4 -0
  19. package/dist/MarkdownRenderer/streaming/lastBlockThrottle.js +14 -0
  20. package/dist/MarkdownRenderer/streaming/revisionPolicy.d.ts +5 -0
  21. package/dist/MarkdownRenderer/streaming/revisionPolicy.js +10 -0
  22. package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.d.ts +6 -0
  23. package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +70 -0
  24. package/dist/MarkdownRenderer/useMarkdownToReact.d.ts +3 -22
  25. package/dist/MarkdownRenderer/useMarkdownToReact.js +3 -1286
  26. package/dist/Types/micromark-extension-directive-subpath.d.ts +8 -0
  27. package/package.json +4 -2
@@ -98,7 +98,6 @@ function _unsupported_iterable_to_array(o, minLen) {
98
98
  if (n === "Map" || n === "Set") return Array.from(n);
99
99
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
100
100
  }
101
- import { preprocessProtectTimeFromDirective } from "./constants";
102
101
  import { applyContextPropsAndConfig } from "./parse/applyContextPropsAndConfig";
103
102
  import { handleBlockquote, handleContainerDirective, handleFootnoteDefinition, handleHeading, handleList, handleListItem, handleParagraph, handleTextAndInlineElements } from "./parse/parseBlockElements";
104
103
  import { handleCode, handleYaml } from "./parse/parseCode";
@@ -236,8 +235,7 @@ var removeAnswerTags = function removeAnswerTags(text) {
236
235
  {
237
236
  key: "preprocessMarkdown",
238
237
  value: function preprocessMarkdown(md) {
239
- var timeProtected = preprocessProtectTimeFromDirective(md || '');
240
- var thinkProcessed = removeAnswerTags(preprocessThinkTags(timeProtected));
238
+ var thinkProcessed = removeAnswerTags(preprocessThinkTags(md || ''));
241
239
  var nonStandardProcessed = removeAnswerTags(preprocessNonStandardHtmlTags(thinkProcessed));
242
240
  return preprocessMarkdownTableNewlines(nonStandardProcessed);
243
241
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 仅启用 remark-directive 的 **容器** 语法(`:::name` … `:::`),不解析行内 `:foo` 与块级 `::foo`。
3
+ * 避免普通文本中的 `:15`(时间)或 `:icon[...]` 被误解析为指令。
4
+ *
5
+ * 依赖与 `remark-directive` 相同:`micromark-extension-directive` + `mdast-util-directive`。
6
+ */
7
+ import type { Root } from 'mdast';
8
+ import type { Plugin } from 'unified';
9
+ /**
10
+ * @returns {undefined}
11
+ * Nothing.
12
+ */
13
+ declare const remarkDirectiveContainersOnly: Plugin<[], Root>;
14
+ export default remarkDirectiveContainersOnly;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 仅启用 remark-directive 的 **容器** 语法(`:::name` … `:::`),不解析行内 `:foo` 与块级 `::foo`。
3
+ * 避免普通文本中的 `:15`(时间)或 `:icon[...]` 被误解析为指令。
4
+ *
5
+ * 依赖与 `remark-directive` 相同:`micromark-extension-directive` + `mdast-util-directive`。
6
+ */ import { directiveFromMarkdown, directiveToMarkdown } from "mdast-util-directive";
7
+ import { directiveContainer } from "micromark-extension-directive/lib/directive-container.js";
8
+ /**
9
+ * @returns {undefined}
10
+ * Nothing.
11
+ */ var remarkDirectiveContainersOnly = function remarkDirectiveContainersOnly() {
12
+ var data = this.data();
13
+ var micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
14
+ var fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
15
+ var toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
16
+ micromarkExtensions.push({
17
+ flow: {
18
+ 58: [
19
+ directiveContainer
20
+ ]
21
+ }
22
+ });
23
+ fromMarkdownExtensions.push(directiveFromMarkdown());
24
+ toMarkdownExtensions.push(directiveToMarkdown());
25
+ };
26
+ export default remarkDirectiveContainersOnly;
@@ -20,5 +20,5 @@ export declare function fixStrongWithSpecialChars(): (tree: any) => void;
20
20
  * 须在 remark-math 之前运行
21
21
  */
22
22
  export declare function protectJinjaDollarInText(): (tree: any) => void;
23
- declare const markdownParser: import("unified").Processor<import("mdast").Root, undefined, undefined, import("mdast").Root, string>;
23
+ declare const markdownParser: import("unified").Processor<import("mdast").Root, import("mdast").Root, import("mdast").Root, import("mdast").Root, string>;
24
24
  export default markdownParser;
@@ -23,7 +23,6 @@ function _unsupported_iterable_to_array(o, minLen) {
23
23
  if (n === "Map" || n === "Set") return Array.from(n);
24
24
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
25
  }
26
- import remarkDirective from "remark-directive";
27
26
  import remarkFrontmatter from "remark-frontmatter";
28
27
  import remarkGfm from "remark-gfm";
29
28
  import remarkHtml from "remark-html";
@@ -32,6 +31,7 @@ import remarkParse from "remark-parse";
32
31
  import { unified } from "unified";
33
32
  import { visit } from "unist-util-visit";
34
33
  import { JINJA_DOLLAR_PLACEHOLDER } from "./constants";
34
+ import remarkDirectiveContainersOnly from "./remarkDirectiveContainersOnly";
35
35
  /**
36
36
  * 提取段落节点的文本内容
37
37
  * @param paragraphNode - 段落节点
@@ -363,7 +363,7 @@ import { JINJA_DOLLAR_PLACEHOLDER } from "./constants";
363
363
  // Markdown 解析器(用于解析 Markdown 为 mdast AST)
364
364
  // 注意:这个解析器只用于解析,不包含 HTML 渲染相关的插件
365
365
  var markdownParser = unified().use(remarkParse) // 解析 Markdown
366
- .use(remarkDirective) // 解析 ::: 容器指令(info / warning / success / error / tip{title="..."}
366
+ .use(remarkDirectiveContainersOnly) // 仅解析 ::: 容器(不解析行内 :foo
367
367
  .use(remarkHtml).use(remarkFrontmatter, [
368
368
  'yaml'
369
369
  ]) // 处理前置元数据
@@ -380,10 +380,9 @@ var genStyle = function genStyle(token) {
380
380
  }), _define_property(_obj, 'li + li', {
381
381
  marginTop: '0.25em'
382
382
  }), _define_property(_obj, "blockquote", {
383
- display: 'flex',
383
+ display: 'block',
384
+ boxSizing: 'border-box',
384
385
  padding: '8px 12px',
385
- gap: '10px',
386
- flexGrow: 1,
387
386
  zIndex: 1,
388
387
  fontSize: 'var(--font-size-base)',
389
388
  fontWeight: 'normal',
@@ -392,6 +391,10 @@ var genStyle = function genStyle(token) {
392
391
  position: 'relative',
393
392
  color: 'var(--color-gray-text-secondary)',
394
393
  margin: '0 !important',
394
+ // 原 flex + gap 在子节点之间的间距(::before 为 absolute,不参与 flex)
395
+ '& > * + *': {
396
+ marginTop: '10px'
397
+ },
395
398
  '&:before': {
396
399
  content: "''",
397
400
  left: '0',
@@ -400,8 +403,7 @@ var genStyle = function genStyle(token) {
400
403
  height: 'calc(100% - 22px)',
401
404
  borderRadius: '4px',
402
405
  width: '3px',
403
- display: 'flex',
404
- alignSelf: 'stretch',
406
+ display: 'block',
405
407
  zIndex: 0,
406
408
  backgroundColor: 'var(--color-gray-control-fill-secondary)'
407
409
  }
@@ -167,7 +167,6 @@ function _ts_generator(thisArg, body) {
167
167
  import rehypeKatex from "rehype-katex";
168
168
  import rehypeRaw from "rehype-raw";
169
169
  import rehypeStringify from "rehype-stringify";
170
- import remarkDirective from "remark-directive";
171
170
  import remarkFrontmatter from "remark-frontmatter";
172
171
  import remarkGfm from "remark-gfm";
173
172
  import remarkMath from "remark-math";
@@ -177,6 +176,7 @@ import { unified } from "unified";
177
176
  import { visit } from "unist-util-visit";
178
177
  import { JINJA_DOLLAR_PLACEHOLDER } from "../parser/constants";
179
178
  import { remarkDirectiveContainer } from "../parser/remarkDirectiveContainer";
179
+ import remarkDirectiveContainersOnly from "../parser/remarkDirectiveContainersOnly";
180
180
  import { convertParagraphToImage, fixStrongWithSpecialChars, protectJinjaDollarInText } from "../parser/remarkParse";
181
181
  // HTML 转义相关的正则表达式和工具
182
182
  var ESCAPE_TEST_NO_ENCODE = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
@@ -373,7 +373,7 @@ export var DEFAULT_MARKDOWN_REMARK_PLUGINS = [
373
373
  remarkFrontmatter,
374
374
  FRONTMATTER_LANGUAGES
375
375
  ],
376
- remarkDirective,
376
+ remarkDirectiveContainersOnly,
377
377
  [
378
378
  remarkDirectiveContainer,
379
379
  REMARK_DIRECTIVE_CONTAINER_OPTIONS
@@ -117,6 +117,55 @@ import { isFileMetaPlaceholderState, kbToSize } from "../AttachmentButton/utils"
117
117
  var lastDotIndex = fileName.lastIndexOf('.');
118
118
  var displayName = lastDotIndex > 0 ? fileName.slice(0, lastDotIndex) : fileName;
119
119
  var displayExtension = lastDotIndex > 0 && lastDotIndex < fileName.length - 1 ? fileName.slice(lastDotIndex + 1) : '';
120
+ var showSize = typeof file.size === 'number' && file.size > 0;
121
+ var fileSize = showSize ? kbToSize(file.size / 1024) : '';
122
+ var lastModifiedTime = (file === null || file === void 0 ? void 0 : file.lastModified) ? dayjs(file.lastModified).format('HH:mm') : '';
123
+ var renderExtensionContainer = function renderExtensionContainer() {
124
+ if (file.status === 'error' && file.errorMessage) {
125
+ return /*#__PURE__*/ React.createElement("div", {
126
+ "data-testid": "file-item-extension-container",
127
+ className: classNames("".concat(props.prefixCls, "-file-name-extension-container"), props.hashId)
128
+ }, /*#__PURE__*/ React.createElement("span", {
129
+ className: classNames("".concat(props.prefixCls, "-file-error-msg"), props.hashId),
130
+ "data-testid": "file-item-error-msg",
131
+ style: {
132
+ color: 'var(--color-red-text-secondary)'
133
+ }
134
+ }, file.errorMessage));
135
+ }
136
+ var items = [];
137
+ if (displayExtension) {
138
+ items.push(/*#__PURE__*/ React.createElement("span", {
139
+ key: "ext",
140
+ "data-testid": "file-item-extension",
141
+ className: classNames("".concat(props.prefixCls, "-file-name-extension"), props.hashId)
142
+ }, displayExtension));
143
+ }
144
+ if (fileSize) {
145
+ items.push(/*#__PURE__*/ React.createElement("div", {
146
+ key: "size",
147
+ "data-testid": "file-item-size",
148
+ className: classNames("".concat(props.prefixCls, "-file-size"), props.hashId)
149
+ }, fileSize));
150
+ }
151
+ if (lastModifiedTime) {
152
+ items.push(/*#__PURE__*/ React.createElement("div", {
153
+ key: "time",
154
+ "data-testid": "file-item-time"
155
+ }, lastModifiedTime));
156
+ }
157
+ if (items.length === 0) return null;
158
+ return /*#__PURE__*/ React.createElement("div", {
159
+ "data-testid": "file-item-extension-container",
160
+ className: classNames("".concat(props.prefixCls, "-file-name-extension-container"), props.hashId)
161
+ }, items.map(function(item, index) {
162
+ return /*#__PURE__*/ React.createElement(React.Fragment, {
163
+ key: index
164
+ }, index > 0 && /*#__PURE__*/ React.createElement("span", {
165
+ className: classNames("".concat(props.prefixCls, "-separator"), props.hashId)
166
+ }, "|"), item);
167
+ }));
168
+ };
120
169
  // 有 status 但无 url/previewUrl:文件内容未拿到,展示大小与格式占位块(loading 状态除外)
121
170
  if (isFileMetaPlaceholderState(file)) {
122
171
  return /*#__PURE__*/ React.createElement(FileMetaPlaceholder, {
@@ -162,33 +211,22 @@ import { isFileMetaPlaceholderState, kbToSize } from "../AttachmentButton/utils"
162
211
  className: classNames(props.className, _define_property({}, "".concat(props.prefixCls, "-meta-placeholder"), isFileMetaPlaceholderState(file))),
163
212
  "data-testid": "file-item"
164
213
  }, /*#__PURE__*/ React.createElement("div", {
214
+ "data-testid": "file-item-icon",
165
215
  className: classNames("".concat(props.prefixCls, "-file-icon"), props.hashId)
166
216
  }, /*#__PURE__*/ React.createElement(AttachmentFileIcon, {
167
217
  file: file,
168
218
  className: classNames("".concat(props.prefixCls, "-file-icon-img"), props.hashId)
169
219
  })), /*#__PURE__*/ React.createElement("div", {
220
+ "data-testid": "file-item-info",
170
221
  className: classNames("".concat(props.prefixCls, "-file-info"), props.hashId)
171
222
  }, /*#__PURE__*/ React.createElement("div", {
172
223
  className: classNames("".concat(props.prefixCls, "-file-name"), props.hashId)
173
224
  }, /*#__PURE__*/ React.createElement("span", {
225
+ "data-testid": "file-item-name",
174
226
  className: classNames("".concat(props.prefixCls, "-file-name-text"), props.hashId),
175
227
  title: file === null || file === void 0 ? void 0 : file.name
176
- }, displayName)), /*#__PURE__*/ React.createElement("div", {
177
- className: classNames("".concat(props.prefixCls, "-file-name-extension-container"), props.hashId)
178
- }, file.status === 'error' && file.errorMessage ? /*#__PURE__*/ React.createElement("span", {
179
- className: classNames("".concat(props.prefixCls, "-file-error-msg"), props.hashId),
180
- style: {
181
- color: 'var(--color-red-text-secondary)'
182
- }
183
- }, file.errorMessage) : /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("span", {
184
- className: classNames("".concat(props.prefixCls, "-file-name-extension"), props.hashId)
185
- }, displayExtension), /*#__PURE__*/ React.createElement("span", {
186
- className: classNames("".concat(props.prefixCls, "-separator"), props.hashId)
187
- }, "|"), /*#__PURE__*/ React.createElement("div", {
188
- className: classNames("".concat(props.prefixCls, "-file-size"), props.hashId)
189
- }, kbToSize(file.size / 1024)), /*#__PURE__*/ React.createElement("span", {
190
- className: classNames("".concat(props.prefixCls, "-separator"), props.hashId)
191
- }, "|"), /*#__PURE__*/ React.createElement("div", null, (file === null || file === void 0 ? void 0 : file.lastModified) ? dayjs(file === null || file === void 0 ? void 0 : file.lastModified).format('HH:mm') : '')))), hovered ? /*#__PURE__*/ React.createElement("div", {
228
+ }, displayName)), renderExtensionContainer()), hovered ? /*#__PURE__*/ React.createElement("div", {
229
+ "data-testid": "file-item-action-bar",
192
230
  className: classNames("".concat(props.prefixCls, "-action-bar"), props.hashId)
193
231
  }, props.customSlot ? /*#__PURE__*/ React.createElement(ActionIconBox, {
194
232
  title: '更多',
@@ -335,6 +335,7 @@ import { useStyle } from "./style";
335
335
  };
336
336
  var _obj;
337
337
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
338
+ "data-testid": "file-view-list",
338
339
  style: {
339
340
  display: 'flex',
340
341
  flexDirection: 'column',
@@ -344,7 +345,7 @@ import { useStyle } from "./style";
344
345
  alignItems: placement === 'left' ? 'flex-start' : 'flex-end',
345
346
  width: 'max-content'
346
347
  }
347
- }, /*#__PURE__*/ React.createElement(motion.div, {
348
+ }, imgList.length > 0 && /*#__PURE__*/ React.createElement(motion.div, {
348
349
  variants: {
349
350
  visible: {
350
351
  opacity: 1,
@@ -364,6 +365,7 @@ import { useStyle } from "./style";
364
365
  initial: "hidden",
365
366
  animate: 'visible',
366
367
  style: props.style,
368
+ "data-testid": "file-view-image-list",
367
369
  className: classNames(prefix, hashId, props.className, "".concat(prefix, "-").concat(placement), (_obj = {}, _define_property(_obj, "".concat(prefix, "-image-list-view"), imgList.length > 1), _define_property(_obj, "".concat(prefix, "-image-list-view-").concat(placement), imgList.length > 1), _obj))
368
370
  }, /*#__PURE__*/ React.createElement(Image.PreviewGroup, null, imgList.map(function(file, index) {
369
371
  if (file.status !== undefined && file.status !== null && !file.url && !file.previewUrl) {
@@ -391,6 +393,7 @@ import { useStyle } from "./style";
391
393
  whileInView: "visible",
392
394
  initial: "hidden",
393
395
  animate: "visible",
396
+ "data-testid": "file-view-video-list",
394
397
  className: classNames("".concat(prefix, "-video-row"), "".concat(prefix, "-video-row-").concat(placement), hashId),
395
398
  style: props.style
396
399
  }, videoList.map(function(file, index) {
@@ -424,6 +427,7 @@ import { useStyle } from "./style";
424
427
  }
425
428
  },
426
429
  "aria-label": "播放视频:".concat(file.name),
430
+ "data-testid": "file-view-video-thumb",
427
431
  style: thumbSize
428
432
  }, /*#__PURE__*/ React.createElement("video", {
429
433
  src: videoUrl,
@@ -459,7 +463,7 @@ import { useStyle } from "./style";
459
463
  maxWidth: '80vw',
460
464
  maxHeight: '80vh'
461
465
  }
462
- })), /*#__PURE__*/ React.createElement(motion.div, {
466
+ })), allNoMediaFiles.length > 0 && /*#__PURE__*/ React.createElement(motion.div, {
463
467
  variants: {
464
468
  visible: {
465
469
  opacity: 1,
@@ -478,6 +482,7 @@ import { useStyle } from "./style";
478
482
  whileInView: "visible",
479
483
  initial: "hidden",
480
484
  animate: 'visible',
485
+ "data-testid": "file-view-file-list",
481
486
  className: classNames(prefix, hashId, props.className, "".concat(prefix, "-").concat(placement), "".concat(prefix, "-vertical")),
482
487
  style: props.style
483
488
  }, noMediaFileList.map(function(file, index) {
@@ -503,6 +508,7 @@ import { useStyle } from "./style";
503
508
  file: file
504
509
  });
505
510
  }), props.maxDisplayCount !== undefined && allNoMediaFiles.length > props.maxDisplayCount && !showAllFiles ? /*#__PURE__*/ React.createElement("div", {
511
+ "data-testid": "file-view-view-all",
506
512
  style: {
507
513
  width: (_props_style = props.style) === null || _props_style === void 0 ? void 0 : _props_style.width
508
514
  },
@@ -77,7 +77,11 @@ var genStyle = function genStyle(token) {
77
77
  flexWrap: 'wrap',
78
78
  alignItems: 'flex-start',
79
79
  gap: 4,
80
- maxWidth: 'calc(285px * 3 + 4px * 2)'
80
+ padding: 0,
81
+ maxWidth: 'calc(285px * 3 + 4px * 2)',
82
+ '& > :only-child': {
83
+ marginTop: 8
84
+ }
81
85
  },
82
86
  '&::-webkit-scrollbar': {
83
87
  width: 6
@@ -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 { buildEditorAlignedComponents, createHastProcessor, markLastParagraphStreamingTail, renderMarkdownBlock, splitMarkdownBlocks, };