import { useTinyflowStore } from '#store/stores.svelte';

export const useDeleteNode = () => {
  const store = useTinyflowStore();
  const deleteNode = (id: string) => {
    store.removeNode(id);
    store.updateEdges((edges) =>
      edges.filter((edge) => edge.source !== id && edge.target !== id),
    );
  };
  return {
    deleteNode,
  };
};
