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 type { Snippet } from 'svelte';
// An array's `count` items, each drawn by `item` (its index): the first
// five, then a button for the rest. Short words and numbers, such as tags
// or languages (`inline`), sit side by side as chips; anything longer,
// one under another.
let { count, inline, item }: { count: number; inline: boolean; item: Snippet<[number]> } = $props();
/** How many items show before "+N more". */
const FIRST = 5;
let all = $state(false);
const shown = $derived(all ? count : Math.min(count, FIRST));
</script>
{#if count === 0}
<span class="empty">empty</span>
{:else}
<ol class="items" class:inline>
{#each { length: shown }, i (i)}
<li>{@render item(i)}</li>
{/each}
{#if inline && shown < count}
<li class="more"><button type="button" class="rest" onclick={() => (all = true)}>+{count - shown} more</button></li>
{/if}
</ol>
{#if !inline && shown < count}
<button type="button" class="rest" onclick={() => (all = true)}>+{count - shown} more</button>
{/if}
{/if}
<style>
.items {
display: flex;
flex-direction: column;
gap: var(--hud-space-1);
margin: 0;
padding: 0;
list-style: none;
}
.items:not(.inline) > li + li {
padding-top: var(--hud-space-1);
border-top: var(--border-width-regular) dashed var(--color-border-secondary);
}
.inline {
flex-direction: row;
flex-wrap: wrap;
align-items: center;
}
.inline > li:not(.more) {
padding: 0 var(--hud-space-2);
border: var(--border-width-regular) solid var(--color-border-secondary);
border-radius: var(--border-radius-full);
background: var(--color-background-secondary);
font-size: var(--font-text-xs-size);
line-height: 1.6;
}
.empty {
color: var(--color-text-tertiary);
font-style: italic;
}
.rest {
padding: 0;
border: 0;
background: none;
color: var(--color-text-info);
font: inherit;
font-size: var(--font-text-sm-size);
cursor: pointer;
}
.items:not(.inline) + .rest {
margin-top: var(--hud-space-1);
}
.rest:hover {
text-decoration: underline;
}
</style>