"use client"; import type { CSSProperties, KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent, } from "react"; import { cn } from "~/lib/utils"; import { BROWSER_VIEWPORT_RESIZE_RAIL_SIZE, type BrowserViewportLayout, type BrowserViewportResizeDirection, } from "./browserViewportLayout"; interface Props { readonly layout: BrowserViewportLayout; readonly activeDirection: BrowserViewportResizeDirection | null; readonly onPointerDown: ( direction: BrowserViewportResizeDirection, event: ReactPointerEvent, ) => void; readonly onKeyDown: ( direction: BrowserViewportResizeDirection, event: ReactKeyboardEvent, ) => void; } type HandleKind = "horizontal" | "vertical" | "corner"; const EDGE_BUTTON_CLASS = "group absolute z-20 touch-none border-0 bg-transparent p-0 outline-none before:absolute before:-inset-1 before:content-[''] focus-visible:bg-foreground/[0.04]"; const EDGE_GRIP_CLASS = "pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-muted-foreground/55 transition-colors duration-150 group-hover:text-foreground/85 group-focus-visible:text-foreground group-active:text-foreground"; function ResizeHandle(props: { readonly direction: BrowserViewportResizeDirection; readonly label: string; readonly kind: HandleKind; readonly cursorClassName: string; readonly style: CSSProperties; readonly active: boolean; readonly mirrorCorner?: boolean; readonly onPointerDown: Props["onPointerDown"]; readonly onKeyDown: Props["onKeyDown"]; }) { const { direction, label, kind, cursorClassName, style, active, mirrorCorner = false, onPointerDown, onKeyDown, } = props; return ( ); } export function BrowserViewportResizeHandles({ layout, activeDirection, onPointerDown, onKeyDown, }: Props) { const left = layout.viewportX; const top = layout.viewportY; const right = left + layout.viewportWidth; const bottom = top + layout.viewportHeight; const railSize = BROWSER_VIEWPORT_RESIZE_RAIL_SIZE; const shared = { activeDirection, onPointerDown, onKeyDown }; return ( <> ); }