@ant-design/agentic-ui 2.30.10 → 2.30.12

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 (67) hide show
  1. package/dist/Bubble/MessagesContent/style.js +3 -1
  2. package/dist/Bubble/style.js +35 -13
  3. package/dist/ChatLayout/index.js +9 -1
  4. package/dist/ChatLayout/style.js +16 -13
  5. package/dist/Components/ActionIconBox/index.js +4 -0
  6. package/dist/Components/Button/IconButton/style.js +1 -1
  7. package/dist/Components/Button/ToggleButton/style.js +1 -1
  8. package/dist/History/components/HistoryList.d.ts +2 -12
  9. package/dist/History/components/HistoryList.js +48 -43
  10. package/dist/History/style.d.ts +4 -0
  11. package/dist/History/style.js +3 -2
  12. package/dist/Hooks/useAutoScroll.js +38 -14
  13. package/dist/Hooks/useLanguage.d.ts +1 -0
  14. package/dist/I18n/locales.d.ts +1 -0
  15. package/dist/I18n/locales.js +2 -0
  16. package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -1
  17. package/dist/MarkdownEditor/editor/Editor.js +22 -6
  18. package/dist/MarkdownEditor/editor/elements/AgenticUiBlocks/AgenticUiFileMapBlock.d.ts +4 -0
  19. package/dist/MarkdownEditor/editor/elements/AgenticUiBlocks/AgenticUiFileMapBlock.js +83 -0
  20. package/dist/MarkdownEditor/editor/elements/AgenticUiBlocks/agenticUiEmbedUtils.d.ts +10 -0
  21. package/dist/MarkdownEditor/editor/elements/AgenticUiBlocks/agenticUiEmbedUtils.js +44 -0
  22. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +27 -5
  23. package/dist/MarkdownEditor/editor/elements/index.js +3 -0
  24. package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +2 -1
  25. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +1 -0
  26. package/dist/MarkdownEditor/editor/plugins/handlePaste.js +2 -1
  27. package/dist/MarkdownEditor/editor/style.js +7 -3
  28. package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/index.js +2 -2
  29. package/dist/MarkdownEditor/types.d.ts +10 -0
  30. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +1 -1
  31. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +3 -3
  32. package/dist/MarkdownInputField/FileMapView/style.js +3 -2
  33. package/dist/MarkdownInputField/SkillModeBar/style.js +1 -1
  34. package/dist/MarkdownInputField/style.js +1 -1
  35. package/dist/MarkdownRenderer/MarkdownRenderer.js +10 -2
  36. package/dist/MarkdownRenderer/index.d.ts +4 -1
  37. package/dist/MarkdownRenderer/index.js +3 -0
  38. package/dist/MarkdownRenderer/markdownReactShared.d.ts +35 -28
  39. package/dist/MarkdownRenderer/markdownReactShared.js +179 -58
  40. package/dist/MarkdownRenderer/renderers/AgenticUiFileMapBlockRenderer.d.ts +6 -0
  41. package/dist/MarkdownRenderer/renderers/AgenticUiFileMapBlockRenderer.js +79 -0
  42. package/dist/MarkdownRenderer/renderers/index.d.ts +3 -0
  43. package/dist/MarkdownRenderer/renderers/index.js +3 -0
  44. package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +3 -2
  45. package/dist/MarkdownRenderer/types.d.ts +21 -0
  46. package/dist/MarkdownRenderer/useStreaming.js +40 -13
  47. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  48. package/dist/Plugins/code/components/CodeRenderer.js +22 -6
  49. package/dist/Plugins/code/components/CodeToolbar.d.ts +2 -0
  50. package/dist/Plugins/code/components/CodeToolbar.js +11 -4
  51. package/dist/Plugins/code/hooks/useToolbarConfig.d.ts +3 -1
  52. package/dist/Plugins/code/hooks/useToolbarConfig.js +5 -3
  53. package/dist/Plugins/code/utils/index.d.ts +1 -0
  54. package/dist/Plugins/code/utils/index.js +1 -0
  55. package/dist/Plugins/code/utils/localPreview.d.ts +12 -0
  56. package/dist/Plugins/code/utils/localPreview.js +190 -0
  57. package/dist/ThoughtChainList/style.js +1 -1
  58. package/dist/ToolUseBarThink/style.js +1 -1
  59. package/dist/Workspace/Browser/index.d.ts +6 -0
  60. package/dist/Workspace/Browser/index.js +22 -13
  61. package/dist/Workspace/Browser/style.js +14 -15
  62. package/dist/Workspace/File/FileComponent.js +4 -4
  63. package/dist/Workspace/File/PreviewComponent.js +4 -4
  64. package/dist/Workspace/File/style.js +33 -39
  65. package/dist/Workspace/RealtimeFollow/style.js +78 -85
  66. package/dist/Workspace/style.js +41 -53
  67. package/package.json +1 -2
