@ant-design/agentic-ui 2.30.31 → 2.31.0

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 (96) hide show
  1. package/dist/AILabel/index.d.ts +2 -0
  2. package/dist/AILabel/index.js +4 -2
  3. package/dist/AgentRunBar/Robot.js +0 -1
  4. package/dist/AgentRunBar/index.js +1 -0
  5. package/dist/AgenticLayout/index.js +1 -0
  6. package/dist/AnswerAlert/index.js +1 -0
  7. package/dist/BackTo/ScrollVisibleButton.d.ts +2 -0
  8. package/dist/BackTo/ScrollVisibleButton.js +4 -2
  9. package/dist/Bubble/List/PureBubbleList.js +2 -0
  10. package/dist/Bubble/style.js +0 -1
  11. package/dist/ChatBootPage/ButtonTab.js +1 -0
  12. package/dist/ChatBootPage/ButtonTabGroup.js +1 -0
  13. package/dist/ChatBootPage/CaseReply.js +1 -0
  14. package/dist/ChatBootPage/Title.js +1 -0
  15. package/dist/ChatLayout/index.js +1 -0
  16. package/dist/Components/ActionItemBox/ActionItemBox.js +1 -0
  17. package/dist/Components/Button/IconButton/index.js +1 -0
  18. package/dist/Components/Button/SwitchButton/index.js +1 -0
  19. package/dist/Components/Button/ToggleButton/index.js +1 -0
  20. package/dist/Components/GradientText/index.js +1 -0
  21. package/dist/Components/LayoutHeader/index.js +2 -1
  22. package/dist/Components/Loading/Loading.js +2 -0
  23. package/dist/Components/Robot/index.js +1 -0
  24. package/dist/Components/Robot/lotties/BlowingWindLottie/index.js +16 -3
  25. package/dist/Components/Robot/lotties/BouncingLottie/index.js +16 -3
  26. package/dist/Components/Robot/lotties/DazingLottie/index.js +16 -3
  27. package/dist/Components/Robot/lotties/PeekLottie/index.js +16 -3
  28. package/dist/Components/Robot/lotties/ThinkingLottie/index.js +16 -3
  29. package/dist/Components/SuggestionList/index.js +1 -0
  30. package/dist/Components/TextAnimate/index.js +1 -0
  31. package/dist/Components/TypingAnimation/index.js +2 -1
  32. package/dist/Components/VisualList/index.js +3 -0
  33. package/dist/Components/lotties/CreativeSparkLottie/index.js +16 -3
  34. package/dist/Components/lotties/DazingLottie/index.js +16 -3
  35. package/dist/Components/lotties/LoadingLottie/index.js +16 -3
  36. package/dist/Components/lotties/ThinkingLottie/index.js +16 -3
  37. package/dist/Components/lotties/ThreeThinkingLottie/index.d.ts +68 -0
  38. package/dist/Components/lotties/ThreeThinkingLottie/index.js +103 -0
  39. package/dist/Components/lotties/ThreeThinkingLottie/three-thinking.json +130 -0
  40. package/dist/Components/lotties/bubble-actions/Copy/index.js +12 -3
  41. package/dist/Components/lotties/bubble-actions/Dislike/index.js +12 -3
  42. package/dist/Components/lotties/bubble-actions/Like/index.js +12 -3
  43. package/dist/Components/lotties/bubble-actions/More/index.js +12 -3
  44. package/dist/Components/lotties/bubble-actions/Play/index.js +12 -3
  45. package/dist/Components/lotties/bubble-actions/Quote/index.js +12 -3
  46. package/dist/Components/lotties/bubble-actions/Refresh/index.js +12 -3
  47. package/dist/Components/lotties/bubble-actions/Share/index.js +12 -3
  48. package/dist/Components/lotties/index.d.ts +2 -0
  49. package/dist/Components/lotties/index.js +2 -0
  50. package/dist/Components/lotties/useAsyncLottieData.d.ts +9 -0
  51. package/dist/Components/lotties/useAsyncLottieData.js +83 -0
  52. package/dist/History/index.js +1 -0
  53. package/dist/Hooks/useLanguage.d.ts +1 -0
  54. package/dist/I18n/locales.d.ts +1 -0
  55. package/dist/I18n/locales.js +2 -0
  56. package/dist/Icons/animated/VoicePlayLottie/index.js +16 -3
  57. package/dist/Icons/animated/VoicingLottie/index.js +16 -3
  58. package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -0
  59. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +10 -10
  60. package/dist/MarkdownInputField/BorderBeamAnimation.d.ts +1 -1
  61. package/dist/MarkdownInputField/BorderBeamAnimation.js +6 -3
  62. package/dist/MarkdownRenderer/MarkdownRenderer.js +1 -0
  63. package/dist/Plugins/chart/AreaChart/index.js +10 -8
  64. package/dist/Plugins/chart/BarChart/index.js +10 -8
  65. package/dist/Plugins/chart/BoxPlotChart/index.d.ts +1 -1
  66. package/dist/Plugins/chart/BoxPlotChart/index.js +11 -8
  67. package/dist/Plugins/chart/DonutChart/index.js +14 -12
  68. package/dist/Plugins/chart/FunnelChart/index.js +10 -8
  69. package/dist/Plugins/chart/HistogramChart/index.d.ts +1 -1
  70. package/dist/Plugins/chart/HistogramChart/index.js +11 -8
  71. package/dist/Plugins/chart/LineChart/index.js +10 -8
  72. package/dist/Plugins/chart/RadarChart/index.js +14 -12
  73. package/dist/Plugins/chart/ScatterChart/index.js +14 -12
  74. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +13 -3
  75. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +21 -4
  76. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  77. package/dist/Plugins/chart/hooks/index.d.ts +2 -0
  78. package/dist/Plugins/chart/hooks/index.js +1 -0
  79. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +1 -1
  80. package/dist/Plugins/chart/hooks/useChartTheme.js +1 -1
  81. package/dist/Plugins/chart/hooks/useDetectTheme.d.ts +45 -0
  82. package/dist/Plugins/chart/hooks/useDetectTheme.js +249 -0
  83. package/dist/Schema/SchemaEditor/index.js +1 -0
  84. package/dist/Schema/SchemaForm/index.js +1 -0
  85. package/dist/TaskList/TaskList.js +21 -4
  86. package/dist/TaskList/components/TaskListItem.js +2 -1
  87. package/dist/TaskList/style.js +1 -1
  88. package/dist/ThoughtChainList/index.js +1 -0
  89. package/dist/ThoughtChainList/style.js +14 -3
  90. package/dist/ToolUseBar/index.js +7 -6
  91. package/dist/ToolUseBarThink/style.js +0 -7
  92. package/dist/WelcomeMessage/index.js +1 -0
  93. package/dist/Workspace/File/FileComponent.js +15 -9
  94. package/dist/Workspace/File/FileTree/FileTreeComponent.js +6 -1
  95. package/dist/Workspace/File/PreviewComponent.js +23 -6
  96. package/package.json +3 -3
