- 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
15 lines
561 B
TypeScript
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;
|
|
}
|