diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba227b9..b2e48ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,8 @@ - For feature create branch `feature/your-feature` and for bug fixing branch `fix/your-branch` - Your change should only be in the `src` folder. - Follow the code style. Spaces in brackets, semicolons, trailing commas. -- For development, use `npm start`. This will start the development server and you can see your change what you did in the `example` & `src` folder. +- For development, use `npm start`. This will start the development server and you can see your change what you did in the `src` folder. +- Run `npm run build` to build the project. - Make commits of logical units. - Check for unnecessary whitespace before committing. - Use descriptive commit messages and reference the #issue number. diff --git a/README.md b/README.md index 494567a..67b0ffb 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Simple content slider, works on scroll. Absolutely free for use. Thriving for precision & community growth. -[Documentation](https://asif-jalil.github.io/scroll-carousel-website) | [Demos](https://asif-jalil.github.io/scroll-carousel-website/#demos) +[NPM](https://www.npmjs.com/package/scroll-carousel) | [Documentation](https://asif-jalil.github.io/scroll-carousel-website) | [Demos](https://asif-jalil.github.io/scroll-carousel-website/#demos) **Note:** This carousel only operates in browser. @@ -69,13 +69,13 @@ To get started with **Scroll Carousel** right away, there are a few CDN availabl Add a link to the css file in your ``: ``` - + ``` Then, before your closing `` tag, add: ``` - + ``` ### Package managers diff --git a/dist/scroll.carousel.css b/dist/scroll.carousel.css deleted file mode 100644 index 7627734..0000000 --- a/dist/scroll.carousel.css +++ /dev/null @@ -1,28 +0,0 @@ -/*! - * - * scroll-carousel - 1.2.1 - * Responsive scroll slider - * - * https://asif-jalil.github.io/scroll-carousel-website - * - */ -/*!*********************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./src/scss/main.scss ***! - \*********************************************************************************************************************************************************************/ -.scroll-carousel-viewport { - overflow: hidden; - position: relative; -} - -.scroll-carousel-slider { - position: relative; - display: inline-flex; -} - -.sc-slide { - position: relative; - display: inline-block; -} -.sc-slide img, .sc-slide video { - max-width: fit-content !important; -} diff --git a/dist/scroll.carousel.css.map b/dist/scroll.carousel.css.map deleted file mode 100644 index e57c590..0000000 --- a/dist/scroll.carousel.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scroll.carousel.css","mappings":";;;;;;;;;;;AAAA;EACE;ACCF","sources":["webpack://scroll-carousel/./src/scss/_body.scss","webpack://scroll-carousel/./src/scss/main.scss"],"sourcesContent":[".scroll-carousel {\n position: relative;\n}",".scroll-carousel {\n position: relative;\n}"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/scroll.carousel.js b/dist/scroll.carousel.js deleted file mode 100644 index 04d50b3..0000000 --- a/dist/scroll.carousel.js +++ /dev/null @@ -1,706 +0,0 @@ -/*! - * - * scroll-carousel - 1.2.1 - * Responsive scroll slider - * - * https://asif-jalil.github.io/scroll-carousel-website - * - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("ScrollCarousel", [], factory); - else if(typeof exports === 'object') - exports["ScrollCarousel"] = factory(); - else - root["ScrollCarousel"] = factory(); -})(this, function() { -return /******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/js/EvEmitter.js": -/*!*****************************!*\ - !*** ./src/js/EvEmitter.js ***! - \*****************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ EvEmitter; } -/* harmony export */ }); -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -function EvEmitter() {} -var proto = EvEmitter.prototype; -proto.on = function (eventName, listener) { - if (!eventName || !listener) return this; - - // set events hash - var events = this._events = this._events || {}; - // set listeners array - var listeners = events[eventName] = events[eventName] || []; - // only add once - if (!listeners.includes(listener)) { - listeners.push(listener); - } - return this; -}; -proto.once = function (eventName, listener) { - if (!eventName || !listener) return this; - - // add event - this.on(eventName, listener); - // set once flag - // set onceEvents hash - var onceEvents = this._onceEvents = this._onceEvents || {}; - // set onceListeners object - var onceListeners = onceEvents[eventName] = onceEvents[eventName] || {}; - // set flag - onceListeners[listener] = true; - return this; -}; -proto.off = function (eventName, listener) { - var listeners = this._events && this._events[eventName]; - if (!listeners || !listeners.length) return this; - var index = listeners.indexOf(listener); - if (index != -1) { - listeners.splice(index, 1); - } - return this; -}; -proto.emitEvent = function (eventName, args) { - var listeners = this._events && this._events[eventName]; - if (!listeners || !listeners.length) return this; - - // copy over to avoid interference if .off() in listener - listeners = listeners.slice(0); - args = args || []; - // once stuff - var onceListeners = this._onceEvents && this._onceEvents[eventName]; - var _iterator = _createForOfIteratorHelper(listeners), - _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var listener = _step.value; - var isOnce = onceListeners && onceListeners[listener]; - if (isOnce) { - // remove listener - // remove before trigger to prevent recursion - this.off(eventName, listener); - // unset once flag - delete onceListeners[listener]; - } - // trigger listener - listener.apply(this, args); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - return this; -}; -proto.allOff = function () { - delete this._events; - delete this._onceEvents; - return this; -}; - -/***/ }), - -/***/ "./src/js/scroll.carousel.const.js": -/*!*****************************************!*\ - !*** ./src/js/scroll.carousel.const.js ***! - \*****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "LTR": function() { return /* binding */ LTR; }, -/* harmony export */ "RTL": function() { return /* binding */ RTL; } -/* harmony export */ }); -var RTL = 'rtl'; -var LTR = 'ltr'; - -/***/ }), - -/***/ "./src/js/util.js": -/*!************************!*\ - !*** ./src/js/util.js ***! - \************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "docReady": function() { return /* binding */ docReady; }, -/* harmony export */ "duplicateElems": function() { return /* binding */ duplicateElems; }, -/* harmony export */ "filterFindElements": function() { return /* binding */ filterFindElements; }, -/* harmony export */ "getQueryElement": function() { return /* binding */ getQueryElement; }, -/* harmony export */ "htmlInit": function() { return /* binding */ htmlInit; }, -/* harmony export */ "isScrolledIntoView": function() { return /* binding */ isScrolledIntoView; }, -/* harmony export */ "makeArray": function() { return /* binding */ makeArray; }, -/* harmony export */ "sanitizer": function() { return /* binding */ sanitizer; }, -/* harmony export */ "toDashed": function() { return /* binding */ toDashed; } -/* harmony export */ }); -/* harmony import */ var _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./scroll.carousel.const */ "./src/js/scroll.carousel.const.js"); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - - -/** - * check an element, node, array, object is into view or not - * - * @param {[Node, Element]} el - * - single element, selected node, an array or a object - * - * @return {Boolean} - Boolean - */ -function isScrolledIntoView(el) { - if (!el) { - return false; - } - var rect = el.getBoundingClientRect(); - var windowHeight = window.innerHeight || document.documentElement.clientHeight; - var windowWidth = window.innerWidth || document.documentElement.clientWidth; - var vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0; - var horInView = rect.left <= windowWidth && rect.left + rect.width >= 0; - return vertInView && horInView; -} - -// ----- getQueryElement ----- // - -// use element as selector string -function getQueryElement(elem) { - if (typeof elem == 'string') { - return document.querySelector(elem); - } - return elem; -} - -// ----- filterFindElements ----- // -function filterFindElements(elems, selector) { - // make array of elems - elems = makeArray(elems); - return elems - // check that elem is an actual element - .filter(function (elem) { - return elem instanceof HTMLElement; - }).reduce(function (scElems, elem) { - var _scElems; - // add elem of no selector - if (!selector) { - scElems.push(elem); - return scElems; - } - // filter & find items if we have a selector - // filter - if (elem.matches(selector)) { - scElems.push(elem); - } - // find children - var childElems = elem.querySelectorAll(selector); - // concat childElems to filterFound array - scElems = (_scElems = scElems).concat.apply(_scElems, _toConsumableArray(childElems)); - return scElems; - }, []); -} - -// ----- makeArray ----- // - -// turn element or NodeList into an array -function makeArray(obj) { - // use object if already an array - if (Array.isArray(obj)) return obj; - - // return empty array if undefined or null - if (obj === null || obj === undefined) return []; - var isArrayLike = _typeof(obj) == 'object' && typeof obj.length == 'number'; - // convert nodeList to array - if (isArrayLike) return _toConsumableArray(obj); - - // array of single index - return [obj]; -} - -// ----- docReady ----- // - -function docReady(onDocReady) { - var readyState = document.readyState; - if (readyState == 'complete' || readyState == 'interactive') { - // do async to allow for other scripts to run. - setTimeout(onDocReady); - } else { - document.addEventListener('DOMContentLoaded', onDocReady); - } -} - -// ----- htmlInit ----- // - -// source: http://bit.ly/3oYLusc -function toDashed(str) { - return str.replace(/(.)([A-Z])/g, function (match, $1, $2) { - return $1 + '-' + $2; - }).toLowerCase(); -} - -// allow user to initialize classes via [data-namespace] or .js-namespace class -// htmlInit( Widget, 'widgetName' ) -// options are parsed from data-namespace-options -function htmlInit(WidgetClass, namespace) { - docReady(function () { - var dashedNamespace = toDashed(namespace); - var dataAttr = 'data-' + dashedNamespace; - var dataAttrElems = document.querySelectorAll("[".concat(dataAttr, "]")); - _toConsumableArray(dataAttrElems).forEach(function (elem) { - var attr = elem.getAttribute(dataAttr); - var options; - try { - options = attr && JSON.parse(attr); - } catch (error) { - // log error, do not initialize - if (console) { - console.error("Error parsing ".concat(dataAttr, " on ").concat(elem.className, ": ").concat(error)); - } - return; - } - // initialize - new WidgetClass(elem, options); - }); - }); -} - -/** - * Duplicate a node - * - * @param {Array} elems - * @return {Array} array of element - * - */ -function duplicateElems(elems) { - return elems.map(function (node) { - return node.cloneNode(true); - }); -} - -// option validation -/** - * - * @param {Object} options - * @returns {Object} Same object of param with sanitization - */ -function sanitizer(options) { - if (Object.keys(options).includes('speed') && !Number(options.speed)) options.speed = 7; - if (Number(options.speed) <= 0) options.speed = 1; - if (Object.keys(options).includes('margin') && !Number(options.margin) && Number(options.margin) !== 0) options.margin = 10; - if (Object.keys(options).includes('direction')) options.direction = options.direction.toLowerCase(); - if (Object.keys(options).includes('direction') && options.direction !== _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_0__.RTL && options.direction !== _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_0__.LTR) options.direction = _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_0__.RTL; - if (Object.keys(options).includes('autoplaySpeed') && !Number(options.autoplaySpeed)) options.autoplaySpeed = 5; - if (Number(options.autoplaySpeed) <= 0) options.autoplaySpeed = 1; - return options; -} - -/***/ }), - -/***/ "./src/scss/main.scss": -/*!****************************!*\ - !*** ./src/scss/main.scss ***! - \****************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!***********************************!*\ - !*** ./src/js/scroll.carousel.js ***! - \***********************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _scss_main_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scss/main.scss */ "./src/scss/main.scss"); -/* harmony import */ var _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scroll.carousel.const */ "./src/js/scroll.carousel.const.js"); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ "./src/js/util.js"); -/* harmony import */ var _EvEmitter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EvEmitter */ "./src/js/EvEmitter.js"); -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - - - - -// globally unique identifiers -var GUID = 0; -// internal store of all ScrollCarousel instances -var instances = {}; - -/** - * Representing the Scroll Carousel - * @constructor - * @param {[Node, Element, string]} element - Target element where - * @param {ScrollCarousel.defaults} options - Configuration options of the carousel - */ -function ScrollCarousel(element) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var queryElement = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getQueryElement)(element); - if (!queryElement) { - if (console) console.error("Bad element for Scroll Carousel: ".concat(queryElement || element)); - return; - } - this.element = queryElement; - - // do not initialize twice on same element - if (this.element.scrollCarouselGUID) { - var instance = instances[this.element.scrollCarouselGUID]; - if (instance) instance.option(options); - return instance; - } - - // baseOption will be used for destroy method and reinit method - this.baseOption = options; - // options - this.options = _objectSpread({}, this.constructor.defaults); - // validated options - var sanitizedOptions = (0,_util__WEBPACK_IMPORTED_MODULE_2__.sanitizer)(options); - // merge options with prototype - this.option(sanitizedOptions); - - // kick things off - this._create(); -} - -// default options -ScrollCarousel.defaults = { - // movement speed of the carousel - speed: 7, - // handle the speed according to acceleration - smartSpeed: false, - // margin between two slides - margin: 10, - // slide will play auto - autoplay: false, - // speed control for autoplay - autoplaySpeed: 5, - // select slide with class name which you want to select for carousel. - // other element will behave as simple - slideSelector: null, - // moving direction of the slides - direction: _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.RTL -}; -var proto = ScrollCarousel.prototype; -// inherit EventEmitter -Object.assign(proto, _EvEmitter__WEBPACK_IMPORTED_MODULE_3__["default"].prototype); - -// start creating the carousel -proto._create = function () { - // add id for ScrollCarousel.data - var id = this.guid = ++GUID; - this.element.scrollCarouselGUID = id; // expando - instances[id] = this; // associate via id - - // create viewport - this._createViewport(); - - // create slider - this._createSlider(); - - // add listeners from on option - for (var eventName in this.options.on) { - var listener = this.options.on[eventName]; - this.on(eventName, listener); - } - - // add listeners from on option - this.activate(); -}; - -// assign default option with user input option -proto.option = function (opts) { - Object.assign(this.options, opts); -}; - -// main mechanism of Scroll Carousel -proto.activate = function () { - var _this$slider, - _this = this; - if (this.isActive) return; - this.isActive = true; - this.translate = 0; - this.displacement = 0; - this.isScrolling = true; - this.prevPosition = document.body.scrollTop || document.documentElement.scrollTop; - - // baseElems will be used for destroy method - this.baseElems = (0,_util__WEBPACK_IMPORTED_MODULE_2__.makeArray)(this.element.children); - - // move initial slide elements so they can be loaded as slides - var slideElems = this._filterFindSlideElements(this.element.children); - this.slideElems = this._makeSlides(slideElems); - - // for ltr direction reverse the elements like rtl mode - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.LTR) { - this.slideElems = this.slideElems.reverse(); - } - - // duplicate the slide array - var duplicateSlideElems = (0,_util__WEBPACK_IMPORTED_MODULE_2__.duplicateElems)(this.slideElems); - (_this$slider = this.slider).append.apply(_this$slider, _toConsumableArray(this.slideElems).concat(_toConsumableArray(duplicateSlideElems))); - this.viewport.append(this.slider); - this.element.append(this.viewport); - - // kick for ltr support - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.LTR) { - this._supportLtr(); - } - if (this.options.autoplay) { - this._autoplay(); - } - this.emitEvent('ready'); - - // transform function call on scroll - window.addEventListener('scroll', function () { - return _this._transform(); - }); -}; - -// run interval for autoplay -proto._autoplay = function () { - var _this2 = this; - // autoplay will set an interval. in every interval, - // we transform the slider. the interval - // will be removed when destroy method fired - this.interval = setInterval(function () { - _this2._transform(); - }, 10); -}; - -// transform the slider -proto._transform = function () { - if (!(0,_util__WEBPACK_IMPORTED_MODULE_2__.isScrolledIntoView)(this.element)) return; - if (this.options.autoplay) { - this._setIsScrolling(); - } - if (!this.options.smartSpeed) { - this._calcRegularSpeed(); - } else { - this._calcSmartSpeed(); - } - this.emitEvent('move', [this.progress]); -}; - -// calculate speed without smart speed -proto._calcRegularSpeed = function () { - var rect = this.slider.getBoundingClientRect(); - this.slider.style.transform = "translateX(".concat(this.translate, "px)"); - var speed = this.isScrolling ? this.options.speed : 1.2; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.RTL) this.translate -= speed; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.LTR) this.translate += speed; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.RTL && this.translate <= -rect.width / 2) this.translate = 0; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.LTR && this.translate >= 0) this.translate = -rect.width / 2; - - // progress is in percent. used to scroll event emit - this.progress = 100 * -this.translate / rect.width * 2; -}; - -// calculate smart speed -proto._calcSmartSpeed = function () { - var documentScrollTop = document.body.scrollTop || document.documentElement.scrollTop; - this.displacement -= this.isScrolling ? Math.abs(this.prevPosition - documentScrollTop) : 1.2; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.LTR && this.displacement < 0) { - this.displacement = 50 / (this.options.speed * 10 / 5.5e3 % 50); - } - var translateBasic = this.displacement / 5.5e3 * (this.options.speed * 10) % 50; - // progress is in percent. used to scroll event emit - this.progress = -translateBasic * 2; - var translate; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.RTL) translate = translateBasic; - if (this.options.direction === _scroll_carousel_const__WEBPACK_IMPORTED_MODULE_1__.LTR) translate = -translateBasic; - this.slider.style.transform = "translateX(".concat(translate, "%)"); - this.prevPosition = documentScrollTop; -}; - -// initial kick for ltr direction -proto._supportLtr = function () { - var rect = this.slider.getBoundingClientRect(); - - // calculate initial translate for regular speed - this.translate = -rect.width + Math.min(document.documentElement.clientWidth, window.innerWidth); - - // calculate initial displacement for smartSpeed - var translateInPercent = 100 * this.translate / rect.width; - this.displacement = -translateInPercent / (this.options.speed * 10 / 5.5e3 % 50); - if (this.options.smartSpeed) { - this.slider.style.transform = "translateX(".concat(translateInPercent, "%)"); - } else { - this.slider.style.transform = "translateX(".concat(this.translate, "px)"); - } -}; - -// check if the document is scrolling or not -proto._setIsScrolling = function () { - var top = document.body.scrollTop || document.documentElement.scrollTop; - this.isScrolling = true; - if (this.prevPosition === top) { - this.isScrolling = false; - return; - } - - // for smartSpeed the prevPosition will be set from _calcSmartSpeed function - if (!this.options.smartSpeed) this.prevPosition = top; -}; - -// every node will be in sc-slide -proto._makeSlide = function (elem) { - var slideElem = document.createElement('div'); - slideElem.style.marginRight = this.options.margin + 'px'; - slideElem.className = 'sc-slide'; - this.slideElem = slideElem; - this.slideElem.append(elem); - return this.slideElem; -}; - -// full array of node -proto._makeSlides = function (elems) { - var _this3 = this; - return elems.map(function (elem) { - return _this3._makeSlide(elem); - }); -}; - -// slider positions the slide -proto._createSlider = function () { - // slider element does all the positioning - var slider = document.createElement('div'); - slider.className = 'scroll-carousel-slider'; - this.slider = slider; -}; - -// slider will be in a viewport and it will transform -proto._createViewport = function () { - this.viewport = document.createElement('div'); - this.viewport.className = 'scroll-carousel-viewport'; -}; - -// filtering elements if the element child structure is too much complex (specially for slideSelector option) -proto._filterFindSlideElements = function (elems) { - return (0,_util__WEBPACK_IMPORTED_MODULE_2__.filterFindElements)(elems, this.options.slideSelector); -}; - -// ============================== METHOD ============================== - -proto.destroy = function () { - var _this$element; - if (!this.isActive) return; - this.viewport.remove(); - (_this$element = this.element).append.apply(_this$element, _toConsumableArray(this.baseElems)); - - // set flags - this.isActive = false; - // clear the interval - clearInterval(this.interval); - window.removeEventListener('scroll', this); - this.emitEvent('destroy'); - this.allOff(); - delete this.element.scrollCarouselGUID; - delete instances[this.guid]; -}; - -// Re initialize the carousel after destroy -proto.reinit = function () { - return new ScrollCarousel(this.element, this.baseOption); -}; - -// ============================== DATA ATTRIBUTE ============================== - -/** - * get Scroll Carousel instance from element - * @param {[Node, Element, String]} elem - element or selector string - * @returns {ScrollCarousel} - Scroll Carousel instance - */ -ScrollCarousel.data = function (elem) { - elem = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getQueryElement)(elem); - if (elem) return instances[elem.scrollCarouselGUID]; -}; - -// initialize with data attribute from here -(0,_util__WEBPACK_IMPORTED_MODULE_2__.htmlInit)(ScrollCarousel, 'carousel'); -/* harmony default export */ __webpack_exports__["default"] = (ScrollCarousel); -}(); -__webpack_exports__ = __webpack_exports__["default"]; -/******/ return __webpack_exports__; -/******/ })() -; -}); \ No newline at end of file diff --git a/dist/scroll.carousel.js.map b/dist/scroll.carousel.js.map deleted file mode 100644 index 443fa86..0000000 --- a/dist/scroll.carousel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scroll.carousel.js","mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;UCVA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNO,IAAMA,OAAO,GAAG,SAAVA,OAAO,GAAS;EAC3BC,OAAO,CAACC,GAAG,CAAC,eAAe,CAAC;AAC9B,CAAC;AAEDF,OAAO,EAAE;;;;;;;;ACJT","sources":["webpack://scroll-carousel/webpack/universalModuleDefinition","webpack://scroll-carousel/webpack/bootstrap","webpack://scroll-carousel/webpack/runtime/define property getters","webpack://scroll-carousel/webpack/runtime/hasOwnProperty shorthand","webpack://scroll-carousel/webpack/runtime/make namespace object","webpack://scroll-carousel/./src/js/index.js","webpack://scroll-carousel/./src/scss/main.scss?fadb"],"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([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"scroll-carousel\"] = factory();\n\telse\n\t\troot[\"scroll-carousel\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const printMe = () => {\n console.log('Print enabled');\n};\n\nprintMe();\n\n","// extracted by mini-css-extract-plugin\nexport {};"],"names":["printMe","console","log"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/scroll.carousel.min.css b/dist/scroll.carousel.min.css index 6f85cc5..646f5ca 100644 --- a/dist/scroll.carousel.min.css +++ b/dist/scroll.carousel.min.css @@ -1,2 +1 @@ -.scroll-carousel-viewport{overflow:hidden;position:relative}.scroll-carousel-slider{display:inline-flex;position:relative}.sc-slide{display:inline-block;position:relative}.sc-slide img,.sc-slide video{max-width:fit-content!important} -/*# sourceMappingURL=scroll.carousel.min.css.map*/ \ No newline at end of file +.scroll-carousel-viewport{overflow:hidden;position:relative}.scroll-carousel-slider{display:inline-flex;position:relative}.sc-slide{display:inline-block;position:relative}.sc-slide img,.sc-slide video{max-width:fit-content!important} \ No newline at end of file diff --git a/dist/scroll.carousel.min.css.map b/dist/scroll.carousel.min.css.map deleted file mode 100644 index da75021..0000000 --- a/dist/scroll.carousel.min.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scroll.carousel.min.css","mappings":"AAAA,0BAA0B,eAAe,CAAC,iBAAiB,CAAC,wBAA0C,mBAAkB,CAApC,iBAAqC,CAAC,UAA4B,oBAAmB,CAArC,iBAAsC,CAAC,8BAA8B,+BAAgC","sources":["webpack://ScrollCarousel/./src/scss/main.scss"],"sourcesContent":[".scroll-carousel-viewport{overflow:hidden;position:relative}.scroll-carousel-slider{position:relative;display:inline-flex}.sc-slide{position:relative;display:inline-block}.sc-slide img,.sc-slide video{max-width:fit-content !important}"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/scroll.carousel.min.js b/dist/scroll.carousel.min.js index 5a05206..5bb986f 100644 --- a/dist/scroll.carousel.min.js +++ b/dist/scroll.carousel.min.js @@ -1,2 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("ScrollCarousel",[],e):"object"==typeof exports?exports.ScrollCarousel=e():t.ScrollCarousel=e()}(this,(function(){return function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e={};t.d(e,{default:function(){return C}});var n="rtl",r="ltr";function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){l=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:{},n=l(t);if(n){if(this.element=n,this.element.scrollCarouselGUID){var r=S[this.element.scrollCarouselGUID];return r&&r.option(e),r}this.baseOption=e,this.options=v({},this.constructor.defaults);var i=c(e);this.option(i),this._create()}else console&&console.error("Bad element for Scroll Carousel: ".concat(n||t))}w.defaults={speed:7,smartSpeed:!1,margin:10,autoplay:!1,autoplaySpeed:5,slideSelector:null,direction:n};var E,O,_,j,A=w.prototype;Object.assign(A,h.prototype),A._create=function(){var t=this.guid=++g;for(var e in this.element.scrollCarouselGUID=t,S[t]=this,this._createViewport(),this._createSlider(),this.options.on){var n=this.options.on[e];this.on(e,n)}this.activate()},A.option=function(t){Object.assign(this.options,t)},A.activate=function(){var t,e=this;if(!this.isActive){this.isActive=!0,this.translate=0,this.displacement=0,this.isScrolling=!0,this.prevPosition=document.body.scrollTop||document.documentElement.scrollTop,this.baseElems=a(this.element.children);var n=this._filterFindSlideElements(this.element.children);this.slideElems=this._makeSlides(n),this.options.direction===r&&(this.slideElems=this.slideElems.reverse());var i=this.slideElems.map((function(t){return t.cloneNode(!0)}));(t=this.slider).append.apply(t,f(this.slideElems).concat(f(i))),this.viewport.append(this.slider),this.element.append(this.viewport),this.options.direction===r&&this._supportLtr(),this.options.autoplay&&this._autoplay(),this.emitEvent("ready"),window.addEventListener("scroll",(function(){return e._transform()}))}},A._autoplay=function(){var t=this;this.interval=setInterval((function(){t._transform()}),10)},A._transform=function(){(function(t){if(!t)return!1;var e=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth,i=e.top<=n&&e.top+e.height>=0,o=e.left<=r&&e.left+e.width>=0;return i&&o})(this.element)&&(this.options.autoplay&&this._setIsScrolling(),this.options.smartSpeed?this._calcSmartSpeed():this._calcRegularSpeed(),this.emitEvent("move",[this.progress]))},A._calcRegularSpeed=function(){var t=this.slider.getBoundingClientRect();this.slider.style.transform="translateX(".concat(this.translate,"px)");var e=this.isScrolling?this.options.speed:1.2;this.options.direction===n&&(this.translate-=e),this.options.direction===r&&(this.translate+=e),this.options.direction===n&&this.translate<=-t.width/2&&(this.translate=0),this.options.direction===r&&this.translate>=0&&(this.translate=-t.width/2),this.progress=100*-this.translate/t.width*2},A._calcSmartSpeed=function(){var t=document.body.scrollTop||document.documentElement.scrollTop;this.displacement-=this.isScrolling?Math.abs(this.prevPosition-t):1.2,this.options.direction===r&&this.displacement<0&&(this.displacement=50/(10*this.options.speed/5500%50));var e,i=this.displacement/5500*(10*this.options.speed)%50;this.progress=2*-i,this.options.direction===n&&(e=i),this.options.direction===r&&(e=-i),this.slider.style.transform="translateX(".concat(e,"%)"),this.prevPosition=t},A._supportLtr=function(){var t=this.slider.getBoundingClientRect();this.translate=-t.width+Math.min(document.documentElement.clientWidth,window.innerWidth);var e=100*this.translate/t.width;this.displacement=-e/(10*this.options.speed/5500%50),this.options.smartSpeed?this.slider.style.transform="translateX(".concat(e,"%)"):this.slider.style.transform="translateX(".concat(this.translate,"px)")},A._setIsScrolling=function(){var t=document.body.scrollTop||document.documentElement.scrollTop;this.isScrolling=!0,this.prevPosition!==t?this.options.smartSpeed||(this.prevPosition=t):this.isScrolling=!1},A._makeSlide=function(t){var e=document.createElement("div");return e.style.marginRight=this.options.margin+"px",e.className="sc-slide",this.slideElem=e,this.slideElem.append(t),this.slideElem},A._makeSlides=function(t){var e=this;return t.map((function(t){return e._makeSlide(t)}))},A._createSlider=function(){var t=document.createElement("div");t.className="scroll-carousel-slider",this.slider=t},A._createViewport=function(){this.viewport=document.createElement("div"),this.viewport.className="scroll-carousel-viewport"},A._filterFindSlideElements=function(t){return function(t,e){return(t=a(t)).filter((function(t){return t instanceof HTMLElement})).reduce((function(t,n){var r;if(!e)return t.push(n),t;n.matches(e)&&t.push(n);var i=n.querySelectorAll(e);return(r=t).concat.apply(r,o(i))}),[])}(t,this.options.slideSelector)},A.destroy=function(){var t;this.isActive&&(this.viewport.remove(),(t=this.element).append.apply(t,f(this.baseElems)),this.isActive=!1,clearInterval(this.interval),window.removeEventListener("scroll",this),this.emitEvent("destroy"),this.allOff(),delete this.element.scrollCarouselGUID,delete S[this.guid])},A.reinit=function(){return new w(this.element,this.baseOption)},w.data=function(t){if(t=l(t))return S[t.scrollCarouselGUID]},E=w,O="carousel",_=function(){var t="data-"+O.replace(/(.)([A-Z])/g,(function(t,e,n){return e+"-"+n})).toLowerCase();o(document.querySelectorAll("[".concat(t,"]"))).forEach((function(e){var n,r=e.getAttribute(t);try{n=r&&JSON.parse(r)}catch(n){return void(console&&console.error("Error parsing ".concat(t," on ").concat(e.className,": ").concat(n)))}new E(e,n)}))},"complete"==(j=document.readyState)||"interactive"==j?setTimeout(_):document.addEventListener("DOMContentLoaded",_);var C=w;return e=e.default}()})); -//# sourceMappingURL=scroll.carousel.min.js.map \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("ScrollCarousel",[],e):"object"==typeof exports?exports.ScrollCarousel=e():t.ScrollCarousel=e()}(this,(function(){return function(){"use strict";var t={d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e={};t.d(e,{default:function(){return C}});var r="rtl",n="ltr";function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){l=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(l)throw o}}}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:{},r=l(t);if(r){if(this.element=r,this.element.scrollCarouselGUID){var n=S[this.element.scrollCarouselGUID];return n&&n.option(e),n}this.baseOption=e,this.options=v({},this.constructor.defaults);var i=c(e);this.option(i),this._create()}else console&&console.error("Bad element for Scroll Carousel: ".concat(r||t))}w.defaults={speed:7,smartSpeed:!1,margin:10,autoplay:!1,autoplaySpeed:5,slideSelector:null,direction:r};var O,E,j,A,_=w.prototype;Object.assign(_,p.prototype),_._create=function(){var t=this.guid=++g;for(var e in this.element.scrollCarouselGUID=t,S[t]=this,this._createViewport(),this._createSlider(),this.options.on){var r=this.options.on[e];this.on(e,r)}this.activate()},_.option=function(t){Object.assign(this.options,t)},_.activate=function(){var t,e=this;if(!this.isActive){this.isActive=!0,this.translate=0,this.displacement=0,this.isScrolling=!0,this.prevPosition=document.body.scrollTop||document.documentElement.scrollTop,this.baseElems=a(this.element.children);var r=this._filterFindSlideElements(this.element.children);this.slideElems=this._makeSlides(r),this.options.direction===n&&(this.slideElems=this.slideElems.reverse());var i=this.slideElems.map((function(t){return t.cloneNode(!0)}));(t=this.slider).append.apply(t,f(this.slideElems).concat(f(i))),this.viewport.append(this.slider),this.element.append(this.viewport),this.options.direction===n&&this._supportLtr(),this.options.autoplay&&this._autoplay(),this.emitEvent("ready"),window.addEventListener("scroll",(function(){return e._transform()}))}},_._autoplay=function(){var t=this;this.interval=setInterval((function(){t._transform()}),10)},_._transform=function(){(function(t){if(!t)return!1;var e=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,i=e.top<=r&&e.top+e.height>=0,o=e.left<=n&&e.left+e.width>=0;return i&&o})(this.element)&&(this.options.autoplay&&this._setIsScrolling(),this.options.smartSpeed?this._calcSmartSpeed():this._calcRegularSpeed(),this.emitEvent("move",[this.progress]))},_._calcRegularSpeed=function(){var t=this.slider.getBoundingClientRect();this.slider.style.transform="translateX(".concat(this.translate,"px)");var e=this.isScrolling?this.options.speed:1.2;this.options.direction===r&&(this.translate-=e),this.options.direction===n&&(this.translate+=e),this.options.direction===r&&this.translate<=-t.width/2&&(this.translate=0),this.options.direction===n&&this.translate>=0&&(this.translate=-t.width/2),this.progress=100*-this.translate/t.width*2},_._calcSmartSpeed=function(){var t=document.body.scrollTop||document.documentElement.scrollTop;this.displacement-=this.isScrolling?Math.abs(this.prevPosition-t):1.2,this.options.direction===n&&this.displacement<0&&(this.displacement=50/(10*this.options.speed/5500%50));var e,i=this.displacement/5500*(10*this.options.speed)%50;this.progress=2*-i,this.options.direction===r&&(e=i),this.options.direction===n&&(e=-i),this.slider.style.transform="translateX(".concat(e,"%)"),this.prevPosition=t},_._supportLtr=function(){var t=this.slider.getBoundingClientRect();this.translate=-t.width+Math.min(document.documentElement.clientWidth,window.innerWidth);var e=100*this.translate/t.width;this.displacement=-e/(10*this.options.speed/5500%50),this.options.smartSpeed?this.slider.style.transform="translateX(".concat(e,"%)"):this.slider.style.transform="translateX(".concat(this.translate,"px)")},_._setIsScrolling=function(){var t=document.body.scrollTop||document.documentElement.scrollTop;this.isScrolling=!0,this.prevPosition!==t?this.options.smartSpeed||(this.prevPosition=t):this.isScrolling=!1},_._makeSlide=function(t){var e=document.createElement("div");return e.style.marginRight=this.options.margin+"px",e.className="sc-slide",this.slideElem=e,this.slideElem.append(t),this.slideElem},_._makeSlides=function(t){var e=this;return t.map((function(t){return e._makeSlide(t)}))},_._createSlider=function(){var t=document.createElement("div");t.className="scroll-carousel-slider",this.slider=t},_._createViewport=function(){this.viewport=document.createElement("div"),this.viewport.className="scroll-carousel-viewport"},_._filterFindSlideElements=function(t){return function(t,e){return(t=a(t)).filter((function(t){return t instanceof HTMLElement})).reduce((function(t,r){var n;if(!e)return t.push(r),t;r.matches(e)&&t.push(r);var i=r.querySelectorAll(e);return(n=t).concat.apply(n,o(i))}),[])}(t,this.options.slideSelector)},_.destroy=function(){var t;this.isActive&&(this.viewport.remove(),(t=this.element).append.apply(t,f(this.baseElems)),this.isActive=!1,clearInterval(this.interval),window.removeEventListener("scroll",this),this.emitEvent("destroy"),this.allOff(),delete this.element.scrollCarouselGUID,delete S[this.guid])},_.reinit=function(){return new w(this.element,this.baseOption)},w.data=function(t){if(t=l(t))return S[t.scrollCarouselGUID]},O=w,E="carousel",j=function(){var t="data-"+E.replace(/(.)([A-Z])/g,(function(t,e,r){return e+"-"+r})).toLowerCase();o(document.querySelectorAll("[".concat(t,"]"))).forEach((function(e){var r,n=e.getAttribute(t);try{r=n&&JSON.parse(n)}catch(r){return void(console&&console.error("Error parsing ".concat(t," on ").concat(e.className,": ").concat(r)))}new O(e,r)}))},"complete"==(A=document.readyState)||"interactive"==A?setTimeout(j):document.addEventListener("DOMContentLoaded",j);var C=w;return e=e.default}()})); \ No newline at end of file diff --git a/dist/scroll.carousel.min.js.map b/dist/scroll.carousel.min.js.map deleted file mode 100644 index 78ba22a..0000000 --- a/dist/scroll.carousel.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scroll.carousel.min.js","mappings":"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","sources":["webpack://ScrollCarousel/webpack/universalModuleDefinition","webpack://ScrollCarousel/webpack/bootstrap","webpack://ScrollCarousel/webpack/runtime/define property getters","webpack://ScrollCarousel/webpack/runtime/hasOwnProperty shorthand","webpack://ScrollCarousel/./src/js/scroll.carousel.const.js","webpack://ScrollCarousel/./src/js/util.js","webpack://ScrollCarousel/./src/js/EvEmitter.js","webpack://ScrollCarousel/./src/js/scroll.carousel.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(\"ScrollCarousel\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ScrollCarousel\"] = factory();\n\telse\n\t\troot[\"ScrollCarousel\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","export const RTL = 'rtl';\nexport const LTR = 'ltr';\n","import { LTR, RTL } from './scroll.carousel.const';\n\n/**\n * check an element, node, array, object is into view or not\n *\n * @param {[Node, Element]} el\n * - single element, selected node, an array or a object\n *\n * @return {Boolean} - Boolean\n */\nexport function isScrolledIntoView(el) {\n if (!el) {\n return false;\n }\n const rect = el.getBoundingClientRect();\n const windowHeight = window.innerHeight || document.documentElement.clientHeight;\n const windowWidth = window.innerWidth || document.documentElement.clientWidth;\n const vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;\n const horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;\n return vertInView && horInView;\n}\n\n// ----- getQueryElement ----- //\n\n// use element as selector string\nexport function getQueryElement(elem) {\n if (typeof elem == 'string') {\n return document.querySelector(elem);\n }\n return elem;\n}\n\n// ----- filterFindElements ----- //\nexport function filterFindElements(elems, selector) {\n // make array of elems\n elems = makeArray(elems);\n\n return (\n elems\n // check that elem is an actual element\n .filter(elem => elem instanceof HTMLElement)\n .reduce((scElems, elem) => {\n // add elem of no selector\n if (!selector) {\n scElems.push(elem);\n return scElems;\n }\n // filter & find items if we have a selector\n // filter\n if (elem.matches(selector)) {\n scElems.push(elem);\n }\n // find children\n let childElems = elem.querySelectorAll(selector);\n // concat childElems to filterFound array\n scElems = scElems.concat(...childElems);\n return scElems;\n }, [])\n );\n}\n\n// ----- makeArray ----- //\n\n// turn element or NodeList into an array\nexport function makeArray(obj) {\n // use object if already an array\n if (Array.isArray(obj)) return obj;\n\n // return empty array if undefined or null\n if (obj === null || obj === undefined) return [];\n\n let isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';\n // convert nodeList to array\n if (isArrayLike) return [...obj];\n\n // array of single index\n return [obj];\n}\n\n// ----- docReady ----- //\n\nexport function docReady(onDocReady) {\n let readyState = document.readyState;\n if (readyState == 'complete' || readyState == 'interactive') {\n // do async to allow for other scripts to run.\n setTimeout(onDocReady);\n } else {\n document.addEventListener('DOMContentLoaded', onDocReady);\n }\n}\n\n// ----- htmlInit ----- //\n\n// source: http://bit.ly/3oYLusc\nexport function toDashed(str) {\n return str\n .replace(/(.)([A-Z])/g, function (match, $1, $2) {\n return $1 + '-' + $2;\n })\n .toLowerCase();\n}\n\n// allow user to initialize classes via [data-namespace] or .js-namespace class\n// htmlInit( Widget, 'widgetName' )\n// options are parsed from data-namespace-options\nexport function htmlInit(WidgetClass, namespace) {\n docReady(function () {\n let dashedNamespace = toDashed(namespace);\n let dataAttr = 'data-' + dashedNamespace;\n let dataAttrElems = document.querySelectorAll(`[${dataAttr}]`);\n\n [...dataAttrElems].forEach(elem => {\n let attr = elem.getAttribute(dataAttr);\n let options;\n try {\n options = attr && JSON.parse(attr);\n } catch (error) {\n // log error, do not initialize\n if (console) {\n console.error(`Error parsing ${dataAttr} on ${elem.className}: ${error}`);\n }\n return;\n }\n // initialize\n new WidgetClass(elem, options);\n });\n });\n}\n\n/**\n * Duplicate a node\n *\n * @param {Array} elems\n * @return {Array} array of element\n *\n */\nexport function duplicateElems(elems) {\n return elems.map(node => node.cloneNode(true));\n}\n\n// option validation\n/**\n *\n * @param {Object} options\n * @returns {Object} Same object of param with sanitization\n */\nexport function sanitizer(options) {\n if (Object.keys(options).includes('speed') && !Number(options.speed)) options.speed = 7;\n if (Number(options.speed) <= 0) options.speed = 1;\n\n if (Object.keys(options).includes('margin') && !Number(options.margin) && Number(options.margin) !== 0)\n options.margin = 10;\n if (Object.keys(options).includes('direction')) options.direction = options.direction.toLowerCase();\n if (Object.keys(options).includes('direction') && options.direction !== RTL && options.direction !== LTR)\n options.direction = RTL;\n\n if (Object.keys(options).includes('autoplaySpeed') && !Number(options.autoplaySpeed))\n options.autoplaySpeed = 5;\n if (Number(options.autoplaySpeed) <= 0) options.autoplaySpeed = 1;\n\n return options;\n}\n\n","export default function EvEmitter() { }\n\nlet proto = EvEmitter.prototype;\n\n\nproto.on = function( eventName, listener ) {\n if ( !eventName || !listener ) return this;\n\n // set events hash\n let events = this._events = this._events || {};\n // set listeners array\n let listeners = events[ eventName ] = events[ eventName ] || [];\n // only add once\n if ( !listeners.includes( listener ) ) {\n listeners.push( listener );\n }\n\n return this;\n};\n\nproto.once = function( eventName, listener ) {\n if ( !eventName || !listener ) return this;\n\n // add event\n this.on( eventName, listener );\n // set once flag\n // set onceEvents hash\n let onceEvents = this._onceEvents = this._onceEvents || {};\n // set onceListeners object\n let onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};\n // set flag\n onceListeners[ listener ] = true;\n\n return this;\n};\n\nproto.off = function( eventName, listener ) {\n let listeners = this._events && this._events[ eventName ];\n if ( !listeners || !listeners.length ) return this;\n\n let index = listeners.indexOf( listener );\n if ( index != -1 ) {\n listeners.splice( index, 1 );\n }\n\n return this;\n};\n\nproto.emitEvent = function( eventName, args ) {\n let listeners = this._events && this._events[eventName];\n if ( !listeners || !listeners.length ) return this;\n\n // copy over to avoid interference if .off() in listener\n listeners = listeners.slice( 0 );\n args = args || [];\n // once stuff\n let onceListeners = this._onceEvents && this._onceEvents[ eventName ];\n\n for ( let listener of listeners ) {\n let isOnce = onceListeners && onceListeners[ listener ];\n if ( isOnce ) {\n // remove listener\n // remove before trigger to prevent recursion\n this.off( eventName, listener );\n // unset once flag\n delete onceListeners[ listener ];\n }\n // trigger listener\n listener.apply( this, args );\n }\n\n return this;\n};\n\nproto.allOff = function() {\n delete this._events;\n delete this._onceEvents;\n return this;\n};","import '../scss/main.scss';\nimport { LTR, RTL } from './scroll.carousel.const';\nimport {\n duplicateElems,\n filterFindElements,\n getQueryElement,\n htmlInit,\n isScrolledIntoView,\n makeArray,\n sanitizer\n} from './util';\nimport EvEmitter from './EvEmitter';\n\n// globally unique identifiers\nlet GUID = 0;\n// internal store of all ScrollCarousel instances\nlet instances = {};\n\n/**\n * Representing the Scroll Carousel\n * @constructor\n * @param {[Node, Element, string]} element - Target element where\n * @param {ScrollCarousel.defaults} options - Configuration options of the carousel\n */\nfunction ScrollCarousel(element, options = {}) {\n let queryElement = getQueryElement(element);\n if (!queryElement) {\n if (console) console.error(`Bad element for Scroll Carousel: ${queryElement || element}`);\n return;\n }\n this.element = queryElement;\n\n // do not initialize twice on same element\n if (this.element.scrollCarouselGUID) {\n let instance = instances[this.element.scrollCarouselGUID];\n if (instance) instance.option(options);\n return instance;\n }\n\n // baseOption will be used for destroy method and reinit method\n this.baseOption = options;\n // options\n this.options = { ...this.constructor.defaults };\n // validated options\n const sanitizedOptions = sanitizer(options);\n // merge options with prototype\n this.option(sanitizedOptions);\n\n // kick things off\n this._create();\n}\n\n// default options\nScrollCarousel.defaults = {\n // movement speed of the carousel\n speed: 7,\n // handle the speed according to acceleration\n smartSpeed: false,\n // margin between two slides\n margin: 10,\n // slide will play auto\n autoplay: false,\n // speed control for autoplay\n autoplaySpeed: 5,\n // select slide with class name which you want to select for carousel.\n // other element will behave as simple\n slideSelector: null,\n // moving direction of the slides\n direction: RTL\n};\n\nlet proto = ScrollCarousel.prototype;\n// inherit EventEmitter\nObject.assign(proto, EvEmitter.prototype);\n\n// start creating the carousel\nproto._create = function () {\n // add id for ScrollCarousel.data\n let id = (this.guid = ++GUID);\n this.element.scrollCarouselGUID = id; // expando\n instances[id] = this; // associate via id\n\n // create viewport\n this._createViewport();\n\n // create slider\n this._createSlider();\n\n // add listeners from on option\n for (let eventName in this.options.on) {\n let listener = this.options.on[eventName];\n this.on(eventName, listener);\n }\n\n // add listeners from on option\n this.activate();\n};\n\n// assign default option with user input option\nproto.option = function (opts) {\n Object.assign(this.options, opts);\n};\n\n// main mechanism of Scroll Carousel\nproto.activate = function () {\n if (this.isActive) return;\n\n this.isActive = true;\n this.translate = 0;\n this.displacement = 0;\n this.isScrolling = true;\n this.prevPosition = document.body.scrollTop || document.documentElement.scrollTop;\n\n // baseElems will be used for destroy method\n this.baseElems = makeArray(this.element.children);\n\n // move initial slide elements so they can be loaded as slides\n let slideElems = this._filterFindSlideElements(this.element.children);\n this.slideElems = this._makeSlides(slideElems);\n\n // for ltr direction reverse the elements like rtl mode\n if (this.options.direction === LTR) {\n this.slideElems = this.slideElems.reverse();\n }\n\n // duplicate the slide array\n let duplicateSlideElems = duplicateElems(this.slideElems);\n\n this.slider.append(...this.slideElems, ...duplicateSlideElems);\n this.viewport.append(this.slider);\n this.element.append(this.viewport);\n\n // kick for ltr support\n if (this.options.direction === LTR) {\n this._supportLtr();\n }\n\n if (this.options.autoplay) {\n this._autoplay();\n }\n\n this.emitEvent('ready');\n\n // transform function call on scroll\n window.addEventListener('scroll', () => this._transform());\n};\n\n// run interval for autoplay\nproto._autoplay = function () {\n // autoplay will set an interval. in every interval,\n // we transform the slider. the interval\n // will be removed when destroy method fired\n this.interval = setInterval(() => {\n this._transform();\n }, 10);\n};\n\n// transform the slider\nproto._transform = function () {\n if (!isScrolledIntoView(this.element)) return;\n\n if (this.options.autoplay) {\n this._setIsScrolling();\n }\n\n if (!this.options.smartSpeed) {\n this._calcRegularSpeed();\n } else {\n this._calcSmartSpeed();\n }\n\n this.emitEvent('move', [this.progress]);\n};\n\n// calculate speed without smart speed\nproto._calcRegularSpeed = function () {\n const rect = this.slider.getBoundingClientRect();\n this.slider.style.transform = `translateX(${this.translate}px)`;\n const speed = this.isScrolling ? this.options.speed : 1.2;\n\n if (this.options.direction === RTL) this.translate -= speed;\n if (this.options.direction === LTR) this.translate += speed;\n\n if (this.options.direction === RTL && this.translate <= -rect.width / 2) this.translate = 0;\n if (this.options.direction === LTR && this.translate >= 0) this.translate = -rect.width / 2;\n\n // progress is in percent. used to scroll event emit\n this.progress = ((100 * -this.translate) / rect.width) * 2;\n};\n\n// calculate smart speed\nproto._calcSmartSpeed = function () {\n const documentScrollTop = document.body.scrollTop || document.documentElement.scrollTop;\n this.displacement -= this.isScrolling ? Math.abs(this.prevPosition - documentScrollTop) : 1.2;\n\n if (this.options.direction === LTR && this.displacement < 0) {\n this.displacement = 50 / (((this.options.speed * 10) / 5.5e3) % 50);\n }\n\n const translateBasic = ((this.displacement / 5.5e3) * (this.options.speed * 10)) % 50;\n // progress is in percent. used to scroll event emit\n this.progress = -translateBasic * 2;\n let translate;\n if (this.options.direction === RTL) translate = translateBasic;\n if (this.options.direction === LTR) translate = -translateBasic;\n\n this.slider.style.transform = `translateX(${translate}%)`;\n this.prevPosition = documentScrollTop;\n};\n\n// initial kick for ltr direction\nproto._supportLtr = function () {\n const rect = this.slider.getBoundingClientRect();\n\n // calculate initial translate for regular speed\n this.translate = -rect.width + Math.min(document.documentElement.clientWidth, window.innerWidth);\n\n // calculate initial displacement for smartSpeed\n let translateInPercent = (100 * this.translate) / rect.width;\n this.displacement = -translateInPercent / (((this.options.speed * 10) / 5.5e3) % 50);\n\n if (this.options.smartSpeed) {\n this.slider.style.transform = `translateX(${translateInPercent}%)`;\n } else {\n this.slider.style.transform = `translateX(${this.translate}px)`;\n }\n};\n\n// check if the document is scrolling or not\nproto._setIsScrolling = function () {\n const top = document.body.scrollTop || document.documentElement.scrollTop;\n\n this.isScrolling = true;\n if (this.prevPosition === top) {\n this.isScrolling = false;\n return;\n }\n\n // for smartSpeed the prevPosition will be set from _calcSmartSpeed function\n if (!this.options.smartSpeed) this.prevPosition = top;\n};\n\n// every node will be in sc-slide\nproto._makeSlide = function (elem) {\n let slideElem = document.createElement('div');\n slideElem.style.marginRight = this.options.margin + 'px';\n slideElem.className = 'sc-slide';\n this.slideElem = slideElem;\n this.slideElem.append(elem);\n return this.slideElem;\n};\n\n// full array of node\nproto._makeSlides = function (elems) {\n return elems.map(elem => this._makeSlide(elem));\n};\n\n// slider positions the slide\nproto._createSlider = function () {\n // slider element does all the positioning\n let slider = document.createElement('div');\n slider.className = 'scroll-carousel-slider';\n this.slider = slider;\n};\n\n// slider will be in a viewport and it will transform\nproto._createViewport = function () {\n this.viewport = document.createElement('div');\n this.viewport.className = 'scroll-carousel-viewport';\n};\n\n// filtering elements if the element child structure is too much complex (specially for slideSelector option)\nproto._filterFindSlideElements = function (elems) {\n return filterFindElements(elems, this.options.slideSelector);\n};\n\n// ============================== METHOD ==============================\n\nproto.destroy = function () {\n if (!this.isActive) return;\n\n this.viewport.remove();\n this.element.append(...this.baseElems);\n\n // set flags\n this.isActive = false;\n // clear the interval\n clearInterval(this.interval);\n\n window.removeEventListener('scroll', this);\n this.emitEvent('destroy');\n this.allOff();\n delete this.element.scrollCarouselGUID;\n delete instances[this.guid];\n};\n\n// Re initialize the carousel after destroy\nproto.reinit = function () {\n return new ScrollCarousel(this.element, this.baseOption);\n};\n\n// ============================== DATA ATTRIBUTE ==============================\n\n/**\n * get Scroll Carousel instance from element\n * @param {[Node, Element, String]} elem - element or selector string\n * @returns {ScrollCarousel} - Scroll Carousel instance\n */\nScrollCarousel.data = function (elem) {\n elem = getQueryElement(elem);\n if (elem) return instances[elem.scrollCarouselGUID];\n};\n\n// initialize with data attribute from here\nhtmlInit(ScrollCarousel, 'carousel');\n\nexport default ScrollCarousel;\n\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","RTL","LTR","getQueryElement","elem","document","querySelector","makeArray","Array","isArray","length","sanitizer","options","keys","includes","Number","speed","margin","direction","toLowerCase","autoplaySpeed","EvEmitter","proto","on","eventName","listener","events","_events","listeners","push","once","onceEvents","_onceEvents","off","index","indexOf","splice","emitEvent","args","slice","onceListeners","apply","allOff","GUID","instances","ScrollCarousel","element","queryElement","scrollCarouselGUID","instance","option","baseOption","constructor","defaults","sanitizedOptions","_create","console","error","smartSpeed","autoplay","slideSelector","WidgetClass","namespace","onDocReady","readyState","assign","id","guid","_createViewport","_createSlider","activate","opts","isActive","translate","displacement","isScrolling","prevPosition","body","scrollTop","documentElement","baseElems","children","slideElems","_filterFindSlideElements","_makeSlides","reverse","duplicateSlideElems","map","node","cloneNode","slider","append","viewport","_supportLtr","_autoplay","window","addEventListener","_transform","interval","setInterval","el","rect","getBoundingClientRect","windowHeight","innerHeight","clientHeight","windowWidth","innerWidth","clientWidth","vertInView","top","height","horInView","left","width","isScrolledIntoView","_setIsScrolling","_calcSmartSpeed","_calcRegularSpeed","progress","style","transform","documentScrollTop","Math","abs","translateBasic","min","translateInPercent","_makeSlide","slideElem","createElement","marginRight","className","elems","selector","filter","HTMLElement","reduce","scElems","matches","childElems","querySelectorAll","concat","filterFindElements","destroy","remove","clearInterval","removeEventListener","reinit","data","dataAttr","replace","match","$1","$2","forEach","attr","getAttribute","JSON","parse","setTimeout"],"sourceRoot":""} \ No newline at end of file diff --git a/example/css/style.css b/example/css/style.css deleted file mode 100644 index ac4e1e0..0000000 --- a/example/css/style.css +++ /dev/null @@ -1,89 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600;700;900&display=swap'); - -body { - font-family: 'Source Sans Pro', sans-serif; -} - -.mt-5 { - margin-top: 3rem; -} - -.mx-auto { - margin-left: auto; - margin-right: auto; -} - -.text-center { - text-align: center; -} - -.fs-1 { - font-size: 2.5rem; -} - -.intro-peragraph { - font-size: 40px; - line-height: 1.1; - font-weight: 600; -} - -.item { - width: 200px; - height: 150px; - background-color: #10505b; - border: 2px solid gray; - margin: 5px; - overflow: hidden; - text-align: center; - color: white; -} - -#demo1 .scroll-carousel-slider { - align-items: center; -} - -img { - height: 150px; - margin: 5px; -} - -.item img { - margin: 0; -} - -.text-green { - color: #10505b; -} - -.text-yellow { - color: #d48207; -} - -.text-orange { - color: #e36942; -} - -.text-pink { - color: #b72c31; -} - -.text-purple { - color: #353a71; -} - -.text-blue { - color: #25476d; -} - -.transparent-box { - position: absolute; - right: 0; - bottom: 0; - background-color: #f54242; - font-size: 20px; - color: #fff; - width: 150px; - height: 40px; - z-index: 1; -} - diff --git a/example/images/binoculars-sketch.png b/example/images/binoculars-sketch.png deleted file mode 100644 index 690730c..0000000 Binary files a/example/images/binoculars-sketch.png and /dev/null differ diff --git a/example/images/blue-flask.png b/example/images/blue-flask.png deleted file mode 100644 index b972bc8..0000000 Binary files a/example/images/blue-flask.png and /dev/null differ diff --git a/example/images/flask.png b/example/images/flask.png deleted file mode 100644 index 9a0a23c..0000000 Binary files a/example/images/flask.png and /dev/null differ diff --git a/example/images/magnetic-field.png b/example/images/magnetic-field.png deleted file mode 100644 index f0a9802..0000000 Binary files a/example/images/magnetic-field.png and /dev/null differ diff --git a/example/index.html b/example/index.html deleted file mode 100644 index 619f4a5..0000000 --- a/example/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - Scroll-carousel - - - - - - -
-
-
- Say - hello - to - the - Scroll - Carousel -
-
Beginner or an advanced user. It's easy, lightweight.
-
Text or images- cycling through elements.
-
Fits perfectly into your website.
-
-
-
-
-
-
-
-
-

