@tbox.cn/app-agent-ui-kit 1.0.0-alpha.1 → 1.0.0-alpha.11
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 +56 -3
- package/package.json +22 -7
- package/src/ChatPage.tsx +115 -20
- package/src/card/action-list-pending.test.tsx +91 -0
- package/src/card/define-card.test.ts +25 -0
- package/src/card/define-card.ts +47 -0
- package/src/card/primitives.test.tsx +157 -0
- package/src/card/primitives.tsx +717 -0
- package/src/card/use-card-actions.ts +86 -0
- package/src/card/view-card-inline.test.tsx +42 -0
- package/src/card/view-card.test.tsx +79 -0
- package/src/card/view-card.tsx +250 -0
- package/src/chat-config.test.ts +35 -71
- package/src/chat-config.ts +29 -7
- package/src/components/ActionBar/DebugButton.test.tsx +3 -0
- package/src/components/ActionBar/DebugButton.tsx +5 -10
- package/src/components/ActionBar/index.tsx +13 -14
- package/src/components/BottomSheet/index.test.tsx +97 -0
- package/src/components/BottomSheet/index.tsx +49 -0
- package/src/components/ChatHeader/index.tsx +19 -17
- package/src/components/ChatInput/index.test.tsx +2 -2
- package/src/components/ChatInput/index.tsx +44 -33
- package/src/components/ChatInput/voice/VoicePressField.tsx +12 -3
- package/src/components/ChatInput/voice/VoiceRecordingOverlay.tsx +9 -9
- package/src/components/ChatInput/voice/useVoicePress.ts +1 -1
- package/src/components/HistoryEntry/index.tsx +4 -4
- package/src/components/MediaList/index.tsx +42 -28
- package/src/components/MessageBubble/index.tsx +59 -28
- package/src/components/PullDownIndicator/index.tsx +3 -4
- package/src/components/QuickCommands/index.test.tsx +3 -1
- package/src/components/QuickCommands/index.tsx +33 -10
- package/src/components/ReasoningBlock/index.tsx +14 -9
- package/src/components/ScrollToBottomButton/index.tsx +7 -5
- package/src/components/ToolCallBlock/index.tsx +58 -38
- package/src/icons.ts +39 -0
- package/src/index.ts +75 -1
- package/src/overlay/Overlay.tsx +154 -0
- package/src/overlay/focus.ts +53 -0
- package/src/overlay/index.ts +16 -0
- package/src/overlay/inert.ts +27 -0
- package/src/overlay/layers.ts +21 -0
- package/src/overlay/overlay.ssr.test.tsx +27 -0
- package/src/overlay/overlay.test.tsx +209 -0
- package/src/overlay/presence.ts +86 -0
- package/src/overlay/scroll-lock.ts +62 -0
- package/src/overlay/stack.ts +111 -0
- package/src/overlay/use-overlay.ts +80 -0
- package/src/preview-provider.tsx +47 -0
- package/src/shell.contract.json +75 -0
- package/src/shell.test.ts +72 -0
- package/src/shell.ts +60 -0
- package/src/surface.test.tsx +35 -0
- package/src/surface.tsx +44 -0
- package/src/theme/base.css +167 -0
- package/src/theme/contract.json +123 -2
- package/src/theme/theme-contract.test.ts +19 -3
- package/src/theme/{tokens.less → tokens.css} +19 -20
- package/src/utils/image-preview-host.tsx +95 -0
- package/src/utils/imagePreview.test.ts +32 -0
- package/src/utils/imagePreview.ts +14 -5
- package/src/utils/toast.test.ts +64 -0
- package/src/utils/toast.ts +100 -7
- package/src/ChatPage.less +0 -62
- package/src/components/ActionBar/index.less +0 -123
- package/src/components/ChatHeader/index.less +0 -148
- package/src/components/ChatInput/index.less +0 -394
- package/src/components/HistoryEntry/index.less +0 -49
- package/src/components/MediaList/index.less +0 -241
- package/src/components/MessageBubble/index.less +0 -325
- package/src/components/PullDownIndicator/index.less +0 -32
- package/src/components/QuickCommands/index.less +0 -63
- package/src/components/ReasoningBlock/index.less +0 -90
- package/src/components/ScrollToBottomButton/index.less +0 -32
- package/src/components/ToolCallBlock/index.less +0 -312
- package/src/theme/global.less +0 -99
- /package/src/theme/{motion.less → motion.css} +0 -0
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
// Codex 风格工具活动日志:无卡框、弱层级、流内展开。
|
|
2
|
-
// web-view 约定:颜色走现有 mall token;滚动区隐藏滚动条;图标走 currentColor。
|
|
3
|
-
.tool-calls {
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
margin: 0 0 12px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.tool-calls__summary,
|
|
10
|
-
.tool-calls__item-trigger,
|
|
11
|
-
.tool-calls__copy {
|
|
12
|
-
appearance: none;
|
|
13
|
-
border: 0;
|
|
14
|
-
font: inherit;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 工具活动区统一沿用摘要字号,保留现有 rem 缩放比例。
|
|
18
|
-
.tool-calls__summary-text,
|
|
19
|
-
.tool-calls__item-name,
|
|
20
|
-
.tool-calls__badge,
|
|
21
|
-
.tool-calls__item-tech,
|
|
22
|
-
.tool-calls__detail-label,
|
|
23
|
-
.tool-calls__detail-body,
|
|
24
|
-
.tool-calls__copy {
|
|
25
|
-
font-size: 24px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.tool-calls__summary {
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
justify-content: space-between;
|
|
32
|
-
width: 100%;
|
|
33
|
-
min-height: 88px;
|
|
34
|
-
padding: 10px 4px;
|
|
35
|
-
border-radius: 16px;
|
|
36
|
-
background: transparent;
|
|
37
|
-
color: var(--tbox-text-muted);
|
|
38
|
-
text-align: left;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
transition:
|
|
41
|
-
color var(--tbox-transition-fast),
|
|
42
|
-
background var(--tbox-transition-fast);
|
|
43
|
-
|
|
44
|
-
&:active {
|
|
45
|
-
background: rgba(11, 15, 23, 0.035);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&:focus-visible {
|
|
49
|
-
outline: 4px solid var(--tbox-primary);
|
|
50
|
-
outline-offset: 4px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&--calling {
|
|
54
|
-
color: var(--tbox-text-secondary);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.tool-calls__left {
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
gap: 16px;
|
|
62
|
-
min-width: 0;
|
|
63
|
-
flex: 1;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.tool-calls__summary-text {
|
|
67
|
-
min-width: 0;
|
|
68
|
-
overflow: hidden;
|
|
69
|
-
color: currentColor;
|
|
70
|
-
font-weight: 400;
|
|
71
|
-
line-height: 1.4;
|
|
72
|
-
text-overflow: ellipsis;
|
|
73
|
-
white-space: nowrap;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.tool-calls__failed {
|
|
77
|
-
color: var(--tbox-text-muted);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.tool-calls__chevron,
|
|
81
|
-
.tool-calls__item-chevron {
|
|
82
|
-
color: var(--tbox-text-muted);
|
|
83
|
-
flex-shrink: 0;
|
|
84
|
-
transition: transform var(--tbox-transition-fast);
|
|
85
|
-
|
|
86
|
-
&--up {
|
|
87
|
-
transform: rotate(180deg);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.tool-calls__chevron {
|
|
92
|
-
margin-left: 16px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.tool-calls__icon {
|
|
96
|
-
flex-shrink: 0;
|
|
97
|
-
|
|
98
|
-
&--success {
|
|
99
|
-
color: var(--tbox-text-muted);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
&--error {
|
|
103
|
-
color: var(--tbox-text-muted);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.tool-calls__spinner {
|
|
108
|
-
width: 28px;
|
|
109
|
-
height: 28px;
|
|
110
|
-
border: 4px solid rgba(9, 107, 250, 0.2);
|
|
111
|
-
border-top-color: var(--tbox-primary);
|
|
112
|
-
border-radius: 50%;
|
|
113
|
-
flex-shrink: 0;
|
|
114
|
-
animation: tool-spin 0.8s linear infinite;
|
|
115
|
-
|
|
116
|
-
&--sm {
|
|
117
|
-
width: 24px;
|
|
118
|
-
height: 24px;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.tool-calls__list {
|
|
123
|
-
display: flex;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
gap: 2px;
|
|
126
|
-
margin-top: 4px;
|
|
127
|
-
padding-left: 4px;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.tool-calls__item {
|
|
131
|
-
display: flex;
|
|
132
|
-
min-width: 0;
|
|
133
|
-
flex-direction: column;
|
|
134
|
-
|
|
135
|
-
&--calling .tool-calls__item-name {
|
|
136
|
-
color: var(--tbox-text-secondary);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
&--error .tool-calls__item-name {
|
|
140
|
-
color: var(--tbox-text-muted);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.tool-calls__item-trigger {
|
|
145
|
-
display: flex;
|
|
146
|
-
align-items: center;
|
|
147
|
-
justify-content: space-between;
|
|
148
|
-
width: 100%;
|
|
149
|
-
min-height: 88px;
|
|
150
|
-
padding: 10px 4px;
|
|
151
|
-
border-radius: 16px;
|
|
152
|
-
background: transparent;
|
|
153
|
-
color: var(--tbox-text-secondary);
|
|
154
|
-
text-align: left;
|
|
155
|
-
cursor: pointer;
|
|
156
|
-
transition:
|
|
157
|
-
color var(--tbox-transition-fast),
|
|
158
|
-
background var(--tbox-transition-fast);
|
|
159
|
-
|
|
160
|
-
&:active {
|
|
161
|
-
background: rgba(11, 15, 23, 0.035);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&:focus-visible {
|
|
165
|
-
outline: 4px solid var(--tbox-primary);
|
|
166
|
-
outline-offset: 4px;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&--static {
|
|
170
|
-
cursor: default;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.tool-calls__item-left {
|
|
175
|
-
display: flex;
|
|
176
|
-
align-items: baseline;
|
|
177
|
-
gap: 16px;
|
|
178
|
-
min-width: 0;
|
|
179
|
-
|
|
180
|
-
> .tool-calls__icon,
|
|
181
|
-
> .tool-calls__spinner {
|
|
182
|
-
align-self: center;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.tool-calls__item-name {
|
|
187
|
-
min-width: 0;
|
|
188
|
-
overflow: hidden;
|
|
189
|
-
color: var(--tbox-text-secondary);
|
|
190
|
-
font-weight: 400;
|
|
191
|
-
line-height: 1.4;
|
|
192
|
-
text-overflow: ellipsis;
|
|
193
|
-
white-space: nowrap;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.tool-calls__badge,
|
|
197
|
-
.tool-calls__item-tech {
|
|
198
|
-
color: var(--tbox-text-muted);
|
|
199
|
-
font-family: inherit;
|
|
200
|
-
line-height: 1.4;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.tool-calls__badge {
|
|
204
|
-
flex-shrink: 0;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// 018 dev 视图技术名后缀(debug 态渲染;prod 不出 DOM)
|
|
208
|
-
.tool-calls__item-tech {
|
|
209
|
-
word-break: break-all;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.tool-calls__item-chevron {
|
|
213
|
-
margin-left: 16px;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.tool-calls__detail {
|
|
217
|
-
display: flex;
|
|
218
|
-
flex-direction: column;
|
|
219
|
-
gap: 20px;
|
|
220
|
-
margin: 2px 0 16px 40px;
|
|
221
|
-
padding: 10px 0 10px 28px;
|
|
222
|
-
border-left: 4px solid var(--tbox-border);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.tool-calls__detail-section {
|
|
226
|
-
display: flex;
|
|
227
|
-
min-width: 0;
|
|
228
|
-
flex-direction: column;
|
|
229
|
-
gap: 10px;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.tool-calls__detail-heading {
|
|
233
|
-
display: flex;
|
|
234
|
-
align-items: center;
|
|
235
|
-
justify-content: space-between;
|
|
236
|
-
gap: 16px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.tool-calls__detail-label {
|
|
240
|
-
color: var(--tbox-text-muted);
|
|
241
|
-
line-height: 1.4;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.tool-calls__detail-body {
|
|
245
|
-
max-height: 560px;
|
|
246
|
-
margin: 0;
|
|
247
|
-
padding: 20px 24px;
|
|
248
|
-
overflow: auto;
|
|
249
|
-
border-radius: 16px;
|
|
250
|
-
background: var(--tbox-bg-subtle);
|
|
251
|
-
color: var(--tbox-text-secondary);
|
|
252
|
-
font-family: Menlo, Monaco, Consolas, monospace;
|
|
253
|
-
line-height: 1.6;
|
|
254
|
-
white-space: pre-wrap;
|
|
255
|
-
word-break: break-all;
|
|
256
|
-
-webkit-overflow-scrolling: touch;
|
|
257
|
-
|
|
258
|
-
&::-webkit-scrollbar {
|
|
259
|
-
display: none;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
&--error {
|
|
263
|
-
color: var(--tbox-text-muted);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
.tool-calls__copy {
|
|
268
|
-
display: inline-flex;
|
|
269
|
-
align-items: center;
|
|
270
|
-
gap: 8px;
|
|
271
|
-
min-height: 88px;
|
|
272
|
-
padding: 6px 10px;
|
|
273
|
-
border-radius: 12px;
|
|
274
|
-
background: transparent;
|
|
275
|
-
color: var(--tbox-text-muted);
|
|
276
|
-
line-height: 1.2;
|
|
277
|
-
flex-shrink: 0;
|
|
278
|
-
cursor: pointer;
|
|
279
|
-
|
|
280
|
-
&:active {
|
|
281
|
-
color: var(--tbox-text-secondary);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
&:focus-visible {
|
|
285
|
-
outline: 4px solid var(--tbox-primary);
|
|
286
|
-
outline-offset: 2px;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
&:disabled {
|
|
290
|
-
opacity: 0.55;
|
|
291
|
-
cursor: default;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
@keyframes tool-spin {
|
|
296
|
-
to {
|
|
297
|
-
transform: rotate(360deg);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
@media (prefers-reduced-motion: reduce) {
|
|
302
|
-
.tool-calls__summary,
|
|
303
|
-
.tool-calls__item-trigger,
|
|
304
|
-
.tool-calls__chevron,
|
|
305
|
-
.tool-calls__item-chevron {
|
|
306
|
-
transition: none;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.tool-calls__spinner {
|
|
310
|
-
animation: none;
|
|
311
|
-
}
|
|
312
|
-
}
|
package/src/theme/global.less
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
@import './tokens.less';
|
|
2
|
-
@import './motion.less';
|
|
3
|
-
|
|
4
|
-
* {
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
html,
|
|
9
|
-
body,
|
|
10
|
-
#root {
|
|
11
|
-
margin: 0;
|
|
12
|
-
padding: 0;
|
|
13
|
-
height: 100%;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
body {
|
|
17
|
-
/* mall-vis 字栈:demo 拉丁栈 + 显式 CJK(demo 依赖容器隐式 CJK,模板面向开放浏览器) */
|
|
18
|
-
font-family:
|
|
19
|
-
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC',
|
|
20
|
-
'Microsoft YaHei', sans-serif;
|
|
21
|
-
font-size: var(--tbox-fs-body);
|
|
22
|
-
color: var(--tbox-text-primary);
|
|
23
|
-
background: var(--tbox-bg-page);
|
|
24
|
-
-webkit-font-smoothing: antialiased;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* 顶层容器全宽(渐变底铺满),内容区由各处 max-width:800px 居中(对齐原模板 #app)。 */
|
|
28
|
-
#root {
|
|
29
|
-
width: 100%;
|
|
30
|
-
position: relative;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* 去掉移动端点击高亮 */
|
|
34
|
-
* {
|
|
35
|
-
-webkit-tap-highlight-color: transparent;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* 卡片统一外层 = 卡片「卡框」。所有卡片共有的框在这里,单卡组件别重复写:
|
|
39
|
-
- 间距:卡片与上下元素(工具调用 / 气泡)的间距,与 .tool-calls 一致;
|
|
40
|
-
- 外观:默认背景(白) / 2px 边框 / 圆角 / 阴影;`overflow:hidden` 把内容裁进圆角;
|
|
41
|
-
- 入场动效:mount 即播(0.36s 上浮淡入,对齐 mall-vis 消息卡节奏)。
|
|
42
|
-
值为源码 px(2x 基线、折半渲染):圆角 var(--tbox-radius-lg)=48≈24(与气泡 48 同口径)、边框 2≈1、阴影 var(--tbox-shadow-sm)≈0 4px 13px。
|
|
43
|
-
⚠️ **内边距不在卡框里**——由卡片自己写。卡框给 padding 会让「自带背景色的卡」在外面露一圈白边(卡里套卡)。
|
|
44
|
-
宽度也不在卡框里:默认占满整列(≈移动端 350~400px 设计宽),紧凑卡自己写 max-width。
|
|
45
|
-
单卡组件(.tbox-<type>)只画内容;**要整卡换底色 / 出血图,直接在自己 root 上 `background:<色>` 或铺满图**——
|
|
46
|
-
会铺满卡框、裁进圆角、不出白边(别再自己设圆角,卡框已裁)。不写背景则露卡框默认白底,不透明。 */
|
|
47
|
-
.tbox-card {
|
|
48
|
-
margin-bottom: 12px;
|
|
49
|
-
background: var(--tbox-bg-card);
|
|
50
|
-
border: 2px solid var(--tbox-border);
|
|
51
|
-
border-radius: var(--tbox-radius-lg);
|
|
52
|
-
box-shadow: var(--tbox-shadow-sm);
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
animation: tbox-card-enter var(--tbox-motion-duration-slow) ease;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@keyframes tbox-card-enter {
|
|
58
|
-
from {
|
|
59
|
-
opacity: 0;
|
|
60
|
-
transform: translateY(16px);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
to {
|
|
64
|
-
opacity: 1;
|
|
65
|
-
transform: translateY(0);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@media (prefers-reduced-motion: reduce) {
|
|
70
|
-
.tbox-card {
|
|
71
|
-
animation: none;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* 多卡纵向容器(SDK CardCarousel 多卡分支):容器内卡片关闭逐卡入场动画——
|
|
76
|
-
同屏多卡逐张挂载时 0.36s 上浮淡入会交叠抖动;单卡直出与其他场景的入场动画保留
|
|
77
|
-
(命中卡片本体 .tbox-card:卡框动画在自身规则上,item 中间层无动画规则) */
|
|
78
|
-
.tbox-card-stack .tbox-card {
|
|
79
|
-
animation: none;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* 兜底态(未知 cardType / 渲染出错,由 CardRenderer 给外层加此修饰类):
|
|
83
|
-
复用卡框,弱化成无阴影的虚线提示框(内边距自带,因为卡框不再给 padding) */
|
|
84
|
-
.tbox-card--fallback {
|
|
85
|
-
max-width: 80%;
|
|
86
|
-
padding: 32px 24px;
|
|
87
|
-
background: var(--tbox-bg-subtle);
|
|
88
|
-
border: 1px dashed var(--tbox-border);
|
|
89
|
-
box-shadow: none;
|
|
90
|
-
color: var(--tbox-text-muted);
|
|
91
|
-
font-size: var(--tbox-fs-caption);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* ===== antd-mobile 全局弹层层级(2026-09-04):业务半屏浮层(门店详情/门店导览)z-index 1100,
|
|
95
|
-
* Toast/Dialog/Popup 等瞬态反馈弹层默认 1000 会被盖住(门店券行领取的弹出提醒不可见实证)——
|
|
96
|
-
* 统一提至 1200 置于一切业务浮层之上(antd-mobile 官方 :root:root 双写覆盖约定)===== */
|
|
97
|
-
:root:root {
|
|
98
|
-
--adm-z-index-mask: 1200;
|
|
99
|
-
}
|
|
File without changes
|