@ant-design/agentic-ui 2.0.22 → 2.0.23
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/Components/GradientText/index.d.ts +2 -1
- package/dist/Components/GradientText/index.js +3 -2
- package/dist/Components/GradientText/style.js +3 -8
- package/dist/Components/TextAnimate/index.d.ts +1 -0
- package/dist/Components/TextAnimate/index.js +27 -16
- package/dist/Components/TypingAnimation/index.d.ts +1 -1
- package/dist/Components/TypingAnimation/index.js +9 -9
- package/dist/MarkdownEditor/editor/components/LazyElement/index.js +36 -4
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +4 -0
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +245 -344
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +74 -56
- package/dist/MarkdownEditor/editor/store.d.ts +36 -0
- package/dist/MarkdownEditor/editor/store.js +208 -76
- package/dist/Schema/SchemaRenderer/index.js +80 -55
- package/dist/Utils/proxySandbox/ProxySandbox.d.ts +32 -0
- package/dist/Utils/proxySandbox/ProxySandbox.js +176 -128
- package/dist/WelcomeMessage/index.d.ts +2 -2
- package/dist/WelcomeMessage/index.js +8 -5
- package/dist/WelcomeMessage/style.js +0 -1
- package/package.json +1 -1
|
@@ -4,5 +4,6 @@ export interface GradientTextProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
colors?: string[];
|
|
6
6
|
animationSpeed?: number;
|
|
7
|
+
style?: React.CSSProperties;
|
|
7
8
|
}
|
|
8
|
-
export declare function GradientText({ children, className, colors, animationSpeed, }: GradientTextProps): React.JSX.Element;
|
|
9
|
+
export declare function GradientText({ children, className, colors, animationSpeed, style, }: GradientTextProps): React.JSX.Element;
|
|
@@ -7,7 +7,8 @@ function GradientText({
|
|
|
7
7
|
children,
|
|
8
8
|
className = "",
|
|
9
9
|
colors = ["#40ffaa", "#4079ff", "#40ffaa", "#4079ff", "#40ffaa"],
|
|
10
|
-
animationSpeed = 8
|
|
10
|
+
animationSpeed = 8,
|
|
11
|
+
style
|
|
11
12
|
}) {
|
|
12
13
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
13
14
|
const prefixCls = getPrefixCls("gradient-text");
|
|
@@ -17,7 +18,7 @@ function GradientText({
|
|
|
17
18
|
animationDuration: `${animationSpeed}s`
|
|
18
19
|
};
|
|
19
20
|
return wrapSSR(
|
|
20
|
-
/* @__PURE__ */ React.createElement("div", { className: classNames(prefixCls, hashId, className) }, /* @__PURE__ */ React.createElement(
|
|
21
|
+
/* @__PURE__ */ React.createElement("div", { className: classNames(prefixCls, hashId, className), style }, /* @__PURE__ */ React.createElement(
|
|
21
22
|
"div",
|
|
22
23
|
{
|
|
23
24
|
className: classNames(`${prefixCls}-text-content`, hashId),
|
|
@@ -25,13 +25,10 @@ import {
|
|
|
25
25
|
} from "../../Hooks/useStyle";
|
|
26
26
|
var animateGradientText = new Keyframes("animateGradientText", {
|
|
27
27
|
"0%": {
|
|
28
|
-
backgroundPosition: "
|
|
29
|
-
},
|
|
30
|
-
"50%": {
|
|
31
|
-
backgroundPosition: "100% 50%"
|
|
28
|
+
backgroundPosition: "100%"
|
|
32
29
|
},
|
|
33
30
|
"100%": {
|
|
34
|
-
backgroundPosition: "
|
|
31
|
+
backgroundPosition: "-100%"
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
var genStyle = (token) => {
|
|
@@ -45,14 +42,12 @@ var genStyle = (token) => {
|
|
|
45
42
|
alignItems: "center",
|
|
46
43
|
justifyContent: "center",
|
|
47
44
|
fontWeight: 500,
|
|
48
|
-
backdropFilter: "blur(10px)",
|
|
49
|
-
transition: "box-shadow 0.5s ease-out",
|
|
50
45
|
overflow: "hidden",
|
|
51
46
|
["&-text-content"]: {
|
|
52
47
|
display: "inline-block",
|
|
53
48
|
position: "relative",
|
|
54
49
|
zIndex: 2,
|
|
55
|
-
backgroundSize: "
|
|
50
|
+
backgroundSize: "200% 100%",
|
|
56
51
|
backgroundClip: "text",
|
|
57
52
|
WebkitBackgroundClip: "text",
|
|
58
53
|
color: "transparent",
|
|
@@ -52,5 +52,6 @@ export interface TextAnimateProps extends MotionProps {
|
|
|
52
52
|
*/
|
|
53
53
|
accessible?: boolean;
|
|
54
54
|
}
|
|
55
|
+
export declare const resolveSegments: (children: React.ReactNode, by: AnimationType) => React.ReactNode[];
|
|
55
56
|
export declare const TextAnimate: React.MemoExoticComponent<({ children, delay, duration, variants, className, segmentClassName, as: Component, startOnView, once, by, animation, accessible, ...props }: TextAnimateProps) => React.JSX.Element>;
|
|
56
57
|
export {};
|
|
@@ -34,7 +34,7 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
import { ConfigProvider } from "antd";
|
|
35
35
|
import classNames from "classnames";
|
|
36
36
|
import { AnimatePresence, motion } from "framer-motion";
|
|
37
|
-
import { isString } from "lodash";
|
|
37
|
+
import { isNumber, isObject, isString } from "lodash";
|
|
38
38
|
import toArray from "rc-util/lib/Children/toArray";
|
|
39
39
|
import React, { memo, useContext } from "react";
|
|
40
40
|
import { useTextAnimateStyle } from "./style";
|
|
@@ -266,19 +266,29 @@ var defaultItemAnimationVariants = {
|
|
|
266
266
|
}
|
|
267
267
|
};
|
|
268
268
|
var resolveSegments = (children, by) => {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
269
|
+
const result = [];
|
|
270
|
+
toArray(children).forEach((item) => {
|
|
271
|
+
if (isString(item) || isNumber(item)) {
|
|
272
|
+
const itemString = item.toString();
|
|
273
|
+
switch (by) {
|
|
274
|
+
case "word":
|
|
275
|
+
result.push(...itemString.split(/(\s+)/));
|
|
276
|
+
break;
|
|
277
|
+
case "character":
|
|
278
|
+
result.push(...itemString.split(""));
|
|
279
|
+
break;
|
|
280
|
+
case "line":
|
|
281
|
+
result.push(...itemString.split("\n"));
|
|
282
|
+
break;
|
|
283
|
+
case "text":
|
|
284
|
+
default:
|
|
285
|
+
result.push(itemString);
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
result.push(item);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
return result;
|
|
282
292
|
};
|
|
283
293
|
var TextAnimateBase = (_a) => {
|
|
284
294
|
var _b = _a, {
|
|
@@ -367,7 +377,7 @@ var TextAnimateBase = (_a) => {
|
|
|
367
377
|
segments.map((segment, i) => /* @__PURE__ */ React.createElement(
|
|
368
378
|
motion.span,
|
|
369
379
|
{
|
|
370
|
-
key: `${by}-${
|
|
380
|
+
key: `${by}-${isObject(segment) ? segment.key : segment}-${i}`,
|
|
371
381
|
variants: finalVariants.item,
|
|
372
382
|
custom: i * staggerTimings[by],
|
|
373
383
|
className: classNames(
|
|
@@ -384,5 +394,6 @@ var TextAnimateBase = (_a) => {
|
|
|
384
394
|
};
|
|
385
395
|
var TextAnimate = memo(TextAnimateBase);
|
|
386
396
|
export {
|
|
387
|
-
TextAnimate
|
|
397
|
+
TextAnimate,
|
|
398
|
+
resolveSegments
|
|
388
399
|
};
|
|
@@ -31,7 +31,9 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
import { ConfigProvider } from "antd";
|
|
32
32
|
import classNames from "classnames";
|
|
33
33
|
import { motion, useInView } from "framer-motion";
|
|
34
|
+
import { isString } from "lodash";
|
|
34
35
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
36
|
+
import { resolveSegments } from "../TextAnimate";
|
|
35
37
|
import { useTypingAnimationStyle } from "./style";
|
|
36
38
|
function TypingAnimation(_a) {
|
|
37
39
|
var _b = _a, {
|
|
@@ -71,7 +73,7 @@ function TypingAnimation(_a) {
|
|
|
71
73
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
72
74
|
const prefixCls = getPrefixCls("typing-animation");
|
|
73
75
|
const { wrapSSR, hashId } = useTypingAnimationStyle(prefixCls);
|
|
74
|
-
const [displayedText, setDisplayedText] = useState(
|
|
76
|
+
const [displayedText, setDisplayedText] = useState([]);
|
|
75
77
|
const [currentWordIndex, setCurrentWordIndex] = useState(0);
|
|
76
78
|
const [currentCharIndex, setCurrentCharIndex] = useState(0);
|
|
77
79
|
const [phase, setPhase] = useState("typing");
|
|
@@ -81,7 +83,7 @@ function TypingAnimation(_a) {
|
|
|
81
83
|
once: true
|
|
82
84
|
});
|
|
83
85
|
const wordsToAnimate = useMemo(
|
|
84
|
-
() => words || (children
|
|
86
|
+
() => words || [resolveSegments(children, "character")],
|
|
85
87
|
[words, children]
|
|
86
88
|
);
|
|
87
89
|
const hasMultipleWords = wordsToAnimate.length > 1;
|
|
@@ -91,14 +93,14 @@ function TypingAnimation(_a) {
|
|
|
91
93
|
useEffect(() => {
|
|
92
94
|
if (!shouldStart || wordsToAnimate.length === 0)
|
|
93
95
|
return;
|
|
94
|
-
const timeoutDelay = delay > 0 && displayedText ===
|
|
96
|
+
const timeoutDelay = delay > 0 && displayedText.length === 0 ? delay : phase === "typing" ? typingSpeed : phase === "deleting" ? deletingSpeed : pauseDelay;
|
|
95
97
|
const timeout = setTimeout(() => {
|
|
96
98
|
const currentWord = wordsToAnimate[currentWordIndex] || "";
|
|
97
|
-
const graphemes = Array.from(currentWord);
|
|
99
|
+
const graphemes = isString(currentWord) ? Array.from(currentWord) : currentWord;
|
|
98
100
|
switch (phase) {
|
|
99
101
|
case "typing":
|
|
100
102
|
if (currentCharIndex < graphemes.length) {
|
|
101
|
-
setDisplayedText(graphemes.slice(0, currentCharIndex + 1)
|
|
103
|
+
setDisplayedText(graphemes.slice(0, currentCharIndex + 1));
|
|
102
104
|
setCurrentCharIndex(currentCharIndex + 1);
|
|
103
105
|
} else {
|
|
104
106
|
if (hasMultipleWords || loop) {
|
|
@@ -114,7 +116,7 @@ function TypingAnimation(_a) {
|
|
|
114
116
|
break;
|
|
115
117
|
case "deleting":
|
|
116
118
|
if (currentCharIndex > 0) {
|
|
117
|
-
setDisplayedText(graphemes.slice(0, currentCharIndex - 1)
|
|
119
|
+
setDisplayedText(graphemes.slice(0, currentCharIndex - 1));
|
|
118
120
|
setCurrentCharIndex(currentCharIndex - 1);
|
|
119
121
|
} else {
|
|
120
122
|
const nextIndex = (currentWordIndex + 1) % wordsToAnimate.length;
|
|
@@ -139,9 +141,7 @@ function TypingAnimation(_a) {
|
|
|
139
141
|
pauseDelay,
|
|
140
142
|
delay
|
|
141
143
|
]);
|
|
142
|
-
const currentWordGraphemes = Array.from(
|
|
143
|
-
wordsToAnimate[currentWordIndex] || ""
|
|
144
|
-
);
|
|
144
|
+
const currentWordGraphemes = isString(wordsToAnimate[currentWordIndex]) ? Array.from(wordsToAnimate[currentWordIndex]) : [wordsToAnimate[currentWordIndex]];
|
|
145
145
|
const isComplete = !loop && currentWordIndex === wordsToAnimate.length - 1 && currentCharIndex >= currentWordGraphemes.length && phase !== "deleting";
|
|
146
146
|
const shouldShowCursor = showCursor && !isComplete && (hasMultipleWords || loop || currentCharIndex < currentWordGraphemes.length);
|
|
147
147
|
const getCursorChar = () => {
|
|
@@ -29,18 +29,28 @@ var LazyElement = ({
|
|
|
29
29
|
const [isVisible, setIsVisible] = useState(false);
|
|
30
30
|
const [hasRendered, setHasRendered] = useState(false);
|
|
31
31
|
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
32
|
+
const observerRef = useRef(null);
|
|
32
33
|
useEffect(() => {
|
|
33
34
|
const container = containerRef.current;
|
|
34
35
|
if (!container)
|
|
35
36
|
return;
|
|
37
|
+
if (hasRendered)
|
|
38
|
+
return;
|
|
39
|
+
if (observerRef.current) {
|
|
40
|
+
observerRef.current.disconnect();
|
|
41
|
+
observerRef.current = null;
|
|
42
|
+
}
|
|
36
43
|
const observer = new IntersectionObserver(
|
|
37
44
|
(entries) => {
|
|
38
45
|
entries.forEach((entry) => {
|
|
39
46
|
setIsIntersecting(entry.isIntersecting);
|
|
40
|
-
if (entry.isIntersecting) {
|
|
47
|
+
if (entry.isIntersecting && !hasRendered) {
|
|
41
48
|
setIsVisible(true);
|
|
42
49
|
setHasRendered(true);
|
|
43
|
-
|
|
50
|
+
if (observerRef.current) {
|
|
51
|
+
observerRef.current.disconnect();
|
|
52
|
+
observerRef.current = null;
|
|
53
|
+
}
|
|
44
54
|
}
|
|
45
55
|
});
|
|
46
56
|
},
|
|
@@ -49,11 +59,33 @@ var LazyElement = ({
|
|
|
49
59
|
threshold: 0
|
|
50
60
|
}
|
|
51
61
|
);
|
|
62
|
+
observerRef.current = observer;
|
|
52
63
|
observer.observe(container);
|
|
64
|
+
const timeoutId = setTimeout(() => {
|
|
65
|
+
const rect = container.getBoundingClientRect();
|
|
66
|
+
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
67
|
+
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
68
|
+
if (!hasRendered && (rect.height > 0 || rect.width > 0) && windowHeight > 0 && windowWidth > 0) {
|
|
69
|
+
const margin = parseInt(rootMargin) || 200;
|
|
70
|
+
const isInViewport = rect.top < windowHeight + margin && rect.bottom > -margin && rect.left < windowWidth + margin && rect.right > -margin;
|
|
71
|
+
if (isInViewport) {
|
|
72
|
+
setIsVisible(true);
|
|
73
|
+
setHasRendered(true);
|
|
74
|
+
if (observerRef.current) {
|
|
75
|
+
observerRef.current.disconnect();
|
|
76
|
+
observerRef.current = null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, 100);
|
|
53
81
|
return () => {
|
|
54
|
-
|
|
82
|
+
clearTimeout(timeoutId);
|
|
83
|
+
if (observerRef.current) {
|
|
84
|
+
observerRef.current.disconnect();
|
|
85
|
+
observerRef.current = null;
|
|
86
|
+
}
|
|
55
87
|
};
|
|
56
|
-
}, [rootMargin]);
|
|
88
|
+
}, [rootMargin, hasRendered]);
|
|
57
89
|
if (hasRendered || isVisible) {
|
|
58
90
|
return /* @__PURE__ */ React.createElement("div", { ref: containerRef }, children);
|
|
59
91
|
}
|