From f964cc11dfcc6dd9cdf00ee41bbb5c392d7d7ec7 Mon Sep 17 00:00:00 2001 From: Serhii Stryzhevskyi Date: Thu, 24 Aug 2017 20:18:41 +0300 Subject: [PATCH] v 0.4.2 - Fix for IE Edge closes #23 - Right click fix closes #24 --- .eslintrc | 5 - bower.json | 2 +- dist/range-slider.js | 801 ++++++++++++++++++++------------------- dist/range-slider.js.map | 2 +- dist/range-slider.min.js | 2 +- package.json | 8 +- src/range-slider.js | 57 +-- src/utils/dom.js | 39 +- src/utils/functions.js | 4 +- webpack.config.js | 1 + 10 files changed, 493 insertions(+), 428 deletions(-) diff --git a/.eslintrc b/.eslintrc index 5bd86b9..253dfa4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,9 +1,4 @@ { - ecmaFeatures: { - globalReturn: true, - jsx: true, - modules: true - }, env: { browser: true, es6: true, diff --git a/bower.json b/bower.json index d126172..e5f9dae 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "rangeslider-pure", - "version": "0.4.1", + "version": "0.4.2", "homepage": "https://github.com/Stryzhevskyi/rangeSlider", "authors": [ "André Ruffert ", diff --git a/dist/range-slider.js b/dist/range-slider.js index d70c06e..90e3258 100644 --- a/dist/range-slider.js +++ b/dist/range-slider.js @@ -43,9 +43,6 @@ return /******/ (function(modules) { // webpackBootstrap /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { @@ -73,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 3); +/******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ @@ -190,405 +187,138 @@ var simpleExtend = exports.simpleExtend = function simpleExtend(defaultOpt, opti Object.defineProperty(exports, "__esModule", { value: true }); -exports.supportsRange = exports.removeAllListenersFromEl = exports.removeEventListeners = exports.addEventListeners = exports.insertAfter = exports.triggerEvent = exports.forEachAncestors = exports.removeClass = exports.addClass = exports.hasClass = exports.setCss = exports.getDimension = exports.getHiddenParentNodes = exports.isHidden = undefined; + +var _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; }; }(); + +var _dom = __webpack_require__(2); + +var dom = _interopRequireWildcard(_dom); var _functions = __webpack_require__(0); var func = _interopRequireWildcard(_functions); +__webpack_require__(3); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } -var EVENT_LISTENER_LIST = 'eventListenerList'; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -/** - * Check if a `element` is visible in the DOM - * - * @param {Element} element - * @return {Boolean} - */ -var isHidden = exports.isHidden = function isHidden(element) { - return element.offsetWidth === 0 || element.offsetHeight === 0 || element.open === false; -}; -/** - * Get hidden parentNodes of an `element` - * - * @param {Element} element - * @return {[type]} - */ -var getHiddenParentNodes = exports.getHiddenParentNodes = function getHiddenParentNodes(element) { - var parents = []; - var node = element.parentNode; +var newLineAndTabRegexp = new RegExp('/[\\n\\t]/', 'g'); +var MAX_SET_BY_DEFAULT = 100; +var HANDLE_RESIZE_DELAY = 300; +var HANDLE_RESIZE_DEBOUNCE = 50; - while (isHidden(node)) { - parents.push(node); - node = node.parentNode; - } - return parents; +var pluginName = 'rangeSlider'; +var pluginIdentifier = 0; +var inputrange = dom.supportsRange(); +var defaults = { + polyfill: true, + rangeClass: 'rangeSlider', + disabledClass: 'rangeSlider--disabled', + fillClass: 'rangeSlider__fill', + bufferClass: 'rangeSlider__buffer', + handleClass: 'rangeSlider__handle', + startEvent: ['mousedown', 'touchstart', 'pointerdown'], + moveEvent: ['mousemove', 'touchmove', 'pointermove'], + endEvent: ['mouseup', 'touchend', 'pointerup'], + min: null, + max: null, + step: null, + value: null, + buffer: null, + stick: null, + borderRadius: 10, + vertical: false }; /** - * Returns dimensions for an element even if it is not visible in the DOM. - * - * @param {Element} element - * @param {string} key (e.g. offsetWidth …) - * @return {Number} + * Plugin + * @param {HTMLElement} element + * @param {this} options */ -var getDimension = exports.getDimension = function getDimension(element, key) { - var hiddenParentNodes = getHiddenParentNodes(element); - var hiddenParentNodesLength = hiddenParentNodes.length; - var displayProperty = []; - var dimension = element[key]; - // Used for native `
` elements - function toggleOpenProperty(element) { - if (typeof element.open !== 'undefined') { - element.open = !element.open; - } - } +var RangeSlider = function () { + function RangeSlider(element, options) { + _classCallCheck(this, RangeSlider); - if (hiddenParentNodesLength) { - for (var i = 0; i < hiddenParentNodesLength; i++) { - // Cache the display property to restore it later. - displayProperty[i] = hiddenParentNodes[i].style.display; + var minSetByDefault = void 0; + var maxSetByDefault = void 0; + var stepSetByDefault = void 0; + var stickAttribute = void 0; + var stickValues = void 0; - hiddenParentNodes[i].style.display = 'block'; - hiddenParentNodes[i].style.height = '0'; - hiddenParentNodes[i].style.overflow = 'hidden'; - hiddenParentNodes[i].style.visibility = 'hidden'; - toggleOpenProperty(hiddenParentNodes[i]); + this.element = element; + this.options = func.simpleExtend(defaults, options); + this.polyfill = this.options.polyfill; + this.vertical = this.options.vertical; + this.onInit = this.options.onInit; + this.onSlide = this.options.onSlide; + this.onSlideStart = this.options.onSlideStart; + this.onSlideEnd = this.options.onSlideEnd; + this.onSlideEventsCount = -1; + this.isInteractsNow = false; + this.needTriggerEvents = false; + + // Plugin should only be used as a polyfill + if (!this.polyfill) { + // Input range support? + if (inputrange) { + return; + } } - dimension = element[key]; + this.options.buffer = this.options.buffer || parseFloat(this.element.getAttribute('data-buffer')); - for (var j = 0; j < hiddenParentNodesLength; j++) { - toggleOpenProperty(hiddenParentNodes[j]); - hiddenParentNodes[j].style.display = displayProperty[j]; - hiddenParentNodes[j].style.height = ''; - hiddenParentNodes[j].style.overflow = ''; - hiddenParentNodes[j].style.visibility = ''; - } - } - return dimension; -}; + this.identifier = 'js-' + pluginName + '-' + pluginIdentifier++; -/** - * - * @param {HTMLElement} el - * @param {Object} cssObj - * @returns {*} - */ -var setCss = exports.setCss = function setCss(el, cssObj) { - for (var key in cssObj) { - el.style[key] = cssObj[key]; - } - return el.style; -}; + this.min = func.getFirsNumberLike(this.options.min, parseFloat(this.element.getAttribute('min')), minSetByDefault = 0); -/** - * - * @param {HTMLElement} elem - * @param {string} className - */ -var hasClass = exports.hasClass = function hasClass(elem, className) { - return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' '); -}; + this.max = func.getFirsNumberLike(this.options.max, parseFloat(this.element.getAttribute('max')), maxSetByDefault = MAX_SET_BY_DEFAULT); -/** - * - * @param {HTMLElement} elem - * @param {string} className - */ -var addClass = exports.addClass = function addClass(elem, className) { - if (!hasClass(elem, className)) { - elem.className += ' ' + className; - } -}; + this.value = func.getFirsNumberLike(this.options.value, this.element.value, parseFloat(this.element.value || this.min + (this.max - this.min) / 2)); -/** - * - * @param {HTMLElement} elem - * @param {string} className - */ -var removeClass = exports.removeClass = function removeClass(elem, className) { - var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' '; + this.step = func.getFirsNumberLike(this.options.step, parseFloat(this.element.getAttribute('step')) || (stepSetByDefault = 1)); - if (hasClass(elem, className)) { - while (newClass.indexOf(' ' + className + ' ') >= 0) { - newClass = newClass.replace(' ' + className + ' ', ' '); + this.percent = null; + + if (func.isArray(this.options.stick) && this.options.stick.length >= 1) { + this.stick = this.options.stick; + } else if (stickAttribute = this.element.getAttribute('stick')) { + stickValues = stickAttribute.split(' '); + if (stickValues.length >= 1) { + this.stick = stickValues.map(parseFloat); + } } - elem.className = newClass.replace(/^\s+|\s+$/g, ''); - } -}; + if (this.stick && this.stick.length === 1) { + this.stick.push(this.step * 1.5); + } + this._updatePercentFromValue(); -/** - * - * @param {HTMLElement} el - * @callback callback - * @param {boolean} andForElement - apply callback for el - * @returns {HTMLElement} - */ -var forEachAncestors = exports.forEachAncestors = function forEachAncestors(el, callback, andForElement) { - if (andForElement) { - callback(el); - } + this.toFixed = this._toFixed(this.step); - while (el.parentNode && !callback(el)) { - el = el.parentNode; - } + var directionClass = void 0; - return el; -}; + this.container = document.createElement('div'); + dom.addClass(this.container, this.options.fillClass); -/** - * - * @param {HTMLElement} el - * @param {string} name event name - * @param {Object} data - */ -var triggerEvent = exports.triggerEvent = function triggerEvent(el, name, data) { - if (!func.isString(name)) { - throw new TypeError('event name must be String'); - } - if (!(el instanceof HTMLElement)) { - throw new TypeError('element must be HTMLElement'); - } - name = name.trim(); - var event = document.createEvent('CustomEvent'); + directionClass = this.vertical ? this.options.fillClass + '__vertical' : this.options.fillClass + '__horizontal'; + dom.addClass(this.container, directionClass); - event.initCustomEvent(name, false, false, data); - el.dispatchEvent(event); -}; + this.handle = document.createElement('div'); + dom.addClass(this.handle, this.options.handleClass); -/** - * @param {Object} referenceNode after this - * @param {Object} newNode insert this - */ -var insertAfter = exports.insertAfter = function insertAfter(referenceNode, newNode) { - return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); -}; + directionClass = this.vertical ? this.options.handleClass + '__vertical' : this.options.handleClass + '__horizontal'; + dom.addClass(this.handle, directionClass); -/** - * Add event listeners and push them to el[EVENT_LISTENER_LIST] - * @param {HTMLElement} el DOM element - * @param {Array} events - * @callback listener - */ -var addEventListeners = exports.addEventListeners = function addEventListeners(el, events, listener) { - events.forEach(function (eventName) { - if (!el[EVENT_LISTENER_LIST]) { - el[EVENT_LISTENER_LIST] = {}; - } - if (!el[EVENT_LISTENER_LIST][eventName]) { - el[EVENT_LISTENER_LIST][eventName] = []; - } + this.range = document.createElement('div'); + dom.addClass(this.range, this.options.rangeClass); + this.range.id = this.identifier; + this.range.appendChild(this.handle); + this.range.appendChild(this.container); - el.addEventListener(eventName, listener, window.PointerEvent ? { passive: false } : false); - if (el[EVENT_LISTENER_LIST][eventName].indexOf(listener) < 0) { - el[EVENT_LISTENER_LIST][eventName].push(listener); - } - }); -}; - -/** - * Remove event listeners and remove them from el[EVENT_LISTENER_LIST] - * @param {HTMLElement} el DOM element - * @param {Array} events - * @callback listener - */ -var removeEventListeners = exports.removeEventListeners = function removeEventListeners(el, events, listener) { - events.forEach(function (eventName) { - var index = void 0; - - el.removeEventListener(eventName, listener, false); - - if (el[EVENT_LISTENER_LIST] && el[EVENT_LISTENER_LIST][eventName] && (index = el[EVENT_LISTENER_LIST][eventName].indexOf(listener)) > -1) { - el[EVENT_LISTENER_LIST][eventName].splice(index, 1); - } - }); -}; - -/** - * Remove ALL event listeners which exists in el[EVENT_LISTENER_LIST] - * @param {HTMLElement} el DOM element - */ -var removeAllListenersFromEl = exports.removeAllListenersFromEl = function removeAllListenersFromEl(instance, el) { - if (!el[EVENT_LISTENER_LIST]) { - return; - } - /* jshint ignore:start */ - - /** - * - * @callback listener - * @this {Object} event name - */ - function rm(listener) { - if (listener === instance._startEventListener) { - this.el.removeEventListener(this.eventName, listener, false); - } - } - - for (var eventName in el[EVENT_LISTENER_LIST]) { - el[EVENT_LISTENER_LIST][eventName].forEach(rm, { eventName: eventName, el: el }); - } - - el[EVENT_LISTENER_LIST] = {}; - /* jshint ignore:end */ -}; - -/** - * Range feature detection - * @return {Boolean} - */ -var supportsRange = exports.supportsRange = function supportsRange() { - var input = document.createElement('input'); - - input.setAttribute('type', 'range'); - return input.type !== 'text'; -}; - -/***/ }), -/* 2 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _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; }; }(); - -var _dom = __webpack_require__(1); - -var dom = _interopRequireWildcard(_dom); - -var _functions = __webpack_require__(0); - -var func = _interopRequireWildcard(_functions); - -__webpack_require__(2); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var newLineAndTabRegexp = new RegExp('/[\\n\\t]/', 'g'); -var MAX_SET_BY_DEFAULT = 100; -var HANDLE_RESIZE_DELAY = 300; -var HANDLE_RESIZE_DEBOUNCE = 50; - -var pluginName = 'rangeSlider'; -var pluginIdentifier = 0; -var inputrange = dom.supportsRange(); -var defaults = { - polyfill: true, - rangeClass: 'rangeSlider', - disabledClass: 'rangeSlider--disabled', - fillClass: 'rangeSlider__fill', - bufferClass: 'rangeSlider__buffer', - handleClass: 'rangeSlider__handle', - startEvent: ['mousedown', 'touchstart', 'pointerdown'], - moveEvent: ['mousemove', 'touchmove', 'pointermove'], - endEvent: ['mouseup', 'touchend', 'pointerup'], - min: null, - max: null, - step: null, - value: null, - buffer: null, - stick: null, - borderRadius: 10, - vertical: false -}; - -/** - * Plugin - * @param {HTMLElement} element - * @param {this} options - */ - -var RangeSlider = function () { - function RangeSlider(element, options) { - _classCallCheck(this, RangeSlider); - - var minSetByDefault = void 0; - var maxSetByDefault = void 0; - var stepSetByDefault = void 0; - var stickAttribute = void 0; - var stickValues = void 0; - - this.element = element; - this.options = func.simpleExtend(defaults, options); - this.polyfill = this.options.polyfill; - this.vertical = this.options.vertical; - this.onInit = this.options.onInit; - this.onSlide = this.options.onSlide; - this.onSlideStart = this.options.onSlideStart; - this.onSlideEnd = this.options.onSlideEnd; - this.onSlideEventsCount = -1; - this.isInteractsNow = false; - this.needTriggerEvents = false; - - // Plugin should only be used as a polyfill - if (!this.polyfill) { - // Input range support? - if (inputrange) { - return; - } - } - - this.options.buffer = this.options.buffer || parseFloat(this.element.getAttribute('data-buffer')); - - this.identifier = 'js-' + pluginName + '-' + pluginIdentifier++; - this.min = func.getFirsNumberLike(this.options.min, parseFloat(this.element.getAttribute('min')), minSetByDefault = 0); - this.max = func.getFirsNumberLike(this.options.max, parseFloat(this.element.getAttribute('max')), maxSetByDefault = MAX_SET_BY_DEFAULT); - this.value = func.getFirsNumberLike(this.options.value, this.element.value, parseFloat(this.element.value || this.min + (this.max - this.min) / 2)); - this.step = func.getFirsNumberLike(this.options.step, parseFloat(this.element.getAttribute('step')) || (stepSetByDefault = 1)); - this.percent = null; - if (func.isArray(this.options.stick) && this.options.stick.length >= 1) { - this.stick = this.options.stick; - } else if (stickAttribute = this.element.getAttribute('stick')) { - stickValues = stickAttribute.split(' '); - if (stickValues.length >= 1) { - this.stick = stickValues.map(parseFloat); - } - } - if (this.stick && this.stick.length === 1) { - this.stick.push(this.step * 1.5); - } - this._updatePercentFromValue(); - - this.toFixed = this._toFixed(this.step); - - var directionClass = void 0; - - this.fill = document.createElement('div'); - dom.addClass(this.fill, this.options.fillClass); - - directionClass = this.vertical ? this.options.fillClass + '__vertical' : this.options.fillClass + '__horizontal'; - dom.addClass(this.fill, directionClass); - - this.handle = document.createElement('div'); - dom.addClass(this.handle, this.options.handleClass); - - directionClass = this.vertical ? this.options.handleClass + '__vertical' : this.options.handleClass + '__horizontal'; - dom.addClass(this.handle, directionClass); - - this.range = document.createElement('div'); - dom.addClass(this.range, this.options.rangeClass); - this.range.id = this.identifier; - this.range.appendChild(this.handle); - this.range.appendChild(this.fill); - - directionClass = this.vertical ? this.options.rangeClass + '__vertical' : this.options.rangeClass + '__horizontal'; - dom.addClass(this.range, directionClass); + directionClass = this.vertical ? this.options.rangeClass + '__vertical' : this.options.rangeClass + '__horizontal'; + dom.addClass(this.range, directionClass); if (this.options.bufferClass) { this.buffer = document.createElement('div'); @@ -755,6 +485,10 @@ var RangeSlider = function () { var el = ev.target; var isEventOnSlider = false; + if (ev.which !== 1) { + return; + } + dom.forEachAncestors(el, function (el) { return isEventOnSlider = el.id === _this.identifier && !dom.hasClass(el, _this.options.disabledClass); }, true); @@ -816,7 +550,6 @@ var RangeSlider = function () { key: '_handleDown', value: function _handleDown(e) { this.isInteractsNow = true; - e.preventDefault(); dom.addEventListeners(document, this.options.moveEvent, this._handleMove); dom.addEventListeners(document, this.options.endEvent, this._handleEnd); @@ -845,13 +578,11 @@ var RangeSlider = function () { var posX = this._getRelativePosition(e); this.isInteractsNow = true; - e.preventDefault(); this._setPosition(posX - this.grabX); } }, { key: '_handleEnd', value: function _handleEnd(e) { - e.preventDefault(); dom.removeEventListeners(document, this.options.moveEvent, this._handleMove); dom.removeEventListeners(document, this.options.endEvent, this._handleEnd); @@ -903,11 +634,11 @@ var RangeSlider = function () { // Update ui if (this.vertical) { - this.fill.style.height = position + this.grabX + 'px'; + this.container.style.height = position + this.grabX + 'px'; this.handle.style.transform = 'translateY(-' + position + 'px)'; this.handle.style['-ms-transform'] = 'translateY(-' + position + 'px)'; } else { - this.fill.style.width = position + this.grabX + 'px'; + this.container.style.width = position + this.grabX + 'px'; this.handle.style.transform = 'translateX(' + position + 'px)'; this.handle.style['-ms-transform'] = 'translateX(' + position + 'px)'; } @@ -1015,30 +746,30 @@ var RangeSlider = function () { var boundingClientRect = this.range.getBoundingClientRect(); // Get the offset relative to the viewport - var rangeX = this.vertical ? boundingClientRect.bottom : boundingClientRect.left; - var pageX = 0; + var rangeSize = this.vertical ? boundingClientRect.bottom : boundingClientRect.left; + var pageOffset = 0; var pagePositionProperty = this.vertical ? 'pageY' : 'pageX'; if (typeof e[pagePositionProperty] !== 'undefined') { - pageX = e.touches && e.touches.length ? e.touches[0][pagePositionProperty] : e[pagePositionProperty]; + pageOffset = e.touches && e.touches.length ? e.touches[0][pagePositionProperty] : e[pagePositionProperty]; } else if (typeof e.originalEvent !== 'undefined') { if (typeof e.originalEvent[pagePositionProperty] !== 'undefined') { - pageX = e.originalEvent[pagePositionProperty]; + pageOffset = e.originalEvent[pagePositionProperty]; } else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][pagePositionProperty] !== 'undefined') { - pageX = e.originalEvent.touches[0][pagePositionProperty]; + pageOffset = e.originalEvent.touches[0][pagePositionProperty]; } } else if (e.touches && e.touches[0] && typeof e.touches[0][pagePositionProperty] !== 'undefined') { - pageX = e.touches[0][pagePositionProperty]; + pageOffset = e.touches[0][pagePositionProperty]; } else if (e.currentPoint && (typeof e.currentPoint.x !== 'undefined' || typeof e.currentPoint.y !== 'undefined')) { - pageX = this.vertical ? e.currentPoint.y : e.currentPoint.x; + pageOffset = this.vertical ? e.currentPoint.y : e.currentPoint.x; } if (this.vertical) { - pageX -= window.pageYOffset; + pageOffset -= window.pageYOffset; } - return this.vertical ? rangeX - pageX : pageX - rangeX; + return this.vertical ? rangeSize - pageOffset : pageOffset - rangeSize; } }, { key: '_getPositionFromValue', @@ -1097,6 +828,308 @@ var RangeSlider = function () { exports.default = RangeSlider; module.exports = exports['default']; +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.supportsRange = exports.removeAllListenersFromEl = exports.removeEventListeners = exports.addEventListeners = exports.insertAfter = exports.triggerEvent = exports.forEachAncestors = exports.removeClass = exports.addClass = exports.hasClass = exports.setCss = exports.getDimension = exports.getHiddenParentNodes = exports.isHidden = exports.detectIE = undefined; + +var _functions = __webpack_require__(0); + +var func = _interopRequireWildcard(_functions); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +var EVENT_LISTENER_LIST = 'eventListenerList'; + +var detectIE = exports.detectIE = function detectIE() { + var ua = window.navigator.userAgent; + var msie = ua.indexOf('MSIE '); + + if (msie > 0) { + return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); + } + + var trident = ua.indexOf('Trident/'); + + if (trident > 0) { + var rv = ua.indexOf('rv:'); + + return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); + } + + var edge = ua.indexOf('Edge/'); + + if (edge > 0) { + return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); + } + + return false; +}; + +var ieVersion = detectIE(); +var eventCaptureParams = window.PointerEvent && !ieVersion ? { passive: false } : false; + +/** + * Check if a `element` is visible in the DOM + * + * @param {Element} element + * @return {Boolean} + */ +var isHidden = exports.isHidden = function isHidden(element) { + return element.offsetWidth === 0 || element.offsetHeight === 0 || element.open === false; +}; + +/** + * Get hidden parentNodes of an `element` + * + * @param {Element} element + * @return {[type]} + */ +var getHiddenParentNodes = exports.getHiddenParentNodes = function getHiddenParentNodes(element) { + var parents = []; + var node = element.parentNode; + + while (isHidden(node)) { + parents.push(node); + node = node.parentNode; + } + return parents; +}; + +/** + * Returns dimensions for an element even if it is not visible in the DOM. + * + * @param {Element} element + * @param {string} key (e.g. offsetWidth …) + * @return {Number} + */ +var getDimension = exports.getDimension = function getDimension(element, key) { + var hiddenParentNodes = getHiddenParentNodes(element); + var hiddenParentNodesLength = hiddenParentNodes.length; + var displayProperty = []; + var dimension = element[key]; + + // Used for native `
` elements + var toggleOpenProperty = function toggleOpenProperty(element) { + if (typeof element.open !== 'undefined') { + element.open = !element.open; + } + }; + + if (hiddenParentNodesLength) { + for (var i = 0; i < hiddenParentNodesLength; i++) { + // Cache the display property to restore it later. + displayProperty[i] = hiddenParentNodes[i].style.display; + + hiddenParentNodes[i].style.display = 'block'; + hiddenParentNodes[i].style.height = '0'; + hiddenParentNodes[i].style.overflow = 'hidden'; + hiddenParentNodes[i].style.visibility = 'hidden'; + toggleOpenProperty(hiddenParentNodes[i]); + } + + dimension = element[key]; + + for (var j = 0; j < hiddenParentNodesLength; j++) { + toggleOpenProperty(hiddenParentNodes[j]); + hiddenParentNodes[j].style.display = displayProperty[j]; + hiddenParentNodes[j].style.height = ''; + hiddenParentNodes[j].style.overflow = ''; + hiddenParentNodes[j].style.visibility = ''; + } + } + return dimension; +}; + +/** + * + * @param {HTMLElement} el + * @param {Object} cssObj + * @returns {*} + */ +var setCss = exports.setCss = function setCss(el, cssObj) { + for (var key in cssObj) { + el.style[key] = cssObj[key]; + } + return el.style; +}; + +/** + * + * @param {HTMLElement} elem + * @param {string} className + */ +var hasClass = exports.hasClass = function hasClass(elem, className) { + return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' '); +}; + +/** + * + * @param {HTMLElement} elem + * @param {string} className + */ +var addClass = exports.addClass = function addClass(elem, className) { + if (!hasClass(elem, className)) { + elem.className += ' ' + className; + } +}; + +/** + * + * @param {HTMLElement} elem + * @param {string} className + */ +var removeClass = exports.removeClass = function removeClass(elem, className) { + var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' '; + + if (hasClass(elem, className)) { + while (newClass.indexOf(' ' + className + ' ') >= 0) { + newClass = newClass.replace(' ' + className + ' ', ' '); + } + elem.className = newClass.replace(/^\s+|\s+$/g, ''); + } +}; + +/** + * + * @param {HTMLElement} el + * @callback callback + * @param {boolean} andForElement - apply callback for el + * @returns {HTMLElement} + */ +var forEachAncestors = exports.forEachAncestors = function forEachAncestors(el, callback, andForElement) { + if (andForElement) { + callback(el); + } + + while (el.parentNode && !callback(el)) { + el = el.parentNode; + } + + return el; +}; + +/** + * + * @param {HTMLElement} el + * @param {string} name event name + * @param {Object} data + */ +var triggerEvent = exports.triggerEvent = function triggerEvent(el, name, data) { + if (!func.isString(name)) { + throw new TypeError('event name must be String'); + } + if (!(el instanceof HTMLElement)) { + throw new TypeError('element must be HTMLElement'); + } + name = name.trim(); + var event = document.createEvent('CustomEvent'); + + event.initCustomEvent(name, false, false, data); + el.dispatchEvent(event); +}; + +/** + * @param {Object} referenceNode after this + * @param {Object} newNode insert this + */ +var insertAfter = exports.insertAfter = function insertAfter(referenceNode, newNode) { + return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); +}; + +/** + * Add event listeners and push them to el[EVENT_LISTENER_LIST] + * @param {HTMLElement} el DOM element + * @param {Array} events + * @callback listener + */ +var addEventListeners = exports.addEventListeners = function addEventListeners(el, events, listener) { + events.forEach(function (eventName) { + if (!el[EVENT_LISTENER_LIST]) { + el[EVENT_LISTENER_LIST] = {}; + } + if (!el[EVENT_LISTENER_LIST][eventName]) { + el[EVENT_LISTENER_LIST][eventName] = []; + } + + el.addEventListener(eventName, listener, eventCaptureParams); + if (el[EVENT_LISTENER_LIST][eventName].indexOf(listener) < 0) { + el[EVENT_LISTENER_LIST][eventName].push(listener); + } + }); +}; + +/** + * Remove event listeners and remove them from el[EVENT_LISTENER_LIST] + * @param {HTMLElement} el DOM element + * @param {Array} events + * @callback listener + */ +var removeEventListeners = exports.removeEventListeners = function removeEventListeners(el, events, listener) { + events.forEach(function (eventName) { + var index = void 0; + + el.removeEventListener(eventName, listener, false); + + if (el[EVENT_LISTENER_LIST] && el[EVENT_LISTENER_LIST][eventName] && (index = el[EVENT_LISTENER_LIST][eventName].indexOf(listener)) > -1) { + el[EVENT_LISTENER_LIST][eventName].splice(index, 1); + } + }); +}; + +/** + * Remove ALL event listeners which exists in el[EVENT_LISTENER_LIST] + * @param {HTMLElement} el DOM element + */ +var removeAllListenersFromEl = exports.removeAllListenersFromEl = function removeAllListenersFromEl(instance, el) { + if (!el[EVENT_LISTENER_LIST]) { + return; + } + /* jshint ignore:start */ + + /** + * + * @callback listener + * @this {Object} event name + */ + function rm(listener) { + if (listener === instance._startEventListener) { + this.el.removeEventListener(this.eventName, listener, false); + } + } + + for (var eventName in el[EVENT_LISTENER_LIST]) { + el[EVENT_LISTENER_LIST][eventName].forEach(rm, { eventName: eventName, el: el }); + } + + el[EVENT_LISTENER_LIST] = {}; + /* jshint ignore:end */ +}; + +/** + * Range feature detection + * @return {Boolean} + */ +var supportsRange = exports.supportsRange = function supportsRange() { + var input = document.createElement('input'); + + input.setAttribute('type', 'range'); + return input.type !== 'text'; +}; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + /***/ }) /******/ ]); }); diff --git a/dist/range-slider.js.map b/dist/range-slider.js.map index a122849..a8c3b31 100644 --- a/dist/range-slider.js.map +++ b/dist/range-slider.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap d73945d03d01dbac7626","webpack:///./src/utils/functions.js","webpack:///./src/utils/dom.js","webpack:///./src/range-slider.css","webpack:///./src/range-slider.js"],"names":["delay","fn","wait","args","setTimeout","apply","debounce","debounceDuration","debouncing","lastReturnVal","window","clearTimeout","debounceTimeout","isString","obj","isArray","Object","prototype","toString","call","isNumberLike","undefined","isFinite","parseFloat","getFirsNumberLike","length","i","len","isObject","simpleExtend","defaultOpt","options","opt","key","func","EVENT_LISTENER_LIST","isHidden","element","offsetWidth","offsetHeight","open","getHiddenParentNodes","parents","node","parentNode","push","getDimension","hiddenParentNodes","hiddenParentNodesLength","displayProperty","dimension","toggleOpenProperty","style","display","height","overflow","visibility","j","setCss","el","cssObj","hasClass","elem","className","RegExp","test","addClass","removeClass","newClass","replace","indexOf","forEachAncestors","callback","andForElement","triggerEvent","name","data","TypeError","HTMLElement","trim","event","document","createEvent","initCustomEvent","dispatchEvent","insertAfter","referenceNode","newNode","insertBefore","nextSibling","addEventListeners","events","listener","forEach","eventName","addEventListener","PointerEvent","passive","removeEventListeners","index","removeEventListener","splice","removeAllListenersFromEl","instance","rm","_startEventListener","supportsRange","input","createElement","setAttribute","type","dom","newLineAndTabRegexp","MAX_SET_BY_DEFAULT","HANDLE_RESIZE_DELAY","HANDLE_RESIZE_DEBOUNCE","pluginName","pluginIdentifier","inputrange","defaults","polyfill","rangeClass","disabledClass","fillClass","bufferClass","handleClass","startEvent","moveEvent","endEvent","min","max","step","value","buffer","stick","borderRadius","vertical","RangeSlider","minSetByDefault","maxSetByDefault","stepSetByDefault","stickAttribute","stickValues","onInit","onSlide","onSlideStart","onSlideEnd","onSlideEventsCount","isInteractsNow","needTriggerEvents","getAttribute","identifier","percent","split","map","_updatePercentFromValue","toFixed","_toFixed","directionClass","fill","handle","range","id","appendChild","_setValue","_handleDown","bind","_handleMove","_handleEnd","_changeEventListener","_handleResize","_init","triggerEvents","_setBufferPosition","_update","cssText","removeChild","ev","target","isEventOnSlider","origin","pos","_getPositionFromValue","_setPosition","sizeProperty","handleSize","rangeSize","maxHandleX","grabX","position","disabled","e","preventDefault","boundingClientRect","getBoundingClientRect","posX","_getRelativePosition","rangeX","bottom","left","handleX","_getPositionFromNode","handleWidth","stickRadius","restFromValue","stickTo","_getValueFromPosition","_cap","Math","abs","transform","width","isPercent","console","warn","isNaN","bufferSize","paddingSize","bufferSizeWithPadding","offsetTop","offsetLeft","offsetParent","pageX","pagePositionProperty","touches","originalEvent","currentPoint","x","y","pageYOffset","percentage","round","Number","force","createInstance","Array","slice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AAC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KAAKrC,OAAtB,EAA+B,OAA/B,EAAwC,EAAC+I,QAAQ,KAAK7B,UAAd,EAAxC;AACD;;;2BAnVa5F,E,EAAI5B,O,EAAS;AACzB,UAAM2M,iBAAiB,SAAjBA,cAAiB,CAAC/K,EAAD,EAAQ;AAC7B,YAAIiB,OAAOjB,GAAGyD,UAAH,CAAX;;AAEA;AACA,YAAI,CAACxC,IAAL,EAAW;AACTA,iBAAO,IAAI6D,WAAJ,CAAgB9E,EAAhB,EAAoB5B,OAApB,CAAP;AACA4B,aAAGyD,UAAH,IAAiBxC,IAAjB;AACD;AACF,OARD;;AAUA,UAAIjB,GAAGlC,MAAP,EAAe;AACbkN,cAAM1N,SAAN,CAAgB2N,KAAhB,CAAsBzN,IAAtB,CAA2BwC,EAA3B,EAA+BkC,OAA/B,CAAuC,UAAUlC,EAAV,EAAc;AACnD+K,yBAAe/K,EAAf;AACD,SAFD;AAGD,OAJD,MAIO;AACL+K,uBAAe/K,EAAf;AACD;AACF;;;;;;kBApOkB8E,W","file":"range-slider.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"rangeSlider\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"rangeSlider\"] = factory();\n\telse\n\t\troot[\"rangeSlider\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap d73945d03d01dbac7626","/**\n * Delays a function for the given number of milliseconds, and then calls\n * it with the arguments supplied.\n *\n * @param {Function} fn function\n * @param {Number} wait delay\n * @param {Number} args arguments\n * @return {Function}\n */\nexport const delay = (fn, wait, ...args) => {\n return setTimeout(function () {\n return fn.apply(null, args);\n }, wait);\n};\n\n/**\n * Returns a debounced function that will make sure the given\n * function is not triggered too much.\n *\n * @param {Function} fn Function to debounce.\n * @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the\n * function. (defaults to 100ms)\n * @return {Function}\n */\nexport const debounce = (fn, debounceDuration) => {\n debounceDuration = debounceDuration || 100;\n return (...args) => {\n if (!fn.debouncing) {\n fn.lastReturnVal = fn.apply(window, args);\n fn.debouncing = true;\n }\n clearTimeout(fn.debounceTimeout);\n fn.debounceTimeout = setTimeout(function () {\n fn.debouncing = false;\n }, debounceDuration);\n return fn.lastReturnVal;\n };\n};\n\nexport const isString = obj => obj === '' + obj;\n\nexport const isArray = obj => Object.prototype.toString.call(obj) === '[object Array]';\n\nexport const isNumberLike = (obj) =>\n (obj !== null && obj !== undefined && (isString(obj) && isFinite(parseFloat(obj)) || (isFinite(obj))));\n\nexport const getFirsNumberLike = (...args) => {\n if (!args.length) {\n return null;\n }\n\n for (let i = 0, len = args.length; i < len; i++) {\n if (isNumberLike(args[i])) {\n return args[i];\n }\n }\n\n return null;\n};\n\nexport const isObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]';\n\nexport const simpleExtend = (defaultOpt, options) => {\n const opt = {};\n\n for (let key in defaultOpt) {\n opt[key] = defaultOpt[key];\n }\n for (let key in options) {\n opt[key] = options[key];\n }\n\n return opt;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/functions.js","import * as func from './functions';\n\nconst EVENT_LISTENER_LIST = 'eventListenerList';\n\n/**\n * Check if a `element` is visible in the DOM\n *\n * @param {Element} element\n * @return {Boolean}\n */\nexport const isHidden = (element) => (\n element.offsetWidth === 0 || element.offsetHeight === 0 || element.open === false\n);\n/**\n * Get hidden parentNodes of an `element`\n *\n * @param {Element} element\n * @return {[type]}\n */\nexport const getHiddenParentNodes = (element) => {\n const parents = [];\n let node = element.parentNode;\n\n while (isHidden(node)) {\n parents.push(node);\n node = node.parentNode;\n }\n return parents;\n};\n\n/**\n * Returns dimensions for an element even if it is not visible in the DOM.\n *\n * @param {Element} element\n * @param {string} key (e.g. offsetWidth …)\n * @return {Number}\n */\nexport const getDimension = (element, key) => {\n const hiddenParentNodes = getHiddenParentNodes(element);\n const hiddenParentNodesLength = hiddenParentNodes.length;\n const displayProperty = [];\n let dimension = element[key];\n\n // Used for native `
` elements\n function toggleOpenProperty(element) {\n if (typeof element.open !== 'undefined') {\n element.open = !element.open;\n }\n }\n\n if (hiddenParentNodesLength) {\n for (let i = 0; i < hiddenParentNodesLength; i++) {\n // Cache the display property to restore it later.\n displayProperty[i] = hiddenParentNodes[i].style.display;\n\n hiddenParentNodes[i].style.display = 'block';\n hiddenParentNodes[i].style.height = '0';\n hiddenParentNodes[i].style.overflow = 'hidden';\n hiddenParentNodes[i].style.visibility = 'hidden';\n toggleOpenProperty(hiddenParentNodes[i]);\n }\n\n dimension = element[key];\n\n for (let j = 0; j < hiddenParentNodesLength; j++) {\n toggleOpenProperty(hiddenParentNodes[j]);\n hiddenParentNodes[j].style.display = displayProperty[j];\n hiddenParentNodes[j].style.height = '';\n hiddenParentNodes[j].style.overflow = '';\n hiddenParentNodes[j].style.visibility = '';\n }\n }\n return dimension;\n};\n\n/**\n *\n * @param {HTMLElement} el\n * @param {Object} cssObj\n * @returns {*}\n */\nexport const setCss = (el, cssObj) => {\n for (const key in cssObj) {\n el.style[key] = cssObj[key];\n }\n return el.style;\n};\n\n/**\n *\n * @param {HTMLElement} elem\n * @param {string} className\n */\nexport const hasClass = (elem, className) => new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');\n\n/**\n *\n * @param {HTMLElement} elem\n * @param {string} className\n */\nexport const addClass = (elem, className) => {\n if (!hasClass(elem, className)) {\n elem.className += ' ' + className;\n }\n};\n\n/**\n *\n * @param {HTMLElement} elem\n * @param {string} className\n */\nexport const removeClass = (elem, className) => {\n let newClass = ' ' + elem.className.replace(/[\\t\\r\\n]/g, ' ') + ' ';\n\n if (hasClass(elem, className)) {\n while (newClass.indexOf(' ' + className + ' ') >= 0) {\n newClass = newClass.replace(' ' + className + ' ', ' ');\n }\n elem.className = newClass.replace(/^\\s+|\\s+$/g, '');\n }\n};\n\n/**\n *\n * @param {HTMLElement} el\n * @callback callback\n * @param {boolean} andForElement - apply callback for el\n * @returns {HTMLElement}\n */\nexport const forEachAncestors = (el, callback, andForElement) => {\n if (andForElement) {\n callback(el);\n }\n\n while (el.parentNode && !callback(el)) {\n el = el.parentNode;\n }\n\n return el;\n};\n\n/**\n *\n * @param {HTMLElement} el\n * @param {string} name event name\n * @param {Object} data\n */\nexport const triggerEvent = (el, name, data) => {\n if (!func.isString(name)) {\n throw new TypeError('event name must be String');\n }\n if (!(el instanceof HTMLElement)) {\n throw new TypeError('element must be HTMLElement');\n }\n name = name.trim();\n const event = document.createEvent('CustomEvent');\n\n event.initCustomEvent(name, false, false, data);\n el.dispatchEvent(event);\n};\n\n/**\n * @param {Object} referenceNode after this\n * @param {Object} newNode insert this\n */\nexport const insertAfter = (referenceNode, newNode) =>\n referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);\n\n/**\n * Add event listeners and push them to el[EVENT_LISTENER_LIST]\n * @param {HTMLElement} el DOM element\n * @param {Array} events\n * @callback listener\n */\nexport const addEventListeners = (el, events, listener) => {\n events.forEach(function (eventName) {\n if (!el[EVENT_LISTENER_LIST]) {\n el[EVENT_LISTENER_LIST] = {};\n }\n if (!el[EVENT_LISTENER_LIST][eventName]) {\n el[EVENT_LISTENER_LIST][eventName] = [];\n }\n\n el.addEventListener(\n eventName,\n listener,\n window.PointerEvent ? {passive: false} : false\n );\n if (el[EVENT_LISTENER_LIST][eventName].indexOf(listener) < 0) {\n el[EVENT_LISTENER_LIST][eventName].push(listener);\n }\n });\n};\n\n/**\n * Remove event listeners and remove them from el[EVENT_LISTENER_LIST]\n * @param {HTMLElement} el DOM element\n * @param {Array} events\n * @callback listener\n */\nexport const removeEventListeners = (el, events, listener) => {\n events.forEach(function (eventName) {\n let index;\n\n el.removeEventListener(\n eventName,\n listener,\n false\n );\n\n if (el[EVENT_LISTENER_LIST] && el[EVENT_LISTENER_LIST][eventName] &&\n (index = el[EVENT_LISTENER_LIST][eventName].indexOf(listener)) > -1\n ) {\n el[EVENT_LISTENER_LIST][eventName].splice(index, 1);\n }\n });\n};\n\n/**\n * Remove ALL event listeners which exists in el[EVENT_LISTENER_LIST]\n * @param {HTMLElement} el DOM element\n */\nexport const removeAllListenersFromEl = (instance, el) => {\n if (!el[EVENT_LISTENER_LIST]) {\n return;\n }\n /* jshint ignore:start */\n\n /**\n *\n * @callback listener\n * @this {Object} event name\n */\n function rm(listener) {\n if (listener === instance._startEventListener) {\n this.el.removeEventListener(this.eventName, listener, false);\n }\n }\n\n for (const eventName in el[EVENT_LISTENER_LIST]) {\n el[EVENT_LISTENER_LIST][eventName].forEach(rm, {eventName: eventName, el: el});\n }\n\n el[EVENT_LISTENER_LIST] = {};\n /* jshint ignore:end */\n};\n\n/**\n * Range feature detection\n * @return {Boolean}\n */\nexport const supportsRange = () => {\n const input = document.createElement('input');\n\n input.setAttribute('type', 'range');\n return input.type !== 'text';\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/dom.js","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/range-slider.css\n// module id = 2\n// module chunks = 0","import * as dom from './utils/dom';\nimport * as func from './utils/functions';\nimport './range-slider.css';\n\nconst newLineAndTabRegexp = new RegExp('/[\\\\n\\\\t]/', 'g');\nconst MAX_SET_BY_DEFAULT = 100;\nconst HANDLE_RESIZE_DELAY = 300;\nconst HANDLE_RESIZE_DEBOUNCE = 50;\n\nconst pluginName = 'rangeSlider';\nlet pluginIdentifier = 0;\nconst inputrange = dom.supportsRange();\nconst defaults = {\n polyfill: true,\n rangeClass: 'rangeSlider',\n disabledClass: 'rangeSlider--disabled',\n fillClass: 'rangeSlider__fill',\n bufferClass: 'rangeSlider__buffer',\n handleClass: 'rangeSlider__handle',\n startEvent: ['mousedown', 'touchstart', 'pointerdown'],\n moveEvent: ['mousemove', 'touchmove', 'pointermove'],\n endEvent: ['mouseup', 'touchend', 'pointerup'],\n min: null,\n max: null,\n step: null,\n value: null,\n buffer: null,\n stick: null,\n borderRadius: 10,\n vertical: false\n};\n\n/**\n * Plugin\n * @param {HTMLElement} element\n * @param {this} options\n */\nexport default class RangeSlider {\n constructor(element, options) {\n let minSetByDefault;\n let maxSetByDefault;\n let stepSetByDefault;\n let stickAttribute;\n let stickValues;\n\n this.element = element;\n this.options = func.simpleExtend(defaults, options);\n this.polyfill = this.options.polyfill;\n this.vertical = this.options.vertical;\n this.onInit = this.options.onInit;\n this.onSlide = this.options.onSlide;\n this.onSlideStart = this.options.onSlideStart;\n this.onSlideEnd = this.options.onSlideEnd;\n this.onSlideEventsCount = -1;\n this.isInteractsNow = false;\n this.needTriggerEvents = false;\n\n // Plugin should only be used as a polyfill\n if (!this.polyfill) {\n // Input range support?\n if (inputrange) {\n return;\n }\n }\n\n this.options.buffer = this.options.buffer || parseFloat(this.element.getAttribute('data-buffer'));\n\n this.identifier = 'js-' + pluginName + '-' + (pluginIdentifier++);\n this.min = func.getFirsNumberLike(\n this.options.min,\n parseFloat(this.element.getAttribute('min')),\n (minSetByDefault = 0)\n );\n this.max = func.getFirsNumberLike(\n this.options.max,\n parseFloat(this.element.getAttribute('max')),\n (maxSetByDefault = MAX_SET_BY_DEFAULT)\n );\n this.value = func.getFirsNumberLike(this.options.value, this.element.value,\n parseFloat(this.element.value || this.min + (this.max - this.min) / 2));\n this.step = func.getFirsNumberLike(this.options.step,\n parseFloat(this.element.getAttribute('step')) || (stepSetByDefault = 1));\n this.percent = null;\n if (func.isArray(this.options.stick) && this.options.stick.length >= 1) {\n this.stick = this.options.stick;\n } else if ((stickAttribute = this.element.getAttribute('stick'))) {\n stickValues = stickAttribute.split(' ');\n if (stickValues.length >= 1) {\n this.stick = stickValues.map(parseFloat);\n }\n }\n if (this.stick && this.stick.length === 1) {\n this.stick.push(this.step * 1.5);\n }\n this._updatePercentFromValue();\n\n this.toFixed = this._toFixed(this.step);\n\n let directionClass;\n\n this.fill = document.createElement('div');\n dom.addClass(this.fill, this.options.fillClass);\n\n directionClass = this.vertical ? this.options.fillClass + '__vertical' : this.options.fillClass + '__horizontal';\n dom.addClass(this.fill, directionClass);\n\n this.handle = document.createElement('div');\n dom.addClass(this.handle, this.options.handleClass);\n\n directionClass = this.vertical ?\n this.options.handleClass + '__vertical' :\n this.options.handleClass + '__horizontal';\n dom.addClass(this.handle, directionClass);\n\n this.range = document.createElement('div');\n dom.addClass(this.range, this.options.rangeClass);\n this.range.id = this.identifier;\n this.range.appendChild(this.handle);\n this.range.appendChild(this.fill);\n\n directionClass = this.vertical ? this.options.rangeClass + '__vertical' : this.options.rangeClass + '__horizontal';\n dom.addClass(this.range, directionClass);\n\n if (this.options.bufferClass) {\n this.buffer = document.createElement('div');\n dom.addClass(this.buffer, this.options.bufferClass);\n this.range.appendChild(this.buffer);\n\n directionClass = this.vertical ?\n this.options.bufferClass + '__vertical' :\n this.options.bufferClass + '__horizontal';\n dom.addClass(this.buffer, directionClass);\n }\n\n if (func.isNumberLike(this.options.value)) {\n this._setValue(this.options.value, true);\n this.element.value = this.options.value;\n }\n\n if (func.isNumberLike(this.options.buffer)) {\n this.element.setAttribute('data-buffer', this.options.buffer);\n }\n\n if (func.isNumberLike(this.options.min) || minSetByDefault) {\n this.element.setAttribute('min', '' + this.min);\n }\n\n if (func.isNumberLike(this.options.max) || maxSetByDefault) {\n this.element.setAttribute('max', '' + this.max);\n }\n\n if (func.isNumberLike(this.options.step) || stepSetByDefault) {\n this.element.setAttribute('step', '' + this.step);\n }\n\n dom.insertAfter(this.element, this.range);\n\n// visually hide the input\n dom.setCss(this.element, {\n 'position': 'absolute',\n 'width': '1px',\n 'height': '1px',\n 'overflow': 'hidden',\n 'opacity': '0'\n });\n\n// Store context\n this._handleDown = this._handleDown.bind(this);\n this._handleMove = this._handleMove.bind(this);\n this._handleEnd = this._handleEnd.bind(this);\n this._startEventListener = this._startEventListener.bind(this);\n this._changeEventListener = this._changeEventListener.bind(this);\n this._handleResize = this._handleResize.bind(this);\n\n this._init();\n\n// Attach Events\n window.addEventListener('resize', this._handleResize, false);\n\n dom.addEventListeners(document, this.options.startEvent, this._startEventListener);\n\n// Listen to programmatic value changes\n this.element.addEventListener('change', this._changeEventListener, false);\n }\n\n /* public methods */\n\n /**\n *\n * @param {Object} obj like {min : Number, max : Number, value : Number, step : Number, buffer : [String|Number]}\n * @param {Boolean} triggerEvents\n * @returns {RangeSlider}\n */\n update(obj, triggerEvents) {\n if (triggerEvents) {\n this.needTriggerEvents = true;\n }\n if (func.isObject(obj)) {\n if (func.isNumberLike(obj.min)) {\n this.element.setAttribute('min', '' + obj.min);\n this.min = obj.min;\n }\n\n if (func.isNumberLike(obj.max)) {\n this.element.setAttribute('max', '' + obj.max);\n this.max = obj.max;\n }\n\n if (func.isNumberLike(obj.step)) {\n this.element.setAttribute('step', '' + obj.step);\n this.step = obj.step;\n this.toFixed = this._toFixed(obj.step);\n }\n\n if (func.isNumberLike(obj.buffer)) {\n this._setBufferPosition(obj.buffer);\n }\n\n if (func.isNumberLike(obj.value)) {\n this._setValue(obj.value);\n }\n }\n this._update();\n this.onSlideEventsCount = 0;\n this.needTriggerEvents = false;\n return this;\n };\n\n destroy() {\n dom.removeAllListenersFromEl(this, document);\n window.removeEventListener('resize', this._handleResize, false);\n this.element.removeEventListener('change', this._changeEventListener, false);\n\n this.element.style.cssText = '';\n delete this.element[pluginName];\n\n // Remove the generated markup\n if (this.range) {\n this.range.parentNode.removeChild(this.range);\n }\n }\n\n /**\n * A lightweight plugin wrapper around the constructor,preventing against multiple instantiations\n * @param {Element} el\n * @param {Object} options\n */\n static create(el, options) {\n const createInstance = (el) => {\n let data = el[pluginName];\n\n // Create a new instance.\n if (!data) {\n data = new RangeSlider(el, options);\n el[pluginName] = data;\n }\n };\n\n if (el.length) {\n Array.prototype.slice.call(el).forEach(function (el) {\n createInstance(el);\n });\n } else {\n createInstance(el);\n }\n }\n\n /* priate methods */\n\n _toFixed(step) {\n return (step + '').replace('.', '').length - 1;\n }\n\n _init() {\n if (this.onInit && typeof this.onInit === 'function') {\n this.onInit();\n }\n this._update();\n }\n\n _updatePercentFromValue() {\n this.percent = (this.value - this.min) / (this.max - this.min);\n }\n\n /**\n * This method check if this.identifier exists in ev.target's ancestors\n * @param ev\n * @param data\n */\n _startEventListener(ev, data) {\n const el = ev.target;\n let isEventOnSlider = false;\n\n dom.forEachAncestors(el, (el) =>\n (isEventOnSlider = el.id === this.identifier && !dom.hasClass(el, this.options.disabledClass)),\n true);\n\n if (isEventOnSlider) {\n this._handleDown(ev, data);\n }\n }\n\n _changeEventListener(ev, data) {\n if (data && data.origin === this.identifier) {\n return;\n }\n\n const value = ev.target.value;\n const pos = this._getPositionFromValue(value);\n\n this._setPosition(pos);\n }\n\n _update() {\n const sizeProperty = this.vertical ? 'offsetHeight' : 'offsetWidth';\n\n this.handleSize = dom.getDimension(this.handle, sizeProperty);\n this.rangeSize = dom.getDimension(this.range, sizeProperty);\n this.maxHandleX = this.rangeSize - this.handleSize;\n this.grabX = this.handleSize / 2;\n this.position = this._getPositionFromValue(this.value);\n\n // Consider disabled state\n if (this.element.disabled) {\n dom.addClass(this.range, this.options.disabledClass);\n } else {\n dom.removeClass(this.range, this.options.disabledClass);\n }\n\n this._setPosition(this.position);\n if (this.options.bufferClass && this.options.buffer) {\n this._setBufferPosition(this.options.buffer);\n }\n this._updatePercentFromValue();\n dom.triggerEvent(this.element, 'change', {origin: this.identifier});\n }\n\n _handleResize() {\n return func.debounce(() => {\n // Simulate resizeEnd event.\n func.delay(() => {\n this._update();\n }, HANDLE_RESIZE_DELAY);\n }, HANDLE_RESIZE_DEBOUNCE)();\n }\n\n _handleDown(e) {\n this.isInteractsNow = true;\n e.preventDefault();\n dom.addEventListeners(document, this.options.moveEvent, this._handleMove);\n dom.addEventListeners(document, this.options.endEvent, this._handleEnd);\n\n // If we click on the handle don't set the new position\n if ((' ' + e.target.className + ' ').replace(newLineAndTabRegexp, ' ').indexOf(this.options.handleClass) > -1) {\n return;\n }\n\n const boundingClientRect = this.range.getBoundingClientRect();\n\n const posX = this._getRelativePosition(e);\n const rangeX = this.vertical ? boundingClientRect.bottom : boundingClientRect.left;\n const handleX = this._getPositionFromNode(this.handle) - rangeX;\n const position = posX - this.grabX;\n\n this._setPosition(position);\n\n if (posX >= handleX && posX < handleX + this.handleWidth) {\n this.grabX = posX - handleX;\n }\n this._updatePercentFromValue();\n }\n\n _handleMove(e) {\n const posX = this._getRelativePosition(e);\n\n this.isInteractsNow = true;\n e.preventDefault();\n this._setPosition(posX - this.grabX);\n }\n\n _handleEnd(e) {\n e.preventDefault();\n dom.removeEventListeners(document, this.options.moveEvent, this._handleMove);\n dom.removeEventListeners(document, this.options.endEvent, this._handleEnd);\n\n // Ok we're done fire the change event\n dom.triggerEvent(this.element, 'change', {origin: this.identifier});\n\n if (this.isInteractsNow || this.needTriggerEvents) {\n if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {\n this.onSlideEnd(this.value, this.percent, this.position);\n }\n }\n this.onSlideEventsCount = 0;\n this.isInteractsNow = false;\n }\n\n _cap(pos, min, max) {\n if (pos < min) {\n return min;\n }\n if (pos > max) {\n return max;\n }\n return pos;\n }\n\n _setPosition(pos) {\n let position;\n let stickRadius;\n let restFromValue;\n let stickTo;\n\n // Snapping steps\n let value = this._getValueFromPosition(this._cap(pos, 0, this.maxHandleX));\n\n // Stick to stick[0] in radius stick[1]\n if (this.stick) {\n stickTo = this.stick[0];\n stickRadius = this.stick[1] || 0.1;\n restFromValue = value % stickTo;\n if (restFromValue < stickRadius) {\n value = value - restFromValue;\n } else if (Math.abs(stickTo - restFromValue) < stickRadius) {\n value = value - restFromValue + stickTo;\n }\n }\n position = this._getPositionFromValue(value);\n\n // Update ui\n if (this.vertical) {\n this.fill.style.height = (position + this.grabX) + 'px';\n this.handle.style.transform = 'translateY(-' + position + 'px)';\n this.handle.style['-ms-transform'] = 'translateY(-' + position + 'px)';\n } else {\n this.fill.style.width = (position + this.grabX) + 'px';\n this.handle.style.transform = 'translateX(' + position + 'px)';\n this.handle.style['-ms-transform'] = 'translateX(' + position + 'px)';\n }\n\n this._setValue(value);\n\n // Update globals\n this.position = position;\n this.value = value;\n this._updatePercentFromValue();\n\n if (this.isInteractsNow || this.needTriggerEvents) {\n if (this.onSlideStart && typeof this.onSlideStart === 'function' && this.onSlideEventsCount === 0) {\n this.onSlideStart(this.value, this.percent, this.position);\n }\n\n if (this.onSlide && typeof this.onSlide === 'function') {\n this.onSlide(this.value, this.percent, this.position);\n }\n }\n\n this.onSlideEventsCount++;\n }\n\n _setBufferPosition(pos) {\n let isPercent = true;\n\n if (isFinite(pos)) {\n pos = parseFloat(pos);\n } else if (func.isString(pos)) {\n if (pos.indexOf('px') > 0) {\n isPercent = false;\n }\n pos = parseFloat(pos);\n } else {\n console.warn('New position must be XXpx or XX%');\n return;\n }\n\n if (isNaN(pos)) {\n console.warn('New position is NaN');\n return;\n }\n if (!this.options.bufferClass) {\n console.warn('You disabled buffer, it\\'s className is empty');\n return;\n }\n let bufferSize = isPercent ? pos : (pos / this.rangeSize * 100);\n\n if (bufferSize < 0) {\n bufferSize = 0;\n }\n if (bufferSize > 100) {\n bufferSize = 100;\n }\n this.options.buffer = bufferSize;\n\n let paddingSize = this.options.borderRadius / this.rangeSize * 100;\n let bufferSizeWithPadding = bufferSize - paddingSize;\n\n if (bufferSizeWithPadding < 0) {\n bufferSizeWithPadding = 0;\n }\n\n if (this.vertical) {\n this.buffer.style.height = bufferSizeWithPadding + '%';\n this.buffer.style.bottom = paddingSize * 0.5 + '%';\n } else {\n this.buffer.style.width = bufferSizeWithPadding + '%';\n this.buffer.style.left = paddingSize * 0.5 + '%';\n }\n\n this.element.setAttribute('data-buffer', bufferSize);\n }\n\n /**\n *\n * @param {Element} node\n * @returns {*} Returns element position relative to the parent\n * @private\n */\n _getPositionFromNode(node) {\n let i = this.vertical ? this.maxHandleX : 0;\n\n while (node !== null) {\n i += this.vertical ? node.offsetTop : node.offsetLeft;\n node = node.offsetParent;\n }\n return i;\n }\n\n /**\n *\n * @param {(MouseEvent|TouchEvent)}e\n * @returns {number}\n */\n _getRelativePosition(e) {\n const boundingClientRect = this.range.getBoundingClientRect();\n\n // Get the offset relative to the viewport\n const rangeX = this.vertical ? boundingClientRect.bottom : boundingClientRect.left;\n let pageX = 0;\n\n const pagePositionProperty = this.vertical ? 'pageY' : 'pageX';\n\n if (typeof e[pagePositionProperty] !== 'undefined') {\n pageX = (e.touches && e.touches.length) ? e.touches[0][pagePositionProperty] : e[pagePositionProperty];\n } else if (typeof e.originalEvent !== 'undefined') {\n if (typeof e.originalEvent[pagePositionProperty] !== 'undefined') {\n pageX = e.originalEvent[pagePositionProperty];\n } else if (e.originalEvent.touches && e.originalEvent.touches[0] &&\n typeof e.originalEvent.touches[0][pagePositionProperty] !== 'undefined') {\n pageX = e.originalEvent.touches[0][pagePositionProperty];\n }\n } else if (e.touches && e.touches[0] && typeof e.touches[0][pagePositionProperty] !== 'undefined') {\n pageX = e.touches[0][pagePositionProperty];\n } else if (e.currentPoint && (typeof e.currentPoint.x !== 'undefined' || typeof e.currentPoint.y !== 'undefined')) {\n pageX = this.vertical ? e.currentPoint.y : e.currentPoint.x;\n }\n\n if (this.vertical) {\n pageX -= window.pageYOffset;\n }\n\n return this.vertical ? rangeX - pageX : pageX - rangeX;\n }\n\n _getPositionFromValue(value) {\n const percentage = (value - this.min) / (this.max - this.min);\n const pos = percentage * this.maxHandleX;\n\n return isNaN(pos) ? 0 : pos;\n }\n\n _getValueFromPosition(pos) {\n const percentage = ((pos) / (this.maxHandleX || 1));\n const value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min;\n\n return Number((value).toFixed(this.toFixed));\n }\n\n _setValue(value, force) {\n if (value === this.value && !force) {\n return;\n }\n\n // Set the new value and fire the `input` event\n this.element.value = value;\n this.value = value;\n dom.triggerEvent(this.element, 'input', {origin: this.identifier});\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/range-slider.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 682a3502b1a643c25369","webpack:///./src/utils/functions.js","webpack:///./src/range-slider.js","webpack:///./src/utils/dom.js","webpack:///./src/range-slider.css"],"names":["delay","fn","wait","args","setTimeout","apply","debounce","debounceDuration","debouncing","lastReturnVal","window","clearTimeout","debounceTimeout","isString","obj","isArray","Object","prototype","toString","call","isNumberLike","undefined","isFinite","parseFloat","getFirsNumberLike","length","i","len","isObject","simpleExtend","defaultOpt","options","opt","key","dom","func","newLineAndTabRegexp","RegExp","MAX_SET_BY_DEFAULT","HANDLE_RESIZE_DELAY","HANDLE_RESIZE_DEBOUNCE","pluginName","pluginIdentifier","inputrange","supportsRange","defaults","polyfill","rangeClass","disabledClass","fillClass","bufferClass","handleClass","startEvent","moveEvent","endEvent","min","max","step","value","buffer","stick","borderRadius","vertical","RangeSlider","element","minSetByDefault","maxSetByDefault","stepSetByDefault","stickAttribute","stickValues","onInit","onSlide","onSlideStart","onSlideEnd","onSlideEventsCount","isInteractsNow","needTriggerEvents","getAttribute","identifier","percent","split","map","push","_updatePercentFromValue","toFixed","_toFixed","directionClass","container","document","createElement","addClass","handle","range","id","appendChild","_setValue","setAttribute","insertAfter","setCss","_handleDown","bind","_handleMove","_handleEnd","_startEventListener","_changeEventListener","_handleResize","_init","addEventListener","addEventListeners","triggerEvents","_setBufferPosition","_update","removeAllListenersFromEl","removeEventListener","style","cssText","parentNode","removeChild","replace","ev","data","el","target","isEventOnSlider","which","forEachAncestors","hasClass","origin","pos","_getPositionFromValue","_setPosition","sizeProperty","handleSize","getDimension","rangeSize","maxHandleX","grabX","position","disabled","removeClass","triggerEvent","e","className","indexOf","boundingClientRect","getBoundingClientRect","posX","_getRelativePosition","rangeX","bottom","left","handleX","_getPositionFromNode","handleWidth","removeEventListeners","stickRadius","restFromValue","stickTo","_getValueFromPosition","_cap","Math","abs","height","transform","width","isPercent","console","warn","isNaN","bufferSize","paddingSize","bufferSizeWithPadding","node","offsetTop","offsetLeft","offsetParent","pageOffset","pagePositionProperty","touches","originalEvent","currentPoint","x","y","pageYOffset","percentage","round","Number","force","createInstance","Array","slice","forEach","EVENT_LISTENER_LIST","detectIE","ua","navigator","userAgent","msie","parseInt","substring","trident","rv","edge","ieVersion","eventCaptureParams","PointerEvent","passive","isHidden","offsetWidth","offsetHeight","open","getHiddenParentNodes","parents","hiddenParentNodes","hiddenParentNodesLength","displayProperty","dimension","toggleOpenProperty","display","overflow","visibility","j","cssObj","elem","test","newClass","callback","andForElement","name","TypeError","HTMLElement","trim","event","createEvent","initCustomEvent","dispatchEvent","referenceNode","newNode","insertBefore","nextSibling","events","listener","eventName","index","splice","instance","rm","input","type"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;AC7DA;;;;;;;;;AASO,IAAMA,wBAAQ,SAARA,KAAQ,CAACC,EAAD,EAAKC,IAAL,EAAuB;AAAA,oCAATC,IAAS;AAATA,QAAS;AAAA;;AAC1C,SAAOC,WAAW,YAAM;AACtB,WAAOH,GAAGI,KAAH,CAAS,IAAT,EAAeF,IAAf,CAAP;AACD,GAFM,EAEJD,IAFI,CAAP;AAGD,CAJM;;AAMP;;;;;;;;;AASO,IAAMI,8BAAW,SAAXA,QAAW,CAACL,EAAD,EAAKM,gBAAL,EAA0B;AAChDA,qBAAmBA,oBAAoB,GAAvC;AACA,SAAO,YAAa;AAAA,uCAATJ,IAAS;AAATA,UAAS;AAAA;;AAClB,QAAI,CAACF,GAAGO,UAAR,EAAoB;AAClBP,SAAGQ,aAAH,GAAmBR,GAAGI,KAA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,EAAmCnG,OAAnC,CAA2CkG,QAA3C,CAAT,IAAiE,CAAC,CADpE,EAEE;AACAxH,SAAGuE,mBAAH,EAAwBkD,SAAxB,EAAmCE,MAAnC,CAA0CD,KAA1C,EAAiD,CAAjD;AACD;AACF,GAdD;AAeD,CAhBM;;AAkBP;;;;AAIO,IAAMnI,8DAA2B,SAA3BA,wBAA2B,CAACqI,QAAD,EAAW5H,EAAX,EAAkB;AACxD,MAAI,CAACA,GAAGuE,mBAAH,CAAL,EAA8B;AAC5B;AACD;AACD;;AAEA;;;;;AAKA,WAASsD,EAAT,CAAYL,QAAZ,EAAsB;AACpB,QAAIA,aAAaI,SAAS9I,mBAA1B,EAA+C;AAC7C,WAAKkB,EAAL,CAAQR,mBAAR,CAA4B,KAAKiI,SAAjC,EAA4CD,QAA5C,EAAsD,KAAtD;AACD;AACF;;AAED,OAAK,IAAMC,SAAX,IAAwBzH,GAAGuE,mBAAH,CAAxB,EAAiD;AAC/CvE,OAAGuE,mBAAH,EAAwBkD,SAAxB,EAAmCnD,OAAnC,CAA2CuD,EAA3C,EAA+C,EAACJ,WAAWA,SAAZ,EAAuBzH,IAAIA,EAA3B,EAA/C;AACD;;AAEDA,KAAGuE,mBAAH,IAA0B,EAA1B;AACA;AACD,CAvBM;;AAyBP;;;;AAIO,IAAMpJ,wCAAgB,SAAhBA,aAAgB,GAAM;AACjC,MAAM2M,QAAQ/J,SAASC,aAAT,CAAuB,OAAvB,CAAd;;AAEA8J,QAAMvJ,YAAN,CAAmB,MAAnB,EAA2B,OAA3B;AACA,SAAOuJ,MAAMC,IAAN,KAAe,MAAtB;AACD,CALM,C;;;;;;ACxRP,yC","file":"range-slider.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"rangeSlider\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"rangeSlider\"] = factory();\n\telse\n\t\troot[\"rangeSlider\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 682a3502b1a643c25369","/**\n * Delays a function for the given number of milliseconds, and then calls\n * it with the arguments supplied.\n *\n * @param {Function} fn function\n * @param {Number} wait delay\n * @param {Number} args arguments\n * @return {Function}\n */\nexport const delay = (fn, wait, ...args) => {\n return setTimeout(() => {\n return fn.apply(null, args);\n }, wait);\n};\n\n/**\n * Returns a debounced function that will make sure the given\n * function is not triggered too much.\n *\n * @param {Function} fn Function to debounce.\n * @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the\n * function. (defaults to 100ms)\n * @return {Function}\n */\nexport const debounce = (fn, debounceDuration) => {\n debounceDuration = debounceDuration || 100;\n return (...args) => {\n if (!fn.debouncing) {\n fn.lastReturnVal = fn.apply(window, args);\n fn.debouncing = true;\n }\n clearTimeout(fn.debounceTimeout);\n fn.debounceTimeout = setTimeout(() => {\n fn.debouncing = false;\n }, debounceDuration);\n return fn.lastReturnVal;\n };\n};\n\nexport const isString = obj => obj === '' + obj;\n\nexport const isArray = obj => Object.prototype.toString.call(obj) === '[object Array]';\n\nexport const isNumberLike = (obj) =>\n (obj !== null && obj !== undefined && (isString(obj) && isFinite(parseFloat(obj)) || (isFinite(obj))));\n\nexport const getFirsNumberLike = (...args) => {\n if (!args.length) {\n return null;\n }\n\n for (let i = 0, len = args.length; i < len; i++) {\n if (isNumberLike(args[i])) {\n return args[i];\n }\n }\n\n return null;\n};\n\nexport const isObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]';\n\nexport const simpleExtend = (defaultOpt, options) => {\n const opt = {};\n\n for (let key in defaultOpt) {\n opt[key] = defaultOpt[key];\n }\n for (let key in options) {\n opt[key] = options[key];\n }\n\n return opt;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/functions.js","import * as dom from './utils/dom';\nimport * as func from './utils/functions';\nimport './range-slider.css';\n\nconst newLineAndTabRegexp = new RegExp('/[\\\\n\\\\t]/', 'g');\nconst MAX_SET_BY_DEFAULT = 100;\nconst HANDLE_RESIZE_DELAY = 300;\nconst HANDLE_RESIZE_DEBOUNCE = 50;\n\nconst pluginName = 'rangeSlider';\nlet pluginIdentifier = 0;\nconst inputrange = dom.supportsRange();\nconst defaults = {\n polyfill: true,\n rangeClass: 'rangeSlider',\n disabledClass: 'rangeSlider--disabled',\n fillClass: 'rangeSlider__fill',\n bufferClass: 'rangeSlider__buffer',\n handleClass: 'rangeSlider__handle',\n startEvent: ['mousedown', 'touchstart', 'pointerdown'],\n moveEvent: ['mousemove', 'touchmove', 'pointermove'],\n endEvent: ['mouseup', 'touchend', 'pointerup'],\n min: null,\n max: null,\n step: null,\n value: null,\n buffer: null,\n stick: null,\n borderRadius: 10,\n vertical: false\n};\n\n/**\n * Plugin\n * @param {HTMLElement} element\n * @param {this} options\n */\nexport default class RangeSlider {\n constructor(element, options) {\n let minSetByDefault;\n let maxSetByDefault;\n let stepSetByDefault;\n let stickAttribute;\n let stickValues;\n\n this.element = element;\n this.options = func.simpleExtend(defaults, options);\n this.polyfill = this.options.polyfill;\n this.vertical = this.options.vertical;\n this.onInit = this.options.onInit;\n this.onSlide = this.options.onSlide;\n this.onSlideStart = this.options.onSlideStart;\n this.onSlideEnd = this.options.onSlideEnd;\n this.onSlideEventsCount = -1;\n this.isInteractsNow = false;\n this.needTriggerEvents = false;\n\n // Plugin should only be used as a polyfill\n if (!this.polyfill) {\n // Input range support?\n if (inputrange) {\n return;\n }\n }\n\n this.options.buffer = this.options.buffer || parseFloat(this.element.getAttribute('data-buffer'));\n\n this.identifier = 'js-' + pluginName + '-' + (pluginIdentifier++);\n\n this.min = func.getFirsNumberLike(\n this.options.min,\n parseFloat(this.element.getAttribute('min')),\n (minSetByDefault = 0)\n );\n\n this.max = func.getFirsNumberLike(\n this.options.max,\n parseFloat(this.element.getAttribute('max')),\n (maxSetByDefault = MAX_SET_BY_DEFAULT)\n );\n\n this.value = func.getFirsNumberLike(this.options.value, this.element.value,\n parseFloat(this.element.value || this.min + (this.max - this.min) / 2));\n\n this.step = func.getFirsNumberLike(this.options.step,\n parseFloat(this.element.getAttribute('step')) || (stepSetByDefault = 1));\n\n this.percent = null;\n\n if (func.isArray(this.options.stick) && this.options.stick.length >= 1) {\n this.stick = this.options.stick;\n } else if ((stickAttribute = this.element.getAttribute('stick'))) {\n stickValues = stickAttribute.split(' ');\n if (stickValues.length >= 1) {\n this.stick = stickValues.map(parseFloat);\n }\n }\n if (this.stick && this.stick.length === 1) {\n this.stick.push(this.step * 1.5);\n }\n this._updatePercentFromValue();\n\n this.toFixed = this._toFixed(this.step);\n\n let directionClass;\n\n this.container = document.createElement('div');\n dom.addClass(this.container, this.options.fillClass);\n\n directionClass = this.vertical ? this.options.fillClass + '__vertical' : this.options.fillClass + '__horizontal';\n dom.addClass(this.container, directionClass);\n\n this.handle = document.createElement('div');\n dom.addClass(this.handle, this.options.handleClass);\n\n directionClass = this.vertical ?\n this.options.handleClass + '__vertical' :\n this.options.handleClass + '__horizontal';\n dom.addClass(this.handle, directionClass);\n\n this.range = document.createElement('div');\n dom.addClass(this.range, this.options.rangeClass);\n this.range.id = this.identifier;\n this.range.appendChild(this.handle);\n this.range.appendChild(this.container);\n\n directionClass = this.vertical ? this.options.rangeClass + '__vertical' : this.options.rangeClass + '__horizontal';\n dom.addClass(this.range, directionClass);\n\n if (this.options.bufferClass) {\n this.buffer = document.createElement('div');\n dom.addClass(this.buffer, this.options.bufferClass);\n this.range.appendChild(this.buffer);\n\n directionClass = this.vertical ?\n this.options.bufferClass + '__vertical' :\n this.options.bufferClass + '__horizontal';\n dom.addClass(this.buffer, directionClass);\n }\n\n if (func.isNumberLike(this.options.value)) {\n this._setValue(this.options.value, true);\n this.element.value = this.options.value;\n }\n\n if (func.isNumberLike(this.options.buffer)) {\n this.element.setAttribute('data-buffer', this.options.buffer);\n }\n\n if (func.isNumberLike(this.options.min) || minSetByDefault) {\n this.element.setAttribute('min', '' + this.min);\n }\n\n if (func.isNumberLike(this.options.max) || maxSetByDefault) {\n this.element.setAttribute('max', '' + this.max);\n }\n\n if (func.isNumberLike(this.options.step) || stepSetByDefault) {\n this.element.setAttribute('step', '' + this.step);\n }\n\n dom.insertAfter(this.element, this.range);\n\n // visually hide the input\n dom.setCss(this.element, {\n 'position': 'absolute',\n 'width': '1px',\n 'height': '1px',\n 'overflow': 'hidden',\n 'opacity': '0'\n });\n\n // Store context\n this._handleDown = this._handleDown.bind(this);\n this._handleMove = this._handleMove.bind(this);\n this._handleEnd = this._handleEnd.bind(this);\n this._startEventListener = this._startEventListener.bind(this);\n this._changeEventListener = this._changeEventListener.bind(this);\n this._handleResize = this._handleResize.bind(this);\n\n this._init();\n\n // Attach Events\n window.addEventListener('resize', this._handleResize, false);\n\n dom.addEventListeners(document, this.options.startEvent, this._startEventListener);\n\n // Listen to programmatic value changes\n this.element.addEventListener('change', this._changeEventListener, false);\n }\n\n /* public methods */\n\n /**\n *\n * @param {Object} obj like {min : Number, max : Number, value : Number, step : Number, buffer : [String|Number]}\n * @param {Boolean} triggerEvents\n * @returns {RangeSlider}\n */\n update(obj, triggerEvents) {\n if (triggerEvents) {\n this.needTriggerEvents = true;\n }\n if (func.isObject(obj)) {\n if (func.isNumberLike(obj.min)) {\n this.element.setAttribute('min', '' + obj.min);\n this.min = obj.min;\n }\n\n if (func.isNumberLike(obj.max)) {\n this.element.setAttribute('max', '' + obj.max);\n this.max = obj.max;\n }\n\n if (func.isNumberLike(obj.step)) {\n this.element.setAttribute('step', '' + obj.step);\n this.step = obj.step;\n this.toFixed = this._toFixed(obj.step);\n }\n\n if (func.isNumberLike(obj.buffer)) {\n this._setBufferPosition(obj.buffer);\n }\n\n if (func.isNumberLike(obj.value)) {\n this._setValue(obj.value);\n }\n }\n this._update();\n this.onSlideEventsCount = 0;\n this.needTriggerEvents = false;\n return this;\n };\n\n destroy() {\n dom.removeAllListenersFromEl(this, document);\n window.removeEventListener('resize', this._handleResize, false);\n this.element.removeEventListener('change', this._changeEventListener, false);\n\n this.element.style.cssText = '';\n delete this.element[pluginName];\n\n // Remove the generated markup\n if (this.range) {\n this.range.parentNode.removeChild(this.range);\n }\n }\n\n /**\n * A lightweight plugin wrapper around the constructor,preventing against multiple instantiations\n * @param {Element} el\n * @param {Object} options\n */\n static create(el, options) {\n const createInstance = (el) => {\n let data = el[pluginName];\n\n // Create a new instance.\n if (!data) {\n data = new RangeSlider(el, options);\n el[pluginName] = data;\n }\n };\n\n if (el.length) {\n Array.prototype.slice.call(el).forEach(function (el) {\n createInstance(el);\n });\n } else {\n createInstance(el);\n }\n }\n\n /* priate methods */\n\n _toFixed(step) {\n return (step + '').replace('.', '').length - 1;\n }\n\n _init() {\n if (this.onInit && typeof this.onInit === 'function') {\n this.onInit();\n }\n this._update();\n }\n\n _updatePercentFromValue() {\n this.percent = (this.value - this.min) / (this.max - this.min);\n }\n\n /**\n * This method check if this.identifier exists in ev.target's ancestors\n * @param ev\n * @param data\n */\n _startEventListener(ev, data) {\n const el = ev.target;\n let isEventOnSlider = false;\n\n if (ev.which !== 1) {\n return;\n }\n\n dom.forEachAncestors(el, el =>\n (isEventOnSlider = el.id === this.identifier && !dom.hasClass(el, this.options.disabledClass)),\n true);\n\n if (isEventOnSlider) {\n this._handleDown(ev, data);\n }\n }\n\n _changeEventListener(ev, data) {\n if (data && data.origin === this.identifier) {\n return;\n }\n\n const value = ev.target.value;\n const pos = this._getPositionFromValue(value);\n\n this._setPosition(pos);\n }\n\n _update() {\n const sizeProperty = this.vertical ? 'offsetHeight' : 'offsetWidth';\n\n this.handleSize = dom.getDimension(this.handle, sizeProperty);\n this.rangeSize = dom.getDimension(this.range, sizeProperty);\n this.maxHandleX = this.rangeSize - this.handleSize;\n this.grabX = this.handleSize / 2;\n this.position = this._getPositionFromValue(this.value);\n\n // Consider disabled state\n if (this.element.disabled) {\n dom.addClass(this.range, this.options.disabledClass);\n } else {\n dom.removeClass(this.range, this.options.disabledClass);\n }\n\n this._setPosition(this.position);\n if (this.options.bufferClass && this.options.buffer) {\n this._setBufferPosition(this.options.buffer);\n }\n this._updatePercentFromValue();\n dom.triggerEvent(this.element, 'change', {origin: this.identifier});\n }\n\n _handleResize() {\n return func.debounce(() => {\n // Simulate resizeEnd event.\n func.delay(() => {\n this._update();\n }, HANDLE_RESIZE_DELAY);\n }, HANDLE_RESIZE_DEBOUNCE)();\n }\n\n _handleDown(e) {\n this.isInteractsNow = true;\n dom.addEventListeners(document, this.options.moveEvent, this._handleMove);\n dom.addEventListeners(document, this.options.endEvent, this._handleEnd);\n\n // If we click on the handle don't set the new position\n if ((' ' + e.target.className + ' ').replace(newLineAndTabRegexp, ' ').indexOf(this.options.handleClass) > -1) {\n return;\n }\n\n const boundingClientRect = this.range.getBoundingClientRect();\n\n const posX = this._getRelativePosition(e);\n const rangeX = this.vertical ? boundingClientRect.bottom : boundingClientRect.left;\n const handleX = this._getPositionFromNode(this.handle) - rangeX;\n const position = posX - this.grabX;\n\n this._setPosition(position);\n\n if (posX >= handleX && posX < handleX + this.handleWidth) {\n this.grabX = posX - handleX;\n }\n this._updatePercentFromValue();\n }\n\n _handleMove(e) {\n const posX = this._getRelativePosition(e);\n\n this.isInteractsNow = true;\n this._setPosition(posX - this.grabX);\n }\n\n _handleEnd(e) {\n dom.removeEventListeners(document, this.options.moveEvent, this._handleMove);\n dom.removeEventListeners(document, this.options.endEvent, this._handleEnd);\n\n // Ok we're done fire the change event\n dom.triggerEvent(this.element, 'change', {origin: this.identifier});\n\n if (this.isInteractsNow || this.needTriggerEvents) {\n if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {\n this.onSlideEnd(this.value, this.percent, this.position);\n }\n }\n this.onSlideEventsCount = 0;\n this.isInteractsNow = false;\n }\n\n _cap(pos, min, max) {\n if (pos < min) {\n return min;\n }\n if (pos > max) {\n return max;\n }\n return pos;\n }\n\n _setPosition(pos) {\n let position;\n let stickRadius;\n let restFromValue;\n let stickTo;\n\n // Snapping steps\n let value = this._getValueFromPosition(this._cap(pos, 0, this.maxHandleX));\n\n // Stick to stick[0] in radius stick[1]\n if (this.stick) {\n stickTo = this.stick[0];\n stickRadius = this.stick[1] || 0.1;\n restFromValue = value % stickTo;\n if (restFromValue < stickRadius) {\n value = value - restFromValue;\n } else if (Math.abs(stickTo - restFromValue) < stickRadius) {\n value = value - restFromValue + stickTo;\n }\n }\n position = this._getPositionFromValue(value);\n\n // Update ui\n if (this.vertical) {\n this.container.style.height = (position + this.grabX) + 'px';\n this.handle.style.transform = 'translateY(-' + position + 'px)';\n this.handle.style['-ms-transform'] = 'translateY(-' + position + 'px)';\n } else {\n this.container.style.width = (position + this.grabX) + 'px';\n this.handle.style.transform = 'translateX(' + position + 'px)';\n this.handle.style['-ms-transform'] = 'translateX(' + position + 'px)';\n }\n\n this._setValue(value);\n\n // Update globals\n this.position = position;\n this.value = value;\n this._updatePercentFromValue();\n\n if (this.isInteractsNow || this.needTriggerEvents) {\n if (this.onSlideStart && typeof this.onSlideStart === 'function' && this.onSlideEventsCount === 0) {\n this.onSlideStart(this.value, this.percent, this.position);\n }\n\n if (this.onSlide && typeof this.onSlide === 'function') {\n this.onSlide(this.value, this.percent, this.position);\n }\n }\n\n this.onSlideEventsCount++;\n }\n\n _setBufferPosition(pos) {\n let isPercent = true;\n\n if (isFinite(pos)) {\n pos = parseFloat(pos);\n } else if (func.isString(pos)) {\n if (pos.indexOf('px') > 0) {\n isPercent = false;\n }\n pos = parseFloat(pos);\n } else {\n console.warn('New position must be XXpx or XX%');\n return;\n }\n\n if (isNaN(pos)) {\n console.warn('New position is NaN');\n return;\n }\n if (!this.options.bufferClass) {\n console.warn('You disabled buffer, it\\'s className is empty');\n return;\n }\n let bufferSize = isPercent ? pos : (pos / this.rangeSize * 100);\n\n if (bufferSize < 0) {\n bufferSize = 0;\n }\n if (bufferSize > 100) {\n bufferSize = 100;\n }\n this.options.buffer = bufferSize;\n\n let paddingSize = this.options.borderRadius / this.rangeSize * 100;\n let bufferSizeWithPadding = bufferSize - paddingSize;\n\n if (bufferSizeWithPadding < 0) {\n bufferSizeWithPadding = 0;\n }\n\n if (this.vertical) {\n this.buffer.style.height = bufferSizeWithPadding + '%';\n this.buffer.style.bottom = paddingSize * 0.5 + '%';\n } else {\n this.buffer.style.width = bufferSizeWithPadding + '%';\n this.buffer.style.left = paddingSize * 0.5 + '%';\n }\n\n this.element.setAttribute('data-buffer', bufferSize);\n }\n\n /**\n *\n * @param {Element} node\n * @returns {*} Returns element position relative to the parent\n * @private\n */\n _getPositionFromNode(node) {\n let i = this.vertical ? this.maxHandleX : 0;\n\n while (node !== null) {\n i += this.vertical ? node.offsetTop : node.offsetLeft;\n node = node.offsetParent;\n }\n return i;\n }\n\n /**\n *\n * @param {(MouseEvent|TouchEvent)}e\n * @returns {number}\n */\n _getRelativePosition(e) {\n const boundingClientRect = this.range.getBoundingClientRect();\n\n // Get the offset relative to the viewport\n const rangeSize = this.vertical ? boundingClientRect.bottom : boundingClientRect.left;\n let pageOffset = 0;\n\n const pagePositionProperty = this.vertical ? 'pageY' : 'pageX';\n\n if (typeof e[pagePositionProperty] !== 'undefined') {\n pageOffset = (e.touches && e.touches.length) ? e.touches[0][pagePositionProperty] : e[pagePositionProperty];\n } else if (typeof e.originalEvent !== 'undefined') {\n if (typeof e.originalEvent[pagePositionProperty] !== 'undefined') {\n pageOffset = e.originalEvent[pagePositionProperty];\n } else if (e.originalEvent.touches && e.originalEvent.touches[0] &&\n typeof e.originalEvent.touches[0][pagePositionProperty] !== 'undefined') {\n pageOffset = e.originalEvent.touches[0][pagePositionProperty];\n }\n } else if (e.touches && e.touches[0] && typeof e.touches[0][pagePositionProperty] !== 'undefined') {\n pageOffset = e.touches[0][pagePositionProperty];\n } else if (e.currentPoint && (typeof e.currentPoint.x !== 'undefined' || typeof e.currentPoint.y !== 'undefined')) {\n pageOffset = this.vertical ? e.currentPoint.y : e.currentPoint.x;\n }\n\n if (this.vertical) {\n pageOffset -= window.pageYOffset;\n }\n\n return this.vertical ? rangeSize - pageOffset : pageOffset - rangeSize;\n }\n\n _getPositionFromValue(value) {\n const percentage = (value - this.min) / (this.max - this.min);\n const pos = percentage * this.maxHandleX;\n\n return isNaN(pos) ? 0 : pos;\n }\n\n _getValueFromPosition(pos) {\n const percentage = ((pos) / (this.maxHandleX || 1));\n const value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min;\n\n return Number((value).toFixed(this.toFixed));\n }\n\n _setValue(value, force) {\n if (value === this.value && !force) {\n return;\n }\n\n // Set the new value and fire the `input` event\n this.element.value = value;\n this.value = value;\n dom.triggerEvent(this.element, 'input', {origin: this.identifier});\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/range-slider.js","import * as func from './functions';\n\nconst EVENT_LISTENER_LIST = 'eventListenerList';\n\nexport const detectIE = () => {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf('MSIE ');\n\n if (msie > 0) {\n return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);\n }\n\n const trident = ua.indexOf('Trident/');\n\n if (trident > 0) {\n const rv = ua.indexOf('rv:');\n\n return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);\n }\n\n const edge = ua.indexOf('Edge/');\n\n if (edge > 0) {\n return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);\n }\n\n return false;\n};\n\nconst ieVersion = detectIE();\nconst eventCaptureParams = window.PointerEvent && !ieVersion ? {passive: false} : false;\n\n/**\n * Check if a `element` is visible in the DOM\n *\n * @param {Element} element\n * @return {Boolean}\n */\nexport const isHidden = (element) => (\n element.offsetWidth === 0 || element.offsetHeight === 0 || element.open === false\n);\n\n/**\n * Get hidden parentNodes of an `element`\n *\n * @param {Element} element\n * @return {[type]}\n */\nexport const getHiddenParentNodes = (element) => {\n const parents = [];\n let node = element.parentNode;\n\n while (isHidden(node)) {\n parents.push(node);\n node = node.parentNode;\n }\n return parents;\n};\n\n/**\n * Returns dimensions for an element even if it is not visible in the DOM.\n *\n * @param {Element} element\n * @param {string} key (e.g. offsetWidth …)\n * @return {Number}\n */\nexport const getDimension = (element, key) => {\n const hiddenParentNodes = getHiddenParentNodes(element);\n const hiddenParentNodesLength = hiddenParentNodes.length;\n const displayProperty = [];\n let dimension = element[key];\n\n // Used for native `
` elements\n const toggleOpenProperty = (element) => {\n if (typeof element.open !== 'undefined') {\n element.open = !element.open;\n }\n };\n\n if (hiddenParentNodesLength) {\n for (let i = 0; i < hiddenParentNodesLength; i++) {\n // Cache the display property to restore it later.\n displayProperty[i] = hiddenParentNodes[i].style.display;\n\n hiddenParentNodes[i].style.display = 'block';\n hiddenParentNodes[i].style.height = '0';\n hiddenParentNodes[i].style.overflow = 'hidden';\n hiddenParentNodes[i].style.visibility = 'hidden';\n toggleOpenProperty(hiddenParentNodes[i]);\n }\n\n dimension = element[key];\n\n for (let j = 0; j < hiddenParentNodesLength; j++) {\n toggleOpenProperty(hiddenParentNodes[j]);\n hiddenParentNodes[j].style.display = displayProperty[j];\n hiddenParentNodes[j].style.height = '';\n hiddenParentNodes[j].style.overflow = '';\n hiddenParentNodes[j].style.visibility = '';\n }\n }\n return dimension;\n};\n\n/**\n *\n * @param {HTMLElement} el\n * @param {Object} cssObj\n * @returns {*}\n */\nexport const setCss = (el, cssObj) => {\n for (const key in cssObj) {\n el.style[key] = cssObj[key];\n }\n return el.style;\n};\n\n/**\n *\n * @param {HTMLElement} elem\n * @param {string} className\n */\nexport const hasClass = (elem, className) => new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');\n\n/**\n *\n * @param {HTMLElement} elem\n * @param {string} className\n */\nexport const addClass = (elem, className) => {\n if (!hasClass(elem, className)) {\n elem.className += ' ' + className;\n }\n};\n\n/**\n *\n * @param {HTMLElement} elem\n * @param {string} className\n */\nexport const removeClass = (elem, className) => {\n let newClass = ' ' + elem.className.replace(/[\\t\\r\\n]/g, ' ') + ' ';\n\n if (hasClass(elem, className)) {\n while (newClass.indexOf(' ' + className + ' ') >= 0) {\n newClass = newClass.replace(' ' + className + ' ', ' ');\n }\n elem.className = newClass.replace(/^\\s+|\\s+$/g, '');\n }\n};\n\n/**\n *\n * @param {HTMLElement} el\n * @callback callback\n * @param {boolean} andForElement - apply callback for el\n * @returns {HTMLElement}\n */\nexport const forEachAncestors = (el, callback, andForElement) => {\n if (andForElement) {\n callback(el);\n }\n\n while (el.parentNode && !callback(el)) {\n el = el.parentNode;\n }\n\n return el;\n};\n\n/**\n *\n * @param {HTMLElement} el\n * @param {string} name event name\n * @param {Object} data\n */\nexport const triggerEvent = (el, name, data) => {\n if (!func.isString(name)) {\n throw new TypeError('event name must be String');\n }\n if (!(el instanceof HTMLElement)) {\n throw new TypeError('element must be HTMLElement');\n }\n name = name.trim();\n const event = document.createEvent('CustomEvent');\n\n event.initCustomEvent(name, false, false, data);\n el.dispatchEvent(event);\n};\n\n/**\n * @param {Object} referenceNode after this\n * @param {Object} newNode insert this\n */\nexport const insertAfter = (referenceNode, newNode) =>\n referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);\n\n/**\n * Add event listeners and push them to el[EVENT_LISTENER_LIST]\n * @param {HTMLElement} el DOM element\n * @param {Array} events\n * @callback listener\n */\nexport const addEventListeners = (el, events, listener) => {\n events.forEach((eventName) => {\n if (!el[EVENT_LISTENER_LIST]) {\n el[EVENT_LISTENER_LIST] = {};\n }\n if (!el[EVENT_LISTENER_LIST][eventName]) {\n el[EVENT_LISTENER_LIST][eventName] = [];\n }\n\n el.addEventListener(\n eventName,\n listener,\n eventCaptureParams\n );\n if (el[EVENT_LISTENER_LIST][eventName].indexOf(listener) < 0) {\n el[EVENT_LISTENER_LIST][eventName].push(listener);\n }\n });\n};\n\n/**\n * Remove event listeners and remove them from el[EVENT_LISTENER_LIST]\n * @param {HTMLElement} el DOM element\n * @param {Array} events\n * @callback listener\n */\nexport const removeEventListeners = (el, events, listener) => {\n events.forEach((eventName) => {\n let index;\n\n el.removeEventListener(\n eventName,\n listener,\n false\n );\n\n if (el[EVENT_LISTENER_LIST] && el[EVENT_LISTENER_LIST][eventName] &&\n (index = el[EVENT_LISTENER_LIST][eventName].indexOf(listener)) > -1\n ) {\n el[EVENT_LISTENER_LIST][eventName].splice(index, 1);\n }\n });\n};\n\n/**\n * Remove ALL event listeners which exists in el[EVENT_LISTENER_LIST]\n * @param {HTMLElement} el DOM element\n */\nexport const removeAllListenersFromEl = (instance, el) => {\n if (!el[EVENT_LISTENER_LIST]) {\n return;\n }\n /* jshint ignore:start */\n\n /**\n *\n * @callback listener\n * @this {Object} event name\n */\n function rm(listener) {\n if (listener === instance._startEventListener) {\n this.el.removeEventListener(this.eventName, listener, false);\n }\n }\n\n for (const eventName in el[EVENT_LISTENER_LIST]) {\n el[EVENT_LISTENER_LIST][eventName].forEach(rm, {eventName: eventName, el: el});\n }\n\n el[EVENT_LISTENER_LIST] = {};\n /* jshint ignore:end */\n};\n\n/**\n * Range feature detection\n * @return {Boolean}\n */\nexport const supportsRange = () => {\n const input = document.createElement('input');\n\n input.setAttribute('type', 'range');\n return input.type !== 'text';\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/dom.js","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/range-slider.css\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/range-slider.min.js b/dist/range-slider.min.js index 364279d..fac2b76 100644 --- a/dist/range-slider.min.js +++ b/dist/range-slider.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("rangeSlider",[],t):"object"==typeof exports?exports.rangeSlider=t():e.rangeSlider=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=(t.delay=function(e,t){for(var i=arguments.length,n=Array(i>2?i-2:0),s=2;s=0;)i=i.replace(" "+t+" "," ");e.className=i.replace(/^\s+|\s+$/g,"")}},t.forEachAncestors=function(e,t,i){for(i&&t(e);e.parentNode&&!t(e);)e=e.parentNode;return e},t.triggerEvent=function(e,t,i){if(!s.isString(t))throw new TypeError("event name must be String");if(!(e instanceof HTMLElement))throw new TypeError("element must be HTMLElement");t=t.trim();var n=document.createEvent("CustomEvent");n.initCustomEvent(t,!1,!1,i),e.dispatchEvent(n)},t.insertAfter=function(e,t){return e.parentNode.insertBefore(t,e.nextSibling)},t.addEventListeners=function(e,t,i){t.forEach(function(t){e.eventListenerList||(e.eventListenerList={}),e.eventListenerList[t]||(e.eventListenerList[t]=[]),e.addEventListener(t,i,!!window.PointerEvent&&{passive:!1}),e.eventListenerList[t].indexOf(i)<0&&e.eventListenerList[t].push(i)})},t.removeEventListeners=function(e,t,i){t.forEach(function(t){var n=void 0;e.removeEventListener(t,i,!1),e.eventListenerList&&e.eventListenerList[t]&&(n=e.eventListenerList[t].indexOf(i))>-1&&e.eventListenerList[t].splice(n,1)})},t.removeAllListenersFromEl=function(e,t){function i(t){t===e._startEventListener&&this.el.removeEventListener(this.eventName,t,!1)}if(t.eventListenerList){for(var n in t.eventListenerList)t.eventListenerList[n].forEach(i,{eventName:n,el:t});t.eventListenerList={}}},t.supportsRange=function(){var e=document.createElement("input");return e.setAttribute("type","range"),"text"!==e.type}},function(e,t){},function(e,t,i){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i=1?this.stick=this.options.stick:(l=this.element.getAttribute("stick"))&&(u=l.split(" "),u.length>=1&&(this.stick=u.map(parseFloat))),this.stick&&1===this.stick.length&&this.stick.push(1.5*this.step),this._updatePercentFromValue(),this.toFixed=this._toFixed(this.step);var m=void 0;this.fill=document.createElement("div"),a.addClass(this.fill,this.options.fillClass),m=this.vertical?this.options.fillClass+"__vertical":this.options.fillClass+"__horizontal",a.addClass(this.fill,m),this.handle=document.createElement("div"),a.addClass(this.handle,this.options.handleClass),m=this.vertical?this.options.handleClass+"__vertical":this.options.handleClass+"__horizontal",a.addClass(this.handle,m),this.range=document.createElement("div"),a.addClass(this.range,this.options.rangeClass),this.range.id=this.identifier,this.range.appendChild(this.handle),this.range.appendChild(this.fill),m=this.vertical?this.options.rangeClass+"__vertical":this.options.rangeClass+"__horizontal",a.addClass(this.range,m),this.options.bufferClass&&(this.buffer=document.createElement("div"),a.addClass(this.buffer,this.options.bufferClass),this.range.appendChild(this.buffer),m=this.vertical?this.options.bufferClass+"__vertical":this.options.bufferClass+"__horizontal",a.addClass(this.buffer,m)),h.isNumberLike(this.options.value)&&(this._setValue(this.options.value,!0),this.element.value=this.options.value),h.isNumberLike(this.options.buffer)&&this.element.setAttribute("data-buffer",this.options.buffer),(h.isNumberLike(this.options.min)||n)&&this.element.setAttribute("min",""+this.min),(h.isNumberLike(this.options.max)||r)&&this.element.setAttribute("max",""+this.max),(h.isNumberLike(this.options.step)||o)&&this.element.setAttribute("step",""+this.step),a.insertAfter(this.element,this.range),a.setCss(this.element,{position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this._handleDown=this._handleDown.bind(this),this._handleMove=this._handleMove.bind(this),this._handleEnd=this._handleEnd.bind(this),this._startEventListener=this._startEventListener.bind(this),this._changeEventListener=this._changeEventListener.bind(this),this._handleResize=this._handleResize.bind(this),this._init(),window.addEventListener("resize",this._handleResize,!1),a.addEventListeners(document,this.options.startEvent,this._startEventListener),this.element.addEventListener("change",this._changeEventListener,!1)}}return r(e,[{key:"update",value:function(e,t){return t&&(this.needTriggerEvents=!0),h.isObject(e)&&(h.isNumberLike(e.min)&&(this.element.setAttribute("min",""+e.min),this.min=e.min),h.isNumberLike(e.max)&&(this.element.setAttribute("max",""+e.max),this.max=e.max),h.isNumberLike(e.step)&&(this.element.setAttribute("step",""+e.step),this.step=e.step,this.toFixed=this._toFixed(e.step)),h.isNumberLike(e.buffer)&&this._setBufferPosition(e.buffer),h.isNumberLike(e.value)&&this._setValue(e.value)),this._update(),this.onSlideEventsCount=0,this.needTriggerEvents=!1,this}},{key:"destroy",value:function(){a.removeAllListenersFromEl(this,document),window.removeEventListener("resize",this._handleResize,!1),this.element.removeEventListener("change",this._changeEventListener,!1),this.element.style.cssText="",delete this.element[f],this.range&&this.range.parentNode.removeChild(this.range)}},{key:"_toFixed",value:function(e){return(e+"").replace(".","").length-1}},{key:"_init",value:function(){this.onInit&&"function"==typeof this.onInit&&this.onInit(),this._update()}},{key:"_updatePercentFromValue",value:function(){this.percent=(this.value-this.min)/(this.max-this.min)}},{key:"_startEventListener",value:function(e,t){var i=this,n=e.target,s=!1;a.forEachAncestors(n,function(e){return s=e.id===i.identifier&&!a.hasClass(e,i.options.disabledClass)},!0),s&&this._handleDown(e,t)}},{key:"_changeEventListener",value:function(e,t){if(!t||t.origin!==this.identifier){var i=e.target.value,n=this._getPositionFromValue(i);this._setPosition(n)}}},{key:"_update",value:function(){var e=this.vertical?"offsetHeight":"offsetWidth";this.handleSize=a.getDimension(this.handle,e),this.rangeSize=a.getDimension(this.range,e),this.maxHandleX=this.rangeSize-this.handleSize,this.grabX=this.handleSize/2,this.position=this._getPositionFromValue(this.value),this.element.disabled?a.addClass(this.range,this.options.disabledClass):a.removeClass(this.range,this.options.disabledClass),this._setPosition(this.position),this.options.bufferClass&&this.options.buffer&&this._setBufferPosition(this.options.buffer),this._updatePercentFromValue(),a.triggerEvent(this.element,"change",{origin:this.identifier})}},{key:"_handleResize",value:function(){var e=this;return h.debounce(function(){h.delay(function(){e._update()},300)},50)()}},{key:"_handleDown",value:function(e){if(this.isInteractsNow=!0,e.preventDefault(),a.addEventListeners(document,this.options.moveEvent,this._handleMove),a.addEventListeners(document,this.options.endEvent,this._handleEnd),!((" "+e.target.className+" ").replace(u," ").indexOf(this.options.handleClass)>-1)){var t=this.range.getBoundingClientRect(),i=this._getRelativePosition(e),n=this.vertical?t.bottom:t.left,s=this._getPositionFromNode(this.handle)-n,r=i-this.grabX;this._setPosition(r),i>=s&&ii?i:e}},{key:"_setPosition",value:function(e){var t=void 0,i=void 0,n=void 0,s=void 0,r=this._getValueFromPosition(this._cap(e,0,this.maxHandleX));this.stick&&(s=this.stick[0],i=this.stick[1]||.1,n=r%s,n0&&(t=!1),e=parseFloat(e)}if(isNaN(e))return void console.warn("New position is NaN");if(!this.options.bufferClass)return void console.warn("You disabled buffer, it's className is empty");var i=t?e:e/this.rangeSize*100;i<0&&(i=0),i>100&&(i=100),this.options.buffer=i;var n=this.options.borderRadius/this.rangeSize*100,s=i-n;s<0&&(s=0),this.vertical?(this.buffer.style.height=s+"%",this.buffer.style.bottom=.5*n+"%"):(this.buffer.style.width=s+"%",this.buffer.style.left=.5*n+"%"),this.element.setAttribute("data-buffer",i)}},{key:"_getPositionFromNode",value:function(e){for(var t=this.vertical?this.maxHandleX:0;null!==e;)t+=this.vertical?e.offsetTop:e.offsetLeft,e=e.offsetParent;return t}},{key:"_getRelativePosition",value:function(e){var t=this.range.getBoundingClientRect(),i=this.vertical?t.bottom:t.left,n=0,s=this.vertical?"pageY":"pageX";return void 0!==e[s]?n=e.touches&&e.touches.length?e.touches[0][s]:e[s]:void 0!==e.originalEvent?void 0!==e.originalEvent[s]?n=e.originalEvent[s]:e.originalEvent.touches&&e.originalEvent.touches[0]&&void 0!==e.originalEvent.touches[0][s]&&(n=e.originalEvent.touches[0][s]):e.touches&&e.touches[0]&&void 0!==e.touches[0][s]?n=e.touches[0][s]:!e.currentPoint||void 0===e.currentPoint.x&&void 0===e.currentPoint.y||(n=this.vertical?e.currentPoint.y:e.currentPoint.x),this.vertical&&(n-=window.pageYOffset),this.vertical?i-n:n-i}},{key:"_getPositionFromValue",value:function(e){var t=(e-this.min)/(this.max-this.min),i=t*this.maxHandleX;return isNaN(i)?0:i}},{key:"_getValueFromPosition",value:function(e){var t=e/(this.maxHandleX||1),i=this.step*Math.round(t*(this.max-this.min)/this.step)+this.min;return Number(i.toFixed(this.toFixed))}},{key:"_setValue",value:function(e,t){(e!==this.value||t)&&(this.element.value=e,this.value=e,a.triggerEvent(this.element,"input",{origin:this.identifier}))}}],[{key:"create",value:function(t,i){var n=function(t){var n=t[f];n||(n=new e(t,i),t[f]=n)};t.length?Array.prototype.slice.call(t).forEach(function(e){n(e)}):n(t)}}]),e}();t.default=m,e.exports=t.default}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("rangeSlider",[],t):"object"==typeof exports?exports.rangeSlider=t():e.rangeSlider=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=(t.delay=function(e,t){for(var i=arguments.length,n=Array(i>2?i-2:0),s=2;s=1?this.stick=this.options.stick:(l=this.element.getAttribute("stick"))&&(u=l.split(" "),u.length>=1&&(this.stick=u.map(parseFloat))),this.stick&&1===this.stick.length&&this.stick.push(1.5*this.step),this._updatePercentFromValue(),this.toFixed=this._toFixed(this.step);var m=void 0;this.container=document.createElement("div"),a.addClass(this.container,this.options.fillClass),m=this.vertical?this.options.fillClass+"__vertical":this.options.fillClass+"__horizontal",a.addClass(this.container,m),this.handle=document.createElement("div"),a.addClass(this.handle,this.options.handleClass),m=this.vertical?this.options.handleClass+"__vertical":this.options.handleClass+"__horizontal",a.addClass(this.handle,m),this.range=document.createElement("div"),a.addClass(this.range,this.options.rangeClass),this.range.id=this.identifier,this.range.appendChild(this.handle),this.range.appendChild(this.container),m=this.vertical?this.options.rangeClass+"__vertical":this.options.rangeClass+"__horizontal",a.addClass(this.range,m),this.options.bufferClass&&(this.buffer=document.createElement("div"),a.addClass(this.buffer,this.options.bufferClass),this.range.appendChild(this.buffer),m=this.vertical?this.options.bufferClass+"__vertical":this.options.bufferClass+"__horizontal",a.addClass(this.buffer,m)),h.isNumberLike(this.options.value)&&(this._setValue(this.options.value,!0),this.element.value=this.options.value),h.isNumberLike(this.options.buffer)&&this.element.setAttribute("data-buffer",this.options.buffer),(h.isNumberLike(this.options.min)||n)&&this.element.setAttribute("min",""+this.min),(h.isNumberLike(this.options.max)||r)&&this.element.setAttribute("max",""+this.max),(h.isNumberLike(this.options.step)||o)&&this.element.setAttribute("step",""+this.step),a.insertAfter(this.element,this.range),a.setCss(this.element,{position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this._handleDown=this._handleDown.bind(this),this._handleMove=this._handleMove.bind(this),this._handleEnd=this._handleEnd.bind(this),this._startEventListener=this._startEventListener.bind(this),this._changeEventListener=this._changeEventListener.bind(this),this._handleResize=this._handleResize.bind(this),this._init(),window.addEventListener("resize",this._handleResize,!1),a.addEventListeners(document,this.options.startEvent,this._startEventListener),this.element.addEventListener("change",this._changeEventListener,!1)}}return r(e,[{key:"update",value:function(e,t){return t&&(this.needTriggerEvents=!0),h.isObject(e)&&(h.isNumberLike(e.min)&&(this.element.setAttribute("min",""+e.min),this.min=e.min),h.isNumberLike(e.max)&&(this.element.setAttribute("max",""+e.max),this.max=e.max),h.isNumberLike(e.step)&&(this.element.setAttribute("step",""+e.step),this.step=e.step,this.toFixed=this._toFixed(e.step)),h.isNumberLike(e.buffer)&&this._setBufferPosition(e.buffer),h.isNumberLike(e.value)&&this._setValue(e.value)),this._update(),this.onSlideEventsCount=0,this.needTriggerEvents=!1,this}},{key:"destroy",value:function(){a.removeAllListenersFromEl(this,document),window.removeEventListener("resize",this._handleResize,!1),this.element.removeEventListener("change",this._changeEventListener,!1),this.element.style.cssText="",delete this.element[f],this.range&&this.range.parentNode.removeChild(this.range)}},{key:"_toFixed",value:function(e){return(e+"").replace(".","").length-1}},{key:"_init",value:function(){this.onInit&&"function"==typeof this.onInit&&this.onInit(),this._update()}},{key:"_updatePercentFromValue",value:function(){this.percent=(this.value-this.min)/(this.max-this.min)}},{key:"_startEventListener",value:function(e,t){var i=this,n=e.target,s=!1;1===e.which&&(a.forEachAncestors(n,function(e){return s=e.id===i.identifier&&!a.hasClass(e,i.options.disabledClass)},!0),s&&this._handleDown(e,t))}},{key:"_changeEventListener",value:function(e,t){if(!t||t.origin!==this.identifier){var i=e.target.value,n=this._getPositionFromValue(i);this._setPosition(n)}}},{key:"_update",value:function(){var e=this.vertical?"offsetHeight":"offsetWidth";this.handleSize=a.getDimension(this.handle,e),this.rangeSize=a.getDimension(this.range,e),this.maxHandleX=this.rangeSize-this.handleSize,this.grabX=this.handleSize/2,this.position=this._getPositionFromValue(this.value),this.element.disabled?a.addClass(this.range,this.options.disabledClass):a.removeClass(this.range,this.options.disabledClass),this._setPosition(this.position),this.options.bufferClass&&this.options.buffer&&this._setBufferPosition(this.options.buffer),this._updatePercentFromValue(),a.triggerEvent(this.element,"change",{origin:this.identifier})}},{key:"_handleResize",value:function(){var e=this;return h.debounce(function(){h.delay(function(){e._update()},300)},50)()}},{key:"_handleDown",value:function(e){if(this.isInteractsNow=!0,a.addEventListeners(document,this.options.moveEvent,this._handleMove),a.addEventListeners(document,this.options.endEvent,this._handleEnd),!((" "+e.target.className+" ").replace(u," ").indexOf(this.options.handleClass)>-1)){var t=this.range.getBoundingClientRect(),i=this._getRelativePosition(e),n=this.vertical?t.bottom:t.left,s=this._getPositionFromNode(this.handle)-n,r=i-this.grabX;this._setPosition(r),i>=s&&ii?i:e}},{key:"_setPosition",value:function(e){var t=void 0,i=void 0,n=void 0,s=void 0,r=this._getValueFromPosition(this._cap(e,0,this.maxHandleX));this.stick&&(s=this.stick[0],i=this.stick[1]||.1,n=r%s,n0&&(t=!1),e=parseFloat(e)}if(isNaN(e))return void console.warn("New position is NaN");if(!this.options.bufferClass)return void console.warn("You disabled buffer, it's className is empty");var i=t?e:e/this.rangeSize*100;i<0&&(i=0),i>100&&(i=100),this.options.buffer=i;var n=this.options.borderRadius/this.rangeSize*100,s=i-n;s<0&&(s=0),this.vertical?(this.buffer.style.height=s+"%",this.buffer.style.bottom=.5*n+"%"):(this.buffer.style.width=s+"%",this.buffer.style.left=.5*n+"%"),this.element.setAttribute("data-buffer",i)}},{key:"_getPositionFromNode",value:function(e){for(var t=this.vertical?this.maxHandleX:0;null!==e;)t+=this.vertical?e.offsetTop:e.offsetLeft,e=e.offsetParent;return t}},{key:"_getRelativePosition",value:function(e){var t=this.range.getBoundingClientRect(),i=this.vertical?t.bottom:t.left,n=0,s=this.vertical?"pageY":"pageX";return void 0!==e[s]?n=e.touches&&e.touches.length?e.touches[0][s]:e[s]:void 0!==e.originalEvent?void 0!==e.originalEvent[s]?n=e.originalEvent[s]:e.originalEvent.touches&&e.originalEvent.touches[0]&&void 0!==e.originalEvent.touches[0][s]&&(n=e.originalEvent.touches[0][s]):e.touches&&e.touches[0]&&void 0!==e.touches[0][s]?n=e.touches[0][s]:!e.currentPoint||void 0===e.currentPoint.x&&void 0===e.currentPoint.y||(n=this.vertical?e.currentPoint.y:e.currentPoint.x),this.vertical&&(n-=window.pageYOffset),this.vertical?i-n:n-i}},{key:"_getPositionFromValue",value:function(e){var t=(e-this.min)/(this.max-this.min),i=t*this.maxHandleX;return isNaN(i)?0:i}},{key:"_getValueFromPosition",value:function(e){var t=e/(this.maxHandleX||1),i=this.step*Math.round(t*(this.max-this.min)/this.step)+this.min;return Number(i.toFixed(this.toFixed))}},{key:"_setValue",value:function(e,t){(e!==this.value||t)&&(this.element.value=e,this.value=e,a.triggerEvent(this.element,"input",{origin:this.identifier}))}}],[{key:"create",value:function(t,i){var n=function(t){var n=t[f];n||(n=new e(t,i),t[f]=n)};t.length?Array.prototype.slice.call(t).forEach(function(e){n(e)}):n(t)}}]),e}();t.default=m,e.exports=t.default},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsRange=t.removeAllListenersFromEl=t.removeEventListeners=t.addEventListeners=t.insertAfter=t.triggerEvent=t.forEachAncestors=t.removeClass=t.addClass=t.hasClass=t.setCss=t.getDimension=t.getHiddenParentNodes=t.isHidden=t.detectIE=void 0;var n=i(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(n),r=t.detectIE=function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){var i=e.indexOf("rv:");return parseInt(e.substring(i+3,e.indexOf(".",i)),10)}var n=e.indexOf("Edge/");return n>0&&parseInt(e.substring(n+5,e.indexOf(".",n)),10)},o=r(),a=!(!window.PointerEvent||o)&&{passive:!1},l=t.isHidden=function(e){return 0===e.offsetWidth||0===e.offsetHeight||!1===e.open},h=t.getHiddenParentNodes=function(e){for(var t=[],i=e.parentNode;l(i);)t.push(i),i=i.parentNode;return t},u=(t.getDimension=function(e,t){var i=h(e),n=i.length,s=[],r=e[t],o=function(e){void 0!==e.open&&(e.open=!e.open)};if(n){for(var a=0;a=0;)i=i.replace(" "+t+" "," ");e.className=i.replace(/^\s+|\s+$/g,"")}},t.forEachAncestors=function(e,t,i){for(i&&t(e);e.parentNode&&!t(e);)e=e.parentNode;return e},t.triggerEvent=function(e,t,i){if(!s.isString(t))throw new TypeError("event name must be String");if(!(e instanceof HTMLElement))throw new TypeError("element must be HTMLElement");t=t.trim();var n=document.createEvent("CustomEvent");n.initCustomEvent(t,!1,!1,i),e.dispatchEvent(n)},t.insertAfter=function(e,t){return e.parentNode.insertBefore(t,e.nextSibling)},t.addEventListeners=function(e,t,i){t.forEach(function(t){e.eventListenerList||(e.eventListenerList={}),e.eventListenerList[t]||(e.eventListenerList[t]=[]),e.addEventListener(t,i,a),e.eventListenerList[t].indexOf(i)<0&&e.eventListenerList[t].push(i)})},t.removeEventListeners=function(e,t,i){t.forEach(function(t){var n=void 0;e.removeEventListener(t,i,!1),e.eventListenerList&&e.eventListenerList[t]&&(n=e.eventListenerList[t].indexOf(i))>-1&&e.eventListenerList[t].splice(n,1)})},t.removeAllListenersFromEl=function(e,t){function i(t){t===e._startEventListener&&this.el.removeEventListener(this.eventName,t,!1)}if(t.eventListenerList){for(var n in t.eventListenerList)t.eventListenerList[n].forEach(i,{eventName:n,el:t});t.eventListenerList={}}},t.supportsRange=function(){var e=document.createElement("input");return e.setAttribute("type","range"),"text"!==e.type}},function(e,t){}])}); \ No newline at end of file diff --git a/package.json b/package.json index fb20dee..a13d65b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "rangeslider-pure", "title": "range-slider", "description": "Simple, small and fast vanilla JavaScript polyfill for the HTML5 slider element", - "version": "0.4.1", + "version": "0.4.2", "main": "dist/range-slider.js", "scripts": { "dev": "webpack-dev-server --no-inline --watch-content-base", @@ -52,13 +52,13 @@ "css-loader": "^0.28.3", "cssnano": "^3.10.0", "cssnext": "^1.8.4", - "eslint": "^3.19.0", + "eslint": "^4.4.1", "eslint-loader": "^1.7.1", - "extract-text-webpack-plugin": "^2.1.0", + "extract-text-webpack-plugin": "^3.0.0", "html-entities": "^1.2.1", "postcss-loader": "^2.0.5", "style-loader": "^0.18.1", - "webpack": "^2.6.1", + "webpack": "^3.5.5", "webpack-dev-server": "^2.4.5" } } diff --git a/src/range-slider.js b/src/range-slider.js index 8f4d378..8992576 100644 --- a/src/range-slider.js +++ b/src/range-slider.js @@ -66,21 +66,27 @@ export default class RangeSlider { this.options.buffer = this.options.buffer || parseFloat(this.element.getAttribute('data-buffer')); this.identifier = 'js-' + pluginName + '-' + (pluginIdentifier++); + this.min = func.getFirsNumberLike( this.options.min, parseFloat(this.element.getAttribute('min')), (minSetByDefault = 0) ); + this.max = func.getFirsNumberLike( this.options.max, parseFloat(this.element.getAttribute('max')), (maxSetByDefault = MAX_SET_BY_DEFAULT) ); + this.value = func.getFirsNumberLike(this.options.value, this.element.value, parseFloat(this.element.value || this.min + (this.max - this.min) / 2)); + this.step = func.getFirsNumberLike(this.options.step, parseFloat(this.element.getAttribute('step')) || (stepSetByDefault = 1)); + this.percent = null; + if (func.isArray(this.options.stick) && this.options.stick.length >= 1) { this.stick = this.options.stick; } else if ((stickAttribute = this.element.getAttribute('stick'))) { @@ -98,11 +104,11 @@ export default class RangeSlider { let directionClass; - this.fill = document.createElement('div'); - dom.addClass(this.fill, this.options.fillClass); + this.container = document.createElement('div'); + dom.addClass(this.container, this.options.fillClass); directionClass = this.vertical ? this.options.fillClass + '__vertical' : this.options.fillClass + '__horizontal'; - dom.addClass(this.fill, directionClass); + dom.addClass(this.container, directionClass); this.handle = document.createElement('div'); dom.addClass(this.handle, this.options.handleClass); @@ -116,7 +122,7 @@ export default class RangeSlider { dom.addClass(this.range, this.options.rangeClass); this.range.id = this.identifier; this.range.appendChild(this.handle); - this.range.appendChild(this.fill); + this.range.appendChild(this.container); directionClass = this.vertical ? this.options.rangeClass + '__vertical' : this.options.rangeClass + '__horizontal'; dom.addClass(this.range, directionClass); @@ -155,7 +161,7 @@ export default class RangeSlider { dom.insertAfter(this.element, this.range); -// visually hide the input + // visually hide the input dom.setCss(this.element, { 'position': 'absolute', 'width': '1px', @@ -164,7 +170,7 @@ export default class RangeSlider { 'opacity': '0' }); -// Store context + // Store context this._handleDown = this._handleDown.bind(this); this._handleMove = this._handleMove.bind(this); this._handleEnd = this._handleEnd.bind(this); @@ -174,12 +180,12 @@ export default class RangeSlider { this._init(); -// Attach Events + // Attach Events window.addEventListener('resize', this._handleResize, false); dom.addEventListeners(document, this.options.startEvent, this._startEventListener); -// Listen to programmatic value changes + // Listen to programmatic value changes this.element.addEventListener('change', this._changeEventListener, false); } @@ -291,9 +297,13 @@ export default class RangeSlider { const el = ev.target; let isEventOnSlider = false; - dom.forEachAncestors(el, (el) => - (isEventOnSlider = el.id === this.identifier && !dom.hasClass(el, this.options.disabledClass)), - true); + if (ev.which !== 1) { + return; + } + + dom.forEachAncestors(el, el => + (isEventOnSlider = el.id === this.identifier && !dom.hasClass(el, this.options.disabledClass)), + true); if (isEventOnSlider) { this._handleDown(ev, data); @@ -346,7 +356,6 @@ export default class RangeSlider { _handleDown(e) { this.isInteractsNow = true; - e.preventDefault(); dom.addEventListeners(document, this.options.moveEvent, this._handleMove); dom.addEventListeners(document, this.options.endEvent, this._handleEnd); @@ -374,12 +383,10 @@ export default class RangeSlider { const posX = this._getRelativePosition(e); this.isInteractsNow = true; - e.preventDefault(); this._setPosition(posX - this.grabX); } _handleEnd(e) { - e.preventDefault(); dom.removeEventListeners(document, this.options.moveEvent, this._handleMove); dom.removeEventListeners(document, this.options.endEvent, this._handleEnd); @@ -429,11 +436,11 @@ export default class RangeSlider { // Update ui if (this.vertical) { - this.fill.style.height = (position + this.grabX) + 'px'; + this.container.style.height = (position + this.grabX) + 'px'; this.handle.style.transform = 'translateY(-' + position + 'px)'; this.handle.style['-ms-transform'] = 'translateY(-' + position + 'px)'; } else { - this.fill.style.width = (position + this.grabX) + 'px'; + this.container.style.width = (position + this.grabX) + 'px'; this.handle.style.transform = 'translateX(' + position + 'px)'; this.handle.style['-ms-transform'] = 'translateX(' + position + 'px)'; } @@ -534,31 +541,31 @@ export default class RangeSlider { const boundingClientRect = this.range.getBoundingClientRect(); // Get the offset relative to the viewport - const rangeX = this.vertical ? boundingClientRect.bottom : boundingClientRect.left; - let pageX = 0; + const rangeSize = this.vertical ? boundingClientRect.bottom : boundingClientRect.left; + let pageOffset = 0; const pagePositionProperty = this.vertical ? 'pageY' : 'pageX'; if (typeof e[pagePositionProperty] !== 'undefined') { - pageX = (e.touches && e.touches.length) ? e.touches[0][pagePositionProperty] : e[pagePositionProperty]; + pageOffset = (e.touches && e.touches.length) ? e.touches[0][pagePositionProperty] : e[pagePositionProperty]; } else if (typeof e.originalEvent !== 'undefined') { if (typeof e.originalEvent[pagePositionProperty] !== 'undefined') { - pageX = e.originalEvent[pagePositionProperty]; + pageOffset = e.originalEvent[pagePositionProperty]; } else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][pagePositionProperty] !== 'undefined') { - pageX = e.originalEvent.touches[0][pagePositionProperty]; + pageOffset = e.originalEvent.touches[0][pagePositionProperty]; } } else if (e.touches && e.touches[0] && typeof e.touches[0][pagePositionProperty] !== 'undefined') { - pageX = e.touches[0][pagePositionProperty]; + pageOffset = e.touches[0][pagePositionProperty]; } else if (e.currentPoint && (typeof e.currentPoint.x !== 'undefined' || typeof e.currentPoint.y !== 'undefined')) { - pageX = this.vertical ? e.currentPoint.y : e.currentPoint.x; + pageOffset = this.vertical ? e.currentPoint.y : e.currentPoint.x; } if (this.vertical) { - pageX -= window.pageYOffset; + pageOffset -= window.pageYOffset; } - return this.vertical ? rangeX - pageX : pageX - rangeX; + return this.vertical ? rangeSize - pageOffset : pageOffset - rangeSize; } _getPositionFromValue(value) { diff --git a/src/utils/dom.js b/src/utils/dom.js index e143b3f..107f21e 100644 --- a/src/utils/dom.js +++ b/src/utils/dom.js @@ -2,6 +2,34 @@ import * as func from './functions'; const EVENT_LISTENER_LIST = 'eventListenerList'; +export const detectIE = () => { + const ua = window.navigator.userAgent; + const msie = ua.indexOf('MSIE '); + + if (msie > 0) { + return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); + } + + const trident = ua.indexOf('Trident/'); + + if (trident > 0) { + const rv = ua.indexOf('rv:'); + + return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); + } + + const edge = ua.indexOf('Edge/'); + + if (edge > 0) { + return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); + } + + return false; +}; + +const ieVersion = detectIE(); +const eventCaptureParams = window.PointerEvent && !ieVersion ? {passive: false} : false; + /** * Check if a `element` is visible in the DOM * @@ -11,6 +39,7 @@ const EVENT_LISTENER_LIST = 'eventListenerList'; export const isHidden = (element) => ( element.offsetWidth === 0 || element.offsetHeight === 0 || element.open === false ); + /** * Get hidden parentNodes of an `element` * @@ -42,11 +71,11 @@ export const getDimension = (element, key) => { let dimension = element[key]; // Used for native `
` elements - function toggleOpenProperty(element) { + const toggleOpenProperty = (element) => { if (typeof element.open !== 'undefined') { element.open = !element.open; } - } + }; if (hiddenParentNodesLength) { for (let i = 0; i < hiddenParentNodesLength; i++) { @@ -173,7 +202,7 @@ export const insertAfter = (referenceNode, newNode) => * @callback listener */ export const addEventListeners = (el, events, listener) => { - events.forEach(function (eventName) { + events.forEach((eventName) => { if (!el[EVENT_LISTENER_LIST]) { el[EVENT_LISTENER_LIST] = {}; } @@ -184,7 +213,7 @@ export const addEventListeners = (el, events, listener) => { el.addEventListener( eventName, listener, - window.PointerEvent ? {passive: false} : false + eventCaptureParams ); if (el[EVENT_LISTENER_LIST][eventName].indexOf(listener) < 0) { el[EVENT_LISTENER_LIST][eventName].push(listener); @@ -199,7 +228,7 @@ export const addEventListeners = (el, events, listener) => { * @callback listener */ export const removeEventListeners = (el, events, listener) => { - events.forEach(function (eventName) { + events.forEach((eventName) => { let index; el.removeEventListener( diff --git a/src/utils/functions.js b/src/utils/functions.js index 357435e..0c87de5 100644 --- a/src/utils/functions.js +++ b/src/utils/functions.js @@ -8,7 +8,7 @@ * @return {Function} */ export const delay = (fn, wait, ...args) => { - return setTimeout(function () { + return setTimeout(() => { return fn.apply(null, args); }, wait); }; @@ -30,7 +30,7 @@ export const debounce = (fn, debounceDuration) => { fn.debouncing = true; } clearTimeout(fn.debounceTimeout); - fn.debounceTimeout = setTimeout(function () { + fn.debounceTimeout = setTimeout(() => { fn.debouncing = false; }, debounceDuration); return fn.lastReturnVal; diff --git a/webpack.config.js b/webpack.config.js index 5b5d1fb..4d5d841 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -58,6 +58,7 @@ const config = { ], compress: true, disableHostCheck: true, + host: '0.0.0.0', port: 8000 } };