@micromag/element-image 0.3.651 → 0.3.659
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/es/index.js +13 -13
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -57,14 +57,14 @@ var Image = function Image(_ref) {
|
|
|
57
57
|
shouldLoad = _ref.shouldLoad;
|
|
58
58
|
var _ref2 = media || {},
|
|
59
59
|
_ref2$metadata = _ref2.metadata,
|
|
60
|
-
metadata = _ref2$metadata ===
|
|
60
|
+
metadata = _ref2$metadata === void 0 ? null : _ref2$metadata;
|
|
61
61
|
var _ref3 = metadata || {},
|
|
62
62
|
_ref3$width = _ref3.width,
|
|
63
|
-
mediaWidth = _ref3$width ===
|
|
63
|
+
mediaWidth = _ref3$width === void 0 ? 0 : _ref3$width,
|
|
64
64
|
_ref3$height = _ref3.height,
|
|
65
|
-
mediaHeight = _ref3$height ===
|
|
65
|
+
mediaHeight = _ref3$height === void 0 ? 0 : _ref3$height,
|
|
66
66
|
_ref3$description = _ref3.description,
|
|
67
|
-
description = _ref3$description ===
|
|
67
|
+
description = _ref3$description === void 0 ? 'image' : _ref3$description;
|
|
68
68
|
var mediaRatio = mediaWidth / mediaHeight;
|
|
69
69
|
var _useState = useState({
|
|
70
70
|
width: mediaWidth,
|
|
@@ -73,9 +73,9 @@ var Image = function Image(_ref) {
|
|
|
73
73
|
_useState2 = _slicedToArray(_useState, 2),
|
|
74
74
|
_useState2$ = _useState2[0],
|
|
75
75
|
_useState2$$width = _useState2$.width,
|
|
76
|
-
realWidth = _useState2$$width ===
|
|
76
|
+
realWidth = _useState2$$width === void 0 ? 0 : _useState2$$width,
|
|
77
77
|
_useState2$$height = _useState2$.height,
|
|
78
|
-
realHeight = _useState2$$height ===
|
|
78
|
+
realHeight = _useState2$$height === void 0 ? 0 : _useState2$$height,
|
|
79
79
|
setRealSize = _useState2[1];
|
|
80
80
|
var wasLoadedRef = useRef(shouldLoad);
|
|
81
81
|
if (shouldLoad && !wasLoadedRef.current) {
|
|
@@ -85,9 +85,9 @@ var Image = function Image(_ref) {
|
|
|
85
85
|
var onImageLoaded = useCallback(function (e) {
|
|
86
86
|
var _e$target = e.target,
|
|
87
87
|
_e$target$naturalWidt = _e$target.naturalWidth,
|
|
88
|
-
naturalWidth = _e$target$naturalWidt ===
|
|
88
|
+
naturalWidth = _e$target$naturalWidt === void 0 ? 0 : _e$target$naturalWidt,
|
|
89
89
|
_e$target$naturalHeig = _e$target.naturalHeight,
|
|
90
|
-
naturalHeight = _e$target$naturalHeig ===
|
|
90
|
+
naturalHeight = _e$target$naturalHeig === void 0 ? 0 : _e$target$naturalHeig;
|
|
91
91
|
if (naturalWidth !== realWidth || naturalHeight !== realHeight) {
|
|
92
92
|
setRealSize({
|
|
93
93
|
width: naturalWidth || 0,
|
|
@@ -111,11 +111,11 @@ var Image = function Image(_ref) {
|
|
|
111
111
|
var imageObjectPosition = null;
|
|
112
112
|
var _ref4 = objectFit || {},
|
|
113
113
|
_ref4$fit = _ref4.fit,
|
|
114
|
-
fit = _ref4$fit ===
|
|
114
|
+
fit = _ref4$fit === void 0 ? null : _ref4$fit,
|
|
115
115
|
_ref4$horizontalPosit = _ref4.horizontalPosition,
|
|
116
|
-
horizontalPosition = _ref4$horizontalPosit ===
|
|
116
|
+
horizontalPosition = _ref4$horizontalPosit === void 0 ? 'center' : _ref4$horizontalPosit,
|
|
117
117
|
_ref4$verticalPositio = _ref4.verticalPosition,
|
|
118
|
-
verticalPosition = _ref4$verticalPositio ===
|
|
118
|
+
verticalPosition = _ref4$verticalPositio === void 0 ? 'center' : _ref4$verticalPositio;
|
|
119
119
|
if (mediaHasSize) {
|
|
120
120
|
var _getSizeWithinBounds = getSizeWithinBounds(realWidth, realHeight, width, height, {
|
|
121
121
|
cover: fit === 'cover'
|
|
@@ -172,9 +172,9 @@ var Image = function Image(_ref) {
|
|
|
172
172
|
finalImageStyle = _objectSpread(_objectSpread({}, finalImageStyle), imageStyle);
|
|
173
173
|
var _finalImageStyle = finalImageStyle,
|
|
174
174
|
_finalImageStyle$widt = _finalImageStyle.width,
|
|
175
|
-
finalWidth = _finalImageStyle$widt ===
|
|
175
|
+
finalWidth = _finalImageStyle$widt === void 0 ? null : _finalImageStyle$widt,
|
|
176
176
|
_finalImageStyle$heig = _finalImageStyle.height,
|
|
177
|
-
finalHeight = _finalImageStyle$heig ===
|
|
177
|
+
finalHeight = _finalImageStyle$heig === void 0 ? null : _finalImageStyle$heig;
|
|
178
178
|
var finalUrl = getOptimalImageUrl(media, finalWidth, finalHeight || finalWidth, {
|
|
179
179
|
resolution: resolution
|
|
180
180
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-image",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.659",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@babel/runtime": "^7.13.10",
|
|
62
62
|
"@folklore/size": "^0.1.20",
|
|
63
|
-
"@micromag/core": "^0.3.
|
|
63
|
+
"@micromag/core": "^0.3.659",
|
|
64
64
|
"classnames": "^2.2.6",
|
|
65
65
|
"prop-types": "^15.7.2",
|
|
66
66
|
"react-intl": "^6.6.4",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"access": "public",
|
|
71
71
|
"registry": "https://registry.npmjs.org/"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "7c13dad69a7e377cd2f900d95cb95694a3a8fcbb"
|
|
74
74
|
}
|