dsh-dock 0.21.0 → 0.21.2
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.md +0 -1
- package/client.js +370 -602
- package/features/animation/view.jsx +81 -4
- package/features/balance/view.js +7 -1
- package/features/tokenlog/view.jsx +8 -1
- package/index.js +0 -3
- package/package.json +2 -2
- package/src/client.jsx +161 -113
- package/features/mobile/host.js +0 -22
- package/features/mobile/view.js +0 -345
|
@@ -1010,6 +1010,79 @@ export function AnimationOverlay(props) {
|
|
|
1010
1010
|
setTimeout(() => { botClickBlockRef.current = false; }, 0);
|
|
1011
1011
|
}
|
|
1012
1012
|
};
|
|
1013
|
+
// ===== 右下角状态徽标自由拖拽:整条可拖动(localStorage 持久化),避免压住任务清单/输入卡 =====
|
|
1014
|
+
// 与桌面伙伴互不干扰(两者在不同 mode 下出现)。双击复位回右下默认位。
|
|
1015
|
+
const [badgePos, setBadgePos] = useState(null); // null = 默认位(右下、输入卡上方)
|
|
1016
|
+
const badgePosRef = useRef(null);
|
|
1017
|
+
const badgeDragRef = useRef(null); // { sx, sy, ox, oy, moved }
|
|
1018
|
+
const badgeClickBlockRef = useRef(false);
|
|
1019
|
+
useEffect(() => {
|
|
1020
|
+
try {
|
|
1021
|
+
if (typeof localStorage === "undefined") return;
|
|
1022
|
+
const raw = localStorage.getItem("dsh-dock/anim/badge-pos/v1");
|
|
1023
|
+
const p2 = raw ? JSON.parse(raw) : null;
|
|
1024
|
+
if (p2 && typeof p2.x === "number" && typeof p2.y === "number" && typeof window !== "undefined") {
|
|
1025
|
+
// 恢复时钳制回视口内(窗口可能变小了)
|
|
1026
|
+
const card = document.querySelector(".dkan-badge");
|
|
1027
|
+
const w = card ? card.offsetWidth : 180, h = card ? card.offsetHeight : 34;
|
|
1028
|
+
const x = Math.min(Math.max(8, p2.x), Math.max(8, window.innerWidth - w - 8));
|
|
1029
|
+
const y = Math.min(Math.max(8, p2.y), Math.max(8, window.innerHeight - h - 8));
|
|
1030
|
+
badgePosRef.current = { x, y };
|
|
1031
|
+
setBadgePos({ x, y });
|
|
1032
|
+
}
|
|
1033
|
+
} catch { /* localStorage 不可用时用默认位 */ }
|
|
1034
|
+
}, []);
|
|
1035
|
+
const onBadgePointerDown = (e) => {
|
|
1036
|
+
if (e.button !== 0) return;
|
|
1037
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
1038
|
+
badgeDragRef.current = { sx: e.clientX, sy: e.clientY, ox: r.left, oy: r.top, moved: false };
|
|
1039
|
+
try { e.currentTarget.setPointerCapture(e.pointerId); } catch { /* 无指针捕获也能拖 */ }
|
|
1040
|
+
};
|
|
1041
|
+
const onBadgePointerMove = (e) => {
|
|
1042
|
+
const d = badgeDragRef.current;
|
|
1043
|
+
if (!d || typeof window === "undefined") return;
|
|
1044
|
+
const dx = e.clientX - d.sx, dy = e.clientY - d.sy;
|
|
1045
|
+
if (!d.moved && Math.hypot(dx, dy) < 4) return; // 小抖动不当作拖动,保证点击可进面板
|
|
1046
|
+
d.moved = true;
|
|
1047
|
+
const el = e.currentTarget;
|
|
1048
|
+
const w = el.offsetWidth || 180, h = el.offsetHeight || 34;
|
|
1049
|
+
const x = Math.min(Math.max(8, d.ox + dx), window.innerWidth - w - 8);
|
|
1050
|
+
const y = Math.min(Math.max(8, d.oy + dy), window.innerHeight - h - 8);
|
|
1051
|
+
badgePosRef.current = { x, y };
|
|
1052
|
+
setBadgePos({ x, y });
|
|
1053
|
+
};
|
|
1054
|
+
const onBadgePointerUp = () => {
|
|
1055
|
+
const d = badgeDragRef.current;
|
|
1056
|
+
badgeDragRef.current = null;
|
|
1057
|
+
if (d && d.moved) {
|
|
1058
|
+
try { if (typeof localStorage !== "undefined") localStorage.setItem("dsh-dock/anim/badge-pos/v1", JSON.stringify(badgePosRef.current)); } catch { /* 持久化失败静默 */ }
|
|
1059
|
+
badgeClickBlockRef.current = true; // 拖动结束的那次 click 不跳面板
|
|
1060
|
+
setTimeout(() => { badgeClickBlockRef.current = false; }, 0);
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
const resetBadgePos = () => {
|
|
1064
|
+
try { if (typeof localStorage !== "undefined") localStorage.removeItem("dsh-dock/anim/badge-pos/v1"); } catch { /* 忽略 */ }
|
|
1065
|
+
badgePosRef.current = null;
|
|
1066
|
+
setBadgePos(null);
|
|
1067
|
+
};
|
|
1068
|
+
// 单击进面板、双击复位:单击延后 240ms 执行,等第二次点击到来就改成复位(否则双击会先开面板)。
|
|
1069
|
+
const badgeClickTimer = useRef(null);
|
|
1070
|
+
const onBadgeClick = () => {
|
|
1071
|
+
if (badgeClickBlockRef.current) return;
|
|
1072
|
+
if (badgeClickTimer.current) {
|
|
1073
|
+
clearTimeout(badgeClickTimer.current);
|
|
1074
|
+
badgeClickTimer.current = null;
|
|
1075
|
+
resetBadgePos();
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
badgeClickTimer.current = setTimeout(() => {
|
|
1079
|
+
badgeClickTimer.current = null;
|
|
1080
|
+
openPanel("animation");
|
|
1081
|
+
}, 240);
|
|
1082
|
+
};
|
|
1083
|
+
const badgeStyle = badgePos
|
|
1084
|
+
? Object.assign({}, speedStyle, { "--dkan-phase": phaseColor(waitingTask ? "code" : phase), left: badgePos.x, top: badgePos.y, right: "auto", bottom: "auto" })
|
|
1085
|
+
: Object.assign({}, speedStyle, { "--dkan-phase": phaseColor(waitingTask ? "code" : phase) });
|
|
1013
1086
|
const onBotResizePointerDown = (e) => {
|
|
1014
1087
|
if (e.button !== 0) return;
|
|
1015
1088
|
e.preventDefault();
|
|
@@ -1102,9 +1175,13 @@ export function AnimationOverlay(props) {
|
|
|
1102
1175
|
{/* 右下角状态徽标:dot 随模式变化(breathe/ring 装饰),颜色随任务阶段、呼吸随吞吐;点击进功能坞动画页 */}
|
|
1103
1176
|
{ambientOn && mode !== "robot" ? (
|
|
1104
1177
|
<button type="button" className={"dkan-badge" + (mode === "breathe" ? " dkan-badge-breathe" : "")}
|
|
1105
|
-
style={
|
|
1106
|
-
title={active.length + " 个任务进行中 · " + (waitingTask ? waitWord : phaseLabel(phase)) + " · 点击查看任务动画页"}
|
|
1107
|
-
|
|
1178
|
+
style={badgeStyle}
|
|
1179
|
+
title={active.length + " 个任务进行中 · " + (waitingTask ? waitWord : phaseLabel(phase)) + " · 点击查看任务动画页 · 可拖动到任意位置,双击复位"}
|
|
1180
|
+
onPointerDown={onBadgePointerDown}
|
|
1181
|
+
onPointerMove={onBadgePointerMove}
|
|
1182
|
+
onPointerUp={onBadgePointerUp}
|
|
1183
|
+
onPointerCancel={onBadgePointerUp}
|
|
1184
|
+
onClick={onBadgeClick}>
|
|
1108
1185
|
<span className="dkan-dotwrap">
|
|
1109
1186
|
<span className="dkan-dot" />
|
|
1110
1187
|
{mode === "breathe" ? <span className="dkan-halo" /> : null}
|
|
@@ -1411,7 +1488,7 @@ const css = [
|
|
|
1411
1488
|
".dkan-fx-confetti i{position:absolute;top:-14px;width:8px;height:13px;border-radius:2px;box-shadow:0 0 4px currentColor;animation:dkan-confetti 2s var(--ds-ease-in-out) forwards;}",
|
|
1412
1489
|
"@keyframes dkan-confetti{0%{opacity:1;transform:translateY(0) rotate(0)}100%{opacity:0;transform:translateY(75vh) translateX(var(--dx)) rotate(var(--r))}}",
|
|
1413
1490
|
// 右下角状态徽标(玻璃拟态,可点击);抬到 dsh 输入卡上方避免重叠错位
|
|
1414
|
-
".dkan-badge{position:fixed;right:20px;bottom:calc(var(--dsh-composer-height,152px) + 20px);z-index:2;display:inline-flex;align-items:center;gap:8px;padding:7px 14px;border-radius:999px;cursor:
|
|
1491
|
+
".dkan-badge{position:fixed;right:20px;bottom:calc(var(--dsh-composer-height,152px) + 20px);z-index:2;display:inline-flex;align-items:center;gap:8px;padding:7px 14px;border-radius:999px;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;border:1px solid var(--dsw-alias-border-l1);background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 78%,transparent);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);box-shadow:0 6px 24px rgb(0 0 0 / .16);color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:12px;line-height:18px;pointer-events:auto;animation:dkan-rise .3s var(--ds-ease-in-out);transition:color .15s var(--ds-ease-in-out);}",
|
|
1415
1492
|
".dkan-badge:hover{color:var(--dsw-alias-label-primary);}",
|
|
1416
1493
|
".dkan-badge .n{color:var(--dsw-alias-label-primary);font-weight:600;}",
|
|
1417
1494
|
"@keyframes dkan-rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}",
|
package/features/balance/view.js
CHANGED
|
@@ -302,9 +302,15 @@ function BalanceChip(props) {
|
|
|
302
302
|
"aria-label": "模型余额",
|
|
303
303
|
onClick: () => openPanel("balance", def ? { provider: def } : null),
|
|
304
304
|
},
|
|
305
|
+
// 窄屏只显示这枚小图标:点它进功能坞看余额详情(title 里是完整数值)
|
|
306
|
+
react.createElement("span", { className: "dockchip-svg", "aria-hidden": "true" },
|
|
307
|
+
react.createElement("svg", { viewBox: "0 0 16 16", width: 13, height: 13, fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
308
|
+
react.createElement("path", { d: "M2.8 6.2h10.4v6.3a1 1 0 0 1-1 1H3.8a1 1 0 0 1-1-1z" }),
|
|
309
|
+
react.createElement("path", { d: "M5.4 6.2V4.6a2.6 2.6 0 0 1 5.2 0v1.6" }))),
|
|
305
310
|
react.createElement("span", { className: "dockchip-dot", style: { background: accent } }),
|
|
306
311
|
mm ? react.createElement("span", { className: "dockchip-pre" }, mm[1]) : null,
|
|
307
|
-
react.createElement("span",
|
|
312
|
+
mm ? react.createElement("span", { className: "dockchip-pre-s" }, "余额 ") : null,
|
|
313
|
+
react.createElement("span", { className: "dockchip-val" }, mm ? mm[2] : text));
|
|
308
314
|
}
|
|
309
315
|
|
|
310
316
|
export const feature = {
|
|
@@ -1432,8 +1432,15 @@ export function TokenLogChip(props) {
|
|
|
1432
1432
|
return (
|
|
1433
1433
|
<button type="button" className={"dockchip" + (snap.err && !t && !gone ? " err" : "")} title={title} aria-label="会话用量"
|
|
1434
1434
|
onClick={() => openPanel("tokenlog", { sessionId: sid, navAt: Date.now() })}>
|
|
1435
|
+
{/* 窄屏只显示这枚小图标:点它进配方看具体数据(title 里是完整数值) */}
|
|
1436
|
+
<span className="dockchip-svg" aria-hidden="true">
|
|
1437
|
+
<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round">
|
|
1438
|
+
<path d="M3.5 12.5V9" /><path d="M8 12.5V4.5" /><path d="M12.5 12.5V7" />
|
|
1439
|
+
</svg>
|
|
1440
|
+
</span>
|
|
1435
1441
|
<span className="dockchip-dot" style={{ background: gone ? "var(--dsw-alias-label-tertiary,#8b95ab)" : "var(--dk-warn)" }} />
|
|
1436
|
-
{labelIcon ? <span className="dockchip-ic">{labelIcon}</span> : null}
|
|
1442
|
+
{labelIcon ? <span className="dockchip-ic">{labelIcon}</span> : null}
|
|
1443
|
+
{hasData ? <span className="dockchip-pre-s">用量 </span> : null}<span className="dockchip-val">{labelMain}</span>{labelExtra ? <span className="dockchip-x">{labelExtra}</span> : null}
|
|
1437
1444
|
</button>
|
|
1438
1445
|
);
|
|
1439
1446
|
}
|
package/index.js
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
// - modelconfig 模型设置:模型目录的输入模态与思考强度(写回官方配置)
|
|
20
20
|
// - providerconfig 模型提供商:Provider 增删改 + API Key + 拉取上游模型列表
|
|
21
21
|
// - mobile-relay 远程访问:账号密码登录的远程入口(网关 + 账号 + 浏览模式目录选择器)
|
|
22
|
-
// - mobile 手机适配:手机/窄屏体验优化(客户端运行时注入,关闭后零残留;宿主半部只留开关占位)
|
|
23
22
|
import { DockConfig, sendJson, readBody, rejectUntrustedRequest, migrateNotifyConfig, migrateModelsFeatureId, migrateImportedFeatures, migrateImportedSections, bindDockConfig, readDockRoot, mutateDockSection } from './src/host-core.js'
|
|
24
23
|
import { injectWelcomeAck } from './src/welcome-ack.js'
|
|
25
24
|
import { feature as fModels } from './features/modelconfig/host.js'
|
|
@@ -32,7 +31,6 @@ import { feature as fNotify } from './features/notify/host.js'
|
|
|
32
31
|
import { feature as fRunState } from './features/runstate/host.js'
|
|
33
32
|
import { feature as fTts } from './features/tts/host.js'
|
|
34
33
|
import { feature as fMobileRelay } from './features/mobile-relay/host.js'
|
|
35
|
-
import { feature as fMobile } from './features/mobile/host.js'
|
|
36
34
|
|
|
37
35
|
export const name = 'dsh-dock'
|
|
38
36
|
|
|
@@ -76,7 +74,6 @@ export function apply(ctx, config) {
|
|
|
76
74
|
fRunState,
|
|
77
75
|
fTts,
|
|
78
76
|
fMobileRelay,
|
|
79
|
-
fMobile,
|
|
80
77
|
]
|
|
81
78
|
|
|
82
79
|
// 绑定 Config 镜像(替代已移除的 settings.get);volatile 字段热更时重绑。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-dock",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "DeepSeek Harness 功能坞插件(dsh-dock):模块化功能中枢——每个功能一个 features/ 模块(可单独提取成包发布,又可经 dockBridge 装回面板)。含用量记录(LLM 调用记账/费用统计,支持各模型自定义单价、多段分时价与周末/节假日谷价)、模型设置、图片理解代理、模型余额、任务动画(19 种运行动画 + 桌面伙伴 3D 场景)、任务通知(完成/异常/需确认通知、提示音、语音播报可选音色、系统通知、钉钉/飞书推送)、运行状态(进行中任务与最近完成一览)、语音朗读(浏览器 TTS 读回复:回合下方喇叭按钮 + 自动朗读);侧栏入口 + 可拖拽弹窗(最大化/最小化/缩放)。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build:client": "node scripts/build-client.mjs",
|
|
45
45
|
"test:client": "node scripts/test-client-views.mjs",
|
|
46
|
-
"test:host": "node scripts/test-task-host.mjs && node scripts/test-tokenlog-host.mjs && node scripts/test-balance-host.mjs && node scripts/test-route-trust-host.mjs && node scripts/test-tts-host.mjs && node scripts/test-legacy-import.mjs && node scripts/test-mobile-relay-host.mjs && node scripts/test-mobile-relay.mjs && node scripts/test-
|
|
46
|
+
"test:host": "node scripts/test-task-host.mjs && node scripts/test-tokenlog-host.mjs && node scripts/test-balance-host.mjs && node scripts/test-route-trust-host.mjs && node scripts/test-tts-host.mjs && node scripts/test-legacy-import.mjs && node scripts/test-mobile-relay-host.mjs && node scripts/test-mobile-relay.mjs && node scripts/test-welcome-ack.mjs",
|
|
47
47
|
"dev:client": "node scripts/watch-client.mjs",
|
|
48
48
|
"dev:link": "node scripts/dev-link-deps.mjs"
|
|
49
49
|
},
|
package/src/client.jsx
CHANGED
|
@@ -30,13 +30,12 @@ import { feature as fRunState } from "../features/runstate/view.jsx";
|
|
|
30
30
|
import { feature as fTts } from "../features/tts/view.jsx";
|
|
31
31
|
import { feature as fGames } from "../features/games/view.jsx";
|
|
32
32
|
import { feature as fMobileRelay } from "../features/mobile-relay/view.jsx";
|
|
33
|
-
import { feature as fMobile } from "../features/mobile/view.js";
|
|
34
33
|
|
|
35
34
|
const name = "dsh-dock";
|
|
36
|
-
const DOCK_VERSION = "0.21.
|
|
35
|
+
const DOCK_VERSION = "0.21.2";
|
|
37
36
|
|
|
38
37
|
// ---- 内置功能注册表:新功能 = features/<id>/ 加模块 + 这里 import 一行 ----
|
|
39
|
-
const BUILTIN_FEATURES = [fTokenlog, fModelconfig, fProviderConfig, fHeartbeat, fTheme, fBalance, fAnimation, fNotify, fRunState, fTts, fGames, fMobileRelay
|
|
38
|
+
const BUILTIN_FEATURES = [fTokenlog, fModelconfig, fProviderConfig, fHeartbeat, fTheme, fBalance, fAnimation, fNotify, fRunState, fTts, fGames, fMobileRelay];
|
|
40
39
|
// 规划占位(路线图):接入后移除并建 features/<id>/ 模块
|
|
41
40
|
const PLANNED_FEATURES = [];
|
|
42
41
|
const PLANNED_NOTES = {};
|
|
@@ -164,8 +163,15 @@ const SHELL_CSS = [
|
|
|
164
163
|
".dockm-name{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;}",
|
|
165
164
|
".dockm-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;}",
|
|
166
165
|
".dockm-view{display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;}",
|
|
167
|
-
".dockm-page{box-sizing:border-box;height:100%;overflow:
|
|
168
|
-
".dockm-page-head{display:flex;align-items:flex-start;gap:10px;
|
|
166
|
+
".dockm-page{box-sizing:border-box;height:100%;display:flex;flex-direction:column;overflow:hidden;padding:16px 20px 0;}",
|
|
167
|
+
".dockm-page-head{flex:none;display:flex;align-items:flex-start;gap:10px;padding-bottom:12px;border-bottom:1px solid var(--dsw-alias-border-l1);}",
|
|
168
|
+
".dockm-page-body{flex:1;min-height:0;display:flex;}",
|
|
169
|
+
".dockm-page-wide-btn{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:12px;cursor:pointer;}",
|
|
170
|
+
".dockm-page-wide-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
171
|
+
/* 面板页的左侧菜单收窄:给右侧列表/表格让出宽度,别留大片空白 */
|
|
172
|
+
".dockm-page .dockm-nav{width:140px;padding:8px 6px;}",
|
|
173
|
+
".dockm-page .dockm-nav-item{padding:7px 8px;font-size:12.5px;gap:6px;}",
|
|
174
|
+
".dockm-page-body>.dockm-body{flex:1;min-height:0;}",
|
|
169
175
|
".dockm-page-icon{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);}",
|
|
170
176
|
".dockm-page-titles{min-width:0;}",
|
|
171
177
|
".dockm-page-title{font-size:17px;font-weight:600;color:var(--dsw-alias-label-primary);line-height:1.3;}",
|
|
@@ -203,9 +209,17 @@ const SHELL_CSS = [
|
|
|
203
209
|
// 禁用桌面拖拽/缩放,所有导航和关闭动作保持至少 44px 的可点击面积。
|
|
204
210
|
"@media (max-width:680px){.dockm-backdrop{align-items:stretch;justify-content:stretch;background:var(--dsw-alias-bg-layer-2);backdrop-filter:none}.dockm-dialog,.dockm-dialog.dockm-max{position:fixed!important;left:0!important;top:0!important;right:auto!important;bottom:auto!important;width:100dvw!important;height:100dvh!important;min-height:100dvh;border:0;border-radius:0;box-shadow:none}.dockm-dialog.dockm-min .dockm-body{display:flex}.dockm-head{min-height:60px;box-sizing:border-box;padding:calc(env(safe-area-inset-top) + 8px) 12px 8px;cursor:default;touch-action:manipulation}.dockm-sub,.dockm-win,.dockm-resize{display:none}.dockm-title{font-size:16px}.dockm-close{width:44px;height:44px;font-size:17px}.dockm-body{flex-direction:column;min-height:0}.dockm-nav{box-sizing:border-box;width:auto;max-width:100%;min-height:56px;flex-direction:row;gap:6px;padding:6px 10px;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none;overscroll-behavior-x:contain}.dockm-nav::-webkit-scrollbar{display:none}.dockm-nav-item{flex:none;min-height:44px;padding:0 12px;font-size:13px;touch-action:manipulation}.dockm-nav-item .dockm-badge{display:none}.dockm-content{padding:16px max(16px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));gap:14px;overscroll-behavior:contain}.dockm-content-head{gap:5px}.dockm-name{font-size:16px}.dockm-desc{font-size:13px;line-height:1.55}.dockm-foot{padding-top:12px;font-size:11px}.dockm-foot-sw{width:100%;margin-left:0;justify-content:space-between}.dock-sw{width:44px;height:26px}.dock-sw::after{top:3px;left:3px;width:18px;height:18px}.dock-sw.on::after{transform:translateX(18px)}.dockh-grid{grid-template-columns:minmax(0,1fr);gap:10px;min-width:0}.dockh-card{padding:12px;box-sizing:border-box;min-width:0}.dockh-desc{font-size:13px}.dockh-go{font-size:12px}}",
|
|
205
211
|
/* 手机端:功能坞弹层挂在 .overlayLayer(z20) 内,会被 z71 的侧栏抽屉盖住(只剩右侧一条)。\n 把 overlayLayer 在窄屏抬到抽屉之上,面板才能全屏覆盖——且不依赖【手机适配】模块是否启用。 */
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
212
|
+
/* 只在「功能坞弹层真的打开」时抬 z 序(:has 精确到 .dockm-dialog),其余时候不碰 DSH 原生浮层 */
|
|
213
|
+
"@media (max-width:767px){body:has(.dockm-dialog) [class*=\"overlayLayer\"]{z-index:100 !important}}",
|
|
214
|
+
/* 手机:功能坞面板页的左侧菜单改成横向可滚动条,占满整行;页头与内边距收紧,「全屏」按钮在手机上无意义(侧栏本就是抽屉)故隐藏 */
|
|
215
|
+
"@media (max-width:767px){.dockm-page{padding:12px 12px 0}.dockm-page-head{gap:8px;padding-bottom:10px}.dockm-page-sub{display:none}.dockm-page-wide-btn{display:none}.dockm-page .dockm-nav{width:auto;max-width:100%;flex-direction:row;gap:6px;padding:8px 0;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none}.dockm-page .dockm-nav::-webkit-scrollbar{display:none}.dockm-page .dockm-nav-item{flex:none;min-height:40px;padding:0 10px;font-size:12.5px}.dockm-page .dockm-page-body{flex-direction:column}.dockm-page .dockm-body{flex-direction:column;min-height:0}.dockm-page .dockm-content{padding:12px 0 16px;gap:12px}}",
|
|
216
|
+
/* 手机自适应(≤767px,始终生效,不依赖任何功能开关):
|
|
217
|
+
· 输入卡贴底(空会话时不再垂直居中留大片空白);
|
|
218
|
+
· 输入卡里的「轮/步/token/缓存」状态条移到输入框上方,压成一行不溢出。 */
|
|
219
|
+
"@media (max-width:767px){[class*=\"scrollBody\"]>[class*=\"composerSeat\"]{margin-top:auto!important;padding-bottom:0!important}[class*=\"composerSeat\"] [class*=\"_dock\"]{order:-1!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;padding:0 2px 6px!important;gap:6px!important;font-size:10px!important;overflow:hidden!important;flex-wrap:nowrap!important;white-space:nowrap!important}[class*=\"composerSeat\"] [class*=\"_dock\"]>*{min-width:0;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[class*=\"composerSeat\"] [class*=\"_dock\"]>*:first-child{flex:0 0 auto}[class*=\"composerSeat\"] [class*=\"_row\"]{gap:4px!important}}",
|
|
220
|
+
/* 手机自适应:设置弹层内容给安全区内边距、会话滚动体留底部安全区、代码块横向滚动、
|
|
221
|
+
行内代码可断行(窄屏不撑破版面)。 */
|
|
222
|
+
"@media (max-width:767px){[role=\"dialog\"][class*=\"panel\"] [class*=\"options\"]{padding-left:max(16px,env(safe-area-inset-left,0px))!important;padding-right:max(16px,env(safe-area-inset-right,0px))!important}[class*=\"scrollBody\"]{padding-bottom:env(safe-area-inset-bottom,0px)!important}pre{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}code{overflow-wrap:anywhere}pre code{overflow-wrap:normal}}",
|
|
209
223
|
"@media (prefers-reduced-motion:reduce){.dockm-backdrop,.dockm-dialog{animation:none}.dockm-nav-item,.dockm-close,.dockm-win,.dock-sw{transition:none}}",
|
|
210
224
|
".dockh-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5;}",
|
|
211
225
|
".dockh-stat{color:var(--dsw-alias-label-tertiary);font-size:12px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
@@ -232,8 +246,15 @@ const SHELL_CSS = [
|
|
|
232
246
|
".dockchip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
233
247
|
".dockchip .dockchip-dot{width:6px;height:6px;border-radius:50%;flex:none;}",
|
|
234
248
|
".dockchip.err{color:var(--dsw-alias-state-error-primary);}",
|
|
235
|
-
/*
|
|
236
|
-
|
|
249
|
+
/* 手机自适应:输入区工具行很窄——chip 字号/内距收紧、隐藏费用后缀与「余额」前缀,
|
|
250
|
+
数值完整显示且工具行保持单行不换行(完整信息仍在 title 悬浮提示里)。 */
|
|
251
|
+
".dockchip-pre-s{display:none;}",
|
|
252
|
+
".dockchip-svg{display:none;align-items:center;justify-content:center;}",
|
|
253
|
+
/* 手机端:输入区工具行太窄,余额/用量只留两枚小图标(点进功能坞看具体数据),
|
|
254
|
+
文本与圆点全部隐藏,图标做成 24×24 的稳定触控块 → 工具行必定单行。 */
|
|
255
|
+
"@media (max-width:767px){.dockchip-row{max-width:min(92px,20cqw);gap:2px}.dockchip-svg{display:inline-flex}.dockchip-val,.dockchip-pre,.dockchip-pre-s,.dockchip-ic,.dockchip-x,.dockchip .dockchip-dot{display:none}.dockchip{width:24px;height:24px;box-sizing:border-box;justify-content:center;padding:0!important;gap:0!important;border-radius:6px}}",
|
|
256
|
+
/* 手机触控基础:去点按蓝块、消双击缩放判定延迟;原生侧栏开关热区扩到 44×44(视觉不变)。 */
|
|
257
|
+
"@media (max-width:767px){:is(button,[role=\"button\"]){-webkit-tap-highlight-color:transparent;touch-action:manipulation}[data-sidebar-opener]{position:relative}[data-sidebar-opener]::after{content:'';position:absolute;left:50%;top:50%;width:44px;height:44px;transform:translate(-50%,-50%)}}",
|
|
237
258
|
].join("\n");
|
|
238
259
|
|
|
239
260
|
let dockCssTag = null;
|
|
@@ -328,31 +349,125 @@ function DockEntry(props) {
|
|
|
328
349
|
}, react.createElement(DockIcon, { size: wide ? 16 : 18 }), wide ? react.createElement("span", { className: "docke2-label" }, "功能坞") : null);
|
|
329
350
|
}
|
|
330
351
|
|
|
331
|
-
// ----
|
|
332
|
-
//
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// 导航总线(open/active/params)驱动:chips 点击 openPanel(...) 即可打开并定位
|
|
352
|
+
// ---- 功能坞工作区:左侧导航(首页总揽 + 各功能模块)+ 右侧内容区 ----
|
|
353
|
+
// 弹层(shell.overlay 的 DockModal)与侧栏面板页(main 的 DockPage)**共用这一套**,
|
|
354
|
+
// 两处界面保持一致:都有自己的左侧菜单,不再把各功能页揉成一整页。
|
|
355
|
+
function DockWorkspace() {
|
|
336
356
|
const [nav, setNav] = react.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
|
|
337
357
|
react.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
|
|
338
|
-
const open = nav.open || typeof document === "undefined";
|
|
339
358
|
const active = nav.active;
|
|
340
|
-
const setActive = navigatePanel;
|
|
341
359
|
const navParams = nav.params;
|
|
360
|
+
const setActive = navigatePanel;
|
|
342
361
|
const [, force] = react.useReducer((n) => n + 1, 0);
|
|
343
362
|
useExternalVersion();
|
|
363
|
+
const contentRef = react.useRef(null);
|
|
364
|
+
// 切换左侧模块时总是从新页面顶部开始,避免把上一页的滚动位置带进小游戏等短页面。
|
|
365
|
+
react.useEffect(() => {
|
|
366
|
+
if (contentRef.current) contentRef.current.scrollTop = 0;
|
|
367
|
+
}, [active]);
|
|
368
|
+
const MODULES = allModules();
|
|
369
|
+
const isHome = active === "home";
|
|
370
|
+
const mod = isHome ? null : (MODULES.find((m) => m.id === active) || MODULES[0]);
|
|
371
|
+
const st = mod ? stateOf(mod.id) : null;
|
|
372
|
+
// 视图统一收到 { ctx, feature, params } props
|
|
373
|
+
//(params 来自导航总线:如 { provider } 高亮余额行、{ sessionId } 按会话筛选用量)
|
|
374
|
+
const View = mod ? mod.View : null;
|
|
375
|
+
// 所有视图都包错误边界(含内置):视图抛错只降级为一行提示,不能把整块面板打没。
|
|
376
|
+
// key 用 mod.id:切换功能时重建边界,避免上一个功能的错误态留在新页面上。
|
|
377
|
+
const viewNode = mod && View
|
|
378
|
+
? react.createElement("div", { className: "dockm-view" },
|
|
379
|
+
react.createElement(FeatureBoundary, { key: mod.id, label: mod.name },
|
|
380
|
+
react.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })))
|
|
381
|
+
: null;
|
|
382
|
+
const enabledCount = MODULES.filter((m) => { const s = stateOf(m.id); return !!(s && s.enabled); }).length;
|
|
383
|
+
return react.createElement("div", { className: "dockm-body" },
|
|
384
|
+
react.createElement("nav", { className: "dockm-nav", "aria-label": "功能模块" },
|
|
385
|
+
react.createElement("button", {
|
|
386
|
+
type: "button",
|
|
387
|
+
key: "home",
|
|
388
|
+
className: "dockm-nav-item" + (isHome ? " on" : ""),
|
|
389
|
+
onClick: () => setActive("home")
|
|
390
|
+
},
|
|
391
|
+
react.createElement("span", { className: "dockm-navhome" }, react.createElement(DockIcon, null)),
|
|
392
|
+
react.createElement("span", null, "首页")),
|
|
393
|
+
MODULES.map((m) =>
|
|
394
|
+
react.createElement("button", {
|
|
395
|
+
type: "button",
|
|
396
|
+
key: m.id,
|
|
397
|
+
className: "dockm-nav-item" + (m.id === active ? " on" : ""),
|
|
398
|
+
onClick: () => setActive(m.id)
|
|
399
|
+
},
|
|
400
|
+
react.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
|
|
401
|
+
react.createElement("span", null, m.name),
|
|
402
|
+
m.planned ? react.createElement("span", { className: "dockm-badge" }, "规划中") : null,
|
|
403
|
+
m.external ? react.createElement("span", { className: "dockm-badge" }, "外部") : null))),
|
|
404
|
+
react.createElement("div", { className: "dockm-content", ref: contentRef },
|
|
405
|
+
react.createElement("div", { className: "dockm-content-head" },
|
|
406
|
+
react.createElement("div", { className: "dockm-name" },
|
|
407
|
+
isHome
|
|
408
|
+
? react.createElement("span", { className: "dockm-navhome" }, react.createElement(DockIcon, null))
|
|
409
|
+
: react.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
|
|
410
|
+
isHome ? "首页" : mod.name,
|
|
411
|
+
!isHome && mod.planned ? react.createElement("span", { className: "dockm-badge" }, "规划中") : null,
|
|
412
|
+
!isHome && mod.external ? react.createElement("span", { className: "dockm-badge" }, "外部包" + (mod.package ? " · " + mod.package : "")) : null),
|
|
413
|
+
react.createElement("div", { className: "dockm-desc" },
|
|
414
|
+
isHome
|
|
415
|
+
? "所有子功能总揽:运行状态、概要与快捷开关,点击卡片进入对应功能页。"
|
|
416
|
+
: mod.description)),
|
|
417
|
+
isHome
|
|
418
|
+
? react.createElement("div", { className: "dockm-view" }, react.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force }))
|
|
419
|
+
: mod.planned
|
|
420
|
+
? react.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "待接入:见 README 路线图")
|
|
421
|
+
: st && st.enabled && viewNode
|
|
422
|
+
? viewNode
|
|
423
|
+
: st && st.error
|
|
424
|
+
? react.createElement("div", { className: "dockm-note dockm-err" }, "功能出错:" + st.error)
|
|
425
|
+
: react.createElement("div", { className: "dockm-note" }, "该功能当前为停用状态(开关已持久化,重启后保持)"),
|
|
426
|
+
react.createElement("div", { className: "dockm-foot" },
|
|
427
|
+
react.createElement("span", null, isHome
|
|
428
|
+
? "功能坞 v" + DOCK_VERSION + " · 共 " + MODULES.length + " 个功能模块," + enabledCount + " 个已启用"
|
|
429
|
+
: "功能坞 v" + DOCK_VERSION + " · 新功能按路线图追加"),
|
|
430
|
+
!isHome && mod && !mod.planned && st
|
|
431
|
+
? react.createElement("span", { className: "dockm-foot-sw" },
|
|
432
|
+
react.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "已启用" : "已停用"),
|
|
433
|
+
react.createElement("button", {
|
|
434
|
+
type: "button",
|
|
435
|
+
className: "dock-sw" + (st.enabled ? " on" : ""),
|
|
436
|
+
role: "switch",
|
|
437
|
+
"aria-checked": !!st.enabled,
|
|
438
|
+
"aria-label": (st.enabled ? "停用" : "启用") + mod.name,
|
|
439
|
+
title: st.enabled ? "停用「" + mod.name + "」" : "启用「" + mod.name + "」",
|
|
440
|
+
onClick: () => { toggleFeature(mod.id); force(); }
|
|
441
|
+
}))
|
|
442
|
+
: null,
|
|
443
|
+
!isHome && mod && typeof mod.Chip === "function"
|
|
444
|
+
? react.createElement("span", { className: "dockm-foot-sw" },
|
|
445
|
+
react.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "会话页小控件"),
|
|
446
|
+
react.createElement("button", {
|
|
447
|
+
type: "button",
|
|
448
|
+
className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
|
|
449
|
+
role: "switch",
|
|
450
|
+
"aria-checked": chipShown(mod.id),
|
|
451
|
+
"aria-label": (chipShown(mod.id) ? "隐藏" : "显示") + mod.name + "的会话页小控件",
|
|
452
|
+
title: "控制会话输入区(模型选择器左侧)是否显示本功能的随身小控件",
|
|
453
|
+
onClick: () => { setChipShown(mod.id, !chipShown(mod.id)); force(); }
|
|
454
|
+
}))
|
|
455
|
+
: null)));
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// ---- 功能坞弹出面板:shell.overlay(仿 dsh 设置:居中模态 = 遮罩 + 对话框) ----
|
|
459
|
+
function DockModal() {
|
|
460
|
+
// 默认关闭;SSR/无浏览器环境下默认展开内容(便于冒烟测试渲染整棵弹层树)
|
|
461
|
+
const [nav, setNav] = react.useState({ open: panelNav.open });
|
|
462
|
+
react.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open })), []);
|
|
463
|
+
const open = nav.open || typeof document === "undefined";
|
|
344
464
|
// ---- 窗口几何:普通(默认居中大窗)/最大化/最小化;拖动标题栏移动、右下角缩放 ----
|
|
345
465
|
// lastGeom 记住本页生命周期内最后一次几何,重开弹层时还原
|
|
346
466
|
const [win, setWin] = react.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
|
|
347
467
|
const dlgRef = react.useRef(null);
|
|
348
|
-
const contentRef = react.useRef(null);
|
|
349
468
|
react.useEffect(() => {
|
|
350
469
|
if (lastGeom.w) setWin({ mode: "normal", x: lastGeom.x, y: lastGeom.y, w: lastGeom.w, h: lastGeom.h });
|
|
351
470
|
}, []);
|
|
352
|
-
// 切换左侧模块时总是从新页面顶部开始,避免把上一页的滚动位置带进小游戏等短页面。
|
|
353
|
-
react.useEffect(() => {
|
|
354
|
-
if (open && contentRef.current) contentRef.current.scrollTop = 0;
|
|
355
|
-
}, [active, open]);
|
|
356
471
|
function beginDrag(e, type) {
|
|
357
472
|
if (win.mode !== "normal" || e.button !== 0) return;
|
|
358
473
|
if (type === "move" && e.target && e.target.closest && e.target.closest("button,select,input")) return;
|
|
@@ -380,21 +495,6 @@ function DockModal() {
|
|
|
380
495
|
window.addEventListener("pointerup", onUp);
|
|
381
496
|
}
|
|
382
497
|
if (!open) return null;
|
|
383
|
-
const MODULES = allModules();
|
|
384
|
-
const isHome = active === "home";
|
|
385
|
-
const mod = isHome ? null : (MODULES.find((m) => m.id === active) || MODULES[0]);
|
|
386
|
-
const st = mod ? stateOf(mod.id) : null;
|
|
387
|
-
// 视图统一收到 { ctx, feature, params } props
|
|
388
|
-
//(params 来自导航总线:如 { provider } 高亮余额行、{ sessionId } 按会话筛选用量)
|
|
389
|
-
const View = mod ? mod.View : null;
|
|
390
|
-
// 所有视图都包错误边界(含内置):视图抛错只降级为一行提示,不能把整块面板打没。
|
|
391
|
-
// key 用 mod.id:切换功能时重建边界,避免上一个功能的错误态留在新页面上。
|
|
392
|
-
const viewNode = mod && View
|
|
393
|
-
? react.createElement("div", { className: "dockm-view" },
|
|
394
|
-
react.createElement(FeatureBoundary, { key: mod.id, label: mod.name },
|
|
395
|
-
react.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })))
|
|
396
|
-
: null;
|
|
397
|
-
const enabledCount = MODULES.filter((m) => { const s = stateOf(m.id); return !!(s && s.enabled); }).length;
|
|
398
498
|
// 最大化:铺满视口(留 10px 边);被拖过/缩放过:固定坐标;否则 CSS 默认居中
|
|
399
499
|
const dialogStyle = win.mode === "max"
|
|
400
500
|
? { position: "fixed", left: 10, top: 10, right: 10, bottom: 10, width: "auto", height: "auto" }
|
|
@@ -436,79 +536,7 @@ function DockModal() {
|
|
|
436
536
|
onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
|
|
437
537
|
}, win.mode === "max" ? "❐" : "▢"),
|
|
438
538
|
react.createElement("button", { type: "button", className: "dockm-close", "aria-label": "关闭", title: "关闭", onClick: () => setPanelOpen(false) }, "✕"))),
|
|
439
|
-
react.createElement(
|
|
440
|
-
react.createElement("nav", { className: "dockm-nav", "aria-label": "功能模块" },
|
|
441
|
-
react.createElement("button", {
|
|
442
|
-
type: "button",
|
|
443
|
-
key: "home",
|
|
444
|
-
className: "dockm-nav-item" + (isHome ? " on" : ""),
|
|
445
|
-
onClick: () => setActive("home")
|
|
446
|
-
},
|
|
447
|
-
react.createElement("span", { className: "dockm-navhome" }, react.createElement(DockIcon, null)),
|
|
448
|
-
react.createElement("span", null, "首页")),
|
|
449
|
-
MODULES.map((m) =>
|
|
450
|
-
react.createElement("button", {
|
|
451
|
-
type: "button",
|
|
452
|
-
key: m.id,
|
|
453
|
-
className: "dockm-nav-item" + (m.id === active ? " on" : ""),
|
|
454
|
-
onClick: () => setActive(m.id)
|
|
455
|
-
},
|
|
456
|
-
react.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
|
|
457
|
-
react.createElement("span", null, m.name),
|
|
458
|
-
m.planned ? react.createElement("span", { className: "dockm-badge" }, "规划中") : null,
|
|
459
|
-
m.external ? react.createElement("span", { className: "dockm-badge" }, "外部") : null))),
|
|
460
|
-
react.createElement("div", { className: "dockm-content", ref: contentRef },
|
|
461
|
-
react.createElement("div", { className: "dockm-content-head" },
|
|
462
|
-
react.createElement("div", { className: "dockm-name" },
|
|
463
|
-
isHome
|
|
464
|
-
? react.createElement("span", { className: "dockm-navhome" }, react.createElement(DockIcon, null))
|
|
465
|
-
: react.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
|
|
466
|
-
isHome ? "首页" : mod.name,
|
|
467
|
-
!isHome && mod.planned ? react.createElement("span", { className: "dockm-badge" }, "规划中") : null,
|
|
468
|
-
!isHome && mod.external ? react.createElement("span", { className: "dockm-badge" }, "外部包" + (mod.package ? " · " + mod.package : "")) : null),
|
|
469
|
-
react.createElement("div", { className: "dockm-desc" },
|
|
470
|
-
isHome
|
|
471
|
-
? "所有子功能总揽:运行状态、概要与快捷开关,点击卡片进入对应功能页。"
|
|
472
|
-
: mod.description)),
|
|
473
|
-
isHome
|
|
474
|
-
? react.createElement("div", { className: "dockm-view" }, react.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force }))
|
|
475
|
-
: mod.planned
|
|
476
|
-
? react.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "待接入:见 README 路线图")
|
|
477
|
-
: st && st.enabled && viewNode
|
|
478
|
-
? viewNode
|
|
479
|
-
: st && st.error
|
|
480
|
-
? react.createElement("div", { className: "dockm-note dockm-err" }, "功能出错:" + st.error)
|
|
481
|
-
: react.createElement("div", { className: "dockm-note" }, "该功能当前为停用状态(开关已持久化,重启后保持)"),
|
|
482
|
-
react.createElement("div", { className: "dockm-foot" },
|
|
483
|
-
react.createElement("span", null, isHome
|
|
484
|
-
? "功能坞 v" + DOCK_VERSION + " · 共 " + MODULES.length + " 个功能模块," + enabledCount + " 个已启用"
|
|
485
|
-
: "功能坞 v" + DOCK_VERSION + " · 新功能按路线图追加"),
|
|
486
|
-
!isHome && mod && !mod.planned && st
|
|
487
|
-
? react.createElement("span", { className: "dockm-foot-sw" },
|
|
488
|
-
react.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "已启用" : "已停用"),
|
|
489
|
-
react.createElement("button", {
|
|
490
|
-
type: "button",
|
|
491
|
-
className: "dock-sw" + (st.enabled ? " on" : ""),
|
|
492
|
-
role: "switch",
|
|
493
|
-
"aria-checked": !!st.enabled,
|
|
494
|
-
"aria-label": (st.enabled ? "停用" : "启用") + mod.name,
|
|
495
|
-
title: st.enabled ? "停用「" + mod.name + "」" : "启用「" + mod.name + "」",
|
|
496
|
-
onClick: () => { toggleFeature(mod.id); force(); }
|
|
497
|
-
}))
|
|
498
|
-
: null,
|
|
499
|
-
!isHome && mod && typeof mod.Chip === "function"
|
|
500
|
-
? react.createElement("span", { className: "dockm-foot-sw" },
|
|
501
|
-
react.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "会话页小控件"),
|
|
502
|
-
react.createElement("button", {
|
|
503
|
-
type: "button",
|
|
504
|
-
className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
|
|
505
|
-
role: "switch",
|
|
506
|
-
"aria-checked": chipShown(mod.id),
|
|
507
|
-
"aria-label": (chipShown(mod.id) ? "隐藏" : "显示") + mod.name + "的会话页小控件",
|
|
508
|
-
title: "控制会话输入区(模型选择器左侧)是否显示本功能的随身小控件",
|
|
509
|
-
onClick: () => { setChipShown(mod.id, !chipShown(mod.id)); force(); }
|
|
510
|
-
}))
|
|
511
|
-
: null))),
|
|
539
|
+
react.createElement(DockWorkspace, null),
|
|
512
540
|
win.mode === "normal"
|
|
513
541
|
? react.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") })
|
|
514
542
|
: null));
|
|
@@ -633,13 +661,33 @@ function DockPanel(props) {
|
|
|
633
661
|
// 作为侧栏面板入口注册后,DSH 自带的入口自定义(Pin/更多)即可让用户把它固定在侧栏顶部
|
|
634
662
|
// (“放到上面”),或取消固定收进侧栏「更多」菜单(“放到更多里”)。
|
|
635
663
|
function DockPage() {
|
|
636
|
-
|
|
664
|
+
const ctx = ctxRef.current;
|
|
665
|
+
// 「全屏」= 收起 DSH 左侧栏,把整幅宽度让给功能坞内容(列表页列多时太窄)。
|
|
666
|
+
// 用官方 layout.toggleSidebar(),再点一次即还原,不直接改 DOM。
|
|
667
|
+
const [wide, setWide] = react.useState(false);
|
|
668
|
+
const toggleWide = () => {
|
|
669
|
+
try {
|
|
670
|
+
const layout = ctx && typeof ctx.get === "function" ? ctx.get("layout") : null;
|
|
671
|
+
if (layout && typeof layout.toggleSidebar === "function") {
|
|
672
|
+
layout.toggleSidebar();
|
|
673
|
+
setWide((v) => !v);
|
|
674
|
+
}
|
|
675
|
+
} catch (e) { /* layout 服务不可用时保持原样 */ }
|
|
676
|
+
};
|
|
677
|
+
return react.createElement("div", { className: "dockm-page" + (wide ? " dockm-page-wide" : "") },
|
|
637
678
|
react.createElement("div", { className: "dockm-page-head" },
|
|
638
679
|
react.createElement("span", { className: "dockm-page-icon" }, react.createElement(DockIcon, { size: 20 })),
|
|
639
680
|
react.createElement("div", { className: "dockm-page-titles" },
|
|
640
681
|
react.createElement("div", { className: "dockm-page-title" }, "功能坞"),
|
|
641
|
-
react.createElement("div", { className: "dockm-page-sub" }, "所有小功能集中在这里管理。侧栏图标可在「更多」菜单里 Pin 到顶部,或取消固定收进更多。"))
|
|
642
|
-
|
|
682
|
+
react.createElement("div", { className: "dockm-page-sub" }, "所有小功能集中在这里管理。侧栏图标可在「更多」菜单里 Pin 到顶部,或取消固定收进更多。")),
|
|
683
|
+
react.createElement("button", {
|
|
684
|
+
type: "button",
|
|
685
|
+
className: "dockm-page-wide-btn",
|
|
686
|
+
title: wide ? "还原侧栏宽度" : "收起左侧栏,全屏显示功能坞",
|
|
687
|
+
"aria-label": wide ? "还原宽度" : "全屏",
|
|
688
|
+
onClick: toggleWide
|
|
689
|
+
}, wide ? "❐ 还原" : "▢ 全屏")),
|
|
690
|
+
react.createElement("div", { className: "dockm-page-body" }, react.createElement(DockWorkspace, null)));
|
|
643
691
|
}
|
|
644
692
|
|
|
645
693
|
// ---- 会话输入区工具行 chips:已启用功能的随身小控件(模型选择器左侧) ----
|
package/features/mobile/host.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// dsh-dock · 功能模块【手机适配】· 宿主半部(开关占位)
|
|
2
|
-
//
|
|
3
|
-
// 手机适配的实现全部在客户端半部(features/mobile/view.js):样式与行为在 Overlay
|
|
4
|
-
// 挂载时注入、卸载时移除,所以这个宿主半部**什么都不注入**,只保留一个 feature 描述符,
|
|
5
|
-
// 让功能开关能照常持久化(settings 的 features 表按 id 记开关,路由 /dsh-dock/features
|
|
6
|
-
// 用 FEATURES 列表校验 id 是否存在)。
|
|
7
|
-
//
|
|
8
|
-
// 为什么不再经 webServer.tapIndex 内联注入 index.html:
|
|
9
|
-
// · 旧版这样做必须重启 dsh web 才能彻底摘除注入的 <style>/<script>;用户要求
|
|
10
|
-
// 「关闭就要关闭得彻底、不能干扰原来的」。改成客户端运行时注入 + 卸载清理后,
|
|
11
|
-
// 关闭开关的瞬间样式、body 属性、遮罩/按钮、监听器、观察器、定时器全部消失,
|
|
12
|
-
// index.html 里一个标记都不残留,也不动 <meta viewport>。
|
|
13
|
-
export const feature = {
|
|
14
|
-
id: 'mobile',
|
|
15
|
-
name: '手机适配',
|
|
16
|
-
description: '手机/窄屏体验优化(客户端运行时注入,关闭后零残留):16px 输入防缩放、触控热区、代码块滚动、会话 chip 收起、设置弹层单列与旧版抽屉兜底',
|
|
17
|
-
defaultEnabled: false,
|
|
18
|
-
setup() {
|
|
19
|
-
// 无宿主副作用;返回空清理函数以匹配生命周期约定。
|
|
20
|
-
return () => {}
|
|
21
|
-
},
|
|
22
|
-
}
|