gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
64 lines (63 loc) • 1.87 kB
TypeScript
import type { GatsbyCache } from "gatsby";
import type { IGatsbyImageData, IGatsbyImageHelperArgs, ImageFormat } from "gatsby-plugin-image";
import type { ImgixURLParams } from "imgix-url-builder";
import { buildURL } from "imgix-url-builder";
import { GatsbyImageDataLayoutKind, GatsbyImageDataPlaceholderKind } from "../constants";
export declare const generateImageSource: IGatsbyImageHelperArgs["generateImageSource"];
/**
* The minimal data used when querying an image's pallete data using Imgix's
* API.
*
* @see Imgix Color Pallete Extration: https://docs.imgix.com/apis/rendering/color-palette/palette
*/
export interface ImgixPalleteLike {
colors: {
hex: string;
}[];
dominant_colors?: {
vibrant?: {
hex: string;
};
muted?: {
hex: string;
};
};
}
/**
* Metadata that defines an image. This data is used to resolve Gatsby image
* objects.
*/
export interface ImageSource {
/**
* The image's Imgix URL.
*/
url: string;
/**
* The width of the image.
*/
width: number;
/**
* The height of the image.
*/
height: number;
}
export type GatsbyImageDataArgs = {
placeholder?: GatsbyImageDataPlaceholderKind;
imgixParams?: ImgixURLParams;
placeholderImgixParams?: ImgixURLParams;
aspectRatio?: number;
backgroundColor?: string;
breakpoints?: number[];
formats?: ImageFormat[];
layout?: GatsbyImageDataLayoutKind;
width?: number;
height?: number;
sizes?: string;
};
type ResolveGatsbyImageDataConfig = {
cache: GatsbyCache;
pluginName?: string;
buildURL?: typeof buildURL;
};
export declare const resolveGatsbyImageData: (image: ImageSource, options: GatsbyImageDataArgs | undefined, config: ResolveGatsbyImageDataConfig) => Promise<IGatsbyImageData | null>;
export {};