@ant-design/agentic-ui 2.30.31 → 2.30.33
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/AILabel/index.d.ts +2 -0
- package/dist/AILabel/index.js +4 -2
- package/dist/AgentRunBar/Robot.js +0 -1
- package/dist/AgentRunBar/index.js +1 -0
- package/dist/AgenticLayout/index.js +1 -0
- package/dist/AnswerAlert/index.js +1 -0
- package/dist/BackTo/ScrollVisibleButton.d.ts +2 -0
- package/dist/BackTo/ScrollVisibleButton.js +4 -2
- package/dist/Bubble/List/PureBubbleList.js +2 -0
- package/dist/Bubble/style.js +0 -1
- package/dist/ChatBootPage/ButtonTab.js +1 -0
- package/dist/ChatBootPage/ButtonTabGroup.js +1 -0
- package/dist/ChatBootPage/CaseReply.js +1 -0
- package/dist/ChatBootPage/Title.js +1 -0
- package/dist/ChatLayout/index.js +1 -0
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -0
- package/dist/Components/Button/IconButton/index.js +1 -0
- package/dist/Components/Button/SwitchButton/index.js +1 -0
- package/dist/Components/Button/ToggleButton/index.js +1 -0
- package/dist/Components/GradientText/index.js +1 -0
- package/dist/Components/LayoutHeader/index.js +2 -1
- package/dist/Components/Loading/Loading.js +2 -0
- package/dist/Components/Robot/index.js +1 -0
- package/dist/Components/SuggestionList/index.js +1 -0
- package/dist/Components/TextAnimate/index.js +1 -0
- package/dist/Components/TypingAnimation/index.js +2 -1
- package/dist/Components/VisualList/index.js +3 -0
- package/dist/Components/lotties/ThreeThinkingLottie/index.d.ts +68 -0
- package/dist/Components/lotties/ThreeThinkingLottie/index.js +151 -0
- package/dist/Components/lotties/ThreeThinkingLottie/three-thinking.json +130 -0
- package/dist/Components/lotties/index.d.ts +1 -0
- package/dist/Components/lotties/index.js +1 -0
- package/dist/History/index.js +1 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -0
- package/dist/MarkdownRenderer/MarkdownRenderer.js +1 -0
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +13 -3
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +19 -4
- package/dist/Plugins/chart/hooks/index.d.ts +2 -0
- package/dist/Plugins/chart/hooks/index.js +1 -0
- package/dist/Plugins/chart/hooks/useDetectTheme.d.ts +46 -0
- package/dist/Plugins/chart/hooks/useDetectTheme.js +222 -0
- package/dist/Schema/SchemaEditor/index.js +1 -0
- package/dist/Schema/SchemaForm/index.js +1 -0
- package/dist/TaskList/TaskList.js +21 -4
- package/dist/TaskList/components/TaskListItem.js +2 -1
- package/dist/TaskList/style.js +1 -1
- package/dist/ThoughtChainList/index.js +1 -0
- package/dist/ToolUseBar/index.js +7 -6
- package/dist/ToolUseBarThink/style.js +0 -7
- package/dist/WelcomeMessage/index.js +1 -0
- package/package.json +2 -2
package/dist/AILabel/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type AILabelStatus = 'default' | 'watermark' | 'emphasis';
|
|
|
16
16
|
* @extends React.HTMLAttributes<HTMLSpanElement>
|
|
17
17
|
*/
|
|
18
18
|
export interface AILabelProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
19
|
+
/** 自动化测试用根节点标识,未设置时默认与主题前缀一致 */
|
|
20
|
+
'data-testid'?: string;
|
|
19
21
|
/**
|
|
20
22
|
* 标签状态
|
|
21
23
|
* @description 控制标签的视觉样式,支持默认、水印和强调三种状态
|
package/dist/AILabel/index.js
CHANGED
|
@@ -185,14 +185,15 @@ import { prefixCls, useStyle } from "./style";
|
|
|
185
185
|
* - 使用 framer-motion 提供平滑的动画效果
|
|
186
186
|
* - 水印状态下,当 Tooltip 未打开时显示禁用图标
|
|
187
187
|
*/ var AILabelComponent = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
188
|
-
var status = props.status, offset = props.offset, tooltip = props.tooltip, className = props.className, style = props.style, rootStyle = props.rootStyle, children = props.children, restProps = _object_without_properties(props, [
|
|
188
|
+
var status = props.status, offset = props.offset, tooltip = props.tooltip, className = props.className, style = props.style, rootStyle = props.rootStyle, children = props.children, dataTestId = props['data-testid'], restProps = _object_without_properties(props, [
|
|
189
189
|
"status",
|
|
190
190
|
"offset",
|
|
191
191
|
"tooltip",
|
|
192
192
|
"className",
|
|
193
193
|
"style",
|
|
194
194
|
"rootStyle",
|
|
195
|
-
"children"
|
|
195
|
+
"children",
|
|
196
|
+
'data-testid'
|
|
196
197
|
]);
|
|
197
198
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
198
199
|
var baseCls = context === null || context === void 0 ? void 0 : context.getPrefixCls(prefixCls);
|
|
@@ -234,6 +235,7 @@ import { prefixCls, useStyle } from "./style";
|
|
|
234
235
|
ref: ref
|
|
235
236
|
}, restProps), {
|
|
236
237
|
className: badgeClassName,
|
|
238
|
+
"data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : baseCls,
|
|
237
239
|
style: rootStyle
|
|
238
240
|
}), children, /*#__PURE__*/ React.createElement(Tooltip, _object_spread_props(_object_spread({}, tooltip), {
|
|
239
241
|
onOpenChange: handleTooltipOpenChange
|
|
@@ -69,7 +69,6 @@ import RobotIcon from "../Components/Robot";
|
|
|
69
69
|
var icon = param.icon, _param_size = param.size, size = _param_size === void 0 ? 42 : _param_size, status = param.status, className = param.className, style = param.style;
|
|
70
70
|
return /*#__PURE__*/ React.createElement("div", {
|
|
71
71
|
className: classNames(className),
|
|
72
|
-
"data-testid": "robot",
|
|
73
72
|
style: /*#__PURE__*/ React.isValidElement(icon) ? _object_spread({
|
|
74
73
|
display: 'flex',
|
|
75
74
|
flexDirection: 'column',
|
|
@@ -282,6 +282,7 @@ export * from "./Robot";
|
|
|
282
282
|
var _obj;
|
|
283
283
|
return wrapSSR(/*#__PURE__*/ React.createElement(motion.div, {
|
|
284
284
|
className: classNames(baseCls, hashId, className, "".concat(baseCls, "-").concat(variant), (_obj = {}, _define_property(_obj, "".concat(baseCls, "-with-description"), description), _define_property(_obj, "".concat(baseCls, "-status-").concat(robotStatus), robotStatus), _obj)),
|
|
285
|
+
"data-testid": baseCls,
|
|
285
286
|
layout: "size",
|
|
286
287
|
transition: {
|
|
287
288
|
duration: 0.25,
|
|
@@ -245,6 +245,7 @@ var AgenticLayoutComponent = function AgenticLayoutComponent(param) {
|
|
|
245
245
|
]);
|
|
246
246
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
247
247
|
className: classNames(prefixCls, className, hashId),
|
|
248
|
+
"data-testid": prefixCls,
|
|
248
249
|
style: style
|
|
249
250
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
250
251
|
className: "".concat(prefixCls, "-body ").concat(hashId),
|
|
@@ -159,6 +159,7 @@ IconNode.displayName = 'IconNode';
|
|
|
159
159
|
var alertCls = classNames(prefixCls, className, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-").concat(type), !!type), _define_property(_obj, "".concat(prefixCls, "-with-description"), !!description), _obj), hashId);
|
|
160
160
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
161
161
|
className: alertCls,
|
|
162
|
+
"data-testid": prefixCls,
|
|
162
163
|
style: style
|
|
163
164
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
164
165
|
className: classNames("".concat(prefixCls, "-content"), hashId)
|
|
@@ -5,6 +5,8 @@ import { UseScrollVisibleProps } from './hooks/useScrollVisible';
|
|
|
5
5
|
* ScrollVisibleButton 组件属性
|
|
6
6
|
*/
|
|
7
7
|
export interface ScrollVisibleButtonProps extends Omit<React.DOMAttributes<HTMLButtonElement>, 'onClick'> {
|
|
8
|
+
/** 自动化测试用按钮标识,未设置时默认与主题前缀一致 */
|
|
9
|
+
'data-testid'?: string;
|
|
8
10
|
/** 自定义类名 */
|
|
9
11
|
className?: string;
|
|
10
12
|
/** 自定义样式 */
|
|
@@ -163,14 +163,15 @@ var EXIT_ANIMATION = {
|
|
|
163
163
|
var _ref = [
|
|
164
164
|
_0,
|
|
165
165
|
_1
|
|
166
|
-
], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), className = _ref2.className, style = _ref2.style, tmp = _ref2.shouldVisible, propsShouldVisible = tmp === void 0 ? DEFAULT_VISIBLE_THRESHOLD : tmp, target = _ref2.target, onClick = _ref2.onClick, tooltip = _ref2.tooltip, children = _ref2.children, rest = _object_without_properties(_ref2, [
|
|
166
|
+
], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), className = _ref2.className, style = _ref2.style, tmp = _ref2.shouldVisible, propsShouldVisible = tmp === void 0 ? DEFAULT_VISIBLE_THRESHOLD : tmp, target = _ref2.target, onClick = _ref2.onClick, tooltip = _ref2.tooltip, children = _ref2.children, dataTestId = _ref2['data-testid'], rest = _object_without_properties(_ref2, [
|
|
167
167
|
"className",
|
|
168
168
|
"style",
|
|
169
169
|
"shouldVisible",
|
|
170
170
|
"target",
|
|
171
171
|
"onClick",
|
|
172
172
|
"tooltip",
|
|
173
|
-
"children"
|
|
173
|
+
"children",
|
|
174
|
+
'data-testid'
|
|
174
175
|
]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
|
|
175
176
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
176
177
|
var baseCls = context === null || context === void 0 ? void 0 : context.getPrefixCls(prefixCls);
|
|
@@ -193,6 +194,7 @@ var EXIT_ANIMATION = {
|
|
|
193
194
|
var button = /*#__PURE__*/ React.createElement("button", _object_spread({
|
|
194
195
|
ref: internalRef,
|
|
195
196
|
className: classNames(baseCls, className, hashId),
|
|
197
|
+
"data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : baseCls,
|
|
196
198
|
style: style,
|
|
197
199
|
type: "button",
|
|
198
200
|
onClick: handleClick
|
|
@@ -203,6 +203,7 @@ export var PureBubbleList = /*#__PURE__*/ React.memo(function(props) {
|
|
|
203
203
|
if (isLoading) {
|
|
204
204
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
205
205
|
className: clsx(prefixClass, "".concat(prefixClass, "-loading"), className, hashId),
|
|
206
|
+
"data-testid": prefixClass,
|
|
206
207
|
ref: bubbleListRef,
|
|
207
208
|
style: {
|
|
208
209
|
padding: 24
|
|
@@ -213,6 +214,7 @@ export var PureBubbleList = /*#__PURE__*/ React.memo(function(props) {
|
|
|
213
214
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
214
215
|
className: clsx("".concat(prefixClass), className, hashId, (_obj = {}, _define_property(_obj, "".concat(prefixClass, "-readonly"), props.readonly), _define_property(_obj, "".concat(prefixClass, "-compact"), compact), _obj)),
|
|
215
216
|
"data-chat-list": bubbleList.length,
|
|
217
|
+
"data-testid": prefixClass,
|
|
216
218
|
style: style,
|
|
217
219
|
ref: bubbleListRef,
|
|
218
220
|
onScroll: onScroll,
|
package/dist/Bubble/style.js
CHANGED
|
@@ -42,6 +42,7 @@ var ButtonTabComponent = function ButtonTabComponent(param) {
|
|
|
42
42
|
return wrapSSR(/*#__PURE__*/ React.createElement("button", {
|
|
43
43
|
type: "button",
|
|
44
44
|
className: buttonClassName,
|
|
45
|
+
"data-testid": prefixCls,
|
|
45
46
|
onClick: handleClick,
|
|
46
47
|
onKeyDown: handleKeyDown,
|
|
47
48
|
tabIndex: 0
|
|
@@ -66,6 +66,7 @@ var ButtonTabGroupComponent = function ButtonTabGroupComponent(param) {
|
|
|
66
66
|
]);
|
|
67
67
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
68
68
|
className: "".concat(prefixCls, " ").concat(className || '', " ").concat(hashId),
|
|
69
|
+
"data-testid": prefixCls,
|
|
69
70
|
role: "group",
|
|
70
71
|
"aria-label": "Tab group"
|
|
71
72
|
}, items.map(function(item) {
|
|
@@ -74,6 +74,7 @@ var CaseReplyComponent = function CaseReplyComponent(param) {
|
|
|
74
74
|
}, []);
|
|
75
75
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
76
76
|
className: containerCls,
|
|
77
|
+
"data-testid": prefixCls,
|
|
77
78
|
style: style,
|
|
78
79
|
onClick: onClick,
|
|
79
80
|
onMouseEnter: handleMouseEnter,
|
|
@@ -15,6 +15,7 @@ var TitleComponent = function TitleComponent(param) {
|
|
|
15
15
|
var subtitleCls = classNames("".concat(prefixCls, "-subtitle"), hashId);
|
|
16
16
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
17
17
|
className: classNames(prefixCls, hashId, className),
|
|
18
|
+
"data-testid": prefixCls,
|
|
18
19
|
style: style
|
|
19
20
|
}, title && /*#__PURE__*/ React.createElement("div", {
|
|
20
21
|
className: mainCls
|
package/dist/ChatLayout/index.js
CHANGED
|
@@ -132,6 +132,7 @@ import { useStyle } from "./style";
|
|
|
132
132
|
var footerBackgroundClassName = clsx("".concat(prefixCls, "-footer-background"), classNames === null || classNames === void 0 ? void 0 : classNames.footerBackground, hashId);
|
|
133
133
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
134
134
|
className: rootClassName,
|
|
135
|
+
"data-testid": prefixCls,
|
|
135
136
|
style: _object_spread({}, styles === null || styles === void 0 ? void 0 : styles.root, style)
|
|
136
137
|
}, header && /*#__PURE__*/ React.createElement(LayoutHeader, header), /*#__PURE__*/ React.createElement("div", {
|
|
137
138
|
className: contentClassName,
|
|
@@ -26,6 +26,7 @@ export var IconButton = function IconButton(param) {
|
|
|
26
26
|
var _obj;
|
|
27
27
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
28
28
|
className: rootCls,
|
|
29
|
+
"data-testid": prefixCls,
|
|
29
30
|
style: style
|
|
30
31
|
}, /*#__PURE__*/ React.createElement(Tooltip, {
|
|
31
32
|
title: tooltip
|
|
@@ -24,6 +24,7 @@ export var ToggleButton = function ToggleButton(param) {
|
|
|
24
24
|
var _obj;
|
|
25
25
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
26
26
|
className: classNames(rootCls, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-active"), active), _define_property(_obj, "".concat(prefixCls, "-disabled"), disabled), _obj)),
|
|
27
|
+
"data-testid": prefixCls,
|
|
27
28
|
style: style
|
|
28
29
|
}, /*#__PURE__*/ React.createElement(ConfigProvider, {
|
|
29
30
|
wave: {
|
|
@@ -19,6 +19,7 @@ export function GradientText(param) {
|
|
|
19
19
|
};
|
|
20
20
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
21
21
|
className: classNames(prefixCls, hashId, className),
|
|
22
|
+
"data-testid": prefixCls,
|
|
22
23
|
style: style
|
|
23
24
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
24
25
|
className: classNames("".concat(prefixCls, "-text-content"), hashId),
|
|
@@ -131,7 +131,8 @@ import { useLayoutHeaderStyle } from "./style";
|
|
|
131
131
|
onShare === null || onShare === void 0 ? void 0 : onShare();
|
|
132
132
|
};
|
|
133
133
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
134
|
-
className: classNames(prefixCls, hashId, className)
|
|
134
|
+
className: classNames(prefixCls, hashId, className),
|
|
135
|
+
"data-testid": prefixCls
|
|
135
136
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
136
137
|
className: classNames("".concat(prefixCls, "-left"), hashId)
|
|
137
138
|
}, leftCollapsible && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
@@ -82,6 +82,7 @@ import { prefixCls, useStyle } from "./style";
|
|
|
82
82
|
var _obj;
|
|
83
83
|
var loadingElement = /*#__PURE__*/ React.createElement("div", {
|
|
84
84
|
className: classNames(baseCls, hashId, className, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-with-tip"), !!tip), _define_property(_obj, "".concat(baseCls, "-with-children"), isNestedPattern), _obj)),
|
|
85
|
+
"data-testid": baseCls,
|
|
85
86
|
style: _object_spread({
|
|
86
87
|
fontSize: mergedSize
|
|
87
88
|
}, styles === null || styles === void 0 ? void 0 : styles.root, style)
|
|
@@ -94,6 +95,7 @@ import { prefixCls, useStyle } from "./style";
|
|
|
94
95
|
if (isNestedPattern) {
|
|
95
96
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
96
97
|
className: classNames("".concat(baseCls, "-nested-pattern"), hashId, wrapperClassName, spinning && "".concat(baseCls, "-spinning")),
|
|
98
|
+
"data-testid": "".concat(baseCls, "-nested-pattern"),
|
|
97
99
|
style: styles === null || styles === void 0 ? void 0 : styles.wrapper
|
|
98
100
|
}, spinning ? loadingElement : null, /*#__PURE__*/ React.createElement("div", {
|
|
99
101
|
className: classNames("".concat(baseCls, "-container"), hashId)
|
|
@@ -72,6 +72,7 @@ export * from "./lotties/PeekLottie";
|
|
|
72
72
|
var icon = param.icon, _param_size = param.size, size = _param_size === void 0 ? 42 : _param_size, status = param.status, className = param.className, style = param.style;
|
|
73
73
|
return /*#__PURE__*/ React.createElement("div", {
|
|
74
74
|
className: classNames(className),
|
|
75
|
+
"data-testid": "robot",
|
|
75
76
|
style: /*#__PURE__*/ React.isValidElement(icon) ? _object_spread({
|
|
76
77
|
display: 'flex',
|
|
77
78
|
flexDirection: 'column',
|
|
@@ -260,6 +260,7 @@ export var SuggestionList = function SuggestionList(param) {
|
|
|
260
260
|
var rootCls = classNames(prefixCls, className, hashId, "".concat(prefixCls, "-").concat(layout), "".concat(prefixCls, "-").concat(type));
|
|
261
261
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
262
262
|
className: rootCls,
|
|
263
|
+
"data-testid": prefixCls,
|
|
263
264
|
style: style,
|
|
264
265
|
role: "group",
|
|
265
266
|
"aria-label": (locale === null || locale === void 0 ? void 0 : locale['suggestion.area']) || '追问区域'
|
|
@@ -229,7 +229,8 @@ var TypingAnimationBase = function TypingAnimationBase(_0) {
|
|
|
229
229
|
};
|
|
230
230
|
return wrapSSR(/*#__PURE__*/ React.createElement(MotionComponent, _object_spread({
|
|
231
231
|
ref: elementRef,
|
|
232
|
-
className: classNames(prefixCls, hashId, className)
|
|
232
|
+
className: classNames(prefixCls, hashId, className),
|
|
233
|
+
"data-testid": prefixCls
|
|
233
234
|
}, props), displayedText, shouldShowCursor && /*#__PURE__*/ React.createElement("span", {
|
|
234
235
|
className: classNames("".concat(prefixCls, "-cursor"), hashId, blinkCursor && "".concat(prefixCls, "-cursor-blinking"))
|
|
235
236
|
}, getCursorChar())));
|
|
@@ -250,6 +250,7 @@ import { useStyle } from "./style";
|
|
|
250
250
|
if (loading) {
|
|
251
251
|
return wrapSSR(/*#__PURE__*/ React.createElement("ul", {
|
|
252
252
|
className: classNames(prefixCls, "".concat(prefixCls, "-loading"), hashId, className),
|
|
253
|
+
"data-testid": "".concat(prefixCls, "-loading"),
|
|
253
254
|
style: style
|
|
254
255
|
}, loadingRender ? loadingRender() : /*#__PURE__*/ React.createElement("span", null, "加载中...")));
|
|
255
256
|
}
|
|
@@ -257,11 +258,13 @@ import { useStyle } from "./style";
|
|
|
257
258
|
if (displayList.length === 0) {
|
|
258
259
|
return wrapSSR(/*#__PURE__*/ React.createElement("ul", {
|
|
259
260
|
className: classNames(prefixCls, "".concat(prefixCls, "-empty"), hashId, className),
|
|
261
|
+
"data-testid": "".concat(prefixCls, "-empty"),
|
|
260
262
|
style: style
|
|
261
263
|
}, emptyRender ? emptyRender() : /*#__PURE__*/ React.createElement("span", null, "暂无数据")));
|
|
262
264
|
}
|
|
263
265
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
264
266
|
className: containerClassName,
|
|
267
|
+
"data-testid": prefixCls,
|
|
265
268
|
style: style
|
|
266
269
|
}, /*#__PURE__*/ React.createElement("ul", {
|
|
267
270
|
className: classNames(prefixCls, hashId)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ThreeThinkingLottieProps {
|
|
3
|
+
/**
|
|
4
|
+
* 是否自动播放动画
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
autoplay?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 是否循环播放动画
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 动画容器类名
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 动画容器样式
|
|
19
|
+
*/
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
/**
|
|
22
|
+
* 动画尺寸
|
|
23
|
+
* @default 32
|
|
24
|
+
*/
|
|
25
|
+
size?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 加载占位符
|
|
28
|
+
*/
|
|
29
|
+
fallback?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ThreeThinkingLottie 组件 - 支持按需加载的思考动画组件
|
|
33
|
+
*
|
|
34
|
+
* 该组件使用动态 import 实现 lottie JSON 文件的按需加载,
|
|
35
|
+
* 避免将动画数据打包进主包,减少首屏加载体积。
|
|
36
|
+
*
|
|
37
|
+
* @component
|
|
38
|
+
* @description 支持按需加载的 Lottie 思考动画组件
|
|
39
|
+
* @param {ThreeThinkingLottieProps} props - 组件属性
|
|
40
|
+
* @param {boolean} [props.autoplay=true] - 是否自动播放动画
|
|
41
|
+
* @param {boolean} [props.loop=true] - 是否循环播放动画
|
|
42
|
+
* @param {string} [props.className] - 动画容器类名
|
|
43
|
+
* @param {React.CSSProperties} [props.style] - 动画容器样式
|
|
44
|
+
* @param {number} [props.size=32] - 动画尺寸
|
|
45
|
+
* @param {React.ReactNode} [props.fallback] - 加载占位符
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* // 基础用法
|
|
50
|
+
* <ThreeThinkingLottie />
|
|
51
|
+
*
|
|
52
|
+
* // 自定义尺寸
|
|
53
|
+
* <ThreeThinkingLottie size={48} />
|
|
54
|
+
*
|
|
55
|
+
* // 自定义加载占位符
|
|
56
|
+
* <ThreeThinkingLottie fallback={<Spin />} />
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @returns {React.ReactElement} 渲染的 Lottie 思考动画组件
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* - 使用动态 import 按需加载 lottie JSON 文件
|
|
63
|
+
* - 减少首屏加载体积
|
|
64
|
+
* - 支持自定义加载占位符
|
|
65
|
+
* - 支持自定义尺寸和样式
|
|
66
|
+
*/
|
|
67
|
+
export declare const ThreeThinkingLottie: React.FC<ThreeThinkingLottieProps>;
|
|
68
|
+
export default ThreeThinkingLottie;
|
|
@@ -0,0 +1,151 @@
|
|
|
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 _define_property(obj, key, value) {
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
Object.defineProperty(obj, key, {
|
|
12
|
+
value: value,
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
obj[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
function _iterable_to_array_limit(arr, i) {
|
|
23
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
|
+
if (_i == null) return;
|
|
25
|
+
var _arr = [];
|
|
26
|
+
var _n = true;
|
|
27
|
+
var _d = false;
|
|
28
|
+
var _s, _e;
|
|
29
|
+
try {
|
|
30
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
31
|
+
_arr.push(_s.value);
|
|
32
|
+
if (i && _arr.length === i) break;
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
_d = true;
|
|
36
|
+
_e = err;
|
|
37
|
+
} finally{
|
|
38
|
+
try {
|
|
39
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
40
|
+
} finally{
|
|
41
|
+
if (_d) throw _e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return _arr;
|
|
45
|
+
}
|
|
46
|
+
function _non_iterable_rest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
49
|
+
function _object_spread(target) {
|
|
50
|
+
for(var i = 1; i < arguments.length; i++){
|
|
51
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
52
|
+
var ownKeys = Object.keys(source);
|
|
53
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
54
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
55
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
ownKeys.forEach(function(key) {
|
|
59
|
+
_define_property(target, key, source[key]);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return target;
|
|
63
|
+
}
|
|
64
|
+
function _sliced_to_array(arr, i) {
|
|
65
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
66
|
+
}
|
|
67
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
68
|
+
if (!o) return;
|
|
69
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
70
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
71
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
72
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
73
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
74
|
+
}
|
|
75
|
+
import Lottie from "lottie-react";
|
|
76
|
+
import React, { useEffect, useState } from "react";
|
|
77
|
+
/**
|
|
78
|
+
* ThreeThinkingLottie 组件 - 支持按需加载的思考动画组件
|
|
79
|
+
*
|
|
80
|
+
* 该组件使用动态 import 实现 lottie JSON 文件的按需加载,
|
|
81
|
+
* 避免将动画数据打包进主包,减少首屏加载体积。
|
|
82
|
+
*
|
|
83
|
+
* @component
|
|
84
|
+
* @description 支持按需加载的 Lottie 思考动画组件
|
|
85
|
+
* @param {ThreeThinkingLottieProps} props - 组件属性
|
|
86
|
+
* @param {boolean} [props.autoplay=true] - 是否自动播放动画
|
|
87
|
+
* @param {boolean} [props.loop=true] - 是否循环播放动画
|
|
88
|
+
* @param {string} [props.className] - 动画容器类名
|
|
89
|
+
* @param {React.CSSProperties} [props.style] - 动画容器样式
|
|
90
|
+
* @param {number} [props.size=32] - 动画尺寸
|
|
91
|
+
* @param {React.ReactNode} [props.fallback] - 加载占位符
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* // 基础用法
|
|
96
|
+
* <ThreeThinkingLottie />
|
|
97
|
+
*
|
|
98
|
+
* // 自定义尺寸
|
|
99
|
+
* <ThreeThinkingLottie size={48} />
|
|
100
|
+
*
|
|
101
|
+
* // 自定义加载占位符
|
|
102
|
+
* <ThreeThinkingLottie fallback={<Spin />} />
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @returns {React.ReactElement} 渲染的 Lottie 思考动画组件
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* - 使用动态 import 按需加载 lottie JSON 文件
|
|
109
|
+
* - 减少首屏加载体积
|
|
110
|
+
* - 支持自定义加载占位符
|
|
111
|
+
* - 支持自定义尺寸和样式
|
|
112
|
+
*/ export var ThreeThinkingLottie = function ThreeThinkingLottie(param) {
|
|
113
|
+
var _param_autoplay = param.autoplay, autoplay = _param_autoplay === void 0 ? true : _param_autoplay, _param_loop = param.loop, loop = _param_loop === void 0 ? true : _param_loop, className = param.className, style = param.style, _param_size = param.size, size = _param_size === void 0 ? 32 : _param_size, fallback = param.fallback;
|
|
114
|
+
var _useState = _sliced_to_array(useState(null), 2), animationData = _useState[0], setAnimationData = _useState[1];
|
|
115
|
+
useEffect(function() {
|
|
116
|
+
// 动态加载 lottie JSON 文件
|
|
117
|
+
import("./three-thinking.json").then(function(data) {
|
|
118
|
+
setAnimationData(data.default || data);
|
|
119
|
+
}).catch(function(error) {
|
|
120
|
+
console.error('Failed to load ThreeThinkingLottie animation:', error);
|
|
121
|
+
});
|
|
122
|
+
}, []);
|
|
123
|
+
var containerStyle = _object_spread({
|
|
124
|
+
width: size,
|
|
125
|
+
height: size,
|
|
126
|
+
display: 'flex',
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
alignItems: 'center'
|
|
129
|
+
}, style);
|
|
130
|
+
// 默认占位符
|
|
131
|
+
var defaultFallback = /*#__PURE__*/ React.createElement("div", {
|
|
132
|
+
style: containerStyle,
|
|
133
|
+
className: className
|
|
134
|
+
}, /*#__PURE__*/ React.createElement("span", {
|
|
135
|
+
style: {
|
|
136
|
+
opacity: 0.3
|
|
137
|
+
}
|
|
138
|
+
}, "..."));
|
|
139
|
+
if (!animationData) {
|
|
140
|
+
return fallback !== undefined ? /*#__PURE__*/ React.createElement(React.Fragment, null, fallback) : defaultFallback;
|
|
141
|
+
}
|
|
142
|
+
return /*#__PURE__*/ React.createElement(Lottie, {
|
|
143
|
+
style: containerStyle,
|
|
144
|
+
className: className,
|
|
145
|
+
"aria-hidden": "true",
|
|
146
|
+
animationData: animationData,
|
|
147
|
+
loop: loop,
|
|
148
|
+
autoplay: autoplay
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
export default ThreeThinkingLottie;
|