@ant-design/agentic-ui 2.29.16 → 2.29.17
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/MarkdownEditor/editor/elements/Hr/index.js +1 -0
- package/dist/MarkdownEditor/editor/elements/Schema/ReadonlySchema.js +79 -53
- package/dist/MarkdownEditor/editor/elements/Schema/index.js +19 -1
- package/dist/MarkdownEditor/editor/plugins/elements.js +45 -0
- package/dist/MarkdownEditor/types.d.ts +9 -0
- package/package.json +16 -16
|
@@ -54,6 +54,7 @@ import React from "react";
|
|
|
54
54
|
export var Hr = function(param) {
|
|
55
55
|
var attributes = param.attributes, children = param.children;
|
|
56
56
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
57
|
+
"data-be": "hr",
|
|
57
58
|
contentEditable: false,
|
|
58
59
|
className: 'select-none',
|
|
59
60
|
style: {
|
|
@@ -50,9 +50,10 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
-
import React, { useContext } from "react";
|
|
53
|
+
import React, { useContext, useMemo } from "react";
|
|
54
54
|
import { BubbleConfigContext } from "../../../../Bubble/BubbleConfigProvide";
|
|
55
55
|
import { SchemaRenderer } from "../../../../Schema";
|
|
56
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
56
57
|
import { useEditorStore } from "../../store";
|
|
57
58
|
/**
|
|
58
59
|
* ReadonlySchema 组件 - 只读模式渲染组件
|
|
@@ -84,67 +85,92 @@ import { useEditorStore } from "../../store";
|
|
|
84
85
|
* - 使用 React.memo 优化性能
|
|
85
86
|
* - 保持预览模式的视觉效果
|
|
86
87
|
*/ export var ReadonlySchema = /*#__PURE__*/ React.memo(function(props) {
|
|
88
|
+
var _editorProps_codeProps;
|
|
87
89
|
var node = props.element;
|
|
88
90
|
var editorProps = useEditorStore().editorProps;
|
|
89
91
|
var apaasify = (editorProps === null || editorProps === void 0 ? void 0 : editorProps.apaasify) || (editorProps === null || editorProps === void 0 ? void 0 : editorProps.apassify);
|
|
90
92
|
var bubble = (useContext(BubbleConfigContext) || {}).bubble;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
var defaultDom = useMemo(function() {
|
|
94
|
+
if ((apaasify === null || apaasify === void 0 ? void 0 : apaasify.enable) && apaasify.render) {
|
|
95
|
+
var renderedContent = apaasify.render(props, bubble === null || bubble === void 0 ? void 0 : bubble.originData);
|
|
96
|
+
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, node.attributes), {
|
|
97
|
+
"data-testid": "schema-container",
|
|
98
|
+
contentEditable: false,
|
|
99
|
+
style: {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
flexDirection: 'column',
|
|
102
|
+
userSelect: 'text',
|
|
103
|
+
WebkitUserSelect: 'text'
|
|
104
|
+
}
|
|
105
|
+
}), renderedContent, /*#__PURE__*/ React.createElement("div", {
|
|
106
|
+
"data-testid": "schema-hidden-json",
|
|
107
|
+
style: {
|
|
108
|
+
height: 1,
|
|
109
|
+
opacity: 0,
|
|
110
|
+
userSelect: 'none',
|
|
111
|
+
pointerEvents: 'none',
|
|
112
|
+
overflow: 'hidden'
|
|
113
|
+
}
|
|
114
|
+
}, JSON.stringify(props.element.value, null, 2)));
|
|
115
|
+
}
|
|
116
|
+
if (node.language === 'agentar-card') {
|
|
117
|
+
var _props_element_value;
|
|
118
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
119
|
+
"data-testid": "agentar-card-container",
|
|
120
|
+
style: {
|
|
121
|
+
padding: '0.5em'
|
|
122
|
+
},
|
|
123
|
+
"data-agentar-card": true
|
|
124
|
+
}, /*#__PURE__*/ React.createElement(SchemaRenderer, {
|
|
125
|
+
schema: props.element.value,
|
|
126
|
+
values: ((_props_element_value = props.element.value) === null || _props_element_value === void 0 ? void 0 : _props_element_value.initialValues) || {},
|
|
127
|
+
useDefaultValues: false,
|
|
128
|
+
debug: false,
|
|
129
|
+
fallbackContent: null
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
return /*#__PURE__*/ React.createElement("pre", _object_spread_props(_object_spread({}, props.attributes), {
|
|
96
133
|
style: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
134
|
+
background: 'rgb(242, 241, 241)',
|
|
135
|
+
color: 'rgb(27, 27, 27)',
|
|
136
|
+
padding: '1em',
|
|
137
|
+
borderRadius: '0.5em',
|
|
138
|
+
margin: '1em 0',
|
|
139
|
+
fontSize: '0.8em',
|
|
140
|
+
fontFamily: 'monospace',
|
|
141
|
+
lineHeight: '1.5',
|
|
142
|
+
overflowX: 'auto',
|
|
143
|
+
whiteSpace: 'pre-wrap',
|
|
144
|
+
wordBreak: 'break-all',
|
|
145
|
+
wordWrap: 'break-word'
|
|
101
146
|
}
|
|
102
|
-
}),
|
|
103
|
-
"data-testid": "schema-hidden-json",
|
|
147
|
+
}), /*#__PURE__*/ React.createElement("code", null, JSON.stringify(props.element.value, null, 2)), /*#__PURE__*/ React.createElement("div", {
|
|
104
148
|
style: {
|
|
105
|
-
|
|
106
|
-
opacity: 0,
|
|
107
|
-
userSelect: 'none',
|
|
108
|
-
pointerEvents: 'none',
|
|
109
|
-
overflow: 'hidden'
|
|
149
|
+
display: 'none'
|
|
110
150
|
}
|
|
111
|
-
},
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}, /*#__PURE__*/ React.createElement(SchemaRenderer, {
|
|
122
|
-
schema: props.element.value,
|
|
123
|
-
values: ((_props_element_value = props.element.value) === null || _props_element_value === void 0 ? void 0 : _props_element_value.initialValues) || {},
|
|
124
|
-
useDefaultValues: false,
|
|
125
|
-
debug: false,
|
|
126
|
-
fallbackContent: null
|
|
127
|
-
}));
|
|
151
|
+
}, props.children));
|
|
152
|
+
}, [
|
|
153
|
+
node.value,
|
|
154
|
+
node.language,
|
|
155
|
+
bubble,
|
|
156
|
+
apaasify
|
|
157
|
+
]);
|
|
158
|
+
var customRender = editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.render;
|
|
159
|
+
if (!customRender) {
|
|
160
|
+
return defaultDom;
|
|
128
161
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
borderRadius: '0.5em',
|
|
135
|
-
margin: '1em 0',
|
|
136
|
-
fontSize: '0.8em',
|
|
137
|
-
fontFamily: 'monospace',
|
|
138
|
-
lineHeight: '1.5',
|
|
139
|
-
overflowX: 'auto',
|
|
140
|
-
whiteSpace: 'pre-wrap',
|
|
141
|
-
wordBreak: 'break-all',
|
|
142
|
-
wordWrap: 'break-word'
|
|
143
|
-
}
|
|
144
|
-
}), /*#__PURE__*/ React.createElement("code", null, JSON.stringify(props.element.value, null, 2)), /*#__PURE__*/ React.createElement("div", {
|
|
145
|
-
style: {
|
|
146
|
-
display: 'none'
|
|
162
|
+
try {
|
|
163
|
+
var renderContent = customRender(props, defaultDom, editorProps === null || editorProps === void 0 ? void 0 : editorProps.codeProps);
|
|
164
|
+
// 返回 undefined 表示“不覆盖”,回退内部默认渲染
|
|
165
|
+
if (renderContent === undefined) {
|
|
166
|
+
return defaultDom;
|
|
147
167
|
}
|
|
148
|
-
|
|
168
|
+
return renderContent;
|
|
169
|
+
} catch (error) {
|
|
170
|
+
debugInfo('ReadonlySchema - codeProps.render 执行异常,回退默认渲染', {
|
|
171
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || String(error)
|
|
172
|
+
});
|
|
173
|
+
return defaultDom;
|
|
174
|
+
}
|
|
149
175
|
});
|
|
150
176
|
ReadonlySchema.displayName = 'ReadonlySchema';
|
|
@@ -96,6 +96,7 @@ import { useEditorStore } from "../../store";
|
|
|
96
96
|
* 2. AgentAR 卡片渲染
|
|
97
97
|
* 3. 默认 JSON 字符串渲染
|
|
98
98
|
*/ export var Schema = function(props) {
|
|
99
|
+
var _editorProps_codeProps;
|
|
99
100
|
debugInfo('Schema - 渲染 Schema', {
|
|
100
101
|
language: props.element.language,
|
|
101
102
|
valueType: _type_of(props.element.value),
|
|
@@ -105,7 +106,7 @@ import { useEditorStore } from "../../store";
|
|
|
105
106
|
var editorProps = useEditorStore().editorProps;
|
|
106
107
|
var apaasify = (editorProps === null || editorProps === void 0 ? void 0 : editorProps.apaasify) || (editorProps === null || editorProps === void 0 ? void 0 : editorProps.apassify);
|
|
107
108
|
var bubble = (useContext(BubbleConfigContext) || {}).bubble;
|
|
108
|
-
|
|
109
|
+
var defaultDom = useMemo(function() {
|
|
109
110
|
if ((apaasify === null || apaasify === void 0 ? void 0 : apaasify.enable) && apaasify.render) {
|
|
110
111
|
var renderedContent = apaasify.render(props, bubble === null || bubble === void 0 ? void 0 : bubble.originData);
|
|
111
112
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, node.attributes), {
|
|
@@ -185,4 +186,21 @@ import { useEditorStore } from "../../store";
|
|
|
185
186
|
bubble,
|
|
186
187
|
apaasify
|
|
187
188
|
]);
|
|
189
|
+
var customRender = editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.render;
|
|
190
|
+
if (!customRender) {
|
|
191
|
+
return defaultDom;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
var renderContent = customRender(props, defaultDom, editorProps === null || editorProps === void 0 ? void 0 : editorProps.codeProps);
|
|
195
|
+
// 返回 undefined 表示“不覆盖”,回退内部默认渲染
|
|
196
|
+
if (renderContent === undefined) {
|
|
197
|
+
return defaultDom;
|
|
198
|
+
}
|
|
199
|
+
return renderContent;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
debugInfo('Schema - codeProps.render 执行异常,回退默认渲染', {
|
|
202
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || String(error)
|
|
203
|
+
});
|
|
204
|
+
return defaultDom;
|
|
205
|
+
}
|
|
188
206
|
};
|
|
@@ -189,6 +189,26 @@ export var MdElements = {
|
|
|
189
189
|
return true;
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
|
+
codeSpace: {
|
|
193
|
+
matchKey: ' ',
|
|
194
|
+
reg: /^\s*(```|···)([\w#\-+*]{1,30})?\s*$/,
|
|
195
|
+
run: function(param) {
|
|
196
|
+
var editor = param.editor, path = param.path, match = param.match;
|
|
197
|
+
var lang = match[2];
|
|
198
|
+
Transforms.delete(editor, {
|
|
199
|
+
at: path
|
|
200
|
+
});
|
|
201
|
+
Transforms.insertNodes(editor, {
|
|
202
|
+
type: 'code',
|
|
203
|
+
language: lang,
|
|
204
|
+
value: ''
|
|
205
|
+
}, {
|
|
206
|
+
at: path,
|
|
207
|
+
select: true
|
|
208
|
+
});
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
},
|
|
192
212
|
head: {
|
|
193
213
|
matchKey: ' ',
|
|
194
214
|
checkAllow: function(ctx) {
|
|
@@ -388,6 +408,31 @@ export var MdElements = {
|
|
|
388
408
|
return true;
|
|
389
409
|
}
|
|
390
410
|
},
|
|
411
|
+
hrSpace: {
|
|
412
|
+
matchKey: ' ',
|
|
413
|
+
reg: /^\s*(\*\*\*|___|---)\s*/,
|
|
414
|
+
checkAllow: function(ctx) {
|
|
415
|
+
var _ctx_node_, _ctx_node;
|
|
416
|
+
return ((_ctx_node = ctx.node) === null || _ctx_node === void 0 ? void 0 : (_ctx_node_ = _ctx_node[0]) === null || _ctx_node_ === void 0 ? void 0 : _ctx_node_.type) === 'paragraph' && ctx.node[1][0] !== 0;
|
|
417
|
+
},
|
|
418
|
+
run: function(param) {
|
|
419
|
+
var editor = param.editor, path = param.path;
|
|
420
|
+
Transforms.delete(editor, {
|
|
421
|
+
at: path
|
|
422
|
+
});
|
|
423
|
+
Transforms.insertNodes(editor, {
|
|
424
|
+
type: 'hr',
|
|
425
|
+
children: [
|
|
426
|
+
{
|
|
427
|
+
text: ''
|
|
428
|
+
}
|
|
429
|
+
]
|
|
430
|
+
}, {
|
|
431
|
+
at: path
|
|
432
|
+
});
|
|
433
|
+
insertAfter(editor, path);
|
|
434
|
+
}
|
|
435
|
+
},
|
|
391
436
|
frontmatter: {
|
|
392
437
|
reg: /^\s*---\s*/,
|
|
393
438
|
checkAllow: function(ctx) {
|
|
@@ -202,6 +202,15 @@ export type MarkdownEditorProps = {
|
|
|
202
202
|
* @property {boolean} [wrap] - 是否自动换行,默认 true
|
|
203
203
|
*/
|
|
204
204
|
codeProps?: {
|
|
205
|
+
render?: (props: CustomLeaf<Record<string, any>> & {
|
|
206
|
+
children: React.ReactNode;
|
|
207
|
+
}, defaultDom: React.ReactNode, codeProps?: MarkdownEditorProps['codeProps']) => React.ReactNode;
|
|
208
|
+
/**
|
|
209
|
+
* 自定义节点渲染函数
|
|
210
|
+
*
|
|
211
|
+
* 约定:当 `render` 返回 `undefined` 时,表示“不覆盖默认渲染”,组件会回退到内部默认的卡片/渲染逻辑;
|
|
212
|
+
* 若需要“不渲染任何内容”,请显式返回 `null`。
|
|
213
|
+
*/
|
|
205
214
|
Languages?: string[];
|
|
206
215
|
hideToolBar?: boolean;
|
|
207
216
|
alwaysExpandedDeepThink?: boolean;
|
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.17",
|
|
4
4
|
"description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
|
|
5
5
|
"repository": "git@github.com:ant-design/agentic-ui.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"@better-scroll/mouse-wheel": "^2.5.1",
|
|
62
62
|
"@better-scroll/observe-dom": "^2.5.1",
|
|
63
63
|
"@better-scroll/scroll-bar": "^2.5.1",
|
|
64
|
-
"@galacean/effects": "^2.8.
|
|
64
|
+
"@galacean/effects": "^2.8.6",
|
|
65
65
|
"@juggle/resize-observer": "^3.4.0",
|
|
66
66
|
"@react-three/fiber": "^8.18.0",
|
|
67
67
|
"@schema-element-editor/host-sdk": "^2.2.1",
|
|
68
68
|
"@sofa-design/icons": "^1.6.2",
|
|
69
69
|
"@types/three": "^0.182.0",
|
|
70
|
-
"ace-builds": "^1.43.
|
|
70
|
+
"ace-builds": "^1.43.6",
|
|
71
71
|
"ajv": "^8.17.1",
|
|
72
72
|
"ajv-formats": "^3.0.1",
|
|
73
73
|
"antd": "^5.29.3",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"framer-motion": "^11.18.2",
|
|
87
87
|
"is-hotkey": "^0.2.0",
|
|
88
88
|
"json5": "^2.2.3",
|
|
89
|
-
"katex": "^0.16.
|
|
90
|
-
"lodash": "^4.17.
|
|
91
|
-
"lodash-es": "^4.17.
|
|
89
|
+
"katex": "^0.16.28",
|
|
90
|
+
"lodash": "^4.17.23",
|
|
91
|
+
"lodash-es": "^4.17.23",
|
|
92
92
|
"lottie-react": "^2.4.1",
|
|
93
93
|
"mermaid": "^11.12.2",
|
|
94
94
|
"mustache": "^4.2.0",
|
|
@@ -121,18 +121,18 @@
|
|
|
121
121
|
"slate-hyperscript": "0.100.0",
|
|
122
122
|
"slate-react": "0.120.0",
|
|
123
123
|
"string-width": "^7.2.0",
|
|
124
|
-
"styled-components": "^6.3.
|
|
124
|
+
"styled-components": "^6.3.8",
|
|
125
125
|
"tailwind-merge": "^3.4.0",
|
|
126
126
|
"three": "^0.182.0",
|
|
127
127
|
"unified": "^11.0.5",
|
|
128
|
-
"unist-util-visit": "^5.
|
|
128
|
+
"unist-util-visit": "^5.1.0"
|
|
129
129
|
},
|
|
130
130
|
"devDependencies": {
|
|
131
131
|
"@mlc-ai/web-llm": "^0.2.80",
|
|
132
|
-
"@playwright/test": "^1.
|
|
133
|
-
"@swc/core": "^1.15.
|
|
132
|
+
"@playwright/test": "^1.58.0",
|
|
133
|
+
"@swc/core": "^1.15.10",
|
|
134
134
|
"@testing-library/jest-dom": "^6.9.1",
|
|
135
|
-
"@testing-library/react": "^16.3.
|
|
135
|
+
"@testing-library/react": "^16.3.2",
|
|
136
136
|
"@testing-library/user-event": "^14.6.1",
|
|
137
137
|
"@types/classnames": "^2.3.4",
|
|
138
138
|
"@types/diacritics": "^1.3.3",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"@types/reveal.js": "^5.2.2",
|
|
152
152
|
"@types/styled-components": "^5.1.36",
|
|
153
153
|
"@types/uuid": "^10.0.0",
|
|
154
|
-
"@umijs/lint": "^4.6.
|
|
154
|
+
"@umijs/lint": "^4.6.25",
|
|
155
155
|
"@vitejs/plugin-react": "^4.7.0",
|
|
156
156
|
"@vitest/coverage-istanbul": "^2.1.9",
|
|
157
157
|
"@vitest/ui": "2.1.9",
|
|
@@ -166,14 +166,14 @@
|
|
|
166
166
|
"lint-staged": "^13.3.0",
|
|
167
167
|
"mockdate": "^3.0.5",
|
|
168
168
|
"nwsapi": "2.2.13",
|
|
169
|
-
"playwright": "^1.
|
|
169
|
+
"playwright": "^1.58.0",
|
|
170
170
|
"postcss": "^8.5.6",
|
|
171
|
-
"prettier": "^3.8.
|
|
171
|
+
"prettier": "^3.8.1",
|
|
172
172
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
173
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
173
|
+
"prettier-plugin-packagejson": "^2.5.22",
|
|
174
174
|
"react": "^18.3.1",
|
|
175
175
|
"react-dom": "^18.3.1",
|
|
176
|
-
"recharts": "^3.
|
|
176
|
+
"recharts": "^3.7.0",
|
|
177
177
|
"sast": "^0.8.1",
|
|
178
178
|
"stylelint": "^14.16.1",
|
|
179
179
|
"typescript": "^5.9.3",
|