UseNodeGraphReturn
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:64
Properties
Section titled “Properties”addGroup
Section titled “addGroup”addGroup: (
bounds,options?) =>string
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:109
Append a group. Returns the group id.
Parameters
Section titled “Parameters”bounds
Section titled “bounds”options?
Section titled “options?”Returns
Section titled “Returns”string
addNode
Section titled “addNode”addNode: (
node) =>string
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:76
Append a node (generating an id when omitted). Returns the node id.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
bind:
NodeGraphBind
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:116
Spread onto <NodeGraph {...bind} /> to wire all four controlled props.
clearSelection
Section titled “clearSelection”clearSelection: () =>
void
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:113
Clear the selection.
Returns
Section titled “Returns”void
connect
Section titled “connect”connect: (
source,target,data?) =>string
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:103
Add an edge between two ports, de-duplicating identical endpoints. Returns the new (or existing) edge id.
Parameters
Section titled “Parameters”source
Section titled “source”target
Section titled “target”unknown
Returns
Section titled “Returns”string
disconnectPort
Section titled “disconnectPort”disconnectPort: (
node,port) =>void
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:85
Remove every edge connected to a port — “detach all” for one socket.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”void
duplicateNodes
Section titled “duplicateNodes”duplicateNodes: (
ids?,options?) =>string[]
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:95
Clone nodes (defaults to the current selection), append the copies, and select them. Returns the new node ids.
Parameters
Section titled “Parameters”readonly string[]
options?
Section titled “options?”Returns
Section titled “Returns”string[]
edges:
NodeGraphEdge[]
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:66
groups
Section titled “groups”groups:
NodeGraphGroup[]
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:67
nodes:
NodeGraphNode[]
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:65
removeEdges
Section titled “removeEdges”removeEdges: (
ids) =>void
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:83
Remove the given edges and prune them from the selection.
Parameters
Section titled “Parameters”readonly string[]
Returns
Section titled “Returns”void
removeGroups
Section titled “removeGroups”removeGroups: (
ids) =>void
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:111
Remove the given groups and prune them from the selection.
Parameters
Section titled “Parameters”readonly string[]
Returns
Section titled “Returns”void
removeNodes
Section titled “removeNodes”removeNodes: (
ids) =>void
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:81
Cascade-delete the given nodes — removes them, drops any edge touching them, and prunes them from the selection.
Parameters
Section titled “Parameters”readonly string[]
Returns
Section titled “Returns”void
removeSelection
Section titled “removeSelection”removeSelection: () =>
void
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:90
Cascade-delete the current selection (nodes + edges + groups) and clear it — the programmatic equivalent of pressing Delete.
Returns
Section titled “Returns”void
selection
Section titled “selection”selection:
NodeGraphSelection
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:68
setEdges
Section titled “setEdges”setEdges:
Dispatch<SetStateAction<NodeGraphEdge[]>>
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:71
setGroups
Section titled “setGroups”setGroups:
Dispatch<SetStateAction<NodeGraphGroup[]>>
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:72
setNodes
Section titled “setNodes”setNodes:
Dispatch<SetStateAction<NodeGraphNode[]>>
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:70
setSelection
Section titled “setSelection”setSelection:
Dispatch<SetStateAction<NodeGraphSelection>>
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:73