/** * @jorvel/runtime — Image optimization helpers. * * Pairs with the `jorvel image` CLI that produces resized WebP/AVIF assets. * The runtime side handles: * - `buildSrcset(src, { widths })` — formats the `` string * - `buildSizes(breakpoints)` — formats the `` string * - `` — React component that wires srcset + sizes + lazy + decoding * * Format negotiation: callers can pass `{ formats: ['avif', 'webp'] }` and the * helper emits one `` per format with the right `type`. Falls back to * a plain `` for unknown formats (server-rendered HTML stays valid even * when the client doesn't understand AVIF). */ import React from 'react'; export type ImageFormat = 'avif' | 'webp' | 'jpg' | 'png'; export declare const DEFAULT_WIDTHS: number[]; export interface BuildSrcsetOptions { /** Pixel widths to emit. Default: DEFAULT_WIDTHS. */ widths?: number[]; /** Template token replaced with the width. Default: `{w}`. */ widthToken?: string; /** Pixel-density variants (`1x`, `2x`) instead of width descriptors. */ density?: number[]; } export declare function buildSrcset(srcTemplate: string, opts?: BuildSrcsetOptions): string; export interface BuildSizesOptions { /** Pairs of `min-width` → CSS size, applied in order. */ breakpoints?: Array<{ minWidth: number; size: string; }>; /** Fallback size when no breakpoint matches. Default: `100vw`. */ fallback?: string; } export declare function buildSizes(opts?: BuildSizesOptions): string; export interface ImageProps extends Omit, 'src' | 'srcSet' | 'sizes' | 'width' | 'height'> { src: string; alt: string; width: number; height: number; widths?: number[]; formats?: ImageFormat[]; breakpoints?: BuildSizesOptions['breakpoints']; sizes?: string; /** Pre-decode + low-priority hint. Default: `lazy` / `async` / `low`. */ loading?: 'lazy' | 'eager'; decoding?: 'auto' | 'sync' | 'async'; fetchPriority?: 'auto' | 'low' | 'high'; /** Replace the default extension with the format suffix. Default: true. */ rewriteExtension?: boolean; } export declare function Image(props: ImageProps): React.ReactElement; export interface PreloadImageLink { rel: 'preload'; as: 'image'; href: string; imagesrcset: string; imagesizes: string; fetchpriority?: 'high' | 'low'; } /** Build a `` descriptor for an LCP candidate. */ export declare function buildImagePreloadLink(src: string, opts?: BuildSrcsetOptions & BuildSizesOptions & { fetchPriority?: 'high' | 'low'; }): PreloadImageLink; //# sourceMappingURL=image.d.ts.map