~ 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
60 lines · 1.7 KB Raw History
<script lang="ts" generics="T">
	import type { Snippet } from 'svelte';

	// A thread's ancestors (the tree's `Chain`): its items oldest first, each drawn by `entry` (a ThreadItem),
	// beside a line that runs down to the post they lead to; with `face`,
	// down the column their authors' faces are drawn in, as FeedContextView's.
	let { items, entry, face = false }: { items: readonly T[]; entry: Snippet<[T]>; face?: boolean } = $props();
</script>

<ul class="chain" class:face>
	{#each items as item, i (i)}
		{@render entry(item)}
	{/each}
</ul>

<style>
	.chain {
		display: flex;
		flex-direction: column;
		gap: var(--hud-space-1);
		min-width: 0;
		margin: 0 0 0 var(--hud-space-4);
		padding: 0 0 0 var(--hud-space-2);
		border-left: 2px solid var(--color-border-secondary);
		list-style: none;
	}

	/* As the Bluesky app's thread: each post its author's face in a column
	   (the template's, 2.625rem), a line running down it from under each
	   face into the next, the last's into the post they lead to. */
	.face {
		gap: 0;
		margin: 0;
		padding: 0;
		border: 0;
	}

	.face > :global(li) {
		position: relative;
	}

	/* A post's stretch starts under its face (drawn a space down, its
	   hover's padding) and runs to just above the next face. */
	.face > :global(li)::before {
		position: absolute;
		top: calc(var(--hud-space-2) + 2.625rem + 4px);
		bottom: calc(4px - var(--hud-space-2));
		left: calc(1.3125rem - 1px);
		width: 2px;
		background: var(--color-border-secondary);
		/* Over a post's hover, which would hide it. */
		z-index: 1;
		content: '';
	}

	/* The last's, past the space under the chain, to the face of the post they lead to. */
	.face > :global(li:last-child)::before {
		bottom: calc(4px - var(--hud-space-3));
	}
</style>