@ant-design/agentic-ui 2.29.43 → 2.29.46

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 (29) hide show
  1. package/dist/AgentRunBar/index.js +27 -19
  2. package/dist/Hooks/useLanguage.d.ts +1 -0
  3. package/dist/I18n/locales.d.ts +1 -0
  4. package/dist/I18n/locales.js +2 -0
  5. package/dist/MarkdownEditor/editor/elements/Table/Table.js +2 -1
  6. package/dist/MarkdownEditor/editor/elements/index.js +21 -0
  7. package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +15 -0
  8. package/dist/MarkdownEditor/editor/plugins/useHighlight.js +173 -14
  9. package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +3 -1
  10. package/dist/MarkdownEditor/editor/style.js +343 -363
  11. package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/index.js +45 -17
  12. package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/style.js +23 -1
  13. package/dist/MarkdownEditor/el.d.ts +7 -0
  14. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  15. package/dist/TaskList/TaskList.d.ts +3 -0
  16. package/dist/TaskList/TaskList.js +210 -0
  17. package/dist/TaskList/components/StatusIcon.d.ts +9 -0
  18. package/dist/TaskList/components/StatusIcon.js +23 -0
  19. package/dist/TaskList/components/TaskListItem.d.ts +12 -0
  20. package/dist/TaskList/components/TaskListItem.js +68 -0
  21. package/dist/TaskList/constants.d.ts +24 -0
  22. package/dist/TaskList/constants.js +38 -0
  23. package/dist/TaskList/index.d.ts +2 -50
  24. package/dist/TaskList/index.js +1 -260
  25. package/dist/TaskList/style.js +66 -9
  26. package/dist/TaskList/types.d.ts +29 -0
  27. package/dist/TaskList/types.js +3 -0
  28. package/dist/ToolUseBar/style.js +6 -5
  29. package/package.json +1 -1
