import type { Socket } from "@nodes/types"; import { getContext } from "svelte"; export function getGraphState() { return getContext("graphState"); } export class GraphState { activeNodeId = $state(-1); selectedNodes = $state(new Set()); activeSocket = $state(null); hoveredSocket = $state(null); possibleSockets = $state([]); possibleSocketIds = $derived(new Set( this.possibleSockets.map((s) => `${s.node.id}-${s.index}`), )); clearSelection() { this.selectedNodes = new Set(); } } export { colors } from "./colors";