@ant-design/agentic-ui 2.14.1 → 2.16.1

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 (103) hide show
  1. package/dist/Bubble/BubbleBeforeNode.js +9 -9
  2. package/dist/Bubble/List/PureBubbleList.js +1 -1
  3. package/dist/Bubble/MessagesContent/EXCEPTION.js +1 -1
  4. package/dist/ChatLayout/style.js +16 -17
  5. package/dist/Constants/mobile.d.ts +3 -0
  6. package/dist/Constants/mobile.js +7 -0
  7. package/dist/Hooks/useLanguage.d.ts +2 -0
  8. package/dist/I18n/locales.d.ts +2 -0
  9. package/dist/I18n/locales.js +4 -0
  10. package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
  11. package/dist/MarkdownEditor/editor/Editor.js +16 -8
  12. package/dist/MarkdownEditor/editor/code.css +2 -2
  13. package/dist/MarkdownEditor/editor/elements/Code.js +11 -6
  14. package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +2 -1
  15. package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +2 -1
  16. package/dist/MarkdownEditor/editor/elements/Head.d.ts +1 -0
  17. package/dist/MarkdownEditor/editor/elements/Head.js +1 -1
  18. package/dist/MarkdownEditor/editor/elements/Image/index.js +19 -7
  19. package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +2 -1
  20. package/dist/MarkdownEditor/editor/elements/LinkCard/style.js +1 -1
  21. package/dist/MarkdownEditor/editor/elements/List/ListItem.js +1 -0
  22. package/dist/MarkdownEditor/editor/elements/List/style.js +2 -2
  23. package/dist/MarkdownEditor/editor/elements/Media.js +22 -10
  24. package/dist/MarkdownEditor/editor/elements/Paragraph.js +2 -1
  25. package/dist/MarkdownEditor/editor/elements/Schema.js +1 -1
  26. package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +16 -4
  27. package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +17 -2
  28. package/dist/MarkdownEditor/editor/elements/Table/Table.js +155 -20
  29. package/dist/MarkdownEditor/editor/elements/Table/Td/style.js +5 -2
  30. package/dist/MarkdownEditor/editor/elements/Table/index.js +0 -2
  31. package/dist/MarkdownEditor/editor/elements/Table/style.js +7 -8
  32. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +5 -3
  33. package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +2 -2
  34. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +100 -1
  35. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +781 -240
  36. package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +8 -19
  37. package/dist/MarkdownEditor/editor/store.js +3 -3
  38. package/dist/MarkdownEditor/editor/style.js +41 -6
  39. package/dist/MarkdownEditor/editor/tools/DragHandle.js +3 -3
  40. package/dist/MarkdownEditor/editor/types/Table.d.ts +1 -0
  41. package/dist/MarkdownEditor/editor/utils/findMatchingClose.d.ts +36 -0
  42. package/dist/MarkdownEditor/editor/utils/findMatchingClose.js +158 -0
  43. package/dist/MarkdownEditor/editor/utils/markdownToHtml.d.ts +41 -2
  44. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +159 -7
  45. package/dist/MarkdownEditor/style.js +8 -2
  46. package/dist/MarkdownEditor/types.d.ts +1 -1
  47. package/dist/MarkdownEditor/utils/exportHtml.js +1 -1
  48. package/dist/MarkdownInputField/MarkdownInputField.d.ts +7 -7
  49. package/dist/MarkdownInputField/MarkdownInputField.js +11 -35
  50. package/dist/MarkdownInputField/SendButton/index.js +17 -3
  51. package/dist/MarkdownInputField/style.js +23 -2
  52. package/dist/Plugins/chart/AreaChart/index.d.ts +12 -0
  53. package/dist/Plugins/chart/AreaChart/index.js +14 -188
  54. package/dist/Plugins/chart/BarChart/index.d.ts +2 -0
  55. package/dist/Plugins/chart/BarChart/index.js +3 -12
  56. package/dist/Plugins/chart/ChartMark/Container.js +5 -2
  57. package/dist/Plugins/chart/ChartRender.d.ts +1 -0
  58. package/dist/Plugins/chart/ChartRender.js +104 -43
  59. package/dist/Plugins/chart/DonutChart/index.js +4 -2
  60. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  61. package/dist/Plugins/chart/FunnelChart/index.d.ts +2 -0
  62. package/dist/Plugins/chart/FunnelChart/index.js +4 -2
  63. package/dist/Plugins/chart/LineChart/index.d.ts +2 -0
  64. package/dist/Plugins/chart/LineChart/index.js +17 -162
  65. package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
  66. package/dist/Plugins/chart/RadarChart/index.js +8 -4
  67. package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
  68. package/dist/Plugins/chart/ScatterChart/index.js +8 -4
  69. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
  70. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundaryExample.js +1 -1
  71. package/dist/Plugins/chart/components/ChartFilter/ChartFilter.d.ts +1 -1
  72. package/dist/Plugins/chart/components/ChartFilter/ChartFilter.js +210 -16
  73. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
  74. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +9 -2
  75. package/dist/Plugins/chart/components/ChartToolBar/style.js +3 -1
  76. package/dist/Plugins/chart/hooks/index.d.ts +10 -0
  77. package/dist/Plugins/chart/hooks/index.js +8 -0
  78. package/dist/Plugins/chart/hooks/useChartDataFilter.d.ts +46 -0
  79. package/dist/Plugins/chart/hooks/useChartDataFilter.js +182 -0
  80. package/dist/Plugins/chart/hooks/useChartStatistics.d.ts +17 -0
  81. package/dist/Plugins/chart/hooks/useChartStatistics.js +25 -0
  82. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +20 -0
  83. package/dist/Plugins/chart/hooks/useChartTheme.js +30 -0
  84. package/dist/Plugins/chart/hooks/useResponsiveSize.d.ts +23 -0
  85. package/dist/Plugins/chart/hooks/useResponsiveSize.js +94 -0
  86. package/dist/Plugins/chart/index.js +94 -10
  87. package/dist/Plugins/chart/utils/registerChart.d.ts +35 -0
  88. package/dist/Plugins/chart/utils/registerChart.js +54 -0
  89. package/dist/Plugins/chart/utils.d.ts +19 -0
  90. package/dist/Plugins/chart/utils.js +27 -0
  91. package/dist/Plugins/code/components/CodeContainer.js +2 -3
  92. package/dist/Plugins/code/components/CodeRenderer.js +53 -2
  93. package/dist/Plugins/code/components/CodeToolbar.js +22 -3
  94. package/dist/Plugins/katex/InlineKatex.js +1 -1
  95. package/dist/Plugins/katex/Katex.js +1 -1
  96. package/dist/Plugins/mermaid/Mermaid.js +66 -66
  97. package/dist/Plugins/mermaid/index.js +1 -1
  98. package/dist/ThoughtChainList/index.js +21 -2
  99. package/dist/ThoughtChainList/style.js +1 -0
  100. package/dist/Utils/loadCSS.js +6 -6
  101. package/dist/WelcomeMessage/index.js +21 -2
  102. package/dist/Workspace/Task/index.js +1 -1
  103. package/package.json +2 -2
