@ant-design/agentic-ui 2.30.31 → 2.31.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.
Files changed (96) hide show
  1. package/dist/AILabel/index.d.ts +2 -0
  2. package/dist/AILabel/index.js +4 -2
  3. package/dist/AgentRunBar/Robot.js +0 -1
  4. package/dist/AgentRunBar/index.js +1 -0
  5. package/dist/AgenticLayout/index.js +1 -0
  6. package/dist/AnswerAlert/index.js +1 -0
  7. package/dist/BackTo/ScrollVisibleButton.d.ts +2 -0
  8. package/dist/BackTo/ScrollVisibleButton.js +4 -2
  9. package/dist/Bubble/List/PureBubbleList.js +2 -0
  10. package/dist/Bubble/style.js +0 -1
  11. package/dist/ChatBootPage/ButtonTab.js +1 -0
  12. package/dist/ChatBootPage/ButtonTabGroup.js +1 -0
  13. package/dist/ChatBootPage/CaseReply.js +1 -0
  14. package/dist/ChatBootPage/Title.js +1 -0
  15. package/dist/ChatLayout/index.js +1 -0
  16. package/dist/Components/ActionItemBox/ActionItemBox.js +1 -0
  17. package/dist/Components/Button/IconButton/index.js +1 -0
  18. package/dist/Components/Button/SwitchButton/index.js +1 -0
  19. package/dist/Components/Button/ToggleButton/index.js +1 -0
  20. package/dist/Components/GradientText/index.js +1 -0
  21. package/dist/Components/LayoutHeader/index.js +2 -1
  22. package/dist/Components/Loading/Loading.js +2 -0
  23. package/dist/Components/Robot/index.js +1 -0
  24. package/dist/Components/Robot/lotties/BlowingWindLottie/index.js +16 -3
  25. package/dist/Components/Robot/lotties/BouncingLottie/index.js +16 -3
  26. package/dist/Components/Robot/lotties/DazingLottie/index.js +16 -3
  27. package/dist/Components/Robot/lotties/PeekLottie/index.js +16 -3
  28. package/dist/Components/Robot/lotties/ThinkingLottie/index.js +16 -3
  29. package/dist/Components/SuggestionList/index.js +1 -0
  30. package/dist/Components/TextAnimate/index.js +1 -0
  31. package/dist/Components/TypingAnimation/index.js +2 -1
  32. package/dist/Components/VisualList/index.js +3 -0
  33. package/dist/Components/lotties/CreativeSparkLottie/index.js +16 -3
  34. package/dist/Components/lotties/DazingLottie/index.js +16 -3
  35. package/dist/Components/lotties/LoadingLottie/index.js +16 -3
  36. package/dist/Components/lotties/ThinkingLottie/index.js +16 -3
  37. package/dist/Components/lotties/ThreeThinkingLottie/index.d.ts +68 -0
  38. package/dist/Components/lotties/ThreeThinkingLottie/index.js +103 -0
  39. package/dist/Components/lotties/ThreeThinkingLottie/three-thinking.json +130 -0
  40. package/dist/Components/lotties/bubble-actions/Copy/index.js +12 -3
  41. package/dist/Components/lotties/bubble-actions/Dislike/index.js +12 -3
  42. package/dist/Components/lotties/bubble-actions/Like/index.js +12 -3
  43. package/dist/Components/lotties/bubble-actions/More/index.js +12 -3
  44. package/dist/Components/lotties/bubble-actions/Play/index.js +12 -3
  45. package/dist/Components/lotties/bubble-actions/Quote/index.js +12 -3
  46. package/dist/Components/lotties/bubble-actions/Refresh/index.js +12 -3
  47. package/dist/Components/lotties/bubble-actions/Share/index.js +12 -3
  48. package/dist/Components/lotties/index.d.ts +2 -0
  49. package/dist/Components/lotties/index.js +2 -0
  50. package/dist/Components/lotties/useAsyncLottieData.d.ts +9 -0
  51. package/dist/Components/lotties/useAsyncLottieData.js +83 -0
  52. package/dist/History/index.js +1 -0
  53. package/dist/Hooks/useLanguage.d.ts +1 -0
  54. package/dist/I18n/locales.d.ts +1 -0
  55. package/dist/I18n/locales.js +2 -0
  56. package/dist/Icons/animated/VoicePlayLottie/index.js +16 -3
  57. package/dist/Icons/animated/VoicingLottie/index.js +16 -3
  58. package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -0
  59. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +10 -10
  60. package/dist/MarkdownInputField/BorderBeamAnimation.d.ts +1 -1
  61. package/dist/MarkdownInputField/BorderBeamAnimation.js +6 -3
  62. package/dist/MarkdownRenderer/MarkdownRenderer.js +1 -0
  63. package/dist/Plugins/chart/AreaChart/index.js +10 -8
  64. package/dist/Plugins/chart/BarChart/index.js +10 -8
  65. package/dist/Plugins/chart/BoxPlotChart/index.d.ts +1 -1
  66. package/dist/Plugins/chart/BoxPlotChart/index.js +11 -8
  67. package/dist/Plugins/chart/DonutChart/index.js +14 -12
  68. package/dist/Plugins/chart/FunnelChart/index.js +10 -8
  69. package/dist/Plugins/chart/HistogramChart/index.d.ts +1 -1
  70. package/dist/Plugins/chart/HistogramChart/index.js +11 -8
  71. package/dist/Plugins/chart/LineChart/index.js +10 -8
  72. package/dist/Plugins/chart/RadarChart/index.js +14 -12
  73. package/dist/Plugins/chart/ScatterChart/index.js +14 -12
  74. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +13 -3
  75. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +21 -4
  76. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  77. package/dist/Plugins/chart/hooks/index.d.ts +2 -0
  78. package/dist/Plugins/chart/hooks/index.js +1 -0
  79. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +1 -1
  80. package/dist/Plugins/chart/hooks/useChartTheme.js +1 -1
  81. package/dist/Plugins/chart/hooks/useDetectTheme.d.ts +45 -0
  82. package/dist/Plugins/chart/hooks/useDetectTheme.js +249 -0
  83. package/dist/Schema/SchemaEditor/index.js +1 -0
  84. package/dist/Schema/SchemaForm/index.js +1 -0
  85. package/dist/TaskList/TaskList.js +21 -4
  86. package/dist/TaskList/components/TaskListItem.js +2 -1
  87. package/dist/TaskList/style.js +1 -1
  88. package/dist/ThoughtChainList/index.js +1 -0
  89. package/dist/ThoughtChainList/style.js +14 -3
  90. package/dist/ToolUseBar/index.js +7 -6
  91. package/dist/ToolUseBarThink/style.js +0 -7
  92. package/dist/WelcomeMessage/index.js +1 -0
  93. package/dist/Workspace/File/FileComponent.js +15 -9
  94. package/dist/Workspace/File/FileTree/FileTreeComponent.js +6 -1
  95. package/dist/Workspace/File/PreviewComponent.js +23 -6
  96. package/package.json +3 -3
