@quintype/components 3.6.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,12 +1909,14 @@ 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) {
|
|
1862
1916
|
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
1863
1917
|
}).join(",") : undefined,
|
|
1864
|
-
key: hashString(props.slug)
|
|
1918
|
+
key: hashString(props.slug),
|
|
1919
|
+
sizes: props === null || props === void 0 ? void 0 : props.sizes
|
|
1865
1920
|
};
|
|
1866
1921
|
}
|
|
1867
1922
|
var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
@@ -1910,7 +1965,7 @@ var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
1910
1965
|
ref: function ref(dom) {
|
|
1911
1966
|
return _this2.dom = dom;
|
|
1912
1967
|
},
|
|
1913
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
1968
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : "qt-image"
|
|
1914
1969
|
}));
|
|
1915
1970
|
}
|
|
1916
1971
|
}, {
|
|
@@ -1940,56 +1995,6 @@ ThumborImage.contextTypes = {
|
|
|
1940
1995
|
lazyLoadEagerPredicate: propTypes.func
|
|
1941
1996
|
};
|
|
1942
1997
|
|
|
1943
|
-
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; }
|
|
1944
|
-
|
|
1945
|
-
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; }
|
|
1946
|
-
var forceLoadingGumlet = false;
|
|
1947
|
-
|
|
1948
|
-
function loadGumlet() {
|
|
1949
|
-
if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
|
|
1950
|
-
return;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
if (process.env.NODE_ENV == 'development') {
|
|
1954
|
-
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
forceLoadingGumlet = true;
|
|
1958
|
-
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1959
|
-
hosts: []
|
|
1960
|
-
};
|
|
1961
|
-
var script = document.createElement('script');
|
|
1962
|
-
script.type = 'text/javascript';
|
|
1963
|
-
script.src = 'https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js';
|
|
1964
|
-
document.body.appendChild(script);
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
function GumletImage(props) {
|
|
1968
|
-
var slug = props.slug,
|
|
1969
|
-
metadata = props.metadata,
|
|
1970
|
-
aspectRatio = props.aspectRatio,
|
|
1971
|
-
imageCDN = props.imageCDN,
|
|
1972
|
-
imgParams = props.imgParams,
|
|
1973
|
-
reactTag = props.reactTag,
|
|
1974
|
-
className = props.className;
|
|
1975
|
-
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1976
|
-
var imageProps = {
|
|
1977
|
-
src: emptyWebGif__default["default"],
|
|
1978
|
-
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1979
|
-
key: hashString(slug)
|
|
1980
|
-
};
|
|
1981
|
-
var Tag = reactTag || "img";
|
|
1982
|
-
React.useEffect(loadGumlet);
|
|
1983
|
-
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), {
|
|
1984
|
-
className: className ? "qt-image ".concat(className) : 'qt-image'
|
|
1985
|
-
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1986
|
-
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1987
|
-
w: 1200
|
|
1988
|
-
}))),
|
|
1989
|
-
alt: props.alt || ""
|
|
1990
|
-
})));
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
1998
|
function mapStateToProps$6(state) {
|
|
1994
1999
|
return {
|
|
1995
2000
|
imageCDN: state.qt.config["cdn-image"],
|
|
@@ -1998,10 +2003,12 @@ function mapStateToProps$6(state) {
|
|
|
1998
2003
|
}
|
|
1999
2004
|
|
|
2000
2005
|
function ResponsiveImageBase(props) {
|
|
2001
|
-
if (process.env.NODE_ENV ==
|
|
2006
|
+
if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
|
|
2002
2007
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
2003
2008
|
}
|
|
2004
2009
|
|
|
2010
|
+
console.log("aa--imageCdnFormat", props.imageCDNFormat);
|
|
2011
|
+
|
|
2005
2012
|
if (props.imageCDNFormat === "gumlet") {
|
|
2006
2013
|
return /*#__PURE__*/React__default["default"].createElement(GumletImage, props);
|
|
2007
2014
|
}
|
|
@@ -5,11 +5,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import emptyWebGif from
|
|
8
|
+
import omit from "@babel/runtime/helpers/objectWithoutProperties";
|
|
9
|
+
import emptyWebGif from "empty-web-gif";
|
|
10
10
|
import { FocusedImage } from "quintype-js";
|
|
11
|
+
import React, { useEffect } from "react";
|
|
11
12
|
import { hashString, USED_PARAMS } from "./image-utils";
|
|
12
|
-
import omit from '@babel/runtime/helpers/objectWithoutProperties';
|
|
13
13
|
var forceLoadingGumlet = false;
|
|
14
14
|
|
|
15
15
|
function loadGumlet() {
|
|
@@ -17,7 +17,7 @@ function loadGumlet() {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (process.env.NODE_ENV ==
|
|
20
|
+
if (process.env.NODE_ENV == "development") {
|
|
21
21
|
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -25,9 +25,9 @@ function loadGumlet() {
|
|
|
25
25
|
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
26
26
|
hosts: []
|
|
27
27
|
};
|
|
28
|
-
var script = document.createElement(
|
|
29
|
-
script.type =
|
|
30
|
-
script.src =
|
|
28
|
+
var script = document.createElement("script");
|
|
29
|
+
script.type = "text/javascript";
|
|
30
|
+
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
31
31
|
document.body.appendChild(script);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -38,17 +38,20 @@ 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
|
-
key: hashString(slug)
|
|
48
|
+
key: hashString(slug),
|
|
49
|
+
sizes: sizes
|
|
47
50
|
};
|
|
48
51
|
var Tag = reactTag || "img";
|
|
49
52
|
useEffect(loadGumlet);
|
|
50
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _extends({}, imageProps, omit(props, USED_PARAMS), {
|
|
51
|
-
className: className ? "qt-image ".concat(className) :
|
|
54
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
52
55
|
})), /*#__PURE__*/React.createElement("noscript", null, /*#__PURE__*/React.createElement("img", {
|
|
53
56
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread(_objectSpread({}, imgParams), {}, {
|
|
54
57
|
w: 1200
|
|
@@ -8,12 +8,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
8
8
|
|
|
9
9
|
function _isNativeReflectConstruct() { 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; } }
|
|
10
10
|
|
|
11
|
-
import
|
|
12
|
-
import emptyWebGif from
|
|
13
|
-
import
|
|
14
|
-
import { func } from 'prop-types';
|
|
11
|
+
import omit from "@babel/runtime/helpers/objectWithoutProperties";
|
|
12
|
+
import emptyWebGif from "empty-web-gif";
|
|
13
|
+
import { func } from "prop-types";
|
|
15
14
|
import { FocusedImage } from "quintype-js";
|
|
16
|
-
import
|
|
15
|
+
import React from "react";
|
|
16
|
+
import { USED_PARAMS, hashString } from "./image-utils";
|
|
17
17
|
export function responsiveProps(props) {
|
|
18
18
|
var image = new FocusedImage(props.slug, props.metadata);
|
|
19
19
|
|
|
@@ -23,12 +23,14 @@ 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) {
|
|
29
30
|
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
30
31
|
}).join(",") : undefined,
|
|
31
|
-
key: hashString(props.slug)
|
|
32
|
+
key: hashString(props.slug),
|
|
33
|
+
sizes: props === null || props === void 0 ? void 0 : props.sizes
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
@@ -77,7 +79,7 @@ export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
77
79
|
ref: function ref(dom) {
|
|
78
80
|
return _this2.dom = dom;
|
|
79
81
|
},
|
|
80
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
82
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : "qt-image"
|
|
81
83
|
}));
|
|
82
84
|
}
|
|
83
85
|
}, {
|
|
@@ -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
|
}
|