chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.3.1 Latest 5 packages
0
0
<script lang="ts">
import Icon from '../atoms/Icon.svelte';
import type { Tile } from '../model';
import TileMark from './TileMark.svelte';
/**
* One column on the strip map: as wide as its share of the strip, one
* segment for each tile stacked in it (a launcher's, null), its chain's
* colour along its top; ringed while it has focus, pulsing while
* something new in it is unseen.
*/
let {
share,
segments,
chain,
focused,
arrived,
zoomed,
label,
onclick
}: {
share: number;
segments: (Pick<Tile, 'tool' | 'arguments' | 'icon'> | null)[];
/** Its chain's colour, 1 to 6, or none. */
chain: number | undefined;
focused: boolean;
arrived: boolean;
zoomed: boolean;
label: string;
onclick: () => void;
} = $props();
</script>
<button
type="button"
class="chip"
class:focused
class:arrived
class:zoomed
class:chained={chain !== undefined}
style:--share={share}
style:--chain={chain === undefined ? undefined : `var(--chain-${chain})`}
aria-label={label}
aria-current={focused ? 'true' : undefined}
title={label}
{onclick}
>
{#each segments as tile, i (i)}
<span class="seg">{#if tile}<TileMark {tile} />{:else}<Icon name="add" />{/if}</span>
{/each}
</button>
<style>
.chip {
position: relative;
display: flex;
flex: none;
flex-direction: column;
gap: 1px;
width: calc(var(--share) * 3 * var(--map-unit));
height: var(--map-chip);
padding: 0;
border: 0;
border-radius: var(--radius-sm);
background: none;
overflow: hidden;
cursor: pointer;
}
.seg {
display: grid;
flex: 1;
place-items: center;
min-height: 0;
overflow: hidden;
background: var(--line);
color: var(--mute);
}
/* Its mark, as tall as its segment allows: a stack's segments share the chip's height, and each mark fits in its own (over the atoms' own sizes). */
.chip .seg :global(:is(.i, .app, .av)) {
width: auto;
height: min(var(--icon-sm), 100% - 2px);
aspect-ratio: 1;
}
.chip:hover .seg {
background: var(--line-strong);
}
.chained .seg:first-child {
border-top: 2px solid var(--chain);
}
.focused {
outline: 1.5px solid var(--primary);
outline-offset: 1px;
}
.zoomed {
outline: 1.5px dashed var(--accent);
outline-offset: 1px;
}
.arrived::after {
content: '';
position: absolute;
top: 2px;
right: 2px;
width: var(--space-1-5);
height: var(--space-1-5);
border-radius: var(--radius-full);
background: var(--agent);
}
@media (prefers-reduced-motion: no-preference) {
.arrived::after {
animation: pulse 1s ease-in-out infinite alternate;
}
}
@keyframes pulse {
to {
opacity: 0.3;
}
}
</style>