~ 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
425 lines · 9.3 KB Raw History
/* The workspace's base: the reset, the body and the type, and what every
   part draws alike (buttons, menus that open, dialogs, icons, keys), each
   value a token from tokens.css by name. Unlike the view, the page is the
   viewport: tabs, the strip map, then the strip.

   The tiles draw with @hud/renderer, whose values are the MCP Apps host
   variables (renderer/src/theme.css), which Claude and ChatGPT set for
   it. Here they are set from the tokens, on the root, so a tile and the
   chrome around it are one look; and again on whatever is drawn in a
   palette of its own (`data-palette`: the playground's preview), as a
   custom property takes the values of the element it is set on.

   A class here reaches into the tiles too, where the renderer's
   components name their parts as they like (.field, .empty, .count,
   .spinner), scoped to themselves but not alone: so no class here takes
   a name as plain as those, and a part only an atom draws (a count, a
   spinner) keeps its style in the atom. */

:root,
[data-palette] {
	--color-background-primary: var(--bg);
	--color-background-secondary: var(--soft);
	--color-background-tertiary: var(--line);
	--color-background-inverse: var(--fg);
	--color-background-info: var(--accent-soft);
	--color-background-danger: var(--soft);
	--color-background-warning: var(--notice);

	--color-text-primary: var(--fg);
	--color-text-secondary: var(--mute);
	--color-text-tertiary: var(--faint);
	--color-text-inverse: var(--bg);
	--color-text-info: var(--accent);
	--color-text-danger: var(--danger);
	--color-text-warning: var(--notice-fg);

	--color-border-primary: var(--line-strong);
	--color-border-secondary: var(--line);
	--color-border-danger: var(--danger);
	--color-border-warning: var(--notice-track);

	--color-ring-primary: var(--primary);

	--hud-color-open: var(--open);
	--hud-color-merged: var(--merged);
	--hud-color-closed: var(--closed-pull);
	--hud-color-neutral: var(--neutral);
	--hud-color-running: var(--running);
	--hud-color-on-role: var(--on-solid);
	--hud-diff-added: var(--ins);
	--hud-diff-added-number: var(--ins-n);
	--hud-diff-removed: var(--del);
	--hud-diff-removed-number: var(--del-n);
	--hud-diff-hunk: var(--hunk);
	--hud-tint-green: var(--tint-green);
	--hud-tint-blue: var(--tint-blue);
	--hud-tint-purple: var(--tint-purple);
	--hud-tint-gray: var(--tint-gray);
	--hud-tint-yellow: var(--tint-yellow);
	--hud-tint-red: var(--tint-red);
	--hud-tint-orange: var(--tint-orange);
	--hud-tint-glyph: var(--on-tint);

	--font-weight-normal: var(--weight-normal);
	--font-weight-medium: var(--weight-medium);
	--font-weight-semibold: var(--weight-semibold);
	--font-weight-bold: var(--weight-bold);
	--font-text-xs-size: var(--text-xs);
	--font-text-sm-size: var(--text-sm);
	--font-text-md-size: var(--text-md);
	--font-text-xs-line-height: var(--leading);
	--font-text-sm-line-height: var(--leading);
	--font-text-md-line-height: var(--leading);
	--font-heading-sm-size: var(--text-lg);
	--font-heading-md-size: var(--text-xl);
	--font-heading-lg-size: var(--text-2xl);
	--font-heading-sm-line-height: var(--leading-tight);
	--font-heading-md-line-height: var(--leading-tight);
	--font-heading-lg-line-height: var(--leading-tight);

	--border-radius-xs: var(--radius-xs);
	--border-radius-sm: var(--radius-sm);
	--border-radius-md: var(--radius-md);
	--border-radius-lg: var(--radius-lg);
	--border-radius-full: var(--radius-full);

	--shadow-lg: var(--shadow-pop);
	--hud-scrim: var(--scrim);
	--hud-text-field: var(--text-field);

	--hud-space-1: var(--space-1);
	--hud-space-2: var(--space-2);
	--hud-space-3: var(--space-3);
	--hud-space-4: var(--space-4);
	--hud-space-5: var(--space-6);
	--hud-space-6: var(--space-8);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

html,
body,
#app {
	height: 100%;
}

body {
	margin: 0;
	overflow: hidden;
	overscroll-behavior: none;
	background: var(--canvas);
	color: var(--fg);
	font: var(--text-base) / var(--leading) var(--font-sans);
	-webkit-font-smoothing: antialiased;
}

:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

h1,
h2,
h3 {
	margin: 0;
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-tight);
}

p {
	margin: 0;
}

svg.i {
	flex: none;
	width: var(--icon);
	height: var(--icon);
	vertical-align: -3px;
}

kbd {
	padding: 0 var(--space-1);
	border: var(--border);
	border-radius: var(--radius-sm);
	color: var(--mute);
	font: var(--text-2xs) / 1.5 var(--font-sans);
}

