@micromag/element-background 0.3.66 → 0.3.69

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 CHANGED
@@ -14,6 +14,7 @@ var styles = {"container":"micromag-element-background-container","layer":"micro
14
14
  var propTypes$1 = {
15
15
  width: PropTypes.number,
16
16
  height: PropTypes.number,
17
+ resolution: PropTypes.number,
17
18
  fit: PropTypes.oneOf(['contain', 'cover']),
18
19
  horizontalAlign: PropTypes.string,
19
20
  verticalAlign: PropTypes.string,
@@ -29,6 +30,7 @@ var propTypes$1 = {
29
30
  var defaultProps$1 = {
30
31
  width: null,
31
32
  height: null,
33
+ resolution: 1,
32
34
  fit: null,
33
35
  horizontalAlign: 'center',
34
36
  verticalAlign: 'center',
@@ -45,6 +47,7 @@ var defaultProps$1 = {
45
47
  var Background = function Background(_ref) {
46
48
  var width = _ref.width,
47
49
  height = _ref.height,
50
+ resolution = _ref.resolution,
48
51
  fit = _ref.fit,
49
52
  horizontalAlign = _ref.horizontalAlign,
50
53
  verticalAlign = _ref.verticalAlign,
@@ -91,7 +94,9 @@ var Background = function Background(_ref) {
91
94
  if (media !== null && (isImage || isVideo && !playing)) {
92
95
  var finalUrl = getOptimalImageUrl(isVideo ? {
93
96
  url: mediaThumbnailUrl
94
- } : media, width, height);
97
+ } : media, width, height, {
98
+ resolution: resolution
99
+ });
95
100
  containerStyle.backgroundImage = finalUrl !== null && finalShouldLoad ? "url(\"".concat(finalUrl, "\")") : null;
96
101
  containerStyle.backgroundRepeat = repeat && !isVideo ? 'repeat' : 'no-repeat';
97
102
  containerStyle.backgroundPosition = [horizontalAlign, verticalAlign].join(' ');
@@ -150,6 +155,7 @@ var _excluded = ["horizontalAlign", "verticalAlign"];
150
155
  var propTypes = {
151
156
  width: PropTypes.number,
152
157
  height: PropTypes.number,
158
+ resolution: PropTypes.number,
153
159
  background: PropTypes.oneOfType([PropTypes$1.backgroundElement, PropTypes.arrayOf(PropTypes$1.backgroundElement)]),
154
160
  playing: PropTypes.bool,
155
161
  children: PropTypes.node,
@@ -162,6 +168,7 @@ var propTypes = {
162
168
  var defaultProps = {
163
169
  width: null,
164
170
  height: null,
171
+ resolution: 1,
165
172
  background: [],
166
173
  playing: false,
167
174
  children: null,
@@ -175,6 +182,7 @@ var defaultProps = {
175
182
  var BackgroundLayers = function BackgroundLayers(_ref) {
176
183
  var width = _ref.width,
177
184
  height = _ref.height,
185
+ resolution = _ref.resolution,
178
186
  background = _ref.background,
179
187
  playing = _ref.playing,
180
188
  children = _ref.children,
@@ -217,6 +225,7 @@ var BackgroundLayers = function BackgroundLayers(_ref) {
217
225
  }, /*#__PURE__*/React.createElement(Background, Object.assign({
218
226
  width: width,
219
227
  height: height,
228
+ resolution: resolution,
220
229
  className: classNames([styles.background, _defineProperty({}, backgroundClassName, backgroundClassName !== null)]),
221
230
  playing: playing,
222
231
  horizontalAlign: horizontalAlign,
package/lib/index.js CHANGED
@@ -28,6 +28,7 @@ var styles = {"container":"micromag-element-background-container","layer":"micro
28
28
  var propTypes$1 = {
29
29
  width: PropTypes__default["default"].number,
30
30
  height: PropTypes__default["default"].number,
31
+ resolution: PropTypes__default["default"].number,
31
32
  fit: PropTypes__default["default"].oneOf(['contain', 'cover']),
32
33
  horizontalAlign: PropTypes__default["default"].string,
33
34
  verticalAlign: PropTypes__default["default"].string,
@@ -43,6 +44,7 @@ var propTypes$1 = {
43
44
  var defaultProps$1 = {
44
45
  width: null,
45
46
  height: null,
47
+ resolution: 1,
46
48
  fit: null,
47
49
  horizontalAlign: 'center',
48
50
  verticalAlign: 'center',
@@ -59,6 +61,7 @@ var defaultProps$1 = {
59
61
  var Background = function Background(_ref) {
60
62
  var width = _ref.width,
61
63
  height = _ref.height,
64
+ resolution = _ref.resolution,
62
65
  fit = _ref.fit,
63
66
  horizontalAlign = _ref.horizontalAlign,
64
67
  verticalAlign = _ref.verticalAlign,
@@ -105,7 +108,9 @@ var Background = function Background(_ref) {
105
108
  if (media !== null && (isImage || isVideo && !playing)) {
106
109
  var finalUrl = utils.getOptimalImageUrl(isVideo ? {
107
110
  url: mediaThumbnailUrl
108
- } : media, width, height);
111
+ } : media, width, height, {
112
+ resolution: resolution
113
+ });
109
114
  containerStyle.backgroundImage = finalUrl !== null && finalShouldLoad ? "url(\"".concat(finalUrl, "\")") : null;
110
115
  containerStyle.backgroundRepeat = repeat && !isVideo ? 'repeat' : 'no-repeat';
111
116
  containerStyle.backgroundPosition = [horizontalAlign, verticalAlign].join(' ');
@@ -164,6 +169,7 @@ var _excluded = ["horizontalAlign", "verticalAlign"];
164
169
  var propTypes = {
165
170
  width: PropTypes__default["default"].number,
166
171
  height: PropTypes__default["default"].number,
172
+ resolution: PropTypes__default["default"].number,
167
173
  background: PropTypes__default["default"].oneOfType([core.PropTypes.backgroundElement, PropTypes__default["default"].arrayOf(core.PropTypes.backgroundElement)]),
168
174
  playing: PropTypes__default["default"].bool,
169
175
  children: PropTypes__default["default"].node,
@@ -176,6 +182,7 @@ var propTypes = {
176
182
  var defaultProps = {
177
183
  width: null,
178
184
  height: null,
185
+ resolution: 1,
179
186
  background: [],
180
187
  playing: false,
181
188
  children: null,
@@ -189,6 +196,7 @@ var defaultProps = {
189
196
  var BackgroundLayers = function BackgroundLayers(_ref) {
190
197
  var width = _ref.width,
191
198
  height = _ref.height,
199
+ resolution = _ref.resolution,
192
200
  background = _ref.background,
193
201
  playing = _ref.playing,
194
202
  children = _ref.children,
@@ -231,6 +239,7 @@ var BackgroundLayers = function BackgroundLayers(_ref) {
231
239
  }, /*#__PURE__*/React__default["default"].createElement(Background, Object.assign({
232
240
  width: width,
233
241
  height: height,
242
+ resolution: resolution,
234
243
  className: classNames__default["default"]([styles.background, _defineProperty__default["default"]({}, backgroundClassName, backgroundClassName !== null)]),
235
244
  playing: playing,
236
245
  horizontalAlign: horizontalAlign,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-background",
3
- "version": "0.3.66",
3
+ "version": "0.3.69",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -48,8 +48,8 @@
48
48
  "dependencies": {
49
49
  "@babel/runtime": "^7.13.10",
50
50
  "@folklore/size": "^0.1.20",
51
- "@micromag/core": "^0.3.66",
52
- "@micromag/element-video": "^0.3.66",
51
+ "@micromag/core": "^0.3.69",
52
+ "@micromag/element-video": "^0.3.69",
53
53
  "classnames": "^2.2.6",
54
54
  "lodash": "^4.17.21",
55
55
  "prop-types": "^15.7.2",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "264bfc8506d254073e1d55ffb9d8dd97e5b78c0b"
62
+ "gitHead": "c69c85dbe321ddcd2d57f5d972b456ab76b5da3e"
63
63
  }