@micromag/element-visual 0.3.420 → 0.3.429

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/lib/index.js +26 -37
  2. package/package.json +11 -5
package/lib/index.js CHANGED
@@ -11,40 +11,29 @@ var core = require('@micromag/core');
11
11
  var Image = require('@micromag/element-image');
12
12
  var Video = require('@micromag/element-video');
13
13
 
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
-
16
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
17
- var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
18
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
19
- var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
20
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
21
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
- var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
23
- var Video__default = /*#__PURE__*/_interopDefaultLegacy(Video);
24
-
25
14
  var styles = {"container":"micromag-element-visual-container","videoContainer":"micromag-element-visual-videoContainer"};
26
15
 
27
16
  var _excluded = ["media", "mediaRef", "width", "height", "resolution", "objectFit", "playing", "muted", "shouldLoad", "videoLoop", "videoInitialMuted", "onLoaded", "className", "imageClassName", "videoClassName", "withoutVideo"];
28
17
  var propTypes = {
29
18
  media: core.PropTypes.media,
30
- mediaRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
19
+ mediaRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
31
20
  // eslint-disable-next-line react/forbid-prop-types
32
- current: PropTypes__default["default"].any
21
+ current: PropTypes.any
33
22
  })]),
34
- width: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
35
- height: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
36
- resolution: PropTypes__default["default"].number,
23
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
24
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
25
+ resolution: PropTypes.number,
37
26
  objectFit: core.PropTypes.objectFit,
38
- playing: PropTypes__default["default"].bool,
39
- muted: PropTypes__default["default"].bool,
40
- shouldLoad: PropTypes__default["default"].bool,
41
- videoLoop: PropTypes__default["default"].bool,
42
- withoutVideo: PropTypes__default["default"].bool,
43
- videoInitialMuted: PropTypes__default["default"].bool,
44
- onLoaded: PropTypes__default["default"].func,
45
- className: PropTypes__default["default"].string,
46
- imageClassName: PropTypes__default["default"].string,
47
- videoClassName: PropTypes__default["default"].string
27
+ playing: PropTypes.bool,
28
+ muted: PropTypes.bool,
29
+ shouldLoad: PropTypes.bool,
30
+ videoLoop: PropTypes.bool,
31
+ withoutVideo: PropTypes.bool,
32
+ videoInitialMuted: PropTypes.bool,
33
+ onLoaded: PropTypes.func,
34
+ className: PropTypes.string,
35
+ imageClassName: PropTypes.string,
36
+ videoClassName: PropTypes.string
48
37
  };
