@micromag/element-background 0.2.333 → 0.2.335
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 +9 -7
- package/lib/index.js +8 -6
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
@@ -77,12 +77,14 @@ var Background = function Background(_ref) {
|
|
|
77
77
|
imageMIME = _ref4.mime;
|
|
78
78
|
|
|
79
79
|
var isImageGIF = imageMIME === 'image/gif';
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
var finalImage = useMemo(function () {
|
|
81
|
+
var tmpImage = isImageGIF ? {
|
|
82
|
+
url: playing ? imageUrl : imageThumbnailUrl
|
|
83
|
+
} : image;
|
|
84
|
+
return hasVideo && !playing && videoThumbnail !== null ? {
|
|
85
|
+
url: videoThumbnail
|
|
86
|
+
} : tmpImage;
|
|
87
|
+
}, [isImageGIF, playing, imageUrl, imageThumbnailUrl, image, hasVideo, videoThumbnail]); // image
|
|
86
88
|
|
|
87
89
|
if (finalImage !== null && (!hasVideo || !playing)) {
|
|
88
90
|
var finalUrl = getOptimalImageUrl(finalImage, width, height);
|
package/lib/index.js
CHANGED
|
@@ -88,12 +88,14 @@ var Background = function Background(_ref) {
|
|
|
88
88
|
imageMIME = _ref4.mime;
|
|
89
89
|
|
|
90
90
|
var isImageGIF = imageMIME === 'image/gif';
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
var finalImage = React.useMemo(function () {
|
|
92
|
+
var tmpImage = isImageGIF ? {
|
|
93
|
+
url: playing ? imageUrl : imageThumbnailUrl
|
|
94
|
+
} : image;
|
|
95
|
+
return hasVideo && !playing && videoThumbnail !== null ? {
|
|
96
|
+
url: videoThumbnail
|
|
97
|
+
} : tmpImage;
|
|
98
|
+
}, [isImageGIF, playing, imageUrl, imageThumbnailUrl, image, hasVideo, videoThumbnail]); // image
|
|
97
99
|
|
|
98
100
|
if (finalImage !== null && (!hasVideo || !playing)) {
|
|
99
101
|
var finalUrl = utils.getOptimalImageUrl(finalImage, width, height);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-background",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.335",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "18c0cdcdefbb844eff89561822c471514f017c54"
|
|
63
63
|
}
|