import ImageTagHelper from "../../core/ImageTagHelper.js"; import TemplateControl from "../../core/TemplateControl.js"; import { XNode } from "../../core/XNode.js"; // import { reveal } from "../../intersection/intersection.js"; let id = 1; let imgID = 1; class ImageCarousel extends TemplateControl { container: HTMLElement; contentClick = (e: MouseEvent) => { if (this.isContentEditable) { return; } let start = e.target as HTMLElement; while (start && !start.assignedSlot) { start = start.parentElement; } if (!start) { return; } const fullScreen = document.createElement("full-screen-image-gallery"); const { children } = this; let selected = null; for (let index = 0; index < children.length; index++) { const element = children[index]; const newChild = element.cloneNode(true) as HTMLElement; if (element === start) { selected = newChild; } if (newChild.tagName === "IMG") { const { full } = ImageTagHelper.getUrls(newChild); newChild.setAttribute("src", full); } fullScreen.appendChild(newChild); } fullScreen.style.position = "fixed"; fullScreen.style.width = "100%"; fullScreen.style.height = "100%"; (fullScreen as any).selected = selected; document.body.appendChild(fullScreen); }; async prepare() { this.id ||= `img_carousel_${id++}`; const root = this.attachShadow({ mode: "open", delegatesFocus: true, slotAssignment: "manual" }); XNode.append(root,