@atlaskit/media-ui 22.2.4 → 22.3.1

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 (194) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/MediaButton.js +12 -29
  3. package/dist/cjs/MediaInlineCard/ErroredView/index.js +6 -35
  4. package/dist/cjs/MediaInlineCard/Frame/index.js +4 -27
  5. package/dist/cjs/MediaInlineCard/Frame/styled.js +5 -18
  6. package/dist/cjs/MediaInlineCard/Icon.js +3 -10
  7. package/dist/cjs/MediaInlineCard/IconAndTitleLayout/index.js +8 -38
  8. package/dist/cjs/MediaInlineCard/IconAndTitleLayout/styled.js +15 -33
  9. package/dist/cjs/MediaInlineCard/LoadedView/index.js +8 -24
  10. package/dist/cjs/MediaInlineCard/LoadingView/index.js +6 -26
  11. package/dist/cjs/MediaInlineCard/LoadingView/styled.js +0 -6
  12. package/dist/cjs/MediaInlineCard/index.js +0 -3
  13. package/dist/cjs/MediaInlineCard/styled.js +1 -10
  14. package/dist/cjs/browser.js +1 -5
  15. package/dist/cjs/camera.js +14 -36
  16. package/dist/cjs/codeViewer.js +1 -46
  17. package/dist/cjs/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +0 -7
  18. package/dist/cjs/customMediaPlayer/analytics/events/track/playCount.js +0 -7
  19. package/dist/cjs/customMediaPlayer/analytics/events/track/played.js +0 -7
  20. package/dist/cjs/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +0 -6
  21. package/dist/cjs/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +0 -6
  22. package/dist/cjs/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +0 -6
  23. package/dist/cjs/customMediaPlayer/analytics/events/ui/shortcutPressed.js +0 -6
  24. package/dist/cjs/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +0 -6
  25. package/dist/cjs/customMediaPlayer/analytics/index.js +0 -9
  26. package/dist/cjs/customMediaPlayer/analytics/utils/analytics.js +4 -8
  27. package/dist/cjs/customMediaPlayer/analytics/utils/playbackAttributes.js +10 -12
  28. package/dist/cjs/customMediaPlayer/fullscreen.js +4 -20
  29. package/dist/cjs/customMediaPlayer/getControlsWrapperClassName.js +0 -3
  30. package/dist/cjs/customMediaPlayer/icons.js +0 -8
  31. package/dist/cjs/customMediaPlayer/index.js +54 -157
  32. package/dist/cjs/customMediaPlayer/playPauseBlanket.js +0 -6
  33. package/dist/cjs/customMediaPlayer/playbackSpeedControls.js +7 -45
  34. package/dist/cjs/customMediaPlayer/simultaneousPlayManager.js +0 -4
  35. package/dist/cjs/customMediaPlayer/styled.js +0 -43
  36. package/dist/cjs/customMediaPlayer/timeRange.js +24 -55
  37. package/dist/cjs/customMediaPlayer/timeSaver.js +5 -12
  38. package/dist/cjs/ellipsify.js +4 -25
  39. package/dist/cjs/errorIcon.js +1 -5
  40. package/dist/cjs/formatDate.js +6 -12
  41. package/dist/cjs/formatDuration.js +0 -5
  42. package/dist/cjs/humanReadableSize.js +1 -6
  43. package/dist/cjs/i18n/cs.js +0 -1
  44. package/dist/cjs/i18n/da.js +0 -1
  45. package/dist/cjs/i18n/de.js +0 -1
  46. package/dist/cjs/i18n/en.js +0 -1
  47. package/dist/cjs/i18n/en_GB.js +0 -1
  48. package/dist/cjs/i18n/en_ZZ.js +0 -1
  49. package/dist/cjs/i18n/es.js +0 -1
  50. package/dist/cjs/i18n/et.js +0 -1
  51. package/dist/cjs/i18n/fi.js +0 -1
  52. package/dist/cjs/i18n/fr.js +0 -1
  53. package/dist/cjs/i18n/hu.js +0 -1
  54. package/dist/cjs/i18n/index.js +0 -30
  55. package/dist/cjs/i18n/it.js +0 -1
  56. package/dist/cjs/i18n/ja.js +0 -1
  57. package/dist/cjs/i18n/ko.js +0 -1
  58. package/dist/cjs/i18n/nb.js +0 -1
  59. package/dist/cjs/i18n/nl.js +0 -1
  60. package/dist/cjs/i18n/pl.js +0 -1
  61. package/dist/cjs/i18n/pt_BR.js +0 -1
  62. package/dist/cjs/i18n/pt_PT.js +0 -1
  63. package/dist/cjs/i18n/ru.js +0 -1
  64. package/dist/cjs/i18n/sk.js +0 -1
  65. package/dist/cjs/i18n/sv.js +0 -1
  66. package/dist/cjs/i18n/th.js +0 -1
  67. package/dist/cjs/i18n/tr.js +0 -1
  68. package/dist/cjs/i18n/uk.js +0 -1
  69. package/dist/cjs/i18n/vi.js +0 -1
  70. package/dist/cjs/i18n/zh.js +0 -1
  71. package/dist/cjs/i18n/zh_TW.js +0 -1
  72. package/dist/cjs/imageMetaData/imageOrientationUtil.js +1 -5
  73. package/dist/cjs/imageMetaData/index.js +8 -50
  74. package/dist/cjs/imageMetaData/metatags.js +0 -23
  75. package/dist/cjs/imageMetaData/parseJPEG.js +1 -18
  76. package/dist/cjs/imageMetaData/parsePNG.js +0 -30
  77. package/dist/cjs/imageMetaData/parsePNGXMP.js +0 -4
  78. package/dist/cjs/imageMetaData/types.js +0 -5
  79. package/dist/cjs/inactivityDetector/inactivityDetector.js +5 -34
  80. package/dist/cjs/inactivityDetector/styled.js +0 -8
  81. package/dist/cjs/index.js +0 -29
  82. package/dist/cjs/intersectionObserver.js +0 -2
  83. package/dist/cjs/locales.js +0 -5
  84. package/dist/cjs/media-type-icon.js +3 -35
  85. package/dist/cjs/mediaImage/index.js +32 -63
  86. package/dist/cjs/mediaImage/styled.js +2 -13
  87. package/dist/cjs/messages.js +0 -2
  88. package/dist/cjs/mime-type-icon.js +13 -18
  89. package/dist/cjs/mixins.js +0 -11
  90. package/dist/cjs/modalSpinner.js +1 -15
  91. package/dist/cjs/shortcut.js +3 -25
  92. package/dist/cjs/truncateText.js +12 -33
  93. package/dist/cjs/util.js +16 -72
  94. package/dist/cjs/version.json +1 -1
  95. package/dist/es2019/MediaButton.js +8 -11
  96. package/dist/es2019/MediaInlineCard/ErroredView/index.js +1 -5
  97. package/dist/es2019/MediaInlineCard/Frame/index.js +0 -8
  98. package/dist/es2019/MediaInlineCard/Frame/styled.js +5 -8
  99. package/dist/es2019/MediaInlineCard/Icon.js +6 -4
  100. package/dist/es2019/MediaInlineCard/IconAndTitleLayout/index.js +1 -16
  101. package/dist/es2019/MediaInlineCard/IconAndTitleLayout/styled.js +19 -13
  102. package/dist/es2019/MediaInlineCard/LoadedView/index.js +0 -1
  103. package/dist/es2019/MediaInlineCard/LoadingView/index.js +0 -2
  104. package/dist/es2019/MediaInlineCard/styled.js +1 -2
  105. package/dist/es2019/browser.js +1 -5
  106. package/dist/es2019/camera.js +9 -52
  107. package/dist/es2019/codeViewer.js +1 -42
  108. package/dist/es2019/customMediaPlayer/analytics/utils/analytics.js +4 -2
  109. package/dist/es2019/customMediaPlayer/fullscreen.js +4 -9
  110. package/dist/es2019/customMediaPlayer/icons.js +0 -4
  111. package/dist/es2019/customMediaPlayer/index.js +9 -85
  112. package/dist/es2019/customMediaPlayer/playbackSpeedControls.js +14 -20
  113. package/dist/es2019/customMediaPlayer/simultaneousPlayManager.js +0 -4
  114. package/dist/es2019/customMediaPlayer/timeRange.js +12 -29
  115. package/dist/es2019/customMediaPlayer/timeSaver.js +5 -9
  116. package/dist/es2019/ellipsify.js +0 -8
  117. package/dist/es2019/formatDuration.js +0 -3
  118. package/dist/es2019/humanReadableSize.js +3 -2
  119. package/dist/es2019/imageMetaData/imageOrientationUtil.js +1 -2
  120. package/dist/es2019/imageMetaData/index.js +10 -24
  121. package/dist/es2019/imageMetaData/metatags.js +4 -4
  122. package/dist/es2019/imageMetaData/parseJPEG.js +0 -3
  123. package/dist/es2019/imageMetaData/parsePNG.js +5 -10
  124. package/dist/es2019/imageMetaData/parsePNGXMP.js +0 -3
  125. package/dist/es2019/imageMetaData/types.js +0 -5
  126. package/dist/es2019/inactivityDetector/inactivityDetector.js +5 -15
  127. package/dist/es2019/inactivityDetector/styled.js +0 -2
  128. package/dist/es2019/media-type-icon.js +0 -2
  129. package/dist/es2019/mediaImage/index.js +15 -27
  130. package/dist/es2019/mediaImage/styled.js +2 -1
  131. package/dist/es2019/mime-type-icon.js +5 -5
  132. package/dist/es2019/shortcut.js +0 -9
  133. package/dist/es2019/truncateText.js +1 -9
  134. package/dist/es2019/util.js +14 -26
  135. package/dist/es2019/version.json +1 -1
  136. package/dist/esm/MediaButton.js +12 -22
  137. package/dist/esm/MediaInlineCard/ErroredView/index.js +6 -19
  138. package/dist/esm/MediaInlineCard/Frame/index.js +4 -21
  139. package/dist/esm/MediaInlineCard/Frame/styled.js +5 -11
  140. package/dist/esm/MediaInlineCard/Icon.js +4 -4
  141. package/dist/esm/MediaInlineCard/IconAndTitleLayout/index.js +8 -26
  142. package/dist/esm/MediaInlineCard/IconAndTitleLayout/styled.js +17 -13
  143. package/dist/esm/MediaInlineCard/LoadedView/index.js +8 -16
  144. package/dist/esm/MediaInlineCard/LoadingView/index.js +6 -15
  145. package/dist/esm/MediaInlineCard/LoadingView/styled.js +0 -2
  146. package/dist/esm/MediaInlineCard/styled.js +1 -4
  147. package/dist/esm/browser.js +1 -5
  148. package/dist/esm/camera.js +14 -31
  149. package/dist/esm/codeViewer.js +1 -42
  150. package/dist/esm/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +0 -3
  151. package/dist/esm/customMediaPlayer/analytics/events/track/playCount.js +0 -3
  152. package/dist/esm/customMediaPlayer/analytics/events/track/played.js +0 -3
  153. package/dist/esm/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +0 -3
  154. package/dist/esm/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +0 -3
  155. package/dist/esm/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +0 -3
  156. package/dist/esm/customMediaPlayer/analytics/events/ui/shortcutPressed.js +0 -3
  157. package/dist/esm/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +0 -3
  158. package/dist/esm/customMediaPlayer/analytics/utils/analytics.js +4 -2
  159. package/dist/esm/customMediaPlayer/analytics/utils/playbackAttributes.js +10 -10
  160. package/dist/esm/customMediaPlayer/fullscreen.js +4 -9
  161. package/dist/esm/customMediaPlayer/icons.js +0 -4
  162. package/dist/esm/customMediaPlayer/index.js +54 -153
  163. package/dist/esm/customMediaPlayer/playPauseBlanket.js +0 -2
  164. package/dist/esm/customMediaPlayer/playbackSpeedControls.js +7 -30
  165. package/dist/esm/customMediaPlayer/simultaneousPlayManager.js +0 -4
  166. package/dist/esm/customMediaPlayer/styled.js +0 -2
  167. package/dist/esm/customMediaPlayer/timeRange.js +24 -51
  168. package/dist/esm/customMediaPlayer/timeSaver.js +5 -10
  169. package/dist/esm/ellipsify.js +4 -14
  170. package/dist/esm/formatDate.js +6 -6
  171. package/dist/esm/formatDuration.js +0 -3
  172. package/dist/esm/humanReadableSize.js +3 -2
  173. package/dist/esm/imageMetaData/imageOrientationUtil.js +1 -2
  174. package/dist/esm/imageMetaData/index.js +8 -40
  175. package/dist/esm/imageMetaData/metatags.js +0 -15
  176. package/dist/esm/imageMetaData/parseJPEG.js +1 -8
  177. package/dist/esm/imageMetaData/parsePNG.js +0 -21
  178. package/dist/esm/imageMetaData/parsePNGXMP.js +0 -3
  179. package/dist/esm/imageMetaData/types.js +0 -5
  180. package/dist/esm/inactivityDetector/inactivityDetector.js +5 -25
  181. package/dist/esm/inactivityDetector/styled.js +0 -4
  182. package/dist/esm/media-type-icon.js +3 -13
  183. package/dist/esm/mediaImage/index.js +32 -52
  184. package/dist/esm/mediaImage/styled.js +2 -6
  185. package/dist/esm/mime-type-icon.js +13 -13
  186. package/dist/esm/mixins.js +0 -2
  187. package/dist/esm/modalSpinner.js +1 -3
  188. package/dist/esm/shortcut.js +3 -19
  189. package/dist/esm/truncateText.js +12 -22
  190. package/dist/esm/util.js +16 -46
  191. package/dist/esm/version.json +1 -1
  192. package/dist/types/mediaImage/index.d.ts +1 -1
  193. package/package.json +4 -4
  194. package/report.api.md +16 -1
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
12
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
18
13
  // Keep PlaybackSpeedControls to use static colors from the new color palette to support the hybrid
