--- // @ts-ignore - types provided by Astro at runtime import { Image as AstroImage } from "astro:assets"; interface Props { /** Source image imported via astro:assets */ src: any; /** Alt text for accessibility */ alt: string; /** Optional HTML string caption (use slot caption for rich content) */ caption?: string; /** Optional class to apply on the
wrapper when caption is used */ figureClass?: string; /** Enable medium-zoom behavior on this image */ zoomable?: boolean; /** Show a download button overlay and enable download flow */ downloadable?: boolean; /** Optional explicit file name to use on download */ downloadName?: string; /** Optional explicit source URL to download instead of currentSrc */ downloadSrc?: string; /** Optional link that wraps the image (not the caption) */ linkHref?: string; /** Optional target for the link (default: _blank when linkHref provided) */ linkTarget?: string; /** Optional rel for the link (default: noopener noreferrer when linkHref provided) */ linkRel?: string; /** Any additional attributes should be forwarded to the underlying */ [key: string]: any; } const { caption, figureClass, zoomable, downloadable, downloadName, downloadSrc, linkHref, linkTarget, linkRel, fullWidth, ...imgProps } = Astro.props as Props; const hasCaptionSlot = Astro.slots.has("caption"); const hasCaption = hasCaptionSlot || (typeof caption === "string" && caption.length > 0); const hasTitle = Astro.slots.has("title"); const uid = `ri_${Math.random().toString(36).slice(2)}`; const dataZoomable = zoomable === true || (imgProps as any)["data-zoomable"] ? "1" : undefined; const dataDownloadable = downloadable === true || (imgProps as any)["data-downloadable"] ? "1" : undefined; const hasLink = typeof linkHref === "string" && linkHref.length > 0; const resolvedTarget = hasLink ? linkTarget || "_blank" : undefined; const resolvedRel = hasLink ? linkRel || "noopener noreferrer" : undefined; ---
{ hasCaption ? (
{dataDownloadable ? ( {hasLink ? ( ) : ( )} ) : hasLink ? ( ) : ( )}
{hasCaptionSlot ? ( ) : ( caption && )}
) : dataDownloadable ? ( {hasLink ? ( ) : ( )} ) : hasLink ? ( ) : ( ) }