@@ -1,260 +1 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _array_without_holes(arr) {
10
- if (Array.isArray(arr)) return _array_like_to_array(arr);
11
- }
12
- function _iterable_to_array(iter) {
13
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14
- }
15
- function _iterable_to_array_limit(arr, i) {
16
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
17
- if (_i == null) return;
18
- var _arr = [];
19
- var _n = true;
20
- var _d = false;
21
- var _s, _e;
22
- try {
23
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
24
- _arr.push(_s.value);
25
- if (i && _arr.length === i) break;
26
- }
27
- } catch (err) {
28
- _d = true;
29
- _e = err;
30
- } finally{
31
- try {
32
- if (!_n && _i["return"] != null) _i["return"]();
33
- } finally{
34
- if (_d) throw _e;
35
- }
36
- }
37
- return _arr;
38
- }
39
- function _non_iterable_rest() {
40
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41
- }
42
- function _non_iterable_spread() {
43
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
- }
45
- function _sliced_to_array(arr, i) {
46
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
47
- }
48
- function _to_consumable_array(arr) {
49
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
50
- }
51
- function _unsupported_iterable_to_array(o, minLen) {
52
- if (!o) return;
53
- if (typeof o === "string") return _array_like_to_array(o, minLen);
54
- var n = Object.prototype.toString.call(o).slice(8, -1);
55
- if (n === "Object" && o.constructor) n = o.constructor.name;
56
- if (n === "Map" || n === "Set") return Array.from(n);
57
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
58
- }
59
- import { ChevronUp, CircleDashed, SuccessFill, X } from "@sofa-design/icons";
60
- import { ConfigProvider } from "antd";
61
- import classNames from "clsx";
62
- import { AnimatePresence, motion } from "framer-motion";
63
- import { useMergedState } from "rc-util";
64
- import React, { memo, useCallback, useContext, useMemo } from "react";
65
- import { ActionIconBox } from "../Components/ActionIconBox";
66
- import { Loading } from "../Components/Loading";
67
- import { useRefFunction } from "../Hooks/useRefFunction";
68
- import { I18nContext } from "../I18n";
69
- import { useStyle } from "./style";
70
- var LOADING_SIZE = 16;
71
- var buildClassName = function buildClassName() {
72
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
73
- args[_key] = arguments[_key];
74
- }
75
- return classNames.apply(void 0, _to_consumable_array(args));
76
- };
77
- var hasTaskContent = function hasTaskContent(content) {
78
- if (Array.isArray(content)) {
79
- return content.length > 0;
80
- }
81
- return !!content;
82
- };
83
- var getArrowRotation = function getArrowRotation(collapsed) {
84
- return {
85
- transform: collapsed ? 'rotate(0deg)' : 'rotate(180deg)',
86
- transition: 'transform 0.3s ease'
87
- };
88
- };
89
- var StatusIcon = /*#__PURE__*/ memo(function(param) {
90
- var status = param.status, prefixCls = param.prefixCls, hashId = param.hashId;
91
- var statusMap = {
92
- success: /*#__PURE__*/ React.createElement(SuccessFill, null),
93
- loading: /*#__PURE__*/ React.createElement(Loading, {
94
- size: LOADING_SIZE
95
- }),
96
- pending: /*#__PURE__*/ React.createElement("div", {
97
- className: buildClassName("".concat(prefixCls, "-status-idle"), hashId)
98
- }, /*#__PURE__*/ React.createElement(CircleDashed, null)),
99
- error: /*#__PURE__*/ React.createElement(X, null)
100
- };
101
- return /*#__PURE__*/ React.createElement("div", {
102
- className: buildClassName("".concat(prefixCls, "-status"), "".concat(prefixCls, "-status-").concat(status), hashId),
103
- "data-testid": "task-list-status-".concat(status)
104
- }, statusMap[status]);
105
- });
106
- StatusIcon.displayName = 'StatusIcon';
107
- var TaskListItem = /*#__PURE__*/ memo(function(param) {
108
- var item = param.item, isLast = param.isLast, prefixCls = param.prefixCls, hashId = param.hashId, expandedKeys = param.expandedKeys, onToggle = param.onToggle;
109
- var locale = useContext(I18nContext).locale;
110
- var isCollapsed = !expandedKeys.includes(item.key);
111
- var hasContent = hasTaskContent(item.content);
112
- // 使用 useCallback 优化切换处理函数
113
- var handleToggle = useCallback(function() {
114
- onToggle(item.key);
115
- }, [
116
- item.key,
117
- onToggle
118
- ]);
119
- var arrowTitle = isCollapsed ? (locale === null || locale === void 0 ? void 0 : locale['taskList.expand']) || '展开' : (locale === null || locale === void 0 ? void 0 : locale['taskList.collapse']) || '收起';
120
- var contentVariants = useMemo(function() {
121
- return {
122
- expanded: {
123
- height: 'auto',
124
- opacity: 1
125
- },
126
- collapsed: {
127
- height: 0,
128
- opacity: 0
129
- }
130
- };
131
- }, []);
132
- var contentTransition = useMemo(function() {
133
- return {
134
- height: {
135
- duration: 0.26,
136
- ease: [
137
- 0.4,
138
- 0,
139
- 0.2,
140
- 1
141
- ]
142
- },
143
- opacity: {
144
- duration: 0.2,
145
- ease: 'linear'
146
- }
147
- };
148
- }, []);
149
- return /*#__PURE__*/ React.createElement("div", {
150
- key: item.key,
151
- className: buildClassName("".concat(prefixCls, "-thoughtChainItem"), hashId),
152
- "data-testid": "task-list-thoughtChainItem"
153
- }, /*#__PURE__*/ React.createElement("div", {
154
- className: buildClassName("".concat(prefixCls, "-left"), hashId),
155
- onClick: handleToggle,
156
- "data-testid": "task-list-left"
157
- }, /*#__PURE__*/ React.createElement(StatusIcon, {
158
- status: item.status,
159
- prefixCls: prefixCls,
160
- hashId: hashId
161
- }), /*#__PURE__*/ React.createElement("div", {
162
- className: buildClassName("".concat(prefixCls, "-content-left"), hashId)
163
- }, !isLast && /*#__PURE__*/ React.createElement("div", {
164
- className: buildClassName("".concat(prefixCls, "-dash-line"), hashId),
165
- "data-testid": "task-list-dash-line"
166
- }))), /*#__PURE__*/ React.createElement("div", {
167
- className: buildClassName("".concat(prefixCls, "-right"), hashId)
168
- }, /*#__PURE__*/ React.createElement("div", {
169
- className: buildClassName("".concat(prefixCls, "-top"), hashId),
170
- onClick: handleToggle
171
- }, /*#__PURE__*/ React.createElement("div", {
172
- className: buildClassName("".concat(prefixCls, "-title"), hashId)
173
- }, item.title), hasContent && /*#__PURE__*/ React.createElement("div", {
174
- className: buildClassName("".concat(prefixCls, "-arrowContainer"), hashId),
175
- onClick: handleToggle,
176
- "data-testid": "task-list-arrowContainer"
177
- }, /*#__PURE__*/ React.createElement(ActionIconBox, {
178
- title: arrowTitle,
179
- iconStyle: getArrowRotation(isCollapsed),
180
- loading: false,
181
- onClick: handleToggle
182
- }, /*#__PURE__*/ React.createElement(ChevronUp, {
183
- "data-testid": "task-list-arrow"
184
- })))), /*#__PURE__*/ React.createElement(AnimatePresence, {
185
- initial: false
186
- }, !isCollapsed && /*#__PURE__*/ React.createElement(motion.div, {
187
- key: "task-content",
188
- variants: contentVariants,
189
- initial: "collapsed",
190
- animate: "expanded",
191
- exit: "collapsed",
192
- transition: contentTransition,
193
- className: buildClassName("".concat(prefixCls, "-body"), hashId)
194
- }, /*#__PURE__*/ React.createElement("div", {
195
- className: buildClassName("".concat(prefixCls, "-content"), hashId)
196
- }, item.content)))));
197
- });
198
- TaskListItem.displayName = 'TaskListItem';
199
- var getDefaultExpandedKeys = function getDefaultExpandedKeys(items, isControlled) {
200
- return isControlled ? [] : items.map(function(item) {
201
- return item.key;
202
- });
203
- };
204
- /**
205
- * TaskList 组件
206
- *
207
- * 显示任务列表,支持展开/折叠、状态管理等功能
208
- * 支持受控和非受控两种模式
209
- *
210
- * @example
211
- * ```tsx
212
- * // 非受控模式
213
- * <TaskList
214
- * items={[
215
- * { key: 'task1', title: '任务1', content: '内容', status: 'success' }
216
- * ]}
217
- * />
218
- *
219
- * // 受控模式
220
- * <TaskList
221
- * items={tasks}
222
- * expandedKeys={expandedKeys}
223
- * onExpandedKeysChange={setExpandedKeys}
224
- * />
225
- * ```
226
- */ export var TaskList = /*#__PURE__*/ memo(function(param) {
227
- var items = param.items, className = param.className, expandedKeys = param.expandedKeys, onExpandedKeysChange = param.onExpandedKeysChange;
228
- var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
229
- var prefixCls = getPrefixCls('task-list');
230
- var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
231
- var isControlled = expandedKeys !== undefined;
232
- var defaultKeys = getDefaultExpandedKeys(items, isControlled);
233
- var _useMergedState = _sliced_to_array(useMergedState(defaultKeys, {
234
- value: expandedKeys,
235
- onChange: onExpandedKeysChange
236
- }), 2), internalExpandedKeys = _useMergedState[0], setInternalExpandedKeys = _useMergedState[1];
237
- var handleToggle = useRefFunction(function(key) {
238
- var currentExpanded = isControlled ? expandedKeys : internalExpandedKeys;
239
- var newExpandedKeys = currentExpanded.includes(key) ? currentExpanded.filter(function(k) {
240
- return k !== key;
241
- }) : _to_consumable_array(currentExpanded).concat([
242
- key
243
- ]);
244
- setInternalExpandedKeys(newExpandedKeys);
245
- });
246
- return wrapSSR(/*#__PURE__*/ React.createElement("div", {
247
- className: className
248
- }, items.map(function(item, index) {
249
- return /*#__PURE__*/ React.createElement(TaskListItem, {
250
- key: item.key,
251
- item: item,
252
- isLast: index === items.length - 1,
253
- prefixCls: prefixCls,
254
- hashId: hashId,
255
- expandedKeys: internalExpandedKeys,
256
- onToggle: handleToggle
257
- });
258
- })));
259
- });
260
- TaskList.displayName = 'TaskList';
1
+ export { TaskList } from "./TaskList";
@@ -52,8 +52,9 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  import { useEditorStyleRegister } from "../Hooks/useStyle";
54
54
  var genStyle = function genStyle(token) {
55
- var _obj;
56
- return _define_property({}, token.componentCls, {
55
+ var componentCls = token.componentCls;
56
+ var _obj, _obj1;
57
+ return _define_property({}, componentCls, {
57
58
  '&-thoughtChainItem': {
58
59
  marginBottom: 4,
59
60
  display: 'flex',
@@ -105,27 +106,27 @@ var genStyle = function genStyle(token) {
105
106
  marginBottom: 4,
106
107
  gap: 4,
107
108
  cursor: 'pointer'
108
- }, _define_property(_obj, "".concat(token.componentCls, "-titleContainer"), {
109
+ }, _define_property(_obj, "".concat(componentCls, "-titleContainer"), {
109
110
  paddingTop: 8,
110
111
  display: 'flex',
111
112
  alignItems: 'center'
112
- }), _define_property(_obj, "".concat(token.componentCls, "-title"), {
113
+ }), _define_property(_obj, "".concat(componentCls, "-title"), {
113
114
  font: 'var(--font-text-h6-base)',
114
115
  marginLeft: 12,
115
116
  textAlign: 'justify',
116
117
  color: 'var(--color-gray-text-default)'
117
- }), _define_property(_obj, "".concat(token.componentCls, "-loading"), {
118
+ }), _define_property(_obj, "".concat(componentCls, "-loading"), {
118
119
  height: 20,
119
120
  display: 'flex',
120
121
  alignItems: 'center',
121
122
  justifyContent: 'center'
122
- }), _define_property(_obj, "".concat(token.componentCls, "-arrowContainer"), {
123
+ }), _define_property(_obj, "".concat(componentCls, "-arrowContainer"), {
123
124
  height: 20,
124
125
  lineHeight: '20px',
125
126
  display: 'flex',
126
127
  alignItems: 'center',
127
128
  justifyContent: 'center'
128
- }), _define_property(_obj, "".concat(token.componentCls, "-arrow"), {
129
+ }), _define_property(_obj, "".concat(componentCls, "-arrow"), {
129
130
  flexShrink: 0,
130
131
  width: 16,
131
132
  height: 16,
@@ -133,7 +134,7 @@ var genStyle = function genStyle(token) {
133
134
  }), _obj),
134
135
  '&-body': _define_property({
135
136
  display: 'flex'
136
- }, "".concat(token.componentCls, "-content"), {
137
+ }, "".concat(componentCls, "-content"), {
137
138
  font: 'var(--font-text-paragraph-sm)',
138
139
  marginLeft: 12,
139
140
  display: 'flex',
@@ -141,7 +142,63 @@ var genStyle = function genStyle(token) {
141
142
  gap: 2,
142
143
  letterSpacing: 'var(--letter-spacing-paragraph-sm, normal)',
143
144
  color: 'var(--color-gray-text-secondary)'
144
- })
145
+ }),
146
+ // Simple variant - wrapper
147
+ '&-simple-wrapper': {
148
+ borderRadius: 'var(--radius-control-base, 8px)',
149
+ background: 'var(--color-gray-bg-page-dark, #f5f5f5)',
150
+ boxShadow: 'var(--shadow-control-base, none)',
151
+ overflow: 'hidden'
152
+ },
153
+ // Simple variant - bar
154
+ '&-simple': (_obj1 = {
155
+ display: 'flex',
156
+ alignItems: 'center',
157
+ height: 36,
158
+ padding: '0 12px',
159
+ gap: 8,
160
+ cursor: 'pointer',
161
+ userSelect: 'none',
162
+ transition: 'background 0.2s ease',
163
+ '&:hover': {
164
+ background: 'var(--color-gray-control-fill-active, rgba(0,0,0,0.04))'
165
+ }
166
+ }, _define_property(_obj1, "".concat(componentCls, "-simple-status"), _define_property({
167
+ display: 'flex',
168
+ alignItems: 'center',
169
+ flexShrink: 0
170
+ }, "".concat(componentCls, "-status"), {
171
+ height: 'auto',
172
+ svg: {
173
+ width: 14,
174
+ height: 14
175
+ }
176
+ })), _define_property(_obj1, "".concat(componentCls, "-simple-text"), {
177
+ flex: 1,
178
+ minWidth: 0,
179
+ font: 'var(--font-text-paragraph-base, 14px)',
180
+ letterSpacing: 'var(--letter-spacing-paragraph-base, normal)',
181
+ color: 'var(--color-gray-text-default, rgba(0,3,9,0.85))',
182
+ overflow: 'hidden',
183
+ textOverflow: 'ellipsis',
184
+ whiteSpace: 'nowrap'
185
+ }), _define_property(_obj1, "".concat(componentCls, "-simple-progress"), {
186
+ flexShrink: 0,
187
+ font: 'var(--font-text-paragraph-sm, 12px)',
188
+ color: 'var(--color-gray-text-secondary, rgba(0,3,9,0.45))'
189
+ }), _define_property(_obj1, "".concat(componentCls, "-simple-arrow"), {
190
+ flexShrink: 0,
191
+ display: 'flex',
192
+ alignItems: 'center',
193
+ justifyContent: 'center'
194
+ }), _obj1),
195
+ // Simple variant - expanded content
196
+ '&-simple-content': {
197
+ overflow: 'hidden'
198
+ },
199
+ '&-simple-list': {
200
+ padding: '4px 12px 8px'
201
+ }
145
202
  });
146
203
  };
147
204
  export function useStyle(prefixCls) {
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ export type TaskStatus = 'success' | 'pending' | 'loading' | 'error';
3
+ export interface TaskItem {
4
+ key: string;
5
+ title?: React.ReactNode;
6
+ content: React.ReactNode | React.ReactNode[];
7
+ status: TaskStatus;
8
+ }
9
+ export type TaskListVariant = 'default' | 'simple';
10
+ export interface TaskListProps {
11
+ /** 任务列表数据 */
12
+ items: TaskItem[];
13
+ /** 自定义类名 */
14
+ className?: string;
15
+ /** 受控模式:指定当前展开的任务项 key 数组 */
16
+ expandedKeys?: string[];
17
+ /** 受控模式:展开状态变化时的回调函数 */
18
+ onExpandedKeysChange?: (expandedKeys: string[]) => void;
19
+ /** 组件变体,simple 模式将任务列表收起为紧凑的单行摘要 */
20
+ variant?: TaskListVariant;
21
+ /** simple 模式下摘要条是否展开(受控) */
22
+ open?: boolean;
23
+ /** simple 模式下摘要条展开状态变化回调 */
24
+ onOpenChange?: (open: boolean) => void;
25
+ }
26
+ /**
27
+ * @deprecated @since 2.30.0 请使用 TaskListProps 替代
28
+ */
29
+ export type ThoughtChainProps = TaskListProps;
@@ -0,0 +1,3 @@
1
+ /**
2
+ * @deprecated @since 2.30.0 请使用 TaskListProps 替代
3
+ */ export { };
@@ -302,7 +302,12 @@ var genStyle = function genStyle(token) {
302
302
  },
303
303
  '&-tool-container': {
304
304
  display: 'flex',
305
+ flexDirection: 'column',
305
306
  width: '100%',
307
+ maxHeight: 700,
308
+ overflow: 'hidden',
309
+ overflowY: 'auto',
310
+ position: 'relative',
306
311
  paddingInline: 4,
307
312
  paddingBottom: 4,
308
313
  '&-light': {
@@ -319,11 +324,7 @@ var genStyle = function genStyle(token) {
319
324
  fontWeight: 'normal',
320
325
  lineHeight: '160%',
321
326
  letterSpacing: 'normal',
322
- color: '#767E8B',
323
- overflow: 'hidden',
324
- display: '-webkit-box',
325
- WebkitLineClamp: 5,
326
- WebkitBoxOrient: 'vertical'
327
+ color: '#767E8B'
327
328
  },
328
329
  '&-tool-content-error': {
329
330
  display: 'flex',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.29.43",
3
+ "version": "2.29.46",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",