UNPKG

willcore.ui

Version:

Simple, Fast And Powerful Client-Side HTML UI Framework.

28 lines (22 loc) 713 B
import { bindable } from "../binding/bindable.js"; import { elementProxy } from "../proxies/elementProxy/elementProxy.js"; class component extends bindable { constructor() { super({ function: 1 }, 0); this.initialDisplayState = null; } static get noName() { return true; } static get noValues() { return elementProxy; } beforeBind(){ let display = getComputedStyle(this.element).display; this.initialDisplayState = !display || display === "none" ? "block" : display; } updateDOM(value){ this.element.style.display = value ? "none" : this.initialDisplayState; } } export { component };