import './components/main-window.js'; import './components/custom-button.js'; import './components/item-list.js'; import './components/custom-modal.js'; import './components/custom-text.js'; import Store from './modules/store.js'; import text from './modules/text.js'; class AppBase extends HTMLElement { constructor() { super(); this.text = text; this.properties = { color: '#324BFF', }; this.store = new Store(); } connectedCallback() { this.store.subscribe(this.render.bind(this)); this.render(); } renderOptions() { const textList = this.store.getRecords(); return textList.map((item) => `${item.text}`).join('\n'); } render(action = 'INIT') { if (![Store.actions.OPEN_MODAL, Store.actions.CLOSE_MODAL, Store.actions.ADD_LINE, Store.actions.REMOVE_LINE, Store.actions.UNDO, 'INIT'].includes(action)) { return; // Only render if content changed } this.innerHTML = ` ${this.text.title} ${this.text.description} ${this.renderOptions()} Delete Add ${text.modal.description} Add Cancel `; } } customElements.define('app-base', AppBase);
${this.text.description}
${text.modal.description}