~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0

A Covers' bar shows while picking in Panes

Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:web/select-bar
.changeset/a_covers_bar_shows_while_picking_in_panes.mdnew+7−0
@@ -0,0 +1,7 @@
---
default: patch
---
# A Covers' bar shows while picking in Panes
Picking covers in a `Panes` (Select in its row, as Grain's profile has it), the bar with Cancel, how many and the action now stays at the bottom of the screen, above the shell's tabs, at every width. Before, it was held to the bottom of the strip of panes, after the last cover and often off the screen. While picking, the strip shows only the pane in use and doesn't scroll; Cancel or the action finishing brings it back to that pane.
web/renderer/src/tree/Covers.svelte+3−1
@@ -224,7 +224,9 @@
}
/* While picking: a bar held at the bottom of what scrolls, Cancel, how
many, and the action. */
many, and the action; inside that scroller's padding, as sticky is,
which keeps it clear of what an app floats over the window's foot
(the shell's tabs: its screens' bottom padding). */
.bar {
position: sticky;
bottom: var(--hud-space-2);
web/renderer/src/tree/Panes.svelte+25−5
@@ -48,7 +48,10 @@
// none of what holds them's gap between. The shown pane's content may
// put one control over the row's right end (`getPaneEnd`: a Covers'
// Select), so the icons keep their places; while it picks, the strip
// and the icons hold still.
// and the icons hold still: the strip then scrolls not at all, the pane
// shown alone in it, so what its content holds at the bottom of what
// scrolls (the Covers' bar) is held at the screen's, the strip scrolled
// back to it after.
let { node }: { node: UiNode } = $props();
const id = $props.id();
@@ -123,7 +126,8 @@
let from: number | null = null;
function onscroll() {
if (!strip || strip.clientWidth <= 0) return;
// Held, it is no scroller: its scroll going to nothing moves no pane.
if (held || !strip || strip.clientWidth <= 0) return;
const width = strip.clientWidth;
// A fling past the next pane, which a browser's momentum may carry over
// it (scroll-snap-stop notwithstanding), is stopped at the next: the
@@ -165,7 +169,7 @@
const measure = () => {
heights = boxes.slice(0, panes.length).map((box) => box?.offsetHeight ?? 0);
places = tabs.slice(0, panes.length).map((tab) => ({ left: tab?.offsetLeft ?? 0, width: tab?.offsetWidth ?? 0 }));
if (track.clientWidth > 0) progress = track.scrollLeft / track.clientWidth;
if (track.clientWidth > 0 && !untrack(() => held)) progress = track.scrollLeft / track.clientWidth;
};
// The pane chosen before the strip could scroll, scrolled to.
const first = untrack(() => chosen);
@@ -181,6 +185,14 @@
track.removeEventListener('touchstart', ontouchstart);
};
});
// Picking over, the strip scrolls again, back at the pane shown.
let wasHeld = false;
$effect(() => {
const now = held;
if (wasHeld && !now && strip && strip.clientWidth > 0) strip.scrollLeft = untrack(() => at) * strip.clientWidth;
wasHeld = now;
});
</script>
<div class="panes" class:live class:held class:marked={mark !== null}>
@@ -215,7 +227,7 @@
</div>
{/if}
{#if many}
<div class="strip" bind:this={strip} style:height={tall} {onscroll} {onscrollend}>
<div class="strip" bind:this={strip} style:height={held ? undefined : tall} {onscroll} {onscrollend}>
{#each panes as pane, i (i)}
<div
bind:this={boxes[i]}
@@ -413,7 +425,15 @@
display: none;
}
/* Picking, the strip scrolls not at all, the pane shown alone in it: a
scroller, it would hold what its content keeps at the bottom of what
scrolls to its own bottom rather than the screen's. */
.live.held .strip {
overflow-x: hidden;
overflow-x: visible;
overflow-y: visible;
}
.live.held .strip > .pane[inert] {
display: none;
}
</style>
web/renderer/test/ssr.mjs+29−1
@@ -50,6 +50,11 @@
// press does not take the @'s place or closes the menu and its form.
// A place's header fails where a Stack with gap none is drawn otherwise,
// or once mounted its Map draws a pin with pins false, or none without.
// Profile's panes, at a phone's width with the build's stylesheet, fail
// where two covers picked draw a bar other than Cancel, 2 selected and
// Delete 2, or one not sticky, or in a box that scrolls or hides it (the
// strip of panes, which would hold it to its own bottom, off the screen),
// or where Cancel leaves the strip not scrolling again.
// Both builds go to a directory of their own in the system's temporary
// directory, taken away after.
@@ -686,7 +691,13 @@ try {
}
// Mounted, the panes' strip scrolls with every pane opened; an icon clicked chooses its pane, whose Select (none on favorites) is the row's; picking, the icons and the strip hold still.
// At a phone's width, with the build's stylesheet: two picked, the bar (Cancel, 2 selected, Delete 2) is sticky with nothing between it and the screen's scroller that scrolls or hides it, the strip no longer a scroller; else it is held to the strip's bottom, under the screen's foot (next.grain.social's profile). Cancel lets the strip scroll again.
{
const styles = readdirSync(join(out, 'client'))
.filter((f) => f.endsWith('.css'))
.map((f) => Object.assign(document.createElement('style'), { textContent: readFileSync(join(out, 'client', f), 'utf8') }));
document.head.append(...styles);
window.happyDOM.setViewport({ width: 390, height: 844 });
const target = document.createElement('div');
document.body.append(target);
const app = client.mount(client.Tree, { target, props: props(PANES) });
@@ -706,13 +717,30 @@ try {
target.querySelector('button.end').click();
client.flushSync();
if (!target.querySelector('.panes.held') || tabs().some((t) => !t.disabled)) problems.push('panes: picking, the strip or its icons do not hold still');
for (const cover of [...target.querySelectorAll('button[aria-pressed]')].slice(0, 2)) cover.click();
client.flushSync();
const bar = target.querySelector('[role="toolbar"]');
const said = bar?.textContent.replace(/\s+/g, ' ').trim();
if (said !== 'Cancel 2 selected Delete 2') problems.push(`panes: two picked, the bar says ${said ?? 'nothing'}`);
if (bar && window.getComputedStyle(bar).position !== 'sticky') problems.push(`panes: picking, the bar is ${window.getComputedStyle(bar).position}, not sticky`);
// happy-dom leaves an overflow nothing sets empty, where a browser says visible.
for (let box = bar?.parentElement; box && box !== target; box = box.parentElement) {
const { overflowX, overflowY, display } = window.getComputedStyle(box);
if (![overflowX, overflowY].every((o) => o === '' || o === 'visible' || o === 'clip') || display === 'none')
problems.push(`panes: picking, the bar is in a box that scrolls or hides it (${box.className}: overflow ${overflowX} ${overflowY}, display ${display}), so it is not held at the screen's foot`);
}
bar?.querySelector('button.cancel').click();
client.flushSync();
const strip = target.querySelector('.strip');
if (target.querySelector('[role="toolbar"]') || target.querySelector('.panes.held') || window.getComputedStyle(strip).overflowX !== 'auto') problems.push('panes: cancelled, the bar stays or the strip does not scroll again');
} catch (e) {
problems.push(`panes: ${e.stack}`);
} finally {
client.unmount(app);
target.remove();
for (const style of styles) style.remove();
}
say('panes: mounted they scroll, an icon chooses its pane and its Select, and picking holds them still');
say("panes: mounted they scroll, an icon chooses its pane and its Select, and picking holds them still, its bar held at the screen's foot");
}
// Each button to show more of a clamped text, clicked, draws it whole: once every tree is hydrated, as a mounted Tree draws dates by the browser's clock.
web/shell/src/Stack.svelte+4−0
@@ -826,6 +826,10 @@
pointer-events: none;
}
/* A screen scrolls in its level, its bottom padding the room the tabs
floating over the window's foot take: its end scrolls clear of them,
and what sticks to the bottom of what scrolls (a Covers' bar while
picking) is held above them, as sticky keeps inside that padding. */
.level {
position: absolute;
inset: 0;