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">
// A picture's own info (its camera, its settings) offered as a photo app
// offers it: an ⓘ in its bottom-left corner, mirroring ALT in its
// bottom-right, which shows the lines over the picture, and hides them
// again. Its parent is the picture's box, positioned; `shown` bound, its
// owner keeps one of the two open at a time. The lines' button is named
// by its lines, and the badge is a 24px target at least, as ALT's is.
let { lines, shown = $bindable(false) }: { lines: { text: string }[]; shown?: boolean } = $props();
</script>
{#if shown}
<!-- Model names and numbers: nothing a page's translation should touch. -->
<button type="button" class="text" translate="no" onclick={() => (shown = false)} title="Hide photo info">
{#each lines as line, i (i)}<span>{line.text}</span>{/each}
</button>
{/if}
<button type="button" class="badge" aria-label={shown ? 'Hide photo info' : 'Show photo info'} aria-expanded={shown} onclick={() => (shown = !shown)}
><span><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" /></svg></span></button
>
<style>
/* ALT's, in the other corner: the same pill, the same height, over
either's text, in a bare box 24px square at least. */
.badge {
position: absolute;
z-index: 1;
left: calc(var(--hud-space-2) - 2px);
bottom: calc(var(--hud-space-2) - 2px);
display: grid;
place-items: center;
min-width: 24px;
min-height: 24px;
padding: 2px;
border: 0;
background: none;
font: inherit;
cursor: pointer;
}
.badge > span {
display: inline-flex;
align-items: center;
padding: 1px var(--hud-space-1);
border-radius: var(--border-radius-xs);
background: rgb(0 0 0 / 0.7);
color: #fff;
font-size: var(--font-text-xs-size);
}
svg {
width: 1lh;
height: 1lh;
fill: none;
stroke: currentColor;
stroke-width: 2.25;
stroke-linecap: round;
stroke-linejoin: round;
}
/* The lines over the picture, their foot clear of the badge. */
.text {
display: flex;
position: absolute;
inset: auto 0 0;
flex-direction: column;
gap: 2px;
max-height: 100%;
overflow-y: auto;
padding: var(--hud-space-3) var(--hud-space-3) calc(var(--hud-space-3) + 1.5rem);
border: 0;
background: rgb(0 0 0 / 0.75);
color: #fff;
font: inherit;
font-size: var(--font-text-sm-size);
line-height: var(--font-text-sm-line-height);
font-variant-numeric: tabular-nums;
text-align: left;
cursor: pointer;
}
</style>