{"version":3,"sources":["webpack://sal/webpack/universalModuleDefinition","webpack://sal/webpack/bootstrap","webpack://sal/./src/sal.js"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","SSR_MESSAGE","NOT_SUPPORTED_MESSAGE","options","rootMargin","threshold","animateClassName","disabledClassName","enterEventName","exitEventName","selector","once","disabled","elements","intersectionObserver","setOptions","settings","clearAnimation","element","classList","remove","fireEvent","entry","event","CustomEvent","bubbles","detail","target","dispatchEvent","disableAnimations","document","body","add","clearObserver","disconnect","isDisabled","onIntersection","entries","observer","forEach","intersectionRatio","animate","unobserve","reverse","disable","enable","IntersectionObserver","filter","querySelectorAll","contains","isAnimated","observe","reset","Array","from","init","window","console","warn","Error"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,IARhB,CASGK,MAAM,WACT,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAM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,EAAQO,WAC1C6B,QAAQtB,GAEXF,EAAWC,GACX6B,KA6CaU,UArCF,WAAwB,IAAvBvC,EAAuB,uDAAZb,EAKvB,GAJAY,EAAWC,GAIW,oBAAXwC,OAIT,OAFAC,QAAQC,KAAKzD,GAEN,CACLY,WACA+B,UACAC,SACAO,SAIJ,IAAKI,OAAOV,qBAGV,MAFAjB,IAEM8B,MAAMzD,GASd,OANKiC,IAGHN,IAFAgB,IAKK,CACLhC,WACA+B,UACAC,SACAO,W","file":"sal.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([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sal\"] = factory();\n\telse\n\t\troot[\"sal\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Sal - Scroll Animation Library\n * Performance focused, lightweight scroll animation library\n */\n\nimport './sal.scss';\n\nconst SSR_MESSAGE = 'Sal was not initialised! Probably it is used in SSR.';\n\nconst NOT_SUPPORTED_MESSAGE = ''\n + 'Your browser does not support IntersectionObserver!\\n'\n + 'Get a polyfill from here:\\n'\n + 'https://github.com/w3c/IntersectionObserver/tree/master/polyfill';\n\n/**\n * Default options\n */\nlet options = {\n rootMargin: '0% 50%',\n threshold: 0.5,\n animateClassName: 'sal-animate',\n disabledClassName: 'sal-disabled',\n enterEventName: 'sal:in',\n exitEventName: 'sal:out',\n selector: '[data-sal]',\n once: true,\n disabled: false,\n};\n\n/**\n * Private\n */\nlet elements = [];\nlet intersectionObserver = null;\n\n/**\n * Set options\n * @param {Object} settings\n */\nconst setOptions = (settings) => {\n if (settings && settings !== options) {\n options = {\n ...options,\n ...settings,\n };\n }\n};\n\n/**\n * Clear animation for given element\n * @param {HTMLElement} element\n */\nconst clearAnimation = (element) => {\n element.classList.remove(options.animateClassName);\n};\n\n/**\n * Dispatches the animate event on the intersection observer entry.\n * @param {IntersectionObserverEntry} detail The entry to fire event on.\n */\nconst fireEvent = (name, entry) => {\n const event = new CustomEvent(name, {\n bubbles: true,\n detail: entry,\n });\n\n entry.target.dispatchEvent(event);\n};\n\n/**\n * Launch animation by adding class\n * @param {IntersectionObserverEntry} entry\n */\nconst animate = (entry) => {\n entry.target.classList.add(options.animateClassName);\n fireEvent(options.enterEventName, entry);\n};\n\n/**\n * Reverse animation by removing class\n * @param {IntersectionObserverEntry} entry\n */\nconst reverse = (entry) => {\n clearAnimation(entry.target);\n fireEvent(options.exitEventName, entry);\n};\n\n/**\n * Check if element was animated\n * @param {HTMLElement} element\n */\nconst isAnimated = (element) => (\n element.classList.contains(options.animateClassName)\n);\n\n/**\n * Enable animations by remove class from body\n */\nconst enableAnimations = () => {\n document.body.classList.remove(options.disabledClassName);\n};\n\n/**\n * Disable animations by add class from body\n */\nconst disableAnimations = () => {\n document.body.classList.add(options.disabledClassName);\n};\n\n/**\n * Clears observer\n */\nconst clearObserver = () => {\n intersectionObserver.disconnect();\n intersectionObserver = null;\n};\n\n/**\n * Check if should be disabled\n * @return {Boolean}\n */\nconst isDisabled = () => (\n options.disabled\n || (\n (typeof options.disabled === 'function')\n && options.disabled()\n )\n);\n\n/**\n * IntersectionObserver callback\n * @param {Array} entries\n * @param {IntersectionObserver} observer\n */\nconst onIntersection = (entries, observer) => {\n entries.forEach((entry) => {\n if (entry.intersectionRatio >= options.threshold) {\n animate(entry);\n\n if (options.once) {\n observer.unobserve(entry.target);\n }\n } else if (!options.once) {\n reverse(entry);\n }\n });\n};\n\n/**\n * Disable sal\n */\nconst disable = () => {\n disableAnimations();\n clearObserver();\n};\n\n/**\n * Enable sal by launching new IntersectionObserver\n */\nconst enable = () => {\n enableAnimations();\n\n intersectionObserver = new IntersectionObserver(onIntersection, {\n rootMargin: options.rootMargin,\n threshold: options.threshold,\n });\n\n elements = [].filter.call(\n document.querySelectorAll(options.selector),\n (element) => !isAnimated(element, options.animateClassName),\n );\n\n elements.forEach((element) => intersectionObserver.observe(element));\n};\n\n/**\n * Reset instance and provide new settings\n * @param {Object} settings\n */\nconst reset = (settings = {}) => {\n clearObserver();\n\n Array.from(document.querySelectorAll(options.selector))\n .forEach(clearAnimation);\n\n setOptions(settings);\n enable();\n};\n\n/**\n * Init\n * @param {Object} settings\n * @return {Object} public API\n */\nconst init = (settings = options) => {\n setOptions(settings);\n\n // Early return, when window object is not defined\n // e.g. during Server Side Rendering\n if (typeof window === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(SSR_MESSAGE);\n\n return {\n elements,\n disable,\n enable,\n reset,\n };\n }\n\n if (!window.IntersectionObserver) {\n disableAnimations();\n\n throw Error(NOT_SUPPORTED_MESSAGE);\n }\n\n if (!isDisabled()) {\n enable();\n } else {\n disableAnimations();\n }\n\n return {\n elements,\n disable,\n enable,\n reset,\n };\n};\n\nexport default init;\n"],"sourceRoot":""}