import { html, nothing } from "lit" import SVGIcon from "../../SVGIcon.js" import ElementFactory from "../../element/ElementFactory.js" import NodeTemplate from "./NodeTemplate.js" export default class VariableManagementNodeTemplate extends NodeTemplate { #hasInput = false #hasOutput = false #displayName = "" static nodeStyleClasses = ["ueb-node-style-glass"] /** @param {NodeElement} element */ initialize(element) { super.initialize(element) this.#displayName = this.element.nodeDisplayName } render() { return html`
${this.#displayName ? html`
${this.#displayName}
` : nothing} ${this.#hasInput ? html`
` : nothing} ${this.#hasOutput ? html`
` : nothing} ${this.pinInserter ? html`
Add pin ${SVGIcon.plusCircle}
`: nothing}
` } createPinElements() { return this.element.getPinEntities() .filter(v => !v.isHidden()) .map(v => { this.#hasInput ||= v.isInput() this.#hasOutput ||= v.isOutput() const result = /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin")) .newObject(v, undefined, this.element) return result }) } }