@@ -55,6 +55,7 @@ var THINKING_DOT_SIZE = 4;
55
55
  var THINKING_DOT_GAP = 4;
56
56
  var THINKING_DOT_ANIMATION = 'agenticBubbleThinkingDotPulse';
57
57
  var THINKING_DOT_ANIMATION_DURATION = '1.2s';
58
+ var THINKING_LOADING_MARGIN_TOP = 'var(--padding-2x)';
58
59
  var THINKING_LOADING_PADDING = {
59
60
  paddingLeft: 'var(--padding-5x)',
60
61
  paddingRight: 'var(--padding-5x)',
@@ -68,7 +69,8 @@ var genStyle = function genStyle(token) {
68
69
  lineHeight: '24px',
69
70
  display: 'flex',
70
71
  alignItems: 'center',
71
- gap: 'var(--padding-2x)'
72
+ gap: 'var(--padding-2x)',
73
+ marginTop: THINKING_LOADING_MARGIN_TOP
72
74
  }, THINKING_LOADING_PADDING), (_obj = {
73
75
  color: 'rgb(102, 111, 141)'
74
76
  }, _define_property(_obj, "&-dots", {
@@ -52,7 +52,7 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
54
54
  var genStyle = function genStyle(token, classNames) {
55
- var _obj;
55
+ var _obj, _obj1, _obj2;
56
56
  return _define_property({}, token.componentCls, {
57
57
  '&-bubble': {
58
58
  position: 'relative',
@@ -186,16 +186,27 @@ var genStyle = function genStyle(token, classNames) {
186
186
  minWidth: '0px',
187
187
  maxWidth: 'min(860px,100%)'
188
188
  },
189
- '&-bubble-content-right': {
189
+ '&-bubble-content-right': (_obj1 = {
190
190
  maxWidth: '75%',
191
191
  borderRadius: '16px 16px 2px 16px',
192
192
  background: 'var(--color-primary-control-fill-secondary-active)',
193
193
  color: 'var(--color-gray-text-default)',
194
- boxShadow: 'none',
195
- '&&-pure': {
196
- background: 'var(--color-primary-control-fill-primary)'
197
- }
198
- },
194
+ boxShadow: 'none'
195
+ }, // inline-code 基础规则用 code.cls(元素+类)选择器,需匹配相同结构才能覆盖
196
+ _define_property(_obj1, "& code".concat(token.antCls, "-agentic-md-editor-content-inline-code"), {
197
+ background: 'var(--color-primary-a7)'
198
+ }), // blockquote 竖条:gray-control-fill-secondary(gray-a2)在蓝色背景上消失
199
+ _define_property(_obj1, "& ".concat(token.antCls, "-agentic-md-editor-content blockquote::before"), {
200
+ backgroundColor: 'var(--color-primary-a7)'
201
+ }), // hr 分割线:gray-border-light(gray-a3)在蓝色背景上不可见
202
+ _define_property(_obj1, "& ".concat(token.antCls, "-agentic-md-editor-content hr"), {
203
+ borderTopColor: 'var(--color-primary-a7)'
204
+ }), // 链接下划线:gray-border-light 在蓝色背景上不可见
205
+ _define_property(_obj1, "& ".concat(token.antCls, "-agentic-md-editor-content a"), {
206
+ textDecorationColor: 'var(--color-primary-a7)'
207
+ }), _define_property(_obj1, '&&-pure', {
208
+ background: 'var(--color-primary-control-fill-primary)'
209
+ }), _obj1),
199
210
  // 用户消息特定样式
200
211
  '&-bubble-user': {
201
212
  marginBlockStart: -20,
@@ -207,15 +218,26 @@ var genStyle = function genStyle(token, classNames) {
207
218
  alignItems: 'flex-end',
208
219
  maxWidth: 'max(668px,75%)'
209
220
  },
210
- '&-content-user': {
221
+ '&-content-user': (_obj2 = {
211
222
  background: 'var(--color-primary-bg-card-light)',
212
223
  color: 'var(--color-gray-text-default)',
213
224
  borderRadius: '12px 12px 2px 12px',
214
- maxWidth: '668px',
215
- '&&-pure': {
216
- background: 'var(--color-primary-control-fill-primary)'
217
- }
218
- },
225
+ maxWidth: '668px'
226
+ }, // inline-code 基础规则用 code.cls(元素+类)选择器,需匹配相同结构才能覆盖
227
+ _define_property(_obj2, "& code".concat(token.antCls, "-agentic-md-editor-content-inline-code"), {
228
+ background: 'var(--color-primary-control-fill-secondary-active)'
229
+ }), // blockquote 竖条:gray-control-fill-secondary(gray-a2)在浅蓝背景上消失
230
+ _define_property(_obj2, "& ".concat(token.antCls, "-agentic-md-editor-content blockquote::before"), {
231
+ backgroundColor: 'var(--color-primary-control-fill-primary)'
232
+ }), // hr 分割线:gray-border-light(gray-a3)在浅蓝背景上不可见
233
+ _define_property(_obj2, "& ".concat(token.antCls, "-agentic-md-editor-content hr"), {
234
+ borderTopColor: 'var(--color-primary-a5)'
235
+ }), // 链接下划线:gray-border-light 在浅蓝背景上不可见
236
+ _define_property(_obj2, "& ".concat(token.antCls, "-agentic-md-editor-content a"), {
237
+ textDecorationColor: 'var(--color-primary-a5)'
238
+ }), _define_property(_obj2, '&&-pure', {
239
+ background: 'var(--color-primary-control-fill-primary)'
240
+ }), _obj2),
219
241
  '&-before-user': {
220
242
  justifyContent: 'flex-end'
221
243
  },
@@ -28,7 +28,7 @@ function _object_spread(target) {
28
28
  }
29
29
  import { ConfigProvider } from "antd";
30
30
  import clsx from "clsx";
31
- import React, { forwardRef, memo, useContext, useImperativeHandle, useRef } from "react";
31
+ import React, { forwardRef, memo, useContext, useEffect, useImperativeHandle, useRef } from "react";
32
32
  import { LayoutHeader } from "../Components/LayoutHeader";
33
33
  import useAutoScroll from "../Hooks/useAutoScroll";
34
34
  import { useElementSize } from "../Hooks/useElementSize";
@@ -117,6 +117,14 @@ import { useStyle } from "./style";
117
117
  scrollToBottom: scrollToBottom
118
118
  };
119
119
  });
120
+ // footer 实际高度变化时(spacer 随之调整),保持列表贴底
121
+ useEffect(function() {
122
+ if (actualFooterHeight > 0) {
123
+ scrollToBottom();
124
+ }
125
+ }, [
126
+ actualFooterHeight
127
+ ]);
120
128
  var rootClassName = clsx(prefixCls, className, classNames === null || classNames === void 0 ? void 0 : classNames.root, hashId);
121
129
  var contentClassName = clsx("".concat(prefixCls, "-content"), classNames === null || classNames === void 0 ? void 0 : classNames.content, hashId);
122
130
  var scrollableClassName = clsx("".concat(prefixCls, "-content-scrollable"), classNames === null || classNames === void 0 ? void 0 : classNames.scrollable, hashId);
@@ -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)',
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { MenuItemType } from '../menu';
2
2
  import { HistoryListConfig } from '../types/HistoryList';
3
3
  /**
4
4
  * 生成历史记录菜单项
@@ -47,14 +47,4 @@ import { HistoryListConfig } from '../types/HistoryList';
47
47
  * - 支持多选和收藏功能
48
48
  * - 支持运行状态图标显示
49
49
  */
50
- export declare const generateHistoryItems: ({ filteredList, selectedIds, onSelectionChange, onClick, onDeleteItem, agent, onFavorite, extra, customDateFormatter, groupBy, sessionSort, groupLabelRender, type, runningId, customOperationExtra, itemDateFormatter, }: HistoryListConfig) => {
51
- key: string;
52
- type: "group";
53
- label: React.ReactNode;
54
- children: {
55
- key: string;
56
- type: "item";
57
- onClick: () => void;
58
- label: React.JSX.Element;
59
- }[];
60
- }[];
50
+ export declare const generateHistoryItems: ({ filteredList, selectedIds, onSelectionChange, onClick, onDeleteItem, agent, onFavorite, extra, customDateFormatter, groupBy, sessionSort, groupLabelRender, type, runningId, customOperationExtra, itemDateFormatter, }: HistoryListConfig) => MenuItemType[];
@@ -124,55 +124,60 @@ import { HistoryItem } from "./HistoryItem";
124
124
  })))
