Panes, curves, menus: stacking, peek covering curves, one of tab or title, edges, drawn underlines

- Curves are one layer over the panes and their edges, from the window's corner (so its pixels are
  the device's; clipped inside the drawing, as a CSS clip resampled it and softened every hairline),
  under the menus; the selection bar and a pane peeking out leave holes in it (masks), the peeking
  pane's own curves drawn over it. Redrawn when the bar moves or a pane's tab comes or goes.
- A pane in a stack shows its tab only while the rule under its title does not show (data-tab), and
  the curve lands in whichever shows, by the same test.
- A pane peeking out is edged all round; the active pane has its other edges in a stronger ink.
- A menu's button pressed while its menu is open closes it (no reopening on the click after).
- A link's underline (solid: a link, an article's link) is drawn by the curve leaving it, line by
  line, its own left out, so the two meet exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 00:04:54 -05:00
1 parent 6c97772ec9
commit 2cefbbfd5f
4 files changed
+186 -39

No files matched your search

+9 -6
View File
@@ -110,7 +110,8 @@ Press `?` for every key. The short version:
fit, the column stacks them the way the strip stacks columns: the pane on the focused branch shown
whole, those before it stuck a tab apart above it and those after it a tab apart at the column's
foot, partly covered and at the limit down to a one-line tab, so every pane shows at least its tab.
A pane scrolled past its own title shows the same tab at its top, over its text. A click anywhere
A pane scrolled past its own title shows the same tab at its top, over its text; a pane shows its
tab only while the rule under its title does not show, never both. A click anywhere
in a pane that is not text, a row or a link makes it the active pane; a click anywhere else, or
Esc, clears a selection. Mouse resting on a pane that is cut off for any reason (covered across
or down, too small a share of its column, past its foot): after a moment it peeks out whole over
@@ -125,9 +126,10 @@ Press `?` for every key. The short version:
in the column, across forks; the same from a node, a selection or an article, back where you were
in each pane, and left then right comes back. Plain `h` and `l` still move along the focused branch.
The pane menu (`⋯`) offers the same.
- **Curves.** A curve runs from the words, row or link each pane was opened from (joined to their
underline) into the rule under the pane's title, and draws that rule, so the two are one hairline
on device pixels; the focused branch's is drawn stronger. Where the title does not show (the pane
- **Curves.** A curve runs from the words, row or link each pane was opened from into the rule under
the pane's title, and draws that rule, and a link's underline too, so link, curve and rule are one
hairline on device pixels. Curves pass over the panes' edges and under the selection bar and the
menus; a pane peeking out covers the curves that are not its own; the focused branch's is drawn stronger. Where the title does not show (the pane
folded to its tab, or scrolled past it), the curve runs into the tab's foot instead; out of a
folded pane whose source is out of sight, it leaves from the end of that pane's tab foot. A source
scrolled or covered out of sight in a pane that still shows is pointed at: the curve is dotted
@@ -142,8 +144,9 @@ Press `?` for every key. The short version:
nothing but the panes' tree decides it (not the focus, a scroll or a fold).
`/colors line|top|edge|off` (or the menu) puts it there, in a band across each pane's top, down
its left edge, or nowhere.
- **The active pane**, where the keys act, has a heavy rule across its top; the rest of the focused
branch, a hairline. `q` closes it and every pane opened from it (whatever it shows: a section, a
- **The active pane**, where the keys act, has a heavy rule across its top and its other edges in a
stronger ink; the rest of the focused branch, a hairline across its top. A pane peeking out is
edged all round. `q` closes it and every pane opened from it (whatever it shows: a section, a
note, an article); each pane's x does the same for that pane. `P`, or a pane's pin, pins it: a
pinned pane stays where it is when a pane it was opened from closes (it shows that its source has
closed), is never replaced by a Shift open, and is never covered, in its column or along the
+14 -2
View File
@@ -236,7 +236,12 @@ let shown: Shown | null = null;
const watchers = new Set<() => void>();
const changed = () => watchers.forEach((f) => f());
/** The button whose menu a press on it just closed: the click that follows that press is not one to open it again. */
let closedBy: { el: HTMLElement; at: number } | null = null;
export function showMenu(entries: Entry[], at: Shown["at"]) {
if (at instanceof HTMLElement && closedBy?.el === at && performance.now() - closedBy.at < 1000) return void (closedBy = null);
closedBy = null;
if (shown?.at instanceof HTMLElement) shown.at.removeAttribute("aria-expanded");
const active = document.activeElement as HTMLElement | null;
shown = { entries, at, restore: active && active !== document.body && !active.closest(".menu") ? active : shown?.restore ?? null };
@@ -285,7 +290,12 @@ export function Menu({ entries, at, sheet, onClose }: { entries: Entry[]; at: Sh
}, [entries, at, sheet]);
// Registered as it is drawn (an effect after paint can come late, and a press outside would be missed).
useLayoutEffect(() => {
const outside = (e: Event) => !ref.current?.contains(e.target as Node) && onClose(false);
const outside = (e: Event) => {
if (ref.current?.contains(e.target as Node)) return;
// A press on the button the menu hangs from closes it, and the click after it does not open it again.
if (at instanceof HTMLElement && at.contains(e.target as Node) && e.type === "pointerdown") closedBy = { el: at, at: performance.now() };
onClose(false);
};
// A scroll closes it too, but not the one that brought what it is about into view as it opened.
const opened = performance.now();
const scrolled = (e: Event) => performance.now() - opened > 250 && outside(e);
@@ -300,7 +310,7 @@ export function Menu({ entries, at, sheet, onClose }: { entries: Entry[]; at: Sh
window.removeEventListener("resize", away);
window.removeEventListener("blur", away);
};
}, [onClose]);
}, [onClose, at]);
const cells = () => [...ref.current!.querySelectorAll<HTMLElement>("[data-mi]:not([aria-disabled='true'])")];
const onKey = (e: KeyboardEvent) => {
// The menu has the keys while it is open: none reach the page's handler.
@@ -425,6 +435,8 @@ function placeBar(el: HTMLElement | null, shown = false) {
const clip = sels[0].closest(".pane-scroll")?.getBoundingClientRect();
const gone = top < bar || top + h > window.innerHeight - 28 || (clip && (last.bottom < clip.top || first.top > clip.bottom));
el.style.visibility = gone ? "hidden" : "visible";
// The curves leave its place clear (Panes.tsx): they are drawn again for where it is now.
if (pane) window.dispatchEvent(new Event("ie:geometry"));
}
/**
+149 -24
View File
@@ -73,6 +73,9 @@ class Pane extends Component<PaneProps> {
}
}
/** Sent when something the curves are drawn from changes without a render or a scroll: a pane's tab coming or going, the selection bar moving. */
export const GEOMETRY = "ie:geometry";
/**
* A pane scrolled past its title shows its tab at its top, as a folded one does (data-scrolled): an
* observer on the title's rule, against the pane's own scroll box less the tab, so nothing is done
@@ -93,7 +96,10 @@ function watchHead(tid: number) {
const io = new IntersectionObserver(
(es) => {
const e = es[es.length - 1];
const was = pane.hasAttribute("data-scrolled");
setAttr(pane, "data-scrolled", !e.isIntersecting && !!e.rootBounds && e.boundingClientRect.height > 0 && e.boundingClientRect.bottom <= e.rootBounds.top + 1);
// The curve into it lands in its tab now, or its title again.
if (was !== pane.hasAttribute("data-scrolled")) window.dispatchEvent(new Event(GEOMETRY));
},
{ root: scroll, rootMargin: `-${TAB}px 0px 0px 0px` },
);
@@ -267,6 +273,20 @@ function nearestY(el: Element | null | false) {
else if (r.bottom > c.bottom - pad) box.scrollTop += Math.min(r.bottom - c.bottom + pad, r.top - c.top - top);
}
/**
* Whether the rule under a pane's title shows (below where its tab would be, above what covers its
* foot): if not, the pane shows its tab instead, and a curve into it lands in the tab's foot.
*/
function ruleShows(p: HTMLElement, col: DOMRect, next: number): boolean {
if (p.hasAttribute("data-buried")) return false;
const head = p.querySelector<HTMLElement>(HEADS);
const rule = (head?.matches(".top") ? head.querySelector<HTMLElement>("h1") : head)?.getBoundingClientRect();
if (!rule) return false;
const r = p.getBoundingClientRect();
const sc = p.querySelector<HTMLElement>(":scope > .pane-scroll")!.getBoundingClientRect();
return rule.bottom > Math.max(r.top, col.top, sc.top) + TAB && rule.bottom <= Math.min(next, col.bottom, sc.bottom);
}
const setAttr = (el: Element | undefined, name: string, on: boolean) => {
if (el && el.hasAttribute(name) !== on) on ? el.setAttribute(name, "") : el.removeAttribute(name);
};
@@ -446,7 +466,17 @@ export function Panes() {
if (!el) return;
const colEls = [...el.querySelectorAll<HTMLElement>(":scope > .col")];
mark(el, colEls, ACROSS, false, colEls[0]?.querySelector<HTMLElement>(".spine")?.offsetWidth ?? 0);
for (const c of colEls) if (c.classList.contains("crowded")) mark(c, [...c.querySelectorAll<HTMLElement>(":scope > .pane")], DOWN, true, TAB);
for (const c of colEls) {
const ps = [...c.querySelectorAll<HTMLElement>(":scope > .pane")];
if (!c.classList.contains("crowded")) {
for (const p of ps) setAttr(p, "data-tab", false);
continue;
}
mark(c, ps, DOWN, true, TAB);
// A covered pane shows its tab only when the rule under its title does not show: never both.
const cb = c.getBoundingClientRect();
ps.forEach((p, i) => setAttr(p, "data-tab", p.hasAttribute("data-covered") && !ruleShows(p, cb, ps[i + 1]?.getBoundingClientRect().top ?? Infinity)));
}
};
/**
@@ -546,7 +576,7 @@ export function Panes() {
const wrap = el.parentElement!;
const onScroll = (e: Event) => {
const t = e.target as HTMLElement;
if (t === el || t.classList?.contains("col")) measure();
measure();
// A scroll inside what peeks (the wheel over it) keeps it out; any other moves things from under it.
if (peeked.length && !peeked.some((p) => p !== t && p.contains(t)) && !(t === peeked[0] && peeked.length === 1 && !t.classList.contains("pane"))) hide();
schedule();
@@ -574,6 +604,7 @@ export function Panes() {
moving = Math.max(0, moving - 1);
if (!moving) schedule();
};
window.addEventListener(GEOMETRY, schedule);
wrap.addEventListener("transitionrun", onRun);
wrap.addEventListener("transitionend", onEnd);
wrap.addEventListener("transitioncancel", onEnd);
@@ -779,6 +810,7 @@ export function Panes() {
clearTimeout(later.current);
clearTimeout(timer);
wrap.removeEventListener("scroll", onScroll, { capture: true });
window.removeEventListener(GEOMETRY, schedule);
wrap.removeEventListener("transitionrun", onRun);
wrap.removeEventListener("transitionend", onEnd);
wrap.removeEventListener("transitioncancel", onEnd);
@@ -846,6 +878,8 @@ interface Edge {
under?: { x: number; y: number };
/** For a source out of sight in its pane: the point on the pane's edge, over it, where the curve ends turned toward it. */
hint?: { x: number; y: number };
/** For a link: its underline, line by line (the last runs on into the curve). */
lines?: { x0: number; x1: number; y: number }[];
textRight: number;
ex: number;
ey: number;
@@ -898,13 +932,15 @@ const lanesUsed = new Map<number, string[]>();
function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
if (!el || !svg) return;
if (!store.settings.curves) {
if (svg.firstChild) svg.replaceChildren();
for (const p of svg.querySelectorAll("path")) p.remove();
for (const s of document.querySelectorAll("[data-curved]")) s.removeAttribute("data-curved");
markRuled(paneEls(el), new Map());
return;
}
// The curves' layer is painted from its box's whole pixel: positions are measured from there, so that a hairline set on device pixels lands on them.
const sb = svg.getBoundingClientRect();
const box = { left: Math.round(sb.left), top: Math.round(sb.top) };
// The curves' layer covers the window from its corner (style.css), so its pixels are the device's and a hairline set on device pixels lands on them; it shows only over the strip.
const box = { left: 0, top: 0 };
// (Clipped inside the drawing: a CSS clip on the layer would have it resampled, softening every hairline.)
const area = (svg.parentElement as HTMLElement).getBoundingClientRect();
const dpr = window.devicePixelRatio || 1;
const els = paneEls(el);
const colEls = [...el.children] as HTMLElement[];
@@ -922,6 +958,8 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
const feet = new Map<number, { x0: number; x1: number; y: number; hue?: number; on: boolean }>();
/** The panes whose tab's foot a curve into them draws already. */
const tabbed = new Set<number>();
/** The links whose underline a curve draws. */
const curved = new Set<HTMLElement>();
const edges: Edge[] = [];
for (const x of store.panesPlaced) {
const parent = x.parent;
@@ -943,27 +981,24 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
const nextCol = colEls[colEls.indexOf(ccol) + 1]?.getBoundingClientRect().left ?? Infinity;
const shownRight = Math.min(cbox.right, nextCol);
// A pane folded down a crowded column shows its tab, and may still show its title under it.
// A pane folded down a crowded column, or scrolled past its title, shows its tab (data-covered, data-scrolled).
let folded = ce.hasAttribute("data-covered");
if (ce.hasAttribute("data-buried")) ey = cbox.top + TAB / 2;
// A pane showing its tab (folded down a crowded column, or scrolled past its title): the curve lands in the tab's foot; else in the rule under its title, where that shows (the same test as the tab's, ruleShows, so the two hand over at once).
const below = ccol.classList.contains("crowded") ? ((ce.nextElementSibling as HTMLElement | null)?.getBoundingClientRect().top ?? Infinity) : Infinity;
let folded = ce.hasAttribute("data-tab") || ce.hasAttribute("data-scrolled") || ce.hasAttribute("data-buried") || (ce.hasAttribute("data-covered") && !ruleShows(ce, ccolBox, below));
if (folded) ey = cbox.top + TAB / 2;
else {
const scroll = ce.querySelector<HTMLElement>(".pane-scroll")!.getBoundingClientRect();
// Under the tab, a rule does not show.
const top = Math.max(cbox.top, scroll.top) + TAB;
const t = ce.querySelector<HTMLElement>(".pane-head h2, .top h1, .wiki-head h2");
const tr = t?.getBoundingClientRect();
ey = folded ? cbox.top + TAB / 2 : tr && tr.bottom > scroll.top + 4 ? Math.max(scroll.top + 6, tr.top + Math.min(tr.height, 32) / 2) : scroll.top + 14;
ey = tr && tr.bottom > scroll.top + 4 ? Math.max(scroll.top + 6, tr.top + Math.min(tr.height, 32) / 2) : scroll.top + 14;
// The rule: under the pane's own head (a section's, a page's title, an article's), not an article's set under a node; the focused head's too (the heavy rule on top marks the active pane).
const head = ruled ? ce.querySelector<HTMLElement>(HEADS) : null;
const ruleEl = head?.matches(".top") ? head.querySelector<HTMLElement>("h1") : head;
const rs = (ruleEl ?? ce.querySelector<HTMLElement>(".pane-head, .top h1, .wiki-head"))?.getBoundingClientRect();
if (rs && rs.bottom <= top) {
const rr = ruleEl?.getBoundingClientRect();
// Scrolled past its title (its tab is on its way): its tab's foot.
if (rr && rr.bottom <= Math.max(cbox.top, scroll.top) + TAB) {
folded = true;
ey = cbox.top + TAB / 2;
}
const rr = ruleEl ? rs : undefined;
const below = ccol.classList.contains("crowded") ? ((ce.nextElementSibling as HTMLElement | null)?.getBoundingClientRect().top ?? Infinity) : Infinity;
if (rr && rr.bottom > top + 4 && rr.bottom < Math.min(scroll.bottom, below) && rr.left < shownRight) {
} else if (rr && ruleShows(ce, ccolBox, below) && rr.left < shownRight) {
ey = level(rr.bottom - 0.5);
ex = Math.max(left + ARRIVE, rr.left);
rule = { x0: ex, x1: Math.min(rr.right, shownRight) };
@@ -990,8 +1025,9 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
let sy: number;
let under: { x: number; y: number } | undefined;
let hint: { x: number; y: number } | undefined;
let lines: { x0: number; x1: number; y: number }[] | undefined;
// What of the pane shows: its own scroll box (below its tab, if folded), less what the pane after it in a crowded column covers, down to the column's foot.
const pfolded = pe.hasAttribute("data-covered");
const pfolded = pe.hasAttribute("data-tab") || pe.hasAttribute("data-buried");
const pscroll = pe.querySelector<HTMLElement>(".pane-scroll")!.getBoundingClientRect();
const nextTop = pcol.classList.contains("crowded") ? (pe.nextElementSibling as HTMLElement | null)?.getBoundingClientRect().top : undefined;
const sc = { top: pfolded || pe.hasAttribute("data-scrolled") ? Math.max(pscroll.top, pbox.top + TAB) : pscroll.top, bottom: Math.min(pscroll.bottom, nextTop ?? Infinity, pcol.getBoundingClientRect().bottom) };
@@ -1032,6 +1068,8 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
const j = Math.max(2, sy - uy);
under = { x: r.right, y: uy };
sx = r.right + 2 * j;
// A link's underline (solid, not a note's dotted one) is drawn here, as the start of the curve, so the two meet exactly; its own is left out (data-curved).
if (s.matches(".lnk, .wiki-text a")) lines = [...rects].filter((q) => q.width > 0 && q.bottom > sc.top && q.top < sc.bottom).map((q) => ({ x0: q.left, x1: q.right, y: level(underline(s, q)) }));
}
if (sy < sc.top + 2 || sy > sc.bottom - 2 || sx > textRight + 1) {
lost = true;
@@ -1051,6 +1089,10 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
}
sy = level(sy);
if (under) under.y = level(under.y);
if (under && lines?.length && !lost) {
under.y = lines[lines.length - 1].y;
curved.add(s);
} else lines = undefined;
}
if (ruled && feet.has(parent.id) && !rules.get(parent.id)?.includes("tab")) rules.set(parent.id, rules.has(parent.id) ? "head tab" : "tab");
// A curve that cannot reach its pane (dotted) leaves the pane's own rule as it is.
@@ -1060,7 +1102,7 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
tabbed.delete(x.node.id);
}
const gutter = colEls.indexOf(ccol);
edges.push({ from: parent.id, to: x.node.id, gutter, left: left - box.left, sx: sx - box.left, sy: sy - box.top, under: under && { x: under.x - box.left, y: under.y - box.top }, hint: hint && { x: hint.x - box.left, y: hint.y - box.top }, textRight: textRight - box.left, ex: ex - box.left, ey: ey - box.top, on: branch.has(x.node.id) && branch.has(parent.id), lost, hue: x.node.hue, rule: rule && { x0: rule.x0 - box.left, x1: rule.x1 - box.left } });
edges.push({ from: parent.id, to: x.node.id, gutter, left: left - box.left, sx: sx - box.left, sy: sy - box.top, under: under && { x: under.x - box.left, y: under.y - box.top }, hint: hint && { x: hint.x - box.left, y: hint.y - box.top }, lines: lines?.map((q) => ({ x0: q.x0 - box.left, x1: q.x1 - box.left, y: q.y - box.top })), textRight: textRight - box.left, ex: ex - box.left, ey: ey - box.top, on: branch.has(x.node.id) && branch.has(parent.id), lost, hue: x.node.hue, rule: rule && { x0: rule.x0 - box.left, x1: rule.x1 - box.left } });
}
// Lanes, gutter by gutter.
const lane = new Map<Edge, number>();
@@ -1086,8 +1128,11 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
const g = e.left + LANE_LAST - i * LANE_PITCH;
const dy = e.ey - e.sy;
let d: string;
// A link's underline, its lines in turn, the last running on into the step down to the lead-out.
const lastLine = e.lines?.[e.lines.length - 1];
const underPath = e.under && (lastLine ? e.lines!.slice(0, -1).map((q) => `M${fx(q.x0)} ${fx(q.y)}H${fx(q.x1)}`).join("") + `M${fx(lastLine.x0)} ${fx(e.under.y)}H${fx(e.under.x)}` : `M${fx(e.under.x)} ${fx(e.under.y)}`);
const join = e.under
? `M${fx(e.under.x)} ${fx(e.under.y)}C${fx((e.under.x + e.sx) / 2)} ${fx(e.under.y)} ${fx((e.under.x + e.sx) / 2)} ${fx(e.sy)} ${fx(e.sx)} ${fx(e.sy)}`
? `${underPath}C${fx((e.under.x + e.sx) / 2)} ${fx(e.under.y)} ${fx((e.under.x + e.sx) / 2)} ${fx(e.sy)} ${fx(e.sx)} ${fx(e.sy)}`
: e.hint
? `M${fx(e.hint.x)} ${fx(e.hint.y)}V${fx(e.sy + Math.sign(e.hint.y - e.sy) * 6)}Q${fx(e.hint.x)} ${fx(e.sy)} ${fx(e.sx)} ${fx(e.sy)}`
: `M${fx(e.sx)} ${fx(e.sy)}`;
@@ -1109,10 +1154,25 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
if (e.rule) d += e.rule.x0 < e.ex - 0.01 ? `M${fx(e.rule.x0)} ${fx(e.ey)}H${fx(e.rule.x1)}` : `H${fx(e.rule.x1)}`;
out.push({ key: `${e.from}>${e.to}`, from: e.from, to: e.to, lane: i, cls: `${e.on ? "on" : ""}${e.lost ? " lost" : ""}`, d, hue: e.hue === undefined ? "" : String(e.hue) });
}
// What peeks out, and the selection bar, leave their places clear of the curves (holes in a mask), but for the curves that belong to what peeks.
const peeked = [...el.querySelectorAll<HTMLElement>("[data-peek]")];
const local = (r: DOMRect) => ({ x: r.left - box.left, y: r.top - box.top, w: r.width, h: r.height });
const holes = peeked.map((p) => local(p.getBoundingClientRect()));
const bar = document.querySelector<HTMLElement>(".pane > .selbar");
const barHole = bar && bar.style.visibility !== "hidden" ? [local(bar.getBoundingClientRect())] : [];
const owned = (id: number) => {
const p = els.get(id);
return !!p && peeked.some((q) => q.contains(p));
};
const { under, over } = layers(svg, area, [...holes, ...barHole], barHole);
// Each curve keeps its element, changed only where it changed, so only what moved is painted again.
const had = new Map<string, SVGPathElement>();
for (const p of svg.querySelectorAll<SVGPathElement>("path")) had.set(p.dataset.key!, p);
out.forEach((c, k) => {
const at = new Map<Element, number>([
[under, 0],
[over, 0],
]);
out.forEach((c) => {
let p = had.get(c.key);
had.delete(c.key);
if (!p) {
@@ -1125,13 +1185,78 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
if (p.getAttribute("class") !== c.cls) p.setAttribute("class", c.cls);
if (p.dataset.lane !== String(c.lane)) p.dataset.lane = String(c.lane);
if ((p.dataset.hue ?? "") !== c.hue) c.hue ? (p.dataset.hue = c.hue) : delete p.dataset.hue;
// In drawing order: the focused branch's last, on top.
if (svg.children[k] !== p) svg.insertBefore(p, svg.children[k] ?? null);
// In drawing order, the focused branch's last, on top; over what peeks if it belongs to it.
const g = owned(c.from) || owned(c.to) ? over : under;
const k = at.get(g)!;
at.set(g, k + 1);
if (g.children[k] !== p) g.insertBefore(p, g.children[k] ?? null);
});
for (const p of had.values()) p.remove();
for (const s of document.querySelectorAll<HTMLElement>("[data-curved]")) if (!curved.has(s)) s.removeAttribute("data-curved");
for (const s of curved) if (!s.hasAttribute("data-curved")) s.setAttribute("data-curved", "");
markRuled(els, rules);
}
/**
* The curves' two layers: those under what peeks (with holes where it is, and where the selection
* bar is), and those over it (its own; a hole only for the bar). Made once; the holes kept as asked.
*/
function layers(svg: SVGSVGElement, area: DOMRect, holes: { x: number; y: number; w: number; h: number }[], barHoles: { x: number; y: number; w: number; h: number }[]) {
const NS = "http://www.w3.org/2000/svg";
let defs = svg.querySelector("defs");
if (!defs) {
defs = document.createElementNS(NS, "defs");
for (const id of ["ie-curve-holes", "ie-curve-bar"]) {
const m = document.createElementNS(NS, "mask");
m.id = id;
m.setAttribute("maskUnits", "userSpaceOnUse");
defs.appendChild(m);
}
const clip = document.createElementNS(NS, "clipPath");
clip.id = "ie-curve-area";
clip.appendChild(document.createElementNS(NS, "rect"));
defs.appendChild(clip);
svg.prepend(defs);
const shown = document.createElementNS(NS, "g");
shown.setAttribute("clip-path", "url(#ie-curve-area)");
svg.appendChild(shown);
for (const c of ["under", "over"]) {
const g = document.createElementNS(NS, "g");
g.setAttribute("class", c);
shown.appendChild(g);
}
}
// Only over the strip.
const r = svg.querySelector("#ie-curve-area rect")!;
for (const [k, v] of Object.entries({ x: area.left, y: area.top, width: area.width, height: area.height })) if (r.getAttribute(k) !== String(v)) r.setAttribute(k, String(v));
const under = svg.querySelector<SVGGElement>("g.under")!;
const over = svg.querySelector<SVGGElement>("g.over")!;
const fill = (id: string, g: SVGGElement, hs: typeof holes) => {
const m = svg.querySelector<SVGMaskElement>(`#${id}`)!;
const key = hs.map((h) => [h.x, h.y, h.w, h.h].map(Math.round).join(",")).join(";");
if (m.dataset.key === key) return;
m.dataset.key = key;
if (!hs.length) {
g.removeAttribute("mask");
m.replaceChildren();
return;
}
const all = document.createElementNS(NS, "rect");
for (const [k, v] of Object.entries({ x: "-10", y: "-10", width: "100000", height: "100000", fill: "white" })) all.setAttribute(k, v);
const cut = hs.map((h) => {
const r = document.createElementNS(NS, "rect");
for (const [k, v] of Object.entries({ x: h.x, y: h.y, width: h.w, height: h.h, fill: "black" })) r.setAttribute(k, String(v));
r.setAttribute("class", "hole");
return r;
});
m.replaceChildren(all, ...cut);
g.setAttribute("mask", `url(#${id})`);
};
fill("ie-curve-holes", under, holes);
fill("ie-curve-bar", over, barHoles);
return { under, over };
}
/** A pane's own head, whose rule a curve into it lands in: a section's, a page's title, an article's (not an article set under a node). */
const HEADS = ":scope > .pane-scroll > .pane-body > .pane-head, :scope > .pane-scroll > .pane-body > .top, :scope > .pane-scroll > .pane-body > .wiki:not(.embedded) > .wiki-head";
+14 -7
View File
@@ -350,6 +350,8 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
--tab: 30px;
--shade: rgb(0 0 0 / 0.2);
--pane-rule: #d9d9d9;
/* The edges of the active pane and of a pane peeking out. */
--edge-strong: #6a6a6a;
--curve: rgb(0 0 0 / 0.17);
--curve-on: color-mix(in srgb, var(--link) 62%, transparent);
}
@@ -357,6 +359,7 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
:root {
--shade: rgb(0 0 0 / 0.6);
--pane-rule: #3a3a3a;
--edge-strong: #a8a8a8;
--curve: rgb(255 255 255 / 0.16);
--curve-on: color-mix(in srgb, var(--link) 62%, transparent);
}
@@ -416,7 +419,7 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
}
.tabline .tabtitle { overflow: hidden; text-overflow: ellipsis; }
.tabline:hover { color: var(--fg); }
.col.crowded > .pane[data-covered] > .tabline { opacity: 1; pointer-events: auto; }
.col.crowded > .pane[data-tab] > .tabline { opacity: 1; pointer-events: auto; }
/* A pane scrolled past its own title shows its tab at its top as well, over its text (Panes.tsx watchHead). */
.pane[data-scrolled] > .tabline { opacity: 1; pointer-events: auto; }
/* Its title centred between the rule across the pane's top (heavy on the active pane) and its foot. */
@@ -432,7 +435,7 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
.col[data-buried]:not([data-peek]) .pane-scroll, .col.crowded > .pane[data-buried]:not([data-peek]) > .pane-scroll { content-visibility: hidden; }
/* Peeking: a covered pane or column, the mouse resting on it, raised over its neighbours whole. */
.col[data-peek], .pane[data-peek] { z-index: 6; box-shadow: 0 3px 18px 0 var(--shade); }
.col[data-peek], .pane[data-peek] { z-index: 6; box-shadow: 0 3px 18px 0 var(--shade); outline: 1px solid var(--edge-strong); outline-offset: -1px; }
/* A pane peeking down its column is shown as tall as its text needs; the extra height takes no room, so nothing around it moves. */
.pane[data-peek-h] { height: var(--peek-h) !important; margin-bottom: calc(-1 * var(--peek-extra, 0px)); }
.col[data-peek] .spine, .col.crowded > .pane[data-peek] > .tabline { opacity: 0; pointer-events: none; }
@@ -443,14 +446,14 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
.grip { position: absolute; z-index: 3; top: 0; left: var(--spine); right: 4.6rem; height: 1.15rem; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.grip::before { content: ""; position: absolute; left: 50%; top: 0.42rem; width: 1.1rem; margin-left: -0.55rem; height: 3px; border-top: 1px solid var(--faint); border-bottom: 1px solid var(--faint); opacity: 0; transition: opacity 0.12s; }
.col.split .grip:hover::before { opacity: 0.8; }
.col:not(.split) .grip, .col.crowded > .pane[data-covered] > .grip { display: none; }
.col:not(.split) .grip, .col.crowded > .pane[data-tab] > .grip { display: none; }
.tabline { touch-action: none; }
.panes.dragging, .panes.dragging * { cursor: grabbing !important; user-select: none; }
.drop-line { position: absolute; z-index: 7; height: 2px; background: var(--link); pointer-events: none; }
/* A pane's pin and ×, top right, in the margin above its title: quiet until pointed at. A pinned pane's pin is filled. */
.pane-ctl { position: absolute; z-index: 3; top: 0.25rem; right: 0.3rem; display: flex; gap: 0.05rem; }
.col.crowded > .pane[data-covered] > .pane-ctl { top: 2px; }
.col.crowded > .pane[data-tab] > .pane-ctl { top: 2px; }
.pane-btn { display: block; width: 1.3rem; height: 1.3rem; padding: 0.3rem; border-radius: 2px; cursor: pointer; color: var(--rule); }
.pane-btn svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.pane:hover .pane-btn { color: var(--faint); }
@@ -464,12 +467,14 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
* badge is set in the same ink.
*/
.pane::after { content: ""; position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 0; background: var(--fg); pointer-events: none; }
.pane.active::after { height: 3px; }
/* The active pane: the heavy rule across its top, and its other three edges in the stronger ink (the same hairline width), over the hairlines it shares with its neighbours. */
.pane.active::after { bottom: 0; height: auto; z-index: 5; background: none; border: 1px solid var(--edge-strong); border-top: 3px solid var(--fg); }
.pane.on-branch:not(.active)::after { height: 1px; background: var(--faint); }
/* The curves: from what each pane was opened from to its title, behind nothing but in the gaps between lines. */
/* A layer of its own, so that drawing a curve again does not paint the panes under it again. */
.curves { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: hidden; }
/* Over the panes and their edges, and over a pane peeking out (whose own place the curves leave clear, Panes.tsx curves); under the menus and the selection bar (a hole in them where it is). */
.curves { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 7; pointer-events: none; overflow: hidden; }
.curves path { fill: none; stroke: var(--curve); stroke-width: 1; }
.curves path.on { stroke: var(--curve-on); }
.curves path.lost { stroke-dasharray: 1 3; }
@@ -538,7 +543,7 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
.col.crowded > .pane[data-ruled~="tab"] + .pane[data-over]::before { background: transparent; }
[data-colors="line"] .pane[data-hue] > .spine::before { content: ""; position: absolute; top: 1.72rem; left: 50%; width: 0.9rem; margin-left: -0.45rem; height: 1px; background: var(--hue-faint); }
[data-colors="line"] .pane.on-branch[data-hue] > .spine::before { background: var(--hue); }
.col.crowded > .pane[data-covered] > .spine::before { display: none; }
.col.crowded > .pane[data-tab] > .spine::before { display: none; }
/* top: under the active pane's ink rule, above the focused branch's hairline */
[data-colors="top"] .pane[data-hue] { background-image: linear-gradient(var(--hue-faint), var(--hue-faint)); background-size: 100% 2px; background-repeat: no-repeat; }
[data-colors="top"] .pane.on-branch[data-hue] { background-image: linear-gradient(var(--hue), var(--hue)); }
@@ -624,6 +629,8 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
*/
.lnk { cursor: pointer; text-decoration: underline 1px solid var(--link); text-underline-offset: 0.18em; text-decoration-skip-ink: auto; }
.lnk:hover, .lnk.on { text-decoration-thickness: 2px; }
/* A link a curve leaves from: the curve draws its underline (Panes.tsx), so the two meet exactly. */
.lnk[data-curved], .wiki-text a[data-curved] { text-decoration-color: transparent; }
.lnk.on { background: var(--wash); }
.lmark {
display: inline-block; margin: 0 0.06em 0 0.08em; font-family: var(--serif); font-size: 0.6em; line-height: 1; font-weight: 600;