@micromag/element-background 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 +4 -1
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import React, { useRef, useMemo } from 'react';
|
|
|
7
7
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
8
8
|
import { getStyleFromColor, getOptimalImageUrl, getLayersFromBackground } from '@micromag/core/utils';
|
|
9
9
|
import { getSizeWithinBounds } from '@folklore/size';
|
|
10
|
+
import { useSupportsWebp } from '@micromag/core/hooks';
|
|
10
11
|
import Video from '@micromag/element-video';
|
|
11
12
|
|
|
12
13
|
var styles = {"layers":"micromag-element-background-layers","layer":"micromag-element-background-layer","videoContainer":"micromag-element-background-videoContainer","video":"micromag-element-background-video","container":"micromag-element-background-container","right":"micromag-element-background-right","background":"micromag-element-background-background","bottom":"micromag-element-background-bottom"};
|
|
@@ -109,13 +110,15 @@ var Background = function Background(_ref) {
|
|
|
109
110
|
width: width,
|
|
110
111
|
height: height
|
|
111
112
|
}, getStyleFromColor(color));
|
|
113
|
+
var supportsWebp = useSupportsWebp();
|
|
112
114
|
|
|
113
115
|
// image
|
|
114
116
|
if (media !== null && (isImage || isVideo && (!shouldLoad || withoutVideo))) {
|
|
115
117
|
var finalUrl = getOptimalImageUrl(isVideo ? {
|
|
116
118
|
url: mediaThumbnailUrl
|
|
117
119
|
} : media, width, height, {
|
|
118
|
-
resolution: resolution
|
|
120
|
+
resolution: resolution,
|
|
121
|
+
supportsWebp: supportsWebp
|
|
119
122
|
});
|
|
120
123
|
containerStyle.backgroundImage = finalUrl !== null && finalShouldLoad ? "url(\"".concat(finalUrl, "\")") : null;
|
|
121
124
|
containerStyle.backgroundRepeat = repeat && !isVideo ? 'repeat' : 'no-repeat';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-background",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.811",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@babel/runtime": "^7.13.10",
|
|
60
60
|
"@folklore/size": "^0.1.20",
|
|
61
|
-
"@micromag/core": "^0.3.
|
|
62
|
-
"@micromag/element-video": "^0.3.
|
|
61
|
+
"@micromag/core": "^0.3.811",
|
|
62
|
+
"@micromag/element-video": "^0.3.811",
|
|
63
63
|
"classnames": "^2.2.6",
|
|
64
64
|
"lodash": "^4.17.21",
|
|
65
65
|
"prop-types": "^15.7.2",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"access": "public",
|
|
71
71
|
"registry": "https://registry.npmjs.org/"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "80a754e5a50e86fa1e195015112ea0ff39008da8"
|
|
74
74
|
}
|