@desynova-digital/player 4.0.1 → 4.0.3
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/Manager.js +99 -0
- package/actions/player.js +331 -0
- package/actions/video.js +206 -0
- package/{utils/colors.js → colors.js} +1 -2
- package/{media → components}/AudioMeter.js +96 -109
- package/components/BigPlayButton.js +84 -0
- package/components/ImageViewer.js +272 -0
- package/{control → components}/MarkerBar.js +33 -24
- package/{utils → components}/Menu.js +13 -4
- package/components/Player.js +706 -0
- package/{header/Header.js → components/PlayerHeader.js} +104 -78
- package/components/Playlist.js +95 -0
- package/{control → components}/PointersBar.js +122 -61
- package/components/PosterImage.js +50 -0
- package/{media → components}/SDOutline.js +13 -49
- package/components/Shortcut.js +821 -0
- package/{control → components}/Slider.js +27 -23
- package/components/TagsBar.js +81 -0
- package/components/Video.js +1280 -0
- package/{control → components/control-bar}/AudioTracksMenuButton.js +32 -28
- package/components/control-bar/CameraButton.js +75 -0
- package/components/control-bar/CommentsButton.js +186 -0
- package/components/control-bar/ControlBar.js +266 -0
- package/components/control-bar/EditorControlMenuButton.js +317 -0
- package/components/control-bar/ForwardControl.js +12 -0
- package/components/control-bar/ForwardReplayControl.js +106 -0
- package/{control → components/control-bar}/FullscreenToggle.js +26 -21
- package/components/control-bar/PlayToggle.js +85 -0
- package/components/control-bar/ReplayControl.js +12 -0
- package/components/control-bar/SettingsMenuButton.js +41 -0
- package/components/control-bar/SubtitleLanguagesMenuButton.js +149 -0
- package/components/control-bar/SubtitleMovementMenu.js +140 -0
- package/{control/VolumneMenuButton.js → components/control-bar/VolumeMenuButton.js} +26 -27
- package/components/control-bar/ZoomMenuButton.js +90 -0
- package/{control → components/marking-controls}/MarkInControl.js +32 -25
- package/{control → components/marking-controls}/MarkOutControl.js +35 -26
- package/components/marking-controls/MarkingAddButton.js +79 -0
- package/components/marking-controls/MarkingControl.js +95 -0
- package/components/marking-controls/MarkingDeleteButton.js +70 -0
- package/{control → components/marking-controls}/MarkingDuration.js +12 -5
- package/components/marking-controls/MarkingPreview.js +72 -0
- package/components/progress-bar/AudioWaveform.js +126 -0
- package/components/progress-bar/LoadProgressBar.js +67 -0
- package/components/progress-bar/MouseTimeDisplay.js +36 -0
- package/{control → components/progress-bar}/PlayProgressBar.js +4 -4
- package/components/progress-bar/ProgressControl.js +186 -0
- package/{control → components/progress-bar}/SeekBar.js +113 -72
- package/{control → components/progress-bar}/Timeline.js +43 -32
- package/{control/PlayBackRateControl.js → components/settings-menu-control/PlaybackRateControl.js} +44 -30
- package/components/settings-menu-control/SafeAreaControl.js +81 -0
- package/components/settings-menu-control/SettingsMenu.js +56 -0
- package/components/settings-menu-control/SubtitleControl.js +1 -0
- package/components/time-controls/CurrentTimeDisplay.js +83 -0
- package/{control → components/time-controls}/DurationDisplay.js +8 -15
- package/components/time-controls/TimeDivider.js +25 -0
- package/{control → components/volume-control}/VolumeBar.js +62 -80
- package/components/volume-control/VolumeControl.js +19 -0
- package/{control → components/volume-control}/VolumeLevel.js +2 -3
- package/components/zoom-control/ZoomBar.js +155 -0
- package/components/zoom-control/ZoomLevel.js +55 -0
- package/index.js +198 -1
- package/package.json +5 -8
- package/reducers/index.js +19 -0
- package/reducers/operation.js +35 -0
- package/reducers/player.js +222 -0
- package/utils/browser.js +30 -0
- package/utils/dom.js +1 -2
- package/utils/fullscreen.js +72 -0
- package/utils/index.js +156 -57
- package/Player.js +0 -945
- package/control/AudioTracksMenuButton.jsx +0 -80
- package/control/ControlBar.js +0 -303
- package/control/ControlBar.jsx +0 -264
- package/control/CurrentTimeDisplay.js +0 -34
- package/control/CurrentTimeDisplay.jsx +0 -35
- package/control/DurationDisplay.jsx +0 -48
- package/control/ForwardBackwardControl.js +0 -76
- package/control/ForwardBackwardControl.jsx +0 -79
- package/control/FullscreenToggle.jsx +0 -83
- package/control/MarkInControl.jsx +0 -109
- package/control/MarkOutControl.jsx +0 -131
- package/control/MarkerBar.jsx +0 -107
- package/control/MarkingControl.js +0 -82
- package/control/MarkingControl.jsx +0 -143
- package/control/MarkingPreview.js +0 -49
- package/control/MarkingPreview.jsx +0 -60
- package/control/PlayBackRateControl.jsx +0 -106
- package/control/PlayProgressBar.jsx +0 -92
- package/control/PlayToggle.js +0 -56
- package/control/PlayToggle.jsx +0 -57
- package/control/PointersBar.jsx +0 -286
- package/control/ProgressControl.js +0 -127
- package/control/ProgressControl.jsx +0 -155
- package/control/SeekBar.jsx +0 -229
- package/control/SettingsMenuButton.js +0 -63
- package/control/SettingsMenuButton.jsx +0 -69
- package/control/Slider.jsx +0 -243
- package/control/Timeline.jsx +0 -131
- package/control/VolumeBar.jsx +0 -174
- package/control/VolumeLevel.jsx +0 -66
- package/control/VolumneMenuButton.jsx +0 -111
- package/header/Header.jsx +0 -479
- package/media/AudioMeter.jsx +0 -411
- package/media/SDOutline.jsx +0 -90
- package/media/Video.js +0 -684
- package/media/Video.jsx +0 -714
- package/playlist/Playlist.js +0 -67
- package/playlist/Playlist.jsx +0 -91
- package/playlist/index.js +0 -13
- package/shortcuts/Shortcut.js +0 -662
- package/utils/Menu.jsx +0 -105
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _CommentsButton = _interopRequireDefault(require("./control-bar/CommentsButton"));
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
13
|
+
/* eslint-disable linebreak-style */
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
23
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
27
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
34
|
+
/*
|
|
35
|
+
* import { colors } from '@desynova-digital/tokens';
|
|
36
|
+
* import colors from '../colors';
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
var propTypes = {
|
|
40
|
+
src: _propTypes.PropTypes.string,
|
|
41
|
+
theme: _propTypes.PropTypes.string
|
|
42
|
+
};
|
|
43
|
+
var ImageContainer = (0, _styledComponents["default"])('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n"])));
|
|
44
|
+
var ImageBlock = (0, _styledComponents["default"])('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n width: 100%;\n height: calc(100% - 50px);\n img {\n position: relative;\n transition: all 350ms ease-in-out;\n &.moving {\n transition: none;\n }\n }\n"])));
|
|
45
|
+
var ImageControls = (0, _styledComponents["default"])('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n height: 50px;\n background: #000;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding: 0 20px;\n .zoom-in, .zoom-out {\n width: 20px;\n height: 20px;\n position: relative;\n cursor: pointer;\n &:after {\n content: '';\n position: absolute;\n width: 14px;\n height: 2px;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: #afb2ba;\n }\n }\n .zoom-in {\n &:before {\n content: '';\n position: absolute;\n width: 2px;\n height: 14px;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: #afb2ba;\n }\n }\n .percent {\n font-size: 14px;\n font-family: SFUIText-Regular;\n color: #fff;\n margin: 0 15px;\n }\n"])));
|
|
46
|
+
var ImageViewer = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
47
|
+
_inherits(ImageViewer, _Component);
|
|
48
|
+
function ImageViewer(props) {
|
|
49
|
+
var _this;
|
|
50
|
+
_classCallCheck(this, ImageViewer);
|
|
51
|
+
_this = _callSuper(this, ImageViewer, [props]);
|
|
52
|
+
_this.state = {
|
|
53
|
+
minWidth: 0,
|
|
54
|
+
minHeight: 0,
|
|
55
|
+
maxWidth: '100%',
|
|
56
|
+
maxHeight: '100%',
|
|
57
|
+
currentHeight: 'auto',
|
|
58
|
+
currentWidth: 'auto',
|
|
59
|
+
draggable: false
|
|
60
|
+
};
|
|
61
|
+
_this.currentX;
|
|
62
|
+
_this.currentY;
|
|
63
|
+
_this.initialX;
|
|
64
|
+
_this.initialY;
|
|
65
|
+
_this.xOffset = 0;
|
|
66
|
+
_this.yOffset = 0;
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
_createClass(ImageViewer, [{
|
|
70
|
+
key: "componentDidMount",
|
|
71
|
+
value: function componentDidMount() {}
|
|
72
|
+
}, {
|
|
73
|
+
key: "onMouseDown",
|
|
74
|
+
value: function onMouseDown() {
|
|
75
|
+
this.initialX = event.offsetX;
|
|
76
|
+
this.initialY = event.offsetY;
|
|
77
|
+
this.setState({
|
|
78
|
+
moving: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "onMouseUp",
|
|
83
|
+
value: function onMouseUp() {
|
|
84
|
+
this.setState({
|
|
85
|
+
moving: false
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "onMouseMove",
|
|
90
|
+
value: function onMouseMove() {
|
|
91
|
+
var _this$state = this.state,
|
|
92
|
+
moving = _this$state.moving,
|
|
93
|
+
draggable = _this$state.draggable,
|
|
94
|
+
currentWidth = _this$state.currentWidth,
|
|
95
|
+
currentHeight = _this$state.currentHeight,
|
|
96
|
+
imageTop = _this$state.imageTop,
|
|
97
|
+
imageLeft = _this$state.imageLeft;
|
|
98
|
+
if (moving && draggable) {
|
|
99
|
+
this.currentX = event.offsetX - this.initialX;
|
|
100
|
+
this.currentY = event.offsetY - this.initialY;
|
|
101
|
+
var newLeft = imageLeft;
|
|
102
|
+
var newTop = imageTop;
|
|
103
|
+
if (currentWidth > this.imageBlock.offsetWidth) {
|
|
104
|
+
var minLeft = 0;
|
|
105
|
+
var maxLeft = this.imageBlock.offsetWidth - currentWidth;
|
|
106
|
+
newLeft = this.imageRef.offsetLeft + this.currentX;
|
|
107
|
+
if (newLeft > minLeft) {
|
|
108
|
+
newLeft = minLeft;
|
|
109
|
+
} else if (newLeft < maxLeft) {
|
|
110
|
+
newLeft = maxLeft;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (currentHeight > this.imageBlock.offsetHeight) {
|
|
114
|
+
var minTop = 0;
|
|
115
|
+
var maxTop = this.imageBlock.offsetHeight - currentHeight;
|
|
116
|
+
newTop = this.imageRef.offsetTop + this.currentY;
|
|
117
|
+
if (newTop > minTop) {
|
|
118
|
+
newTop = minTop;
|
|
119
|
+
} else if (newTop < maxTop) {
|
|
120
|
+
newTop = maxTop;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this.setState({
|
|
124
|
+
imageLeft: newLeft,
|
|
125
|
+
imageTop: newTop
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "handleImageLoaded",
|
|
131
|
+
value: function handleImageLoaded() {
|
|
132
|
+
var percentage = Math.round(this.imageRef.offsetHeight / this.imageRef.naturalHeight * 100);
|
|
133
|
+
var imageLeft = (this.imageBlock.offsetWidth - this.imageRef.offsetWidth) / 2;
|
|
134
|
+
var imageTop = (this.imageBlock.offsetHeight - this.imageRef.offsetHeight) / 2;
|
|
135
|
+
this.setState({
|
|
136
|
+
minWidth: this.imageRef.offsetWidth,
|
|
137
|
+
minHeight: this.imageRef.offsetHeight,
|
|
138
|
+
maxWidth: this.imageRef.naturalWidth,
|
|
139
|
+
maxHeight: this.imageRef.naturalHeight,
|
|
140
|
+
currentWidth: this.imageRef.offsetWidth,
|
|
141
|
+
currentHeight: this.imageRef.offsetHeight,
|
|
142
|
+
percentage: percentage,
|
|
143
|
+
imageLeft: imageLeft,
|
|
144
|
+
imageTop: imageTop
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "zoomIn",
|
|
149
|
+
value: function zoomIn() {
|
|
150
|
+
var _this$state2 = this.state,
|
|
151
|
+
maxWidth = _this$state2.maxWidth,
|
|
152
|
+
maxHeight = _this$state2.maxHeight,
|
|
153
|
+
percentage = _this$state2.percentage;
|
|
154
|
+
if (percentage < 100) {
|
|
155
|
+
var newPercentage = Math.round(percentage / 10) * 10 + 10;
|
|
156
|
+
newPercentage = newPercentage > 100 ? 100 : newPercentage;
|
|
157
|
+
var newWidth = newPercentage * maxWidth / 100;
|
|
158
|
+
var newHeight = newPercentage * maxHeight / 100;
|
|
159
|
+
var imageLeft = (this.imageBlock.offsetWidth - newWidth) / 2;
|
|
160
|
+
var imageTop = (this.imageBlock.offsetHeight - newHeight) / 2;
|
|
161
|
+
this.setState({
|
|
162
|
+
percentage: newPercentage,
|
|
163
|
+
currentWidth: newWidth,
|
|
164
|
+
currentHeight: newHeight,
|
|
165
|
+
draggable: true,
|
|
166
|
+
imageLeft: imageLeft,
|
|
167
|
+
imageTop: imageTop
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "zoomOut",
|
|
173
|
+
value: function zoomOut() {
|
|
174
|
+
var _this$state3 = this.state,
|
|
175
|
+
minWidth = _this$state3.minWidth,
|
|
176
|
+
maxWidth = _this$state3.maxWidth,
|
|
177
|
+
maxHeight = _this$state3.maxHeight,
|
|
178
|
+
percentage = _this$state3.percentage;
|
|
179
|
+
if (percentage) {
|
|
180
|
+
var minPercent = Math.round(minWidth / maxWidth * 100);
|
|
181
|
+
var newPercentage = Math.round(percentage / 10) * 10 - 10;
|
|
182
|
+
newPercentage = newPercentage < minPercent ? minPercent : newPercentage;
|
|
183
|
+
var newWidth = newPercentage * maxWidth / 100;
|
|
184
|
+
var newHeight = newPercentage * maxHeight / 100;
|
|
185
|
+
var imageLeft = (this.imageBlock.offsetWidth - newWidth) / 2;
|
|
186
|
+
var imageTop = (this.imageBlock.offsetHeight - newHeight) / 2;
|
|
187
|
+
var stateObj = {
|
|
188
|
+
percentage: newPercentage,
|
|
189
|
+
currentWidth: newWidth,
|
|
190
|
+
currentHeight: newHeight,
|
|
191
|
+
draggable: true,
|
|
192
|
+
imageLeft: imageLeft,
|
|
193
|
+
imageTop: imageTop
|
|
194
|
+
};
|
|
195
|
+
if (minPercent === newPercentage) {
|
|
196
|
+
stateObj = _objectSpread(_objectSpread({}, stateObj), {}, {
|
|
197
|
+
draggable: false
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
this.setState(stateObj);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "render",
|
|
205
|
+
value: function render() {
|
|
206
|
+
var _this2 = this;
|
|
207
|
+
var _this$state4 = this.state,
|
|
208
|
+
minWidth = _this$state4.minWidth,
|
|
209
|
+
minHeight = _this$state4.minHeight,
|
|
210
|
+
maxWidth = _this$state4.maxWidth,
|
|
211
|
+
maxHeight = _this$state4.maxHeight,
|
|
212
|
+
currentWidth = _this$state4.currentWidth,
|
|
213
|
+
currentHeight = _this$state4.currentHeight,
|
|
214
|
+
percentage = _this$state4.percentage,
|
|
215
|
+
imageTop = _this$state4.imageTop,
|
|
216
|
+
imageLeft = _this$state4.imageLeft,
|
|
217
|
+
draggable = _this$state4.draggable,
|
|
218
|
+
moving = _this$state4.moving;
|
|
219
|
+
var src = this.props.src;
|
|
220
|
+
return /*#__PURE__*/_react["default"].createElement(ImageContainer, null, /*#__PURE__*/_react["default"].createElement(ImageBlock, {
|
|
221
|
+
ref: function ref(imageBlock) {
|
|
222
|
+
return _this2.imageBlock = imageBlock;
|
|
223
|
+
}
|
|
224
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
225
|
+
role: "presentation",
|
|
226
|
+
style: {
|
|
227
|
+
minWidth: minWidth,
|
|
228
|
+
minHeight: minHeight,
|
|
229
|
+
maxWidth: maxWidth,
|
|
230
|
+
maxHeight: maxHeight,
|
|
231
|
+
width: currentWidth,
|
|
232
|
+
height: currentHeight,
|
|
233
|
+
top: imageTop,
|
|
234
|
+
left: imageLeft,
|
|
235
|
+
cursor: draggable ? 'grab' : 'default'
|
|
236
|
+
},
|
|
237
|
+
draggable: false,
|
|
238
|
+
ref: function ref(imageRef) {
|
|
239
|
+
return _this2.imageRef = imageRef;
|
|
240
|
+
},
|
|
241
|
+
onLoad: this.handleImageLoaded.bind(this),
|
|
242
|
+
onMouseDown: this.onMouseDown.bind(this),
|
|
243
|
+
onMouseMove: this.onMouseMove.bind(this),
|
|
244
|
+
onMouseUp: this.onMouseUp.bind(this),
|
|
245
|
+
alt: "WILD_magazine_Polar_bear_final_00635",
|
|
246
|
+
src: src,
|
|
247
|
+
className: moving ? 'moving' : ''
|
|
248
|
+
// src='https://www.nginx.com/wp-content/uploads/2015/04/nginx-plus-dashboard_R6.png'
|
|
249
|
+
})), /*#__PURE__*/_react["default"].createElement(ImageControls, null, /*#__PURE__*/_react["default"].createElement("p", {
|
|
250
|
+
className: "zoom-in",
|
|
251
|
+
role: "presentation",
|
|
252
|
+
onClick: function onClick() {
|
|
253
|
+
return _this2.zoomIn();
|
|
254
|
+
}
|
|
255
|
+
}), /*#__PURE__*/_react["default"].createElement("p", {
|
|
256
|
+
className: "percent"
|
|
257
|
+
}, percentage, "%"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
258
|
+
className: "zoom-out",
|
|
259
|
+
role: "presentation",
|
|
260
|
+
onClick: function onClick() {
|
|
261
|
+
return _this2.zoomOut();
|
|
262
|
+
}
|
|
263
|
+
}), /*#__PURE__*/_react["default"].createElement(_CommentsButton["default"], _extends({}, this.props, {
|
|
264
|
+
key: "comments-button",
|
|
265
|
+
order: 6.01
|
|
266
|
+
}))));
|
|
267
|
+
}
|
|
268
|
+
}]);
|
|
269
|
+
return ImageViewer;
|
|
270
|
+
}(_react.Component);
|
|
271
|
+
ImageViewer.propTypes = propTypes;
|
|
272
|
+
ImageViewer.displayName = 'ImageViewer';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -9,22 +9,23 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _propTypes = require("prop-types");
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
var _components = require("@desynova-digital/components");
|
|
12
|
+
var _tokens = require("@desynova-digital/tokens");
|
|
12
13
|
var _templateObject;
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
16
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
18
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
18
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
function _toPropertyKey(
|
|
20
|
-
function _toPrimitive(
|
|
21
|
-
function
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
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); }; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
24
23
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
25
|
-
function
|
|
26
|
-
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; } }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
29
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
30
|
/*
|
|
30
31
|
* import { colors } from '@desynova-digital/tokens';
|
|
@@ -33,7 +34,8 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
33
34
|
|
|
34
35
|
var propTypes = {
|
|
35
36
|
player: _propTypes.PropTypes.instanceOf(Object),
|
|
36
|
-
controlType: _propTypes.PropTypes.string
|
|
37
|
+
controlType: _propTypes.PropTypes.string,
|
|
38
|
+
theme: _propTypes.PropTypes.string
|
|
37
39
|
};
|
|
38
40
|
var defaultProps = {
|
|
39
41
|
player: {}
|
|
@@ -43,13 +45,12 @@ var MarkerBlock = _styledComponents["default"].div(_templateObject || (_template
|
|
|
43
45
|
}, function (props) {
|
|
44
46
|
return props.controlType === 'advanced' && !props.isFullscreen ? '0px' : '5px';
|
|
45
47
|
}, _components.Icon.Element);
|
|
46
|
-
var MarkerBar = /*#__PURE__*/function (_Component) {
|
|
48
|
+
var MarkerBar = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
47
49
|
_inherits(MarkerBar, _Component);
|
|
48
|
-
var _super = _createSuper(MarkerBar);
|
|
49
50
|
function MarkerBar(props) {
|
|
50
51
|
var _this;
|
|
51
52
|
_classCallCheck(this, MarkerBar);
|
|
52
|
-
_this =
|
|
53
|
+
_this = _callSuper(this, MarkerBar, [props]);
|
|
53
54
|
_this.getMarkerPosition = _this.getMarkerPosition.bind(_assertThisInitialized(_this));
|
|
54
55
|
_this.getTimePos = _this.getTimePos.bind(_assertThisInitialized(_this));
|
|
55
56
|
return _this;
|
|
@@ -57,8 +58,8 @@ var MarkerBar = /*#__PURE__*/function (_Component) {
|
|
|
57
58
|
_createClass(MarkerBar, [{
|
|
58
59
|
key: "getMarkerPosition",
|
|
59
60
|
value: function getMarkerPosition(timePos) {
|
|
60
|
-
var
|
|
61
|
-
var percent = timePos /
|
|
61
|
+
var player = this.props.player;
|
|
62
|
+
var percent = timePos / player.duration;
|
|
62
63
|
return percent >= 1 ? 1 : percent;
|
|
63
64
|
}
|
|
64
65
|
}, {
|
|
@@ -88,14 +89,23 @@ var MarkerBar = /*#__PURE__*/function (_Component) {
|
|
|
88
89
|
key: "render",
|
|
89
90
|
value: function render() {
|
|
90
91
|
var _this$props = this.props,
|
|
91
|
-
|
|
92
|
+
player = _this$props.player,
|
|
92
93
|
controlType = _this$props.controlType,
|
|
93
|
-
playerSelectedMarker = _this$props.playerSelectedMarker
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
playerSelectedMarker = _this$props.playerSelectedMarker,
|
|
95
|
+
zoom = _this$props.zoom,
|
|
96
|
+
theme = _this$props.theme;
|
|
97
|
+
var leftMarkerPosition = 0;
|
|
98
|
+
var rightMarkerPosition = 0;
|
|
99
|
+
if (zoom > 0) {
|
|
100
|
+
leftMarkerPosition = "".concat((this.getMarkerPosition(playerSelectedMarker.leftMarker) * 100 * zoom * 20).toFixed(2), "%");
|
|
101
|
+
rightMarkerPosition = "".concat((this.getMarkerPosition(playerSelectedMarker.rightMarker) * 100 * zoom * 20).toFixed(2), "%");
|
|
102
|
+
} else {
|
|
103
|
+
leftMarkerPosition = "".concat((this.getMarkerPosition(playerSelectedMarker.leftMarker) * 100).toFixed(2), "%");
|
|
104
|
+
rightMarkerPosition = "".concat((this.getMarkerPosition(playerSelectedMarker.rightMarker) * 100).toFixed(2), "%");
|
|
105
|
+
}
|
|
96
106
|
return /*#__PURE__*/_react["default"].createElement(MarkerBlock, {
|
|
97
107
|
controlType: controlType,
|
|
98
|
-
isFullscreen: isFullscreen
|
|
108
|
+
isFullscreen: player.isFullscreen
|
|
99
109
|
}, playerSelectedMarker.leftMarker > -1 ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
100
110
|
className: "marker marker-left",
|
|
101
111
|
style: {
|
|
@@ -105,7 +115,7 @@ var MarkerBar = /*#__PURE__*/function (_Component) {
|
|
|
105
115
|
name: "marker",
|
|
106
116
|
width: 8,
|
|
107
117
|
height: 7,
|
|
108
|
-
color: "#00cec6
|
|
118
|
+
color: theme ? "".concat(_tokens.colors[theme].videoPlayer.themeColor) : '#00cec6'
|
|
109
119
|
})) : null, playerSelectedMarker.rightMarker > -1 ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
110
120
|
className: "marker marker-right",
|
|
111
121
|
style: {
|
|
@@ -115,13 +125,12 @@ var MarkerBar = /*#__PURE__*/function (_Component) {
|
|
|
115
125
|
name: "marker",
|
|
116
126
|
width: 8,
|
|
117
127
|
height: 7,
|
|
118
|
-
color: "#00cec6
|
|
128
|
+
color: theme ? "".concat(_tokens.colors[theme].videoPlayer.themeColor) : '#00cec6'
|
|
119
129
|
})) : null);
|
|
120
130
|
}
|
|
121
131
|
}]);
|
|
122
132
|
return MarkerBar;
|
|
123
133
|
}(_react.Component);
|
|
124
|
-
exports["default"] = MarkerBar;
|
|
125
134
|
MarkerBar.propTypes = propTypes;
|
|
126
135
|
MarkerBar.defaultProps = defaultProps;
|
|
127
136
|
MarkerBar.displayName = 'MarkerBar';
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
var _propTypes = require("prop-types");
|
|
10
10
|
var _components = require("@desynova-digital/components");
|
|
11
|
+
var _tokens = require("@desynova-digital/tokens");
|
|
11
12
|
var _templateObject, _templateObject2;
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
14
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
@@ -16,22 +17,30 @@ var propTypes = {
|
|
|
16
17
|
icon: _propTypes.PropTypes.string,
|
|
17
18
|
style: _propTypes.PropTypes.instanceOf(Object),
|
|
18
19
|
active: _propTypes.PropTypes.bool,
|
|
19
|
-
position: _propTypes.PropTypes.string
|
|
20
|
+
position: _propTypes.PropTypes.string,
|
|
21
|
+
theme: _propTypes.PropTypes.string
|
|
20
22
|
};
|
|
21
23
|
var defaultProps = {
|
|
22
24
|
position: 'center'
|
|
23
25
|
};
|
|
24
|
-
var MenuContainer = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 20px;\n position: relative;\n &:hover {\n .menu-popup {\n visibility: visible;\n opacity: 1;\n }\n }\n .menu-popup {\n visibility: hidden;\n opacity: 0;\n position: absolute;\n bottom: 20px;\n padding-bottom: 16px;\n z-index: 10;\n transition: all 350ms ease-in-out;\n &.right {\n left: -10px;\n &:after {\n left: 15px;\n }\n }\n &.center {\n left: 50%;\n transform: translateX(-50%);\n &:after {\n left: 50%;\n transform: translateX(-50%);\n }\n }\n &.left {\n right: -10px;\n &:after {\n right: 15px;\n }\n }\n &.active {\n visibility: visible;\n opacity: 1;\n }\n &:after {\n content: '';\n border-left: 6px solid transparent;\n position: absolute;\n border-right: 6px solid transparent;\n border-top: 6px solid
|
|
25
|
-
|
|
26
|
+
var MenuContainer = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 20px;\n position: relative;\n &:hover {\n .menu-popup {\n visibility: visible;\n opacity: 1;\n }\n }\n .menu-popup {\n visibility: hidden;\n opacity: 0;\n position: absolute;\n bottom: 20px;\n padding-bottom: 16px;\n z-index: 10;\n transition: all 350ms ease-in-out;\n &.right {\n left: -10px;\n &:after {\n left: 15px;\n }\n }\n &.center {\n left: 50%;\n transform: translateX(-50%);\n &:after {\n left: 50%;\n transform: translateX(-50%);\n }\n }\n &.left {\n right: -10px;\n &:after {\n right: 15px;\n }\n }\n &.active {\n visibility: visible;\n opacity: 1;\n }\n &:after {\n content: '';\n border-left: 6px solid transparent;\n position: absolute;\n border-right: 6px solid transparent;\n border-top: 6px solid ", ";\n bottom: 10px;\n }\n .menu-list {\n border-radius: 10px;\n background: #fff;\n min-width: 175px;\n max-height: 500px;\n transition: all 250ms ease-in-out;\n overflow: auto;\n max-height: 400px;\n }\n }\n"])), function (props) {
|
|
27
|
+
return props.theme ? " ".concat(_tokens.colors[props.theme].videoPlayer.borderColor) : 'rgb(0, 206, 198)';
|
|
28
|
+
});
|
|
29
|
+
var MenuIcon = (0, _styledComponents["default"])(_components.Button)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n margin: 0px;\n &:hover,\n &:focus {\n background: transparent;\n svg path {\n fill: ", ";\n }\n }\n"])), function (props) {
|
|
30
|
+
return props.theme ? " ".concat(_tokens.colors[props.theme].videoPlayer.themeColor) : '#00cec6';
|
|
31
|
+
});
|
|
26
32
|
function Menu(_ref) {
|
|
27
33
|
var style = _ref.style,
|
|
28
34
|
children = _ref.children,
|
|
29
35
|
icon = _ref.icon,
|
|
30
36
|
active = _ref.active,
|
|
31
|
-
position = _ref.position
|
|
37
|
+
position = _ref.position,
|
|
38
|
+
theme = _ref.theme;
|
|
32
39
|
return /*#__PURE__*/_react["default"].createElement(MenuContainer, {
|
|
40
|
+
theme: theme,
|
|
33
41
|
style: style
|
|
34
42
|
}, /*#__PURE__*/_react["default"].createElement(MenuIcon, {
|
|
43
|
+
theme: theme,
|
|
35
44
|
display: "rounded",
|
|
36
45
|
appearance: "cta",
|
|
37
46
|
icon: icon,
|