// One page at a time. Sites, You, Fronts, Rogues, Paper, the tree and the Select list sit in the same spot // over the map, so a page that opens closes whichever other one is open. Screen state only: no rules here. const pages = new Map void>(); /** A page's way to close itself without telling the others (its flag, and nothing more). */ export function onePage(name: string, close: () => void) { pages.set(name, close); } /** `name` is opening: close every other page. */ export function opening(name: string) { for (const [k, close] of pages) if (k !== name) close(); }