From 3aa87784277a2ad729561b0d597eca33663d1298 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Tue, 17 Nov 2026 16:20:52 -0500 Subject: [PATCH] Panes: one controller for the listeners, shared helpers for repeated lookups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The panes' effect registered 25 listeners and removed each by hand; they share an AbortController now. - One relayout() for the four places that laid out, measured and drew; one uncurve() for "curves off" and the start of the pages' marks (so schedule just calls curves(), which goes to pageMarks as pages); one handleAt() for the mouse and touch drags' handle lookup (the close/pin/⋯ checks before it could never match inside a grip or tab); ruleOf() for the rule a pane's head draws, written three times; setAttr from stack.ts instead of a copy; paneOfPage for the desktop column's pane to show, the same rule; the pin, close and W icons from Pages.tsx instead of copies in Chrome. - The curves' `box` offset was a constant zero subtracted everywhere. - Gone: glideTo's ms parameter (never passed), the "lifting" class (nothing reads it), Axis fields nothing reads, a dead branch in the map's rails, a linear search per pane in forks reorder, a stale and a superseded comment. Exports used only in their own file are not exported. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab --- src/ui/Pages.tsx | 13 +-- src/ui/Panes.tsx | 242 ++++++++++++++++++++--------------------------- src/ui/forks.ts | 19 ++-- src/ui/lanes.ts | 6 +- src/ui/stack.ts | 18 ++-- 5 files changed, 128 insertions(+), 170 deletions(-) diff --git a/src/ui/Pages.tsx b/src/ui/Pages.tsx index 0df4427..807abb3 100644 --- a/src/ui/Pages.tsx +++ b/src/ui/Pages.tsx @@ -11,17 +11,17 @@ import { mapStep, rails, type Rail } from "./pages"; import { article } from "./wiki"; /** What a pane is called: its node's title, or its article's (a section of one by its heading). */ -export function paneTitle(p: PaneRef): string { +function paneTitle(p: PaneRef): string { if (p.kind === "node") return store.snap.nodes[p.id] ? label(store.snap, p.id) : "…"; const a = article(p.title, p.lang); const sec = p.sec !== undefined && a.state === "ready" ? a.value.sections.find((x) => x.id === p.sec) : undefined; return sec ? sec.heading : a.state === "ready" ? a.value.title : p.title; } -const W = () => W; +export const W = () => W; /** Up to this many panes in a column, a trail step shows a dot for each; beyond, their number. */ -export const STACK_DOTS = 4; +const STACK_DOTS = 4; /** * How many panes the page of a step holds, when more than one: a dot for each, top to bottom as they @@ -107,12 +107,13 @@ export function Trail() { ); } -const Pin = () => ( +/** A pane's pin and close icons (here and in Panes.tsx). */ +export const Pin = () => ( ); -const Close = () => ( +export const Close = () => ( @@ -134,7 +135,7 @@ function RailLine({ r, step, hue, on }: { r: Rail; step: number; hue?: number; o ? { left: `${x}px`, width: `${markAt(r.level + 1, step) + MARK - x}px`, top: 0, height: "50%" } : r.kind === "pass" ? { left: `${x}px`, top: 0, bottom: 0 } - : { left: `${r.kind === "down" ? lineAt(r.level, step) : x}px`, top: "50%", bottom: 0 }; + : { left: `${x}px`, top: "50%", bottom: 0 }; return