125
125
  ];
126
126
  }));
127
+ var MIN_GROUP_SIZE = 3;
127
128
  // 按照时间顺序对分组进行排序:今日 > 昨日 > 一周内 > 其他
128
129
  var sortedGroupKeys = Object.keys(groupList).sort(function(keyA, keyB) {
129
130
  return (groupMaxTimes[keyB] || 0) - (groupMaxTimes[keyA] || 0);
130
131
  });
131
- var items = sortedGroupKeys.map(function(key) {
132
- var _list_sort;
132
+ var buildItemNodes = function buildItemNodes(list) {
133
+ return list.sort(function(a, b) {
134
+ if (sessionSort === false) return 0;
135
+ if (sessionSort) {
136
+ var result = sessionSort(a, b);
137
+ return typeof result === 'boolean' ? 0 : result;
138
+ }
139
+ return dayjs(b.gmtCreate).valueOf() - dayjs(a.gmtCreate).valueOf();
140
+ }).map(function(item) {
141
+ return {
142
+ key: item.sessionId || "item-".concat(item.id),
143
+ type: 'item',
144
+ onClick: function onClick1() {
145
+ if (!item.sessionId) return;
146
+ onClick(item.sessionId, item);
147
+ },
148
+ label: /*#__PURE__*/ React.createElement(HistoryItem, {
149
+ item: item,
150
+ selectedIds: selectedIds,
151
+ onSelectionChange: onSelectionChange,
152
+ onClick: onClick,
153
+ onDeleteItem: onDeleteItem,
154
+ agent: agent,
155
+ onFavorite: onFavorite,
156
+ extra: extra,
157
+ type: type,
158
+ runningId: runningId,
159
+ customOperationExtra: customOperationExtra,
160
+ itemDateFormatter: itemDateFormatter
161
+ })
162
+ };
163
+ });
164
+ };
165
+ var items = sortedGroupKeys.flatMap(function(key) {
133
166
  var list = groupList[key];
134
- var firstItem = list === null || list === void 0 ? void 0 : list.at(0);
167
+ // 少于最小数量时,直接平铺为普通条目,不展示分组标题
168
+ if (list.length < MIN_GROUP_SIZE) {
169
+ return buildItemNodes(list);
170
+ }
171
+ var firstItem = list.at(0);
135
172
  var label = customDateFormatter && (firstItem === null || firstItem === void 0 ? void 0 : firstItem.gmtCreate) ? customDateFormatter(firstItem.gmtCreate) : formatTime(firstItem === null || firstItem === void 0 ? void 0 : firstItem.gmtCreate);
136
- return {
137
- key: "group-".concat(key),
138
- type: 'group',
139
- label: groupLabelRender ? groupLabelRender(key, list, label) : label,
140
- children: list === null || list === void 0 ? void 0 : (_list_sort = list.sort(function(a, b) {
141
- if (sessionSort === false) {
142
- return 0;
143
- }
144
- if (sessionSort) {
145
- var result = sessionSort(a, b);
146
- return typeof result === 'boolean' ? 0 : result;
147
- }
148
- return dayjs(b.gmtCreate).valueOf() - dayjs(a.gmtCreate).valueOf();
149
- })) === null || _list_sort === void 0 ? void 0 : _list_sort.map(function(item) {
150
- return {
151
- key: item.sessionId || "item-".concat(item.id),
152
- type: 'item',
153
- onClick: function onClick1() {
154
- if (!item.sessionId) {
155
- return;
156
- }
157
- onClick(item.sessionId, item);
158
- },
159
- label: /*#__PURE__*/ React.createElement(HistoryItem, {
160
- item: item,
161
- selectedIds: selectedIds,
162
- onSelectionChange: onSelectionChange,
163
- onClick: onClick,
164
- onDeleteItem: onDeleteItem,
165
- agent: agent,
166
- onFavorite: onFavorite,
167
- extra: extra,
168
- type: type,
169
- runningId: runningId,
170
- customOperationExtra: customOperationExtra,
171
- itemDateFormatter: itemDateFormatter
172
- })
173
- };
174
- })
175
- };
173
+ return [
174
+ {
175
+ key: "group-".concat(key),
176
+ type: 'group',
177
+ label: groupLabelRender ? groupLabelRender(key, list, label) : label,
178
+ children: buildItemNodes(list)
179
+ }
180
+ ];
176
181
  });
177
182
  return items;
178
183
  };
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { ChatTokenType, GenerateStyle } from '../Hooks/useStyle';
3
+ declare const genStyle: GenerateStyle<ChatTokenType>;
4
+ /** @internal 供单测调用 genStyle 覆盖 token 回退分支 */
5
+ export { genStyle };
2
6
  export declare function useStyle(prefixCls?: string): {
3
7
  hashId: string;
4
8
  wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
@@ -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"]', {
@@ -292,6 +292,7 @@ var genStyle = function genStyle(token) {
292
292
  }
293
293
  }), _obj2)), _obj3;
