dsh-conversation-navigator 0.2.2 → 0.2.3
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.en.md +107 -106
- package/README.md +103 -102
- package/lib/client.js +1460 -1365
- package/package.json +47 -47
package/lib/client.js
CHANGED
|
@@ -1,1365 +1,1460 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({
|
|
2
|
-
id: "dsh-conversation-navigator",
|
|
3
|
-
factory: (require) => {
|
|
4
|
-
var module = { exports: {} };
|
|
5
|
-
var exports = module.exports;
|
|
6
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
const React = require("react");
|
|
8
|
-
const { Button, Tooltip, IconCloseOutline16, IconSearchOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
|
-
|
|
10
|
-
/* ---------- 自绘图标: Lucide (ISC License, https://lucide.dev)
|
|
11
|
-
24px 网格 / 2px 描边 / 圆角线帽, 与 DSH 官方描边图标同一视觉语言 ---------- */
|
|
12
|
-
function ToggleIcon() {
|
|
13
|
-
return React.createElement("svg", {
|
|
14
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
15
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
16
|
-
"aria-hidden": true,
|
|
17
|
-
},
|
|
18
|
-
React.createElement("path", { d: "M3 5h.01" }),
|
|
19
|
-
React.createElement("path", { d: "M3 12h.01" }),
|
|
20
|
-
React.createElement("path", { d: "M3 19h.01" }),
|
|
21
|
-
React.createElement("path", { d: "M8 5h13" }),
|
|
22
|
-
React.createElement("path", { d: "M8 12h13" }),
|
|
23
|
-
React.createElement("path", { d: "M8 19h13" }),
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
function LoadEarlierIcon() {
|
|
27
|
-
return React.createElement("svg", {
|
|
28
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
29
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
30
|
-
"aria-hidden": true,
|
|
31
|
-
},
|
|
32
|
-
React.createElement("path", { d: "M5 3h14" }),
|
|
33
|
-
React.createElement("path", { d: "m18 13-6-6-6 6" }),
|
|
34
|
-
React.createElement("path", { d: "M12 7v14" }),
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
function LoadAllIcon() {
|
|
38
|
-
return React.createElement("svg", {
|
|
39
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
40
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
41
|
-
"aria-hidden": true,
|
|
42
|
-
},
|
|
43
|
-
React.createElement("path", { d: "m17 11-5-5-5 5" }),
|
|
44
|
-
React.createElement("path", { d: "m17 18-5-5-5 5" }),
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
function JumpLatestIcon() {
|
|
48
|
-
return React.createElement("svg", {
|
|
49
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
50
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
51
|
-
"aria-hidden": true,
|
|
52
|
-
},
|
|
53
|
-
React.createElement("path", { d: "M12 17V3" }),
|
|
54
|
-
React.createElement("path", { d: "m6 11 6 6 6-6" }),
|
|
55
|
-
React.createElement("path", { d: "M19 21H5" }),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
function CollapseAllIcon() {
|
|
59
|
-
return React.createElement("svg", {
|
|
60
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
61
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
62
|
-
"aria-hidden": true,
|
|
63
|
-
},
|
|
64
|
-
React.createElement("path", { d: "m14 10 7-7" }),
|
|
65
|
-
React.createElement("path", { d: "M20 10h-6V4" }),
|
|
66
|
-
React.createElement("path", { d: "m3 21 7-7" }),
|
|
67
|
-
React.createElement("path", { d: "M4 14h6v6" }),
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function SwitchTurnsIcon() {
|
|
72
|
-
return React.createElement("svg", {
|
|
73
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
74
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
75
|
-
"aria-hidden": true,
|
|
76
|
-
},
|
|
77
|
-
React.createElement("path", { d: "M8 3 4 7l4 4" }),
|
|
78
|
-
React.createElement("path", { d: "M4 7h16" }),
|
|
79
|
-
React.createElement("path", { d: "m16 21 4-4-4-4" }),
|
|
80
|
-
React.createElement("path", { d: "M20 17H4" }),
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function PinIcon() {
|
|
85
|
-
return React.createElement("svg", {
|
|
86
|
-
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
87
|
-
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
88
|
-
"aria-hidden": true,
|
|
89
|
-
},
|
|
90
|
-
React.createElement("path", { d: "M12 17v5" }),
|
|
91
|
-
React.createElement("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* ---------- own stylesheet (static packages have no styles builtin) ---------- */
|
|
96
|
-
const CSS = `
|
|
97
|
-
.cnvnav-panel {
|
|
98
|
-
position: fixed; z-index: 9999; width: 288px;
|
|
99
|
-
display: flex; flex-direction: column;
|
|
100
|
-
pointer-events: auto;
|
|
101
|
-
background: var(--dsw-alias-bg-overlay, #fff);
|
|
102
|
-
border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
103
|
-
border-radius: 12px;
|
|
104
|
-
box-shadow: 0 16px 48px rgba(0,0,0,.22);
|
|
105
|
-
font-family: system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
|
106
|
-
font-size: 12px;
|
|
107
|
-
color: var(--dsw-alias-label-primary, #222);
|
|
108
|
-
overflow: hidden;
|
|
109
|
-
transition: opacity .18s ease, transform .18s ease;
|
|
110
|
-
}
|
|
111
|
-
.cnvnav-panel-hidden { opacity: 0; transform: translateY(-6px) scale(.985); pointer-events: none; }
|
|
112
|
-
.cnvnav-panel-unplaced { visibility: hidden; }
|
|
113
|
-
.cnvnav-head {
|
|
114
|
-
display: flex; align-items: center; gap: 8px;
|
|
115
|
-
padding: 10px 12px;
|
|
116
|
-
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
117
|
-
}
|
|
118
|
-
.cnvnav-count { color: var(--dsw-alias-label-secondary, #888); font-size: 11px; }
|
|
119
|
-
|
|
120
|
-
.cnvnav-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.cnvnav-group-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.cnvnav-group-row
|
|
143
|
-
.cnvnav-group-
|
|
144
|
-
.cnvnav-group-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
.cnvnav-group-
|
|
152
|
-
.cnvnav-group-head
|
|
153
|
-
.cnvnav-group-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
color: var(--dsw-alias-label-secondary, #888);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
.cnvnav-chevron
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
.
|
|
176
|
-
|
|
177
|
-
.cnvnav-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
.cnvnav-item
|
|
185
|
-
|
|
186
|
-
.cnvnav-item
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
.cnvnav-item
|
|
194
|
-
.cnvnav-item-active
|
|
195
|
-
.cnvnav-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
.cnvnav-
|
|
203
|
-
.cnvnav-
|
|
204
|
-
.cnvnav-badge
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
.cnvnav-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
.cnvnav-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
.cnvnav-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.cnvnav-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
.cnvnav-list
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
.cnvnav-list::-webkit-scrollbar
|
|
270
|
-
.cnvnav-mini-list::-webkit-scrollbar
|
|
271
|
-
.cnvnav-list::-webkit-scrollbar-
|
|
272
|
-
.cnvnav-mini-list::-webkit-scrollbar-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
.cnvnav-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
.cnvnav-mini-item
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
background: var(--dsw-alias-
|
|
308
|
-
color: var(--dsw-alias-label-primary, #222);
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
.cnvnav-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
.cnvnav-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
.cnvnav-head
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
return
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
"
|
|
444
|
-
"
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
if (!
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
return null;
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
if (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
case "
|
|
522
|
-
return "
|
|
523
|
-
case "
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
return
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return
|
|
557
|
-
}
|
|
558
|
-
function
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
const
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
if (
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
d.
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
);
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
const
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
:
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
)
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
React.createElement(
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
),
|
|
1243
|
-
)
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
icon: React.createElement(
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-conversation-navigator",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
const React = require("react");
|
|
8
|
+
const { Button, Tooltip, IconCloseOutline16, IconSearchOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
|
+
|
|
10
|
+
/* ---------- 自绘图标: Lucide (ISC License, https://lucide.dev)
|
|
11
|
+
24px 网格 / 2px 描边 / 圆角线帽, 与 DSH 官方描边图标同一视觉语言 ---------- */
|
|
12
|
+
function ToggleIcon() {
|
|
13
|
+
return React.createElement("svg", {
|
|
14
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
15
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
},
|
|
18
|
+
React.createElement("path", { d: "M3 5h.01" }),
|
|
19
|
+
React.createElement("path", { d: "M3 12h.01" }),
|
|
20
|
+
React.createElement("path", { d: "M3 19h.01" }),
|
|
21
|
+
React.createElement("path", { d: "M8 5h13" }),
|
|
22
|
+
React.createElement("path", { d: "M8 12h13" }),
|
|
23
|
+
React.createElement("path", { d: "M8 19h13" }),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function LoadEarlierIcon() {
|
|
27
|
+
return React.createElement("svg", {
|
|
28
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
29
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
30
|
+
"aria-hidden": true,
|
|
31
|
+
},
|
|
32
|
+
React.createElement("path", { d: "M5 3h14" }),
|
|
33
|
+
React.createElement("path", { d: "m18 13-6-6-6 6" }),
|
|
34
|
+
React.createElement("path", { d: "M12 7v14" }),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function LoadAllIcon() {
|
|
38
|
+
return React.createElement("svg", {
|
|
39
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
40
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
},
|
|
43
|
+
React.createElement("path", { d: "m17 11-5-5-5 5" }),
|
|
44
|
+
React.createElement("path", { d: "m17 18-5-5-5 5" }),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function JumpLatestIcon() {
|
|
48
|
+
return React.createElement("svg", {
|
|
49
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
50
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
},
|
|
53
|
+
React.createElement("path", { d: "M12 17V3" }),
|
|
54
|
+
React.createElement("path", { d: "m6 11 6 6 6-6" }),
|
|
55
|
+
React.createElement("path", { d: "M19 21H5" }),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function CollapseAllIcon() {
|
|
59
|
+
return React.createElement("svg", {
|
|
60
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
61
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
62
|
+
"aria-hidden": true,
|
|
63
|
+
},
|
|
64
|
+
React.createElement("path", { d: "m14 10 7-7" }),
|
|
65
|
+
React.createElement("path", { d: "M20 10h-6V4" }),
|
|
66
|
+
React.createElement("path", { d: "m3 21 7-7" }),
|
|
67
|
+
React.createElement("path", { d: "M4 14h6v6" }),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function SwitchTurnsIcon() {
|
|
72
|
+
return React.createElement("svg", {
|
|
73
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
74
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
75
|
+
"aria-hidden": true,
|
|
76
|
+
},
|
|
77
|
+
React.createElement("path", { d: "M8 3 4 7l4 4" }),
|
|
78
|
+
React.createElement("path", { d: "M4 7h16" }),
|
|
79
|
+
React.createElement("path", { d: "m16 21 4-4-4-4" }),
|
|
80
|
+
React.createElement("path", { d: "M20 17H4" }),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function PinIcon() {
|
|
85
|
+
return React.createElement("svg", {
|
|
86
|
+
viewBox: "0 0 24 24", width: 14, height: 14, fill: "none",
|
|
87
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
88
|
+
"aria-hidden": true,
|
|
89
|
+
},
|
|
90
|
+
React.createElement("path", { d: "M12 17v5" }),
|
|
91
|
+
React.createElement("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* ---------- own stylesheet (static packages have no styles builtin) ---------- */
|
|
96
|
+
const CSS = `
|
|
97
|
+
.cnvnav-panel {
|
|
98
|
+
position: fixed; z-index: 9999; width: 288px;
|
|
99
|
+
display: flex; flex-direction: column;
|
|
100
|
+
pointer-events: auto;
|
|
101
|
+
background: var(--dsw-alias-bg-overlay, #fff);
|
|
102
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
103
|
+
border-radius: 12px;
|
|
104
|
+
box-shadow: 0 16px 48px rgba(0,0,0,.22);
|
|
105
|
+
font-family: system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
color: var(--dsw-alias-label-primary, #222);
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
transition: opacity .18s ease, transform .18s ease;
|
|
110
|
+
}
|
|
111
|
+
.cnvnav-panel-hidden { opacity: 0; transform: translateY(-6px) scale(.985); pointer-events: none; }
|
|
112
|
+
.cnvnav-panel-unplaced { visibility: hidden; }
|
|
113
|
+
.cnvnav-head {
|
|
114
|
+
display: flex; align-items: center; gap: 8px;
|
|
115
|
+
padding: 10px 12px;
|
|
116
|
+
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
117
|
+
}
|
|
118
|
+
.cnvnav-count { color: var(--dsw-alias-label-secondary, #888); font-size: 11px; }
|
|
119
|
+
/* 左下角拖拽缩放热区(普通面板): 仅圆角区域可拖, 无可见手柄 */
|
|
120
|
+
.cnvnav-resize-grip {
|
|
121
|
+
position: absolute; left: 0; bottom: 0;
|
|
122
|
+
width: 14px; height: 14px;
|
|
123
|
+
cursor: nesw-resize;
|
|
124
|
+
border-bottom-left-radius: 12px;
|
|
125
|
+
touch-action: none;
|
|
126
|
+
background: transparent;
|
|
127
|
+
}
|
|
128
|
+
.cnvnav-search { flex: none; display: flex; }
|
|
129
|
+
.cnvnav-turns-toggle { flex: none; display: flex; }
|
|
130
|
+
.cnvnav-close { margin-left: auto; }
|
|
131
|
+
.cnvnav-list {
|
|
132
|
+
overflow-y: auto; padding: 6px; min-height: 0;
|
|
133
|
+
display: flex; flex-direction: column; gap: 2px;
|
|
134
|
+
}
|
|
135
|
+
.cnvnav-group { display: flex; flex-direction: column; margin-bottom: 2px; }
|
|
136
|
+
.cnvnav-group-row {
|
|
137
|
+
display: flex; align-items: stretch;
|
|
138
|
+
border-radius: 8px; overflow: hidden;
|
|
139
|
+
position: relative;
|
|
140
|
+
transition: background .16s ease;
|
|
141
|
+
}
|
|
142
|
+
.cnvnav-group-row:hover { background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12)); }
|
|
143
|
+
.cnvnav-group-row-active { background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 13%, transparent); }
|
|
144
|
+
.cnvnav-group-row-active::before {
|
|
145
|
+
content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
|
|
146
|
+
width: 3px; border-radius: 2px;
|
|
147
|
+
background: var(--dsw-alias-brand-primary, #4f46e5);
|
|
148
|
+
}
|
|
149
|
+
.cnvnav-group-row-active:hover { background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 18%, transparent); }
|
|
150
|
+
.cnvnav-group-row-active .cnvnav-group-title { color: var(--dsw-alias-brand-primary, #4f46e5); }
|
|
151
|
+
.cnvnav-group-row-active .cnvnav-group-sub { color: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 45%, var(--dsw-alias-label-secondary, #888)); }
|
|
152
|
+
.cnvnav-group-head-wrap { flex: 1; min-width: 0; display: flex; }
|
|
153
|
+
.cnvnav-group-head {
|
|
154
|
+
width: 100%;
|
|
155
|
+
display: flex; align-items: baseline; gap: 6px; text-align: left;
|
|
156
|
+
border: none; background: transparent; cursor: pointer;
|
|
157
|
+
padding: 5px 0 5px 17px;
|
|
158
|
+
color: var(--dsw-alias-label-primary, #222);
|
|
159
|
+
}
|
|
160
|
+
.cnvnav-group-title { font-family: var(--dsw-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif); font-size: 14px; font-weight: 700; line-height: 20px; white-space: nowrap; transition: color .16s ease; }
|
|
161
|
+
.cnvnav-group-head .cnvnav-badge { align-self: center; }
|
|
162
|
+
.cnvnav-group-sub {
|
|
163
|
+
color: var(--dsw-alias-label-secondary, #888);
|
|
164
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
165
|
+
flex: 1; min-width: 0;
|
|
166
|
+
}
|
|
167
|
+
.cnvnav-chevron-wrap { flex: none; display: flex; }
|
|
168
|
+
.cnvnav-chevron {
|
|
169
|
+
min-width: 30px; align-self: stretch;
|
|
170
|
+
display: flex; align-items: center; justify-content: center; gap: 3px;
|
|
171
|
+
border: none; background: transparent; cursor: pointer;
|
|
172
|
+
color: var(--dsw-alias-label-secondary, #888);
|
|
173
|
+
font-size: 11px; line-height: 1; padding: 0 8px;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
transition: color .16s ease, background .16s ease;
|
|
176
|
+
}
|
|
177
|
+
.cnvnav-chevron:hover { color: var(--dsw-alias-brand-primary, #4f46e5); background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12)); }
|
|
178
|
+
.cnvnav-chevron-icon { flex: none; display: block; transition: transform .2s cubic-bezier(.4, 0, .2, 1); }
|
|
179
|
+
.cnvnav-chevron[aria-expanded="true"] .cnvnav-chevron-icon { transform: rotate(90deg); }
|
|
180
|
+
.cnvnav-chevron-count { font-size: 11px; line-height: 1; }
|
|
181
|
+
.cnvnav-steps { display: grid; grid-template-rows: 1fr; margin-top: 2px; transition: grid-template-rows .24s cubic-bezier(.4, 0, .2, 1), margin-top .24s cubic-bezier(.4, 0, .2, 1); }
|
|
182
|
+
.cnvnav-steps-collapsed { grid-template-rows: 0fr; margin-top: 0; }
|
|
183
|
+
.cnvnav-steps-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
184
|
+
.cnvnav-fade-item { animation: cnvnav-fade-up .2s ease-out backwards; }
|
|
185
|
+
@keyframes cnvnav-fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
|
|
186
|
+
.cnvnav-item {
|
|
187
|
+
display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
|
|
188
|
+
border: none; background: transparent; cursor: pointer;
|
|
189
|
+
padding: 5px 8px 5px 22px; border-radius: 8px; position: relative;
|
|
190
|
+
color: var(--dsw-alias-label-primary, #222);
|
|
191
|
+
transition: background .16s ease;
|
|
192
|
+
}
|
|
193
|
+
.cnvnav-item:hover { background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12)); }
|
|
194
|
+
.cnvnav-item-active { background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 13%, transparent); }
|
|
195
|
+
.cnvnav-item-active:hover { background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 18%, transparent); }
|
|
196
|
+
.cnvnav-item-active .cnvnav-item-preview { color: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 60%, var(--dsw-alias-label-primary, #222)); }
|
|
197
|
+
.cnvnav-item-active::before,
|
|
198
|
+
.cnvnav-item-active::after {
|
|
199
|
+
content: ''; position: absolute; left: 6px; width: 3px; border-radius: 2px;
|
|
200
|
+
background: var(--dsw-alias-brand-primary, #4f46e5);
|
|
201
|
+
}
|
|
202
|
+
.cnvnav-item-active::before { top: 6px; height: calc(50% - 7.5px); }
|
|
203
|
+
.cnvnav-item-active::after { bottom: 6px; height: calc(50% - 7.5px); }
|
|
204
|
+
.cnvnav-badge {
|
|
205
|
+
flex: none; min-width: 36px; box-sizing: border-box;
|
|
206
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
207
|
+
height: 19px; padding: 0 5px; border-radius: 4px;
|
|
208
|
+
font-size: 10px; font-weight: 650; line-height: 1;
|
|
209
|
+
letter-spacing: .035em; white-space: nowrap;
|
|
210
|
+
}
|
|
211
|
+
.cnvnav-badge-traj-user { color: var(--dsw-alias-state-business-primary, #4f46e5); background: var(--dsw-alias-state-business-tertiary, rgba(79,70,229,.14)); }
|
|
212
|
+
.cnvnav-badge-traj-context { color: color-mix(in srgb, var(--dsw-alias-state-success-primary, #0e9f6e) 68%, var(--dsw-alias-label-secondary, #888)); background: var(--dsw-alias-state-success-tertiary, rgba(14,159,110,.14)); }
|
|
213
|
+
.cnvnav-badge-traj-assistant { color: color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color, #7c3aed) 60%, var(--dsw-alias-state-error-secondary, #b91c1c)); background: color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color, #7c3aed) 55%, var(--dsw-alias-state-error-secondary, #b91c1c)) 15%, var(--dsw-alias-bg-layer-1, transparent)); }
|
|
214
|
+
.cnvnav-badge-traj-tool { color: var(--dsw-alias-state-warn-label, #b45309); background: var(--dsw-alias-state-warn-tertiary, rgba(180,83,9,.14)); }
|
|
215
|
+
.cnvnav-badge-traj-compacted { color: var(--dsw-alias-label-secondary, #888); background: var(--dsw-alias-bg-module-platform, rgba(128,128,128,.12)); }
|
|
216
|
+
.cnvnav-badge-other-command { color: #1d4ed8; background: rgba(29,78,216,.13); }
|
|
217
|
+
.cnvnav-badge-other-error { color: var(--dsw-alias-state-error-primary, #dc2626); background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #dc2626) 14%, transparent); }
|
|
218
|
+
.cnvnav-badge-other-retry { color: #ea580c; background: rgba(234,88,12,.14); }
|
|
219
|
+
.cnvnav-badge-other-neutral { color: var(--dsw-alias-label-secondary, #888); background: var(--dsw-alias-bg-module-platform, rgba(128,128,128,.12)); }
|
|
220
|
+
.cnvnav-item-preview {
|
|
221
|
+
flex: 1; min-width: 0; display: block;
|
|
222
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
223
|
+
color: var(--dsw-alias-label-secondary, #888);
|
|
224
|
+
}
|
|
225
|
+
.cnvnav-item-time {
|
|
226
|
+
flex: none; color: var(--dsw-alias-label-secondary, #888); font-size: 10px; opacity: .8;
|
|
227
|
+
}
|
|
228
|
+
.cnvnav-hl {
|
|
229
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 30%, transparent);
|
|
230
|
+
color: inherit; border-radius: 2px; padding: 0 1px; font-weight: 600;
|
|
231
|
+
}
|
|
232
|
+
.cnvnav-empty { padding: 18px 10px; text-align: center; color: var(--dsw-alias-label-secondary, #888); }
|
|
233
|
+
/* ---------- 极简模式 ---------- */
|
|
234
|
+
.cnvnav-mini-wrap {
|
|
235
|
+
position: fixed; z-index: 9999; right: 12px;
|
|
236
|
+
pointer-events: auto;
|
|
237
|
+
transition: opacity .18s ease, transform .18s ease;
|
|
238
|
+
}
|
|
239
|
+
.cnvnav-mini-panel {
|
|
240
|
+
width: 18px; height: 220px; overflow: hidden;
|
|
241
|
+
position: relative;
|
|
242
|
+
display: flex; flex-direction: column;
|
|
243
|
+
background: transparent;
|
|
244
|
+
border: 1px solid transparent;
|
|
245
|
+
border-radius: 12px;
|
|
246
|
+
box-shadow: none;
|
|
247
|
+
transition: width .18s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
|
|
248
|
+
}
|
|
249
|
+
.cnvnav-mini-wrap:hover .cnvnav-mini-panel {
|
|
250
|
+
width: 288px;
|
|
251
|
+
background: var(--dsw-alias-bg-overlay, #fff);
|
|
252
|
+
border-color: var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
253
|
+
box-shadow: 0 16px 48px rgba(0,0,0,.22);
|
|
254
|
+
}
|
|
255
|
+
.cnvnav-mini-fab {
|
|
256
|
+
position: absolute; bottom: 100%; right: -8px;
|
|
257
|
+
margin-bottom: 6px;
|
|
258
|
+
display: flex;
|
|
259
|
+
}
|
|
260
|
+
.cnvnav-mini-list {
|
|
261
|
+
flex: 1; min-height: 0; width: 288px; box-sizing: border-box;
|
|
262
|
+
overflow-y: auto; padding: 4px;
|
|
263
|
+
display: flex; flex-direction: column; gap: 2px;
|
|
264
|
+
}
|
|
265
|
+
/* dsweb 式滚动条: 只显示滑块, 无滑轨无上下按钮.
|
|
266
|
+
面板列表与极简条统一为常显细白条(极简条收起时列表被裁剪,
|
|
267
|
+
悬停展开后滑块自然可见). Chromium 用 webkit 伪元素
|
|
268
|
+
(标准属性会令其失效), Firefox 用 @supports 标准属性 */
|
|
269
|
+
.cnvnav-list::-webkit-scrollbar,
|
|
270
|
+
.cnvnav-mini-list::-webkit-scrollbar { width: 4px; }
|
|
271
|
+
.cnvnav-list::-webkit-scrollbar-track,
|
|
272
|
+
.cnvnav-mini-list::-webkit-scrollbar-track { background: transparent; }
|
|
273
|
+
.cnvnav-list::-webkit-scrollbar-thumb,
|
|
274
|
+
.cnvnav-mini-list::-webkit-scrollbar-thumb {
|
|
275
|
+
background: color-mix(in srgb, var(--dsw-alias-label-secondary, #888) 40%, transparent);
|
|
276
|
+
border-radius: 2px;
|
|
277
|
+
}
|
|
278
|
+
.cnvnav-list::-webkit-scrollbar-button,
|
|
279
|
+
.cnvnav-mini-list::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
|
|
280
|
+
.cnvnav-list::-webkit-scrollbar-corner,
|
|
281
|
+
.cnvnav-mini-list::-webkit-scrollbar-corner { background: transparent; }
|
|
282
|
+
@supports (-moz-appearance: none) {
|
|
283
|
+
.cnvnav-list,
|
|
284
|
+
.cnvnav-mini-list {
|
|
285
|
+
scrollbar-width: thin;
|
|
286
|
+
scrollbar-color: color-mix(in srgb, var(--dsw-alias-label-secondary, #888) 40%, transparent) transparent;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
.cnvnav-mini-item {
|
|
290
|
+
flex: none; height: 28px; box-sizing: border-box; width: 100%;
|
|
291
|
+
display: flex; align-items: center; text-align: left;
|
|
292
|
+
border: none; background: transparent; cursor: pointer;
|
|
293
|
+
padding: 5px 8px 5px 17px; border-radius: 8px; position: relative;
|
|
294
|
+
color: var(--dsw-alias-label-secondary, #888);
|
|
295
|
+
font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
296
|
+
transition: background .16s ease;
|
|
297
|
+
}
|
|
298
|
+
.cnvnav-mini-item:hover { background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12)); }
|
|
299
|
+
/* 每行都有指示竖条: 非当前=掺前景色(浅色主题掺黑/深色主题掺白, 40%), 当前=品牌色实色 */
|
|
300
|
+
.cnvnav-mini-item::before {
|
|
301
|
+
content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
|
|
302
|
+
width: 3px; border-radius: 2px;
|
|
303
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary, #222) 40%, transparent);
|
|
304
|
+
transition: background .16s ease;
|
|
305
|
+
}
|
|
306
|
+
.cnvnav-mini-item-active {
|
|
307
|
+
background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 13%, transparent);
|
|
308
|
+
color: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 60%, var(--dsw-alias-label-primary, #222));
|
|
309
|
+
}
|
|
310
|
+
.cnvnav-mini-item-active::before { background: var(--dsw-alias-brand-primary, #4f46e5); }
|
|
311
|
+
.cnvnav-filter {
|
|
312
|
+
flex: 1; min-width: 0; box-sizing: border-box;
|
|
313
|
+
height: 28px; padding: 0 8px;
|
|
314
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
315
|
+
border-radius: 8px;
|
|
316
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,.06));
|
|
317
|
+
color: var(--dsw-alias-label-primary, #222);
|
|
318
|
+
font-family: var(--dsw-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif);
|
|
319
|
+
font-size: 12px; outline: none;
|
|
320
|
+
animation: cnvnav-search-in .16s ease-out;
|
|
321
|
+
}
|
|
322
|
+
.cnvnav-filter::placeholder { color: var(--dsw-alias-label-secondary, #888); }
|
|
323
|
+
.cnvnav-filter:focus { border-color: var(--dsw-alias-brand-primary, #4f46e5); }
|
|
324
|
+
@keyframes cnvnav-search-in {
|
|
325
|
+
from { opacity: 0; transform: translateX(4px); }
|
|
326
|
+
to { opacity: 1; transform: translateX(0); }
|
|
327
|
+
}
|
|
328
|
+
.cnvnav-topbar { display: flex; gap: 6px; margin: 6px 6px 0; }
|
|
329
|
+
.cnvnav-footer { display: flex; gap: 6px; margin: 0 6px 6px; }
|
|
330
|
+
.cnvnav-bar-btn { flex: 1; display: block; }
|
|
331
|
+
.cnvnav-bar-fill { width: 100%; }
|
|
332
|
+
/* ---------- 拖动定位与左对齐极简 ---------- */
|
|
333
|
+
.cnvnav-head { cursor: grab; touch-action: none; }
|
|
334
|
+
.cnvnav-dragging { cursor: grabbing; user-select: none; }
|
|
335
|
+
.cnvnav-dragging .cnvnav-head { cursor: grabbing; }
|
|
336
|
+
/* 模式切换按钮激活态: 与整行描边图标按钮同一视觉层级
|
|
337
|
+
(实心 primary 填充夹在幽灵图标中间会显得"错位") */
|
|
338
|
+
.cnvnav-head button.cnvnav-toggle-on {
|
|
339
|
+
color: var(--dsw-alias-brand-primary, #4f46e5);
|
|
340
|
+
background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 13%, transparent);
|
|
341
|
+
}
|
|
342
|
+
.cnvnav-head button.cnvnav-toggle-on:hover {
|
|
343
|
+
background: color-mix(in srgb, var(--dsw-alias-brand-primary, #4f46e5) 20%, transparent);
|
|
344
|
+
}
|
|
345
|
+
.cnvnav-mini-wrap-left { right: auto; }
|
|
346
|
+
.cnvnav-mini-wrap-left .cnvnav-mini-fab { right: auto; left: -8px; }
|
|
347
|
+
`;
|
|
348
|
+
|
|
349
|
+
function apply(ctx) {
|
|
350
|
+
const slots = ctx.get("slots");
|
|
351
|
+
if (slots === undefined) return;
|
|
352
|
+
const timer = ctx.get("timer");
|
|
353
|
+
const sessions = ctx.get("sessions");
|
|
354
|
+
|
|
355
|
+
/* own stylesheet with fiber-scoped cleanup */
|
|
356
|
+
const styleEl = document.createElement("style");
|
|
357
|
+
styleEl.setAttribute("data-dsh-cnvnav", "");
|
|
358
|
+
styleEl.textContent = CSS;
|
|
359
|
+
document.head.appendChild(styleEl);
|
|
360
|
+
ctx.effect(() => () => styleEl.remove());
|
|
361
|
+
|
|
362
|
+
/* ---------- shared store (toggle button + overlay panel) ---------- */
|
|
363
|
+
const UI_KEY = "dsh-cnvnav:ui:v1";
|
|
364
|
+
const VIEW_MODES = ["full", "hidden", "minimal", "minimal-left"];
|
|
365
|
+
function readUi() {
|
|
366
|
+
try {
|
|
367
|
+
const raw = window.localStorage.getItem(UI_KEY);
|
|
368
|
+
if (!raw) return {};
|
|
369
|
+
const o = JSON.parse(raw);
|
|
370
|
+
const out = {};
|
|
371
|
+
if (VIEW_MODES.indexOf(o.viewMode) !== -1) out.viewMode = o.viewMode;
|
|
372
|
+
if (o.docked === true || o.docked === false) out.docked = o.docked;
|
|
373
|
+
if (typeof o.panelWidth === "number" && o.panelWidth >= 240 && o.panelWidth <= 560) out.panelWidth = o.panelWidth;
|
|
374
|
+
if (typeof o.panelHeight === "number" && o.panelHeight >= 90 && o.panelHeight <= 2000) out.panelHeight = o.panelHeight;
|
|
375
|
+
if (o.userPos && typeof o.userPos.left === "number" && typeof o.userPos.top === "number"
|
|
376
|
+
&& Number.isFinite(o.userPos.left) && Number.isFinite(o.userPos.top)) {
|
|
377
|
+
out.userPos = { left: o.userPos.left, top: o.userPos.top };
|
|
378
|
+
}
|
|
379
|
+
return out;
|
|
380
|
+
} catch (err) {
|
|
381
|
+
return {};
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function persistUi() {
|
|
385
|
+
try {
|
|
386
|
+
window.localStorage.setItem(UI_KEY, JSON.stringify({
|
|
387
|
+
viewMode: state.viewMode, docked: state.docked, userPos: state.userPos, panelWidth: state.panelWidth, panelHeight: state.panelHeight,
|
|
388
|
+
}));
|
|
389
|
+
} catch (err) { /* 隐私模式等场景忽略 */ }
|
|
390
|
+
}
|
|
391
|
+
const savedUi = readUi();
|
|
392
|
+
let state = Object.assign({
|
|
393
|
+
open: true, sessionId: null, outline: null, activeKey: null, expanded: {},
|
|
394
|
+
hasMore: false, loadingOlder: false, loadingAll: false,
|
|
395
|
+
viewMode: "full", docked: true, userPos: null, panelWidth: 288, panelHeight: null,
|
|
396
|
+
}, savedUi);
|
|
397
|
+
const listeners = new Set();
|
|
398
|
+
function setState(patch) {
|
|
399
|
+
state = Object.assign({}, state, patch);
|
|
400
|
+
listeners.forEach((fn) => { try { fn(); } catch (err) { console.error(err); } });
|
|
401
|
+
}
|
|
402
|
+
function subscribe(fn) { listeners.add(fn); return () => { listeners.delete(fn); }; }
|
|
403
|
+
function useStore() {
|
|
404
|
+
const [snap, setSnap] = React.useState(state);
|
|
405
|
+
React.useEffect(() => subscribe(() => setSnap(state)), []);
|
|
406
|
+
return snap;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* ---------- history paging ---------- */
|
|
410
|
+
let loadingAll = false;
|
|
411
|
+
function loadOlderPage() {
|
|
412
|
+
if (sessions === undefined) return;
|
|
413
|
+
const sid = state.sessionId;
|
|
414
|
+
if (sid === null) return;
|
|
415
|
+
const binding = sessions.binding(sid);
|
|
416
|
+
if (binding === undefined) return;
|
|
417
|
+
binding.session.loadOlder().catch((err) => console.error(err));
|
|
418
|
+
}
|
|
419
|
+
async function loadAllPages() {
|
|
420
|
+
if (sessions === undefined || loadingAll) return;
|
|
421
|
+
const sid = state.sessionId;
|
|
422
|
+
if (sid === null) return;
|
|
423
|
+
const binding = sessions.binding(sid);
|
|
424
|
+
if (binding === undefined) return;
|
|
425
|
+
loadingAll = true;
|
|
426
|
+
setState({ loadingAll: true });
|
|
427
|
+
try {
|
|
428
|
+
let guard = 0;
|
|
429
|
+
while (binding.session.getSnapshot().hasMore && guard < 500) {
|
|
430
|
+
await binding.session.loadOlder();
|
|
431
|
+
guard += 1;
|
|
432
|
+
}
|
|
433
|
+
} catch (err) {
|
|
434
|
+
console.error(err);
|
|
435
|
+
} finally {
|
|
436
|
+
loadingAll = false;
|
|
437
|
+
setState({ loadingAll: false });
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/* ---------- outline derivation from ConversationSnapshot ---------- */
|
|
442
|
+
const KIND_META = {
|
|
443
|
+
"user": { label: "你", cls: "traj-user" },
|
|
444
|
+
"steering": { label: "插话", cls: "traj-user" },
|
|
445
|
+
"context": { label: "上下文", cls: "traj-context" },
|
|
446
|
+
"assistant-step": { label: "助手", cls: "traj-assistant" },
|
|
447
|
+
"tool-call": { label: "工具", cls: "traj-tool" },
|
|
448
|
+
"command": { label: "命令", cls: "other-command" },
|
|
449
|
+
"compaction": { label: "压缩", cls: "traj-compacted" },
|
|
450
|
+
"manual-compaction": { label: "压缩", cls: "traj-compacted" },
|
|
451
|
+
"turn-error": { label: "出错", cls: "other-error" },
|
|
452
|
+
"turn-max-tokens": { label: "截断", cls: "other-error" },
|
|
453
|
+
"model-retry": { label: "重试", cls: "other-retry" },
|
|
454
|
+
"workflow-run": { label: "流程", cls: "other-neutral" },
|
|
455
|
+
"unknown": { label: "其他", cls: "other-neutral" },
|
|
456
|
+
};
|
|
457
|
+
function firstText(blocks) {
|
|
458
|
+
if (!Array.isArray(blocks)) return null;
|
|
459
|
+
for (const b of blocks) {
|
|
460
|
+
if (!b || typeof b !== "object") continue;
|
|
461
|
+
if ((b.type === "text" || b.kind === "text") && typeof b.text === "string" && b.text.trim() !== "") return b.text;
|
|
462
|
+
}
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
/* Searchable dialogue text: user questions + agent actual dialogue only
|
|
466
|
+
(excludes context, tool calls, commands, compaction, reasoning, etc.) */
|
|
467
|
+
function dialogueText(node) {
|
|
468
|
+
const d = node && node.data;
|
|
469
|
+
if (!d || typeof d !== "object") return null;
|
|
470
|
+
if (node.kind === "user") return firstText(d.content);
|
|
471
|
+
if (node.kind === "assistant-step") {
|
|
472
|
+
if (!Array.isArray(d.blocks)) return null;
|
|
473
|
+
const parts = [];
|
|
474
|
+
for (const b of d.blocks) {
|
|
475
|
+
if (!b || typeof b !== "object") continue;
|
|
476
|
+
if ((b.type === "text" || b.kind === "text") && typeof b.text === "string" && b.text.trim() !== "") parts.push(b.text.trim());
|
|
477
|
+
}
|
|
478
|
+
return parts.length > 0 ? parts.join(" ") : null;
|
|
479
|
+
}
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
/* Full user question text (all text blocks) for the hover bubble. */
|
|
483
|
+
function fullDialogueText(node) {
|
|
484
|
+
const d = node && node.data;
|
|
485
|
+
if (!d || typeof d !== "object") return null;
|
|
486
|
+
if (node.kind !== "user") return null;
|
|
487
|
+
if (typeof d.content === "string") {
|
|
488
|
+
const t = d.content.trim();
|
|
489
|
+
return t === "" ? null : t;
|
|
490
|
+
}
|
|
491
|
+
if (!Array.isArray(d.content)) return null;
|
|
492
|
+
const parts = [];
|
|
493
|
+
for (const b of d.content) {
|
|
494
|
+
if (!b || typeof b !== "object") continue;
|
|
495
|
+
if ((b.type === "text" || b.kind === "text") && typeof b.text === "string" && b.text.trim() !== "") parts.push(b.text.trim());
|
|
496
|
+
}
|
|
497
|
+
return parts.length > 0 ? parts.join("\n") : null;
|
|
498
|
+
}
|
|
499
|
+
function previewFor(node) {
|
|
500
|
+
const d = node && node.data;
|
|
501
|
+
if (!d || typeof d !== "object") return null;
|
|
502
|
+
switch (node.kind) {
|
|
503
|
+
case "user":
|
|
504
|
+
case "steering":
|
|
505
|
+
case "context":
|
|
506
|
+
return firstText(d.content);
|
|
507
|
+
case "assistant-step": {
|
|
508
|
+
const text = firstText(d.blocks);
|
|
509
|
+
if (text !== null) return text;
|
|
510
|
+
if (Array.isArray(d.blocks) && d.blocks.some((b) => b && b.kind === "tool-call")) return "调用工具";
|
|
511
|
+
return d.status === "running" ? "进行中…" : null;
|
|
512
|
+
}
|
|
513
|
+
case "tool-call": {
|
|
514
|
+
const root = d.root;
|
|
515
|
+
if (!root || typeof root !== "object") return null;
|
|
516
|
+
if (root.isError === true) return "执行失败";
|
|
517
|
+
const name = typeof root.name === "string" ? root.name
|
|
518
|
+
: (root.call && typeof root.call.name === "string" ? root.call.name : null);
|
|
519
|
+
return name;
|
|
520
|
+
}
|
|
521
|
+
case "command":
|
|
522
|
+
return typeof d.name === "string" ? d.name + (typeof d.args === "string" && d.args !== "" ? " " + d.args : "") : null;
|
|
523
|
+
case "compaction":
|
|
524
|
+
return typeof d.summary === "string" ? d.summary : "上下文已压缩";
|
|
525
|
+
case "manual-compaction": {
|
|
526
|
+
const c = d.compaction;
|
|
527
|
+
if (c && typeof c.summary === "string") return c.summary;
|
|
528
|
+
return "手动压缩";
|
|
529
|
+
}
|
|
530
|
+
case "turn-error":
|
|
531
|
+
return typeof d.message === "string" ? d.message : "本轮出错";
|
|
532
|
+
case "turn-max-tokens":
|
|
533
|
+
return "达到输出上限";
|
|
534
|
+
case "model-retry": {
|
|
535
|
+
const n = Array.isArray(d.attempts) ? d.attempts.length : 0;
|
|
536
|
+
return "自动重试" + (n > 0 ? " ×" + n : "…");
|
|
537
|
+
}
|
|
538
|
+
case "unknown":
|
|
539
|
+
return typeof d.type === "string" ? "未知事件 " + d.type : "未知事件";
|
|
540
|
+
default:
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function timeOf(node) {
|
|
545
|
+
const d = node && node.data;
|
|
546
|
+
if (!d || typeof d !== "object") return null;
|
|
547
|
+
const t = typeof d.time === "number" ? d.time
|
|
548
|
+
: (d.root && typeof d.root.time === "number" ? d.root.time : null);
|
|
549
|
+
return t;
|
|
550
|
+
}
|
|
551
|
+
function fmtTime(ms) {
|
|
552
|
+
if (typeof ms !== "number" || !isFinite(ms)) return "";
|
|
553
|
+
const d = new Date(ms);
|
|
554
|
+
const h = d.getHours();
|
|
555
|
+
const m = d.getMinutes();
|
|
556
|
+
return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m);
|
|
557
|
+
}
|
|
558
|
+
function turnOf(node) {
|
|
559
|
+
const loc = node && node.location;
|
|
560
|
+
if (!loc) return null;
|
|
561
|
+
if (loc.kind === "step" || loc.kind === "turn") return loc.turn.turn;
|
|
562
|
+
return null;
|
|
563
|
+
}
|
|
564
|
+
function truncate(text, max) {
|
|
565
|
+
if (typeof text !== "string") return "";
|
|
566
|
+
if (text.length <= max) return text;
|
|
567
|
+
return text.slice(0, max) + "…";
|
|
568
|
+
}
|
|
569
|
+
function deriveOutline(snap) {
|
|
570
|
+
const empty = { groups: [], count: 0, byKey: {} };
|
|
571
|
+
if (snap === null || snap === undefined) return empty;
|
|
572
|
+
const order = snap.chat && snap.chat.order;
|
|
573
|
+
const nodes = snap.chat && snap.chat.nodes;
|
|
574
|
+
if (!Array.isArray(order) || nodes === undefined) return empty;
|
|
575
|
+
const groups = [];
|
|
576
|
+
const byKey = {};
|
|
577
|
+
let current = null;
|
|
578
|
+
let count = 0;
|
|
579
|
+
for (const key of order) {
|
|
580
|
+
const node = nodes.get(key);
|
|
581
|
+
if (node === undefined) continue;
|
|
582
|
+
const meta = KIND_META[node.kind] || KIND_META.unknown;
|
|
583
|
+
const item = {
|
|
584
|
+
key: node.key,
|
|
585
|
+
kind: node.kind,
|
|
586
|
+
label: meta.label,
|
|
587
|
+
cls: meta.cls,
|
|
588
|
+
preview: previewFor(node),
|
|
589
|
+
search: dialogueText(node),
|
|
590
|
+
full: fullDialogueText(node),
|
|
591
|
+
time: fmtTime(timeOf(node)),
|
|
592
|
+
};
|
|
593
|
+
const turn = turnOf(node);
|
|
594
|
+
if (turn === null) {
|
|
595
|
+
groups.push({ turn: null, items: [item], gid: "x" + groups.length });
|
|
596
|
+
count += 1;
|
|
597
|
+
current = null;
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
if (current === null || current.turn !== turn) {
|
|
601
|
+
current = { turn: turn, items: [], gid: "t" + turn };
|
|
602
|
+
groups.push(current);
|
|
603
|
+
}
|
|
604
|
+
current.items.push(item);
|
|
605
|
+
count += 1;
|
|
606
|
+
}
|
|
607
|
+
for (const g of groups) {
|
|
608
|
+
const first = g.items[0];
|
|
609
|
+
if (g.turn === null) {
|
|
610
|
+
g.title = first.label;
|
|
611
|
+
g.subtitle = truncate(first.preview || "", 60);
|
|
612
|
+
g.headKey = first.key;
|
|
613
|
+
g.headIsUser = false;
|
|
614
|
+
} else {
|
|
615
|
+
g.title = "第 " + g.turn + " 轮";
|
|
616
|
+
const head = first.kind === "user" ? first : null;
|
|
617
|
+
g.headKey = head ? head.key : first.key;
|
|
618
|
+
g.headIsUser = head !== null;
|
|
619
|
+
g.subtitle = truncate((head ? head.preview : first.preview) || "", 60);
|
|
620
|
+
}
|
|
621
|
+
for (const it of g.items) byKey[it.key] = g.gid;
|
|
622
|
+
}
|
|
623
|
+
return { groups: groups, count: count, byKey: byKey };
|
|
624
|
+
}
|
|
625
|
+
let cacheKey = null;
|
|
626
|
+
let cacheValue = null;
|
|
627
|
+
function selectOutline(snap) {
|
|
628
|
+
if (snap !== cacheKey) {
|
|
629
|
+
cacheKey = snap;
|
|
630
|
+
cacheValue = deriveOutline(snap);
|
|
631
|
+
}
|
|
632
|
+
return cacheValue;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/* ---------- DOM helpers: jump + position tracking ---------- */
|
|
636
|
+
function findAnchor(key) {
|
|
637
|
+
const rows = document.querySelectorAll("[data-chat-anchor-key]");
|
|
638
|
+
for (const row of rows) {
|
|
639
|
+
if (row.getAttribute("data-chat-anchor-key") === key) return row;
|
|
640
|
+
}
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
let lastActive = null;
|
|
644
|
+
function jumpTo(key) {
|
|
645
|
+
try {
|
|
646
|
+
const el = findAnchor(key);
|
|
647
|
+
if (el === null) return false;
|
|
648
|
+
el.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
649
|
+
lastActive = key;
|
|
650
|
+
setState({ activeKey: key });
|
|
651
|
+
return true;
|
|
652
|
+
} catch (err) {
|
|
653
|
+
console.error(err);
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
function computeActiveKey() {
|
|
658
|
+
try {
|
|
659
|
+
const scrollport = document.querySelector("[data-conversation-scroll]");
|
|
660
|
+
if (scrollport === null) return null;
|
|
661
|
+
const vp = scrollport.getBoundingClientRect();
|
|
662
|
+
const rows = document.querySelectorAll("[data-chat-anchor-key]");
|
|
663
|
+
let found = null;
|
|
664
|
+
for (const row of rows) {
|
|
665
|
+
const rect = row.getBoundingClientRect();
|
|
666
|
+
if (rect.bottom > vp.top) { found = row; break; }
|
|
667
|
+
}
|
|
668
|
+
if (found === null && rows.length > 0) found = rows[rows.length - 1];
|
|
669
|
+
return found === null ? null : found.getAttribute("data-chat-anchor-key");
|
|
670
|
+
} catch (err) {
|
|
671
|
+
console.error(err);
|
|
672
|
+
return null;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
let panelEl = null;
|
|
677
|
+
let listEl = null;
|
|
678
|
+
let dragMove = null;
|
|
679
|
+
let resizeStart = null; /* { x, y, w, h, docked } for the corner grip */
|
|
680
|
+
const itemEls = {};
|
|
681
|
+
const groupEls = {};
|
|
682
|
+
|
|
683
|
+
/* ---------- header toggle button ---------- */
|
|
684
|
+
function ToggleButton(props) {
|
|
685
|
+
const snap = useStore();
|
|
686
|
+
const outline = props.useSession(selectOutline);
|
|
687
|
+
const hasMore = props.useSession((s) => s.hasMore);
|
|
688
|
+
const loadingOlder = props.useSession((s) => s.loadingOlder);
|
|
689
|
+
React.useEffect(() => {
|
|
690
|
+
setState({ sessionId: props.sessionId, outline: outline, hasMore: hasMore, loadingOlder: loadingOlder });
|
|
691
|
+
}, [outline, props.sessionId, hasMore, loadingOlder]);
|
|
692
|
+
React.useEffect(() => {
|
|
693
|
+
if (state.sessionId !== null && state.sessionId !== props.sessionId) {
|
|
694
|
+
lastActive = null;
|
|
695
|
+
setState({ activeKey: null, expanded: {} });
|
|
696
|
+
}
|
|
697
|
+
}, [props.sessionId]);
|
|
698
|
+
return React.createElement(Tooltip, {
|
|
699
|
+
label: snap.open ? "收起会话导航" : "打开会话导航",
|
|
700
|
+
side: "bottom",
|
|
701
|
+
delayMs: 500,
|
|
702
|
+
},
|
|
703
|
+
React.createElement("span", null,
|
|
704
|
+
React.createElement(Button, {
|
|
705
|
+
variant: snap.open ? "primary" : "ghost",
|
|
706
|
+
size: "sm",
|
|
707
|
+
icon: React.createElement(ToggleIcon),
|
|
708
|
+
"aria-pressed": snap.open,
|
|
709
|
+
onClick: () => setState({ open: !snap.open }),
|
|
710
|
+
}, "导航"),
|
|
711
|
+
),
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/* ---------- floating navigator panel ---------- */
|
|
716
|
+
function Panel() {
|
|
717
|
+
const snap = useStore();
|
|
718
|
+
const [filter, setFilter] = React.useState("");
|
|
719
|
+
const [searchOpen, setSearchOpen] = React.useState(false);
|
|
720
|
+
const viewMode = snap.viewMode; /* full | hidden | minimal | minimal-left */
|
|
721
|
+
const turnsHidden = viewMode !== "full";
|
|
722
|
+
function nextModeLabel() {
|
|
723
|
+
return viewMode === "full" ? "隐藏轮次" : viewMode === "hidden" ? "极简·右" : viewMode === "minimal" ? "极简·左" : "显示轮次";
|
|
724
|
+
}
|
|
725
|
+
function cycleMode() {
|
|
726
|
+
const next = viewMode === "full" ? "hidden" : viewMode === "hidden" ? "minimal" : viewMode === "minimal" ? "minimal-left" : "full";
|
|
727
|
+
setState({ viewMode: next });
|
|
728
|
+
persistUi();
|
|
729
|
+
}
|
|
730
|
+
function toggleSearch() {
|
|
731
|
+
if (searchOpen) setFilter("");
|
|
732
|
+
setSearchOpen(!searchOpen);
|
|
733
|
+
}
|
|
734
|
+
/* ---------- 拖动定位(仅面板形式, 极简条不参与) ---------- */
|
|
735
|
+
function startDrag(e) {
|
|
736
|
+
if (e.button !== 0) return;
|
|
737
|
+
if (typeof e.target.closest === "function" && e.target.closest("button") !== null) return;
|
|
738
|
+
const el = panelEl;
|
|
739
|
+
if (el === null) return;
|
|
740
|
+
dragMove = { startX: e.clientX, startY: e.clientY, baseLeft: el.offsetLeft, baseTop: el.offsetTop, el: el, dragging: false };
|
|
741
|
+
try { e.currentTarget.setPointerCapture(e.pointerId); } catch (err) { /* 忽略捕获失败 */ }
|
|
742
|
+
}
|
|
743
|
+
function moveDrag(e) {
|
|
744
|
+
const d = dragMove;
|
|
745
|
+
if (d === null) return;
|
|
746
|
+
const dx = e.clientX - d.startX;
|
|
747
|
+
const dy = e.clientY - d.startY;
|
|
748
|
+
if (!d.dragging && (Math.abs(dx) > 3 || Math.abs(dy) > 3)) {
|
|
749
|
+
d.dragging = true;
|
|
750
|
+
d.el.classList.add("cnvnav-dragging");
|
|
751
|
+
}
|
|
752
|
+
if (!d.dragging) return;
|
|
753
|
+
const vw = document.documentElement.clientWidth || 1000;
|
|
754
|
+
const vh = document.documentElement.clientHeight || 800;
|
|
755
|
+
const w = d.el.offsetWidth || 288;
|
|
756
|
+
const h = d.el.offsetHeight || 200;
|
|
757
|
+
const left = Math.min(Math.max(8, d.baseLeft + dx), Math.max(8, vw - w - 8));
|
|
758
|
+
const top = Math.min(Math.max(8, d.baseTop + dy), Math.max(8, vh - h - 8));
|
|
759
|
+
d.el.style.left = Math.round(left) + "px";
|
|
760
|
+
d.el.style.top = Math.round(top) + "px";
|
|
761
|
+
}
|
|
762
|
+
function endDrag() {
|
|
763
|
+
const d = dragMove;
|
|
764
|
+
dragMove = null;
|
|
765
|
+
if (d === null || !d.dragging) return;
|
|
766
|
+
d.el.classList.remove("cnvnav-dragging");
|
|
767
|
+
const r = d.el.getBoundingClientRect();
|
|
768
|
+
/* 拖完同步封顶(与 place() 浮动分支一致): 上边缘固定, 高度至多半屏 */
|
|
769
|
+
const vh = document.documentElement.clientHeight || 800;
|
|
770
|
+
d.el.style.maxHeight = Math.max(160, Math.round(Math.min(vh / 2, vh - Math.max(8, Math.round(r.top)) - 8))) + "px";
|
|
771
|
+
setState({ docked: false, userPos: { left: Math.round(r.left), top: Math.round(r.top) } });
|
|
772
|
+
persistUi();
|
|
773
|
+
}
|
|
774
|
+
/* ---------- 左下角拖拽缩放(仅普通面板) ---------- */
|
|
775
|
+
const MIN_PANEL_H = 90; /* 约 3 轮 */
|
|
776
|
+
function startResize(e) {
|
|
777
|
+
if (e.button !== 0) return;
|
|
778
|
+
if (resizeStart !== null) return;
|
|
779
|
+
const el = panelEl;
|
|
780
|
+
if (el === null) return;
|
|
781
|
+
resizeStart = {
|
|
782
|
+
startX: e.clientX, startY: e.clientY,
|
|
783
|
+
baseW: el.offsetWidth || 288,
|
|
784
|
+
baseH: el.offsetHeight || 200,
|
|
785
|
+
baseMaxH: (function () { const v = parseInt(el.style.maxHeight, 10); return Number.isFinite(v) && v > 0 ? v : (el.offsetHeight || 200); })(),
|
|
786
|
+
el: el,
|
|
787
|
+
};
|
|
788
|
+
try { e.currentTarget.setPointerCapture(e.pointerId); } catch (err) { /* 忽略 */ }
|
|
789
|
+
}
|
|
790
|
+
function moveResize(e) {
|
|
791
|
+
const d = resizeStart;
|
|
792
|
+
if (d === null) return;
|
|
793
|
+
const vh = document.documentElement.clientHeight || 800;
|
|
794
|
+
const dx = e.clientX - d.startX;
|
|
795
|
+
const dy = e.clientY - d.startY;
|
|
796
|
+
/* 高度用 maxHeight + height:auto: 实际高度 = min(内容, 上限)。
|
|
797
|
+
以拖拽起点为基准线性跟随鼠标(无漂移/无状态跳变):
|
|
798
|
+
拖小立即压缩出滚动, 拖大在内容充足时线性恢复更多行;
|
|
799
|
+
内容不足时面板保持内容高(拖动无感, 属预期)。 */
|
|
800
|
+
const r = d.el.getBoundingClientRect();
|
|
801
|
+
const sp = document.querySelector("[data-conversation-scroll]");
|
|
802
|
+
/* 上限必须与 place() 各分支一致, 否则松手后会被 place 压回造成跳变:
|
|
803
|
+
docked/常规 = min(容器高-24, vh-40); 自由位置 = vh-顶-8 */
|
|
804
|
+
const sr = sp !== null ? sp.getBoundingClientRect() : null;
|
|
805
|
+
const cap = Math.max(MIN_PANEL_H, Math.round(
|
|
806
|
+
state.docked && sr !== null
|
|
807
|
+
? Math.min(sr.height - 24, vh - 40)
|
|
808
|
+
: vh - r.top - 8
|
|
809
|
+
));
|
|
810
|
+
const nw = Math.min(Math.max(240, d.baseW - dx), 560);
|
|
811
|
+
/* 目标上限 = 起点可见高 + 总位移, 线性且可逆 */
|
|
812
|
+
const nMaxH = Math.min(Math.max(MIN_PANEL_H, d.baseH + dy), cap);
|
|
813
|
+
const left = Math.max(8, r.right - nw);
|
|
814
|
+
d.el.style.width = Math.round(nw) + "px";
|
|
815
|
+
d.el.style.left = Math.round(left) + "px";
|
|
816
|
+
d.el.style.height = "";
|
|
817
|
+
d.el.style.maxHeight = Math.round(nMaxH) + "px";
|
|
818
|
+
}
|
|
819
|
+
function endResize() {
|
|
820
|
+
const d = resizeStart;
|
|
821
|
+
resizeStart = null;
|
|
822
|
+
if (d === null) return;
|
|
823
|
+
const el = d.el;
|
|
824
|
+
const rect = el.getBoundingClientRect();
|
|
825
|
+
const nw = el.offsetWidth;
|
|
826
|
+
const parsed = parseInt(el.style.maxHeight, 10);
|
|
827
|
+
const nh = Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
828
|
+
if (state.docked) {
|
|
829
|
+
setState({ panelWidth: Math.round(nw), panelHeight: nh });
|
|
830
|
+
} else {
|
|
831
|
+
setState({ panelWidth: Math.round(nw), panelHeight: nh, userPos: { left: Math.round(rect.left), top: Math.round(rect.top) } });
|
|
832
|
+
}
|
|
833
|
+
persistUi();
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
React.useEffect(() => {
|
|
837
|
+
if (!snap.open) return;
|
|
838
|
+
let lastKey = null;
|
|
839
|
+
let stableTicks = 0;
|
|
840
|
+
let misses = 0;
|
|
841
|
+
function place() {
|
|
842
|
+
const panel = panelEl;
|
|
843
|
+
if (panel === null) return false;
|
|
844
|
+
if (dragMove !== null) return true;
|
|
845
|
+
const vw = document.documentElement.clientWidth || 1000;
|
|
846
|
+
const vh = document.documentElement.clientHeight || 800;
|
|
847
|
+
const mini = viewMode === "minimal" || viewMode === "minimal-left";
|
|
848
|
+
const alignLeft = viewMode === "minimal-left";
|
|
849
|
+
const width = (state.panelWidth || 288);
|
|
850
|
+
/* 面板宽度对非极简模式统一生效, 确保拖动(未停靠)状态下也能实时刷新 */
|
|
851
|
+
if (!mini) panel.style.width = width + "px";
|
|
852
|
+
/* 面板被拖走后不再自动停靠: 夹进视口、上边缘固定, 展开高度至多半屏以便下方留白 */
|
|
853
|
+
if (!mini && !state.docked && state.userPos !== null) {
|
|
854
|
+
const w = panel.offsetWidth || 288;
|
|
855
|
+
const h = panel.offsetHeight || 200;
|
|
856
|
+
const left = Math.min(Math.max(8, Math.round(state.userPos.left)), Math.max(8, vw - w - 8));
|
|
857
|
+
const top = Math.min(Math.max(8, Math.round(state.userPos.top)), Math.max(8, vh - h - 8));
|
|
858
|
+
const fh = state.panelHeight;
|
|
859
|
+
const cap = Math.max(MIN_PANEL_H, Math.round(vh - top - 8));
|
|
860
|
+
const def = Math.max(MIN_PANEL_H, Math.round(Math.min(vh / 2, vh - top - 8)));
|
|
861
|
+
panel.style.height = "";
|
|
862
|
+
panel.style.maxHeight = Math.max(MIN_PANEL_H, Math.min(typeof fh === "number" && fh > 0 ? fh : def, cap)) + "px";
|
|
863
|
+
panel.style.left = left + "px";
|
|
864
|
+
panel.style.top = top + "px";
|
|
865
|
+
panel.classList.remove("cnvnav-panel-unplaced");
|
|
866
|
+
return true;
|
|
867
|
+
}
|
|
868
|
+
const sp = document.querySelector("[data-conversation-scroll]");
|
|
869
|
+
const MINI_H = 220;
|
|
870
|
+
if (sp === null) {
|
|
871
|
+
/* 会话视图可能尚未挂载(刷新/重启/切会话时面板先就位);
|
|
872
|
+
非会话页(设置页等)则永远没有该容器。
|
|
873
|
+
连续 15 次(约 6s)仍未出现才回退到视口定位, 否则保持隐藏等待校准。 */
|
|
874
|
+
misses += 1;
|
|
875
|
+
if (misses >= 15) {
|
|
876
|
+
if (mini) {
|
|
877
|
+
/* 极简: 水平锚定, 右对齐由 CSS right 负责, 左对齐钉在视口左侧 */
|
|
878
|
+
if (alignLeft) {
|
|
879
|
+
panel.style.left = "12px";
|
|
880
|
+
panel.style.right = "auto";
|
|
881
|
+
} else {
|
|
882
|
+
panel.style.left = "";
|
|
883
|
+
panel.style.right = "";
|
|
884
|
+
}
|
|
885
|
+
panel.style.top = Math.max(8, Math.round((vh - MINI_H) / 2)) + "px";
|
|
886
|
+
panel.style.maxHeight = MINI_H + "px";
|
|
887
|
+
} else {
|
|
888
|
+
panel.style.left = Math.max(8, vw - width - 12) + "px";
|
|
889
|
+
panel.style.top = Math.max(8, 60) + "px";
|
|
890
|
+
const fh = state.panelHeight;
|
|
891
|
+
const cap = Math.round(vh - 90);
|
|
892
|
+
const def = cap;
|
|
893
|
+
panel.style.height = "";
|
|
894
|
+
panel.style.maxHeight = Math.max(MIN_PANEL_H, Math.min(typeof fh === "number" && fh > 0 ? fh : def, cap)) + "px";
|
|
895
|
+
}
|
|
896
|
+
panel.classList.remove("cnvnav-panel-unplaced");
|
|
897
|
+
return true;
|
|
898
|
+
}
|
|
899
|
+
return false;
|
|
900
|
+
}
|
|
901
|
+
const r = sp.getBoundingClientRect();
|
|
902
|
+
const key = mini
|
|
903
|
+
? [Math.round(r.left), Math.round(r.top), Math.round(r.height), Math.round(vh)].join("|")
|
|
904
|
+
: [Math.round(r.top), Math.round(r.height), Math.round(vw), Math.round(vh)].join("|");
|
|
905
|
+
if (key !== lastKey) {
|
|
906
|
+
lastKey = key;
|
|
907
|
+
if (mini) {
|
|
908
|
+
/* 极简: 右对齐由 CSS(right)锚定视口右缘, 左对齐钉在对话区左缘 */
|
|
909
|
+
if (alignLeft) {
|
|
910
|
+
panel.style.left = Math.max(8, Math.round(r.left + 12)) + "px";
|
|
911
|
+
panel.style.right = "auto";
|
|
912
|
+
} else {
|
|
913
|
+
panel.style.left = "";
|
|
914
|
+
panel.style.right = "";
|
|
915
|
+
}
|
|
916
|
+
panel.style.top = Math.max(8, Math.round(r.top + (r.height - MINI_H) / 2)) + "px";
|
|
917
|
+
panel.style.maxHeight = MINI_H + "px";
|
|
918
|
+
} else {
|
|
919
|
+
panel.style.left = Math.max(8, vw - width - 12) + "px";
|
|
920
|
+
panel.style.top = Math.max(8, Math.round(r.top + 8)) + "px";
|
|
921
|
+
const fh = state.panelHeight;
|
|
922
|
+
const cap = Math.max(MIN_PANEL_H, Math.round(Math.min(r.height - 24, vh - 40)));
|
|
923
|
+
const def = cap;
|
|
924
|
+
panel.style.height = "";
|
|
925
|
+
panel.style.maxHeight = Math.max(MIN_PANEL_H, Math.min(typeof fh === "number" && fh > 0 ? fh : def, cap)) + "px";
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
panel.classList.remove("cnvnav-panel-unplaced");
|
|
929
|
+
return true;
|
|
930
|
+
}
|
|
931
|
+
place();
|
|
932
|
+
/* 每 400ms 复查: 容器出现即校准; 布局连续 3 次无变化后停止 */
|
|
933
|
+
let id = setInterval(() => {
|
|
934
|
+
const before = lastKey;
|
|
935
|
+
if (!place()) return;
|
|
936
|
+
if (lastKey !== null && lastKey === before) {
|
|
937
|
+
stableTicks += 1;
|
|
938
|
+
if (stableTicks >= 3) clearInterval(id);
|
|
939
|
+
} else {
|
|
940
|
+
stableTicks = 0;
|
|
941
|
+
}
|
|
942
|
+
}, 400);
|
|
943
|
+
window.addEventListener("resize", place);
|
|
944
|
+
/* 左对齐极简条需跟随左侧栏展开/折叠: 对话区宽度变化时重新校准 */
|
|
945
|
+
let ro = null;
|
|
946
|
+
const roTarget = document.querySelector("[data-conversation-scroll]");
|
|
947
|
+
if (typeof ResizeObserver === "function" && roTarget !== null) {
|
|
948
|
+
ro = new ResizeObserver(() => { place(); });
|
|
949
|
+
ro.observe(roTarget);
|
|
950
|
+
}
|
|
951
|
+
return () => {
|
|
952
|
+
clearInterval(id);
|
|
953
|
+
window.removeEventListener("resize", place);
|
|
954
|
+
if (ro !== null) ro.disconnect();
|
|
955
|
+
};
|
|
956
|
+
}, [snap.open, snap.sessionId, viewMode, state.docked, state.userPos, state.panelWidth, state.panelHeight]);
|
|
957
|
+
|
|
958
|
+
React.useEffect(() => {
|
|
959
|
+
if (!snap.open) return;
|
|
960
|
+
const run = () => {
|
|
961
|
+
const key = computeActiveKey();
|
|
962
|
+
if (key !== lastActive) {
|
|
963
|
+
lastActive = key;
|
|
964
|
+
setState({ activeKey: key });
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
const update = timer !== undefined ? timer.throttle(run, 120) : run;
|
|
968
|
+
document.addEventListener("scroll", update, true);
|
|
969
|
+
window.addEventListener("resize", update);
|
|
970
|
+
run();
|
|
971
|
+
return () => {
|
|
972
|
+
document.removeEventListener("scroll", update, true);
|
|
973
|
+
window.removeEventListener("resize", update);
|
|
974
|
+
if (timer !== undefined && typeof update.dispose === "function") update.dispose();
|
|
975
|
+
};
|
|
976
|
+
}, [snap.open]);
|
|
977
|
+
|
|
978
|
+
React.useEffect(() => {
|
|
979
|
+
if (!snap.open || snap.activeKey === null) return;
|
|
980
|
+
let target = itemEls[snap.activeKey];
|
|
981
|
+
if (target === undefined || target === null || (typeof target.closest === "function" && target.closest(".cnvnav-steps-collapsed") !== null)) {
|
|
982
|
+
const gid = snap.outline !== null ? snap.outline.byKey[snap.activeKey] : undefined;
|
|
983
|
+
if (gid !== undefined) target = groupEls[gid];
|
|
984
|
+
}
|
|
985
|
+
const list = listEl;
|
|
986
|
+
if (target !== undefined && target !== null && list !== null) {
|
|
987
|
+
const lr = list.getBoundingClientRect();
|
|
988
|
+
const er = target.getBoundingClientRect();
|
|
989
|
+
const rel = er.top - lr.top + list.scrollTop;
|
|
990
|
+
if (rel < list.scrollTop || rel + er.height > list.scrollTop + list.clientHeight) {
|
|
991
|
+
list.scrollTo({ top: Math.max(0, rel - list.clientHeight / 2), behavior: "smooth" });
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}, [snap.open, snap.activeKey]);
|
|
995
|
+
|
|
996
|
+
const groups = snap.outline !== null ? snap.outline.groups : [];
|
|
997
|
+
const count = snap.outline !== null ? snap.outline.count : 0;
|
|
998
|
+
const hasExpanded = Object.keys(snap.expanded).some((k) => snap.expanded[k] === true);
|
|
999
|
+
|
|
1000
|
+
/* ---------- 极简模式(右/左对齐): 只保留定位 ---------- */
|
|
1001
|
+
if (viewMode === "minimal" || viewMode === "minimal-left") {
|
|
1002
|
+
const miniRows = [];
|
|
1003
|
+
for (const g of groups) {
|
|
1004
|
+
if (g.turn === null) continue;
|
|
1005
|
+
miniRows.push({
|
|
1006
|
+
key: g.headKey,
|
|
1007
|
+
text: g.subtitle,
|
|
1008
|
+
full: g.headIsUser && g.items.length > 0 ? g.items[0].full : null,
|
|
1009
|
+
active: g.items.some((it) => it.key === snap.activeKey),
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
return React.createElement("div", {
|
|
1013
|
+
ref: (el) => { panelEl = el; },
|
|
1014
|
+
className: "cnvnav-mini-wrap" + (viewMode === "minimal-left" ? " cnvnav-mini-wrap-left" : "") + " cnvnav-panel-unplaced" + (snap.open ? "" : " cnvnav-panel-hidden"),
|
|
1015
|
+
role: "complementary",
|
|
1016
|
+
"aria-label": "会话导航",
|
|
1017
|
+
"aria-hidden": !snap.open,
|
|
1018
|
+
},
|
|
1019
|
+
React.createElement(Tooltip, {
|
|
1020
|
+
label: nextModeLabel(),
|
|
1021
|
+
side: "top",
|
|
1022
|
+
delayMs: 500,
|
|
1023
|
+
},
|
|
1024
|
+
React.createElement("span", { className: "cnvnav-mini-fab" },
|
|
1025
|
+
React.createElement(Button, {
|
|
1026
|
+
variant: "ghost",
|
|
1027
|
+
size: "sm",
|
|
1028
|
+
icon: React.createElement(SwitchTurnsIcon),
|
|
1029
|
+
"aria-pressed": true,
|
|
1030
|
+
onClick: () => cycleMode(),
|
|
1031
|
+
}),
|
|
1032
|
+
),
|
|
1033
|
+
),
|
|
1034
|
+
React.createElement("div", { className: "cnvnav-mini-panel" },
|
|
1035
|
+
React.createElement("div", {
|
|
1036
|
+
ref: (el) => { listEl = el; },
|
|
1037
|
+
className: "cnvnav-mini-list",
|
|
1038
|
+
},
|
|
1039
|
+
groups.length === 0
|
|
1040
|
+
? React.createElement("div", { className: "cnvnav-empty" }, "当前会话暂无对话节点")
|
|
1041
|
+
: miniRows.map((r) => React.createElement(Tooltip, {
|
|
1042
|
+
key: r.key,
|
|
1043
|
+
label: r.full !== null ? r.full : "跳转到此位置",
|
|
1044
|
+
side: "top",
|
|
1045
|
+
delayMs: 500,
|
|
1046
|
+
maxWidth: 340,
|
|
1047
|
+
},
|
|
1048
|
+
React.createElement("button", {
|
|
1049
|
+
type: "button",
|
|
1050
|
+
ref: (el) => { itemEls[r.key] = el; },
|
|
1051
|
+
className: "cnvnav-mini-item" + (r.active ? " cnvnav-mini-item-active" : ""),
|
|
1052
|
+
onClick: () => jumpTo(r.key),
|
|
1053
|
+
}, r.text),
|
|
1054
|
+
)),
|
|
1055
|
+
),
|
|
1056
|
+
),
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
const kw = filter.trim().toLowerCase();
|
|
1061
|
+
const filtering = kw !== "";
|
|
1062
|
+
function hit(text) {
|
|
1063
|
+
return typeof text === "string" && text !== "" && text.toLowerCase().indexOf(kw) !== -1;
|
|
1064
|
+
}
|
|
1065
|
+
/* Split text into nodes, wrapping every case-insensitive keyword match in a <mark>. */
|
|
1066
|
+
function highlightedNodes(text, kw) {
|
|
1067
|
+
if (typeof text !== "string" || kw === "") return [text];
|
|
1068
|
+
const lower = text.toLowerCase();
|
|
1069
|
+
const out = [];
|
|
1070
|
+
let i = 0;
|
|
1071
|
+
let m = 0;
|
|
1072
|
+
for (;;) {
|
|
1073
|
+
const idx = lower.indexOf(kw, i);
|
|
1074
|
+
if (idx === -1) { if (i < text.length) out.push(text.slice(i)); break; }
|
|
1075
|
+
if (idx > i) out.push(text.slice(i, idx));
|
|
1076
|
+
out.push(React.createElement("mark", { key: "m" + (m++), className: "cnvnav-hl" }, text.slice(idx, idx + kw.length)));
|
|
1077
|
+
i = idx + kw.length;
|
|
1078
|
+
}
|
|
1079
|
+
return out;
|
|
1080
|
+
}
|
|
1081
|
+
/* Window the text around the first keyword match (so the keyword is visible,
|
|
1082
|
+
not hidden behind head-truncation), then highlight every occurrence. */
|
|
1083
|
+
function snippetNodes(text, kw, before, after) {
|
|
1084
|
+
if (typeof text !== "string") return [text];
|
|
1085
|
+
const idx = text.toLowerCase().indexOf(kw);
|
|
1086
|
+
if (idx === -1) return highlightedNodes(text, kw);
|
|
1087
|
+
const start = Math.max(0, idx - before);
|
|
1088
|
+
const end = Math.min(text.length, idx + kw.length + after);
|
|
1089
|
+
const s = text.slice(start, end);
|
|
1090
|
+
const parts = [];
|
|
1091
|
+
if (start > 0) parts.push("…");
|
|
1092
|
+
parts.push(...highlightedNodes(s, kw));
|
|
1093
|
+
if (end < text.length) parts.push("…");
|
|
1094
|
+
return parts;
|
|
1095
|
+
}
|
|
1096
|
+
function renderItem(item, staggerMs) {
|
|
1097
|
+
const useSnippet = filtering && hit(item.search);
|
|
1098
|
+
const preview = useSnippet ? snippetNodes(item.search, kw, 5, 60) : item.preview;
|
|
1099
|
+
const hasPreview = preview !== null && preview !== "" && (!Array.isArray(preview) || preview.length > 0);
|
|
1100
|
+
return React.createElement("button", {
|
|
1101
|
+
key: item.key,
|
|
1102
|
+
type: "button",
|
|
1103
|
+
ref: (el) => { itemEls[item.key] = el; },
|
|
1104
|
+
className: "cnvnav-item" + (item.key === snap.activeKey ? " cnvnav-item-active" : "") + (staggerMs !== undefined ? " cnvnav-fade-item" : ""),
|
|
1105
|
+
style: staggerMs !== undefined ? { animationDelay: staggerMs + "ms" } : undefined,
|
|
1106
|
+
onClick: () => jumpTo(item.key),
|
|
1107
|
+
},
|
|
1108
|
+
React.createElement("span", { className: "cnvnav-badge cnvnav-badge-" + item.cls }, item.label),
|
|
1109
|
+
hasPreview
|
|
1110
|
+
? React.createElement("span", { className: "cnvnav-item-preview" }, preview)
|
|
1111
|
+
: null,
|
|
1112
|
+
item.time !== ""
|
|
1113
|
+
? React.createElement("span", { className: "cnvnav-item-time" }, item.time)
|
|
1114
|
+
: null,
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
function renderGroupHead(g, groupActive, chevron) {
|
|
1118
|
+
const headSearch = g.items.length > 0 ? g.items[0].search : null;
|
|
1119
|
+
const headFull = g.headIsUser && g.items.length > 0 ? g.items[0].full : null;
|
|
1120
|
+
const useSnippet = filtering && hit(headSearch);
|
|
1121
|
+
const sub = useSnippet ? snippetNodes(headSearch, kw, 5, 55) : g.subtitle;
|
|
1122
|
+
const hasSub = sub !== "" && (!Array.isArray(sub) || sub.length > 0);
|
|
1123
|
+
/* 标题策略:
|
|
1124
|
+
显示轮次: 轮次行 = 加粗「第 N 轮」; 压缩等非轮次行 = 加粗类型标签, 视作轮次同级
|
|
1125
|
+
隐藏轮次: 每行统一轨迹徽标 — 轮次头 = 「用户」业务蓝(助手开头则助手紫), 非轮次行 = 各自徽标(压缩=中性灰) */
|
|
1126
|
+
let titleNode = null;
|
|
1127
|
+
if (g.turn === null) {
|
|
1128
|
+
if (turnsHidden && g.items.length > 0) {
|
|
1129
|
+
const headItem = g.items[0];
|
|
1130
|
+
titleNode = React.createElement("span", {
|
|
1131
|
+
className: "cnvnav-badge cnvnav-badge-" + headItem.cls,
|
|
1132
|
+
}, headItem.label);
|
|
1133
|
+
} else {
|
|
1134
|
+
titleNode = React.createElement("span", { className: "cnvnav-group-title" }, g.title);
|
|
1135
|
+
}
|
|
1136
|
+
} else if (!turnsHidden) {
|
|
1137
|
+
titleNode = React.createElement("span", { className: "cnvnav-group-title" }, g.title);
|
|
1138
|
+
} else if (g.items.length > 0) {
|
|
1139
|
+
const headItem = g.items[0];
|
|
1140
|
+
titleNode = React.createElement("span", {
|
|
1141
|
+
className: "cnvnav-badge cnvnav-badge-" + headItem.cls,
|
|
1142
|
+
}, headItem.kind === "user" ? "用户" : headItem.label);
|
|
1143
|
+
}
|
|
1144
|
+
return React.createElement("div", {
|
|
1145
|
+
ref: (el) => { groupEls[g.gid] = el; },
|
|
1146
|
+
className: "cnvnav-group-row" + (groupActive ? " cnvnav-group-row-active" : ""),
|
|
1147
|
+
},
|
|
1148
|
+
React.createElement(Tooltip, {
|
|
1149
|
+
label: headFull !== null ? headFull : "跳转到此位置", maxWidth: 340,
|
|
1150
|
+
side: "top",
|
|
1151
|
+
delayMs: 500,
|
|
1152
|
+
},
|
|
1153
|
+
React.createElement("span", { className: "cnvnav-group-head-wrap" },
|
|
1154
|
+
React.createElement("button", {
|
|
1155
|
+
type: "button",
|
|
1156
|
+
className: "cnvnav-group-head",
|
|
1157
|
+
onClick: () => jumpTo(g.headKey),
|
|
1158
|
+
},
|
|
1159
|
+
titleNode,
|
|
1160
|
+
hasSub
|
|
1161
|
+
? React.createElement("span", { className: "cnvnav-group-sub" }, sub)
|
|
1162
|
+
: null,
|
|
1163
|
+
),
|
|
1164
|
+
),
|
|
1165
|
+
),
|
|
1166
|
+
chevron !== undefined ? chevron : null,
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
let groupNodes;
|
|
1171
|
+
if (filtering) {
|
|
1172
|
+
groupNodes = [];
|
|
1173
|
+
for (const g of groups) {
|
|
1174
|
+
const headHit = g.headIsUser && g.items.length > 0 && hit(g.items[0].search);
|
|
1175
|
+
const hits = g.items.filter((it, i) =>
|
|
1176
|
+
(it.kind === "user" || it.kind === "assistant-step") &&
|
|
1177
|
+
hit(it.search) &&
|
|
1178
|
+
!(i === 0 && g.headIsUser)
|
|
1179
|
+
);
|
|
1180
|
+
if (!headHit && hits.length === 0) continue;
|
|
1181
|
+
const groupActive = g.items.some((it) => it.key === snap.activeKey);
|
|
1182
|
+
groupNodes.push(React.createElement("div", {
|
|
1183
|
+
key: g.gid,
|
|
1184
|
+
className: "cnvnav-group cnvnav-fade-item",
|
|
1185
|
+
style: { animationDelay: (groupNodes.length * 18) + "ms" },
|
|
1186
|
+
},
|
|
1187
|
+
renderGroupHead(g, groupActive, null),
|
|
1188
|
+
hits.length > 0
|
|
1189
|
+
? React.createElement("div", { className: "cnvnav-steps" },
|
|
1190
|
+
React.createElement("div", { className: "cnvnav-steps-inner" },
|
|
1191
|
+
hits.map((it, i) => renderItem(it, i * 20)),
|
|
1192
|
+
),
|
|
1193
|
+
)
|
|
1194
|
+
: null,
|
|
1195
|
+
));
|
|
1196
|
+
}
|
|
1197
|
+
} else {
|
|
1198
|
+
groupNodes = groups.map((g) => {
|
|
1199
|
+
const expanded = snap.expanded[g.gid] === true;
|
|
1200
|
+
const isTurnGroup = g.turn !== null;
|
|
1201
|
+
const stepItems = isTurnGroup ? (g.headIsUser ? g.items.slice(1) : g.items) : [];
|
|
1202
|
+
const hasSteps = stepItems.length > 0;
|
|
1203
|
+
const groupActive = g.items.some((it) => it.key === snap.activeKey);
|
|
1204
|
+
const chevron = hasSteps
|
|
1205
|
+
? React.createElement(Tooltip, {
|
|
1206
|
+
label: expanded ? "折叠步次" : "展开步次",
|
|
1207
|
+
side: "top",
|
|
1208
|
+
delayMs: 500,
|
|
1209
|
+
},
|
|
1210
|
+
React.createElement("span", { className: "cnvnav-chevron-wrap" },
|
|
1211
|
+
React.createElement("button", {
|
|
1212
|
+
type: "button",
|
|
1213
|
+
className: "cnvnav-chevron",
|
|
1214
|
+
"aria-expanded": expanded,
|
|
1215
|
+
onClick: (e) => {
|
|
1216
|
+
e.stopPropagation();
|
|
1217
|
+
setState({ expanded: Object.assign({}, state.expanded, { [g.gid]: !expanded }) });
|
|
1218
|
+
},
|
|
1219
|
+
},
|
|
1220
|
+
React.createElement("svg", {
|
|
1221
|
+
className: "cnvnav-chevron-icon",
|
|
1222
|
+
viewBox: "0 0 24 24", width: 12, height: 12, fill: "none",
|
|
1223
|
+
stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
|
|
1224
|
+
"aria-hidden": true,
|
|
1225
|
+
},
|
|
1226
|
+
React.createElement("path", { d: "m9 18 6-6-6-6" }),
|
|
1227
|
+
),
|
|
1228
|
+
expanded ? null : React.createElement("span", { className: "cnvnav-chevron-count" }, String(stepItems.length)),
|
|
1229
|
+
),
|
|
1230
|
+
),
|
|
1231
|
+
)
|
|
1232
|
+
: null;
|
|
1233
|
+
return React.createElement("div", { key: g.gid, className: "cnvnav-group" },
|
|
1234
|
+
renderGroupHead(g, groupActive, chevron),
|
|
1235
|
+
hasSteps
|
|
1236
|
+
? React.createElement("div", {
|
|
1237
|
+
className: "cnvnav-steps" + (expanded ? "" : " cnvnav-steps-collapsed"),
|
|
1238
|
+
"aria-hidden": !expanded,
|
|
1239
|
+
},
|
|
1240
|
+
React.createElement("div", { className: "cnvnav-steps-inner" },
|
|
1241
|
+
stepItems.map(renderItem),
|
|
1242
|
+
),
|
|
1243
|
+
)
|
|
1244
|
+
: null,
|
|
1245
|
+
);
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
return React.createElement("div", {
|
|
1250
|
+
ref: (el) => { panelEl = el; },
|
|
1251
|
+
className: "cnvnav-panel cnvnav-panel-unplaced" + (snap.open ? "" : " cnvnav-panel-hidden"),
|
|
1252
|
+
role: "complementary",
|
|
1253
|
+
"aria-label": "会话导航",
|
|
1254
|
+
"aria-hidden": !snap.open,
|
|
1255
|
+
},
|
|
1256
|
+
React.createElement("div", {
|
|
1257
|
+
className: "cnvnav-head",
|
|
1258
|
+
onPointerDown: startDrag,
|
|
1259
|
+
onPointerMove: moveDrag,
|
|
1260
|
+
onPointerUp: endDrag,
|
|
1261
|
+
onPointerCancel: endDrag,
|
|
1262
|
+
},
|
|
1263
|
+
React.createElement(Tooltip, {
|
|
1264
|
+
label: searchOpen ? "收起搜索" : "搜索关键词",
|
|
1265
|
+
side: "bottom",
|
|
1266
|
+
delayMs: 500,
|
|
1267
|
+
},
|
|
1268
|
+
React.createElement("span", { className: "cnvnav-search" },
|
|
1269
|
+
React.createElement(Button, {
|
|
1270
|
+
variant: "ghost",
|
|
1271
|
+
size: "sm",
|
|
1272
|
+
icon: React.createElement(IconSearchOutline16, { size: 14 }),
|
|
1273
|
+
onClick: () => toggleSearch(),
|
|
1274
|
+
}),
|
|
1275
|
+
),
|
|
1276
|
+
),
|
|
1277
|
+
searchOpen
|
|
1278
|
+
? null
|
|
1279
|
+
: React.createElement(Tooltip, {
|
|
1280
|
+
label: nextModeLabel(),
|
|
1281
|
+
side: "bottom",
|
|
1282
|
+
delayMs: 500,
|
|
1283
|
+
},
|
|
1284
|
+
React.createElement("span", { className: "cnvnav-turns-toggle" },
|
|
1285
|
+
React.createElement(Button, {
|
|
1286
|
+
variant: "ghost",
|
|
1287
|
+
size: "sm",
|
|
1288
|
+
className: viewMode !== "full" ? "cnvnav-toggle-on" : "",
|
|
1289
|
+
icon: React.createElement(SwitchTurnsIcon),
|
|
1290
|
+
"aria-pressed": viewMode !== "full",
|
|
1291
|
+
onClick: () => cycleMode(),
|
|
1292
|
+
}),
|
|
1293
|
+
),
|
|
1294
|
+
),
|
|
1295
|
+
searchOpen
|
|
1296
|
+
? React.createElement("input", {
|
|
1297
|
+
type: "text",
|
|
1298
|
+
className: "cnvnav-filter",
|
|
1299
|
+
placeholder: "请输入关键词",
|
|
1300
|
+
value: filter,
|
|
1301
|
+
autoFocus: true,
|
|
1302
|
+
onChange: (e) => setFilter(e.target.value),
|
|
1303
|
+
})
|
|
1304
|
+
: null,
|
|
1305
|
+
searchOpen
|
|
1306
|
+
? null
|
|
1307
|
+
: React.createElement(Tooltip, {
|
|
1308
|
+
label: snap.docked ? "解除停靠(拖动头部定位)" : "停靠回右侧",
|
|
1309
|
+
side: "bottom",
|
|
1310
|
+
delayMs: 500,
|
|
1311
|
+
},
|
|
1312
|
+
React.createElement("span", null,
|
|
1313
|
+
React.createElement(Button, {
|
|
1314
|
+
variant: snap.docked ? "primary" : "ghost",
|
|
1315
|
+
size: "sm",
|
|
1316
|
+
icon: React.createElement(PinIcon),
|
|
1317
|
+
"aria-pressed": snap.docked,
|
|
1318
|
+
onClick: () => {
|
|
1319
|
+
if (snap.docked) {
|
|
1320
|
+
const el = panelEl;
|
|
1321
|
+
const r = el !== null ? el.getBoundingClientRect() : null;
|
|
1322
|
+
setState({ docked: false, userPos: r !== null ? { left: Math.round(r.left), top: Math.round(r.top) } : null });
|
|
1323
|
+
} else {
|
|
1324
|
+
setState({ docked: true });
|
|
1325
|
+
}
|
|
1326
|
+
persistUi();
|
|
1327
|
+
},
|
|
1328
|
+
}),
|
|
1329
|
+
),
|
|
1330
|
+
),
|
|
1331
|
+
React.createElement("span", { className: "cnvnav-count" }, (filtering ? groupNodes.length + " / " : "") + String(count) + " 条"),
|
|
1332
|
+
React.createElement(Tooltip, {
|
|
1333
|
+
label: "收起面板",
|
|
1334
|
+
side: "bottom",
|
|
1335
|
+
delayMs: 500,
|
|
1336
|
+
},
|
|
1337
|
+
React.createElement("span", { className: "cnvnav-close" },
|
|
1338
|
+
React.createElement(Button, {
|
|
1339
|
+
variant: "ghost",
|
|
1340
|
+
size: "sm",
|
|
1341
|
+
icon: React.createElement(IconCloseOutline16, { size: 14 }),
|
|
1342
|
+
onClick: () => setState({ open: false }),
|
|
1343
|
+
}),
|
|
1344
|
+
),
|
|
1345
|
+
),
|
|
1346
|
+
),
|
|
1347
|
+
React.createElement("div", { className: "cnvnav-topbar" },
|
|
1348
|
+
React.createElement(Tooltip, {
|
|
1349
|
+
label: "加载更早的一批轮次",
|
|
1350
|
+
side: "bottom",
|
|
1351
|
+
delayMs: 500,
|
|
1352
|
+
disabled: !snap.hasMore || snap.loadingOlder,
|
|
1353
|
+
},
|
|
1354
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
1355
|
+
React.createElement(Button, {
|
|
1356
|
+
variant: "ghost",
|
|
1357
|
+
size: "sm",
|
|
1358
|
+
className: "cnvnav-bar-fill",
|
|
1359
|
+
icon: React.createElement(LoadEarlierIcon),
|
|
1360
|
+
disabled: !snap.hasMore || snap.loadingOlder,
|
|
1361
|
+
onClick: () => loadOlderPage(),
|
|
1362
|
+
}, "加载更早"),
|
|
1363
|
+
),
|
|
1364
|
+
),
|
|
1365
|
+
React.createElement(Tooltip, {
|
|
1366
|
+
label: "加载全部历史轮次",
|
|
1367
|
+
side: "bottom",
|
|
1368
|
+
delayMs: 500,
|
|
1369
|
+
disabled: !snap.hasMore || snap.loadingOlder || snap.loadingAll,
|
|
1370
|
+
},
|
|
1371
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
1372
|
+
React.createElement(Button, {
|
|
1373
|
+
variant: "ghost",
|
|
1374
|
+
size: "sm",
|
|
1375
|
+
className: "cnvnav-bar-fill",
|
|
1376
|
+
icon: React.createElement(LoadAllIcon),
|
|
1377
|
+
disabled: !snap.hasMore || snap.loadingOlder || snap.loadingAll,
|
|
1378
|
+
onClick: () => loadAllPages(),
|
|
1379
|
+
}, "加载全部"),
|
|
1380
|
+
),
|
|
1381
|
+
),
|
|
1382
|
+
),
|
|
1383
|
+
React.createElement("div", {
|
|
1384
|
+
ref: (el) => { listEl = el; },
|
|
1385
|
+
className: "cnvnav-list",
|
|
1386
|
+
},
|
|
1387
|
+
groups.length === 0
|
|
1388
|
+
? React.createElement("div", { className: "cnvnav-empty" }, "当前会话暂无对话节点")
|
|
1389
|
+
: (filtering && groupNodes.length === 0
|
|
1390
|
+
? React.createElement("div", { className: "cnvnav-empty" }, "无匹配结果")
|
|
1391
|
+
: groupNodes),
|
|
1392
|
+
),
|
|
1393
|
+
React.createElement("div", { className: "cnvnav-footer" },
|
|
1394
|
+
React.createElement(Tooltip, {
|
|
1395
|
+
label: "回到对话最新位置",
|
|
1396
|
+
side: "top",
|
|
1397
|
+
delayMs: 500,
|
|
1398
|
+
},
|
|
1399
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
1400
|
+
React.createElement(Button, {
|
|
1401
|
+
variant: "ghost",
|
|
1402
|
+
size: "sm",
|
|
1403
|
+
className: "cnvnav-bar-fill",
|
|
1404
|
+
icon: React.createElement(JumpLatestIcon),
|
|
1405
|
+
onClick: () => {
|
|
1406
|
+
const gs = snap.outline !== null ? snap.outline.groups : [];
|
|
1407
|
+
if (gs.length === 0) return;
|
|
1408
|
+
const lastGroup = gs[gs.length - 1];
|
|
1409
|
+
const lastItem = lastGroup.items[lastGroup.items.length - 1];
|
|
1410
|
+
if (lastItem !== undefined) jumpTo(lastItem.key);
|
|
1411
|
+
},
|
|
1412
|
+
}, "回到最新"),
|
|
1413
|
+
),
|
|
1414
|
+
),
|
|
1415
|
+
React.createElement(Tooltip, {
|
|
1416
|
+
label: hasExpanded ? "折叠所有已展开的轮次" : "当前无展开的轮次",
|
|
1417
|
+
side: "top",
|
|
1418
|
+
delayMs: 500,
|
|
1419
|
+
disabled: !hasExpanded,
|
|
1420
|
+
},
|
|
1421
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
1422
|
+
React.createElement(Button, {
|
|
1423
|
+
variant: "ghost",
|
|
1424
|
+
size: "sm",
|
|
1425
|
+
className: "cnvnav-bar-fill",
|
|
1426
|
+
icon: React.createElement(CollapseAllIcon),
|
|
1427
|
+
disabled: !hasExpanded,
|
|
1428
|
+
onClick: () => setState({ expanded: {} }),
|
|
1429
|
+
}, "全部折叠"),
|
|
1430
|
+
),
|
|
1431
|
+
),
|
|
1432
|
+
),
|
|
1433
|
+
React.createElement("span", {
|
|
1434
|
+
className: "cnvnav-resize-grip",
|
|
1435
|
+
onPointerDown: startResize,
|
|
1436
|
+
onPointerMove: moveResize,
|
|
1437
|
+
onPointerUp: endResize,
|
|
1438
|
+
onPointerCancel: endResize,
|
|
1439
|
+
"aria-hidden": true,
|
|
1440
|
+
}),
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
/* ---------- register ---------- */
|
|
1445
|
+
slots.inject("conversation.session.header.utilities", () => slots.register(
|
|
1446
|
+
{ name: "conversation.session.header.utilities", id: "conversation-navigator-toggle", order: 20, label: () => "会话导航" },
|
|
1447
|
+
(props) => React.createElement(ToggleButton, props),
|
|
1448
|
+
));
|
|
1449
|
+
slots.inject("shell.overlay", () => slots.register(
|
|
1450
|
+
{ name: "shell.overlay", id: "conversation-navigator-panel", order: 10, label: () => "会话导航" },
|
|
1451
|
+
() => React.createElement(Panel),
|
|
1452
|
+
));
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
const inject = ["slots", "sessions"];
|
|
1456
|
+
exports.apply = apply;
|
|
1457
|
+
exports.inject = inject;
|
|
1458
|
+
return module.exports;
|
|
1459
|
+
}
|
|
1460
|
+
});
|