@ant-design/agentic-ui 2.30.29 → 2.30.30

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.
@@ -3,6 +3,7 @@ import { parserMdToSchema } from './editor/parser/parserMdToSchema';
3
3
  import { EditorUtils } from './editor/utils/editorUtils';
4
4
  import { MarkdownEditorProps } from './types';
5
5
  export { EditorUtils, parserMdToSchema };
6
+ export { sanitizeEditorChromeStyle } from './utils/sanitizeChromeStyle';
6
7
  export * from './editor/elements';
7
8
  export * from './editor/utils';
8
9
  export * from './el';
@@ -175,8 +175,10 @@ import { useSystemKeyboard } from "./editor/utils/keyboard";
175
175
  import { PluginContext } from "./plugin";
176
176
  import { useStyle } from "./style";
177
177
  import { exportHtml } from "./utils/exportHtml";
178
+ import { sanitizeEditorChromeStyle } from "./utils/sanitizeChromeStyle";
178
179
  // 原生表格功能已集成到编辑器中
179
180
  export { EditorUtils, parserMdToSchema };
181
+ export { sanitizeEditorChromeStyle } from "./utils/sanitizeChromeStyle";
180
182
  export * from "./editor/elements";
181
183
  export * from "./editor/utils";
182
184
  export * from "./el";