49
38
  var defaultProps = {
50
39
  media: null,
@@ -81,7 +70,7 @@ var Visual = function Visual(_ref) {
81
70
  imageClassName = _ref.imageClassName,
82
71
  videoClassName = _ref.videoClassName,
83
72
  withoutVideo = _ref.withoutVideo,
84
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
73
+ props = _objectWithoutProperties(_ref, _excluded);
85
74
  var _ref2 = media || {},
86
75
  _ref2$type = _ref2.type,
87
76
  type = _ref2$type === void 0 ? null : _ref2$type,
@@ -91,17 +80,17 @@ var Visual = function Visual(_ref) {
91
80
  url = _ref2$url === void 0 ? null : _ref2$url;
92
81
  var isVideo = type === 'video';
93
82
  var elProps = React.useMemo(function () {
94
- return _objectSpread__default["default"](_objectSpread__default["default"]({}, props), {}, {
83
+ return _objectSpread(_objectSpread({}, props), {}, {
95
84
  media: media
96
85
  });
97
86
  }, [props, media]);
98
87
  var imageElProps = React.useMemo(function () {
99
- var tmpProps = (!shouldLoad || withoutVideo) && isVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, elProps), {}, {
88
+ var tmpProps = (!shouldLoad || withoutVideo) && isVideo ? _objectSpread(_objectSpread({}, elProps), {}, {
100
89
  media: {
101
90
  url: thumbnailUrl
102
91
  }
103
92
  }) : elProps;
104
- return shouldLoad && !withoutVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, elProps), {}, {
93
+ return shouldLoad && !withoutVideo ? _objectSpread(_objectSpread({}, elProps), {}, {
105
94
  media: {
106
95
  url: url
107
96
  }
@@ -139,25 +128,25 @@ var Visual = function Visual(_ref) {
139
128
  onParentLoaded(e);
140
129
  }
141
130
  }, []);
142
- return type !== null ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'image' || !shouldLoad || withoutVideo ? /*#__PURE__*/React__default["default"].createElement(Image__default["default"], Object.assign({}, imageElProps, {
131
+ return type !== null ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 'image' || !shouldLoad || withoutVideo ? /*#__PURE__*/React.createElement(Image, Object.assign({}, imageElProps, {
143
132
  objectFit: objectFit,
144
133
  width: width,
145
134
  height: height,
146
135
  resolution: resolution,
147
136
  shouldLoad: shouldLoad,
148
137
  onLoaded: onLoaded,
149
- className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)]),
138
+ className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
150
139
  imageClassName: imageClassName
151
- })) : null, type === 'video' && shouldLoad && !withoutVideo ? /*#__PURE__*/React__default["default"].createElement("div", {
152
- className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)]),
140
+ })) : null, type === 'video' && shouldLoad && !withoutVideo ? /*#__PURE__*/React.createElement("div", {
141
+ className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
153
142
  style: {
154
143
  width: width,
155
144
  height: height
156
145
  }
157
- }, /*#__PURE__*/React__default["default"].createElement("div", {
158
- className: classNames__default["default"]([styles.videoContainer, _defineProperty__default["default"]({}, videoClassName, videoClassName !== null)]),
146
+ }, /*#__PURE__*/React.createElement("div", {
147
+ className: classNames([styles.videoContainer, _defineProperty({}, videoClassName, videoClassName !== null)]),
159
148
  style: videoContainerStyle
160
- }, /*#__PURE__*/React__default["default"].createElement(Video__default["default"], Object.assign({}, elProps, {
149
+ }, /*#__PURE__*/React.createElement(Video, Object.assign({}, elProps, {
161
150
  mediaRef: mediaRef,
162
151
  width: objectFit === null ? width : null,
163
152
  height: objectFit === null ? height : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-visual",
3
- "version": "0.3.420",
3
+ "version": "0.3.429",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -32,6 +32,12 @@
32
32
  "license": "ISC",
33
33
  "main": "lib/index.js",
34
34
  "module": "es/index.js",
35
+ "exports": {
36
+ ".": {
37
+ "require": "./lib/index.js",
38
+ "import": "./es/index.js"
39
+ }
40
+ },
35
41
  "files": [
36
42
  "lib",
37
43
  "es",
@@ -51,9 +57,9 @@
51
57
  "dependencies": {
52
58
  "@babel/runtime": "^7.13.10",
53
59
  "@folklore/size": "^0.1.20",
54
- "@micromag/core": "^0.3.420",
55
- "@micromag/element-image": "^0.3.420",
56
- "@micromag/element-video": "^0.3.420",
60
+ "@micromag/core": "^0.3.429",
61
+ "@micromag/element-image": "^0.3.429",
62
+ "@micromag/element-video": "^0.3.429",
57
63
  "classnames": "^2.2.6",
58
64
  "prop-types": "^15.7.2",
59
65
  "uuid": "^9.0.0"
@@ -62,5 +68,5 @@
62
68
  "access": "public",
63
69
  "registry": "https://registry.npmjs.org/"
64
70
  },
65
- "gitHead": "5b0f037a41c3bca07a5bce8f0dce205242f7ad17"
71
+ "gitHead": "f15e72b88ecfda4c54b87626513149b58572c52b"
66
72
  }