mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 16:59:43 +02:00
feat(tiles): Tiles header button with a session picker, and a tile's + menu
A Tiles button beside Split in the header, opt-in through the per-device showTileGridButton setting (read in applyHeaderVisibilitySettings; the settings checkbox, displayKeys membership and schema exclusion follow with persistence) and hard-gated like Split: hidden by its --hidden marker, a JS width check with a live media listener, a @media (max-width: 1179px) backstop and never in a solo window. While the grid is open the button closes it and reads as pressed. Closed, it opens a picker: a checkbox per open session in tab order (never one popped out to its own window; one with no PTY is offered, its tile shows the Attach overlay), names as text, preselected with the grid this tab last left, else the active session and an open split's two. Boxes past what the window can fit are disabled with the count shown, and Open opens the grid on the checked sessions, focusing the active one if checked. Escape and an outside click close it; its close method is idempotent and the global Escape handler calls it. A tile's + lists the open sessions not yet tiled; picking one adds it and focuses it (a human selection). A grid that already holds what the window fits disables the entries. "New session in this case" waits for auto-join. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,11 @@ export class FakeEl {
|
||||
title = '';
|
||||
hidden = false;
|
||||
disabled = false;
|
||||
checked = false;
|
||||
contains(other: FakeEl | null): boolean {
|
||||
for (let n: FakeEl | null = other; n; n = n.parentElement) if (n === this) return true;
|
||||
return false;
|
||||
}
|
||||
textContent = '';
|
||||
value = '';
|
||||
type = '';
|
||||
@@ -154,6 +159,7 @@ export const body = new FakeEl();
|
||||
export const fetchSpy = vi.fn(async (..._args: unknown[]) => ({ ok: true, json: async () => ({}) }));
|
||||
/** `document.addEventListener`, so a test can find a listener the app installed. */
|
||||
export const documentAddEventListener = vi.fn();
|
||||
export const documentRemoveEventListener = vi.fn();
|
||||
export const localStore = new Map<string, string>();
|
||||
/** The clock behind `performance.now` inside the context; tests move it with advanceClock(). */
|
||||
let clock = 100_000;
|
||||
@@ -198,12 +204,13 @@ const context = vm.createContext({
|
||||
history: { replaceState: vi.fn(), state: null },
|
||||
document: {
|
||||
addEventListener: documentAddEventListener,
|
||||
removeEventListener: documentRemoveEventListener,
|
||||
documentElement: { dataset: {} },
|
||||
createElement: () => new FakeEl(),
|
||||
getElementById: (id: string) => (id === 'tileGrid' ? section : null),
|
||||
body,
|
||||
querySelector: (sel: string) =>
|
||||
sel === '.main' ? main : sel === '.terminal-wrap' ? wrap : (bySelector.get(sel) ?? null),
|
||||
bySelector.get(sel) ?? (sel === '.main' ? main : sel === '.terminal-wrap' ? wrap : null),
|
||||
querySelectorAll: () => [],
|
||||
},
|
||||
localStorage: {
|
||||
|
||||
Reference in New Issue
Block a user