dsh-conversation-navigator 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +37 -69
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -5,26 +5,10 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
7
|
const React = require("react");
|
|
8
|
+
const { Button, IconPanelLeftOutline16, IconChevronUpOutline14, IconRefreshOutline14, IconChevronDownOutline14, IconTriangleRightFill14, IconCloseOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
8
9
|
|
|
9
10
|
/* ---------- own stylesheet (static packages have no styles builtin) ---------- */
|
|
10
11
|
const CSS = `
|
|
11
|
-
.cnvnav-toggle {
|
|
12
|
-
display: inline-flex; align-items: center; gap: 6px;
|
|
13
|
-
height: 28px; padding: 0 10px; border-radius: 8px;
|
|
14
|
-
border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
15
|
-
background: transparent;
|
|
16
|
-
color: var(--dsw-alias-label-secondary, #666);
|
|
17
|
-
font-size: 12px; line-height: 1; cursor: pointer;
|
|
18
|
-
}
|
|
19
|
-
.cnvnav-toggle:hover {
|
|
20
|
-
background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12));
|
|
21
|
-
color: var(--dsw-alias-label-primary, #222);
|
|
22
|
-
}
|
|
23
|
-
.cnvnav-toggle-on {
|
|
24
|
-
color: var(--dsw-alias-brand-primary, #4f46e5);
|
|
25
|
-
border-color: var(--dsw-alias-brand-primary, #4f46e5);
|
|
26
|
-
}
|
|
27
|
-
.cnvnav-toggle svg { display: block; }
|
|
28
12
|
.cnvnav-panel {
|
|
29
13
|
position: fixed; z-index: 9999; width: 288px;
|
|
30
14
|
display: flex; flex-direction: column;
|
|
@@ -45,15 +29,7 @@ window.__ModuleLoader__.load({
|
|
|
45
29
|
}
|
|
46
30
|
.cnvnav-title { font-weight: 600; font-size: 13px; }
|
|
47
31
|
.cnvnav-count { color: var(--dsw-alias-label-secondary, #888); font-size: 11px; }
|
|
48
|
-
.cnvnav-close {
|
|
49
|
-
margin-left: auto; border: none; background: transparent;
|
|
50
|
-
color: var(--dsw-alias-label-secondary, #888); cursor: pointer;
|
|
51
|
-
font-size: 16px; line-height: 1; padding: 2px 7px; border-radius: 6px;
|
|
52
|
-
}
|
|
53
|
-
.cnvnav-close:hover {
|
|
54
|
-
background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12));
|
|
55
|
-
color: var(--dsw-alias-label-primary, #222);
|
|
56
|
-
}
|
|
32
|
+
.cnvnav-close { margin-left: auto; }
|
|
57
33
|
.cnvnav-list {
|
|
58
34
|
overflow-y: auto; padding: 6px; min-height: 0;
|
|
59
35
|
display: flex; flex-direction: column; gap: 2px;
|
|
@@ -129,15 +105,7 @@ window.__ModuleLoader__.load({
|
|
|
129
105
|
.cnvnav-empty { padding: 18px 10px; text-align: center; color: var(--dsw-alias-label-secondary, #888); }
|
|
130
106
|
.cnvnav-topbar { display: flex; gap: 6px; margin: 6px 6px 0; }
|
|
131
107
|
.cnvnav-footer { display: flex; gap: 6px; margin: 0 6px 6px; }
|
|
132
|
-
.cnvnav-
|
|
133
|
-
flex: 1; padding: 7px; border-radius: 8px;
|
|
134
|
-
border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35));
|
|
135
|
-
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,.06));
|
|
136
|
-
color: var(--dsw-alias-label-primary, #222); cursor: pointer; font-size: 12px;
|
|
137
|
-
}
|
|
138
|
-
.cnvnav-bottom:hover { border-color: var(--dsw-alias-brand-primary, #4f46e5); color: var(--dsw-alias-brand-primary, #4f46e5); }
|
|
139
|
-
.cnvnav-bottom:disabled { opacity: .45; cursor: default; border-color: var(--dsw-alias-border-l1, rgba(128,128,128,.35)); color: var(--dsw-alias-label-secondary, #888); }
|
|
140
|
-
.cnvnav-bottom:disabled:hover { border-color: var(--dsw-alias-border-l1, rgba(128,128,128,.35)); color: var(--dsw-alias-label-secondary, #888); }
|
|
108
|
+
.cnvnav-bar-btn { flex: 1; }
|
|
141
109
|
`;
|
|
142
110
|
|
|
143
111
|
function apply(ctx) {
|
|
@@ -404,17 +372,6 @@ window.__ModuleLoader__.load({
|
|
|
404
372
|
const groupEls = {};
|
|
405
373
|
|
|
406
374
|
/* ---------- header toggle button ---------- */
|
|
407
|
-
function ToggleIcon() {
|
|
408
|
-
return React.createElement("svg", {
|
|
409
|
-
viewBox: "0 0 16 16", width: 14, height: 14, fill: "none",
|
|
410
|
-
stroke: "currentColor", strokeWidth: 1.4, "aria-hidden": true,
|
|
411
|
-
},
|
|
412
|
-
React.createElement("circle", { cx: 3, cy: 3.5, r: 1.1, fill: "currentColor", stroke: "none" }),
|
|
413
|
-
React.createElement("path", { d: "M6.2 3.5h7.8M6.2 8h7.8M6.2 12.5h7.8", strokeLinecap: "round" }),
|
|
414
|
-
React.createElement("circle", { cx: 3, cy: 8, r: 1.1, fill: "currentColor", stroke: "none" }),
|
|
415
|
-
React.createElement("circle", { cx: 3, cy: 12.5, r: 1.1, fill: "currentColor", stroke: "none" }),
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
375
|
function ToggleButton(props) {
|
|
419
376
|
const snap = useStore();
|
|
420
377
|
const outline = props.useSession(selectOutline);
|
|
@@ -429,13 +386,14 @@ window.__ModuleLoader__.load({
|
|
|
429
386
|
setState({ activeKey: null, expanded: {} });
|
|
430
387
|
}
|
|
431
388
|
}, [props.sessionId]);
|
|
432
|
-
return React.createElement(
|
|
433
|
-
|
|
434
|
-
|
|
389
|
+
return React.createElement(Button, {
|
|
390
|
+
variant: snap.open ? "primary" : "ghost",
|
|
391
|
+
size: "sm",
|
|
392
|
+
icon: React.createElement(IconPanelLeftOutline16),
|
|
435
393
|
"aria-pressed": snap.open,
|
|
436
394
|
title: snap.open ? "收起会话导航" : "打开会话导航",
|
|
437
395
|
onClick: () => setState({ open: !snap.open }),
|
|
438
|
-
},
|
|
396
|
+
}, "导航");
|
|
439
397
|
}
|
|
440
398
|
|
|
441
399
|
/* ---------- floating navigator panel ---------- */
|
|
@@ -573,28 +531,34 @@ window.__ModuleLoader__.load({
|
|
|
573
531
|
React.createElement("div", { className: "cnvnav-head" },
|
|
574
532
|
React.createElement("span", { className: "cnvnav-title" }, "会话导航"),
|
|
575
533
|
React.createElement("span", { className: "cnvnav-count" }, String(count) + " 条"),
|
|
576
|
-
React.createElement(
|
|
577
|
-
|
|
534
|
+
React.createElement(Button, {
|
|
535
|
+
variant: "ghost",
|
|
536
|
+
size: "sm",
|
|
578
537
|
className: "cnvnav-close",
|
|
538
|
+
icon: React.createElement(IconCloseOutline16, { size: 14 }),
|
|
579
539
|
title: "收起",
|
|
580
540
|
onClick: () => setState({ open: false }),
|
|
581
|
-
}
|
|
541
|
+
}),
|
|
582
542
|
),
|
|
583
543
|
React.createElement("div", { className: "cnvnav-topbar" },
|
|
584
|
-
React.createElement(
|
|
585
|
-
|
|
586
|
-
|
|
544
|
+
React.createElement(Button, {
|
|
545
|
+
variant: "ghost",
|
|
546
|
+
size: "sm",
|
|
547
|
+
className: "cnvnav-bar-btn",
|
|
548
|
+
icon: React.createElement(IconChevronUpOutline14),
|
|
587
549
|
disabled: !snap.hasMore || snap.loadingOlder,
|
|
588
550
|
title: "加载更早的一批轮次",
|
|
589
551
|
onClick: () => loadOlderPage(),
|
|
590
|
-
}, "
|
|
591
|
-
React.createElement(
|
|
592
|
-
|
|
593
|
-
|
|
552
|
+
}, "加载更早"),
|
|
553
|
+
React.createElement(Button, {
|
|
554
|
+
variant: "ghost",
|
|
555
|
+
size: "sm",
|
|
556
|
+
className: "cnvnav-bar-btn",
|
|
557
|
+
icon: React.createElement(IconRefreshOutline14),
|
|
594
558
|
disabled: !snap.hasMore || snap.loadingOlder || snap.loadingAll,
|
|
595
559
|
title: "加载全部历史轮次",
|
|
596
560
|
onClick: () => loadAllPages(),
|
|
597
|
-
}, "
|
|
561
|
+
}, "加载全部"),
|
|
598
562
|
),
|
|
599
563
|
React.createElement("div", {
|
|
600
564
|
ref: (el) => { listEl = el; },
|
|
@@ -605,9 +569,11 @@ window.__ModuleLoader__.load({
|
|
|
605
569
|
: groupNodes,
|
|
606
570
|
),
|
|
607
571
|
React.createElement("div", { className: "cnvnav-footer" },
|
|
608
|
-
React.createElement(
|
|
609
|
-
|
|
610
|
-
|
|
572
|
+
React.createElement(Button, {
|
|
573
|
+
variant: "ghost",
|
|
574
|
+
size: "sm",
|
|
575
|
+
className: "cnvnav-bar-btn",
|
|
576
|
+
icon: React.createElement(IconChevronDownOutline14),
|
|
611
577
|
onClick: () => {
|
|
612
578
|
const gs = snap.outline !== null ? snap.outline.groups : [];
|
|
613
579
|
if (gs.length === 0) return;
|
|
@@ -615,13 +581,15 @@ window.__ModuleLoader__.load({
|
|
|
615
581
|
const lastItem = lastGroup.items[lastGroup.items.length - 1];
|
|
616
582
|
if (lastItem !== undefined) jumpTo(lastItem.key);
|
|
617
583
|
},
|
|
618
|
-
}, "
|
|
619
|
-
React.createElement(
|
|
620
|
-
|
|
621
|
-
|
|
584
|
+
}, "回到最新"),
|
|
585
|
+
React.createElement(Button, {
|
|
586
|
+
variant: "ghost",
|
|
587
|
+
size: "sm",
|
|
588
|
+
className: "cnvnav-bar-btn",
|
|
589
|
+
icon: React.createElement(IconTriangleRightFill14),
|
|
622
590
|
title: "折叠所有已展开的轮次",
|
|
623
591
|
onClick: () => setState({ expanded: {} }),
|
|
624
|
-
}, "
|
|
592
|
+
}, "全部折叠"),
|
|
625
593
|
),
|
|
626
594
|
);
|
|
627
595
|
}
|