@axis-ds/agentic-ui 1.5.0 → 1.5.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.
- package/README.md +1 -1
- package/dist/streaming-text/index.js +28 -26
- package/dist/streaming-text/index.mjs +28 -26
- package/package.json +62 -4
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ AgentAvatar, ApprovalCard, AttachmentCard, CodeBlock, ContextPanel, DiffViewer,
|
|
|
94
94
|
|
|
95
95
|
## 문서
|
|
96
96
|
|
|
97
|
-
자세한 사용법은 [AXIS Design System 문서](https://axis.
|
|
97
|
+
자세한 사용법은 [AXIS Design System 문서](https://axis-design-system.pages.dev)를 참고하세요.
|
|
98
98
|
|
|
99
99
|
## 라이선스
|
|
100
100
|
|
|
@@ -45,36 +45,38 @@ function StreamingText({
|
|
|
45
45
|
"aria-label": ariaLabel,
|
|
46
46
|
className
|
|
47
47
|
}) {
|
|
48
|
-
const
|
|
49
|
-
const [
|
|
50
|
-
const
|
|
48
|
+
const chars = React.useMemo(() => Array.from(text), [text]);
|
|
49
|
+
const [visibleLength, setVisibleLength] = React.useState(0);
|
|
50
|
+
const [prevText, setPrevText] = React.useState(text);
|
|
51
|
+
if (text !== prevText) {
|
|
52
|
+
setPrevText(text);
|
|
53
|
+
if (!text.startsWith(prevText)) setVisibleLength(0);
|
|
54
|
+
}
|
|
55
|
+
const targetLength = chars.length;
|
|
56
|
+
const isStreaming = !isComplete && visibleLength < targetLength;
|
|
57
|
+
const onCompleteRef = React.useRef(onComplete);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
onCompleteRef.current = onComplete;
|
|
60
|
+
});
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (!isStreaming) return;
|
|
63
|
+
const interval = setInterval(() => {
|
|
64
|
+
setVisibleLength((n) => Math.min(n + 1, targetLength));
|
|
65
|
+
}, speed);
|
|
66
|
+
return () => clearInterval(interval);
|
|
67
|
+
}, [isStreaming, targetLength, speed]);
|
|
68
|
+
const wasStreamingRef = React.useRef(false);
|
|
51
69
|
React.useEffect(() => {
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
setIsStreaming(false);
|
|
70
|
+
if (isStreaming) {
|
|
71
|
+
wasStreamingRef.current = true;
|
|
55
72
|
return;
|
|
56
73
|
}
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
setIsStreaming(true);
|
|
61
|
-
const interval = setInterval(() => {
|
|
62
|
-
if (charIndex < newText.length) {
|
|
63
|
-
setDisplayedText((prev) => prev + newText[charIndex]);
|
|
64
|
-
charIndex++;
|
|
65
|
-
} else {
|
|
66
|
-
clearInterval(interval);
|
|
67
|
-
setIsStreaming(false);
|
|
68
|
-
if (onComplete) onComplete();
|
|
69
|
-
}
|
|
70
|
-
}, speed);
|
|
71
|
-
prevTextRef.current = text;
|
|
72
|
-
return () => clearInterval(interval);
|
|
73
|
-
} else if (text !== prevTextRef.current) {
|
|
74
|
-
setDisplayedText("");
|
|
75
|
-
prevTextRef.current = "";
|
|
74
|
+
if (wasStreamingRef.current) {
|
|
75
|
+
wasStreamingRef.current = false;
|
|
76
|
+
if (!isComplete) onCompleteRef.current?.();
|
|
76
77
|
}
|
|
77
|
-
}, [
|
|
78
|
+
}, [isStreaming, isComplete]);
|
|
79
|
+
const displayedText = isComplete ? text : chars.slice(0, visibleLength).join("");
|
|
78
80
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
79
81
|
"div",
|
|
80
82
|
{
|
|
@@ -12,36 +12,38 @@ function StreamingText({
|
|
|
12
12
|
"aria-label": ariaLabel,
|
|
13
13
|
className
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
const [
|
|
17
|
-
const
|
|
15
|
+
const chars = React.useMemo(() => Array.from(text), [text]);
|
|
16
|
+
const [visibleLength, setVisibleLength] = React.useState(0);
|
|
17
|
+
const [prevText, setPrevText] = React.useState(text);
|
|
18
|
+
if (text !== prevText) {
|
|
19
|
+
setPrevText(text);
|
|
20
|
+
if (!text.startsWith(prevText)) setVisibleLength(0);
|
|
21
|
+
}
|
|
22
|
+
const targetLength = chars.length;
|
|
23
|
+
const isStreaming = !isComplete && visibleLength < targetLength;
|
|
24
|
+
const onCompleteRef = React.useRef(onComplete);
|
|
18
25
|
React.useEffect(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
onCompleteRef.current = onComplete;
|
|
27
|
+
});
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (!isStreaming) return;
|
|
30
|
+
const interval = setInterval(() => {
|
|
31
|
+
setVisibleLength((n) => Math.min(n + 1, targetLength));
|
|
32
|
+
}, speed);
|
|
33
|
+
return () => clearInterval(interval);
|
|
34
|
+
}, [isStreaming, targetLength, speed]);
|
|
35
|
+
const wasStreamingRef = React.useRef(false);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
if (isStreaming) {
|
|
38
|
+
wasStreamingRef.current = true;
|
|
22
39
|
return;
|
|
23
40
|
}
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
setIsStreaming(true);
|
|
28
|
-
const interval = setInterval(() => {
|
|
29
|
-
if (charIndex < newText.length) {
|
|
30
|
-
setDisplayedText((prev) => prev + newText[charIndex]);
|
|
31
|
-
charIndex++;
|
|
32
|
-
} else {
|
|
33
|
-
clearInterval(interval);
|
|
34
|
-
setIsStreaming(false);
|
|
35
|
-
if (onComplete) onComplete();
|
|
36
|
-
}
|
|
37
|
-
}, speed);
|
|
38
|
-
prevTextRef.current = text;
|
|
39
|
-
return () => clearInterval(interval);
|
|
40
|
-
} else if (text !== prevTextRef.current) {
|
|
41
|
-
setDisplayedText("");
|
|
42
|
-
prevTextRef.current = "";
|
|
41
|
+
if (wasStreamingRef.current) {
|
|
42
|
+
wasStreamingRef.current = false;
|
|
43
|
+
if (!isComplete) onCompleteRef.current?.();
|
|
43
44
|
}
|
|
44
|
-
}, [
|
|
45
|
+
}, [isStreaming, isComplete]);
|
|
46
|
+
const displayedText = isComplete ? text : chars.slice(0, visibleLength).join("");
|
|
45
47
|
return /* @__PURE__ */ jsxs(
|
|
46
48
|
"div",
|
|
47
49
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axis-ds/agentic-ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "AXIS Design System - Agentic UI Components for AI/LLM Applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -103,6 +103,64 @@
|
|
|
103
103
|
},
|
|
104
104
|
"./tailwind.css": "./tailwind.css"
|
|
105
105
|
},
|
|
106
|
+
"typesVersions": {
|
|
107
|
+
"*": {
|
|
108
|
+
"run-progress": [
|
|
109
|
+
"./dist/run-progress/index.d.ts"
|
|
110
|
+
],
|
|
111
|
+
"approval-card": [
|
|
112
|
+
"./dist/approval-card/index.d.ts"
|
|
113
|
+
],
|
|
114
|
+
"streaming-text": [
|
|
115
|
+
"./dist/streaming-text/index.d.ts"
|
|
116
|
+
],
|
|
117
|
+
"tool-call-card": [
|
|
118
|
+
"./dist/tool-call-card/index.d.ts"
|
|
119
|
+
],
|
|
120
|
+
"message-bubble": [
|
|
121
|
+
"./dist/message-bubble/index.d.ts"
|
|
122
|
+
],
|
|
123
|
+
"feedback-buttons": [
|
|
124
|
+
"./dist/feedback-buttons/index.d.ts"
|
|
125
|
+
],
|
|
126
|
+
"code-block": [
|
|
127
|
+
"./dist/code-block/index.d.ts"
|
|
128
|
+
],
|
|
129
|
+
"diff-viewer": [
|
|
130
|
+
"./dist/diff-viewer/index.d.ts"
|
|
131
|
+
],
|
|
132
|
+
"plan-card": [
|
|
133
|
+
"./dist/plan-card/index.d.ts"
|
|
134
|
+
],
|
|
135
|
+
"context-panel": [
|
|
136
|
+
"./dist/context-panel/index.d.ts"
|
|
137
|
+
],
|
|
138
|
+
"token-usage-indicator": [
|
|
139
|
+
"./dist/token-usage-indicator/index.d.ts"
|
|
140
|
+
],
|
|
141
|
+
"attachment-card": [
|
|
142
|
+
"./dist/attachment-card/index.d.ts"
|
|
143
|
+
],
|
|
144
|
+
"agent-avatar": [
|
|
145
|
+
"./dist/agent-avatar/index.d.ts"
|
|
146
|
+
],
|
|
147
|
+
"recovery-banner": [
|
|
148
|
+
"./dist/recovery-banner/index.d.ts"
|
|
149
|
+
],
|
|
150
|
+
"source-panel": [
|
|
151
|
+
"./dist/source-panel/index.d.ts"
|
|
152
|
+
],
|
|
153
|
+
"step-timeline": [
|
|
154
|
+
"./dist/step-timeline/index.d.ts"
|
|
155
|
+
],
|
|
156
|
+
"surface-renderer": [
|
|
157
|
+
"./dist/surface-renderer/index.d.ts"
|
|
158
|
+
],
|
|
159
|
+
"thinking-indicator": [
|
|
160
|
+
"./dist/thinking-indicator/index.d.ts"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
},
|
|
106
164
|
"sideEffects": false,
|
|
107
165
|
"files": [
|
|
108
166
|
"dist",
|
|
@@ -120,8 +178,8 @@
|
|
|
120
178
|
"clsx": "^2.1.0",
|
|
121
179
|
"framer-motion": "^11.0.0",
|
|
122
180
|
"tailwind-merge": "^2.5.0",
|
|
123
|
-
"@axis-ds/tokens": "1.5.
|
|
124
|
-
"@axis-ds/ui-react": "1.5.
|
|
181
|
+
"@axis-ds/tokens": "1.5.1",
|
|
182
|
+
"@axis-ds/ui-react": "1.5.1"
|
|
125
183
|
},
|
|
126
184
|
"devDependencies": {
|
|
127
185
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -153,7 +211,7 @@
|
|
|
153
211
|
"url": "https://github.com/IDEA-on-Action/AXIS-Design-System.git",
|
|
154
212
|
"directory": "packages/axis-agentic-ui"
|
|
155
213
|
},
|
|
156
|
-
"homepage": "https://axis.
|
|
214
|
+
"homepage": "https://axis-design-system.pages.dev",
|
|
157
215
|
"scripts": {
|
|
158
216
|
"build": "tsup && node scripts/postbuild.mjs",
|
|
159
217
|
"dev": "tsup --watch --onSuccess \"node scripts/postbuild.mjs\"",
|