import { ReadonlyInputElement } from "./InputElement" import { Store } from "../../Logic/UIEventSource" import BaseUIElement from "../BaseUIElement" import { VariableUiElement } from "../Base/VariableUIElement" export default class VariableInputElement extends BaseUIElement implements ReadonlyInputElement { private readonly value: Store private readonly element: BaseUIElement private readonly upstream: Store> constructor(upstream: Store>) { super() this.upstream = upstream this.value = upstream.bind((v) => v.GetValue()) this.element = new VariableUiElement(upstream) } GetValue(): Store { return this.value } IsValid(t: T): boolean { return this.upstream.data.IsValid(t) } protected InnerConstructElement(): HTMLElement { return this.element.ConstructElement() } }