chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.4.0 Latest 5 packages
0
0
<script lang="ts">
import type { Snippet } from 'svelte';
import type { Column, Slot } from '../model';
/**
* One column of the strip: full height, as wide as its share of the
* strip's visible width (all of it while zoomed, and on a phone), its
* tiles stacked one above another, or a launcher. A column opened from
* the one on its left is joined to it across the gap, in its chain's
* colour.
*/
let {
column,
share,
bridge,
flash,
slot
}: {
column: Column;
share: number;
/** The chain colour of the line across the gap on its left, or none. */
bridge: number | undefined;
/** Counts the flashes asked of it: each new one flashes it once. */
flash: number;
slot: Snippet<[Slot]>;
} = $props();
let element: HTMLElement | undefined = $state();
$effect(() => {
if (!flash || !element || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
element.animate(
[
{ boxShadow: '0 0 0 2px var(--primary), 0 0 0 10px var(--ring-color)', borderRadius: 'var(--radius-lg)' },
{ boxShadow: '0 0 0 2px var(--primary), 0 0 0 0 transparent', borderRadius: 'var(--radius-lg)' }
],
{ duration: 650, easing: 'ease-out' }
);
});
</script>
<div bind:this={element} class="column" class:bridged={bridge !== undefined} style:--share={share} style:--chain={bridge === undefined ? undefined : `var(--chain-${bridge})`} data-column={column.key}>
{#each column.slots as one (one.key)}
{@render slot(one)}
{/each}
</div>
<style>
.column {
position: relative;
display: flex;
flex: none;
flex-direction: column;
gap: var(--gap);
width: calc(var(--share) * (100% + var(--gap)) - var(--gap));
min-height: 0;
scroll-snap-align: start;
}
.bridged::before {
content: '';
position: absolute;
top: calc(var(--strip) / 2 - 1px);
right: 100%;
width: var(--gap);
height: 2px;
background: var(--chain);
pointer-events: none;
}
@media (max-width: 640px) {
.column {
width: 100%;
scroll-snap-stop: always;
}
.bridged::before {
display: none;
}
}
</style>