dsh-sidenote 0.8.9 → 0.8.10
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 +662 -229
- package/lib/types/client/host/contracts.d.ts +1 -1
- package/lib/types/client/host/menuSurface.d.ts +10 -0
- package/lib/types/client/host/sessionVisibility.d.ts +1 -1
- package/lib/types/client/locales.d.ts +13 -0
- package/lib/types/client/sidechat/SideChatMenu.d.ts +13 -0
- package/lib/types/client/sidechat/recentClosed.d.ts +9 -16
- package/lib/types/client/sidechat/slash.d.ts +4 -2
- package/package.json +1 -1
- package/src/client/host/contracts.ts +1 -0
- package/src/client/host/menuSurface.ts +10 -0
- package/src/client/host/sessionVisibility.ts +1 -1
- package/src/client/locales.ts +26 -0
- package/src/client/sidechat/SideChatMenu.tsx +180 -0
- package/src/client/sidechat/native-tab.tsx +4 -1
- package/src/client/sidechat/recentClosed.ts +120 -58
- package/src/client/sidechat/side-menu.module.css +107 -0
- package/src/client/sidechat/slash.ts +91 -109
package/lib/client.js
CHANGED
|
@@ -797,7 +797,7 @@ window.__ModuleLoader__.load({
|
|
|
797
797
|
let dockRegistered = false;
|
|
798
798
|
let report = {
|
|
799
799
|
versions: {
|
|
800
|
-
sidenote: "0.8.
|
|
800
|
+
sidenote: "0.8.10",
|
|
801
801
|
dsh: "unknown",
|
|
802
802
|
betterSidebar: null
|
|
803
803
|
},
|
|
@@ -1078,6 +1078,19 @@ window.__ModuleLoader__.load({
|
|
|
1078
1078
|
cmdFocus: "Focus \"{title}\"",
|
|
1079
1079
|
cmdFocusDetail: "Existing side chat",
|
|
1080
1080
|
cmdReopen: "Reopen \"{title}\"",
|
|
1081
|
+
cmdMenuTitle: "Side chats",
|
|
1082
|
+
cmdSearch: "Search side chats…",
|
|
1083
|
+
cmdSearchPlaceholder: "Search…",
|
|
1084
|
+
cmdOpenGroup: "Open side chats",
|
|
1085
|
+
cmdClosedGroup: "Recently closed",
|
|
1086
|
+
cmdNoMatches: "No matching side chats",
|
|
1087
|
+
cmdRemove: "Remove",
|
|
1088
|
+
cmdRemoveNamed: "Remove \"{title}\" from history",
|
|
1089
|
+
cmdRemoveConfirm: "Remove \"{title}\" from history?",
|
|
1090
|
+
cmdRemoveHint: "Kept in DSH. Cannot reopen from /side.",
|
|
1091
|
+
cmdRemoveCancel: "Cancel",
|
|
1092
|
+
cmdMenuFailed: "Could not complete this action. Try again.",
|
|
1093
|
+
cmdHistorySaveFailed: "Could not save side-chat history permanently. Browser storage may be full.",
|
|
1081
1094
|
closedJustNow: "Closed just now",
|
|
1082
1095
|
closedMinutesAgo: "Closed {n} min ago",
|
|
1083
1096
|
closedHoursAgo: "Closed {n}h ago",
|
|
@@ -1319,6 +1332,19 @@ window.__ModuleLoader__.load({
|
|
|
1319
1332
|
cmdFocus: "聚焦「{title}」",
|
|
1320
1333
|
cmdFocusDetail: "已存在的侧边聊天",
|
|
1321
1334
|
cmdReopen: "重开「{title}」",
|
|
1335
|
+
cmdMenuTitle: "侧边聊天",
|
|
1336
|
+
cmdSearch: "搜索侧聊…",
|
|
1337
|
+
cmdSearchPlaceholder: "搜索…",
|
|
1338
|
+
cmdOpenGroup: "正在打开",
|
|
1339
|
+
cmdClosedGroup: "最近关闭",
|
|
1340
|
+
cmdNoMatches: "没有匹配的侧聊",
|
|
1341
|
+
cmdRemove: "移除",
|
|
1342
|
+
cmdRemoveNamed: "从历史中移除「{title}」",
|
|
1343
|
+
cmdRemoveConfirm: "移除「{title}」?",
|
|
1344
|
+
cmdRemoveHint: "原会话保留,无法通过 /side 重开。",
|
|
1345
|
+
cmdRemoveCancel: "取消",
|
|
1346
|
+
cmdMenuFailed: "操作未完成,请重试。",
|
|
1347
|
+
cmdHistorySaveFailed: "侧聊历史未能持久保存,浏览器存储空间可能不足。",
|
|
1322
1348
|
closedJustNow: "刚刚关闭",
|
|
1323
1349
|
closedMinutesAgo: "{n} 分钟前关闭",
|
|
1324
1350
|
closedHoursAgo: "{n} 小时前关闭",
|
|
@@ -1463,23 +1489,23 @@ window.__ModuleLoader__.load({
|
|
|
1463
1489
|
}
|
|
1464
1490
|
//#endregion
|
|
1465
1491
|
//#region \0dsh-css:/home/runner/work/dsh-sidenote/dsh-sidenote/src/client/diagnostics/diagnostics.module.css.mjs
|
|
1466
|
-
const css$
|
|
1467
|
-
const tagId$
|
|
1468
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
1492
|
+
const css$6 = ".tGe0LW_trigger{color:var(--dsw-alias-label-secondary,#555);border:1px solid var(--dsw-alias-border-l1,#ddd);cursor:pointer;background:0 0;border-radius:8px;padding:4px 8px;font-size:12px}.tGe0LW_panel{z-index:100;box-sizing:border-box;background:var(--dsw-alias-bg-layer-1,#fff);width:min(400px,100vw - 32px);max-height:calc(100vh - 80px);color:var(--dsw-alias-label-primary,#222);border:1px solid var(--dsw-alias-border-l1,#ddd);border-radius:12px;padding:14px;font-size:13px;position:fixed;top:60px;right:16px;overflow:auto;box-shadow:0 12px 36px #0002}.tGe0LW_header,.tGe0LW_actions,.tGe0LW_list li>div{justify-content:space-between;align-items:center;gap:12px;display:flex}.tGe0LW_header button,.tGe0LW_actions button{color:inherit;border:1px solid var(--dsw-alias-border-l1,#ddd);cursor:pointer;background:0 0;border-radius:6px;padding:4px 8px}.tGe0LW_description,.tGe0LW_versions,.tGe0LW_list p{color:var(--dsw-alias-label-secondary,#666);font-size:12px;line-height:1.5}.tGe0LW_list{margin:12px 0;padding:0;list-style:none}.tGe0LW_list li{border-top:1px solid var(--dsw-alias-border-l1,#ddd);padding:10px 0}.tGe0LW_list li p{margin:4px 0}.tGe0LW_list strong{font-size:12px;font-weight:500}.tGe0LW_list [data-state=unavailable]{color:var(--dsw-alias-state-error-primary,#c33)}.tGe0LW_list details{color:var(--dsw-alias-label-tertiary,#888);font-size:11px}.tGe0LW_list summary{cursor:pointer}.tGe0LW_list code{overflow-wrap:anywhere}";
|
|
1493
|
+
const tagId$6 = "dsh-sidenote/diagnostics.module.css";
|
|
1494
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
|
|
1469
1495
|
const tag = document.createElement("style");
|
|
1470
1496
|
tag.dataset.plugin = "dsh-sidenote";
|
|
1471
|
-
tag.dataset.pluginCss = tagId$
|
|
1472
|
-
tag.textContent = css$
|
|
1497
|
+
tag.dataset.pluginCss = tagId$6;
|
|
1498
|
+
tag.textContent = css$6;
|
|
1473
1499
|
document.head.appendChild(tag);
|
|
1474
1500
|
}
|
|
1475
1501
|
var diagnostics_module_css_default = {
|
|
1476
|
-
"trigger": "tGe0LW_trigger",
|
|
1477
|
-
"actions": "tGe0LW_actions",
|
|
1478
|
-
"list": "tGe0LW_list",
|
|
1479
1502
|
"header": "tGe0LW_header",
|
|
1480
1503
|
"versions": "tGe0LW_versions",
|
|
1504
|
+
"description": "tGe0LW_description",
|
|
1505
|
+
"list": "tGe0LW_list",
|
|
1506
|
+
"trigger": "tGe0LW_trigger",
|
|
1481
1507
|
"panel": "tGe0LW_panel",
|
|
1482
|
-
"
|
|
1508
|
+
"actions": "tGe0LW_actions"
|
|
1483
1509
|
};
|
|
1484
1510
|
//#endregion
|
|
1485
1511
|
//#region src/client/diagnostics/index.tsx
|
|
@@ -2549,46 +2575,46 @@ window.__ModuleLoader__.load({
|
|
|
2549
2575
|
}
|
|
2550
2576
|
//#endregion
|
|
2551
2577
|
//#region \0dsh-css:/home/runner/work/dsh-sidenote/dsh-sidenote/src/client/annotations/annotations.module.css.mjs
|
|
2552
|
-
const css$
|
|
2553
|
-
const tagId$
|
|
2554
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
2578
|
+
const css$5 = ".SVnebq_chipWrap{box-sizing:border-box;width:calc(100% - 2 * var(--dsh-composer-side-clearance,16px));max-width:var(--dsh-composer-card-max-width,780px);background:var(--dsw-alias-bg-base);flex-wrap:wrap;align-items:center;gap:6px;margin:0 auto;padding:2px 0;display:flex}.SVnebq_chip{--chip-surface:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);background:var(--chip-surface);color:var(--dsw-alias-label-secondary);border-radius:10px;align-items:center;transition:background .12s,color .12s;display:inline-flex;position:relative}.SVnebq_chip:hover,.SVnebq_chip:focus-within,.SVnebq_chip[data-open]{--chip-surface:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.SVnebq_chipMain{border-radius:inherit;min-height:28px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;gap:5px;padding:3px 9px;font-size:12px;line-height:18px;display:inline-flex}.SVnebq_chipDismissShade{border-radius:inherit;background:linear-gradient(to right, transparent, var(--chip-surface) 45%);opacity:0;pointer-events:none;justify-content:flex-end;align-items:center;width:38px;transition:opacity .16s ease-out;display:flex;position:absolute;inset:0 3px 0 auto}.SVnebq_chipDismiss{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:transform .16s ease-out,background .12s,color .12s;display:inline-flex;transform:translate(2px)scale(.94)}.SVnebq_chip:hover .SVnebq_chipDismissShade,.SVnebq_chip:focus-within .SVnebq_chipDismissShade{opacity:1}.SVnebq_chip:hover .SVnebq_chipDismiss,.SVnebq_chip:focus-within .SVnebq_chipDismiss{pointer-events:auto;transform:none}.SVnebq_chipDismiss:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.SVnebq_chipDismiss:disabled{opacity:.45;cursor:default}.SVnebq_contextPanel{box-sizing:border-box;z-index:1000;overscroll-behavior:contain;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:14px;padding:4px;animation:.12s ease-out SVnebq_contextAppear;position:fixed;overflow:auto;box-shadow:0 8px 28px #0000001f}.SVnebq_contextList{margin:0;padding:0;list-style:none}.SVnebq_contextItem{border-radius:10px;align-items:flex-start;gap:10px;margin:0;padding:8px 10px;transition:background .12s;display:flex}.SVnebq_contextItem+.SVnebq_contextItem{border-top:1px solid var(--dsw-alias-border-l1)}.SVnebq_contextItem:hover,.SVnebq_contextItem:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.SVnebq_contextNumber{min-width:16px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:12px;line-height:21px}.SVnebq_contextContent{flex:1;min-width:0}.SVnebq_contextLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.SVnebq_contextLabel:not(:first-child){margin-top:6px}.SVnebq_contextSource{color:var(--dsw-alias-label-secondary);margin-bottom:8px;font-size:12px}.SVnebq_documentPath{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:-4px 0 6px;font-size:11px}.SVnebq_documentSource{overflow-wrap:anywhere}.SVnebq_contextText{white-space:pre-wrap;overflow-wrap:anywhere;user-select:text;font-size:13px;line-height:1.6}.SVnebq_contextActions{flex:none;gap:2px;display:flex}.SVnebq_contextAction{width:26px;height:26px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:8px;justify-content:center;align-items:center;padding:0;transition:color .12s,background .12s;display:inline-flex}.SVnebq_contextAction:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.SVnebq_contextAction:disabled,.SVnebq_chipClearAll:disabled{opacity:.45;cursor:default}.SVnebq_contextEditor{box-sizing:border-box;resize:vertical;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:100%;min-height:64px;color:inherit;font:inherit;border-radius:6px;margin-top:4px;padding:6px 8px;font-size:13px;line-height:1.6;display:block}.SVnebq_contextFooter{padding:2px 10px 4px}.SVnebq_chipClearAll{color:var(--dsw-alias-label-tertiary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;padding:4px 6px;font-size:12px}.SVnebq_chipClearAll:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-state-error-primary)}.SVnebq_chipMain:focus-visible,.SVnebq_chipDismiss:focus-visible,.SVnebq_contextAction:focus-visible,.SVnebq_chipClearAll:focus-visible,.SVnebq_contextEditor:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.SVnebq_storageNotice{color:var(--dsw-alias-label-secondary);flex-basis:100%;font-size:12px}@keyframes SVnebq_contextAppear{0%{opacity:0;transform:translateY(3px)}to{opacity:1;transform:translateY(0)}}@media (hover:none){.SVnebq_chipMain{padding-right:32px}.SVnebq_chipDismissShade{opacity:1}.SVnebq_chipDismiss{pointer-events:auto;transform:none}}@media (prefers-reduced-motion:reduce){.SVnebq_contextPanel{animation:none}.SVnebq_chip,.SVnebq_chipDismissShade,.SVnebq_chipDismiss,.SVnebq_contextItem,.SVnebq_contextAction{transition:none}}.SVnebq_userContextHost{display:contents}.SVnebq_composerHost{min-width:0;display:block}[data-sidenote-context-replaced]{display:none!important}.SVnebq_sentChips{white-space:normal;display:inline}.SVnebq_sentChipGroup{display:inline}.SVnebq_sentChip{vertical-align:middle;background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);font:inherit;border:0;border-radius:6px;align-items:center;gap:4px;margin:0 6px 2px 0;padding:2px 6px;font-size:12px;line-height:18px;transition:background .14s,color .14s;display:inline-flex}button.SVnebq_sentChip{cursor:pointer}button.SVnebq_sentChip:hover,button.SVnebq_sentChip[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover-solid)}button.SVnebq_sentChip:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.SVnebq_sentChevron,.SVnebq_sentChevronOpen{opacity:.65;flex:none;transition:transform .14s}.SVnebq_sentChevronOpen{transform:rotate(180deg)}.SVnebq_sentPreview{text-align:left;white-space:normal}@media (prefers-reduced-motion:reduce){.SVnebq_sentChip,.SVnebq_sentChevron,.SVnebq_sentChevronOpen{transition:none}}";
|
|
2579
|
+
const tagId$5 = "dsh-sidenote/annotations.module.css";
|
|
2580
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
|
|
2555
2581
|
const tag = document.createElement("style");
|
|
2556
2582
|
tag.dataset.plugin = "dsh-sidenote";
|
|
2557
|
-
tag.dataset.pluginCss = tagId$
|
|
2558
|
-
tag.textContent = css$
|
|
2583
|
+
tag.dataset.pluginCss = tagId$5;
|
|
2584
|
+
tag.textContent = css$5;
|
|
2559
2585
|
document.head.appendChild(tag);
|
|
2560
2586
|
}
|
|
2561
2587
|
var annotations_module_css_default = {
|
|
2562
|
-
"
|
|
2563
|
-
"
|
|
2588
|
+
"contextContent": "SVnebq_contextContent",
|
|
2589
|
+
"documentPath": "SVnebq_documentPath",
|
|
2590
|
+
"contextFooter": "SVnebq_contextFooter",
|
|
2564
2591
|
"contextItem": "SVnebq_contextItem",
|
|
2565
|
-
"
|
|
2566
|
-
"storageNotice": "SVnebq_storageNotice",
|
|
2567
|
-
"sentChip": "SVnebq_sentChip",
|
|
2568
|
-
"sentChevron": "SVnebq_sentChevron",
|
|
2569
|
-
"contextAppear": "SVnebq_contextAppear",
|
|
2570
|
-
"chipMain": "SVnebq_chipMain",
|
|
2571
|
-
"contextLabel": "SVnebq_contextLabel",
|
|
2592
|
+
"documentSource": "SVnebq_documentSource",
|
|
2572
2593
|
"contextList": "SVnebq_contextList",
|
|
2594
|
+
"sentChevron": "SVnebq_sentChevron",
|
|
2573
2595
|
"composerHost": "SVnebq_composerHost",
|
|
2574
|
-
"
|
|
2575
|
-
"
|
|
2596
|
+
"contextEditor": "SVnebq_contextEditor",
|
|
2597
|
+
"contextLabel": "SVnebq_contextLabel",
|
|
2598
|
+
"contextSource": "SVnebq_contextSource",
|
|
2576
2599
|
"chip": "SVnebq_chip",
|
|
2577
|
-
"
|
|
2600
|
+
"chipWrap": "SVnebq_chipWrap",
|
|
2601
|
+
"chipMain": "SVnebq_chipMain",
|
|
2602
|
+
"sentChevronOpen": "SVnebq_sentChevronOpen",
|
|
2603
|
+
"sentChipGroup": "SVnebq_sentChipGroup",
|
|
2604
|
+
"userContextHost": "SVnebq_userContextHost",
|
|
2605
|
+
"contextPanel": "SVnebq_contextPanel",
|
|
2578
2606
|
"chipDismiss": "SVnebq_chipDismiss",
|
|
2607
|
+
"contextAction": "SVnebq_contextAction",
|
|
2579
2608
|
"chipDismissShade": "SVnebq_chipDismissShade",
|
|
2580
|
-
"
|
|
2609
|
+
"contextActions": "SVnebq_contextActions",
|
|
2581
2610
|
"chipClearAll": "SVnebq_chipClearAll",
|
|
2582
|
-
"
|
|
2611
|
+
"contextNumber": "SVnebq_contextNumber",
|
|
2612
|
+
"sentChip": "SVnebq_sentChip",
|
|
2613
|
+
"sentPreview": "SVnebq_sentPreview",
|
|
2583
2614
|
"sentChips": "SVnebq_sentChips",
|
|
2584
|
-
"
|
|
2585
|
-
"
|
|
2586
|
-
"
|
|
2587
|
-
"contextFooter": "SVnebq_contextFooter",
|
|
2588
|
-
"contextSource": "SVnebq_contextSource",
|
|
2589
|
-
"contextActions": "SVnebq_contextActions",
|
|
2590
|
-
"documentSource": "SVnebq_documentSource",
|
|
2591
|
-
"sentPreview": "SVnebq_sentPreview"
|
|
2615
|
+
"contextAppear": "SVnebq_contextAppear",
|
|
2616
|
+
"storageNotice": "SVnebq_storageNotice",
|
|
2617
|
+
"contextText": "SVnebq_contextText"
|
|
2592
2618
|
};
|
|
2593
2619
|
//#endregion
|
|
2594
2620
|
//#region src/client/annotations/DocumentQuoteContent.tsx
|
|
@@ -3095,49 +3121,49 @@ window.__ModuleLoader__.load({
|
|
|
3095
3121
|
}
|
|
3096
3122
|
//#endregion
|
|
3097
3123
|
//#region \0dsh-css:/home/runner/work/dsh-sidenote/dsh-sidenote/src/client/sidechat/sidechat.module.css.mjs
|
|
3098
|
-
const css$
|
|
3099
|
-
const tagId$
|
|
3100
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
3124
|
+
const css$4 = "._5KEEsG_nativeHost,._5KEEsG_root,._5KEEsG_nativeConversation{flex-direction:column;min-height:0;display:flex}._5KEEsG_nativeHost,._5KEEsG_root{height:100%}._5KEEsG_root{color:var(--dsw-alias-label-primary)}._5KEEsG_nativeConversation{flex:1}._5KEEsG_chatView{flex-direction:column;flex:1 0 auto;min-width:0;display:flex}._5KEEsG_mainContext{box-sizing:border-box;width:100%;padding:12px calc(var(--dsh-composer-side-clearance,8px) + 16px) 4px;flex:none;min-width:0}._5KEEsG_contextColumn{width:100%;max-width:var(--dsh-chat-content-width,748px);min-width:0;margin-inline:auto}._5KEEsG_historyToggle{align-items:center;gap:6px;display:flex}._5KEEsG_contextHint{color:var(--dsw-alias-label-tertiary);font-size:12px}._5KEEsG_contextChevron{transform:rotate(-90deg)}._5KEEsG_contextChevron,._5KEEsG_contextChevronOpen{flex:none}._5KEEsG_progress{margin:12px 0;padding:4px 0;position:relative;container-type:inline-size}._5KEEsG_progressEntries{overscroll-behavior:contain;scrollbar-width:thin;overflow-anchor:none;max-height:min(240px,32vh);margin-inline-end:-16px;overflow:auto}._5KEEsG_progressContent{width:100cqw}._5KEEsG_progressEntries:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}._5KEEsG_progressDetail,._5KEEsG_contextBubble{white-space:pre-wrap}._5KEEsG_progressEntry,._5KEEsG_progressDetail{overflow-wrap:anywhere;font-size:14px;line-height:1.65}._5KEEsG_contextImage{border-radius:8px;max-width:100%;max-height:160px;margin:8px 0}._5KEEsG_progressEntry{margin:0 0 12px;display:flow-root}._5KEEsG_progressEntry:last-child{margin-bottom:0}._5KEEsG_progressProcess{color:var(--dsw-alias-label-tertiary);margin:8px 0;font-size:13px}._5KEEsG_progressProcess summary{cursor:pointer;border-radius:4px;align-items:center;gap:6px;min-height:24px;list-style:none;display:flex}._5KEEsG_progressProcess summary::-webkit-details-marker{display:none}._5KEEsG_progressProcess summary:hover{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover)}._5KEEsG_progressProcess summary>svg,._5KEEsG_progressProcess summary>span:not(._5KEEsG_progressPreview){flex:none}._5KEEsG_progressProcess summary>svg:last-child{margin-left:auto;transform:rotate(-90deg)}._5KEEsG_progressProcess[open] summary>svg:last-child{transform:none}._5KEEsG_progressPreview{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}._5KEEsG_progressDetail{color:var(--dsw-alias-label-secondary);margin:6px 0 12px 20px}._5KEEsG_progressLatest{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-button-floating-fill);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border-radius:16px;align-items:center;gap:4px;padding:5px 9px;font-size:12px;display:flex;position:absolute;bottom:4px;right:12px}._5KEEsG_progressLatest:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-floating-hover)}._5KEEsG_reflowAction{width:32px;height:32px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:8px;flex:none;order:1;justify-content:center;align-items:center;margin-left:auto;padding:0;display:inline-flex}._5KEEsG_reflowAction:hover{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover)}._5KEEsG_reflowAction:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}._5KEEsG_reflowAction:disabled{cursor:default;color:var(--dsw-alias-state-business-primary);background:0 0}._5KEEsG_nativeToolbar{border-bottom:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:8px;padding:8px 12px;display:flex}._5KEEsG_nativeToolbarActions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._5KEEsG_nativeAction,._5KEEsG_historyToggle{color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:4px 6px;font-size:13px}._5KEEsG_nativeAction:hover,._5KEEsG_nativeAction:focus-visible,._5KEEsG_historyToggle:hover,._5KEEsG_historyToggle:focus-visible{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}._5KEEsG_nativeAction:disabled{opacity:.5;cursor:default;pointer-events:none}._5KEEsG_tooltipAnchor{display:inline-flex}._5KEEsG_historyToggle{margin:0;text-align:left;margin-inline-start:-6px}._5KEEsG_stateScreen{text-align:center;flex-direction:column;flex:1;justify-content:center;align-items:center;gap:8px;padding:24px 16px;display:flex}._5KEEsG_emptyIcon{color:var(--dsw-alias-label-tertiary)}._5KEEsG_emptyTitle{font-size:14px;font-weight:600}._5KEEsG_emptyText{color:var(--dsw-alias-label-secondary);max-width:280px;font-size:13px;line-height:1.6}._5KEEsG_stateDetail,._5KEEsG_errorRow{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;font-size:13px;line-height:1.6}._5KEEsG_errorRow{padding:8px 12px}._5KEEsG_headerSide{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;align-items:center;gap:4px;padding:4px 8px;font-size:13px;line-height:20px;display:inline-flex}._5KEEsG_headerSide:hover,._5KEEsG_headerSide:focus-visible{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}._5KEEsG_headerSide:disabled{opacity:.4;cursor:default}._5KEEsG_contextUserRow{flex-direction:column;align-items:flex-end;gap:8px;margin:16px 0 24px;display:flex}._5KEEsG_contextBubble{border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-bubble);max-width:82%;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;padding:10px 16px;font-size:14px;line-height:1.65}";
|
|
3125
|
+
const tagId$4 = "dsh-sidenote/sidechat.module.css";
|
|
3126
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
|
|
3101
3127
|
const tag = document.createElement("style");
|
|
3102
3128
|
tag.dataset.plugin = "dsh-sidenote";
|
|
3103
|
-
tag.dataset.pluginCss = tagId$
|
|
3104
|
-
tag.textContent = css$
|
|
3129
|
+
tag.dataset.pluginCss = tagId$4;
|
|
3130
|
+
tag.textContent = css$4;
|
|
3105
3131
|
document.head.appendChild(tag);
|
|
3106
3132
|
}
|
|
3107
3133
|
var sidechat_module_css_default = {
|
|
3108
|
-
"
|
|
3109
|
-
"contextColumn": "_5KEEsG_contextColumn",
|
|
3110
|
-
"contextChevron": "_5KEEsG_contextChevron",
|
|
3111
|
-
"emptyIcon": "_5KEEsG_emptyIcon",
|
|
3134
|
+
"reflowAction": "_5KEEsG_reflowAction",
|
|
3112
3135
|
"contextBubble": "_5KEEsG_contextBubble",
|
|
3136
|
+
"headerSide": "_5KEEsG_headerSide",
|
|
3137
|
+
"tooltipAnchor": "_5KEEsG_tooltipAnchor",
|
|
3113
3138
|
"nativeToolbarActions": "_5KEEsG_nativeToolbarActions",
|
|
3114
|
-
"
|
|
3115
|
-
"
|
|
3139
|
+
"emptyTitle": "_5KEEsG_emptyTitle",
|
|
3140
|
+
"emptyIcon": "_5KEEsG_emptyIcon",
|
|
3116
3141
|
"progressProcess": "_5KEEsG_progressProcess",
|
|
3117
|
-
"
|
|
3118
|
-
"progressEntry": "_5KEEsG_progressEntry",
|
|
3119
|
-
"tooltipAnchor": "_5KEEsG_tooltipAnchor",
|
|
3120
|
-
"stateDetail": "_5KEEsG_stateDetail",
|
|
3121
|
-
"mainContext": "_5KEEsG_mainContext",
|
|
3122
|
-
"nativeConversation": "_5KEEsG_nativeConversation",
|
|
3123
|
-
"progressDetail": "_5KEEsG_progressDetail",
|
|
3124
|
-
"root": "_5KEEsG_root",
|
|
3125
|
-
"progressLatest": "_5KEEsG_progressLatest",
|
|
3126
|
-
"nativeToolbar": "_5KEEsG_nativeToolbar",
|
|
3127
|
-
"errorRow": "_5KEEsG_errorRow",
|
|
3128
|
-
"reflowAction": "_5KEEsG_reflowAction",
|
|
3129
|
-
"nativeAction": "_5KEEsG_nativeAction",
|
|
3142
|
+
"chatView": "_5KEEsG_chatView",
|
|
3130
3143
|
"progressContent": "_5KEEsG_progressContent",
|
|
3144
|
+
"contextChevron": "_5KEEsG_contextChevron",
|
|
3145
|
+
"nativeAction": "_5KEEsG_nativeAction",
|
|
3146
|
+
"contextChevronOpen": "_5KEEsG_contextChevronOpen",
|
|
3131
3147
|
"contextHint": "_5KEEsG_contextHint",
|
|
3132
|
-
"
|
|
3148
|
+
"nativeConversation": "_5KEEsG_nativeConversation",
|
|
3149
|
+
"contextColumn": "_5KEEsG_contextColumn",
|
|
3150
|
+
"errorRow": "_5KEEsG_errorRow",
|
|
3151
|
+
"contextImage": "_5KEEsG_contextImage",
|
|
3152
|
+
"progress": "_5KEEsG_progress",
|
|
3153
|
+
"nativeToolbar": "_5KEEsG_nativeToolbar",
|
|
3154
|
+
"mainContext": "_5KEEsG_mainContext",
|
|
3155
|
+
"contextUserRow": "_5KEEsG_contextUserRow",
|
|
3133
3156
|
"emptyText": "_5KEEsG_emptyText",
|
|
3134
3157
|
"nativeHost": "_5KEEsG_nativeHost",
|
|
3158
|
+
"root": "_5KEEsG_root",
|
|
3159
|
+
"progressEntry": "_5KEEsG_progressEntry",
|
|
3160
|
+
"stateScreen": "_5KEEsG_stateScreen",
|
|
3161
|
+
"progressLatest": "_5KEEsG_progressLatest",
|
|
3162
|
+
"stateDetail": "_5KEEsG_stateDetail",
|
|
3163
|
+
"progressEntries": "_5KEEsG_progressEntries",
|
|
3135
3164
|
"historyToggle": "_5KEEsG_historyToggle",
|
|
3136
|
-
"
|
|
3137
|
-
"
|
|
3138
|
-
"chatView": "_5KEEsG_chatView",
|
|
3139
|
-
"emptyTitle": "_5KEEsG_emptyTitle",
|
|
3140
|
-
"headerSide": "_5KEEsG_headerSide"
|
|
3165
|
+
"progressDetail": "_5KEEsG_progressDetail",
|
|
3166
|
+
"progressPreview": "_5KEEsG_progressPreview"
|
|
3141
3167
|
};
|
|
3142
3168
|
//#endregion
|
|
3143
3169
|
//#region src/client/sidechat/ContextProgress.tsx
|
|
@@ -4299,7 +4325,7 @@ ${body}
|
|
|
4299
4325
|
return [];
|
|
4300
4326
|
}
|
|
4301
4327
|
}
|
|
4302
|
-
/** Browser-local identity outlives tabs and
|
|
4328
|
+
/** Browser-local identity outlives tabs and manually removed recovery records. */
|
|
4303
4329
|
function createSessionVisibility() {
|
|
4304
4330
|
let snapshot = {
|
|
4305
4331
|
hidden: new Set(readSaved()),
|
|
@@ -4400,7 +4426,7 @@ ${body}
|
|
|
4400
4426
|
const KEY_PREFIX$1 = "dsh-sidenote:side-meta:v1:";
|
|
4401
4427
|
const restorationCandidates = /* @__PURE__ */ new Map();
|
|
4402
4428
|
function takeRestoredSideChatMeta(sessionId, tabId) {
|
|
4403
|
-
const key = keyOf(sessionId, tabId);
|
|
4429
|
+
const key = keyOf$1(sessionId, tabId);
|
|
4404
4430
|
const meta = restorationCandidates.get(key);
|
|
4405
4431
|
restorationCandidates.delete(key);
|
|
4406
4432
|
return meta;
|
|
@@ -4418,7 +4444,7 @@ ${body}
|
|
|
4418
4444
|
}
|
|
4419
4445
|
return `run-ssr-${Math.random().toString(36).slice(2)}`;
|
|
4420
4446
|
})();
|
|
4421
|
-
function keyOf(sessionId, tabId) {
|
|
4447
|
+
function keyOf$1(sessionId, tabId) {
|
|
4422
4448
|
return `${KEY_PREFIX$1}${sessionId}:${tabId}`;
|
|
4423
4449
|
}
|
|
4424
4450
|
function revive(value) {
|
|
@@ -4477,7 +4503,7 @@ ${body}
|
|
|
4477
4503
|
notify();
|
|
4478
4504
|
}
|
|
4479
4505
|
function readSideChatMeta(sessionId, tabId) {
|
|
4480
|
-
const key = keyOf(sessionId, tabId);
|
|
4506
|
+
const key = keyOf$1(sessionId, tabId);
|
|
4481
4507
|
const record = readRecord(windowStorage(), key) ?? readRecord(storage(), key);
|
|
4482
4508
|
return record?.runId === SIDENOTE_RUN_ID ? record : void 0;
|
|
4483
4509
|
}
|
|
@@ -4488,7 +4514,7 @@ ${body}
|
|
|
4488
4514
|
runId: record.runId ?? SIDENOTE_RUN_ID
|
|
4489
4515
|
});
|
|
4490
4516
|
for (const store of [windowStorage(), storage()]) try {
|
|
4491
|
-
store?.setItem(keyOf(record.sessionId, record.tabId), value);
|
|
4517
|
+
store?.setItem(keyOf$1(record.sessionId, record.tabId), value);
|
|
4492
4518
|
} catch {}
|
|
4493
4519
|
if (options?.silent !== true) notify();
|
|
4494
4520
|
}
|
|
@@ -4496,7 +4522,7 @@ ${body}
|
|
|
4496
4522
|
function switchSideChatSession(expected, childId, boundarySeq) {
|
|
4497
4523
|
const current = readSideChatMeta(expected.sessionId, expected.tabId);
|
|
4498
4524
|
if (!current || current.childId !== expected.childId || current.nativeAddress !== expected.nativeAddress || current.runId !== expected.runId || current.createdAt !== expected.createdAt) throw new Error("侧聊已关闭或改变,正文已保留");
|
|
4499
|
-
const key = keyOf(current.sessionId, current.tabId);
|
|
4525
|
+
const key = keyOf$1(current.sessionId, current.tabId);
|
|
4500
4526
|
const value = JSON.stringify({
|
|
4501
4527
|
...current,
|
|
4502
4528
|
childId,
|
|
@@ -4531,7 +4557,7 @@ ${body}
|
|
|
4531
4557
|
}
|
|
4532
4558
|
}
|
|
4533
4559
|
function dropSideChatMeta(sessionId, tabId) {
|
|
4534
|
-
const key = keyOf(sessionId, tabId);
|
|
4560
|
+
const key = keyOf$1(sessionId, tabId);
|
|
4535
4561
|
try {
|
|
4536
4562
|
windowStorage()?.removeItem(key);
|
|
4537
4563
|
} catch {}
|
|
@@ -4576,7 +4602,7 @@ ${body}
|
|
|
4576
4602
|
*/
|
|
4577
4603
|
function sweepOrphanedSideChatMeta() {
|
|
4578
4604
|
restorationCandidates.clear();
|
|
4579
|
-
for (const record of storedSideChatMetas()) if (record.runId !== SIDENOTE_RUN_ID) restorationCandidates.set(keyOf(record.sessionId, record.tabId), record);
|
|
4605
|
+
for (const record of storedSideChatMetas()) if (record.runId !== SIDENOTE_RUN_ID) restorationCandidates.set(keyOf$1(record.sessionId, record.tabId), record);
|
|
4580
4606
|
return restorationCandidates.size;
|
|
4581
4607
|
}
|
|
4582
4608
|
//#endregion
|
|
@@ -5517,38 +5543,97 @@ ${body}
|
|
|
5517
5543
|
}
|
|
5518
5544
|
//#endregion
|
|
5519
5545
|
//#region src/client/sidechat/recentClosed.ts
|
|
5520
|
-
/**
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5546
|
+
/** Closed side-chat recovery records, grouped by parent and ordered newest first. */
|
|
5547
|
+
const LEGACY_PREFIX = "dsh-sidenote:closed-side:v1:";
|
|
5548
|
+
const KEY_PREFIX = "dsh-sidenote:closed-side:v2:";
|
|
5549
|
+
const parentPrefix = (parent) => `${KEY_PREFIX}${encodeURIComponent(parent)}:`;
|
|
5550
|
+
const entryKey = (parent, child) => parentPrefix(parent) + encodeURIComponent(child);
|
|
5551
|
+
function isEntry(value) {
|
|
5552
|
+
if (value === null || typeof value !== "object") return false;
|
|
5553
|
+
const e = value;
|
|
5554
|
+
return typeof e.childId === "string" && typeof e.parentSessionId === "string" && typeof e.title === "string";
|
|
5555
|
+
}
|
|
5556
|
+
function readLegacy(parent) {
|
|
5530
5557
|
try {
|
|
5531
|
-
const
|
|
5532
|
-
|
|
5533
|
-
const parsed = JSON.parse(raw);
|
|
5534
|
-
if (!Array.isArray(parsed)) return [];
|
|
5535
|
-
return parsed.filter((e) => typeof e === "object" && e !== null && typeof e.childId === "string" && typeof e.parentSessionId === "string" && typeof e.title === "string");
|
|
5558
|
+
const value = JSON.parse(localStorage.getItem(LEGACY_PREFIX + parent) ?? "null");
|
|
5559
|
+
return Array.isArray(value) ? value.filter(isEntry).filter((entry) => entry.parentSessionId === parent) : [];
|
|
5536
5560
|
} catch {
|
|
5537
5561
|
return [];
|
|
5538
5562
|
}
|
|
5539
5563
|
}
|
|
5540
|
-
function
|
|
5564
|
+
function storageKeys(store) {
|
|
5565
|
+
try {
|
|
5566
|
+
return Object.keys(store);
|
|
5567
|
+
} catch {
|
|
5568
|
+
return [];
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
function browserStorage(kind) {
|
|
5541
5572
|
try {
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5573
|
+
return globalThis[kind];
|
|
5574
|
+
} catch {
|
|
5575
|
+
return;
|
|
5576
|
+
}
|
|
5577
|
+
}
|
|
5578
|
+
function readStored(store, key) {
|
|
5579
|
+
try {
|
|
5580
|
+
const raw = store?.getItem(key);
|
|
5581
|
+
if (raw == null) return void 0;
|
|
5582
|
+
const value = JSON.parse(raw);
|
|
5583
|
+
if (value && typeof value.writtenAt === "number" && (value.entry === null || isEntry(value.entry))) return value;
|
|
5545
5584
|
} catch {}
|
|
5546
5585
|
}
|
|
5586
|
+
function encodeStored(key, entry) {
|
|
5587
|
+
const writtenAt = Math.max(Date.now(), (readStored(browserStorage("localStorage"), key)?.writtenAt ?? 0) + 1);
|
|
5588
|
+
return JSON.stringify({
|
|
5589
|
+
entry,
|
|
5590
|
+
writtenAt
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5593
|
+
/** A single key per child prevents closing/removing one chat from overwriting another
|
|
5594
|
+
* window's history. Legacy arrays remain readable; a null entry masks a removed v1 record. */
|
|
5595
|
+
function listClosedSideChats(parentSessionId) {
|
|
5596
|
+
const entries = new Map(readLegacy(parentSessionId).map((entry) => [entry.childId, entry]));
|
|
5597
|
+
const changes = /* @__PURE__ */ new Map();
|
|
5598
|
+
const prefix = parentPrefix(parentSessionId);
|
|
5599
|
+
for (const store of [browserStorage("localStorage"), browserStorage("sessionStorage")]) {
|
|
5600
|
+
if (!store) continue;
|
|
5601
|
+
for (const key of storageKeys(store)) {
|
|
5602
|
+
if (!key.startsWith(prefix)) continue;
|
|
5603
|
+
try {
|
|
5604
|
+
const childId = decodeURIComponent(key.slice(prefix.length));
|
|
5605
|
+
const value = readStored(store, key);
|
|
5606
|
+
if (!value || value.writtenAt <= (changes.get(childId)?.writtenAt ?? -1)) continue;
|
|
5607
|
+
if (value.entry === null || value.entry.childId === childId && value.entry.parentSessionId === parentSessionId) changes.set(childId, value);
|
|
5608
|
+
} catch {}
|
|
5609
|
+
}
|
|
5610
|
+
}
|
|
5611
|
+
for (const [childId, change] of changes) if (change.entry === null) entries.delete(childId);
|
|
5612
|
+
else entries.set(childId, change.entry);
|
|
5613
|
+
return [...entries.values()].sort((a, b) => (b.closedAt || 0) - (a.closedAt || 0));
|
|
5614
|
+
}
|
|
5615
|
+
function recordClosedSideChat(parentSessionId, entry) {
|
|
5616
|
+
const key = entryKey(parentSessionId, entry.childId);
|
|
5617
|
+
const value = encodeStored(key, entry);
|
|
5618
|
+
try {
|
|
5619
|
+
localStorage.setItem(key, value);
|
|
5620
|
+
try {
|
|
5621
|
+
sessionStorage.removeItem(key);
|
|
5622
|
+
} catch {}
|
|
5623
|
+
return true;
|
|
5624
|
+
} catch {
|
|
5625
|
+
try {
|
|
5626
|
+
sessionStorage.setItem(key, value);
|
|
5627
|
+
} catch {}
|
|
5628
|
+
console.warn("[dsh-sidenote] Could not persist a closed side chat in local storage.");
|
|
5629
|
+
return false;
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5547
5632
|
/** Share the recovery payload between pagehide and true native-tab closure. */
|
|
5548
5633
|
function rememberSideChat(tabId, title, meta) {
|
|
5549
5634
|
const current = parseSideChatMeta(meta);
|
|
5550
|
-
if (!current.childId || !current.parentSessionId) return;
|
|
5551
|
-
recordClosedSideChat(current.parentSessionId, {
|
|
5635
|
+
if (!current.childId || !current.parentSessionId) return true;
|
|
5636
|
+
return recordClosedSideChat(current.parentSessionId, {
|
|
5552
5637
|
childId: current.childId,
|
|
5553
5638
|
parentSessionId: current.parentSessionId,
|
|
5554
5639
|
tabId,
|
|
@@ -5561,41 +5646,53 @@ ${body}
|
|
|
5561
5646
|
closedAt: Date.now()
|
|
5562
5647
|
});
|
|
5563
5648
|
}
|
|
5564
|
-
/** 读某主会话的最近关闭列表(新者在前)。 */
|
|
5565
|
-
function listClosedSideChats(parentSessionId) {
|
|
5566
|
-
if (typeof localStorage === "undefined") return [];
|
|
5567
|
-
return readAll(KEY_PREFIX + parentSessionId);
|
|
5568
|
-
}
|
|
5569
5649
|
/** Existing recovery records can seed the durable visibility index on upgrade. */
|
|
5570
5650
|
function allClosedSideChats() {
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
}
|
|
5651
|
+
const parents = /* @__PURE__ */ new Set();
|
|
5652
|
+
for (const store of [browserStorage("localStorage"), browserStorage("sessionStorage")]) for (const key of store ? storageKeys(store) : []) if (key.startsWith(LEGACY_PREFIX)) parents.add(key.slice(28));
|
|
5653
|
+
else if (key.startsWith(KEY_PREFIX)) try {
|
|
5654
|
+
parents.add(decodeURIComponent(key.slice(28).split(":")[0]));
|
|
5655
|
+
} catch {}
|
|
5656
|
+
return [...parents].flatMap(listClosedSideChats);
|
|
5576
5657
|
}
|
|
5577
|
-
/**
|
|
5658
|
+
/** Reopening consumes the record; closing the same child later writes it again. */
|
|
5578
5659
|
function dropClosedSideChat(parentSessionId, childId) {
|
|
5579
5660
|
try {
|
|
5580
|
-
const key =
|
|
5581
|
-
const
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5661
|
+
const key = entryKey(parentSessionId, childId);
|
|
5662
|
+
const legacy = readLegacy(parentSessionId);
|
|
5663
|
+
const wasLegacy = legacy.some((entry) => entry.childId === childId);
|
|
5664
|
+
const durable = readStored(browserStorage("localStorage"), key);
|
|
5665
|
+
const fallback = readStored(browserStorage("sessionStorage"), key);
|
|
5666
|
+
if (!wasLegacy && !durable?.entry && !fallback?.entry) return true;
|
|
5667
|
+
const tombstone = encodeStored(key, null);
|
|
5668
|
+
try {
|
|
5669
|
+
localStorage.setItem(key, tombstone);
|
|
5670
|
+
} catch (error) {
|
|
5671
|
+
if (!wasLegacy && !durable?.entry && fallback?.entry) {
|
|
5672
|
+
sessionStorage.removeItem(key);
|
|
5673
|
+
return true;
|
|
5674
|
+
}
|
|
5675
|
+
if (!wasLegacy) throw error;
|
|
5676
|
+
const remaining = legacy.filter((entry) => entry.childId !== childId);
|
|
5677
|
+
if (remaining.length === 0) localStorage.removeItem(LEGACY_PREFIX + parentSessionId);
|
|
5678
|
+
else localStorage.setItem(LEGACY_PREFIX + parentSessionId, JSON.stringify(remaining));
|
|
5679
|
+
localStorage.setItem(key, tombstone);
|
|
5680
|
+
}
|
|
5681
|
+
try {
|
|
5682
|
+
sessionStorage.removeItem(key);
|
|
5683
|
+
} catch {}
|
|
5684
|
+
return true;
|
|
5685
|
+
} catch {
|
|
5686
|
+
return false;
|
|
5687
|
+
}
|
|
5585
5688
|
}
|
|
5586
|
-
/**
|
|
5587
|
-
* but revoke that old occurrence's automatic restoration identity. */
|
|
5689
|
+
/** Revoke an old tab occurrence's automatic restoration identity while keeping manual history. */
|
|
5588
5690
|
function forgetClosedTabBinding(parentSessionId, tabId) {
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
const
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
if (entry.tabId !== tabId) return entry;
|
|
5595
|
-
const { tabId: _oldTab, ...rest } = entry;
|
|
5596
|
-
return rest;
|
|
5597
|
-
})));
|
|
5598
|
-
} catch {}
|
|
5691
|
+
for (const entry of listClosedSideChats(parentSessionId)) {
|
|
5692
|
+
if (entry.tabId !== tabId) continue;
|
|
5693
|
+
const { tabId: _oldTab, ...rest } = entry;
|
|
5694
|
+
recordClosedSideChat(parentSessionId, rest);
|
|
5695
|
+
}
|
|
5599
5696
|
}
|
|
5600
5697
|
//#endregion
|
|
5601
5698
|
//#region src/client/annotations/submissionExtras.ts
|
|
@@ -6118,9 +6215,10 @@ ${body}
|
|
|
6118
6215
|
(0, react.useEffect)(() => {
|
|
6119
6216
|
const onAbort = () => {
|
|
6120
6217
|
const current = readSideChatMeta(sessionId, record.id);
|
|
6121
|
-
rememberSideChat(record.id, sideChatTitleOf(current), current);
|
|
6218
|
+
const saved = rememberSideChat(record.id, sideChatTitleOf(current), current);
|
|
6122
6219
|
forgetSideChatOpening(sessionId, record.id);
|
|
6123
6220
|
dropSideChatMeta(sessionId, record.id);
|
|
6221
|
+
if (!saved && !rememberSideChat(record.id, sideChatTitleOf(current), current)) showToast(t("cmdHistorySaveFailed"));
|
|
6124
6222
|
};
|
|
6125
6223
|
if (record.signal.aborted) {
|
|
6126
6224
|
onAbort();
|
|
@@ -6415,80 +6513,375 @@ ${body}
|
|
|
6415
6513
|
}
|
|
6416
6514
|
}
|
|
6417
6515
|
//#endregion
|
|
6418
|
-
//#region src/client/
|
|
6419
|
-
/** 0.
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6516
|
+
//#region src/client/host/menuSurface.ts
|
|
6517
|
+
/** The supported 0.2.2 hosts expose MenuSurface; the older development types do not. */
|
|
6518
|
+
const MenuSurface = _deepseek_ai_dsh_client_ui_primitives.MenuSurface ?? "div";
|
|
6519
|
+
/** Native 0.2.2 tooltips can escape a scrolling menu via the body portal. */
|
|
6520
|
+
const MenuTooltip = _deepseek_ai_dsh_client_ui_primitives.Tooltip;
|
|
6521
|
+
//#endregion
|
|
6522
|
+
//#region \0dsh-css:/home/runner/work/dsh-sidenote/dsh-sidenote/src/client/sidechat/side-menu.module.css.mjs
|
|
6523
|
+
const css$3 = ".v6I3QW_card{z-index:100;box-sizing:border-box;min-width:min(220px,100%);max-width:100%;color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-prominent);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);flex-direction:column;padding:4px;display:flex;position:absolute;bottom:calc(100% + 4px);left:0;right:0;overflow:hidden}.v6I3QW_search{padding:2px 2px 3px;display:flex}.v6I3QW_search input{border-radius:var(--dsw-radius-md);min-width:0;color:var(--dsw-alias-label-primary);font:inherit;background:0 0;border:.5px solid #0000;outline:none;flex:1;padding:5px 7px;font-size:12px}.v6I3QW_search input::placeholder{color:var(--dsw-alias-label-tertiary)}.v6I3QW_viewport{--row-height:32px;--heading-height:24px;min-height:0;max-height:calc(var(--visible-rows) * var(--row-height) + var(--visible-groups) * var(--heading-height));overscroll-behavior:contain;scrollbar-gutter:stable;overflow-y:auto}.v6I3QW_heading{box-sizing:border-box;height:var(--heading-height);line-height:var(--heading-height);color:var(--dsw-alias-label-tertiary);padding:0 7px;font-size:11px;font-weight:500}.v6I3QW_row{height:var(--row-height);box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:2px;padding-right:4px;display:flex}.v6I3QW_row[data-active],.v6I3QW_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.v6I3QW_choice,.v6I3QW_remove,.v6I3QW_confirmActions button{font:inherit;color:inherit;border-radius:var(--dsw-radius-sm);cursor:pointer;background:0 0;border:0}.v6I3QW_choice{text-align:left;flex:1;align-items:baseline;gap:6px;min-width:0;padding:5px 7px;font-size:12px;line-height:18px;display:flex}.v6I3QW_label,.v6I3QW_detail{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.v6I3QW_label{flex:0 auto;min-width:0}.v6I3QW_detail{min-width:0;color:var(--dsw-alias-label-tertiary);flex:1;font-size:11px}.v6I3QW_remove{width:26px;height:26px;color:var(--dsw-alias-label-tertiary);opacity:0;flex-shrink:0;place-items:center;display:grid}.v6I3QW_row:hover .v6I3QW_remove,.v6I3QW_row:focus-within .v6I3QW_remove{opacity:1}.v6I3QW_remove:hover,.v6I3QW_remove:focus-visible{color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-interactive-bg-hover)}.v6I3QW_choice:focus-visible,.v6I3QW_remove:focus-visible,.v6I3QW_confirmActions button:focus-visible{outline:1px solid var(--dsw-alias-label-secondary);outline-offset:-1px}.v6I3QW_confirmation{flex:1;align-items:center;gap:6px;min-width:0;padding-left:7px;display:flex}.v6I3QW_confirmTitle,.v6I3QW_confirmHint{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.v6I3QW_confirmTitle{flex:0 auto;font-size:12px;font-weight:500}.v6I3QW_confirmHint{color:var(--dsw-alias-label-secondary);flex:1;font-size:11px}.v6I3QW_confirmActions{flex:none;gap:4px;margin-left:auto;display:flex}.v6I3QW_confirmActions button{white-space:nowrap;padding:4px 7px;font-size:12px;line-height:18px}.v6I3QW_confirmActions button:hover{background:var(--dsw-alias-interactive-bg-hover)}.v6I3QW_confirmActions .v6I3QW_danger{color:var(--dsw-alias-state-error-primary);font-weight:500}.v6I3QW_empty,.v6I3QW_error{color:var(--dsw-alias-label-tertiary);padding:7px 8px;font-size:12px}.v6I3QW_error{color:var(--dsw-alias-state-error-primary)}@media (hover:none){.v6I3QW_remove{opacity:1}}";
|
|
6524
|
+
const tagId$3 = "dsh-sidenote/side-menu.module.css";
|
|
6525
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
|
|
6526
|
+
const tag = document.createElement("style");
|
|
6527
|
+
tag.dataset.plugin = "dsh-sidenote";
|
|
6528
|
+
tag.dataset.pluginCss = tagId$3;
|
|
6529
|
+
tag.textContent = css$3;
|
|
6530
|
+
document.head.appendChild(tag);
|
|
6423
6531
|
}
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
if (option.id.startsWith("reopen:")) {
|
|
6479
|
-
const childId = option.id.slice(7);
|
|
6480
|
-
const entry = listClosedSideChats(session.sessionId).find((e) => e.childId === childId);
|
|
6481
|
-
const opts = entry === void 0 ? void 0 : {
|
|
6482
|
-
...entry.topic !== void 0 ? { topic: entry.topic } : {},
|
|
6483
|
-
...entry.savedMeta !== void 0 ? { savedMeta: entry.savedMeta } : {}
|
|
6484
|
-
};
|
|
6485
|
-
if (reopenSideChat(ctx, session.sessionId, childId, opts)) dropClosedSideChat(session.sessionId, childId);
|
|
6486
|
-
}
|
|
6487
|
-
}
|
|
6488
|
-
}
|
|
6532
|
+
var side_menu_module_css_default = {
|
|
6533
|
+
"confirmTitle": "v6I3QW_confirmTitle",
|
|
6534
|
+
"card": "v6I3QW_card",
|
|
6535
|
+
"viewport": "v6I3QW_viewport",
|
|
6536
|
+
"error": "v6I3QW_error",
|
|
6537
|
+
"label": "v6I3QW_label",
|
|
6538
|
+
"choice": "v6I3QW_choice",
|
|
6539
|
+
"empty": "v6I3QW_empty",
|
|
6540
|
+
"detail": "v6I3QW_detail",
|
|
6541
|
+
"heading": "v6I3QW_heading",
|
|
6542
|
+
"confirmation": "v6I3QW_confirmation",
|
|
6543
|
+
"search": "v6I3QW_search",
|
|
6544
|
+
"row": "v6I3QW_row",
|
|
6545
|
+
"confirmActions": "v6I3QW_confirmActions",
|
|
6546
|
+
"confirmHint": "v6I3QW_confirmHint",
|
|
6547
|
+
"danger": "v6I3QW_danger",
|
|
6548
|
+
"remove": "v6I3QW_remove"
|
|
6549
|
+
};
|
|
6550
|
+
//#endregion
|
|
6551
|
+
//#region src/client/sidechat/SideChatMenu.tsx
|
|
6552
|
+
const keyOf = (item) => `${item.kind}:${item.id}`;
|
|
6553
|
+
const VISIBLE_ROWS = 5;
|
|
6554
|
+
function SideChatMenu({ readItems, onSelect, onRemove, onClose }) {
|
|
6555
|
+
useLocaleTick();
|
|
6556
|
+
const [items, setItems] = (0, react.useState)(readItems);
|
|
6557
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
6558
|
+
const [highlight, setHighlight] = (0, react.useState)("new:new");
|
|
6559
|
+
const [confirming, setConfirming] = (0, react.useState)();
|
|
6560
|
+
const confirmationHintId = (0, react.useId)();
|
|
6561
|
+
const [error, setError] = (0, react.useState)(false);
|
|
6562
|
+
const root = (0, react.useRef)(null);
|
|
6563
|
+
const search = (0, react.useRef)(null);
|
|
6564
|
+
const viewport = (0, react.useRef)(null);
|
|
6565
|
+
const scrollRequested = (0, react.useRef)(false);
|
|
6566
|
+
const selectedRow = (0, react.useRef)(null);
|
|
6567
|
+
const cancelButton = (0, react.useRef)(null);
|
|
6568
|
+
const needle = query.trim().toLowerCase();
|
|
6569
|
+
const matches = (item) => `${item.label} ${item.detail ?? ""}`.toLowerCase().includes(needle);
|
|
6570
|
+
const shown = items.filter(matches);
|
|
6571
|
+
const visibleGroups = new Set(shown.slice(0, VISIBLE_ROWS).filter((item) => item.kind !== "new").map((item) => item.kind)).size;
|
|
6572
|
+
const active = shown.find((item) => keyOf(item) === highlight) ?? shown[0];
|
|
6573
|
+
const activeKey = active && keyOf(active);
|
|
6574
|
+
const close = (restoreFocus) => {
|
|
6575
|
+
if (restoreFocus && root.current) focusSideComposer(conversationViewOf(root.current));
|
|
6576
|
+
onClose();
|
|
6577
|
+
};
|
|
6578
|
+
const reveal = (element) => {
|
|
6579
|
+
const list = viewport.current;
|
|
6580
|
+
if (!list || !element) return false;
|
|
6581
|
+
const bounds = list.getBoundingClientRect();
|
|
6582
|
+
const row = (element.closest("[data-sidenote-side-menu-row]") ?? element).getBoundingClientRect();
|
|
6583
|
+
if (row.top < bounds.top) list.scrollTop += row.top - bounds.top;
|
|
6584
|
+
else if (row.bottom > bounds.bottom) list.scrollTop += row.bottom - bounds.bottom;
|
|
6585
|
+
return row.bottom <= bounds.top || row.top >= bounds.bottom;
|
|
6489
6586
|
};
|
|
6587
|
+
(0, react.useLayoutEffect)(() => {
|
|
6588
|
+
const card = root.current;
|
|
6589
|
+
if (!card) return;
|
|
6590
|
+
const fit = (event) => {
|
|
6591
|
+
if (event?.target instanceof Node && card.contains(event.target)) return;
|
|
6592
|
+
const top = Math.max(8, conversationViewOf(card).getBoundingClientRect().top + 8);
|
|
6593
|
+
card.style.maxHeight = `${Math.max(0, card.getBoundingClientRect().bottom - top)}px`;
|
|
6594
|
+
};
|
|
6595
|
+
fit();
|
|
6596
|
+
search.current?.focus({ preventScroll: true });
|
|
6597
|
+
window.addEventListener("resize", fit);
|
|
6598
|
+
window.addEventListener("scroll", fit, true);
|
|
6599
|
+
return () => {
|
|
6600
|
+
window.removeEventListener("resize", fit);
|
|
6601
|
+
window.removeEventListener("scroll", fit, true);
|
|
6602
|
+
};
|
|
6603
|
+
}, []);
|
|
6604
|
+
(0, react.useEffect)(() => {
|
|
6605
|
+
const dismiss = (event) => {
|
|
6606
|
+
if (event.target instanceof Node && !root.current?.contains(event.target)) onClose();
|
|
6607
|
+
};
|
|
6608
|
+
document.addEventListener("pointerdown", dismiss, true);
|
|
6609
|
+
return () => document.removeEventListener("pointerdown", dismiss, true);
|
|
6610
|
+
}, [onClose]);
|
|
6611
|
+
(0, react.useEffect)(() => {
|
|
6612
|
+
const card = root.current;
|
|
6613
|
+
return () => {
|
|
6614
|
+
queueMicrotask(() => {
|
|
6615
|
+
if (!card?.isConnected) onClose();
|
|
6616
|
+
});
|
|
6617
|
+
};
|
|
6618
|
+
}, [onClose]);
|
|
6619
|
+
(0, react.useLayoutEffect)(() => {
|
|
6620
|
+
if (confirming) {
|
|
6621
|
+
cancelButton.current?.focus({ preventScroll: true });
|
|
6622
|
+
reveal(cancelButton.current);
|
|
6623
|
+
}
|
|
6624
|
+
}, [confirming]);
|
|
6625
|
+
(0, react.useLayoutEffect)(() => {
|
|
6626
|
+
if (!confirming && scrollRequested.current) reveal(selectedRow.current);
|
|
6627
|
+
scrollRequested.current = false;
|
|
6628
|
+
}, [
|
|
6629
|
+
activeKey,
|
|
6630
|
+
query,
|
|
6631
|
+
confirming
|
|
6632
|
+
]);
|
|
6633
|
+
function select(item) {
|
|
6634
|
+
if (onSelect(item)) close(true);
|
|
6635
|
+
else {
|
|
6636
|
+
setItems(readItems());
|
|
6637
|
+
setError(true);
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
function remove(item) {
|
|
6641
|
+
const success = onRemove(item);
|
|
6642
|
+
const next = readItems();
|
|
6643
|
+
const remaining = next.filter(matches);
|
|
6644
|
+
const nearby = remaining[Math.min(shown.indexOf(item), remaining.length - 1)];
|
|
6645
|
+
scrollRequested.current = true;
|
|
6646
|
+
setItems(next);
|
|
6647
|
+
setConfirming(void 0);
|
|
6648
|
+
setHighlight(nearby ? keyOf(nearby) : "");
|
|
6649
|
+
setError(!success);
|
|
6650
|
+
search.current?.focus({ preventScroll: true });
|
|
6651
|
+
}
|
|
6652
|
+
function handleKey(event) {
|
|
6653
|
+
event.stopPropagation();
|
|
6654
|
+
if (event.nativeEvent.isComposing) return;
|
|
6655
|
+
if (event.key === "Escape") {
|
|
6656
|
+
event.preventDefault();
|
|
6657
|
+
if (confirming) {
|
|
6658
|
+
setConfirming(void 0);
|
|
6659
|
+
search.current?.focus({ preventScroll: true });
|
|
6660
|
+
} else close(true);
|
|
6661
|
+
return;
|
|
6662
|
+
}
|
|
6663
|
+
if (event.target !== search.current || !active || confirming) return;
|
|
6664
|
+
if (event.key === "Enter") {
|
|
6665
|
+
event.preventDefault();
|
|
6666
|
+
if (!event.repeat && !reveal(selectedRow.current)) select(active);
|
|
6667
|
+
return;
|
|
6668
|
+
}
|
|
6669
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
6670
|
+
event.preventDefault();
|
|
6671
|
+
if (shown.length === 1) return;
|
|
6672
|
+
const index = (shown.indexOf(active) + (event.key === "ArrowDown" ? 1 : -1) + shown.length) % shown.length;
|
|
6673
|
+
scrollRequested.current = true;
|
|
6674
|
+
setHighlight(keyOf(shown[index]));
|
|
6675
|
+
}
|
|
6676
|
+
}
|
|
6677
|
+
function renderRow(item) {
|
|
6678
|
+
const key = keyOf(item);
|
|
6679
|
+
const selected = active && keyOf(active) === key;
|
|
6680
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6681
|
+
className: side_menu_module_css_default.row,
|
|
6682
|
+
"data-sidenote-side-menu-row": "",
|
|
6683
|
+
"data-active": selected || void 0,
|
|
6684
|
+
onMouseEnter: () => setHighlight(key),
|
|
6685
|
+
children: confirming === key ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6686
|
+
className: side_menu_module_css_default.confirmation,
|
|
6687
|
+
children: [
|
|
6688
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6689
|
+
className: side_menu_module_css_default.confirmTitle,
|
|
6690
|
+
children: t("cmdRemoveConfirm", { title: item.title ?? item.label })
|
|
6691
|
+
}),
|
|
6692
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6693
|
+
className: side_menu_module_css_default.confirmHint,
|
|
6694
|
+
id: confirmationHintId,
|
|
6695
|
+
children: t("cmdRemoveHint")
|
|
6696
|
+
}),
|
|
6697
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6698
|
+
className: side_menu_module_css_default.confirmActions,
|
|
6699
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6700
|
+
type: "button",
|
|
6701
|
+
ref: cancelButton,
|
|
6702
|
+
onClick: () => {
|
|
6703
|
+
setConfirming(void 0);
|
|
6704
|
+
search.current?.focus({ preventScroll: true });
|
|
6705
|
+
},
|
|
6706
|
+
children: t("cmdRemoveCancel")
|
|
6707
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6708
|
+
type: "button",
|
|
6709
|
+
className: side_menu_module_css_default.danger,
|
|
6710
|
+
"aria-describedby": confirmationHintId,
|
|
6711
|
+
onClick: () => remove(item),
|
|
6712
|
+
children: t("cmdRemove")
|
|
6713
|
+
})]
|
|
6714
|
+
})
|
|
6715
|
+
]
|
|
6716
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
6717
|
+
type: "button",
|
|
6718
|
+
ref: selected ? selectedRow : void 0,
|
|
6719
|
+
className: side_menu_module_css_default.choice,
|
|
6720
|
+
onFocus: () => setHighlight(key),
|
|
6721
|
+
onClick: () => select(item),
|
|
6722
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6723
|
+
className: side_menu_module_css_default.label,
|
|
6724
|
+
children: item.label
|
|
6725
|
+
}), item.detail && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6726
|
+
className: side_menu_module_css_default.detail,
|
|
6727
|
+
children: item.detail
|
|
6728
|
+
})]
|
|
6729
|
+
}), item.kind === "reopen" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MenuTooltip, {
|
|
6730
|
+
label: t("cmdRemove"),
|
|
6731
|
+
side: "top",
|
|
6732
|
+
delayMs: 250,
|
|
6733
|
+
portal: true,
|
|
6734
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6735
|
+
type: "button",
|
|
6736
|
+
className: side_menu_module_css_default.remove,
|
|
6737
|
+
"aria-label": t("cmdRemoveNamed", { title: item.title ?? item.label }),
|
|
6738
|
+
onFocus: () => setHighlight(key),
|
|
6739
|
+
onClick: () => {
|
|
6740
|
+
setHighlight(key);
|
|
6741
|
+
setConfirming(key);
|
|
6742
|
+
setError(false);
|
|
6743
|
+
},
|
|
6744
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconTrashOutline16, { size: 15 })
|
|
6745
|
+
})
|
|
6746
|
+
})] })
|
|
6747
|
+
}, key);
|
|
6748
|
+
}
|
|
6749
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MenuSurface, {
|
|
6750
|
+
ref: root,
|
|
6751
|
+
className: side_menu_module_css_default.card,
|
|
6752
|
+
role: "dialog",
|
|
6753
|
+
"aria-label": t("cmdMenuTitle"),
|
|
6754
|
+
"data-sidenote-side-menu": "",
|
|
6755
|
+
onKeyDown: handleKey,
|
|
6756
|
+
onBlur: (event) => {
|
|
6757
|
+
if (event.relatedTarget instanceof Node && !event.currentTarget.contains(event.relatedTarget)) onClose();
|
|
6758
|
+
},
|
|
6759
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
6760
|
+
onClick: (event) => event.stopPropagation(),
|
|
6761
|
+
children: [
|
|
6762
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6763
|
+
className: side_menu_module_css_default.search,
|
|
6764
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
6765
|
+
ref: search,
|
|
6766
|
+
"aria-label": t("cmdSearch"),
|
|
6767
|
+
placeholder: t("cmdSearchPlaceholder"),
|
|
6768
|
+
value: query,
|
|
6769
|
+
onChange: (event) => {
|
|
6770
|
+
scrollRequested.current = true;
|
|
6771
|
+
setQuery(event.target.value);
|
|
6772
|
+
setHighlight("");
|
|
6773
|
+
setConfirming(void 0);
|
|
6774
|
+
setError(false);
|
|
6775
|
+
}
|
|
6776
|
+
})
|
|
6777
|
+
}),
|
|
6778
|
+
error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6779
|
+
className: side_menu_module_css_default.error,
|
|
6780
|
+
role: "alert",
|
|
6781
|
+
children: t("cmdMenuFailed")
|
|
6782
|
+
}),
|
|
6783
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6784
|
+
className: side_menu_module_css_default.viewport,
|
|
6785
|
+
ref: viewport,
|
|
6786
|
+
style: {
|
|
6787
|
+
"--visible-rows": VISIBLE_ROWS,
|
|
6788
|
+
"--visible-groups": visibleGroups
|
|
6789
|
+
},
|
|
6790
|
+
children: [
|
|
6791
|
+
shown.filter((item) => item.kind === "new").map(renderRow),
|
|
6792
|
+
["focus", "reopen"].map((kind) => {
|
|
6793
|
+
const group = shown.filter((item) => item.kind === kind);
|
|
6794
|
+
return group.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6795
|
+
className: side_menu_module_css_default.group,
|
|
6796
|
+
role: "group",
|
|
6797
|
+
"aria-label": t(kind === "focus" ? "cmdOpenGroup" : "cmdClosedGroup"),
|
|
6798
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6799
|
+
className: side_menu_module_css_default.heading,
|
|
6800
|
+
children: t(kind === "focus" ? "cmdOpenGroup" : "cmdClosedGroup")
|
|
6801
|
+
}), group.map(renderRow)]
|
|
6802
|
+
}, kind);
|
|
6803
|
+
}),
|
|
6804
|
+
shown.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6805
|
+
className: side_menu_module_css_default.empty,
|
|
6806
|
+
children: t("cmdNoMatches")
|
|
6807
|
+
})
|
|
6808
|
+
]
|
|
6809
|
+
})
|
|
6810
|
+
]
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
//#endregion
|
|
6814
|
+
//#region src/client/sidechat/slash.ts
|
|
6815
|
+
/** /side opens a session-scoped selector for new, open and closed side chats. */
|
|
6816
|
+
function sideMenuItems(ctx, sessionId) {
|
|
6817
|
+
const items = [{
|
|
6818
|
+
kind: "new",
|
|
6819
|
+
id: "new",
|
|
6820
|
+
label: t("cmdNew"),
|
|
6821
|
+
detail: t("cmdNewDetail")
|
|
6822
|
+
}];
|
|
6823
|
+
const openChildren = /* @__PURE__ */ new Set();
|
|
6824
|
+
if (directNativeLeg(ctx)) for (const tab of sideChatTabsOf(ctx, sessionId)) {
|
|
6825
|
+
const meta = tab.meta;
|
|
6826
|
+
const child = meta?.childId ?? sideChatOpening(sessionId, tab.id)?.childId;
|
|
6827
|
+
if (child) openChildren.add(child);
|
|
6828
|
+
items.push({
|
|
6829
|
+
kind: "focus",
|
|
6830
|
+
id: tab.id,
|
|
6831
|
+
label: t("cmdFocus", { title: meta ? sideChatTitleOf(meta) : tab.title }),
|
|
6832
|
+
detail: t("cmdFocusDetail")
|
|
6833
|
+
});
|
|
6834
|
+
}
|
|
6835
|
+
else {
|
|
6836
|
+
const snapshot = betterSidebarOf(ctx)?.getSnapshot();
|
|
6837
|
+
if (snapshot?.sessionId === sessionId && snapshot.state !== void 0) for (const tab of collectSideTabs(snapshot.state)) {
|
|
6838
|
+
const child = parseSideChatMeta(tab.meta).childId;
|
|
6839
|
+
if (child) openChildren.add(child);
|
|
6840
|
+
items.push({
|
|
6841
|
+
kind: "focus",
|
|
6842
|
+
id: tab.id,
|
|
6843
|
+
label: t("cmdFocus", { title: tab.title }),
|
|
6844
|
+
detail: t("cmdFocusDetail")
|
|
6845
|
+
});
|
|
6846
|
+
}
|
|
6847
|
+
}
|
|
6848
|
+
for (const entry of listClosedSideChats(sessionId)) {
|
|
6849
|
+
if (openChildren.has(entry.childId)) continue;
|
|
6850
|
+
const title = entry.topic ?? entry.title;
|
|
6851
|
+
items.push({
|
|
6852
|
+
kind: "reopen",
|
|
6853
|
+
id: entry.childId,
|
|
6854
|
+
title,
|
|
6855
|
+
label: t("cmdReopen", { title }),
|
|
6856
|
+
detail: formatClosedAt(entry.closedAt)
|
|
6857
|
+
});
|
|
6858
|
+
}
|
|
6859
|
+
return items;
|
|
6860
|
+
}
|
|
6861
|
+
function selectSideMenuItem(ctx, sessionId, item) {
|
|
6862
|
+
if (currentSessionIdOf(ctx) !== sessionId) return false;
|
|
6863
|
+
if (item.kind === "new") return createSideChat(ctx, sessionId);
|
|
6864
|
+
if (item.kind === "focus") {
|
|
6865
|
+
if (!sideMenuItems(ctx, sessionId).some((row) => row.kind === "focus" && row.id === item.id)) return false;
|
|
6866
|
+
if (focusNativeTab(ctx, item.id)) return true;
|
|
6867
|
+
const sidebar = betterSidebarOf(ctx);
|
|
6868
|
+
if (!sidebar) return false;
|
|
6869
|
+
sidebar.activateTab(item.id, { sessionId });
|
|
6870
|
+
return true;
|
|
6871
|
+
}
|
|
6872
|
+
const entry = listClosedSideChats(sessionId).find((e) => e.childId === item.id);
|
|
6873
|
+
if (!entry) return false;
|
|
6874
|
+
if (!reopenSideChat(ctx, sessionId, item.id, {
|
|
6875
|
+
topic: entry.topic,
|
|
6876
|
+
savedMeta: entry.savedMeta
|
|
6877
|
+
})) return false;
|
|
6878
|
+
dropClosedSideChat(sessionId, item.id);
|
|
6879
|
+
return true;
|
|
6880
|
+
}
|
|
6881
|
+
function removeSideMenuItem(ctx, sessionId, item) {
|
|
6882
|
+
if (currentSessionIdOf(ctx) !== sessionId || item.kind !== "reopen" || !sideMenuItems(ctx, sessionId).some((row) => row.kind === "reopen" && row.id === item.id)) return false;
|
|
6883
|
+
return dropClosedSideChat(sessionId, item.id);
|
|
6490
6884
|
}
|
|
6491
|
-
/** 注册 /side 与中文别名「/侧边」;不可行时静默降级(不影响 Tab 入口)。 */
|
|
6492
6885
|
function registerSideCommand(ctx) {
|
|
6493
6886
|
let commandUi;
|
|
6494
6887
|
try {
|
|
@@ -6496,12 +6889,52 @@ ${body}
|
|
|
6496
6889
|
} catch {
|
|
6497
6890
|
return;
|
|
6498
6891
|
}
|
|
6499
|
-
if (commandUi
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6892
|
+
if (!commandUi?.register) return;
|
|
6893
|
+
let sequence = 0;
|
|
6894
|
+
let request;
|
|
6895
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6896
|
+
const publish = (next) => {
|
|
6897
|
+
request = next;
|
|
6898
|
+
for (const listener of listeners) listener();
|
|
6899
|
+
};
|
|
6900
|
+
const subscribe = (listener) => {
|
|
6901
|
+
listeners.add(listener);
|
|
6902
|
+
return () => {
|
|
6903
|
+
listeners.delete(listener);
|
|
6904
|
+
};
|
|
6905
|
+
};
|
|
6906
|
+
const snapshot = () => request;
|
|
6907
|
+
function Overlay({ sessionId }) {
|
|
6908
|
+
const opened = (0, react.useSyncExternalStore)(subscribe, snapshot);
|
|
6909
|
+
if (opened?.sessionId !== sessionId) return null;
|
|
6910
|
+
return (0, react.createElement)(SideChatMenu, {
|
|
6911
|
+
key: opened.sequence,
|
|
6912
|
+
readItems: () => sideMenuItems(ctx, sessionId),
|
|
6913
|
+
onSelect: (item) => selectSideMenuItem(ctx, sessionId, item),
|
|
6914
|
+
onRemove: (item) => removeSideMenuItem(ctx, sessionId, item),
|
|
6915
|
+
onClose: () => {
|
|
6916
|
+
if (request === opened) publish(void 0);
|
|
6917
|
+
}
|
|
6918
|
+
});
|
|
6504
6919
|
}
|
|
6920
|
+
ctx.slots.inject("conversation.input.overlay", () => ctx.slots.register({
|
|
6921
|
+
name: "conversation.input.overlay",
|
|
6922
|
+
id: "dsh-sidenote-side-menu",
|
|
6923
|
+
order: 1,
|
|
6924
|
+
inject: (sessionId) => ({ sessionId })
|
|
6925
|
+
}, Overlay));
|
|
6926
|
+
for (const name of ["side", "侧边"]) ctx.effect(() => commandUi.register({
|
|
6927
|
+
name,
|
|
6928
|
+
description: () => t("cmdDesc"),
|
|
6929
|
+
available: (session) => canForkFrom(ctx, session.sessionId),
|
|
6930
|
+
ui: {
|
|
6931
|
+
kind: "action",
|
|
6932
|
+
run: (session) => publish({
|
|
6933
|
+
sessionId: session.sessionId,
|
|
6934
|
+
sequence: ++sequence
|
|
6935
|
+
})
|
|
6936
|
+
}
|
|
6937
|
+
}), `dsh-sidenote: /${name} command`);
|
|
6505
6938
|
}
|
|
6506
6939
|
//#endregion
|
|
6507
6940
|
//#region src/client/sidechat/referenceSource.ts
|
|
@@ -7136,31 +7569,31 @@ ${body}
|
|
|
7136
7569
|
document.head.appendChild(tag);
|
|
7137
7570
|
}
|
|
7138
7571
|
var annotate_module_css_default = {
|
|
7139
|
-
"
|
|
7140
|
-
"
|
|
7141
|
-
"deleteButton": "_SVViG_deleteButton",
|
|
7142
|
-
"editorSpacer": "_SVViG_editorSpacer",
|
|
7143
|
-
"hint": "_SVViG_hint",
|
|
7144
|
-
"badgeSent": "_SVViG_badgeSent",
|
|
7145
|
-
"sentChipRow": "_SVViG_sentChipRow",
|
|
7146
|
-
"confirmButton": "_SVViG_confirmButton",
|
|
7572
|
+
"cancelButton": "_SVViG_cancelButton",
|
|
7573
|
+
"editorNew": "_SVViG_editorNew",
|
|
7147
7574
|
"editorError": "_SVViG_editorError",
|
|
7148
|
-
"
|
|
7575
|
+
"editorTextarea": "_SVViG_editorTextarea",
|
|
7576
|
+
"sentCardQuote": "_SVViG_sentCardQuote",
|
|
7577
|
+
"confirmButton": "_SVViG_confirmButton",
|
|
7149
7578
|
"sentCardTitle": "_SVViG_sentCardTitle",
|
|
7579
|
+
"hint": "_SVViG_hint",
|
|
7580
|
+
"highlight": "_SVViG_highlight",
|
|
7150
7581
|
"dshSidenoteHintIn": "_SVViG_dshSidenoteHintIn",
|
|
7151
|
-
"
|
|
7582
|
+
"sentCardNote": "_SVViG_sentCardNote",
|
|
7583
|
+
"editorInput": "_SVViG_editorInput",
|
|
7152
7584
|
"editorTarget": "_SVViG_editorTarget",
|
|
7153
|
-
"
|
|
7154
|
-
"
|
|
7585
|
+
"editorAskRow": "_SVViG_editorAskRow",
|
|
7586
|
+
"editorFooter": "_SVViG_editorFooter",
|
|
7587
|
+
"editorSpacer": "_SVViG_editorSpacer",
|
|
7588
|
+
"badgeSent": "_SVViG_badgeSent",
|
|
7155
7589
|
"sentChip": "_SVViG_sentChip",
|
|
7156
|
-
"
|
|
7157
|
-
"
|
|
7590
|
+
"deleteButton": "_SVViG_deleteButton",
|
|
7591
|
+
"badge": "_SVViG_badge",
|
|
7592
|
+
"hintClose": "_SVViG_hintClose",
|
|
7593
|
+
"editorEdit": "_SVViG_editorEdit",
|
|
7158
7594
|
"editorAsk": "_SVViG_editorAsk",
|
|
7159
|
-
"
|
|
7160
|
-
"
|
|
7161
|
-
"editorAskRow": "_SVViG_editorAskRow",
|
|
7162
|
-
"cancelButton": "_SVViG_cancelButton",
|
|
7163
|
-
"hintClose": "_SVViG_hintClose"
|
|
7595
|
+
"saveButton": "_SVViG_saveButton",
|
|
7596
|
+
"sentChipRow": "_SVViG_sentChipRow"
|
|
7164
7597
|
};
|
|
7165
7598
|
//#endregion
|
|
7166
7599
|
//#region src/client/annotate/hint.tsx
|
|
@@ -7250,11 +7683,11 @@ ${body}
|
|
|
7250
7683
|
document.head.appendChild(tag);
|
|
7251
7684
|
}
|
|
7252
7685
|
var selection_module_css_default = {
|
|
7253
|
-
"toolbarButton": "oPK1ua_toolbarButton",
|
|
7254
|
-
"selectionNotice": "oPK1ua_selectionNotice",
|
|
7255
|
-
"toolbarBelow": "oPK1ua_toolbarBelow",
|
|
7256
7686
|
"toolbar": "oPK1ua_toolbar",
|
|
7257
|
-
"
|
|
7687
|
+
"toolbarBelow": "oPK1ua_toolbarBelow",
|
|
7688
|
+
"toolbarButton": "oPK1ua_toolbarButton",
|
|
7689
|
+
"toolbarStatus": "oPK1ua_toolbarStatus",
|
|
7690
|
+
"selectionNotice": "oPK1ua_selectionNotice"
|
|
7258
7691
|
};
|
|
7259
7692
|
//#endregion
|
|
7260
7693
|
//#region src/client/annotations/SelectionToolbarFrame.tsx
|
|
@@ -9173,15 +9606,15 @@ ${body}
|
|
|
9173
9606
|
document.head.appendChild(tag);
|
|
9174
9607
|
}
|
|
9175
9608
|
var settings_module_css_default = {
|
|
9176
|
-
"
|
|
9177
|
-
"status": "_2xJwMG_status",
|
|
9178
|
-
"label": "_2xJwMG_label",
|
|
9609
|
+
"error": "_2xJwMG_error",
|
|
9179
9610
|
"description": "_2xJwMG_description",
|
|
9180
9611
|
"hint": "_2xJwMG_hint",
|
|
9181
|
-
"
|
|
9612
|
+
"status": "_2xJwMG_status",
|
|
9613
|
+
"title": "_2xJwMG_title",
|
|
9182
9614
|
"copy": "_2xJwMG_copy",
|
|
9615
|
+
"row": "_2xJwMG_row",
|
|
9183
9616
|
"page": "_2xJwMG_page",
|
|
9184
|
-
"
|
|
9617
|
+
"label": "_2xJwMG_label"
|
|
9185
9618
|
};
|
|
9186
9619
|
//#endregion
|
|
9187
9620
|
//#region src/client/settings.tsx
|