import { useCallback, useRef, useState } from 'react'; import { Search, Footprints, Droplets, Ellipsis } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import type { NodeAction } from './types'; import styles from './ProcessDiagram.module.css'; const HIDE_DELAY = 150; interface NodeToolbarProps { nodeId: string; /** Screen-space position (already transformed by zoom/pan) */ screenX: number; screenY: number; onAction: (nodeId: string, action: NodeAction) => void; onMouseEnter: () => void; onMouseLeave: () => void; } const ACTIONS: { Icon: LucideIcon; action: NodeAction; title: string }[] = [ { Icon: Search, action: 'inspect', title: 'Inspect' }, { Icon: Footprints, action: 'toggle-trace', title: 'Toggle tracing' }, { Icon: Droplets, action: 'configure-tap', title: 'Configure tap' }, { Icon: Ellipsis, action: 'copy-id', title: 'Copy ID' }, ]; export function NodeToolbar({ nodeId, screenX, screenY, onAction, onMouseEnter, onMouseLeave, }: NodeToolbarProps) { return (