@micromag/element-visual 0.3.311 → 0.3.318

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.
@@ -1 +1 @@
1
- .micromag-element-visual-container{position:relative;overflow:hidden}.micromag-element-visual-container .micromag-element-visual-videoContainer{position:absolute;overflow:hidden}
1
+ .micromag-element-visual-container{overflow:hidden;position:relative}.micromag-element-visual-container .micromag-element-visual-videoContainer{overflow:hidden;position:absolute}
package/es/index.js CHANGED
@@ -51,34 +51,31 @@ var defaultProps = {
51
51
  imageClassName: null,
52
52
  videoClassName: null
53
53
  };
54
-
55
54
  var Visual = function Visual(_ref) {
56
55
  var media = _ref.media,
57
- mediaRef = _ref.mediaRef,
58
- width = _ref.width,
59
- height = _ref.height,
60
- resolution = _ref.resolution,
61
- objectFit = _ref.objectFit,
62
- playing = _ref.playing,
63
- muted = _ref.muted,
64
- shouldLoad = _ref.shouldLoad,
65
- videoLoop = _ref.videoLoop;
66
- _ref.videoInitialMuted;
67
- var onParentLoaded = _ref.onLoaded,
68
- className = _ref.className,
69
- imageClassName = _ref.imageClassName,
70
- videoClassName = _ref.videoClassName,
71
- withoutVideo = _ref.withoutVideo,
72
- props = _objectWithoutProperties(_ref, _excluded);
73
-
56
+ mediaRef = _ref.mediaRef,
57
+ width = _ref.width,
58
+ height = _ref.height,
59
+ resolution = _ref.resolution,
60
+ objectFit = _ref.objectFit,
61
+ playing = _ref.playing,
62
+ muted = _ref.muted,
63
+ shouldLoad = _ref.shouldLoad,
64
+ videoLoop = _ref.videoLoop;
65
+ _ref.videoInitialMuted;
66
+ var onParentLoaded = _ref.onLoaded,
67
+ className = _ref.className,
68
+ imageClassName = _ref.imageClassName,
69
+ videoClassName = _ref.videoClassName,
70
+ withoutVideo = _ref.withoutVideo,
71
+ props = _objectWithoutProperties(_ref, _excluded);
74
72
  var _ref2 = media || {},
75
- _ref2$type = _ref2.type,
76
- type = _ref2$type === void 0 ? null : _ref2$type,
77
- _ref2$thumbnail_url = _ref2.thumbnail_url,
78
- thumbnailUrl = _ref2$thumbnail_url === void 0 ? null : _ref2$thumbnail_url,
79
- _ref2$url = _ref2.url,
80
- url = _ref2$url === void 0 ? null : _ref2$url;
81
-
73
+ _ref2$type = _ref2.type,
74
+ type = _ref2$type === void 0 ? null : _ref2$type,
75
+ _ref2$thumbnail_url = _ref2.thumbnail_url,
76
+ thumbnailUrl = _ref2$thumbnail_url === void 0 ? null : _ref2$thumbnail_url,
77
+ _ref2$url = _ref2.url,
78
+ url = _ref2$url === void 0 ? null : _ref2$url;
82
79
  var isVideo = type === 'video';
83
80
  var elProps = useMemo(function () {
84
81
  return _objectSpread(_objectSpread({}, props), {}, {
@@ -98,28 +95,23 @@ var Visual = function Visual(_ref) {
98
95
  }) : tmpProps;
99
96
  }, [isVideo, elProps, thumbnailUrl, url, shouldLoad]);
100
97
  var videoContainerStyle = null;
101
-
102
98
  if (type === 'video' && objectFit !== null && shouldLoad) {
103
99
  var _ref3 = objectFit || {},
104
- _ref3$fit = _ref3.fit,
105
- fit = _ref3$fit === void 0 ? 'cover' : _ref3$fit;
106
-
100
+ _ref3$fit = _ref3.fit,
101
+ fit = _ref3$fit === void 0 ? 'cover' : _ref3$fit;
107
102
  var _ref4 = media || {},
108
- _ref4$metadata = _ref4.metadata,
109
- videoMetadata = _ref4$metadata === void 0 ? null : _ref4$metadata;
110
-
103
+ _ref4$metadata = _ref4.metadata,
104
+ videoMetadata = _ref4$metadata === void 0 ? null : _ref4$metadata;
111
105
  var _ref5 = videoMetadata || {},
112
- _ref5$width = _ref5.width,
113
- videoWidth = _ref5$width === void 0 ? 0 : _ref5$width,
114
- _ref5$height = _ref5.height,
115
- videoHeight = _ref5$height === void 0 ? 0 : _ref5$height;
116
-
106
+ _ref5$width = _ref5.width,
107
+ videoWidth = _ref5$width === void 0 ? 0 : _ref5$width,
108
+ _ref5$height = _ref5.height,
109
+ videoHeight = _ref5$height === void 0 ? 0 : _ref5$height;
117
110
  var _getSizeWithinBounds = getSizeWithinBounds(videoWidth, videoHeight, width, height, {
118
- cover: fit === 'cover'
119
- }),
120
- resizedVideoWidth = _getSizeWithinBounds.width,
121
- resizedVideoHeight = _getSizeWithinBounds.height;
122
-
111
+ cover: fit === 'cover'
112
+ }),
113
+ resizedVideoWidth = _getSizeWithinBounds.width,
114
+ resizedVideoHeight = _getSizeWithinBounds.height;
123
115
  var resizedVideoLeft = -(resizedVideoWidth - width) / 2;
124
116
  var resizedVideoTop = -(resizedVideoHeight - height) / 2;
125
117
  videoContainerStyle = {
@@ -129,7 +121,6 @@ var Visual = function Visual(_ref) {
129
121
  top: resizedVideoTop
130
122
  };
131
123
  }
132
-
133
124
  var onLoaded = useCallback(function (e) {
134
125
  if (onParentLoaded !== null) {
135
126
  onParentLoaded(e);
@@ -165,7 +156,6 @@ var Visual = function Visual(_ref) {
165
156
  autoPlay: true
166
157
  })))) : null) : null;
