@morlay/ui-conversation-message-actions 0.1.3 → 0.1.5
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/client.cjs +16461 -881
- package/dist/{rolldown-runtime-BMI-E3GI.mjs → rolldown-runtime-Dr7-SnC6.mjs} +2 -1
- package/dist/testing.mjs +1 -1
- package/package.json +24 -24
- package/src/client/chat-node/MessageItem.tsx +37 -18
- package/src/client/chat-node/register.ts +1 -1
- package/src/client/controller.ts +3 -2
- package/src/client/index.ts +4 -7
- package/src/client/chat-node/MessageIconActions.styles.ts +0 -76
- package/src/client/chat-node/MessageIconActions.tsx +0 -166
- package/src/client/chat-node/MessageItem.styles.ts +0 -248
- package/src/client/chat-node/message-chrome.ts +0 -44
- package/src/client/chat-node/use-calendar-day.ts +0 -19
- package/src/client/composer-stats/StatsPills.styles.ts +0 -57
- package/src/client/composer-stats/StatsPills.tsx +0 -362
- package/src/client/composer-stats/register.ts +0 -17
- package/src/client/composer-stats/stat-dialog.styles.ts +0 -70
- package/src/client/composer-stats/stat-dialog.ts +0 -52
- package/src/client/composer-stats/token-format.ts +0 -84
- package/src/client/composer-stats/turn-reading.ts +0 -35
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import type { CSSProps } from "@morlay/dsh-client-ui-primitives/client";
|
|
2
|
-
|
|
3
|
-
export const styles = {
|
|
4
|
-
userRow: {
|
|
5
|
-
display: "flex",
|
|
6
|
-
flexDirection: "column",
|
|
7
|
-
alignItems: "flex-end",
|
|
8
|
-
gap: "6px",
|
|
9
|
-
},
|
|
10
|
-
userStack: {
|
|
11
|
-
display: "flex",
|
|
12
|
-
flexDirection: "column",
|
|
13
|
-
alignItems: "flex-end",
|
|
14
|
-
gap: "8px",
|
|
15
|
-
minWidth: "0",
|
|
16
|
-
maxWidth: "min(525px, 82%)",
|
|
17
|
-
},
|
|
18
|
-
bubble: {
|
|
19
|
-
maxWidth: "100%",
|
|
20
|
-
background: "var(--dsw-specific-bubble)",
|
|
21
|
-
borderRadius: "22px",
|
|
22
|
-
padding: "10px 16px",
|
|
23
|
-
fontSize: "16px",
|
|
24
|
-
lineHeight: "24px",
|
|
25
|
-
color: "var(--dsw-alias-label-primary)",
|
|
26
|
-
},
|
|
27
|
-
contextRow: {
|
|
28
|
-
padding: "2px 0",
|
|
29
|
-
},
|
|
30
|
-
compactionRow: {
|
|
31
|
-
padding: "2px 0",
|
|
32
|
-
},
|
|
33
|
-
compactionButton: {
|
|
34
|
-
display: "flex",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
width: "100%",
|
|
37
|
-
height: "24px",
|
|
38
|
-
minWidth: "0",
|
|
39
|
-
padding: "0",
|
|
40
|
-
border: "none",
|
|
41
|
-
borderRadius: "6px",
|
|
42
|
-
background: "none",
|
|
43
|
-
color: "inherit",
|
|
44
|
-
font: "inherit",
|
|
45
|
-
textAlign: "left",
|
|
46
|
-
"&:not(:disabled)": {
|
|
47
|
-
cursor: "pointer",
|
|
48
|
-
},
|
|
49
|
-
"&:not(:disabled):hover": {
|
|
50
|
-
background: "var(--dsw-alias-interactive-bg-hover)",
|
|
51
|
-
},
|
|
52
|
-
"&:not(:disabled):hover .compactionContextIcon": {
|
|
53
|
-
opacity: "0",
|
|
54
|
-
},
|
|
55
|
-
"&:not(:disabled):focus-visible .compactionContextIcon": {
|
|
56
|
-
opacity: "0",
|
|
57
|
-
},
|
|
58
|
-
"&:not(:disabled):hover .compactionDisclosureIcon": {
|
|
59
|
-
opacity: "1",
|
|
60
|
-
},
|
|
61
|
-
"&:not(:disabled):focus-visible .compactionDisclosureIcon": {
|
|
62
|
-
opacity: "1",
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
compactionLeading: {
|
|
66
|
-
flex: "none",
|
|
67
|
-
display: "inline-grid",
|
|
68
|
-
placeItems: "center",
|
|
69
|
-
width: "16px",
|
|
70
|
-
height: "16px",
|
|
71
|
-
marginRight: "6px",
|
|
72
|
-
color: "var(--dsw-alias-label-secondary)",
|
|
73
|
-
},
|
|
74
|
-
compactionContextIcon: {
|
|
75
|
-
display: "inline-flex",
|
|
76
|
-
gridArea: "1 / 1",
|
|
77
|
-
alignItems: "center",
|
|
78
|
-
justifyContent: "center",
|
|
79
|
-
},
|
|
80
|
-
compactionDisclosureIcon: {
|
|
81
|
-
display: "inline-flex",
|
|
82
|
-
gridArea: "1 / 1",
|
|
83
|
-
alignItems: "center",
|
|
84
|
-
justifyContent: "center",
|
|
85
|
-
opacity: "0",
|
|
86
|
-
},
|
|
87
|
-
compactionTitle: {
|
|
88
|
-
flex: "none",
|
|
89
|
-
fontSize: "14px",
|
|
90
|
-
lineHeight: "24px",
|
|
91
|
-
color: "var(--dsw-alias-label-primary-dimmed)",
|
|
92
|
-
},
|
|
93
|
-
compactionSep: {
|
|
94
|
-
flex: "none",
|
|
95
|
-
width: "2px",
|
|
96
|
-
height: "2px",
|
|
97
|
-
margin: "0 8px",
|
|
98
|
-
borderRadius: "1px",
|
|
99
|
-
background: "var(--dsw-alias-label-caption)",
|
|
100
|
-
},
|
|
101
|
-
compactionSummary: {
|
|
102
|
-
flex: "1 1 auto",
|
|
103
|
-
minWidth: "0",
|
|
104
|
-
overflow: "hidden",
|
|
105
|
-
color: "var(--dsw-alias-label-tertiary)",
|
|
106
|
-
fontSize: "14px",
|
|
107
|
-
lineHeight: "24px",
|
|
108
|
-
textOverflow: "ellipsis",
|
|
109
|
-
whiteSpace: "nowrap",
|
|
110
|
-
},
|
|
111
|
-
compactionBody: {
|
|
112
|
-
padding: "4px 0 4px 22px",
|
|
113
|
-
color: "var(--dsw-alias-label-tertiary)",
|
|
114
|
-
fontSize: "14px",
|
|
115
|
-
lineHeight: "24px",
|
|
116
|
-
},
|
|
117
|
-
retryRow: {
|
|
118
|
-
color: "var(--dsw-alias-label-tertiary)",
|
|
119
|
-
fontSize: "13px",
|
|
120
|
-
lineHeight: "20px",
|
|
121
|
-
"&[data-active] .retryText": {
|
|
122
|
-
background:
|
|
123
|
-
"linear-gradient(\n 90deg,\n var(--dsw-alias-label-tertiary) 0%,\n var(--dsw-alias-label-tertiary) 40%,\n var(--dsw-alias-label-secondary) 50%,\n var(--dsw-alias-label-tertiary) 60%,\n var(--dsw-alias-label-tertiary) 100%\n )",
|
|
124
|
-
backgroundPosition: "100% 50%",
|
|
125
|
-
backgroundSize: "200% 100%",
|
|
126
|
-
backgroundClip: "text",
|
|
127
|
-
color: "transparent",
|
|
128
|
-
animation: "retry-shimmer 1.6s ease-in-out infinite",
|
|
129
|
-
"@media (prefers-reduced-motion: reduce)": {
|
|
130
|
-
background: "none",
|
|
131
|
-
color: "inherit",
|
|
132
|
-
animation: "none",
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
"&[open] .retrySummary::after": {
|
|
136
|
-
transform: "rotate(45deg)",
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
retrySummary: {
|
|
140
|
-
display: "inline-flex",
|
|
141
|
-
alignItems: "center",
|
|
142
|
-
width: "fit-content",
|
|
143
|
-
padding: "2px 0",
|
|
144
|
-
gap: "7px",
|
|
145
|
-
borderRadius: "3px",
|
|
146
|
-
color: "inherit",
|
|
147
|
-
cursor: "pointer",
|
|
148
|
-
listStyle: "none",
|
|
149
|
-
userSelect: "none",
|
|
150
|
-
"&::-webkit-details-marker": {
|
|
151
|
-
display: "none",
|
|
152
|
-
},
|
|
153
|
-
"&::after": {
|
|
154
|
-
width: "6px",
|
|
155
|
-
height: "6px",
|
|
156
|
-
borderRight: "1.5px solid currentcolor",
|
|
157
|
-
borderBottom: "1.5px solid currentcolor",
|
|
158
|
-
content: '""',
|
|
159
|
-
opacity: "0.8",
|
|
160
|
-
transform: "rotate(-45deg)",
|
|
161
|
-
transition: "transform 120ms ease",
|
|
162
|
-
},
|
|
163
|
-
"&:hover": {
|
|
164
|
-
color: "var(--dsw-alias-label-secondary)",
|
|
165
|
-
},
|
|
166
|
-
"&:focus-visible": {
|
|
167
|
-
// 上游 ui-chat 的 MessageItem 这轮把焦点环改成读官方焦点变量(`focus.css` 口径)。
|
|
168
|
-
outline: "1.5px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))",
|
|
169
|
-
outlineOffset: "2px",
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
retryText: {
|
|
173
|
-
color: "inherit",
|
|
174
|
-
},
|
|
175
|
-
retryDetails: {
|
|
176
|
-
display: "grid",
|
|
177
|
-
gap: "2px",
|
|
178
|
-
marginTop: "3px",
|
|
179
|
-
paddingLeft: "14px",
|
|
180
|
-
overflowWrap: "anywhere",
|
|
181
|
-
fontSize: "12px",
|
|
182
|
-
lineHeight: "18px",
|
|
183
|
-
},
|
|
184
|
-
retryDetailLabel: {
|
|
185
|
-
color: "var(--dsw-alias-label-secondary)",
|
|
186
|
-
},
|
|
187
|
-
turnErrorRow: {
|
|
188
|
-
display: "grid",
|
|
189
|
-
gridTemplateColumns: "10px minmax(0, 1fr) auto",
|
|
190
|
-
gap: "8px",
|
|
191
|
-
alignItems: "start",
|
|
192
|
-
padding: "2px 0",
|
|
193
|
-
fontSize: "13px",
|
|
194
|
-
lineHeight: "20px",
|
|
195
|
-
},
|
|
196
|
-
turnErrorDot: {
|
|
197
|
-
marginTop: "5px",
|
|
198
|
-
},
|
|
199
|
-
turnErrorCopy: {
|
|
200
|
-
minWidth: "0",
|
|
201
|
-
overflowWrap: "anywhere",
|
|
202
|
-
},
|
|
203
|
-
turnErrorTitle: {
|
|
204
|
-
marginRight: "6px",
|
|
205
|
-
color: "var(--dsw-alias-state-error-primary)",
|
|
206
|
-
fontWeight: "600",
|
|
207
|
-
},
|
|
208
|
-
turnErrorMessage: {
|
|
209
|
-
color: "var(--dsw-alias-label-secondary)",
|
|
210
|
-
},
|
|
211
|
-
turnErrorCode: {
|
|
212
|
-
color: "var(--dsw-alias-label-tertiary)",
|
|
213
|
-
font: "var(--dsw-font-markdown-code-block-small)",
|
|
214
|
-
},
|
|
215
|
-
maxTokensTitle: {
|
|
216
|
-
marginRight: "6px",
|
|
217
|
-
color: "var(--dsw-alias-state-warn-primary)",
|
|
218
|
-
fontWeight: "600",
|
|
219
|
-
},
|
|
220
|
-
refChip: {
|
|
221
|
-
display: "inline-block",
|
|
222
|
-
margin: "0 2px",
|
|
223
|
-
padding: "0 8px",
|
|
224
|
-
borderRadius: "6px",
|
|
225
|
-
background: "rgba(97, 135, 216, 0.22)",
|
|
226
|
-
color: "var(--dsw-alias-label-primary)",
|
|
227
|
-
fontSize: "0.85em",
|
|
228
|
-
lineHeight: "1.6",
|
|
229
|
-
whiteSpace: "nowrap",
|
|
230
|
-
verticalAlign: "baseline",
|
|
231
|
-
},
|
|
232
|
-
confirmActions: {
|
|
233
|
-
display: "flex",
|
|
234
|
-
justifyContent: "flex-end",
|
|
235
|
-
gap: "8px",
|
|
236
|
-
},
|
|
237
|
-
} satisfies Record<string, CSSProps>;
|
|
238
|
-
|
|
239
|
-
export const animations = {
|
|
240
|
-
"retry-shimmer": {
|
|
241
|
-
from: {
|
|
242
|
-
backgroundPosition: "100% 50%",
|
|
243
|
-
},
|
|
244
|
-
to: {
|
|
245
|
-
backgroundPosition: "0 50%",
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
} satisfies Record<string, Record<string, CSSProps>>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Translate } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
|
-
|
|
3
|
-
export type ClockTranslate = Translate<"clock.md" | "clock.ymd">;
|
|
4
|
-
|
|
5
|
-
function pad2(n: number): string {
|
|
6
|
-
return String(n).padStart(2, "0");
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function startOfLocalDay(ms: number): number {
|
|
10
|
-
const d = new Date(ms);
|
|
11
|
-
d.setHours(0, 0, 0, 0);
|
|
12
|
-
return d.getTime();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function msUntilNextLocalMidnight(ms: number): number {
|
|
16
|
-
const next = new Date(ms);
|
|
17
|
-
next.setHours(24, 0, 0, 0);
|
|
18
|
-
return Math.max(next.getTime() - ms, 1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function formatTokensPerSecond(tps: number): string {
|
|
22
|
-
const clamped = Math.max(0, tps);
|
|
23
|
-
return clamped >= 10 ? String(Math.round(clamped)) : String(Math.round(clamped * 10) / 10);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function formatMessageClock(
|
|
27
|
-
time: number,
|
|
28
|
-
t: ClockTranslate,
|
|
29
|
-
now: number = Date.now(),
|
|
30
|
-
): string {
|
|
31
|
-
const d = new Date(time);
|
|
32
|
-
const n = new Date(now);
|
|
33
|
-
const clock = `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
34
|
-
if (
|
|
35
|
-
d.getFullYear() === n.getFullYear() &&
|
|
36
|
-
d.getMonth() === n.getMonth() &&
|
|
37
|
-
d.getDate() === n.getDate()
|
|
38
|
-
) {
|
|
39
|
-
return clock;
|
|
40
|
-
}
|
|
41
|
-
const params = { y: d.getFullYear(), m: d.getMonth() + 1, d: d.getDate() };
|
|
42
|
-
const md = d.getFullYear() === n.getFullYear() ? t("clock.md", params) : t("clock.ymd", params);
|
|
43
|
-
return `${md} ${clock}`;
|
|
44
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { msUntilNextLocalMidnight, startOfLocalDay } from "./message-chrome.ts";
|
|
3
|
-
|
|
4
|
-
export function useCalendarDay(): number {
|
|
5
|
-
const [day, setDay] = useState(() => startOfLocalDay(Date.now()));
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
let timer: ReturnType<typeof setTimeout>;
|
|
8
|
-
const arm = (): void => {
|
|
9
|
-
const now = Date.now();
|
|
10
|
-
setDay(startOfLocalDay(now));
|
|
11
|
-
timer = setTimeout(arm, msUntilNextLocalMidnight(now));
|
|
12
|
-
};
|
|
13
|
-
timer = setTimeout(arm, msUntilNextLocalMidnight(Date.now()));
|
|
14
|
-
return () => {
|
|
15
|
-
clearTimeout(timer);
|
|
16
|
-
};
|
|
17
|
-
}, []);
|
|
18
|
-
return day;
|
|
19
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { CSSProps } from "@morlay/dsh-client-ui-primitives/client";
|
|
2
|
-
|
|
3
|
-
export const styles = {
|
|
4
|
-
// 上游 `StatsPills.module.css` 的 `.root` 原样:统计行在 composer dock 里是 shrink-wrap 的
|
|
5
|
-
// 一个条目,与同为 dock 子项的上下文占用按钮并排——行内间距由 dock 的 `gap: 12px` 统一,
|
|
6
|
-
// 统计自己不再撑满整行(撑满会把占用按钮挤到行尾,两块之间的间距就跟行内间距对不上)。
|
|
7
|
-
root: {
|
|
8
|
-
display: "flex",
|
|
9
|
-
justifyContent: "center",
|
|
10
|
-
gap: "12px",
|
|
11
|
-
minWidth: "0",
|
|
12
|
-
maxWidth: "100%",
|
|
13
|
-
boxSizing: "border-box",
|
|
14
|
-
fontSize: "var(--dsh-content-font-size-secondary, 13px)",
|
|
15
|
-
lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
|
|
16
|
-
},
|
|
17
|
-
anchor: {
|
|
18
|
-
display: "inline-flex",
|
|
19
|
-
minWidth: "0",
|
|
20
|
-
},
|
|
21
|
-
pill: {
|
|
22
|
-
cursor: "pointer",
|
|
23
|
-
|
|
24
|
-
"&:hover, &[aria-expanded='true']": {
|
|
25
|
-
background: "var(--dsw-alias-interactive-bg-hover)",
|
|
26
|
-
color: "var(--dsw-alias-label-secondary)",
|
|
27
|
-
},
|
|
28
|
-
display: "inline-flex",
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
gap: "6px",
|
|
31
|
-
boxSizing: "border-box",
|
|
32
|
-
maxWidth: "100%",
|
|
33
|
-
padding: "1px 8px",
|
|
34
|
-
border: "none",
|
|
35
|
-
borderRadius: "24px",
|
|
36
|
-
background: "transparent",
|
|
37
|
-
color: "var(--dsw-alias-label-tertiary)",
|
|
38
|
-
font: "inherit",
|
|
39
|
-
fontVariantNumeric: "tabular-nums",
|
|
40
|
-
lineHeight: "inherit",
|
|
41
|
-
whiteSpace: "nowrap",
|
|
42
|
-
"& svg": {
|
|
43
|
-
width: "14px",
|
|
44
|
-
height: "14px",
|
|
45
|
-
flex: "none",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
label: {
|
|
49
|
-
minWidth: "0",
|
|
50
|
-
overflow: "hidden",
|
|
51
|
-
textOverflow: "ellipsis",
|
|
52
|
-
},
|
|
53
|
-
sep: {
|
|
54
|
-
color: "var(--dsw-alias-separator-primary)",
|
|
55
|
-
margin: "0 6px",
|
|
56
|
-
},
|
|
57
|
-
} satisfies Record<string, CSSProps>;
|