@@ -165,7 +165,41 @@ import remarkMath from "remark-math";
165
165
  import remarkParse from "remark-parse";
166
166
  import remarkRehype from "remark-rehype";
167
167
  import { unified } from "unified";
168
+ import { visit } from "unist-util-visit";
168
169
  import { fixStrongWithSpecialChars } from "../parser/remarkParse";
170
+ // HTML 转义相关的正则表达式和工具
171
+ var ESCAPE_TEST_NO_ENCODE = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
172
+ var ESCAPE_TEST = /[&<>"']/;
173
+ var ESCAPE_REPLACE = /[&<>"']/g;
174
+ var ESCAPE_REPLACE_NO_ENCODE = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g;
175
+ var ENDING_NEWLINE = /\n$/;
176
+ var ESCAPE_REPLACEMENTS = {
177
+ '&': '&amp;',
178
+ '<': '&lt;',
179
+ '>': '&gt;',
180
+ '"': '&quot;',
181
+ "'": '&#39;'
182
+ };
183
+ var getEscapeReplacement = function(ch) {
184
+ return ESCAPE_REPLACEMENTS[ch];
185
+ };
186
+ /**
187
+ * HTML 转义函数
188
+ * @param html - 要转义的 HTML 字符串
189
+ * @param encode - 是否编码所有特殊字符(包括 &)
190
+ * @returns 转义后的字符串
191
+ */ export function escapeHtml(html, encode) {
192
+ if (encode) {
193
+ if (ESCAPE_TEST.test(html)) {
194
+ return html.replace(ESCAPE_REPLACE, getEscapeReplacement);
195
+ }
196
+ } else {
197
+ if (ESCAPE_TEST_NO_ENCODE.test(html)) {
198
+ return html.replace(ESCAPE_REPLACE_NO_ENCODE, getEscapeReplacement);
199
+ }
200
+ }
201
+ return html;
202
+ }
169
203
  var INLINE_MATH_WITH_SINGLE_DOLLAR = {
170
204
  singleDollarTextMath: true
171
205
  };
@@ -173,6 +207,90 @@ var FRONTMATTER_LANGUAGES = [
173
207
  'yaml'
174
208
  ];
175
209
  var remarkRehypePlugin = remarkRehype;
210
+ /**
211
+ * 配置链接渲染器,在新标签页打开链接
212
+ */ function rehypeLinkTarget() {
213
+ return function() {
214
+ return function(tree) {
215
+ visit(tree, 'element', function(node) {
216
+ if (node.tagName === 'a' && node.properties) {
217
+ node.properties.target = '_blank';
218
+ node.properties.rel = 'noopener noreferrer';
219
+ }
220
+ });
221
+ };
222
+ };
223
+ }
224
+ /**
225
+ * 配置段落渲染器,支持自定义段落标签
226
+ */ function rehypeParagraphTag() {
227
+ var tagName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'p';
228
+ return function() {
229
+ return function(tree) {
230
+ visit(tree, 'element', function(node) {
231
+ if (node.tagName === 'p') {
232
+ node.tagName = tagName;
233
+ }
234
+ });
235
+ };
236
+ };
237
+ }
238
+ /**
239
+ * 从代码节点中提取原始文本
240
+ */ function getCodeText(node) {
241
+ if (!node.children) return '';
242
+ return node.children.map(function(child) {
243
+ if (child.type === 'text' && 'value' in child) {
244
+ return String(child.value);
245
+ }
246
+ if (child.type === 'element') {
247
+ return getCodeText(child);
248
+ }
249
+ return '';
250
+ }).join('');
251
+ }
252
+ /**
253
+ * 配置代码块渲染器,添加流式状态支持
254
+ */ function rehypeCodeBlock() {
255
+ return function() {
256
+ return function(tree) {
257
+ visit(tree, 'element', function(node) {
258
+ var _node_children;
259
+ if (node.tagName === 'pre' && ((_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children[0])) {
260
+ var codeNode = node.children[0];
261
+ if (codeNode.tagName === 'code' && codeNode.properties) {
262
+ // 检查是否为代码块(而非行内代码)
263
+ // 代码块通常在 pre 标签内,且有 className 包含 language-
264
+ var hasLanguageClass = codeNode.properties.className ? Array.isArray(codeNode.properties.className) ? codeNode.properties.className.some(function(cls) {
265
+ return String(cls).startsWith('language-');
266
+ }) : String(codeNode.properties.className).startsWith('language-') : false;
267
+ // 或者通过检查代码内容长度来判断(代码块通常较长)
268
+ var codeText = getCodeText(codeNode);
269
+ var isBlock = hasLanguageClass || codeText.includes('\n') && codeText.length > 10;
270
+ if (isBlock) {
271
+ // 添加 data-block 属性
272
+ codeNode.properties['data-block'] = 'true';
273
+ // 默认设置为 done,在实际流式场景中可以通过外部传入状态
274
+ // 这里我们检查代码是否看起来完整(有换行且不以换行结尾可能表示未完成)
275
+ var endsWithNewline = codeText.match(ENDING_NEWLINE);
276
+ var streamStatus = endsWithNewline ? 'done' : 'loading';
277
+ // 添加 data-state 属性
278
+ codeNode.properties['data-state'] = streamStatus;
279
+ // 转义代码内容(移除末尾换行后重新添加,确保格式一致)
280
+ if (codeNode.children && codeNode.children.length > 0) {
281
+ var textNode = codeNode.children[0];
282
+ if (textNode.type === 'text' && 'value' in textNode) {
283
+ var code = String(textNode.value).replace(ENDING_NEWLINE, '');
284
+ textNode.value = escapeHtml(code, true) + '\n';
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+ });
291
+ };
292
+ };
293
+ }
176
294
  export var DEFAULT_MARKDOWN_REMARK_PLUGINS = [
177
295
  remarkParse,
178
296
  remarkGfm,
@@ -214,11 +332,24 @@ var resolveRemarkPlugins = function(plugins) {
214
332
  }
215
333
  return plugins;
216
334
  };
217
- var createMarkdownProcessor = function(plugins) {
335
+ var createMarkdownProcessor = function(plugins, config) {
218
336
  var processor = unified();
219
337
  var remarkPlugins = resolveRemarkPlugins(plugins);
220
338
  applyPlugins(processor, remarkPlugins);
221
- processor.use(rehypeRaw).use(rehypeKatex).use(rehypeStringify);
339
+ processor.use(rehypeRaw).use(rehypeKatex);
340
+ // 应用配置选项
341
+ if (config === null || config === void 0 ? void 0 : config.openLinksInNewTab) {
342
+ processor.use(rehypeLinkTarget());
343
+ }
344
+ if ((config === null || config === void 0 ? void 0 : config.paragraphTag) && config.paragraphTag !== 'p') {
345
+ processor.use(rehypeParagraphTag(config.paragraphTag));
346
+ }
347
+ processor.use(rehypeCodeBlock());
348
+ // 用户自定义配置(最后应用,可以覆盖默认配置)
349
+ if (config === null || config === void 0 ? void 0 : config.markedConfig) {
350
+ applyPlugins(processor, config.markedConfig);
351
+ }
352
+ processor.use(rehypeStringify);
222
353
  return processor;
223
354
  };
224
355
  /**
@@ -230,19 +361,31 @@ var createMarkdownProcessor = function(plugins) {
230
361
  * - 前置元数据 (Frontmatter)
231
362
  * - 特殊字符修复
232
363
  * - 原始 HTML 标签
364
+ * - 链接在新标签页打开(可选)
365
+ * - 自定义段落标签(可选)
366
+ * - 代码块流式状态支持
233
367
  *
234
368
  * @param markdown - 要转换的 Markdown 字符串
369
+ * @param plugins - 可选的 unified 插件配置
370
+ * @param config - 可选的渲染配置选项
235
371
  * @returns Promise<string> - 从 Markdown 生成的 HTML 字符串
236
372
  *
237
373
  * @example
238
374
  * ```typescript
239
375
  * const html = await markdownToHtml('# 标题\n\n这是**粗体**文本');
240
376
  * console.log(html); // '<h1>标题</h1><p>这是<strong>粗体</strong>文本</p>'
377
+ *
378
+ * // 使用配置选项
379
+ * const htmlWithConfig = await markdownToHtml(
380
+ * '[链接](https://example.com)',
381
+ * undefined,
382
+ * { openLinksInNewTab: true, paragraphTag: 'div' }
383
+ * );
241
384
  * ```
242
385
  *
243
386
  * @throws {Error} 当转换过程中发生错误时返回空字符串
244
387
  */ export var markdownToHtml = /*#__PURE__*/ function() {
245
- var _ref = _async_to_generator(function(markdown, plugins) {
388
+ var _ref = _async_to_generator(function(markdown, plugins, config) {
246
389
  var htmlContent, error;
247
390
  return _ts_generator(this, function(_state) {
248
391
  switch(_state.label){
@@ -255,7 +398,7 @@ var createMarkdownProcessor = function(plugins) {
255
398
  ]);
256
399
  return [
257
400
  4,
258
- createMarkdownProcessor(plugins).process(markdown)
401
+ createMarkdownProcessor(plugins, config).process(markdown)
259
402
  ];
260
403
  case 1:
261
404
  htmlContent = _state.sent();
@@ -277,7 +420,7 @@ var createMarkdownProcessor = function(plugins) {
277
420
  }
278
421
  });
279
422
  });
280
- return function markdownToHtml(markdown, plugins) {
423
+ return function markdownToHtml(markdown, plugins, config) {
281
424
  return _ref.apply(this, arguments);
282
425
  };
283
426
  }();
@@ -288,12 +431,21 @@ var createMarkdownProcessor = function(plugins) {
288
431
  * 适用于不需要异步处理的场景,但可能会阻塞主线程。
289
432
  *
290
433
  * @param markdown - 要转换的 Markdown 字符串
434
+ * @param plugins - 可选的 unified 插件配置
435
+ * @param config - 可选的渲染配置选项
291
436
  * @returns string - 从 Markdown 生成的 HTML 字符串
292
437
  *
293
438
  * @example
294
439
  * ```typescript
295
440
  * const html = markdownToHtmlSync('## 副标题\n\n- 列表项1\n- 列表项2');
296
441
  * console.log(html); // '<h2>副标题</h2><ul><li>列表项1</li><li>列表项2</li></ul>'
442
+ *
443
+ * // 使用配置选项
444
+ * const htmlWithConfig = markdownToHtmlSync(
445
+ * '[链接](https://example.com)',
446
+ * undefined,
447
+ * { openLinksInNewTab: true }
448
+ * );
297
449
  * ```
298
450
  *
299
451
  * @throws {Error} 当转换过程中发生错误时返回空字符串
@@ -301,9 +453,9 @@ var createMarkdownProcessor = function(plugins) {
301
453
  * @remarks
302
454
  * - 建议在可能的情况下使用异步版本 `markdownToHtml`
303
455
  * - 同步版本可能影响用户界面响应性
304
- */ export var markdownToHtmlSync = function(markdown, plugins) {
456
+ */ export var markdownToHtmlSync = function(markdown, plugins, config) {
305
457
  try {
306
- var file = createMarkdownProcessor(plugins).processSync(markdown);
458
+ var file = createMarkdownProcessor(plugins, config).processSync(markdown);
307
459
  return String(file);
308
460
  } catch (error) {
309
461
  console.error('Error converting markdown to HTML:', error);
@@ -50,6 +50,7 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
+ import { MOBILE_BREAKPOINT } from "../Constants/mobile";
53
54
  import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
54
55
  var genStyle = function(token) {
55
56
  return _define_property({}, token.componentCls, {
@@ -67,7 +68,7 @@ var genStyle = function(token) {
67
68
  scrollbarColor: 'hsl(240 5.9% 90%) transparent',
68
69
  boxSizing: 'border-box'
69
70
  },
70
- 'div.composition div:not(.no-focus).empty:first-child::before': {
71
+ 'div[data-composition] div:not([data-no-focus]).empty:first-child::before': {
71
72
  display: 'none'
72
73
  },
73
74
  '> *': {
@@ -81,7 +82,12 @@ var genStyle = function(token) {
81
82
  },
82
83
  '&-edit-area': {
83
84
  outline: 'none !important'
84
- }
85
+ },
86
+ '&-content': _define_property({
87
+ padding: '4px 20px'
88
+ }, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
89
+ padding: '4px 4px'
90
+ })
85
91
  });
86
92
  };
87
93
  /**
@@ -4,10 +4,10 @@ import React from 'react';
4
4
  import { BaseEditor, Selection } from 'slate';
5
5
  import { HistoryEditor } from 'slate-history';
6
6
  import { ReactEditor, RenderElementProps } from 'slate-react';
7
- import type { MarkdownToHtmlOptions } from './editor/utils/markdownToHtml';
8
7
  import { TagPopupProps } from './editor/elements/TagPopup';
9
8
  import { EditorStore } from './editor/store';
10
9
  import { InsertAutocompleteProps } from './editor/tools/InsertAutocomplete';
10
+ import type { MarkdownToHtmlOptions } from './editor/utils/markdownToHtml';
11
11
  import { CustomLeaf, Elements } from './el';
12
12
  /**
13
13
  * @typedef CommentDataType
@@ -7,7 +7,7 @@
7
7
  * @returns A complete HTML document as a string
8
8
  */ export var generateHtmlDocument = function(content) {
9
9
  var title = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'Markdown Export', styles = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : '';
10
- return '<!DOCTYPE html>\n<html>\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(title, "</title>\n <style>\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n line-height: 1.6;\n padding: 20px;\n max-width: 900px;\n margin: 0 auto;\n color: #333;\n }\n pre {\n background-color: #f6f8fa;\n border-radius: 3px;\n padding: 16px;\n overflow: auto;\n }\n code {\n background-color: rgba(27, 31, 35, 0.05);\n border-radius: 3px;\n padding: 0.2em 0.4em;\n font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n }\n blockquote {\n border-left: 4px solid #ddd;\n padding-left: 16px;\n margin-left: 0;\n color: #666;\n }\n img {\n max-width: 100%;\n }\n table {\n border-collapse: collapse;\n width: 100%;\n margin-bottom: 16px;\n }\n table, th, td {\n border: 1px solid #ddd;\n }\n th, td {\n padding: 8px;\n text-align: left;\n }\n th {\n background-color: #f6f8fa;\n }\n ").concat(styles, "\n </style>\n</head>\n<body>\n ").concat(content, "\n</body>\n</html>");
10
+ return '<!DOCTYPE html>\n<html>\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(title, "</title>\n <style>\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n line-height: 1.6;\n padding: 12px;\n max-width: 900px;\n margin: 0 auto;\n color: #333;\n }\n pre {\n background-color: #f6f8fa;\n border-radius: 3px;\n padding: 16px;\n overflow: auto;\n }\n code {\n background-color: rgba(27, 31, 35, 0.05);\n border-radius: 3px;\n padding: 0.2em 0.4em;\n font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n }\n blockquote {\n border-left: 4px solid #ddd;\n padding-left: 16px;\n margin-left: 0;\n color: #666;\n }\n img {\n max-width: 100%;\n }\n table {\n border-collapse: collapse;\n width: 100%;\n margin-bottom: 16px;\n }\n table, th, td {\n border: 1px solid #ddd;\n }\n th, td {\n padding: 8px;\n text-align: left;\n vertical-align: middle;\n }\n th {\n background-color: #f6f8fa;\n }\n @media screen and (max-width: 768px) {\n th, td {\n padding: 2px;\n }\n }\n ").concat(styles, "\n </style>\n</head>\n<body>\n ").concat(content, "\n</body>\n</html>");
11
11
  };
12
12
  /**
13
13
  * Export HTML content to a file
@@ -14,7 +14,7 @@ import type { CreateRecognizer } from './VoiceInput';
14
14
  * @property {string} [className] - 应用于输入字段的 CSS 类名
15
15
  * @property {boolean} [disabled] - 是否禁用输入字段
16
16
  * @property {boolean} [typing] - 用户是否正在输入的状态标志
17
- * @property {'Enter' | 'Mod+Enter'} [triggerSendKey] - 触发发送操作的键盘快捷键
17
+ * @property {'Enter'} [triggerSendKey] - 触发发送操作的键盘快捷键(Enter 发送,Shift+Enter 换行)
18
18
  * @property {function} [onSend] - 当内容发送时触发的异步回调函数
19
19
  */
20
20
  export type MarkdownInputFieldProps = {
@@ -56,11 +56,11 @@ export type MarkdownInputFieldProps = {
56
56
  typing?: boolean;
57
57
  /**
58
58
  * 触发发送操作的键盘快捷键。
59
- * - 'Enter': 回车键触发发送
60
- * - 'Mod+Enter': 按下 Ctrl/Command + Enter 触发发送
61
- * @example triggerSendKey="Mod+Enter"
59
+ * - 'Enter': 回车键触发发送,Shift+Enter 换行
60
+ * @deprecated 此属性已废弃,现在固定使用 Enter 发送,Shift+Enter 换行
61
+ * @example triggerSendKey="Enter"
62
62
  */
63
- triggerSendKey?: 'Enter' | 'Mod+Enter';
63
+ triggerSendKey?: 'Enter';
64
64
  /**
65
65
  * 当内容发送时触发的异步回调函数。
66
66
  * 返回一个 Promise 对象,当发送成功后 resolve。
@@ -429,7 +429,7 @@ export type MarkdownInputFieldProps = {
429
429
  * @param {(value: string) => void} [props.onChange] - 值变化时的回调
430
430
  * @param {(value: string) => Promise<void>} [props.onSend] - 发送消息的回调
431
431
  * @param {string} [props.placeholder] - 占位符文本
432
- * @param {string} [props.triggerSendKey='Mod+Enter'] - 触发发送的快捷键
432
+ * @param {string} [props.triggerSendKey='Enter'] - 触发发送的快捷键(Enter 发送,Shift+Enter 换行)
433
433
  * @param {boolean} [props.disabled] - 是否禁用
434
434
  * @param {boolean} [props.typing] - 是否正在输入
435
435
  * @param {AttachmentProps} [props.attachment] - 附件配置
@@ -445,7 +445,7 @@ export type MarkdownInputFieldProps = {
445
445
  * onChange={(value) => console.log(value)}
446
446
  * onSend={(value) => Promise.resolve()}
447
447
  * placeholder="请输入Markdown文本..."
448
- * triggerSendKey="Mod+Enter"
448
+ * triggerSendKey="Enter"
449
449
  * />
450
450
  * ```
451
451
  *
@@ -277,7 +277,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
277
277
  * @param {(value: string) => void} [props.onChange] - 值变化时的回调
278
278
  * @param {(value: string) => Promise<void>} [props.onSend] - 发送消息的回调
279
279
  * @param {string} [props.placeholder] - 占位符文本
280
- * @param {string} [props.triggerSendKey='Mod+Enter'] - 触发发送的快捷键
280
+ * @param {string} [props.triggerSendKey='Enter'] - 触发发送的快捷键(Enter 发送,Shift+Enter 换行)
281
281
  * @param {boolean} [props.disabled] - 是否禁用
282
282
  * @param {boolean} [props.typing] - 是否正在输入
283
283
  * @param {AttachmentProps} [props.attachment] - 附件配置
@@ -293,7 +293,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
293
293
  * onChange={(value) => console.log(value)}
294
294
  * onSend={(value) => Promise.resolve()}
295
295
  * placeholder="请输入Markdown文本..."
296
- * triggerSendKey="Mod+Enter"
296
+ * triggerSendKey="Enter"
297
297
  * />
298
298
  * ```
299
299
  *
@@ -638,26 +638,16 @@ import { useVoiceInputManager } from "./VoiceInputManager";
638
638
  // 键盘事件:早返回减少嵌套
639
639
  var handleKeyDown = useRefFunction(function(e) {
640
640
  var _markdownEditorRef_current;
641
- var triggerSendKey = props.triggerSendKey || 'Enter';
642
641
  if (markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.store.inputComposition) return;
643
642
  var isEnter = e.key === 'Enter';
644
643
  var isMod = e.ctrlKey || e.metaKey;
645
- if (triggerSendKey === 'Enter') {
646
- if (!(isEnter && !isMod)) return;
647
- e.stopPropagation();
648
- e.preventDefault();
649
- if (props.onSend) sendMessage();
650
- return;
651
- }
652
- if (triggerSendKey === 'Mod+Enter') {
653
- if (!(isEnter && isMod)) return;
654
- e.stopPropagation();
655
- e.preventDefault();
656
- // 防止重复触发:检查是否已经在加载中
657
- if (props.onSend && !isLoading && !props.disabled && !props.typing) {
658
- sendMessage();
659
- }
660
- }
644
+ var isShift = e.shiftKey;
645
+ // Enter 发送,Shift+Enter 换行
646
+ if (!isEnter || isMod) return;
647
+ if (isShift) return; // Shift+Enter 时让编辑器处理换行
648
+ e.stopPropagation();
649
+ e.preventDefault();
650
+ if (props.onSend) sendMessage();
661
651
  });
662
652
  // 预计算:SendActions 节点,统一渲染,避免重复 JSX
663
653
  var sendActionsNode = /*#__PURE__*/ React.createElement(SendActions, {
@@ -773,8 +763,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
773
763
  },
774
764
  textAreaProps: {
775
765
  enable: true,
776
- placeholder: props.placeholder,
777
- triggerSendKey: props.triggerSendKey || 'Enter'
766
+ placeholder: props.placeholder
778
767
  },
779
768
  tagInputProps: _object_spread({
780
769
  enable: true,
@@ -814,20 +803,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
814
803
  toc: false,
815
804
  pasteConfig: props.pasteConfig
816
805
  }, markdownProps)))), props.toolsRender ? /*#__PURE__*/ React.createElement("div", {
817
- style: {
818
- backgroundColor: '#fff',
819
- display: 'flex',
820
- boxSizing: 'border-box',
821
- borderRadius: 'inherit',
822
- flexDirection: 'row',
823
- alignItems: 'center',
824
- justifyContent: 'space-between',
825
- gap: 8,
826
- width: '100%',
827
- paddingRight: 'var(--padding-3x)',
828
- paddingLeft: 'var(--padding-3x)',
829
- paddingBottom: 'var(--padding-3x)'
830
- }
806
+ className: classNames("".concat(baseCls, "-tools-wrapper"), hashId)
831
807
  }, /*#__PURE__*/ React.createElement("div", {
832
808
  ref: actionsRef,
833
809
  contentEditable: false,
@@ -53,12 +53,13 @@ function _object_without_properties_loose(source, excluded) {
53
53
  }
54
54
  return target;
55
55
  }
56
- import { ConfigProvider } from "antd";
56
+ import { ConfigProvider, Tooltip } from "antd";
57
57
  import classNames from "classnames";
58
58
  import { motion } from "framer-motion";
59
59
  import React, { useContext, useEffect } from "react";
60
60
  import { ErrorBoundary } from "react-error-boundary";
61
61
  import { StopIcon } from "../../AgentRunBar/icons";
62
+ import { I18nContext } from "../../I18n";
62
63
  import { useStyle } from "./style";
63
64
  function SendIcon(props) {
64
65
  var hover = props.hover, typing = props.typing, onInit = props.onInit, rest = _object_without_properties(props, [
@@ -145,14 +146,27 @@ function SendIcon(props) {
145
146
  (_props_onInit = props.onInit) === null || _props_onInit === void 0 ? void 0 : _props_onInit.call(props);
146
147
  }, []);
147
148
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
149
+ var locale = useContext(I18nContext).locale;
148
150
  var baseCls = getPrefixCls('agentic-md-input-field-send-button');
149
151
  var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
150
152
  if (typeof window === 'undefined' || typeof document === 'undefined' || !window.document) {
151
153
  // SSR 环境下不渲染
152
154
  return null;
153
155
  }
156
+ var sendText = (locale === null || locale === void 0 ? void 0 : locale['input.sendButtonTooltip.send']) || '按 Enter 键发送';
157
+ var newlineText = (locale === null || locale === void 0 ? void 0 : locale['input.sendButtonTooltip.newline']) || '按 Shift+Enter 键换行';
158
+ var tooltipTitle = /*#__PURE__*/ React.createElement("div", {
159
+ style: {
160
+ lineHeight: '1.5',
161
+ textAlign: 'left'
162
+ }
163
+ }, /*#__PURE__*/ React.createElement("div", null, sendText), /*#__PURE__*/ React.createElement("div", null, newlineText));
154
164
  var _obj;
155
- return wrapSSR(/*#__PURE__*/ React.createElement("div", {
165
+ return wrapSSR(/*#__PURE__*/ React.createElement(Tooltip, {
166
+ arrow: false,
167
+ title: tooltipTitle,
168
+ mouseEnterDelay: 0.5
169
+ }, /*#__PURE__*/ React.createElement("div", {
156
170
  "data-testid": "send-button",
157
171
  onClick: function() {
158
172
  if (!disabled) {
@@ -176,5 +190,5 @@ function SendIcon(props) {
176
190
  hover: isSendable && !disabled,
177
191
  disabled: disabled,
178
192
  typing: typing
179
- }))));
193
+ })))));
180
194
  };
@@ -51,6 +51,7 @@ function _object_spread_props(target, source) {
51
51
  return target;
52
52
  }
53
53
  import { Keyframes } from "@ant-design/cssinjs";
54
+ import { MOBILE_BREAKPOINT, MOBILE_PADDING } from "../Constants/mobile";
54
55
  import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
55
56
  // MarkdownInputField 样式常量
56
57
  // Glow border effect constants - 辉光边框效果常量
@@ -204,13 +205,15 @@ var genStyle = function(token) {
204
205
  padding: '0 !important'
205
206
  }
206
207
  },
207
- '&-editor-content': {
208
+ '&-editor-content': _define_property({
208
209
  overflowY: 'auto',
209
210
  maxHeight: 'inherit',
210
211
  borderRadius: 'inherit',
211
212
  scrollbarColor: 'var(--color-gray-text-tertiary) transparent',
212
213
  scrollbarWidth: 'thin'
213
- },
214
+ }, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
215
+ padding: "".concat(MOBILE_PADDING, " !important")
216
+ }),
214
217
  '&&-disabled': {
215
218
  backgroundColor: 'rgba(0,0,0,0.04)',
216
219
  cursor: 'not-allowed',
@@ -224,6 +227,24 @@ var genStyle = function(token) {
224
227
  font: 'var(--font-text-body-base)',
225
228
  color: 'var(--color-gray-text-default)'
226
229
  },
230
+ '&-tools-wrapper': _define_property({
231
+ backgroundColor: '#fff',
232
+ display: 'flex',
233
+ boxSizing: 'border-box',
234
+ borderRadius: 'inherit',
235
+ flexDirection: 'row',
236
+ alignItems: 'center',
237
+ justifyContent: 'space-between',
238
+ gap: 8,
239
+ width: '100%',
240
+ paddingLeft: 'var(--padding-3x)',
241
+ paddingRight: 'var(--padding-3x)',
242
+ paddingBottom: 'var(--padding-3x)'
243
+ }, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
244
+ paddingLeft: MOBILE_PADDING,
245
+ paddingRight: MOBILE_PADDING,
246
+ paddingBottom: MOBILE_PADDING
247
+ }),
227
248
  '&-send-actions': {
228
249
  position: 'absolute',
229
250
  userSelect: 'none',
@@ -2,6 +2,16 @@ import React from 'react';
2
2
  import { ChartContainerProps } from '../components';
3
3
  import { StatisticConfigType } from '../hooks/useChartStatistic';
4
4
  import { ChartDataItem } from '../utils';
5
+ /**
6
+ * @fileoverview 面积图组件文件
7
+ *
8
+ * 该文件提供了面积图组件的实现,基于 Chart.js 和 react-chartjs-2。
9
+ * 支持数据可视化、交互、配置、统计等功能。
10
+ *
11
+ * @author md-editor
12
+ * @version 1.0.0
13
+ * @since 2024
14
+ */
5
15
  /**
6
16
  * 面积图数据项类型
7
17
  *
@@ -129,6 +139,8 @@ export interface AreaChartProps extends ChartContainerProps {
129
139
  renderFilterInToolbar?: boolean;
130
140
  /** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
131
141
  statistic?: StatisticConfigType;
142
+ /** 是否显示加载状态(当图表未闭合时显示) */
143
+ loading?: boolean;
132
144
  }
133
145
  /**
134
146
  * 面积图组件