Here is the default carousel

-
- -
-
-
- - - -
- -
- - - - - - -
-
1
-
2
-
3
-
4
-
-
-

You can use smart speed

-
-
- - - -
- -
- - - - - - -
-
1
-
2
-
3
-
4
-
-
-

Initialized with data attribute

-
-
- - - -
- -
- - - - - - -
-
1
-
2
-
3
-
4
-
-
-

You can use different speed hhh

-
-
- - - -
- -
- - - - - - -
-
1
-
2
-
3
-
4
-
- -

Slide selector

-
-
1
-
2
-
3
-
4
-
Transparent
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
-
-
-
-

CODE IS POETRY

-
- - - \ No newline at end of file diff --git a/example/js/scroll-carousel.js b/example/js/scroll-carousel.js deleted file mode 100644 index 1e07c68..0000000 --- a/example/js/scroll-carousel.js +++ /dev/null @@ -1,57 +0,0 @@ -// import { ScrollCarousel } from './dist/scroll.carousel'; -(function () { - let demo1 = document.querySelector('#demo1'); - let demo2 = document.querySelector('#demo2'); - let demo3 = document.querySelector('#demo3'); - - let dm1 = new ScrollCarousel(demo1, { - on: { - ready: function () { - console.log('Be ready'); - }, - destroy: function () { - console.log('Carousel destroyed'); - } - } - }); - - document.querySelector('#btn-1').addEventListener('click', function () { - if (dm1.isActive) { - dm1.destroy(); - } else { - dm1 = new ScrollCarousel(demo1, { - on: { - ready: function () { - console.log('Be ready'); - }, - destroy: function () { - console.log('Carousel destroyed'); - } - } - }); - } - }); - - new ScrollCarousel('#demo5', { - slideSelector: '.item', - smartSpeed: true - }); - - new ScrollCarousel(demo2, { - autoplay: true, - autoplaySpeed: 8, - smartSpeed: true, - direction: 'ltr', - speed: 9, - margin: 5 - }); - - const dm3 = new ScrollCarousel(demo3, { - smartSpeed: true - }); - - dm3.on('scroll', function (progress) { - console.log(progress); - }); -})(); - diff --git a/package-lock.json b/package-lock.json index a162a79..76446b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scroll-carousel", - "version": "0.5.0", + "version": "1.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scroll-carousel", - "version": "0.5.0", + "version": "1.2.2", "license": "MIT", "devDependencies": { "@babel/core": "^7.19.6", @@ -18,6 +18,7 @@ "css-minimizer-webpack-plugin": "^4.2.2", "mini-css-extract-plugin": "^2.6.1", "node-sass": "^7.0.3", + "rimraf": "^5.0.1", "sass": "^1.55.0", "sass-loader": "^13.1.0", "style-loader": "^3.3.1", @@ -1811,6 +1812,73 @@ "dev": true, "license": "MIT" }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/@jest/schemas": { "version": "29.0.0", "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", @@ -1954,6 +2022,63 @@ "node": ">=10" } }, + "node_modules/@npmcli/move-file/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/move-file/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@npmcli/move-file/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@sinclair/typebox": { "version": "0.24.51", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", @@ -3057,6 +3182,21 @@ "node": "*" } }, + "node_modules/cacache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -4037,6 +4177,12 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -4522,6 +4668,34 @@ } } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -4689,6 +4863,28 @@ "assert-plus": "^1.0.0" } }, + "node_modules/glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -4709,6 +4905,15 @@ "dev": true, "license": "BSD-2-Clause" }, + "node_modules/glob/node_modules/minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -5377,6 +5582,24 @@ "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", "dev": true }, + "node_modules/jackspeak": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.0.tgz", + "integrity": "sha512-uKmsITSsF4rUWQHzqaRUuyAir3fZfW3f202Ee34lz/gZCi970CPZwyQXLGNgWJvvZbvFyzeyGq0+4fcG/mBKZg==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jest-util": { "version": "29.2.1", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.2.1.tgz", @@ -5966,6 +6189,30 @@ "dev": true, "license": "ISC" }, + "node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimatch/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", @@ -6276,6 +6523,21 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/node-gyp/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/node-gyp/node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -6674,6 +6936,40 @@ "dev": true, "license": "MIT" }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/path-scurry/node_modules/minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -7659,53 +7955,23 @@ } }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", "dev": true, - "license": "ISC", "dependencies": { - "glob": "^7.1.3" + "glob": "^10.2.5" }, "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "rimraf": "dist/cjs/src/bin.js" }, "engines": { - "node": "*" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8581,6 +8847,21 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -8594,6 +8875,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -9355,6 +9649,53 @@ } } }, + "node_modules/webpack-dev-server/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/webpack-dev-server/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/webpack-dev-server/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/webpack-merge": { "version": "5.8.0", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", @@ -9483,6 +9824,103 @@ "dev": true, "license": "MIT" }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -10702,6 +11140,54 @@ "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "dev": true }, + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "requires": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "@jest/schemas": { "version": "29.0.0", "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", @@ -10809,8 +11295,49 @@ "requires": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true + }, "@sinclair/typebox": { "version": "0.24.51", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", @@ -11676,6 +12203,15 @@ "requires": { "brace-expansion": "^1.1.7" } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } } } }, @@ -12336,6 +12872,12 @@ "domhandler": "^4.2.0" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -12696,6 +13238,24 @@ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "dev": true }, + "foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "dependencies": { + "signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true + } + } + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -12816,6 +13376,27 @@ "assert-plus": "^1.0.0" } }, + "glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "dependencies": { + "minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true + } + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -13304,6 +13885,16 @@ "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", "dev": true }, + "jackspeak": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.0.tgz", + "integrity": "sha512-uKmsITSsF4rUWQHzqaRUuyAir3fZfW3f202Ee34lz/gZCi970CPZwyQXLGNgWJvvZbvFyzeyGq0+4fcG/mBKZg==", + "dev": true, + "requires": { + "@isaacs/cliui": "^8.0.2", + "@pkgjs/parseargs": "^0.11.0" + } + }, "jest-util": { "version": "29.2.1", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.2.1.tgz", @@ -13732,6 +14323,26 @@ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "dev": true }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + } + } + }, "minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", @@ -13949,6 +14560,15 @@ "set-blocking": "^2.0.0" } }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -14218,6 +14838,30 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "requires": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "dev": true + }, + "minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true + } + } + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -14860,37 +15504,12 @@ "dev": true }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", "dev": true, "requires": { - "glob": "^7.1.3" - }, - "dependencies": { - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } + "glob": "^10.2.5" } }, "safe-buffer": { @@ -15538,6 +16157,17 @@ "strip-ansi": "^6.0.1" } }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -15547,6 +16177,15 @@ "ansi-regex": "^5.0.1" } }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, "strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -16061,6 +16700,40 @@ "spdy": "^4.0.2", "webpack-dev-middleware": "^5.3.1", "ws": "^8.4.2" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "webpack-merge": { @@ -16129,6 +16802,68 @@ "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", "dev": true }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 50ef2c9..782378e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scroll-carousel", - "version": "1.2.1", + "version": "1.2.2", "description": "Scroll carousel, a unique content slider that specially works on window scroll.", "main": "dist/scroll.carousel.js", "types": "src/js/scroll.carousel.d.ts", @@ -10,7 +10,8 @@ "start:serve": "webpack serve --config webpack.config.js", "start:watch": "webpack --watch --config webpack.config.js", "build:debug": "webpack --config webpack.config.js", - "build:prod": "cross-env NODE_ENV=production webpack --config webpack.config.js" + "clean": "rimraf dist", + "build:prod": "npm run clean & cross-env NODE_ENV=production webpack --config webpack.config.js" }, "keywords": [ "scroll", @@ -29,6 +30,9 @@ "practice", "pages" ], + "files": [ + "dist" + ], "contributors": [ { "name": "Asif Jalil", @@ -62,6 +66,7 @@ "css-minimizer-webpack-plugin": "^4.2.2", "mini-css-extract-plugin": "^2.6.1", "node-sass": "^7.0.3", + "rimraf": "^5.0.1", "sass": "^1.55.0", "sass-loader": "^13.1.0", "style-loader": "^3.3.1", diff --git a/src/js/EvEmitter.js b/src/js/EvEmitter.js index b983834..d79ab96 100644 --- a/src/js/EvEmitter.js +++ b/src/js/EvEmitter.js @@ -1,79 +1,40 @@ -export default function EvEmitter() { } +export default function EvEmitter() {} let proto = EvEmitter.prototype; - -proto.on = function( eventName, listener ) { - if ( !eventName || !listener ) return this; +proto.on = function (eventName, listener) { + if (!eventName || !listener) return this; // set events hash - let events = this._events = this._events || {}; + let events = (this._events = this._events || {}); // set listeners array - let listeners = events[ eventName ] = events[ eventName ] || []; + let listeners = (events[eventName] = events[eventName] || []); // only add once - if ( !listeners.includes( listener ) ) { - listeners.push( listener ); - } - - return this; -}; - -proto.once = function( eventName, listener ) { - if ( !eventName || !listener ) return this; - - // add event - this.on( eventName, listener ); - // set once flag - // set onceEvents hash - let onceEvents = this._onceEvents = this._onceEvents || {}; - // set onceListeners object - let onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; - // set flag - onceListeners[ listener ] = true; - - return this; -}; - -proto.off = function( eventName, listener ) { - let listeners = this._events && this._events[ eventName ]; - if ( !listeners || !listeners.length ) return this; - - let index = listeners.indexOf( listener ); - if ( index != -1 ) { - listeners.splice( index, 1 ); + if (!listeners.includes(listener)) { + listeners.push(listener); } return this; }; -proto.emitEvent = function( eventName, args ) { +proto.emitEvent = function (eventName, args) { let listeners = this._events && this._events[eventName]; - if ( !listeners || !listeners.length ) return this; + if (!listeners || !listeners.length) return this; // copy over to avoid interference if .off() in listener - listeners = listeners.slice( 0 ); + listeners = listeners.slice(0); args = args || []; - // once stuff - let onceListeners = this._onceEvents && this._onceEvents[ eventName ]; - for ( let listener of listeners ) { - let isOnce = onceListeners && onceListeners[ listener ]; - if ( isOnce ) { - // remove listener - // remove before trigger to prevent recursion - this.off( eventName, listener ); - // unset once flag - delete onceListeners[ listener ]; - } + for (let listener of listeners) { // trigger listener - listener.apply( this, args ); + listener.apply(this, args); } return this; }; -proto.allOff = function() { +proto.allOff = function () { delete this._events; - delete this._onceEvents; return this; -}; \ No newline at end of file +}; + diff --git a/src/js/scroll.carousel.d.ts b/src/js/scroll.carousel.d.ts index 1be7703..9340cbc 100644 --- a/src/js/scroll.carousel.d.ts +++ b/src/js/scroll.carousel.d.ts @@ -65,7 +65,7 @@ declare namespace ScrollCarousel { * Bind events within options by setting on to an Object. The object's keys should match the event names. * on is useful for capturing events as ScrollCarousel is initialized, like ready */ - on: EventBindings | undefined; + on?: EventBindings; /** * moving direction of the slides */ diff --git a/webpack.config.js b/webpack.config.js index b0d698c..48c2e12 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -108,7 +108,7 @@ module.exports = { }) ] }, - devtool: !isProd ? false : 'source-map', + devtool: isProd ? false : 'source-map', devServer: { static: { directory: path.resolve(__dirname, 'example')