feat(ui): 停靠态改为左缘细条 + hover 滑出面板 (v0.5.3-local.11)

停靠态原先把整个工作台面板常驻挂在 footer 槽位,占用侧栏纵向空间。
改为 12px 左缘细条 + 悬停滑出 250px 面板:

- 自动隐藏(默认):悬停细条滑出,移开 180ms 自动收回
- 固定常开:面板常显,可点右侧 « 手柄收成细条,之后仅点击展开
- 任一弹窗打开期间保持展开,避免误收回
- measureFloatGeo 新增细条左缘测量:优先 footerActions/footArea 左缘 −8,
  链断裂回退侧栏左缘,避免旧兜底 64 的残带
- footer 槽位只留零尺寸锚点,不再占位
- 浮动态(dock=float)保持原浮动卡片,不渲染细条

新增 04_test/edge-panel.test.mjs 并纳入 pack 兼容回归,覆盖默认自动隐藏、
设置开关持久化、固定常开 + « 收起、浮动态不受影响。

验证:npm run pack 全绿,双资产同源 sha256 faed3889…。
This commit is contained in:
wangheng
2026-12-03 15:56:42 +08:00
parent bdae7f8a06
commit 8255ad604c
11 changed files with 511 additions and 33 deletions
+130 -7
View File
@@ -8430,6 +8430,19 @@ var css = xterm_default + "\n" + [
".dsh-wt_foldBtnGhost{cursor:default;pointer-events:none}",
".dsh-wt_layoutHasKids .dsh-wt_layoutArrow{margin-right:0}",
".dsh-wt_manageRowSub{margin-left:20px}",
// 停靠态:左缘细条 + 滑出面板
".dsh-wt_edgeAnchor{width:0;height:0;overflow:hidden;flex:none}",
".dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:65;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.07));border-right:1px solid transparent;transition:background .15s,border-color .15s}",
".dsh-wt_edgeStrip:hover,.dsh-wt_edgeStripOn{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05));border-right-color:var(--dsw-alias-border-l1,#262b36)}",
".dsh-wt_edgeStripGlyph{font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#6e7683);user-select:none;-webkit-user-select:none}",
".dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:66;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}",
".dsh-wt_edgePanelWrapOn{transform:translateX(0)}",
".dsh-wt_edgePanel{position:absolute;inset:0;box-sizing:border-box;padding:10px 10px 14px;background:var(--dsw-alias-bg-base,#0b0e14);border-right:1px solid var(--dsw-alias-border-l2,#3a4150);overflow-y:auto;overscroll-behavior:contain}",
".dsh-wt_edgeHandle{position:absolute;right:0;top:50%;transform:translateY(-50%);width:17px;height:64px;display:flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-right:none;border-radius:8px 0 0 8px;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.10));color:var(--dsw-alias-state-accent-primary,#4f8ef7);font-size:13px;line-height:1;cursor:pointer;box-shadow:-4px 0 10px rgba(0,0,0,.14)}",
".dsh-wt_edgeHandle:hover{background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff}",
".dsh-wt_edgeSettings{display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);font-size:11.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}",
".dsh-wt_edgeSettingsLabel{user-select:none;-webkit-user-select:none}",
".dsh-wt_edgeSettingsToggle{display:inline-flex;align-items:center;cursor:pointer}",
// DS Bot 侧栏元素隐藏(迁移自「改 ds-bot/client.js 插 return null」的做法)。
// 动机:ds-bot 是随应用升级的 .bundled-plugins tgz 安装,升级/重装必丢改;
// 改为由本插件注入 CSS,只要工作台装着,ds-bot 随便升级都不丢。
@@ -8497,6 +8510,8 @@ var zh = {
"manage.deleteProject": "\u5220\u9664\u9879\u76EE",
"manage.changeView": "\u53D8\u66F4\u89C6\u56FE",
"manage.addPage": "\u65B0\u589E\u4E8C\u7EA7\u9875\u9762",
"edge.autoHide": "\u81EA\u52A8\u9690\u85CF\u4FA7\u8FB9\u680F",
"edge.collapse": "\u6536\u8D77\u4FA7\u8FB9\u680F",
"tree.fold": "\u6298\u53E0\u4E8C\u7EA7\u9875\u9762",
"tree.expand": "\u5C55\u5F00\u4E8C\u7EA7\u9875\u9762",
"viewPick.title": "\u9009\u62E9\u65B0\u89C6\u56FE\uFF08\u5185\u5BB9\u7A97\u81EA\u52A8\u8FC1\u5165\uFF09",
@@ -8735,6 +8750,8 @@ var en = {
"manage.deleteProject": "Delete project",
"manage.changeView": "Change layout",
"manage.addPage": "Add sub page",
"edge.autoHide": "Auto-hide sidebar",
"edge.collapse": "Collapse sidebar",
"tree.fold": "Collapse sub pages",
"tree.expand": "Expand sub pages",
"viewPick.title": "Pick a new layout (panes migrate automatically)",
@@ -9216,7 +9233,7 @@ var CHANGELOG_V030 = `\u66F4\u65B0\u516C\u544A \xB7 v0.5.1
\u30103.1 \u6587\u5B57\u4E0E\u7EC6\u8282\u6253\u78E8\u3011\u5168\u5C40\u5B57\u4F53\u4E0E\u5B57\u53F7\u7EDF\u4E00\u4F18\u5316\u3001\u4E0B\u62C9\u9762\u677F\u73BB\u7483\u5316\u4E0E\u5BF9\u9F50\u3001\u83DC\u5355\u70B9\u9009\u540E\u4FDD\u6301\u6253\u5F00\u4FBF\u4E8E\u8FDE\u7EED\u9884\u89C8\u3001\u6309\u94AE\u63CF\u8FB9\u4E0E\u60AC\u505C\u53CD\u9988\u7B49\u4EA4\u4E92\u7EC6\u8282\uFF1B\u540C\u65F6\u4FEE\u590D\u4E86\u591A\u9879\u4F53\u9A8C\u95EE\u9898\uFF08\u7167\u7247\u4E0A\u4F20\u6E05\u6670\u5EA6\u3001\u80CC\u666F\u7F51\u683C\u7EBF\u5728\u7167\u7247\u6A21\u5F0F\u4E0B\u4E0D\u751F\u6548\u3001\u6D45\u8272\u4E3B\u9898\u4E0B\u5DE5\u4F5C\u72B6\u6001\u5149\u6548\u4E0D\u53EF\u89C1\u7B49\uFF09\u3002`;
// src/client/updateCheck.ts
var LOCAL_VERSION = false ? "dev" : "0.5.3-local.10";
var LOCAL_VERSION = false ? "dev" : "0.5.3-local.11";
var UPDATE_API = "/api/worktable/update-check";
var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1";
var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1";
@@ -21114,6 +21131,7 @@ function normalizeView(raw) {
dock: p.dock === "float" ? "float" : "footer",
floatTop: typeof p.floatTop === "number" ? p.floatTop : null,
foldedProjects: Array.isArray(p.foldedProjects) ? p.foldedProjects.filter((x) => typeof x === "string") : [],
edgeAutoHide: p.edgeAutoHide !== false,
consoleTheme: p.consoleTheme === "dark" || p.consoleTheme === "light" || p.consoleTheme === "system" ? p.consoleTheme : "system",
consoleCols: typeof p.consoleCols === "number" && p.consoleCols >= 1 && p.consoleCols <= 5 ? Math.round(p.consoleCols) : 3,
consoleShape: p.consoleShape === "circle" ? "circle" : "square",
@@ -21943,6 +21961,10 @@ function WorktableSection(props) {
const [bottomInset, setBottomInset] = (0, import_react3.useState)(0);
const bottomInsetRef = (0, import_react3.useRef)(0);
const [floatGeo, setFloatGeo] = (0, import_react3.useState)(null);
const [edgeLeft, setEdgeLeft] = (0, import_react3.useState)(64);
const [edgeOpen, setEdgeOpen] = (0, import_react3.useState)(false);
const [edgeDismissed, setEdgeDismissed] = (0, import_react3.useState)(false);
const edgeCloseTimer = (0, import_react3.useRef)(null);
const [sidebarRight, setSidebarRight] = (0, import_react3.useState)(null);
const [activeSplitId, setActiveSplitId] = (0, import_react3.useState)(
() => splitStore.active && splitStore.spec ? splitStore.spec.id : null
@@ -22340,6 +22362,18 @@ function WorktableSection(props) {
const margin = 20;
const width = rect.width - padLeft - padRight - margin * 2;
setSidebarRight(Math.round(rect.right));
setEdgeLeft((() => {
let el = rootRef.current;
while (el) {
if (typeof el.className === "string" && /footerActions|footArea/i.test(el.className)) {
const r = el.getBoundingClientRect();
if (r.width > 120) return Math.max(0, Math.round(r.left) - 8);
break;
}
el = el.parentElement;
}
return Math.max(0, Math.round(rect.left));
})());
if (width > 0) {
setFloatGeo({ left: Math.round(rect.left + padLeft + margin), width: Math.round(width) });
} else {
@@ -22748,11 +22782,11 @@ function WorktableSection(props) {
if (!mountedRef.current || !raw || widgetReadSeqRef.current[binding.bindingId] !== readSeq) return;
const resolved = widgetRegistry.resolve(binding, raw, current.spec, current.folder);
if (!resolved || !force && mountedWidgetRef.current[binding.bindingId] === raw) return;
const content = buildMountContent(binding.folder, resolved.item);
if (!content) return;
const content2 = buildMountContent(binding.folder, resolved.item);
if (!content2) return;
const open = splitStore.active && splitStore.spec?.id === binding.projectId;
if (open) {
splitStore.lockPane(resolved.target.row, resolved.target.index, content);
splitStore.lockPane(resolved.target.row, resolved.target.index, content2);
recordMountedWidget(binding.bindingId, raw);
delete pendingMountRef.current[binding.bindingId];
persistPendingWidgets();
@@ -23265,6 +23299,24 @@ function WorktableSection(props) {
}
return out;
}, [visibleLayouts, effectiveOrder, view.foldedProjects]);
const cancelEdgeClose = (0, import_react3.useCallback)(() => {
if (edgeCloseTimer.current != null) {
window.clearTimeout(edgeCloseTimer.current);
edgeCloseTimer.current = null;
}
}, []);
const openEdge = (0, import_react3.useCallback)(() => {
cancelEdgeClose();
setEdgeDismissed(false);
setEdgeOpen(true);
}, [cancelEdgeClose]);
const scheduleEdgeClose = (0, import_react3.useCallback)(() => {
cancelEdgeClose();
edgeCloseTimer.current = window.setTimeout(() => setEdgeOpen(false), 180);
}, [cancelEdgeClose]);
(0, import_react3.useEffect)(() => () => cancelEdgeClose(), [cancelEdgeClose]);
const anyPopupOpen = addOpen || viewOptionsOpen || customOpen || requestDelete != null || iconPick != null || bindPick != null || viewPickFor != null || consoleBind != null;
const edgeVisible = view.edgeAutoHide === false ? !edgeDismissed : edgeOpen || anyPopupOpen;
const isFloat = float != null;
const floatStyle = isFloat ? {
position: "fixed",
@@ -23970,8 +24022,7 @@ function WorktableSection(props) {
popupLayer
] });
}
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: "dsh-wt_section" + (isFloat ? " dsh-wt_float" : ""), style: isFloat ? floatStyle : dockedStyle, children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_divider" }),
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_header", children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"button",
@@ -24214,7 +24265,79 @@ function WorktableSection(props) {
]
},
s.id
)) })
)) }),
!isFloat && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_edgeSettings", children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_edgeSettingsLabel", children: t("edge.autoHide") }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"span",
{
className: "dsh-wt_edgeSettingsToggle",
role: "switch",
"aria-checked": view.edgeAutoHide !== false,
"aria-label": t("edge.autoHide"),
tabIndex: 0,
onClick: () => {
setEdgeDismissed(false);
persistView({ edgeAutoHide: view.edgeAutoHide === false });
},
onKeyDown: (e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
setEdgeDismissed(false);
persistView({ edgeAutoHide: view.edgeAutoHide === false });
}
},
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_updateSwitch", "data-off": view.edgeAutoHide === false ? "true" : void 0 })
}
)
] })
] });
if (isFloat) {
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: "dsh-wt_section dsh-wt_float", style: floatStyle, children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_divider" }),
content
] });
}
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: rootRef, className: "dsh-wt_section dsh-wt_edgeAnchor", style: dockedStyle, "aria-hidden": true }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"div",
{
className: "dsh-wt_edgeStrip" + (edgeVisible ? " dsh-wt_edgeStripOn" : ""),
style: { left: edgeLeft },
role: "button",
tabIndex: 0,
"aria-label": t("title"),
title: t("title"),
onMouseEnter: view.edgeAutoHide === false ? void 0 : openEdge,
onMouseLeave: scheduleEdgeClose,
onClick: openEdge,
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_edgeStripGlyph", "aria-hidden": true, children: "\xBB" })
}
),
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
"div",
{
className: "dsh-wt_edgePanelWrap" + (edgeVisible ? " dsh-wt_edgePanelWrapOn" : ""),
style: { left: edgeLeft },
onMouseEnter: cancelEdgeClose,
onMouseLeave: scheduleEdgeClose,
children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_section dsh-wt_edgePanel", children: content }),
view.edgeAutoHide === false && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"button",
{
type: "button",
className: "dsh-wt_edgeHandle",
"aria-label": t("edge.collapse"),
title: t("edge.collapse"),
onClick: () => setEdgeDismissed(true),
children: "\xAB"
}
)
]
}
)
] });
}
var inject = ["slots", "locale", "sessions", "conversation", "workspaces"];
+1 -1
View File
@@ -382,7 +382,7 @@ function resolveDshHomeSafe() {
cachedDshHome = baseDshHome();
return cachedDshHome;
}
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.10";
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.11";
var name = "dsh-worktable";
var inject = ["webServer", "sessions"];
var HEALTH_PATH = "/api/worktable/health";