~ 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
91 lines · 1.9 KB Raw History
<script lang="ts">
	import Icon from '../atoms/Icon.svelte';
	import Kbd from '../atoms/Kbd.svelte';
	import type { IconName } from '../icons';
	import type { Tile } from '../model';
	import TileMark from './TileMark.svelte';

	/** A row of the palette that is not the launcher's: an action with its key, a canvas and where it is, a tile (its mark) and the canvas it is on. */
	let {
		icon,
		tile = null,
		text,
		sub = null,
		keys = null,
		active = false,
		onpick,
		onhover
	}: {
		icon: IconName;
		tile?: Pick<Tile, 'tool' | 'arguments' | 'icon'> | null;
		text: string;
		sub?: string | null;
		keys?: string | null;
		active?: boolean;
		onpick: () => void;
		onhover?: () => void;
	} = $props();
</script>

<button type="button" class="row" class:active role="option" aria-selected={active} onclick={onpick} onmousemove={onhover}>
	<span class="mark">{#if tile}<TileMark {tile} />{:else}<Icon name={icon} />{/if}</span>
	<span class="text">{text}</span>
	{#if sub}<span class="sub">{sub}</span>{/if}
	{#if keys}<span class="keys"><Kbd {keys} /></span>{/if}
</button>

<style>
	.row {
		display: flex;
		align-items: center;
		gap: var(--space-2);
		width: 100%;
		padding: var(--space-1) var(--space-2);
		border: 0;
		border-radius: var(--radius-md);
		background: none;
		color: var(--fg);
		font: inherit;
		font-size: var(--text-sm);
		text-align: left;
		cursor: pointer;
	}

	.row:hover {
		background: var(--hover);
	}

	.row.active {
		background: var(--accent-soft);
	}

	.mark {
		display: grid;
		flex: none;
		place-items: center;
		width: var(--avatar);
		height: var(--avatar);
		color: var(--mute);
	}

	.text {
		flex: none;
		max-width: 70%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.sub {
		flex: 1;
		min-width: 0;
		overflow: hidden;
		color: var(--mute);
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.keys {
		margin-left: auto;
	}
</style>