diff --git a/01_content/src/client/index.tsx b/01_content/src/client/index.tsx index 27ff93b..fcf4b05 100644 --- a/01_content/src/client/index.tsx +++ b/01_content/src/client/index.tsx @@ -68,14 +68,14 @@ const OVER_BOTTOM_PX = 24 const OVER_TOP_PX = 24 const OVER_SIDE_PX = 80 -/** 拓扑预设(聊天窗恒贴右,PRD §13.2 硬约束):左右/三栏/上一下二/井字 */ +/** 拓扑预设(聊天窗恒贴右,PRD §13.2 硬约束):左右/三栏/左二右一/井字/左品右聊/左1大下3小 */ const PRESET_DEFS = [ { id: '2h', leftCount: 0, topCount: 0, contentCount: 1, chatFull: false }, { id: '3h', leftCount: 0, topCount: 0, contentCount: 2, chatFull: false }, { id: 'l2', leftCount: 0, topCount: 1, contentCount: 1, chatFull: true }, - { id: 't2', leftCount: 0, topCount: 1, contentCount: 1, chatFull: false }, { id: 'grid', leftCount: 0, topCount: 2, contentCount: 1, chatFull: false }, { id: 't3', leftCount: 0, topCount: 1, contentCount: 2, chatFull: true }, + { id: 'l13', leftCount: 0, topCount: 1, contentCount: 3, chatFull: true, topHeightDefault: 420 }, ] as const /** 侧栏图标备选集(emoji):布局/快捷方式/入驻项目的图标,点击可换(首项 🧱 为布局默认) */ @@ -119,7 +119,7 @@ function buildLayout(presetId: string, name: string): LayoutSpec { main, leftWidth: { default: 260, min: 160, max: 480 }, chatWidth: { default: 360, min: 240, max: 600 }, - topHeight: { default: 200, min: 120, max: 480 }, + topHeight: { default: (def as any).topHeightDefault ?? 200, min: 120, max: 480 }, chatSide: 'right', chatFullHeight: def.chatFull === true, } @@ -136,11 +136,15 @@ function presetThumb(defId: string) { if (defId === '3h') { return {cell(false, 'a')}{cell(false, 'b')}{cell(true, 'c')} } - if (defId === 't2') { + if (defId === 'l13') { + // 左列上 1 大 + 下 3 小;右列对话整列(5 视窗) return ( - - {cell(false, 'a')} - {cell(false, 'b')}{cell(true, 'c')} + + + {cell(false, 'a')} + {cell(false, 'b')}{cell(false, 'c')}{cell(false, 'd')} + + {cell(true, 'e')} ) } diff --git a/02_process/PRD.md b/02_process/PRD.md index aa91750..54fdaea 100644 --- a/02_process/PRD.md +++ b/02_process/PRD.md @@ -335,8 +335,9 @@ type SplitPane = { 视口内钳制;透明遮罩点击关闭),不再使用侧边栏内展开式下拉;面板内容仅「选择布局 + 填名称」 (快捷方式表单暂移除,存量快捷方式条目仍保留展示/删除); - **拓扑预设六个**(2 行 × 3 列缩略图网格,聊天窗蓝色 💬 标注): - 左右两栏 / 三栏横排 / 左二右一 / 上一下二 / 井字四栏 / 左品右聊(2026-08-17 更新: - 第三个预设由「左一右二」改为「左二右一」); + 左右两栏 / 三栏横排 / 左二右一 / 井字四栏 / 左品右聊 / 左1大下3小(2026-08-18 更新: + 删「上一下二」(与左品右聊重叠),末尾新增 5 视窗预设「左1大下3小」——左侧上下结构, + 上 1 通栏大窗(默认高 300)+ 下 3 小窗并排,右侧聊天通高整列); 左二右一 = 左侧上下两个内容窗 + 右侧聊天通高整列(chatFullHeight 几何,聊天可 ⇄ 翻转贴左); 左品右聊 = 左侧品字形(上一个、下两个内容窗)+ 右侧聊天通高整列(chatFullHeight 几何, 聊天可 ⇄ 翻转贴左); diff --git a/02_process/worklogs/2026-08-16_worktable-v2.md b/02_process/worklogs/2026-08-16_worktable-v2.md index bde3c2b..090ddd3 100644 --- a/02_process/worklogs/2026-08-16_worktable-v2.md +++ b/02_process/worklogs/2026-08-16_worktable-v2.md @@ -699,4 +699,20 @@ (建目录→注册分组→按组建会话→验证→归档会话+删分组+清目录,无残留)。 - 备注:加入现有组纯客户端(重启前即可用);新建组依赖 mkdir 路由(重启后可用)。 +## 补记(布局预设重排 + 新增 5 视窗预设) + +- 用户要求:① 删「上一下二」(第二行第一个,与左品右聊重叠);② 其后两个预设左移一位、 + 末尾空出;③ 末尾新增 5 视窗预设——左侧上下结构:上 1 通栏大窗 + 下 3 小窗并排,右侧对话整列; + ④ 已确认「原来的第4个」= 上一下二本身(只删一个)。 +- 实现:PRESET_DEFS 新序 [2h, 3h, l2, grid, t3, l13];l13 = topCount 1 + contentCount 3 + + chatFull true + topHeightDefault 420(上大下小在宽高上都明显,可拖动微调);缩略图新增 l13 + 分支(左列 1+3、右列对话,共 5 格),删除 t2 分支与定义;buildLayout 支持按预设定制 + topHeight 默认值。 +- 验证(preset-l13-probe.cjs):presetCount=6、thumbCells=[2,3,3,4,4,5](t2 已去、l13 末尾 + 5 格);保存布局 savedTop=1/savedMain=3/chatFull=true/topDefault=420;打开后 paneCount=4 + (4 内容窗 + 对话 = 5 视窗)、topW=797 通栏 vs botW=262×3 三小窗、topOnTop=true; + functional-diag 全 20 STEP ERROR_COUNT: 0(STEP9 点第 3 个仍为 l2,断言不变)。 +- 备注:纯客户端改动,F5 即生效;存量已保存布局不受影响(存的是完整 spec,非预设 id)。 + + diff --git a/04_test/preset-l13-probe.cjs b/04_test/preset-l13-probe.cjs new file mode 100644 index 0000000..c4b8732 --- /dev/null +++ b/04_test/preset-l13-probe.cjs @@ -0,0 +1,93 @@ +// preset-l13-probe.cjs — 验证预设重排 + 新 5 视窗预设(缩略图/持久化/几何) +const http = require('http'); +const { spawn } = require('child_process'); +const WebSocket = require('ws'); +const PORT = 9340; +const proc = spawn('C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', [ + '--headless=new', '--disable-gpu', '--no-first-run', '--no-default-browser-check', + '--window-size=1440,900', '--force-device-scale-factor=1', + '--remote-debugging-port=' + PORT, + '--user-data-dir=C:\\Users\\SJL\\AppData\\Local\\Temp\\wt-chrome-l13', + 'about:blank', +], { stdio: 'ignore' }); +const getJSON = (p) => new Promise((res, rej) => { + http.get({ host: '127.0.0.1', port: PORT, path: p }, (r) => { let d=''; r.on('data',c=>d+=c); r.on('end',()=>{try{res(JSON.parse(d))}catch(e){rej(e)}}) }).on('error', rej); +}); +const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); +(async () => { + let list = null; + for (let i = 0; i < 40; i++) { try { list = await getJSON('/json/list'); if (list && list.length) break; } catch {} await sleep(500); } + const target = list.find((t) => t.type === 'page') || list[0]; + const ws = new WebSocket(target.webSocketDebuggerUrl); + let id = 0; const pending = new Map(); + const send = (method, params) => new Promise((res) => { const mid = ++id; pending.set(mid, res); ws.send(JSON.stringify({ id: mid, method, params })); }); + ws.on('message', (raw) => { const m = JSON.parse(String(raw)); if (m.id && pending.has(m.id)) { pending.get(m.id)(m); pending.delete(m.id); } }); + await new Promise((r) => ws.on('open', r)); + await send('Runtime.enable'); + await send('Page.addScriptToEvaluateOnNewDocument', { + source: "try{ if(location.origin==='http://127.0.0.1:3080'){ localStorage.setItem('dsh.worktable.projects.v1', JSON.stringify({order:[],lastUsed:{},hidden:[],nameOverrides:{},shortcuts:[],layouts:[]})); } }catch(e){}", + }); + await send('Page.navigate', { url: 'http://127.0.0.1:3080/' }); + const evaluate = async (expr) => { + const r = await send('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true }); + if (r.result && r.result.exceptionDetails) return { __error: (r.result.exceptionDetails.exception || {}).description || r.result.exceptionDetails.text }; + return r.result && r.result.result ? r.result.result.value : undefined; + }; + let ready = null; + for (let i = 0; i < 30; i++) { await sleep(1000); ready = await evaluate("!!window.__dshWorktable"); if (ready === true) break; } + await sleep(1000); + const step = await evaluate(`(async function(){ + var out = {}; + try { + var vis = function(sel){ return [].slice.call(document.querySelectorAll(sel)).find(function(el){ return (getComputedStyle(el).visibility!=='hidden'&&el.getBoundingClientRect().height>0); }); }; + // 打开添加面板 + var addBtn = document.querySelectorAll('.dsh-wt_actions .dsh-wt_iconBtn')[2]; + if (addBtn) { addBtn.click(); } + await new Promise(function(r){ setTimeout(r, 300); }); + var presets = [].slice.call(document.querySelectorAll('.dsh-wt_presets .dsh-wt_preset')); + out.presetCount = presets.length; + out.thumbCells = presets.map(function(p){ return p.querySelectorAll('.dsh-wt_thumbCell').length; }); + out.chatCells = presets.map(function(p){ return p.querySelectorAll('.dsh-wt_thumbChat').length; }); + // 点第 6 个(新 l13)并保存 + if (presets[5]) { presets[5].click(); } + await new Promise(function(r){ setTimeout(r, 200); }); + var inp = document.querySelector('.dsh-wt_addForm input'); + var setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set; + setter.call(inp, 'L13-probe'); + inp.dispatchEvent(new Event('input', { bubbles: true })); + await new Promise(function(r){ setTimeout(r, 200); }); + var saveBtn = document.querySelector('.dsh-wt_addBtn'); + if (saveBtn) { saveBtn.click(); } + await new Promise(function(r){ setTimeout(r, 400); }); + var saved = null; + try { saved = JSON.parse(localStorage.getItem('dsh.worktable.projects.v1')).layouts[0]; } catch(e) {} + out.savedTop = saved && saved.top ? saved.top.length : null; + out.savedMain = saved && saved.main ? saved.main.length : null; + out.savedChatFull = saved ? saved.chatFullHeight === true : null; + out.savedTopDefault = saved && saved.topHeight ? saved.topHeight.default : null; + // 打开该布局验证几何(失败则等 2s 重试一次) + var st = window.__dshWorktable.splitStore; + if (saved) { out.openResult = st.open(saved); } + await new Promise(function(r){ setTimeout(r, 900); }); + if (!st.active) { out.openResult2 = saved ? st.open(saved) : null; } + await new Promise(function(r){ setTimeout(r, 900); }); + out.active = st.active; + out.specId = st.spec && st.spec.id; + out.geom = st.geom; + var panes = [].slice.call(document.querySelectorAll('.dsh-wt_pane')).filter(function(el){ return (getComputedStyle(el).visibility!=='hidden'&&el.getBoundingClientRect().height>0); }); + out.paneCount = panes.length; + if (panes.length >= 4) { + var r0 = panes[0].getBoundingClientRect(); + var r1 = panes[1].getBoundingClientRect(); + out.topW = Math.round(r0.width); + out.botW0 = Math.round(r1.width); + out.topTaller = r0.height > r1.height; + out.topOnTop = r0.top < r1.top; + } + st.close(); + } catch(e) { out.err = String(e); } + return JSON.stringify(out); + })()`); + console.log('L13PROBE:', JSON.stringify(step)); + ws.close(); proc.kill(); process.exit(0); +})().catch((e) => { console.error('FATAL', e && e.stack || e); try { proc.kill(); } catch {} process.exit(1); });