@morlay/ui-conversation-message-actions 0.0.18 → 0.0.19-alpha.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.
Files changed (45) hide show
  1. package/README.md +29 -98
  2. package/dist/client.cjs +1380 -0
  3. package/dist/client.d.cts +6 -0
  4. package/dist/client.d.mts +6 -0
  5. package/dist/index.d.cts +75 -0
  6. package/dist/index.d.mts +3 -33
  7. package/dist/index.mjs +460 -2
  8. package/dist/invariant.d.cts +7 -0
  9. package/dist/{plan-BSa7k9HO.d.mts → plan-CT_6Y1fD.d.cts} +11 -9
  10. package/dist/plan-Cm9hCord.d.mts +101 -0
  11. package/dist/plan.d.cts +2 -0
  12. package/dist/plan.d.mts +2 -2
  13. package/dist/plan.mjs +145 -11
  14. package/dist/shared-LK3nImWW.mjs +55 -0
  15. package/dist/testing.d.cts +3242 -0
  16. package/dist/testing.d.mts +11 -5
  17. package/dist/testing.mjs +1976 -3775
  18. package/package.json +34 -31
  19. package/src/client/chat-node/MessageIconActions.styles.ts +76 -0
  20. package/src/client/chat-node/MessageIconActions.tsx +30 -11
  21. package/src/client/chat-node/MessageItem.styles.ts +247 -0
  22. package/src/client/chat-node/MessageItem.tsx +32 -39
  23. package/src/client/chat-node/message-chrome.ts +0 -2
  24. package/src/client/chat-node/register.ts +3 -4
  25. package/src/client/chat-node/use-calendar-day.ts +0 -4
  26. package/src/client/composer-stats/StatsPills.styles.ts +57 -0
  27. package/src/client/composer-stats/StatsPills.tsx +384 -0
  28. package/src/client/composer-stats/register.ts +17 -0
  29. package/src/client/composer-stats/stat-dialog.styles.ts +70 -0
  30. package/src/client/composer-stats/stat-dialog.ts +52 -0
  31. package/src/client/composer-stats/token-format.ts +85 -0
  32. package/src/client/composer-stats/turn-reading.ts +35 -0
  33. package/src/client/controller.ts +32 -114
  34. package/src/client/index.ts +8 -24
  35. package/src/index.ts +105 -118
  36. package/src/plan.ts +189 -24
  37. package/src/shared.ts +1 -1
  38. package/src/testing.ts +1 -5
  39. package/src/types.ts +1 -1
  40. package/dist/client.js +0 -806
  41. package/dist/src-B4HwXsob.mjs +0 -499
  42. package/src/client/chat-node/MessageIconActions.module.css +0 -86
  43. package/src/client/chat-node/MessageItem.module.css +0 -290
  44. package/src/client/css-modules.d.ts +0 -4
  45. package/src/client/import-action.tsx +0 -74
