@micromag/element-image 0.3.807 → 0.3.811
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 +7 -1
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import classNames from 'classnames';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import React, { forwardRef, useState, useRef, useCallback } from 'react';
|
|
8
8
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
9
|
+
import { useSupportsWebp } from '@micromag/core/hooks';
|
|
9
10
|
import { getOptimalImageUrl } from '@micromag/core/utils';
|
|
10
11
|
|
|
11
12
|
var styles = {"container":"micromag-element-image-container","img":"micromag-element-image-img"};
|
|
@@ -175,13 +176,18 @@ var Image = function Image(_ref) {
|
|
|
175
176
|
}
|
|
176
177
|
finalContainerStyle = _objectSpread(_objectSpread({}, finalContainerStyle), containerStyle);
|
|
177
178
|
finalImageStyle = _objectSpread(_objectSpread({}, finalImageStyle), imageStyle);
|
|
179
|
+
var supportsWebp = useSupportsWebp();
|
|
180
|
+
console.log({
|
|
181
|
+
supportsWebp: supportsWebp
|
|
182
|
+
});
|
|
178
183
|
var _finalImageStyle = finalImageStyle,
|
|
179
184
|
_finalImageStyle$widt = _finalImageStyle.width,
|
|
180
185
|
finalWidth = _finalImageStyle$widt === void 0 ? null : _finalImageStyle$widt,
|
|
181
186
|
_finalImageStyle$heig = _finalImageStyle.height,
|
|
182
187
|
finalHeight = _finalImageStyle$heig === void 0 ? null : _finalImageStyle$heig;
|
|
183
188
|
var finalUrl = getOptimalImageUrl(media, finalWidth, finalHeight || finalWidth, {
|
|
184
|
-
resolution: resolution
|
|
189
|
+
resolution: resolution,
|
|
190
|
+
supportsWebp: supportsWebp
|
|
185
191
|
});
|
|
186
192
|
|
|
187
193
|
// console.log('image finalWidth, finalHeight, resolution', finalImageStyle, resolution, finalUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-image",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.811",
|
|
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.811",
|
|
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": "80a754e5a50e86fa1e195015112ea0ff39008da8"
|
|
74
74
|
}
|