@quintype/components 3.5.1-image-below-fold.0 → 3.5.1-image-below-fold.2
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);
|
|
@@ -1257,6 +1257,7 @@ var StubObserverWrapper = /*#__PURE__*/function () {
|
|
|
1257
1257
|
_classCallCheck__default["default"](this, StubObserverWrapper);
|
|
1258
1258
|
|
|
1259
1259
|
this.callback = callback;
|
|
1260
|
+
console.log("aa--inside-StubObserverWrapper");
|
|
1260
1261
|
}
|
|
1261
1262
|
|
|
1262
1263
|
_createClass__default["default"](StubObserverWrapper, [{
|
|
@@ -1844,6 +1845,66 @@ function hashString(string) {
|
|
|
1844
1845
|
return hash;
|
|
1845
1846
|
}
|
|
1846
1847
|
|
|
1848
|
+
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; }
|
|
1849
|
+
|
|
1850
|
+
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; }
|
|
1851
|
+
var forceLoadingGumlet = false;
|
|
1852
|
+
|
|
1853
|
+
function loadGumlet() {
|
|
1854
|
+
if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
if (process.env.NODE_ENV == "development") {
|
|
1859
|
+
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
forceLoadingGumlet = true;
|
|
1863
|
+
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1864
|
+
hosts: []
|
|
1865
|
+
};
|
|
1866
|
+
var script = document.createElement("script");
|
|
1867
|
+
script.type = "text/javascript";
|
|
1868
|
+
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
1869
|
+
document.body.appendChild(script);
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
function GumletImage(props) {
|
|
1873
|
+
var slug = props.slug,
|
|
1874
|
+
metadata = props.metadata,
|
|
1875
|
+
aspectRatio = props.aspectRatio,
|
|
1876
|
+
imageCDN = props.imageCDN,
|
|
1877
|
+
imgParams = props.imgParams,
|
|
1878
|
+
reactTag = props.reactTag,
|
|
1879
|
+
className = props.className;
|
|
1880
|
+
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1881
|
+
var imageProps = {
|
|
1882
|
+
src: emptyWebGif__default["default"],
|
|
1883
|
+
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1884
|
+
key: hashString(slug)
|
|
1885
|
+
};
|
|
1886
|
+
var Tag = reactTag || "img";
|
|
1887
|
+
React.useEffect(loadGumlet);
|
|
1888
|
+
console.log("aa--imageProps", imageProps);
|
|
1889
|
+
console.log("aa--props", props);
|
|
1890
|
+
console.log("aa--USED_PARAMS", USED_PARAMS);
|
|
1891
|
+
console.log("aa--omit(props, USED_PARAMS)", omit__default["default"](props, USED_PARAMS));
|
|
1892
|
+
React.useEffect(function () {
|
|
1893
|
+
console.log("aa--imageProps", imageProps);
|
|
1894
|
+
console.log("aa--props", props);
|
|
1895
|
+
console.log("aa--USED_PARAMS", USED_PARAMS);
|
|
1896
|
+
console.log("aa--omit(props, USED_PARAMS)", omit__default["default"](props, USED_PARAMS));
|
|
1897
|
+
}, []);
|
|
1898
|
+
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), {
|
|
1899
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1900
|
+
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1901
|
+
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1902
|
+
w: 1200
|
|
1903
|
+
}))),
|
|
1904
|
+
alt: props.alt || ""
|
|
1905
|
+
})));
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1847
1908
|
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
1909
|
|
|
1849
1910
|
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; } }
|
|
@@ -1878,6 +1939,7 @@ var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
1878
1939
|
_this.state = {
|
|
1879
1940
|
showImage: !_this.shouldLazyLoad()
|
|
1880
1941
|
};
|
|
1942
|
+
console.log("aa--this.props", _this.props);
|
|
1881
1943
|
return _this;
|
|
1882
1944
|
}
|
|
1883
1945
|
|
|
@@ -1906,11 +1968,12 @@ var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
1906
1968
|
var imageProps = this.state.showImage ? responsiveProps(this.props) : {
|
|
1907
1969
|
src: emptyWebGif__default["default"]
|
|
1908
1970
|
};
|
|
1971
|
+
console.log("aa--imageProps", imageProps);
|
|
1909
1972
|
return /*#__PURE__*/React__default["default"].createElement(this.props.reactTag || "img", Object.assign(imageProps, omit__default["default"](this.props, USED_PARAMS), {
|
|
1910
1973
|
ref: function ref(dom) {
|
|
1911
1974
|
return _this2.dom = dom;
|
|
1912
1975
|
},
|
|
1913
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
1976
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : "qt-image"
|
|
1914
1977
|
}));
|
|
1915
1978
|
}
|
|
1916
1979
|
}, {
|
|
@@ -1940,60 +2003,6 @@ ThumborImage.contextTypes = {
|
|
|
1940
2003
|
lazyLoadEagerPredicate: propTypes.func
|
|
1941
2004
|
};
|
|
1942
2005
|
|
|
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
|
-
console.log("aa--imageProps", imageProps);
|
|
1984
|
-
console.log("aa--props", props);
|
|
1985
|
-
console.log("aa--USED_PARAMS", USED_PARAMS);
|
|
1986
|
-
console.log("aa--omit(props, USED_PARAMS)", omit__default["default"](props, USED_PARAMS));
|
|
1987
|
-
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), {
|
|
1988
|
-
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1989
|
-
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1990
|
-
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1991
|
-
w: 1200
|
|
1992
|
-
}))),
|
|
1993
|
-
alt: props.alt || ""
|
|
1994
|
-
})));
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
2006
|
function mapStateToProps$6(state) {
|
|
1998
2007
|
return {
|
|
1999
2008
|
imageCDN: state.qt.config["cdn-image"],
|
|
@@ -2002,7 +2011,9 @@ function mapStateToProps$6(state) {
|
|
|
2002
2011
|
}
|
|
2003
2012
|
|
|
2004
2013
|
function ResponsiveImageBase(props) {
|
|
2005
|
-
|
|
2014
|
+
console.log("aa--ResponsiveImageBase-Props", props);
|
|
2015
|
+
|
|
2016
|
+
if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
|
|
2006
2017
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
2007
2018
|
}
|
|
2008
2019
|
|
|
@@ -51,6 +51,12 @@ export function GumletImage(props) {
|
|
|
51
51
|
console.log("aa--props", props);
|
|
52
52
|
console.log("aa--USED_PARAMS", USED_PARAMS);
|
|
53
53
|
console.log("aa--omit(props, USED_PARAMS)", omit(props, USED_PARAMS));
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
console.log("aa--imageProps", imageProps);
|
|
56
|
+
console.log("aa--props", props);
|
|
57
|
+
console.log("aa--USED_PARAMS", USED_PARAMS);
|
|
58
|
+
console.log("aa--omit(props, USED_PARAMS)", omit(props, USED_PARAMS));
|
|
59
|
+
}, []);
|
|
54
60
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _extends({}, imageProps, omit(props, USED_PARAMS), {
|
|
55
61
|
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
56
62
|
})), /*#__PURE__*/React.createElement("noscript", null, /*#__PURE__*/React.createElement("img", {
|
|
@@ -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
|
|
|
@@ -45,6 +45,7 @@ export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
45
45
|
_this.state = {
|
|
46
46
|
showImage: !_this.shouldLazyLoad()
|
|
47
47
|
};
|
|
48
|
+
console.log("aa--this.props", _this.props);
|
|
48
49
|
return _this;
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -73,11 +74,12 @@ export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
73
74
|
var imageProps = this.state.showImage ? responsiveProps(this.props) : {
|
|
74
75
|
src: emptyWebGif
|
|
75
76
|
};
|
|
77
|
+
console.log("aa--imageProps", imageProps);
|
|
76
78
|
return /*#__PURE__*/React.createElement(this.props.reactTag || "img", Object.assign(imageProps, omit(this.props, USED_PARAMS), {
|
|
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
|
}, {
|
|
@@ -9,7 +9,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
|
|
10
10
|
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; } }
|
|
11
11
|
|
|
12
|
-
import { func, string } from
|
|
12
|
+
import { func, string } from "prop-types";
|
|
13
13
|
import React from "react";
|
|
14
14
|
|
|
15
15
|
var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
@@ -95,6 +95,7 @@ var StubObserverWrapper = /*#__PURE__*/function () {
|
|
|
95
95
|
_classCallCheck(this, StubObserverWrapper);
|
|
96
96
|
|
|
97
97
|
this.callback = callback;
|
|
98
|
+
console.log("aa--inside-StubObserverWrapper");
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
_createClass(StubObserverWrapper, [{
|
|
@@ -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,7 +12,9 @@ function mapStateToProps(state) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function ResponsiveImageBase(props) {
|
|
15
|
-
|
|
15
|
+
console.log("aa--ResponsiveImageBase-Props", props);
|
|
16
|
+
|
|
17
|
+
if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
|
|
16
18
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
17
19
|
}
|
|
18
20
|
|
package/package.json
CHANGED