Skip to content

@sqlrooms/cosmos / CosmosSliceState

Type Alias: CosmosSliceState

CosmosSliceState = object

Core state interface for the Cosmos graph visualization. Contains the graph instance, simulation state, and all control functions.

Properties

cosmos

cosmos: object

NameTypeDescription
configCosmosSliceConfig-
graphGraph | nullThe current graph instance
isSimulationRunningbooleanWhether the physics simulation is currently running
setConfig()(config) => voidSets the config for the cosmos slice
createGraph()(container) => voidCreates a new graph instance in the specified container
toggleSimulation()() => voidToggles the physics simulation on/off
fitView()() => voidAdjusts the view to fit all nodes
startWithEnergy()() => voidStarts the simulation with initial energy
destroyGraph()() => voidCleans up and removes the current graph
updateSimulationConfig()(config) => voidUpdates the simulation configuration parameters
updateGraphConfig()(config) => voidUpdates the graph's visual configuration
updateGraphData()(data) => voidUpdates the graph's data (points, links, colors, etc.)
setFocusedPoint()(index) => voidSets the currently focused point by its index
setZoomLevel()(level) => voidSets the zoom level of the graph view