import type { Channel, ChannelMessage, View, ViewContext } from "@berry/api/web.ts"; import type { Ghostty, Terminal } from "./ghostty.ts"; import { Grid } from "./grid.ts"; import { COLORS } from "./palette.ts"; import { type ClientMessage, OUTPUT, type ServerMessage, SNAPSHOT } from "./protocol.ts"; const FALLBACK = { width: 8, height: 18 }; const css = ([r, g, b]: readonly number[]) => `rgb(${r} ${g} ${b})`; const zoomKey = (key: KeyboardEvent) => (key.ctrlKey || key.metaKey) && ["Equal", "Minus", "Digit0", "NumpadAdd", "NumpadSubtract", "Numpad0"].includes(key.code); /** A conversation's shell, drawn from the terminal state the server sends and the output that follows it. */ export function terminalView(load: () => Promise): View { const rows =
as HTMLElement; const canvas =