@opensumi/ide-components 3.2.2-next-1722913990.0 → 3.2.2-next-1723024363.0

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 (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -775,7 +775,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n})
775
775
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
776
776
 
777
777
  "use strict";
778
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\nvar _extends = Object.assign || 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; };\n\nvar _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _raf2 = __webpack_require__(/*! raf */ \"../../node_modules/raf/index.js\");\n\nvar _raf3 = _interopRequireDefault(_raf2);\n\nvar _domCss = __webpack_require__(/*! dom-css */ \"../../node_modules/dom-css/index.js\");\n\nvar _domCss2 = _interopRequireDefault(_domCss);\n\nvar _react = __webpack_require__(/*! react */ \"../../node_modules/react/index.js\");\n\nvar _propTypes = __webpack_require__(/*! prop-types */ \"../../node_modules/prop-types/index.js\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _isString = __webpack_require__(/*! ../utils/isString */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/isString.js\");\n\nvar _isString2 = _interopRequireDefault(_isString);\n\nvar _getScrollbarWidth = __webpack_require__(/*! ../utils/getScrollbarWidth */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/getScrollbarWidth.js\");\n\nvar _getScrollbarWidth2 = _interopRequireDefault(_getScrollbarWidth);\n\nvar _returnFalse = __webpack_require__(/*! ../utils/returnFalse */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/returnFalse.js\");\n\nvar _returnFalse2 = _interopRequireDefault(_returnFalse);\n\nvar _getInnerWidth = __webpack_require__(/*! ../utils/getInnerWidth */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/getInnerWidth.js\");\n\nvar _getInnerWidth2 = _interopRequireDefault(_getInnerWidth);\n\nvar _getInnerHeight = __webpack_require__(/*! ../utils/getInnerHeight */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/getInnerHeight.js\");\n\nvar _getInnerHeight2 = _interopRequireDefault(_getInnerHeight);\n\nvar _styles = __webpack_require__(/*! ./styles */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/Scrollbars/styles.js\");\n\nvar _defaultRenderElements = __webpack_require__(/*! ./defaultRenderElements */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/Scrollbars/defaultRenderElements.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Scrollbars = function (_Component) {\n _inherits(Scrollbars, _Component);\n\n function Scrollbars(props) {\n var _ref;\n\n _classCallCheck(this, Scrollbars);\n\n for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n rest[_key - 1] = arguments[_key];\n }\n\n var _this = _possibleConstructorReturn(this, (_ref = Scrollbars.__proto__ || Object.getPrototypeOf(Scrollbars)).call.apply(_ref, [this, props].concat(rest)));\n\n _this.getScrollLeft = _this.getScrollLeft.bind(_this);\n _this.getScrollTop = _this.getScrollTop.bind(_this);\n _this.getScrollWidth = _this.getScrollWidth.bind(_this);\n _this.getScrollHeight = _this.getScrollHeight.bind(_this);\n _this.getClientWidth = _this.getClientWidth.bind(_this);\n _this.getClientHeight = _this.getClientHeight.bind(_this);\n _this.getValues = _this.getValues.bind(_this);\n _this.getThumbHorizontalWidth = _this.getThumbHorizontalWidth.bind(_this);\n _this.getThumbVerticalHeight = _this.getThumbVerticalHeight.bind(_this);\n _this.getScrollLeftForOffset = _this.getScrollLeftForOffset.bind(_this);\n _this.getScrollTopForOffset = _this.getScrollTopForOffset.bind(_this);\n\n _this.scrollLeft = _this.scrollLeft.bind(_this);\n _this.scrollTop = _this.scrollTop.bind(_this);\n _this.scrollToLeft = _this.scrollToLeft.bind(_this);\n _this.scrollToTop = _this.scrollToTop.bind(_this);\n _this.scrollToRight = _this.scrollToRight.bind(_this);\n _this.scrollToBottom = _this.scrollToBottom.bind(_this);\n\n _this.handleTrackMouseEnter = _this.handleTrackMouseEnter.bind(_this);\n _this.handleTrackMouseLeave = _this.handleTrackMouseLeave.bind(_this);\n _this.handleHorizontalTrackMouseDown = _this.handleHorizontalTrackMouseDown.bind(_this);\n _this.handleVerticalTrackMouseDown = _this.handleVerticalTrackMouseDown.bind(_this);\n _this.handleHorizontalThumbMouseDown = _this.handleHorizontalThumbMouseDown.bind(_this);\n _this.handleVerticalThumbMouseDown = _this.handleVerticalThumbMouseDown.bind(_this);\n _this.handleWindowResize = _this.handleWindowResize.bind(_this);\n _this.handleScroll = _this.handleScroll.bind(_this);\n _this.handleDrag = _this.handleDrag.bind(_this);\n _this.handleDragEnd = _this.handleDragEnd.bind(_this);\n\n _this.state = {\n didMountUniversal: false\n };\n return _this;\n }\n\n _createClass(Scrollbars, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.addListeners();\n this.update();\n this.componentDidMountUniversal();\n }\n }, {\n key: 'componentDidMountUniversal',\n value: function componentDidMountUniversal() {\n // eslint-disable-line react/sort-comp\n var universal = this.props.universal;\n\n if (!universal) return;\n this.setState({ didMountUniversal: true });\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate() {\n this.update();\n }\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.removeListeners();\n (0, _raf2.cancel)(this.requestFrame);\n clearTimeout(this.hideTracksTimeout);\n clearInterval(this.detectScrollingInterval);\n }\n }, {\n key: 'getScrollLeft',\n value: function getScrollLeft() {\n if (!this.view) return 0;\n return this.view.scrollLeft;\n }\n }, {\n key: 'getScrollTop',\n value: function getScrollTop() {\n if (!this.view) return 0;\n return this.view.scrollTop;\n }\n }, {\n key: 'getScrollWidth',\n value: function getScrollWidth() {\n if (!this.view) return 0;\n return this.view.scrollWidth;\n }\n }, {\n key: 'getScrollHeight',\n value: function getScrollHeight() {\n if (!this.view) return 0;\n return this.view.scrollHeight;\n }\n }, {\n key: 'getClientWidth',\n value: function getClientWidth() {\n if (!this.view) return 0;\n return this.view.clientWidth;\n }\n }, {\n key: 'getClientHeight',\n value: function getClientHeight() {\n if (!this.view) return 0;\n return this.view.clientHeight;\n }\n }, {\n key: 'getValues',\n value: function getValues() {\n var _ref2 = this.view || {},\n _ref2$scrollLeft = _ref2.scrollLeft,\n scrollLeft = _ref2$scrollLeft === undefined ? 0 : _ref2$scrollLeft,\n _ref2$scrollTop = _ref2.scrollTop,\n scrollTop = _ref2$scrollTop === undefined ? 0 : _ref2$scrollTop,\n _ref2$scrollWidth = _ref2.scrollWidth,\n scrollWidth = _ref2$scrollWidth === undefined ? 0 : _ref2$scrollWidth,\n _ref2$scrollHeight = _ref2.scrollHeight,\n scrollHeight = _ref2$scrollHeight === undefined ? 0 : _ref2$scrollHeight,\n _ref2$clientWidth = _ref2.clientWidth,\n clientWidth = _ref2$clientWidth === undefined ? 0 : _ref2$clientWidth,\n _ref2$clientHeight = _ref2.clientHeight,\n clientHeight = _ref2$clientHeight === undefined ? 0 : _ref2$clientHeight;\n\n return {\n left: scrollLeft / (scrollWidth - clientWidth) || 0,\n top: scrollTop / (scrollHeight - clientHeight) || 0,\n scrollLeft: scrollLeft,\n scrollTop: scrollTop,\n scrollWidth: scrollWidth,\n scrollHeight: scrollHeight,\n clientWidth: clientWidth,\n clientHeight: clientHeight\n };\n }\n }, {\n key: 'getThumbHorizontalWidth',\n value: function getThumbHorizontalWidth() {\n var _props = this.props,\n thumbSize = _props.thumbSize,\n thumbMinSize = _props.thumbMinSize;\n var _view = this.view,\n scrollWidth = _view.scrollWidth,\n clientWidth = _view.clientWidth;\n\n var trackWidth = (0, _getInnerWidth2[\"default\"])(this.trackHorizontal);\n var width = Math.ceil(clientWidth / scrollWidth * trackWidth);\n if (trackWidth <= width) return 0;\n if (thumbSize) return thumbSize;\n return Math.max(width, thumbMinSize);\n }\n }, {\n key: 'getThumbVerticalHeight',\n value: function getThumbVerticalHeight() {\n var _props2 = this.props,\n thumbSize = _props2.thumbSize,\n thumbMinSize = _props2.thumbMinSize;\n var _view2 = this.view,\n scrollHeight = _view2.scrollHeight,\n clientHeight = _view2.clientHeight;\n\n var trackHeight = (0, _getInnerHeight2[\"default\"])(this.trackVertical);\n var height = Math.ceil(clientHeight / scrollHeight * trackHeight);\n if (trackHeight <= height) return 0;\n if (thumbSize) return thumbSize;\n return Math.max(height, thumbMinSize);\n }\n }, {\n key: 'getScrollLeftForOffset',\n value: function getScrollLeftForOffset(offset) {\n var _view3 = this.view,\n scrollWidth = _view3.scrollWidth,\n clientWidth = _view3.clientWidth;\n\n var trackWidth = (0, _getInnerWidth2[\"default\"])(this.trackHorizontal);\n var thumbWidth = this.getThumbHorizontalWidth();\n return offset / (trackWidth - thumbWidth) * (scrollWidth - clientWidth);\n }\n }, {\n key: 'getScrollTopForOffset',\n value: function getScrollTopForOffset(offset) {\n var _view4 = this.view,\n scrollHeight = _view4.scrollHeight,\n clientHeight = _view4.clientHeight;\n\n var trackHeight = (0, _getInnerHeight2[\"default\"])(this.trackVertical);\n var thumbHeight = this.getThumbVerticalHeight();\n return offset / (trackHeight - thumbHeight) * (scrollHeight - clientHeight);\n }\n }, {\n key: 'scrollLeft',\n value: function scrollLeft() {\n var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n if (!this.view) return;\n this.view.scrollLeft = left;\n }\n }, {\n key: 'scrollTop',\n value: function scrollTop() {\n var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n if (!this.view) return;\n this.view.scrollTop = top;\n }\n }, {\n key: 'scrollToLeft',\n value: function scrollToLeft() {\n if (!this.view) return;\n this.view.scrollLeft = 0;\n }\n }, {\n key: 'scrollToTop',\n value: function scrollToTop() {\n if (!this.view) return;\n this.view.scrollTop = 0;\n }\n }, {\n key: 'scrollToRight',\n value: function scrollToRight() {\n if (!this.view) return;\n this.view.scrollLeft = this.view.scrollWidth;\n }\n }, {\n key: 'scrollToBottom',\n value: function scrollToBottom() {\n if (!this.view) return;\n this.view.scrollTop = this.view.scrollHeight;\n }\n }, {\n key: 'addListeners',\n value: function addListeners() {\n /* istanbul ignore if */\n if (typeof document === 'undefined' || !this.view) return;\n var view = this.view,\n trackHorizontal = this.trackHorizontal,\n trackVertical = this.trackVertical,\n thumbHorizontal = this.thumbHorizontal,\n thumbVertical = this.thumbVertical;\n\n view.addEventListener('scroll', this.handleScroll);\n if (!(0, _getScrollbarWidth2[\"default\"])()) return;\n trackHorizontal.addEventListener('mouseenter', this.handleTrackMouseEnter);\n trackHorizontal.addEventListener('mouseleave', this.handleTrackMouseLeave);\n trackHorizontal.addEventListener('mousedown', this.handleHorizontalTrackMouseDown);\n trackVertical.addEventListener('mouseenter', this.handleTrackMouseEnter);\n trackVertical.addEventListener('mouseleave', this.handleTrackMouseLeave);\n trackVertical.addEventListener('mousedown', this.handleVerticalTrackMouseDown);\n thumbHorizontal.addEventListener('mousedown', this.handleHorizontalThumbMouseDown);\n thumbVertical.addEventListener('mousedown', this.handleVerticalThumbMouseDown);\n window.addEventListener('resize', this.handleWindowResize);\n }\n }, {\n key: 'removeListeners',\n value: function removeListeners() {\n /* istanbul ignore if */\n if (typeof document === 'undefined' || !this.view) return;\n var view = this.view,\n trackHorizontal = this.trackHorizontal,\n trackVertical = this.trackVertical,\n thumbHorizontal = this.thumbHorizontal,\n thumbVertical = this.thumbVertical;\n\n view.removeEventListener('scroll', this.handleScroll);\n if (!(0, _getScrollbarWidth2[\"default\"])()) return;\n trackHorizontal.removeEventListener('mouseenter', this.handleTrackMouseEnter);\n trackHorizontal.removeEventListener('mouseleave', this.handleTrackMouseLeave);\n trackHorizontal.removeEventListener('mousedown', this.handleHorizontalTrackMouseDown);\n trackVertical.removeEventListener('mouseenter', this.handleTrackMouseEnter);\n trackVertical.removeEventListener('mouseleave', this.handleTrackMouseLeave);\n trackVertical.removeEventListener('mousedown', this.handleVerticalTrackMouseDown);\n thumbHorizontal.removeEventListener('mousedown', this.handleHorizontalThumbMouseDown);\n thumbVertical.removeEventListener('mousedown', this.handleVerticalThumbMouseDown);\n window.removeEventListener('resize', this.handleWindowResize);\n // Possibly setup by `handleDragStart`\n this.teardownDragging();\n }\n }, {\n key: 'handleScroll',\n value: function handleScroll(event) {\n var _this2 = this;\n\n var _props3 = this.props,\n onScroll = _props3.onScroll,\n onScrollFrame = _props3.onScrollFrame;\n\n if (onScroll) onScroll(event);\n this.update(function (values) {\n var scrollLeft = values.scrollLeft,\n scrollTop = values.scrollTop;\n\n _this2.viewScrollLeft = scrollLeft;\n _this2.viewScrollTop = scrollTop;\n if (onScrollFrame) onScrollFrame(values);\n });\n this.detectScrolling();\n }\n }, {\n key: 'handleScrollStart',\n value: function handleScrollStart() {\n var onScrollStart = this.props.onScrollStart;\n\n if (onScrollStart) onScrollStart();\n this.handleScrollStartAutoHide();\n }\n }, {\n key: 'handleScrollStartAutoHide',\n value: function handleScrollStartAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.showTracks();\n }\n }, {\n key: 'handleScrollStop',\n value: function handleScrollStop() {\n var onScrollStop = this.props.onScrollStop;\n\n if (onScrollStop) onScrollStop();\n this.handleScrollStopAutoHide();\n }\n }, {\n key: 'handleScrollStopAutoHide',\n value: function handleScrollStopAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.hideTracks();\n }\n }, {\n key: 'handleWindowResize',\n value: function handleWindowResize() {\n (0, _getScrollbarWidth2[\"default\"])(false);\n this.forceUpdate();\n }\n }, {\n key: 'handleHorizontalTrackMouseDown',\n value: function handleHorizontalTrackMouseDown(event) {\n event.preventDefault();\n var target = event.target,\n clientX = event.clientX;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetLeft = _target$getBoundingCl.left;\n\n var thumbWidth = this.getThumbHorizontalWidth();\n var offset = Math.abs(targetLeft - clientX) - thumbWidth / 2;\n this.view.scrollLeft = this.getScrollLeftForOffset(offset);\n }\n }, {\n key: 'handleVerticalTrackMouseDown',\n value: function handleVerticalTrackMouseDown(event) {\n event.preventDefault();\n var target = event.target,\n clientY = event.clientY;\n\n var _target$getBoundingCl2 = target.getBoundingClientRect(),\n targetTop = _target$getBoundingCl2.top;\n\n var thumbHeight = this.getThumbVerticalHeight();\n var offset = Math.abs(targetTop - clientY) - thumbHeight / 2;\n this.view.scrollTop = this.getScrollTopForOffset(offset);\n }\n }, {\n key: 'handleHorizontalThumbMouseDown',\n value: function handleHorizontalThumbMouseDown(event) {\n event.preventDefault();\n this.handleDragStart(event);\n var target = event.target,\n clientX = event.clientX;\n var offsetWidth = target.offsetWidth;\n\n var _target$getBoundingCl3 = target.getBoundingClientRect(),\n left = _target$getBoundingCl3.left;\n\n this.prevPageX = offsetWidth - (clientX - left);\n }\n }, {\n key: 'handleVerticalThumbMouseDown',\n value: function handleVerticalThumbMouseDown(event) {\n event.preventDefault();\n this.handleDragStart(event);\n var target = event.target,\n clientY = event.clientY;\n var offsetHeight = target.offsetHeight;\n\n var _target$getBoundingCl4 = target.getBoundingClientRect(),\n top = _target$getBoundingCl4.top;\n\n this.prevPageY = offsetHeight - (clientY - top);\n }\n }, {\n key: 'setupDragging',\n value: function setupDragging() {\n (0, _domCss2[\"default\"])(document.body, _styles.disableSelectStyle);\n document.addEventListener('mousemove', this.handleDrag);\n document.addEventListener('mouseup', this.handleDragEnd);\n document.onselectstart = _returnFalse2[\"default\"];\n }\n }, {\n key: 'teardownDragging',\n value: function teardownDragging() {\n (0, _domCss2[\"default\"])(document.body, _styles.disableSelectStyleReset);\n document.removeEventListener('mousemove', this.handleDrag);\n document.removeEventListener('mouseup', this.handleDragEnd);\n document.onselectstart = undefined;\n }\n }, {\n key: 'handleDragStart',\n value: function handleDragStart(event) {\n this.dragging = true;\n event.stopImmediatePropagation();\n this.setupDragging();\n }\n }, {\n key: 'handleDrag',\n value: function handleDrag(event) {\n if (this.prevPageX) {\n var clientX = event.clientX;\n\n var _trackHorizontal$getB = this.trackHorizontal.getBoundingClientRect(),\n trackLeft = _trackHorizontal$getB.left;\n\n var thumbWidth = this.getThumbHorizontalWidth();\n var clickPosition = thumbWidth - this.prevPageX;\n var offset = -trackLeft + clientX - clickPosition;\n this.view.scrollLeft = this.getScrollLeftForOffset(offset);\n }\n if (this.prevPageY) {\n var clientY = event.clientY;\n\n var _trackVertical$getBou = this.trackVertical.getBoundingClientRect(),\n trackTop = _trackVertical$getBou.top;\n\n var thumbHeight = this.getThumbVerticalHeight();\n var _clickPosition = thumbHeight - this.prevPageY;\n var _offset = -trackTop + clientY - _clickPosition;\n this.view.scrollTop = this.getScrollTopForOffset(_offset);\n }\n return false;\n }\n }, {\n key: 'handleDragEnd',\n value: function handleDragEnd() {\n this.dragging = false;\n this.prevPageX = this.prevPageY = 0;\n this.teardownDragging();\n this.handleDragEndAutoHide();\n }\n }, {\n key: 'handleDragEndAutoHide',\n value: function handleDragEndAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.hideTracks();\n }\n }, {\n key: 'handleTrackMouseEnter',\n value: function handleTrackMouseEnter() {\n this.trackMouseOver = true;\n this.handleTrackMouseEnterAutoHide();\n }\n }, {\n key: 'handleTrackMouseEnterAutoHide',\n value: function handleTrackMouseEnterAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.showTracks();\n }\n }, {\n key: 'handleTrackMouseLeave',\n value: function handleTrackMouseLeave() {\n this.trackMouseOver = false;\n this.handleTrackMouseLeaveAutoHide();\n }\n }, {\n key: 'handleTrackMouseLeaveAutoHide',\n value: function handleTrackMouseLeaveAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.hideTracks();\n }\n }, {\n key: 'showTracks',\n value: function showTracks() {\n clearTimeout(this.hideTracksTimeout);\n (0, _domCss2[\"default\"])(this.trackHorizontal, { opacity: 1 });\n (0, _domCss2[\"default\"])(this.trackVertical, { opacity: 1 });\n }\n }, {\n key: 'hideTracks',\n value: function hideTracks() {\n var _this3 = this;\n\n if (this.dragging) return;\n if (this.scrolling) return;\n if (this.trackMouseOver) return;\n var autoHideTimeout = this.props.autoHideTimeout;\n\n clearTimeout(this.hideTracksTimeout);\n this.hideTracksTimeout = setTimeout(function () {\n (0, _domCss2[\"default\"])(_this3.trackHorizontal, { opacity: 0 });\n (0, _domCss2[\"default\"])(_this3.trackVertical, { opacity: 0 });\n }, autoHideTimeout);\n }\n }, {\n key: 'detectScrolling',\n value: function detectScrolling() {\n var _this4 = this;\n\n if (this.scrolling) return;\n this.scrolling = true;\n this.handleScrollStart();\n this.detectScrollingInterval = setInterval(function () {\n if (_this4.lastViewScrollLeft === _this4.viewScrollLeft && _this4.lastViewScrollTop === _this4.viewScrollTop) {\n clearInterval(_this4.detectScrollingInterval);\n _this4.scrolling = false;\n _this4.handleScrollStop();\n }\n _this4.lastViewScrollLeft = _this4.viewScrollLeft;\n _this4.lastViewScrollTop = _this4.viewScrollTop;\n }, 100);\n }\n }, {\n key: 'raf',\n value: function raf(callback) {\n var _this5 = this;\n\n if (this.requestFrame) _raf3[\"default\"].cancel(this.requestFrame);\n this.requestFrame = (0, _raf3[\"default\"])(function () {\n _this5.requestFrame = undefined;\n callback();\n });\n }\n }, {\n key: 'update',\n value: function update(callback) {\n var _this6 = this;\n\n this.raf(function () {\n return _this6._update(callback);\n });\n }\n }, {\n key: '_update',\n value: function _update(callback) {\n var _props4 = this.props,\n onUpdate = _props4.onUpdate,\n hideTracksWhenNotNeeded = _props4.hideTracksWhenNotNeeded;\n\n var values = this.getValues();\n if ((0, _getScrollbarWidth2[\"default\"])()) {\n var scrollLeft = values.scrollLeft,\n clientWidth = values.clientWidth,\n scrollWidth = values.scrollWidth;\n\n var trackHorizontalWidth = (0, _getInnerWidth2[\"default\"])(this.trackHorizontal);\n var thumbHorizontalWidth = this.getThumbHorizontalWidth();\n var thumbHorizontalX = scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalWidth - thumbHorizontalWidth);\n var thumbHorizontalStyle = {\n width: thumbHorizontalWidth,\n transform: 'translateX(' + thumbHorizontalX + 'px)'\n };\n var scrollTop = values.scrollTop,\n clientHeight = values.clientHeight,\n scrollHeight = values.scrollHeight;\n\n var trackVerticalHeight = (0, _getInnerHeight2[\"default\"])(this.trackVertical);\n var thumbVerticalHeight = this.getThumbVerticalHeight();\n var thumbVerticalY = scrollTop / (scrollHeight - clientHeight) * (trackVerticalHeight - thumbVerticalHeight);\n var thumbVerticalStyle = {\n height: thumbVerticalHeight,\n transform: 'translateY(' + thumbVerticalY + 'px)'\n };\n if (hideTracksWhenNotNeeded) {\n var trackHorizontalStyle = {\n visibility: scrollWidth > clientWidth ? 'visible' : 'hidden'\n };\n var trackVerticalStyle = {\n visibility: scrollHeight > clientHeight ? 'visible' : 'hidden'\n };\n (0, _domCss2[\"default\"])(this.trackHorizontal, trackHorizontalStyle);\n (0, _domCss2[\"default\"])(this.trackVertical, trackVerticalStyle);\n }\n (0, _domCss2[\"default\"])(this.thumbHorizontal, thumbHorizontalStyle);\n (0, _domCss2[\"default\"])(this.thumbVertical, thumbVerticalStyle);\n }\n if (onUpdate) onUpdate(values);\n if (typeof callback !== 'function') return;\n callback(values);\n }\n }, {\n key: 'render',\n value: function render() {\n var _this7 = this;\n\n var scrollbarWidth = (0, _getScrollbarWidth2[\"default\"])();\n /* eslint-disable no-unused-vars */\n\n var _props5 = this.props,\n onScroll = _props5.onScroll,\n onScrollFrame = _props5.onScrollFrame,\n onScrollStart = _props5.onScrollStart,\n onScrollStop = _props5.onScrollStop,\n onUpdate = _props5.onUpdate,\n renderView = _props5.renderView,\n renderTrackHorizontal = _props5.renderTrackHorizontal,\n renderTrackVertical = _props5.renderTrackVertical,\n renderThumbHorizontal = _props5.renderThumbHorizontal,\n renderThumbVertical = _props5.renderThumbVertical,\n tagName = _props5.tagName,\n hideTracksWhenNotNeeded = _props5.hideTracksWhenNotNeeded,\n autoHide = _props5.autoHide,\n autoHideTimeout = _props5.autoHideTimeout,\n autoHideDuration = _props5.autoHideDuration,\n thumbSize = _props5.thumbSize,\n thumbMinSize = _props5.thumbMinSize,\n universal = _props5.universal,\n autoHeight = _props5.autoHeight,\n autoHeightMin = _props5.autoHeightMin,\n autoHeightMax = _props5.autoHeightMax,\n style = _props5.style,\n children = _props5.children,\n props = _objectWithoutProperties(_props5, ['onScroll', 'onScrollFrame', 'onScrollStart', 'onScrollStop', 'onUpdate', 'renderView', 'renderTrackHorizontal', 'renderTrackVertical', 'renderThumbHorizontal', 'renderThumbVertical', 'tagName', 'hideTracksWhenNotNeeded', 'autoHide', 'autoHideTimeout', 'autoHideDuration', 'thumbSize', 'thumbMinSize', 'universal', 'autoHeight', 'autoHeightMin', 'autoHeightMax', 'style', 'children']);\n /* eslint-enable no-unused-vars */\n\n var didMountUniversal = this.state.didMountUniversal;\n\n\n var containerStyle = _extends({}, _styles.containerStyleDefault, autoHeight && _extends({}, _styles.containerStyleAutoHeight, {\n minHeight: autoHeightMin,\n maxHeight: autoHeightMax\n }), style);\n\n var viewStyle = _extends({}, _styles.viewStyleDefault, {\n // Hide scrollbars by setting a negative margin\n marginRight: scrollbarWidth ? -scrollbarWidth : 0,\n marginBottom: scrollbarWidth ? -scrollbarWidth : 0\n }, autoHeight && _extends({}, _styles.viewStyleAutoHeight, {\n // Add scrollbarWidth to autoHeight in order to compensate negative margins\n minHeight: (0, _isString2[\"default\"])(autoHeightMin) ? 'calc(' + autoHeightMin + ' + ' + scrollbarWidth + 'px)' : autoHeightMin + scrollbarWidth,\n maxHeight: (0, _isString2[\"default\"])(autoHeightMax) ? 'calc(' + autoHeightMax + ' + ' + scrollbarWidth + 'px)' : autoHeightMax + scrollbarWidth\n }), autoHeight && universal && !didMountUniversal && {\n minHeight: autoHeightMin,\n maxHeight: autoHeightMax\n }, universal && !didMountUniversal && _styles.viewStyleUniversalInitial);\n\n var trackAutoHeightStyle = {\n transition: 'opacity ' + autoHideDuration + 'ms',\n opacity: 0\n };\n\n var trackHorizontalStyle = _extends({}, _styles.trackHorizontalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {\n display: 'none'\n });\n\n var trackVerticalStyle = _extends({}, _styles.trackVerticalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {\n display: 'none'\n });\n\n return (0, _react.createElement)(tagName, _extends({}, props, { style: containerStyle, ref: function ref(_ref3) {\n _this7.container = _ref3;\n } }), [(0, _react.cloneElement)(renderView({ style: viewStyle }), { key: 'view', ref: function ref(_ref4) {\n _this7.view = _ref4;\n } }, children), (0, _react.cloneElement)(renderTrackHorizontal({ style: trackHorizontalStyle }), { key: 'trackHorizontal', ref: function ref(_ref5) {\n _this7.trackHorizontal = _ref5;\n } }, (0, _react.cloneElement)(renderThumbHorizontal({ style: _styles.thumbHorizontalStyleDefault }), { ref: function ref(_ref6) {\n _this7.thumbHorizontal = _ref6;\n } })), (0, _react.cloneElement)(renderTrackVertical({ style: trackVerticalStyle }), { key: 'trackVertical', ref: function ref(_ref7) {\n _this7.trackVertical = _ref7;\n } }, (0, _react.cloneElement)(renderThumbVertical({ style: _styles.thumbVerticalStyleDefault }), { ref: function ref(_ref8) {\n _this7.thumbVertical = _ref8;\n } }))]);\n }\n }]);\n\n return Scrollbars;\n}(_react.Component);\n\nexports[\"default\"] = Scrollbars;\n\n\nScrollbars.propTypes = {\n onScroll: _propTypes2[\"default\"].func,\n onScrollFrame: _propTypes2[\"default\"].func,\n onScrollStart: _propTypes2[\"default\"].func,\n onScrollStop: _propTypes2[\"default\"].func,\n onUpdate: _propTypes2[\"default\"].func,\n renderView: _propTypes2[\"default\"].func,\n renderTrackHorizontal: _propTypes2[\"default\"].func,\n renderTrackVertical: _propTypes2[\"default\"].func,\n renderThumbHorizontal: _propTypes2[\"default\"].func,\n renderThumbVertical: _propTypes2[\"default\"].func,\n tagName: _propTypes2[\"default\"].string,\n thumbSize: _propTypes2[\"default\"].number,\n thumbMinSize: _propTypes2[\"default\"].number,\n hideTracksWhenNotNeeded: _propTypes2[\"default\"].bool,\n autoHide: _propTypes2[\"default\"].bool,\n autoHideTimeout: _propTypes2[\"default\"].number,\n autoHideDuration: _propTypes2[\"default\"].number,\n autoHeight: _propTypes2[\"default\"].bool,\n autoHeightMin: _propTypes2[\"default\"].oneOfType([_propTypes2[\"default\"].number, _propTypes2[\"default\"].string]),\n autoHeightMax: _propTypes2[\"default\"].oneOfType([_propTypes2[\"default\"].number, _propTypes2[\"default\"].string]),\n universal: _propTypes2[\"default\"].bool,\n style: _propTypes2[\"default\"].object,\n children: _propTypes2[\"default\"].node\n};\n\nScrollbars.defaultProps = {\n renderView: _defaultRenderElements.renderViewDefault,\n renderTrackHorizontal: _defaultRenderElements.renderTrackHorizontalDefault,\n renderTrackVertical: _defaultRenderElements.renderTrackVerticalDefault,\n renderThumbHorizontal: _defaultRenderElements.renderThumbHorizontalDefault,\n renderThumbVertical: _defaultRenderElements.renderThumbVerticalDefault,\n tagName: 'div',\n thumbMinSize: 30,\n hideTracksWhenNotNeeded: false,\n autoHide: false,\n autoHideTimeout: 1000,\n autoHideDuration: 200,\n autoHeight: false,\n autoHeightMin: 0,\n autoHeightMax: 200,\n universal: false\n};\n\n//# sourceURL=webpack://@opensumi/ide-components/../../node_modules/@opensumi/react-custom-scrollbars-2/lib/Scrollbars/index.js?");
778
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\nvar _extends = Object.assign || 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; };\n\nvar _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _raf2 = __webpack_require__(/*! raf */ \"../../node_modules/raf/index.js\");\n\nvar _raf3 = _interopRequireDefault(_raf2);\n\nvar _domCss = __webpack_require__(/*! dom-css */ \"../../node_modules/dom-css/index.js\");\n\nvar _domCss2 = _interopRequireDefault(_domCss);\n\nvar _react = __webpack_require__(/*! react */ \"../../node_modules/react/index.js\");\n\nvar _propTypes = __webpack_require__(/*! prop-types */ \"../../node_modules/prop-types/index.js\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _isString = __webpack_require__(/*! ../utils/isString */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/isString.js\");\n\nvar _isString2 = _interopRequireDefault(_isString);\n\nvar _getScrollbarWidth = __webpack_require__(/*! ../utils/getScrollbarWidth */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/getScrollbarWidth.js\");\n\nvar _getScrollbarWidth2 = _interopRequireDefault(_getScrollbarWidth);\n\nvar _returnFalse = __webpack_require__(/*! ../utils/returnFalse */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/returnFalse.js\");\n\nvar _returnFalse2 = _interopRequireDefault(_returnFalse);\n\nvar _getInnerWidth = __webpack_require__(/*! ../utils/getInnerWidth */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/getInnerWidth.js\");\n\nvar _getInnerWidth2 = _interopRequireDefault(_getInnerWidth);\n\nvar _getInnerHeight = __webpack_require__(/*! ../utils/getInnerHeight */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/utils/getInnerHeight.js\");\n\nvar _getInnerHeight2 = _interopRequireDefault(_getInnerHeight);\n\nvar _styles = __webpack_require__(/*! ./styles */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/Scrollbars/styles.js\");\n\nvar _defaultRenderElements = __webpack_require__(/*! ./defaultRenderElements */ \"../../node_modules/@opensumi/react-custom-scrollbars-2/lib/Scrollbars/defaultRenderElements.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Scrollbars = function (_Component) {\n _inherits(Scrollbars, _Component);\n\n function Scrollbars(props) {\n var _ref;\n\n _classCallCheck(this, Scrollbars);\n\n for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n rest[_key - 1] = arguments[_key];\n }\n\n var _this = _possibleConstructorReturn(this, (_ref = Scrollbars.__proto__ || Object.getPrototypeOf(Scrollbars)).call.apply(_ref, [this, props].concat(rest)));\n\n _this.getScrollLeft = _this.getScrollLeft.bind(_this);\n _this.getScrollTop = _this.getScrollTop.bind(_this);\n _this.getScrollWidth = _this.getScrollWidth.bind(_this);\n _this.getScrollHeight = _this.getScrollHeight.bind(_this);\n _this.getClientWidth = _this.getClientWidth.bind(_this);\n _this.getClientHeight = _this.getClientHeight.bind(_this);\n _this.getValues = _this.getValues.bind(_this);\n _this.getThumbHorizontalWidth = _this.getThumbHorizontalWidth.bind(_this);\n _this.getThumbVerticalHeight = _this.getThumbVerticalHeight.bind(_this);\n _this.getScrollLeftForOffset = _this.getScrollLeftForOffset.bind(_this);\n _this.getScrollTopForOffset = _this.getScrollTopForOffset.bind(_this);\n\n _this.scrollLeft = _this.scrollLeft.bind(_this);\n _this.scrollTop = _this.scrollTop.bind(_this);\n _this.scrollToLeft = _this.scrollToLeft.bind(_this);\n _this.scrollToTop = _this.scrollToTop.bind(_this);\n _this.scrollToRight = _this.scrollToRight.bind(_this);\n _this.scrollToBottom = _this.scrollToBottom.bind(_this);\n\n _this.handleTrackMouseEnter = _this.handleTrackMouseEnter.bind(_this);\n _this.handleTrackMouseLeave = _this.handleTrackMouseLeave.bind(_this);\n _this.handleHorizontalTrackMouseDown = _this.handleHorizontalTrackMouseDown.bind(_this);\n _this.handleVerticalTrackMouseDown = _this.handleVerticalTrackMouseDown.bind(_this);\n _this.handleHorizontalThumbMouseDown = _this.handleHorizontalThumbMouseDown.bind(_this);\n _this.handleVerticalThumbMouseDown = _this.handleVerticalThumbMouseDown.bind(_this);\n _this.handleWindowResize = _this.handleWindowResize.bind(_this);\n _this.handleScroll = _this.handleScroll.bind(_this);\n _this.handleDrag = _this.handleDrag.bind(_this);\n _this.handleDragEnd = _this.handleDragEnd.bind(_this);\n\n _this.state = {\n didMountUniversal: false\n };\n return _this;\n }\n\n _createClass(Scrollbars, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.addListeners();\n this.update();\n this.componentDidMountUniversal();\n }\n }, {\n key: 'componentDidMountUniversal',\n value: function componentDidMountUniversal() {\n // eslint-disable-line react/sort-comp\n var universal = this.props.universal;\n\n if (!universal) return;\n this.setState({ didMountUniversal: true });\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate() {\n this.update();\n }\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.removeListeners();\n (0, _raf2.cancel)(this.requestFrame);\n clearTimeout(this.hideTracksTimeout);\n clearInterval(this.detectScrollingInterval);\n }\n }, {\n key: 'getScrollLeft',\n value: function getScrollLeft() {\n if (!this.view) return 0;\n return this.view.scrollLeft;\n }\n }, {\n key: 'getScrollTop',\n value: function getScrollTop() {\n if (!this.view) return 0;\n return this.view.scrollTop;\n }\n }, {\n key: 'getScrollWidth',\n value: function getScrollWidth() {\n if (!this.view) return 0;\n return this.view.scrollWidth;\n }\n }, {\n key: 'getScrollHeight',\n value: function getScrollHeight() {\n if (!this.view) return 0;\n return this.view.scrollHeight;\n }\n }, {\n key: 'getClientWidth',\n value: function getClientWidth() {\n if (!this.view) return 0;\n return this.view.clientWidth;\n }\n }, {\n key: 'getClientHeight',\n value: function getClientHeight() {\n if (!this.view) return 0;\n return this.view.clientHeight;\n }\n }, {\n key: 'getValues',\n value: function getValues() {\n var _ref2 = this.view || {},\n _ref2$scrollLeft = _ref2.scrollLeft,\n scrollLeft = _ref2$scrollLeft === undefined ? 0 : _ref2$scrollLeft,\n _ref2$scrollTop = _ref2.scrollTop,\n scrollTop = _ref2$scrollTop === undefined ? 0 : _ref2$scrollTop,\n _ref2$scrollWidth = _ref2.scrollWidth,\n scrollWidth = _ref2$scrollWidth === undefined ? 0 : _ref2$scrollWidth,\n _ref2$scrollHeight = _ref2.scrollHeight,\n scrollHeight = _ref2$scrollHeight === undefined ? 0 : _ref2$scrollHeight,\n _ref2$clientWidth = _ref2.clientWidth,\n clientWidth = _ref2$clientWidth === undefined ? 0 : _ref2$clientWidth,\n _ref2$clientHeight = _ref2.clientHeight,\n clientHeight = _ref2$clientHeight === undefined ? 0 : _ref2$clientHeight;\n\n return {\n left: scrollLeft / (scrollWidth - clientWidth) || 0,\n top: scrollTop / (scrollHeight - clientHeight) || 0,\n scrollLeft: scrollLeft,\n scrollTop: scrollTop,\n scrollWidth: scrollWidth,\n scrollHeight: scrollHeight,\n clientWidth: clientWidth,\n clientHeight: clientHeight\n };\n }\n }, {\n key: 'getThumbHorizontalWidth',\n value: function getThumbHorizontalWidth() {\n var _props = this.props,\n thumbSize = _props.thumbSize,\n thumbMinSize = _props.thumbMinSize;\n var _view = this.view,\n scrollWidth = _view.scrollWidth,\n clientWidth = _view.clientWidth;\n\n var trackWidth = (0, _getInnerWidth2[\"default\"])(this.trackHorizontal);\n var width = Math.ceil(clientWidth / scrollWidth * trackWidth);\n if (trackWidth <= width) return 0;\n if (thumbSize) return thumbSize;\n return Math.max(width, thumbMinSize);\n }\n }, {\n key: 'getThumbVerticalHeight',\n value: function getThumbVerticalHeight() {\n var _props2 = this.props,\n thumbSize = _props2.thumbSize,\n thumbMinSize = _props2.thumbMinSize;\n var _view2 = this.view,\n scrollHeight = _view2.scrollHeight,\n clientHeight = _view2.clientHeight;\n\n var trackHeight = (0, _getInnerHeight2[\"default\"])(this.trackVertical);\n var height = Math.ceil(clientHeight / scrollHeight * trackHeight);\n if (trackHeight <= height) return 0;\n if (thumbSize) return thumbSize;\n return Math.max(height, thumbMinSize);\n }\n }, {\n key: 'getScrollLeftForOffset',\n value: function getScrollLeftForOffset(offset) {\n var _view3 = this.view,\n scrollWidth = _view3.scrollWidth,\n clientWidth = _view3.clientWidth;\n\n var trackWidth = (0, _getInnerWidth2[\"default\"])(this.trackHorizontal);\n var thumbWidth = this.getThumbHorizontalWidth();\n return offset / (trackWidth - thumbWidth) * (scrollWidth - clientWidth);\n }\n }, {\n key: 'getScrollTopForOffset',\n value: function getScrollTopForOffset(offset) {\n var _view4 = this.view,\n scrollHeight = _view4.scrollHeight,\n clientHeight = _view4.clientHeight;\n\n var trackHeight = (0, _getInnerHeight2[\"default\"])(this.trackVertical);\n var thumbHeight = this.getThumbVerticalHeight();\n return offset / (trackHeight - thumbHeight) * (scrollHeight - clientHeight);\n }\n }, {\n key: 'scrollLeft',\n value: function scrollLeft() {\n var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n if (!this.view) return;\n this.view.scrollLeft = left;\n }\n }, {\n key: 'scrollTop',\n value: function scrollTop() {\n var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n if (!this.view) return;\n this.view.scrollTop = top;\n }\n }, {\n key: 'scrollToLeft',\n value: function scrollToLeft() {\n if (!this.view) return;\n this.view.scrollLeft = 0;\n }\n }, {\n key: 'scrollToTop',\n value: function scrollToTop() {\n if (!this.view) return;\n this.view.scrollTop = 0;\n }\n }, {\n key: 'scrollToRight',\n value: function scrollToRight() {\n if (!this.view) return;\n this.view.scrollLeft = this.view.scrollWidth;\n }\n }, {\n key: 'scrollToBottom',\n value: function scrollToBottom() {\n if (!this.view) return;\n this.view.scrollTop = this.view.scrollHeight;\n }\n }, {\n key: 'addListeners',\n value: function addListeners() {\n /* istanbul ignore if */\n if (typeof document === 'undefined' || !this.view) return;\n var view = this.view,\n trackHorizontal = this.trackHorizontal,\n trackVertical = this.trackVertical,\n thumbHorizontal = this.thumbHorizontal,\n thumbVertical = this.thumbVertical;\n\n view.addEventListener('scroll', this.handleScroll);\n if (!(0, _getScrollbarWidth2[\"default\"])()) return;\n trackHorizontal.addEventListener('mouseenter', this.handleTrackMouseEnter);\n trackHorizontal.addEventListener('mouseleave', this.handleTrackMouseLeave);\n trackHorizontal.addEventListener('mousedown', this.handleHorizontalTrackMouseDown);\n trackVertical.addEventListener('mouseenter', this.handleTrackMouseEnter);\n trackVertical.addEventListener('mouseleave', this.handleTrackMouseLeave);\n trackVertical.addEventListener('mousedown', this.handleVerticalTrackMouseDown);\n thumbHorizontal.addEventListener('mousedown', this.handleHorizontalThumbMouseDown);\n thumbVertical.addEventListener('mousedown', this.handleVerticalThumbMouseDown);\n window.addEventListener('resize', this.handleWindowResize);\n }\n }, {\n key: 'removeListeners',\n value: function removeListeners() {\n /* istanbul ignore if */\n if (typeof document === 'undefined' || !this.view) return;\n var view = this.view,\n trackHorizontal = this.trackHorizontal,\n trackVertical = this.trackVertical,\n thumbHorizontal = this.thumbHorizontal,\n thumbVertical = this.thumbVertical;\n\n view.removeEventListener('scroll', this.handleScroll);\n if (!(0, _getScrollbarWidth2[\"default\"])()) return;\n trackHorizontal.removeEventListener('mouseenter', this.handleTrackMouseEnter);\n trackHorizontal.removeEventListener('mouseleave', this.handleTrackMouseLeave);\n trackHorizontal.removeEventListener('mousedown', this.handleHorizontalTrackMouseDown);\n trackVertical.removeEventListener('mouseenter', this.handleTrackMouseEnter);\n trackVertical.removeEventListener('mouseleave', this.handleTrackMouseLeave);\n trackVertical.removeEventListener('mousedown', this.handleVerticalTrackMouseDown);\n thumbHorizontal.removeEventListener('mousedown', this.handleHorizontalThumbMouseDown);\n thumbVertical.removeEventListener('mousedown', this.handleVerticalThumbMouseDown);\n window.removeEventListener('resize', this.handleWindowResize);\n // Possibly setup by `handleDragStart`\n this.teardownDragging();\n }\n }, {\n key: 'handleScroll',\n value: function handleScroll(event) {\n var _this2 = this;\n\n var _props3 = this.props,\n onScroll = _props3.onScroll,\n onScrollFrame = _props3.onScrollFrame;\n\n if (onScroll) onScroll(event);\n this.update(function (values) {\n var scrollLeft = values.scrollLeft,\n scrollTop = values.scrollTop;\n\n _this2.viewScrollLeft = scrollLeft;\n _this2.viewScrollTop = scrollTop;\n if (onScrollFrame) onScrollFrame(values);\n });\n this.detectScrolling();\n }\n }, {\n key: 'handleScrollStart',\n value: function handleScrollStart() {\n var onScrollStart = this.props.onScrollStart;\n\n if (onScrollStart) onScrollStart();\n this.handleScrollStartAutoHide();\n }\n }, {\n key: 'handleScrollStartAutoHide',\n value: function handleScrollStartAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.showTracks();\n }\n }, {\n key: 'handleScrollStop',\n value: function handleScrollStop() {\n var onScrollStop = this.props.onScrollStop;\n\n if (onScrollStop) onScrollStop();\n this.handleScrollStopAutoHide();\n }\n }, {\n key: 'handleScrollStopAutoHide',\n value: function handleScrollStopAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.hideTracks();\n }\n }, {\n key: 'handleWindowResize',\n value: function handleWindowResize() {\n (0, _getScrollbarWidth2[\"default\"])(false);\n this.forceUpdate();\n }\n }, {\n key: 'handleHorizontalTrackMouseDown',\n value: function handleHorizontalTrackMouseDown(event) {\n event.preventDefault();\n var target = event.target,\n clientX = event.clientX;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetLeft = _target$getBoundingCl.left;\n\n var thumbWidth = this.getThumbHorizontalWidth();\n var offset = Math.abs(targetLeft - clientX) - thumbWidth / 2;\n this.view.scrollLeft = this.getScrollLeftForOffset(offset);\n }\n }, {\n key: 'handleVerticalTrackMouseDown',\n value: function handleVerticalTrackMouseDown(event) {\n event.preventDefault();\n var target = event.target,\n clientY = event.clientY;\n\n var _target$getBoundingCl2 = target.getBoundingClientRect(),\n targetTop = _target$getBoundingCl2.top;\n\n var thumbHeight = this.getThumbVerticalHeight();\n var offset = Math.abs(targetTop - clientY) - thumbHeight / 2;\n this.view.scrollTop = this.getScrollTopForOffset(offset);\n }\n }, {\n key: 'handleHorizontalThumbMouseDown',\n value: function handleHorizontalThumbMouseDown(event) {\n event.preventDefault();\n this.handleDragStart(event);\n var target = event.target,\n clientX = event.clientX;\n var offsetWidth = target.offsetWidth;\n\n var _target$getBoundingCl3 = target.getBoundingClientRect(),\n left = _target$getBoundingCl3.left;\n\n this.prevPageX = offsetWidth - (clientX - left);\n }\n }, {\n key: 'handleVerticalThumbMouseDown',\n value: function handleVerticalThumbMouseDown(event) {\n event.preventDefault();\n this.handleDragStart(event);\n var target = event.target,\n clientY = event.clientY;\n var offsetHeight = target.offsetHeight;\n\n var _target$getBoundingCl4 = target.getBoundingClientRect(),\n top = _target$getBoundingCl4.top;\n\n this.prevPageY = offsetHeight - (clientY - top);\n }\n }, {\n key: 'setupDragging',\n value: function setupDragging() {\n (0, _domCss2[\"default\"])(document.body, _styles.disableSelectStyle);\n document.addEventListener('mousemove', this.handleDrag);\n document.addEventListener('mouseup', this.handleDragEnd);\n document.onselectstart = _returnFalse2[\"default\"];\n }\n }, {\n key: 'teardownDragging',\n value: function teardownDragging() {\n (0, _domCss2[\"default\"])(document.body, _styles.disableSelectStyleReset);\n document.removeEventListener('mousemove', this.handleDrag);\n document.removeEventListener('mouseup', this.handleDragEnd);\n document.onselectstart = undefined;\n }\n }, {\n key: 'handleDragStart',\n value: function handleDragStart(event) {\n this.dragging = true;\n event.stopImmediatePropagation();\n this.setupDragging();\n }\n }, {\n key: 'handleDrag',\n value: function handleDrag(event) {\n if (this.prevPageX) {\n var clientX = event.clientX;\n\n var _trackHorizontal$getB = this.trackHorizontal.getBoundingClientRect(),\n trackLeft = _trackHorizontal$getB.left;\n\n var thumbWidth = this.getThumbHorizontalWidth();\n var clickPosition = thumbWidth - this.prevPageX;\n var offset = -trackLeft + clientX - clickPosition;\n this.view.scrollLeft = this.getScrollLeftForOffset(offset);\n }\n if (this.prevPageY) {\n var clientY = event.clientY;\n\n var _trackVertical$getBou = this.trackVertical.getBoundingClientRect(),\n trackTop = _trackVertical$getBou.top;\n\n var thumbHeight = this.getThumbVerticalHeight();\n var _clickPosition = thumbHeight - this.prevPageY;\n var _offset = -trackTop + clientY - _clickPosition;\n this.view.scrollTop = this.getScrollTopForOffset(_offset);\n }\n return false;\n }\n }, {\n key: 'handleDragEnd',\n value: function handleDragEnd() {\n this.dragging = false;\n this.prevPageX = this.prevPageY = 0;\n this.teardownDragging();\n this.handleDragEndAutoHide();\n }\n }, {\n key: 'handleDragEndAutoHide',\n value: function handleDragEndAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.hideTracks();\n }\n }, {\n key: 'handleTrackMouseEnter',\n value: function handleTrackMouseEnter() {\n this.trackMouseOver = true;\n this.handleTrackMouseEnterAutoHide();\n }\n }, {\n key: 'handleTrackMouseEnterAutoHide',\n value: function handleTrackMouseEnterAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.showTracks();\n }\n }, {\n key: 'handleTrackMouseLeave',\n value: function handleTrackMouseLeave() {\n this.trackMouseOver = false;\n this.handleTrackMouseLeaveAutoHide();\n }\n }, {\n key: 'handleTrackMouseLeaveAutoHide',\n value: function handleTrackMouseLeaveAutoHide() {\n var autoHide = this.props.autoHide;\n\n if (!autoHide) return;\n this.hideTracks();\n }\n }, {\n key: 'showTracks',\n value: function showTracks() {\n clearTimeout(this.hideTracksTimeout);\n (0, _domCss2[\"default\"])(this.trackHorizontal, { opacity: 1 });\n (0, _domCss2[\"default\"])(this.trackVertical, { opacity: 1 });\n }\n }, {\n key: 'hideTracks',\n value: function hideTracks() {\n var _this3 = this;\n\n if (this.dragging) return;\n if (this.scrolling) return;\n if (this.trackMouseOver) return;\n var autoHideTimeout = this.props.autoHideTimeout;\n\n clearTimeout(this.hideTracksTimeout);\n this.hideTracksTimeout = setTimeout(function () {\n (0, _domCss2[\"default\"])(_this3.trackHorizontal, { opacity: 0 });\n (0, _domCss2[\"default\"])(_this3.trackVertical, { opacity: 0 });\n }, autoHideTimeout);\n }\n }, {\n key: 'detectScrolling',\n value: function detectScrolling() {\n var _this4 = this;\n\n if (this.scrolling) return;\n this.scrolling = true;\n this.handleScrollStart();\n this.detectScrollingInterval = setInterval(function () {\n if (_this4.lastViewScrollLeft === _this4.viewScrollLeft && _this4.lastViewScrollTop === _this4.viewScrollTop) {\n clearInterval(_this4.detectScrollingInterval);\n _this4.scrolling = false;\n _this4.handleScrollStop();\n }\n _this4.lastViewScrollLeft = _this4.viewScrollLeft;\n _this4.lastViewScrollTop = _this4.viewScrollTop;\n }, 100);\n }\n }, {\n key: 'raf',\n value: function raf(callback) {\n var _this5 = this;\n\n if (this.requestFrame) _raf3[\"default\"].cancel(this.requestFrame);\n this.requestFrame = (0, _raf3[\"default\"])(function () {\n _this5.requestFrame = undefined;\n callback();\n });\n }\n }, {\n key: 'update',\n value: function update(callback) {\n var _this6 = this;\n\n this.raf(function () {\n return _this6._update(callback);\n });\n }\n }, {\n key: '_update',\n value: function _update(callback) {\n var _props4 = this.props,\n onUpdate = _props4.onUpdate,\n hideTracksWhenNotNeeded = _props4.hideTracksWhenNotNeeded;\n\n var values = this.getValues();\n if ((0, _getScrollbarWidth2[\"default\"])()) {\n var scrollLeft = values.scrollLeft,\n clientWidth = values.clientWidth,\n scrollWidth = values.scrollWidth;\n\n var trackHorizontalWidth = (0, _getInnerWidth2[\"default\"])(this.trackHorizontal);\n var thumbHorizontalWidth = this.getThumbHorizontalWidth();\n var thumbHorizontalX = scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalWidth - thumbHorizontalWidth);\n var thumbHorizontalStyle = {\n width: thumbHorizontalWidth,\n transform: 'translateX(' + thumbHorizontalX + 'px)'\n };\n var scrollTop = values.scrollTop,\n clientHeight = values.clientHeight,\n scrollHeight = values.scrollHeight;\n\n var trackVerticalHeight = (0, _getInnerHeight2[\"default\"])(this.trackVertical);\n var thumbVerticalHeight = this.getThumbVerticalHeight();\n var thumbVerticalY = scrollTop / (scrollHeight - clientHeight) * (trackVerticalHeight - thumbVerticalHeight);\n var thumbVerticalStyle = {\n height: thumbVerticalHeight,\n transform: 'translateY(' + thumbVerticalY + 'px)'\n };\n if (hideTracksWhenNotNeeded) {\n var trackHorizontalStyle = {\n visibility: scrollWidth > clientWidth ? 'visible' : 'hidden'\n };\n var trackVerticalStyle = {\n visibility: scrollHeight > clientHeight ? 'visible' : 'hidden'\n };\n (0, _domCss2[\"default\"])(this.trackHorizontal, trackHorizontalStyle);\n (0, _domCss2[\"default\"])(this.trackVertical, trackVerticalStyle);\n }\n (0, _domCss2[\"default\"])(this.thumbHorizontal, thumbHorizontalStyle);\n (0, _domCss2[\"default\"])(this.thumbVertical, thumbVerticalStyle);\n }\n if (onUpdate) onUpdate(values);\n if (typeof callback !== 'function') return;\n callback(values);\n }\n }, {\n key: 'render',\n value: function render() {\n var _this7 = this;\n\n var scrollbarWidth = (0, _getScrollbarWidth2[\"default\"])();\n /* eslint-disable no-unused-vars */\n\n var _props5 = this.props,\n onScroll = _props5.onScroll,\n onScrollFrame = _props5.onScrollFrame,\n onScrollStart = _props5.onScrollStart,\n onScrollStop = _props5.onScrollStop,\n onUpdate = _props5.onUpdate,\n renderView = _props5.renderView,\n renderTrackHorizontal = _props5.renderTrackHorizontal,\n renderTrackVertical = _props5.renderTrackVertical,\n renderThumbHorizontal = _props5.renderThumbHorizontal,\n renderThumbVertical = _props5.renderThumbVertical,\n tagName = _props5.tagName,\n hideTracksWhenNotNeeded = _props5.hideTracksWhenNotNeeded,\n autoHide = _props5.autoHide,\n autoHideTimeout = _props5.autoHideTimeout,\n autoHideDuration = _props5.autoHideDuration,\n thumbSize = _props5.thumbSize,\n thumbMinSize = _props5.thumbMinSize,\n universal = _props5.universal,\n autoHeight = _props5.autoHeight,\n autoHeightMin = _props5.autoHeightMin,\n autoHeightMax = _props5.autoHeightMax,\n style = _props5.style,\n children = _props5.children,\n props = _objectWithoutProperties(_props5, ['onScroll', 'onScrollFrame', 'onScrollStart', 'onScrollStop', 'onUpdate', 'renderView', 'renderTrackHorizontal', 'renderTrackVertical', 'renderThumbHorizontal', 'renderThumbVertical', 'tagName', 'hideTracksWhenNotNeeded', 'autoHide', 'autoHideTimeout', 'autoHideDuration', 'thumbSize', 'thumbMinSize', 'universal', 'autoHeight', 'autoHeightMin', 'autoHeightMax', 'style', 'children']);\n /* eslint-enable no-unused-vars */\n\n var didMountUniversal = this.state.didMountUniversal;\n\n\n var containerStyle = _extends({}, _styles.containerStyleDefault, autoHeight && _extends({}, _styles.containerStyleAutoHeight, {\n minHeight: autoHeightMin,\n maxHeight: autoHeightMax\n }), style);\n\n var viewStyle = _extends({}, _styles.viewStyleDefault, {\n // Hide scrollbars by setting a negative margin\n marginRight: scrollbarWidth ? -scrollbarWidth : 0,\n marginBottom: scrollbarWidth ? -scrollbarWidth : 0,\n // if scrollbar width equals zero, do not show scrollbar\n overflow: scrollbarWidth ? _styles.viewStyleDefault.overflow : 'hidden'\n }, autoHeight && _extends({}, _styles.viewStyleAutoHeight, {\n // Add scrollbarWidth to autoHeight in order to compensate negative margins\n minHeight: (0, _isString2[\"default\"])(autoHeightMin) ? 'calc(' + autoHeightMin + ' + ' + scrollbarWidth + 'px)' : autoHeightMin + scrollbarWidth,\n maxHeight: (0, _isString2[\"default\"])(autoHeightMax) ? 'calc(' + autoHeightMax + ' + ' + scrollbarWidth + 'px)' : autoHeightMax + scrollbarWidth\n }), autoHeight && universal && !didMountUniversal && {\n minHeight: autoHeightMin,\n maxHeight: autoHeightMax\n }, universal && !didMountUniversal && _styles.viewStyleUniversalInitial);\n\n var trackAutoHeightStyle = {\n transition: 'opacity ' + autoHideDuration + 'ms',\n opacity: 0\n };\n\n var trackHorizontalStyle = _extends({}, _styles.trackHorizontalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {\n display: 'none'\n });\n\n var trackVerticalStyle = _extends({}, _styles.trackVerticalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {\n display: 'none'\n });\n\n return (0, _react.createElement)(tagName, _extends({}, props, { style: containerStyle, ref: function ref(_ref3) {\n _this7.container = _ref3;\n } }), [(0, _react.cloneElement)(renderView({ style: viewStyle }), { key: 'view', ref: function ref(_ref4) {\n _this7.view = _ref4;\n } }, children), (0, _react.cloneElement)(renderTrackHorizontal({ style: trackHorizontalStyle }), { key: 'trackHorizontal', ref: function ref(_ref5) {\n _this7.trackHorizontal = _ref5;\n } }, (0, _react.cloneElement)(renderThumbHorizontal({ style: _styles.thumbHorizontalStyleDefault }), { ref: function ref(_ref6) {\n _this7.thumbHorizontal = _ref6;\n } })), (0, _react.cloneElement)(renderTrackVertical({ style: trackVerticalStyle }), { key: 'trackVertical', ref: function ref(_ref7) {\n _this7.trackVertical = _ref7;\n } }, (0, _react.cloneElement)(renderThumbVertical({ style: _styles.thumbVerticalStyleDefault }), { ref: function ref(_ref8) {\n _this7.thumbVertical = _ref8;\n } }))]);\n }\n }]);\n\n return Scrollbars;\n}(_react.Component);\n\nexports[\"default\"] = Scrollbars;\n\n\nScrollbars.propTypes = {\n onScroll: _propTypes2[\"default\"].func,\n onScrollFrame: _propTypes2[\"default\"].func,\n onScrollStart: _propTypes2[\"default\"].func,\n onScrollStop: _propTypes2[\"default\"].func,\n onUpdate: _propTypes2[\"default\"].func,\n renderView: _propTypes2[\"default\"].func,\n renderTrackHorizontal: _propTypes2[\"default\"].func,\n renderTrackVertical: _propTypes2[\"default\"].func,\n renderThumbHorizontal: _propTypes2[\"default\"].func,\n renderThumbVertical: _propTypes2[\"default\"].func,\n tagName: _propTypes2[\"default\"].string,\n thumbSize: _propTypes2[\"default\"].number,\n thumbMinSize: _propTypes2[\"default\"].number,\n hideTracksWhenNotNeeded: _propTypes2[\"default\"].bool,\n autoHide: _propTypes2[\"default\"].bool,\n autoHideTimeout: _propTypes2[\"default\"].number,\n autoHideDuration: _propTypes2[\"default\"].number,\n autoHeight: _propTypes2[\"default\"].bool,\n autoHeightMin: _propTypes2[\"default\"].oneOfType([_propTypes2[\"default\"].number, _propTypes2[\"default\"].string]),\n autoHeightMax: _propTypes2[\"default\"].oneOfType([_propTypes2[\"default\"].number, _propTypes2[\"default\"].string]),\n universal: _propTypes2[\"default\"].bool,\n style: _propTypes2[\"default\"].object,\n children: _propTypes2[\"default\"].node\n};\n\nScrollbars.defaultProps = {\n renderView: _defaultRenderElements.renderViewDefault,\n renderTrackHorizontal: _defaultRenderElements.renderTrackHorizontalDefault,\n renderTrackVertical: _defaultRenderElements.renderTrackVerticalDefault,\n renderThumbHorizontal: _defaultRenderElements.renderThumbHorizontalDefault,\n renderThumbVertical: _defaultRenderElements.renderThumbVerticalDefault,\n tagName: 'div',\n thumbMinSize: 30,\n hideTracksWhenNotNeeded: false,\n autoHide: false,\n autoHideTimeout: 1000,\n autoHideDuration: 200,\n autoHeight: false,\n autoHeightMin: 0,\n autoHeightMax: 200,\n universal: false\n};\n\n//# sourceURL=webpack://@opensumi/ide-components/../../node_modules/@opensumi/react-custom-scrollbars-2/lib/Scrollbars/index.js?");
779
779
 
