@micromag/screen-audio 0.2.372 → 0.2.384
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 +13 -2
- package/lib/index.js +12 -1
- package/package.json +11 -11
package/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FormattedMessage, defineMessage } from 'react-intl';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
-
import React, { useState, useCallback, useRef,
|
|
5
|
+
import React, { useState, useCallback, useRef, useEffect, useMemo } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
@@ -30,6 +30,7 @@ var propTypes = {
|
|
|
30
30
|
callToAction: PropTypes$1.callToAction,
|
|
31
31
|
current: PropTypes.bool,
|
|
32
32
|
transitions: PropTypes$1.transitions,
|
|
33
|
+
getMediaRef: PropTypes.func,
|
|
33
34
|
className: PropTypes.string
|
|
34
35
|
};
|
|
35
36
|
var defaultProps = {
|
|
@@ -40,6 +41,7 @@ var defaultProps = {
|
|
|
40
41
|
callToAction: null,
|
|
41
42
|
current: true,
|
|
42
43
|
transitions: null,
|
|
44
|
+
getMediaRef: null,
|
|
43
45
|
className: null
|
|
44
46
|
};
|
|
45
47
|
|
|
@@ -53,6 +55,7 @@ var AudioScreen = function AudioScreen(_ref) {
|
|
|
53
55
|
callToAction = _ref.callToAction,
|
|
54
56
|
current = _ref.current,
|
|
55
57
|
transitions = _ref.transitions,
|
|
58
|
+
getMediaRef = _ref.getMediaRef,
|
|
56
59
|
className = _ref.className;
|
|
57
60
|
var trackScreenMedia = useTrackScreenMedia('audio');
|
|
58
61
|
|
|
@@ -112,7 +115,15 @@ var AudioScreen = function AudioScreen(_ref) {
|
|
|
112
115
|
togglePlay = _ref4.togglePlay,
|
|
113
116
|
toggleMute = _ref4.toggleMute,
|
|
114
117
|
play = _ref4.play,
|
|
115
|
-
pause = _ref4.pause
|
|
118
|
+
pause = _ref4.pause,
|
|
119
|
+
_ref4$mediaRef = _ref4.mediaRef,
|
|
120
|
+
apiMediaRef = _ref4$mediaRef === void 0 ? null : _ref4$mediaRef;
|
|
121
|
+
|
|
122
|
+
useEffect(function () {
|
|
123
|
+
if (apiMediaRef !== null && getMediaRef !== null) {
|
|
124
|
+
getMediaRef(apiMediaRef.current);
|
|
125
|
+
}
|
|
126
|
+
}, [apiMediaRef, getMediaRef]);
|
|
116
127
|
|
|
117
128
|
var _useState3 = useState(null),
|
|
118
129
|
_useState4 = _slicedToArray(_useState3, 2),
|
package/lib/index.js
CHANGED
|
@@ -51,6 +51,7 @@ var propTypes = {
|
|
|
51
51
|
callToAction: core.PropTypes.callToAction,
|
|
52
52
|
current: PropTypes__default["default"].bool,
|
|
53
53
|
transitions: core.PropTypes.transitions,
|
|
54
|
+
getMediaRef: PropTypes__default["default"].func,
|
|
54
55
|
className: PropTypes__default["default"].string
|
|
55
56
|
};
|
|
56
57
|
var defaultProps = {
|
|
@@ -61,6 +62,7 @@ var defaultProps = {
|
|
|
61
62
|
callToAction: null,
|
|
62
63
|
current: true,
|
|
63
64
|
transitions: null,
|
|
65
|
+
getMediaRef: null,
|
|
64
66
|
className: null
|
|
65
67
|
};
|
|
66
68
|
|
|
@@ -74,6 +76,7 @@ var AudioScreen = function AudioScreen(_ref) {
|
|
|
74
76
|
callToAction = _ref.callToAction,
|
|
75
77
|
current = _ref.current,
|
|
76
78
|
transitions = _ref.transitions,
|
|
79
|
+
getMediaRef = _ref.getMediaRef,
|
|
77
80
|
className = _ref.className;
|
|
78
81
|
var trackScreenMedia = hooks.useTrackScreenMedia('audio');
|
|
79
82
|
|
|
@@ -133,7 +136,15 @@ var AudioScreen = function AudioScreen(_ref) {
|
|
|
133
136
|
togglePlay = _ref4.togglePlay,
|
|
134
137
|
toggleMute = _ref4.toggleMute,
|
|
135
138
|
play = _ref4.play,
|
|
136
|
-
pause = _ref4.pause
|
|
139
|
+
pause = _ref4.pause,
|
|
140
|
+
_ref4$mediaRef = _ref4.mediaRef,
|
|
141
|
+
apiMediaRef = _ref4$mediaRef === void 0 ? null : _ref4$mediaRef;
|
|
142
|
+
|
|
143
|
+
React.useEffect(function () {
|
|
144
|
+
if (apiMediaRef !== null && getMediaRef !== null) {
|
|
145
|
+
getMediaRef(apiMediaRef.current);
|
|
146
|
+
}
|
|
147
|
+
}, [apiMediaRef, getMediaRef]);
|
|
137
148
|
|
|
138
149
|
var _useState3 = React.useState(null),
|
|
139
150
|
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-audio",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.384",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.13.10",
|
|
52
|
-
"@micromag/core": "^0.2.
|
|
53
|
-
"@micromag/element-audio": "^0.2.
|
|
54
|
-
"@micromag/element-background": "^0.2.
|
|
55
|
-
"@micromag/element-call-to-action": "^0.2.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.2.
|
|
57
|
-
"@micromag/element-container": "^0.2.
|
|
58
|
-
"@micromag/element-layout": "^0.2.
|
|
59
|
-
"@micromag/element-media-controls": "^0.2.
|
|
60
|
-
"@micromag/transforms": "^0.2.
|
|
52
|
+
"@micromag/core": "^0.2.384",
|
|
53
|
+
"@micromag/element-audio": "^0.2.384",
|
|
54
|
+
"@micromag/element-background": "^0.2.384",
|
|
55
|
+
"@micromag/element-call-to-action": "^0.2.384",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.2.384",
|
|
57
|
+
"@micromag/element-container": "^0.2.384",
|
|
58
|
+
"@micromag/element-layout": "^0.2.384",
|
|
59
|
+
"@micromag/element-media-controls": "^0.2.384",
|
|
60
|
+
"@micromag/transforms": "^0.2.384",
|
|
61
61
|
"classnames": "^2.2.6",
|
|
62
62
|
"lodash": "^4.17.21",
|
|
63
63
|
"prop-types": "^15.7.2",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "cfe309fba4ad374b6cd483e588d90ab3b76d2f5b"
|
|
71
71
|
}
|