import type { EdgeChange, NodeChange, WorkflowEdge, WorkflowNode } from "../editor";
export interface UseFlowStateOptions<TNData = unknown, TEData = unknown> {
    initialNodes?: WorkflowNode<TNData>[];
    initialEdges?: WorkflowEdge<TEData>[];
}
/**
 * Patch type for `updateNodeData` — accepts a partial object that gets
 * shallow-merged, or a producer function `(prev) => next`.
 */
export type NodeDataPatch<TNData> = Partial<TNData> | ((prev: TNData | undefined) => TNData | undefined);
export interface FlowStateBag<TNData = unknown, TEData = unknown> {
    nodes: WorkflowNode<TNData>[];
    edges: WorkflowEdge<TEData>[];
    onNodesChange: (changes: NodeChange<TNData>[]) => void;
    onEdgesChange: (changes: EdgeChange<TEData>[]) => void;
    setNodes: (update: WorkflowNode<TNData>[] | ((prev: WorkflowNode<TNData>[]) => WorkflowNode<TNData>[])) => void;
    setEdges: (update: WorkflowEdge<TEData>[] | ((prev: WorkflowEdge<TEData>[]) => WorkflowEdge<TEData>[])) => void;
    /**
     * Update the `data` slice of a single node by id. Only that node's
     * reference changes — every other node keeps its previous reference,
     * so React.memo'd kind components for unrelated nodes do not re-render.
     * No-ops when `id` is not present in the current nodes array.
     */
    updateNodeData: (id: string, patch: NodeDataPatch<TNData>) => void;
    /**
     * Read a single node by id from the latest snapshot. Returns undefined
     * if the id is unknown. Useful inside imperative callbacks that need
     * the freshest value without subscribing to re-renders.
     */
    getNode: (id: string) => WorkflowNode<TNData> | undefined;
}
export declare function useFlowState<TNData = unknown, TEData = unknown>(options?: UseFlowStateOptions<TNData, TEData>): FlowStateBag<TNData, TEData>;
//# sourceMappingURL=useFlowState.d.ts.map