@@ -65,6 +65,7 @@ function _object_without_properties_loose(source, excluded) {
65
65
  import { ConfigProvider, theme as antdTheme } from "antd";
66
66
  import classNames from "clsx";
67
67
  import React from "react";
68
+ import { useDetectTheme } from "../../hooks";
68
69
  import { ChartDarkAntdProvidedContext, useChartDarkAntdProvided } from "./ChartDarkAntdContext";
69
70
  import ChartErrorBoundary from "./ChartErrorBoundary";
70
71
  import { useStyle } from "./style";
@@ -81,7 +82,7 @@ import { useStyle } from "./style";
81
82
  * @param {string} [props.className] - 自定义CSS类名
82
83
  * @param {React.ReactNode} props.children - 子元素
83
84
  * @param {React.CSSProperties} [props.style] - 样式对象
84
- * @param {'light' | 'dark'} [props.theme='light'] - 图表主题
85
+ * @param {'light' | 'dark'} [props.theme] - 图表主题,不传时自动检测(检测 html[data-theme='dark'] CSS 变量亮度)
85
86
  * @param {boolean} [props.isMobile=false] - 是否为移动端
86
87
  * @param {object} [props.errorBoundary] - 错误边界配置
87
88
  * @param {boolean} [props.errorBoundary.enabled=true] - 是否启用错误边界
@@ -91,17 +92,24 @@ import { useStyle } from "./style";
91
92
  *
92
93
  * @example
93
94
  * ```tsx
94
- * // 基础使用
95
+ * // 基础使用(自动检测主题)
95
96
  * <ChartContainer
96
97
  * baseClassName="area-chart-container"
97
98
  * className="custom-chart"
98
- * theme="light"
99
99
  * isMobile={false}
100
100
  * style={{ width: 600, height: 400 }}
101
101
  * >
102
102
  * <div>图表内容</div>
103
103
  * </ChartContainer>
104
104
  *
105
+ * // 显式指定主题
106
+ * <ChartContainer
107
+ * baseClassName="area-chart-container"
108
+ * theme="dark"
109
+ * >
110
+ * <div>图表内容</div>
111
+ * </ChartContainer>
112
+ *
105
113
  * // 自定义错误边界
106
114
  * <ChartContainer
107
115
  * baseClassName="line-chart-container"
@@ -137,8 +145,9 @@ import { useStyle } from "./style";
137
145
  * - 内置错误边界保护,防止图表错误影响整个应用
138
146
  * - 错误边界默认启用,可通过配置禁用或自定义
139
147
  * - `theme="dark"` 时在本容器内嵌套 Ant Design 暗色算法,工具栏/筛选等 antd 控件与画布暗色一致(嵌套容器不重复包裹)
148
+ * - 支持自动主题检测:当 theme 未指定时,会自动检测 html[data-theme='dark'] 属性或 CSS 变量亮度判断主题
140
149
  */ var ChartContainer = function ChartContainer(_0) {
141
- var baseClassName = _0.baseClassName, className = _0.className, children = _0.children, style = _0.style, classNamesProp = _0.classNames, stylesProp = _0.styles, _0_theme = _0.theme, theme = _0_theme === void 0 ? 'light' : _0_theme, _0_variant = _0.variant, variant = _0_variant === void 0 ? 'default' : _0_variant, _0_isMobile = _0.isMobile, isMobile = _0_isMobile === void 0 ? false : _0_isMobile, _0_errorBoundary = _0.errorBoundary, errorBoundary = _0_errorBoundary === void 0 ? {
150
+ var baseClassName = _0.baseClassName, className = _0.className, children = _0.children, style = _0.style, classNamesProp = _0.classNames, stylesProp = _0.styles, themeProp = _0.theme, _0_autoDetectTheme = _0.autoDetectTheme, autoDetectTheme = _0_autoDetectTheme === void 0 ? true : _0_autoDetectTheme, _0_variant = _0.variant, variant = _0_variant === void 0 ? 'default' : _0_variant, _0_isMobile = _0.isMobile, isMobile = _0_isMobile === void 0 ? false : _0_isMobile, _0_errorBoundary = _0.errorBoundary, errorBoundary = _0_errorBoundary === void 0 ? {
142
151
  enabled: true
143
152
  } : _0_errorBoundary, restProps = _object_without_properties(_0, [
144
153
  "baseClassName",
@@ -148,12 +157,20 @@ import { useStyle } from "./style";
148
157
  "classNames",
149
158
  "styles",
150
159
  "theme",
160
+ "autoDetectTheme",
151
161
  "variant",
152
162
  "isMobile",
153
163
  "errorBoundary"
154
164
  ]);
155
165
  var _useStyle = useStyle(baseClassName), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
156
166
  var ancestorDarkAntdProvided = useChartDarkAntdProvided();
167
+ // 自动检测主题:当 themeProp 未指定且 autoDetectTheme 为 true 时,自动检测
168
+ // 当 themeProp 已明确传入时,跳过监听以避免创建多余的 MutationObserver
169
+ var needDetect = autoDetectTheme && !themeProp;
170
+ var detectedTheme = useDetectTheme({
171
+ observeChanges: needDetect
172
+ });
173
+ var theme = themeProp !== null && themeProp !== void 0 ? themeProp : needDetect ? detectedTheme : 'light';
157
174
  var wrapDarkAntd = theme === 'dark' && !ancestorDarkAntdProvided;
158
175
  // 构建动态类名
159
176
  var combinedClassName = classNames(baseClassName, hashId, theme === 'light' && "".concat(baseClassName, "-light-theme"), theme === 'dark' && "".concat(baseClassName, "-dark-theme"), isMobile && "".concat(baseClassName, "-mobile"), !isMobile && "".concat(baseClassName, "-desktop"), variant === 'outline' && "".concat(baseClassName, "-outline"), variant === 'borderless' && "".concat(baseClassName, "-borderless"), className, classNamesProp === null || classNamesProp === void 0 ? void 0 : classNamesProp.root);
@@ -462,6 +462,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
462
462
  'fileType.config': string;
463
463
  'fileType.powerpoint': string;
464
464
  'workspace.file.unsupportedPreview': string;
465
+ 'workspace.file.unsupportedPreviewNoDownload': string;
465
466
  'workspace.file.downloadButton': string;
466
467
  'workspace.file.videoNotSupported': string;
467
468
  'workspace.file.audioNotSupported': string;
@@ -888,6 +889,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
888
889
  'fileType.config': string;
889
890
  'fileType.powerpoint': string;
890
891
  'workspace.file.unsupportedPreview': string;
892
+ 'workspace.file.unsupportedPreviewNoDownload': string;
891
893
  'workspace.file.downloadButton': string;
892
894
  'workspace.file.videoNotSupported': string;
893
895
  'workspace.file.audioNotSupported': string;
@@ -7,4 +7,6 @@ export { useChartDataFilter } from './useChartDataFilter';
7
7
  export type { ChartStatisticConfig, StatisticConfigType, } from './useChartStatistic';
8
8
  export { useChartStatistics } from './useChartStatistics';
9
9
  export { useChartTheme } from './useChartTheme';
10
+ export { useDetectTheme } from './useDetectTheme';
11
+ export type { DetectThemeOptions } from './useDetectTheme';
10
12
  export { useResponsiveSize } from './useResponsiveSize';
@@ -5,4 +5,5 @@
5
5
  */ export { useChartDataFilter } from "./useChartDataFilter";
6
6
  export { useChartStatistics } from "./useChartStatistics";
7
7
  export { useChartTheme } from "./useChartTheme";
8
+ export { useDetectTheme } from "./useDetectTheme";
8
9
  export { useResponsiveSize } from "./useResponsiveSize";
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @since 1.0.0
15
15
  */
16
- export declare const useChartTheme: (theme?: 'light' | 'dark') => {
16
+ export declare const useChartTheme: (theme?: 'light' | 'dark' | undefined) => {
17
17
  isLight: boolean;
18
18
  axisTextColor: string;
19
19
  gridColor: string;
@@ -16,7 +16,7 @@ import { useMemo } from "react";
16
16
  */ export var useChartTheme = function useChartTheme() {
17
17
  var theme = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'light';
18
18
  return useMemo(function() {
19
- var isLight = theme === 'light';
19
+ var isLight = (theme !== null && theme !== void 0 ? theme : 'light') === 'light';
20
20
  var axisTextColor = isLight ? 'rgba(0, 25, 61, 0.3255)' : 'rgba(255, 255, 255, 0.8)';
21
21
  var gridColor = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.2)';
22
22
  return {
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 主题检测配置选项
3
+ */
4
+ export interface DetectThemeOptions {
5
+ /**
6
+ * 用于检测主题的 CSS 变量名
7
+ * @default '--color-gray-bg-page'
8
+ */
9
+ cssVariable?: string;
10
+ /**
11
+ * 亮度阈值,低于此值认为是暗色主题
12
+ * @default 145
13
+ */
14
+ darknessThreshold?: number;
15
+ /**
16
+ * 是否监听主题变化
17
+ * @default true
18
+ */
19
+ observeChanges?: boolean;
20
+ }
21
+ /**
22
+ * 自动检测当前主题的 Hook(单例模式)
23
+ *
24
+ * 所有 hook 实例共享同一个 MutationObserver 和 matchMedia 监听器,
25
+ * 避免页面上多个图表时创建重复的 DOM 监听。
26
+ *
27
+ * 检测策略(按优先级):
28
+ * 1. 检查 `html[data-theme='dark']` 属性
29
+ * 2. 检查指定 CSS 变量的亮度值
30
+ * 3. 检查 `--color-gray-bg-page` 的亮度值
31
+ *
32
+ * @param options 检测配置选项(observeChanges 为 false 时跳过监听)
33
+ * @returns 检测到的主题 'light' | 'dark'
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const theme = useDetectTheme();
38
+ * // theme: 'light' | 'dark'
39
+ *
40
+ * // 禁用监听(仅检测一次)
41
+ * const theme = useDetectTheme({ observeChanges: false });
42
+ * ```
43
+ */
44
+ export declare const useDetectTheme: (options?: DetectThemeOptions) => 'light' | 'dark';
45
+ export default useDetectTheme;
@@ -0,0 +1,249 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
47
+ import { useSyncExternalStore } from "react";
48
+ /**
49
+ * 解析颜色值为 RGB
50
+ */ var parseColorToRgb = function parseColorToRgb(color) {
51
+ var normalizedColor = color.trim().toLowerCase();
52
+ // 短十六进制格式 #rgb
53
+ var shortHexMatch = normalizedColor.match(/^#([0-9a-f]{3})$/i);
54
+ if (shortHexMatch) {
55
+ var _shortHexMatch__split_map = _sliced_to_array(shortHexMatch[1].split('').map(function(char) {
56
+ return Number.parseInt(char + char, 16);
57
+ }), 3), r = _shortHexMatch__split_map[0], g = _shortHexMatch__split_map[1], b = _shortHexMatch__split_map[2];
58
+ return {
59
+ r: r,
60
+ g: g,
61
+ b: b
62
+ };
63
+ }
64
+ // 标准十六进制格式 #rrggbb
65
+ var hexMatch = normalizedColor.match(/^#([0-9a-f]{6})$/i);
66
+ if (hexMatch) {
67
+ return {
68
+ r: Number.parseInt(hexMatch[1].slice(0, 2), 16),
69
+ g: Number.parseInt(hexMatch[1].slice(2, 4), 16),
70
+ b: Number.parseInt(hexMatch[1].slice(4, 6), 16)
71
+ };
72
+ }
73
+ // rgb/rgba 格式
74
+ var rgbMatch = normalizedColor.match(/^rgba?\((\d{1,3})[\s,]+(\d{1,3})[\s,]+(\d{1,3})(?:[\s,]+[\d.]+)?\)$/i);
75
+ if (rgbMatch) {
76
+ return {
77
+ r: Number.parseInt(rgbMatch[1], 10),
78
+ g: Number.parseInt(rgbMatch[2], 10),
79
+ b: Number.parseInt(rgbMatch[3], 10)
80
+ };
81
+ }
82
+ return null;
83
+ };
84
+ /**
85
+ * 计算颜色的亮度
86
+ * 使用加权公式:Y = 0.299*R + 0.587*G + 0.114*B
87
+ */ var calculateBrightness = function calculateBrightness(color) {
88
+ var rgb = parseColorToRgb(color);
89
+ if (!rgb) return null;
90
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
91
+ };
92
+ /**
93
+ * 检测背景色是否为暗色
94
+ */ var isDarkBackground = function isDarkBackground(color) {
95
+ var threshold = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 145;
96
+ var brightness = calculateBrightness(color);
97
+ if (brightness === null) return false;
98
+ return brightness < threshold;
99
+ };
100
+ /**
101
+ * 检测 HTML 元素的 data-theme 属性是否为 dark
102
+ */ var checkDataTheme = function checkDataTheme() {
103
+ if (typeof document === 'undefined') return false;
104
+ var htmlElement = document.documentElement;
105
+ return htmlElement.getAttribute('data-theme') === 'dark';
106
+ };
107
+ /**
108
+ * 获取 CSS 变量的计算值
109
+ */ var getCSSVariableValue = function getCSSVariableValue(variableName) {
110
+ if (typeof window === 'undefined') return null;
111
+ var computedStyle = window.getComputedStyle(document.documentElement);
112
+ var value = computedStyle.getPropertyValue(variableName).trim();
113
+ return value || null;
114
+ };
115
+ /**
116
+ * 根据多种方式检测当前主题
117
+ */ var detectTheme = function detectTheme(cssVariable, darknessThreshold) {
118
+ // 1. 首先检查 html[data-theme='dark']
119
+ if (checkDataTheme()) {
120
+ return 'dark';
121
+ }
122
+ // 2. 检查 CSS 变量的亮度
123
+ var cssValue = getCSSVariableValue(cssVariable);
124
+ if (cssValue && isDarkBackground(cssValue, darknessThreshold)) {
125
+ return 'dark';
126
+ }
127
+ // 3. 检查背景色 CSS 变量
128
+ var bgColor = getCSSVariableValue('--color-gray-bg-page');
129
+ if (bgColor && isDarkBackground(bgColor, darknessThreshold)) {
130
+ return 'dark';
131
+ }
132
+ return 'light';
133
+ };
134
+ // --- 单例主题检测:所有 hook 实例共享一个 MutationObserver + matchMedia 监听 ---
135
+ var listeners = [];
136
+ var currentTheme = 'light';
137
+ var observerRef = null;
138
+ var mediaQueryRef = null;
139
+ var refCount = 0;
140
+ var DEFAULT_CSS_VARIABLE = '--color-gray-bg-page';
141
+ var DEFAULT_DARKNESS_THRESHOLD = 145;
142
+ function subscribeTheme(listener) {
143
+ listeners.push(listener);
144
+ refCount++;
145
+ // 第一个订阅者时初始化全局监听器
146
+ if (refCount === 1 && typeof window !== 'undefined') {
147
+ currentTheme = detectTheme(DEFAULT_CSS_VARIABLE, DEFAULT_DARKNESS_THRESHOLD);
148
+ var updateTheme = function updateTheme() {
149
+ var next = detectTheme(DEFAULT_CSS_VARIABLE, DEFAULT_DARKNESS_THRESHOLD);
150
+ if (next !== currentTheme) {
151
+ currentTheme = next;
152
+ listeners.forEach(function(fn) {
153
+ return fn();
154
+ });
155
+ }
156
+ };
157
+ var htmlElement = document.documentElement;
158
+ observerRef = new MutationObserver(function(mutations) {
159
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
160
+ try {
161
+ for(var _iterator = mutations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
162
+ var mutation = _step.value;
163
+ if (mutation.type === 'attributes' && mutation.attributeName === 'data-theme') {
164
+ updateTheme();
165
+ break;
166
+ }
167
+ }
168
+ } catch (err) {
169
+ _didIteratorError = true;
170
+ _iteratorError = err;
171
+ } finally{
172
+ try {
173
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
174
+ _iterator.return();
175
+ }
176
+ } finally{
177
+ if (_didIteratorError) {
178
+ throw _iteratorError;
179
+ }
180
+ }
181
+ }
182
+ });
183
+ observerRef.observe(htmlElement, {
184
+ attributes: true,
185
+ attributeFilter: [
186
+ 'data-theme',
187
+ 'class',
188
+ 'style'
189
+ ]
190
+ });
191
+ mediaQueryRef = window.matchMedia('(prefers-color-scheme: dark)');
192
+ mediaQueryRef.addEventListener('change', updateTheme);
193
+ }
194
+ return function() {
195
+ listeners = listeners.filter(function(fn) {
196
+ return fn !== listener;
197
+ });
198
+ refCount--;
199
+ // 最后一个订阅者取消时清理全局监听器
200
+ if (refCount === 0) {
201
+ observerRef === null || observerRef === void 0 ? void 0 : observerRef.disconnect();
202
+ observerRef = null;
203
+ if (mediaQueryRef) {
204
+ mediaQueryRef.removeEventListener('change', function() {});
205
+ mediaQueryRef = null;
206
+ }
207
+ }
208
+ };
209
+ }
210
+ function getSnapshot() {
211
+ return currentTheme;
212
+ }
213
+ function getServerSnapshot() {
214
+ return 'light';
215
+ }
216
+ /**
217
+ * 自动检测当前主题的 Hook(单例模式)
218
+ *
219
+ * 所有 hook 实例共享同一个 MutationObserver 和 matchMedia 监听器,
220
+ * 避免页面上多个图表时创建重复的 DOM 监听。
221
+ *
222
+ * 检测策略(按优先级):
223
+ * 1. 检查 `html[data-theme='dark']` 属性
224
+ * 2. 检查指定 CSS 变量的亮度值
225
+ * 3. 检查 `--color-gray-bg-page` 的亮度值
226
+ *
227
+ * @param options 检测配置选项(observeChanges 为 false 时跳过监听)
228
+ * @returns 检测到的主题 'light' | 'dark'
229
+ *
230
+ * @example
231
+ * ```tsx
232
+ * const theme = useDetectTheme();
233
+ * // theme: 'light' | 'dark'
234
+ *
235
+ * // 禁用监听(仅检测一次)
236
+ * const theme = useDetectTheme({ observeChanges: false });
237
+ * ```
238
+ */ export var useDetectTheme = function useDetectTheme() {
239
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
240
+ var _options_observeChanges = options.observeChanges, observeChanges = _options_observeChanges === void 0 ? true : _options_observeChanges;
241
+ // 当 observeChanges 为 false 时,只做一次性检测,不订阅变更
242
+ var liveTheme = useSyncExternalStore(subscribeTheme, getSnapshot, getServerSnapshot);
243
+ if (!observeChanges) {
244
+ var _options_cssVariable, _options_darknessThreshold;
245
+ return detectTheme((_options_cssVariable = options.cssVariable) !== null && _options_cssVariable !== void 0 ? _options_cssVariable : DEFAULT_CSS_VARIABLE, (_options_darknessThreshold = options.darknessThreshold) !== null && _options_darknessThreshold !== void 0 ? _options_darknessThreshold : DEFAULT_DARKNESS_THRESHOLD);
246
+ }
247
+ return liveTheme;
248
+ };
249
+ export default useDetectTheme;
@@ -442,6 +442,7 @@ import { useStyle } from "./style";
442
442
  ]);
