@quintype/components 3.5.2-csv-table.0 → 3.5.3-fix-image-sizes.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
|
@@ -1856,11 +1856,26 @@ function responsiveProps(props) {
|
|
|
1856
1856
|
}, props.imgParams));
|
|
1857
1857
|
}
|
|
1858
1858
|
|
|
1859
|
+
function generateSizes() {
|
|
1860
|
+
// return "(max-width: 600px) 100vw, (max-width: 900px) 50vw, (max-width: 1240px) 33vw, 11.13vw";
|
|
1861
|
+
var sizes = props.widths.map(function (size) {
|
|
1862
|
+
if (size === 250) {
|
|
1863
|
+
return "(max-width: 600px) 250px";
|
|
1864
|
+
} else if (size === 480) {
|
|
1865
|
+
return "(max-width: 900px) 480px";
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
return "640px";
|
|
1869
|
+
});
|
|
1870
|
+
return sizes.join(",");
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1859
1873
|
return {
|
|
1860
1874
|
src: generatePath(props.defaultWidth),
|
|
1861
1875
|
srcSet: props.widths ? props.widths.map(function (size) {
|
|
1862
1876
|
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
1863
1877
|
}).join(",") : undefined,
|
|
1878
|
+
sizes: generateSizes(),
|
|
1864
1879
|
key: hashString(props.slug)
|
|
1865
1880
|
};
|
|
1866
1881
|
}
|
|
@@ -1910,7 +1925,7 @@ var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
1910
1925
|
ref: function ref(dom) {
|
|
1911
1926
|
return _this2.dom = dom;
|
|
1912
1927
|
},
|
|
1913
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
1928
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : "qt-image"
|
|
1914
1929
|
}));
|
|
1915
1930
|
}
|
|
1916
1931
|
}, {
|
|
@@ -1950,7 +1965,7 @@ function loadGumlet() {
|
|
|
1950
1965
|
return;
|
|
1951
1966
|
}
|
|
1952
1967
|
|
|
1953
|
-
if (process.env.NODE_ENV ==
|
|
1968
|
+
if (process.env.NODE_ENV == "development") {
|
|
1954
1969
|
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1955
1970
|
}
|
|
1956
1971
|
|
|
@@ -1958,9 +1973,9 @@ function loadGumlet() {
|
|
|
1958
1973
|
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1959
1974
|
hosts: []
|
|
1960
1975
|
};
|
|
1961
|
-
var script = document.createElement(
|
|
1962
|
-
script.type =
|
|
1963
|
-
script.src =
|
|
1976
|
+
var script = document.createElement("script");
|
|
1977
|
+
script.type = "text/javascript";
|
|
1978
|
+
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
1964
1979
|
document.body.appendChild(script);
|
|
1965
1980
|
}
|
|
1966
1981
|
|
|
@@ -1973,15 +1988,40 @@ function GumletImage(props) {
|
|
|
1973
1988
|
reactTag = props.reactTag,
|
|
1974
1989
|
className = props.className;
|
|
1975
1990
|
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1991
|
+
|
|
1992
|
+
function generatePath(size) {
|
|
1993
|
+
return "//" + imageCDN + "/" + image.path(aspectRatio, Object.assign({
|
|
1994
|
+
w: size
|
|
1995
|
+
}, imgParams));
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
function generateSizes() {
|
|
1999
|
+
// return "(max-width: 600px) 100vw, (max-width: 900px) 50vw, (max-width: 1240px) 33vw, 11.13vw";
|
|
2000
|
+
var sizes = props.widths.map(function (size) {
|
|
2001
|
+
if (size === 250) {
|
|
2002
|
+
return "(max-width: 600px) 250px";
|
|
2003
|
+
} else if (size === 480) {
|
|
2004
|
+
return "(max-width: 900px) 480px";
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
return "640px";
|
|
2008
|
+
});
|
|
2009
|
+
return sizes.join(",");
|
|
2010
|
+
}
|
|
2011
|
+
|
|
1976
2012
|
var imageProps = {
|
|
1977
2013
|
src: emptyWebGif__default["default"],
|
|
1978
2014
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
2015
|
+
srcSet: props.widths ? props.widths.map(function (size) {
|
|
2016
|
+
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
2017
|
+
}).join(",") : undefined,
|
|
2018
|
+
sizes: generateSizes(),
|
|
1979
2019
|
key: hashString(slug)
|
|
1980
2020
|
};
|
|
1981
2021
|
var Tag = reactTag || "img";
|
|
1982
2022
|
React.useEffect(loadGumlet);
|
|
1983
2023
|
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) :
|
|
2024
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1985
2025
|
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1986
2026
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1987
2027
|
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
|
|
|
@@ -40,15 +40,40 @@ export function GumletImage(props) {
|
|
|
40
40
|
reactTag = props.reactTag,
|
|
41
41
|
className = props.className;
|
|
42
42
|
var image = new FocusedImage(slug, metadata);
|
|
43
|
+
|
|
44
|
+
function generatePath(size) {
|
|
45
|
+
return "//" + imageCDN + "/" + image.path(aspectRatio, Object.assign({
|
|
46
|
+
w: size
|
|
47
|
+
}, imgParams));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function generateSizes() {
|
|
51
|
+
// return "(max-width: 600px) 100vw, (max-width: 900px) 50vw, (max-width: 1240px) 33vw, 11.13vw";
|
|
52
|
+
var sizes = props.widths.map(function (size) {
|
|
53
|
+
if (size === 250) {
|
|
54
|
+
return "(max-width: 600px) 250px";
|
|
55
|
+
} else if (size === 480) {
|
|
56
|
+
return "(max-width: 900px) 480px";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return "640px";
|
|
60
|
+
});
|
|
61
|
+
return sizes.join(",");
|
|
62
|
+
}
|
|
63
|
+
|
|
43
64
|
var imageProps = {
|
|
44
65
|
src: emptyWebGif,
|
|
45
66
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
67
|
+
srcSet: props.widths ? props.widths.map(function (size) {
|
|
68
|
+
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
69
|
+
}).join(",") : undefined,
|
|
70
|
+
sizes: generateSizes(),
|
|
46
71
|
key: hashString(slug)
|
|
47
72
|
};
|
|
48
73
|
var Tag = reactTag || "img";
|
|
49
74
|
useEffect(loadGumlet);
|
|
50
75
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _extends({}, imageProps, omit(props, USED_PARAMS), {
|
|
51
|
-
className: className ? "qt-image ".concat(className) :
|
|
76
|
+
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
52
77
|
})), /*#__PURE__*/React.createElement("noscript", null, /*#__PURE__*/React.createElement("img", {
|
|
53
78
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread(_objectSpread({}, imgParams), {}, {
|
|
54
79
|
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,11 +23,26 @@ export function responsiveProps(props) {
|
|
|
23
23
|
}, props.imgParams));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function generateSizes() {
|
|
27
|
+
// return "(max-width: 600px) 100vw, (max-width: 900px) 50vw, (max-width: 1240px) 33vw, 11.13vw";
|
|
28
|
+
var sizes = props.widths.map(function (size) {
|
|
29
|
+
if (size === 250) {
|
|
30
|
+
return "(max-width: 600px) 250px";
|
|
31
|
+
} else if (size === 480) {
|
|
32
|
+
return "(max-width: 900px) 480px";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return "640px";
|
|
36
|
+
});
|
|
37
|
+
return sizes.join(",");
|
|
38
|
+
}
|
|
39
|
+
|
|
26
40
|
return {
|
|
27
41
|
src: generatePath(props.defaultWidth),
|
|
28
42
|
srcSet: props.widths ? props.widths.map(function (size) {
|
|
29
43
|
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
30
44
|
}).join(",") : undefined,
|
|
45
|
+
sizes: generateSizes(),
|
|
31
46
|
key: hashString(props.slug)
|
|
32
47
|
};
|
|
33
48
|
}
|
|
@@ -77,7 +92,7 @@ export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
77
92
|
ref: function ref(dom) {
|
|
78
93
|
return _this2.dom = dom;
|
|
79
94
|
},
|
|
80
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
95
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : "qt-image"
|
|
81
96
|
}));
|
|
82
97
|
}
|
|
83
98
|
}, {
|
package/package.json
CHANGED