19
14
  // theming in media viewer https://product-fabric.atlassian.net/browse/DSP-6067
@@ -28,35 +23,25 @@ import { messages } from '../messages';
28
23
  import { WidthObserver } from '@atlaskit/width-detector';
29
24
  export var PlaybackSpeedControls = /*#__PURE__*/function (_Component) {
30
25
  _inherits(PlaybackSpeedControls, _Component);
31
-
32
26
  var _super = _createSuper(PlaybackSpeedControls);
33
-
34
27
  function PlaybackSpeedControls() {
35
28
  var _this;
36
-
37
29
  _classCallCheck(this, PlaybackSpeedControls);
38
-
39
30
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
31
  args[_key] = arguments[_key];
41
32
  }
42
-
43
33
  _this = _super.call.apply(_super, [this].concat(args));
44
-
45
34
  _defineProperty(_assertThisInitialized(_this), "state", {
46
35
  popupHeight: 255
47
36
  });
48
-
49
37
  _defineProperty(_assertThisInitialized(_this), "onPlaybackSpeedChange", function (option, _actionMeta) {
50
38
  var onPlaybackSpeedChange = _this.props.onPlaybackSpeedChange;
51
-
52
39
  if (!option) {
53
40
  return;
54
41
  }
55
-
56
42
  var playbackSpeed = parseFloat("".concat(option.value));
57
43
  onPlaybackSpeedChange(playbackSpeed);
58
44
  });
59
-
60
45
  _defineProperty(_assertThisInitialized(_this), "speedOptions", function () {
61
46
  return [{
62
47
  // @ts-ignore: FormattedMessage is returning an Element which is a type mismatch with what OptionType wants. This can be fix by using 'intl' object once this packages gets refactor later.
@@ -79,7 +64,6 @@ export var PlaybackSpeedControls = /*#__PURE__*/function (_Component) {
79
64
  }]
80
65
  }];
81
66
  });
