@quintype/components 3.6.1-image-sizes.0 → 3.6.1-image-sizes.1
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/dist/cjs/index.js
CHANGED
|
@@ -17,9 +17,9 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
17
17
|
var reactDfp = require('react-dfp');
|
|
18
18
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
19
19
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
20
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
20
21
|
var emptyWebGif = require('empty-web-gif');
|
|
21
22
|
var quintypeJs = require('quintype-js');
|
|
22
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
23
23
|
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
24
24
|
var classNames = require('classnames');
|
|
25
25
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
@@ -60,8 +60,8 @@ var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
|
60
60
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
61
61
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
62
62
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
63
|
-
var emptyWebGif__default = /*#__PURE__*/_interopDefaultLegacy(emptyWebGif);
|
|
64
63
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
64
|
+
var emptyWebGif__default = /*#__PURE__*/_interopDefaultLegacy(emptyWebGif);
|
|
65
65
|
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
66
66
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
67
67
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
@@ -1844,6 +1844,59 @@ function hashString(string) {
|
|
|
1844
1844
|
return hash;
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1848
|
+
|
|
1849
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1850
|
+
var forceLoadingGumlet = false;
|
|
1851
|
+
|
|
1852
|
+
function loadGumlet() {
|
|
1853
|
+
if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
if (process.env.NODE_ENV == "development") {
|
|
1858
|
+
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
forceLoadingGumlet = true;
|
|
1862
|
+
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1863
|
+
hosts: []
|
|
1864
|
+
};
|
|
1865
|
+
var script = document.createElement("script");
|
|
1866
|
+
script.type = "text/javascript";
|
|
1867
|
+
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
1868
|
+
document.body.appendChild(script);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
function GumletImage(props) {
|
|
1872
|
+
var slug = props.slug,
|
|
1873
|
+
metadata = props.metadata,
|
|
1874
|
+
aspectRatio = props.aspectRatio,
|
|
1875
|
+
imageCDN = props.imageCDN,
|
|
1876
|
+
imgParams = props.imgParams,
|
|
1877
|
+
reactTag = props.reactTag,
|
|
1878
|
+
className = props.className,
|
|
1879
|
+
sizes = props.sizes;
|
|
1880
|
+
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1881
|
+
console.log("aa--sizes", sizes);
|
|
1882
|
+
var imageProps = {
|
|
1883
|
+
src: emptyWebGif__default["default"],
|
|
1884
|
+
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1885
|
+
key: hashString(slug),
|
|
1886
|
+
sizes: sizes
|
|
1887
|
+
};
|
|
1888
|
+
var Tag = reactTag || "img";
|
|
1889
|
+
React.useEffect(loadGumlet);
|
|
1890
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Tag, _extends__default["default"]({}, imageProps, omit__default["default"](props, USED_PARAMS), {
|
|
1891
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1892
|
+
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1893
|
+
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1894
|
+
w: 1200
|
|
1895
|
+
}))),
|
|
1896
|
+
alt: props.alt || ""
|
|
1897
|
+
})));
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1847
1900
|
function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
|
|
1848
1901
|
|
|
1849
1902
|
function _isNativeReflectConstruct$g() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -1856,6 +1909,7 @@ function responsiveProps(props) {
|
|
|
1856
1909
|
}, props.imgParams));
|
|
1857
1910
|
}
|
|
1858
1911
|
|
|
1912
|
+
console.log("aa--sizes", props === null || props === void 0 ? void 0 : props.sizes);
|
|
1859
1913
|
return {
|
|
1860
1914
|
src: generatePath(props.defaultWidth),
|
|
1861
1915
|
srcSet: props.widths ? props.widths.map(function (size) {
|
|
@@ -1941,57 +1995,6 @@ ThumborImage.contextTypes = {
|
|
|
1941
1995
|
lazyLoadEagerPredicate: propTypes.func
|
|
1942
1996
|
};
|
|
1943
1997
|
|
|
1944
|
-
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1945
|
-
|
|
1946
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1947
|
-
var forceLoadingGumlet = false;
|
|
1948
|
-
|
|
1949
|
-
function loadGumlet() {
|
|
1950
|
-
if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
|
|
1951
|
-
return;
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
if (process.env.NODE_ENV == "development") {
|
|
1955
|
-
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
forceLoadingGumlet = true;
|
|
1959
|
-
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1960
|
-
hosts: []
|
|
1961
|
-
};
|
|
1962
|
-
var script = document.createElement("script");
|
|
1963
|
-
script.type = "text/javascript";
|
|
1964
|
-
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
1965
|
-
document.body.appendChild(script);
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
function GumletImage(props) {
|
|
1969
|
-
var slug = props.slug,
|
|
1970
|
-
metadata = props.metadata,
|
|
1971
|
-
aspectRatio = props.aspectRatio,
|
|
1972
|
-
imageCDN = props.imageCDN,
|
|
1973
|
-
imgParams = props.imgParams,
|
|
1974
|
-
reactTag = props.reactTag,
|
|
1975
|
-
className = props.className;
|
|
1976
|
-
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1977
|
-
var imageProps = {
|
|
1978
|
-
src: emptyWebGif__default["default"],
|
|
1979
|
-
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1980
|
-
key: hashString(slug),
|
|
1981
|
-
sizes: props === null || props === void 0 ? void 0 : props.sizes
|
|
1982
|
-
};
|
|
1983
|
-
var Tag = reactTag || "img";
|
|
1984
|
-
React.useEffect(loadGumlet);
|
|
1985
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Tag, _extends__default["default"]({}, imageProps, omit__default["default"](props, USED_PARAMS), {
|
|
1986
|
-
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1987
|
-
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1988
|
-
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1989
|
-
w: 1200
|
|
1990
|
-
}))),
|
|
1991
|
-
alt: props.alt || ""
|
|
1992
|
-
})));
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
1998
|
function mapStateToProps$6(state) {
|
|
1996
1999
|
return {
|
|
1997
2000
|
imageCDN: state.qt.config["cdn-image"],
|
|
@@ -2000,10 +2003,12 @@ function mapStateToProps$6(state) {
|
|
|
2000
2003
|
}
|
|
2001
2004
|
|
|
2002
2005
|
function ResponsiveImageBase(props) {
|
|
2003
|
-
if (process.env.NODE_ENV ==
|
|
2006
|
+
if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
|
|
2004
2007
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
2005
2008
|
}
|
|
2006
2009
|
|
|
2010
|
+
console.log("aa--imageCdnFormat", props.imageCDNFormat);
|
|
2011
|
+
|
|
2007
2012
|
if (props.imageCDNFormat === "gumlet") {
|
|
2008
2013
|
return /*#__PURE__*/React__default["default"].createElement(GumletImage, props);
|
|
2009
2014
|
}
|
|
@@ -38,13 +38,15 @@ export function GumletImage(props) {
|
|
|
38
38
|
imageCDN = props.imageCDN,
|
|
39
39
|
imgParams = props.imgParams,
|
|
40
40
|
reactTag = props.reactTag,
|
|
41
|
-
className = props.className
|
|
41
|
+
className = props.className,
|
|
42
|
+
sizes = props.sizes;
|
|
42
43
|
var image = new FocusedImage(slug, metadata);
|
|
44
|
+
console.log("aa--sizes", sizes);
|
|
43
45
|
var imageProps = {
|
|
44
46
|
src: emptyWebGif,
|
|
45
47
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
46
48
|
key: hashString(slug),
|
|
47
|
-
sizes:
|
|
49
|
+
sizes: sizes
|
|
48
50
|
};
|
|
49
51
|
var Tag = reactTag || "img";
|
|
50
52
|
useEffect(loadGumlet);
|
|
@@ -23,6 +23,7 @@ export function responsiveProps(props) {
|
|
|
23
23
|
}, props.imgParams));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
console.log("aa--sizes", props === null || props === void 0 ? void 0 : props.sizes);
|
|
26
27
|
return {
|
|
27
28
|
src: generatePath(props.defaultWidth),
|
|
28
29
|
srcSet: props.widths ? props.widths.map(function (size) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { arrayOf, number, object, string } from "prop-types";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { string, arrayOf, number, object } from 'prop-types';
|
|
3
|
+
import { connect } from "react-redux";
|
|
5
4
|
import { GumletImage } from "./impl/gumlet-image";
|
|
5
|
+
import { ThumborImage } from "./impl/thumbor-image";
|
|
6
6
|
|
|
7
7
|
function mapStateToProps(state) {
|
|
8
8
|
return {
|
|
@@ -12,10 +12,12 @@ function mapStateToProps(state) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function ResponsiveImageBase(props) {
|
|
15
|
-
if (process.env.NODE_ENV ==
|
|
15
|
+
if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
|
|
16
16
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
console.log("aa--imageCdnFormat", props.imageCDNFormat);
|
|
20
|
+
|
|
19
21
|
if (props.imageCDNFormat === "gumlet") {
|
|
20
22
|
return /*#__PURE__*/React.createElement(GumletImage, props);
|
|
21
23
|
}
|