@ant-design/agentic-ui 2.30.9 → 2.30.11

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 (48) hide show
  1. package/dist/ChatLayout/style.js +16 -13
  2. package/dist/Components/ActionIconBox/index.js +4 -0
  3. package/dist/Components/Button/IconButton/style.js +1 -1
  4. package/dist/Components/Button/ToggleButton/style.js +1 -1
  5. package/dist/Constants/mobile.d.ts +2 -2
  6. package/dist/Constants/mobile.js +1 -1
  7. package/dist/History/style.js +2 -2
  8. package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -1
  9. package/dist/MarkdownEditor/editor/Editor.js +22 -6
  10. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +27 -5
  11. package/dist/MarkdownEditor/editor/style.js +7 -3
  12. package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/index.js +2 -2
  13. package/dist/MarkdownEditor/editor/utils/findMatchingClose.js +38 -18
  14. package/dist/MarkdownEditor/style.js +13 -2
  15. package/dist/MarkdownEditor/types.d.ts +11 -1
  16. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +1 -1
  17. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +3 -3
  18. package/dist/MarkdownInputField/FileMapView/style.js +3 -2
  19. package/dist/MarkdownInputField/SkillModeBar/style.js +1 -1
  20. package/dist/MarkdownInputField/style.js +1 -1
  21. package/dist/MarkdownRenderer/MarkdownRenderer.js +3 -2
  22. package/dist/MarkdownRenderer/index.d.ts +1 -1
  23. package/dist/MarkdownRenderer/markdownReactShared.d.ts +35 -28
  24. package/dist/MarkdownRenderer/markdownReactShared.js +181 -60
  25. package/dist/MarkdownRenderer/renderers/MermaidRenderer.d.ts +2 -2
  26. package/dist/MarkdownRenderer/renderers/MermaidRenderer.js +162 -5
  27. package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +3 -2
  28. package/dist/MarkdownRenderer/types.d.ts +21 -0
  29. package/dist/MarkdownRenderer/useStreaming.js +50 -15
  30. package/dist/Plugins/mermaid/Mermaid.d.ts +2 -28
  31. package/dist/Plugins/mermaid/Mermaid.js +13 -30
  32. package/dist/Plugins/mermaid/MermaidFallback.d.ts +5 -2
  33. package/dist/Plugins/mermaid/MermaidFallback.js +13 -10
  34. package/dist/Plugins/mermaid/MermaidRendererImpl.d.ts +0 -4
  35. package/dist/Plugins/mermaid/MermaidRendererImpl.js +15 -22
  36. package/dist/Plugins/mermaid/style.d.ts +0 -5
  37. package/dist/Plugins/mermaid/style.js +18 -71
  38. package/dist/ThoughtChainList/style.js +1 -1
  39. package/dist/ToolUseBarThink/style.js +1 -1
  40. package/dist/Workspace/Browser/index.d.ts +6 -0
  41. package/dist/Workspace/Browser/index.js +22 -13
  42. package/dist/Workspace/Browser/style.js +14 -15
  43. package/dist/Workspace/File/FileComponent.js +4 -4
  44. package/dist/Workspace/File/PreviewComponent.js +4 -4
  45. package/dist/Workspace/File/style.js +33 -39
  46. package/dist/Workspace/RealtimeFollow/style.js +78 -85
  47. package/dist/Workspace/style.js +41 -53
  48. package/package.json +3 -3
@@ -52,6 +52,9 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  import { MOBILE_BREAKPOINT, MOBILE_PADDING } from "../Constants/mobile";
54
54
  import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
