- ZOOM: the ⌘±/⌘0 ladder is owned, not stock roles — applyZoom sets the factor and broadcasts 'lh:zoom'; the renderer publishes --lh-zoom; the gutter lengths (.lh-lights-gutter / .lh-closed-toggle) divide by it so their RENDERED size is a physical constant at every zoom — the graph button stays glued next to the lights, nothing slides under them. before-input-event catches ⌘=/layout variants the menu's Plus may not claim; did-finish-load re-pushes on reload; getZoom covers first paint. The lights themselves stay at construction position — Electron 44 has NO setTrafficLightPosition (options-only; the first run crashed on it). HIG-acceptable: native lights hug the corner; the web chrome compensates around them. - JOBS SUITE FLAKE, actually fixed this time: the seams are module-global and the sweep scans every record — a timed-out async test left a running orphan + late wake that poisoned its NEIGHBORS (respawned 3 !== 0). New afterEach fence: settle every tracked running job, unregister aborts, seams reset to inert no-ops — every test starts from identical state regardless of upstream flake. Verified: two consecutive full-suite runs 1326/1326.
30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
/*
|
|
* Preload (2026-09-17, narrow-window wave): the ONLY bridge between the
|
|
* sandboxed renderer and the main process. contextIsolation + sandbox are
|
|
* on (electron/main.cjs), so this file is the renderer's entire access to
|
|
* Electron — keep it a minimal, explicit API surface.
|
|
*
|
|
* window.lh.expandWindow() — widen the window to the sidebar auto-close
|
|
* threshold (928px) when the sidebar is opened below it. The main
|
|
* process clamps: no-op if the window is already wide enough.
|
|
*
|
|
* window.lh.onZoom(cb) / window.lh.getZoom() — the zoom truth (owner
|
|
* round 7, 2026-10-05): every ⌘±/⌘0 change arrives as "lh:zoom" with
|
|
* the new factor; getZoom covers the first-paint race. The renderer
|
|
* publishes it as --lh-zoom so physical-constant lengths (the traffic-
|
|
* light gutter) can divide by it.
|
|
*
|
|
* Channel names are mirrored in electron/main.cjs — keep them in sync.
|
|
*/
|
|
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
contextBridge.exposeInMainWorld("lh", {
|
|
expandWindow: () => ipcRenderer.send("lh:expand-window"),
|
|
onZoom: (cb) => {
|
|
const listener = (_event, factor) => cb(factor);
|
|
ipcRenderer.on("lh:zoom", listener);
|
|
return () => ipcRenderer.removeListener("lh:zoom", listener);
|
|
},
|
|
getZoom: () => ipcRenderer.invoke("lh:zoom:get"),
|
|
});
|