import { Code } from 'lucide-react'; import { useState } from 'react'; import { cn } from '../../lib/utils'; import { PopoutDialog } from '../PopoutDialog'; import { Button } from '../ui/button'; import { DiagramViewer, type DiagramViewerProps } from './DiagramViewer'; /** * The diagram at full size over the document: the SAME `DiagramViewer` the * fence renders inline, in the `TablePopout` chrome (a non-modal Base UI * dialog with the dark scrim; annotation toolbars that portal outside it * stay interactive). One code path: everything the popout can do, the * inline canvas can do, only larger. The canvas takes the keyboard on * arrival so `+`, `-`, `0` and Escape work without a click; Escape walks * the viewer's ladder first (a draft, a selection) and closes the popout * only when nothing else is left to close. */ export function DiagramPopout({ open, onClose, title, container, dataAttributes, ...viewer }: Omit & { open: boolean; onClose: () => void; /** The dialog's accessible name and the header label. */ title: string; /** Portal target; null falls back to body. */ container?: HTMLElement | null; dataAttributes?: Record; }) { const [sourceOpen, setSourceOpen] = useState(false); const hasPane = viewer.onSave !== undefined; return ( {/* The popout's own chrome: a press here addresses no diagram part (see diagram/diagramControls). */}
{title} {hasPane && (