UNPKG

@selenite/graph-editor

Version:

A graph editor for visual programming, based on rete and svelte.

23 lines (22 loc) 780 B
import { XmlSchema } from '@selenite/commons'; import { xmlToGraph } from './code-integration/utils.svelte'; onmessage = (e) => { const { data } = e; switch (data.type) { case 'xmlToGraph': { const { xml } = data; const schema = XmlSchema.fromJSON(data.schema); const { nodes, connections } = xmlToGraph({ xml, schema }); console.log('wow schema', schema); console.log('wow res', nodes, connections); const msg = { type: 'xmlToGraph', nodes: nodes.map((n) => n.toJSON()), connections: connections.map((c) => c.toJSON()) }; console.log('wow msg', msg); postMessage(msg); break; } } };