gatsby-plugin-image 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -6
- package/dist/babel-helpers.js +66 -66
- package/dist/babel-plugin-parse-static-images.js +80 -80
- package/dist/components/gatsby-image.browser.js +247 -246
- package/dist/components/gatsby-image.server.js +112 -112
- package/dist/components/hooks.js +399 -399
- package/dist/components/intersection-observer.js +55 -55
- package/dist/components/layout-wrapper.js +94 -94
- package/dist/components/lazy-hydrate.js +75 -75
- package/dist/components/main-image.js +43 -43
- package/dist/components/picture.js +96 -96
- package/dist/components/placeholder.js +74 -74
- package/dist/components/static-image.server.js +111 -111
- package/dist/gatsby-image.browser.js +1 -1
- package/dist/gatsby-image.browser.modern.js +1 -1
- package/dist/gatsby-image.browser.module.js +1 -1
- package/dist/gatsby-node.js +54 -54
- package/dist/image-utils.js +449 -449
- package/dist/index.browser-44f85d35.js +2 -0
- package/dist/{index.browser-6dd13747.js.map → index.browser-44f85d35.js.map} +1 -1
- package/dist/index.browser-47dabe93.js +2 -0
- package/dist/{index.browser-38b528ec.js.map → index.browser-47dabe93.js.map} +1 -1
- package/dist/{index.browser-6dd13747.js → index.browser-aa98ba4b.js} +3 -3
- package/dist/{index.browser-bb1a9c70.js.map → index.browser-aa98ba4b.js.map} +1 -1
- package/dist/index.js +27 -27
- package/dist/{lazy-hydrate-9c85febc.js → lazy-hydrate-20d22952.js} +2 -2
- package/dist/{lazy-hydrate-9c85febc.js.map → lazy-hydrate-20d22952.js.map} +1 -1
- package/dist/{lazy-hydrate-3976826a.js → lazy-hydrate-5c228ac8.js} +2 -2
- package/dist/{lazy-hydrate-3976826a.js.map → lazy-hydrate-5c228ac8.js.map} +1 -1
- package/dist/{lazy-hydrate-5042e462.js → lazy-hydrate-85a67a95.js} +2 -2
- package/dist/{lazy-hydrate-5042e462.js.map → lazy-hydrate-85a67a95.js.map} +1 -1
- package/dist/node-apis/image-processing.js +278 -278
- package/dist/node-apis/node-utils.js +11 -11
- package/dist/node-apis/parser.js +98 -98
- package/dist/node-apis/preprocess-source.js +118 -118
- package/dist/node-apis/watcher.js +129 -129
- package/dist/resolver-utils.js +119 -119
- package/dist/src/babel-helpers.d.ts +6 -6
- package/dist/src/babel-plugin-parse-static-images.d.ts +10 -10
- package/dist/src/components/gatsby-image.browser.d.ts.map +1 -1
- package/dist/src/gatsby-node.d.ts +5 -5
- package/dist/src/gatsby-ssr.d.ts.map +1 -1
- package/dist/src/node-apis/image-processing.d.ts +30 -30
- package/dist/src/node-apis/node-utils.d.ts +1 -1
- package/dist/src/node-apis/parser.d.ts +11 -11
- package/dist/src/node-apis/preprocess-source.d.ts +2 -2
- package/dist/src/node-apis/watcher.d.ts +12 -12
- package/dist/src/resolver-utils.d.ts +21 -21
- package/gatsby-ssr.js +1 -1
- package/package.json +4 -4
- package/dist/index.browser-38b528ec.js +0 -2
- package/dist/index.browser-bb1a9c70.js +0 -2
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { GatsbyCache, Reporter, ParentSpanPluginArgs, Actions, Store } from "gatsby";
|
|
2
|
-
import type { FileSystemNode } from "gatsby-source-filesystem";
|
|
3
|
-
import { IStaticImageProps } from "../components/static-image.server";
|
|
4
|
-
import { ISharpGatsbyImageArgs } from "../image-utils";
|
|
5
|
-
export interface IImageMetadata {
|
|
6
|
-
isFixed: boolean;
|
|
7
|
-
contentDigest?: string;
|
|
8
|
-
args: Record<string, unknown>;
|
|
9
|
-
cacheFilename: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function createImageNode({ fullPath, createNodeId, createNode, reporter, }: {
|
|
12
|
-
fullPath: string;
|
|
13
|
-
createNodeId: ParentSpanPluginArgs["createNodeId"];
|
|
14
|
-
createNode: Actions["createNode"];
|
|
15
|
-
reporter: Reporter;
|
|
16
|
-
}): Promise<FileSystemNode | undefined>;
|
|
17
|
-
export declare const isRemoteURL: (url: string) => boolean;
|
|
18
|
-
export declare function writeImages({ images, pathPrefix, cacheDir, reporter, cache, sourceDir, createNodeId, createNode, store, filename, }: {
|
|
19
|
-
images: Map<string, IStaticImageProps>;
|
|
20
|
-
pathPrefix: string;
|
|
21
|
-
cacheDir: string;
|
|
22
|
-
reporter: Reporter;
|
|
23
|
-
cache: GatsbyCache;
|
|
24
|
-
sourceDir: string;
|
|
25
|
-
createNodeId: ParentSpanPluginArgs["createNodeId"];
|
|
26
|
-
createNode: Actions["createNode"];
|
|
27
|
-
store: Store;
|
|
28
|
-
filename: string;
|
|
29
|
-
}): Promise<void>;
|
|
30
|
-
export declare function writeImage(file: FileSystemNode, args: ISharpGatsbyImageArgs, pathPrefix: string, reporter: Reporter, cache: GatsbyCache, filename: string): Promise<void>;
|
|
1
|
+
import { GatsbyCache, Reporter, ParentSpanPluginArgs, Actions, Store } from "gatsby";
|
|
2
|
+
import type { FileSystemNode } from "gatsby-source-filesystem";
|
|
3
|
+
import { IStaticImageProps } from "../components/static-image.server";
|
|
4
|
+
import { ISharpGatsbyImageArgs } from "../image-utils";
|
|
5
|
+
export interface IImageMetadata {
|
|
6
|
+
isFixed: boolean;
|
|
7
|
+
contentDigest?: string;
|
|
8
|
+
args: Record<string, unknown>;
|
|
9
|
+
cacheFilename: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createImageNode({ fullPath, createNodeId, createNode, reporter, }: {
|
|
12
|
+
fullPath: string;
|
|
13
|
+
createNodeId: ParentSpanPluginArgs["createNodeId"];
|
|
14
|
+
createNode: Actions["createNode"];
|
|
15
|
+
reporter: Reporter;
|
|
16
|
+
}): Promise<FileSystemNode | undefined>;
|
|
17
|
+
export declare const isRemoteURL: (url: string) => boolean;
|
|
18
|
+
export declare function writeImages({ images, pathPrefix, cacheDir, reporter, cache, sourceDir, createNodeId, createNode, store, filename, }: {
|
|
19
|
+
images: Map<string, IStaticImageProps>;
|
|
20
|
+
pathPrefix: string;
|
|
21
|
+
cacheDir: string;
|
|
22
|
+
reporter: Reporter;
|
|
23
|
+
cache: GatsbyCache;
|
|
24
|
+
sourceDir: string;
|
|
25
|
+
createNodeId: ParentSpanPluginArgs["createNodeId"];
|
|
26
|
+
createNode: Actions["createNode"];
|
|
27
|
+
store: Store;
|
|
28
|
+
filename: string;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
export declare function writeImage(file: FileSystemNode, args: ISharpGatsbyImageArgs, pathPrefix: string, reporter: Reporter, cache: GatsbyCache, filename: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getCacheDir: (root: string) => string;
|
|
1
|
+
export declare const getCacheDir: (root: string) => string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { NodePath } from "@babel/core";
|
|
2
|
-
import { ParserOptions } from "@babel/parser";
|
|
3
|
-
import babel from "@babel/core";
|
|
4
|
-
import { IStaticImageProps } from "../components/static-image.server";
|
|
5
|
-
export declare function getBabelParserOptions(filePath: string): ParserOptions;
|
|
6
|
-
export declare function babelParseToAst(contents: string, filePath: string): babel.types.File;
|
|
7
|
-
/**
|
|
8
|
-
* Traverses the parsed source, looking for StaticImage components.
|
|
9
|
-
* Extracts and returns the props from any that are found
|
|
10
|
-
*/
|
|
11
|
-
export declare const extractStaticImageProps: (ast: babel.types.File, onError?: (prop: string, nodePath: NodePath) => void) => Map<string, IStaticImageProps>;
|
|
1
|
+
import { NodePath } from "@babel/core";
|
|
2
|
+
import { ParserOptions } from "@babel/parser";
|
|
3
|
+
import babel from "@babel/core";
|
|
4
|
+
import { IStaticImageProps } from "../components/static-image.server";
|
|
5
|
+
export declare function getBabelParserOptions(filePath: string): ParserOptions;
|
|
6
|
+
export declare function babelParseToAst(contents: string, filePath: string): babel.types.File;
|
|
7
|
+
/**
|
|
8
|
+
* Traverses the parsed source, looking for StaticImage components.
|
|
9
|
+
* Extracts and returns the props from any that are found
|
|
10
|
+
*/
|
|
11
|
+
export declare const extractStaticImageProps: (ast: babel.types.File, onError?: (prop: string, nodePath: NodePath) => void) => Map<string, IStaticImageProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PreprocessSourceArgs } from "gatsby";
|
|
2
|
-
export declare function preprocessSource({ filename, contents, pathPrefix, cache, reporter, store, createNodeId, actions: { createNode }, }: PreprocessSourceArgs): Promise<void>;
|
|
1
|
+
import { PreprocessSourceArgs } from "gatsby";
|
|
2
|
+
export declare function preprocessSource({ filename, contents, pathPrefix, cache, reporter, store, createNodeId, actions: { createNode }, }: PreprocessSourceArgs): Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Actions, ParentSpanPluginArgs, GatsbyCache, Reporter } from "gatsby";
|
|
2
|
-
/**
|
|
3
|
-
* Watch a static source image for changes during develop
|
|
4
|
-
*/
|
|
5
|
-
export declare function watchImage({ fullPath, pathPrefix, createNodeId, createNode, cache, reporter, }: {
|
|
6
|
-
fullPath: string;
|
|
7
|
-
pathPrefix: string;
|
|
8
|
-
createNodeId: ParentSpanPluginArgs["createNodeId"];
|
|
9
|
-
createNode: Actions["createNode"];
|
|
10
|
-
cache: GatsbyCache;
|
|
11
|
-
reporter: Reporter;
|
|
12
|
-
}): void;
|
|
1
|
+
import { Actions, ParentSpanPluginArgs, GatsbyCache, Reporter } from "gatsby";
|
|
2
|
+
/**
|
|
3
|
+
* Watch a static source image for changes during develop
|
|
4
|
+
*/
|
|
5
|
+
export declare function watchImage({ fullPath, pathPrefix, createNodeId, createNode, cache, reporter, }: {
|
|
6
|
+
fullPath: string;
|
|
7
|
+
pathPrefix: string;
|
|
8
|
+
createNodeId: ParentSpanPluginArgs["createNodeId"];
|
|
9
|
+
createNode: Actions["createNode"];
|
|
10
|
+
cache: GatsbyCache;
|
|
11
|
+
reporter: Reporter;
|
|
12
|
+
}): void;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { GraphQLFieldResolver } from "gatsby/graphql";
|
|
2
|
-
import { EnumTypeComposerAsObjectDefinition, ObjectTypeComposerFieldConfigAsObjectDefinition, ObjectTypeComposerArgumentConfigMapDefinition } from "graphql-compose";
|
|
3
|
-
import { ISharpGatsbyImageArgs, IImageSizeArgs } from "./image-utils";
|
|
4
|
-
export declare const ImageFormatType: EnumTypeComposerAsObjectDefinition;
|
|
5
|
-
export declare const ImageLayoutType: EnumTypeComposerAsObjectDefinition;
|
|
6
|
-
export declare const ImagePlaceholderType: EnumTypeComposerAsObjectDefinition;
|
|
7
|
-
export interface IGatsbyGraphQLFieldConfig<TSource, TContext, TArgs> {
|
|
8
|
-
description?: string;
|
|
9
|
-
type: string;
|
|
10
|
-
args?: Record<string, IGatsbyGraphQLResolverArgumentConfig>;
|
|
11
|
-
resolve: GraphQLFieldResolver<TSource, TContext, TArgs>;
|
|
12
|
-
}
|
|
13
|
-
export interface IGatsbyGraphQLResolverArgumentConfig<TValue = any> {
|
|
14
|
-
description?: string;
|
|
15
|
-
type: string | Array<string>;
|
|
16
|
-
defaultValue?: TValue;
|
|
17
|
-
}
|
|
18
|
-
export declare type IGatsbyImageResolverArgs = Pick<ISharpGatsbyImageArgs & IImageSizeArgs, "aspectRatio" | "backgroundColor" | "breakpoints" | "height" | "layout" | "outputPixelDensities" | "sizes" | "width">;
|
|
19
|
-
export declare function getGatsbyImageResolver<TSource, TContext, TArgs>(resolve: GraphQLFieldResolver<TSource, TContext, IGatsbyImageResolverArgs & TArgs>, extraArgs?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>): ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, IGatsbyImageResolverArgs & TArgs>;
|
|
20
|
-
export declare type IGatsbyImageFieldArgs = Pick<ISharpGatsbyImageArgs & IImageSizeArgs, "aspectRatio" | "backgroundColor" | "breakpoints" | "formats" | "height" | "layout" | "outputPixelDensities" | "placeholder" | "sizes" | "width">;
|
|
21
|
-
export declare function getGatsbyImageFieldConfig<TSource, TContext, TArgs>(resolve: GraphQLFieldResolver<TSource, TContext, IGatsbyImageFieldArgs & TArgs>, extraArgs?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>): ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, IGatsbyImageFieldArgs & TArgs>;
|
|
1
|
+
import { GraphQLFieldResolver } from "gatsby/graphql";
|
|
2
|
+
import { EnumTypeComposerAsObjectDefinition, ObjectTypeComposerFieldConfigAsObjectDefinition, ObjectTypeComposerArgumentConfigMapDefinition } from "graphql-compose";
|
|
3
|
+
import { ISharpGatsbyImageArgs, IImageSizeArgs } from "./image-utils";
|
|
4
|
+
export declare const ImageFormatType: EnumTypeComposerAsObjectDefinition;
|
|
5
|
+
export declare const ImageLayoutType: EnumTypeComposerAsObjectDefinition;
|
|
6
|
+
export declare const ImagePlaceholderType: EnumTypeComposerAsObjectDefinition;
|
|
7
|
+
export interface IGatsbyGraphQLFieldConfig<TSource, TContext, TArgs> {
|
|
8
|
+
description?: string;
|
|
9
|
+
type: string;
|
|
10
|
+
args?: Record<string, IGatsbyGraphQLResolverArgumentConfig>;
|
|
11
|
+
resolve: GraphQLFieldResolver<TSource, TContext, TArgs>;
|
|
12
|
+
}
|
|
13
|
+
export interface IGatsbyGraphQLResolverArgumentConfig<TValue = any> {
|
|
14
|
+
description?: string;
|
|
15
|
+
type: string | Array<string>;
|
|
16
|
+
defaultValue?: TValue;
|
|
17
|
+
}
|
|
18
|
+
export declare type IGatsbyImageResolverArgs = Pick<ISharpGatsbyImageArgs & IImageSizeArgs, "aspectRatio" | "backgroundColor" | "breakpoints" | "height" | "layout" | "outputPixelDensities" | "sizes" | "width">;
|
|
19
|
+
export declare function getGatsbyImageResolver<TSource, TContext, TArgs>(resolve: GraphQLFieldResolver<TSource, TContext, IGatsbyImageResolverArgs & TArgs>, extraArgs?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>): ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, IGatsbyImageResolverArgs & TArgs>;
|
|
20
|
+
export declare type IGatsbyImageFieldArgs = Pick<ISharpGatsbyImageArgs & IImageSizeArgs, "aspectRatio" | "backgroundColor" | "breakpoints" | "formats" | "height" | "layout" | "outputPixelDensities" | "placeholder" | "sizes" | "width">;
|
|
21
|
+
export declare function getGatsbyImageFieldConfig<TSource, TContext, TArgs>(resolve: GraphQLFieldResolver<TSource, TContext, IGatsbyImageFieldArgs & TArgs>, extraArgs?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>): ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, IGatsbyImageFieldArgs & TArgs>;
|
package/gatsby-ssr.js
CHANGED
|
@@ -33,7 +33,7 @@ function onRenderBody(_ref) {
|
|
|
33
33
|
var setHeadComponents = _ref.setHeadComponents;
|
|
34
34
|
setHeadComponents([React__namespace.createElement("style", {
|
|
35
35
|
key: "gatsby-image-style",
|
|
36
|
-
dangerouslySetInnerHTML: generateHtml(".gatsby-image-wrapper{position:relative;overflow:hidden}.gatsby-image-wrapper img{bottom:0;height:100%;left:0;margin:0;max-width:none;padding:0;position:absolute;right:0;top:0;width:100%;object-fit:cover}.gatsby-image-wrapper [data-main-image]{opacity:0;transform:translateZ(0);transition:opacity .25s linear;will-change:opacity}.gatsby-image-wrapper-constrained{display:inline-block;vertical-align:top}")
|
|
36
|
+
dangerouslySetInnerHTML: generateHtml(".gatsby-image-wrapper{position:relative;overflow:hidden}.gatsby-image-wrapper picture.object-fit-polyfill{position:static!important}.gatsby-image-wrapper img{bottom:0;height:100%;left:0;margin:0;max-width:none;padding:0;position:absolute;right:0;top:0;width:100%;object-fit:cover}.gatsby-image-wrapper [data-main-image]{opacity:0;transform:translateZ(0);transition:opacity .25s linear;will-change:opacity}.gatsby-image-wrapper-constrained{display:inline-block;vertical-align:top}")
|
|
37
37
|
}), React__namespace.createElement("noscript", {
|
|
38
38
|
key: "gatsby-image-style-noscript",
|
|
39
39
|
dangerouslySetInnerHTML: generateHtml("<style>" + ".gatsby-image-wrapper noscript [data-main-image]{opacity:1!important}.gatsby-image-wrapper [data-placeholder-image]{opacity:0!important}" + "</style>")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-plugin-image",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npm-run-all -s clean -p build:*",
|
|
6
6
|
"build:gatsby-node": "tsc --jsx react --downlevelIteration true --skipLibCheck true --esModuleInterop true --outDir dist/ src/gatsby-node.ts src/babel-plugin-parse-static-images.ts src/resolver-utils.ts src/types.d.ts -d --declarationDir dist/src",
|
|
@@ -77,12 +77,12 @@
|
|
|
77
77
|
"@babel/runtime": "^7.15.4",
|
|
78
78
|
"@babel/traverse": "^7.15.4",
|
|
79
79
|
"babel-jsx-utils": "^1.1.0",
|
|
80
|
-
"babel-plugin-remove-graphql-queries": "^4.
|
|
80
|
+
"babel-plugin-remove-graphql-queries": "^4.1.0",
|
|
81
81
|
"camelcase": "^5.3.1",
|
|
82
82
|
"chokidar": "^3.5.2",
|
|
83
83
|
"common-tags": "^1.8.0",
|
|
84
84
|
"fs-extra": "^10.0.0",
|
|
85
|
-
"gatsby-core-utils": "^3.
|
|
85
|
+
"gatsby-core-utils": "^3.1.0",
|
|
86
86
|
"objectFitPolyfill": "^2.3.5",
|
|
87
87
|
"prop-types": "^15.7.2"
|
|
88
88
|
},
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
},
|
|
94
94
|
"author": "Matt Kane <matt@gatsbyjs.com>",
|
|
95
95
|
"license": "MIT",
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "4086ca523d1caf68d44076e361f00e7b4b96c4a5"
|
|
97
97
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=require("react"),t=require("common-tags"),r=require("camelcase"),a=require("prop-types"),i=require("react-dom");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var s,l=n(e),u=o(e),d=n(r),c=o(a),h=n(a);function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},p.apply(this,arguments)}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function g(e,t){if(null==e)return{};var r,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)t.indexOf(r=n[a])>=0||(i[r]=e[r]);return i}var m=[.25,.5,1,2],v=[750,1080,1366,1920],y=[320,654,768,1024,1366,1600,1920,2048,2560,3440,3840,4096],w=function(e){return console.warn(e)},b=function(e,t){return e-t},E=function(e){return e.map(function(e){return e.src+" "+e.width+"w"}).join(",\n")};function x(e){var t=e.lastIndexOf(".");if(-1!==t){var r=e.substr(t+1);if("jpeg"===r)return"jpg";if(3===r.length||4===r.length)return r}}function S(e){var t=e.layout,r=void 0===t?"constrained":t,a=e.width,i=e.height,n=e.sourceMetadata,o=e.breakpoints,s=e.aspectRatio,l=e.formats,u=void 0===l?["auto","webp"]:l;return u=u.map(function(e){return e.toLowerCase()}),r=d.default(r),a&&i?p({},e,{formats:u,layout:r,aspectRatio:a/i}):(n.width&&n.height&&!s&&(s=n.width/n.height),"fullWidth"===r?(a=a||n.width||o[o.length-1],i=i||Math.round(a/(s||1.3333333333333333))):(a||(a=i&&s?i*s:n.width?n.width:i?Math.round(i/1.3333333333333333):800),s&&!i?i=Math.round(a/s):s||(s=a/i)),p({},e,{width:a,height:i,aspectRatio:s,layout:r,formats:u}))}function L(e){var r,a=(e=S(e)).pluginName,i=e.sourceMetadata,n=e.generateImageSource,o=e.layout,l=e.fit,u=e.options,d=e.width,c=e.height,h=e.filename,f=e.reporter,g=void 0===f?{warn:w}:f,y=e.backgroundColor,b=e.placeholderURL;if(a||g.warn('[gatsby-plugin-image] "generateImageData" was not passed a plugin name'),"function"!=typeof n)throw new Error("generateImageSource must be a function");i&&(i.width||i.height)?i.format||(i.format=x(h)):i={width:d,height:c,format:(null==(r=i)?void 0:r.format)||x(h)||"auto"};var L=new Set(e.formats);(0===L.size||L.has("auto")||L.has(""))&&(L.delete("auto"),L.delete(""),L.add(i.format)),L.has("jpg")&&L.has("png")&&(g.warn("["+a+"] Specifying both 'jpg' and 'png' formats is not supported. Using 'auto' instead"),L.delete("jpg"===i.format?"png":"jpg"));var j=function(e){var r=e.filename,a=e.layout,i=void 0===a?"constrained":a,n=e.sourceMetadata,o=e.reporter,l=void 0===o?{warn:w}:o,u=e.breakpoints,d=void 0===u?v:u,c=Object.entries({width:e.width,height:e.height}).filter(function(e){var t=e[1];return"number"==typeof t&&t<1});if(c.length)throw new Error("Specified dimensions for images must be positive numbers (> 0). Problem dimensions you have are "+c.map(function(e){return e.join(": ")}).join(", "));return"fixed"===i?function(e){var r=e.filename,a=e.sourceMetadata,i=e.width,n=e.height,o=e.fit,l=void 0===o?"cover":o,u=e.outputPixelDensities,d=e.reporter,c=void 0===d?{warn:w}:d,h=a.width/a.height,p=M(void 0===u?m:u);if(i&&n){var f=k(a,{width:i,height:n,fit:l});i=f.width,n=f.height,h=f.aspectRatio}i?n||(n=Math.round(i/h)):i=n?Math.round(n*h):800;var g,v,y=i;if(a.width<i||a.height<n){var b=a.width<i?"width":"height";c.warn(t.stripIndent(s||(g=["\n The requested ",' "','px" for the image '," was larger than the actual image "," of ","px. If possible, replace the current image with a larger one."],v||(v=g.slice(0)),g.raw=v,s=g),b,"width"===b?i:n,r,b,a[b])),"width"===b?(i=a.width,n=Math.round(i/h)):i=(n=a.height)*h}return{sizes:p.filter(function(e){return e>=1}).map(function(e){return Math.round(e*i)}).filter(function(e){return e<=a.width}),aspectRatio:h,presentationWidth:y,presentationHeight:Math.round(y/h),unscaledWidth:i}}(e):"constrained"===i?R(e):"fullWidth"===i?R(p({breakpoints:d},e)):(l.warn("No valid layout was provided for the image at "+r+". Valid image layouts are fixed, fullWidth, and constrained. Found "+i),{sizes:[n.width],presentationWidth:n.width,presentationHeight:n.height,aspectRatio:n.width/n.height,unscaledWidth:n.width})}(p({},e,{sourceMetadata:i})),I={sources:[]},_=e.sizes;_||(_=function(e,t){switch(t){case"constrained":return"(min-width: "+e+"px) "+e+"px, 100vw";case"fixed":return e+"px";case"fullWidth":return"100vw";default:return}}(j.presentationWidth,o)),L.forEach(function(e){var t=j.sizes.map(function(t){var r=n(h,t,Math.round(t/j.aspectRatio),e,l,u);if(null!=r&&r.width&&r.height&&r.src&&r.format)return r;g.warn("["+a+"] The resolver for image "+h+" returned an invalid value.")}).filter(Boolean);if("jpg"===e||"png"===e||"auto"===e){var r=t.find(function(e){return e.width===j.unscaledWidth})||t[0];r&&(I.fallback={src:r.src,srcSet:E(t),sizes:_})}else{var i;null==(i=I.sources)||i.push({srcSet:E(t),sizes:_,type:"image/"+e})}});var O={images:I,layout:o,backgroundColor:y};switch(b&&(O.placeholder={fallback:b}),o){case"fixed":O.width=j.presentationWidth,O.height=j.presentationHeight;break;case"fullWidth":O.width=1,O.height=1/j.aspectRatio;break;case"constrained":O.width=e.width||j.presentationWidth||1,O.height=(O.width||1)/j.aspectRatio}return O}var M=function(e){return Array.from(new Set([1].concat(e))).sort(b)};function R(e){var t,r=e.sourceMetadata,a=e.width,i=e.height,n=e.fit,o=void 0===n?"cover":n,s=e.outputPixelDensities,l=e.breakpoints,u=e.layout,d=r.width/r.height,c=M(void 0===s?m:s);if(a&&i){var h=k(r,{width:a,height:i,fit:o});a=h.width,i=h.height,d=h.aspectRatio}a=a&&Math.min(a,r.width),i=i&&Math.min(i,r.height),a||i||(i=(a=Math.min(800,r.width))/d),a||(a=i*d);var p=a;return(r.width<a||r.height<i)&&(a=r.width,i=r.height),a=Math.round(a),(null==l?void 0:l.length)>0?(t=l.filter(function(e){return e<=r.width})).length<l.length&&!t.includes(r.width)&&t.push(r.width):t=(t=c.map(function(e){return Math.round(e*a)})).filter(function(e){return e<=r.width}),"constrained"!==u||t.includes(a)||t.push(a),{sizes:t=t.sort(b),aspectRatio:d,presentationWidth:p,presentationHeight:Math.round(p/d),unscaledWidth:a}}function k(e,t){var r=e.width/e.height,a=t.width,i=t.height;switch(t.fit){case"fill":a=t.width?t.width:e.width,i=t.height?t.height:e.height;break;case"inside":var n=t.width?t.width:Number.MAX_SAFE_INTEGER,o=t.height?t.height:Number.MAX_SAFE_INTEGER;a=Math.min(n,Math.round(o*r)),i=Math.min(o,Math.round(n/r));break;case"outside":var s=t.width?t.width:0,l=t.height?t.height:0;a=Math.max(s,Math.round(l*r)),i=Math.max(l,Math.round(s/r));break;default:t.width&&!t.height&&(a=t.width,i=Math.round(t.width/r)),t.height&&!t.width&&(a=Math.round(t.height*r),i=t.height)}return{width:a,height:i,aspectRatio:a/i}}var j=["baseUrl","urlBuilder","sourceWidth","sourceHeight","pluginName","formats","breakpoints","options"],I=["images","placeholder"],_=new Set,O=function(){return"undefined"!=typeof HTMLImageElement&&"loading"in HTMLImageElement.prototype};function N(){return"undefined"!=typeof GATSBY___IMAGE&&GATSBY___IMAGE}function W(e){e&&_.add(e)}function P(e){return _.has(e)}var z,q=function(e){var t;return function(e){var t,r;return Boolean(null==e||null==(t=e.images)||null==(r=t.fallback)?void 0:r.src)}(e)?e:function(e){return Boolean(null==e?void 0:e.gatsbyImageData)}(e)?e.gatsbyImageData:null==e||null==(t=e.childImageSharp)?void 0:t.gatsbyImageData},D=["children"],T=function(e){var t=e.layout,r=e.width,a=e.height;return"fullWidth"===t?l.default.createElement("div",{"aria-hidden":!0,style:{paddingTop:a/r*100+"%"}}):"constrained"===t?l.default.createElement("div",{style:{maxWidth:r,display:"block"}},l.default.createElement("img",{alt:"",role:"presentation","aria-hidden":"true",src:"data:image/svg+xml;charset=utf-8,%3Csvg height='"+a+"' width='"+r+"' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E",style:{maxWidth:"100%",display:"block",position:"static"}})):null},H=["src","srcSet","loading","alt","shouldLoad","innerRef"],C=["fallback","sources","shouldLoad"],A=function(e){var t=e.src,r=e.srcSet,a=e.loading,i=e.alt,n=void 0===i?"":i,o=e.shouldLoad,s=e.innerRef,u=g(e,H);return l.default.createElement("img",p({},u,{decoding:"async",loading:a,src:o?t:void 0,"data-src":o?void 0:t,srcSet:o?r:void 0,"data-srcset":o?void 0:r,alt:n,ref:s}))},F=e.forwardRef(function(e,t){var r=e.fallback,a=e.sources,i=void 0===a?[]:a,n=e.shouldLoad,o=void 0===n||n,s=g(e,C),u=s.sizes||(null==r?void 0:r.sizes),d=l.default.createElement(A,p({},s,r,{sizes:u,shouldLoad:o,innerRef:t}));return i.length?l.default.createElement("picture",null,i.map(function(e){var t=e.media,r=e.srcSet,a=e.type;return l.default.createElement("source",{key:t+"-"+a+"-"+r,type:a,media:t,srcSet:o?r:void 0,"data-srcset":o?void 0:r,sizes:u})}),d):d});A.propTypes={src:c.string.isRequired,alt:c.string.isRequired,sizes:c.string,srcSet:c.string,shouldLoad:c.bool},F.displayName="Picture",F.propTypes={alt:c.string.isRequired,shouldLoad:c.bool,fallback:c.exact({src:c.string.isRequired,srcSet:c.string,sizes:c.string}),sources:c.arrayOf(c.oneOfType([c.exact({media:c.string.isRequired,type:c.string,sizes:c.string,srcSet:c.string.isRequired}),c.exact({media:c.string,type:c.string.isRequired,sizes:c.string,srcSet:c.string.isRequired})]))};var V=["fallback"],G=function(e){var t=e.fallback,r=g(e,V);return t?l.default.createElement(F,p({},r,{fallback:{src:t},"aria-hidden":!0,alt:""})):l.default.createElement("div",p({},r))};G.displayName="Placeholder",G.propTypes={fallback:c.string,sources:null==(z=F.propTypes)?void 0:z.sources,alt:function(e,t,r){return e[t]?new Error("Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed."):null}};var U=e.forwardRef(function(e,t){return l.default.createElement(l.default.Fragment,null,l.default.createElement(F,p({ref:t},e)),l.default.createElement("noscript",null,l.default.createElement(F,p({},e,{shouldLoad:!0}))))});U.displayName="MainImage",U.propTypes=F.propTypes;var B=function(e,t,r){return e.alt||""===e.alt?h.default.string.apply(h.default,[e,t,r].concat([].slice.call(arguments,3))):new Error('The "alt" prop is required in '+r+'. If the image is purely presentational then pass an empty string: e.g. alt="". Learn more: https://a11y-style-guide.com/style-guide/section-media.html')},J={image:h.default.object.isRequired,alt:B},Y=["style","className"],X=function(t){var r,a;function n(r){var a;return(a=t.call(this,r)||this).root=e.createRef(),a.hydrated={current:!1},a.forceRender={current:"development"===process.env.NODE_ENV},a.lazyHydrator=null,a.ref=e.createRef(),a.unobserveRef=void 0,a.state={isLoading:O(),isLoaded:!1},a}a=t,(r=n).prototype=Object.create(a.prototype),r.prototype.constructor=r,f(r,a);var o=n.prototype;return o._lazyHydrate=function(e,t){var r=this,a=this.root.current.querySelector("[data-gatsby-image-ssr]");return O()&&a&&!this.hydrated.current?(this.hydrated.current=!0,Promise.resolve()):Promise.resolve().then(function(){return require("./lazy-hydrate-5042e462.js")}).then(function(a){r.lazyHydrator=(0,a.lazyHydrate)(p({image:e.image.images,isLoading:t.isLoading,isLoaded:t.isLoaded,toggleIsLoaded:function(){null==e.onLoad||e.onLoad(),r.setState({isLoaded:!0})},ref:r.ref},e),r.root,r.hydrated,r.forceRender)})},o._setupIntersectionObserver=function(e){var t=this;void 0===e&&(e=!0),Promise.resolve().then(function(){return require("./intersection-observer-3d807f12.js")}).then(function(r){var a=(0,r.createIntersectionObserver)(function(){if(t.root.current){var r=JSON.stringify(t.props.image.images);null==t.props.onStartLoad||t.props.onStartLoad({wasCached:e&&P(r)}),t.setState({isLoading:!0,isLoaded:e&&P(r)})}});t.root.current&&(t.unobserveRef=a(t.root))})},o.shouldComponentUpdate=function(e,t){var r=this,a=!1;return this.state.isLoading||!t.isLoading||t.isLoaded||(this.forceRender.current=!0),this.props.image.images!==e.image.images&&(this.unobserveRef&&(this.unobserveRef(),this.hydrated.current&&this.lazyHydrator&&i.render(null,this.root.current)),this.setState({isLoading:!1,isLoaded:!1},function(){r._setupIntersectionObserver(!1)}),a=!0),this.root.current&&!a&&this._lazyHydrate(e,t),!1},o.componentDidMount=function(){if(this.root.current){var e=this.root.current.querySelector("[data-gatsby-image-ssr]"),t=JSON.stringify(this.props.image.images);if(O()&&e&&N()){var r,a;if(null==(r=(a=this.props).onStartLoad)||r.call(a,{wasCached:!1}),e.complete){var i,n;null==(i=(n=this.props).onLoad)||i.call(n),W(t)}else{var o=this;e.addEventListener("load",function r(){e.removeEventListener("load",r),null==o.props.onLoad||o.props.onLoad(),W(t)})}return}this._setupIntersectionObserver(!0)}},o.componentWillUnmount=function(){this.unobserveRef&&(this.unobserveRef(),this.hydrated.current&&this.lazyHydrator&&this.lazyHydrator())},o.render=function(){var e=this.props.as||"div",t=this.props.image,r=t.width,a=t.height,i=t.layout,n=function(e,t,r){var a={},i="gatsby-image-wrapper";return N()||(a.position="relative",a.overflow="hidden"),"fixed"===r?(a.width=e,a.height=t):"constrained"===r&&(N()||(a.display="inline-block",a.verticalAlign="top"),i="gatsby-image-wrapper gatsby-image-wrapper-constrained"),{className:i,"data-gatsby-image-wrapper":"",style:a}}(r,a,i),o=n.style,s=n.className,u=g(n,Y),d=this.props.className;this.props.class&&(d=this.props.class);var c=function(e,t,r){var a=null;return"fullWidth"===e&&(a='<div aria-hidden="true" style="padding-top: '+r/t*100+'%;"></div>'),"constrained"===e&&(a='<div style="max-width: '+t+'px; display: block;"><img alt="" role="presentation" aria-hidden="true" src="data:image/svg+xml;charset=utf-8,%3Csvg height=\''+r+"' width='"+t+"' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E\" style=\"max-width: 100%; display: block; position: static;\"></div>"),a}(i,r,a);return l.default.createElement(e,p({},u,{style:p({},o,this.props.style,{backgroundColor:this.props.backgroundColor}),className:s+(d?" "+d:""),ref:this.root,dangerouslySetInnerHTML:{__html:c},suppressHydrationWarning:!0}))},n}(e.Component),Z=function(e){if(!e.image)return"development"===process.env.NODE_ENV&&console.warn("[gatsby-plugin-image] Missing image prop"),null;N()||"development"!==process.env.NODE_ENV||console.warn('[gatsby-plugin-image] You\'re missing out on some cool performance features. Please add "gatsby-plugin-image" to your gatsby-config.js');var t=e.image,r=JSON.stringify([t.width,t.height,t.layout,e.className,e.class,e.backgroundColor]);return l.default.createElement(X,p({key:r},e))};Z.propTypes=J,Z.displayName="GatsbyImage";var K=["src","__imageData","__error","width","height","aspectRatio","tracedSVGOptions","placeholder","formats","quality","transformOptions","jpgOptions","pngOptions","webpOptions","avifOptions","blurredOptions"],Q=function(e,t){return"fullWidth"!==e.layout||"width"!==t&&"height"!==t||!e[t]?h.default.number.apply(h.default,[e,t].concat([].slice.call(arguments,2))):new Error('"'+t+'" '+e[t]+" may not be passed when layout is fullWidth.")},$=new Set(["fixed","fullWidth","constrained"]),ee={src:h.default.string.isRequired,alt:B,width:Q,height:Q,sizes:h.default.string,layout:function(e){if(void 0!==e.layout&&!$.has(e.layout))return new Error("Invalid value "+e.layout+'" provided for prop "layout". Defaulting to "constrained". Valid values are "fixed", "fullWidth" or "constrained".')}},te=function(e){return function(t){var r=t.src,a=t.__imageData,i=t.__error,n=g(t,K);return i&&console.warn(i),a?l.default.createElement(e,p({image:a},n)):(console.warn("Image not loaded",r),i||"development"!==process.env.NODE_ENV||console.warn('Please ensure that "gatsby-plugin-image" is included in the plugins array in gatsby-config.js, and that your version of gatsby is at least 2.24.78'),null)}}(Z);te.displayName="StaticImage",te.propTypes=ee,exports.GatsbyImage=Z,exports.LaterHydrator=function(e){var t=e.children;return u.useEffect(function(){Promise.resolve().then(function(){return require("./lazy-hydrate-5042e462.js")})},[]),t},exports.LayoutWrapper=function(t){var r=t.children,a=g(t,D);return l.default.createElement(e.Fragment,null,l.default.createElement(T,p({},a)),r,!1)},exports.MainImage=U,exports.Placeholder=G,exports.StaticImage=te,exports._extends=p,exports._objectWithoutPropertiesLoose=g,exports.generateImageData=L,exports.getImage=q,exports.getImageData=function(e){var t,r=e.baseUrl,a=e.urlBuilder,i=e.sourceWidth,n=e.sourceHeight,o=e.pluginName,s=void 0===o?"getImageData":o,l=e.formats,u=void 0===l?["auto"]:l,d=e.breakpoints,c=e.options,h=g(e,j);return null!=(t=d)&&t.length||"fullWidth"!==h.layout&&"FULL_WIDTH"!==h.layout||(d=y),L(p({},h,{pluginName:s,generateImageSource:function(e,t,r,i){return{width:t,height:r,format:i,src:a({baseUrl:e,width:t,height:r,options:c,format:i})}},filename:r,formats:u,breakpoints:d,sourceMetadata:{width:i,height:n,format:"auto"}}))},exports.getLowResolutionImageURL=function(e,t){var r;return void 0===t&&(t=20),null==(r=(0,(e=S(e)).generateImageSource)(e.filename,t,Math.round(t/e.aspectRatio),e.sourceMetadata.format||"jpg",e.fit,e.options))?void 0:r.src},exports.getMainProps=function(e,t,r,a,i,n,s,l){var u,d;return void 0===l&&(l={}),null!=s&&s.current&&!("objectFit"in document.documentElement.style)&&(s.current.dataset.objectFit=null!=(u=l.objectFit)?u:"cover",s.current.dataset.objectPosition=""+(null!=(d=l.objectPosition)?d:"50% 50%"),function(e){try{var t=function(){window.objectFitPolyfill(e.current)},r=function(){if(!("objectFitPolyfill"in window))return Promise.resolve(Promise.resolve().then(function(){return o(require("objectFitPolyfill"))})).then(function(){})}();Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}}(s)),N()||(l=p({height:"100%",left:0,position:"absolute",top:0,transform:"translateZ(0)",transition:"opacity 250ms linear",width:"100%",willChange:"opacity"},l)),p({},r,{loading:a,shouldLoad:e,"data-main-image":"",style:p({},l,{opacity:t?1:0}),onLoad:function(e){if(!t){W(n);var r=e.currentTarget,a=new Image;a.src=r.currentSrc,a.decode?a.decode().catch(function(){}).then(function(){i(!0)}):i(!0)}},ref:s})},exports.getPlaceholderProps=function(e,t,r,a,i,n,o,s){var l={};n&&(l.backgroundColor=n,"fixed"===r?(l.width=a,l.height=i,l.backgroundColor=n,l.position="relative"):("constrained"===r||"fullWidth"===r)&&(l.position="absolute",l.top=0,l.left=0,l.bottom=0,l.right=0)),o&&(l.objectFit=o),s&&(l.objectPosition=s);var u=p({},e,{"aria-hidden":!0,"data-placeholder-image":"",style:p({opacity:t?0:1,transition:"opacity 500ms linear"},l)});return N()||(u.style={height:"100%",left:0,position:"absolute",top:0,width:"100%"}),u},exports.getSrc=function(e){var t,r,a;return null==(t=q(e))||null==(r=t.images)||null==(a=r.fallback)?void 0:a.src},exports.getSrcSet=function(e){var t,r,a;return null==(t=q(e))||null==(r=t.images)||null==(a=r.fallback)?void 0:a.srcSet},exports.withArtDirection=function(e,t){var r,a,i,n=e.images,o=e.placeholder,s=p({},g(e,I),{images:p({},n,{sources:[]}),placeholder:o&&p({},o,{sources:[]})});return t.forEach(function(t){var r,a=t.media,i=t.image;a?(i.layout!==e.layout&&"development"===process.env.NODE_ENV&&console.warn('[gatsby-plugin-image] Mismatched image layout: expected "'+e.layout+'" but received "'+i.layout+'". All art-directed images use the same layout as the default image'),(r=s.images.sources).push.apply(r,i.images.sources.map(function(e){return p({},e,{media:a})}).concat([{media:a,srcSet:i.images.fallback.srcSet}])),s.placeholder&&s.placeholder.sources.push({media:a,srcSet:i.placeholder.fallback})):"development"===process.env.NODE_ENV&&console.warn("[gatsby-plugin-image] All art-directed images passed to must have a value set for `media`. Skipping.")}),(r=s.images.sources).push.apply(r,n.sources),null!=o&&o.sources&&(null==(a=s.placeholder)||(i=a.sources).push.apply(i,o.sources)),s};
|
|
2
|
-
//# sourceMappingURL=index.browser-38b528ec.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import t,{Fragment as r,forwardRef as i,createRef as a,Component as n}from"react";import{stripIndent as o}from"common-tags";import s from"camelcase";import*as l from"prop-types";import d from"prop-types";import{render as u}from"react-dom";function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c.apply(this,arguments)}function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function p(e,t){if(null==e)return{};var r,i,a={},n=Object.keys(e);for(i=0;i<n.length;i++)t.indexOf(r=n[i])>=0||(a[r]=e[r]);return a}var g,f=[.25,.5,1,2],m=[750,1080,1366,1920],v=[320,654,768,1024,1366,1600,1920,2048,2560,3440,3840,4096],y=function(e){return console.warn(e)},w=function(e,t){return e-t},b=function(e){return e.map(function(e){return e.src+" "+e.width+"w"}).join(",\n")};function E(e){var t=e.lastIndexOf(".");if(-1!==t){var r=e.substr(t+1);if("jpeg"===r)return"jpg";if(3===r.length||4===r.length)return r}}function S(e){var t=e.layout,r=void 0===t?"constrained":t,i=e.width,a=e.height,n=e.sourceMetadata,o=e.breakpoints,l=e.aspectRatio,d=e.formats,u=void 0===d?["auto","webp"]:d;return u=u.map(function(e){return e.toLowerCase()}),r=s(r),i&&a?c({},e,{formats:u,layout:r,aspectRatio:i/a}):(n.width&&n.height&&!l&&(l=n.width/n.height),"fullWidth"===r?(i=i||n.width||o[o.length-1],a=a||Math.round(i/(l||1.3333333333333333))):(i||(i=a&&l?a*l:n.width?n.width:a?Math.round(a/1.3333333333333333):800),l&&!a?a=Math.round(i/l):l||(l=i/a)),c({},e,{width:i,height:a,aspectRatio:l,layout:r,formats:u}))}function M(e,t){var r;return void 0===t&&(t=20),null==(r=(0,(e=S(e)).generateImageSource)(e.filename,t,Math.round(t/e.aspectRatio),e.sourceMetadata.format||"jpg",e.fit,e.options))?void 0:r.src}function L(e){var t,r=(e=S(e)).pluginName,i=e.sourceMetadata,a=e.generateImageSource,n=e.layout,s=e.fit,l=e.options,d=e.width,u=e.height,h=e.filename,p=e.reporter,v=void 0===p?{warn:y}:p,w=e.backgroundColor,M=e.placeholderURL;if(r||v.warn('[gatsby-plugin-image] "generateImageData" was not passed a plugin name'),"function"!=typeof a)throw new Error("generateImageSource must be a function");i&&(i.width||i.height)?i.format||(i.format=E(h)):i={width:d,height:u,format:(null==(t=i)?void 0:t.format)||E(h)||"auto"};var L=new Set(e.formats);(0===L.size||L.has("auto")||L.has(""))&&(L.delete("auto"),L.delete(""),L.add(i.format)),L.has("jpg")&&L.has("png")&&(v.warn("["+r+"] Specifying both 'jpg' and 'png' formats is not supported. Using 'auto' instead"),L.delete("jpg"===i.format?"png":"jpg"));var j=function(e){var t=e.filename,r=e.layout,i=void 0===r?"constrained":r,a=e.sourceMetadata,n=e.reporter,s=void 0===n?{warn:y}:n,l=e.breakpoints,d=void 0===l?m:l,u=Object.entries({width:e.width,height:e.height}).filter(function(e){var t=e[1];return"number"==typeof t&&t<1});if(u.length)throw new Error("Specified dimensions for images must be positive numbers (> 0). Problem dimensions you have are "+u.map(function(e){return e.join(": ")}).join(", "));return"fixed"===i?function(e){var t=e.filename,r=e.sourceMetadata,i=e.width,a=e.height,n=e.fit,s=void 0===n?"cover":n,l=e.outputPixelDensities,d=e.reporter,u=void 0===d?{warn:y}:d,c=r.width/r.height,h=k(void 0===l?f:l);if(i&&a){var p=_(r,{width:i,height:a,fit:s});i=p.width,a=p.height,c=p.aspectRatio}i?a||(a=Math.round(i/c)):i=a?Math.round(a*c):800;var m,v,w=i;if(r.width<i||r.height<a){var b=r.width<i?"width":"height";u.warn(o(g||(m=["\n The requested ",' "','px" for the image '," was larger than the actual image "," of ","px. If possible, replace the current image with a larger one."],v||(v=m.slice(0)),m.raw=v,g=m),b,"width"===b?i:a,t,b,r[b])),"width"===b?(i=r.width,a=Math.round(i/c)):i=(a=r.height)*c}return{sizes:h.filter(function(e){return e>=1}).map(function(e){return Math.round(e*i)}).filter(function(e){return e<=r.width}),aspectRatio:c,presentationWidth:w,presentationHeight:Math.round(w/c),unscaledWidth:i}}(e):"constrained"===i?R(e):"fullWidth"===i?R(c({breakpoints:d},e)):(s.warn("No valid layout was provided for the image at "+t+". Valid image layouts are fixed, fullWidth, and constrained. Found "+i),{sizes:[a.width],presentationWidth:a.width,presentationHeight:a.height,aspectRatio:a.width/a.height,unscaledWidth:a.width})}(c({},e,{sourceMetadata:i})),N={sources:[]},x=e.sizes;x||(x=function(e,t){switch(t){case"constrained":return"(min-width: "+e+"px) "+e+"px, 100vw";case"fixed":return e+"px";case"fullWidth":return"100vw";default:return}}(j.presentationWidth,n)),L.forEach(function(e){var t=j.sizes.map(function(t){var i=a(h,t,Math.round(t/j.aspectRatio),e,s,l);if(null!=i&&i.width&&i.height&&i.src&&i.format)return i;v.warn("["+r+"] The resolver for image "+h+" returned an invalid value.")}).filter(Boolean);if("jpg"===e||"png"===e||"auto"===e){var i=t.find(function(e){return e.width===j.unscaledWidth})||t[0];i&&(N.fallback={src:i.src,srcSet:b(t),sizes:x})}else{var n;null==(n=N.sources)||n.push({srcSet:b(t),sizes:x,type:"image/"+e})}});var I={images:N,layout:n,backgroundColor:w};switch(M&&(I.placeholder={fallback:M}),n){case"fixed":I.width=j.presentationWidth,I.height=j.presentationHeight;break;case"fullWidth":I.width=1,I.height=1/j.aspectRatio;break;case"constrained":I.width=e.width||j.presentationWidth||1,I.height=(I.width||1)/j.aspectRatio}return I}var k=function(e){return Array.from(new Set([1].concat(e))).sort(w)};function R(e){var t,r=e.sourceMetadata,i=e.width,a=e.height,n=e.fit,o=void 0===n?"cover":n,s=e.outputPixelDensities,l=e.breakpoints,d=e.layout,u=r.width/r.height,c=k(void 0===s?f:s);if(i&&a){var h=_(r,{width:i,height:a,fit:o});i=h.width,a=h.height,u=h.aspectRatio}i=i&&Math.min(i,r.width),a=a&&Math.min(a,r.height),i||a||(a=(i=Math.min(800,r.width))/u),i||(i=a*u);var p=i;return(r.width<i||r.height<a)&&(i=r.width,a=r.height),i=Math.round(i),(null==l?void 0:l.length)>0?(t=l.filter(function(e){return e<=r.width})).length<l.length&&!t.includes(r.width)&&t.push(r.width):t=(t=c.map(function(e){return Math.round(e*i)})).filter(function(e){return e<=r.width}),"constrained"!==d||t.includes(i)||t.push(i),{sizes:t=t.sort(w),aspectRatio:u,presentationWidth:p,presentationHeight:Math.round(p/u),unscaledWidth:i}}function _(e,t){var r=e.width/e.height,i=t.width,a=t.height;switch(t.fit){case"fill":i=t.width?t.width:e.width,a=t.height?t.height:e.height;break;case"inside":var n=t.width?t.width:Number.MAX_SAFE_INTEGER,o=t.height?t.height:Number.MAX_SAFE_INTEGER;i=Math.min(n,Math.round(o*r)),a=Math.min(o,Math.round(n/r));break;case"outside":var s=t.width?t.width:0,l=t.height?t.height:0;i=Math.max(s,Math.round(l*r)),a=Math.max(l,Math.round(s/r));break;default:t.width&&!t.height&&(i=t.width,a=Math.round(t.width/r)),t.height&&!t.width&&(i=Math.round(t.height*r),a=t.height)}return{width:i,height:a,aspectRatio:i/a}}var j=["baseUrl","urlBuilder","sourceWidth","sourceHeight","pluginName","formats","breakpoints","options"],N=["images","placeholder"],x=new Set,I=function(){return"undefined"!=typeof HTMLImageElement&&"loading"in HTMLImageElement.prototype};function O(){return"undefined"!=typeof GATSBY___IMAGE&&GATSBY___IMAGE}function W(e){e&&x.add(e)}function z(e){return x.has(e)}var T=function(e){var t;return function(e){var t,r;return Boolean(null==e||null==(t=e.images)||null==(r=t.fallback)?void 0:r.src)}(e)?e:function(e){return Boolean(null==e?void 0:e.gatsbyImageData)}(e)?e.gatsbyImageData:null==e||null==(t=e.childImageSharp)?void 0:t.gatsbyImageData},P=function(e){var t,r,i;return null==(t=T(e))||null==(r=t.images)||null==(i=r.fallback)?void 0:i.src},H=function(e){var t,r,i;return null==(t=T(e))||null==(r=t.images)||null==(i=r.fallback)?void 0:i.srcSet};function D(e){var t,r=e.baseUrl,i=e.urlBuilder,a=e.sourceWidth,n=e.sourceHeight,o=e.pluginName,s=void 0===o?"getImageData":o,l=e.formats,d=void 0===l?["auto"]:l,u=e.breakpoints,h=e.options,g=p(e,j);return null!=(t=u)&&t.length||"fullWidth"!==g.layout&&"FULL_WIDTH"!==g.layout||(u=v),L(c({},g,{pluginName:s,generateImageSource:function(e,t,r,a){return{width:t,height:r,format:a,src:i({baseUrl:e,width:t,height:r,options:h,format:a})}},filename:r,formats:d,breakpoints:u,sourceMetadata:{width:a,height:n,format:"auto"}}))}function C(e,t,r,i,a,n,o,s){var l,d;return void 0===s&&(s={}),null!=o&&o.current&&!("objectFit"in document.documentElement.style)&&(o.current.dataset.objectFit=null!=(l=s.objectFit)?l:"cover",o.current.dataset.objectPosition=""+(null!=(d=s.objectPosition)?d:"50% 50%"),function(e){try{var t=function(){window.objectFitPolyfill(e.current)},r=function(){if(!("objectFitPolyfill"in window))return Promise.resolve(import("objectFitPolyfill")).then(function(){})}();Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}}(o)),O()||(s=c({height:"100%",left:0,position:"absolute",top:0,transform:"translateZ(0)",transition:"opacity 250ms linear",width:"100%",willChange:"opacity"},s)),c({},r,{loading:i,shouldLoad:e,"data-main-image":"",style:c({},s,{opacity:t?1:0}),onLoad:function(e){if(!t){W(n);var r=e.currentTarget,i=new Image;i.src=r.currentSrc,i.decode?i.decode().catch(function(){}).then(function(){a(!0)}):a(!0)}},ref:o})}function q(e,t,r,i,a,n,o,s){var l={};n&&(l.backgroundColor=n,"fixed"===r?(l.width=i,l.height=a,l.backgroundColor=n,l.position="relative"):("constrained"===r||"fullWidth"===r)&&(l.position="absolute",l.top=0,l.left=0,l.bottom=0,l.right=0)),o&&(l.objectFit=o),s&&(l.objectPosition=s);var d=c({},e,{"aria-hidden":!0,"data-placeholder-image":"",style:c({opacity:t?0:1,transition:"opacity 500ms linear"},l)});return O()||(d.style={height:"100%",left:0,position:"absolute",top:0,width:"100%"}),d}function A(e,t){var r,i,a,n=e.images,o=e.placeholder,s=c({},p(e,N),{images:c({},n,{sources:[]}),placeholder:o&&c({},o,{sources:[]})});return t.forEach(function(t){var r,i=t.media,a=t.image;i?(a.layout!==e.layout&&"development"===process.env.NODE_ENV&&console.warn('[gatsby-plugin-image] Mismatched image layout: expected "'+e.layout+'" but received "'+a.layout+'". All art-directed images use the same layout as the default image'),(r=s.images.sources).push.apply(r,a.images.sources.map(function(e){return c({},e,{media:i})}).concat([{media:i,srcSet:a.images.fallback.srcSet}])),s.placeholder&&s.placeholder.sources.push({media:i,srcSet:a.placeholder.fallback})):"development"===process.env.NODE_ENV&&console.warn("[gatsby-plugin-image] All art-directed images passed to must have a value set for `media`. Skipping.")}),(r=s.images.sources).push.apply(r,n.sources),null!=o&&o.sources&&(null==(i=s.placeholder)||(a=i.sources).push.apply(a,o.sources)),s}var F,V=["children"],G=function(e){var r=e.layout,i=e.width,a=e.height;return"fullWidth"===r?t.createElement("div",{"aria-hidden":!0,style:{paddingTop:a/i*100+"%"}}):"constrained"===r?t.createElement("div",{style:{maxWidth:i,display:"block"}},t.createElement("img",{alt:"",role:"presentation","aria-hidden":"true",src:"data:image/svg+xml;charset=utf-8,%3Csvg height='"+a+"' width='"+i+"' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E",style:{maxWidth:"100%",display:"block",position:"static"}})):null},U=function(e){var i=e.children,a=p(e,V);return t.createElement(r,null,t.createElement(G,c({},a)),i,!1)},B=["src","srcSet","loading","alt","shouldLoad","innerRef"],J=["fallback","sources","shouldLoad"],Y=function(e){var r=e.src,i=e.srcSet,a=e.loading,n=e.alt,o=void 0===n?"":n,s=e.shouldLoad,l=e.innerRef,d=p(e,B);return t.createElement("img",c({},d,{decoding:"async",loading:a,src:s?r:void 0,"data-src":s?void 0:r,srcSet:s?i:void 0,"data-srcset":s?void 0:i,alt:o,ref:l}))},X=i(function(e,r){var i=e.fallback,a=e.sources,n=void 0===a?[]:a,o=e.shouldLoad,s=void 0===o||o,l=p(e,J),d=l.sizes||(null==i?void 0:i.sizes),u=t.createElement(Y,c({},l,i,{sizes:d,shouldLoad:s,innerRef:r}));return n.length?t.createElement("picture",null,n.map(function(e){var r=e.media,i=e.srcSet,a=e.type;return t.createElement("source",{key:r+"-"+a+"-"+i,type:a,media:r,srcSet:s?i:void 0,"data-srcset":s?void 0:i,sizes:d})}),u):u});Y.propTypes={src:l.string.isRequired,alt:l.string.isRequired,sizes:l.string,srcSet:l.string,shouldLoad:l.bool},X.displayName="Picture",X.propTypes={alt:l.string.isRequired,shouldLoad:l.bool,fallback:l.exact({src:l.string.isRequired,srcSet:l.string,sizes:l.string}),sources:l.arrayOf(l.oneOfType([l.exact({media:l.string.isRequired,type:l.string,sizes:l.string,srcSet:l.string.isRequired}),l.exact({media:l.string,type:l.string.isRequired,sizes:l.string,srcSet:l.string.isRequired})]))};var Z=["fallback"],K=function(e){var r=e.fallback,i=p(e,Z);return r?t.createElement(X,c({},i,{fallback:{src:r},"aria-hidden":!0,alt:""})):t.createElement("div",c({},i))};K.displayName="Placeholder",K.propTypes={fallback:l.string,sources:null==(F=X.propTypes)?void 0:F.sources,alt:function(e,t,r){return e[t]?new Error("Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed."):null}};var Q=i(function(e,r){return t.createElement(t.Fragment,null,t.createElement(X,c({ref:r},e)),t.createElement("noscript",null,t.createElement(X,c({},e,{shouldLoad:!0}))))});Q.displayName="MainImage",Q.propTypes=X.propTypes;var $=function(e,t,r){return e.alt||""===e.alt?d.string.apply(d,[e,t,r].concat([].slice.call(arguments,3))):new Error('The "alt" prop is required in '+r+'. If the image is purely presentational then pass an empty string: e.g. alt="". Learn more: https://a11y-style-guide.com/style-guide/section-media.html')},ee={image:d.object.isRequired,alt:$},te=["style","className"],re=function(e){var r,i;function n(t){var r;return(r=e.call(this,t)||this).root=a(),r.hydrated={current:!1},r.forceRender={current:"development"===process.env.NODE_ENV},r.lazyHydrator=null,r.ref=a(),r.unobserveRef=void 0,r.state={isLoading:I(),isLoaded:!1},r}i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,h(r,i);var o=n.prototype;return o._lazyHydrate=function(e,t){var r=this,i=this.root.current.querySelector("[data-gatsby-image-ssr]");return I()&&i&&!this.hydrated.current?(this.hydrated.current=!0,Promise.resolve()):import("./lazy-hydrate-9c85febc.js").then(function(i){r.lazyHydrator=(0,i.lazyHydrate)(c({image:e.image.images,isLoading:t.isLoading,isLoaded:t.isLoaded,toggleIsLoaded:function(){null==e.onLoad||e.onLoad(),r.setState({isLoaded:!0})},ref:r.ref},e),r.root,r.hydrated,r.forceRender)})},o._setupIntersectionObserver=function(e){var t=this;void 0===e&&(e=!0),import("./intersection-observer-6b794dd8.js").then(function(r){var i=(0,r.createIntersectionObserver)(function(){if(t.root.current){var r=JSON.stringify(t.props.image.images);null==t.props.onStartLoad||t.props.onStartLoad({wasCached:e&&z(r)}),t.setState({isLoading:!0,isLoaded:e&&z(r)})}});t.root.current&&(t.unobserveRef=i(t.root))})},o.shouldComponentUpdate=function(e,t){var r=this,i=!1;return this.state.isLoading||!t.isLoading||t.isLoaded||(this.forceRender.current=!0),this.props.image.images!==e.image.images&&(this.unobserveRef&&(this.unobserveRef(),this.hydrated.current&&this.lazyHydrator&&u(null,this.root.current)),this.setState({isLoading:!1,isLoaded:!1},function(){r._setupIntersectionObserver(!1)}),i=!0),this.root.current&&!i&&this._lazyHydrate(e,t),!1},o.componentDidMount=function(){if(this.root.current){var e=this.root.current.querySelector("[data-gatsby-image-ssr]"),t=JSON.stringify(this.props.image.images);if(I()&&e&&O()){var r,i;if(null==(r=(i=this.props).onStartLoad)||r.call(i,{wasCached:!1}),e.complete){var a,n;null==(a=(n=this.props).onLoad)||a.call(n),W(t)}else{var o=this;e.addEventListener("load",function r(){e.removeEventListener("load",r),null==o.props.onLoad||o.props.onLoad(),W(t)})}return}this._setupIntersectionObserver(!0)}},o.componentWillUnmount=function(){this.unobserveRef&&(this.unobserveRef(),this.hydrated.current&&this.lazyHydrator&&this.lazyHydrator())},o.render=function(){var e=this.props.as||"div",r=this.props.image,i=r.width,a=r.height,n=r.layout,o=function(e,t,r){var i={},a="gatsby-image-wrapper";return O()||(i.position="relative",i.overflow="hidden"),"fixed"===r?(i.width=e,i.height=t):"constrained"===r&&(O()||(i.display="inline-block",i.verticalAlign="top"),a="gatsby-image-wrapper gatsby-image-wrapper-constrained"),{className:a,"data-gatsby-image-wrapper":"",style:i}}(i,a,n),s=o.style,l=o.className,d=p(o,te),u=this.props.className;this.props.class&&(u=this.props.class);var h=function(e,t,r){var i=null;return"fullWidth"===e&&(i='<div aria-hidden="true" style="padding-top: '+r/t*100+'%;"></div>'),"constrained"===e&&(i='<div style="max-width: '+t+'px; display: block;"><img alt="" role="presentation" aria-hidden="true" src="data:image/svg+xml;charset=utf-8,%3Csvg height=\''+r+"' width='"+t+"' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E\" style=\"max-width: 100%; display: block; position: static;\"></div>"),i}(n,i,a);return t.createElement(e,c({},d,{style:c({},s,this.props.style,{backgroundColor:this.props.backgroundColor}),className:l+(u?" "+u:""),ref:this.root,dangerouslySetInnerHTML:{__html:h},suppressHydrationWarning:!0}))},n}(n),ie=function(e){if(!e.image)return"development"===process.env.NODE_ENV&&console.warn("[gatsby-plugin-image] Missing image prop"),null;O()||"development"!==process.env.NODE_ENV||console.warn('[gatsby-plugin-image] You\'re missing out on some cool performance features. Please add "gatsby-plugin-image" to your gatsby-config.js');var r=e.image,i=JSON.stringify([r.width,r.height,r.layout,e.className,e.class,e.backgroundColor]);return t.createElement(re,c({key:i},e))};ie.propTypes=ee,ie.displayName="GatsbyImage";var ae=["src","__imageData","__error","width","height","aspectRatio","tracedSVGOptions","placeholder","formats","quality","transformOptions","jpgOptions","pngOptions","webpOptions","avifOptions","blurredOptions"],ne=function(e,t){return"fullWidth"!==e.layout||"width"!==t&&"height"!==t||!e[t]?d.number.apply(d,[e,t].concat([].slice.call(arguments,2))):new Error('"'+t+'" '+e[t]+" may not be passed when layout is fullWidth.")},oe=new Set(["fixed","fullWidth","constrained"]),se={src:d.string.isRequired,alt:$,width:ne,height:ne,sizes:d.string,layout:function(e){if(void 0!==e.layout&&!oe.has(e.layout))return new Error("Invalid value "+e.layout+'" provided for prop "layout". Defaulting to "constrained". Valid values are "fixed", "fullWidth" or "constrained".')}},le=function(e){return function(r){var i=r.src,a=r.__imageData,n=r.__error,o=p(r,ae);return n&&console.warn(n),a?t.createElement(e,c({image:a},o)):(console.warn("Image not loaded",i),n||"development"!==process.env.NODE_ENV||console.warn('Please ensure that "gatsby-plugin-image" is included in the plugins array in gatsby-config.js, and that your version of gatsby is at least 2.24.78'),null)}}(ie);function de(t){var r=t.children;return e.useEffect(function(){import("./lazy-hydrate-9c85febc.js")},[]),r}le.displayName="StaticImage",le.propTypes=se;export{ie as G,U as L,Q as M,K as P,le as S,p as _,c as a,C as b,de as c,T as d,P as e,H as f,q as g,D as h,L as i,M as j,A as w};
|
|
2
|
-
//# sourceMappingURL=index.browser-bb1a9c70.js.map
|