@ant-design/agentic-ui 2.11.1 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Bubble/MessagesContent/BubbleExtra.js +7 -1
- package/dist/MarkdownEditor/editor/types/Table.d.ts +1 -0
- package/dist/MarkdownEditor/editor/utils/ace.d.ts +22 -105
- package/dist/MarkdownEditor/editor/utils/ace.js +328 -106
- package/dist/MarkdownEditor/types.d.ts +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.d.ts +2 -4
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +8 -61
- package/dist/MarkdownInputField/AttachmentButton/index.d.ts +1 -1
- package/dist/MarkdownInputField/AttachmentButton/index.js +7 -19
- package/dist/MarkdownInputField/FileUploadManager/index.d.ts +1 -1
- package/dist/MarkdownInputField/FileUploadManager/index.js +137 -138
- package/dist/MarkdownInputField/MarkdownInputField.d.ts +32 -0
- package/dist/MarkdownInputField/MarkdownInputField.js +26 -8
- package/dist/MarkdownInputField/SendActions/index.d.ts +1 -1
- package/dist/Plugins/chart/ChartRender.js +75 -13
- package/dist/Plugins/chart/LineChart/index.js +10 -4
- package/dist/Plugins/chart/index.js +17 -5
- package/dist/Plugins/chart/utils.d.ts +40 -0
- package/dist/Plugins/chart/utils.js +116 -0
- package/dist/Plugins/code/CodeUI/Katex/Katex.d.ts +0 -1
- package/dist/Plugins/code/CodeUI/Katex/Katex.js +182 -6
- package/dist/Plugins/code/components/AceEditor.d.ts +4 -6
- package/dist/Plugins/code/components/AceEditor.js +362 -40
- package/dist/Plugins/code/loadAceEditor.d.ts +26 -0
- package/dist/Plugins/code/loadAceEditor.js +266 -0
- package/dist/Plugins/katex/InlineKatex.d.ts +0 -1
- package/dist/Plugins/katex/InlineKatex.js +183 -7
- package/dist/Plugins/katex/Katex.d.ts +0 -1
- package/dist/Plugins/katex/Katex.js +184 -6
- package/dist/Plugins/katex/loadKatex.d.ts +18 -0
- package/dist/Plugins/katex/loadKatex.js +181 -0
- package/dist/Plugins/mermaid/Mermaid.js +315 -113
- package/dist/Schema/SchemaEditor/AceEditorWrapper.d.ts +1 -1
- package/dist/Schema/SchemaEditor/AceEditorWrapper.js +342 -53
- package/dist/Utils/loadCSS.d.ts +31 -0
- package/dist/Utils/loadCSS.js +264 -0
- package/package.json +1 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CSS 异步加载工具
|
|
3
|
+
*
|
|
4
|
+
* 提供动态加载 CSS 文件的功能,支持按需加载和缓存
|
|
5
|
+
*/ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
6
|
+
try {
|
|
7
|
+
var info = gen[key](arg);
|
|
8
|
+
var value = info.value;
|
|
9
|
+
} catch (error) {
|
|
10
|
+
reject(error);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (info.done) {
|
|
14
|
+
resolve(value);
|
|
15
|
+
} else {
|
|
16
|
+
Promise.resolve(value).then(_next, _throw);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function _async_to_generator(fn) {
|
|
20
|
+
return function() {
|
|
21
|
+
var self = this, args = arguments;
|
|
22
|
+
return new Promise(function(resolve, reject) {
|
|
23
|
+
var gen = fn.apply(self, args);
|
|
24
|
+
function _next(value) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
26
|
+
}
|
|
27
|
+
function _throw(err) {
|
|
28
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
29
|
+
}
|
|
30
|
+
_next(undefined);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function _ts_generator(thisArg, body) {
|
|
35
|
+
var f, y, t, g, _ = {
|
|
36
|
+
label: 0,
|
|
37
|
+
sent: function() {
|
|
38
|
+
if (t[0] & 1) throw t[1];
|
|
39
|
+
return t[1];
|
|
40
|
+
},
|
|
41
|
+
trys: [],
|
|
42
|
+
ops: []
|
|
43
|
+
};
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function(v) {
|
|
53
|
+
return step([
|
|
54
|
+
n,
|
|
55
|
+
v
|
|
56
|
+
]);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function step(op) {
|
|
60
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
+
while(_)try {
|
|
62
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
+
if (y = 0, t) op = [
|
|
64
|
+
op[0] & 2,
|
|
65
|
+
t.value
|
|
66
|
+
];
|
|
67
|
+
switch(op[0]){
|
|
68
|
+
case 0:
|
|
69
|
+
case 1:
|
|
70
|
+
t = op;
|
|
71
|
+
break;
|
|
72
|
+
case 4:
|
|
73
|
+
_.label++;
|
|
74
|
+
return {
|
|
75
|
+
value: op[1],
|
|
76
|
+
done: false
|
|
77
|
+
};
|
|
78
|
+
case 5:
|
|
79
|
+
_.label++;
|
|
80
|
+
y = op[1];
|
|
81
|
+
op = [
|
|
82
|
+
0
|
|
83
|
+
];
|
|
84
|
+
continue;
|
|
85
|
+
case 7:
|
|
86
|
+
op = _.ops.pop();
|
|
87
|
+
_.trys.pop();
|
|
88
|
+
continue;
|
|
89
|
+
default:
|
|
90
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
91
|
+
_ = 0;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
95
|
+
_.label = op[1];
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
99
|
+
_.label = t[1];
|
|
100
|
+
t = op;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
if (t && _.label < t[2]) {
|
|
104
|
+
_.label = t[2];
|
|
105
|
+
_.ops.push(op);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (t[2]) _.ops.pop();
|
|
109
|
+
_.trys.pop();
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
op = body.call(thisArg, _);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
op = [
|
|
115
|
+
6,
|
|
116
|
+
e
|
|
117
|
+
];
|
|
118
|
+
y = 0;
|
|
119
|
+
} finally{
|
|
120
|
+
f = t = 0;
|
|
121
|
+
}
|
|
122
|
+
if (op[0] & 5) throw op[1];
|
|
123
|
+
return {
|
|
124
|
+
value: op[0] ? op[1] : void 0,
|
|
125
|
+
done: true
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
var loadedCSS = new Set();
|
|
130
|
+
/**
|
|
131
|
+
* 异步加载 CSS 文件
|
|
132
|
+
*
|
|
133
|
+
* 对于 webpack 处理的 CSS 文件,应该使用动态 import 函数形式
|
|
134
|
+
* webpack 会自动处理 CSS 的提取和加载
|
|
135
|
+
*
|
|
136
|
+
* @param cssPath - CSS 文件路径(推荐使用函数形式的动态 import)
|
|
137
|
+
* @returns Promise<void> 加载完成的 Promise
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* // 推荐:使用动态 import 加载 CSS 模块(webpack 会自动处理)
|
|
142
|
+
* await loadCSS(() => import('./katex.min.css'));
|
|
143
|
+
*
|
|
144
|
+
* // 不推荐:直接使用字符串路径(仅适用于外部 URL)
|
|
145
|
+
* await loadCSS('https://example.com/style.css');
|
|
146
|
+
* ```
|
|
147
|
+
*/ export var loadCSS = /*#__PURE__*/ function() {
|
|
148
|
+
var _ref = _async_to_generator(function(cssPath) {
|
|
149
|
+
var pathKey, error, existingLink, link;
|
|
150
|
+
return _ts_generator(this, function(_state) {
|
|
151
|
+
switch(_state.label){
|
|
152
|
+
case 0:
|
|
153
|
+
if (typeof window === 'undefined') {
|
|
154
|
+
return [
|
|
155
|
+
2
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
if (!(typeof cssPath === 'function')) return [
|
|
159
|
+
3,
|
|
160
|
+
5
|
|
161
|
+
];
|
|
162
|
+
pathKey = cssPath.toString();
|
|
163
|
+
// 如果已经加载过,直接返回
|
|
164
|
+
if (loadedCSS.has(pathKey)) {
|
|
165
|
+
return [
|
|
166
|
+
2
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
_state.label = 1;
|
|
170
|
+
case 1:
|
|
171
|
+
_state.trys.push([
|
|
172
|
+
1,
|
|
173
|
+
3,
|
|
174
|
+
,
|
|
175
|
+
4
|
|
176
|
+
]);
|
|
177
|
+
// 执行动态 import,webpack 会自动处理 CSS
|
|
178
|
+
return [
|
|
179
|
+
4,
|
|
180
|
+
cssPath()
|
|
181
|
+
];
|
|
182
|
+
case 2:
|
|
183
|
+
_state.sent();
|
|
184
|
+
loadedCSS.add(pathKey);
|
|
185
|
+
return [
|
|
186
|
+
3,
|
|
187
|
+
4
|
|
188
|
+
];
|
|
189
|
+
case 3:
|
|
190
|
+
error = _state.sent();
|
|
191
|
+
console.warn('Failed to load CSS:', error);
|
|
192
|
+
// 即使加载失败也标记为已加载,避免重复尝试
|
|
193
|
+
loadedCSS.add(pathKey);
|
|
194
|
+
return [
|
|
195
|
+
3,
|
|
196
|
+
4
|
|
197
|
+
];
|
|
198
|
+
case 4:
|
|
199
|
+
return [
|
|
200
|
+
2
|
|
201
|
+
];
|
|
202
|
+
case 5:
|
|
203
|
+
// 处理字符串路径(仅适用于外部 URL)
|
|
204
|
+
// 如果已经加载过,直接返回
|
|
205
|
+
if (loadedCSS.has(cssPath)) {
|
|
206
|
+
return [
|
|
207
|
+
2
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
// 检查是否已经存在该 CSS 链接
|
|
211
|
+
existingLink = document.querySelector('link[href*="'.concat(cssPath, '"]'));
|
|
212
|
+
if (existingLink) {
|
|
213
|
+
loadedCSS.add(cssPath);
|
|
214
|
+
return [
|
|
215
|
+
2
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
// 创建 link 元素(仅用于外部 URL)
|
|
219
|
+
link = document.createElement('link');
|
|
220
|
+
link.rel = 'stylesheet';
|
|
221
|
+
link.type = 'text/css';
|
|
222
|
+
link.href = cssPath;
|
|
223
|
+
return [
|
|
224
|
+
2,
|
|
225
|
+
new Promise(function(resolve) {
|
|
226
|
+
link.onload = function() {
|
|
227
|
+
loadedCSS.add(cssPath);
|
|
228
|
+
resolve();
|
|
229
|
+
};
|
|
230
|
+
link.onerror = function() {
|
|
231
|
+
console.warn("Failed to load CSS: ".concat(cssPath));
|
|
232
|
+
// 即使加载失败也标记为已加载,避免重复尝试
|
|
233
|
+
loadedCSS.add(cssPath);
|
|
234
|
+
resolve(); // 不 reject,避免阻塞
|
|
235
|
+
};
|
|
236
|
+
// 添加到 head
|
|
237
|
+
document.head.appendChild(link);
|
|
238
|
+
})
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
return function loadCSS(cssPath) {
|
|
244
|
+
return _ref.apply(this, arguments);
|
|
245
|
+
};
|
|
246
|
+
}();
|
|
247
|
+
/**
|
|
248
|
+
* 预加载 CSS 文件
|
|
249
|
+
* 使用低优先级加载,不阻塞当前执行
|
|
250
|
+
*
|
|
251
|
+
* @param cssPath - CSS 文件路径
|
|
252
|
+
*/ export var preloadCSS = function(cssPath) {
|
|
253
|
+
if (typeof window === 'undefined') {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
// 如果已经加载过,直接返回
|
|
257
|
+
if (typeof cssPath === 'string' && loadedCSS.has(cssPath)) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// 触发加载但不等待结果
|
|
261
|
+
loadCSS(cssPath).catch(function() {
|
|
262
|
+
// 静默处理错误,预加载失败不影响后续使用
|
|
263
|
+
});
|
|
264
|
+
};
|