@micromag/element-background 0.4.49 → 0.4.50

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.
Files changed (2) hide show
  1. package/es/index.js +67 -60
  2. package/package.json +4 -4
package/es/index.js CHANGED
@@ -2,11 +2,12 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
3
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
4
  import classNames from 'classnames';
5
- import React, { useRef, useMemo } from 'react';
5
+ import { useRef, useMemo } from 'react';
6
6
  import { getStyleFromColor, getOptimalImageUrl, getLayersFromBackground } from '@micromag/core/utils';
7
7
  import { getSizeWithinBounds } from '@folklore/size';
8
8
  import { useSetting } from '@micromag/core/contexts';
9
9
  import Video from '@micromag/element-video';
10
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
11
 
11
12
  var styles = {"container":"micromag-element-background-container","videoContainer":"micromag-element-background-videoContainer","video":"micromag-element-background-video","layers":"micromag-element-background-layers","layer":"micromag-element-background-layer","right":"micromag-element-background-right","background":"micromag-element-background-background","bottom":"micromag-element-background-bottom"};
12
13
 
@@ -120,30 +121,33 @@ function Background(_ref) {
120
121
  videoContainerStyle.objectFit = 'cover';
121
122
  }
122
123
  }
123
- return /*#__PURE__*/React.createElement("div", {
124
+ return /*#__PURE__*/jsxs("div", {
124
125
  className: classNames([styles.container, className]),
125
- style: containerStyle
126
- }, isVideo && shouldLoad && !withoutVideo ? /*#__PURE__*/React.createElement("div", {
127
- className: styles.videoContainer,
128
- style: videoContainerStyle
129
- }, /*#__PURE__*/React.createElement(Video, {
130
- className: styles.video,
131
- media: media,
132
- mediaRef: !forceMuted ? mediaRef : null,
133
- paused: !playing,
134
- muted: muted || forceMuted,
135
- shouldLoad: shouldLoad,
136
- onPlayError: onPlayError,
137
- disablePictureInPicture: true,
138
- autoPlay: true,
139
- loop: true,
140
- withPoster: true,
141
- focusable: false,
142
- qualityStartLevel: qualityStartLevel,
143
- onQualityLevelChange: onQualityLevelChange
144
- })) : null, /*#__PURE__*/React.createElement("div", {
145
- className: styles.content
146
- }, children));
126
+ style: containerStyle,
127
+ children: [isVideo && shouldLoad && !withoutVideo ? /*#__PURE__*/jsx("div", {
128
+ className: styles.videoContainer,
129
+ style: videoContainerStyle,
130
+ children: /*#__PURE__*/jsx(Video, {
131
+ className: styles.video,
132
+ media: media,
133
+ mediaRef: !forceMuted ? mediaRef : null,
134
+ paused: !playing,
135
+ muted: muted || forceMuted,
136
+ shouldLoad: shouldLoad,
137
+ onPlayError: onPlayError,
138
+ disablePictureInPicture: true,
139
+ autoPlay: true,
140
+ loop: true,
141
+ withPoster: true,
142
+ focusable: false,
143
+ qualityStartLevel: qualityStartLevel,
144
+ onQualityLevelChange: onQualityLevelChange
145
+ })
146
+ }) : null, /*#__PURE__*/jsx("div", {
147
+ className: styles.content,
148
+ children: children
149
+ })]
150
+ });
147
151
  }
148
152
 
149
153
  var _excluded = ["horizontalAlign", "verticalAlign"];
@@ -196,43 +200,46 @@ function BackgroundLayers(_ref) {
196
200
  width: width,
197
201
  height: height
198
202
  } : null);
