@xenolithengine/graph-editor
v0.7.0-beta.3
Published
XenolithGraph editor — composes core, renderer, interaction, and plugins.
Maintainers
Readme
@xenolithengine/graph-editor
XenolithGraph editor — composes the headless core, the PIXI renderer, interaction, and plugins into a usable editor. This is the package vanilla hosts always reach for.
Beta — public API in
STABLE-API.mdis the surface we plan to freeze, but it is NOT frozen yet — breaking changes can land at any point before v1.0. If you adopt now, pin an exact version.
Part of XenolithGraph — an AI-native, embeddable node-graph editor for the web with its own visual design language (Xen).
Install
pnpm add @xenolithengine/graph-editor pixi.jspixi.js@^8.6.0 is a peer dependency.
Usage
import { XenolithEditor } from '@xenolithengine/graph-editor'
const editor = await XenolithEditor.init('#graph', {
minimap: true,
controls: true,
snap: 8,
})
editor.loadJSON(savedGraph) // xenolith.v1 format
editor.fitView()
editor.on('node:click', ({ nodeId }) => console.log(nodeId))
editor.on('edge:connecting', (p) => { if (forbidden(p)) p.cancel() })
// namespaced API (v0.7 BETA)
editor.history.undo()
editor.view.fitView({ padding: 80 })
editor.clipboard.copy()What's exported
XenolithEditor—init(target, opts),loadJSON,toJSON/getGraphReadonly,on/off,setTheme,destroy, plus the namespacesview,history,clipboard,chromeXenolithEditorOptions,ConnectionRequest,NodeStatus,GraphSnapshotparseXenolithGraph,serializeXenolithGraph,XENOLITH_GRAPH_VERSION+xenolith.v1types (XenolithGraphV1,XenolithNodeV1, …)CommandRegistry,Commands,ContextMenuRegistry,SidebarManagerStepDebugger,diffGraphs+GraphDifftypesPluginHost,XenolithPlugin,PluginContext- Recipes:
BUILTIN_RECIPES,createRecipeRegistry,instantiateRecipe - Event types:
EditorEvents,PreventablePayload
Docs
- Quickstart guide
- API reference — every method exposed by
XenolithEditor - GitHub
MIT © XenolithEngine
