import { atom } from 'jotai';

/**
 * Atom to store pending drag state when transitioning from docked to floating
 * When the user starts dragging the docked panel header, we store the mouse position
 * so the floating overlay can continue the drag seamlessly
 */
export interface PendingDragState {
  /** Mouse X position when drag started */
  startX: number;
  /** Mouse Y position when drag started */
  startY: number;
  /** Offset from panel left edge to mouse X */
  offsetX: number;
  /** Offset from panel top edge to mouse Y */
  offsetY: number;
  /** Timestamp to prevent stale drag states */
  timestamp: number;
}

export const pendingUndockDragAtom = atom<PendingDragState | null>(null);