294
294
  };
295
+ /** @internal 供单测调用 genStyle 覆盖 token 回退分支 */ export { genStyle };
295
296
  export function useStyle(prefixCls) {
296
297
  return useEditorStyleRegister('history-group-menu', function(token) {
297
298
  var groupMenuToken = _object_spread_props(_object_spread({}, token), {
@@ -153,7 +153,7 @@ function _ts_generator(thisArg, body) {
153
153
  }
154
154
  import { useEffect, useRef } from "react";
155
155
  import { useThrottleFn } from "./useThrottleFn";
156
- var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
156
+ var SCROLL_TOLERANCE = 20;
157
157
  /**
158
158
  * useAutoScroll Hook - 自动滚动 Hook
159
159
  *
@@ -203,15 +203,22 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
203
203
  var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
204
204
  SCROLL_TOLERANCE: SCROLL_TOLERANCE
205
205
  };
206
+ var _ref;
206
207
  var containerRef = useRef(null);
207
208
  var lastScrollHeight = useRef(0);
208
- var isLocked = useRef(false); // 用户滚动锁定状态
209
+ /**
210
+ * 记录自动滚动是否处于激活状态(即用户没有主动向上滚动)。
211
+ * 在 smooth scroll 动画过程中 scrollTop 尚未到达目标值,如果此时有新内容
212
+ * 进来,isNearBottom 可能因 scrollTop 还在动画中途而误判为 false,导致
213
+ * 漏掉最后一次滚动。用此标志可以安全地跨帧维持"应该跟底"的意图。
214
+ */ var isAutoScrollEngaged = useRef(true);
209
215
  var observer = useRef(null);
216
+ var tolerance = (_ref = props === null || props === void 0 ? void 0 : props.SCROLL_TOLERANCE) !== null && _ref !== void 0 ? _ref : SCROLL_TOLERANCE;
210
217
  // 主滚动逻辑
211
218
  var _checkScroll = function _checkScroll() {
212
219
  var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, behavior = arguments.length > 1 ? arguments[1] : void 0;
213
220
  return _async_to_generator(function() {
214
- var _props_onResize, container, currentScrollHeight, prevScrollHeight, isNearBottom, shouldScroll, _container_scrollTo, scrollBehavior;
221
+ var _props_onResize, container, currentScrollHeight, prevScrollHeight, isNearBottom, shouldScroll, scrollBehavior;
215
222
  return _ts_generator(this, function(_state) {
216
223
  container = containerRef.current;
217
224
  if (!container) return [
@@ -223,21 +230,20 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
223
230
  });
224
231
  currentScrollHeight = container.scrollHeight;
225
232
  prevScrollHeight = lastScrollHeight.current;
226
- // 计算用户是否在底部区域
227
- isNearBottom = container.scrollTop + container.clientHeight >= prevScrollHeight - ((props === null || props === void 0 ? void 0 : props.SCROLL_TOLERANCE) || SCROLL_TOLERANCE);
228
- // 触发滚动的情况:
229
- // 1. 强制滚动(手动触发)
230
- // 2. 内容高度增加且用户原本在底部
231
- shouldScroll = force || currentScrollHeight > prevScrollHeight && (isNearBottom || isLocked.current);
233
+ // 使用当前 scrollHeight 判断是否靠近底部,避免 smooth 动画中 scrollTop
234
+ // 尚未到达目标时的误判。
235
+ isNearBottom = container.scrollTop + container.clientHeight >= currentScrollHeight - tolerance;
236
+ shouldScroll = force || currentScrollHeight > prevScrollHeight && (isNearBottom || isAutoScrollEngaged.current);
232
237
  if (shouldScroll && container.scrollTo) {
233
- ;
234
- // 如果传入了 behavior,使用传入的值;否则使用配置的 scrollBehavior;最后默认为 'smooth'
235
238
  scrollBehavior = behavior !== undefined ? behavior : props.scrollBehavior || 'smooth';
236
- (_container_scrollTo = container.scrollTo) === null || _container_scrollTo === void 0 ? void 0 : _container_scrollTo.call(container, {
239
+ container.scrollTo({
237
240
  top: currentScrollHeight,
238
241
  behavior: scrollBehavior
239
242
  });
240
- isLocked.current = false; // 滚动后解除锁定
243
+ isAutoScrollEngaged.current = true;
244
+ } else if (!isNearBottom) {
245
+ // 用户已经向上滚动远离底部,关闭自动跟随
246
+ isAutoScrollEngaged.current = false;
241
247
  }
242
248
  lastScrollHeight.current = currentScrollHeight;
243
249
  return [
@@ -247,12 +253,30 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
247
253
  })();
248
254
  };
249
255
  var checkScroll = useThrottleFn(_checkScroll, props.timeout || 160);
256
+ // 监听用户手动滚动,判断其是否离开了底部
257
+ useEffect(function() {
258
+ var container = containerRef.current;
259
+ if (!container) return;
260
+ var handleScroll = function handleScroll() {
261
+ var atBottom = container.scrollTop + container.clientHeight >= container.scrollHeight - tolerance;
262
+ if (atBottom) {
263
+ isAutoScrollEngaged.current = true;
264
+ } else {
265
+ isAutoScrollEngaged.current = false;
266
+ }
267
+ };
268
+ container.addEventListener('scroll', handleScroll, {
269
+ passive: true
270
+ });
271
+ return function() {
272
+ return container.removeEventListener('scroll', handleScroll);
273
+ };
274
+ }, _to_consumable_array(props.deps || []));
250
275
  // DOM 变化监听(MutationObserver)
251
276
  useEffect(function() {
252
277
  var container = containerRef.current;
253
278
  if (!container) return;
254
279
  observer.current = new MutationObserver(function(mutations) {
255
- // 过滤出添加节点的变化
256
280
  var hasAddedNodes = mutations.some(function(m) {
257
281
  return m.addedNodes.length > 0;
258
282
  });
@@ -392,6 +392,7 @@ export declare function useLanguage(): {
392
392
  'browser.searching': string;
393
393
  'layout.header.title': string;
394
394
  theme: string;
395
+ localPreview: string;
395
396
  expandCollapse: string;
396
397
  moreActions: string;
397
398
  clickToRetry: string;
@@ -354,6 +354,7 @@ export declare const cnLabels: {
354
354
  'browser.searching': string;
355
355
  'layout.header.title': string;
356
356
  theme: string;
357
+ localPreview: string;
357
358
  expandCollapse: string;
358
359
  moreActions: string;
359
360
  clickToRetry: string;
@@ -376,6 +376,7 @@
376
376
  'browser.searching': '搜索中...',
377
377
  'layout.header.title': 'AI 助手',
378
378
  theme: '主题',
379
+ localPreview: '本地预览',
379
380
  expandCollapse: '展开/收起',
380
381
  moreActions: '更多操作',
381
382
  clickToRetry: '点击重试',
@@ -801,6 +802,7 @@
801
802
  'browser.searching': 'Searching...',
802
803
  'layout.header.title': 'AI Assistant',
803
804
  theme: 'Theme',
805
+ localPreview: 'Local Preview',
804
806
  expandCollapse: 'Expand/Collapse',
805
807
  moreActions: 'More Actions',
806
808
  clickToRetry: 'Click to Retry',
@@ -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,
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { RenderElementProps } from 'slate-react';
3
+ export declare const AgenticUiFileMapBlock: React.FC<RenderElementProps>;
4
+ export declare const ReadonlyAgenticUiFileMapBlock: React.NamedExoticComponent<RenderElementProps>;