editor: friendlier panels - collapsible rail, remembered state, no more overlap

Rail sections (Outline/Blocks/Nodes) collapse via their headers like
Experiments already did, so long pages stay navigable. Rail open state
and section toggles persist in localStorage across reloads (the QA
preview flow reloads constantly). The assistant panel shifts left while
the dev panel is open instead of stacking exactly underneath it, and
the rail/dev/assistant widths cap at the viewport on small screens.

Tests: rail-sections harness (collapse, reload persistence, shifted
assistant); harness boots with a fresh profile unless keepStorage is
passed; in-memory localStorage shim for the origin-less jsdom.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
mats committed 2026-11-07 12:37:09 +01:00
1 parent 5786712078
commit bb875a0956
10 files changed
+185 -20

No files matched your search

+16
View File
@@ -1,5 +1,21 @@
// jsdom has no layout: give the few APIs the editor touches harmless defaults.
if (!('scrollIntoView' in Element.prototype)) (Element.prototype as any).scrollIntoView = () => {}
// This jsdom runs origin-less, so there is no localStorage: provide an
// in-memory one so UI persistence (rail/panel state) behaves like a browser.
if (typeof (globalThis as any).localStorage === 'undefined') {
const store = new Map<string, string>()
;(globalThis as any).localStorage = {
getItem: (k: string) => (store.has(k) ? store.get(k)! : null),
setItem: (k: string, v: string) => void store.set(k, String(v)),
removeItem: (k: string) => void store.delete(k),
clear: () => store.clear(),
key: (i: number) => [...store.keys()][i] ?? null,
get length() {
return store.size
},
}
}
;(globalThis as any).IS_REACT_ACT_ENVIRONMENT = true
// Store updates arrive from fetch/timers outside act(); the harness settles them explicitly.