@micromag/element-background 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.
- package/es/index.js +4 -3
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -7,7 +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 {
|
|
10
|
+
import { useSetting } from '@micromag/core/contexts';
|
|
11
11
|
import Video from '@micromag/element-video';
|
|
12
12
|
|
|
13
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"};
|
|
@@ -110,14 +110,15 @@ var Background = function Background(_ref) {
|
|
|
110
110
|
width: width,
|
|
111
111
|
height: height
|
|
112
112
|
}, getStyleFromColor(color));
|
|
113
|
-
var supportsWebp =
|
|
113
|
+
var supportsWebp = useSetting('supportsWebp', false);
|
|
114
|
+
var imageResolution = useSetting('imageResolution', resolution);
|
|
114
115
|
|
|
115
116
|
// image
|
|
116
117
|
if (media !== null && (isImage || isVideo && (!shouldLoad || withoutVideo))) {
|
|
117
118
|
var finalUrl = getOptimalImageUrl(isVideo ? {
|
|
118
119
|
url: mediaThumbnailUrl
|
|
119
120
|
} : media, width, height, {
|
|
120
|
-
resolution:
|
|
121
|
+
resolution: imageResolution,
|
|
121
122
|
supportsWebp: supportsWebp
|
|
122
123
|
});
|
|
123
124
|
containerStyle.backgroundImage = finalUrl !== null && finalShouldLoad ? "url(\"".concat(finalUrl, "\")") : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-background",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.814",
|
|
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.814",
|
|
62
|
+
"@micromag/element-video": "^0.3.814",
|
|
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": "96d19c8ede8dc2e8c051ba118975258e061a8da2"
|
|
74
74
|
}
|