@micromag/element-image 0.3.812 → 0.3.814

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.
Files changed (2) hide show
  1. package/es/index.js +4 -6
  2. package/package.json +3 -3
package/es/index.js CHANGED
@@ -6,7 +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
+ import { useSetting } from '@micromag/core/contexts';
10
10
  import { getOptimalImageUrl } from '@micromag/core/utils';
11
11
 
12
12
  var styles = {"container":"micromag-element-image-container","img":"micromag-element-image-img"};
@@ -83,6 +83,8 @@ var Image = function Image(_ref) {
83
83
  _useState2$$height = _useState2$.height,
84
84
  realHeight = _useState2$$height === void 0 ? 0 : _useState2$$height,
85
85
  setRealSize = _useState2[1];
86
+ var supportsWebp = useSetting('supportsWebp', false);
87
+ var imageResolution = useSetting('imageResolution', resolution);
86
88
  var wasLoadedRef = useRef(shouldLoad);
87
89
  if (shouldLoad && !wasLoadedRef.current) {
88
90
  wasLoadedRef.current = shouldLoad;
@@ -176,17 +178,13 @@ var Image = function Image(_ref) {
176
178
  }
177
179
  finalContainerStyle = _objectSpread(_objectSpread({}, finalContainerStyle), containerStyle);
178
180
  finalImageStyle = _objectSpread(_objectSpread({}, finalImageStyle), imageStyle);
179
- var supportsWebp = useSupportsWebp();
180
- console.log({
181
- supportsWebp: supportsWebp
182
- });
183
181
  var _finalImageStyle = finalImageStyle,
184
182
  _finalImageStyle$widt = _finalImageStyle.width,
185
183
  finalWidth = _finalImageStyle$widt === void 0 ? null : _finalImageStyle$widt,
186
184
  _finalImageStyle$heig = _finalImageStyle.height,
187
185
  finalHeight = _finalImageStyle$heig === void 0 ? null : _finalImageStyle$heig;
188
186
  var finalUrl = getOptimalImageUrl(media, finalWidth, finalHeight || finalWidth, {
189
- resolution: resolution,
187
+ resolution: imageResolution,
190
188
  supportsWebp: supportsWebp
191
189
  });
192
190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-image",
3
- "version": "0.3.812",
3
+ "version": "0.3.814",
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.812",
63
+ "@micromag/core": "^0.3.814",
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": "34ea72adfaffec7c33e328b9c46301cd18cbde83"
73
+ "gitHead": "96d19c8ede8dc2e8c051ba118975258e061a8da2"
74
74
  }