443
443
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
444
444
  className: classNames(prefixCls, className, hashId),
445
+ "data-testid": prefixCls,
445
446
  style: {
446
447
  height: typeof height === 'number' ? "".concat(height, "px") : height
447
448
  }
@@ -452,6 +452,7 @@ import { I18nContext, compileTemplate } from "../../I18n";
452
452
  renderFormItem
453
453
  ]);
454
454
  return /*#__PURE__*/ React.createElement(Form, {
455
+ "data-testid": "schema-form",
455
456
  form: form,
456
457
  layout: "vertical",
457
458
  initialValues: defaultValues,
@@ -73,7 +73,7 @@ import { ChevronUp } from "@sofa-design/icons";
73
73
  import { ConfigProvider } from "antd";
74
74
  import classNames from "clsx";
75
75
  import { useMergedState } from "rc-util";
76
- import React, { memo, useContext, useMemo } from "react";
76
+ import React, { memo, useContext, useEffect, useMemo, useState } from "react";
77
77
  import { ActionIconBox } from "../Components/ActionIconBox";
78
78
  import { useRefFunction } from "../Hooks/useRefFunction";
79
79
  import { I18nContext } from "../I18n";
@@ -81,6 +81,7 @@ import { StatusIcon } from "./components/StatusIcon";
81
81
  import { TaskListItem } from "./components/TaskListItem";
82
82
  import { getArrowRotation } from "./constants";
83
83
  import { useStyle } from "./style";
84
+ var SIMPLE_COLLAPSE_DURATION_MS = 350;
84
85
  var getDefaultExpandedKeys = function getDefaultExpandedKeys(items, isControlled) {
85
86
  return isControlled ? [] : items.map(function(item) {
86
87
  return item.key;
@@ -112,11 +113,26 @@ export var TaskList = /*#__PURE__*/ memo(function(param) {
112
113
  return onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(val);
113
114
  }
114
115
  }), 2), simpleExpanded = _useMergedState1[0], setSimpleExpanded = _useMergedState1[1];
116
+ var _useState = _sliced_to_array(useState(true), 2), shouldRenderContent = _useState[0], setShouldRenderContent = _useState[1];
115
117
  var handleSimpleToggle = useRefFunction(function() {
116
118
  setSimpleExpanded(function(prev) {
117
119
  return !prev;
118
120
  });
119
121
  });
122
+ useEffect(function() {
123
+ if (simpleExpanded) {
124
+ setShouldRenderContent(true);
125
+ return;
126
+ }
127
+ var timer = window.setTimeout(function() {
128
+ setShouldRenderContent(false);
129
+ }, SIMPLE_COLLAPSE_DURATION_MS);
130
+ return function() {
131
+ window.clearTimeout(timer);
132
+ };
133
+ }, [
134
+ simpleExpanded
135
+ ]);
120
136
  var _useMemo = useMemo(function() {
121
137
  var completedCount = items.filter(function(i) {
122
138
  return i.status === 'success';
@@ -168,7 +184,8 @@ export var TaskList = /*#__PURE__*/ memo(function(param) {
168
184
  };
169
185
  if (variant !== 'simple') {
170
186
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
171
- className: className
187
+ className: className,
188
+ "data-testid": prefixCls
172
189
  }, renderItems(items)));
173
190
  }
174
191
  var simpleCls = "".concat(prefixCls, "-simple");
@@ -210,8 +227,8 @@ export var TaskList = /*#__PURE__*/ memo(function(param) {
210
227
  "data-testid": "task-list-simple-arrow"
211
228
  })))), /*#__PURE__*/ React.createElement("div", {
212
229
  className: classNames("".concat(simpleCls, "-content"), hashId, _define_property({}, "".concat(simpleCls, "-content-expanded"), simpleExpanded))
213
- }, /*#__PURE__*/ React.createElement("div", {
230
+ }, shouldRenderContent ? /*#__PURE__*/ React.createElement("div", {
214
231
  className: classNames("".concat(simpleCls, "-list"), hashId)
215
- }, renderItems(visibleItems)))));
232
+ }, renderItems(visibleItems)) : null)));
216
233
  });
