The active pane's edges: kept to the pane they are for; drawn by the pane with the curves off; tests count curves, not edges
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
9c0f4b8c02
commit
e6e4ad8d26
5 files changed
+10
-8
No files matched your search
+1
-1
@@ -52,7 +52,7 @@ const lines = (page: Page) =>
|
||||
};
|
||||
const svg = document.querySelector<SVGSVGElement>(".curves")!.getBoundingClientRect();
|
||||
const box = { left: Math.round(svg.left), top: Math.round(svg.top) };
|
||||
return [...document.querySelectorAll<SVGPathElement>(".curves path:not(.foot)")].map((p) => {
|
||||
return [...document.querySelectorAll<SVGPathElement>(".curves path:not(.foot):not(.frame)")].map((p) => {
|
||||
const pe = document.querySelector<HTMLElement>(`.pane[data-tid="${p.dataset.to}"]`)!;
|
||||
const a = p.getPointAtLength(0);
|
||||
const b = p.getPointAtLength(p.getTotalLength());
|
||||
|
||||
+2
-2
@@ -315,7 +315,7 @@ test("a curve per open edge, from where each pane was opened to its title; it fo
|
||||
// The focused branch (Two kinds of cell → Complex cells) in its own ink; the others not.
|
||||
expect(edge("Two kinds of cell", "Complex cells")[0].cls).toContain("on");
|
||||
expect(edge("Two kinds of cell", "Simple cells")[0].cls).not.toContain("on");
|
||||
expect(await page.locator(".curves path.on").first().evaluate((el) => getComputedStyle(el).stroke)).not.toBe(await page.locator(".curves path:not(.on)").first().evaluate((el) => getComputedStyle(el).stroke));
|
||||
expect(await page.locator(".curves path.on").first().evaluate((el) => getComputedStyle(el).stroke)).not.toBe(await page.locator(".curves path:not(.on):not(.frame)").first().evaluate((el) => getComputedStyle(el).stroke));
|
||||
// Scroll Eukaryote's text: the curve out of it moves with its link.
|
||||
const before = edge("Eukaryote", "Bacteria")[0].a;
|
||||
await pane(page, "Eukaryote").locator(".pane-scroll").evaluate((el) => (el.scrollTop = 40));
|
||||
@@ -402,7 +402,7 @@ test("curves down one gutter take lanes of their own, side by side, up to as man
|
||||
for (let i = 0; i < 10; i++) await keys(page, "j Enter");
|
||||
await still(page);
|
||||
const runs = await page.evaluate(() =>
|
||||
[...document.querySelectorAll<SVGPathElement>(".curves path")].map((p) => {
|
||||
[...document.querySelectorAll<SVGPathElement>(".curves path:not(.frame)")].map((p) => {
|
||||
const v = /C[^C]*?([\d.]+) [\d.]+V/.exec(p.getAttribute("d")!);
|
||||
return { lane: Number(p.dataset.lane), x: v ? Number(v[1]) : NaN };
|
||||
}),
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ test("every pane of a crowded column shows at least its tab, above or below the
|
||||
for (const c of centred) expect(c.off).toBeLessThanOrEqual(1.5);
|
||||
// The curve becomes a tab's line where it meets it: no stub of it before the meeting.
|
||||
const stubs = await page.evaluate(() =>
|
||||
[...document.querySelectorAll<SVGPathElement>(".curves path:not(.foot)")].filter((p) => {
|
||||
[...document.querySelectorAll<SVGPathElement>(".curves path:not(.foot):not(.frame)")].filter((p) => {
|
||||
const pe = document.querySelector<HTMLElement>(`.pane[data-tid="${p.dataset.to}"]`);
|
||||
return pe?.dataset.ruled?.includes("tab") && (p.getAttribute("d")!.match(/M/g) ?? []).length > 1;
|
||||
}).length,
|
||||
@@ -310,7 +310,7 @@ test("a dotted curve to a source out of sight in its pane turns, at its end, tow
|
||||
const lib = pane(page, "Library").locator(".pane-scroll");
|
||||
const lead = async () =>
|
||||
page.evaluate(() => {
|
||||
const p = [...document.querySelectorAll<SVGPathElement>(".curves path:not(.foot)")].find((x) => x.classList.contains("lost"));
|
||||
const p = [...document.querySelectorAll<SVGPathElement>(".curves path:not(.foot):not(.frame)")].find((x) => x.classList.contains("lost"));
|
||||
if (!p) return null;
|
||||
const a = p.getPointAtLength(0);
|
||||
const b = p.getPointAtLength(8);
|
||||
|
||||
+3
-3
@@ -832,7 +832,7 @@ export function Panes() {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div class="panes" data-colors={store.settings.colors}>
|
||||
<div class="panes" data-colors={store.settings.colors} data-curves={store.settings.curves ? undefined : "off"}>
|
||||
<div class="strip" ref={strip}>
|
||||
{order.map((c) => {
|
||||
const items = cols.get(c)!;
|
||||
@@ -1204,9 +1204,9 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) {
|
||||
if (!p) {
|
||||
p = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
p.dataset.key = c.key;
|
||||
p.dataset.from = String(c.from);
|
||||
p.dataset.to = String(c.to);
|
||||
}
|
||||
if (p.dataset.from !== String(c.from)) p.dataset.from = String(c.from);
|
||||
if (p.dataset.to !== String(c.to)) p.dataset.to = String(c.to);
|
||||
if (p.getAttribute("d") !== c.d) p.setAttribute("d", c.d);
|
||||
if (p.getAttribute("class") !== c.cls) p.setAttribute("class", c.cls);
|
||||
if (p.dataset.lane !== String(c.lane)) p.dataset.lane = String(c.lane);
|
||||
|
||||
@@ -470,6 +470,8 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
|
||||
/* The active pane: the heavy rule across its top; its other three edges in the stronger ink are drawn with the curves (Panes.tsx), over the hairlines it shares with its neighbours, so a move from pane to pane repaints only those lines. */
|
||||
.pane.active::after { height: 3px; }
|
||||
.panes .curves path.frame.frame { stroke: var(--edge-strong); fill: none; stroke-dasharray: none; }
|
||||
/* With the curves off, the pane draws them itself. */
|
||||
.panes[data-curves="off"] .pane.active::after { bottom: 0; height: auto; 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. */
|
||||
|
||||
Reference in new issue
Block a user