export class cx_ui { static #generator(type, manipulator = null) { return (name, click = null, manipulate = null) => { const item = document.createElement(type); item.id = `${type}-${name}`; item.classList.add(name); item.classList.add(`${type}-${name}`); if (manipulator !== null) { manipulator(item); } if (click !== null) { item.addEventListener("click", click); } if (manipulate !== null) { manipulate(item); } return item; }; } static get div() { return this.#generator("div"); } static get push() { return this.#generator("input", (item) => { item.type = "button"; item.classList.add("push"); }); } static p(name, text, click = null, manipulate = null) { const generator = this.#generator("p", (p) => { p.innerText = text; }); const result = generator(name, click, manipulate); return result; } static get input() { return this.#generator("input"); } static image(name, url, click = null, manipulate = null) { const generator = this.#generator("img", (img) => { img.src = url; }); const result = generator(name, click, manipulate); return result; } }