import { useContext } from 'preact/hooks';
import { NodeId, SocketHandlers, SocketHandler } from '../../node.ts';
import './Socket.css';
interface SocketProps {
name: string;
class?: string;
onMouseDown?: SocketHandler;
onMouseUp?: SocketHandler;
}
const Socket = ({ name, onMouseDown, onMouseUp, ...props }: SocketProps) => {
const nodeId = useContext(NodeId);
const wrap = (func?: SocketHandler) => (event: MouseEvent) => func && func(nodeId, name, event);
return (
);
};
export const InSocket = ({ name }: { name: string }) => {
const handlers = useContext(SocketHandlers);
return (
);
};
export const OutSocket = ({ name }: { name: string }) => {
const handlers = useContext(SocketHandlers);
return (
);
};