217
234
  TaskList.displayName = 'TaskList';
@@ -35,7 +35,8 @@ export var TaskListItem = /*#__PURE__*/ memo(function(param) {
35
35
  className: classNames("".concat(prefixCls, "-dash-line"), hashId),
36
36
  "data-testid": "task-list-dash-line"
37
37
  }))), /*#__PURE__*/ React.createElement("div", {
38
- className: classNames("".concat(prefixCls, "-right"), hashId)
38
+ className: classNames("".concat(prefixCls, "-right"), hashId),
39
+ "data-testid": "task-list-right"
39
40
  }, /*#__PURE__*/ React.createElement("div", {
40
41
  className: classNames("".concat(prefixCls, "-top"), hashId),
41
42
  onClick: handleToggle
@@ -153,7 +153,7 @@ var genStyle = function genStyle(token) {
153
153
  display: 'flex',
154
154
  alignItems: 'center',
155
155
  height: 36,
156
- padding: '0 12px',
156
+ padding: '0 4px',
157
157
  gap: 8,
158
158
  cursor: 'pointer',
159
159
  userSelect: 'none',
@@ -486,6 +486,7 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
486
486
  locale: locale
487
487
  }), /*#__PURE__*/ React.createElement("div", {
488
488
  className: classNames("".concat(prefixCls), hashId),
489
+ "data-testid": prefixCls,
489
490
  style: restStyle
490
491
  }, /*#__PURE__*/ React.createElement(motion.div, {
491
492
  className: classNames("".concat(prefixCls, "-container"), hashId, _define_property({}, "".concat(prefixCls, "-container-loading"), !(bubble === null || bubble === void 0 ? void 0 : bubble.isFinished)))
@@ -52,7 +52,16 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
54
54
  var genStyle = function genStyle(token) {
55
- return _define_property({}, token.componentCls, {
55
+ return _define_property({
56
+ '@keyframes thoughtChainSpin': {
57
+ '0%': {
58
+ transform: 'rotate(0deg)'
59
+ },
60
+ '100%': {
61
+ transform: 'rotate(360deg)'
62
+ }
63
+ }
64
+ }, token.componentCls, {
56
65
  padding: '12px',
57
66
  '*': {
58
67
  boxSizing: 'border-box'
@@ -87,8 +96,10 @@ var genStyle = function genStyle(token) {
87
96
  zIndex: 1,
88
97
  backgroundSize: '150%',
89
98
  backgroundPosition: '0 0',
90
- backgroundImage: "conic-gradient(\n from var(--angle, 0deg) at 50% 50%,\n rgba(46, 255, 127, 0.7) 0deg,\n rgba(120, 133, 255, 1) 90deg,\n rgba(255, 0, 153, 0.4) 180deg,\n rgba(0, 221, 255, 0.62) 270deg,\n rgba(46, 255, 127, 0.7) 360deg\n )",
91
- animationName: 'spin',
99
+ backgroundImage: "conic-gradient(\n rgba(46, 255, 127, 0.7) 0deg,\n rgba(120, 133, 255, 1) 90deg,\n rgba(255, 0, 153, 0.4) 180deg,\n rgba(0, 221, 255, 0.62) 270deg,\n rgba(46, 255, 127, 0.7) 360deg\n )",
100
+ transformOrigin: 'center center',
101
+ willChange: 'transform',
102
+ animationName: 'thoughtChainSpin',
92
103
  animationDuration: '2s',
93
104
  animationTimingFunction: 'linear',
94
105
  animationIterationCount: 'infinite'
@@ -155,13 +155,14 @@ export * from "./BarItem";
155
155
  * - 提供加载状态显示
156
156
  * - 支持错误状态处理
157
157
  */ var ToolUseBarComponent = function ToolUseBarComponent(_0) {
158
- var tools = _0.tools, onActiveKeysChange = _0.onActiveKeysChange, onExpandedKeysChange = _0.onExpandedKeysChange, _0_light = _0.light, light = _0_light === void 0 ? false : _0_light, _0_disableAnimation = _0.disableAnimation, disableAnimation = _0_disableAnimation === void 0 ? false : _0_disableAnimation, style = _0.style, props = _object_without_properties(_0, [
158
+ var tools = _0.tools, onActiveKeysChange = _0.onActiveKeysChange, onExpandedKeysChange = _0.onExpandedKeysChange, _0_light = _0.light, light = _0_light === void 0 ? false : _0_light, _0_disableAnimation = _0.disableAnimation, disableAnimation = _0_disableAnimation === void 0 ? false : _0_disableAnimation, style = _0.style, testId = _0.testId, props = _object_without_properties(_0, [
159
159
  "tools",
160
160
  "onActiveKeysChange",
161
161
  "onExpandedKeysChange",
162
162
  "light",
163
163
  "disableAnimation",
164
- "style"
164
+ "style",
165
+ "testId"
165
166
  ]);
166
167
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
167
168
  var prefixCls = getPrefixCls('agentic-tool-use-bar');
@@ -246,13 +247,13 @@ export * from "./BarItem";
246
247
  ]);
247
248
  if (!(tools === null || tools === void 0 ? void 0 : tools.length)) return /*#__PURE__*/ React.createElement("div", {
248
249
  className: containerClassName,
249
- style: style,
250
- "data-testid": "ToolUse"
250
+ "data-testid": testId !== null && testId !== void 0 ? testId : 'ToolUse',
251
+ style: style
251
252
  });
252
253
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
253
254
  className: containerClassName,
254
- style: style,
255
- "data-testid": "ToolUse"
255
+ "data-testid": testId !== null && testId !== void 0 ? testId : 'ToolUse',
256
+ style: style
256
257
  }, toolItems));
257
258
  };
258
259
  // 使用 memo 优化组件,避免不必要的重新渲染
@@ -51,7 +51,6 @@ function _object_spread_props(target, source) {
51
51
  return target;
52
52
  }
53
53
  import { useEditorStyleRegister } from "../Hooks/useStyle";
54
- var LIGHT_MODE_BACKGROUND = 'rgba(255, 255, 255, 0.65)';
55
54
  var LIGHT_MODE_BACKDROP_FILTER = 'blur(12px)';
56
55
  var genStyle = function genStyle(token) {
57
56
  return _define_property({}, token.componentCls, {
@@ -111,18 +110,15 @@ var genStyle = function genStyle(token) {
111
110
  }
112
111
  },
113
112
  '&-loading': {
114
- background: 'var(--color-gray-bg-card-white)',
115
113
  boxSizing: 'border-box',
116
114
  boxShadow: '0px 0px 1px 0px rgba(0, 19, 41, 0.05),0px 2px 7px 0px rgba(0, 19, 41, 0.05),0px 2px 5px -2px rgba(0, 19, 41, 0.06)',
117
115
  '&:hover': {
118
- background: 'var(--color-gray-bg-card-white)',
119
116
  boxSizing: 'border-box',
120
117
  boxShadow: '0px 0px 1px 0px rgba(0, 19, 41, 0.05),0px 2px 7px 0px rgba(0, 19, 41, 0.05),0px 2px 5px -2px rgba(0, 19, 41, 0.06)'
121
118
  }
122
119
  },
123
120
  '&-success': {
124
121
  borderRadius: 'var(--radius-card-base)',
125
- background: 'var(--color-gray-bg-card-light)',
126
122
  boxShadow: 'inset 0px 0px 1px 0px rgba(0, 19, 41, 0.15)'
127
123
  },
128
124
  // Placed after &-success so light mode wins when both classes apply (success + light).
@@ -131,11 +127,9 @@ var genStyle = function genStyle(token) {
131
127
  border: 'none',
132
128
  borderRadius: '14px',
133
129
  padding: 4,
134
- background: LIGHT_MODE_BACKGROUND,
135
130
  backdropFilter: LIGHT_MODE_BACKDROP_FILTER,
136
131
  WebkitBackdropFilter: LIGHT_MODE_BACKDROP_FILTER,
137
132
  '&:hover': _define_property({
138
- background: 'none',
139
133
  boxShadow: 'none'
140
134
  }, "".concat(token.componentCls, "-header-left-icon-light"), {
141
135
  color: 'var(--color-gray-text-secondary)'
@@ -267,7 +261,6 @@ var genStyle = function genStyle(token) {
267
261
  paddingLeft: 12,
268
262
  marginLeft: 16,
269
263
  marginTop: -10,
270
- background: LIGHT_MODE_BACKGROUND,
271
264
  backdropFilter: LIGHT_MODE_BACKDROP_FILTER,
272
265
  WebkitBackdropFilter: LIGHT_MODE_BACKDROP_FILTER
273
266
  }
@@ -121,6 +121,7 @@ import { useStyle } from "./style";
121
121
  var _ref = customStyle || {}, ref = _object_destructuring_empty(_ref), restStyle = _extends({}, _ref);
122
122
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
123
123
  className: clsx(prefixCls, hashId, rootClassName),
124
+ "data-testid": prefixCls,
124
125
  style: restStyle
125
126
  }, title && /*#__PURE__*/ React.createElement(TypingAnimation, _object_spread_props(_object_spread({
126
127
  as: "div"