UNPKG

circuit-bricks

Version:

A modular, Lego-style SVG circuit component system for React (ALPHA - Not for production use)

31 lines 1.14 kB
/** * usePortPosition Hook * * A React hook for tracking the position of component ports. * Compatible with infinite circuit canvas with panning and zooming. */ import { Point, Wire } from '../schemas/componentSchema'; interface PortPositionState { from: Point | null; to: Point | null; error: string | null; } /** * A hook to track the positions of ports connected by a wire * * @param wire - The wire connecting the ports * @param deps - Additional dependencies that should trigger position updates * @returns Object containing port positions and error state */ export declare function usePortPosition(wire: Wire | null, deps?: any[]): PortPositionState; /** * Hook to track a single port position * * @param componentId - The component ID * @param portId - The port ID * @param deps - Additional dependencies that should trigger position updates * @returns The port position or null if not found */ export declare function useSinglePortPosition(componentId: string | null, portId: string | null, deps?: any[]): Point | null; export default usePortPosition; //# sourceMappingURL=usePortPosition.d.ts.map