UNPKG

@selenite/graph-editor

Version:

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

33 lines (32 loc) 891 B
import { ClassicPreset } from 'rete'; const socketDatastructures = ['scalar', 'array']; export class Socket extends ClassicPreset.Socket { // readonly isArray: boolean; datastructure = $state('scalar'); isRequired; type = $state('any'); value; selected = $state(false); node; displayLabel; port = $state(); element = $state(); constructor({ name = '', datastructure = 'scalar', isRequired = false, type = 'any', displayLabel, node }) { super(name); this.datastructure = datastructure; this.isRequired = isRequired; this.type = type; this.selected = false; this.node = node; this.displayLabel = displayLabel; } select() { this.selected = true; } deselect() { this.selected = false; } toggleSelection() { this.selected = !this.selected; } }