import TemplateControl from "../../core/TemplateControl.js"; const associatedElement = Symbol("associatedElement"); export default class PdfViewerEditable extends TemplateControl { root: ShadowRoot; async prepare() { this.root = this.attachShadow({ mode: "closed"}); } onChildAdded(child: HTMLElement) { const poster = child.getAttribute("poster"); const img = document.createElement("img"); img.setAttribute("part", "child"); img.src = poster; this.root.appendChild(img); child[associatedElement] = img; } onChildRemoved(child: Node) { child[associatedElement]?.remove(); } } customElements.define("pdf-viewer", PdfViewerEditable);