@quintype/components 3.0.0 → 3.1.0-gumlet-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
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,7 +1947,8 @@ 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
|
+
disableLazy = props.disableLazy;
|
|
1951
1952
|
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1952
1953
|
var imageProps = {
|
|
1953
1954
|
src: emptyWebGif__default["default"],
|
|
@@ -1955,9 +1956,16 @@ function GumletImage(props) {
|
|
|
1955
1956
|
key: hashString(slug)
|
|
1956
1957
|
};
|
|
1957
1958
|
var Tag = reactTag || "img";
|
|
1959
|
+
|
|
1960
|
+
if (disableLazy) {
|
|
1961
|
+
imageProps = _objectSpread$3(_objectSpread$3({}, imageProps), {}, {
|
|
1962
|
+
"data-gmlazy": "false"
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1958
1966
|
React.useEffect(loadGumlet);
|
|
1959
1967
|
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) :
|
|
1968
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1961
1969
|
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1962
1970
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$3(_objectSpread$3({}, imgParams), {}, {
|
|
1963
1971
|
w: 1200
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
|
|
4
4
|
function ownKeys(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; }
|
|
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
8
|
import React, { useEffect } from "react";
|
|
9
|
-
import emptyWebGif from
|
|
9
|
+
import emptyWebGif from "empty-web-gif";
|
|
10
10
|
import { FocusedImage } from "quintype-js";
|
|
11
11
|
import { hashString, USED_PARAMS } from "./image-utils";
|
|
12
|
-
import omit from
|
|
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,7 +38,8 @@ 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
|
+
disableLazy = props.disableLazy;
|
|
42
43
|
var image = new FocusedImage(slug, metadata);
|
|
43
44
|
var imageProps = {
|
|
44
45
|
src: emptyWebGif,
|
|
@@ -46,9 +47,16 @@ export function GumletImage(props) {
|
|
|
46
47
|
key: hashString(slug)
|
|
47
48
|
};
|
|
48
49
|
var Tag = reactTag || "img";
|
|
50
|
+
|
|
51
|
+
if (disableLazy) {
|
|
52
|
+
imageProps = _objectSpread(_objectSpread({}, imageProps), {}, {
|
|
53
|
+
"data-gmlazy": "false"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
useEffect(loadGumlet);
|
|
50
58
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _extends({}, imageProps, omit(props, USED_PARAMS), {
|
|
51
|
-
className: className ? "qt-image ".concat(className) :
|
|
59
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
52
60
|
})), /*#__PURE__*/React.createElement("noscript", null, /*#__PURE__*/React.createElement("img", {
|
|
53
61
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread(_objectSpread({}, imgParams), {}, {
|
|
54
62
|
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.1.0-gumlet-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"
|