@quintype/components 3.0.0 → 3.0.1-img-lazy.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/dist/cjs/index.js +10 -7
- package/dist/es/components/impl/gumlet-image.js +13 -10
- package/package.json +2 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1926,7 +1926,7 @@ function loadGumlet() {
|
|
|
1926
1926
|
return;
|
|
1927
1927
|
}
|
|
1928
1928
|
|
|
1929
|
-
if (process.env.NODE_ENV ==
|
|
1929
|
+
if (process.env.NODE_ENV == "development") {
|
|
1930
1930
|
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1931
1931
|
}
|
|
1932
1932
|
|
|
@@ -1934,9 +1934,9 @@ function loadGumlet() {
|
|
|
1934
1934
|
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1935
1935
|
hosts: []
|
|
1936
1936
|
};
|
|
1937
|
-
var script = document.createElement(
|
|
1938
|
-
script.type =
|
|
1939
|
-
script.src =
|
|
1937
|
+
var script = document.createElement("script");
|
|
1938
|
+
script.type = "text/javascript";
|
|
1939
|
+
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
1940
1940
|
document.body.appendChild(script);
|
|
1941
1941
|
}
|
|
1942
1942
|
|
|
@@ -1947,17 +1947,20 @@ function GumletImage(props) {
|
|
|
1947
1947
|
imageCDN = props.imageCDN,
|
|
1948
1948
|
imgParams = props.imgParams,
|
|
1949
1949
|
reactTag = props.reactTag,
|
|
1950
|
-
className = props.className
|
|
1950
|
+
className = props.className,
|
|
1951
|
+
_props$imgLazy = props.imgLazy,
|
|
1952
|
+
imgLazy = _props$imgLazy === void 0 ? "true" : _props$imgLazy;
|
|
1951
1953
|
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1952
1954
|
var imageProps = {
|
|
1953
1955
|
src: emptyWebGif__default["default"],
|
|
1954
1956
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1955
|
-
key: hashString(slug)
|
|
1957
|
+
key: hashString(slug),
|
|
1958
|
+
"data-gmlazy": imgLazy
|
|
1956
1959
|
};
|
|
1957
1960
|
var Tag = reactTag || "img";
|
|
1958
1961
|
React.useEffect(loadGumlet);
|
|
1959
1962
|
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), {
|
|
1960
|
-
className: className ? "qt-image ".concat(className) :
|
|
1963
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1961
1964
|
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1962
1965
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$3(_objectSpread$3({}, imgParams), {}, {
|
|
1963
1966
|
w: 1200
|
|
@@ -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
|
+
_props$imgLazy = props.imgLazy,
|
|
43
|
+
imgLazy = _props$imgLazy === void 0 ? "true" : _props$imgLazy;
|
|
42
44
|
var image = new FocusedImage(slug, metadata);
|
|
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
|
+
"data-gmlazy": imgLazy
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/components",
|
|
3
|
-
"version": "3.0.0",
|
|
3
|
+
"version": "3.0.1-img-lazy.0",
|
|
4
4
|
"description": "Components to help build Quintype Node.js apps",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"clean:dist": "rimraf dist",
|
|
103
103
|
"docs": "rimraf docs && jsdoc -c jsdoc.json",
|
|
104
104
|
"prepack": "npm run build",
|
|
105
|
+
"prepublishOnly": "./bin-dev-scripts/standard-version-release.sh",
|
|
105
106
|
"sync-files-to": "npx onchange --verbose --wait --await-write-finish 'src/**/*' -- ./bin-dev-scripts/sync-to.sh",
|
|
106
107
|
"test": "jest --config jest.config.js",
|
|
107
108
|
"test:cover": "jest --coverage --watchAll; open coverage/index.html"
|