GoScrobble/web/node_modules/.cache/babel-loader/469343915a1433294fe1cd451343d986.json

1 line
32 KiB
JSON

{"ast":null,"code":"import _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport CarouselItem from './CarouselItem';\nimport { mapToCssModules } from './utils';\nvar SWIPE_THRESHOLD = 40;\n\nvar Carousel = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Carousel, _React$Component);\n\n function Carousel(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_this));\n _this.renderItems = _this.renderItems.bind(_assertThisInitialized(_this));\n _this.hoverStart = _this.hoverStart.bind(_assertThisInitialized(_this));\n _this.hoverEnd = _this.hoverEnd.bind(_assertThisInitialized(_this));\n _this.handleTouchStart = _this.handleTouchStart.bind(_assertThisInitialized(_this));\n _this.handleTouchEnd = _this.handleTouchEnd.bind(_assertThisInitialized(_this));\n _this.touchStartX = 0;\n _this.touchStartY = 0;\n _this.state = {\n activeIndex: _this.props.activeIndex,\n direction: 'right',\n indicatorClicked: false\n };\n return _this;\n }\n\n var _proto = Carousel.prototype;\n\n _proto.getChildContext = function getChildContext() {\n return {\n direction: this.state.direction\n };\n };\n\n _proto.componentDidMount = function componentDidMount() {\n // Set up the cycle\n if (this.props.ride === 'carousel') {\n this.setInterval();\n } // TODO: move this to the specific carousel like bootstrap. Currently it will trigger ALL carousels on the page.\n\n\n document.addEventListener('keyup', this.handleKeyPress);\n };\n\n Carousel.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n var newState = null;\n var activeIndex = prevState.activeIndex,\n direction = prevState.direction,\n indicatorClicked = prevState.indicatorClicked;\n\n if (nextProps.activeIndex !== activeIndex) {\n // Calculate the direction to turn\n if (nextProps.activeIndex === activeIndex + 1) {\n direction = 'right';\n } else if (nextProps.activeIndex === activeIndex - 1) {\n direction = 'left';\n } else if (nextProps.activeIndex < activeIndex) {\n direction = indicatorClicked ? 'left' : 'right';\n } else if (nextProps.activeIndex !== activeIndex) {\n direction = indicatorClicked ? 'right' : 'left';\n }\n\n newState = {\n activeIndex: nextProps.activeIndex,\n direction: direction,\n indicatorClicked: false\n };\n }\n\n return newState;\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (prevState.activeIndex === this.state.activeIndex) return;\n this.setInterval(this.props);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.clearInterval();\n document.removeEventListener('keyup', this.handleKeyPress);\n };\n\n _proto.setInterval = function (_setInterval) {\n function setInterval() {\n return _setInterval.apply(this, arguments);\n }\n\n setInterval.toString = function () {\n return _setInterval.toString();\n };\n\n return setInterval;\n }(function (props) {\n if (props === void 0) {\n props = this.props;\n } // make sure not to have multiple intervals going...\n\n\n this.clearInterval();\n\n if (props.interval) {\n this.cycleInterval = setInterval(function () {\n props.next();\n }, parseInt(props.interval, 10));\n }\n });\n\n _proto.clearInterval = function (_clearInterval) {\n function clearInterval() {\n return _clearInterval.apply(this, arguments);\n }\n\n clearInterval.toString = function () {\n return _clearInterval.toString();\n };\n\n return clearInterval;\n }(function () {\n clearInterval(this.cycleInterval);\n });\n\n _proto.hoverStart = function hoverStart() {\n if (this.props.pause === 'hover') {\n this.clearInterval();\n }\n\n if (this.props.mouseEnter) {\n var _this$props;\n\n (_this$props = this.props).mouseEnter.apply(_this$props, arguments);\n }\n };\n\n _proto.hoverEnd = function hoverEnd() {\n if (this.props.pause === 'hover') {\n this.setInterval();\n }\n\n if (this.props.mouseLeave) {\n var _this$props2;\n\n (_this$props2 = this.props).mouseLeave.apply(_this$props2, arguments);\n }\n };\n\n _proto.handleKeyPress = function handleKeyPress(evt) {\n if (this.props.keyboard) {\n if (evt.keyCode === 37) {\n this.props.previous();\n } else if (evt.keyCode === 39) {\n this.props.next();\n }\n }\n };\n\n _proto.handleTouchStart = function handleTouchStart(e) {\n if (!this.props.enableTouch) {\n return;\n }\n\n this.touchStartX = e.changedTouches[0].screenX;\n this.touchStartY = e.changedTouches[0].screenY;\n };\n\n _proto.handleTouchEnd = function handleTouchEnd(e) {\n if (!this.props.enableTouch) {\n return;\n }\n\n var currentX = e.changedTouches[0].screenX;\n var currentY = e.changedTouches[0].screenY;\n var diffX = Math.abs(this.touchStartX - currentX);\n var diffY = Math.abs(this.touchStartY - currentY); // Don't swipe if Y-movement is bigger than X-movement\n\n if (diffX < diffY) {\n return;\n }\n\n if (diffX < SWIPE_THRESHOLD) {\n return;\n }\n\n if (currentX < this.touchStartX) {\n this.props.next();\n } else {\n this.props.previous();\n }\n };\n\n _proto.renderItems = function renderItems(carouselItems, className) {\n var _this2 = this;\n\n var slide = this.props.slide;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className\n }, carouselItems.map(function (item, index) {\n var isIn = index === _this2.state.activeIndex;\n return /*#__PURE__*/React.cloneElement(item, {\n in: isIn,\n slide: slide\n });\n }));\n };\n\n _proto.render = function render() {\n var _this3 = this;\n\n var _this$props3 = this.props,\n cssModule = _this$props3.cssModule,\n slide = _this$props3.slide,\n className = _this$props3.className;\n var outerClasses = mapToCssModules(classNames(className, 'carousel', slide && 'slide'), cssModule);\n var innerClasses = mapToCssModules(classNames('carousel-inner'), cssModule); // filter out booleans, null, or undefined\n\n var children = this.props.children.filter(function (child) {\n return child !== null && child !== undefined && typeof child !== 'boolean';\n });\n var slidesOnly = children.every(function (child) {\n return child.type === CarouselItem;\n }); // Rendering only slides\n\n if (slidesOnly) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: outerClasses,\n onMouseEnter: this.hoverStart,\n onMouseLeave: this.hoverEnd\n }, this.renderItems(children, innerClasses));\n } // Rendering slides and controls\n\n\n if (children[0] instanceof Array) {\n var _carouselItems = children[0];\n var _controlLeft = children[1];\n var _controlRight = children[2];\n return /*#__PURE__*/React.createElement(\"div\", {\n className: outerClasses,\n onMouseEnter: this.hoverStart,\n onMouseLeave: this.hoverEnd\n }, this.renderItems(_carouselItems, innerClasses), _controlLeft, _controlRight);\n } // Rendering indicators, slides and controls\n\n\n var indicators = children[0];\n\n var wrappedOnClick = function wrappedOnClick(e) {\n if (typeof indicators.props.onClickHandler === 'function') {\n _this3.setState({\n indicatorClicked: true\n }, function () {\n return indicators.props.onClickHandler(e);\n });\n }\n };\n\n var wrappedIndicators = /*#__PURE__*/React.cloneElement(indicators, {\n onClickHandler: wrappedOnClick\n });\n var carouselItems = children[1];\n var controlLeft = children[2];\n var controlRight = children[3];\n return /*#__PURE__*/React.createElement(\"div\", {\n className: outerClasses,\n onMouseEnter: this.hoverStart,\n onMouseLeave: this.hoverEnd,\n onTouchStart: this.handleTouchStart,\n onTouchEnd: this.handleTouchEnd\n }, wrappedIndicators, this.renderItems(carouselItems, innerClasses), controlLeft, controlRight);\n };\n\n return Carousel;\n}(React.Component);\n\nCarousel.propTypes = {\n // the current active slide of the carousel\n activeIndex: PropTypes.number,\n // a function which should advance the carousel to the next slide (via activeIndex)\n next: PropTypes.func.isRequired,\n // a function which should advance the carousel to the previous slide (via activeIndex)\n previous: PropTypes.func.isRequired,\n // controls if the left and right arrow keys should control the carousel\n keyboard: PropTypes.bool,\n\n /* If set to \"hover\", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on\n * mouseleave. If set to false, hovering over the carousel won't pause it. (default: \"hover\")\n */\n pause: PropTypes.oneOf(['hover', false]),\n // Autoplays the carousel after the user manually cycles the first item. If \"carousel\", autoplays the carousel on load.\n // This is how bootstrap defines it... I would prefer a bool named autoplay or something...\n ride: PropTypes.oneOf(['carousel']),\n // the interval at which the carousel automatically cycles (default: 5000)\n // eslint-disable-next-line react/no-unused-prop-types\n interval: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.bool]),\n children: PropTypes.array,\n // called when the mouse enters the Carousel\n mouseEnter: PropTypes.func,\n // called when the mouse exits the Carousel\n mouseLeave: PropTypes.func,\n // controls whether the slide animation on the Carousel works or not\n slide: PropTypes.bool,\n cssModule: PropTypes.object,\n className: PropTypes.string,\n enableTouch: PropTypes.bool\n};\nCarousel.defaultProps = {\n interval: 5000,\n pause: 'hover',\n keyboard: true,\n slide: true,\n enableTouch: true\n};\nCarousel.childContextTypes = {\n direction: PropTypes.string\n};\nexport default Carousel;","map":{"version":3,"sources":["/app/node_modules/reactstrap/es/Carousel.js"],"names":["_assertThisInitialized","_inheritsLoose","React","PropTypes","classNames","CarouselItem","mapToCssModules","SWIPE_THRESHOLD","Carousel","_React$Component","props","_this","call","handleKeyPress","bind","renderItems","hoverStart","hoverEnd","handleTouchStart","handleTouchEnd","touchStartX","touchStartY","state","activeIndex","direction","indicatorClicked","_proto","prototype","getChildContext","componentDidMount","ride","setInterval","document","addEventListener","getDerivedStateFromProps","nextProps","prevState","newState","componentDidUpdate","prevProps","componentWillUnmount","clearInterval","removeEventListener","_setInterval","apply","arguments","toString","interval","cycleInterval","next","parseInt","_clearInterval","pause","mouseEnter","_this$props","mouseLeave","_this$props2","evt","keyboard","keyCode","previous","e","enableTouch","changedTouches","screenX","screenY","currentX","currentY","diffX","Math","abs","diffY","carouselItems","className","_this2","slide","createElement","map","item","index","isIn","cloneElement","in","render","_this3","_this$props3","cssModule","outerClasses","innerClasses","children","filter","child","undefined","slidesOnly","every","type","onMouseEnter","onMouseLeave","Array","_carouselItems","_controlLeft","_controlRight","indicators","wrappedOnClick","onClickHandler","setState","wrappedIndicators","controlLeft","controlRight","onTouchStart","onTouchEnd","Component","propTypes","number","func","isRequired","bool","oneOf","oneOfType","string","array","object","defaultProps","childContextTypes"],"mappings":"AAAA,OAAOA,sBAAP,MAAmC,kDAAnC;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAC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B;AAGA,eAAe/G,QAAf","sourcesContent":["import _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport CarouselItem from './CarouselItem';\nimport { mapToCssModules } from './utils';\nvar SWIPE_THRESHOLD = 40;\n\nvar Carousel = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Carousel, _React$Component);\n\n function Carousel(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_this));\n _this.renderItems = _this.renderItems.bind(_assertThisInitialized(_this));\n _this.hoverStart = _this.hoverStart.bind(_assertThisInitialized(_this));\n _this.hoverEnd = _this.hoverEnd.bind(_assertThisInitialized(_this));\n _this.handleTouchStart = _this.handleTouchStart.bind(_assertThisInitialized(_this));\n _this.handleTouchEnd = _this.handleTouchEnd.bind(_assertThisInitialized(_this));\n _this.touchStartX = 0;\n _this.touchStartY = 0;\n _this.state = {\n activeIndex: _this.props.activeIndex,\n direction: 'right',\n indicatorClicked: false\n };\n return _this;\n }\n\n var _proto = Carousel.prototype;\n\n _proto.getChildContext = function getChildContext() {\n return {\n direction: this.state.direction\n };\n };\n\n _proto.componentDidMount = function componentDidMount() {\n // Set up the cycle\n if (this.props.ride === 'carousel') {\n this.setInterval();\n } // TODO: move this to the specific carousel like bootstrap. Currently it will trigger ALL carousels on the page.\n\n\n document.addEventListener('keyup', this.handleKeyPress);\n };\n\n Carousel.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n var newState = null;\n var activeIndex = prevState.activeIndex,\n direction = prevState.direction,\n indicatorClicked = prevState.indicatorClicked;\n\n if (nextProps.activeIndex !== activeIndex) {\n // Calculate the direction to turn\n if (nextProps.activeIndex === activeIndex + 1) {\n direction = 'right';\n } else if (nextProps.activeIndex === activeIndex - 1) {\n direction = 'left';\n } else if (nextProps.activeIndex < activeIndex) {\n direction = indicatorClicked ? 'left' : 'right';\n } else if (nextProps.activeIndex !== activeIndex) {\n direction = indicatorClicked ? 'right' : 'left';\n }\n\n newState = {\n activeIndex: nextProps.activeIndex,\n direction: direction,\n indicatorClicked: false\n };\n }\n\n return newState;\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (prevState.activeIndex === this.state.activeIndex) return;\n this.setInterval(this.props);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.clearInterval();\n document.removeEventListener('keyup', this.handleKeyPress);\n };\n\n _proto.setInterval = function (_setInterval) {\n function setInterval() {\n return _setInterval.apply(this, arguments);\n }\n\n setInterval.toString = function () {\n return _setInterval.toString();\n };\n\n return setInterval;\n }(function (props) {\n if (props === void 0) {\n props = this.props;\n }\n\n // make sure not to have multiple intervals going...\n this.clearInterval();\n\n if (props.interval) {\n this.cycleInterval = setInterval(function () {\n props.next();\n }, parseInt(props.interval, 10));\n }\n });\n\n _proto.clearInterval = function (_clearInterval) {\n function clearInterval() {\n return _clearInterval.apply(this, arguments);\n }\n\n clearInterval.toString = function () {\n return _clearInterval.toString();\n };\n\n return clearInterval;\n }(function () {\n clearInterval(this.cycleInterval);\n });\n\n _proto.hoverStart = function hoverStart() {\n if (this.props.pause === 'hover') {\n this.clearInterval();\n }\n\n if (this.props.mouseEnter) {\n var _this$props;\n\n (_this$props = this.props).mouseEnter.apply(_this$props, arguments);\n }\n };\n\n _proto.hoverEnd = function hoverEnd() {\n if (this.props.pause === 'hover') {\n this.setInterval();\n }\n\n if (this.props.mouseLeave) {\n var _this$props2;\n\n (_this$props2 = this.props).mouseLeave.apply(_this$props2, arguments);\n }\n };\n\n _proto.handleKeyPress = function handleKeyPress(evt) {\n if (this.props.keyboard) {\n if (evt.keyCode === 37) {\n this.props.previous();\n } else if (evt.keyCode === 39) {\n this.props.next();\n }\n }\n };\n\n _proto.handleTouchStart = function handleTouchStart(e) {\n if (!this.props.enableTouch) {\n return;\n }\n\n this.touchStartX = e.changedTouches[0].screenX;\n this.touchStartY = e.changedTouches[0].screenY;\n };\n\n _proto.handleTouchEnd = function handleTouchEnd(e) {\n if (!this.props.enableTouch) {\n return;\n }\n\n var currentX = e.changedTouches[0].screenX;\n var currentY = e.changedTouches[0].screenY;\n var diffX = Math.abs(this.touchStartX - currentX);\n var diffY = Math.abs(this.touchStartY - currentY); // Don't swipe if Y-movement is bigger than X-movement\n\n if (diffX < diffY) {\n return;\n }\n\n if (diffX < SWIPE_THRESHOLD) {\n return;\n }\n\n if (currentX < this.touchStartX) {\n this.props.next();\n } else {\n this.props.previous();\n }\n };\n\n _proto.renderItems = function renderItems(carouselItems, className) {\n var _this2 = this;\n\n var slide = this.props.slide;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className\n }, carouselItems.map(function (item, index) {\n var isIn = index === _this2.state.activeIndex;\n return /*#__PURE__*/React.cloneElement(item, {\n in: isIn,\n slide: slide\n });\n }));\n };\n\n _proto.render = function render() {\n var _this3 = this;\n\n var _this$props3 = this.props,\n cssModule = _this$props3.cssModule,\n slide = _this$props3.slide,\n className = _this$props3.className;\n var outerClasses = mapToCssModules(classNames(className, 'carousel', slide && 'slide'), cssModule);\n var innerClasses = mapToCssModules(classNames('carousel-inner'), cssModule); // filter out booleans, null, or undefined\n\n var children = this.props.children.filter(function (child) {\n return child !== null && child !== undefined && typeof child !== 'boolean';\n });\n var slidesOnly = children.every(function (child) {\n return child.type === CarouselItem;\n }); // Rendering only slides\n\n if (slidesOnly) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: outerClasses,\n onMouseEnter: this.hoverStart,\n onMouseLeave: this.hoverEnd\n }, this.renderItems(children, innerClasses));\n } // Rendering slides and controls\n\n\n if (children[0] instanceof Array) {\n var _carouselItems = children[0];\n var _controlLeft = children[1];\n var _controlRight = children[2];\n return /*#__PURE__*/React.createElement(\"div\", {\n className: outerClasses,\n onMouseEnter: this.hoverStart,\n onMouseLeave: this.hoverEnd\n }, this.renderItems(_carouselItems, innerClasses), _controlLeft, _controlRight);\n } // Rendering indicators, slides and controls\n\n\n var indicators = children[0];\n\n var wrappedOnClick = function wrappedOnClick(e) {\n if (typeof indicators.props.onClickHandler === 'function') {\n _this3.setState({\n indicatorClicked: true\n }, function () {\n return indicators.props.onClickHandler(e);\n });\n }\n };\n\n var wrappedIndicators = /*#__PURE__*/React.cloneElement(indicators, {\n onClickHandler: wrappedOnClick\n });\n var carouselItems = children[1];\n var controlLeft = children[2];\n var controlRight = children[3];\n return /*#__PURE__*/React.createElement(\"div\", {\n className: outerClasses,\n onMouseEnter: this.hoverStart,\n onMouseLeave: this.hoverEnd,\n onTouchStart: this.handleTouchStart,\n onTouchEnd: this.handleTouchEnd\n }, wrappedIndicators, this.renderItems(carouselItems, innerClasses), controlLeft, controlRight);\n };\n\n return Carousel;\n}(React.Component);\n\nCarousel.propTypes = {\n // the current active slide of the carousel\n activeIndex: PropTypes.number,\n // a function which should advance the carousel to the next slide (via activeIndex)\n next: PropTypes.func.isRequired,\n // a function which should advance the carousel to the previous slide (via activeIndex)\n previous: PropTypes.func.isRequired,\n // controls if the left and right arrow keys should control the carousel\n keyboard: PropTypes.bool,\n\n /* If set to \"hover\", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on\n * mouseleave. If set to false, hovering over the carousel won't pause it. (default: \"hover\")\n */\n pause: PropTypes.oneOf(['hover', false]),\n // Autoplays the carousel after the user manually cycles the first item. If \"carousel\", autoplays the carousel on load.\n // This is how bootstrap defines it... I would prefer a bool named autoplay or something...\n ride: PropTypes.oneOf(['carousel']),\n // the interval at which the carousel automatically cycles (default: 5000)\n // eslint-disable-next-line react/no-unused-prop-types\n interval: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.bool]),\n children: PropTypes.array,\n // called when the mouse enters the Carousel\n mouseEnter: PropTypes.func,\n // called when the mouse exits the Carousel\n mouseLeave: PropTypes.func,\n // controls whether the slide animation on the Carousel works or not\n slide: PropTypes.bool,\n cssModule: PropTypes.object,\n className: PropTypes.string,\n enableTouch: PropTypes.bool\n};\nCarousel.defaultProps = {\n interval: 5000,\n pause: 'hover',\n keyboard: true,\n slide: true,\n enableTouch: true\n};\nCarousel.childContextTypes = {\n direction: PropTypes.string\n};\nexport default Carousel;"]},"metadata":{},"sourceType":"module"}