@micromag/element-closed-captions 0.3.311 → 0.3.322

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.
@@ -1 +1 @@
1
- .micromag-element-closed-captions-container{position:relative;text-align:center}.micromag-element-closed-captions-container .micromag-element-closed-captions-captions{display:inline-block;padding:10px;background-color:#1c1c1c;color:#fff;word-break:break-word}
1
+ .micromag-element-closed-captions-container{position:relative;text-align:center}.micromag-element-closed-captions-container .micromag-element-closed-captions-captions{background-color:#1c1c1c;color:#fff;display:inline-block;padding:10px;word-break:break-word}
package/es/index.js CHANGED
@@ -25,34 +25,28 @@ var defaultProps = {
25
25
  timeOffset: null,
26
26
  className: null
27
27
  };
28
-
29
28
  var ClosedCaptions = function ClosedCaptions(_ref) {
30
29
  var currentTime = _ref.currentTime,
31
- timeOffset = _ref.timeOffset,
32
- media = _ref.media,
33
- className = _ref.className;
34
-
30
+ timeOffset = _ref.timeOffset,
31
+ media = _ref.media,
32
+ className = _ref.className;
35
33
  var _ref2 = media || {},
36
- _ref2$url = _ref2.url,
37
- url = _ref2$url === void 0 ? null : _ref2$url;
38
-
34
+ _ref2$url = _ref2.url,
35
+ url = _ref2$url === void 0 ? null : _ref2$url;
39
36
  var _useState = useState([]),
40
- _useState2 = _slicedToArray(_useState, 2),
41
- lines = _useState2[0],
42
- setLines = _useState2[1];
43
-
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ lines = _useState2[0],
39
+ setLines = _useState2[1];
44
40
  var _useState3 = useState(-1),
45
- _useState4 = _slicedToArray(_useState3, 2),
46
- lineIndex = _useState4[0],
47
- setLineIndex = _useState4[1];
48
-
41
+ _useState4 = _slicedToArray(_useState3, 2),
42
+ lineIndex = _useState4[0],
43
+ setLineIndex = _useState4[1];
49
44
  var startOffset = timeOffset !== null ? timeOffset.split(/[\t ]*-->[\t ]*/) : null;
50
45
  var startSeconds = startOffset !== null && startOffset.length ? getSecondsFromTime(startOffset[0]) : 0;
51
46
  useEffect(function () {
52
47
  if (url === null) {
53
48
  return;
54
49
  }
55
-
56
50
  fetch(url, {
57
51
  mode: 'cors'
58
52
  }).then(function (response) {
@@ -74,7 +68,6 @@ var ClosedCaptions = function ClosedCaptions(_ref) {
74
68
  useEffect(function () {
75
69
  if (lines.length > 0) {
76
70
  var nextLineIndex = getLineIndexFromTime(currentTime);
77
-
78
71
  if (nextLineIndex !== lineIndex) {
79
72
  setLineIndex(nextLineIndex);
80
73
  }
@@ -91,7 +84,6 @@ var ClosedCaptions = function ClosedCaptions(_ref) {
91
84
  } : null
92
85
  }) : null);
93
86
  };
94
-
95
87
  ClosedCaptions.propTypes = propTypes;
96
88
  ClosedCaptions.defaultProps = defaultProps;
97
89
 
package/lib/index.js CHANGED
@@ -37,34 +37,28 @@ var defaultProps = {
37
37
  timeOffset: null,
38
38
  className: null
39
39
  };
40
-
41
40
  var ClosedCaptions = function ClosedCaptions(_ref) {
42
41
  var currentTime = _ref.currentTime,
43
- timeOffset = _ref.timeOffset,
44
- media = _ref.media,
45
- className = _ref.className;
46
-
42
+ timeOffset = _ref.timeOffset,
43
+ media = _ref.media,
44
+ className = _ref.className;
47
45
  var _ref2 = media || {},
48
- _ref2$url = _ref2.url,
49
- url = _ref2$url === void 0 ? null : _ref2$url;
50
-
46
+ _ref2$url = _ref2.url,
47
+ url = _ref2$url === void 0 ? null : _ref2$url;
51
48
  var _useState = React.useState([]),
52
- _useState2 = _slicedToArray__default["default"](_useState, 2),
53
- lines = _useState2[0],
54
- setLines = _useState2[1];
55
-
49
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
50
+ lines = _useState2[0],
51
+ setLines = _useState2[1];
56
52
  var _useState3 = React.useState(-1),
57
- _useState4 = _slicedToArray__default["default"](_useState3, 2),
58
- lineIndex = _useState4[0],
59
- setLineIndex = _useState4[1];
60
-
53
+ _useState4 = _slicedToArray__default["default"](_useState3, 2),
54
+ lineIndex = _useState4[0],
55
+ setLineIndex = _useState4[1];
61
56
  var startOffset = timeOffset !== null ? timeOffset.split(/[\t ]*-->[\t ]*/) : null;
62
57
  var startSeconds = startOffset !== null && startOffset.length ? utils.getSecondsFromTime(startOffset[0]) : 0;
63
58
  React.useEffect(function () {
64
59
  if (url === null) {
65
60
  return;
66
61
  }
67
-
68
62
  fetch__default["default"](url, {
69
63
  mode: 'cors'
70
64
  }).then(function (response) {
@@ -86,7 +80,6 @@ var ClosedCaptions = function ClosedCaptions(_ref) {
86
80
  React.useEffect(function () {
87
81
  if (lines.length > 0) {
88
82
  var nextLineIndex = getLineIndexFromTime(currentTime);
89
-
90
83
  if (nextLineIndex !== lineIndex) {
91
84
  setLineIndex(nextLineIndex);
92
85
  }
@@ -103,7 +96,6 @@ var ClosedCaptions = function ClosedCaptions(_ref) {
103
96
  } : null
104
97
  }) : null);
105
98
  };
106
-
107
99
  ClosedCaptions.propTypes = propTypes;
108
100
  ClosedCaptions.defaultProps = defaultProps;
109
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-closed-captions",
3
- "version": "0.3.311",
3
+ "version": "0.3.322",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -49,17 +49,17 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.13.10",
52
- "@micromag/core": "^0.3.311",
52
+ "@micromag/core": "^0.3.322",
53
53
  "classnames": "^2.2.6",
54
54
  "node-fetch": "^2.6.1",
55
55
  "parse-srt": "^1.0.0-alpha",
56
56
  "prop-types": "^15.7.2",
57
57
  "react-intl": "^5.12.1",
58
- "uuid": "^8.3.2",
58
+ "uuid": "^9.0.0",
59
59
  "whatwg-fetch": "^3.6.1"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "fab297a7ad204611597c749b969f14d992d35d47"
64
+ "gitHead": "2dfe09ad5a9ac720e4bfbffcb6371fc31c24fa9f"
65
65
  }