@@ -1,290 +0,0 @@
1
- /* User bubble: right-aligned column (bubble + IconActions). Figma
2
- User_Bubble/message_container 659:38813 — r22 fill, actions gap 6 below. */
3
-
4
- .userRow {
5
- display: flex;
6
- flex-direction: column;
7
- align-items: flex-end;
8
- gap: 6px;
9
- }
10
-
11
- .userStack {
12
- display: flex;
13
- flex-direction: column;
14
- align-items: flex-end;
15
- gap: 8px;
16
- min-width: 0;
17
- max-width: min(525px, 82%);
18
- }
19
- .bubble {
20
- /* 525px cap inside the 736 column; percentage keeps narrow windows sane. */
21
- max-width: 100%;
22
- background: var(--dsw-specific-bubble);
23
- border-radius: 22px;
24
- /* 44px single-line bubble: 24 line + 10 vertical padding each side. */
25
- padding: 10px 16px;
26
- font-size: 16px;
27
- line-height: 24px;
28
- color: var(--dsw-alias-label-primary);
29
- }
30
-
31
- .contextRow {
32
- padding: 2px 0;
33
- }
34
-
35
- /* Compaction marker: one dim 24px row with a context icon at rest and a
36
- hover/focus disclosure for the summary body. Dimmed title (not
37
- label-primary) — the row is a boundary notice, not conversation content. */
38
- .compactionRow {
39
- padding: 2px 0;
40
- }
41
-
42
- .compactionButton {
43
- display: flex;
44
- align-items: center;
45
- width: 100%;
46
- height: 24px;
47
- min-width: 0;
48
- padding: 0;
49
- border: none;
50
- border-radius: 6px;
51
- background: none;
52
- color: inherit;
53
- font: inherit;
54
- text-align: left;
55
- }
56
-
57
- .compactionButton:not(:disabled) {
58
- cursor: pointer;
59
- }
60
-
61
- .compactionButton:not(:disabled):hover {
62
- background: var(--dsw-alias-interactive-bg-hover);
63
- }
64
-
65
- .compactionLeading {
66
- flex: none;
67
- display: inline-grid;
68
- place-items: center;
69
- width: 16px;
70
- height: 16px;
71
- margin-right: 6px;
72
- color: var(--dsw-alias-label-secondary);
73
- }
74
-
75
- .compactionContextIcon,
76
- .compactionDisclosureIcon {
77
- display: inline-flex;
78
- grid-area: 1 / 1;
79
- align-items: center;
80
- justify-content: center;
81
- }
82
-
83
- .compactionDisclosureIcon {
84
- opacity: 0;
85
- }
86
-
87
- .compactionButton:not(:disabled):hover .compactionContextIcon,
88
- .compactionButton:not(:disabled):focus-visible .compactionContextIcon {
89
- opacity: 0;
90
- }
91
-
92
- .compactionButton:not(:disabled):hover .compactionDisclosureIcon,
93
- .compactionButton:not(:disabled):focus-visible .compactionDisclosureIcon {
94
- opacity: 1;
95
- }
96
-
97
- .compactionTitle {
98
- flex: none;
99
- font-size: 14px;
100
- line-height: 24px;
101
- color: var(--dsw-alias-label-primary-dimmed);
102
- }
103
-
104
- .compactionSep {
105
- flex: none;
106
- width: 2px;
107
- height: 2px;
108
- margin: 0 8px;
109
- border-radius: 1px;
110
- background: var(--dsw-alias-label-caption);
111
- }
112
-
113
- .compactionSummary {
114
- flex: 1 1 auto;
115
- min-width: 0;
116
- overflow: hidden;
117
- color: var(--dsw-alias-label-tertiary);
118
- font-size: 14px;
119
- line-height: 24px;
120
- text-overflow: ellipsis;
121
- white-space: nowrap;
122
- }
123
-
124
- .compactionBody {
125
- padding: 4px 0 4px 22px;
126
- color: var(--dsw-alias-label-tertiary);
127
- font-size: 14px;
128
- line-height: 24px;
129
- }
130
-
131
- .retryRow {
132
- color: var(--dsw-alias-label-tertiary);
133
- font-size: 13px;
134
- line-height: 20px;
135
- }
136
-
137
- .retrySummary {
138
- display: inline-flex;
139
- align-items: center;
140
- width: fit-content;
141
- padding: 2px 0;
142
- gap: 7px;
143
- border-radius: 3px;
144
- color: inherit;
145
- cursor: pointer;
146
- list-style: none;
147
- user-select: none;
148
- }
149
-
150
- .retrySummary::-webkit-details-marker {
151
- display: none;
152
- }
153
-
154
- .retrySummary::after {
155
- width: 6px;
156
- height: 6px;
157
- border-right: 1.5px solid currentcolor;
158
- border-bottom: 1.5px solid currentcolor;
159
- content: "";
160
- opacity: 0.8;
161
- transform: rotate(-45deg);
162
- transition: transform 120ms ease;
163
- }
164
-
165
- .retrySummary:hover {
166
- color: var(--dsw-alias-label-secondary);
167
- }
168
-
169
- .retrySummary:focus-visible {
170
- outline: 1.5px solid var(--dsw-alias-button-info-fill);
171
- outline-offset: 2px;
172
- }
173
-
174
- .retryText {
175
- color: inherit;
176
- }
177
-
178
- .retryRow[data-active] .retryText {
179
- background: linear-gradient(
180
- 90deg,
181
- var(--dsw-alias-label-tertiary) 0%,
182
- var(--dsw-alias-label-tertiary) 40%,
183
- var(--dsw-alias-label-secondary) 50%,
184
- var(--dsw-alias-label-tertiary) 60%,
185
- var(--dsw-alias-label-tertiary) 100%
186
- );
187
- background-position: 100% 50%;
188
- background-size: 200% 100%;
189
- background-clip: text;
190
- color: transparent;
191
- animation: retry-shimmer 1.6s ease-in-out infinite;
192
- }
193
-
194
- .retryRow[open] .retrySummary::after {
195
- transform: rotate(45deg);
196
- }
197
-
198
- .retryDetails {
199
- display: grid;
200
- gap: 2px;
201
- margin-top: 3px;
202
- padding-left: 14px;
203
- overflow-wrap: anywhere;
204
- font-size: 12px;
205
- line-height: 18px;
206
- }
207
-
208
- .retryDetailLabel {
209
- color: var(--dsw-alias-label-secondary);
210
- }
211
-
212
- .turnErrorRow {
213
- display: grid;
214
- grid-template-columns: 10px minmax(0, 1fr) auto;
215
- gap: 8px;
216
- align-items: start;
217
- padding: 2px 0;
218
- font-size: 13px;
219
- line-height: 20px;
220
- }
221
-
222
- .turnErrorDot {
223
- margin-top: 5px;
224
- }
225
-
226
- .turnErrorCopy {
227
- min-width: 0;
228
- overflow-wrap: anywhere;
229
- }
230
-
231
- .turnErrorTitle {
232
- margin-right: 6px;
233
- color: var(--dsw-alias-state-error-primary);
234
- font-weight: 600;
235
- }
236
-
237
- .turnErrorMessage {
238
- color: var(--dsw-alias-label-secondary);
239
- }
240
-
241
- .turnErrorCode {
242
- color: var(--dsw-alias-label-tertiary);
243
- font: var(--dsw-font-markdown-code-block-small);
244
- }
245
-
246
- .maxTokensTitle {
247
- margin-right: 6px;
248
- color: var(--dsw-alias-state-warn-primary);
249
- font-weight: 600;
250
- }
251
-
252
- @keyframes retry-shimmer {
253
- from {
254
- background-position: 100% 50%;
255
- }
256
-
257
- to {
258
- background-position: 0 50%;
259
- }
260
- }
261
-
262
- @media (prefers-reduced-motion: reduce) {
263
- .retryRow[data-active] .retryText {
264
- background: none;
265
- color: inherit;
266
- animation: none;
267
- }
268
- }
269
-
270
- /* Reference chip projection inside a user bubble (`<skill>name</skill>` model
271
- spans render as chips; free geometry — no textarea pairing here). */
272
- .refChip {
273
- display: inline-block;
274
- margin: 0 2px;
275
- padding: 0 8px;
276
- border-radius: 6px;
277
- background: rgba(97, 135, 216, 0.22);
278
- color: var(--dsw-alias-label-primary);
279
- font-size: 0.85em;
280
- line-height: 1.6;
281
- white-space: nowrap;
282
- vertical-align: baseline;
283
- }
284
-
285
- /* Retry-confirmation modal action row. */
286
- .confirmActions {
287
- display: flex;
288
- justify-content: flex-end;
289
- gap: 8px;
290
- }
@@ -1,4 +0,0 @@
1
- declare module "*.module.css" {
2
- const classes: Record<string, string>;
3
- export default classes;
4
- }
@@ -1,74 +0,0 @@
1
- import { useCallback, useRef, useState, type ReactElement } from "react";
2
- import { Button, IconProps } from "@deepseek-ai/dsh-client-ui-primitives";
3
- import type { SessionEditorState } from "./controller.ts";
4
-
5
- export interface SessionImportActionProps {
6
- useSessionEditor: <S>(sel: (s: SessionEditorState) => S) => S;
7
-
8
- importSession: (file: File) => Promise<boolean>;
9
- }
10
-
11
- export const IconUpload = ({ size = 14, className }: IconProps) => (
12
- <svg
13
- width={size}
14
- height={size}
15
- className={className}
16
- viewBox="0 0 24 24"
17
- fill="none"
18
- xmlns="http://www.w3.org/2000/svg"
19
- stroke="currentColor"
20
- stroke-width="2"
21
- stroke-linecap="round"
22
- stroke-linejoin="round"
23
- >
24
- <path d="M12 3v12" />
25
- <path d="m17 8-5-5-5 5" />
26
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
27
- </svg>
28
- );
29
-
30
- export function SessionImportAction({
31
- useSessionEditor,
32
- importSession,
33
- }: SessionImportActionProps): ReactElement {
34
- const inputRef = useRef<HTMLInputElement>(null);
35
- const importing = useSessionEditor((s) => s.pending === "import");
36
- const error = useSessionEditor((s) => s.error);
37
- const [busy, setBusy] = useState(false);
38
-
39
- const onPick = useCallback(
40
- (file: File | undefined) => {
41
- if (file === undefined) return;
42
- setBusy(true);
43
- void importSession(file).finally(() => setBusy(false));
44
- },
45
- [importSession],
46
- );
47
-
48
- const working = busy || importing;
49
- return (
50
- <>
51
- <Button
52
- size="sm"
53
- icon={<IconUpload />}
54
- disabled={working}
55
- aria-busy={working}
56
- aria-label={working ? "导入中…" : "导入会话"}
57
- title={error ?? "导入会话:用导出的 zip 覆盖当前会话内容"}
58
- onClick={() => inputRef.current?.click()}
59
- >
60
- <input
61
- ref={inputRef}
62
- type="file"
63
- accept=".zip,application/zip"
64
- style={{ display: "none" }}
65
- onChange={(e) => {
66
- const file = e.target.files?.[0];
67
- e.target.value = "";
68
- onPick(file);
69
- }}
70
- />
71
- </Button>
72
- </>
73
- );
74
- }