--- // @ts-ignore - types provided by Astro at runtime import { Image } 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; /** Any additional attributes should be forwarded to the underlying */ [key: string]: any; } const { caption, figureClass, zoomable, downloadable, downloadName, downloadSrc, ...imgProps } = Astro.props as Props; const hasCaptionSlot = Astro.slots.has('caption'); const hasCaption = hasCaptionSlot || (typeof caption === 'string' && caption.length > 0); 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; ---
{hasCaption ? (
{dataDownloadable ? ( ) : ( )}
{hasCaptionSlot ? ( ) : ( caption && )}
) : ( dataDownloadable ? ( ) : ( ) )}