import type { ImageCdn, UrlTransformer } from 'unpic'; export type Layout = 'fixed' | 'constrained' | 'fullWidth' | 'inset' | 'filled'; type Prettify = { [K in keyof T]: T[K]; } & {}; export interface ImageSourceOptions { src: string; width?: number; height?: number; aspectRatio?: number; layout?: Layout; breakpoints?: number[]; transformer?: UrlTransformer; cdn?: ImageCdn; } /** * HTML image attributes, common to image components in multiple frameworks. * For React (and potentially other frameworks added in the future), convert to camelCase. */ export interface CoreImageAttributes> { src?: string | number | null; width?: string | number | null; height?: string | number | null; alt?: string | number | null; loading?: 'eager' | 'lazy' | null; decoding?: 'sync' | 'async' | 'auto' | null; style?: TStyle; srcset?: string | number | null; role?: 'presentation' | 'img' | 'none' | 'figure' | (string & {}) | null; sizes?: string | number | null; fetchpriority?: 'high' | 'low' | 'auto' | null; } export type BaseImageProps, TStyle> = Exclude & ImageSourceOptions & { priority?: boolean; fetchpriority?: 'high' | 'low'; background?: string; objectFit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down' | 'inherit' | 'initial'; }; type BaseImageWithAspectRatioProps, TStyle> = BaseImageProps & { aspectRatio: number; }; type ImageWithAspectRatioAndWidthProps, TStyle> = BaseImageWithAspectRatioProps & { width: number; }; type ImageWithAspectRatioAndHeightProps, TStyle> = BaseImageWithAspectRatioProps & { height: number; }; type ImageWithWidthAndHeightProps, TStyle> = BaseImageProps & { width: number; height: number; }; type ImageWithSizeProps, TStyle> = ImageWithAspectRatioAndWidthProps | ImageWithAspectRatioAndHeightProps | ImageWithWidthAndHeightProps; export type FixedImageProps, TStyle> = Prettify & { layout: 'fixed'; }>; export type ConstrainedImageProps, TStyle> = ImageWithSizeProps & { layout?: 'constrained'; }; export type FullWidthImageProps, TStyle> = BaseImageProps & { layout: 'fullWidth'; width?: never; }; export type InsetImageProps, TStyle> = BaseImageProps & { layout: 'inset'; }; export type FilledImageProps, TStyle> = BaseImageProps & { layout: 'filled'; }; export type AWCImageProps, TStyle = TImageAttributes['style']> = FixedImageProps | ConstrainedImageProps | FullWidthImageProps | InsetImageProps | FilledImageProps; /** * Gets the `sizes` attribute for an image, based on the layout and width */ export declare const getSizes: (width?: number, layout?: Layout) => string | undefined; /** * Gets the styles for an image */ export declare const getStyle: , TStyle = Record>({ width, height, aspectRatio, layout, objectFit, background }: Pick, 'width' | 'height' | 'aspectRatio' | 'layout' | 'objectFit' | 'background'>) => TImageAttributes['style']; /** * Gets the breakpoints for an image, based on the layout and width */ export declare const getBreakpoints: ({ width, layout }: { width?: number; layout: Layout; }) => number[]; /** * Generate an image srcset */ export declare const getSrcSet: ({ src, width, layout, height, aspectRatio, breakpoints, cdn, transformer }: Omit & { src: URL | string; }) => string | undefined; /** * Generates the props for an img element */ export declare function transformProps, TStyle = Record>({ src, width, height, priority, layout, aspectRatio, cdn, transformer, objectFit, background, breakpoints, ...props }: AWCImageProps): TImageAttributes; export {};