[READ-ONLY] Mirror of https://github.com/bombshell-dev/tty. Platform independent 2D layout engine for terminal applications based on Clay
5

Configure Feed

Select the types of activity you want to include in your feed.

๐Ÿ’… use const for top-level constants in demos

Charles Lowell (Apr 10, 2026, 4:06 PM -0500) e4137556 feaa5c27

+24 -24
+13 -13
demo/inline-region.ts
··· 28 28 import { cursor, settings } from "../settings.ts"; 29 29 import { validated } from "../validate.ts"; 30 30 31 - let encode = (s: string) => new TextEncoder().encode(s); 32 - let write = (b: Uint8Array) => Deno.stdout.writeSync(b); 31 + const encode = (s: string) => new TextEncoder().encode(s); 32 + const write = (b: Uint8Array) => Deno.stdout.writeSync(b); 33 33 34 - let GREEN = rgba(80, 250, 123); 35 - let GRAY = rgba(100, 100, 100); 36 - let CYAN = rgba(139, 233, 253); 34 + const GREEN = rgba(80, 250, 123); 35 + const GRAY = rgba(100, 100, 100); 36 + const CYAN = rgba(139, 233, 253); 37 37 38 - let RED = rgba(255, 0, 0); 39 - let ORANGE = rgba(255, 153, 0); 40 - let YELLOW = rgba(255, 255, 0); 41 - let NGREEN = rgba(51, 255, 0); 42 - let BLUE = rgba(0, 153, 255); 43 - let VIOLET = rgba(102, 0, 255); 44 - let RAINBOW = [RED, ORANGE, YELLOW, NGREEN, BLUE, VIOLET]; 38 + const RED = rgba(255, 0, 0); 39 + const ORANGE = rgba(255, 153, 0); 40 + const YELLOW = rgba(255, 255, 0); 41 + const NGREEN = rgba(51, 255, 0); 42 + const BLUE = rgba(0, 153, 255); 43 + const VIOLET = rgba(102, 0, 255); 44 + const RAINBOW = [RED, ORANGE, YELLOW, NGREEN, BLUE, VIOLET]; 45 45 46 - let BRAILLE = ["โ ‹", "โ ™", "โ น", "โ ธ", "โ ผ", "โ ด", "โ ฆ", "โ ง", "โ ‡", "โ "]; 46 + const BRAILLE = ["โ ‹", "โ ™", "โ น", "โ ธ", "โ ผ", "โ ด", "โ ฆ", "โ ง", "โ ‡", "โ "]; 47 47 48 48 function* queryCursor(): Operation<CursorEvent> { 49 49 let parser = yield* until(createInput({ escLatency: 100 }));
+11 -11
demo/keyboard.ts
··· 33 33 import { useInput } from "./use-input.ts"; 34 34 import { useStdin } from "./use-stdin.ts"; 35 35 36 - let active = rgba(60, 120, 220); 37 - let inactive = rgba(50, 50, 60); 38 - let on = rgba(40, 180, 80); 39 - let label = rgba(220, 220, 220); 40 - let dim = rgba(100, 100, 120); 41 - let highlight = rgba(255, 220, 80); 36 + const active = rgba(60, 120, 220); 37 + const inactive = rgba(50, 50, 60); 38 + const on = rgba(40, 180, 80); 39 + const label = rgba(220, 220, 220); 40 + const dim = rgba(100, 100, 120); 41 + const highlight = rgba(255, 220, 80); 42 42 43 - let KEY_W = 5; 44 - let GAP = 1; 43 + const KEY_W = 5; 44 + const GAP = 1; 45 45 46 46 interface KeyDef { 47 47 label: string; ··· 58 58 event.code.toUpperCase() === k.code.toUpperCase(); 59 59 } 60 60 61 - let hovered = rgba(80, 80, 100); 61 + const hovered = rgba(80, 80, 100); 62 62 63 63 function key(ops: Op[], k: KeyDef, ctx: AppContext): void { 64 64 let pressed = ctx.event && matches(k, ctx.event); ··· 328 328 ); 329 329 } 330 330 331 - let flagNames: 331 + const flagNames: 332 332 (keyof Omit<AppContext, "mode" | "event" | "logged" | "log" | "entered">)[] = 333 333 [ 334 334 "Disambiguate escape codes", ··· 338 338 "Report associated text", 339 339 ]; 340 340 341 - let logEntries: { key: string; name: keyof EventFilter }[] = [ 341 + const logEntries: { key: string; name: keyof EventFilter }[] = [ 342 342 { key: "a", name: "keydown" }, 343 343 { key: "b", name: "keyup" }, 344 344 { key: "c", name: "keyrepeat" },