From 51fdbef0fd9f229e073528c6f04757cf8421fa26 Mon Sep 17 00:00:00 2001 From: oratis Date: Sun, 23 Aug 2026 16:16:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E5=8F=B3=E4=BE=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=BB=98=E8=AE=A4=E6=94=B6=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 全新 profile 打开 Lisa 时右侧面板不再展开,默认进入两栏(侧边栏 + 聊天区占满)的布局;只有用户手动打开过一次之后才会保持展开。 - lisa-client.ts: 反转 lisaRightbar 的判定 —— 原来是"存了 collapsed 才收起",现在是"存了 open 才展开",于是 key 未设置即读作收起。 #fnPanel 的切换与持久化行为不变。 - lisa-html.ts: 紧跟 增加一段启动脚本,在 .frame 被解析前就打上 body.rb-collapsed。MAIN_CLIENT_JS 挂在 前且体积很大,浏览器 很可能先绘制已解析的 DOM 再执行它;收起既然成了多数人的默认路径, 不加这段会让每次冷加载都闪一下三栏再跳成两栏。主脚本随后幂等地 重新应用同一个 class。 - lisa-html-snapshot.test.ts: MAIN_HTML 是逐字节校验(长度 + sha256), 改 GUI 必须重算,已更新并补上变更流水注释。 ≤1180px 与 ≤720px 两个断点的自动隐藏逻辑未动,本次只影响宽屏默认值。 验证:typecheck 通过,npm test 全绿(1639 项 / 0 失败);1440px 宽度下 实测三种状态 —— 未设置→收起、open→展开、collapsed→收起且按钮保留 高亮态,open/collapsed 均跨刷新保持。 Co-Authored-By: Claude Opus 5 --- src/web/lisa-client.ts | 8 +++++--- src/web/lisa-css.ts | 4 +++- src/web/lisa-html-snapshot.test.ts | 10 ++++++++-- src/web/lisa-html.ts | 9 +++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/web/lisa-client.ts b/src/web/lisa-client.ts index 2cfad50..d51fa16 100644 --- a/src/web/lisa-client.ts +++ b/src/web/lisa-client.ts @@ -1120,10 +1120,12 @@ if (fnSearchBtn && fnFind) { // Right panel manual collapse (F4) — wide-screen only concern: the ≤1180px // media query hides the panel regardless. Persisted; the fnbar button shows -// an active tint while collapsed. +// an active tint while collapsed. Collapsed is the DEFAULT: the panel only +// stays open once the user has explicitly opened it ("open" in localStorage), +// so a fresh profile boots into the two-column chat-first layout. { - let collapsed = false; - try { collapsed = localStorage.getItem('lisaRightbar') === 'collapsed'; } catch (e) {} + let collapsed = true; + try { collapsed = localStorage.getItem('lisaRightbar') !== 'open'; } catch (e) {} const applyRb = () => { document.body.classList.toggle('rb-collapsed', collapsed); const btn = document.getElementById('fnPanel'); diff --git a/src/web/lisa-css.ts b/src/web/lisa-css.ts index 15235f3..c56273c 100644 --- a/src/web/lisa-css.ts +++ b/src/web/lisa-css.ts @@ -2416,7 +2416,9 @@ export const MAIN_CSS = ` :root { /* Hide the legacy pixel send icon; the text label is enough in the new theme. */ #sendBtn img { display: none; } - /* ── Manual right-panel collapse (F4, persisted client-side) ──── */ + /* ── Manual right-panel collapse (F4, persisted client-side) ──── + Collapsed is the DEFAULT state; the class is only absent once the user + has explicitly opened the panel (lisaRightbar === "open"). */ body.rb-collapsed .frame { grid-template-columns: 300px 1fr; grid-template-areas: diff --git a/src/web/lisa-html-snapshot.test.ts b/src/web/lisa-html-snapshot.test.ts index 34f7271..dc4c995 100644 --- a/src/web/lisa-html-snapshot.test.ts +++ b/src/web/lisa-html-snapshot.test.ts @@ -197,10 +197,16 @@ import { MAIN_HTML } from "./lisa-html.js"; * #tabStrip); nodes now carry data-* attributes only * (runDelegatedAction dispatches approve/deny/send/output/cancel/adopt/ * stream/open-lisa/close-stream). + * Then: the right panel now defaults to COLLAPSED — the lisaRightbar check + * inverted (open only when the value is literally "open", so an unset key + * reads as collapsed), and a tiny boot +