feat: 项目卡片统一加框+小字精简 + 图标点击可选(18emoji) + 新建布局与travelatlas唯一互斥

This commit is contained in:
Aisland
2026-08-17 21:22:20 +08:00
parent 25c5cb84d0
commit b59194a6a9
6 changed files with 206 additions and 6 deletions
+63 -1
View File
@@ -5,8 +5,9 @@ const WebSocket = require('ws');
const PORT = 9335;
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-func2',
'--user-data-dir=C:\\Users\\SJL\\AppData\\Local\\Temp\\wt-chrome-func3',
'about:blank',
], { stdio: 'ignore' });
@@ -46,6 +47,9 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
await send('Runtime.enable');
await send('Log.enable');
await send('Page.enable');
await send('Page.addScriptToEvaluateOnNewDocument', {
source: "try{ if(location.origin==='http://127.0.0.1:3080'){ localStorage.setItem('dsh.worktable.view.v1', JSON.stringify({query:'',searchOpen:false,orderBy:'manual',dock:'footer',floatTop:null,sortMigratedV2:true})); localStorage.setItem('dsh.worktable.projects.v1', JSON.stringify({order:[],lastUsed:{},hidden:[],nameOverrides:{},shortcuts:[],layouts:[{id:'t-layout',title:'\u6d4b\u8bd5\u5e03\u5c40',top:null,left:null,main:[{id:'p1',title:'\u5185\u5bb91',min:200,content:null}],leftWidth:{default:260,min:160,max:480},chatWidth:{default:360,min:240,max:600},topHeight:{default:200,min:120,max:480},chatSide:'right',chatFullHeight:false}]})); } }catch(e){}",
});
await send('Page.navigate', { url: 'http://127.0.0.1:3080/' });
await sleep(11000);
@@ -55,6 +59,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
return r.result && r.result.result ? r.result.result.value : undefined;
};
// 展开侧栏(宿主默认折叠,宽侧栏下工作台才渲染项目卡片)
const expanded = await evaluate("(function(){ var b=document.querySelector('button[title=\"Open sidebar\"],button[aria-label=\"Open sidebar\"]'); if(b){b.click(); return true} return false })()");
console.log('SIDEBAR_EXPAND:', JSON.stringify(expanded));
await sleep(900);
const step1 = await evaluate("(function(){ var out={}; out.debugExport=!!window.__dshWorktable; var st=window.__dshWorktable&&window.__dshWorktable.splitStore; if(!st) return JSON.stringify(out); out.openResult=st.open({id:'t-diag',title:'diag',top:null,main:[{id:'p1',title:'1',min:200,content:null},{id:'p2',title:'2',min:200,content:null}],chatWidth:{default:320,min:240,max:600}}); out.afterOpen={active:st.active,spec:st.spec&&st.spec.id}; out.paneWs=st.paneWs&&st.paneWs.slice(); out.chatW=st.chatW; out.geom=st.geom; return JSON.stringify(out) })()");
console.log('STEP1:', JSON.stringify(step1));
await sleep(900);
@@ -73,6 +82,59 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const step5 = await evaluate("(function(){ var out={}; out.pane0PickerBack=document.querySelectorAll('.dsh-wt_panePicker').length; var st=window.__dshWorktable.splitStore; st.close(); out.closed=st.active===false; return JSON.stringify(out) })()");
console.log('STEP5:', JSON.stringify(step5));
const step6 = await evaluate(`(async function(){
var out={};
out.cards=document.querySelectorAll('.dsh-wt_layout').length;
var card=document.querySelector('.dsh-wt_layout');
if(card){
var ic=card.querySelector('.dsh-wt_layoutIcon');
out.icon0=ic?ic.textContent:null;
if(ic){ ic.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true})); }
await new Promise(function(r){setTimeout(r,250)});
out.popup=!!document.querySelector('.dsh-wt_iconPop');
out.cells=document.querySelectorAll('.dsh-wt_iconCell').length;
var cells=document.querySelectorAll('.dsh-wt_iconCell');
if(cells[1]){ cells[1].dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true})); }
await new Promise(function(r){setTimeout(r,250)});
out.icon1=card.querySelector('.dsh-wt_layoutIcon').textContent;
try{ out.saved=JSON.parse(localStorage.getItem('dsh.worktable.projects.v1')).layouts[0].icon }catch(e){ out.saved='ERR:'+e.message }
}
var ta=document.querySelector('.dsh-wt_projects .ta_card');
if(ta){ var cs=getComputedStyle(ta); out.taBorder=cs.borderTopColor; var desc=ta.querySelector('.ta_cardDesc'); out.taDescDisplay=desc?getComputedStyle(desc).display:null; }
var pr=document.querySelector('.dsh-wt_projects .pr_card');
if(pr){ var cs2=getComputedStyle(pr); out.prBorder=cs2.borderTopColor; var desc2=pr.querySelector('.pr_cardDesc'); out.prDescDisplay=desc2?getComputedStyle(desc2).display:null; }
return JSON.stringify(out);
})()`);
console.log('STEP6:', JSON.stringify(step6));
// 唯一性互斥:本引擎布局打开时,点开旅行 Atlas(其浮层 .ta_split 出现)→ 本引擎自动关闭
const step7 = await evaluate(`(async function(){
var out={};
var st=window.__dshWorktable.splitStore;
st.open({id:'t-mutex',title:'mutex',top:null,main:[{id:'m1',title:'m',min:200,content:null}],chatWidth:{default:320,min:240,max:600}});
out.engineOpenAfterOpen=st.active;
var ta=document.querySelector('.ta_card');
if(ta){ ta.click(); }
await new Promise(function(r){setTimeout(r,700)});
out.taSplitPresent=!!document.querySelector('.ta_split');
out.engineClosedByTa=st.active===false;
// 合成验证:直接向 body 挂 .ta_split(模拟 travelatlas 浮层出现)→ 观察器应关闭本引擎
if(st.active){
var fake=document.createElement('div');
fake.className='ta_split';
document.body.appendChild(fake);
await new Promise(function(r){setTimeout(r,400)});
out.engineClosedByFakeTa=st.active===false;
fake.remove();
}
if(st.active){ st.close(); }
var taClose=document.querySelector('.ta_splitClose');
if(taClose){ taClose.click(); }
await new Promise(function(r){setTimeout(r,400)});
return JSON.stringify(out);
})()`);
console.log('STEP7:', JSON.stringify(step7));
const errors = events.filter((e) =>
e.method === 'Runtime.exceptionThrown' ||
(e.method === 'Log.entryAdded' && e.params.entry.level === 'error') ||