OptionalisOptionalonCalled when any of a node's rim badges is clicked, after that badge's own
onClick. Use it for behaviour every badge shares; use NodeBadge.onClick
for one badge's own action.
Declaring it makes every badge take the pointer cursor and consume its click, so the node underneath is not also selected.
OptionalonCalled when the user asks to delete graph elements, before anything is removed. The library resolves the whole target set first — including the edges that removing a node would take with it (DeleteContext.cascadingEdges) — so a consumer can persist the full consequence of the gesture without re-deriving the cascade.
false / { accept: false } to veto: nothing is removed, no
nodeRemove/edgeRemove/noteRemove fires, and the selection is left intact.true to delete exactly what was requested.{ accept: true, nodes?, edges?, notes? } to narrow the delete to
a subset — e.g. keep only what the backend actually deleted. An omitted key
means "as requested", so { accept: true } is equivalent to true; pass an
empty array to spare that kind entirely. Elements that weren't part of the
request are ignored.May be async (persist the delete, then decide) — a second delete gesture is ignored while a decision is pending. DeleteContext.confirm opens a confirmation modal so consumers don't rebuild one.
Only user-initiated deletes are gated: programmatic graph.removeNode() /
graph.removeEdge() / noteManager.removeNote() never invoke this hook, so
consumer code driving the model isn't blocked by the consumer's own gate.
OptionalonCalled during a connect gesture, after the target node is resolved but before the edge (or note-link) is created. Acts as the edge equivalent of onBeforeNodeEditCommit: a validation / enrichment / veto hook.
false / { accept: false } to veto: the preview is dropped,
nothing is added, and connect mode stays armed so the user can retry.true to accept with defaults.{ accept: true, data?, style?, id?, directed? } to accept and
supply the new edge's payload/style/id/direction.May be async (e.g. persist to a backend before deciding); the shadow-edge
preview persists until the promise settles, and no new connect gesture is
accepted while it is pending. Fires for both click- and drag-to-connect.
Also fires for note→node links (EdgeCreateContext.kind 'note-link'),
where the edge-specific fields of the decision are ignored.
whether the connection should be created, optionally with its data.
OptionalonCalled when an edge edit session is about to be committed. Acts as a
validation / persistence / veto hook, mirroring onBeforeNodeEditCommit:
return false (or a promise of it) to refuse, leaving the edge's data
untouched and the modal open. On success the edge's data is replaced and
edgeChange fires on the data bus.
whether the commit should proceed
OptionalonCalled once, with the whole candidate set, just before a pivot ingests it — the one gate on the ingest pipeline.
false / { accept: false } to veto: nothing lands, and the run
reports 'vetoed'.true to ingest exactly what was chosen.{ accept: true, nodes?, edges? } to narrow the ingest to a
subset — e.g. only what the backend confirmed. An omitted key means "as
requested", so { accept: true } is equivalent to true; pass an empty
array to land none of that kind.Called once per ingest with the entire batch, never per candidate: a pivot
that found 1,800 correlations must not turn into 1,800 hook calls, and the
per-gesture write-path hooks (onBeforeEdgeCreate, onBeforeDelete)
are deliberately about user gestures rather than a programmatic merge. It gates
autoIngest pivots too, which is what keeps them governed.
May be async (persist, then decide). IngestContext.confirm opens the shared confirmation modal.
OptionalonCalled when the user creates a node interactively (Create ▸ Add node, or the canvas context-menu's "Add Node Here"), once the graph-space position is known and before the node is added. Mirrors onBeforeEdgeCreate:
false / { accept: false } to veto — nothing is added.true to accept the library's default node.{ accept: true, id?, data?, style? } to accept and supply the new
node's id / payload / style.May be async, and NodeCreateContext.promptData opens the same
declarative-form or custom-HTML modal the edge hook uses. Absent this hook the
tool still works — it just creates a default, unnamed node. Programmatic
graph.addNode() is never gated.
OptionalonCalled when a node edit session is about to be committed. Acts as a
validation / persistence / veto hook: return false (or a promise of it) to
refuse, leaving the node's data untouched and the modal open. On success the
node's data is replaced and nodeChange fires on the data bus.
boolean indicating if the commit should proceed or not
OptionalonCalled when the canvas is about to be zoomed.
OptionalonCalled when the canvas is clicked.
OptionalonCalled when the canvas is right clicked.
OptionalonCalled when the mouse move over the canvas.
OptionalonCalled when a user pointer down the canvas.
OptionalonCalled when a user pointer up the canvas.
OptionalonCalled when the canvas is zoomed.
OptionalonCalled when an edge is unselected by the user.
OptionalonCalled when an edge is selected by the user.
OptionalonCalled when an edge is right clicked.
OptionalonCalled when an edge is selected by the user.
OptionalonCalled when an edge edit session starts. Acts as a UI hook, mirroring
onNodeEdit: return the body to inject into the edit modal. A custom
body owns the draft — mutate session.draft (or call session.setDraft) as
the user types, because the library has no form to read on submit.
The edge edit session
A HTML Div that will be injected in the modal's body
OptionalonCalled when an edge edit session gets cancelled.
OptionalonCalled when a user hovers over an edge.
OptionalonCalled when a user hovers over an edge.
OptionalonCalled when an edge is selected by the user.
OptionalonCalled when a node is unselected by the user.
OptionalonCalled when a node is clicked.
OptionalonCalled when a node is right clicked.
OptionalonCalled when a node is double clicked.
OptionalonCalled when a node drag ends.
OptionalonCalled when a node is dragged.
OptionalonCalled when a node edit session starts. Act as a UI hook.
The node edit session
A HTML Div that will be injected in the modal's body
OptionalonCalled when an node edit session gets cancelled
OptionalonCalled when a user hovers over a node.
OptionalonCalled when a user hovers out of a node.
OptionalonCalled when a user pointer down a node.
OptionalonCalled when a user pointer up a node.
OptionalonCalled when a node is selected by the user.
OptionalonCalled when nodes are selected by the user.
OptionalonCalled when a note is clicked.
OptionalonCalled when a note is right clicked.
OptionalonCalled when a note is double clicked.
OptionalonCalled when a user pointer up a node.
OptionalonCalled when a user pointer down a node.
OptionalonCalled when a user pointer up a node.
OptionalonCalled when a user hovers over a note.
OptionalonCalled when a user hovers out of a note.
OptionalonCalled when a user pointer down a node.
OptionalonCalled when a user pointer up a node.
OptionalonCalled when the every tenth of simulation ticks.
OptionalonCalled when the simulation ticks.
Live validity predicate evaluated during the connect gesture as the cursor hovers candidate targets (à la React Flow's
isValidConnection). Returnfalseto mark the hovered target invalid: the shadow edge renders in an invalid style, and releasing / clicking on it creates nothing (in that case onBeforeEdgeCreate is not consulted). Runs on every pointer move, so it must be synchronous and cheap.