.mute {
	color: var(--mute);
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1-5);
	height: var(--control);
	padding: 0 var(--space-3);
	border: var(--border);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--fg);
	font: var(--weight-medium) var(--text-sm) var(--font-sans);
	white-space: nowrap;
	cursor: pointer;
}

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

.btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.btn.sm {
	height: var(--control-sm);
	padding: 0 var(--space-2-5);
}

.btn.primary {
	border-color: var(--primary);
	background: var(--primary);
	color: var(--on-primary);
}

.btn.primary:hover {
	opacity: 0.85;
}

.btn.danger {
	color: var(--danger);
}

/* A button that is its icon alone: a tap's size, its word in its label. */
.icon-button {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: var(--control-sm);
	height: var(--control-sm);
	padding: 0;
	border: 0;
	border-radius: var(--radius-md);
	background: none;
	color: var(--mute);
	cursor: pointer;
}

.icon-button:hover,
.icon-button[aria-pressed='true'] {
	background: var(--hover);
	color: var(--fg);
}

.icon-button:disabled {
	opacity: 0.5;
	cursor: default;
}

.text-button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--fg);
	font: inherit;
	text-decoration: underline;
	text-decoration-color: var(--link-line);
	text-underline-offset: var(--underline-offset);
	cursor: pointer;
}

input,
select {
	font: var(--text-field) var(--font-sans);
}

/* A hint in a field: faint text, which reads at 4.5:1 in every theme, not the browser's grey. */
::placeholder {
	color: var(--faint);
	opacity: 1;
}

.input {
	height: var(--control);
	min-width: 0;
	padding: 0 var(--space-2-5);
	border: var(--border);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--fg);
}

.input:focus {
	outline: 0;
	border-color: var(--primary);
	box-shadow: var(--ring);
}

/* A menu that opens: a <details class="popover">, its <summary> the button, its .menu what opens. */
.popover {
	position: relative;
	display: flex;
	align-items: center;
}

.popover > summary {
	list-style: none;
	cursor: pointer;
}

.popover > summary::-webkit-details-marker {
	display: none;
}

.popover > .menu {
	position: absolute;
	z-index: var(--z-menu);
	top: calc(100% + var(--space-1-5));
	left: 0;
	width: var(--menu-width);
	max-width: calc(100vw - 2 * var(--space-4));
	max-height: calc(100vh - var(--tabs) - 2 * var(--space-4));
	overflow-y: auto;
	padding: var(--space-1) 0;
	border: var(--border);
	border-radius: var(--radius-md);
	background: var(--panel);
	box-shadow: var(--shadow-pop);
	color: var(--fg);
	font-size: var(--text-sm);
}

.popover.end > .menu {
	right: 0;
	left: auto;
}

.menu-head {
	padding: var(--space-2) var(--space-3) var(--space-1);
	color: var(--mute);
	font-size: var(--text-xs);
	font-weight: var(--weight-semibold);
}

.menu-item {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	width: 100%;
	padding: var(--space-2) var(--space-3);
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.menu-item:hover {
	background: var(--hover);
}

.menu-item:disabled {
	opacity: 0.6;
	cursor: default;
}

.menu-item .i {
	color: var(--mute);
}

.menu hr {
	margin: var(--space-1) 0;
	border: 0;
	border-top: var(--border);
}

/* What a list says where its rows would be. */
.empty-state {
	padding: var(--space-1) var(--space-3) var(--space-2);
	color: var(--mute);
	font-size: var(--text-sm);
}

.dialog {
	width: min(var(--dialog-width), calc(100vw - 2 * var(--space-4)));
	margin: 12vh auto auto;
	padding: var(--space-5);
	border: var(--border);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--fg);
	box-shadow: var(--shadow-pop);
}

.dialog::backdrop {
	background: var(--scrim);
}

.dialog h2 {
	padding-right: var(--space-8);
	font-size: var(--text-lg);
	overflow-wrap: anywhere;
}

.dialog .close {
	position: absolute;
	top: var(--space-4);
	right: var(--space-4);
}

.dialog .actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-2);
	margin-top: var(--space-4);
}

.problem {
	color: var(--danger);
	font-size: var(--text-sm);
}

@media (max-width: 640px) {
	/* A menu with much in it opens as a sheet along the bottom, over the page dimmed, which a tap closes. */
	.popover.sheet > .menu {
		position: fixed;
		z-index: calc(var(--z-menu) + 1);
		top: auto;
		right: var(--space-2);
		bottom: var(--space-2);
		left: var(--space-2);
		width: auto;
		max-width: none;
		max-height: 70vh;
	}

	.popover.sheet[open] > summary::before {
		content: '';
		position: fixed;
		inset: 0;
		z-index: var(--z-menu);
		background: var(--scrim);
		cursor: default;
	}

	/* A dialog is a sheet along the bottom, as wide as the screen but its margins: the browser's own most a dialog grows would else leave it off-centre. */
	.dialog {
		position: fixed;
		width: auto;
		max-width: none;
		margin: auto var(--space-2) var(--space-2);
		max-height: 80vh;
	}
}