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

	// A long-form document's look, for reading: its parts in a column, lines
	// of about 65 characters; plain paragraphs keeping their line breaks; and
	// with `leaflet`, a Leaflet document's blocks (each `div.block` in its
	// alignment, `div.gap` for its empty lines; headings, quotes, code with
	// its language, pictures, rules, lists, buttons) as Leaflet draws them.
	// A part of a kind not drawn is one muted line naming it. The old
	// renderer's `Document` and a resolved tree's draw their parts in it.
	let { leaflet = false, children }: { leaflet?: boolean; children: Snippet } = $props();
</script>

<article class="document" class:leaflet>{@render children()}</article>

<style>
	.document {
		display: flex;
		flex-direction: column;
		gap: 0.9em;
		max-width: 65ch;
		min-width: 0;
		font-size: var(--font-text-md-size);
		line-height: 1.65;
		overflow-wrap: break-word;
	}

	.document > :global(p) {
		margin: 0;
	}

	.document > :global(p.plain) {
		white-space: pre-wrap;
	}

	.document :global(p.unsupported) {
		margin: 0;
		color: var(--color-text-tertiary);
		font-size: var(--font-text-sm-size);
		font-style: italic;
	}

	.leaflet > :global(div.block) {
		min-width: 0;
	}

	.leaflet :global(div.gap) {
		height: 0.25em;
	}

	.leaflet :global(:is(.block, li, blockquote) > :is(p, blockquote, figure)) {
		margin: 0;
	}

	.leaflet :global(.heading) {
		margin: 0.6em 0 0;
		font-weight: var(--font-weight-semibold);
		line-height: 1.3;
		overflow-wrap: anywhere;
	}

	.leaflet :global(h2.heading) {
		font-size: 1.375em;
	}

	.leaflet :global(h3.heading) {
		font-size: 1.2em;
	}

	.leaflet :global(h4.heading) {
		font-size: 1.05em;
	}

	.leaflet :global(blockquote) {
		padding-left: var(--hud-space-3);
		border-left: 3px solid var(--color-border-primary);
		color: var(--color-text-secondary);
	}

	.leaflet :global(figure.code) {
		border-radius: var(--border-radius-md);
		background: var(--color-background-secondary);
		overflow: hidden;
	}

	.leaflet :global(figure.code figcaption) {
		padding: var(--hud-space-1) var(--hud-space-3) 0;
		color: var(--color-text-tertiary);
		font-family: var(--font-mono);
		font-size: var(--font-text-xs-size);
	}

	.leaflet :global(figure.code pre) {
		margin: 0;
		padding: var(--hud-space-2) var(--hud-space-3) var(--hud-space-3);
		overflow-x: auto;
		font-family: var(--font-mono);
		font-size: var(--font-text-sm-size);
		line-height: 1.5;
	}

	.leaflet :global(figure.image) {
		width: 100%;
		max-height: 80vh;
		aspect-ratio: var(--ratio);
		border-radius: var(--border-radius-md);
		overflow: hidden;
	}

	.leaflet :global(hr) {
		width: 100%;
		margin: 0.5em 0;
		border: 0;
		border-top: var(--border-width-regular) solid var(--color-border-secondary);
	}

	.leaflet :global(:is(ul, ol).list) {
		margin: 0;
		padding-left: 1.5em;
	}

	.leaflet :global(.list > li + li) {
		margin-top: 0.3em;
	}

	.leaflet :global(.list > li > .list) {
		margin-top: 0.3em;
	}

	.leaflet :global(:is(a, button).button) {
		padding: var(--hud-space-2) var(--hud-space-4);
		border: var(--border-width-regular) solid var(--color-border-primary);
		border-radius: var(--border-radius-md);
		background: var(--color-background-secondary);
		color: var(--color-text-primary);
		font: inherit;
		font-weight: var(--font-weight-medium);
		cursor: pointer;
	}

	/* A button that is a link: as the button is, its words never underlined. */
	.leaflet :global(a.button) {
		display: inline-block;
		text-align: center;
		text-decoration: none;
	}

	.leaflet :global(button.button:disabled) {
		cursor: default;
	}
</style>