167
158
  };
168
-
169
159
  Visual.propTypes = propTypes;
170
160
  Visual.defaultProps = defaultProps;
171
161
 
package/lib/index.js CHANGED
@@ -64,34 +64,31 @@ var defaultProps = {
64
64
  imageClassName: null,
65
65
  videoClassName: null
66
66
  };
67
-
68
67
  var Visual = function Visual(_ref) {
69
68
  var media = _ref.media,
70
- mediaRef = _ref.mediaRef,
71
- width = _ref.width,
72
- height = _ref.height,
73
- resolution = _ref.resolution,
74
- objectFit = _ref.objectFit,
75
- playing = _ref.playing,
76
- muted = _ref.muted,
77
- shouldLoad = _ref.shouldLoad,
78
- videoLoop = _ref.videoLoop;
79
- _ref.videoInitialMuted;
80
- var onParentLoaded = _ref.onLoaded,
81
- className = _ref.className,
82
- imageClassName = _ref.imageClassName,
83
- videoClassName = _ref.videoClassName,
84
- withoutVideo = _ref.withoutVideo,
85
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
86
-
69
+ mediaRef = _ref.mediaRef,
70
+ width = _ref.width,
71
+ height = _ref.height,
72
+ resolution = _ref.resolution,
73
+ objectFit = _ref.objectFit,
74
+ playing = _ref.playing,
75
+ muted = _ref.muted,
76
+ shouldLoad = _ref.shouldLoad,
77
+ videoLoop = _ref.videoLoop;
78
+ _ref.videoInitialMuted;
79
+ var onParentLoaded = _ref.onLoaded,
80
+ className = _ref.className,
81
+ imageClassName = _ref.imageClassName,
82
+ videoClassName = _ref.videoClassName,
83
+ withoutVideo = _ref.withoutVideo,
84
+ props = _objectWithoutProperties__default["default"](_ref, _excluded);
87
85
  var _ref2 = media || {},
88
- _ref2$type = _ref2.type,
89
- type = _ref2$type === void 0 ? null : _ref2$type,
90
- _ref2$thumbnail_url = _ref2.thumbnail_url,
91
- thumbnailUrl = _ref2$thumbnail_url === void 0 ? null : _ref2$thumbnail_url,
92
- _ref2$url = _ref2.url,
93
- url = _ref2$url === void 0 ? null : _ref2$url;
94
-
86
+ _ref2$type = _ref2.type,
87
+ type = _ref2$type === void 0 ? null : _ref2$type,
88
+ _ref2$thumbnail_url = _ref2.thumbnail_url,
89
+ thumbnailUrl = _ref2$thumbnail_url === void 0 ? null : _ref2$thumbnail_url,
90
+ _ref2$url = _ref2.url,
91
+ url = _ref2$url === void 0 ? null : _ref2$url;
95
92
  var isVideo = type === 'video';
96
93
  var elProps = React.useMemo(function () {
97
94
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, props), {}, {
@@ -111,28 +108,23 @@ var Visual = function Visual(_ref) {
111
108
  }) : tmpProps;
112
109
  }, [isVideo, elProps, thumbnailUrl, url, shouldLoad]);
