gatsby-source-sanity
Version:
Gatsby source plugin for building websites using Sanity.io as a backend.
68 lines (67 loc) • 1.79 kB
TypeScript
export declare const LOWEST_FLUID_BREAKPOINT_WIDTH = 100;
export declare const DEFAULT_FIXED_WIDTH = 400;
export declare const DEFAULT_FLUID_MAX_WIDTH = 800;
export declare type ImageNode = ImageAsset | ImageObject | ImageRef | string | null | undefined;
declare enum ImageFormat {
NO_CHANGE = "",
WEBP = "webp",
JPG = "jpg",
PNG = "png"
}
declare type GatsbyImageProps = {
base64: string | null;
aspectRatio: number;
src: string;
srcWebp: string;
srcSet: string;
srcSetWebp: string;
};
declare type GatsbyFixedImageProps = GatsbyImageProps & {
width: number;
height: number;
};
declare type GatsbyFluidImageProps = GatsbyImageProps & {
sizes: string;
};
declare type ImageDimensions = {
width: number;
height: number;
aspectRatio: number;
};
declare type ImageMetadata = {
dimensions: ImageDimensions;
lqip?: string;
};
declare type ImageAssetStub = {
url: string;
assetId: string;
extension: string;
metadata: ImageMetadata;
};
declare type ImageAsset = ImageAssetStub & {
_id: string;
};
declare type ImageRef = {
_ref: string;
};
declare type ImageObject = {
asset: ImageRef | ImageAsset;
};
export declare type FluidArgs = {
maxWidth?: number;
maxHeight?: number;
sizes?: string;
toFormat?: ImageFormat;
};
export declare type FixedArgs = {
width?: number;
height?: number;
toFormat?: ImageFormat;
};
declare type SanityLocation = {
projectId: string;
dataset: string;
};
export declare function getFixedGatsbyImage(image: ImageNode, args: FixedArgs, loc: SanityLocation): GatsbyFixedImageProps | null;
export declare function getFluidGatsbyImage(image: ImageNode, args: FluidArgs, loc: SanityLocation): GatsbyFluidImageProps | null;
export {};