@@ -202,9 +204,9 @@ var I18nBoundary = function I18nBoundary(param) {
202
204
  /** 基于 Slate.js 的 Markdown 编辑器核心组件,readonly + renderMode='markdown' 时走轻量 MarkdownRenderer */ export var BaseMarkdownEditor = function BaseMarkdownEditor(props) {
203
205
  var _ref, _ref1, _props_streaming, _props_readonly;
204
206
  var _props_jinja, _effectiveJinja_templatePanel, _props_floatBar, _props_floatBar1, _props_textAreaProps;
205
- var initValue = props.initValue, width = props.width, _props_toolBar = props.toolBar, toolBar = _props_toolBar === void 0 ? {} : _props_toolBar, editorRef = props.editorRef, _props_toc = props.toc, toc = _props_toc === void 0 ? false : _props_toc, readonly = props.readonly, lazy = props.lazy, style = props.style, _props_contentStyle = props.contentStyle, contentStyle = _props_contentStyle === void 0 ? {
207
+ var initValue = props.initValue, width = props.width, _props_toolBar = props.toolBar, toolBar = _props_toolBar === void 0 ? {} : _props_toolBar, editorRef = props.editorRef, _props_toc = props.toc, toc = _props_toc === void 0 ? false : _props_toc, readonly = props.readonly, lazy = props.lazy, rawStyle = props.style, tmp = props.contentStyle, rawContentStyle = tmp === void 0 ? {
206
208
  height: '100%'
207
- } : _props_contentStyle, editorStyle = props.editorStyle, height = props.height, children = props.children, renderMode = props.renderMode, renderType = props.renderType, rest = _object_without_properties(props, [
209
+ } : tmp, editorStyle = props.editorStyle, height = props.height, children = props.children, renderMode = props.renderMode, renderType = props.renderType, rest = _object_without_properties(props, [
208
210
  "initValue",
209
211
  "width",
210
212
  "toolBar",
@@ -220,6 +222,8 @@ var I18nBoundary = function I18nBoundary(param) {
220
222
  "renderMode",
221
223
  "renderType"
222
224
  ]);
225
+ var contentStyle = sanitizeEditorChromeStyle(rawContentStyle);
226
+ var rootStyle = sanitizeEditorChromeStyle(rawStyle);
223
227
  var effectiveRenderMode = (_ref = renderMode !== null && renderMode !== void 0 ? renderMode : renderType) !== null && _ref !== void 0 ? _ref : 'slate';
224
228
  // 是否挂载
225
229
  var _useState = _sliced_to_array(useState(false), 2), editorMountStatus = _useState[0], setMountedStatus = _useState[1];
@@ -393,7 +397,7 @@ var I18nBoundary = function I18nBoundary(param) {
393
397
  style: _object_spread({
394
398
  width: width || '100%',
395
399
  height: height || 'auto'
396
- }, style),
400
+ }, rootStyle),
397
401
  ref: markdownContainerRef
398
402
  }, /*#__PURE__*/ React.createElement(MarkdownRenderer, {
399
403
  content: initValue || '',
@@ -452,7 +456,7 @@ var I18nBoundary = function I18nBoundary(param) {
452
456
  style: _object_spread({
453
457
  width: width || '100%',
454
458
  height: height || 'auto'
455
- }, style)
459
+ }, rootStyle)
456
460
  }, !readonly && (toolBar === null || toolBar === void 0 ? void 0 : toolBar.enable) === true ? /*#__PURE__*/ React.createElement("div", {
457
461
  className: classNames("".concat(baseClassName, "-toolbar-container"), _define_property({}, "".concat(baseClassName, "-min-toolbar"), toolBar.min))
458
462
  }, /*#__PURE__*/ React.createElement(ToolBar, {
@@ -515,7 +515,6 @@ var genStyle = function genStyle(token) {
515
515
  borderRadius: 'var(--radius-control-sm)',
516
516
  background: 'var(--color-primary-bg-tip)',
517
517
  '[data-tag-popup-input]': {
518
- border: '1px solid var(--color-gray-control-border-default, rgba(20, 22, 28, 0.12))',
519
518
  color: 'var(--color-primary-text-default, rgba(20, 22, 28, 0.88))',
520
519
  '&:not([data-composition]).empty::before': {
521
520
  color: 'var(--color-gray-text-light, rgba(80, 94, 119, 0.53))',
@@ -0,0 +1,6 @@
1
+ import type { CSSProperties } from 'react';
2
+ /**
3
+ * 清理会产生无效内联声明的样式值(如 `padding-top: ;`、`--foo: ;`)。
4
+ * 用于 BaseMarkdownEditor 根 `style` 与 `contentStyle`。
5
+ */
6
+ export declare function sanitizeEditorChromeStyle(style: CSSProperties | undefined): CSSProperties;
@@ -0,0 +1,87 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ var PADDING_KEYS = [
30
+ 'padding',
31
+ 'paddingTop',
32
+ 'paddingRight',
33
+ 'paddingBottom',
34
+ 'paddingLeft'
35
+ ];
36
+ /**
37
+ * 清理会产生无效内联声明的样式值(如 `padding-top: ;`、`--foo: ;`)。
38
+ * 用于 BaseMarkdownEditor 根 `style` 与 `contentStyle`。
39
+ */ export function sanitizeEditorChromeStyle(style) {
40
+ if (!style) return {};
41
+ var out = _object_spread({}, style);
42
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
43
+ try {
44
+ for(var _iterator = PADDING_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
45
+ var k = _step.value;
46
+ if (out[k] === '') {
47
+ delete out[k];
48
+ }
49
+ }
50
+ } catch (err) {
51
+ _didIteratorError = true;
52
+ _iteratorError = err;
53
+ } finally{
54
+ try {
55
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
56
+ _iterator.return();
57
+ }
58
+ } finally{
59
+ if (_didIteratorError) {
60
+ throw _iteratorError;
61
+ }
62
+ }
63
+ }
64
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
65
+ try {
66
+ for(var _iterator1 = Object.keys(out)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
67
+ var key = _step1.value;
68
+ if (key.startsWith('--') && out[key] === '') {
69
+ delete out[key];
70
+ }
71
+ }
72
+ } catch (err) {
73
+ _didIteratorError1 = true;
74
+ _iteratorError1 = err;
75
+ } finally{
76
+ try {
77
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
78
+ _iterator1.return();
79
+ }
80
+ } finally{
81
+ if (_didIteratorError1) {
82
+ throw _iteratorError1;
83
+ }
84
+ }
85
+ }
86
+ return out;
87
+ }
@@ -280,7 +280,6 @@ var genStyle = function genStyle(token) {
280
280
  }), _define_property(_obj1, "".concat(token.componentCls, "-container"), {
281
281
  position: 'relative',
282
282
  background: 'var(--color-gray-bg-page)',
283
- borderBottom: '1px solid var(--color-gray-border-light, rgba(20, 22, 28, 0.12)) !important',
284
283
  '&-empty': {
285
284
  border: 'none'
286
285
  }
@@ -211,6 +211,9 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
211
211
  ]);
212
212
  var _ref;
213
213
  var _props_skillMode, _props_enlargeable, _props_refinePrompt, _props_enlargeable1, _props_enlargeable2, _props_toolsRender;
214
+ var _ref1 = markdownProps !== null && markdownProps !== void 0 ? markdownProps : {}, markdownContentStyle = _ref1.contentStyle, markdownPropsRest = _object_without_properties(_ref1, [
215
+ "contentStyle"
216
+ ]);
214
217
  // 默认关闭文件上传,需显式传入 attachment.enable: true 开启
215
218
  var attachment = _object_spread({}, DEFAULT_ATTACHMENT, props.attachment);
216
219
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
@@ -426,11 +429,11 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
426
429
  enable: false
427
430
  },
428
431
  readonly: editorReadonly,
429
- contentStyle: {
432
+ contentStyle: _object_spread({
430
433
  alignItems: 'flex-start',
431
434
  padding: 'var(--padding-3x)',
432
435
  paddingRight: computedRightPadding || 'var(--padding-3x)'
433
- },
436
+ }, markdownContentStyle),
434
437
  textAreaProps: {
435
438
  enable: true,
436
439
  placeholder: props.placeholder
@@ -486,7 +489,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
486
489
  ],
487
490
  plainTextOnly: true
488
491
  }, props.pasteConfig)
489
- }, markdownProps), (props === null || props === void 0 ? void 0 : props.quickActionRender) || ((_props_refinePrompt = props.refinePrompt) === null || _props_refinePrompt === void 0 ? void 0 : _props_refinePrompt.enable) || ((_props_enlargeable1 = props.enlargeable) === null || _props_enlargeable1 === void 0 ? void 0 : _props_enlargeable1.enable) ? /*#__PURE__*/ React.createElement(QuickActions, {
492
+ }, markdownPropsRest), (props === null || props === void 0 ? void 0 : props.quickActionRender) || ((_props_refinePrompt = props.refinePrompt) === null || _props_refinePrompt === void 0 ? void 0 : _props_refinePrompt.enable) || ((_props_enlargeable1 = props.enlargeable) === null || _props_enlargeable1 === void 0 ? void 0 : _props_enlargeable1.enable) ? /*#__PURE__*/ React.createElement(QuickActions, {
490
493
  ref: quickActionsRef,
491
494
  value: value,
492
495
  fileMap: fileMap,
@@ -253,7 +253,7 @@ function SendIcon(props) {
253
253
  }
254
254
  },
255
255
  style: style,
256
- className: classNames(baseCls, hashId, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-compact"), props.compact), _define_property(_obj, "".concat(baseCls, "-disabled"), disabled), _define_property(_obj, "".concat(baseCls, "-typing"), typing), _obj))
256
+ className: classNames(baseCls, hashId, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-compact"), props.compact), _define_property(_obj, "".concat(baseCls, "-disabled"), disabled || !isSendable), _define_property(_obj, "".concat(baseCls, "-typing"), typing), _obj))
257
257
  }, /*#__PURE__*/ React.createElement(ErrorBoundary, {
258
258
  fallback: /*#__PURE__*/ React.createElement("div", null)
259
259
  }, /*#__PURE__*/ React.createElement(SendIcon, {
@@ -62,7 +62,8 @@ var pauseIconRotate = new Keyframes('pauseIconRotate', {
62
62
  }
63
63
  });
64
64
  var genStyle = function genStyle(token) {
65
- return _define_property({}, token.componentCls, {
65
+ var _obj;
66
+ return _obj = {}, _define_property(_obj, token.componentCls, {
66
67
  fontSize: '32px',
67
68
  height: 32,
68
69
  display: 'flex',
@@ -70,10 +71,6 @@ var genStyle = function genStyle(token) {
70
71
  lineHeight: '32px',
71
72
  cursor: 'pointer',
72
73
  marginLeft: 4,
73
- '&&-disabled': {
74
- cursor: 'not-allowed',
75
- opacity: 1
76
- },
77
74
  // 旋转动画样式
78
75
  '.pause-icon-ring': {
79
76
  transition: 'transform 0.1s ',
@@ -83,7 +80,13 @@ var genStyle = function genStyle(token) {
83
80
  animationTimingFunction: 'linear',
84
81
  animationIterationCount: 'infinite'
85
82
  }
86
- });
83
+ }), // 使用完整 modifier 类名,避免嵌套 `&&-disabled` 与 BEM 类名拼接不一致导致 cursor 等未生效
84
+ _define_property(_obj, "".concat(token.componentCls, "-disabled"), {
85
+ cursor: 'not-allowed',
86
+ // 发送图标圆形 fill 使用 var(--color-primary-control-fill-primary),禁用时改为灰色语义
87
+ '--color-primary-control-fill-primary': '#8c8c8c',
88
+ '--color-gray-bg-card-white': 'black'
89
+ }), _obj;
87
90
  };
88
91
  /**
89
92
  * Probubble
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.30.29",
3
+ "version": "2.30.30",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
@@ -23,21 +23,20 @@
23
23
  "lint": "pnpm run lint:es && pnpm run lint:css",
24
24
  "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
25
25
  "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
26
+ "playwright:install": "playwright install --with-deps chromium",
26
27
  "prepare": "husky install && dumi setup",
27
- "prepublishOnly": "npm run build && npm run test:full",
28
28
  "prettier": "prettier --write \"{src,docs,test}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
29
29
  "preview": "pnpm dumi preview",
30
30
  "report:demo": "node scripts/generateDemoReport.js",
31
31
  "start": "pnpm run dev",
32
32
  "test": "vitest --run",
33
- "test:full": "cross-env VITEST_FULL_SUITE=1 vitest --run",
34
33
  "test:coverage": "vitest --run --coverage",
35
34
  "test:coverage:full": "cross-env VITEST_FULL_SUITE=1 vitest --run --coverage",
36
35
  "test:e2e": "playwright test",
37
- "playwright:install": "playwright install --with-deps chromium",
38
36
  "test:e2e:debug": "playwright test --debug",
39
37
  "test:e2e:skip-server": "cross-env SKIP_WEBSERVER=1 playwright test",
40
38
  "test:e2e:ui": "playwright test --ui",
39
+ "test:full": "cross-env VITEST_FULL_SUITE=1 vitest --run",
41
40
  "tsc": "tsc --noEmit"
42
41
  },
43
42
  "lint-staged": {