@wdprlib/runtime
    Preparing search index...

    Module gallery

    Runtime module for [[gallery]] lightbox behavior.

    The renderer marks lightbox-enabled gallery anchors with the with-lb class (anchors whose href is the image itself) and disabled viewers with data-viewer="false" on the .gallery-box. This module attaches a delegated click listener that opens a <dialog>-based lightbox:

    • shows the clicked anchor's image with its alt text as a caption
    • previous / next buttons and arrow keys navigate within the same gallery box, wrapping at the ends
    • Esc (native dialog cancel), the close button, or a backdrop click close the dialog; focus returns to the anchor that opened it

    Environments without HTMLDialogElement.showModal get no listeners at all — clicks fall through to normal link navigation.

    A small stylesheet is injected once per document and reference-counted across initGallery() instances; consumers can override the wdpr-lightbox* classes.

    The destroy() cleanup removes the listeners, the dialog element, and (at refcount zero) the injected stylesheet.

    Functions

    initGallery