io

io.export

export(): GraphSnapshot

Export the complete current graph state as a GraphSnapshot.

Captures node/edge data, node/edge positions, per-element visual overrides (color, size, pinned, width, dashed), the current selection, hidden elements, and camera state (if wireInteraction has been called). The result is a plain JSON-serialisable object.

Not recorded in history (not undoable).

Returns: GraphSnapshot

Example

const snap = api.io.export();
localStorage.setItem("graph", JSON.stringify(snap));