/** @jsxRuntime automatic */ /** @jsxImportSource remix/component */ import { buildSrcset, pickVariant } from '../../src/domain/image-plan.ts' import type { Photo } from '../../src/domain/types.ts' import { variantUrl, type Site } from '../data/site.ts' export type PictureOptions = { /** `sizes` attribute: how wide the image renders at each breakpoint. */ sizes: string /** Above-the-fold images load eagerly with high priority; everything else is lazy. */ priority?: boolean class?: string } /** * `` with WebP and JPEG srcsets, intrinsic size, and the tiny LQIP * painted behind it, so the box is the right shape before a byte of the photo * arrives (no layout shift) and never flashes empty. */ export function picture(site: Site, photo: Photo, options: PictureOptions) { const url = (p: Photo, v: Parameters[2]) => variantUrl(site, p, v) const fallback = pickVariant(photo, 'jpeg', 960) ?? photo.variants[0]! return ( {photo.alt} ) }