diff --git a/preview/check-v030.mjs b/preview/check-v030.mjs new file mode 100644 index 0000000..013f153 --- /dev/null +++ b/preview/check-v030.mjs @@ -0,0 +1,40 @@ +import { spawn } from 'node:child_process' +import { mkdtemp, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join, dirname } from 'node:path' +import { fileURLToPath } from 'node:url' +const url = process.argv[2] +const EDGE = 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe' +const dir = dirname(fileURLToPath(import.meta.url)) +const profile = await mkdtemp(join(tmpdir(), 'ss-v030-')) +const out = {} +const sleep = ms => new Promise(r => setTimeout(r, ms)) +let browser, ws +try { + browser = spawn(EDGE, ['--headless=new','--disable-gpu','--no-first-run','--no-default-browser-check','--remote-debugging-port=0','--user-data-dir=' + profile, 'about:blank'], { stdio: ['ignore','ignore','pipe'] }) + const endpoint = await new Promise((resolve, reject) => { let log=''; const t=setTimeout(()=>reject(Error('timeout')),20000); browser.stderr.on('data', b=>{ log+=b; const m=log.match(/DevTools listening on (.+)/); if(m){clearTimeout(t);resolve(m[1].trim())} }); browser.on('error',reject) }) + ws = new WebSocket(endpoint); await new Promise((r,j)=>{ws.onopen=r;ws.onerror=j}) + let n=0; const pend=new Map() + ws.onmessage = e => { const m=JSON.parse(e.data); if(m.id){const p=pend.get(m.id);pend.delete(m.id);m.error?p.reject(Error(JSON.stringify(m.error))):p.resolve(m.result)} } + const cdp=(method,params={},sid)=>new Promise((res,rej)=>{const id=++n;pend.set(id,{resolve:res,reject:rej});ws.send(JSON.stringify({id,method,params,...(sid?{sessionId:sid}:{})}))}) + const { targetId } = await cdp('Target.createTarget', { url: 'about:blank' }) + const { sessionId } = await cdp('Target.attachToTarget', { targetId, flatten: true }) + const call=(m,p={})=>cdp(m,p,sessionId) + await call('Page.enable'); await call('Runtime.enable') + const ev = async x => { const r=await call('Runtime.evaluate',{expression:x,returnByValue:true,awaitPromise:true}); if(r.exceptionDetails) throw Error(r.exceptionDetails.exception?.description||r.exceptionDetails.text); return r.result.value } + const waitFor = async (x,t=45000)=>{ const end=Date.now()+t; while(Date.now() { const r=await call('Page.captureScreenshot',{format:'png',captureBeyondViewport:false}); await writeFile(join(dir,name),Buffer.from(r.data,'base64')) } + const setPane = async (w) => ev("(() => { const root=document.querySelector('.ssw-root'); let el=root; let cell=null; for(let i=0;i<8&⪙i++){ if(/tabCell|tabHost_123xe_164|pane_123xe_211/.test((el.className||'').toString())) cell=el; el=el.parentElement } const t=cell||root.parentElement; t.style.flex='0 0 "+w+"px'; t.style.width='"+w+"px'; return true })()") + await call('Emulation.setDeviceMetricsOverride',{width:1440,height:900,deviceScaleFactor:1,mobile:false}) + await call('Page.navigate',{url}) + await waitFor("document.readyState === 'complete'",30000) + try { await ev("(() => { const b=[...document.querySelectorAll('button')].find(x=>(x.innerText||'').trim()==='继续'); if(b)b.click(); return !!b })()") } catch {} + await waitFor("!!document.querySelector('.ssw-nav-hit')",60000) + await ev("document.querySelector('.ssw-nav-hit').click(); true") + await waitFor("!!document.querySelector('.ssw-root')",20000) + await sleep(2200) + const measure = async () => ev("(() => { const tabs=getComputedStyle(document.querySelector('.ssw-tabs')); const tree=document.querySelector('.ssw-tree'); const cur=document.querySelector('.ssw-current'); return { tabsRadius: tabs.borderRadius, tabsBg: tabs.backgroundColor, treeW: Math.round(tree.getBoundingClientRect().width), currentW: Math.round(cur.getBoundingClientRect().width), hasCourt: !!document.querySelector('.ssw-court'), hasIcon: !!document.querySelector('.ssw-seat svg'), leadW: Math.round(document.querySelector('.ssw-lead .ssw-seat').getBoundingClientRect().width), sixCols: getComputedStyle(document.querySelector('.ssw-six')).gridTemplateColumns } })()") + await setPane(720); await sleep(700); out.w720 = await measure(); await shot('v030-wide.png') + await setPane(360); await sleep(700); out.w360 = await measure(); await shot('v030-narrow.png') +} catch(e) { out.fatal = String(e?.stack ?? e) } finally { try{ws?.close()}catch{}; try{browser?.kill()}catch{} } +console.log(JSON.stringify(out, null, 2)) \ No newline at end of file diff --git a/preview/v030-narrow.png b/preview/v030-narrow.png new file mode 100644 index 0000000..0cbc8f7 Binary files /dev/null and b/preview/v030-narrow.png differ diff --git a/preview/v030-wide.png b/preview/v030-wide.png new file mode 100644 index 0000000..04ca0f6 Binary files /dev/null and b/preview/v030-wide.png differ diff --git a/sansheng/client.js b/sansheng/client.js index 3450020..5665aff 100644 --- a/sansheng/client.js +++ b/sansheng/client.js @@ -475,48 +475,6 @@ body[data-ds-dark-theme] .ssw-float,html[data-theme=dark] .ssw-float{background: .ssw-badge[data-status=failed]{background:rgba(220,38,38,.12);color:var(--ssw-danger)} .ssw-form{margin-bottom:12px;padding:10px;border:1px solid var(--ssw-line);border-radius:9px;background:var(--ssw-side)} .ssw-empty-line{margin:10px 0;font-size:12px;color:var(--ssw-faint)} -/* 朝堂工作台外观(按 4 审 + 最新外观方案):浅底、白卡、细边、蓝色只给当前角色与主按钮 */ -.ssw-root{container-type:inline-size} -.ssw-tabs{display:flex;gap:22px;margin:14px 16px 0;padding:0;border:0;border-bottom:1px solid var(--ssw-line);border-radius:0;background:transparent} -.ssw-tab{flex:0 0 auto;display:flex;align-items:center;gap:6px;padding:8px 0 10px;border-radius:0;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--ssw-muted);font-size:13px} -.ssw-tab.is-active{color:var(--ssw-blue);font-weight:600;border-bottom-color:var(--ssw-blue);background:transparent;box-shadow:none} -.ssw-tab-count{font-size:11px;color:var(--ssw-faint);font-weight:400} -.ssw-court{max-width:1040px;margin:0 auto;padding:16px 16px 8px;display:grid;grid-template-columns:1fr;gap:16px;align-items:start} -@container (min-width:440px){.ssw-court{grid-template-columns:260px minmax(0,1fr)}} -.ssw-org{container-type:inline-size} -@container (max-width:340px){.ssw-org .ssw-role-duty{display:none}.ssw-org .ssw-six{grid-template-columns:repeat(2,minmax(0,1fr))}.ssw-org .ssw-lead{width:100%}} -.ssw-org{min-width:0} -.ssw-tree{padding:0} -.ssw-scope .ssw-seat{border:1px solid var(--ssw-line);border-radius:9px;background:var(--ssw-card)} -.ssw-scope .ssw-lead .ssw-seat{border-color:var(--ssw-line)} -.ssw-scope .ssw-seat:hover{border-color:var(--ssw-blue)} -.ssw-scope .ssw-seat[aria-pressed=true]{border-color:var(--ssw-blue);background:var(--ssw-wash);box-shadow:0 0 0 2px rgba(59,130,246,.12)} -.ssw-seat{min-height:64px;padding:11px 12px 9px;gap:5px;box-shadow:0 1px 2px rgba(16,24,40,.04)} -.ssw-seat-head{display:flex;align-items:center;gap:8px} -.ssw-seat-icon{flex:none;color:var(--ssw-muted)} -.ssw-role-name{font-size:15px;font-weight:600;letter-spacing:1px;flex:1;white-space:nowrap} -.ssw-role-duty{font-size:11px;color:var(--ssw-muted);line-height:1.5} -.ssw-dot{width:7px;height:7px} -.ssw-lead{width:190px} -.ssw-detail{border:1px solid var(--ssw-line);border-radius:10px;background:var(--ssw-card);padding:16px;display:flex;flex-direction:column;gap:12px;min-height:340px} -.ssw-detail-top{display:flex;align-items:baseline;justify-content:space-between;gap:8px} -.ssw-detail-name{font-size:17px;font-weight:600;letter-spacing:1px} -.ssw-detail-status{font-size:11px;color:var(--ssw-faint)} -.ssw-detail-text{margin:0;font-size:12px;line-height:1.9;color:var(--ssw-muted)} -.ssw-detail-actions .ssw-primary{width:100%;padding:10px 12px;font-size:13px} -.ssw-detail .ssw-config{margin:0;border:1px solid var(--ssw-line);border-radius:8px;background:var(--ssw-bg)} -.ssw-detail .ssw-report{padding:0;margin:0} -.ssw-detail .ssw-report-toggle{color:var(--ssw-muted);font-size:12px;padding:2px 0} -@container (max-width:439px){ - .ssw-court{padding:12px 12px 8px;gap:14px} - .ssw-lead{width:100%} - .ssw-six{grid-template-columns:repeat(2,minmax(0,1fr))} - .ssw-seat{min-height:52px;padding:12px;gap:0} - .ssw-role-duty{display:none} - .ssw-role-name{font-size:15px} - .ssw-seat-icon{width:15px;height:15px} - .ssw-detail{min-height:0} -} .ssw-project-line{align-items:baseline;margin-bottom:10px} .ssw-project-title{margin:0} .ssw-tab-body{height:100%;min-height:0;display:flex;flex-direction:column} @@ -1499,8 +1457,7 @@ function apply(ctx) { }, (0, import_react.createElement)( "span", - { className: "ssw-seat-head" }, - (0, import_react.createElement)(SeatIcon, { id: seat.id }), + { className: "ssw-role-top" }, (0, import_react.createElement)("span", { className: "ssw-role-name" }, seat.name), (0, import_react.createElement)("span", { className: "ssw-dot", "data-status": seat.status, "aria-hidden": "true" }) ), @@ -1536,15 +1493,15 @@ function apply(ctx) { { className: "ssw-project" }, (0, import_react.createElement)( "div", - { className: "ssw-project-line" }, - (0, import_react.createElement)("span", { className: "ssw-project-title" }, wb.projectTitle || "未命名项目"), + { className: "ssw-project-line", style: { justifyContent: "flex-end" } }, (0, import_react.createElement)("span", { className: "ssw-count" }, wb.project.seatCount + " 个角色 · " + wb.project.sessionCount + " 个会话") - ) + ), + (0, import_react.createElement)("div", { className: "ssw-project-title" }, wb.projectTitle || "未命名项目") ); const selectedStatus = wb.selected.status; const detailActions = (0, import_react.createElement)( "div", - { className: "ssw-detail-actions" }, + { className: "ssw-current-actions" }, selectedStatus === "bound" ? (0, import_react.createElement)("button", { type: "button", className: "ssw-primary", @@ -1735,24 +1692,18 @@ function apply(ctx) { (0, import_react.createElement)("div", { className: "ssw-list" }, artifactRows) ); const detail = (0, import_react.createElement)( - "aside", - { className: "ssw-detail" }, + "section", + { className: "ssw-current" }, (0, import_react.createElement)( "div", - { className: "ssw-detail-top" }, - (0, import_react.createElement)("strong", { className: "ssw-detail-name" }, wb.selected.name), - (0, import_react.createElement)("span", { className: "ssw-detail-status" }, "角色职责 · " + wb.selected.statusLabel) + { className: "ssw-current-top" }, + (0, import_react.createElement)("strong", { className: "ssw-current-name" }, wb.selected.name), + (0, import_react.createElement)("span", { className: "ssw-current-label" }, "角色职责 · " + wb.selected.statusLabel) ), - (0, import_react.createElement)("p", { className: "ssw-detail-text" }, wb.selected.responsibility), - detailActions, - config - ); - const courtView = (0, import_react.createElement)( - "section", - { className: "ssw-court" }, - (0, import_react.createElement)("div", { className: "ssw-org" }, tree), - detail + (0, import_react.createElement)("p", { className: "ssw-current-text" }, wb.selected.responsibility), + detailActions ); + const courtView = (0, import_react.createElement)(import_react.Fragment, null, tree, detail, config); let body; if (phase === "loading") body = (0, import_react.createElement)("div", { className: "ssw-loading" }, "正在加载工作台…"); else if (phase === "no-workspace") body = (0, import_react.createElement)( diff --git a/sansheng/package.json b/sansheng/package.json index 2123a37..256ecef 100644 --- a/sansheng/package.json +++ b/sansheng/package.json @@ -1,6 +1,6 @@ { "name": "dsh-sansheng-liubu", - "version": "0.3.0", + "version": "0.3.1", "description": "三省六部:每个项目固定十席角色与独立会话的 DSH 插件(第一版)。", "keywords": [ "dsh-plugin", diff --git a/sansheng/src/client/index.js b/sansheng/src/client/index.js index 1313e8f..420e510 100644 --- a/sansheng/src/client/index.js +++ b/sansheng/src/client/index.js @@ -550,8 +550,7 @@ export function apply(ctx) { title: seat.name + ' · ' + seat.duty + '(' + seat.statusLabel + ')', onClick: () => pickSeat(seat.id), }, - h('span', { className: 'ssw-seat-head' }, - h(SeatIcon, { id: seat.id }), + h('span', { className: 'ssw-role-top' }, h('span', { className: 'ssw-role-name' }, seat.name), h('span', { className: 'ssw-dot', 'data-status': seat.status, 'aria-hidden': 'true' }), ), @@ -580,14 +579,14 @@ export function apply(ctx) { ) const projectInfo = h('div', { className: 'ssw-project' }, - h('div', { className: 'ssw-project-line' }, - h('span', { className: 'ssw-project-title' }, wb.projectTitle || '未命名项目'), + h('div', { className: 'ssw-project-line', style: { justifyContent: 'flex-end' } }, h('span', { className: 'ssw-count' }, wb.project.seatCount + ' 个角色 · ' + wb.project.sessionCount + ' 个会话'), ), + h('div', { className: 'ssw-project-title' }, wb.projectTitle || '未命名项目'), ) const selectedStatus = wb.selected.status - const detailActions = h('div', { className: 'ssw-detail-actions' }, + const detailActions = h('div', { className: 'ssw-current-actions' }, selectedStatus === 'bound' ? h('button', { type: 'button', className: 'ssw-primary', disabled: busy, @@ -727,19 +726,15 @@ export function apply(ctx) { ) : null, h('div', { className: 'ssw-list' }, artifactRows)) - const detail = h('aside', { className: 'ssw-detail' }, - h('div', { className: 'ssw-detail-top' }, - h('strong', { className: 'ssw-detail-name' }, wb.selected.name), - h('span', { className: 'ssw-detail-status' }, '角色职责 · ' + wb.selected.statusLabel), + const detail = h('section', { className: 'ssw-current' }, + h('div', { className: 'ssw-current-top' }, + h('strong', { className: 'ssw-current-name' }, wb.selected.name), + h('span', { className: 'ssw-current-label' }, '角色职责 · ' + wb.selected.statusLabel), ), - h('p', { className: 'ssw-detail-text' }, wb.selected.responsibility), + h('p', { className: 'ssw-current-text' }, wb.selected.responsibility), detailActions, - config, - ) - const courtView = h('section', { className: 'ssw-court' }, - h('div', { className: 'ssw-org' }, tree), - detail, ) + const courtView = h(Fragment, null, tree, detail, config) let body if (phase === 'loading') body = h('div', { className: 'ssw-loading' }, '正在加载工作台…') diff --git a/sansheng/src/client/styles.js b/sansheng/src/client/styles.js index dcd3a23..88e39c7 100644 --- a/sansheng/src/client/styles.js +++ b/sansheng/src/client/styles.js @@ -107,48 +107,6 @@ body[data-ds-dark-theme] .ssw-float,html[data-theme=dark] .ssw-float{background: .ssw-badge[data-status=failed]{background:rgba(220,38,38,.12);color:var(--ssw-danger)} .ssw-form{margin-bottom:12px;padding:10px;border:1px solid var(--ssw-line);border-radius:9px;background:var(--ssw-side)} .ssw-empty-line{margin:10px 0;font-size:12px;color:var(--ssw-faint)} -/* 朝堂工作台外观(按 4 审 + 最新外观方案):浅底、白卡、细边、蓝色只给当前角色与主按钮 */ -.ssw-root{container-type:inline-size} -.ssw-tabs{display:flex;gap:22px;margin:14px 16px 0;padding:0;border:0;border-bottom:1px solid var(--ssw-line);border-radius:0;background:transparent} -.ssw-tab{flex:0 0 auto;display:flex;align-items:center;gap:6px;padding:8px 0 10px;border-radius:0;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--ssw-muted);font-size:13px} -.ssw-tab.is-active{color:var(--ssw-blue);font-weight:600;border-bottom-color:var(--ssw-blue);background:transparent;box-shadow:none} -.ssw-tab-count{font-size:11px;color:var(--ssw-faint);font-weight:400} -.ssw-court{max-width:1040px;margin:0 auto;padding:16px 16px 8px;display:grid;grid-template-columns:1fr;gap:16px;align-items:start} -@container (min-width:440px){.ssw-court{grid-template-columns:260px minmax(0,1fr)}} -.ssw-org{container-type:inline-size} -@container (max-width:340px){.ssw-org .ssw-role-duty{display:none}.ssw-org .ssw-six{grid-template-columns:repeat(2,minmax(0,1fr))}.ssw-org .ssw-lead{width:100%}} -.ssw-org{min-width:0} -.ssw-tree{padding:0} -.ssw-scope .ssw-seat{border:1px solid var(--ssw-line);border-radius:9px;background:var(--ssw-card)} -.ssw-scope .ssw-lead .ssw-seat{border-color:var(--ssw-line)} -.ssw-scope .ssw-seat:hover{border-color:var(--ssw-blue)} -.ssw-scope .ssw-seat[aria-pressed=true]{border-color:var(--ssw-blue);background:var(--ssw-wash);box-shadow:0 0 0 2px rgba(59,130,246,.12)} -.ssw-seat{min-height:64px;padding:11px 12px 9px;gap:5px;box-shadow:0 1px 2px rgba(16,24,40,.04)} -.ssw-seat-head{display:flex;align-items:center;gap:8px} -.ssw-seat-icon{flex:none;color:var(--ssw-muted)} -.ssw-role-name{font-size:15px;font-weight:600;letter-spacing:1px;flex:1;white-space:nowrap} -.ssw-role-duty{font-size:11px;color:var(--ssw-muted);line-height:1.5} -.ssw-dot{width:7px;height:7px} -.ssw-lead{width:190px} -.ssw-detail{border:1px solid var(--ssw-line);border-radius:10px;background:var(--ssw-card);padding:16px;display:flex;flex-direction:column;gap:12px;min-height:340px} -.ssw-detail-top{display:flex;align-items:baseline;justify-content:space-between;gap:8px} -.ssw-detail-name{font-size:17px;font-weight:600;letter-spacing:1px} -.ssw-detail-status{font-size:11px;color:var(--ssw-faint)} -.ssw-detail-text{margin:0;font-size:12px;line-height:1.9;color:var(--ssw-muted)} -.ssw-detail-actions .ssw-primary{width:100%;padding:10px 12px;font-size:13px} -.ssw-detail .ssw-config{margin:0;border:1px solid var(--ssw-line);border-radius:8px;background:var(--ssw-bg)} -.ssw-detail .ssw-report{padding:0;margin:0} -.ssw-detail .ssw-report-toggle{color:var(--ssw-muted);font-size:12px;padding:2px 0} -@container (max-width:439px){ - .ssw-court{padding:12px 12px 8px;gap:14px} - .ssw-lead{width:100%} - .ssw-six{grid-template-columns:repeat(2,minmax(0,1fr))} - .ssw-seat{min-height:52px;padding:12px;gap:0} - .ssw-role-duty{display:none} - .ssw-role-name{font-size:15px} - .ssw-seat-icon{width:15px;height:15px} - .ssw-detail{min-height:0} -} .ssw-project-line{align-items:baseline;margin-bottom:10px} .ssw-project-title{margin:0} .ssw-tab-body{height:100%;min-height:0;display:flex;flex-direction:column}