export class Project extends HTMLElement { constructor() { super() const path = this.getAttribute('path') const shadow = this.attachShadow({mode: 'open'}) const textArea = document.createElement('textarea') const header = document.createElement('h1') header.innerText = path textArea.value = localStorage.getItem( path ) ?? '' textArea.addEventListener('input', e => { localStorage.setItem( path, e.target.value ) }) const div = document.createElement('div') div.appendChild(header) div.appendChild(textArea) shadow.appendChild(div) } connectedCallback() { const style = document.createElement('style') style.textContent = ` textarea { width: 80%; height: 45vh; } ` this.shadowRoot.append(style) } }