199
- return /*#__PURE__*/React.createElement("div", {
203
+ return /*#__PURE__*/jsxs("div", {
200
204
  className: classNames([styles.container, className]),
201
- style: containerStyle
202
- }, /*#__PURE__*/React.createElement("div", {
203
- className: styles.layers
204
- }, layers.map(function (_ref2, index) {
205
- var _ref2$horizontalAlign = _ref2.horizontalAlign,
206
- horizontalAlign = _ref2$horizontalAlign === void 0 ? undefined : _ref2$horizontalAlign,
207
- _ref2$verticalAlign = _ref2.verticalAlign,
208
- verticalAlign = _ref2$verticalAlign === void 0 ? undefined : _ref2$verticalAlign,
209
- layer = _objectWithoutProperties(_ref2, _excluded);
210
- return /*#__PURE__*/React.createElement("div", {
211
- key: "background-".concat(index),
212
- className: classNames([styles.layer, layerClassName, _defineProperty(_defineProperty({}, styles.bottom, verticalAlign === 'bottom'), styles.right, horizontalAlign === 'right')]),
213
- style: {
214
- zIndex: maxZIndex - index
215
- }
216
- }, /*#__PURE__*/React.createElement(Background, Object.assign({
217
- width: width,
218
- height: height,
219
- resolution: resolution,
220
- className: classNames([styles.background, backgroundClassName]),
221
- playing: playing,
222
- muted: muted,
223
- horizontalAlign: horizontalAlign,
224
- verticalAlign: verticalAlign,
225
- loadingMode: loadingMode,
226
- shouldLoad: shouldLoad,
227
- mediaRef: mediaRef,
228
- withoutVideo: withoutVideo,
229
- onPlayError: onPlayError,
230
- qualityStartLevel: qualityStartLevel,
231
- onQualityLevelChange: onQualityLevelChange
232
- }, layer)));
233
- })), /*#__PURE__*/React.createElement("div", {
234
- className: styles.content
235
- }, children));
205
+ style: containerStyle,
206
+ children: [/*#__PURE__*/jsx("div", {
207
+ className: styles.layers,
208
+ children: layers.map(function (_ref2, index) {
209
+ var _ref2$horizontalAlign = _ref2.horizontalAlign,
210
+ horizontalAlign = _ref2$horizontalAlign === void 0 ? undefined : _ref2$horizontalAlign,
211
+ _ref2$verticalAlign = _ref2.verticalAlign,
212
+ verticalAlign = _ref2$verticalAlign === void 0 ? undefined : _ref2$verticalAlign,
213
+ layer = _objectWithoutProperties(_ref2, _excluded);
214
+ return /*#__PURE__*/jsx("div", {
215
+ className: classNames([styles.layer, layerClassName, _defineProperty(_defineProperty({}, styles.bottom, verticalAlign === 'bottom'), styles.right, horizontalAlign === 'right')]),
216
+ style: {
217
+ zIndex: maxZIndex - index
218
+ },
219
+ children: /*#__PURE__*/jsx(Background, _objectSpread({
220
+ width: width,
221
+ height: height,
222
+ resolution: resolution,
223
+ className: classNames([styles.background, backgroundClassName]),
224
+ playing: playing,
225
+ muted: muted,
226
+ horizontalAlign: horizontalAlign,
227
+ verticalAlign: verticalAlign,
228
+ loadingMode: loadingMode,
229
+ shouldLoad: shouldLoad,
230
+ mediaRef: mediaRef,
231
+ withoutVideo: withoutVideo,
232
+ onPlayError: onPlayError,
233
+ qualityStartLevel: qualityStartLevel,
234
+ onQualityLevelChange: onQualityLevelChange
235
+ }, layer))
236
+ }, "background-".concat(index));
237
+ })
238
+ }), /*#__PURE__*/jsx("div", {
239
+ className: styles.content,
240
+ children: children
241
+ })]
242
+ });
236
243
  }
237
244
 
238
245
  export { Background, BackgroundLayers, BackgroundLayers as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-background",
3
- "version": "0.4.49",
3
+ "version": "0.4.50",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -60,8 +60,8 @@
60
60
  "dependencies": {
61
61
  "@babel/runtime": "^7.28.6",
62
62
  "@folklore/size": "^0.1.20",
63
- "@micromag/core": "^0.4.49",
64
- "@micromag/element-video": "^0.4.49",
63
+ "@micromag/core": "^0.4.50",
64
+ "@micromag/element-video": "^0.4.50",
65
65
  "classnames": "^2.2.6",
66
66
  "lodash": "^4.17.23",
67
67
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -71,5 +71,5 @@
71
71
  "access": "public",
72
72
  "registry": "https://registry.npmjs.org/"
73
73
  },
74
- "gitHead": "0a225ff29387217cccb0fcc5a731e23c74bd202e"
74
+ "gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8"
75
75
  }