Files
t3code/apps/web/src/lib/terminalFocus.ts
T
Julius Marminge dd739c880d Port browser preview annotations to desktop
- Add IPC and runtime plumbing for preview annotation theming
- Generate and ship annotation CSS for the desktop overlay
- Add pointer and artifact handling for browser preview interactions
2026-06-13 22:18:37 -07:00

15 lines
561 B
TypeScript

export type TerminalFocusOwner = "drawer" | "right-panel";
export function getTerminalFocusOwner(): TerminalFocusOwner | null {
const activeElement = document.activeElement;
if (!(activeElement instanceof HTMLElement)) return null;
if (!activeElement.isConnected) return null;
const owner = activeElement.closest<HTMLElement>("[data-terminal-owner]")?.dataset.terminalOwner;
if (owner === "drawer" || owner === "right-panel") return owner;
return null;
}
export function isTerminalFocused(): boolean {
return getTerminalFocusOwner() !== null;
}