113
110
  var videoContainerStyle = null;
114
-
115
111
  if (type === 'video' && objectFit !== null && shouldLoad) {
116
112
  var _ref3 = objectFit || {},
117
- _ref3$fit = _ref3.fit,
118
- fit = _ref3$fit === void 0 ? 'cover' : _ref3$fit;
119
-
113
+ _ref3$fit = _ref3.fit,
114
+ fit = _ref3$fit === void 0 ? 'cover' : _ref3$fit;
120
115
  var _ref4 = media || {},
121
- _ref4$metadata = _ref4.metadata,
122
- videoMetadata = _ref4$metadata === void 0 ? null : _ref4$metadata;
123
-
116
+ _ref4$metadata = _ref4.metadata,
117
+ videoMetadata = _ref4$metadata === void 0 ? null : _ref4$metadata;
124
118
  var _ref5 = videoMetadata || {},
125
- _ref5$width = _ref5.width,
126
- videoWidth = _ref5$width === void 0 ? 0 : _ref5$width,
127
- _ref5$height = _ref5.height,
128
- videoHeight = _ref5$height === void 0 ? 0 : _ref5$height;
129
-
119
+ _ref5$width = _ref5.width,
120
+ videoWidth = _ref5$width === void 0 ? 0 : _ref5$width,
121
+ _ref5$height = _ref5.height,
122
+ videoHeight = _ref5$height === void 0 ? 0 : _ref5$height;
130
123
  var _getSizeWithinBounds = size.getSizeWithinBounds(videoWidth, videoHeight, width, height, {
131
- cover: fit === 'cover'
132
- }),
133
- resizedVideoWidth = _getSizeWithinBounds.width,
134
- resizedVideoHeight = _getSizeWithinBounds.height;
135
-
124
+ cover: fit === 'cover'
125
+ }),
126
+ resizedVideoWidth = _getSizeWithinBounds.width,
127
+ resizedVideoHeight = _getSizeWithinBounds.height;
136
128
  var resizedVideoLeft = -(resizedVideoWidth - width) / 2;
137
129
  var resizedVideoTop = -(resizedVideoHeight - height) / 2;
138
130
  videoContainerStyle = {
@@ -142,7 +134,6 @@ var Visual = function Visual(_ref) {
142
134
  top: resizedVideoTop
143
135
  };
144
136
  }
145
-
146
137
  var onLoaded = React.useCallback(function (e) {
147
138
  if (onParentLoaded !== null) {
148
139
  onParentLoaded(e);
@@ -178,7 +169,6 @@ var Visual = function Visual(_ref) {
178
169
  autoPlay: true
179
170
  })))) : null) : null;
180
171
  };
181
-
182
172
  Visual.propTypes = propTypes;
183
173
  Visual.defaultProps = defaultProps;
184
174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-visual",
3
- "version": "0.3.311",
3
+ "version": "0.3.318",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -50,15 +50,15 @@
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.13.10",
52
52
  "@folklore/size": "^0.1.20",
53
- "@micromag/core": "^0.3.311",
54
- "@micromag/element-image": "^0.3.311",
55
- "@micromag/element-video": "^0.3.311",
53
+ "@micromag/core": "^0.3.318",
54
+ "@micromag/element-image": "^0.3.318",
55
+ "@micromag/element-video": "^0.3.318",
56
56
  "classnames": "^2.2.6",
57
57
  "prop-types": "^15.7.2",
58
- "uuid": "^8.3.2"
58
+ "uuid": "^9.0.0"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "fab297a7ad204611597c749b969f14d992d35d47"
63
+ "gitHead": "7d1a296e0c0d410e1225279e1f19e3a7715bfa96"
64
64
  }