import { FixedObject, FluidObject } from 'gatsby-image'; import ImgixClient from '@imgix/js-core'; import { IGetImageDataArgs, IGatsbyImageData, GatsbyImageProps } from 'gatsby-plugin-image'; import { ObjectTypeComposerFieldConfigAsObjectDefinition } from 'graphql-compose'; import { NodePluginSchema, GatsbyCache, GatsbyGraphQLObjectType, GatsbyGraphQLEnumType, GatsbyGraphQLInputObjectType, PluginOptions as PluginOptions$1 } from 'gatsby'; /** * Imgix parameters used in Imgix's URL API. * * @see Imgix Image URL API Reference: {@link https://docs.imgix.com/apis/rendering} */ declare type ImgixParams = Record; /** * Metadata that defines an image. This data is used to resolve Gatsby image objects. */ interface ImageSource extends ImageSourceDimensions { /** * The image's Imgix URL. */ url: string; } /** * Dimensions of an image. This data is used to resolve Gatsby image objects. */ interface ImageSourceDimensions { /** * The width of the image. */ width: number; /** * The height of the image. */ height: number; } /** * A function that converts an object from your data into image metadata used by * the Gatsby image resolvers. * * @example * * ```ts * interface ImageData { * url?: string; * dimensions?: { * width: number; * height: number; * }; * } * * const generateImageSource = (source: ImageData) => * source.url * ? { * url: source.url, * width: source.dimensions.width, * height: source.dimensions.height, * } * : null; * ``` * * @param source - The source data containing the image's Imgix URL. * * @returns Metadata used by the Gatsby image resolvers. If the source does not * contain an image, return `null` to mark the image as absent. */ declare type GenerateImageSource = (source: TSource) => ImageSource | null | Promise; declare type ImgixClientConfig = ConstructorParameters[0]; declare type BuildFixedObjectTypeConfig$1 = { includeLibraryParam?: boolean; }; /** * @deprecated `gatsby-image` is deprecated ("fixed" and "fluid" images). Use * `gatsby-plugin-image` instead. You can use the `getGatsbyImageData` * function to build an object like `buildFixedObjectType`. * @see {@link https://www.gatsbyjs.com/docs/reference/release-notes/image-migration-guide/ | Migrating from gatsby-image to gatsby-plugin-image} */ declare const buildFixedImageData: (src: string, imgixParams: ImgixParams & { w: number; h: number; }, options?: BuildFixedObjectTypeConfig$1) => FixedObject; declare type BuildFluidObjectTypeConfig$1 = { includeLibraryParam?: boolean; sizes?: string; }; /** * @deprecated `gatsby-image` is deprecated ("fixed" and "fluid" images). Use * `gatsby-plugin-image` instead. You can use the `getGatsbyImageData` * function to build an object like `buildFluidObjectType`. * @see {@link https://www.gatsbyjs.com/docs/reference/release-notes/image-migration-guide/ | Migrating from gatsby-image to gatsby-plugin-image} */ declare const buildFluidImageData: (src: string, imgixParams: ImgixParams & { ar: string; }, options?: BuildFluidObjectTypeConfig$1) => FluidObject; declare type GetGatsbyImageDataConfig = Omit, "baseUrl" | "urlBuilder" | "sourceWidth" | "sourceHeight" | "width" | "aspectRatio" | "pluginName" | "options"> & { src: string; imgixParams?: ImgixParams; } & ({ sourceWidth: number; sourceHeight: number; } | { width: number; aspectRatio: number; }); declare const getGatsbyImageData: (config: GetGatsbyImageDataConfig) => IGatsbyImageData; declare type ImgixGatsbyImageProps = GetGatsbyImageDataConfig & Omit; declare const ImgixGatsbyImage: (props: ImgixGatsbyImageProps) => JSX.Element; declare type FixedArgs = { width?: number; height?: number | null; imgixParams?: ImgixParams; placeholderImgixParams?: ImgixParams; }; declare type BuildFixedFieldConfigConfig = { namespace: string; generateImageSource: GenerateImageSource; defaultImgixParams?: ImgixParams; defaultPlaceholderImgixParams?: ImgixParams; imgixClientConfig?: Partial; }; declare const buildFixedFieldConfig: (config: BuildFixedFieldConfigConfig) => ObjectTypeComposerFieldConfigAsObjectDefinition; declare type BuildFixedObjectTypeConfig = { namespace: string; schema: NodePluginSchema; cache: GatsbyCache; }; declare const buildFixedObjectType: (config: BuildFixedObjectTypeConfig) => GatsbyGraphQLObjectType; declare type FluidArgs = { maxWidth?: number; maxHeight?: number | null; srcSetBreakpoints?: number[]; imgixParams?: ImgixParams; placeholderImgixParams?: ImgixParams; }; declare type BuildFluidFieldConfigConfig = { namespace: string; generateImageSource: GenerateImageSource; defaultImgixParams?: ImgixParams; defaultPlaceholderImgixParams?: ImgixParams; imgixClientConfig?: Partial; }; declare const buildFluidFieldConfig: (config: BuildFluidFieldConfigConfig) => ObjectTypeComposerFieldConfigAsObjectDefinition; declare type BuildFluidObjectTypeConfig = { namespace: string; schema: NodePluginSchema; cache: GatsbyCache; }; declare const buildFluidObjectType: (config: BuildFluidObjectTypeConfig) => GatsbyGraphQLObjectType; declare type BuildGatsbyImageDataPlaceholderEnumConfig = { namespace: string; schema: NodePluginSchema; }; declare const buildGatsbyImageDataPlaceholderEnum: (config: BuildGatsbyImageDataPlaceholderEnumConfig) => GatsbyGraphQLEnumType; /** * Gatsby Image placeholder kinds. * * @see Gatsby Image plugin documentation: {@link https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image/#placeholder} */ declare enum GatsbyImageDataPlaceholderKind { Blurred = "blurred", DominantColor = "dominantColor", None = "none" } /** * Gatsby Image layout kinds. * * @see Gatsby Image plugin documentation: {@link https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image/#layout} */ declare enum GatsbyImageDataLayoutKind { Constrained = "constrained", Fixed = "fixed", FullWidth = "fullWidth" } declare type GatsbyImageDataArgs = { placeholder?: GatsbyImageDataPlaceholderKind; imgixParams?: ImgixParams; placeholderImgixParams?: ImgixParams; layout?: GatsbyImageDataLayoutKind; }; declare type ResolveGatsbyImageDataConfig = { cache: GatsbyCache; pluginName?: string; imgixClientConfig?: Partial; }; declare const resolveGatsbyImageData: (image: ImageSource, options: GatsbyImageDataArgs | undefined, config: ResolveGatsbyImageDataConfig) => Promise; declare type BuildGatsbyImageDataFieldConfigConfig = { namespace: string; pluginName: string; generateImageSource: GenerateImageSource; cache: GatsbyCache; defaultImgixParams?: ImgixParams; defaultPlaceholderImgixParams?: ImgixParams; imgixClientConfig?: Partial; }; declare const buildGatsbyImageDataFieldConfig: (config: BuildGatsbyImageDataFieldConfigConfig) => ObjectTypeComposerFieldConfigAsObjectDefinition; declare type UrlArgs = { imgixParams?: ImgixParams; }; declare type BuildUrlFieldConfigConfig = { namespace: string; generateImageSource: GenerateImageSource; defaultImgixParams?: ImgixParams; imgixClientConfig?: Partial; }; declare const buildUrlFieldConfig: (config: BuildUrlFieldConfigConfig) => ObjectTypeComposerFieldConfigAsObjectDefinition; declare type BuildImgixParamsInputObjectTypeConfig = { namespace: string; schema: NodePluginSchema; }; declare const buildImgixParamsInputObjectType: (config: BuildImgixParamsInputObjectTypeConfig) => GatsbyGraphQLInputObjectType; declare type GenerateImageSourceFromUrlConfig = { cache: GatsbyCache; }; declare const generateImageSourceFromUrl: (url: string, config: GenerateImageSourceFromUrlConfig) => Promise; declare enum SourceType { AmazonS3 = "s3", GoogleCloudStorage = "gcs", MicrosoftAzure = "azure", WebFolder = "webFolder", WebProxy = "webProxy" } declare type PluginOptions = PluginOptions$1 & { defaultImgixParams: ImgixParams; fields: FieldConfig[]; disableIxlibParam: boolean; } & ({ sourceType?: Exclude; domain?: string; secureURLToken?: string; } | { sourceType: SourceType.WebProxy; domain: string; secureURLToken: string; }); /** * Configuration used to register Imgix URL generating fields. * * @typeParam TSource - Source data from which image metadata can be derived. */ declare type FieldConfig = { /** * The root GraphQL node type from which image metadata can be derived. */ nodeType: string; /** * The name of the field that will be added to nodes of type `nodeType`. */ fieldName: string; } & ({ /** * A function that converts an object from your data into image metadata * used by the Gatsby image resolvers. * * @remarks * If a list of images should be returned, use the `generateImageSources` * property in place of `generateImageSource` (note the pluralization). */ generateImageSource: GenerateImageSource; } | { /** * A function that converts an object from your data into a list of image * metadata used by the Gatsby image resolvers. * * @remarks * If a single image should be returned, use the `generateImageSource` * property in place of `generateImageSources` (note the lack of pluralization). */ generateImageSources: GenerateImageSources; } | { /** * A function that converts an object from your data into an image URL * used by the Gatsby image resolvers. * * @remarks * When using this option, a network request will be made for each URL to * fetch its dimensions (the results will be cached). If your data already * contains the image dimensions, use the `generateImageSource` property * in place of `getURL`. * * If a list of images should be returned, use the `getURLs` property in * place of `getURL` (note the pluralization). * @see {@link GenerateImageSource} */ getURL: GetUrl; } | { /** * A function that converts an object from your data into a list of image * URLs used by the Gatsby image resolvers. * * @remarks * When using this option, a network request will be made for each URL to * fetch its dimensions (the results will be cached). If your data already * contains the image dimensions, use the `generateImageSources` property * in place of `getURLs`. * * If a single image should be returned, use the `getURL` property in * place of `getURLs` (note the lack of pluralization). */ getURLs: GetUrls; }); /** * A version of `GenerateImageSource` that returns a list of image sources. * * @see {@link GenerateImageSource} */ declare type GenerateImageSources = (source: TSource) => (ImageSource | null)[] | Promise<(ImageSource | null)[]>; /** * Returns an image URL from source data. * * @param source - Source data from which an image URL can be derived. * * @returns An image URL. */ declare type GetUrl = (source: TSource) => string | null | Promise; /** * Returns a list of image URLs from source data. * * @param source - Source data from which image URLs can be derived. * * @returns A list of image URLs. */ declare type GetUrls = (source: TSource) => (string | null)[] | Promise<(string | null)[]>; export { BuildFixedFieldConfigConfig, BuildFixedObjectTypeConfig, BuildFluidFieldConfigConfig, BuildFluidObjectTypeConfig, BuildGatsbyImageDataFieldConfigConfig, BuildGatsbyImageDataPlaceholderEnumConfig, BuildImgixParamsInputObjectTypeConfig, BuildUrlFieldConfigConfig, FieldConfig, GatsbyImageDataArgs, GatsbyImageDataLayoutKind, GatsbyImageDataPlaceholderKind, GenerateImageSource, GetGatsbyImageDataConfig, ImageSource, ImageSourceDimensions, ImgixClientConfig, ImgixGatsbyImage, ImgixGatsbyImageProps, ImgixParams, PluginOptions, SourceType, UrlArgs, buildFixedFieldConfig, buildFixedImageData, buildFixedObjectType, buildFluidFieldConfig, buildFluidImageData, buildFluidObjectType, buildGatsbyImageDataFieldConfig, buildGatsbyImageDataPlaceholderEnum, buildImgixParamsInputObjectType, buildUrlFieldConfig, generateImageSourceFromUrl, getGatsbyImageData, resolveGatsbyImageData }; //# sourceMappingURL=index.server.d.ts.map