OpenClawBot / src /tui /tui-overlays.ts
darkfire514's picture
Upload 2526 files
fb4d8fe verified
import type { Component, TUI } from "@mariozechner/pi-tui";
type OverlayHost = Pick<TUI, "showOverlay" | "hideOverlay" | "hasOverlay" | "setFocus">;
export function createOverlayHandlers(host: OverlayHost, fallbackFocus: Component) {
const openOverlay = (component: Component) => {
host.showOverlay(component);
};
const closeOverlay = () => {
if (host.hasOverlay()) {
host.hideOverlay();
return;
}
host.setFocus(fallbackFocus);
};
return { openOverlay, closeOverlay };
}