dsh-conversation-navigator 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +102 -72
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -101,8 +101,9 @@ window.__ModuleLoader__.load({
|
|
|
101
101
|
.cnvnav-group-row:hover { background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12)); }
|
|
102
102
|
.cnvnav-group-row-active { background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,.12)); }
|
|
103
103
|
.cnvnav-group-row-active .cnvnav-group-title { color: var(--dsw-alias-brand-primary, #4f46e5); }
|
|
104
|
+
.cnvnav-group-head-wrap { flex: 1; min-width: 0; display: block; }
|
|
104
105
|
.cnvnav-group-head {
|
|
105
|
-
|
|
106
|
+
width: 100%;
|
|
106
107
|
display: flex; align-items: baseline; gap: 6px; text-align: left;
|
|
107
108
|
border: none; background: transparent; cursor: pointer;
|
|
108
109
|
padding: 5px 0 5px 8px;
|
|
@@ -114,8 +115,9 @@ window.__ModuleLoader__.load({
|
|
|
114
115
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
115
116
|
flex: 1; min-width: 0;
|
|
116
117
|
}
|
|
118
|
+
.cnvnav-chevron-wrap { flex: none; display: block; }
|
|
117
119
|
.cnvnav-chevron {
|
|
118
|
-
|
|
120
|
+
min-width: 30px; width: 100%;
|
|
119
121
|
display: flex; align-items: center; justify-content: center;
|
|
120
122
|
border: none; background: transparent; cursor: pointer;
|
|
121
123
|
color: var(--dsw-alias-label-secondary, #888);
|
|
@@ -163,7 +165,8 @@ window.__ModuleLoader__.load({
|
|
|
163
165
|
.cnvnav-empty { padding: 18px 10px; text-align: center; color: var(--dsw-alias-label-secondary, #888); }
|
|
164
166
|
.cnvnav-topbar { display: flex; gap: 6px; margin: 6px 6px 0; }
|
|
165
167
|
.cnvnav-footer { display: flex; gap: 6px; margin: 0 6px 6px; }
|
|
166
|
-
.cnvnav-bar-btn { flex: 1; }
|
|
168
|
+
.cnvnav-bar-btn { flex: 1; display: block; }
|
|
169
|
+
.cnvnav-bar-fill { width: 100%; }
|
|
167
170
|
`;
|
|
168
171
|
|
|
169
172
|
function apply(ctx) {
|
|
@@ -449,13 +452,15 @@ window.__ModuleLoader__.load({
|
|
|
449
452
|
side: "bottom",
|
|
450
453
|
delayMs: 500,
|
|
451
454
|
},
|
|
452
|
-
React.createElement(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
React.createElement("span", null,
|
|
456
|
+
React.createElement(Button, {
|
|
457
|
+
variant: snap.open ? "primary" : "ghost",
|
|
458
|
+
size: "sm",
|
|
459
|
+
icon: React.createElement(ToggleIcon),
|
|
460
|
+
"aria-pressed": snap.open,
|
|
461
|
+
onClick: () => setState({ open: !snap.open }),
|
|
462
|
+
}, "导航"),
|
|
463
|
+
),
|
|
459
464
|
);
|
|
460
465
|
}
|
|
461
466
|
|
|
@@ -537,29 +542,43 @@ window.__ModuleLoader__.load({
|
|
|
537
542
|
ref: (el) => { groupEls[g.gid] = el; },
|
|
538
543
|
className: "cnvnav-group-row" + (groupActive ? " cnvnav-group-row-active" : ""),
|
|
539
544
|
},
|
|
540
|
-
React.createElement(
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
onClick: () => jumpTo(g.headKey),
|
|
545
|
+
React.createElement(Tooltip, {
|
|
546
|
+
label: "跳转到此位置",
|
|
547
|
+
side: "top",
|
|
548
|
+
delayMs: 500,
|
|
545
549
|
},
|
|
546
|
-
React.createElement("span", { className: "cnvnav-group-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
+
React.createElement("span", { className: "cnvnav-group-head-wrap" },
|
|
551
|
+
React.createElement("button", {
|
|
552
|
+
type: "button",
|
|
553
|
+
className: "cnvnav-group-head",
|
|
554
|
+
onClick: () => jumpTo(g.headKey),
|
|
555
|
+
},
|
|
556
|
+
React.createElement("span", { className: "cnvnav-group-title" }, g.title),
|
|
557
|
+
g.subtitle !== ""
|
|
558
|
+
? React.createElement("span", { className: "cnvnav-group-sub" }, g.subtitle)
|
|
559
|
+
: null,
|
|
560
|
+
),
|
|
561
|
+
),
|
|
550
562
|
),
|
|
551
563
|
hasSteps
|
|
552
|
-
? React.createElement(
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
"aria-expanded": expanded,
|
|
557
|
-
onClick: (e) => {
|
|
558
|
-
e.stopPropagation();
|
|
559
|
-
setState({ expanded: Object.assign({}, state.expanded, { [g.gid]: !expanded }) });
|
|
560
|
-
},
|
|
564
|
+
? React.createElement(Tooltip, {
|
|
565
|
+
label: expanded ? "折叠步次" : "展开步次",
|
|
566
|
+
side: "top",
|
|
567
|
+
delayMs: 500,
|
|
561
568
|
},
|
|
562
|
-
|
|
569
|
+
React.createElement("span", { className: "cnvnav-chevron-wrap" },
|
|
570
|
+
React.createElement("button", {
|
|
571
|
+
type: "button",
|
|
572
|
+
className: "cnvnav-chevron",
|
|
573
|
+
"aria-expanded": expanded,
|
|
574
|
+
onClick: (e) => {
|
|
575
|
+
e.stopPropagation();
|
|
576
|
+
setState({ expanded: Object.assign({}, state.expanded, { [g.gid]: !expanded }) });
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
expanded ? "▾" : "▸ " + stepItems.length,
|
|
580
|
+
),
|
|
581
|
+
),
|
|
563
582
|
)
|
|
564
583
|
: null,
|
|
565
584
|
),
|
|
@@ -599,13 +618,14 @@ window.__ModuleLoader__.load({
|
|
|
599
618
|
side: "bottom",
|
|
600
619
|
delayMs: 500,
|
|
601
620
|
},
|
|
602
|
-
React.createElement(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
621
|
+
React.createElement("span", { className: "cnvnav-close" },
|
|
622
|
+
React.createElement(Button, {
|
|
623
|
+
variant: "ghost",
|
|
624
|
+
size: "sm",
|
|
625
|
+
icon: React.createElement(IconCloseOutline16, { size: 14 }),
|
|
626
|
+
onClick: () => setState({ open: false }),
|
|
627
|
+
}),
|
|
628
|
+
),
|
|
609
629
|
),
|
|
610
630
|
),
|
|
611
631
|
React.createElement("div", { className: "cnvnav-topbar" },
|
|
@@ -613,29 +633,35 @@ window.__ModuleLoader__.load({
|
|
|
613
633
|
label: "加载更早的一批轮次",
|
|
614
634
|
side: "bottom",
|
|
615
635
|
delayMs: 500,
|
|
636
|
+
disabled: !snap.hasMore || snap.loadingOlder,
|
|
616
637
|
},
|
|
617
|
-
React.createElement(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
638
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
639
|
+
React.createElement(Button, {
|
|
640
|
+
variant: "ghost",
|
|
641
|
+
size: "sm",
|
|
642
|
+
className: "cnvnav-bar-fill",
|
|
643
|
+
icon: React.createElement(LoadEarlierIcon),
|
|
644
|
+
disabled: !snap.hasMore || snap.loadingOlder,
|
|
645
|
+
onClick: () => loadOlderPage(),
|
|
646
|
+
}, "加载更早"),
|
|
647
|
+
),
|
|
625
648
|
),
|
|
626
649
|
React.createElement(Tooltip, {
|
|
627
650
|
label: "加载全部历史轮次",
|
|
628
651
|
side: "bottom",
|
|
629
652
|
delayMs: 500,
|
|
653
|
+
disabled: !snap.hasMore || snap.loadingOlder || snap.loadingAll,
|
|
630
654
|
},
|
|
631
|
-
React.createElement(
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
655
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
656
|
+
React.createElement(Button, {
|
|
657
|
+
variant: "ghost",
|
|
658
|
+
size: "sm",
|
|
659
|
+
className: "cnvnav-bar-fill",
|
|
660
|
+
icon: React.createElement(LoadAllIcon),
|
|
661
|
+
disabled: !snap.hasMore || snap.loadingOlder || snap.loadingAll,
|
|
662
|
+
onClick: () => loadAllPages(),
|
|
663
|
+
}, "加载全部"),
|
|
664
|
+
),
|
|
639
665
|
),
|
|
640
666
|
),
|
|
641
667
|
React.createElement("div", {
|
|
@@ -652,32 +678,36 @@ window.__ModuleLoader__.load({
|
|
|
652
678
|
side: "top",
|
|
653
679
|
delayMs: 500,
|
|
654
680
|
},
|
|
655
|
-
React.createElement(
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
681
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
682
|
+
React.createElement(Button, {
|
|
683
|
+
variant: "ghost",
|
|
684
|
+
size: "sm",
|
|
685
|
+
className: "cnvnav-bar-fill",
|
|
686
|
+
icon: React.createElement(JumpLatestIcon),
|
|
687
|
+
onClick: () => {
|
|
688
|
+
const gs = snap.outline !== null ? snap.outline.groups : [];
|
|
689
|
+
if (gs.length === 0) return;
|
|
690
|
+
const lastGroup = gs[gs.length - 1];
|
|
691
|
+
const lastItem = lastGroup.items[lastGroup.items.length - 1];
|
|
692
|
+
if (lastItem !== undefined) jumpTo(lastItem.key);
|
|
693
|
+
},
|
|
694
|
+
}, "回到最新"),
|
|
695
|
+
),
|
|
668
696
|
),
|
|
669
697
|
React.createElement(Tooltip, {
|
|
670
698
|
label: "折叠所有已展开的轮次",
|
|
671
699
|
side: "top",
|
|
672
700
|
delayMs: 500,
|
|
673
701
|
},
|
|
674
|
-
React.createElement(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
702
|
+
React.createElement("span", { className: "cnvnav-bar-btn" },
|
|
703
|
+
React.createElement(Button, {
|
|
704
|
+
variant: "ghost",
|
|
705
|
+
size: "sm",
|
|
706
|
+
className: "cnvnav-bar-fill",
|
|
707
|
+
icon: React.createElement(CollapseAllIcon),
|
|
708
|
+
onClick: () => setState({ expanded: {} }),
|
|
709
|
+
}, "全部折叠"),
|
|
710
|
+
),
|
|
681
711
|
),
|
|
682
712
|
),
|
|
683
713
|
);
|