1import { Controller } from "@hotwired/stimulus" 2import PhotoSwipeLightbox from "photoswipe/lightbox" 3 4export default class extends Controller { 5 connect() { 6 this.lightbox = new PhotoSwipeLightbox({ 7 gallery: this.element, 8 children: "a", 9 pswpModule: () => import("photoswipe") 10 }) 11 12 this.lightbox.addFilter("itemData", (itemData) => { 13 const img = itemData.element?.querySelector("img") 14 if (img?.naturalWidth > 0) { 15 itemData.w = img.naturalWidth 16 itemData.h = img.naturalHeight 17 } 18 return itemData 19 }) 20 21 this.lightbox.init() 22 } 23 24 disconnect() { 25 this.lightbox?.destroy() 26 this.lightbox = null 27 } 28}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.