import { html, nothing, type TemplateResult } from 'lit'; import type { NuiTerminalViewState } from './types.js'; export type { NuiTerminalViewState } from './types.js'; export interface NuiTerminalHandlers { onKeyDown: (event: KeyboardEvent) => void; onContainerClick: () => void; } export function renderTerminal( state: NuiTerminalViewState, handlers: NuiTerminalHandlers, ): TemplateResult { const prompt = state.prompt || 'guest@nucleify:~$ '; return html`
${ state.welcomeMessage ? html`
${state.welcomeMessage}
` : nothing }
${state.history.map( (item) => html`
${prompt} ${item.command}
${ item.response !== undefined ? html`
${item.response}
` : nothing }
`, )}
${prompt}
`; }