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:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dsh-worktable",
|
||||
"description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目",
|
||||
"version": "0.5.3-local.10",
|
||||
"version": "0.5.3-local.11",
|
||||
"entry": {
|
||||
"name": "dsh-worktable",
|
||||
"inject": []
|
||||
|
||||
+130
-7
@@ -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"];
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dsh-worktable",
|
||||
"description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)",
|
||||
"version": "0.5.3-local.10",
|
||||
"version": "0.5.3-local.11",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Aisland-SJL/dsh-worktable.git",
|
||||
|
||||
@@ -83,7 +83,7 @@ if (!patchOk) process.exit(1)
|
||||
console.log('[release-prep] identity check passed (' + IDENTITY + ', cordis.patch.yml strict)')
|
||||
|
||||
// ---------- 2. 会话/输入兼容回归 + 构建 + 语法检查 ----------
|
||||
const compatTests = ['host-input.test.mjs', 'session-compat.test.mjs', 'session-details.test.mjs', 'host-transport.test.mjs', 'widget-mount.test.mjs', 'request-auth.test.mjs', 'preview-files.test.mjs', 'sandboxed-frame.test.mjs', 'update-check.test.mjs']
|
||||
const compatTests = ['host-input.test.mjs', 'session-compat.test.mjs', 'session-details.test.mjs', 'host-transport.test.mjs', 'widget-mount.test.mjs', 'request-auth.test.mjs', 'preview-files.test.mjs', 'sandboxed-frame.test.mjs', 'update-check.test.mjs', 'edge-panel.test.mjs']
|
||||
.map((file) => join(HERE, '..', '04_test', file))
|
||||
const compatRun = spawnSync(process.execPath, ['--test', ...compatTests], { cwd: HERE, stdio: 'inherit' })
|
||||
if (compatRun.status !== 0) { console.error('[release-prep] FAIL: session/input compatibility tests'); process.exit(1) }
|
||||
|
||||
@@ -91,6 +91,8 @@ type ViewState = {
|
||||
floatTop: number | null
|
||||
/** 折叠中的项目 id(这些项目不展开显示其二级页面;缺省 = 全部展开)*/
|
||||
foldedProjects?: string[]
|
||||
/** 停靠态边缘面板:自动隐藏(默认 true = 悬停细条滑出、移开收回;false = 常开,手动点 « 收起)*/
|
||||
edgeAutoHide?: boolean
|
||||
/** 控制室面板主题:dark/light/system(system = 跟随宿主 color-scheme,即 DSH 深色/白色/跟随系统设置) */
|
||||
consoleTheme?: 'dark' | 'light' | 'system'
|
||||
/** 控制室每行显示项目数(1-5,默认 3)*/
|
||||
@@ -359,6 +361,7 @@ function normalizeView(raw: any): ViewState {
|
||||
dock: p.dock === 'float' ? 'float' : 'footer',
|
||||
floatTop: typeof p.floatTop === 'number' ? p.floatTop : null,
|
||||
foldedProjects: Array.isArray(p.foldedProjects) ? p.foldedProjects.filter((x: unknown): x is string => 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',
|
||||
@@ -1240,6 +1243,14 @@ function WorktableSection(props: any) {
|
||||
const [bottomInset, setBottomInset] = useState(0)
|
||||
const bottomInsetRef = useRef(0)
|
||||
const [floatGeo, setFloatGeo] = useState<{ left: number; width: number | null } | null>(null)
|
||||
|
||||
// ── 停靠态:左缘细条 + hover 滑出面板 ──
|
||||
// 细条常驻左缘;hover 展开面板,移开延迟 180ms 收回(防抖动);
|
||||
// 任何弹窗打开期间保持展开;「自动隐藏」关掉后常开,可手动点 « 收成细条。
|
||||
const [edgeLeft, setEdgeLeft] = useState(64)
|
||||
const [edgeOpen, setEdgeOpen] = useState(false)
|
||||
const [edgeDismissed, setEdgeDismissed] = useState(false)
|
||||
const edgeCloseTimer = useRef<number | null>(null)
|
||||
const [sidebarRight, setSidebarRight] = useState<number | null>(null)
|
||||
const [activeSplitId, setActiveSplitId] = useState<string | null>(() =>
|
||||
splitStore.active && splitStore.spec ? splitStore.spec.id : null,
|
||||
@@ -1629,6 +1640,21 @@ function WorktableSection(props: any) {
|
||||
const margin = 20
|
||||
const width = rect.width - padLeft - padRight - margin * 2
|
||||
setSidebarRight(Math.round(rect.right))
|
||||
// 细条贴左缘:优先从 footerActions/footArea 容器实测左缘 − 栏内边距 8;
|
||||
// 链断裂时回退实测侧栏左缘(webview 内浅色栏左缘即原生 rail 右缘,xiaoquai 为 0)。
|
||||
// 旧兜底 64 会在隐藏态留出 64px 残带。
|
||||
setEdgeLeft((() => {
|
||||
let el: HTMLElement | null = 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 {
|
||||
@@ -2588,6 +2614,22 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [visibleLayouts, effectiveOrder, view.foldedProjects])
|
||||
|
||||
// ── 边缘面板开关:hover 打开/移开延迟收回;弹窗期间保持展开 ──
|
||||
const cancelEdgeClose = useCallback(() => {
|
||||
if (edgeCloseTimer.current != null) { window.clearTimeout(edgeCloseTimer.current); edgeCloseTimer.current = null }
|
||||
}, [])
|
||||
const openEdge = useCallback(() => { cancelEdgeClose(); setEdgeDismissed(false); setEdgeOpen(true) }, [cancelEdgeClose])
|
||||
const scheduleEdgeClose = useCallback(() => {
|
||||
cancelEdgeClose()
|
||||
edgeCloseTimer.current = window.setTimeout(() => setEdgeOpen(false), 180)
|
||||
}, [cancelEdgeClose])
|
||||
useEffect(() => () => cancelEdgeClose(), [cancelEdgeClose])
|
||||
|
||||
const anyPopupOpen = addOpen || viewOptionsOpen || customOpen || requestDelete != null
|
||||
|| iconPick != null || bindPick != null || viewPickFor != null || consoleBind != null
|
||||
/** 自动隐藏模式看 hover 状态;常开模式看是否被手动收起 */
|
||||
const edgeVisible = view.edgeAutoHide === false ? !edgeDismissed : (edgeOpen || anyPopupOpen)
|
||||
|
||||
const isFloat = float != null
|
||||
const floatStyle = isFloat
|
||||
? {
|
||||
@@ -3201,9 +3243,8 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={rootRef} className={'dsh-wt_section' + (isFloat ? ' dsh-wt_float' : '')} style={isFloat ? floatStyle : dockedStyle}>
|
||||
<div className="dsh-wt_divider" />
|
||||
const content = (
|
||||
<>
|
||||
<div className="dsh-wt_header">
|
||||
<button
|
||||
type="button"
|
||||
@@ -3387,7 +3428,72 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* 侧边栏控制(仅停靠态展示;浮动态无意义) */}
|
||||
{!isFloat && (
|
||||
<div className="dsh-wt_edgeSettings">
|
||||
<span className="dsh-wt_edgeSettingsLabel">{t('edge.autoHide')}</span>
|
||||
<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 }) }
|
||||
}}
|
||||
>
|
||||
<span className="dsh-wt_updateSwitch" data-off={view.edgeAutoHide === false ? 'true' : undefined} />
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
||||
// 浮动态:保留原浮动卡片(含分隔线)
|
||||
if (isFloat) {
|
||||
return (
|
||||
<div ref={rootRef} className="dsh-wt_section dsh-wt_float" style={floatStyle}>
|
||||
<div className="dsh-wt_divider" />
|
||||
{content}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// 停靠态 = 左缘细条 + hover 滑出面板:footer 槽位只留零尺寸锚点(不占位),
|
||||
// 细条贴左缘,面板从该缘滑出盖住浅色栏,移开自动收回。
|
||||
return (
|
||||
<>
|
||||
<div ref={rootRef} className="dsh-wt_section dsh-wt_edgeAnchor" style={dockedStyle} aria-hidden />
|
||||
<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 ? undefined : openEdge}
|
||||
onMouseLeave={scheduleEdgeClose}
|
||||
onClick={openEdge}
|
||||
><span className="dsh-wt_edgeStripGlyph" aria-hidden>»</span></div>
|
||||
<div
|
||||
className={'dsh-wt_edgePanelWrap' + (edgeVisible ? ' dsh-wt_edgePanelWrapOn' : '')}
|
||||
style={{ left: edgeLeft }}
|
||||
onMouseEnter={cancelEdgeClose}
|
||||
onMouseLeave={scheduleEdgeClose}
|
||||
>
|
||||
<div className="dsh-wt_section dsh-wt_edgePanel">{content}</div>
|
||||
{view.edgeAutoHide === false && (
|
||||
<button
|
||||
type="button"
|
||||
className="dsh-wt_edgeHandle"
|
||||
aria-label={t('edge.collapse')}
|
||||
title={t('edge.collapse')}
|
||||
onClick={() => setEdgeDismissed(true)}
|
||||
>«</button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ export const zh = {
|
||||
'manage.deleteProject': '删除项目',
|
||||
'manage.changeView': '变更视图',
|
||||
'manage.addPage': '新增二级页面',
|
||||
'edge.autoHide': '自动隐藏侧边栏',
|
||||
'edge.collapse': '收起侧边栏',
|
||||
'tree.fold': '折叠二级页面',
|
||||
'tree.expand': '展开二级页面',
|
||||
'viewPick.title': '选择新视图(内容窗自动迁入)',
|
||||
@@ -304,6 +306,8 @@ export const 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)',
|
||||
|
||||
@@ -679,6 +679,19 @@ export const css = xtermCss + '\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 随便升级都不丢。
|
||||
|
||||
+45
-12
@@ -4,9 +4,9 @@
|
||||
> 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build`
|
||||
> 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。
|
||||
|
||||
当前版本:**0.5.3-local.10**(2026-12-02)
|
||||
产物:`01_content/dist/v0.5.3-local.10/dsh-worktable.tgz`,486219 字节,
|
||||
sha256 `2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
|
||||
当前版本:**0.5.3-local.11**(2026-12-03)
|
||||
产物:`01_content/dist/v0.5.3-local.11/dsh-worktable.tgz`,487469 字节,
|
||||
sha256 `faed38898653babef117897eb0249f655f00aea433a82f5fe4fb2efb036bffe1`
|
||||
|
||||
---
|
||||
|
||||
@@ -33,7 +33,40 @@ sha256 `2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
|
||||
|
||||
---
|
||||
|
||||
## 二、孤儿路由防护(0.5.3-local.5,2026-12-02)
|
||||
## 二、停靠态边缘面板:左缘细条 + hover 滑出(0.5.3-local.11,2026-12-03)
|
||||
|
||||
**动机**:停靠态原先直接把整个工作台面板挂在 footer 槽位常驻,占用侧栏纵向空间。
|
||||
改为「左缘 12px 细条 + 悬停滑出 250px 面板」,可用时收起、需要时滑出。
|
||||
|
||||
**两种模式**(面板底部「自动隐藏侧边栏」开关,存 `view.edgeAutoHide`):
|
||||
|
||||
| 模式 | 行为 |
|
||||
|---|---|
|
||||
| **自动隐藏**(默认,开关 ON) | 悬停细条 → 面板滑出;移开 180ms → 自动收回 |
|
||||
| **固定常开**(开关 OFF) | 面板常显;点右侧 « 手柄收成细条,之后仅点击细条重新展开(不随 hover) |
|
||||
|
||||
**关键实现**:
|
||||
|
||||
| 位置 | 内容 |
|
||||
|---|---|
|
||||
| `src/client/index.tsx` `ViewState.edgeAutoHide` | 视图状态,normalize 缺省 `true` |
|
||||
| 同文件 `edgeOpen` / `edgeDismissed` / `edgeCloseTimer` | 展开态、手动收起态、180ms 防抖关闭定时器 |
|
||||
| 同文件 `edgeVisible` | 自动隐藏看 `edgeOpen \|\| anyPopupOpen`;常开看 `!edgeDismissed` |
|
||||
| 同文件 `anyPopupOpen` | 任一弹窗(添加/设置/自定义/删除确认/图标/绑定/视图/控制室绑定)打开期间保持展开 |
|
||||
| 同文件 `measureFloatGeo` | 新增 `setEdgeLeft(...)`:优先 footerActions/footArea 容器左缘 −8,链断裂回退侧栏左缘;**避免旧兜底 64 留下的残带** |
|
||||
| 渲染 `dsh-wt_edgeAnchor` | footer 槽位只留零尺寸锚点,不再占位 |
|
||||
| 渲染 `dsh-wt_edgeStrip` / `dsh-wt_edgePanelWrap` | 细条 + 滑出包裹层(`transform: translateX(-100%)` → `0`) |
|
||||
| `src/client/styles.ts` | `.dsh-wt_edgeStrip/.edgePanelWrap/.edgePanel/.edgeHandle/.edgeSettings` |
|
||||
| `src/client/locales.ts` | `edge.autoHide` / `edge.collapse` 中英 |
|
||||
|
||||
**浮动态不受影响**:`dock === 'float'` 仍走原浮动卡片分支,不渲染细条。
|
||||
|
||||
**回归**:`04_test/edge-panel.test.mjs`(已纳入 `npm run pack` 的兼容回归),覆盖
|
||||
默认自动隐藏、设置开关持久化、固定常开 + « 收起、浮动态不受影响 4 组场景。
|
||||
|
||||
---
|
||||
|
||||
## 三、孤儿路由防护(0.5.3-local.5,2026-12-02)
|
||||
|
||||
**现象**:安装/升级其他插件触发 profile 热重载后,侧边栏工作台抽屉整个消失,
|
||||
日志报 `webserver: duplicate exact route "/api/worktable/health"`。
|
||||
@@ -67,7 +100,7 @@ const register = (route: any, publicAsset = false) => {
|
||||
|
||||
---
|
||||
|
||||
## 三、iframe 全屏(0.5.3-local.5,2026-12-02)
|
||||
## 四、iframe 全屏(0.5.3-local.5,2026-12-02)
|
||||
|
||||
**动机**:项目窗格里的看板(HTML 单文件)自带全屏按钮,缺 `allowFullScreen`
|
||||
会被浏览器拒绝。
|
||||
@@ -80,7 +113,7 @@ return <iframe className="dsh-wt_paneFrame" src={fileUrl} title={basenameOf(prop
|
||||
|
||||
---
|
||||
|
||||
## 四、二级页面(父子项目树,0.5.3-local.5,2026-12-02)
|
||||
## 五、二级页面(父子项目树,0.5.3-local.5,2026-12-02)
|
||||
|
||||
**能力**:项目下可挂独立布局页,侧栏按树形展示(仅一级嵌套)。
|
||||
|
||||
@@ -105,7 +138,7 @@ return <iframe className="dsh-wt_paneFrame" src={fileUrl} title={basenameOf(prop
|
||||
|
||||
---
|
||||
|
||||
## 五、DS Bot 侧栏元素隐藏(0.5.3-local.5,2026-12-02)
|
||||
## 六、DS Bot 侧栏元素隐藏(0.5.3-local.5,2026-12-02)
|
||||
|
||||
**背景**:原先通过改 `ds-bot/client.js`(组件开头插 `return null`)实现隐藏。
|
||||
ds-bot 是随应用升级的 `.bundled-plugins` tgz 安装,**升级/重装必丢**。
|
||||
@@ -128,7 +161,7 @@ nav.bt-home-nav{display:none!important} /* 首页/消
|
||||
|
||||
---
|
||||
|
||||
## 六、更新检查改指本仓 Gitea(0.5.3-local.6,2026-12-02)
|
||||
## 七、更新检查改指本仓 Gitea(0.5.3-local.6,2026-12-02)
|
||||
|
||||
**现象**:控制室/设置里点「立即检查」,查不到本仓新发布的版本,还常显示「上次检查未成功」。
|
||||
|
||||
@@ -171,7 +204,7 @@ core 段 0.5.2 < 0.5.3 已能正确判定「有新版」。
|
||||
|
||||
---
|
||||
|
||||
## 七、工具链修复(0.5.3-local.5,2026-12-02)
|
||||
## 八、工具链修复(0.5.3-local.5,2026-12-02)
|
||||
|
||||
三个 Windows 兼容缺陷,不修则 `npm run pack` 门禁过不去:
|
||||
|
||||
@@ -186,7 +219,7 @@ core 段 0.5.2 < 0.5.3 已能正确判定「有新版」。
|
||||
|
||||
---
|
||||
|
||||
## 八、安装 / 重启
|
||||
## 九、安装 / 重启
|
||||
|
||||
- 发布版安装:`dsh plugin --profile web add "<release tgz URL>"`
|
||||
- **桌面端:先完全退出 Slark,再执行命令**,装完手动重开。
|
||||
@@ -196,7 +229,7 @@ core 段 0.5.2 < 0.5.3 已能正确判定「有新版」。
|
||||
|
||||
---
|
||||
|
||||
## 九、回归入口
|
||||
## 十、回归入口
|
||||
|
||||
```bash
|
||||
cd 01_content
|
||||
@@ -215,7 +248,7 @@ sidebar/control-room/update 呈现 → 真实 Chromium 分栏边距(5 场景
|
||||
|
||||
---
|
||||
|
||||
## 十、已知边界
|
||||
## 十一、已知边界
|
||||
|
||||
1. **同 tag 资产不可覆盖**:坏包处理 = 发新版本号 + 旧 Release 正文标注问题。
|
||||
2. 平台边界:Windows 网页端为已测范围;macOS 为核心路径已做跨平台适配、
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
// 边缘面板(左缘细条 + hover 滑出)行为验证:针对实际构建产物。
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { createContext, runInNewContext } from 'node:vm'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
|
||||
const BUNDLE = resolve(process.argv[2] ?? join(dirname(fileURLToPath(import.meta.url)), '..', '01_content', 'lib', 'client.js'))
|
||||
const source = readFileSync(BUNDLE, 'utf8')
|
||||
const assert = (c, m) => { if (!c) throw new Error(m) }
|
||||
|
||||
const Fragment = Symbol('test.fragment')
|
||||
const jsx = (type, props, key) => ({ type, props: props ?? {}, key: key ?? props?.key ?? null })
|
||||
|
||||
function makeHooks() {
|
||||
const slots = []
|
||||
let cursor = 0
|
||||
const useState = (initial) => {
|
||||
const i = cursor++
|
||||
if (!(i in slots)) slots[i] = typeof initial === 'function' ? initial() : initial
|
||||
return [slots[i], (next) => { slots[i] = typeof next === 'function' ? next(slots[i]) : next }]
|
||||
}
|
||||
const useRef = (initial) => {
|
||||
const i = cursor++
|
||||
if (!(i in slots)) slots[i] = { current: initial }
|
||||
return slots[i]
|
||||
}
|
||||
const pass = (a, b) => b ?? undefined
|
||||
const React = {
|
||||
createElement: (type, props, ...children) => ({ type, props: { ...(props ?? {}), children: children.length > 1 ? children : children[0] }, key: props?.key ?? null }),
|
||||
Fragment, useState, useRef,
|
||||
useMemo: (fn) => fn(),
|
||||
useCallback: (fn) => fn,
|
||||
useEffect: () => {},
|
||||
useLayoutEffect: () => {},
|
||||
useContext: () => undefined,
|
||||
useReducer: (r, initial) => [initial, () => {}],
|
||||
memo: (c) => c,
|
||||
forwardRef: (c) => c,
|
||||
createContext: () => ({ Provider: Fragment, Consumer: Fragment }),
|
||||
version: 'test',
|
||||
}
|
||||
return { React, render: (component, props) => { cursor = 0; return component(props) } }
|
||||
}
|
||||
|
||||
function fakeElement(tag = 'div') {
|
||||
const el = {
|
||||
tagName: String(tag).toUpperCase(),
|
||||
className: '', style: {}, children: [], dataset: {},
|
||||
classList: { add() {}, remove() {}, contains: () => false },
|
||||
getBoundingClientRect: () => ({ left: 0, right: 1280, top: 0, bottom: 0, width: 1280, height: 0 }),
|
||||
appendChild(c) { el.children.push(c); return c },
|
||||
removeChild() {}, remove() {},
|
||||
setAttribute() {}, getAttribute: () => null, removeAttribute() {},
|
||||
addEventListener() {}, removeEventListener() {},
|
||||
focus() {}, blur() {}, click() {},
|
||||
querySelector: () => null, querySelectorAll: () => [],
|
||||
parentElement: null, parentNode: null,
|
||||
scrollIntoView() {},
|
||||
getContext: () => ({ globalCompositeOperation: '', createLinearGradient() { return { addColorStop() {} } }, fillRect() {}, getImageData() { return { data: [0, 0, 0, 255] } } }),
|
||||
}
|
||||
return el
|
||||
}
|
||||
|
||||
function loadComponent({ stored = {} } = {}) {
|
||||
const values = new Map([['dsh.worktable.updateCheck.v1', '0']])
|
||||
for (const [key, value] of Object.entries(stored)) values.set(key, String(value))
|
||||
const localStorage = {
|
||||
getItem: (key) => values.has(key) ? values.get(key) : null,
|
||||
setItem: (key, value) => values.set(key, String(value)),
|
||||
removeItem: (key) => values.delete(key),
|
||||
}
|
||||
const body = fakeElement('body')
|
||||
const head = fakeElement('head')
|
||||
const document = {
|
||||
body, head, documentElement: fakeElement('html'),
|
||||
querySelector: () => null, querySelectorAll: () => [],
|
||||
createElement: (tag) => fakeElement(tag),
|
||||
addEventListener() {}, removeEventListener() {},
|
||||
}
|
||||
const window = {
|
||||
innerWidth: 1280, innerHeight: 900, localStorage, document,
|
||||
__ModuleLoader__: { load: (definition) => { window.captured = definition } },
|
||||
addEventListener() {}, removeEventListener() {}, dispatchEvent() {},
|
||||
matchMedia: () => ({ matches: false, addEventListener() {}, removeEventListener() {} }),
|
||||
setTimeout: () => 1, clearTimeout() {}, setInterval: () => 1, clearInterval() {},
|
||||
requestAnimationFrame: () => 1, cancelAnimationFrame() {}, open() {},
|
||||
}
|
||||
const hooks = makeHooks()
|
||||
const jsxRuntime = { Fragment, jsx, jsxs: jsx }
|
||||
const sandbox = {
|
||||
window, document, localStorage, self: window,
|
||||
location: { href: 'http://localhost/', protocol: 'http:' },
|
||||
navigator: { userAgent: 'node edge regression', platform: 'Win32', language: 'en-US' },
|
||||
console, atob, btoa,
|
||||
fetch: async () => ({ ok: false, status: 404, json: async () => ({}) }),
|
||||
setTimeout: window.setTimeout, clearTimeout: window.clearTimeout,
|
||||
setInterval: window.setInterval, clearInterval: window.clearInterval,
|
||||
requestAnimationFrame: window.requestAnimationFrame, cancelAnimationFrame: window.cancelAnimationFrame,
|
||||
MutationObserver: class { observe() {} disconnect() {} },
|
||||
ResizeObserver: class { observe() {} unobserve() {} disconnect() {} },
|
||||
IntersectionObserver: class { observe() {} unobserve() {} disconnect() {} },
|
||||
CustomEvent: class { constructor(type, init) { this.type = type; this.detail = init?.detail } },
|
||||
URL, Blob, AbortController, indexedDB: undefined,
|
||||
}
|
||||
createContext(sandbox)
|
||||
runInNewContext(source, sandbox, { filename: BUNDLE, timeout: 20000 })
|
||||
const requireExternal = (id) => {
|
||||
if (id === 'react') return hooks.React
|
||||
if (id === 'react/jsx-runtime') return jsxRuntime
|
||||
if (id === 'react-dom') return { createPortal: (child) => child }
|
||||
if (id === 'scheduler') return {}
|
||||
throw new Error('unexpected external: ' + id)
|
||||
}
|
||||
const exports = window.captured.factory(requireExternal)
|
||||
assert(typeof exports.WorktableSection === 'function', 'no WorktableSection export')
|
||||
return { component: exports.WorktableSection, hooks, values }
|
||||
}
|
||||
|
||||
function walk(node, pred, out = []) {
|
||||
if (Array.isArray(node)) { for (const c of node) walk(c, pred, out); return out }
|
||||
if (!node || typeof node !== 'object') return out
|
||||
if (typeof node.type !== 'undefined' && pred(node)) out.push(node)
|
||||
walk(node.props?.children, pred, out)
|
||||
return out
|
||||
}
|
||||
const classHas = (node, name) => String(node.props?.className ?? '').split(/\s+/).includes(name)
|
||||
const byClass = (tree, name) => walk(tree, (n) => classHas(n, name))
|
||||
|
||||
function run() {
|
||||
// 1) 默认(edgeAutoHide 未设置 = 自动隐藏):停靠态渲染细条,面板默认收起
|
||||
{
|
||||
const { component, hooks } = loadComponent()
|
||||
const render = () => hooks.render(component, { wide: true, t: (k) => k })
|
||||
let tree = render()
|
||||
assert(byClass(tree, 'dsh-wt_edgeStrip').length === 1, '未渲染左缘细条')
|
||||
assert(byClass(tree, 'dsh-wt_anchor' + 'x').length === 0, 'sanity')
|
||||
assert(byClass(tree, 'dsh-wt_edgeAnchor').length === 1, '未渲染零尺寸锚点')
|
||||
assert(byClass(tree, 'dsh-wt_edgePanelWrap').length === 1, '未渲染面板包裹层')
|
||||
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 0, '自动隐藏模式下默认应是收起')
|
||||
// 细条上有 hover 打开
|
||||
const strip = byClass(tree, 'dsh-wt_edgeStrip')[0]
|
||||
assert(typeof strip.props.onMouseEnter === 'function', '细条缺少 hover 打开')
|
||||
strip.props.onMouseEnter({})
|
||||
tree = render()
|
||||
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 1, 'hover 后应展开')
|
||||
// 移开 → 调度关闭(定时器在夹具里不执行,验证 handler 存在)
|
||||
const wrap = byClass(tree, 'dsh-wt_edgePanelWrap')[0]
|
||||
assert(typeof wrap.props.onMouseLeave === 'function', '面板缺少移开收回')
|
||||
// 自动隐藏模式不显示 « 手柄
|
||||
assert(byClass(tree, 'dsh-wt_edgeHandle').length === 0, '自动隐藏模式不应出现收起手柄')
|
||||
console.log('PASS 1: 默认自动隐藏 — 细条常驻、默认收起、hover 展开、无手柄')
|
||||
}
|
||||
|
||||
// 2) 设置开关存在且可切换
|
||||
{
|
||||
const { component, hooks, values } = loadComponent()
|
||||
const render = () => hooks.render(component, { wide: true, t: (k) => k })
|
||||
let tree = render()
|
||||
assert(byClass(tree, 'dsh-wt_edgeSettings').length === 1, '设置里缺少侧边栏控制项')
|
||||
const toggle = byClass(tree, 'dsh-wt_edgeSettingsToggle')[0]
|
||||
assert(toggle?.props?.role === 'switch', '开关 role 不是 switch')
|
||||
assert(toggle.props['aria-checked'] === true, '默认应为开启')
|
||||
toggle.props.onClick({})
|
||||
tree = render()
|
||||
const raw = values.get('dsh.worktable.view.v1')
|
||||
assert(raw && JSON.parse(raw).edgeAutoHide === false, '切换后未持久化 edgeAutoHide=false')
|
||||
console.log('PASS 2: 设置开关存在、默认开启、点击持久化为 false')
|
||||
}
|
||||
|
||||
// 3) 固定常开(edgeAutoHide=false):面板常显 + 出现 « 手柄;细条无 hover 展开
|
||||
{
|
||||
const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ edgeAutoHide: false }) } })
|
||||
const render = () => hooks.render(component, { wide: true, t: (k) => k })
|
||||
let tree = render()
|
||||
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 1, '固定常开模式下应直接展开')
|
||||
assert(byClass(tree, 'dsh-wt_edgeHandle').length === 1, '固定常开模式应出现 « 手柄')
|
||||
const strip = byClass(tree, 'dsh-wt_edgeStrip')[0]
|
||||
assert(strip.props.onMouseEnter === undefined, '固定常开模式细条不应 hover 展开')
|
||||
// 点 « 收起
|
||||
const handle = byClass(tree, 'dsh-wt_edgeHandle')[0]
|
||||
handle.props.onClick({})
|
||||
tree = render()
|
||||
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 0, '点 « 后应收起')
|
||||
console.log('PASS 3: 固定常开 — 常显、有 « 手柄、细条不 hover、点 « 可收起')
|
||||
}
|
||||
|
||||
// 4) 浮动态不受影响
|
||||
{
|
||||
const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ dock: 'float', floatTop: 100 }) } })
|
||||
const tree = hooks.render(component, { wide: true, t: (k) => k })
|
||||
assert(byClass(tree, 'dsh-wt_float').length >= 1, '浮动态应保留浮动卡片')
|
||||
assert(byClass(tree, 'dsh-wt_edgeStrip').length === 0, '浮动态不应渲染细条')
|
||||
console.log('PASS 4: 浮动态保持原行为,不渲染细条')
|
||||
}
|
||||
|
||||
console.log('\nALL EDGE PANEL CHECKS PASSED')
|
||||
}
|
||||
|
||||
run()
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> ## 📦 本仓库是内部补丁分发仓,不是上游源码仓
|
||||
>
|
||||
> 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.10`)。
|
||||
> 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.11`)。
|
||||
> 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。
|
||||
|
||||
### 要不要装
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
### 安装
|
||||
|
||||
当前版本 **v0.5.3-local.10**:
|
||||
当前版本 **v0.5.3-local.11**:
|
||||
|
||||
```bash
|
||||
dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.10/dsh-worktable.tgz"
|
||||
dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.11/dsh-worktable.tgz"
|
||||
```
|
||||
|
||||
- **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。
|
||||
- `--profile web` 按你自己的 profile 名字改。
|
||||
- 资产 `dsh-worktable.tgz`,486219 字节,sha256:
|
||||
`2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
|
||||
- 资产 `dsh-worktable.tgz`,487469 字节,sha256:
|
||||
`faed38898653babef117897eb0249f655f00aea433a82f5fe4fb2efb036bffe1`
|
||||
(下载后可 `Get-FileHash dsh-worktable.tgz -Algorithm SHA256` 核对)
|
||||
- 声明兼容的 DSH 版本:`0.2.0-rc.2` / `0.2.1-rc.3` / `0.2.1-rc.5` / `0.2.2-alpha.2`。
|
||||
宿主不在这个列表里时,安装会被兼容性检查直接拒绝并回滚。
|
||||
@@ -50,7 +50,7 @@ dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/r
|
||||
|
||||
### 升级与回退
|
||||
|
||||
- 装上 `0.5.3-local.10` 后,插件不会提示升级到 0.5.1。
|
||||
- 装上 `0.5.3-local.11` 后,插件不会提示升级到 0.5.1。
|
||||
- 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。
|
||||
- 回退官方版:
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user