Pages, from a real phone: the pane gone to has the page's height; dots for a page's panes in the trail; a 140 ms glide; the map as a tree; a held pane moves; a one-row selection bar; a tap on a link only opens it
- A shared page stacks whenever a share would cut the pane looked at short (stack.ts crowds; desktop unchanged). - Each trail step shows a dot per pane on its page, its own filled in its colour; past four, the number. - The strip glides to a page in 140 ms easing out (rAF, snapping off on the way), at once with reduced motion; a finger takes it from a glide. - The map draws tree lines from each parent into each child in the child's colour (pages.ts rails), crisp borders, deep forests indented less. - A press held on a pane's tab or the band above its title picks it up (touch), drop line and ghost, edge scroll, a second finger cancels; Move this pane up/down in the pane menu (Alt+Shift+k j). - The docked selection bar is one row: actions scroll sideways under a fade, the ⋯ and × fixed at its end. - The hover preview is the mouse's only (pointerType), dropped on any press, click or pane change; the keyboard preview is not shown on touch. 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
d3c2ea452a
commit
99aae86dff
14 files changed
+1163
-120
No files matched your search
+21
-1
@@ -28,6 +28,9 @@ const top = (more: Partial<TopCtx> = {}): TopCtx => ({ view: "auto", autolink: "
|
||||
/** Every key the page's handler takes, read from keys.ts: an item's key must be one of them. */
|
||||
const handled = new Set([...readFileSync(new URL("../src/ui/keys.ts", import.meta.url), "utf8").matchAll(/case "([^"]+)":/g)].map((m) => m[1]));
|
||||
|
||||
/** The Alt keys the page's handler takes (by the key's place: KeyH, ArrowUp…), written as the menus press them ("A-h"). */
|
||||
const altKeys = new Set([...readFileSync(new URL("../src/ui/keys.ts", import.meta.url), "utf8").matchAll(/^\s+(Key[A-Z]|Arrow\w+): \(\) =>/gm)].map((m) => `A-${m[1].startsWith("Key") ? m[1].slice(3).toLowerCase() : m[1]}`));
|
||||
|
||||
describe("actions", () => {
|
||||
it("every item with a key runs by pressing exactly that key, which the key handler takes", () => {
|
||||
const { act, calls } = recorder();
|
||||
@@ -38,6 +41,7 @@ describe("actions", () => {
|
||||
...items(nodeEntries(node({ library: true }), act)),
|
||||
...items(paneEntries({ node: node(), pinned: false }, act)),
|
||||
...items(paneEntries({ article: "Octopus", pinned: true }, act)),
|
||||
...items(paneEntries({ node: node(), pinned: false, above: true, below: true }, act)),
|
||||
...items(articleRowEntries("Octopus", true, act)),
|
||||
...items(topEntries(top({ canRedo: true }), act)),
|
||||
...items(libraryEntries({ title: "Work", current: false, last: false }, act)),
|
||||
@@ -48,7 +52,7 @@ describe("actions", () => {
|
||||
calls.length = 0;
|
||||
it.run();
|
||||
expect(calls).toEqual([`press ${it.shift ? "S-" : ""}${it.key}`]);
|
||||
expect(handled.has(it.key!) || it.key === "Escape", `${it.label}: ${it.key}`).toBe(true);
|
||||
expect(handled.has(it.key!) || it.key === "Escape" || altKeys.has(it.key!), `${it.label}: ${it.key}`).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -191,6 +195,22 @@ describe("actions", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("moving a pane in its column", () => {
|
||||
it("the pane menu offers Move this pane up and down (Alt+Shift+k j) only where its column has another pane, greyed where it cannot go", () => {
|
||||
const { act, calls } = recorder();
|
||||
expect(labels(paneEntries({ node: node(), pinned: false }, act))).not.toContain("Move this pane up");
|
||||
const es = paneEntries({ node: node(), pinned: false, above: false, below: true }, act);
|
||||
const up = find(es, "Move this pane up");
|
||||
const down = find(es, "Move this pane down");
|
||||
expect(up.disabled).toBe(true);
|
||||
expect(down.disabled).toBe(false);
|
||||
expect([up.keyText, down.keyText]).toEqual(["Alt+⇧k", "Alt+⇧j"]);
|
||||
down.run();
|
||||
expect(calls).toEqual(["press S-A-j"]);
|
||||
expect(labels(paneEntries({ article: "Octopus", pinned: false, above: true, below: false }, act))).toContain("Move this pane up");
|
||||
});
|
||||
});
|
||||
|
||||
describe("the libraries panel's state", () => {
|
||||
const lib = (id: string, title = id): LibraryInfo => ({ id, title, created: "", nodes: 0, branches: ["main"] });
|
||||
const list = [lib("a"), lib("b"), lib("c")];
|
||||
|
||||
+46
-2
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { close, open, plain, trace, type Forest } from "../src/ui/forks";
|
||||
import { arrived, findKey, loadVisits, pageAt, paneKey, paneOfPage, visit, type Visits } from "../src/ui/pages";
|
||||
import { all, close, open, plain, trace, type Forest } from "../src/ui/forks";
|
||||
import { arrived, findKey, loadVisits, mapStep, pageAt, paneKey, paneOfPage, rails, visit, type Visits } from "../src/ui/pages";
|
||||
|
||||
const same = (a: string, b: string) => a === b;
|
||||
const k = (r: string) => r;
|
||||
@@ -95,4 +95,48 @@ describe("the pages layout", () => {
|
||||
expect(v.keys).toHaveLength(200);
|
||||
expect(v.keys[v.i]).toBe("k240");
|
||||
});
|
||||
|
||||
it("the map's tree lines: a line into each child from its parent's, on toward a later sibling, through the rows between, and down from a parent to its first child", () => {
|
||||
// top ─ a ─ b
|
||||
// │ └ c
|
||||
// └ d
|
||||
let f: Forest<string> = plain(["top", "a", "b"]);
|
||||
f = open(f, 1, "c", true, same);
|
||||
f = open(f, 0, "d", true, same);
|
||||
const placed = all(f);
|
||||
const name = new Map(placed.map((x) => [x.node.id, x.node.ref]));
|
||||
const lines = rails(placed).map((rs, i) => [placed[i].node.ref, rs.map((r) => `${r.kind}@${r.level}>${name.get(r.tid)}`).sort().join(" ")]);
|
||||
expect(lines).toEqual([
|
||||
["top", "dash@0>top down@0>a"],
|
||||
["a", "down@1>b elbow@0>a on@0>d"],
|
||||
["b", "elbow@1>b on@1>c pass@0>d"],
|
||||
["c", "elbow@1>c pass@0>d"],
|
||||
["d", "elbow@0>d"],
|
||||
]);
|
||||
});
|
||||
|
||||
it("an orphan has no line into it, only its mark; its own children hang from it", () => {
|
||||
let f: Forest<string> = plain(["top", "a", "b", "e"]);
|
||||
const a = f.trees[0].kids[0];
|
||||
const b = a.kids[0];
|
||||
f = { ...f, trees: f.trees.map((t) => ({ ...t, kids: t.kids.map((k) => ({ ...k, kids: k.kids.map((x) => ({ ...x, pinned: true })) })) })) };
|
||||
const g = close(f, a.id, b.id).forest;
|
||||
expect(g.trees).toHaveLength(2);
|
||||
const placed = all(g);
|
||||
const rs = rails(placed);
|
||||
const orphan = placed.findIndex((x) => x.node.ref === "b");
|
||||
expect(placed[orphan].col).toBe(2);
|
||||
expect(rs[orphan].map((r) => `${r.kind}@${r.level}`)).toEqual(["dash@2", "down@2"]);
|
||||
const e = placed.findIndex((x) => x.node.ref === "e");
|
||||
expect(rs[e].map((r) => `${r.kind}@${r.level}`)).toEqual(["elbow@2"]);
|
||||
// Nothing from the first tree runs into the orphan's rows.
|
||||
expect(rs[orphan].some((r) => r.kind === "pass")).toBe(false);
|
||||
});
|
||||
|
||||
it("the map indents a finger's width a level, less in a deep forest, never under 8 px", () => {
|
||||
expect(mapStep(0)).toBe(16);
|
||||
expect(mapStep(8)).toBe(16);
|
||||
expect(mapStep(10)).toBe(14);
|
||||
expect(mapStep(40)).toBe(8);
|
||||
});
|
||||
});
|
||||
+25
-1
@@ -1,6 +1,6 @@
|
||||
/** The stacking shared by the panes view's strip and its crowded columns (src/ui/stack.ts). */
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { coverage, offsets, reveal, starts, whole } from "../src/ui/stack";
|
||||
import { coverage, crowds, fill, offsets, reveal, starts, whole } from "../src/ui/stack";
|
||||
|
||||
describe("stack", () => {
|
||||
it("sticks each item a strip after the one before, a pinned one its whole size, never past where the rest can still be reached", () => {
|
||||
@@ -34,4 +34,28 @@ describe("stack", () => {
|
||||
expect(whole(660, 1920, at[1], 700, 40)).toBe(true);
|
||||
expect(whole(880, 1920, at[1], 700, 40)).toBe(false);
|
||||
});
|
||||
|
||||
it("a column's height is shared: short panes take what they need, long ones share the rest", () => {
|
||||
expect(fill(700, [200, 1000])).toEqual([200, 500]);
|
||||
expect(fill(700, [1000, 1000])).toEqual([350, 350]);
|
||||
expect(fill(700, [100, 150])).toEqual([100, 600]);
|
||||
expect(fill(700, [300, 2000, 300])).toEqual([233, 234, 233]);
|
||||
});
|
||||
|
||||
it("a column stacks when its panes do not fit at their least; as pages, also whenever a share would cut the pane looked at short", () => {
|
||||
// Wide screen: shared while they fit at their least, whoever is looked at.
|
||||
expect(crowds(850, [1000, 1000], 260)).toBe(false);
|
||||
expect(crowds(850, [1000, 1000, 1000], 260)).toBe(false);
|
||||
expect(crowds(850, [1000, 1000, 1000, 1000], 260)).toBe(true);
|
||||
// As pages: the long pane looked at gets the height.
|
||||
expect(crowds(720, [1000, 1000], 260, 0)).toBe(true);
|
||||
expect(crowds(720, [1000, 1000], 260, 1)).toBe(true);
|
||||
// A short pane looked at, shown whole by the share, leaves the long one beside it.
|
||||
expect(crowds(720, [300, 1000], 260, 0)).toBe(false);
|
||||
expect(crowds(720, [300, 1000], 260, 1)).toBe(true);
|
||||
// Both whole: nothing folds.
|
||||
expect(crowds(720, [300, 350], 260, 1)).toBe(false);
|
||||
// One pane: nothing to fold.
|
||||
expect(crowds(720, [3000], 260, 0)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user