@micromag/element-background 0.4.49 → 0.4.51
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 +67 -60
- 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
|
|
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__*/
|
|
124
|
+
return /*#__PURE__*/jsxs("div", {
|
|
124
125
|
className: classNames([styles.container, className]),
|
|
125
|
-
style: containerStyle
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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__*/
|
|
203
|
+
return /*#__PURE__*/jsxs("div", {
|
|
200
204
|
className: classNames([styles.container, className]),
|
|
201
|
-
style: containerStyle
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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.
|
|
3
|
+
"version": "0.4.51",
|
|
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.
|
|
64
|
-
"@micromag/element-video": "^0.4.
|
|
63
|
+
"@micromag/core": "^0.4.51",
|
|
64
|
+
"@micromag/element-video": "^0.4.51",
|
|
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": "
|
|
74
|
+
"gitHead": "985a2370829c9ac8901ea97bf20bfc98ab158439"
|
|
75
75
|
}
|