@desynova-digital/player 3.9.7 → 3.9.9
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 +26 -50
- package/actions/player.js +58 -89
- package/actions/video.js +70 -69
- package/colors.js +13 -13
- package/components/AudioMeter.js +138 -182
- package/components/BigPlayButton.js +48 -72
- package/components/ImageViewer.js +120 -165
- package/components/MarkerBar.js +64 -75
- package/components/Menu.js +30 -57
- package/components/Player.js +239 -357
- package/components/PlayerHeader.js +213 -348
- package/components/Playlist.js +50 -89
- package/components/PointersBar.js +131 -203
- package/components/PosterImage.js +12 -22
- package/components/SDOutline.js +32 -54
- package/components/Shortcut.js +135 -140
- package/components/Slider.js +85 -128
- package/components/TagsBar.js +45 -62
- package/components/Video.js +479 -655
- package/components/control-bar/AudioTracksMenuButton.js +63 -86
- package/components/control-bar/CameraButton.js +65 -76
- package/components/control-bar/CommentsButton.js +97 -136
- package/components/control-bar/ControlBar.js +171 -164
- package/components/control-bar/EditorControlMenuButton.js +180 -280
- package/components/control-bar/ForwardControl.js +7 -11
- package/components/control-bar/ForwardReplayControl.js +41 -55
- package/components/control-bar/FullscreenToggle.js +48 -67
- package/components/control-bar/PlayToggle.js +39 -54
- package/components/control-bar/ReplayControl.js +7 -11
- package/components/control-bar/SettingsMenuButton.js +19 -29
- package/components/control-bar/SubtitleLanguagesMenuButton.js +90 -119
- package/components/control-bar/SubtitleMovementMenu.js +128 -0
- package/components/control-bar/VolumeMenuButton.js +71 -96
- package/components/control-bar/ZoomMenuButton.js +57 -81
- package/components/marking-controls/MarkInControl.js +49 -65
- package/components/marking-controls/MarkOutControl.js +53 -69
- package/components/marking-controls/MarkingAddButton.js +41 -54
- package/components/marking-controls/MarkingControl.js +58 -107
- package/components/marking-controls/MarkingDeleteButton.js +39 -51
- package/components/marking-controls/MarkingDuration.js +23 -56
- package/components/marking-controls/MarkingPreview.js +39 -51
- package/components/progress-bar/AudioWaveform.js +48 -64
- package/components/progress-bar/LoadProgressBar.js +14 -37
- package/components/progress-bar/MouseTimeDisplay.js +14 -30
- package/components/progress-bar/PlayProgressBar.js +23 -41
- package/components/progress-bar/ProgressControl.js +82 -141
- package/components/progress-bar/SeekBar.js +101 -169
- package/components/progress-bar/Timeline.js +57 -81
- package/components/settings-menu-control/PlaybackRateControl.js +70 -115
- package/components/settings-menu-control/SafeAreaControl.js +49 -65
- package/components/settings-menu-control/SettingsMenu.js +26 -50
- package/components/time-controls/CurrentTimeDisplay.js +15 -34
- package/components/time-controls/DurationDisplay.js +14 -33
- package/components/time-controls/TimeDivider.js +12 -28
- package/components/volume-control/VolumeBar.js +84 -118
- package/components/volume-control/VolumeControl.js +7 -23
- package/components/volume-control/VolumeLevel.js +19 -36
- package/components/zoom-control/ZoomBar.js +79 -111
- package/components/zoom-control/ZoomLevel.js +24 -36
- package/index.js +204 -149
- package/package.json +5 -1
- package/reducers/index.js +12 -14
- package/reducers/operation.js +14 -14
- package/reducers/player.js +40 -42
- package/utils/browser.js +10 -5
- package/utils/dom.js +4 -15
- package/utils/fullscreen.js +24 -24
- package/utils/index.js +35 -46
|
@@ -1,110 +1,86 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var _styledComponents = require('styled-components');
|
|
18
|
-
|
|
19
|
-
var _styledComponents2 = _interopRequireDefault(_styledComponents);
|
|
20
|
-
|
|
21
|
-
var _components = require('@desynova-digital/components');
|
|
22
|
-
|
|
23
|
-
var _colors = require('../colors');
|
|
24
|
-
|
|
25
|
-
var _colors2 = _interopRequireDefault(_colors);
|
|
26
|
-
|
|
27
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _components = require("@desynova-digital/components");
|
|
12
|
+
var _colors = _interopRequireDefault(require("../colors"));
|
|
13
|
+
var _templateObject; // import { colors } from '@desynova-digital/tokens';
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
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); }
|
|
29
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
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); } }
|
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
|
+
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); }
|
|
24
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
25
|
+
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); }; }
|
|
26
|
+
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); }
|
|
27
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
|
+
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; } }
|
|
29
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
37
31
|
var propTypes = {
|
|
38
32
|
actions: _propTypes.PropTypes.instanceOf(Object),
|
|
39
33
|
player: _propTypes.PropTypes.instanceOf(Object)
|
|
40
34
|
};
|
|
41
|
-
|
|
42
35
|
var defaultProps = {
|
|
43
36
|
actions: {},
|
|
44
37
|
player: {}
|
|
45
38
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
displayName: 'BigPlayButton__PlayButton',
|
|
49
|
-
componentId: 'sc-o6dg96-0'
|
|
50
|
-
})(['background:', ';width:100px;height:100px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);border:none;z-index:1;&:hover,&:focus{background:', ';}'], function (props) {
|
|
51
|
-
return _colors2.default.common.video[props.assetType].buttonGradient;
|
|
39
|
+
var PlayButton = (0, _styledComponents["default"])(_components.Button)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n width: 100px;\n height: 100px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n border: none;\n z-index:1;\n &:hover,\n &:focus {\n background: ", ";\n }\n"])), function (props) {
|
|
40
|
+
return _colors["default"].common.video[props.assetType].buttonGradient;
|
|
52
41
|
}, function (props) {
|
|
53
|
-
return
|
|
42
|
+
return _colors["default"].common.video[props.assetType].buttonGradient;
|
|
54
43
|
});
|
|
55
|
-
|
|
56
|
-
var BigPlayButton = function (_Component) {
|
|
44
|
+
var BigPlayButton = /*#__PURE__*/function (_Component) {
|
|
57
45
|
_inherits(BigPlayButton, _Component);
|
|
58
|
-
|
|
46
|
+
var _super = _createSuper(BigPlayButton);
|
|
59
47
|
function BigPlayButton(props, context) {
|
|
48
|
+
var _this;
|
|
60
49
|
_classCallCheck(this, BigPlayButton);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
_this.handleClick = _this.handleClick.bind(_this);
|
|
50
|
+
_this = _super.call(this, props, context);
|
|
51
|
+
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
|
|
65
52
|
return _this;
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
_createClass(BigPlayButton, [{
|
|
69
|
-
key:
|
|
55
|
+
key: "componentDidMount",
|
|
70
56
|
value: function componentDidMount() {}
|
|
71
57
|
}, {
|
|
72
|
-
key:
|
|
58
|
+
key: "handleClick",
|
|
73
59
|
value: function handleClick() {
|
|
74
60
|
var actions = this.props.actions;
|
|
75
|
-
|
|
76
61
|
actions.play();
|
|
77
62
|
actions.handleVideoRewind(false);
|
|
78
63
|
}
|
|
79
64
|
}, {
|
|
80
|
-
key:
|
|
65
|
+
key: "render",
|
|
81
66
|
value: function render() {
|
|
82
67
|
var player = this.props.player;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
height: 100,
|
|
95
|
-
tabIndex: '0',
|
|
96
|
-
onClick: this.handleClick
|
|
97
|
-
}, this.props)) : null
|
|
98
|
-
);
|
|
68
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, !player.hasStarted || !player.currentSrc || player.paused && !player.rewindActive ? /*#__PURE__*/_react["default"].createElement(PlayButton, _extends({
|
|
69
|
+
display: "rounded",
|
|
70
|
+
appearance: "cta",
|
|
71
|
+
icon: "play",
|
|
72
|
+
iconWidth: 20,
|
|
73
|
+
iconHeight: 26,
|
|
74
|
+
width: 100,
|
|
75
|
+
height: 100,
|
|
76
|
+
tabIndex: "0",
|
|
77
|
+
onClick: this.handleClick
|
|
78
|
+
}, this.props)) : null);
|
|
99
79
|
}
|
|
100
80
|
}]);
|
|
101
|
-
|
|
102
81
|
return BigPlayButton;
|
|
103
82
|
}(_react.Component);
|
|
104
|
-
|
|
105
|
-
exports.default = BigPlayButton;
|
|
106
|
-
|
|
107
|
-
|
|
83
|
+
exports["default"] = BigPlayButton;
|
|
108
84
|
BigPlayButton.propTypes = propTypes;
|
|
109
85
|
BigPlayButton.defaultProps = defaultProps;
|
|
110
86
|
BigPlayButton.displayName = 'BigPlayButton';
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _CommentsButton = require('./control-bar/CommentsButton');
|
|
22
|
-
|
|
23
|
-
var _CommentsButton2 = _interopRequireDefault(_CommentsButton);
|
|
24
|
-
|
|
25
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
-
|
|
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(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
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(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; }
|
|
19
|
+
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; }
|
|
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; }
|
|
27
21
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
25
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
|
+
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); }
|
|
27
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
|
+
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); }; }
|
|
29
|
+
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); }
|
|
30
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
|
+
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; } }
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
34
34
|
/*
|
|
35
35
|
* import { colors } from '@desynova-digital/tokens';
|
|
36
36
|
* import colors from '../colors';
|
|
@@ -39,30 +39,16 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
39
39
|
var propTypes = {
|
|
40
40
|
src: _propTypes.PropTypes.string
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})(['position:relative;overflow:hidden;']);
|
|
47
|
-
|
|
48
|
-
var ImageBlock = (0, _styledComponents2.default)('div').withConfig({
|
|
49
|
-
displayName: 'ImageViewer__ImageBlock',
|
|
50
|
-
componentId: 'sc-5q95u9-1'
|
|
51
|
-
})(['position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:calc(100% - 50px);img{position:relative;transition:all 350ms ease-in-out;&.moving{transition:none;}}']);
|
|
52
|
-
|
|
53
|
-
var ImageControls = (0, _styledComponents2.default)('div').withConfig({
|
|
54
|
-
displayName: 'ImageViewer__ImageControls',
|
|
55
|
-
componentId: 'sc-5q95u9-2'
|
|
56
|
-
})(['position:relative;height:50px;background:#000;display:flex;justify-content:flex-start;align-items:center;padding:0 20px;.zoom-in,.zoom-out{width:20px;height:20px;position:relative;cursor:pointer;&:after{content:\'\';position:absolute;width:14px;height:2px;top:50%;left:50%;transform:translate(-50%,-50%);background:#afb2ba;}}.zoom-in{&:before{content:\'\';position:absolute;width:2px;height:14px;top:50%;left:50%;transform:translate(-50%,-50%);background:#afb2ba;}}.percent{font-size:14px;font-family:SFUIText-Regular;color:#fff;margin:0 15px;}']);
|
|
57
|
-
|
|
58
|
-
var ImageViewer = function (_Component) {
|
|
42
|
+
var ImageContainer = (0, _styledComponents["default"])('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n"])));
|
|
43
|
+
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"])));
|
|
44
|
+
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"])));
|
|
45
|
+
var ImageViewer = /*#__PURE__*/function (_Component) {
|
|
59
46
|
_inherits(ImageViewer, _Component);
|
|
60
|
-
|
|
47
|
+
var _super = _createSuper(ImageViewer);
|
|
61
48
|
function ImageViewer(props) {
|
|
49
|
+
var _this;
|
|
62
50
|
_classCallCheck(this, ImageViewer);
|
|
63
|
-
|
|
64
|
-
var _this = _possibleConstructorReturn(this, (ImageViewer.__proto__ || Object.getPrototypeOf(ImageViewer)).call(this, props));
|
|
65
|
-
|
|
51
|
+
_this = _super.call(this, props);
|
|
66
52
|
_this.state = {
|
|
67
53
|
minWidth: 0,
|
|
68
54
|
minHeight: 0,
|
|
@@ -78,15 +64,13 @@ var ImageViewer = function (_Component) {
|
|
|
78
64
|
_this.initialY;
|
|
79
65
|
_this.xOffset = 0;
|
|
80
66
|
_this.yOffset = 0;
|
|
81
|
-
|
|
82
67
|
return _this;
|
|
83
68
|
}
|
|
84
|
-
|
|
85
69
|
_createClass(ImageViewer, [{
|
|
86
|
-
key:
|
|
70
|
+
key: "componentDidMount",
|
|
87
71
|
value: function componentDidMount() {}
|
|
88
72
|
}, {
|
|
89
|
-
key:
|
|
73
|
+
key: "onMouseDown",
|
|
90
74
|
value: function onMouseDown() {
|
|
91
75
|
this.initialX = event.offsetX;
|
|
92
76
|
this.initialY = event.offsetY;
|
|
@@ -95,24 +79,22 @@ var ImageViewer = function (_Component) {
|
|
|
95
79
|
});
|
|
96
80
|
}
|
|
97
81
|
}, {
|
|
98
|
-
key:
|
|
82
|
+
key: "onMouseUp",
|
|
99
83
|
value: function onMouseUp() {
|
|
100
84
|
this.setState({
|
|
101
85
|
moving: false
|
|
102
86
|
});
|
|
103
87
|
}
|
|
104
88
|
}, {
|
|
105
|
-
key:
|
|
89
|
+
key: "onMouseMove",
|
|
106
90
|
value: function onMouseMove() {
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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;
|
|
116
98
|
if (moving && draggable) {
|
|
117
99
|
this.currentX = event.offsetX - this.initialX;
|
|
118
100
|
this.currentY = event.offsetY - this.initialY;
|
|
@@ -145,12 +127,11 @@ var ImageViewer = function (_Component) {
|
|
|
145
127
|
}
|
|
146
128
|
}
|
|
147
129
|
}, {
|
|
148
|
-
key:
|
|
130
|
+
key: "handleImageLoaded",
|
|
149
131
|
value: function handleImageLoaded() {
|
|
150
132
|
var percentage = Math.round(this.imageRef.offsetHeight / this.imageRef.naturalHeight * 100);
|
|
151
133
|
var imageLeft = (this.imageBlock.offsetWidth - this.imageRef.offsetWidth) / 2;
|
|
152
134
|
var imageTop = (this.imageBlock.offsetHeight - this.imageRef.offsetHeight) / 2;
|
|
153
|
-
|
|
154
135
|
this.setState({
|
|
155
136
|
minWidth: this.imageRef.offsetWidth,
|
|
156
137
|
minHeight: this.imageRef.offsetHeight,
|
|
@@ -164,13 +145,12 @@ var ImageViewer = function (_Component) {
|
|
|
164
145
|
});
|
|
165
146
|
}
|
|
166
147
|
}, {
|
|
167
|
-
key:
|
|
148
|
+
key: "zoomIn",
|
|
168
149
|
value: function zoomIn() {
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
150
|
+
var _this$state2 = this.state,
|
|
151
|
+
maxWidth = _this$state2.maxWidth,
|
|
152
|
+
maxHeight = _this$state2.maxHeight,
|
|
153
|
+
percentage = _this$state2.percentage;
|
|
174
154
|
if (percentage < 100) {
|
|
175
155
|
var newPercentage = Math.round(percentage / 10) * 10 + 10;
|
|
176
156
|
newPercentage = newPercentage > 100 ? 100 : newPercentage;
|
|
@@ -189,14 +169,13 @@ var ImageViewer = function (_Component) {
|
|
|
189
169
|
}
|
|
190
170
|
}
|
|
191
171
|
}, {
|
|
192
|
-
key:
|
|
172
|
+
key: "zoomOut",
|
|
193
173
|
value: function zoomOut() {
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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;
|
|
200
179
|
if (percentage) {
|
|
201
180
|
var minPercent = Math.round(minWidth / maxWidth * 100);
|
|
202
181
|
var newPercentage = Math.round(percentage / 10) * 10 - 10;
|
|
@@ -214,7 +193,7 @@ var ImageViewer = function (_Component) {
|
|
|
214
193
|
imageTop: imageTop
|
|
215
194
|
};
|
|
216
195
|
if (minPercent === newPercentage) {
|
|
217
|
-
stateObj =
|
|
196
|
+
stateObj = _objectSpread(_objectSpread({}, stateObj), {}, {
|
|
218
197
|
draggable: false
|
|
219
198
|
});
|
|
220
199
|
}
|
|
@@ -222,97 +201,73 @@ var ImageViewer = function (_Component) {
|
|
|
222
201
|
}
|
|
223
202
|
}
|
|
224
203
|
}, {
|
|
225
|
-
key:
|
|
204
|
+
key: "render",
|
|
226
205
|
value: function render() {
|
|
227
206
|
var _this2 = this;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
moving = _state4.moving;
|
|
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;
|
|
241
219
|
var src = this.props.src;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}),
|
|
290
|
-
_react2.default.createElement(
|
|
291
|
-
'p',
|
|
292
|
-
{
|
|
293
|
-
className: 'percent'
|
|
294
|
-
},
|
|
295
|
-
percentage,
|
|
296
|
-
'%'
|
|
297
|
-
),
|
|
298
|
-
_react2.default.createElement('p', {
|
|
299
|
-
className: 'zoom-out',
|
|
300
|
-
role: 'presentation',
|
|
301
|
-
onClick: function onClick() {
|
|
302
|
-
return _this2.zoomOut();
|
|
303
|
-
}
|
|
304
|
-
}),
|
|
305
|
-
_react2.default.createElement(_CommentsButton2.default, _extends({}, this.props, { key: 'comments-button', order: 6.01 }))
|
|
306
|
-
)
|
|
307
|
-
);
|
|
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
|
+
}))));
|
|
308
267
|
}
|
|
309
268
|
}]);
|
|
310
|
-
|
|
311
269
|
return ImageViewer;
|
|
312
270
|
}(_react.Component);
|
|
313
|
-
|
|
314
|
-
exports.default = ImageViewer;
|
|
315
|
-
|
|
316
|
-
|
|
271
|
+
exports["default"] = ImageViewer;
|
|
317
272
|
ImageViewer.propTypes = propTypes;
|
|
318
273
|
ImageViewer.displayName = 'ImageViewer';
|