780
780
  /***/ }),
781
781
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-components",
3
- "version": "3.2.2-next-1722913990.0",
3
+ "version": "3.2.2-next-1723024363.0",
4
4
  "description": "@opensumi/ide-components",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@ant-design/icons": "^4.6.4",
19
- "@opensumi/ide-utils": "3.2.2-next-1722913990.0",
20
- "@opensumi/react-custom-scrollbars-2": "^4.3.1",
19
+ "@opensumi/ide-utils": "3.2.2-next-1723024363.0",
20
+ "@opensumi/react-custom-scrollbars-2": "^4.3.2",
21
21
  "fuzzy": "^0.1.3",
22
22
  "lodash": "^4.17.21",
23
23
  "marked": "4.0.10",
@@ -36,10 +36,10 @@
36
36
  "react-window": "^1.8.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@opensumi/ide-dev-tool": "3.2.2-next-1722913990.0",
39
+ "@opensumi/ide-dev-tool": "3.2.2-next-1723024363.0",
40
40
  "@types/marked": "^4.0.7",
41
41
  "@types/react-window": "^1.8.5",
42
42
  "prop-types": "^15.8.1"
43
43
  },
44
- "gitHead": "865d9bfa4d2b27ffffcb2f34ddea2c320bdf71c6"
44
+ "gitHead": "f5db4190bb2b7e745d0c0e824ec1f6dece4ca360"
45
45
  }