82
-
83
67
  _defineProperty(_assertThisInitialized(_this), "popupCustomStyles", {
84
68
  container: function container(styles) {
85
69
  return _objectSpread(_objectSpread({}, styles), {}, {
@@ -96,7 +80,7 @@ export var PlaybackSpeedControls = /*#__PURE__*/function (_Component) {
96
80
  },
97
81
  option: function option(styles, _ref) {
98
82
  var isFocused = _ref.isFocused,
99
- isSelected = _ref.isSelected;
83
+ isSelected = _ref.isSelected;
100
84
  return _objectSpread(_objectSpread({}, styles), {}, {
101
85
  color: isSelected ? '#579dff' : 'inherit',
102
86
  backgroundColor: isSelected ? '#082145' : isFocused ? '#a1bdd914' : '#22272b',
@@ -111,38 +95,32 @@ export var PlaybackSpeedControls = /*#__PURE__*/function (_Component) {
111
95
  });
112
96
  }
113
97
  });
114
-
115
98
  _defineProperty(_assertThisInitialized(_this), "onResize", function (width) {
116
99
  var originalDimensions = _this.props.originalDimensions;
117
-
118
100
  if (originalDimensions) {
119
101
  var aspectRatio = originalDimensions.height / originalDimensions.width;
120
102
  var controlsSize = 60;
121
103
  var minimumHeight = 100;
122
104
  var popupHeight = Math.max(aspectRatio * width - controlsSize, minimumHeight);
123
-
124
105
  _this.setState({
125
106
  popupHeight: popupHeight
126
107
  });
127
- } // This is a hacky solution. Please replace with a better one if you find one.
108
+ }
109
+ // This is a hacky solution. Please replace with a better one if you find one.
128
110
  // There is something inside popper.js that recalc position on scroll.
129
111
  // We enable this functionality with `eventListeners` modifier.
130
112
  // Here we simulate scroll even to trick popper.js to recalc position.
131
-
132
-
133
113
  window.dispatchEvent(new CustomEvent('scroll'));
134
114
  });
135
-
136
115
  return _this;
137
116
  }
138
-
139
117
  _createClass(PlaybackSpeedControls, [{
140
118
  key: "render",
141
119
  value: function render() {
142
120
  var _this$props = this.props,
143
- playbackSpeed = _this$props.playbackSpeed,
144
- intl = _this$props.intl,
145
- onClick = _this$props.onClick;
121
+ playbackSpeed = _this$props.playbackSpeed,
122
+ intl = _this$props.intl,
123
+ onClick = _this$props.onClick;
146
124
  var popupHeight = this.state.popupHeight;
147
125
  var value = this.speedOptions()[0].options.find(function (option) {
148
126
  return option.value === playbackSpeed;
@@ -185,7 +163,7 @@ export var PlaybackSpeedControls = /*#__PURE__*/function (_Component) {
185
163
  onChange: this.onPlaybackSpeedChange,
186
164
  target: function target(_ref2) {
187
165
  var ref = _ref2.ref,
188
- isOpen = _ref2.isOpen;
166
+ isOpen = _ref2.isOpen;
189
167
  return /*#__PURE__*/React.createElement(Tooltip, {
190
168
  content: intl.formatMessage(messages.playbackSpeed),
191
169
  position: "top"
@@ -201,7 +179,6 @@ export var PlaybackSpeedControls = /*#__PURE__*/function (_Component) {
201
179
  }));
202
180
  }
203
181
  }]);
204
-
205
182
  return PlaybackSpeedControls;
206
183
  }(Component);
207
184
  export default injectIntl(PlaybackSpeedControls);
@@ -1,17 +1,13 @@
1
1
  var players = [];
2
-
3
2
  var addPlayer = function addPlayer(player) {
4
3
  return players.push(player);
5
4
  };
6
-
7
5
  var removePlayer = function removePlayer(player) {
8
6
  var playerIndex = players.indexOf(player);
9
-
10
7
  if (playerIndex > -1) {
11
8
  players.splice(playerIndex, 1);
12
9
  }
13
10
  };
14
-
15
11
  export default {
16
12
  pauseOthers: function pauseOthers(player) {
17
13
  players.forEach(function (otherPlayer) {
@@ -1,7 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
4
-
5
3
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
6
4
  import styled from '@emotion/styled';
7
5
  import { R300 } from '@atlaskit/theme/colors';
@@ -5,131 +5,106 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
-
13
10
  import React from 'react';
14
11
  import { Component } from 'react';
15
12
  import { TimeLine, CurrentTimeLine, Thumb, BufferedTime, CurrentTimeTooltip, TimeRangeWrapper } from './styled';
16
13
  import { formatDuration } from '../formatDuration';
17
14
  export var TimeRange = /*#__PURE__*/function (_Component) {
18
15
  _inherits(TimeRange, _Component);
19
-
20
16
  var _super = _createSuper(TimeRange);
21
-
22
17
  function TimeRange() {
23
18
  var _this;
24
-
25
19
  _classCallCheck(this, TimeRange);
26
-
27
20
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
21
  args[_key] = arguments[_key];
29
22
  }
30
-
31
23
  _this = _super.call.apply(_super, [this].concat(args));
32
-
33
24
  _defineProperty(_assertThisInitialized(_this), "thumbElement", /*#__PURE__*/React.createRef());
34
-
35
25
  _defineProperty(_assertThisInitialized(_this), "wrapperElement", /*#__PURE__*/React.createRef());
36
-
37
26
  _defineProperty(_assertThisInitialized(_this), "wrapperElementWidth", 0);
38
-
39
27
  _defineProperty(_assertThisInitialized(_this), "state", {
40
28
  isDragging: false,
41
29
  dragStartClientX: 0
42
30
  });
43
-
44
31
  _defineProperty(_assertThisInitialized(_this), "setWrapperWidth", function () {
45
32
  if (!_this.wrapperElement.current) {
46
33
  return;
47
34
  }
48
-
49
35
  _this.wrapperElementWidth = _this.wrapperElement.current.getBoundingClientRect().width;
50
36
  });
51
-
52
37
  _defineProperty(_assertThisInitialized(_this), "onMouseMove", function (e) {
53
38
  var _this$state = _this.state,
54
- isDragging = _this$state.isDragging,
55
- dragStartClientX = _this$state.dragStartClientX;
56
-
39
+ isDragging = _this$state.isDragging,
40
+ dragStartClientX = _this$state.dragStartClientX;
57
41
  if (!isDragging) {
58
42
  return;
59
43
  }
60
-
61
44
  e.stopPropagation();
62
45
  var _this$props = _this.props,
63
- onChange = _this$props.onChange,
64
- duration = _this$props.duration,
65
- currentTime = _this$props.currentTime;
46
+ onChange = _this$props.onChange,
47
+ duration = _this$props.duration,
48
+ currentTime = _this$props.currentTime;
66
49
  var clientX = e.clientX;
67
50
  var absolutePosition = clientX - dragStartClientX;
68
51
  var isOutsideToRight = absolutePosition > _this.wrapperElementWidth;
69
- var isOutsideToLeft = absolutePosition < 0; // Next to conditions take care of situation where user moves mouse very quickly out to the side
52
+ var isOutsideToLeft = absolutePosition < 0;
53
+
54
+ // Next to conditions take care of situation where user moves mouse very quickly out to the side
70
55
  // left or right. It's very easy to leave thumb not at the end/beginning of a timeline.
71
56
  // This will guarantee that in this case thumb will move to appropriate extreme.
72
-
73
57
  if (isOutsideToRight) {
74
58
  absolutePosition = _this.wrapperElementWidth;
75
59
  }
76
-
77
60
  if (isOutsideToLeft) {
78
61
  absolutePosition = 0;
79
62
  }
80
-
81
63
  var newTimeWithBoundaries = absolutePosition * duration / _this.wrapperElementWidth;
82
-
83
64
  if (currentTime !== newTimeWithBoundaries) {
84
65
  // If value hasn't changed we don't want to call "change"
85
66
  onChange(newTimeWithBoundaries);
86
67
  }
87
68
  });
88
-
89
69
  _defineProperty(_assertThisInitialized(_this), "onMouseUp", function () {
90
- var onChanged = _this.props.onChanged; // As soon as user finished dragging, we should clean up events.
91
-
70
+ var onChanged = _this.props.onChanged;
71
+ // As soon as user finished dragging, we should clean up events.
92
72
  document.removeEventListener('mouseup', _this.onMouseUp);
93
73
  document.removeEventListener('mousemove', _this.onMouseMove);
94
-
95
74
  if (onChanged) {
96
75
  onChanged();
97
76
  }
98
-
99
77
  _this.setState({
100
78
  isDragging: false
101
79
  });
102
80
  });
103
-
104
81
  _defineProperty(_assertThisInitialized(_this), "onThumbMouseDown", function (e) {
105
- e.preventDefault(); // We need to recalculate every time, because width can change (thanks, editor ;-)
82
+ e.preventDefault();
83
+
84
+ // We need to recalculate every time, because width can change (thanks, editor ;-)
85
+ _this.setWrapperWidth();
106
86
 
107
- _this.setWrapperWidth(); // We are implementing drag and drop here. There is no reason to start listening for mouseUp or move
87
+ // We are implementing drag and drop here. There is no reason to start listening for mouseUp or move
108
88
  // before that. Also if we start listening for mouseup before that we could pick up someone else's event
109
89
  // For example editors resizing of a inline video player.
110
-
111
-
112
90
  document.addEventListener('mouseup', _this.onMouseUp);
113
91
  document.addEventListener('mousemove', _this.onMouseMove);
114
92
  var _this$props2 = _this.props,
115
- duration = _this$props2.duration,
116
- onChange = _this$props2.onChange;
93
+ duration = _this$props2.duration,
94
+ onChange = _this$props2.onChange;
117
95
  var event = e.nativeEvent;
118
96
  var x = event.offsetX;
119
97
  var currentTime = x * duration / _this.wrapperElementWidth;
120
-
121
98
  _this.setState({
122
99
  isDragging: true,
123
100
  dragStartClientX: event.clientX - x
124
- }); // As soon as user clicks timeline we want to move thumb over to that place.
125
-
101
+ });
126
102
 
103
+ // As soon as user clicks timeline we want to move thumb over to that place.
127
104
  onChange(currentTime);
128
105
  });
129
-
130
106
  return _this;
131
107
  }
132
-
133
108
  _createClass(TimeRange, [{
134
109
  key: "componentDidMount",
135
110
  value: function componentDidMount() {
@@ -147,11 +122,11 @@ export var TimeRange = /*#__PURE__*/function (_Component) {
147
122
  value: function render() {
148
123
  var isDragging = this.state.isDragging;
149
124
  var _this$props3 = this.props,
150
- currentTime = _this$props3.currentTime,
151
- duration = _this$props3.duration,
152
- bufferedTime = _this$props3.bufferedTime,
153
- disableThumbTooltip = _this$props3.disableThumbTooltip,
154
- isAlwaysActive = _this$props3.isAlwaysActive;
125
+ currentTime = _this$props3.currentTime,
126
+ duration = _this$props3.duration,
127
+ bufferedTime = _this$props3.bufferedTime,
128
+ disableThumbTooltip = _this$props3.disableThumbTooltip,
129
+ isAlwaysActive = _this$props3.isAlwaysActive;
155
130
  var currentPosition = currentTime * 100 / duration;
156
131
  var bufferedTimePercentage = bufferedTime * 100 / duration;
157
132
  return /*#__PURE__*/React.createElement(TimeRangeWrapper, {
@@ -176,10 +151,8 @@ export var TimeRange = /*#__PURE__*/function (_Component) {
176
151
  }, formatDuration(currentTime))))));
177
152
  }
178
153
  }]);
179
-
180
154
  return TimeRange;
181
155
  }(Component);
182
-
183
156
  _defineProperty(TimeRange, "defaultProps", {
184
157
  disableThumbTooltip: false,
185
158
  isAlwaysActive: false
@@ -1,48 +1,43 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
-
4
3
  var getDefaultTimeLocalStorageKey = function getDefaultTimeLocalStorageKey(id) {
5
4
  return "time-saver-default-time-".concat(id);
6
5
  };
6
+
7
7
  /**
8
8
  * Modules that stores watch time (a number) in local storage by unique identifier.
9
9
  * Used in Custom Media Player to enable the feature where a user would resume watching
10
10
  * from where they left off.
11
11
  */
12
-
13
-
14
12
  export var TimeSaver = /*#__PURE__*/function () {
15
13
  function TimeSaver(config) {
16
14
  _classCallCheck(this, TimeSaver);
17
-
18
15
  this.config = config;
19
16
  }
20
-
21
17
  _createClass(TimeSaver, [{
22
18
  key: "defaultTime",
23
19
  get: function get() {
24
20
  if (this.config && localStorage) {
25
21
  try {
26
22
  var fileDefaultTime = localStorage.getItem(getDefaultTimeLocalStorageKey(this.config.contentId));
27
-
28
23
  if (fileDefaultTime) {
29
24
  return JSON.parse(fileDefaultTime);
30
25
  }
31
- } catch (e) {// Nothing to do, falling back to 0
26
+ } catch (e) {
27
+ // Nothing to do, falling back to 0
32
28
  }
33
29
  }
34
-
35
30
  return 0;
36
31
  },
37
32
  set: function set(time) {
38
33
  if (this.config && localStorage) {
39
34
  try {
40
35
  localStorage.setItem(getDefaultTimeLocalStorageKey(this.config.contentId), JSON.stringify(time));
41
- } catch (e) {// Nothing to do, storing hasn't happened.
36
+ } catch (e) {
37
+ // Nothing to do, storing hasn't happened.
42
38
  }
43
39
  }
44
40
  }
45
41
  }]);
46
-
47
42
  return TimeSaver;
48
43
  }();
@@ -1,7 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
2
  var _templateObject;
4
-
5
3
  import React, { useRef, useEffect } from 'react';
6
4
  import styled from '@emotion/styled';
7
5
  import * as exenv from 'exenv';
@@ -12,16 +10,15 @@ var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLi
12
10
  Wrapper.displayName = 'Ellipsify';
13
11
  export var Ellipsify = function Ellipsify(_ref2) {
14
12
  var text = _ref2.text,
15
- lines = _ref2.lines,
16
- endLength = _ref2.endLength,
17
- inline = _ref2.inline,
18
- testId = _ref2.testId;
13
+ lines = _ref2.lines,
14
+ endLength = _ref2.endLength,
15
+ inline = _ref2.inline,
16
+ testId = _ref2.testId;
19
17
  var element = useRef(null);
20
18
  useEffect(function () {
21
19
  if (!element.current) {
22
20
  return;
23
21
  }
24
-
25
22
  setEllipsis(element.current, {
26
23
  lines: lines,
27
24
  endLength: endLength
@@ -35,7 +32,6 @@ export var Ellipsify = function Ellipsify(_ref2) {
35
32
  "data-testid": testId
36
33
  }, text);
37
34
  };
38
-
39
35
  var setEllipsis = function setEllipsis(element, props) {
40
36
  var maximumLines = props.lines;
41
37
  var height = element.getBoundingClientRect().height;
@@ -44,32 +40,26 @@ var setEllipsis = function setEllipsis(element, props) {
44
40
  var lineHeight = element.getBoundingClientRect().height;
45
41
  var lineCount = height / lineHeight;
46
42
  var maximumHeight = lineHeight * maximumLines;
47
-
48
43
  if (lineCount <= maximumLines) {
49
44
  element.textContent = text;
50
45
  return;
51
46
  }
52
-
53
47
  var textContent = text;
54
48
  var endLength = typeof props.endLength === 'number' && props.endLength >= 0 ? props.endLength : 8;
55
49
  var beginningText = text.substr(0, text.length * maximumLines / lineCount - endLength);
56
50
  var endText = text.substr(text.length - endLength, endLength);
57
51
  element.textContent = textContent = "".concat(beginningText, "...").concat(endText);
58
52
  var finalHeight = element.getBoundingClientRect().height;
59
-
60
53
  if (finalHeight > maximumHeight) {
61
54
  var adjustedBeginningText = beginningText.substr(0, beginningText.length - beginningText.length / maximumLines * 0.25);
62
55
  textContent = "".concat(adjustedBeginningText, "...").concat(endText);
63
56
  }
64
-
65
57
  delayRun(function () {
66
58
  return element.textContent = textContent;
67
59
  });
68
60
  };
69
-
70
61
  var timeout = function timeout(fn) {
71
62
  return setTimeout(fn, 1);
72
63
  };
73
-
74
64
  var delayRun = exenv.canUseDOM && window.requestAnimationFrame ? window.requestAnimationFrame : timeout;
75
65
  export default Ellipsify;
@@ -9,12 +9,12 @@ export var formatterOptions = {
9
9
  };
10
10
  export var partsFormatter = function partsFormatter(_ref) {
11
11
  var day = _ref.day,
12
- month = _ref.month,
13
- year = _ref.year,
14
- hour = _ref.hour,
15
- minute = _ref.minute,
16
- _ref$dayPeriod = _ref.dayPeriod,
17
- dayPeriod = _ref$dayPeriod === void 0 ? '' : _ref$dayPeriod;
12
+ month = _ref.month,
13
+ year = _ref.year,
14
+ hour = _ref.hour,
15
+ minute = _ref.minute,
16
+ _ref$dayPeriod = _ref.dayPeriod,
17
+ dayPeriod = _ref$dayPeriod === void 0 ? '' : _ref$dayPeriod;
18
18
  var formattedDayPeriod = dayPeriod.replace(/\./g, '').replace(/\s/g, '');
19
19
  return "".concat(day, " ").concat(month, " ").concat(year, ", ").concat(hour, ":").concat(minute, " ").concat(formattedDayPeriod);
20
20
  };
@@ -1,16 +1,13 @@
1
1
  var pad = function pad(n) {
2
2
  return n < 10 ? "0".concat(n) : n;
3
3
  };
4
-
5
4
  var isInvalidInput = function isInvalidInput(seconds) {
6
5
  return isNaN(seconds) || seconds === Infinity || seconds < 0;
7
6
  };
8
-
9
7
  export var formatDuration = function formatDuration(seconds) {
10
8
  if (isInvalidInput(seconds)) {
11
9
  return '0:00';
12
10
  }
13
-
14
11
  var totalSeconds = parseInt("".concat(seconds), 10);
15
12
  var hours = Math.floor(totalSeconds / 3600);
16
13
  var remainingSeconds = totalSeconds % 3600;
@@ -1,10 +1,11 @@
1
- import * as bytes from 'bytes'; // eslint-disable-next-line no-bitwise
1
+ import * as bytes from 'bytes';
2
2
 
3
+ // eslint-disable-next-line no-bitwise
3
4
  var ONE_MEGABYTE_IN_BYTES = 1 << 20;
5
+
4
6
  /**
5
7
  * Takes a media (file) size in bytes and returns a human readable string
6
8
  */
7
-
8
9
  export function toHumanReadableMediaSize(size) {
9
10
  // [MS-967]: Api issue might return string for size
10
11
  var parsedSize = parseInt("".concat(size), 10);
@@ -14,12 +14,11 @@ var ORIENT_TRANSFORMS = {
14
14
  7: 'rotate(90deg) rotateY(180deg)',
15
15
  // Mirror horizontal and rotate 90 CW
16
16
  8: 'rotate(270deg)' // Rotate 270 CW
17
-
18
17
  };
18
+
19
19
  /**
20
20
  * Returns true if image rotated 90 or 270 degrees (on it's side)
21
21
  */
22
-
23
22
  export var isRotated = function isRotated(orientation) {
24
23
  return orientation >= 5;
25
24
  };