55
+ var RADIUS_XL = 'var(--radius-xl, var(--radius-card-lg, 16px))';
56
+ var COLOR_GRAY_BG_ACTIVE = 'var(--color-gray-bg-active, var(--color-gray-control-fill-active, rgba(20, 22, 28, 0.12)))';
57
+ var COLOR_GRAY_BORDER_DEFAULT = 'var(--color-gray-border-default, var(--color-gray-border-light, rgba(20, 22, 28, 0.12)))';
55
58
  var genStyle = function genStyle(token) {
56
59
  return _define_property({}, token.componentCls, _define_property({
57
60
  display: 'flex',
@@ -59,10 +62,10 @@ var genStyle = function genStyle(token) {
59
62
  height: '100%',
60
63
  width: '100%',
61
64
  position: 'relative',
62
- borderTopLeftRadius: 'var(--radius-xl)',
63
- borderTopRightRadius: 'var(--radius-xl)',
64
- borderBottomLeftRadius: 'var(--radius-xl)',
65
- borderBottomRightRadius: 'var(--radius-xl)',
65
+ borderTopLeftRadius: RADIUS_XL,
66
+ borderTopRightRadius: RADIUS_XL,
67
+ borderBottomLeftRadius: RADIUS_XL,
68
+ borderBottomRightRadius: RADIUS_XL,
66
69
  backgroundColor: 'var(--color-gray-bg-page-light)',
67
70
  '&-header': {
68
71
  display: 'flex',
@@ -73,8 +76,8 @@ var genStyle = function genStyle(token) {
73
76
  minHeight: '48px',
74
77
  flexShrink: 0,
75
78
  zIndex: 10,
76
- borderTopLeftRadius: 'var(--radius-xl)',
77
- borderTopRightRadius: 'var(--radius-xl)',
79
+ borderTopLeftRadius: RADIUS_XL,
80
+ borderTopRightRadius: RADIUS_XL,
78
81
  '&-left': {
79
82
  display: 'flex',
80
83
  alignItems: 'center',
@@ -104,7 +107,7 @@ var genStyle = function genStyle(token) {
104
107
  color: 'var(--color-gray-text-default)'
105
108
  },
106
109
  '&:active': {
107
- backgroundColor: 'var(--color-gray-bg-active)'
110
+ backgroundColor: COLOR_GRAY_BG_ACTIVE
108
111
  }
109
112
  }
110
113
  },
@@ -129,7 +132,7 @@ var genStyle = function genStyle(token) {
129
132
  color: 'var(--color-gray-text-default)'
130
133
  },
131
134
  '&:active': {
132
- backgroundColor: 'var(--color-gray-bg-active)'
135
+ backgroundColor: COLOR_GRAY_BG_ACTIVE
133
136
  }
134
137
  },
135
138
  '&-collapse-btn': {
@@ -150,7 +153,7 @@ var genStyle = function genStyle(token) {
150
153
  color: 'var(--color-gray-text-default)'
151
154
  },
152
155
  '&:active': {
153
- backgroundColor: 'var(--color-gray-bg-active)'
156
+ backgroundColor: COLOR_GRAY_BG_ACTIVE
154
157
  }
155
158
  }
156
159
  }
@@ -159,7 +162,7 @@ var genStyle = function genStyle(token) {
159
162
  position: 'relative',
160
163
  zIndex: 1,
161
164
  width: '100%',
162
- paddingBottom: 'var(--radius-xl)',
165
+ paddingBottom: RADIUS_XL,
163
166
  flex: 1,
164
167
  overflow: 'hidden',
165
168
  display: 'flex',
@@ -181,7 +184,7 @@ var genStyle = function genStyle(token) {
181
184
  backgroundColor: 'var(--color-gray-border-light)',
182
185
  borderRadius: '3px',
183
186
  '&:hover': {
184
- backgroundColor: 'var(--color-gray-border-default)'
187
+ backgroundColor: COLOR_GRAY_BORDER_DEFAULT
185
188
  }
186
189
  },
187
190
  '> div': {
@@ -202,8 +205,8 @@ var genStyle = function genStyle(token) {
202
205
  position: 'absolute',
203
206
  bottom: 0,
204
207
  zIndex: 100,
205
- borderBottomLeftRadius: 'var(--radius-xl)',
206
- borderBottomRightRadius: 'var(--radius-xl)'
208
+ borderBottomLeftRadius: RADIUS_XL,
209
+ borderBottomRightRadius: RADIUS_XL
207
210
  },
208
211
  '&-footer-background': {
209
212
  position: 'absolute',
@@ -357,6 +357,7 @@ import { useStyle } from "./style";
357
357
  switch(_state.label){
358
358
  case 0:
359
359
  e.preventDefault();
360
+ e.stopPropagation();
360
361
  if (!props.onClick) return [
361
362
  2
362
363
  ];
@@ -413,6 +414,7 @@ import { useStyle } from "./style";
413
414
  5
414
415
  ];
415
416
  e.preventDefault();
417
+ e.stopPropagation();
416
418
  if (!props.onClick) return [
417
419
  2
418
420
  ];
@@ -481,6 +483,7 @@ import { useStyle } from "./style";
481
483
  switch(_state.label){
482
484
  case 0:
483
485
  e.preventDefault();
486
+ e.stopPropagation();
484
487
  if (!props.onClick) return [
485
488
  2
486
489
  ];
@@ -537,6 +540,7 @@ import { useStyle } from "./style";
537
540
  5
538
541
  ];
539
542
  e.preventDefault();
543
+ e.stopPropagation();
540
544
  if (!props.onClick) return [
541
545
  2
542
546
  ];
@@ -65,7 +65,7 @@ var genStyle = function genStyle(token) {
65
65
  border: 'none',
66
66
  borderRadius: 'var(--radius-control-base, 6px)',
67
67
  cursor: 'pointer',
68
- fontFamily: 'var(--font-family-base)',
68
+ fontFamily: 'var(--font-family-base, var(--font-family-text, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif))',
69
69
  fontSize: 'var(--font-size-base, 14px)',
70
70
  fontWeight: 'var(--font-weight-medium, 500)',
71
71
  lineHeight: 'var(--line-height-base, 1.5)',
@@ -62,7 +62,7 @@ var genStyle = function genStyle(token) {
62
62
  alignItems: 'center',
63
63
  padding: '5px 12px',
64
64
  cursor: 'pointer',
65
- fontFamily: 'var(--font-family-base)',
65
+ fontFamily: 'var(--font-family-base, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif)',
66
66
  fontSize: 'var(--font-size-base, 14px)',
67
67
  fontWeight: 'var(--font-weight-medium, 500)',
68
68
  lineHeight: 'var(--line-height-base, 1.5)',
@@ -6,8 +6,8 @@
6
6
  export declare const TABLE_COL_WIDTH_MIN_COLUMNS = 5;
7
7
  /** 编辑模式表格:列数 >= 此值时才计算并渲染 data col 元素,否则仅渲染行号列 */
8
8
  export declare const TABLE_EDIT_COL_WIDTH_MIN_COLUMNS = 3;
9
- /** 表格默认列宽 (px),与 style.ts 中 --agentic-ui-table-cell-min-width (120px) 保持一致 */
10
- export declare const TABLE_DEFAULT_COL_WIDTH = 120;
9
+ /** 表格默认列宽 (px),与 style.ts 中 --agentic-ui-table-cell-min-width (40px) 保持一致 */
10
+ export declare const TABLE_DEFAULT_COL_WIDTH = 40;
11
11
  /** 表格最后一列最小宽度 (px),弹性列用于吸收剩余空间 */
12
12
  export declare const TABLE_LAST_COL_MIN_WIDTH = 80;
13
13
  export declare const MOBILE_PADDING = "clamp(4px, 2vw, 12px)";
@@ -8,7 +8,7 @@ var MOBILE_TABLE_MIN_CELL_WIDTH = 96;
8
8
  * - 列数 >= 5:使用 TABLE_DEFAULT_COL_WIDTH 固定宽度
9
9
  */ export var TABLE_COL_WIDTH_MIN_COLUMNS = 5;
10
10
  /** 编辑模式表格:列数 >= 此值时才计算并渲染 data col 元素,否则仅渲染行号列 */ export var TABLE_EDIT_COL_WIDTH_MIN_COLUMNS = 3;
11
- /** 表格默认列宽 (px),与 style.ts 中 --agentic-ui-table-cell-min-width (120px) 保持一致 */ export var TABLE_DEFAULT_COL_WIDTH = 120;
11
+ /** 表格默认列宽 (px),与 style.ts 中 --agentic-ui-table-cell-min-width (40px) 保持一致 */ export var TABLE_DEFAULT_COL_WIDTH = 40;
12
12
  /** 表格最后一列最小宽度 (px),弹性列用于吸收剩余空间 */ export var TABLE_LAST_COL_MIN_WIDTH = 80;
13
13
  export var MOBILE_PADDING = "clamp(".concat(MOBILE_PADDING_MIN, ", ").concat(MOBILE_PADDING_SCALE, ", ").concat(MOBILE_PADDING_MAX, ")");
14
14
  export var MOBILE_BREAKPOINT = '768px';
@@ -241,10 +241,10 @@ var genStyle = function genStyle(token) {
241
241
  transform: 'translateX(0)'
242
242
  },
243
243
  '95%': {
244
- transform: 'translateX(var(--scroll-width))'
244
+ transform: 'translateX(var(--scroll-width, 0px))'
245
245
  },
246
246
  '100%': {
247
- transform: 'translateX(var(--scroll-width))'
247
+ transform: 'translateX(var(--scroll-width, 0px))'
248
248
  }
249
249
  }), // 为超长文本添加滚动效果
250
250
  _define_property(_obj2, '[data-overflow="true"]', {
@@ -441,7 +441,8 @@ var I18nBoundary = function I18nBoundary(param) {
441
441
  }, contentStyle),
442
442
  prefixCls: baseClassName,
443
443
  fncProps: props.fncProps,
444
- linkConfig: props.linkConfig
444
+ linkConfig: props.linkConfig,
445
+ eleRender: props.eleRender
445
446
  }), children))));
446
447
  }
447
448
  var _obj1;
@@ -959,7 +959,7 @@ var defaultAllowedTypes = [
959
959
  };
960
960
  /**
961
961
  * 处理输入法开始事件
962
- */ var onCompositionStart = function onCompositionStart(e) {
962
+ */ var onCompositionStart = function onCompositionStart() {
963
963
  var _markdownEditorRef_current_selection;
964
964
  if (markdownContainerRef.current) {
965
965
  markdownContainerRef.current.setAttribute('data-composition', '');
@@ -979,8 +979,18 @@ var defaultAllowedTypes = [
979
979
  }
980
980
  }
981
981
  }
982
- if (markdownEditorRef.current.selection && Range.isCollapsed(markdownEditorRef.current.selection)) {
983
- e.preventDefault();
982
+ // 注意:不在此处调用 e.preventDefault()
983
+ // 移动端(Android GBoard / iOS 软键盘)所有输入都经过组合事件,
984
+ // 调用 preventDefault 会阻断浏览器将字符写入 contenteditable,
985
+ // 导致 Slate 模型永远为空,占位符无法消失。
986
+ };
987
+ /**
988
+ * 部分 Android WebView(如微信)可能跳过 compositionstart 直接触发
989
+ * compositionupdate,此处兜底确保 data-composition 始终被设置。
990
+ */ var onCompositionUpdate = function onCompositionUpdate() {
991
+ if (markdownContainerRef.current && !markdownContainerRef.current.hasAttribute('data-composition')) {
992
+ markdownContainerRef.current.setAttribute('data-composition', '');
993
+ store.inputComposition = true;
984
994
  }
985
995
  };
986
996
  /**
@@ -988,9 +998,6 @@ var defaultAllowedTypes = [
988
998
  */ var onCompositionEnd = function onCompositionEnd() {
989
999
  var _markdownEditorRef_current_selection;
990
1000
  store.inputComposition = false;
991
- if (markdownContainerRef.current) {
992
- markdownContainerRef.current.removeAttribute('data-composition');
993
- }
994
1001
  var focusPath = ((_markdownEditorRef_current_selection = markdownEditorRef.current.selection) === null || _markdownEditorRef_current_selection === void 0 ? void 0 : _markdownEditorRef_current_selection.focus.path) || [];
995
1002
  if (focusPath.length > 0) {
996
1003
  var _markdownEditorRef_current_selection1;
@@ -1005,6 +1012,14 @@ var defaultAllowedTypes = [
1005
1012
  }
1006
1013
  }
1007
1014
  }
1015
+ // 延迟到下一帧移除 data-composition,确保 Slate 完成模型更新、
1016
+ // React 完成重渲染(isEmpty 变为 false、empty class 移除)后
1017
+ // 再解除占位符隐藏,避免竞态导致占位符短暂闪现。
1018
+ requestAnimationFrame(function() {
1019
+ if (markdownContainerRef.current) {
1020
+ markdownContainerRef.current.removeAttribute('data-composition');
1021
+ }
1022
+ });
1008
1023
  };
1009
1024
  var elementRenderElement = useRefFunction(function(eleProps) {
1010
1025
  var _props_lazy;
@@ -1227,6 +1242,7 @@ var defaultAllowedTypes = [
1227
1242
  autoCorrect: "off",
1228
1243
  autoCapitalize: "none",
1229
1244
  onCompositionStart: onCompositionStart,
1245
+ onCompositionUpdate: onCompositionUpdate,
1230
1246
  onCompositionEnd: onCompositionEnd,
1231
1247
  className: classNames(props.className, baseClassName, (_obj = {}, _define_property(_obj, "".concat(baseClassName, "-").concat(readonlyCls), readonlyCls), _define_property(_obj, "".concat(baseClassName, "-report"), props.reportMode), _define_property(_obj, "".concat(baseClassName, "-edit"), !readonly), _define_property(_obj, "".concat(baseClassName, "-compact"), props.compact), _obj), hashId),
1232
1248
  style: props.style,
@@ -97,7 +97,7 @@ function _unsupported_iterable_to_array(o, minLen) {
97
97
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
98
98
  }
99
99
  import classNames from "clsx";
100
- import React, { useContext } from "react";
100
+ import React, { useContext, useEffect, useState } from "react";
101
101
  import { Node } from "slate";
102
102
  import { I18nContext } from "../../../../I18n";
103
103
  import { debugInfo } from "../../../../Utils/debugUtils";
@@ -115,6 +115,28 @@ export var Paragraph = function Paragraph(props) {
115
115
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownEditorRef = _useEditorStore.markdownEditorRef, markdownContainerRef = _useEditorStore.markdownContainerRef, readonly = _useEditorStore.readonly, editorProps = _useEditorStore.editorProps;
116
116
  var locale = useContext(I18nContext).locale;
117
117
  var _useSelStatus = _sliced_to_array(useSelStatus(props.element), 1), selected = _useSelStatus[0];
118
+ // 将 store.inputComposition(可变对象属性)同步到 React state,
119
+ // 使 useMemo 能在组合输入状态变化时重新评估 isEmpty,
120
+ // 避免竞态导致占位符在组合结束后短暂闪现。
121
+ var _useState = _sliced_to_array(useState(false), 2), isComposing = _useState[0], setIsComposing = _useState[1];
122
+ useEffect(function() {
123
+ var container = markdownContainerRef.current;
124
+ if (!container) return;
125
+ var observer = new MutationObserver(function() {
126
+ setIsComposing(container.hasAttribute('data-composition'));
127
+ });
128
+ observer.observe(container, {
129
+ attributes: true,
130
+ attributeFilter: [
131
+ 'data-composition'
132
+ ]
133
+ });
134
+ return function() {
135
+ return observer.disconnect();
136
+ };
137
+ }, [
138
+ markdownContainerRef
139
+ ]);
118
140
  return React.useMemo(function() {
119
141
  var _props_element_children_every, _props_element_children, _props_element, _markdownEditorRef_current, _props_children;
120
142
  var str = Node.string(props.element).trim();
@@ -129,10 +151,9 @@ export var Paragraph = function Paragraph(props) {
129
151
  var hasOnlyTextNodes = (_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_children = _props_element.children) === null || _props_element_children === void 0 ? void 0 : (_props_element_children_every = _props_element_children.every) === null || _props_element_children_every === void 0 ? void 0 : _props_element_children_every.call(_props_element_children, function(child) {
130
152
  return !child.type && !child.code && !child.tag;
131
153
  });
132
- // trim 后的字符串为空时,应该显示 placeholder
133
- // 需要满足:只有一个段落节点,且所有子节点都是纯文本节点
134
- // 注意:当只输入空格时,trim() 后为空,!str true,应该正确显示 placeholder
135
- var isEmpty = !str && ((_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length) === 1 && hasOnlyTextNodes ? true : undefined;
154
+ // 组合输入进行中时,Slate 模型尚未更新(字符还在 IME 候选区),
155
+ // 此时强制视为非空以隐藏占位符,避免用户输入时占位符仍然可见。
156
+ var isEmpty = !str && !isComposing && ((_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length) === 1 && hasOnlyTextNodes ? true : undefined;
136
157
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
137
158
  "data-be": 'paragraph',
138
159
  "data-drag-el": true,
@@ -155,6 +176,7 @@ export var Paragraph = function Paragraph(props) {
155
176
  align,
156
177
  readonly,
157
178
  selected,
179
+ isComposing,
158
180
  (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length,
159
181
  editorProps.titlePlaceholderContent
160
182
  ]);
@@ -203,7 +203,7 @@ var genStyle = function genStyle(token) {
203
203
  width: '8px',
204
204
  height: '8px'
205
205
  }), _define_property(_obj, '::-webkit-scrollbar-thumb', {
206
- backgroundColor: 'var(--color-gray-text-tertiary)',
206
+ backgroundColor: 'var(--color-gray-text-tertiary, var(--color-gray-text-light))',
207
207
  borderRadius: '20px'
208
208
  }), _define_property(_obj, '&-edit', {
209
209
  '> div.empty:first-child': {
@@ -222,7 +222,11 @@ var genStyle = function genStyle(token) {
222
222
  fontSize: '1em',
223
223
  lineHeight: '21px',
224
224
  wordBreak: 'break-word',
225
- whiteSpace: 'wrap'
225
+ whiteSpace: 'wrap',
226
+ // 防止占位符伪元素响应触摸/点击事件,避免在移动端
227
+ // 竞态窗口内占位符遮挡用户对实际文字的交互。
228
+ pointerEvents: 'none',
229
+ userSelect: 'none'
226
230
  }
227
231
  },
228
232
  '> div.empty:first-child [data-slate-node="text"]': {
@@ -366,7 +370,7 @@ var genStyle = function genStyle(token) {
366
370
  fontSize: '0.9rem',
367
371
  lineHeight: 'var(--line-height-base)',
368
372
  letterSpacing: 'var(--letter-spacing-base)',
369
- fontFamily: 'var(--font-family-base)'
373
+ fontFamily: 'var(--font-family-base, var(--font-family-text))'
370
374
  },
371
375
  'ul, ol': {
372
376
  margin: 0
@@ -337,12 +337,12 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
337
337
  }, loading ? /*#__PURE__*/ React.createElement("div", {
338
338
  style: {
339
339
  padding: 12,
340
- color: 'var(--color-text-secondary)'
340
+ color: 'var(--color-text-secondary, var(--color-gray-text-secondary, rgba(0,0,0,0.45)))'
341
341
  }
342
342
  }, locale.loading) : items.length === 0 ? notFoundContent !== null && notFoundContent !== void 0 ? notFoundContent : /*#__PURE__*/ React.createElement("div", {
343
343
  style: {
344
344
  padding: 12,
345
- color: 'var(--color-text-secondary)'
345
+ color: 'var(--color-text-secondary, var(--color-gray-text-secondary, rgba(0,0,0,0.45)))'
346
346
  }
347
347
  }, locale['jinja.panel.noTemplates']) : items.map(function(item, i) {
348
348
  return /*#__PURE__*/ React.createElement("div", {
@@ -101,26 +101,46 @@
101
101
  }
102
102
  return false;
103
103
  }
104
- /**
105
- * 检查 Mermaid 代码是否完整
106
- */ function isMermaidCodeComplete(code) {
107
- // 检查是否包含基本的 Mermaid 图表类型关键字
108
- var hasChartType = code.includes('graph') || code.includes('sequenceDiagram') || code.includes('gantt') || code.includes('pie') || code.includes('classDiagram') || code.includes('stateDiagram') || code.includes('erDiagram') || code.includes('journey') || code.includes('gitgraph') || code.includes('flowchart');
109
- if (!hasChartType) return false;
110
- // 检查基本结构完整性
104
+ var MERMAID_DIAGRAM_KEYWORDS = [
105
+ 'graph',
106
+ 'flowchart',
107
+ 'sequenceDiagram',
108
+ 'gantt',
109
+ 'pie',
110
+ 'classDiagram',
111
+ 'stateDiagram',
112
+ 'erDiagram',
113
+ 'journey',
114
+ 'gitgraph',
115
+ 'xychart-beta',
116
+ 'mindmap',
117
+ 'timeline',
118
+ 'quadrantChart',
119
+ 'sankey-beta',
120
+ 'block-beta',
121
+ 'packet-beta',
122
+ 'kanban',
123
+ 'architecture-beta',
124
+ 'requirementDiagram',
125
+ 'zenuml',
126
+ 'C4Context',
127
+ 'C4Container',
128
+ 'C4Component',
129
+ 'C4Deployment'
130
+ ];
131
+ var MERMAID_INCOMPLETE_TAIL = [
132
+ /graph\s*$/i,
133
+ /-->?\s*$/
134
+ ];
135
+ function isMermaidCodeComplete(code) {
136
+ if (!MERMAID_DIAGRAM_KEYWORDS.some(function(kw) {
137
+ return code.includes(kw);
138
+ })) return false;
111
139
  if (code.length < 10) return false;
112
- // 检查括号匹配
113
- var hasUnclosedBrackets = checkUnclosedBrackets(code);
114
- if (hasUnclosedBrackets) return false;
115
- // 检查是否以常见的不完整模式结尾
116
- var incompletePatterns = [
117
- /graph\s*$/i,
118
- /-->?\s*$/
119
- ];
120
- var endsWithIncomplete = incompletePatterns.some(function(pattern) {
121
- return pattern.test(code);
140
+ if (checkUnclosedBrackets(code)) return false;
141
+ return !MERMAID_INCOMPLETE_TAIL.some(function(re) {
142
+ return re.test(code);
122
143
  });
123
- return !endsWithIncomplete;
124
144
  }
125
145
  /**
126
146
  * 检查代码块是否完整(基于代码内容)
@@ -64,8 +64,8 @@ var TABLE_CELL = {
64
64
  textAlign: 'left',
65
65
  lineHeight: '24px',
66
66
  fontSize: '1em',
67
- minWidth: 'var(--agentic-ui-table-cell-min-width, 120px)',
68
- width: 'var(--agentic-ui-table-cell-min-width, 120px)',
67
+ minWidth: 'var(--agentic-ui-table-cell-min-width, 40px)',
68
+ width: 'var(--agentic-ui-table-cell-min-width, 40px)',
69
69
  whiteSpace: 'nowrap',
70
70
  overflow: 'hidden',
71
71
  textOverflow: 'ellipsis',
@@ -155,6 +155,8 @@ var genTableStyle = function genTableStyle(token, mobileBreakpoint, mobilePaddin
155
155
  borderBottom: 'none'
156
156
  }), _define_property(_obj, 'tr td:first-child:not(.config-td)', {
157
157
  fontWeight: 600
158
+ }), _define_property(_obj, 'tbody tr:not(.config-tr)', {
159
+ animation: 'agenticTableRowFadeIn 0.3s ease both'
158
160
  }), _define_property(_obj, 'tbody tr:not(.config-tr):hover', {
159
161
  background: 'linear-gradient(var(--agentic-ui-table-hover-bg, rgba(0, 0, 0, 0.04)), var(--agentic-ui-table-hover-bg, rgba(0, 0, 0, 0.04))), linear-gradient(var(--agentic-ui-table-cell-bg, #ffffff), var(--agentic-ui-table-cell-bg, #ffffff))'
160
162
  }), _define_property(_obj, "@media (max-width: ".concat(mobileBreakpoint, ")"), {
@@ -295,6 +297,15 @@ var genTableStyle = function genTableStyle(token, mobileBreakpoint, mobilePaddin
295
297
  '&:hover': {
296
298
  color: '#52c41a'
297
299
  }
300
+ }), _define_property(_obj1, '@keyframes agenticTableRowFadeIn', {
301
+ from: {
302
+ opacity: 0,
303
+ transform: 'translateY(4px)'
304
+ },
305
+ to: {
306
+ opacity: 1,
307
+ transform: 'translateY(0)'
308
+ }
298
309
  }), _obj1;
299
310
  };
300
311
  var genStyle = function genStyle(token) {
@@ -344,7 +344,7 @@ export type MarkdownEditorProps = {
344
344
  * - `--agentic-ui-table-header-bg` 表头背景色,默认 #f7f7f9
345
345
  * - `--agentic-ui-table-hover-bg` 行悬停背景色,默认 rgba(0,0,0,0.04)
346
346
  * - `--agentic-ui-table-cell-bg` 单元格背景色,默认 #ffffff
347
- * - `--agentic-ui-table-cell-min-width` 单元格最小宽度,默认 120px
347
+ * - `--agentic-ui-table-cell-min-width` 单元格最小宽度,默认 40px
348
348
  * - `--agentic-ui-table-cell-padding` 单元格内边距,默认 16px 12px
349
349
  * @example style={{ ['--agentic-ui-table-border-color']: '#ddd', ['--agentic-ui-table-header-bg']: '#f0f0f0' } as React.CSSProperties}
350
350
  */
@@ -637,4 +637,14 @@ export type MarkdownEditorProps = {
637
637
  * @description 当同时传入时,`renderMode` 优先
638
638
  */
639
639
  renderType?: RenderMode;
640
+ /**
641
+ * 自定义元素渲染函数(仅 `renderMode: 'markdown'` 时生效)
642
+ * @description 拦截并自定义 MarkdownRenderer 中任意块级/行内元素的渲染结果。
643
+ * 与 Slate 模式的 `eleItemRender` 对应,允许替换段落、标题、列表、图片等元素。
644
+ * 返回 `undefined` 时回退到默认渲染。
645
+ * @param props - 元素属性(tagName、node、children 等)
646
+ * @param defaultDom - 默认渲染结果
647
+ * @returns 自定义渲染节点,或 undefined 时回退到 defaultDom
648
+ */
649
+ eleRender?: (props: import('../MarkdownRenderer/types').MarkdownRendererEleProps, defaultDom: React.ReactNode) => React.ReactNode;
640
650
  };
@@ -108,7 +108,7 @@ var VideoThumbnail = function VideoThumbnail(param) {
108
108
  style: _object_spread_props(_object_spread({}, style), {
109
109
  position: 'relative',
110
110
  overflow: 'hidden',
111
- borderRadius: 'var(--radius-base)',
111
+ borderRadius: 'var(--radius-base, 4px)',
112
112
  flexShrink: 0
113
113
  })
114
114
  }, /*#__PURE__*/ React.createElement("video", {
@@ -83,8 +83,8 @@ var genStyle = function genStyle(token) {
83
83
  height: 'var(--padding-1x)'
84
84
  },
85
85
  '&::-webkit-scrollbar-thumb': {
86
- background: 'var(--color-gray-border-default)',
87
- borderRadius: 'var(--radius-base)'
86
+ background: 'var(--color-gray-border-default, var(--color-gray-border-light))',
87
+ borderRadius: 'var(--radius-base, var(--radius-control-xs, 4px))'
88
88
  },
89
89
  '&::-webkit-scrollbar-track': {
90
90
  background: 'transparent'
@@ -141,7 +141,7 @@ var genStyle = function genStyle(token) {
141
141
  background: 'var(--color-gray-bg-card-white)',
142
142
  boxSizing: 'border-box',
143
143
  boxShadow: 'var(--shadow-control-base)',
144
- borderRadius: 'var(--radius-base)',
144
+ borderRadius: 'var(--radius-base, var(--radius-control-xs, 4px))',
145
145
  border: 'none',
146
146
  overflow: 'hidden',
147
147
  img: {
@@ -80,7 +80,8 @@ var genStyle = function genStyle(token) {
80
80
  padding: 0,
81
81
  maxWidth: 'calc(285px * 3 + 4px * 2)',
82
82
  '& > :only-child': {
83
- marginTop: 8
83
+ marginTop: 8,
84
+ padding: 2
84
85
  }
85
86
  },
86
87
  '&::-webkit-scrollbar': {
@@ -271,7 +272,7 @@ var genStyle = function genStyle(token) {
271
272
  background: 'var(--color-gray-bg-card-white)',
272
273
  boxSizing: 'border-box',
273
274
  boxShadow: 'var(--shadow-control-base)',
274
- borderRadius: 'var(--radius-base)',
275
+ borderRadius: 'var(--radius-base, 4px)',
275
276
  border: 'none',
276
277
  overflow: 'hidden',
277
278
  img: {
@@ -99,7 +99,7 @@ var genStyle = function genStyle(token) {
99
99
  borderRadius: 'var(--radius-control-sm)'
100
100
  },
101
101
  '&:active': {
102
- backgroundColor: 'var(--color-gray-control-fill-pressed)',
102
+ backgroundColor: 'var(--color-gray-control-fill-pressed, var(--color-gray-control-fill-secondary-active))',
103
103
  outline: 'none',
104
104
  border: 'none'
105
105
  },
@@ -172,7 +172,7 @@ var genStyle = function genStyle(token) {
172
172
  maxHeight: 400,
173
173
  height: '100%',
174
174
  overflowY: 'visible',
175
- scrollbarColor: 'var(--color-gray-text-tertiary) transparent',
175
+ scrollbarColor: 'var(--color-gray-text-tertiary, #505c716b) transparent',
176
176
  scrollbarWidth: 'thin',
177
177
  '&&-disabled': {
178
178
  backgroundColor: 'rgba(0,0,0,0.04)',
@@ -236,7 +236,7 @@ var SCHEMA_LANGUAGES = new Set([
236
236
  * - Markdown → hast → React 元素树(hast-util-to-jsx-runtime)
237
237
  * - 特殊块(code / mermaid / chart / katex)通过组件映射拦截渲染
238
238
  */ var InternalMarkdownRenderer = /*#__PURE__*/ forwardRef(function(props, ref) {
239
- var content = props.content, _props_streaming = props.streaming, streaming = _props_streaming === void 0 ? false : _props_streaming, isFinished = props.isFinished, queueOptions = props.queueOptions, plugins = props.plugins, remarkPlugins = props.remarkPlugins, htmlConfig = props.htmlConfig, className = props.className, style = props.style, customPrefixCls = props.prefixCls, linkConfig = props.linkConfig, streamingParagraphAnimation = props.streamingParagraphAnimation, apaasify = props.apaasify;
239
+ var content = props.content, _props_streaming = props.streaming, streaming = _props_streaming === void 0 ? false : _props_streaming, isFinished = props.isFinished, queueOptions = props.queueOptions, plugins = props.plugins, remarkPlugins = props.remarkPlugins, htmlConfig = props.htmlConfig, className = props.className, style = props.style, customPrefixCls = props.prefixCls, linkConfig = props.linkConfig, streamingParagraphAnimation = props.streamingParagraphAnimation, apaasify = props.apaasify, eleRender = props.eleRender;
240
240
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
241
241
  // 复用 MarkdownEditor 的 CSS 前缀和样式,保持渲染一致性
242
242
  var prefixCls = getPrefixCls('agentic-md-editor', customPrefixCls);
@@ -358,7 +358,8 @@ var SCHEMA_LANGUAGES = new Set([
358
358
  linkConfig: linkConfig,
359
359
  streaming: streaming,
360
360
  streamingParagraphAnimation: streamingParagraphAnimation,
361
- contentRevisionSource: streaming ? displayedContent : undefined
361
+ contentRevisionSource: streaming ? displayedContent : undefined,
362
+ eleRender: eleRender
362
363
  });
363
364
  return wrapVarSSR(wrapSSR(wrapContentSSR(/*#__PURE__*/ React.createElement("div", {
364
365
  ref: containerRef,
@@ -6,7 +6,7 @@ export { ChartBlockRenderer } from './renderers/ChartRenderer';
6
6
  export { CodeBlockRenderer } from './renderers/CodeRenderer';
7
7
  export { MermaidBlockRenderer } from './renderers/MermaidRenderer';
8
8
  export { SchemaBlockRenderer } from './renderers/SchemaRenderer';
9
- export type { CharacterQueueOptions, MarkdownRendererProps, MarkdownRendererRef, RenderMode, RendererBlockProps, } from './types';
9
+ export type { CharacterQueueOptions, MarkdownRendererEleProps, MarkdownRendererProps, MarkdownRendererRef, RenderMode, RendererBlockProps, } from './types';
10
10
  export type { UseMarkdownToReactOptions } from './markdownReactShared';
11
11
  export { markdownToReactSync, useMarkdownToReact } from './useMarkdownToReact';
12
12
  export { useStreamingMarkdownReact } from './streaming/useStreamingMarkdownReact';