Good Evening, while I was working on a system for creating a workflow editor (similar to reactflow for instance), I wanted to develop this system as flexible as possible:
- Nodes can contain various Input/output connectors.
- Each Input can only be connected to one output.
- Outputs can be connected to various inputs.
- Outputs can only be connected to inputs. And inputs only to outputs.
- All Nodes are rendered wthin one component I call "Node-Renderer" in which the Object structure is passed to as an input signal.
All of this is contained in one large Object so I can export/import in JSON alike this here. (PS. Node A's (index is 0 ) Output 0 is connected to Node B's (index is one) Input 0)
[
{
title: 'Node A',
type: '',
x: 0,
y: 0,
input:
[
{
title: 'Input'
type: '',
x: 0,
y: 0,
reference: '',
}
],
output:
[
{
title: 'Output',
type: '',
x: 0,
y: 0,
reference: ['1/0'],
}
],
},
{
title: 'Node B',
type: '',
x: 0,
y: 0,
input:
[
{
title: 'Input'
type: '',
x: 0,
y: 0,
reference: '0/0',
}
],
output:
[
{
title: 'Output',
type: '',
x: 0,
y: 0,
reference: [],
}
],
}
]