@@ -755,6 +755,7 @@ export var FileComponent = function FileComponent(param) {
755
755
  resetKey
756
756
  ]);
757
757
  // 监听 nodes 变化,同步更新 previewFile
758
+ // 当外部数据更新时,保持预览文件与最新数据同步
758
759
  useEffect(function() {
759
760
  if (!previewFile) return;
760
761
  // 在所有节点中查找与当前预览文件匹配的文件
@@ -768,7 +769,7 @@ export var FileComponent = function FileComponent(param) {
768
769
  var found = findUpdatedFile(node.children);
769
770
  if (found) return found;
770
771
  } else {
771
- // 文件节点,比较 ID 或文件引用
772
+ // 文件节点,比较 ID 或文件名+类型
772
773
  if (node.id && node.id === previewFile.id || node.name === previewFile.name && node.type === previewFile.type) {
773
774
  return node;
774
775
  }
@@ -795,8 +796,15 @@ export var FileComponent = function FileComponent(param) {
795
796
  if (updatedFile) {
796
797
  setPreviewFile(updatedFile);
797
798
  }
799
+ // 注意:这里故意使用 nodes 而非 safeNodes 作为依赖
800
+ // 因为 safeNodes 每次渲染都会重新计算,会导致无限循环
801
+ // nodes 引用变化时才需要检查更新
802
+ // eslint-disable-next-line react-hooks/exhaustive-deps
798
803
  }, [
799
- nodes
804
+ nodes,
805
+ previewFile === null || previewFile === void 0 ? void 0 : previewFile.id,
806
+ previewFile === null || previewFile === void 0 ? void 0 : previewFile.name,
807
+ previewFile === null || previewFile === void 0 ? void 0 : previewFile.type
800
808
  ]);
801
809
  // 处理分组折叠/展开
802
810
  var handleToggleGroup = useRefFunction(function(groupId, type, collapsed) {
@@ -1022,7 +1030,9 @@ export var FileComponent = function FileComponent(param) {
1022
1030
  if (hasKeyword) {
1023
1031
  return /*#__PURE__*/ React.createElement(Typography.Text, {
1024
1032
  type: "secondary"
1025
- }, ((locale === null || locale === void 0 ? void 0 : locale['workspace.noResultsFor']) || "未找到与「".concat(keyword, "」匹配的结果")).replace('${keyword}', String(keyword)));
1033
+ }, compileTemplate((locale === null || locale === void 0 ? void 0 : locale['workspace.noResultsFor']) || '未找到与「${keyword}」匹配的结果', {
1034
+ keyword: String(keyword)
1035
+ }));
1026
1036
  }
1027
1037
  if (typeof emptyRender === 'function') {
1028
1038
  return emptyRender();
@@ -1044,12 +1054,8 @@ export var FileComponent = function FileComponent(param) {
1044
1054
  });
1045
1055
  // 渲染文件内容
1046
1056
  var renderFileContent = useRefFunction(function() {
1047
- if ((!nodes || nodes.length === 0) && !loading) {
1048
- return /*#__PURE__*/ React.createElement("div", {
1049
- className: classNames("".concat(prefixCls, "-empty"), hashId)
1050
- }, renderEmptyContent());
1051
- }
1052
- if (safeNodes.length === 0) {
1057
+ // 统一的空状态判断:数据为空且非加载中
1058
+ if (safeNodes.length === 0 && !loading) {
1053
1059
  return /*#__PURE__*/ React.createElement("div", {
1054
1060
  className: classNames("".concat(prefixCls, "-empty"), hashId)
1055
1061
  }, renderEmptyContent());
@@ -214,9 +214,14 @@ var FileTreeComponent = function FileTreeComponent(param) {
214
214
  }
215
215
  // 须让 `Promise` 在失败时 reject,以便 rc-tree 不将 key 记为已加载,从而可再次展开重试
216
216
  return Promise.resolve(onLoadChildrenRef(source)).then(function(loaded) {
217
+ var children = loaded !== null && loaded !== void 0 ? loaded : [];
217
218
  setInnerTree(function(prev) {
218
- return replaceNodeChildren(prev, k, loaded);
219
+ return replaceNodeChildren(prev, k, children);
219
220
  });
221
+ }).catch(function(error) {
222
+ console.error('Failed to load tree children:', error);
223
+ // 返回 reject 以便 rc-tree 不将 key 记为已加载,允许重试
224
+ throw error;
220
225
  });
221
226
  }, [
222
227
  onLoadChildrenRef,
@@ -185,7 +185,15 @@ var PlaceholderContent = function PlaceholderContent(param) {
185
185
  if (customContent || !processResult) return;
186
186
  var typeInference = processResult.typeInference, dataSource = processResult.dataSource;
187
187
  var isTextOrCode = typeInference.category === 'text' || typeInference.category === 'code';
188
- if (!isTextOrCode) return;
188
+ // 非文本/代码类型时重置状态
189
+ if (!isTextOrCode) {
190
+ setContentState({
191
+ status: 'idle',
192
+ mdContent: '',
193
+ rawContent: ''
194
+ });
195
+ return;
196
+ }
189
197
  var setReadyContent = function setReadyContent(raw) {
190
198
  setContentState({
191
199
  status: 'ready',
@@ -216,11 +224,19 @@ var PlaceholderContent = function PlaceholderContent(param) {
216
224
  });
217
225
  console.error('加载文本内容失败:', err);
218
226
  });
227
+ } else {
228
+ // 无数据源时重置状态,避免显示旧内容
229
+ setContentState({
230
+ status: 'idle',
231
+ mdContent: '',
232
+ rawContent: ''
233
+ });
219
234
  }
220
235
  }, [
221
236
  processResult,
222
237
  file.name,
223
- customContent
238
+ customContent,
239
+ locale
224
240
  ]);
225
241
  useEffect(function() {
226
242
  var _editorRef_current;
@@ -249,14 +265,13 @@ var PlaceholderContent = function PlaceholderContent(param) {
249
265
  var isCurrentFileHtml = isHtmlFile(file.name, processResult === null || processResult === void 0 ? void 0 : processResult.dataSource.mimeType);
250
266
  var renderPreviewContent = function renderPreviewContent() {
251
267
  if (file.loading) {
252
- var _file_content;
253
268
  return /*#__PURE__*/ React.createElement("div", {
254
269
  className: classNames("".concat(prefixCls, "-content-loading"), hashId)
255
270
  }, /*#__PURE__*/ React.createElement("span", {
256
271
  className: classNames("".concat(prefixCls, "-content-loading-tip"), hashId)
257
272
  }, /*#__PURE__*/ React.createElement(LoadingOutlined, null), (locale === null || locale === void 0 ? void 0 : locale['workspace.file.generating']) || '正在生成'), /*#__PURE__*/ React.createElement("div", {
258
273
  className: classNames("".concat(prefixCls, "-content-loading-inner"), hashId)
259
- }, (file === null || file === void 0 ? void 0 : (_file_content = file.content) === null || _file_content === void 0 ? void 0 : _file_content.padEnd(10000, file === null || file === void 0 ? void 0 : file.content)) || '...'.padEnd(10000, '...')));
274
+ }, (file === null || file === void 0 ? void 0 : file.content) || '...'));
260
275
  }
261
276
  if (customContent) {
262
277
  return /*#__PURE__*/ React.createElement("div", {
@@ -331,7 +346,7 @@ var PlaceholderContent = function PlaceholderContent(param) {
331
346
  className: classNames("".concat(filePrefixCls, "-item-separator"), hashId)
332
347
  }, "|"), /*#__PURE__*/ React.createElement("span", {
333
348
  className: classNames("".concat(filePrefixCls, "-item-time"), hashId)
334
- }, formatLastModified(file.lastModified))))))), canDownload && onDownload && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
349
+ }, formatLastModified(file.lastModified))))))), canDownload && onDownload ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
335
350
  className: classNames("".concat(prefixCls, "-unsupported-text"), hashId)
