Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

thinkterm-web ui: takeover surface, drag and drop, panel polish

RoversX8b9a2b80911a
diff --git a/thinkterm-web/smoke/agents-test.js b/thinkterm-web/smoke/agents-test.js
index 0df496a4..babfa45c 100644
--- a/thinkterm-web/smoke/agents-test.js
+++ b/thinkterm-web/smoke/agents-test.js
@@ -29,7 +29,7 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
const click = (sel) => ev(`(() => { const el = document.querySelector(${JSON.stringify(sel)}); if (!el) return false; el.click(); return true; })()`);
const mouse = (type, x, y, extra = {}) => send("Input.dispatchMouseEvent", { type, x, y, button: "left", clickCount: 1, ...extra }, s);
const fail = (what) => { throw new Error(what); };
- const attached = async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''"));
+ const attached = async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''"));
const canvasWidth = () => ev("document.querySelector('canvas#term').getBoundingClientRect().width");
const agentsW = () => ev("getComputedStyle(document.documentElement).getPropertyValue('--agents-w').trim()");
// The switch lives in the settings panel; the gear opens it, and the
@@ -58,12 +58,12 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
if (!(await ev("document.body.hasAttribute('data-agents')"))) fail("the body carries no data-agents mark");
if (!(await ev("document.querySelector('#tabs [data-action=agents]').classList.contains('on')"))) fail("the tab row's button does not show the panel is on");
out.width = await agentsW();
- if (out.width !== "260px") fail("the panel did not open at its default width: " + out.width);
+ if (out.width !== "300px") fail("the panel did not open at its default width: " + out.width);
out.summary = await ev("document.querySelector('#agents .hd .sum').textContent");
if (out.summary !== "No agents detected") fail("the header does not carry the wasm's summary: " + JSON.stringify(out.summary));
out.title = await ev("document.querySelector('#agents .hd .ti').textContent");
if (out.title !== "Agents") fail("the header is not titled: " + JSON.stringify(out.title));
- await until("the terminal to give up the room", async () => Math.abs(wide - (await canvasWidth()) - 260) < 1);
+ await until("the terminal to give up the room", async () => Math.abs(wide - (await canvasWidth()) - 300) < 1);
out.canvas_with = await canvasWidth();
out.panel = "ok";
@@ -76,9 +76,12 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
const el = document.elementFromPoint(x, 400);
return { x, on: el ? (el.className || el.id || el.tagName) : null }; })()`);
if (grab.on !== "handle") fail(`${grab.x},400 is not the handle but ` + JSON.stringify(grab.on));
- // 40 px further left is 40 px more panel; the pointer's distance from the
+ // 60 px further left is 60 px more panel; the pointer's distance from the
// right edge is the width, so this is where it has to end up.
- const target = (await ev("window.innerWidth")) - 300;
+ const target = (await ev("window.innerWidth")) - 360;
+ // The backing store follows the panel's opening by a frame or two; let
+ // that settle, or the opening resize is counted against the drag.
+ await sleep(600);
// Every change of the canvas's backing store, which is what one terminal
// resize costs; the count is read before the release and after it.
await ev(`(() => { const c = document.querySelector('canvas#term'); window.__resizes = 0; window.__last = c.width;
@@ -95,11 +98,11 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
out.resizes_after_release = (await ev("window.__resizes")) - out.resizes_during_drag;
out.agents_w = await agentsW();
out.stored = await ev("localStorage.getItem('thinkterm.agents-width')");
- if (midWidth !== "300px") fail("the panel did not follow the pointer: " + midWidth);
- if (out.resizes_during_drag !== 0) fail("the terminal was resized " + out.resizes_during_drag + " times during the drag");
- if (out.resizes_after_release !== 1) fail("the release should resize the terminal exactly once, not " + out.resizes_after_release);
- if (out.agents_w !== "300px") fail("the width ended at " + out.agents_w);
- if (out.stored !== "300") fail("the width stored is " + JSON.stringify(out.stored));
+ if (midWidth !== "360px") fail("the panel did not follow the pointer: " + midWidth);
+ if (out.resizes_during_drag < 1) fail("the terminal did not follow the drag");
+ if (out.resizes_after_release > 1) fail("the release resized the terminal " + out.resizes_after_release + " times");
+ if (out.agents_w !== "360px") fail("the width ended at " + out.agents_w);
+ if (out.stored !== "360") fail("the width stored is " + JSON.stringify(out.stored));
out.drag = "ok";
const shot = await send("Page.captureScreenshot", { format: "png" }, s); fs.writeFileSync(outPng, Buffer.from(shot.data, "base64"));
@@ -115,7 +118,7 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
// --- (d) the tab row's button is the same switch.
if (!(await click("#tabs [data-action=agents]"))) fail("no agents button in the tab row");
await until("the panel again", () => ev("!!document.getElementById('agents')"));
- if ((await agentsW()) !== "300px") fail("the panel did not come back at the width it was dragged to");
+ if ((await agentsW()) !== "360px") fail("the panel did not come back at the width it was dragged to");
if (!(await ev("JSON.parse(window.thinkterm.client.settings())['agents-panel']")))
fail("the button did not put the preference on");
await click("#tabs [data-action=agents]");
diff --git a/thinkterm-web/smoke/dnd-test.js b/thinkterm-web/smoke/dnd-test.js
new file mode 100644
index 00000000..e5df189d
--- /dev/null
+++ b/thinkterm-web/smoke/dnd-test.js
@@ -0,0 +1,126 @@
+// End-to-end check of the page's drag and drop, driven through dnd.sh (not
+// part of the served bundle). Two threads made through the panel: dragging
+// the second above the first reorders the tree. Two tabs in the window:
+// dragging the second before the first reorders the strip. A split pane:
+// dragging one capsule onto the other pane's right half rearranges the
+// layout (read from `canvas.dataset.layout`). Each drag is photographed
+// mid-flight, with its ghost and either its insertion line or its overlay.
+//
+// node dnd-test.js <url> <cli prefix> <out.png>
+//
+// `cli prefix` is a `thinkterm cli` pinned to the same server. Needs the
+// `ws` npm package on NODE_PATH and Google Chrome installed.
+const { spawn } = require("child_process");
+const http = require("http"); const fs = require("fs"); const os = require("os"); const path = require("path");
+const WebSocket = require("ws");
+const [url, cli, outPng] = process.argv.slice(2);
+void cli;
+const chromePath = process.env.CHROME || "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
+const port = 9333 + Math.floor(Math.random() * 500);
+setTimeout(() => { console.error("watchdog"); try { chrome.kill(); } catch {} process.exit(4); }, 150000).unref();
+const profile = fs.mkdtempSync(`${os.tmpdir()}/tt-dnd-`);
+const chrome = spawn(chromePath, ["--headless=new", "--no-first-run", `--remote-debugging-port=${port}`, `--user-data-dir=${profile}`, "--window-size=1400,800", "--hide-scrollbars", "--enable-unsafe-webgpu", "about:blank"], { stdio: "ignore" });
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+async function browserWs() { for (let i = 0; i < 50; i++) { try { return await new Promise((res, rej) => http.get(`http://127.0.0.1:${port}/json/version`, (r) => { let b = ""; r.on("data", (d) => b += d); r.on("end", () => res(JSON.parse(b).webSocketDebuggerUrl)); }).on("error", rej)); } catch { await sleep(200); } } throw new Error("chrome did not come up"); }
+(async () => {
+ const ws = new WebSocket(await browserWs()); await new Promise((r) => ws.on("open", r));
+ let id = 0; const waiting = new Map(); const logs = [];
+ ws.on("message", (m) => { const msg = JSON.parse(m); if (msg.id && waiting.has(msg.id)) { waiting.get(msg.id)(msg.result || msg.error); waiting.delete(msg.id); }
+ if (msg.method === "Runtime.consoleAPICalled") logs.push(msg.params.args.map((a) => a.value ?? a.description).join(" "));
+ if (msg.method === "Runtime.exceptionThrown") logs.push("EXCEPTION " + JSON.stringify(msg.params.exceptionDetails.exception?.description || msg.params.exceptionDetails.text)); });
+ const send = (method, params = {}, sessionId) => new Promise((r) => { const i = ++id; waiting.set(i, r); ws.send(JSON.stringify({ id: i, method, params, sessionId })); });
+ const { targetId } = await send("Target.createTarget", { url: "about:blank" });
+ const s = (await send("Target.attachToTarget", { targetId, flatten: true })).sessionId;
+ await send("Runtime.enable", {}, s); await send("Page.enable", {}, s);
+ const ev = async (expr) => (await send("Runtime.evaluate", { expression: expr, returnByValue: true }, s)).result?.value;
+ const rows = async () => JSON.parse(await ev("document.getElementById('side')?.dataset.rows || '[]'"));
+ const threads = async () => (await rows()).filter((r) => r.kind === "thread");
+ const layout = async () => JSON.parse(await ev("document.getElementById('term').dataset.layout || '{}'"));
+ const until = async (what, fn, ms = 15000) => { const t = Date.now(); while (Date.now() - t < ms) { const v = await fn(); if (v) return v; await sleep(120); } throw new Error("timeout waiting for " + what); };
+ const click = (sel) => ev(`(() => { const el = document.querySelector(${JSON.stringify(sel)}); if (!el) return false; el.click(); return true; })()`);
+ const rect = async (sel) => ev(`(() => { const el = document.querySelector(${JSON.stringify(sel)}); if (!el) return null; const r = el.getBoundingClientRect(); return [r.left + r.width / 2, r.top + r.height / 2, r.left, r.top, r.width, r.height]; })()`);
+ const mouse = (type, x, y, buttons) => send("Input.dispatchMouseEvent", { type, x, y, button: "left", buttons, clickCount: 1 }, s);
+ const shot = async (name) => { const png = await send("Page.captureScreenshot", { format: "png" }, s); fs.writeFileSync(path.join(path.dirname(outPng), name), Buffer.from(png.data, "base64")); return name; };
+ const fail = (what) => { throw new Error(what); };
+ const out = {};
+
+ /** Press at `from`, walk to `to` in steps so the page sees a drag, take a
+ picture with the drag still up, then let go. */
+ const dragTo = async (from, to, name) => {
+ await mouse("mousePressed", from[0], from[1], 1);
+ for (let i = 1; i <= 6; i++) {
+ await mouse("mouseMoved", from[0] + ((to[0] - from[0]) * i) / 6, from[1] + ((to[1] - from[1]) * i) / 6, 1);
+ await sleep(40);
+ }
+ await sleep(200);
+ const seen = await ev("(() => { const g = document.querySelector('#dnd .ghost'); const l = document.querySelector('#dnd .line'); const z = document.querySelector('#dnd .zone'); return { ghost: !!g, line: !!l, zone: !!z }; })()");
+ const file = name ? await shot(name) : null;
+ await mouse("mouseReleased", to[0], to[1], 0);
+ return { ...seen, shot: file };
+ };
+
+ await send("Page.navigate", { url }, s);
+ await until("attach", async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''")), 25000);
+ await sleep(800);
+
+ // --- two threads in one project, made through the panel
+ await click("[data-action=new-thread]");
+ const first = await until("first thread", async () => (await threads()).find((t) => t.selected));
+ await click("[data-action=new-thread]");
+ const second = await until("second thread", async () => (await threads()).find((t) => t.id !== first.id && t.project === first.project));
+ await until("both on show", async () => (await threads()).filter((t) => t.project === first.project).length === 2);
+ const order = async () => (await threads()).filter((t) => t.project === first.project).map((t) => t.id);
+ const before = await order();
+ if (before[0] !== first.id) fail("the threads did not start in the order they were made: " + JSON.stringify(before));
+
+ // --- drag the second thread above the first
+ const sel = (id) => `#side .row.thread[data-thread="${id}"]`;
+ const src = await rect(sel(second.id));
+ const dst = await rect(sel(first.id));
+ out.thread_drag = await dragTo([src[0], src[1]], [dst[0], dst[3] + 3], "dnd-sidebar.png");
+ if (!out.thread_drag.ghost || !out.thread_drag.line) fail("no ghost or insertion line mid-drag: " + JSON.stringify(out.thread_drag));
+ await until("the tree reordered", async () => (await order())[0] === second.id);
+ out.threads = { before, after: await order() };
+
+ // --- two tabs in this window, the second dragged before the first
+ await click("[data-action=new-tab]");
+ await until("two tabs", () => ev("document.querySelectorAll('#tabs .tab').length === 2"));
+ await sleep(500);
+ const strip = () => ev("Array.from(document.querySelectorAll('#tabs .tab')).map((t) => t.dataset.tab).join(',')");
+ const tabsBefore = await strip();
+ const ids = tabsBefore.split(",");
+ const tabSrc = await rect(`#tabs .tab[data-tab="${ids[1]}"]`);
+ const tabDst = await rect(`#tabs .tab[data-tab="${ids[0]}"]`);
+ out.tab_drag = await dragTo([tabSrc[0], tabSrc[1]], [tabDst[2] + 4, tabDst[1]], "dnd-tabs.png");
+ if (!out.tab_drag.ghost || !out.tab_drag.line) fail("no ghost or insertion line over the strip: " + JSON.stringify(out.tab_drag));
+ await until("the strip reordered", async () => (await strip()) === ids[1] + "," + ids[0], 20000);
+ out.tabs = { before: tabsBefore, after: await strip() };
+
+ // --- a split, then one capsule dropped on the other pane's right half
+ await click("[data-action=split-right]");
+ await until("two panes", async () => ((await layout()).panes || []).length === 2, 12000);
+ await sleep(600);
+ let l = await layout();
+ const [left, right] = l.panes[0].left < l.panes[1].left ? [l.panes[0], l.panes[1]] : [l.panes[1], l.panes[0]];
+ const arrangement = (lay) => lay.panes.slice().sort((a, b) => a.left - b.left).map((p) => p.id).join(",");
+ const panesBefore = arrangement(l);
+ const cap = await rect(`#panes .nav[data-nav="${left.id}"] .cap[data-pane="${left.id}"]`);
+ const box = await ev("(r => [r.left, r.top])(document.getElementById('term').getBoundingClientRect())");
+ // Three quarters across the right pane, below its bar: its right half.
+ const tx = box[0] + (right.left + right.cols * 0.8) * l.cell[0];
+ const ty = box[1] + (right.top + right.rows * 0.5) * l.cell[1];
+ out.pane_drag = await dragTo([cap[0], cap[1]], [tx, ty], "dnd-pane.png");
+ if (!out.pane_drag.ghost || !out.pane_drag.zone) fail("no ghost or drop overlay over the pane: " + JSON.stringify(out.pane_drag));
+ await until("the layout rearranged", async () => { const now = await layout(); return (now.panes || []).length === 2 && arrangement(now) !== panesBefore; }, 20000);
+ l = await layout();
+ out.panes = { before: panesBefore, after: arrangement(l) };
+
+ // --- the terminal still has the keyboard after a drop
+ if (!(await ev("document.activeElement && document.activeElement.id === 'kbd'"))) fail("the terminal lost the keyboard after a drop");
+ out.focus = "kbd";
+
+ await shot(path.basename(outPng));
+ out.logs = logs.filter((x) => !/^\s*$/.test(x) && !/INFO/.test(x)).slice(-6);
+ console.log(JSON.stringify(out));
+ ws.close(); chrome.kill(); process.exit(0);
+})().catch((e) => { console.error(e); chrome.kill(); process.exit(1); });
diff --git a/thinkterm-web/smoke/dnd.sh b/thinkterm-web/smoke/dnd.sh
new file mode 100755
index 00000000..4c3fcfce
--- /dev/null
+++ b/thinkterm-web/smoke/dnd.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Drag and drop, end to end: a release server under a throwaway HOME, the
+# release bundle, headless Chrome. Two threads are reordered in the panel,
+# two tabs in the strip, and a pane is dropped on another pane's half.
+#
+# NODE_PATH=<dir with node_modules/ws> thinkterm-web/smoke/dnd.sh [out.png]
+#
+# Prints the JSON dnd-test.js produces; exit status is the test's. The
+# mid-drag screenshots land beside the one named here.
+set -eu
+cd "$(dirname "$0")/../.."
+REPO=$PWD
+BIN=${CARGO_TARGET_DIR:-$REPO/target}/release
+PORT=18105
+OUT=${1:-/tmp/thinkterm-dnd.png}
+if lsof -nP -t -i :$PORT >/dev/null 2>&1; then echo "port $PORT busy" >&2; exit 1; fi
+REAL_HOME=$HOME
+T=$(mktemp -d "${TMPDIR:-/tmp}/tt-dnd.XXXXXX")
+cat > "$T/web.lua" <<LUA
+return { web_servers = { { bind_address = "127.0.0.1:$PORT" } } }
+LUA
+export HOME="$T/home"; mkdir -p "$HOME"
+export THINKTERM_NO_PRIVACY_DISCLAIM=1
+export THINKTERM_WEB_STATIC_DIR="$REPO/thinkterm-web/www"
+"$BIN/thinkterm-mux-server" --config-file "$T/web.lua" --daemonize
+i=0; until curl -s -o /dev/null "http://127.0.0.1:$PORT/"; do i=$((i+1)); [ $i -lt 50 ] || { echo "server did not come up" >&2; exit 1; }; sleep 0.2; done
+# Pinned to this server: without --prefer-mux and this HOME the CLI would
+# reach a running GUI instead.
+CLI="env HOME=$HOME THINKTERM_NO_PRIVACY_DISCLAIM=1 $BIN/thinkterm --config-file $T/web.lua cli --prefer-mux --no-auto-start"
+$CLI spawn --window-id 0 >/dev/null
+URL=$($CLI web-token mint --label dnd --ttl 1h --url-only 2>/dev/null | head -1)
+status=0
+HOME=$REAL_HOME node "$REPO/thinkterm-web/smoke/dnd-test.js" "$URL" "$CLI" "$OUT" || status=$?
+for p in $(pgrep -f "$T/web.lua" || true); do kill "$p"; done
+# The server may still be closing its files; a leftover directory is not
+# worth a failure.
+sleep 0.5
+rm -rf "$T" 2>/dev/null || true
+exit $status
diff --git a/thinkterm-web/smoke/handoff-test.js b/thinkterm-web/smoke/handoff-test.js
new file mode 100644
index 00000000..ff50d9be
--- /dev/null
+++ b/thinkterm-web/smoke/handoff-test.js
@@ -0,0 +1,52 @@
+// Two pages on one server: A switches the server to Handoff and holds the
+// terminal; B sees the full-area card naming A's host, presses its button,
+// and gets the terminal; A then sees the card. node card-test.js <urlA> <urlB> <cli> <out.png>
+const { spawn, execSync } = require("child_process");
+const http = require("http"); const fs = require("fs"); const os = require("os");
+const WebSocket = require("ws");
+const [urlA, urlB, cli, outPng] = process.argv.slice(2);
+const chromePath = process.env.CHROME || "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
+const port = 9333 + Math.floor(Math.random() * 500);
+setTimeout(() => { console.error("watchdog"); try { chrome.kill(); } catch {} process.exit(4); }, 60000).unref();
+const profile = fs.mkdtempSync(`${os.tmpdir()}/tt-card-`);
+const chrome = spawn(chromePath, ["--headless=new", "--no-first-run", `--remote-debugging-port=${port}`, `--user-data-dir=${profile}`, "--window-size=1100,700", "--hide-scrollbars", "--enable-unsafe-webgpu", "about:blank"], { stdio: "ignore" });
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+async function browserWs() { for (let i = 0; i < 50; i++) { try { return await new Promise((res, rej) => http.get(`http://127.0.0.1:${port}/json/version`, (r) => { let b = ""; r.on("data", (d) => b += d); r.on("end", () => res(JSON.parse(b).webSocketDebuggerUrl)); }).on("error", rej)); } catch { await sleep(200); } } throw new Error("chrome did not come up"); }
+(async () => {
+ const ws = new WebSocket(await browserWs()); await new Promise((r) => ws.on("open", r));
+ let id = 0; const waiting = new Map(); const logs = [];
+ ws.on("message", (m) => { const msg = JSON.parse(m); if (msg.id && waiting.has(msg.id)) { waiting.get(msg.id)(msg.result || msg.error); waiting.delete(msg.id); }
+ if (msg.method === "Runtime.consoleAPICalled") logs.push(msg.params.args.map((a) => a.value ?? a.description).join(" "));
+ if (msg.method === "Runtime.exceptionThrown") logs.push("EXCEPTION " + JSON.stringify(msg.params.exceptionDetails.exception?.description || msg.params.exceptionDetails.text)); });
+ const send = (method, params = {}, sessionId) => new Promise((r) => { const i = ++id; waiting.set(i, r); ws.send(JSON.stringify({ id: i, method, params, sessionId })); });
+ const page = async (url) => {
+ const { targetId } = await send("Target.createTarget", { url: "about:blank" });
+ const s = (await send("Target.attachToTarget", { targetId, flatten: true })).sessionId;
+ await send("Runtime.enable", {}, s); await send("Page.enable", {}, s);
+ const ev = async (expr) => (await send("Runtime.evaluate", { expression: expr, returnByValue: true }, s)).result?.value;
+ const until = async (what, expr, ms = 10000) => { const t = Date.now(); while (Date.now() - t < ms) { const v = await ev(expr); if (v) return v; await sleep(100); } throw new Error("timeout waiting for " + what + ": " + JSON.stringify({ status: await ev("document.getElementById('status')?.dataset.summary"), card: await ev("JSON.stringify(JSON.parse(window.thinkterm.client.status()).card)") })); };
+ await send("Page.navigate", { url }, s);
+ await until("attach", "/this browser has|mirroring|another device/.test((document.getElementById('status')?.dataset.summary || ''))", 20000);
+ return { s, ev, until };
+ };
+ const card = "JSON.parse(window.thinkterm.client.status()).card";
+ const out = {};
+ const A = await page(urlA);
+ // A takes the server into Handoff through the tab menu's action.
+ out.a_switch = await A.ev("JSON.parse(window.thinkterm.client.menu_action('access:handoff')).handled");
+ await A.until("A owns in handoff", "/this browser has/.test(document.getElementById('status').dataset.summary)");
+ out.a_card_before = await A.ev(`${card}`);
+ const B = await page(urlB);
+ out.b_card = await B.until("B sees the card", `${card} && ${card}.state === 'busy' && ${card}`);
+ out.b_card_box = await B.ev("(() => { const c = document.getElementById('card'); const t = document.getElementById('term'); const r = c.getBoundingClientRect(), q = t.getBoundingClientRect(); return { covers: Math.abs(r.left - q.left) < 1 && Math.abs(r.width - q.width) < 1 && Math.abs(r.height - q.height) < 1, hidden: c.hidden, bg: getComputedStyle(c).backgroundColor, button: c.querySelector('.go')?.textContent }; })()");
+ await sleep(600);
+ out.b_text = await B.ev("(() => { const t = document.querySelector('#card .title'); const cs = getComputedStyle(t); return { text: t.textContent, w: t.offsetWidth, h: t.offsetHeight, color: cs.color, font: cs.font, vis: cs.visibility, op: cs.opacity, cardOp: getComputedStyle(document.getElementById('card')).opacity, anim: getComputedStyle(document.getElementById('card')).animationName }; })()");
+ const shot = await send("Page.captureScreenshot", { format: "png" }, B.s); fs.writeFileSync(outPng, Buffer.from(shot.data, "base64"));
+ await B.ev("document.querySelector('#card .go').click(); 1");
+ out.b_owns = await B.until("B got it", `${card} === null && /this browser has/.test(document.getElementById('status').dataset.summary)`) && "ok";
+ out.a_card_after = await A.until("A sees the card", `${card} && ${card}.state === 'busy' && ${card}`);
+ out.a_hidden = await A.ev("document.getElementById('card').hidden");
+ out.logs = logs.filter((l) => !/INFO/.test(l)).slice(-5);
+ console.log(JSON.stringify(out));
+ ws.close(); chrome.kill(); process.exit(0);
+})().catch((e) => { console.error(e); chrome.kill(); process.exit(1); });
diff --git a/thinkterm-web/smoke/handoff.sh b/thinkterm-web/smoke/handoff.sh
new file mode 100755
index 00000000..dd527837
--- /dev/null
+++ b/thinkterm-web/smoke/handoff.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# The tab strip, end to end: a release server with two tabs under a
+# throwaway HOME, the release bundle, headless Chrome.
+#
+# NODE_PATH=<dir with node_modules/ws> thinkterm-web/smoke/tabs.sh [out.png]
+#
+# Prints the JSON tabs-test.js produces; exit status is the test's.
+set -eu
+cd "$(dirname "$0")/../.."
+REPO=$PWD
+BIN=${CARGO_TARGET_DIR:-$REPO/target}/release
+PORT=18107
+OUT=${1:-/tmp/thinkterm-tabs.png}
+if lsof -nP -t -i :$PORT >/dev/null 2>&1; then echo "port $PORT busy" >&2; exit 1; fi
+REAL_HOME=$HOME
+T=$(mktemp -d "${TMPDIR:-/tmp}/tt-handoff.XXXXXX")
+cat > "$T/web.lua" <<LUA
+return { web_servers = { { bind_address = "127.0.0.1:$PORT" } } }
+LUA
+export HOME="$T/home"; mkdir -p "$HOME"
+export THINKTERM_NO_PRIVACY_DISCLAIM=1
+export THINKTERM_WEB_STATIC_DIR="$REPO/thinkterm-web/www"
+"$BIN/thinkterm-mux-server" --config-file "$T/web.lua" --daemonize
+i=0; until curl -s -o /dev/null "http://127.0.0.1:$PORT/"; do i=$((i+1)); [ $i -lt 50 ] || { echo "server did not come up" >&2; exit 1; }; sleep 0.2; done
+# Pinned to this server: without --prefer-mux and this HOME the CLI would
+# reach a running GUI instead.
+CLI="env HOME=$HOME THINKTERM_NO_PRIVACY_DISCLAIM=1 $BIN/thinkterm --config-file $T/web.lua cli --prefer-mux --no-auto-start"
+$CLI spawn --window-id 0 >/dev/null
+URL=$($CLI web-token mint --label a --ttl 1h --url-only 2>/dev/null | head -1)
+status=0
+HOME=$REAL_HOME node "$REPO/thinkterm-web/smoke/handoff-test.js" "$URL" "$($CLI web-token mint --label b --ttl 1h --url-only 2>/dev/null | head -1)" "$CLI" "$OUT" || status=$?
+for p in $(pgrep -f "$T/web.lua" || true); do kill "$p"; done
+# The server may still be closing its files; a leftover directory is not
+# worth a failure.
+sleep 0.5
+rm -rf "$T" 2>/dev/null || true
+exit $status
diff --git a/thinkterm-web/smoke/menus-test.js b/thinkterm-web/smoke/menus-test.js
index 43a23058..af04481c 100644
--- a/thinkterm-web/smoke/menus-test.js
+++ b/thinkterm-web/smoke/menus-test.js
@@ -52,7 +52,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
const out = {};
await send("Page.navigate", { url }, s);
- await until("attach", async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
+ await until("attach", async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
await sleep(900);
// --- (a) the pane's menu, from a right-click in the terminal itself.
diff --git a/thinkterm-web/smoke/mobile-test.js b/thinkterm-web/smoke/mobile-test.js
index d8c56c2d..ddda5b10 100644
--- a/thinkterm-web/smoke/mobile-test.js
+++ b/thinkterm-web/smoke/mobile-test.js
@@ -21,7 +21,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
/** The phone the page is emulated on. */
const PHONE = { width: 390, height: 844, deviceScaleFactor: 3, mobile: true };
/** The key bar's height, as tokens.css and mobile.svelte.ts have it. */
-const BAR = 44;
+const BAR = 52;
(async () => {
const ws = new WebSocket(await browserWs()); await new Promise((r) => ws.on("open", r));
@@ -68,7 +68,7 @@ const BAR = 44;
await send("Emulation.setDeviceMetricsOverride", PHONE, s);
await send("Emulation.setTouchEmulationEnabled", { enabled: true }, s);
await send("Page.navigate", { url }, s);
- await until("attach", async () => /this browser has|mirroring|following/.test(await summary()), 25000);
+ await until("attach", async () => /this browser has/.test(await summary()), 25000);
await sleep(900);
// --- (a) the shape: the mark on the body, the bar at the foot of the
@@ -84,7 +84,7 @@ const BAR = 44;
if (Math.abs(bar.height - BAR) > 1) fail("the key bar is " + bar.height + " tall");
if (bar.keys !== 17) fail("the key bar has " + bar.keys + " keys");
const box = await ev(`(() => { const r = document.getElementById('term').getBoundingClientRect();
- const tabs = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--tabs'));
+ const tabs = parseFloat(getComputedStyle(document.body).getPropertyValue('--tabs'));
return { height: r.height, want: window.innerHeight - tabs - ${BAR}, width: r.width, inner: window.innerWidth }; })()`);
if (Math.abs(box.height - box.want) > 2) fail("the canvas is " + box.height + " tall, not " + box.want);
if (Math.abs(box.width - box.inner) > 1) fail("the canvas is " + box.width + " wide, not the window's " + box.inner);
@@ -158,7 +158,7 @@ const BAR = 44;
await touch("touchEnd", []);
await until("the drawer out", () => ev("!!document.querySelector('#side.open')"), 3000);
const drawer = await ev("(() => { const r = document.getElementById('side').getBoundingClientRect(); return { w: r.width, top: r.top, bottom: r.bottom }; })()");
- if (!(drawer.w > 0 && drawer.w <= 300)) fail("the drawer is " + drawer.w + " wide");
+ if (!(drawer.w > 0 && drawer.w <= 320)) fail("the drawer is " + drawer.w + " wide");
if (!(await ev("!!document.getElementById('scrim')"))) fail("no backdrop behind the drawer");
await tap(360, 420);
await until("the drawer away", () => ev("!document.querySelector('#side.open')"), 3000);
@@ -173,7 +173,7 @@ const BAR = 44;
const labels = await ev("Array.from(document.querySelectorAll('.menu .mi .lb')).map((e) => e.textContent)");
if (labels[0] !== "Copy") fail("the long press opened " + JSON.stringify(labels));
const row = await ev("(() => { const r = document.querySelector('.menu .mi').getBoundingClientRect(); return r.height; })()");
- if (Math.abs(row - 40) > 1) fail("a menu row is " + row + " tall, not the 40 a finger needs");
+ if (Math.abs(row - 44) > 1) fail("a menu row is " + row + " tall, not the 44 a finger needs");
out.longpress = "ok";
const shot = await send("Page.captureScreenshot", { format: "png" }, s); fs.writeFileSync(outPng, Buffer.from(shot.data, "base64"));
diff --git a/thinkterm-web/smoke/palette-test.js b/thinkterm-web/smoke/palette-test.js
index 04d1407d..72801f76 100644
--- a/thinkterm-web/smoke/palette-test.js
+++ b/thinkterm-web/smoke/palette-test.js
@@ -50,7 +50,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
const out = {};
await send("Page.navigate", { url }, s);
- await until("attach", async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
+ await until("attach", async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
await sleep(900);
// --- two threads to find: the server's landing one, named "main", and a
diff --git a/thinkterm-web/smoke/settings-test.js b/thinkterm-web/smoke/settings-test.js
index 3137409f..c68a55e0 100644
--- a/thinkterm-web/smoke/settings-test.js
+++ b/thinkterm-web/smoke/settings-test.js
@@ -30,7 +30,7 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
const until = async (what, fn, ms = 12000) => { const t = Date.now(); while (Date.now() - t < ms) { const v = await fn(); if (v) return v; await sleep(120); } throw new Error("timeout waiting for " + what + ": settings=" + JSON.stringify(await settings()) + " layout=" + JSON.stringify(await layout())); };
const click = (sel) => ev(`(() => { const el = document.querySelector(${JSON.stringify(sel)}); if (!el) return false; el.click(); return true; })()`);
const fail = (what) => { throw new Error(what); };
- const attached = async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''"));
+ const attached = async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''"));
const fontPt = async () => (await layout()).font_pt;
// The number field commits on change, as it does when the pointer leaves it.
const setSize = (pt) => ev(`(() => { const n = document.querySelector('#settings .num'); if (!n || n.disabled) return false;
@@ -65,7 +65,22 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
await until("the light theme", () => ev("document.documentElement.dataset.theme === 'light'"));
out.theme = "ok";
- // --- (d) what was chosen survives a reload.
+ // --- (d) the server's colour scheme arrives on its own, and a scheme
+ // picked here overrides it. The cleared ground is behind WebGPU, so the
+ // canvas publishes it as data-bg instead.
+ const bg = () => ev("document.getElementById('term').dataset.bg || ''");
+ await until("the server's scheme", async () => (await bg()) === "#1d2021");
+ out.server_scheme = "ok";
+ await click("#settings [data-section=appearance]");
+ if (!(await click("#settings [data-setting=terminal-scheme]"))) fail("no colour scheme row");
+ await until("the scheme picker", () => ev("!!document.getElementById('schemes')"));
+ if (!(await ev("(() => { const q = document.querySelector('#schemes .q'); if (!q) return false; q.value = 'Dracula'; q.dispatchEvent(new Event('input', { bubbles: true })); return true; })()"))) fail("no scheme search field");
+ await until("Dracula in the list", () => ev("!!document.querySelector('#schemes .pe[data-scheme=\"Dracula\"]')"), 20000);
+ if (!(await click('#schemes .pe[data-scheme="Dracula"]'))) fail("Dracula did not click");
+ await until("the terminal in Dracula", async () => (await bg()) === "#1e1f29");
+ out.scheme = await ev("(document.querySelector('#settings [data-setting=terminal-scheme]') || {}).dataset?.scheme");
+
+ // --- (e) what was chosen survives a reload.
await click("#settings [data-section=appearance]");
if (!(await click("#settings input[data-font=pinned]"))) fail("no fixed-size choice");
if (!(await setSize(14))) fail("the size field is not there or still disabled");
@@ -81,6 +96,7 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
await until("attach again", attached, 20000);
await until("the stored theme", () => ev("document.documentElement.dataset.theme === 'light'"));
await until("the stored size", async () => (await fontPt()) === 14);
+ await until("the stored scheme", async () => (await bg()) === "#1e1f29");
if (await ev("!!document.getElementById('settings')")) fail("the panel came back up on its own");
out.stored = await settings();
out.persist = "ok";
diff --git a/thinkterm-web/smoke/settings.sh b/thinkterm-web/smoke/settings.sh
index 8ae4f62b..461e98fe 100755
--- a/thinkterm-web/smoke/settings.sh
+++ b/thinkterm-web/smoke/settings.sh
@@ -1,8 +1,8 @@
#!/bin/sh
# The settings panel, end to end: a release server with an empty tree under
# a throwaway HOME, the release bundle, headless Chrome, pinning the font,
-# following the desktop again, the light theme, and a reload that keeps
-# what was chosen.
+# following the desktop again, the light theme, the server's colour scheme
+# and a browser's own, and a reload that keeps what was chosen.
#
# NODE_PATH=<dir with node_modules/ws> thinkterm-web/smoke/settings.sh [out.png]
#
@@ -17,7 +17,9 @@ if lsof -nP -t -i :$PORT >/dev/null 2>&1; then echo "port $PORT busy" >&2; exit
REAL_HOME=$HOME
T=$(mktemp -d "${TMPDIR:-/tmp}/tt-settings.XXXXXX")
cat > "$T/web.lua" <<LUA
-return { web_servers = { { bind_address = "127.0.0.1:$PORT" } } }
+-- The scheme is the server's; the page must draw in it on attach, before
+-- anyone picks anything.
+return { color_scheme = "Gruvbox dark, hard (base16)", web_servers = { { bind_address = "127.0.0.1:$PORT" } } }
LUA
export HOME="$T/home"; mkdir -p "$HOME"
export THINKTERM_NO_PRIVACY_DISCLAIM=1
diff --git a/thinkterm-web/smoke/sidebar-drag-test.js b/thinkterm-web/smoke/sidebar-drag-test.js
index c55c2d73..78276bf5 100644
--- a/thinkterm-web/smoke/sidebar-drag-test.js
+++ b/thinkterm-web/smoke/sidebar-drag-test.js
@@ -38,7 +38,7 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
const out = {};
await send("Page.navigate", { url }, s);
- await until("attach", async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
+ await until("attach", async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
await sleep(800);
// --- (a) the field being typed into survives the panel's re-listings.
@@ -93,8 +93,8 @@ async function browserWs() { for (let i = 0; i < 50; i++) { try { return await n
out.side_w = await ev("getComputedStyle(document.documentElement).getPropertyValue('--side-w').trim()");
out.stored = await ev("localStorage.getItem('thinkterm.sidebar')");
if (midWidth !== "180px") fail("the panel did not follow the pointer: " + midWidth);
- if (out.resizes_during_drag !== 0) fail("the terminal was resized " + out.resizes_during_drag + " times during the drag");
- if (out.resizes_after_release !== 1) fail("the release should resize the terminal exactly once, not " + out.resizes_after_release);
+ if (out.resizes_during_drag < 1) fail("the terminal did not follow the drag");
+ if (out.resizes_after_release > 1) fail("the release resized the terminal " + out.resizes_after_release + " times");
if (out.side_w !== "180px") fail("the width ended at " + out.side_w);
if (out.stored !== "180") fail("the width stored is " + JSON.stringify(out.stored));
out.drag = "ok";
diff --git a/thinkterm-web/smoke/sidebar-test.js b/thinkterm-web/smoke/sidebar-test.js
index 4a0ab05d..93f1bb5c 100644
--- a/thinkterm-web/smoke/sidebar-test.js
+++ b/thinkterm-web/smoke/sidebar-test.js
@@ -38,7 +38,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
const out = {};
await send("Page.navigate", { url }, s);
- await until("attach", async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
+ await until("attach", async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
await sleep(800);
out.rows_at_start = (await rows()).map((r) => r.kind);
if (!(await rows()).some((r) => r.kind === "others")) fail("the CLI window is not listed under Other windows");
@@ -61,8 +61,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
await click(`[data-action=pin][data-thread="${second.id}"]`);
await until("pinned", async () => { const r = await rows(); const i = r.findIndex((x) => x.kind === "pinned"); const t = r.find((x) => x.kind === "thread" && x.id === second.id); return i >= 0 && t && t.pinned && r.indexOf(t) > i; });
const before = list().length;
- await click(`[data-action=delete][data-thread="${second.id}"]`);
- if (!/delete\?/.test(await ev(`document.querySelector('[data-action=delete][data-thread="${second.id}"]').textContent`))) fail("delete did not ask");
+ // One press deletes, as the desktop's menu item does.
await click(`[data-action=delete][data-thread="${second.id}"]`);
await until("deleted", async () => !(await threads()).some((t) => t.id === second.id), 15000);
await until("its pane is gone", () => list().length < before, 15000);
@@ -120,7 +119,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
await ev("window.__landed = 1");
await send("Page.reload", { ignoreCache: true }, s);
await until("a fresh document", () => ev("window.__landed === undefined"), 20000);
- await until("attach again", async () => /this browser has|mirroring|following/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
+ await until("attach again", async () => /this browser has/.test(await ev("document.getElementById('status').dataset.summary || ''")), 20000);
const reopened = await until("the same Space on show", async () => {
const row = await space();
return row && row.kind === "space" && row.id === made.id ? row : null;
diff --git a/thinkterm-web/smoke/tabs-test.js b/thinkterm-web/smoke/tabs-test.js
index 589e64a7..6855490c 100644
--- a/thinkterm-web/smoke/tabs-test.js
+++ b/thinkterm-web/smoke/tabs-test.js
@@ -49,7 +49,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
const fail = (what) => { throw new Error(what); };
await send("Page.navigate", { url }, s);
- await until("attach", "/this browser has|mirroring|following/.test((document.getElementById('status').dataset.summary || ''))", 20000);
+ await until("attach", "/this browser has/.test((document.getElementById('status').dataset.summary || ''))", 20000);
// --- tabs: two on the server, click the other, type, follow back
out.strip_at_start = await until("two tabs", "document.querySelectorAll('#tabs .tab').length === 2 && document.getElementById('tabs').innerText");
@@ -104,8 +104,7 @@ const sh = (cmd) => execSync(cmd, { encoding: "utf8" });
await click("zoom");
await until("unzoomed", `${L}.zoomed == null`, 8000);
const closeBtn = "document.querySelector('.nav.focused .cap.current .x')";
- await ev(`${closeBtn}.click(); 1`);
- if ((await ev(`${closeBtn}.textContent`)) !== "close?") fail("close did not ask");
+ // One press closes, as the desktop's × does.
await ev(`${closeBtn}.click(); 1`);
await until("one pane", `(${L}.panes || []).length === 1`, 8000);
if (list().some((p) => p.pane_id === a.id)) fail("the pane was not closed");
diff --git a/thinkterm-web/ui/index.html b/thinkterm-web/ui/index.html
index 214540cd..6e4537b7 100644
--- a/thinkterm-web/ui/index.html
+++ b/thinkterm-web/ui/index.html
@@ -2,7 +2,8 @@
<html lang="en">
<head>
<meta charset="utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="mobile-web-app-capable" content="yes">
<title>ThinkTerm</title>
</head>
<body>
diff --git a/thinkterm-web/ui/src/AgentsPanel.svelte b/thinkterm-web/ui/src/AgentsPanel.svelte
index 010c45bf..d73de7a8 100644
--- a/thinkterm-web/ui/src/AgentsPanel.svelte
+++ b/thinkterm-web/ui/src/AgentsPanel.svelte
@@ -5,7 +5,13 @@
// brings that pane on show.
import { handle } from './client';
import { refreshViews, s, views } from './client.svelte';
- import { agentIcon, circleAlert, circleCheck, loaderCircle } from './icons';
+ import { agentIcon, circleAlert, circleCheck, iconByName, loaderCircle } from './icons';
+
+ // The desktop's segmented mode selector. Which tabs exist, which this
+ // browser can open and what each is called are the model's
+ // (thinkterm-web/src/agents.rs `panel_tabs`); drawn here.
+ const tabs = $derived(views.agents.tabs);
+ const active = $derived(views.agents.active);
const rows = $derived(views.agents.rows);
const summary = $derived(views.agents.summary);
@@ -36,16 +42,21 @@
}
// The panel's width: a preference of this browser's, within the bounds
- // the desktop gives its right sidebar.
+ // the desktop gives its right sidebar, which is a wider panel than the
+ // left one -- 340px at its narrowest (RIGHT_SIDEBAR_MIN_WIDTH), because
+ // its rows carry two lines. A browser window has less to spare than a
+ // desktop one, so the floor is lower and the default is the desktop's
+ // own minimum.
const STORE = 'thinkterm.agents-width';
- const MIN = 200;
- const MAX = 360;
- const DEFAULT = 260;
+ const MIN = 240;
+ const MAX = 520;
+ const DEFAULT = 300;
let width = DEFAULT;
function setWidth(px: number): number {
const w = Math.round(Math.min(MAX, Math.max(MIN, px)));
document.documentElement.style.setProperty('--agents-w', `${w}px`);
+ handle.client?.resize();
return w;
}
@@ -62,50 +73,45 @@
let dragging = false;
/** The canvas whose box is held still for the drag, so it resizes once. */
- let frozen: HTMLCanvasElement | null = null;
function onPointerDown(ev: PointerEvent) {
const target = ev.target;
if (!(target instanceof HTMLElement) || !target.classList.contains('handle')) return;
ev.preventDefault();
dragging = true;
+ handle.client?.panel_drag(true);
try {
target.setPointerCapture(ev.pointerId);
} catch {
// Without capture the drag still follows the pointer over the panel.
}
- // As the sidebar's edge does: the terminal is resized from the canvas's
- // box, so a drag that moved it would resize the whole grid on every
- // frame. Its size is pinned for the drag, and the one real resize
- // happens on release.
- const canvas = document.getElementById('term');
- if (canvas instanceof HTMLCanvasElement) {
- const box = canvas.getBoundingClientRect();
- canvas.style.width = `${box.width}px`;
- canvas.style.height = `${box.height}px`;
- frozen = canvas;
- }
+ // The canvas follows the panel's edge as it moves: the grid is
+ // resized live, as the desktop's is.
}
// The panel is against the right edge, so its width is what is left of the
// window to the right of the pointer.
function onPointerMove(ev: PointerEvent) {
- if (dragging) width = setWidth(window.innerWidth - ev.clientX);
+ if (!dragging) return;
+ // A release the page never saw (over another window, say) ends the
+ // drag on the next move with no button down.
+ if (ev.buttons === 0) {
+ onPointerUp();
+ return;
+ }
+ width = setWidth(window.innerWidth - ev.clientX);
+ handle.client?.resize();
}
function onPointerUp() {
if (!dragging) return;
dragging = false;
+ handle.client?.panel_drag(false);
try {
localStorage.setItem(STORE, String(width));
} catch {
// As above: the width is then this page load's only.
}
- if (frozen) {
- frozen.style.width = '';
- frozen.style.height = '';
- frozen = null;
- }
}
</script>
@@ -121,10 +127,27 @@
onpointermove={onPointerMove}
onpointerup={onPointerUp}
onpointercancel={onPointerUp}
+ onlostpointercapture={onPointerUp}
>
<div class="handle"></div>
<div class="hd">
<span class="ti">{s('web-agents-title')}</span>
+ <!-- The desktop's selector: four segments, the active one a filled pill
+ carrying its label, the rest icon-only. -->
+ <div class="modes" role="tablist">
+ {#each tabs as tab (tab.id)}
+ <span
+ class="mode"
+ class:on={tab.id === active}
+ class:off={!tab.available}
+ role="tab"
+ aria-selected={tab.id === active}
+ aria-disabled={!tab.available}
+ data-mode={tab.id}
+ title={tab.tip}
+ >{@html iconByName(tab.icon) ?? ''}{#if tab.id === active}<span class="ml">{tab.label}</span>{/if}</span>
+ {/each}
+ </div>
<span class="sum">{summary}</span>
</div>
<div class="list">
diff --git a/thinkterm-web/ui/src/App.svelte b/thinkterm-web/ui/src/App.svelte
index c9304f93..afe6c78f 100644
--- a/thinkterm-web/ui/src/App.svelte
+++ b/thinkterm-web/ui/src/App.svelte
@@ -5,6 +5,7 @@
import AgentsPanel from './AgentsPanel.svelte';
import Card from './Card.svelte';
import ContextMenu from './ContextMenu.svelte';
+ import DragLayer from './DragLayer.svelte';
import KeyBar from './KeyBar.svelte';
import NavBars from './NavBars.svelte';
import SearchPalette from './SearchPalette.svelte';
@@ -57,5 +58,6 @@
{#if views.settings['agents-panel']}<AgentsPanel />{/if}
{#if mobile.on}<KeyBar />{/if}
<ContextMenu />
+<DragLayer />
<SearchPalette />
<SettingsPanel />
diff --git a/thinkterm-web/ui/src/Card.svelte b/thinkterm-web/ui/src/Card.svelte
index a2545658..d102ad17 100644
--- a/thinkterm-web/ui/src/Card.svelte
+++ b/thinkterm-web/ui/src/Card.svelte
@@ -1,8 +1,40 @@
<script lang="ts">
- // The desktop's words over a terminal another device holds.
+ // The desktop's surface over a terminal another device holds: opaque,
+ // across the whole terminal area, with the desktop's eyes. What it says
+ // and what its button offers are the model's (thinkterm-web/src/app.rs
+ // `card`); a press anywhere on it, or a scroll, asks for the terminal,
+ // and the model's next state says how that went.
+ import { handle } from './client';
import { views } from './client.svelte';
const card = $derived(views.status.card);
+ const taking = $derived(card?.state === 'taking');
+
+ // The desktop's eyes blink once every five seconds.
+ let closed = $state(false);
+ $effect(() => {
+ if (!card) return;
+ const timer = setInterval(() => {
+ closed = true;
+ setTimeout(() => { closed = false; }, 250);
+ }, 5000);
+ return () => clearInterval(timer);
+ });
+
+ function ask(ev: Event) {
+ ev.preventDefault();
+ if (taking) return;
+ handle.client?.take_over();
+ // The keyboard stays the terminal's: a button that took focus would
+ // keep the keys once the card is gone.
+ document.getElementById('kbd')?.focus({ preventScroll: true });
+ }
</script>
-<div id="card" hidden={!card}><div class="eyes">• •</div><div class="title">{card?.title ?? ''}</div><div class="hint">{card?.hint ?? ''}</div></div>
+<!-- svelte-ignore a11y_no_static_element_interactions -->
+<div id="card" hidden={!card} data-state={card?.state ?? ''} onpointerdown={ask} onwheel={ask}>
+ <div class="eyes">{closed ? '─ ─' : '• •'}</div>
+ <div class="title">{card?.title ?? ''}</div>
+ <div class="hint">{card?.hint ?? ''}</div>
+ <button class="go" disabled={taking} onpointerdown={(ev) => { ev.preventDefault(); ev.stopPropagation(); }} onclick={ask}>{card?.action ?? ''}</button>
+</div>
diff --git a/thinkterm-web/ui/src/DragLayer.svelte b/thinkterm-web/ui/src/DragLayer.svelte
new file mode 100644
index 00000000..65e1a4ed
--- /dev/null
+++ b/thinkterm-web/ui/src/DragLayer.svelte
@@ -0,0 +1,34 @@
+<script lang="ts">
+ // What a drag shows: the ghost under the pointer, the 2px line the row or
+ // tab would land on, and the half of the pane a capsule would take. The
+ // desktop paints the same three (render/paint.rs), in the same accent.
+ import { drag, installDrag } from './drag.svelte';
+ import { POP, ms } from './motion';
+ import { fade } from 'svelte/transition';
+
+ const px = (n: number) => `${n.toFixed(2)}px`;
+
+ function listen(_node: HTMLElement) {
+ return { destroy: installDrag() };
+ }
+</script>
+
+<div id="dnd" use:listen>
+ {#if drag.kind}
+ <div class="ghost" style="left:{px(drag.x)};top:{px(drag.y)}" transition:fade={{ duration: ms(POP) }}>{drag.label}</div>
+ {/if}
+ {#if drag.line}
+ <div
+ class="line"
+ style="left:{px(drag.line.left)};top:{px(drag.line.top)};width:{px(drag.line.width)};height:{px(drag.line.height)}"
+ transition:fade={{ duration: ms(POP) }}
+ ></div>
+ {/if}
+ {#if drag.zone}
+ <div
+ class="zone"
+ style="left:{px(drag.zone.left)};top:{px(drag.zone.top)};width:{px(drag.zone.width)};height:{px(drag.zone.height)}"
+ transition:fade={{ duration: ms(POP) }}
+ ></div>
+ {/if}
+</div>
diff --git a/thinkterm-web/ui/src/KeyBar.svelte b/thinkterm-web/ui/src/KeyBar.svelte
index e9c8f949..176d671a 100644
--- a/thinkterm-web/ui/src/KeyBar.svelte
+++ b/thinkterm-web/ui/src/KeyBar.svelte
@@ -45,6 +45,9 @@
/** Where the bar sits: the foot of the *visual* viewport, which is what
the soft keyboard takes a bite out of. */
let top = $state(0);
+ /** The bar itself, so what it measures -- KEYBAR plus whatever the home
+ indicator's safe area adds under it -- is what the page leaves room for. */
+ let bar = $state<HTMLDivElement | null>(null);
function disarm() {
ctrl = false;
@@ -157,11 +160,16 @@
const vv = window.visualViewport;
const read = () => {
const height = vv ? vv.height : window.innerHeight;
- top = (vv ? vv.offsetTop : 0) + height - KEYBAR;
+ const mine = bar?.offsetHeight || KEYBAR;
+ top = (vv ? vv.offsetTop : 0) + height - mine;
+ document.documentElement.style.setProperty('--keybar', `${mine}px`);
document.documentElement.style.setProperty('--vvh', `${height}px`);
};
document.documentElement.style.setProperty('--keybar', `${KEYBAR}px`);
read();
+ // The first read runs before the bar has been laid out with its safe
+ // area, so its real height is taken on the next frame.
+ requestAnimationFrame(read);
vv?.addEventListener('resize', read);
vv?.addEventListener('scroll', read);
window.addEventListener('resize', read);
@@ -180,7 +188,7 @@
<!-- The keys are the bar's, delegated, as the tab row's and the sidebar's
are; a release anywhere ends a repeat. -->
<svelte:window onpointerup={stopRepeat} onpointercancel={stopRepeat} />
-<div id="keybar" role="toolbar" aria-label="Terminal keys" tabindex="-1" style="top:{top.toFixed(2)}px" onpointerdown={onDown}>
+<div bind:this={bar} id="keybar" role="toolbar" aria-label="Terminal keys" tabindex="-1" style="top:{top.toFixed(2)}px" onpointerdown={onDown}>
{#each HEAD as k (k.name)}
<button class="k" type="button" data-key={k.name} aria-label={k.label}>{k.label}</button>
{/each}
diff --git a/thinkterm-web/ui/src/NavBars.svelte b/thinkterm-web/ui/src/NavBars.svelte
index 0b43892f..2cd1819e 100644
--- a/thinkterm-web/ui/src/NavBars.svelte
+++ b/thinkterm-web/ui/src/NavBars.svelte
@@ -6,20 +6,33 @@
import { s, views } from './client.svelte';
import { loaderCircle, maximize2, minimize2, plus, squareSplitHorizontal, squareSplitVertical, squareTerminal, x } from './icons';
+ import { armDrag } from './drag.svelte';
+
const px = (n: number) => n.toFixed(2);
+
+ // A press on a capsule may be its drag onto another pane; the close
+ // button is its own, and a press that stays put still focuses the pane.
+ function onPointerDown(ev: PointerEvent) {
+ const target = ev.target;
+ if (!(target instanceof Element) || target.closest('.x')) return;
+ const cap = target.closest('.cap');
+ const id = cap?.getAttribute('data-pane');
+ if (!cap || id === null || id === undefined) return;
+ armDrag(ev, { kind: 'pane', id, label: cap.textContent?.trim() ?? id });
+ }
</script>
<!-- The row is one delegated handler, as the wasm had it; its children
are the controls, not the container. -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
-<div id="panes" onclick={onChromeClick}>
+<div id="panes" onclick={onChromeClick} onpointerdown={onPointerDown}>
{#each views.navs as bar (bar.rect.pane)}
<div
class="nav"
class:focused={bar.focused}
data-nav={bar.rect.pane}
- style="left:{px(bar.rect.left)}px;top:{px(bar.rect.top)}px;width:{px(bar.rect.width)}px;height:{px(bar.rect.height)}px"
+ style="left:{px(bar.rect.left)}px;top:{px(bar.rect.top)}px;width:min({px(bar.rect.width)}px, calc(100% - {px(bar.rect.left)}px));height:{px(bar.rect.height)}px"
><span class="caps">{#each bar.members as m (m.pane)}<span
class="cap"
class:current={m.current}
@@ -33,8 +46,8 @@
title={s('web-tip-close-pane')}
>{#if bar.closing && m.current}{s('web-confirm-close')}{:else}{@html x}{/if}</span></span>{/each}</span><span class="acts"><span
class="act"
- data-action="new-tab"
- title={s('web-tip-new-tab')}>{@html plus}</span><span
+ data-action="new-pane"
+ title={s('web-tip-new-pane')}>{@html plus}</span><span
class="act"
data-action="split-below"
title={s('web-tip-split-down')}>{@html squareSplitVertical}</span><span
diff --git a/thinkterm-web/ui/src/SearchPalette.svelte b/thinkterm-web/ui/src/SearchPalette.svelte
index 2229982e..f1b24990 100644
--- a/thinkterm-web/ui/src/SearchPalette.svelte
+++ b/thinkterm-web/ui/src/SearchPalette.svelte
@@ -5,6 +5,8 @@
// arrows, and closed by anything that means the page moved on.
import { iconByName } from './icons';
import { closePalette, move, palette, run, search, select, selectedId, shownSections } from './palette.svelte';
+ import { POP, ms } from './motion';
+ import { fade, scale } from 'svelte/transition';
const sections = $derived(shownSections());
const current = $derived(selectedId());
@@ -52,8 +54,13 @@
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
{#if palette.open}
- <div id="palette-back" onpointerdown={closePalette}></div>
- <div id="palette" role="dialog" aria-modal="true">
+ <div id="palette-back" onpointerdown={closePalette} transition:fade={{ duration: ms(POP) }}></div>
+ <div
+ id="palette"
+ role="dialog"
+ aria-modal="true"
+ transition:scale={{ duration: ms(POP), start: 0.97, opacity: 0 }}
+ >
<input
class="q"
value={palette.query}
diff --git a/thinkterm-web/ui/src/SettingsPanel.svelte b/thinkterm-web/ui/src/SettingsPanel.svelte
index 69bd755f..8955a4e0 100644
--- a/thinkterm-web/ui/src/SettingsPanel.svelte
+++ b/thinkterm-web/ui/src/SettingsPanel.svelte
@@ -5,8 +5,22 @@
// whatever it concerns.
import { s, views } from './client.svelte';
import { bot, info, minus, palette, panelLeft, plus, rotateCcw, search, slidersHorizontal, x } from './icons';
- import { applyTheme, closeSettings, panel, setSetting } from './settings.svelte';
- import type { Hotkey, Theme } from './model';
+ import { applyTheme, closeSettings, FOLLOW_DESKTOP, loadSchemes, panel, pickScheme, previewScheme, schemes, setSetting, storedScheme } from './settings.svelte';
+ import type { Hotkey, Scheme, Theme } from './model';
+ import { POP, WINDOW, ms } from './motion';
+ import { fade, scale } from 'svelte/transition';
+ import { cubicOut } from 'svelte/easing';
+
+ /** Fade and an 8px rise: the settings window arriving, and leaving the
+ way it came. */
+ function rise(_node: Element, { duration }: { duration: number }) {
+ return {
+ duration,
+ easing: cubicOut,
+ css: (t: number) =>
+ `opacity: ${t}; transform: var(--settings-tf) translateY(${(1 - t) * 8}px)`,
+ };
+ }
const settings = $derived(views.settings);
@@ -128,6 +142,72 @@
closeSettings();
}
+ // The colour-scheme picker: a searchable list over the panel, with the
+ // terminal drawn in whatever row is under the cursor. Escape restores
+ // what was picked before it opened.
+ let picking = $state(false);
+ let schemeQuery = $state('');
+ let cursor = $state(0);
+ const chosen = $derived(settings['terminal-scheme'] ?? FOLLOW_DESKTOP);
+ const following = $derived(chosen === FOLLOW_DESKTOP);
+ const schemeLabel = $derived(following ? s('web-scheme-desktop') : chosen);
+
+ /** The list: "Follow the desktop" first, then whatever matches. */
+ const matches = $derived.by(() => {
+ const q = schemeQuery.trim().toLowerCase();
+ const rows: (Scheme | null)[] = q === '' || s('web-scheme-desktop').toLowerCase().includes(q) ? [null] : [];
+ for (const scheme of schemes.all) {
+ if (q === '' || scheme.name.toLowerCase().includes(q)) rows.push(scheme);
+ }
+ return rows;
+ });
+
+ function openPicker() {
+ schemeQuery = '';
+ cursor = 0;
+ picking = true;
+ void loadSchemes();
+ }
+
+ /** Put back what was picked before the picker opened: the stored
+ colours when the catalogue has not arrived yet. */
+ function restoreScheme() {
+ picking = false;
+ previewScheme(following ? null : (schemes.all.find((scheme) => scheme.name === chosen) ?? storedScheme()));
+ }
+
+ function commit(row: Scheme | null) {
+ picking = false;
+ pickScheme(row);
+ }
+
+ $effect(() => {
+ if (!picking) return;
+ // Keep the cursor on the list, and show what it is on.
+ const row = matches[Math.min(cursor, matches.length - 1)] ?? null;
+ previewScheme(row);
+ });
+
+ function onPickerKeydown(ev: KeyboardEvent) {
+ ev.stopPropagation();
+ if (ev.key === 'Escape') {
+ ev.preventDefault();
+ restoreScheme();
+ } else if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') {
+ ev.preventDefault();
+ const next = cursor + (ev.key === 'ArrowDown' ? 1 : -1);
+ cursor = Math.max(0, Math.min(matches.length - 1, next));
+ } else if (ev.key === 'Enter') {
+ ev.preventDefault();
+ // No row under the cursor is no choice; `null` is a row of its own.
+ if (cursor < matches.length) commit(matches[cursor]);
+ }
+ }
+
+ function focusField(node: HTMLInputElement) {
+ node.focus({ preventScroll: true });
+ }
+
function focusHere(node: HTMLDivElement) {
node.focus({ preventScroll: true });
}
@@ -138,8 +218,18 @@
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
{#if panel.open}
- <div id="settings-back" onpointerdown={closeSettings}></div>
- <div id="settings" role="dialog" aria-modal="true" tabindex="-1" onkeydown={onKeydown} use:focusHere>
+ <div id="settings-back" onpointerdown={closeSettings} transition:fade={{ duration: ms(WINDOW) }}></div>
+ <!-- The desktop's window comes up rather than in: a fade and an 8px
+ rise, at the length a window takes rather than a menu's. -->
+ <div
+ id="settings"
+ role="dialog"
+ aria-modal="true"
+ tabindex="-1"
+ onkeydown={onKeydown}
+ use:focusHere
+ transition:rise={{ duration: ms(WINDOW) }}
+ >
<button class="sc" type="button" title={s('web-settings-close')} onclick={closeSettings}>{@html x}</button>
<div class="snav">
<div class="app">ThinkTerm</div>
@@ -180,8 +270,14 @@
</div>
{/if}
- {#if shows('appearance', s('web-settings-theme')) || shows('appearance', s('web-settings-font'))}
+ {#if shows('appearance', s('web-settings-theme')) || shows('appearance', s('web-settings-font')) || shows('appearance', s('web-settings-scheme'))}
<div class="card">
+ {#if shows('appearance', s('web-settings-scheme'))}
+ <div class="srow">
+ <div class="tx"><div class="lab">{s('web-settings-scheme')}</div><div class="desc">{d('web-settings-scheme-description')}</div></div>
+ <button class="pillsel" type="button" data-setting="terminal-scheme" data-scheme={chosen} onclick={openPicker}>{schemeLabel}</button>
+ </div>
+ {/if}
{#if shows('appearance', s('web-settings-theme'))}
<div class="srow">
<div class="tx"><div class="lab">{s('web-settings-theme')}</div><div class="desc">{d('web-settings-theme-description')}</div></div>
@@ -252,4 +348,31 @@
{#if panel.error !== ''}<div class="err">{panel.error}</div>{/if}
</div>
</div>
+ {#if picking}
+ <div id="schemes-back" onpointerdown={restoreScheme} transition:fade={{ duration: ms(POP) }}></div>
+ <div
+ id="schemes"
+ role="dialog"
+ aria-modal="true"
+ tabindex="-1"
+ onkeydown={onPickerKeydown}
+ transition:scale={{ duration: ms(POP), start: 0.97, opacity: 0 }}
+ >
+ <input class="q" placeholder={s('web-scheme-search')} bind:value={schemeQuery} spellcheck="false" oninput={() => (cursor = 0)} use:focusField />
+ <div class="pl">
+ {#each matches as row, i (row ? row.name : '')}
+ <div class="pe" class:on={i === Math.min(cursor, matches.length - 1)} data-scheme={row ? row.name : FOLLOW_DESKTOP}
+ onpointerenter={() => (cursor = i)} onclick={() => commit(row)}>
+ <span class="sw" style:background={row ? row.background : 'transparent'}>
+ {#if row}{#each row.ansi as colour, n (n)}<i style:background={colour}></i>{/each}{/if}
+ </span>
+ <span class="t">{row ? row.name : s('web-scheme-desktop')}</span>
+ {#if (row ? row.name : FOLLOW_DESKTOP) === chosen}<span class="acc">{s('web-scheme-preview')}</span>{/if}
+ </div>
+ {:else}
+ <div class="pn">{schemes.loading ? '…' : schemes.error || s('command-palette-empty')}</div>
+ {/each}
+ </div>
+ </div>
+ {/if}
{/if}
diff --git a/thinkterm-web/ui/src/Sidebar.svelte b/thinkterm-web/ui/src/Sidebar.svelte
index caf6cede..7e543a47 100644
--- a/thinkterm-web/ui/src/Sidebar.svelte
+++ b/thinkterm-web/ui/src/Sidebar.svelte
@@ -5,20 +5,40 @@
import { s, views, sideClick, sideKey } from './client.svelte';
import {
archive, archiveRestore, chevronDown, chevronRight, circleAlert, circleCheck, circlePlus,
- bell, ellipsis, folder, folderOpen, folderPlus, layers, loaderCircle, pin, pinOff, plus,
+ bell, ellipsis, folder, folderOpen, folderPlus, layers, loaderCircle, panelLeft, pin, pinOff, plus,
trash2,
} from './icons';
import { menu, openMenu } from './menu.svelte';
- import { search as searchIcon, settings as settingsIcon } from './icons';
+ import { armDrag } from './drag.svelte';
+ import { handle } from './client';
+ import { toggleSidebar } from './chrome';
+ import { iconByName } from './icons';
import { openPalette } from './palette.svelte';
import { openSettings } from './settings.svelte';
import { mobile, openSide } from './mobile.svelte';
import { palette } from './palette.svelte';
import { followSpace, panel } from './settings.svelte';
- import type { SideRow } from './model';
+ import type { FooterAction, SideRow } from './model';
const rows = $derived(views.sidebar.rows);
+ const footer = $derived(views.sidebar.footer);
+ /** The panel is narrower than the width the model says the footer's
+ label needs. Measured, because a container query cannot read a
+ value the model supplies. */
+ let narrow = $state(false);
+ function watchWidth(node: HTMLElement) {
+ const limit = () => views.sidebar.footer_label_min_width;
+ const observer = new ResizeObserver(([entry]) => {
+ narrow = entry.contentRect.width < limit();
+ });
+ observer.observe(node);
+ return { destroy: () => observer.disconnect() };
+ }
const editing = $derived(views.sidebar.editing);
+ const addingWorkspace = $derived(editing.kind === 'new-project');
+ const addError = $derived(views.sidebar.new_project_error);
+ /** Nothing to work in yet: the tree's own invitation to add one. */
+ const noWorkspaces = $derived(!rows.some((r) => r.kind === 'project'));
const editingThread = (id: string) => editing.kind === 'thread' && editing.id === id;
const editingProject = (id: string) => editing.kind === 'project' && editing.id === id;
const editingSpace = (id: string) => editing.kind === 'space' && editing.id === id;
@@ -48,6 +68,30 @@
node.select();
}
+ // A refused path keeps the field, so nothing is retyped; the caret goes
+ // back to it with the whole path selected, ready to be replaced.
+ $effect(() => {
+ if (!addError) return;
+ const input = document.querySelector<HTMLInputElement>('#side .path input');
+ if (!input) return;
+ input.focus();
+ input.select();
+ });
+
+ // The thread on show is kept in view: the one a just-added workspace
+ // brought with it is at the end of a list that may have scrolled away.
+ // `nearest` scrolls only when it has to, so a thread already on screen
+ // is left where the reader put it.
+ let shown = '';
+ $effect(() => {
+ const row = rows.find((r) => r.kind === 'thread' && r.selected);
+ const id = row && row.kind === 'thread' ? row.id : '';
+ if (id === '' || id === shown) return;
+ shown = id;
+ const el = document.querySelector(`#side .row.thread[data-thread="${CSS.escape(id)}"]`);
+ el?.scrollIntoView({ block: 'nearest' });
+ });
+
// What a click landed on, as `sidebar::Sidebar::click_target` read it: the
// nearest element carrying one of the four marks. A click on a row's text
// or dot is the row; the small buttons and the headers' actions are their
@@ -67,14 +111,15 @@
case 'search': openPalette('threads'); handled = true; break;
case 'new-thread': handled = sideClick('new-thread', project); break;
case 'new-project': handled = sideClick('new-project'); break;
+ case 'sidebar': toggleSidebar(); handled = true; break;
case 'archived': handled = sideClick('toggle-archived'); break;
case 'pin': handled = sideClick('pin', thread, true); break;
case 'unpin': handled = sideClick('pin', thread, false); break;
case 'delete': handled = sideClick('delete', thread); break;
case 'archive': handled = sideClick('archive', project); break;
case 'unarchive': handled = sideClick('unarchive', project); break;
- // Anchored under the button, as the view options are: the Spaces
- // are a list to pick from, not a menu for a point.
+ // The whole row is the Space button, as on the desktop; the list
+ // hangs under it.
case 'space-menu': {
const box = hit.getBoundingClientRect();
openMenu('space', '', box.left, box.bottom + 4);
@@ -174,10 +219,9 @@
// the tab row's toggle bring it back as an overlay over the canvas.
// Nothing is resized -- `--side-w` stays 0 -- so this is the panel's own
// display state and nothing else's.
- /** How far into the window the edge trigger reaches, in client px. */
- const EDGE = 6;
- const REVEAL_DELAY = 150;
- const RETREAT_DELAY = 250;
+ // How far the edge trigger reaches and how long the two dwells are is
+ // the model's (thinkterm-web/src/sidebar.rs `REVEAL`), not this layer's.
+ const reveal = $derived(views.sidebar.reveal);
let revealed = $state(false);
let revealTimer: ReturnType<typeof setTimeout> | null = null;
let retreatTimer: ReturnType<typeof setTimeout> | null = null;
@@ -213,7 +257,7 @@
revealTimer = setTimeout(() => {
revealTimer = null;
if (armed()) revealed = true;
- }, REVEAL_DELAY);
+ }, reveal.dwell_ms);
}
function scheduleRetreat() {
@@ -224,7 +268,7 @@
retreatTimer = setTimeout(() => {
retreatTimer = null;
if (!suppressed()) revealed = false;
- }, RETREAT_DELAY);
+ }, reveal.retreat_ms);
}
function hide() {
@@ -247,7 +291,7 @@
cancelRetreat();
return;
}
- if (target?.closest('[data-action=sidebar]') || ev.clientX <= EDGE) {
+ if (target?.closest('[data-action=sidebar]') || ev.clientX <= reveal.edge) {
scheduleReveal();
return;
}
@@ -265,9 +309,11 @@
$effect(() => {
window.addEventListener('pointermove', onWindowPointerMove);
window.addEventListener('click', onWindowClick);
+ window.addEventListener('blur', onPointerUp);
return () => {
window.removeEventListener('pointermove', onWindowPointerMove);
window.removeEventListener('click', onWindowClick);
+ window.removeEventListener('blur', onPointerUp);
cancelReveal();
cancelRetreat();
};
@@ -275,51 +321,82 @@
let dragging = false;
/** The canvas whose box is held still for the drag, so it resizes once. */
- let frozen: HTMLCanvasElement | null = null;
+
+ // A press on a thread or project row may be its drag. Pinned threads and
+ // archived projects are neither dragged nor landed on -- the model orders
+ // them elsewhere -- and a press on a button, or in the name being typed,
+ // is not a row's at all.
+ function armRowDrag(ev: PointerEvent, target: Element) {
+ if (target.closest('.act,.hov,input')) return;
+ const el = target.closest('.row.thread[data-thread],.row.project[data-project]');
+ if (!el) return;
+ const thread = el.getAttribute('data-thread');
+ const project = el.getAttribute('data-project');
+ const row = views.sidebar.rows.find((r) =>
+ thread !== null ? r.kind === 'thread' && r.id === thread : r.kind === 'project' && r.id === project);
+ if (row?.kind === 'thread' && !row.pinned) {
+ armDrag(ev, { kind: 'thread', id: row.id, label: row.name, project: row.project });
+ } else if (row?.kind === 'project' && !row.archived) {
+ armDrag(ev, { kind: 'project', id: row.id, label: row.name });
+ }
+ }
function onPointerDown(ev: PointerEvent) {
const target = ev.target;
- if (!(target instanceof HTMLElement) || !target.classList.contains('handle')) return;
+ if (!(target instanceof HTMLElement)) return;
+ if (!target.classList.contains('handle')) {
+ armRowDrag(ev, target);
+ return;
+ }
ev.preventDefault();
dragging = true;
+ handle.client?.panel_drag(true);
try {
target.setPointerCapture(ev.pointerId);
} catch {
// Without capture the drag still follows the pointer over the panel.
}
- // The terminal is resized from the canvas's box, so a drag that moved it
- // resized the whole grid on every frame -- which is what flickered. Its
- // size is pinned for the drag; only its left edge moves, and the one
- // real resize happens on release.
- const canvas = document.getElementById('term');
- if (canvas instanceof HTMLCanvasElement) {
- const box = canvas.getBoundingClientRect();
- canvas.style.width = `${box.width}px`;
- canvas.style.height = `${box.height}px`;
- frozen = canvas;
- }
+ // The canvas follows the panel's edge as it moves: the grid is
+ // resized live, as the desktop's is.
}
function onPointerMove(ev: PointerEvent) {
- if (dragging) width = setWidth(ev.clientX);
+ if (!dragging) return;
+ // A release the page never saw (over another window, say) ends the
+ // drag on the next move with no button down.
+ if (ev.buttons === 0) {
+ onPointerUp();
+ return;
+ }
+ width = setWidth(ev.clientX);
+ // Refit in this same task: the observer would run a frame later,
+ // with the old bitmap stretched across the new box meanwhile.
+ handle.client?.resize();
}
function onPointerUp() {
if (!dragging) return;
dragging = false;
+ handle.client?.panel_drag(false);
try {
localStorage.setItem(STORE, String(width));
} catch {
// As above: the width is then this page load's only.
}
- if (frozen) {
- frozen.style.width = '';
- frozen.style.height = '';
- frozen = null;
- }
}
</script>
+{#snippet footAction(action: FooterAction)}
+ <span
+ class="act"
+ class:lbl={action.label !== null}
+ class:off={!action.enabled}
+ data-action={action.enabled ? action.id : undefined}
+ aria-disabled={!action.enabled}
+ title={action.tip}
+ >{@html iconByName(action.icon) ?? ''}{#if action.label !== null}<span class="tl">{action.label}</span>{/if}</span>
+{/snippet}
+
<!-- The panel is one delegated handler, as the wasm had it; its children
are the rows and their buttons, not the container. -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
@@ -327,6 +404,8 @@
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
<aside
id="side"
+ use:watchWidth
+ class:narrow
class:revealed
class:open={mobile.on && mobile.side}
data-rows={JSON.stringify(rows)}
@@ -337,22 +416,37 @@
onpointermove={onPointerMove}
onpointerup={onPointerUp}
onpointercancel={onPointerUp}
+ onlostpointercapture={onPointerUp}
onpointerenter={cancelRetreat}
onpointerleave={scheduleRetreat}
>
<div class="handle"></div>
+ <div class="bar"><span class="act" data-action="sidebar" title={s('web-tip-sidebar')}>{@html panelLeft}</span></div>
<div class="list">
{#each rows as row (key(row))}
{#if row.kind === 'space'}
- <div class="row space">{@html layers}{#if editingSpace(row.id)}<input class="rename" value={row.name} spellcheck="false" use:typeHere>{:else}<span class="t">{row.name}</span>{/if}<span class="act" data-action="space-menu" title={s('web-tip-space')}>{@html ellipsis}</span></div>
+ <div class="row space" data-action={editingSpace(row.id) ? undefined : 'space-menu'} title={s('web-tip-space')}>{@html layers}{#if editingSpace(row.id)}<input class="rename" value={row.name} spellcheck="false" use:typeHere>{:else}<span class="t">{row.name}</span>{/if}<span class="act">{@html ellipsis}</span></div>
{:else if row.kind === 'new-thread'}
<div class="top"><div class="pill" data-action="new-thread" title={s('web-tip-new-thread')}>{@html circlePlus}<span>{s('sidebar-new-thread')}</span></div><span class="act round" data-action="notifications" title={s('tooltip-sidebar-notifications')}>{@html bell}</span></div>
{:else if row.kind === 'pinned'}
<div class="hdr">{@html pin}<span>{s('sidebar-pinned')}</span></div>
{:else if row.kind === 'workspaces'}
<div class="hdr"><span>{s('sidebar-workspaces')}</span><span class="act round" data-action="new-project" title={s('web-tip-new-project')}>{@html folderPlus}</span></div>
- {#if editing.kind === 'new-project'}
- <div class="path"><input placeholder={s('web-path-placeholder')} spellcheck="false" use:typeHere></div>
+ {#if addingWorkspace}
+ <div class="path" class:bad={!!addError}>
+ <div class="lb">{@html folderPlus}<span>{s('web-add-workspace')}</span></div>
+ <input
+ placeholder={s('web-path-placeholder')}
+ spellcheck="false"
+ autocapitalize="off"
+ autocorrect="off"
+ enterkeyhint="go"
+ use:typeHere
+ >
+ <div class="hint">{addError ?? s('web-add-workspace-hint')}</div>
+ </div>
+ {:else if noWorkspaces}
+ <div class="hdr add" data-action="new-project" title={s('web-tip-new-project')}>{@html folderPlus}<span>{s('web-add-workspace')}</span></div>
{/if}
{:else if row.kind === 'project' && row.archived}
<div class="row project archived" data-project={row.id} title={row.path}>{@html archive}<span class="t">{row.name}</span><span class="hov"><span class="act" data-action="unarchive" data-project={row.id} title={s('web-tip-restore')}>{@html archiveRestore}</span></span></div>
@@ -380,10 +474,18 @@
{/if}
{/each}
</div>
- <!-- The footer, as the desktop's sidebar ends: Settings on the left,
- the thread search on the right. -->
+ <!-- The footer, as the desktop's sidebar ends: which actions it carries,
+ what they are called, which are refused and which sit at the right
+ inset are the model's (app.rs `side_footer`); the label goes when
+ the panel is narrower than the model's own threshold. -->
<div class="foot">
- <span class="act" data-action="settings" title={s('tooltip-sidebar-settings')}>{@html settingsIcon}</span>
- <span class="act" data-action="search" title={s('tooltip-sidebar-thread-search')}>{@html searchIcon}</span>
+ {#each footer.filter((a) => !a.trailing) as action (action.id)}
+ {@render footAction(action)}
+ {/each}
+ <span class="acts">
+ {#each footer.filter((a) => a.trailing) as action (action.id)}
+ {@render footAction(action)}
+ {/each}
+ </span>
</div>
</aside>
diff --git a/thinkterm-web/ui/src/TabRow.svelte b/thinkterm-web/ui/src/TabRow.svelte
index 9a29734f..9b9ea458 100644
--- a/thinkterm-web/ui/src/TabRow.svelte
+++ b/thinkterm-web/ui/src/TabRow.svelte
@@ -1,11 +1,12 @@
<script lang="ts">
// The window's tab row: the sidebar toggle, a capsule per tab of this
- // window, the new-tab button, and the hint that the tab is fitted to
- // this window. What `chrome::TabStrip::render` drew.
+ // window, the new-tab button and the right panel's toggle. What
+ // `chrome::TabStrip::render` drew.
import { onChromeClick } from './chrome';
import { s, views } from './client.svelte';
import { panelLeft, panelRight, plus, squareTerminal, x } from './icons';
import { openMenu } from './menu.svelte';
+ import { armDrag } from './drag.svelte';
import { short } from './title';
const tabs = $derived(views.tabs?.tabs ?? []);
@@ -20,13 +21,24 @@
ev.preventDefault();
openMenu('tab', tab, ev.clientX, ev.clientY);
}
+
+ // A press on a capsule may be its drag; the close button is its own, and
+ // a press that never travels is still the click that switches tab.
+ function onPointerDown(ev: PointerEvent) {
+ const target = ev.target;
+ if (!(target instanceof Element) || target.closest('.x')) return;
+ const cap = target.closest('.tab');
+ const id = cap?.getAttribute('data-tab');
+ if (!cap || id === null || id === undefined) return;
+ armDrag(ev, { kind: 'tab', id, label: cap.textContent?.trim() ?? id });
+ }
</script>
<!-- The row is one delegated handler, as the wasm had it; its children
are the controls, not the container. -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
-<div id="tabs" onclick={onChromeClick} oncontextmenu={onMenu}>
+<div id="tabs" onclick={onChromeClick} oncontextmenu={onMenu} onpointerdown={onPointerDown}>
<span class="act" data-action="sidebar" title={s('web-tip-sidebar')}>{@html panelLeft}</span>
{#each tabs as tab (tab.tab)}
<span class="tab" class:current={tab.current} data-pane={tab.target} data-tab={tab.tab} title={tab.title}>
@@ -40,10 +52,9 @@
</span>
{/each}
<span class="act" data-action="new-tab" title={s('web-tip-new-tab')}>{@html plus}</span>
- <!-- The row's right end, as the desktop's tab bar has it: the hint that
- the tab is fitted to this window, then the right panel's toggle. -->
+ <!-- The row's right end, as the desktop's tab bar has it: the right
+ panel's toggle. -->
<span class="trail">
- {#if controls?.fit}<span class="hint" title={s('web-tip-fitted')}>{s('web-fitted')}</span>{/if}
<span
class="act"
class:on={views.settings['agents-panel']}
diff --git a/thinkterm-web/ui/src/chrome.ts b/thinkterm-web/ui/src/chrome.ts
index 4eb97c39..97e0f7a9 100644
--- a/thinkterm-web/ui/src/chrome.ts
+++ b/thinkterm-web/ui/src/chrome.ts
@@ -2,6 +2,7 @@
// read it: the nearest element that carries one of the three marks, and
// the bar it sits in for the buttons that act on a bar's pane.
+import { handle } from './client';
import { chromeClick, views } from './client.svelte';
import { mobile, openSide } from './mobile.svelte';
import { openPalette } from './palette.svelte';
@@ -21,6 +22,9 @@ export function toggleSidebar() {
}
const off = document.body.dataset.side === 'off';
if (off) delete document.body.dataset.side; else document.body.dataset.side = 'off';
+ // Refit in this task, before the browser paints the moved box with the
+ // old bitmap stretched across it.
+ handle.client?.resize();
document.getElementById('kbd')?.focus();
}
@@ -63,7 +67,7 @@ export function onChromeClick(ev: MouseEvent) {
// is a preference the wasm keeps.
setSetting('agents-panel', !views.settings['agents-panel']);
handled = true;
- } else if (action === 'split-right' || action === 'split-below' || action === 'zoom') {
+ } else if (action === 'split-right' || action === 'split-below' || action === 'zoom' || action === 'new-pane') {
// A bar's buttons act on the bar's pane, whichever is focused.
handled = chromeClick(action, id(hit.closest('[data-nav]'), 'data-nav'));
} else {
diff --git a/thinkterm-web/ui/src/client.svelte.ts b/thinkterm-web/ui/src/client.svelte.ts
index 89b4bc64..2e7eff6c 100644
--- a/thinkterm-web/ui/src/client.svelte.ts
+++ b/thinkterm-web/ui/src/client.svelte.ts
@@ -10,9 +10,12 @@ export const views = $state({
tabs: null as TabsView | null,
navs: [] as NavsView,
status: { toast: null, card: null, summary: '' } as StatusView,
- sidebar: { rows: [], editing: { kind: 'none' }, space: null } as SidebarView,
+ sidebar: {
+ rows: [], editing: { kind: 'none' }, space: null, new_project_error: null,
+ reveal: { edge: 6, dwell_ms: 150, retreat_ms: 250 }, footer: [], footer_label_min_width: 168,
+ } as SidebarView,
/** The right-hand panel's rows, whether it is on show or not. */
- agents: { rows: [], summary: '' } as AgentsView,
+ agents: { rows: [], summary: '', tabs: [], active: 'agents' } as AgentsView,
/** The page's own preferences, as the wasm holds them (settings.rs). */
settings: {
language: 'system',
diff --git a/thinkterm-web/ui/src/drag.svelte.ts b/thinkterm-web/ui/src/drag.svelte.ts
new file mode 100644
index 00000000..663f27bc
--- /dev/null
+++ b/thinkterm-web/ui/src/drag.svelte.ts
@@ -0,0 +1,387 @@
+// Dragging a row, a tab or a pane, as the desktop does it (wezterm-gui
+// mouseevent.rs `sidebar_row_drag`, `pane_tab_drag`): a press that travels
+// ~5px -- or a finger that rests -- becomes a drag, a ghost follows the
+// pointer, and where it would land is shown until it is let go.
+//
+// Nothing here decides what a drop means. Every one goes to `client.drop`,
+// which performs it or refuses it; a refusal is a snap back and no more.
+// What is offered as a target is read from the model's own rows (a thread's
+// project, a row's pinned flag) and from this frame's rectangles.
+
+import { handle } from './client';
+import { refreshViews, views } from './client.svelte';
+
+/** How far a press travels before it is a drag (the desktop's ~5px). */
+const THRESHOLD = 5;
+/** How long a finger rests on a row before it is one. */
+const HOLD = 500;
+/** The band at a list's edge that scrolls it, how far a tick moves it,
+ and how often a parked pointer ticks -- the desktop's numbers. */
+const HOT = 32;
+const STEP = 16;
+const TICK = 40;
+
+export type DragKind = 'thread' | 'project' | 'tab' | 'pane';
+export type Edge = 'left' | 'right' | 'top' | 'bottom';
+
+/** What a press has picked up: the row, capsule or tab under it. */
+export type Spec = { kind: DragKind; id: string; label: string; project?: string };
+
+type Rect = { left: number; top: number; width: number; height: number };
+
+/** Where letting go would put it: the argument for `client.drop`, plus the
+ rectangle that says so on screen. */
+type Target =
+ | { kind: 'before'; before: string | undefined; line: Rect }
+ | { kind: 'at'; at: number; line: Rect }
+ | { kind: 'pane'; target: string; edge: Edge; zone: Rect };
+
+/** What the drag layer draws. `kind` is null while nothing is dragging. */
+export const drag = $state({
+ kind: null as DragKind | null,
+ label: '',
+ x: 0,
+ y: 0,
+ /** Letting go here would land somewhere; else the pointer says no. */
+ ok: false,
+ line: null as Rect | null,
+ zone: null as Rect | null,
+});
+
+let spec: Spec | null = null;
+let pointer: number | null = null;
+let startX = 0;
+let startY = 0;
+let active = false;
+let target: Target | null = null;
+let hold: ReturnType<typeof setTimeout> | null = null;
+let scroll: ReturnType<typeof setTimeout> | null = null;
+/** When a drag last ended, so the click that press produces is swallowed
+ and a later, unrelated one is not. */
+let swallow = 0;
+
+const box = (el: Element): Rect => {
+ const r = el.getBoundingClientRect();
+ return { left: r.left, top: r.top, width: r.width, height: r.height };
+};
+
+/** The sibling rows a sidebar drag may land between, in the model's order:
+ the same project's unpinned threads, or the Space's live projects. */
+function siblings(): string[] {
+ if (!spec) return [];
+ if (spec.kind === 'thread') {
+ return views.sidebar.rows
+ .filter((r) => r.kind === 'thread' && !r.pinned && r.project === spec?.project)
+ .map((r) => (r.kind === 'thread' ? r.id : ''));
+ }
+ return views.sidebar.rows
+ .filter((r) => r.kind === 'project' && !r.archived)
+ .map((r) => (r.kind === 'project' ? r.id : ''));
+}
+
+function rowRects(): { id: string; rect: Rect }[] {
+ if (!spec) return [];
+ const attr = spec.kind === 'thread' ? 'data-thread' : 'data-project';
+ const out: { id: string; rect: Rect }[] = [];
+ for (const id of siblings()) {
+ const el = document.querySelector(`#side .row[${attr}="${CSS.escape(id)}"]`);
+ if (el) out.push({ id, rect: box(el) });
+ }
+ return out;
+}
+
+/** The gap the pointer is in, as `sidebar_insert_position` picks it: before
+ the first row whose middle is below it, else last. */
+function sideTarget(x: number, y: number): Target | null {
+ const side = document.getElementById('side');
+ const list = document.querySelector('#side .list');
+ if (!side || !list || !spec) return null;
+ const panel = box(side);
+ if (x < panel.left || x >= panel.left + panel.width) return null;
+ const rows = rowRects();
+ if (rows.length === 0) return null;
+ const first = rows[0].rect;
+ const last = rows[rows.length - 1].rect;
+ // A thread pointer that leaves its own list is aiming at no gap of it, so
+ // the drag is refused rather than snapped to an end -- which is what keeps
+ // a thread dragged onto another project a no-op. A project's list is the
+ // whole panel, so anywhere below it simply means the end.
+ if (spec.kind === 'thread') {
+ const slack = first.height;
+ if (y < first.top - slack || y > last.top + last.height + slack) return null;
+ }
+ const inset = box(list);
+ const line = (top: number): Rect => ({ left: inset.left, top: top - 1, width: inset.width, height: 2 });
+ for (const row of rows) {
+ if (y < row.rect.top + row.rect.height / 2) {
+ return { kind: 'before', before: row.id, line: line(row.rect.top) };
+ }
+ }
+ return { kind: 'before', before: undefined, line: line(last.top + last.height) };
+}
+
+/** Which gap of the strip the pointer is in, and the index the tab lands on
+ once it has left its own place. */
+function tabTarget(x: number, y: number): Target | null {
+ const strip = document.getElementById('tabs');
+ if (!strip || !spec) return null;
+ const bounds = box(strip);
+ if (x < bounds.left || x >= bounds.left + bounds.width) return null;
+ if (y < bounds.top || y >= bounds.top + bounds.height) return null;
+ const caps = Array.from(strip.querySelectorAll('.tab')).filter(
+ (el) => el.getAttribute('data-tab') !== spec?.id,
+ );
+ const rects = caps.map(box);
+ const at = rects.filter((r) => r.left + r.width / 2 < x).length;
+ const edge = at < rects.length ? rects[at].left : rects.length > 0 ? rects[at - 1].left + rects[at - 1].width : x;
+ const top = rects.length > 0 ? rects[0].top : bounds.top + 4;
+ const height = rects.length > 0 ? rects[0].height : bounds.height - 8;
+ return { kind: 'at', at, line: { left: edge - 1, top, width: 2, height } };
+}
+
+type Layout = {
+ cell?: [number, number];
+ panes?: { id: number; left: number; top: number; cols: number; rows: number }[];
+};
+
+/** The pane under the pointer and the half of it nearest the pointer, from
+ the layout the wasm publishes: its boxes are in cells, and the grid
+ starts a cell in and half a cell down (App::pad), as `paneAt` reads it. */
+function paneTarget(x: number, y: number): Target | null {
+ const canvas = document.getElementById('term');
+ if (!(canvas instanceof HTMLCanvasElement) || !spec) return null;
+ let layout: Layout;
+ try {
+ layout = JSON.parse(canvas.dataset.layout || '{}') as Layout;
+ } catch {
+ return null;
+ }
+ const cell = layout.cell;
+ if (!cell || !(cell[0] > 0) || !(cell[1] > 0) || !Array.isArray(layout.panes)) return null;
+ const bounds = box(canvas);
+ const x0 = bounds.left + cell[0];
+ const y0 = bounds.top + cell[1] / 2;
+ for (const p of layout.panes) {
+ const rect = {
+ left: x0 + p.left * cell[0],
+ top: y0 + p.top * cell[1],
+ width: p.cols * cell[0],
+ height: p.rows * cell[1],
+ };
+ if (x < rect.left || x >= rect.left + rect.width || y < rect.top || y >= rect.top + rect.height) continue;
+ if (String(p.id) === spec.id) return null;
+ const fx = (x - rect.left) / Math.max(rect.width, 1);
+ const fy = (y - rect.top) / Math.max(rect.height, 1);
+ let edge: Edge = 'left';
+ let near = fx;
+ for (const [d, e] of [[1 - fx, 'right'], [fy, 'top'], [1 - fy, 'bottom']] as [number, Edge][]) {
+ if (d < near) {
+ near = d;
+ edge = e;
+ }
+ }
+ const zone =
+ edge === 'left' ? { ...rect, width: rect.width / 2 }
+ : edge === 'right' ? { ...rect, left: rect.left + rect.width / 2, width: rect.width / 2 }
+ : edge === 'top' ? { ...rect, height: rect.height / 2 }
+ : { ...rect, top: rect.top + rect.height / 2, height: rect.height / 2 };
+ return { kind: 'pane', target: String(p.id), edge, zone };
+ }
+ return null;
+}
+
+function retarget(x: number, y: number) {
+ if (!spec) return;
+ target =
+ spec.kind === 'pane' ? paneTarget(x, y)
+ : spec.kind === 'tab' ? tabTarget(x, y)
+ : sideTarget(x, y);
+ drag.ok = target !== null;
+ drag.line = target && target.kind !== 'pane' ? target.line : null;
+ drag.zone = target && target.kind === 'pane' ? target.zone : null;
+}
+
+/** The list under the pointer scrolls while the drag rests at its edge; a
+ parked pointer sends no more moves, so each applied step queues the next. */
+function autoscroll(x: number, y: number) {
+ if (!spec || spec.kind === 'pane') return;
+ const el =
+ spec.kind === 'tab'
+ ? document.getElementById('tabs')
+ : document.querySelector<HTMLElement>('#side .list');
+ if (!el) return;
+ const bounds = box(el);
+ const across = spec.kind === 'tab';
+ const at = across ? x : y;
+ const start = across ? bounds.left : bounds.top;
+ const end = start + (across ? bounds.width : bounds.height);
+ const delta = at < start + HOT ? -STEP : at > end - HOT ? STEP : 0;
+ if (delta === 0) return;
+ const before = across ? el.scrollLeft : el.scrollTop;
+ if (across) el.scrollLeft = before + delta;
+ else el.scrollTop = before + delta;
+ if ((across ? el.scrollLeft : el.scrollTop) === before) return;
+ if (scroll !== null) return;
+ scroll = setTimeout(() => {
+ scroll = null;
+ if (!active) return;
+ autoscroll(drag.x, drag.y);
+ retarget(drag.x, drag.y);
+ }, TICK);
+}
+
+function begin(x: number, y: number) {
+ if (!spec || active) return;
+ active = true;
+ drag.kind = spec.kind;
+ drag.label = spec.label;
+ document.body.classList.add('dnd');
+ retarget(x, y);
+}
+
+/** Put everything back; `commit` says whether the drop is performed first. */
+/** The next click is the press's, not the row's: set when a drag or a
+ cancel ate a press a click will still follow. */
+let swallowNext = false;
+
+function finish(commit: boolean, clickFollows = false) {
+ if (hold !== null) {
+ clearTimeout(hold);
+ hold = null;
+ }
+ if (scroll !== null) {
+ clearTimeout(scroll);
+ scroll = null;
+ }
+ // Only a press that will produce a click is swallowed: a finger that
+ // travelled and a cancelled pointer produce none, and the next tap
+ // must not pay for them.
+ if (clickFollows) {
+ swallow = Date.now();
+ swallowNext = true;
+ }
+ const landed = commit && active ? target : null;
+ const picked = spec;
+ spec = null;
+ pointer = null;
+ active = false;
+ target = null;
+ drag.kind = null;
+ drag.line = null;
+ drag.zone = null;
+ drag.ok = false;
+ document.body.classList.remove('dnd', 'dnd-no');
+ if (!landed || !picked || !handle.client) return;
+ // The model performs it or refuses it; a refusal draws nothing.
+ if (landed.kind === 'pane') handle.client.drop('pane', picked.id, landed.target, landed.edge, null);
+ else if (landed.kind === 'at') handle.client.drop('tab', picked.id, null, null, landed.at);
+ else handle.client.drop(picked.kind, picked.id, landed.before ?? null, null, null);
+ refreshViews();
+ // The terminal keeps the keyboard, as it had it before the press.
+ document.getElementById('kbd')?.focus();
+}
+
+function onMove(ev: PointerEvent) {
+ if (!spec || ev.pointerId !== pointer) return;
+ // A release the page never saw (over another window, a Cmd+Tab) ends
+ // it on the next move with no button down.
+ if (ev.pointerType === 'mouse' && ev.buttons === 0) {
+ finish(false);
+ return;
+ }
+ drag.x = ev.clientX;
+ drag.y = ev.clientY;
+ if (!active) {
+ const dx = ev.clientX - startX;
+ const dy = ev.clientY - startY;
+ if (dx * dx + dy * dy < THRESHOLD * THRESHOLD) return;
+ // A finger that wandered before it rested was scrolling the list.
+ if (ev.pointerType === 'touch') {
+ finish(false);
+ return;
+ }
+ begin(ev.clientX, ev.clientY);
+ }
+ autoscroll(ev.clientX, ev.clientY);
+ retarget(ev.clientX, ev.clientY);
+ document.body.classList.toggle('dnd-no', !drag.ok);
+}
+
+function onUp(ev: PointerEvent) {
+ if (!spec || ev.pointerId !== pointer) return;
+ const up = ev.type === 'pointerup';
+ // A mouse release produces a click; a lifted finger that dragged
+ // does not.
+ finish(up, up && active && ev.pointerType === 'mouse');
+}
+
+function onKey(ev: KeyboardEvent) {
+ if (spec && ev.key === 'Escape') {
+ ev.stopPropagation();
+ // The button is still down: its release will click whatever is
+ // under it, and that click is the cancelled drag's.
+ finish(false, active);
+ }
+}
+
+function onBlur() {
+ if (spec) finish(false);
+}
+
+/** A drag ate the press, so the click it produced is not the row's. */
+function onClick(ev: MouseEvent) {
+ if (!swallowNext || Date.now() - swallow > 1500) {
+ swallowNext = false;
+ return;
+ }
+ swallowNext = false;
+ swallow = 0;
+ ev.stopPropagation();
+ ev.preventDefault();
+}
+
+/** A finger that has taken over must not scroll the page under it. */
+function onTouchMove(ev: TouchEvent) {
+ if (active && ev.cancelable) ev.preventDefault();
+}
+
+/** Arm a drag on this press. It becomes one once the pointer travels, or
+ once a finger has rested; until then the press is still a click. */
+export function armDrag(ev: PointerEvent, picked: Spec) {
+ if (spec !== null) return;
+ if (ev.pointerType === 'mouse' && ev.button !== 0) return;
+ spec = picked;
+ pointer = ev.pointerId;
+ startX = ev.clientX;
+ startY = ev.clientY;
+ drag.x = ev.clientX;
+ drag.y = ev.clientY;
+ active = false;
+ target = null;
+ if (ev.pointerType === 'touch') {
+ hold = setTimeout(() => {
+ hold = null;
+ begin(drag.x, drag.y);
+ }, HOLD);
+ }
+}
+
+/** The window listeners the drag runs on, installed once by the drag layer. */
+export function installDrag(): () => void {
+ window.addEventListener('pointermove', onMove);
+ window.addEventListener('pointerup', onUp);
+ window.addEventListener('pointercancel', onUp);
+ window.addEventListener('blur', onBlur);
+ window.addEventListener('keydown', onKey, true);
+ window.addEventListener('click', onClick, true);
+ window.addEventListener('touchmove', onTouchMove, { passive: false });
+ return () => {
+ window.removeEventListener('pointermove', onMove);
+ window.removeEventListener('pointerup', onUp);
+ window.removeEventListener('pointercancel', onUp);
+ window.removeEventListener('blur', onBlur);
+ window.removeEventListener('keydown', onKey, true);
+ window.removeEventListener('click', onClick, true);
+ window.removeEventListener('touchmove', onTouchMove);
+ };
+}
diff --git a/thinkterm-web/ui/src/icons.ts b/thinkterm-web/ui/src/icons.ts
index 57d4e2e3..57ccb394 100644
--- a/thinkterm-web/ui/src/icons.ts
+++ b/thinkterm-web/ui/src/icons.ts
@@ -7,6 +7,7 @@ import archiveRestore from '../../../third_party/lucide/icons/archive-restore.sv
import bell from '../../../third_party/lucide/icons/bell.svg?raw';
import info from '../../../third_party/lucide/icons/info.svg?raw';
import minus from '../../../third_party/lucide/icons/minus.svg?raw';
+import notebookTabs from '../../../third_party/lucide/icons/notebook-tabs.svg?raw';
import palette from '../../../third_party/lucide/icons/palette.svg?raw';
import bot from '../../../third_party/lucide/icons/bot.svg?raw';
import check from '../../../third_party/lucide/icons/check.svg?raw';
@@ -15,13 +16,17 @@ import chevronRight from '../../../third_party/lucide/icons/chevron-right.svg?ra
import circleAlert from '../../../third_party/lucide/icons/circle-alert.svg?raw';
import circleCheck from '../../../third_party/lucide/icons/circle-check.svg?raw';
import circlePlus from '../../../third_party/lucide/icons/circle-plus.svg?raw';
+import codeXml from '../../../third_party/lucide/icons/code-xml.svg?raw';
import clipboardPaste from '../../../third_party/lucide/icons/clipboard-paste.svg?raw';
import copy from '../../../third_party/lucide/icons/copy.svg?raw';
import ellipsis from '../../../third_party/lucide/icons/ellipsis.svg?raw';
import eye from '../../../third_party/lucide/icons/eye.svg?raw';
+import folderTree from '../../../third_party/lucide/icons/folder-tree.svg?raw';
import folder from '../../../third_party/lucide/icons/folder.svg?raw';
import folderOpen from '../../../third_party/lucide/icons/folder-open.svg?raw';
import folderPlus from '../../../third_party/lucide/icons/folder-plus.svg?raw';
+import globe from '../../../third_party/lucide/icons/globe.svg?raw';
+import grid2x2 from '../../../third_party/lucide/icons/grid-2x2.svg?raw';
import house from '../../../third_party/lucide/icons/house.svg?raw';
import languages from '../../../third_party/lucide/icons/languages.svg?raw';
import layers from '../../../third_party/lucide/icons/layers.svg?raw';
@@ -66,11 +71,15 @@ export {
circleCheck,
circlePlus,
clipboardPaste,
+ codeXml,
copy,
ellipsis,
eye,
folder,
folderOpen,
+ folderTree,
+ globe,
+ grid2x2,
folderPlus,
house,
info,
@@ -81,6 +90,7 @@ export {
maximize2,
minimize2,
minus,
+ notebookTabs,
palette,
panelLeft,
panelRight,
@@ -124,6 +134,11 @@ const BY_NAME: Record<string, string> = {
folder,
'folder-open': folderOpen,
'folder-plus': folderPlus,
+ 'folder-tree': folderTree,
+ 'notebook-tabs': notebookTabs,
+ 'code-xml': codeXml,
+ globe,
+ 'grid-2x2': grid2x2,
house,
languages,
layers,
diff --git a/thinkterm-web/ui/src/main.ts b/thinkterm-web/ui/src/main.ts
index f357e499..73a184f8 100644
--- a/thinkterm-web/ui/src/main.ts
+++ b/thinkterm-web/ui/src/main.ts
@@ -5,7 +5,7 @@ import { handle } from './client';
import { attach, setBoot } from './client.svelte';
import { watchMobile } from './mobile.svelte';
import { storedPicks, watchHotkey } from './palette.svelte';
-import { applyTheme, storedSettings, storedSpace } from './settings.svelte';
+import { applyTheme, previewScheme, storedScheme, storedSettings, storedSpace } from './settings.svelte';
import type { Theme } from './model';
import './tokens.css';
@@ -126,6 +126,9 @@ try {
// console, not a failed boot -- the defaults are perfectly usable.
const refused = handle.client.apply_settings(JSON.stringify(settings));
if (refused !== "") console.warn("stored settings: " + refused);
+ // The picked scheme's colours were stored with its name, so the first
+ // frame is already in it and nothing waits on schemes.json.
+ if (settings["terminal-scheme"] && settings["terminal-scheme"] !== "desktop") previewScheme(storedScheme());
attach(handle.client);
// Which locale the preference came to, for the settings panel to name.
document.documentElement.lang = handle.client.set_locale(locale, languages);
diff --git a/thinkterm-web/ui/src/mobile.svelte.ts b/thinkterm-web/ui/src/mobile.svelte.ts
index 3b94f370..66d299ca 100644
--- a/thinkterm-web/ui/src/mobile.svelte.ts
+++ b/thinkterm-web/ui/src/mobile.svelte.ts
@@ -7,9 +7,11 @@
/** A window narrower than this is the phone shape whatever the pointer is. */
const NARROW = 720;
-/** The key bar's height. The canvas and the drawers leave room for it, and
- it is what the bar is offset by from the foot of the visual viewport. */
-export const KEYBAR = 44;
+/** The key bar's height, safe area aside: 44px keys with 4px of air above
+ and below, so every key clears the 44px a thumb needs. The bar reports
+ what it really measures as `--keybar`, which is this plus whatever the
+ home indicator takes; the canvas and the drawers leave room for that. */
+export const KEYBAR = 52;
export const mobile = $state({
/** The page is in its phone shape. */
diff --git a/thinkterm-web/ui/src/model.ts b/thinkterm-web/ui/src/model.ts
index 394db965..f05b4f26 100644
--- a/thinkterm-web/ui/src/model.ts
+++ b/thinkterm-web/ui/src/model.ts
@@ -45,7 +45,7 @@ export type NavsView = NavView[];
export type Strings = Record<string, string>;
export type Toast = { text: string; sticky: boolean; at: number };
-export type Card = { title: string; hint: string };
+export type Card = { title: string; hint: string; state: 'busy' | 'free' | 'taking' | 'refused'; action: string };
export type StatusView = { toast: Toast | null; card: Card | null; summary: string };
// The sidebar (thinkterm-web/src/tree.rs `Row`, `ThreadRow`; sidebar.rs
@@ -90,8 +90,35 @@ export type Editing =
| { kind: 'project'; id: string }
| { kind: 'space'; id: string };
-/** `space` is the Space on show, for the page to remember. */
-export type SidebarView = { rows: SideRow[]; editing: Editing; space: string | null };
+/** `space` is the Space on show, for the page to remember;
+ `new_project_error` is why the last path typed into Add workspace was
+ refused, shown beside the field. */
+/** What a hover over the window's left edge does with the panel put away
+ (thinkterm-web/src/sidebar.rs `REVEAL`). Lengths are CSS pixels. */
+export type Reveal = { edge: number; dwell_ms: number; retreat_ms: number };
+
+/** One action in the panel's footer (`sidebar.rs` `FooterAction`); `label`
+ is drawn beside the icon while the panel is wide enough for it. */
+export type FooterAction = {
+ id: string;
+ icon: string;
+ label: string | null;
+ tip: string;
+ enabled: boolean;
+ /** Right-aligned, as the desktop keeps everything but the gear. */
+ trailing: boolean;
+};
+
+export type SidebarView = {
+ rows: SideRow[];
+ editing: Editing;
+ space: string | null;
+ new_project_error: string | null;
+ reveal: Reveal;
+ footer: FooterAction[];
+ /** Below this the footer shows the gear without its label. */
+ footer_label_min_width: number;
+};
// The context menus (thinkterm-web/src/menu.rs `MenuItem`, `Kind`; views.rs
// `MenuOutcome`): what a menu offers, and what running a row came to.
@@ -164,7 +191,17 @@ export type AgentRow = {
};
/** `summary` is the line above the rows; "No agents detected" when empty. */
-export type AgentsView = { rows: AgentRow[]; summary: string };
+/** One tab of the right panel's selector (`agents.rs` `PanelTab`): which
+ exist, and which this browser can open. */
+export type PanelTab = {
+ id: string;
+ icon: string;
+ label: string;
+ available: boolean;
+ tip: string;
+};
+
+export type AgentsView = { rows: AgentRow[]; summary: string; tabs: PanelTab[]; active: string };
// The page's own preferences (thinkterm-web/src/settings.rs `WebSettings`),
// whose JSON names are kebab-case.
@@ -182,6 +219,23 @@ export type WebSettings = {
'agents-panel': boolean;
'palette-hotkey': Hotkey;
'sidebar-width': number;
+ /** `"desktop"` follows the server's configuration; else a scheme's name. */
+ 'terminal-scheme': string;
+};
+
+/** One entry of `schemes.json`, built by `thinkterm cli color-schemes
+ --json`. Every colour is a `#rrggbb` string. */
+export type Scheme = {
+ name: string;
+ foreground: string;
+ background: string;
+ cursor_bg: string;
+ cursor_fg: string;
+ cursor_border: string;
+ selection_bg: string;
+ selection_fg: string;
+ ansi: string[];
+ brights: string[];
};
/** One row of `client.languages()`. */
diff --git a/thinkterm-web/ui/src/motion.ts b/thinkterm-web/ui/src/motion.ts
new file mode 100644
index 00000000..b61f2915
--- /dev/null
+++ b/thinkterm-web/ui/src/motion.ts
@@ -0,0 +1,26 @@
+// What the page animates, and how long for. The desktop animates its
+// overlays in; a browser expects the same, and a reader who has asked the
+// system for less motion expects none -- so every duration goes through
+// here and comes back zero when they have.
+
+const REDUCED = '(prefers-reduced-motion: reduce)';
+
+/** Whether this reader has asked for less motion, read at the moment of the
+ transition rather than cached: the setting can change mid-session. */
+export function reduced(): boolean {
+ try {
+ return window.matchMedia(REDUCED).matches;
+ } catch {
+ return false;
+ }
+}
+
+/** A duration in ms, or none at all for a reader who asked for less. */
+export function ms(duration: number): number {
+ return reduced() ? 0 : duration;
+}
+
+/** The overlays' own timings: menus and the palette snap, the settings
+ window -- the biggest surface the page opens -- takes a beat longer. */
+export const POP = 120;
+export const WINDOW = 160;
diff --git a/thinkterm-web/ui/src/settings.svelte.ts b/thinkterm-web/ui/src/settings.svelte.ts
index 304a169d..10d1f2d1 100644
--- a/thinkterm-web/ui/src/settings.svelte.ts
+++ b/thinkterm-web/ui/src/settings.svelte.ts
@@ -6,12 +6,16 @@
import { handle } from './client';
import { refreshViews, setLocale, views } from './client.svelte';
-import type { LanguageOption, Theme } from './model';
+import type { LanguageOption, Scheme, Theme } from './model';
/** Where this browser keeps the preferences, whole, as the wasm's JSON. */
const STORE = 'thinkterm.settings';
/** The Space the sidebar was showing, so the next load opens on it. */
const SPACE = 'thinkterm.space';
+/** The picked scheme, colours and all, so a boot needs no `schemes.json`. */
+const SCHEME = 'thinkterm.scheme';
+/** The `terminal-scheme` value that means "whatever the server is set to". */
+export const FOLLOW_DESKTOP = 'desktop';
export const panel = $state({
/** The modal is up. */
@@ -144,3 +148,66 @@ export function applyTheme(theme: Theme) {
follow = listener;
paint(query.matches);
}
+
+
+// The colour schemes. The table is a build output (ci/build-web.sh runs
+// `thinkterm cli color-schemes --json` into www/schemes.json), a megabyte
+// or so, so it is fetched when the picker first opens and never at boot:
+// the picked scheme's own colours are stored with its name.
+
+export const schemes = $state({
+ /** The table, once fetched. */
+ all: [] as Scheme[],
+ /** A fetch is in flight. */
+ loading: false,
+ /** Why the table could not be read; empty when it could. */
+ error: '',
+});
+
+export async function loadSchemes() {
+ if (schemes.all.length > 0 || schemes.loading) return;
+ schemes.loading = true;
+ schemes.error = '';
+ try {
+ const res = await fetch(new URL('schemes.json', document.baseURI).href);
+ if (!res.ok) throw new Error(String(res.status));
+ schemes.all = (await res.json()) as Scheme[];
+ } catch (e) {
+ schemes.error = String((e as { message?: string })?.message ?? e);
+ } finally {
+ schemes.loading = false;
+ }
+}
+
+/** The scheme this browser picked, as it was stored, or nothing. */
+export function storedScheme(): Scheme | null {
+ try {
+ const raw = localStorage.getItem(SCHEME);
+ if (!raw) return null;
+ const value = JSON.parse(raw) as Scheme;
+ return value && typeof value.name === 'string' && Array.isArray(value.ansi) ? value : null;
+ } catch {
+ return null;
+ }
+}
+
+/** Draw with `scheme` without keeping it: what a hover shows. `null` goes
+ back to the server's own scheme. */
+export function previewScheme(scheme: Scheme | null) {
+ const client = handle.client;
+ if (!client) return;
+ client.set_terminal_palette(scheme ? JSON.stringify(scheme) : undefined);
+}
+
+/** Keep `scheme` for this browser: the colours beside the name, so the next
+ boot draws with it before `schemes.json` is anywhere near. */
+export function pickScheme(scheme: Scheme | null) {
+ previewScheme(scheme);
+ try {
+ if (scheme) localStorage.setItem(SCHEME, JSON.stringify(scheme));
+ else localStorage.removeItem(SCHEME);
+ } catch {
+ // A browser that blocks storage keeps it for this load only.
+ }
+ setSetting('terminal-scheme', scheme ? scheme.name : FOLLOW_DESKTOP);
+}
diff --git a/thinkterm-web/ui/src/tokens.css b/thinkterm-web/ui/src/tokens.css
index 851919ec..d92e17d6 100644
--- a/thinkterm-web/ui/src/tokens.css
+++ b/thinkterm-web/ui/src/tokens.css
@@ -10,6 +10,12 @@
--ui: -apple-system, "SF Pro Text", "Helvetica Neue", Roboto, system-ui, sans-serif;
--tabs: 40px; --side-w: 220px; --side-px: 220px; --agents-w: 0px; --keybar: 0px;
--done: #7CE5A2; --open: #61B8FF; --warn: #DB7320;
+ /* Measured off the desktop's own frames: its round buttons and pills
+ (#262628), its selected row (#3E3E41), its settings card (#1D1D1F). */
+ --btn: #262628; --btn-hover: #313134; --btn-border: rgba(118,118,128,.35);
+ --row-hover: #232326; --row-sel: #3E3E41;
+ --card: #1D1D1F; --card-border: rgba(118,118,128,.22); --card-line: rgba(118,118,128,.24); --dot: rgba(242,242,247,.16);
+ --fade: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
body[data-side=off] { --side-w: 0px; }
/* The right panel's width lives on the root, as the sidebar's does; without
@@ -22,6 +28,10 @@ body:not([data-agents]) { --agents-w: 0px; }
--text: #1C1C1E; --text2: #48484A; --muted: #8E8E93; --accent: #007AFF; --danger: #D7263D;
--wash: rgba(28,28,30,.025); --ring: rgba(28,28,30,.12); --edge: rgba(28,28,30,.38); --shadow: 0 .5px 0 1px rgba(0,0,0,.04);
--warn: #C05F14;
+ --btn: rgba(255,255,255,.86); --btn-hover: #FFFFFF; --btn-border: rgba(60,60,67,.24);
+ --row-hover: rgba(28,28,30,.06); --row-sel: rgba(255,255,255,.94);
+ --card: rgba(255,255,255,.72); --card-border: rgba(60,60,67,.16); --card-line: rgba(60,60,67,.14);
+ --dot: rgba(28,28,30,.22);
}
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text2); font: 500 14px var(--ui); overflow: hidden; }
/* The page is mounted into #app; it generates no box of its own, so the
@@ -32,7 +42,7 @@ svg { width: 16px; height: 16px; flex: none; }
/* The window's tab row. Capsules never shrink; the row scrolls. */
#tabs { position: absolute; left: var(--side-w); right: var(--agents-w); top: 0; height: var(--tabs); box-sizing: border-box; display: flex; align-items: center; gap: 9px; padding: 2px 8px 0 8px; background: var(--bg); overflow-x: auto; overflow-y: hidden; white-space: nowrap; user-select: none; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
-#tabs .tab { display: inline-flex; align-items: center; flex: 0 0 auto; width: 160px; height: 30px; box-sizing: border-box; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; color: var(--text2); cursor: default; }
+#tabs .tab { display: inline-flex; align-items: center; flex: 0 0 auto; width: 128px; height: 30px; box-sizing: border-box; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; color: var(--text2); cursor: default; transition: var(--fade); }
#tabs .tab:hover { background: var(--ctl-hover); }
#tabs .tab.current { background: var(--ctl); border-color: var(--ctl-border); box-shadow: var(--shadow); color: var(--text); }
.t { margin-left: 4px; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -40,11 +50,10 @@ svg { width: 16px; height: 16px; flex: none; }
.current .x, .tab:hover .x, .cap:hover .x { display: inline-flex; }
.x:hover { background: var(--ring); opacity: 1; }
.x.danger { width: auto; padding: 0 6px; font-size: 11px; color: var(--danger); opacity: 1; }
-.act { width: 30px; height: 30px; flex: none; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; box-sizing: border-box; color: var(--text2); }
+.act { width: 30px; height: 30px; flex: none; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; box-sizing: border-box; color: var(--text2); transition: var(--fade); }
.act:hover { background: var(--ctl-hover); border-color: var(--edge); color: var(--text); }
#tabs .act.on { color: var(--accent); }
#tabs .trail { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
-#tabs .hint { color: var(--muted); font-size: 12px; padding: 0 6px; }
#tabs .follow { color: var(--muted); font-size: 12px; padding: 0 8px; height: 24px; line-height: 24px; border-radius: 999px; cursor: default; }
#tabs .follow.on { color: var(--accent); }
#tabs .follow:hover { background: var(--ctl-hover); }
@@ -54,89 +63,179 @@ svg { width: 16px; height: 16px; flex: none; }
canvas#term { will-change: transform; }
/* One bar over each pane, laid out from the canvas's cells. */
#panes { position: absolute; inset: var(--tabs) var(--agents-w) 0 var(--side-w); pointer-events: none; overflow: hidden; }
-/* The desktop's left sidebar: Spaces, Projects, Threads. */
-#side { position: absolute; left: 0; top: 0; bottom: 0; width: var(--side-w); box-sizing: border-box; background: var(--side-bg); border-right: 1px solid var(--sep); font: 500 15px var(--ui); color: var(--text2); user-select: none; overflow: hidden; }
-body[data-side=off] #side:not(.revealed) { display: none; }
-/* Hovering the window's left edge, or the toggle, while the panel is put
- away: it comes back over the canvas rather than beside it, so nothing is
- resized -- `--side-w` stays 0 and the width comes from `--side-px`. */
-#side.revealed { top: var(--tabs); width: var(--side-px); z-index: 15; box-shadow: 0 8px 28px rgba(0,0,0,.42); }
-#side .list { position: absolute; inset: 26px 5px 44px 5px; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 5px; padding-bottom: 8px; }
-/* The footer, as the desktop's sidebar ends: Settings as a row on the left,
- the thread search as a button on the right. */
-/* The footer as the desktop ends its sidebar: a row of icons, the gear
- at the left inset and the thread search at the right, no rule above. */
-#side .foot { position: absolute; left: 12px; right: 12px; bottom: 0; height: 44px; display: flex; align-items: center; justify-content: space-between; }
+/* The desktop's left sidebar: Spaces, Projects, Threads. Every row's box
+ spans the panel's 10px insets, so a trailing control's centre lands 25px
+ from the right edge, round button or hover action alike. */
+#side { position: absolute; left: 0; top: 0; bottom: 0; width: var(--side-w); box-sizing: border-box; background: var(--side-bg); border-right: 1px solid var(--sep); font: 400 15px var(--ui); color: var(--text2); user-select: none; overflow: hidden; }
+/* Put away, the panel waits off the left edge rather than leaving the tree:
+ the reveal is then a 150ms slide in and a 150ms slide back, which
+ `display: none` could not animate. */
+body[data-side=off]:not([data-mobile]) #side {
+ top: 0; width: var(--side-px); z-index: 17; box-shadow: 0 8px 28px rgba(0,0,0,.42);
+ transform: translateX(-101%); visibility: hidden; pointer-events: none; will-change: transform;
+ transition: transform .15s cubic-bezier(.4,0,1,1), visibility 0s linear .15s;
+}
+body[data-side=off]:not([data-mobile]) #side.revealed {
+ transform: translateX(0); visibility: visible; pointer-events: auto;
+ transition: transform .15s cubic-bezier(0,0,.2,1), visibility 0s;
+}
+@media (prefers-reduced-motion: reduce) {
+ body[data-side=off]:not([data-mobile]) #side { transition: none; }
+}
+#side .list { position: absolute; inset: 26px 10px 44px 10px; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 5px; padding-bottom: 8px; }
+/* The footer as the desktop ends its sidebar: a row of icons, the gear at
+ the left inset and the thread search at the right, no rule above. */
+#side .foot { position: absolute; left: 13px; right: 13px; bottom: 0; height: 58px; display: flex; align-items: center; justify-content: space-between; }
#side .foot .act { width: 28px; height: 28px; color: var(--text2); border-radius: 8px; }
-#side .foot .act svg { width: 15px; height: 15px; }
-#side .foot .act:hover { color: var(--text); background: rgba(42,42,44,.98); }
+/* The gear carries its label, as the desktop's footer does; the row is the
+ label's own width, and the search stays at the right inset. */
+#side .foot .act.lbl { width: auto; min-width: 28px; max-width: calc(100% - 34px); padding: 0 7px; gap: 6px; justify-content: flex-start; font-size: 14px; }
+#side .foot .act.lbl .tl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+/* Under the width the model says the label needs, the gear is a lone
+ button again -- `.narrow` is set from that number, not from a media
+ query with a number of its own. */
+#side.narrow .foot .act.lbl .tl { display: none; }
+#side .foot .act svg { width: 16px; height: 16px; }
+#side .foot .acts { display: inline-flex; align-items: center; gap: 3px; }
+#side .foot .act:hover { color: var(--text); background: var(--row-hover); }
+/* Nothing behind them yet: shown, as the desktop shows them, and inert. */
+#side .foot .act.off { color: var(--muted); opacity: .5; }
+#side .foot .act.off:hover { background: transparent; color: var(--muted); }
+/* The tab row's toggle stays above the revealed panel: a quick press pins
+ the panel open without the reveal getting in the way. */
+#tabs [data-action=sidebar] { position: relative; z-index: 18; }
+/* Pinned open, the panel carries the toggle itself at its top-left, as the
+ desktop's titlebar does; the tab row's copy shows only while it is away. */
+body:not([data-side=off]):not([data-mobile]) #tabs [data-action=sidebar] { display: none; }
+#side .bar { display: none; position: absolute; left: 10px; top: 5px; height: 30px; align-items: center; }
+body:not([data-side=off]):not([data-mobile]) #side .bar { display: flex; }
+body:not([data-side=off]):not([data-mobile]) #side .list { top: var(--tabs); }
+#side .bar .act { width: 30px; height: 30px; border-radius: 8px; color: var(--text2); }
+#side .bar .act:hover { background: var(--ctl-hover); color: var(--text); }
+body[data-side=off]:not([data-mobile]) #side .list { top: var(--tabs); }
#side .handle { position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; cursor: col-resize; z-index: 1; }
-#side .row { display: flex; align-items: center; min-height: 33px; box-sizing: border-box; padding: 0 5px; border-radius: 10px; border: 1px solid transparent; flex: none; }
-#side .row.thread { padding-left: 25px; }
-#side .row .t { margin-left: 5px; color: var(--text); }
+/* 34px rows on a 4px pitch, 10px corners: the desktop's selected thread
+ measures 68 device px tall with a 20 px corner at 2x. */
+#side .row { display: flex; align-items: center; min-height: 33px; box-sizing: border-box; padding: 0 0 0 5px; border-radius: 10px; border: 1px solid transparent; flex: none; transition: var(--fade); }
+#side .row.thread { margin-left: 15px; }
+/* WORKSPACE_SECTION_LABEL_GAP (12 design px) above a section label that
+ follows rows, and WORKSPACE_GROUP_EXTRA_GAP (8) between folders. */
+#side .row + .hdr { margin-top: 6px; }
+#side .row.project { margin-top: 4px; }
+#side .hdr + .row.project, #side .list > .row.project:first-child { margin-top: 0; }
+#side .row.project { padding-left: 2px; }
+#side .row .t { margin-left: 6px; color: var(--text); }
#side .row.project .t, #side .row.space .t { color: var(--text2); }
-#side .row:hover { background: rgba(42,42,44,.98); }
-#side .row.selected { background: rgba(62,62,65,.98); border-color: rgba(118,118,128,.22); box-shadow: var(--shadow); }
+/* The Space row is the pill's height plus 6 design px, not a list row. */
+#side .row.space { min-height: 32px; cursor: default; }
+#side .row.space .act { width: 29px; height: 29px; margin-left: auto; color: var(--text2); }
+#side .row:hover { background: var(--row-hover); }
+#side .row.selected { background: var(--row-sel); border-color: rgba(118,118,128,.22); box-shadow: var(--shadow); }
+#side .row.selected .t { color: var(--text); }
#side .row.archived { opacity: .55; }
-#side .chev { display: inline-flex; width: 16px; margin-right: 2px; color: var(--muted); }
+#side .chev { display: inline-flex; align-items: center; justify-content: center; width: 13px; flex: none; color: var(--muted); }
+#side .chev svg { width: 12px; height: 12px; }
#side .hov { display: none; margin-left: auto; gap: 2px; }
#side .row:hover .hov { display: inline-flex; }
-#side .act { width: 24px; height: 24px; }
-#side .act svg { width: 13px; height: 13px; }
-/* The desktop's round buttons: the bell, the new project, a project's plus. */
-#side .act.round { width: 28px; height: 28px; border-radius: 999px; border: 1px solid rgba(118,118,128,.22); background: rgba(36,36,38,.94); color: var(--text); flex: none; }
-#side .act.round:hover { background: rgba(48,48,50,.98); }
-#side .act.round svg { width: 14px; height: 14px; }
-#side .top { display: flex; align-items: center; gap: 8px; margin: 4px 10px 6px 10px; flex: none; }
-#side .top .pill { flex: 1 1 auto; margin: 0; }
+#side .row.thread .hov { margin-right: 3px; }
+#side .act { width: 24px; height: 24px; border-radius: 8px; transition: var(--fade); }
+#side .act svg { width: 14px; height: 14px; }
+#side .act:hover { background: var(--btn-hover); border-color: transparent; color: var(--text); }
+/* The desktop's round buttons: the bell, the new project, a project's plus.
+ All three measure 60x60 device px at 2x. */
+#side .act.round { width: 29px; height: 29px; border-radius: 999px; border: 1px solid var(--btn-border); background: var(--btn); color: var(--text); flex: none; }
+#side .act.round:hover { background: var(--btn-hover); border-color: var(--btn-border); }
+#side .act.round svg { width: 15px; height: 15px; }
+#side .top { display: flex; align-items: center; gap: 7px; margin: 0 1px; flex: none; box-sizing: border-box; border: 0; }
+#side .top .pill { flex: 1 1 auto; margin: 0; min-width: 0; }
#side .row.project .act.round { margin-left: auto; }
#side .row.project .hov { margin-left: auto; margin-right: 2px; }
#side .row.project:hover .act.round { margin-left: 0; }
-#side .hdr { display: flex; align-items: center; gap: 5px; min-height: 33px; padding: 0 10px; color: var(--text2); font-size: 14px; margin-top: 6px; }
+#side .hdr { display: flex; align-items: center; gap: 6px; min-height: 33px; padding: 0; box-sizing: border-box; border: 1px solid transparent; color: var(--text2); font-size: 15px; margin-top: 0px; }
#side .hdr .act { margin-left: auto; }
#side .hdr.sub { cursor: default; }
-#side .pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; margin: 4px 10px 6px 10px; border-radius: 999px; background: rgba(36,36,38,.94); border: 1px solid rgba(118,118,128,.22); color: var(--text); flex: none; }
-#side .pill:hover { background: rgba(48,48,50,.98); }
-#side .st { display: inline-flex; width: 13px; height: 13px; align-items: center; justify-content: center; margin-left: 6px; flex: none; }
+#side .pill span { overflow: hidden; text-overflow: ellipsis; }
+#side .pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 29px; margin: 0; padding: 0 10px; box-sizing: border-box; min-width: 0; white-space: nowrap; overflow: hidden; border-radius: 999px; background: var(--btn); border: 1px solid var(--btn-border); color: var(--text); flex: none; transition: var(--fade); }
+#side .pill svg { width: 15px; height: 15px; }
+#side .pill:hover { background: var(--btn-hover); }
+#side .st { display: inline-flex; width: 14px; height: 14px; align-items: center; justify-content: center; margin: 0; flex: none; }
#side .st svg { width: 13px; height: 13px; }
#side .st.alert svg { width: 10px; height: 10px; }
#side .st.done { color: var(--done); }
-#side .st.dot::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: rgba(242,242,247,.16); }
+/* 10 device px at 2x, so 5. */
+#side .st.dot::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: var(--dot); }
#side .st.dot.active::before { background: var(--done); }
-#side .st.dot.unread::before { background: #3A3A3C; }
-#side .st.dot.pinned::before { background: rgba(242,242,247,.68); }
+#side .st.dot.unread::before { background: var(--muted); }
+#side .st.dot.pinned::before { background: var(--text2); }
#side .st.dot.open::before { background: var(--open); }
-#side input.rename { font: 500 15px var(--ui); color: var(--text); background: #3A3A3C; border: 0; border-radius: 4px; padding: 2px 4px; margin-left: 5px; flex: 1 1 auto; min-width: 0; outline: none; }
-#side .path { display: flex; align-items: center; gap: 5px; padding: 0 10px; }
-#side .path input { flex: 1 1 auto; min-width: 0; font: 14px var(--ui); color: var(--text); background: var(--ctl); border: 1px solid var(--ctl-border); border-radius: 6px; padding: 4px 6px; outline: none; }
-/* The desktop's right-hand Agents panel: one row per pane an agent runs
- in (wezterm-gui/src/termwindow/ui/agent_panel.rs). */
-#agents { position: absolute; right: 0; top: 0; bottom: 0; width: var(--agents-w); box-sizing: border-box; background: var(--side-bg); border-left: 1px solid var(--sep); font: 500 13px var(--ui); color: var(--text2); user-select: none; overflow: hidden; }
+#side input.rename { font: 400 15px var(--ui); color: var(--text); background: var(--ctl); border: 1px solid var(--ctl-border); border-radius: 4px; padding: 2px 4px; margin-left: 6px; flex: 1 1 auto; min-width: 0; outline: none; }
+#side input { user-select: text; -webkit-user-select: text; }
+/* Add workspace: a labelled block under the Workspaces header rather than
+ a bare field, with the hint under the input and the refusal in its place
+ when a path came back refused. */
+#side .path { display: flex; flex-direction: column; gap: 6px; margin: 1px 0 3px 0; padding: 8px 9px 9px 9px; box-sizing: border-box; border-radius: 10px; background: var(--card); border: 1px solid var(--card-border); flex: none; }
+#side .path .lb { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
+#side .path .lb svg { width: 14px; height: 14px; color: var(--text2); }
+#side .path input { width: 100%; box-sizing: border-box; font: 400 14px var(--ui); color: var(--text); background: var(--ctl); border: 1px solid var(--ctl-border); border-radius: 7px; padding: 6px 8px; outline: none; transition: var(--fade); }
+#side .path input::placeholder { color: var(--muted); }
+#side .path input:focus { border-color: var(--accent); }
+#side .path .hint { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.35; word-break: break-word; }
+#side .path.bad input { border-color: var(--danger); }
+#side .path.bad .hint { color: var(--danger); }
+/* With no workspace yet, the header's round button is the only way in and
+ nothing says so; this row does. */
+#side .hdr.add { gap: 7px; min-height: 33px; padding: 0 8px; border-radius: 10px; border: 1px dashed var(--card-line); color: var(--muted); transition: var(--fade); }
+#side .hdr.add svg { width: 15px; height: 15px; }
+#side .hdr.add:hover { color: var(--text); background: var(--row-hover); border-color: var(--edge); }
+/* The desktop's right-hand Agents panel (wezterm-gui/src/termwindow/ui/
+ agent_panel.rs). A sibling of the left sidebar: the same 10px insets,
+ 10px row corners and 15px face, on rows that are three of the desktop's
+ text lines tall because they carry two -- identity, then state and
+ place. The desktop's own empty state is the toolbar line and nothing
+ else, which is what this draws too. */
+#agents { position: absolute; right: 0; top: 0; bottom: 0; width: var(--agents-w); box-sizing: border-box; background: var(--side-bg); border-left: 1px solid var(--sep); font: 500 15px var(--ui); color: var(--text2); user-select: none; overflow: hidden; }
#agents .handle { position: absolute; left: -2px; top: 0; bottom: 0; width: 4px; cursor: col-resize; z-index: 1; }
-#agents .hd { position: absolute; left: 0; right: 0; top: 0; box-sizing: border-box; padding: 9px 12px 7px 12px; display: flex; flex-direction: column; gap: 2px; }
-#agents .hd .ti { color: var(--text); font-size: 14px; }
-#agents .hd .sum { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-#agents .list { position: absolute; inset: 56px 5px 0 5px; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 2px; padding-bottom: 32px; }
-/* Two lines and a chip, the row height the desktop gives them. */
-#agents .ag { display: flex; align-items: center; gap: 9px; min-height: 46px; box-sizing: border-box; padding: 5px 7px; border-radius: 10px; flex: none; }
-#agents .ag:hover { background: rgba(42,42,44,.98); }
+/* The title, then the desktop's toolbar line: what the panel is showing,
+ or why it is showing nothing. */
+#agents .hd { position: absolute; left: 0; right: 0; top: 0; box-sizing: border-box; padding: 8px 10px 0 10px; display: flex; flex-direction: column; }
+#agents .hd .ti { display: flex; align-items: center; min-height: 30px; color: var(--text); font-size: 15px; }
+#agents .hd .sum { display: flex; align-items: center; min-height: 32px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+/* The desktop's segmented mode selector (`right_sidebar.rs`, the block
+ under RIGHT_SIDEBAR_MODE_HEIGHT): a bordered capsule of four segments,
+ the active one a filled pill with its label, on a 5px inner inset. Only
+ Agents has a wire behind it here; the other three say so and refuse. */
+#agents .modes { display: flex; align-items: stretch; height: 34px; margin: 6px 0 0 0; box-sizing: border-box; border-radius: 999px; background: var(--btn); border: 1px solid var(--btn-border); padding: 2px; gap: 0; }
+#agents .mode { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 1 0; min-width: 0; box-sizing: border-box; border-radius: 999px; border: 1px solid transparent; color: var(--text2); font-size: 13px; cursor: default; transition: var(--fade); }
+#agents .mode svg { width: 15px; height: 15px; }
+#agents .mode.on { flex: 0 1 auto; padding: 0 11px; background: var(--ctl); border-color: var(--ctl-border); box-shadow: var(--shadow); color: var(--text); }
+#agents .mode .ml { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+/* Nothing to press: the tooltip is the whole answer, so no hover lift. */
+#agents .mode.off { color: var(--muted); opacity: .55; }
+#agents .list { position: absolute; inset: 110px 10px 0 10px; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 2px; padding-bottom: 24px; }
+/* 60px: three lines of the row's own 20px leading, as the desktop's
+ `agents_row_height` gives two lines a file row's share of padding. */
+#agents .ag { display: flex; align-items: center; gap: 10px; min-height: 60px; box-sizing: border-box; padding: 0 6px; border-radius: 10px; border: 1px solid transparent; flex: none; transition: var(--fade); }
+#agents .ag:hover { background: var(--row-hover); }
#agents .ag.elsewhere { opacity: .62; }
#agents .ic { display: inline-flex; width: 20px; height: 20px; flex: none; align-items: center; justify-content: center; color: var(--text2); }
#agents .ic svg { width: 20px; height: 20px; }
/* The brand marks carry no stroke and no fill of their own. */
#agents .ic svg[role=img] { fill: currentColor; }
-#agents .tx { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
-#agents .n { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+#agents .tx { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
+#agents .n { color: var(--text); line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#agents .n .d { color: var(--muted); }
-#agents .p { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+#agents .p { color: var(--muted); line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#agents .st { display: inline-flex; width: 16px; height: 16px; flex: none; align-items: center; justify-content: center; }
#agents .st svg { width: 16px; height: 16px; }
+/* The desktop's three: the sidebar's live blue for working, its amber for
+ waiting on a human, a muted tick for idle. Unknown gets no icon at all. */
+#agents .st.spin { color: var(--open); }
#agents .st.alert { color: var(--warn); }
#agents .st.idle { color: var(--muted); }
.nav { position: absolute; pointer-events: auto; box-sizing: border-box; display: flex; align-items: center; gap: 9px; padding: 0 5px; background: var(--bg); color: var(--text2); user-select: none; overflow: hidden; }
.nav.focused { color: var(--text); }
.nav .caps { display: flex; gap: 9px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
-.nav .cap { display: inline-flex; align-items: center; flex: 0 0 auto; width: 160px; height: 30px; box-sizing: border-box; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; background: var(--wash); color: var(--text2); cursor: default; }
+.nav .cap { display: inline-flex; align-items: center; flex: 0 0 auto; width: 128px; height: 30px; box-sizing: border-box; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; background: var(--wash); color: var(--text2); cursor: default; }
.nav .cap.current { background: var(--ctl); border-color: var(--ctl-border); box-shadow: var(--shadow); color: inherit; }
.nav .cap:hover:not(.current) { background: var(--ctl-hover); }
.nav .acts { display: flex; gap: 2px; margin-left: auto; flex: none; }
@@ -144,16 +243,31 @@ body[data-side=off] #side:not(.revealed) { display: none; }
.spin { display: inline-flex; animation: spin .96s steps(12) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* What the desktop shows over a terminal another device holds. */
-#card { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); text-align: center; padding: 26px 36px; border-radius: 18px; background: color-mix(in srgb, var(--bg) 86%, transparent); border: 1px solid var(--ctl-border); pointer-events: none; user-select: none; }
-#card .eyes { font: 17px var(--ui); color: var(--muted); letter-spacing: 2px; margin-bottom: 8px; }
+@keyframes card-in { from { opacity: 0; } to { opacity: 1; } }
+#card:not([hidden]) { animation: card-in .16s cubic-bezier(0,0,.2,1); }
+/* The desktop's opaque surface: the terminal area, nothing of the pane
+ showing through, the text a little above centre as the desktop's is. */
+#card { position: absolute; inset: var(--tabs) var(--agents-w) 0 var(--side-w); z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; text-align: center; background: var(--bg); user-select: none; cursor: default; }
+#card[hidden] { display: none; }
+#card .eyes { font: 20px var(--ui); color: var(--text); letter-spacing: 2px; margin-bottom: 18px; }
#card .title { font: 500 17px var(--ui); color: var(--text); }
-#card .hint { font: 15px var(--ui); color: var(--text2); margin-top: 10px; }
+#card .hint { font: 14px var(--ui); color: var(--text2); margin-top: 10px; max-width: 420px; }
+#card .go { margin-top: 22px; height: 32px; padding: 0 18px; font: 500 13px var(--ui); color: var(--text); background: var(--ctl); border: 1px solid var(--btn-border); border-radius: 8px; cursor: pointer; transition: var(--fade); }
+#card .go:hover:not(:disabled) { background: var(--ctl-hover); }
+#card .go:disabled { opacity: .55; cursor: default; }
+#card[data-state=refused] .title { color: var(--danger); }
+@keyframes card-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
+#card[data-state=taking] .eyes { animation: card-pulse 1.2s ease-in-out infinite; }
/* Passing remarks: refusals, reconnects. */
#status { position: absolute; right: 12px; bottom: 12px; max-width: 60%; padding: 7px 11px; border-radius: 8px; background: var(--ctl); border: 1px solid var(--ctl-border); color: var(--text); font: 13px var(--ui); box-shadow: 0 2px 12px rgba(0,0,0,.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
#status.error { color: var(--danger); }
/* The context menus: one panel per open submenu, over everything the page
draws, the desktop's control colours at the page's smaller size. */
-.menu { position: fixed; z-index: 20; min-width: 168px; max-width: 340px; box-sizing: border-box; padding: 5px; border-radius: 10px; background: var(--ctl); border: 1px solid var(--ctl-border); box-shadow: 0 8px 28px rgba(0,0,0,.42); color: var(--text); font: 500 13px var(--ui); user-select: none; outline: none; }
+/* The panel arrives at the point it was asked for: a 120ms fade and a
+ hair of scale from that corner. Its own measuring reads offsetWidth,
+ which a transform does not move. */
+@keyframes menu-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
+.menu { animation: menu-in .12s cubic-bezier(0,0,.2,1); transform-origin: top left; position: fixed; z-index: 20; min-width: 168px; max-width: 340px; box-sizing: border-box; padding: 5px; border-radius: 10px; background: var(--ctl); border: 1px solid var(--ctl-border); box-shadow: 0 8px 28px rgba(0,0,0,.42); color: var(--text); font: 500 13px var(--ui); user-select: none; outline: none; }
.menu .mi { display: flex; align-items: center; gap: 8px; height: 28px; box-sizing: border-box; padding: 0 8px; border-radius: 6px; white-space: nowrap; }
.menu .mi:hover, .menu .mi.on { background: var(--ctl-hover); }
.menu .mi.disabled { color: var(--muted); }
@@ -183,48 +297,70 @@ body[data-side=off] #side:not(.revealed) { display: none; }
#palette .st { flex: none; max-width: 34%; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
#palette .acc { flex: none; margin-left: auto; padding-left: 10px; color: var(--muted); font-size: 12px; }
#palette .pn { padding: 14px 9px; color: var(--muted); }
-/* The settings panel: the page's own preferences, one row each. */
-/* The settings window, as the desktop draws it: a nav column with the
- sections, and the section's cards of rows on the right. */
-#settings { position: fixed; z-index: 31; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(920px, 94vw); height: min(602px, 90vh); box-sizing: border-box; display: flex; background: var(--bg); border: 1px solid var(--ctl-border); border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.55); color: var(--text); font: 500 14px var(--ui); overflow: hidden; outline: none; }
-#settings .sc { position: absolute; right: 12px; top: 12px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; background: transparent; border: 0; color: var(--muted); }
-#settings .sc:hover { color: var(--text); background: var(--ctl-hover); }
+/* The colour-scheme picker: the palette's list, over the settings window,
+ with a swatch of the scheme's ground and its eight ANSI colours. */
+#schemes-back { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.28); }
+#schemes { position: fixed; z-index: 41; left: 50%; top: 12vh; transform: translateX(-50%); width: min(520px, 90vw); box-sizing: border-box; display: flex; flex-direction: column; border-radius: 12px; background: var(--ctl); border: 1px solid var(--ctl-border); box-shadow: 0 16px 48px rgba(0,0,0,.46); color: var(--text); font: 500 13px var(--ui); overflow: hidden; }
+#schemes .q { flex: none; box-sizing: border-box; width: 100%; padding: 10px 12px; font: 400 15px var(--ui); color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--sep); outline: none; }
+#schemes .q::placeholder { color: var(--muted); }
+#schemes .pl { flex: 1 1 auto; max-height: 52vh; overflow-y: auto; scrollbar-width: thin; padding: 10px; }
+#schemes .pe { display: flex; align-items: center; gap: 10px; height: 34px; box-sizing: border-box; padding: 0 10px; border-radius: 8px; white-space: nowrap; cursor: default; }
+#schemes .pe.on { background: var(--ctl-hover); }
+#schemes .sw { flex: none; display: inline-flex; align-items: center; gap: 1px; width: 74px; height: 18px; padding: 0 3px; border-radius: 4px; border: 1px solid var(--card-border); box-sizing: border-box; }
+#schemes .sw i { flex: 1 1 auto; height: 10px; border-radius: 1px; }
+#schemes .t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
+#schemes .acc { flex: none; margin-left: auto; padding-left: 10px; color: var(--muted); font-size: 12px; }
+#schemes .pn { padding: 14px 10px; color: var(--muted); }
+#settings .pillsel[data-setting="terminal-scheme"] { text-align: left; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+/* The settings window, as the desktop draws it (desktop-settings.png, 2x):
+ a 220px nav column, then cards of 55px rows on a #1D1D1F ground with the
+ control pills right-aligned to the card's 18px inset. */
+#settings { --settings-tf: translate(-50%, -50%); position: fixed; z-index: 31; left: 50%; top: 50%; transform: var(--settings-tf); width: min(960px, 94vw); height: min(602px, 90vh); box-sizing: border-box; display: flex; background: var(--bg); border: 1px solid var(--ctl-border); border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.55); color: var(--text); font: 500 14px var(--ui); overflow: hidden; outline: none; }
+#settings .sc { position: absolute; right: 12px; top: 12px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; background: transparent; border: 0; color: var(--muted); transition: var(--fade); }
+#settings .sc:hover { color: var(--text); background: var(--row-hover); }
#settings .sc svg { width: 15px; height: 15px; }
-#settings .snav { flex: 0 0 220px; box-sizing: border-box; padding: 18px 14px; background: var(--side-bg); border-right: 1px solid var(--sep); display: flex; flex-direction: column; gap: 10px; }
-#settings .app { font-size: 17px; font-weight: 700; color: var(--text); padding: 12px 2px 6px 2px; }
-#settings .find { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--ctl); border: 1px solid var(--ctl-border); color: var(--muted); }
+#settings .snav { flex: 0 0 220px; box-sizing: border-box; padding: 18px 14px; background: var(--side-bg); border-right: 1px solid var(--sep); display: flex; flex-direction: column; }
+#settings .app { font-size: 17px; font-weight: 700; color: var(--text); padding: 18px 3px 15px 3px; }
+#settings .find { display: flex; align-items: center; gap: 7px; height: 28px; box-sizing: border-box; padding: 0 10px; border-radius: 999px; background: var(--ctl); border: 1px solid var(--ctl-border); color: var(--muted); }
#settings .find svg { width: 14px; height: 14px; flex: none; }
-#settings .find input { flex: 1 1 auto; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font: 500 14px var(--ui); }
-#settings .secs { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
-#settings .sec { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 10px; color: var(--text); cursor: default; }
-#settings .sec svg { width: 16px; height: 16px; flex: none; color: var(--text2); }
-#settings .sec:hover { background: rgba(42,42,44,.98); }
-#settings .sec.on { background: var(--ctl); border: 1px solid var(--ctl-border); box-shadow: var(--shadow); }
-#settings .body { flex: 1 1 auto; min-width: 0; overflow-y: auto; scrollbar-width: thin; padding: 30px 34px 24px 24px; }
-#settings .title { font-size: 20px; font-weight: 700; margin: 6px 0 18px 0; }
-#settings .card { background: var(--ctl); border: 1px solid var(--ctl-border); border-radius: 12px; padding: 0 18px; margin-bottom: 18px; }
-#settings .srow { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--sep); }
+#settings .find input { flex: 1 1 auto; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font: 500 13px var(--ui); }
+#settings .secs { display: flex; flex-direction: column; gap: 4px; margin-top: 11px; }
+/* 68 device px tall on a 76 px pitch at 2x, and the selected row is the
+ sidebar's own #3E3E41. A shadow rather than a border: a border on the
+ selected row alone would move the text by a pixel. */
+#settings .sec { display: flex; align-items: center; gap: 7px; height: 34px; box-sizing: border-box; padding: 0 9px; border-radius: 10px; color: var(--text); cursor: default; transition: var(--fade); }
+#settings .sec svg { width: 15px; height: 15px; flex: none; color: var(--text2); }
+#settings .sec:hover { background: var(--row-hover); }
+#settings .sec.on { background: var(--row-sel); box-shadow: var(--shadow); }
+#settings .body { flex: 1 1 auto; min-width: 0; overflow-y: auto; scrollbar-width: thin; padding: 28px 26px 24px 22px; }
+#settings .title { font-size: 19px; font-weight: 700; margin: 0 0 20px 0; }
+#settings .card { background: var(--card); border: 1px solid var(--card-border); border-radius: 17px; padding: 0 18px; margin-bottom: 18px; }
+#settings .srow { display: flex; align-items: center; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--card-line); }
#settings .srow:last-child { border-bottom: 0; }
#settings .tx { flex: 1 1 auto; min-width: 0; }
#settings .lab { font-weight: 600; color: var(--text); }
-#settings .desc { margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 500; }
-#settings .ctl { display: flex; align-items: center; gap: 10px; flex: none; }
-#settings .pillsel, #settings .pillbtn { flex: none; font: 500 13px var(--ui); color: var(--text); background: var(--ctl-hover); border: 1px solid var(--ctl-border); border-radius: 8px; padding: 6px 12px; min-width: 120px; }
+#settings .desc { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
+#settings .ctl { display: flex; align-items: center; gap: 8px; flex: none; }
+/* The desktop's control pill: 280x54 device px at 2x, flush with the card's
+ right inset. */
+#settings .pillsel, #settings .pillbtn { flex: none; box-sizing: border-box; height: 28px; font: 500 13px var(--ui); color: var(--text); background: var(--ctl); border: 1px solid var(--btn-border); border-radius: 8px; padding: 0 12px; min-width: 140px; transition: var(--fade); }
#settings .pillsel { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text2) 50%), linear-gradient(135deg, var(--text2) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
+#settings .pillsel:hover, #settings .pillbtn:hover { background-color: var(--ctl-hover); }
#settings .pillbtn { min-width: 0; }
-#settings .pillbtn:hover { background: var(--ctl-pressed); }
-#settings .seg { display: inline-flex; border: 1px solid var(--ctl-border); border-radius: 8px; overflow: hidden; }
-#settings .sg { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; color: var(--text2); font: 500 13px var(--ui); cursor: default; }
+#settings .seg { display: inline-flex; height: 28px; box-sizing: border-box; border: 1px solid var(--btn-border); border-radius: 8px; overflow: hidden; background: var(--ctl); }
+#settings .sg { display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; color: var(--text2); font: 500 13px var(--ui); cursor: default; transition: var(--fade); }
#settings .sg input { position: absolute; opacity: 0; width: 0; height: 0; }
+#settings .sg:hover { color: var(--text); }
#settings .sg.on { background: var(--ctl-pressed); color: var(--text); }
-#settings .stepper { display: inline-flex; align-items: center; height: 30px; border-radius: 8px; background: var(--ctl-hover); border: 1px solid var(--ctl-border); overflow: hidden; }
+#settings .stepper { display: inline-flex; align-items: center; height: 28px; box-sizing: border-box; border-radius: 8px; background: var(--ctl); border: 1px solid var(--btn-border); overflow: hidden; }
#settings .stepper.off { opacity: .5; }
-#settings .stepper button { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text); }
+#settings .stepper button { width: 28px; height: 26px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text); transition: var(--fade); }
+#settings .stepper button:hover:not(:disabled) { background: var(--ctl-hover); }
#settings .stepper button svg { width: 13px; height: 13px; }
-#settings .stepper .num { width: 54px; height: 28px; text-align: center; background: transparent; border: 0; color: var(--text); font: 500 13px var(--ui); outline: none; -moz-appearance: textfield; }
+#settings .stepper .num { width: 52px; height: 26px; text-align: center; background: transparent; border: 0; color: var(--text); font: 500 13px var(--ui); outline: none; -moz-appearance: textfield; }
#settings .stepper .num::-webkit-inner-spin-button { display: none; }
-#settings .reset { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; background: transparent; border: 0; color: var(--muted); }
-#settings .reset:hover:not(:disabled) { color: var(--text); background: var(--ctl-hover); }
+#settings .reset { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; background: transparent; border: 0; color: var(--muted); transition: var(--fade); }
+#settings .reset:hover:not(:disabled) { color: var(--text); background: var(--row-hover); }
#settings .reset:disabled { opacity: .35; }
#settings .reset svg { width: 15px; height: 15px; }
#settings .switch { position: relative; display: inline-block; width: 40px; height: 24px; flex: none; }
@@ -244,7 +380,29 @@ body[data-side=off] #side:not(.revealed) { display: none; }
exactly the page it was. Termux is the shape this follows -- the terminal
takes the width, the two panels become drawers over it, and a key bar
supplies the keys a soft keyboard has not got. */
-body[data-mobile] { --side-w: 0px; --agents-w: 0px; }
+body[data-mobile] {
+ --side-w: 0px; --agents-w: 0px; --tabs: 46px;
+ /* What the notch, the rounded corners and the home indicator take. Zero
+ everywhere the browser reports nothing, which is every desktop. */
+ --safe-t: env(safe-area-inset-top, 0px);
+ --safe-r: env(safe-area-inset-right, 0px);
+ --safe-b: env(safe-area-inset-bottom, 0px);
+ --safe-l: env(safe-area-inset-left, 0px);
+}
+/* Nothing in the chrome is a document to select or double-tap into: a
+ second tap is a second key, never a zoom, and no grey flash follows a
+ finger. The canvas is exempt below, where every finger is the terminal's. */
+body[data-mobile] #tabs, body[data-mobile] #panes, body[data-mobile] #side,
+body[data-mobile] #agents, body[data-mobile] #keybar, body[data-mobile] .menu,
+body[data-mobile] #palette, body[data-mobile] #settings, body[data-mobile] #scrim {
+ touch-action: manipulation; -webkit-tap-highlight-color: transparent;
+ -webkit-user-select: none; user-select: none;
+}
+/* A field is still typed into, and iOS zooms the page for anything under
+ 16px; every field the phone shape shows is that big. */
+body[data-mobile] input, body[data-mobile] textarea, body[data-mobile] select {
+ -webkit-user-select: text; user-select: text; font-size: 16px;
+}
/* The soft keyboard shrinks the *visual* viewport and nothing else, so the
canvas is sized from that rather than from the window: --vvh and --keybar
are KeyBar.svelte's, set on the root while the bar is mounted. */
@@ -256,52 +414,186 @@ body[data-mobile] #panes {
}
/* The browser must not pan or zoom the page: every finger on the canvas is
the terminal's, and touch.ts decides what it meant. */
-body[data-mobile] canvas#term { touch-action: none; }
-body[data-mobile] #tabs { -webkit-overflow-scrolling: touch; }
+body[data-mobile] canvas#term { touch-action: none; -webkit-tap-highlight-color: transparent; }
+/* The tab row clears the notch and the corners, and its capsules are the
+ height a thumb needs. */
+body[data-mobile] #tabs {
+ height: calc(var(--tabs) + var(--safe-t));
+ padding: calc(2px + var(--safe-t)) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l));
+ gap: 7px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
+}
+body[data-mobile] #term, body[data-mobile] #panes { top: calc(var(--tabs) + var(--safe-t)); }
+body[data-mobile] #term, body[data-mobile] #panes { height: calc(var(--vvh, 100%) - var(--tabs) - var(--safe-t) - var(--keybar)); }
+body[data-mobile] #tabs .tab { height: 36px; width: 150px; padding: 0 6px 0 10px; }
+body[data-mobile] .act { width: 38px; height: 38px; }
+/* A close button between two capsules is easy to hit by mistake; on a
+ phone it is only on the tab in front, and big enough to mean it. */
+body[data-mobile] .x { width: 28px; height: 28px; margin-left: 2px; }
+body[data-mobile] #tabs .tab:not(.current) .x { display: none; }
/* Only the zoom button fits beside the capsules on a phone; a split and a
new tab are the tab row's and the menus'. */
body[data-mobile] .nav .act[data-action=new-tab],
body[data-mobile] .nav .act[data-action=split-right],
body[data-mobile] .nav .act[data-action=split-below] { display: none; }
+/* The pane's own capsule has the width the tab row's has not: a 160px box
+ on a 390px screen left two thirds of the bar empty. */
+body[data-mobile] .nav .cap { width: auto; flex: 1 1 auto; min-width: 0; max-width: 100%; }
+body[data-mobile] .nav .acts .act { width: 34px; height: 34px; }
/* The two panels are drawers: over the canvas, resizing nothing, or not
there at all. */
body[data-mobile] #side,
body[data-mobile] #agents {
- top: var(--tabs);
+ top: calc(var(--tabs) + var(--safe-t));
bottom: auto;
- height: calc(var(--vvh, 100%) - var(--tabs) - var(--keybar));
- width: min(300px, 85vw);
+ height: calc(var(--vvh, 100%) - var(--tabs) - var(--safe-t) - var(--keybar));
+ width: min(320px, 86vw);
z-index: 15;
box-shadow: 0 8px 28px rgba(0,0,0,.42);
+ overscroll-behavior: contain;
}
-body[data-mobile] #side { display: none; }
-body[data-mobile] #side.open { display: block; }
+body[data-mobile] #side {
+ padding-left: var(--safe-l);
+ transform: translateX(-101%); visibility: hidden; pointer-events: none; will-change: transform;
+ transition: transform .15s cubic-bezier(.4,0,1,1), visibility 0s linear .15s;
+}
+body[data-mobile] #side.open {
+ transform: translateX(0); visibility: visible; pointer-events: auto;
+ transition: transform .15s cubic-bezier(0,0,.2,1), visibility 0s;
+}
+/* The right drawer is mounted when it opens, so it arrives rather than
+ transitions. */
+@keyframes drawer-in { from { transform: translateX(101%); } to { transform: translateX(0); } }
+body[data-mobile] #agents { animation: drawer-in .15s cubic-bezier(0,0,.2,1); }
+body[data-mobile] #agents { padding-right: var(--safe-r); }
/* Their edges are dragged with a pointer, which a phone has not got. */
body[data-mobile] #side .handle,
body[data-mobile] #agents .handle { display: none; }
+/* A row, a button and a footer icon a thumb can hit. The list's insets and
+ the panel's rhythm are the desktop's; only the heights grow. */
+body[data-mobile] #side .row { min-height: 44px; }
+body[data-mobile] #side .hdr { min-height: 36px; }
+body[data-mobile] #side .top .pill, body[data-mobile] #side .pill { height: 38px; }
+body[data-mobile] #side .act.round { width: 38px; height: 38px; }
+body[data-mobile] #side .act { width: 34px; height: 34px; }
+body[data-mobile] #side .foot { height: 52px; left: 12px; right: 12px; }
+body[data-mobile] #side .foot .act { width: 40px; height: 40px; }
+body[data-mobile] #side .list { inset: 12px 10px 52px 10px; }
+/* A finger has no hover, so a thread's pin and delete would never appear. */
+body[data-mobile] #side .hov { display: inline-flex; }
+body[data-mobile] #side .path input { padding: 9px 10px; }
/* Behind whichever drawer is out: a press here puts it away. */
#scrim { position: fixed; inset: 0; z-index: 14; background: rgba(0,0,0,.34); }
-/* A menu row a finger can hit. */
-body[data-mobile] .menu .mi { height: 40px; }
+/* A menu row a finger can hit, clear of the corners and the indicator. */
+body[data-mobile] .menu {
+ min-width: 200px; padding: 6px;
+ max-height: calc(var(--vvh, 100%) - var(--keybar) - 24px); overflow-y: auto;
+}
+body[data-mobile] .menu .mi { height: 44px; font-size: 14px; }
+/* The palette is a sheet on a phone: the window's width, above the key bar,
+ with rows a thumb can pick from. */
+body[data-mobile] #palette {
+ top: calc(var(--safe-t) + 10px); width: calc(100vw - 20px - var(--safe-l) - var(--safe-r));
+ max-height: calc(var(--vvh, 100%) - var(--keybar) - var(--safe-t) - 20px);
+}
+body[data-mobile] #palette .pl { max-height: none; flex: 1 1 auto; }
+body[data-mobile] #palette .pe { height: 44px; }
+body[data-mobile] #palette .st { display: none; }
+/* The settings window has no room for its 220px nav column beside the
+ cards: on a phone it fills the window and the sections become a strip
+ of chips over one column of rows. */
+body[data-mobile] #settings {
+ left: 0; top: 0; --settings-tf: translate(0, 0); transform: var(--settings-tf); width: 100%;
+ height: calc(var(--vvh, 100%) - var(--keybar));
+ border-radius: 0; border: 0; flex-direction: column;
+}
+body[data-mobile] #settings .snav {
+ flex: none; padding: calc(var(--safe-t) + 10px) calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l));
+ border-right: 0; border-bottom: 1px solid var(--sep);
+}
+body[data-mobile] #settings .app { padding: 0 2px 10px 2px; font-size: 16px; }
+body[data-mobile] #settings .find { display: none; }
+body[data-mobile] #settings .secs {
+ flex-direction: row; margin-top: 0; gap: 6px;
+ overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
+}
+body[data-mobile] #settings .secs::-webkit-scrollbar { display: none; }
+body[data-mobile] #settings .sec { flex: 0 0 auto; height: 38px; border-radius: 999px; background: var(--ctl); }
+body[data-mobile] #settings .sec.on { background: var(--row-sel); }
+body[data-mobile] #settings .body { padding: 18px calc(14px + var(--safe-r)) 24px calc(14px + var(--safe-l)); }
+body[data-mobile] #settings .title { font-size: 20px; margin-bottom: 14px; }
+body[data-mobile] #settings .card { padding: 0 14px; }
+/* Label over control, so a description never squeezes into one word a line. */
+body[data-mobile] #settings .srow { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 0; }
+body[data-mobile] #settings .ctl { justify-content: flex-start; flex-wrap: wrap; }
+body[data-mobile] #settings .pillsel, body[data-mobile] #settings .pillbtn,
+body[data-mobile] #settings .seg, body[data-mobile] #settings .stepper { height: 38px; }
+body[data-mobile] #settings .pillsel { flex: 1 1 auto; min-width: 0; }
+body[data-mobile] #settings .sc { top: calc(var(--safe-t) + 10px); right: calc(10px + var(--safe-r)); width: 34px; height: 34px; }
+/* The remark and the takeover card sit clear of the key bar. */
+body[data-mobile] #status {
+ right: calc(10px + var(--safe-r)); left: calc(10px + var(--safe-l)); max-width: none;
+ bottom: calc(var(--keybar) + 10px); white-space: normal;
+}
+body[data-mobile] #card { padding: 22px 24px calc(var(--keybar) + 22px); }
+body[data-mobile] #card .go { height: 38px; }
/* The key bar, along the foot of the visual viewport; `top` is the bar's
own, since the soft keyboard moves that foot up the window. It scrolls
- sideways when the keys do not fit. */
+ sideways when the keys do not fit, and its own height -- the keys plus
+ whatever the home indicator takes under them -- is what the page above
+ leaves room for. */
#keybar {
- position: fixed; left: 0; right: 0; height: 44px; z-index: 16; box-sizing: border-box;
- display: flex; align-items: center; gap: 4px; padding: 0 6px;
+ position: fixed; left: 0; right: 0; z-index: 16; box-sizing: border-box;
+ height: calc(52px + env(safe-area-inset-bottom, 0px));
+ padding: 0 6px env(safe-area-inset-bottom, 0px) 6px;
+ display: flex; align-items: center; gap: 5px;
background: var(--ctl); border-top: 1px solid var(--ctl-border);
- overflow-x: auto; overflow-y: hidden; white-space: nowrap;
- scrollbar-width: none; user-select: none; touch-action: manipulation;
+ overflow-x: auto; overflow-y: hidden; white-space: nowrap; overscroll-behavior-x: contain;
+ scrollbar-width: none; user-select: none; -webkit-user-select: none; touch-action: manipulation;
+ -webkit-tap-highlight-color: transparent;
}
#keybar::-webkit-scrollbar { display: none; }
#keybar .k {
- flex: 0 0 auto; min-width: 44px; height: 34px; margin: 0; padding: 0 8px;
+ flex: 0 0 auto; min-width: 44px; height: 44px; margin: 0; padding: 0 10px;
display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
- border-radius: 8px; border: 1px solid var(--ctl-border); background: var(--ctl-hover);
- color: var(--text); font: 500 13px var(--ui);
- touch-action: manipulation; -webkit-tap-highlight-color: transparent;
+ border-radius: 10px; border: 1px solid var(--ctl-border); background: var(--ctl-hover);
+ color: var(--text); font: 500 14px var(--ui);
+ touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
#keybar .k:active { background: var(--ctl-pressed); }
/* An armed modifier: it is spent on the next key, from here or from the
- soft keyboard. */
-#keybar .k.armed { background: var(--accent); border-color: transparent; color: #FFFFFF; }
+ soft keyboard. The ring says so from across the bar, not only the fill. */
+#keybar .k.armed {
+ background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 700;
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 34%, transparent);
+}
+/* Landscape on a phone: the window is 390px tall and the chrome would take
+ a third of it. The rows shrink; nothing else changes. */
+@media (orientation: landscape) and (max-height: 500px) {
+ body[data-mobile] { --tabs: 40px; }
+ body[data-mobile] #tabs .tab { height: 30px; }
+ body[data-mobile] .act { width: 32px; height: 32px; }
+ #keybar { height: calc(44px + env(safe-area-inset-bottom, 0px)); }
+ #keybar .k { height: 36px; min-width: 40px; }
+ body[data-mobile] #settings .srow { flex-direction: row; align-items: center; gap: 14px; }
+ body[data-mobile] #settings .pillsel { flex: none; min-width: 140px; }
+}
+
+/* A reader who has asked the system for less motion gets none of it: the
+ page still opens and closes exactly the same things. */
+@media (prefers-reduced-motion: reduce) {
+ #side, body[data-mobile] #side, body[data-mobile] #agents,
+ .menu, #card:not([hidden]) { animation: none; transition: none; }
+}
+
+/* A drag in flight: the ghost under the pointer, the 2px line where the row
+ or tab would land, and the half of the pane a capsule would take. The
+ accent is the desktop's own (render/paint.rs), and nothing here takes the
+ pointer -- the drag is driven from the window. */
+#dnd { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
+#dnd .ghost { position: fixed; transform: translate(10px, 8px); max-width: 240px; padding: 5px 10px; border-radius: 999px; background: var(--ctl); border: 1px solid var(--ctl-border); box-shadow: 0 8px 28px rgba(0,0,0,.42); color: var(--text); font: 500 13px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .78; }
+#dnd .line { position: fixed; border-radius: 2px; background: var(--accent); }
+#dnd .zone { position: fixed; box-sizing: border-box; border-radius: 8px; background: color-mix(in srgb, var(--accent) 28%, transparent); border: 2px solid color-mix(in srgb, var(--accent) 80%, transparent); }
+/* The cursor says what letting go would do, over whatever it is above. */
+body.dnd, body.dnd * { cursor: grabbing !important; }
+body.dnd.dnd-no, body.dnd.dnd-no * { cursor: not-allowed !important; }
+body.dnd { touch-action: none; }