UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

44 lines 1.14 kB
import { Port } from './port.js'; import { action, makeObservable } from 'mobx'; export class Output extends Port { constructor(props) { super(props); makeObservable(this, { set: action }); } set(value, type) { this._value = value; this._dynamicType = type || null; } connect(target) { const graph = this.node.getGraph(); if (!graph) { return { valid: false }; } return graph.connect(this.node, this, target.node, target); } /** * Returns the underlying class of the input. * @returns */ get factory() { //@ts-ignore return this.constructor; } clone() { const clonedOutput = new this.factory({ name: this.name, type: this.type, value: this._value, visible: this.visible, node: this.node }); clonedOutput._dynamicType = this._dynamicType; clonedOutput._edges = [...this._edges]; return clonedOutput; } } //# sourceMappingURL=output.js.map