336
351
  }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.unsupportedPreview']) || '此文件无法预览,请下载查看。'), /*#__PURE__*/ React.createElement(Button, {
337
352
  color: "default",
@@ -339,7 +354,9 @@ var PlaceholderContent = function PlaceholderContent(param) {
339
354
  icon: /*#__PURE__*/ React.createElement(DownloadIcon, null),
340
355
  onClick: handleDownload,
341
356
  "aria-label": (locale === null || locale === void 0 ? void 0 : locale['workspace.file.download']) || '下载'
342
- }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.downloadButton']) || '下载'))));
357
+ }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.downloadButton']) || '下载')) : /*#__PURE__*/ React.createElement("div", {
358
+ className: classNames("".concat(prefixCls, "-unsupported-text"), hashId)
359
+ }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.unsupportedPreviewNoDownload']) || '此文件无法预览。')));
343
360
  }
344
361
  var renderTextOrCode = function renderTextOrCode() {
345
362
  if (isCurrentFileHtml) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.30.31",
3
+ "version": "2.31.0",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
@@ -32,12 +32,12 @@
32
32
  "start": "pnpm run dev",
33
33
  "test": "vitest --run",
34
34
  "test:coverage": "vitest --run --coverage",
35
- "test:coverage:full": "cross-env VITEST_FULL_SUITE=1 vitest --run --coverage",
35
+ "test:coverage:full": "vitest --run --coverage --mode full",
36
36
  "test:e2e": "playwright test",
37
37
  "test:e2e:debug": "playwright test --debug",
38
38
  "test:e2e:skip-server": "cross-env SKIP_WEBSERVER=1 playwright test",
39
39
  "test:e2e:ui": "playwright test --ui",
40
- "test:full": "cross-env VITEST_FULL_SUITE=1 vitest --run",
40
+ "test:full": "vitest --run --mode full",
41
41
  "tsc": "tsc --noEmit"
42
42
  },
43
43
  "lint-staged": {