@ant-design/agentic-ui 2.29.4-beta.0 → 2.29.5
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.
- package/dist/AgentRunBar/Robot.d.ts +2 -2
- package/dist/AgentRunBar/index.d.ts +1 -0
- package/dist/AgentRunBar/index.js +1 -0
- package/dist/Hooks/useLanguage.d.ts +2 -0
- package/dist/I18n/locales.d.ts +2 -0
- package/dist/I18n/locales.js +6 -2
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +2 -2
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +2 -1
- package/dist/MarkdownEditor/editor/style.js +10 -1
- package/dist/MarkdownInputField/MarkdownInputField.js +1 -1
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +29 -1
- package/dist/MarkdownInputField/style.d.ts +2 -1
- package/dist/MarkdownInputField/style.js +13 -8
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +10 -0
- package/dist/Plugins/chart/AreaChart/index.js +2 -1
- package/dist/Plugins/chart/BarChart/index.js +16 -11
- package/dist/Plugins/chart/LineChart/index.js +3 -2
- package/dist/Plugins/chart/utils.js +43 -29
- package/dist/Plugins/code/components/CodeToolbar.js +4 -4
- package/dist/ToolUseBarThink/style.js +4 -3
- package/dist/typing.d.ts +29 -2
- package/package.json +15 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type RobotStatus = 'default' | 'thinking' | 'dazing' | 'pause';
|
|
3
|
+
interface RobotProps {
|
|
4
4
|
/** 机器人状态 */
|
|
5
5
|
status?: RobotStatus;
|
|
6
6
|
/** 机器人大小 */
|
|
@@ -20,6 +20,7 @@ import { I18nContext } from "../I18n";
|
|
|
20
20
|
import { PauseIcon, PlayIcon, SimplePauseIcon, SimplePlayIcon, SimpleStopIcon, StopIcon } from "./icons";
|
|
21
21
|
import Robot from "./Robot";
|
|
22
22
|
import { useStyle } from "./style";
|
|
23
|
+
export * from "./Robot";
|
|
23
24
|
/**
|
|
24
25
|
* 任务状态枚举
|
|
25
26
|
* @enum {string}
|
|
@@ -382,6 +382,8 @@ export declare function useLanguage(): {
|
|
|
382
382
|
'browser.totalResults': string;
|
|
383
383
|
'browser.searching': string;
|
|
384
384
|
'layout.header.title': string;
|
|
385
|
+
theme: string;
|
|
386
|
+
expandCollapse: string;
|
|
385
387
|
};
|
|
386
388
|
setLanguage: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
387
389
|
toggleLanguage: () => void;
|
package/dist/I18n/locales.d.ts
CHANGED
package/dist/I18n/locales.js
CHANGED
|
@@ -366,7 +366,9 @@
|
|
|
366
366
|
'browser.noResults': '暂无结果',
|
|
367
367
|
'browser.totalResults': '共${count}个结果',
|
|
368
368
|
'browser.searching': '搜索中...',
|
|
369
|
-
'layout.header.title': 'AI 助手'
|
|
369
|
+
'layout.header.title': 'AI 助手',
|
|
370
|
+
theme: '主题',
|
|
371
|
+
expandCollapse: '展开/收起'
|
|
370
372
|
};
|
|
371
373
|
/**
|
|
372
374
|
* 英文标签映射对象
|
|
@@ -734,5 +736,7 @@
|
|
|
734
736
|
'browser.noResults': 'No results found',
|
|
735
737
|
'browser.totalResults': 'Total ${count} results',
|
|
736
738
|
'browser.searching': 'Searching...',
|
|
737
|
-
'layout.header.title': 'AI Assistant'
|
|
739
|
+
'layout.header.title': 'AI Assistant',
|
|
740
|
+
theme: 'Theme',
|
|
741
|
+
expandCollapse: 'Expand/Collapse'
|
|
738
742
|
};
|
|
@@ -72,7 +72,7 @@ import { parserSlateNodeToMarkdown } from "../../utils";
|
|
|
72
72
|
* 移除了不必要的滚动监听和复杂的宽度计算
|
|
73
73
|
*/ export var ReadonlyTableComponent = /*#__PURE__*/ React.memo(function(param) {
|
|
74
74
|
var hashId = param.hashId, children = param.children, element = param.element, baseCls = param.baseCls;
|
|
75
|
-
var _element_children__children, _element_children_, _element_children, _editorProps_tableConfig;
|
|
75
|
+
var _element_children__children, _element_children_, _element_children, _editorProps_tableConfig, _i18n_locale;
|
|
76
76
|
var editorProps = useEditorStore().editorProps;
|
|
77
77
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
78
78
|
var _ref = (editorProps === null || editorProps === void 0 ? void 0 : editorProps.tableConfig) || {}, _ref_actions = _ref.actions, actions = _ref_actions === void 0 ? {
|
|
@@ -185,7 +185,7 @@ import { parserSlateNodeToMarkdown } from "../../utils";
|
|
|
185
185
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
|
|
186
186
|
className: classNames(baseCls, hashId)
|
|
187
187
|
}, tableDom), popoverContent, previewOpen && /*#__PURE__*/ React.createElement(Modal, {
|
|
188
|
-
title: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_tableConfig = editorProps.tableConfig) === null || _editorProps_tableConfig === void 0 ? void 0 : _editorProps_tableConfig.previewTitle) || '预览表格',
|
|
188
|
+
title: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_tableConfig = editorProps.tableConfig) === null || _editorProps_tableConfig === void 0 ? void 0 : _editorProps_tableConfig.previewTitle) || (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.previewTable) || '预览表格',
|
|
189
189
|
open: previewOpen,
|
|
190
190
|
closable: true,
|
|
191
191
|
footer: null,
|
|
@@ -111,7 +111,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
111
111
|
import { Editor, Node, Path, Range, Transforms } from "slate";
|
|
112
112
|
import { ReactEditor } from "slate-react";
|
|
113
113
|
export var inlineNode = new Set([
|
|
114
|
-
'break'
|
|
114
|
+
'break',
|
|
115
|
+
'inline-katex'
|
|
115
116
|
]);
|
|
116
117
|
var voidNode = new Set([
|
|
117
118
|
'hr',
|
|
@@ -139,8 +139,17 @@ var genStyle = function(token) {
|
|
|
139
139
|
'[data-hidden]': {
|
|
140
140
|
display: 'none'
|
|
141
141
|
},
|
|
142
|
-
// KaTeX
|
|
142
|
+
// KaTeX容器样式和公式样式修复
|
|
143
|
+
// 确保 white-space: nowrap 不被父元素的 pre-wrap 覆盖
|
|
144
|
+
// KaTeX 库生成的元素需要 nowrap 来防止公式堆叠
|
|
145
|
+
'.katex': {
|
|
146
|
+
whiteSpace: 'nowrap !important'
|
|
147
|
+
},
|
|
143
148
|
'.katex-container': {
|
|
149
|
+
whiteSpace: 'nowrap !important',
|
|
150
|
+
'& *': {
|
|
151
|
+
whiteSpace: 'nowrap !important'
|
|
152
|
+
},
|
|
144
153
|
'.newline': {
|
|
145
154
|
margin: '4px 0'
|
|
146
155
|
}
|
|
@@ -195,7 +195,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
195
195
|
var _props_style, _props_attachment, _props_enlargeable, _props_refinePrompt, _props_enlargeable1, _props_enlargeable2;
|
|
196
196
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
197
197
|
var baseCls = getPrefixCls('agentic-md-input-field');
|
|
198
|
-
var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
198
|
+
var _useStyle = useStyle(baseCls, props.disableHoverAnimation), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
199
199
|
// 状态管理
|
|
200
200
|
var _useMarkdownInputFieldState = useMarkdownInputFieldState({
|
|
201
201
|
value: props.value,
|
|
@@ -175,6 +175,7 @@ function _ts_generator(thisArg, body) {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
import React from "react";
|
|
178
|
+
import { Editor, Transforms } from "slate";
|
|
178
179
|
import { useRefFunction } from "../../Hooks/useRefFunction";
|
|
179
180
|
import { upLoadFileToServer } from "../AttachmentButton";
|
|
180
181
|
import { isMobileDevice } from "../AttachmentButton/utils";
|
|
@@ -323,11 +324,38 @@ import { getFileListFromDataTransferItems } from "../FilePaste";
|
|
|
323
324
|
}());
|
|
324
325
|
// 键盘事件:早返回减少嵌套
|
|
325
326
|
var handleKeyDown = useRefFunction(function(e) {
|
|
326
|
-
var _markdownEditorRef_current;
|
|
327
|
+
var _markdownEditorRef_current, _markdownEditorRef_current_markdownEditorRef, _markdownEditorRef_current1;
|
|
327
328
|
if (markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.store.inputComposition) return;
|
|
329
|
+
var editor = markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : (_markdownEditorRef_current1 = markdownEditorRef.current) === null || _markdownEditorRef_current1 === void 0 ? void 0 : (_markdownEditorRef_current_markdownEditorRef = _markdownEditorRef_current1.markdownEditorRef) === null || _markdownEditorRef_current_markdownEditorRef === void 0 ? void 0 : _markdownEditorRef_current_markdownEditorRef.current;
|
|
328
330
|
var isEnter = e.key === 'Enter';
|
|
329
331
|
var isMod = e.ctrlKey || e.metaKey;
|
|
330
332
|
var isShift = e.shiftKey;
|
|
333
|
+
// 处理 Home 键:移动到文档开头
|
|
334
|
+
if (e.key === 'Home' && !isMod && editor) {
|
|
335
|
+
e.preventDefault();
|
|
336
|
+
e.stopPropagation();
|
|
337
|
+
var start = Editor.start(editor, []);
|
|
338
|
+
Transforms.select(editor, start);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
// 处理 End 键:移动到文档末尾
|
|
342
|
+
if (e.key === 'End' && !isMod && editor) {
|
|
343
|
+
e.preventDefault();
|
|
344
|
+
e.stopPropagation();
|
|
345
|
+
var end = Editor.end(editor, []);
|
|
346
|
+
Transforms.select(editor, end);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
// 处理 Ctrl+A / Cmd+A:全选
|
|
350
|
+
if ((e.key === 'a' || e.key === 'A') && isMod && !isShift && editor) {
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
e.stopPropagation();
|
|
353
|
+
Transforms.select(editor, {
|
|
354
|
+
anchor: Editor.start(editor, []),
|
|
355
|
+
focus: Editor.end(editor, [])
|
|
356
|
+
});
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
331
359
|
// 手机端禁用 Enter 键发送
|
|
332
360
|
if (isEnter && !isMod && !isShift && isMobileDevice()) {
|
|
333
361
|
return; // 让编辑器正常处理换行
|
|
@@ -3,9 +3,10 @@ export declare const addGlowBorderOffset: (size: string | number) => string;
|
|
|
3
3
|
/**
|
|
4
4
|
* Probubble
|
|
5
5
|
* @param prefixCls
|
|
6
|
+
* @param disableHoverAnimation 是否禁用 hover 动画
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
|
-
export declare function useStyle(prefixCls?: string): {
|
|
9
|
+
export declare function useStyle(prefixCls?: string, disableHoverAnimation?: boolean): {
|
|
9
10
|
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
|
|
10
11
|
hashId: string;
|
|
11
12
|
};
|
|
@@ -104,8 +104,13 @@ var stopIconRotate = new Keyframes('stopIconRotate', {
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
var genStyle = function(token) {
|
|
107
|
+
var hoverStyle = token.disableHoverAnimation ? {} : {
|
|
108
|
+
'&:hover': {
|
|
109
|
+
boxShadow: '0px 0px 1px 0px rgba(10, 48, 104, 0.25), 0px 2px 7px 0px rgba(10, 48, 104, 0.05), 0px 2px 5px -2px rgba(10, 48, 104, 0.06)'
|
|
110
|
+
}
|
|
111
|
+
};
|
|
107
112
|
var _obj, _obj1;
|
|
108
|
-
return _obj1 = {}, _define_property(_obj1, token.componentCls, {
|
|
113
|
+
return _obj1 = {}, _define_property(_obj1, token.componentCls, _object_spread_props(_object_spread({
|
|
109
114
|
width: '100%',
|
|
110
115
|
height: '100%',
|
|
111
116
|
display: 'flex',
|
|
@@ -125,10 +130,8 @@ var genStyle = function(token) {
|
|
|
125
130
|
outline: '1px solid transparent',
|
|
126
131
|
outlineColor: 'var(--mif-active-outline-color, transparent)'
|
|
127
132
|
},
|
|
128
|
-
boxShadow: '0px 0px 1px 0px rgba(10, 48, 104, 0.15), 0px 1.5px 4px -1px rgba(10, 48, 104, 0.04)'
|
|
129
|
-
|
|
130
|
-
boxShadow: '0px 0px 1px 0px rgba(10, 48, 104, 0.25), 0px 2px 7px 0px rgba(10, 48, 104, 0.05), 0px 2px 5px -2px rgba(10, 48, 104, 0.06)'
|
|
131
|
-
},
|
|
133
|
+
boxShadow: '0px 0px 1px 0px rgba(10, 48, 104, 0.15), 0px 1.5px 4px -1px rgba(10, 48, 104, 0.04)'
|
|
134
|
+
}, hoverStyle), {
|
|
132
135
|
'&-focused': {
|
|
133
136
|
boxShadow: '0px 0px 1px 0px rgba(10, 48, 104, 0.25), 0px 2px 7px 0px rgba(10, 48, 104, 0.05), 0px 2px 5px -2px rgba(10, 48, 104, 0.06)'
|
|
134
137
|
},
|
|
@@ -281,7 +284,7 @@ var genStyle = function(token) {
|
|
|
281
284
|
animationTimingFunction: 'linear',
|
|
282
285
|
animationIterationCount: 'infinite'
|
|
283
286
|
}
|
|
284
|
-
}), _define_property(_obj1, "".concat(token.componentCls, "-before-tools"), {
|
|
287
|
+
})), _define_property(_obj1, "".concat(token.componentCls, "-before-tools"), {
|
|
285
288
|
display: 'flex',
|
|
286
289
|
gap: 8,
|
|
287
290
|
width: '100%',
|
|
@@ -304,11 +307,13 @@ var genStyle = function(token) {
|
|
|
304
307
|
/**
|
|
305
308
|
* Probubble
|
|
306
309
|
* @param prefixCls
|
|
310
|
+
* @param disableHoverAnimation 是否禁用 hover 动画
|
|
307
311
|
* @returns
|
|
308
|
-
*/ export function useStyle(prefixCls) {
|
|
312
|
+
*/ export function useStyle(prefixCls, disableHoverAnimation) {
|
|
309
313
|
return useEditorStyleRegister('MarkdownInputField', function(token) {
|
|
310
314
|
var proChatToken = _object_spread_props(_object_spread({}, token), {
|
|
311
|
-
componentCls: ".".concat(prefixCls)
|
|
315
|
+
componentCls: ".".concat(prefixCls),
|
|
316
|
+
disableHoverAnimation: disableHoverAnimation
|
|
312
317
|
});
|
|
313
318
|
return [
|
|
314
319
|
resetComponent(proChatToken),
|
|
@@ -421,4 +421,14 @@ export type MarkdownInputFieldProps = {
|
|
|
421
421
|
* @description 自定义发送按钮的样式和行为
|
|
422
422
|
*/
|
|
423
423
|
sendButtonProps?: SendButtonCustomizationProps;
|
|
424
|
+
/**
|
|
425
|
+
* 是否禁用 hover 动画
|
|
426
|
+
* @description 控制是否在鼠标悬停时显示阴影动画效果
|
|
427
|
+
* @default false
|
|
428
|
+
* @example
|
|
429
|
+
* ```tsx
|
|
430
|
+
* <MarkdownInputField disableHoverAnimation={true} />
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
disableHoverAnimation?: boolean;
|
|
424
434
|
};
|
|
@@ -183,7 +183,7 @@ var BarChart = function(param) {
|
|
|
183
183
|
// 从数据中提取唯一的类别作为筛选选项
|
|
184
184
|
var categories = useMemo(function() {
|
|
185
185
|
var uniqueCategories = _to_consumable_array(new Set(safeData.map(function(item) {
|
|
186
|
-
return item.category;
|
|
186
|
+
return item === null || item === void 0 ? void 0 : item.category;
|
|
187
187
|
}))).filter(Boolean);
|
|
188
188
|
return uniqueCategories;
|
|
189
189
|
}, [
|
|
@@ -192,7 +192,7 @@ var BarChart = function(param) {
|
|
|
192
192
|
// 从数据中提取 filterLabel,过滤掉 undefined 值
|
|
193
193
|
var validFilterLabels = useMemo(function() {
|
|
194
194
|
return safeData.map(function(item) {
|
|
195
|
-
return item.filterLabel;
|
|
195
|
+
return item === null || item === void 0 ? void 0 : item.filterLabel;
|
|
196
196
|
}).filter(function(filterLabel) {
|
|
197
197
|
return filterLabel !== undefined;
|
|
198
198
|
});
|
|
@@ -225,9 +225,9 @@ var BarChart = function(param) {
|
|
|
225
225
|
var withFilterLabel = !filterLabels || !selectedFilterLabel ? base : base.filter(function(item) {
|
|
226
226
|
return item.filterLabel === selectedFilterLabel;
|
|
227
227
|
});
|
|
228
|
-
// 最终统一过滤掉 x 为空(null/undefined
|
|
228
|
+
// 最终统一过滤掉 x 为空(null/undefined/空字符串)的数据,避免后续 toString 报错
|
|
229
229
|
return withFilterLabel.filter(function(item) {
|
|
230
|
-
return item.x !== null && item.x !== undefined;
|
|
230
|
+
return item.x !== null && item.x !== undefined && item.x !== '' && String(item.x).trim() !== '';
|
|
231
231
|
});
|
|
232
232
|
}, [
|
|
233
233
|
safeData,
|
|
@@ -250,7 +250,7 @@ var BarChart = function(param) {
|
|
|
250
250
|
var uniqueValues = _to_consumable_array(new Set(filteredData.map(function(item) {
|
|
251
251
|
return item.x;
|
|
252
252
|
}).filter(function(x) {
|
|
253
|
-
return x !== null && x !== undefined;
|
|
253
|
+
return x !== null && x !== undefined && x !== '' && String(x).trim() !== '';
|
|
254
254
|
})));
|
|
255
255
|
return uniqueValues;
|
|
256
256
|
}
|
|
@@ -518,12 +518,17 @@ var BarChart = function(param) {
|
|
|
518
518
|
var calculateLabelWidth = function(text) {
|
|
519
519
|
var fontSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 11;
|
|
520
520
|
// 创建临时canvas来测量文本宽度
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
521
|
+
try {
|
|
522
|
+
var canvas = document.createElement('canvas');
|
|
523
|
+
var context = canvas.getContext('2d');
|
|
524
|
+
if (!context) return text.length * fontSize * 0.6; // 备用估算
|
|
525
|
+
context.font = "".concat(fontSize, "px Arial, sans-serif");
|
|
526
|
+
var metrics = context.measureText(text);
|
|
527
|
+
return metrics.width;
|
|
528
|
+
} catch (e) {
|
|
529
|
+
// 在测试环境或无法使用 canvas 时使用备用估算
|
|
530
|
+
return text.length * fontSize * 0.6;
|
|
531
|
+
}
|
|
527
532
|
};
|
|
528
533
|
// 计算所需的最大标签宽度
|
|
529
534
|
var calculateMaxLabelWidth = useMemo(function() {
|
|
@@ -219,7 +219,8 @@ var LineChart = function(_param) {
|
|
|
219
219
|
}, [
|
|
220
220
|
filteredData,
|
|
221
221
|
types,
|
|
222
|
-
xValues
|
|
222
|
+
xValues,
|
|
223
|
+
color
|
|
223
224
|
]);
|
|
224
225
|
var options = {
|
|
225
226
|
responsive: true,
|
|
@@ -388,7 +389,7 @@ var LineChart = function(_param) {
|
|
|
388
389
|
}, config), {
|
|
389
390
|
theme: theme
|
|
390
391
|
}));
|
|
391
|
-
})), /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
|
|
392
|
+
})), !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
|
|
392
393
|
filterOptions: filterOptions,
|
|
393
394
|
selectedFilter: selectedFilter,
|
|
394
395
|
onFilterChange: setSelectedFilter
|
|
@@ -231,9 +231,13 @@ var intl = new Intl.NumberFormat('en-US', {
|
|
|
231
231
|
*
|
|
232
232
|
* @since 1.0.0
|
|
233
233
|
*/ export var extractAndSortXValues = function(data) {
|
|
234
|
-
// 提取所有 x
|
|
234
|
+
// 提取所有 x 值并归一化,同时过滤掉空值(null/undefined/空字符串)
|
|
235
235
|
var normalizedValues = data.map(function(item) {
|
|
236
|
-
return
|
|
236
|
+
return item.x;
|
|
237
|
+
}).filter(function(x) {
|
|
238
|
+
return x !== null && x !== undefined && x !== '' && String(x).trim() !== '';
|
|
239
|
+
}).map(function(x) {
|
|
240
|
+
return normalizeXValue(x);
|
|
237
241
|
});
|
|
238
242
|
// 去重并排序
|
|
239
243
|
var uniqueValues = _to_consumable_array(new Set(normalizedValues));
|
|
@@ -464,35 +468,45 @@ var intl = new Intl.NumberFormat('en-US', {
|
|
|
464
468
|
* ```
|
|
465
469
|
*
|
|
466
470
|
* @since 1.0.0
|
|
467
|
-
*/ export var resolveCssVariable = function(
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
//
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
471
|
+
*/ export var resolveCssVariable = function() {
|
|
472
|
+
var cssVariableCache = new Map();
|
|
473
|
+
return function(cssVar) {
|
|
474
|
+
// 如果不是 CSS 变量,直接返回
|
|
475
|
+
if (!cssVar.trim().startsWith('var(')) {
|
|
476
|
+
return cssVar;
|
|
477
|
+
}
|
|
478
|
+
if (cssVariableCache.has(cssVar)) {
|
|
479
|
+
return cssVariableCache.get(cssVar);
|
|
480
|
+
}
|
|
481
|
+
// 提取变量名,如 'var(--color-blue)' => '--color-blue'
|
|
482
|
+
var match = cssVar.match(/var\((--[^)]+)\)/);
|
|
483
|
+
if (!match) {
|
|
484
|
+
// 无法匹配也缓存,避免重复解析
|
|
485
|
+
cssVariableCache.set(cssVar, cssVar);
|
|
486
|
+
return cssVar;
|
|
487
|
+
}
|
|
488
|
+
var resolvedColor = cssVar;
|
|
489
|
+
// 从 DOM 中获取计算后的样式值
|
|
490
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
491
|
+
try {
|
|
492
|
+
// 创建临时元素来获取计算后的颜色值
|
|
493
|
+
var tempEl = document.createElement('div');
|
|
494
|
+
tempEl.style.color = cssVar;
|
|
495
|
+
document.body.appendChild(tempEl);
|
|
496
|
+
var computedColor = window.getComputedStyle(tempEl).color;
|
|
497
|
+
document.body.removeChild(tempEl);
|
|
498
|
+
// 如果解析成功,将 rgb/rgba 转换为十六进制
|
|
499
|
+
if (computedColor && computedColor !== cssVar) {
|
|
500
|
+
resolvedColor = rgbToHex(computedColor);
|
|
501
|
+
}
|
|
502
|
+
} catch (e) {
|
|
503
|
+
console.warn("Failed to resolve CSS variable: ".concat(cssVar), e);
|
|
489
504
|
}
|
|
490
|
-
} catch (e) {
|
|
491
|
-
console.warn("Failed to resolve CSS variable: ".concat(cssVar), e);
|
|
492
505
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
};
|
|
506
|
+
cssVariableCache.set(cssVar, resolvedColor);
|
|
507
|
+
return resolvedColor;
|
|
508
|
+
};
|
|
509
|
+
}();
|
|
496
510
|
/**
|
|
497
511
|
* 将十六进制颜色或CSS变量转换为带透明度的 RGBA 字符串
|
|
498
512
|
*
|
|
@@ -76,7 +76,7 @@ import { LoadImage } from "./LoadImage";
|
|
|
76
76
|
* />
|
|
77
77
|
* ```
|
|
78
78
|
*/ export var CodeToolbar = function(props) {
|
|
79
|
-
var _editorProps_codeProps, _editorProps_codeProps1, _element_language, _element_language1, _i18n_locale, _i18n_locale1;
|
|
79
|
+
var _editorProps_codeProps, _editorProps_codeProps1, _element_language, _element_language1, _i18n_locale, _i18n_locale1, _i18n_locale2, _i18n_locale3;
|
|
80
80
|
// 获取国际化上下文
|
|
81
81
|
var i18n = useContext(I18nContext);
|
|
82
82
|
// 获取编辑器配置
|
|
@@ -187,14 +187,14 @@ import { LoadImage } from "./LoadImage";
|
|
|
187
187
|
return onViewModeToggle === null || onViewModeToggle === void 0 ? void 0 : onViewModeToggle(value);
|
|
188
188
|
}
|
|
189
189
|
}) : null, /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
190
|
-
title:
|
|
190
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.theme) || '主题',
|
|
191
191
|
theme: theme === 'chaos' ? 'dark' : 'light',
|
|
192
192
|
onClick: function() {
|
|
193
193
|
setTheme(theme === 'github' ? 'chaos' : 'github');
|
|
194
194
|
}
|
|
195
195
|
}, /*#__PURE__*/ React.createElement(Moon, null)), /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
196
196
|
theme: theme === 'chaos' ? 'dark' : 'light',
|
|
197
|
-
title: (i18n === null || i18n === void 0 ? void 0 : (
|
|
197
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale2 = i18n.locale) === null || _i18n_locale2 === void 0 ? void 0 : _i18n_locale2.copy) || '复制',
|
|
198
198
|
style: {
|
|
199
199
|
fontSize: '1em',
|
|
200
200
|
lineHeight: '1.75em',
|
|
@@ -214,7 +214,7 @@ import { LoadImage } from "./LoadImage";
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
}, /*#__PURE__*/ React.createElement(Copy, null)), /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
217
|
-
title:
|
|
217
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale3 = i18n.locale) === null || _i18n_locale3 === void 0 ? void 0 : _i18n_locale3.expandCollapse) || '展开/收起',
|
|
218
218
|
theme: theme === 'chaos' ? 'dark' : 'light',
|
|
219
219
|
onClick: function() {
|
|
220
220
|
onExpandToggle === null || onExpandToggle === void 0 ? void 0 : onExpandToggle();
|
|
@@ -57,7 +57,7 @@ var genStyle = function(token) {
|
|
|
57
57
|
return _define_property({}, token.componentCls, {
|
|
58
58
|
position: 'relative',
|
|
59
59
|
cursor: 'pointer',
|
|
60
|
-
borderRadius: '
|
|
60
|
+
borderRadius: 'var(--radius-card-base)',
|
|
61
61
|
boxSizing: 'border-box',
|
|
62
62
|
border: 'var(--color-gray-border-light)',
|
|
63
63
|
boxShadow: 'var(--shadow-border-base)',
|
|
@@ -128,16 +128,17 @@ var genStyle = function(token) {
|
|
|
128
128
|
width: '100%',
|
|
129
129
|
display: 'flex',
|
|
130
130
|
alignItems: 'center',
|
|
131
|
-
gap: '
|
|
131
|
+
gap: '4px',
|
|
132
132
|
zIndex: 1
|
|
133
133
|
},
|
|
134
134
|
'&-header': {
|
|
135
135
|
height: 24,
|
|
136
136
|
display: 'flex',
|
|
137
137
|
alignItems: 'center',
|
|
138
|
-
gap:
|
|
138
|
+
gap: 4,
|
|
139
139
|
flex: 1,
|
|
140
140
|
justifyContent: 'space-between',
|
|
141
|
+
paddingRight: 4,
|
|
141
142
|
'&-light': {
|
|
142
143
|
gap: 4
|
|
143
144
|
}
|
package/dist/typing.d.ts
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
-
declare module '*.svg'
|
|
2
|
-
|
|
1
|
+
declare module '*.svg' {
|
|
2
|
+
const content: string;
|
|
3
|
+
export default content;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module '*.png' {
|
|
7
|
+
const content: string;
|
|
8
|
+
export default content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module '*.jpg' {
|
|
12
|
+
const content: string;
|
|
13
|
+
export default content;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module '*.jpeg' {
|
|
17
|
+
const content: string;
|
|
18
|
+
export default content;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module '*.gif' {
|
|
22
|
+
const content: string;
|
|
23
|
+
export default content;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module '*.webp' {
|
|
27
|
+
const content: string;
|
|
28
|
+
export default content;
|
|
29
|
+
}
|
|
3
30
|
declare module 'direction' {
|
|
4
31
|
function direction(text: string): 'neutral' | 'ltr' | 'rtl';
|
|
5
32
|
export default direction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.5",
|
|
4
4
|
"description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
|
|
5
5
|
"repository": "git@github.com:ant-design/agentic-ui.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,11 +24,15 @@
|
|
|
24
24
|
"prepare": "husky install && dumi setup",
|
|
25
25
|
"prepublishOnly": "father doctor && pnpm run test && pnpm run build",
|
|
26
26
|
"prettier": "prettier --write \"{src,docs,test}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
|
|
27
|
+
"preview": "pnpm dumi preview",
|
|
27
28
|
"report:demo": "node scripts/generateDemoReport.js",
|
|
28
29
|
"start": "pnpm run dev",
|
|
29
30
|
"test": "vitest --run --exclude \"**/e2e/**\"",
|
|
30
31
|
"test:coverage": "vitest --run --exclude \"**/e2e/**\" --coverage",
|
|
31
|
-
"test:e2e": "
|
|
32
|
+
"test:e2e": "playwright test",
|
|
33
|
+
"test:e2e:debug": "playwright test --debug",
|
|
34
|
+
"test:e2e:skip-server": "cross-env SKIP_WEBSERVER=1 playwright test",
|
|
35
|
+
"test:e2e:ui": "playwright test --ui",
|
|
32
36
|
"tsc": "tsc --noEmit"
|
|
33
37
|
},
|
|
34
38
|
"lint-staged": {
|
|
@@ -57,8 +61,10 @@
|
|
|
57
61
|
"@better-scroll/scroll-bar": "^2.5.1",
|
|
58
62
|
"@galacean/effects": "^2.6.5",
|
|
59
63
|
"@juggle/resize-observer": "^3.4.0",
|
|
64
|
+
"@react-three/fiber": "^8.18.0",
|
|
60
65
|
"@schema-element-editor/host-sdk": "^2.1.1",
|
|
61
66
|
"@sofa-design/icons": "^1.6.1",
|
|
67
|
+
"@types/three": "^0.182.0",
|
|
62
68
|
"ace-builds": "^1.43.4",
|
|
63
69
|
"ajv": "^8.17.1",
|
|
64
70
|
"ajv-formats": "^3.0.1",
|
|
@@ -67,7 +73,9 @@
|
|
|
67
73
|
"chart.js": "^4.5.1",
|
|
68
74
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
69
75
|
"classnames": "^2.5.1",
|
|
76
|
+
"clsx": "^2.1.1",
|
|
70
77
|
"copy-to-clipboard": "^3.3.3",
|
|
78
|
+
"cross-env": "^7.0.3",
|
|
71
79
|
"dayjs": "^1.11.19",
|
|
72
80
|
"diacritics": "^1.3.0",
|
|
73
81
|
"direction": "^1.0.4",
|
|
@@ -111,10 +119,14 @@
|
|
|
111
119
|
"slate-hyperscript": "0.100.0",
|
|
112
120
|
"slate-react": "0.120.0",
|
|
113
121
|
"string-width": "^7.2.0",
|
|
122
|
+
"styled-components": "^6.1.19",
|
|
123
|
+
"tailwind-merge": "^3.4.0",
|
|
124
|
+
"three": "^0.182.0",
|
|
114
125
|
"unified": "^11.0.5",
|
|
115
126
|
"unist-util-visit": "^5.0.0"
|
|
116
127
|
},
|
|
117
128
|
"devDependencies": {
|
|
129
|
+
"@playwright/test": "^1.44.0",
|
|
118
130
|
"@swc/core": "^1.3.53",
|
|
119
131
|
"@testing-library/jest-dom": "^6.9.1",
|
|
120
132
|
"@testing-library/react": "^16.3.0",
|
|
@@ -134,6 +146,7 @@
|
|
|
134
146
|
"@types/react-dom": "^18.3.7",
|
|
135
147
|
"@types/react-resizable": "^3.0.8",
|
|
136
148
|
"@types/reveal.js": "^5.2.1",
|
|
149
|
+
"@types/styled-components": "^5.1.36",
|
|
137
150
|
"@types/uuid": "^10.0.0",
|
|
138
151
|
"@umijs/lint": "^4.5.3",
|
|
139
152
|
"@vitejs/plugin-react": "^4.7.0",
|