irie 0.0.9__py3-none-any.whl → 0.0.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-base.js +1069 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-base.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-lite.js +1378 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-lite.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper.js +1927 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/createPopper.js +258 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/contains.js +23 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getBoundingClientRect.js +28 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getClippingRect.js +70 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getCompositeRect.js +57 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getComputedStyle.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getDocumentElement.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getDocumentRect.js +29 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getHTMLElementScroll.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getLayoutRect.js +25 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getNodeName.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getNodeScroll.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getOffsetParent.js +64 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getParentNode.js +19 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getScrollParent.js +16 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getViewportRect.js +40 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindow.js +12 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindowScroll.js +10 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindowScrollBarX.js +13 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/instanceOf.js +23 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/isScrollParent.js +10 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/isTableElement.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/listScrollParents.js +26 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/enums.js +31 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/index.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/applyStyles.js +84 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/arrow.js +101 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/computeStyles.js +155 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/eventListeners.js +49 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/flip.js +147 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/hide.js +61 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/index.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/offset.js +53 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/popperOffsets.js +25 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/preventOverflow.js +123 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper-base.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper-lite.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper.js +20 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/types.js +0 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/computeAutoPlacement.js +47 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/computeOffsets.js +70 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/debounce.js +15 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/detectOverflow.js +64 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/expandToHashMap.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/format.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getAltAxis.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getAltLen.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getBasePlacement.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getFreshSideObject.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getMainAxisFromPlacement.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getOppositePlacement.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getOppositeVariationPlacement.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getVariation.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/math.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/mergeByName.js +14 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/mergePaddingObject.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/orderModifiers.js +44 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/rectToClientRect.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/uniqueBy.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/validateModifiers.js +76 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/within.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-base.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-base.min.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-lite.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-lite.min.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js.flow +3 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-reboot.min.css +7 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +7 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.esm.min.js +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
- irie/apps/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.css +34 -0
- irie/apps/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.min.js +7 -0
- irie/apps/static/assets/vendor/notyf/notyf.es.js +441 -0
- irie/apps/static/assets/vendor/notyf/notyf.min.css +1 -0
- irie/apps/static/assets/vendor/notyf/notyf.min.js +1 -0
- irie/apps/static/assets/vendor/notyf/notyf.umd.js +449 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.css +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.js +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.mjs +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.mjs +2238 -0
- irie/apps/static/assets/vendor/onscreen/dist/index.js +21 -0
- irie/apps/static/assets/vendor/onscreen/dist/on-screen.es6.js +404 -0
- irie/apps/static/assets/vendor/onscreen/dist/on-screen.umd.min.js +1 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar-core.esm.js +889 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.esm.js +994 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.min.css +1 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.min.js +10 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.umd.js +127 -0
- irie/apps/static/assets/vendor/smooth-scroll/dist/smooth-scroll.min.js +2 -0
- irie/apps/static/assets/vendor/smooth-scroll/dist/smooth-scroll.polyfills.min.js +2 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.all.min.js +2 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.min.css +1 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.min.js +1 -0
- irie/apps/static/assets/vendor/waypoints/lib/jquery.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/noframework.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/infinite.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/inview.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/sticky.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/waypoints.debug.js +46 -0
- irie/apps/static/assets/vendor/waypoints/lib/zepto.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/licenses.txt +23 -0
- irie/apps/static/assets/vendor/waypoints/testem.json +24 -0
- irie/init/hayward.zip +0 -0
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/METADATA +1 -1
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/RECORD +122 -5
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/WHEEL +0 -0
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/entry_points.txt +0 -0
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Omyb":[function(require,module,exports) {
|
|
2
|
+
"use strict";function e(e,t){var r=window.MutationObserver;if(r){var n=new r(t);return n.observe(e,{childList:!0,subtree:!0}),n}return e.addEventListener("DOMNodeInserted",t,!1),e.addEventListener("DOMNodeRemoved",t,!1),null}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
3
|
+
},{}],"A8OV":[function(require,module,exports) {
|
|
4
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("../helpers/observe-dom"));function s(){var e=this,s=this.options.container;s instanceof HTMLElement&&("static"===window.getComputedStyle(s).position&&(s.style.position="relative"));this._observer=t.default(document.querySelector("body"),function(){Object.keys(e.trackedElements).forEach(function(t){e.on("enter",t),e.on("leave",t)})}),s.addEventListener("scroll",this._scroll,{passive:!0}),window.addEventListener("resize",this._scroll,{passive:!0}),this._scroll(),this.attached=!0}exports.default=s;
|
|
5
|
+
},{"../helpers/observe-dom":"Omyb"}],"OJn0":[function(require,module,exports) {
|
|
6
|
+
"use strict";function e(e,t){if(!e)throw new Error("You should specify the element you want to test");"string"==typeof e&&(e=document.querySelector(e));var n=e.getBoundingClientRect();return n.bottom-t.tolerance>0&&n.right-t.tolerance>0&&n.left+t.tolerance<(window.innerWidth||document.documentElement.clientWidth)&&n.top+t.tolerance<(window.innerHeight||document.documentElement.clientHeight)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
7
|
+
},{}],"m6QN":[function(require,module,exports) {
|
|
8
|
+
"use strict";function e(e,t){if(!e)throw new Error("You should specify the element you want to test");if("string"==typeof e&&(e=document.querySelector(e)),"string"==typeof t&&(t={tolerance:0,container:document.querySelector(t)}),"string"==typeof t.container&&(t.container=document.querySelector(t.container)),t instanceof HTMLElement&&(t={tolerance:0,container:t}),!t.container)throw new Error("You should specify a container element");var o=t.container.getBoundingClientRect();return e.offsetTop+e.clientHeight-t.tolerance>t.container.scrollTop&&e.offsetLeft+e.clientWidth-t.tolerance>t.container.scrollLeft&&e.offsetLeft+t.tolerance<o.width+t.container.scrollLeft&&e.offsetTop+t.tolerance<o.height+t.container.scrollTop}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
9
|
+
},{}],"VqMh":[function(require,module,exports) {
|
|
10
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var i=e(require("./in-viewport")),n=e(require("./in-container"));function t(e,t){void 0===e&&(e={}),void 0===t&&(t={container:window,tolerance:0});var o,r=Object.keys(e);r.length&&(o=t.container===window?i.default:n.default,r.forEach(function(i){e[i].nodes.forEach(function(n){if(o(n.node,t)?(n.wasVisible=n.isVisible,n.isVisible=!0):(n.wasVisible=n.isVisible,n.isVisible=!1),!0===n.isVisible&&!1===n.wasVisible){if(!e[i].enter)return;Object.keys(e[i].enter).forEach(function(t){"function"==typeof e[i].enter[t]&&e[i].enter[t](n.node,"enter")})}if(!1===n.isVisible&&!0===n.wasVisible){if(!e[i].leave)return;Object.keys(e[i].leave).forEach(function(t){"function"==typeof e[i].leave[t]&&e[i].leave[t](n.node,"leave")})}})}))}exports.default=t;
|
|
11
|
+
},{"./in-viewport":"OJn0","./in-container":"m6QN"}],"GRp5":[function(require,module,exports) {
|
|
12
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("../helpers/scroll-handler"));function r(){var e,r=this;return function(){clearTimeout(e),e=setTimeout(function(){t.default(r.trackedElements,r.options)},r.options.debounce)}}exports.default=r;
|
|
13
|
+
},{"../helpers/scroll-handler":"VqMh"}],"FO0g":[function(require,module,exports) {
|
|
14
|
+
"use strict";function e(){this._observer instanceof MutationObserver&&this._observer.disconnect(),this.options.container.removeEventListener("scroll",this._scroll),window.removeEventListener("resize",this._scroll),this.attached=!1}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
15
|
+
},{}],"nGOL":[function(require,module,exports) {
|
|
16
|
+
"use strict";function e(e,t,s){var l=Object.keys(this.trackedElements[t].enter||{}),n=Object.keys(this.trackedElements[t].leave||{});if({}.hasOwnProperty.call(this.trackedElements,t))if(s){if(this.trackedElements[t][e]){var r="function"==typeof s?s.name:s;delete this.trackedElements[t][e][r]}}else delete this.trackedElements[t][e];l.length||n.length||delete this.trackedElements[t]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
17
|
+
},{}],"NKIH":[function(require,module,exports) {
|
|
18
|
+
"use strict";function e(e,t,r){if(!e)throw new Error("No event given. Choose either enter or leave");if(!t)throw new Error("No selector to track");if(["enter","leave"].indexOf(e)<0)throw new Error(e+" event is not supported");({}).hasOwnProperty.call(this.trackedElements,t)||(this.trackedElements[t]={}),this.trackedElements[t].nodes=[];for(var s=0,n=document.querySelectorAll(t);s<n.length;s++){var o={isVisible:!1,wasVisible:!1,node:n[s]};this.trackedElements[t].nodes.push(o)}"function"==typeof r&&(this.trackedElements[t][e]||(this.trackedElements[t][e]={}),this.trackedElements[t][e][r.name||"anonymous"]=r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
19
|
+
},{}],"QCba":[function(require,module,exports) {
|
|
20
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("./methods/attach")),r=e(require("./methods/debounced-scroll")),n=e(require("./methods/destroy")),o=e(require("./methods/off")),i=e(require("./methods/on")),u=e(require("./helpers/in-viewport"));function a(e){void 0===e&&(e={tolerance:0,debounce:100,container:window}),this.options={},this.trackedElements={},Object.defineProperties(this.options,{container:{configurable:!1,enumerable:!1,get:function(){var t;return"string"==typeof e.container?t=document.querySelector(e.container):e.container instanceof HTMLElement&&(t=e.container),t||window},set:function(t){e.container=t}},debounce:{get:function(){return e.debounce||100},set:function(t){e.debounce=t}},tolerance:{get:function(){return e.tolerance||0},set:function(t){e.tolerance=t}}}),Object.defineProperty(this,"_scroll",{enumerable:!1,configurable:!1,writable:!1,value:this._debouncedScroll.call(this)}),this.attach()}Object.defineProperties(a.prototype,{_debouncedScroll:{configurable:!1,writable:!1,enumerable:!1,value:r.default},attach:{configurable:!1,writable:!1,enumerable:!1,value:t.default},destroy:{configurable:!1,writable:!1,enumerable:!1,value:n.default},off:{configurable:!1,writable:!1,enumerable:!1,value:o.default},on:{configurable:!1,writable:!1,enumerable:!1,value:i.default}}),a.check=u.default,exports.default=a;
|
|
21
|
+
},{"./methods/attach":"A8OV","./methods/debounced-scroll":"GRp5","./methods/destroy":"FO0g","./methods/off":"nGOL","./methods/on":"NKIH","./helpers/in-viewport":"OJn0"}]},{},["QCba"], null)
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observes DOM mutations and runs a callback function when
|
|
3
|
+
* detecting one.
|
|
4
|
+
*
|
|
5
|
+
* @param {node} obj The DOM node you want to observe
|
|
6
|
+
* @param {function} callback The callback function you want to call
|
|
7
|
+
* @return {MutationObserver} obs The mutation observer instance used to track DOM mutations
|
|
8
|
+
*/
|
|
9
|
+
function observeDOM(obj, callback) {
|
|
10
|
+
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
|
|
11
|
+
|
|
12
|
+
/* istanbul ignore else */
|
|
13
|
+
if (MutationObserver) {
|
|
14
|
+
var obs = new MutationObserver(callback);
|
|
15
|
+
|
|
16
|
+
obs.observe(obj, {
|
|
17
|
+
childList: true,
|
|
18
|
+
subtree: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return obs;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
obj.addEventListener('DOMNodeInserted', callback, false);
|
|
25
|
+
obj.addEventListener('DOMNodeRemoved', callback, false);
|
|
26
|
+
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Attaches the scroll event handler
|
|
32
|
+
*
|
|
33
|
+
* @return {void}
|
|
34
|
+
*/
|
|
35
|
+
function attach() {
|
|
36
|
+
var _this = this;
|
|
37
|
+
|
|
38
|
+
var container = this.options.container;
|
|
39
|
+
|
|
40
|
+
if (container instanceof HTMLElement) {
|
|
41
|
+
var style = window.getComputedStyle(container);
|
|
42
|
+
|
|
43
|
+
if (style.position === 'static') {
|
|
44
|
+
container.style.position = 'relative';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this._observer = observeDOM(document.querySelector('body'), function () {
|
|
49
|
+
Object.keys(_this.trackedElements).forEach(function (element) {
|
|
50
|
+
_this.on('enter', element);
|
|
51
|
+
_this.on('leave', element);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
container.addEventListener('scroll', this._scroll, { passive: true });
|
|
56
|
+
window.addEventListener('resize', this._scroll, { passive: true });
|
|
57
|
+
this._scroll();
|
|
58
|
+
this.attached = true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Checks an element's position in respect to the viewport
|
|
63
|
+
* and determines wether it's inside the viewport.
|
|
64
|
+
*
|
|
65
|
+
* @param {node} element The DOM node you want to check
|
|
66
|
+
* @return {boolean} A boolean value that indicates wether is on or off the viewport.
|
|
67
|
+
*/
|
|
68
|
+
function inViewport(el) {
|
|
69
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { tolerance: 0 };
|
|
70
|
+
|
|
71
|
+
if (!el) {
|
|
72
|
+
throw new Error('You should specify the element you want to test');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (typeof el === 'string') {
|
|
76
|
+
el = document.querySelector(el);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var elRect = el.getBoundingClientRect();
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
// Check bottom boundary
|
|
83
|
+
elRect.bottom - options.tolerance > 0 &&
|
|
84
|
+
|
|
85
|
+
// Check right boundary
|
|
86
|
+
elRect.right - options.tolerance > 0 &&
|
|
87
|
+
|
|
88
|
+
// Check left boundary
|
|
89
|
+
elRect.left + options.tolerance < (window.innerWidth || document.documentElement.clientWidth) &&
|
|
90
|
+
|
|
91
|
+
// Check top boundary
|
|
92
|
+
elRect.top + options.tolerance < (window.innerHeight || document.documentElement.clientHeight)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Checks an element's position in respect to a HTMLElement
|
|
98
|
+
* and determines wether it's within its boundaries.
|
|
99
|
+
*
|
|
100
|
+
* @param {node} element The DOM node you want to check
|
|
101
|
+
* @return {boolean} A boolean value that indicates wether is on or off the container.
|
|
102
|
+
*/
|
|
103
|
+
function inContainer(el) {
|
|
104
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { tolerance: 0, container: '' };
|
|
105
|
+
|
|
106
|
+
if (!el) {
|
|
107
|
+
throw new Error('You should specify the element you want to test');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (typeof el === 'string') {
|
|
111
|
+
el = document.querySelector(el);
|
|
112
|
+
}
|
|
113
|
+
if (typeof options === 'string') {
|
|
114
|
+
options = {
|
|
115
|
+
tolerance: 0,
|
|
116
|
+
container: document.querySelector(options)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (typeof options.container === 'string') {
|
|
120
|
+
options.container = document.querySelector(options.container);
|
|
121
|
+
}
|
|
122
|
+
if (options instanceof HTMLElement) {
|
|
123
|
+
options = {
|
|
124
|
+
tolerance: 0,
|
|
125
|
+
container: options
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (!options.container) {
|
|
129
|
+
throw new Error('You should specify a container element');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
var containerRect = options.container.getBoundingClientRect();
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
// // Check bottom boundary
|
|
136
|
+
el.offsetTop + el.clientHeight - options.tolerance > options.container.scrollTop &&
|
|
137
|
+
|
|
138
|
+
// Check right boundary
|
|
139
|
+
el.offsetLeft + el.clientWidth - options.tolerance > options.container.scrollLeft &&
|
|
140
|
+
|
|
141
|
+
// Check left boundary
|
|
142
|
+
el.offsetLeft + options.tolerance < containerRect.width + options.container.scrollLeft &&
|
|
143
|
+
|
|
144
|
+
// // Check top boundary
|
|
145
|
+
el.offsetTop + options.tolerance < containerRect.height + options.container.scrollTop
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// TODO: Refactor this so it can be easily tested
|
|
150
|
+
/* istanbul ignore next */
|
|
151
|
+
function eventHandler() {
|
|
152
|
+
var trackedElements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
153
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { tolerance: 0 };
|
|
154
|
+
|
|
155
|
+
var selectors = Object.keys(trackedElements);
|
|
156
|
+
var testVisibility = void 0;
|
|
157
|
+
|
|
158
|
+
if (!selectors.length) return;
|
|
159
|
+
|
|
160
|
+
if (options.container === window) {
|
|
161
|
+
testVisibility = inViewport;
|
|
162
|
+
} else {
|
|
163
|
+
testVisibility = inContainer;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
selectors.forEach(function (selector) {
|
|
167
|
+
trackedElements[selector].nodes.forEach(function (item) {
|
|
168
|
+
if (testVisibility(item.node, options)) {
|
|
169
|
+
item.wasVisible = item.isVisible;
|
|
170
|
+
item.isVisible = true;
|
|
171
|
+
} else {
|
|
172
|
+
item.wasVisible = item.isVisible;
|
|
173
|
+
item.isVisible = false;
|
|
174
|
+
}
|
|
175
|
+
if (item.isVisible === true && item.wasVisible === false) {
|
|
176
|
+
if (!trackedElements[selector].enter) return;
|
|
177
|
+
|
|
178
|
+
Object.keys(trackedElements[selector].enter).forEach(function (callback) {
|
|
179
|
+
if (typeof trackedElements[selector].enter[callback] === 'function') {
|
|
180
|
+
trackedElements[selector].enter[callback](item.node, 'enter');
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (item.isVisible === false && item.wasVisible === true) {
|
|
185
|
+
if (!trackedElements[selector].leave) return;
|
|
186
|
+
|
|
187
|
+
Object.keys(trackedElements[selector].leave).forEach(function (callback) {
|
|
188
|
+
if (typeof trackedElements[selector].leave[callback] === 'function') {
|
|
189
|
+
trackedElements[selector].leave[callback](item.node, 'leave');
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Debounces the scroll event to avoid performance issues
|
|
199
|
+
*
|
|
200
|
+
* @return {void}
|
|
201
|
+
*/
|
|
202
|
+
function debouncedScroll() {
|
|
203
|
+
var _this = this;
|
|
204
|
+
|
|
205
|
+
var timeout = void 0;
|
|
206
|
+
|
|
207
|
+
if (this.options.debounce === false) {
|
|
208
|
+
return function () {
|
|
209
|
+
return eventHandler(_this.trackedElements, _this.options);
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return function () {
|
|
214
|
+
clearTimeout(timeout);
|
|
215
|
+
|
|
216
|
+
timeout = setTimeout(function () {
|
|
217
|
+
eventHandler(_this.trackedElements, _this.options);
|
|
218
|
+
}, _this.options.debounce);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Removes the scroll event handler
|
|
224
|
+
*
|
|
225
|
+
* @return {void}
|
|
226
|
+
*/
|
|
227
|
+
function destroy() {
|
|
228
|
+
if (this._observer instanceof MutationObserver) {
|
|
229
|
+
this._observer.disconnect();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.options.container.removeEventListener('scroll', this._scroll);
|
|
233
|
+
window.removeEventListener('resize', this._scroll);
|
|
234
|
+
this.attached = false;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Stops tracking elements matching a CSS selector. If a selector has no
|
|
239
|
+
* callbacks it gets removed.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} event The event you want to stop tracking (enter or leave)
|
|
242
|
+
* @param {string} selector The CSS selector you want to stop tracking
|
|
243
|
+
* @return {void}
|
|
244
|
+
*/
|
|
245
|
+
function off(event, selector, handler) {
|
|
246
|
+
var enterCallbacks = Object.keys(this.trackedElements[selector].enter || {});
|
|
247
|
+
var leaveCallbacks = Object.keys(this.trackedElements[selector].leave || {});
|
|
248
|
+
|
|
249
|
+
if ({}.hasOwnProperty.call(this.trackedElements, selector)) {
|
|
250
|
+
if (handler) {
|
|
251
|
+
if (this.trackedElements[selector][event]) {
|
|
252
|
+
var callbackName = typeof handler === 'function' ? handler.name : handler;
|
|
253
|
+
delete this.trackedElements[selector][event][callbackName];
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
delete this.trackedElements[selector][event];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (!enterCallbacks.length && !leaveCallbacks.length) {
|
|
261
|
+
delete this.trackedElements[selector];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Starts tracking elements matching a CSS selector
|
|
267
|
+
*
|
|
268
|
+
* @param {string} event The event you want to track (enter or leave)
|
|
269
|
+
* @param {string} selector The element you want to track
|
|
270
|
+
* @param {function} callback The callback function to handle the event
|
|
271
|
+
* @return {void}
|
|
272
|
+
*/
|
|
273
|
+
function on(event, selector, callback) {
|
|
274
|
+
var allowed = ['enter', 'leave'];
|
|
275
|
+
|
|
276
|
+
if (!event) throw new Error('No event given. Choose either enter or leave');
|
|
277
|
+
if (!selector) throw new Error('No selector to track');
|
|
278
|
+
if (allowed.indexOf(event) < 0) throw new Error(event + ' event is not supported');
|
|
279
|
+
|
|
280
|
+
if (!{}.hasOwnProperty.call(this.trackedElements, selector)) {
|
|
281
|
+
this.trackedElements[selector] = {};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
this.trackedElements[selector].nodes = [];
|
|
285
|
+
|
|
286
|
+
for (var i = 0, elems = document.querySelectorAll(selector); i < elems.length; i++) {
|
|
287
|
+
var item = {
|
|
288
|
+
isVisible: false,
|
|
289
|
+
wasVisible: false,
|
|
290
|
+
node: elems[i]
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
this.trackedElements[selector].nodes.push(item);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (typeof callback === 'function') {
|
|
297
|
+
if (!this.trackedElements[selector][event]) {
|
|
298
|
+
this.trackedElements[selector][event] = {};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
this.trackedElements[selector][event][callback.name || 'anonymous'] = callback;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Detects wether DOM nodes enter or leave the viewport
|
|
307
|
+
*
|
|
308
|
+
* @constructor
|
|
309
|
+
* @param {object} options The configuration object
|
|
310
|
+
*/
|
|
311
|
+
function OnScreen() {
|
|
312
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { tolerance: 0, debounce: 100, container: window };
|
|
313
|
+
|
|
314
|
+
this.options = {};
|
|
315
|
+
this.trackedElements = {};
|
|
316
|
+
|
|
317
|
+
Object.defineProperties(this.options, {
|
|
318
|
+
container: {
|
|
319
|
+
configurable: false,
|
|
320
|
+
enumerable: false,
|
|
321
|
+
get: function get() {
|
|
322
|
+
var container = void 0;
|
|
323
|
+
|
|
324
|
+
if (typeof options.container === 'string') {
|
|
325
|
+
container = document.querySelector(options.container);
|
|
326
|
+
} else if (options.container instanceof HTMLElement) {
|
|
327
|
+
container = options.container;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return container || window;
|
|
331
|
+
},
|
|
332
|
+
set: function set(value) {
|
|
333
|
+
options.container = value;
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
debounce: {
|
|
337
|
+
get: function get() {
|
|
338
|
+
if (options.debounce === false) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return parseInt(options.debounce, 10) || 100;
|
|
343
|
+
},
|
|
344
|
+
set: function set(value) {
|
|
345
|
+
options.debounce = value;
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
tolerance: {
|
|
349
|
+
get: function get() {
|
|
350
|
+
return parseInt(options.tolerance, 10) || 0;
|
|
351
|
+
},
|
|
352
|
+
set: function set(value) {
|
|
353
|
+
options.tolerance = value;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
Object.defineProperty(this, '_scroll', {
|
|
359
|
+
enumerable: false,
|
|
360
|
+
configurable: false,
|
|
361
|
+
writable: false,
|
|
362
|
+
value: this._debouncedScroll.call(this)
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
this.attach();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
Object.defineProperties(OnScreen.prototype, {
|
|
369
|
+
_debouncedScroll: {
|
|
370
|
+
configurable: false,
|
|
371
|
+
writable: false,
|
|
372
|
+
enumerable: false,
|
|
373
|
+
value: debouncedScroll
|
|
374
|
+
},
|
|
375
|
+
attach: {
|
|
376
|
+
configurable: false,
|
|
377
|
+
writable: false,
|
|
378
|
+
enumerable: false,
|
|
379
|
+
value: attach
|
|
380
|
+
},
|
|
381
|
+
destroy: {
|
|
382
|
+
configurable: false,
|
|
383
|
+
writable: false,
|
|
384
|
+
enumerable: false,
|
|
385
|
+
value: destroy
|
|
386
|
+
},
|
|
387
|
+
off: {
|
|
388
|
+
configurable: false,
|
|
389
|
+
writable: false,
|
|
390
|
+
enumerable: false,
|
|
391
|
+
value: off
|
|
392
|
+
},
|
|
393
|
+
on: {
|
|
394
|
+
configurable: false,
|
|
395
|
+
writable: false,
|
|
396
|
+
enumerable: false,
|
|
397
|
+
value: on
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
OnScreen.check = inViewport;
|
|
402
|
+
|
|
403
|
+
export default OnScreen;
|
|
404
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):global.OnScreen=factory()}(this,function(){"use strict";function observeDOM(obj,callback){var MutationObserver=window.MutationObserver||window.WebKitMutationObserver;if(MutationObserver){var obs=new MutationObserver(callback);return obs.observe(obj,{childList:!0,subtree:!0}),obs}return obj.addEventListener("DOMNodeInserted",callback,!1),obj.addEventListener("DOMNodeRemoved",callback,!1),null}function attach(){var _this=this,container=this.options.container;if(container instanceof HTMLElement){var style=window.getComputedStyle(container);"static"===style.position&&(container.style.position="relative")}this._observer=observeDOM(document.querySelector("body"),function(){Object.keys(_this.trackedElements).forEach(function(element){_this.on("enter",element),_this.on("leave",element)})}),container.addEventListener("scroll",this._scroll,{passive:!0}),window.addEventListener("resize",this._scroll,{passive:!0}),this._scroll(),this.attached=!0}function inViewport(el){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:0};if(!el)throw new Error("You should specify the element you want to test");"string"==typeof el&&(el=document.querySelector(el));var elRect=el.getBoundingClientRect();return elRect.bottom-options.tolerance>0&&elRect.right-options.tolerance>0&&elRect.left+options.tolerance<(window.innerWidth||document.documentElement.clientWidth)&&elRect.top+options.tolerance<(window.innerHeight||document.documentElement.clientHeight)}function inContainer(el){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:0,container:""};if(!el)throw new Error("You should specify the element you want to test");if("string"==typeof el&&(el=document.querySelector(el)),"string"==typeof options&&(options={tolerance:0,container:document.querySelector(options)}),"string"==typeof options.container&&(options.container=document.querySelector(options.container)),options instanceof HTMLElement&&(options={tolerance:0,container:options}),!options.container)throw new Error("You should specify a container element");var containerRect=options.container.getBoundingClientRect();return el.offsetTop+el.clientHeight-options.tolerance>options.container.scrollTop&&el.offsetLeft+el.clientWidth-options.tolerance>options.container.scrollLeft&&el.offsetLeft+options.tolerance<containerRect.width+options.container.scrollLeft&&el.offsetTop+options.tolerance<containerRect.height+options.container.scrollTop}function eventHandler(){var trackedElements=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:0},selectors=Object.keys(trackedElements),testVisibility=void 0;selectors.length&&(testVisibility=options.container===window?inViewport:inContainer,selectors.forEach(function(selector){trackedElements[selector].nodes.forEach(function(item){if(testVisibility(item.node,options)?(item.wasVisible=item.isVisible,item.isVisible=!0):(item.wasVisible=item.isVisible,item.isVisible=!1),item.isVisible===!0&&item.wasVisible===!1){if(!trackedElements[selector].enter)return;Object.keys(trackedElements[selector].enter).forEach(function(callback){"function"==typeof trackedElements[selector].enter[callback]&&trackedElements[selector].enter[callback](item.node,"enter")})}if(item.isVisible===!1&&item.wasVisible===!0){if(!trackedElements[selector].leave)return;Object.keys(trackedElements[selector].leave).forEach(function(callback){"function"==typeof trackedElements[selector].leave[callback]&&trackedElements[selector].leave[callback](item.node,"leave")})}})}))}function debouncedScroll(){var _this=this,timeout=void 0;return this.options.debounce===!1?function(){return eventHandler(_this.trackedElements,_this.options)}:function(){clearTimeout(timeout),timeout=setTimeout(function(){eventHandler(_this.trackedElements,_this.options)},_this.options.debounce)}}function destroy(){this._observer instanceof MutationObserver&&this._observer.disconnect(),this.options.container.removeEventListener("scroll",this._scroll),window.removeEventListener("resize",this._scroll),this.attached=!1}function off(event,selector,handler){var enterCallbacks=Object.keys(this.trackedElements[selector].enter||{}),leaveCallbacks=Object.keys(this.trackedElements[selector].leave||{});if({}.hasOwnProperty.call(this.trackedElements,selector))if(handler){if(this.trackedElements[selector][event]){var callbackName="function"==typeof handler?handler.name:handler;delete this.trackedElements[selector][event][callbackName]}}else delete this.trackedElements[selector][event];enterCallbacks.length||leaveCallbacks.length||delete this.trackedElements[selector]}function on(event,selector,callback){var allowed=["enter","leave"];if(!event)throw new Error("No event given. Choose either enter or leave");if(!selector)throw new Error("No selector to track");if(allowed.indexOf(event)<0)throw new Error(event+" event is not supported");({}).hasOwnProperty.call(this.trackedElements,selector)||(this.trackedElements[selector]={}),this.trackedElements[selector].nodes=[];for(var i=0,elems=document.querySelectorAll(selector);i<elems.length;i++){var item={isVisible:!1,wasVisible:!1,node:elems[i]};this.trackedElements[selector].nodes.push(item)}"function"==typeof callback&&(this.trackedElements[selector][event]||(this.trackedElements[selector][event]={}),this.trackedElements[selector][event][callback.name||"anonymous"]=callback)}function OnScreen(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{tolerance:0,debounce:100,container:window};this.options={},this.trackedElements={},Object.defineProperties(this.options,{container:{configurable:!1,enumerable:!1,get:function(){var container=void 0;return"string"==typeof options.container?container=document.querySelector(options.container):options.container instanceof HTMLElement&&(container=options.container),container||window},set:function(value){options.container=value}},debounce:{get:function(){return options.debounce===!1?!1:parseInt(options.debounce,10)||100},set:function(value){options.debounce=value}},tolerance:{get:function(){return parseInt(options.tolerance,10)||0},set:function(value){options.tolerance=value}}}),Object.defineProperty(this,"_scroll",{enumerable:!1,configurable:!1,writable:!1,value:this._debouncedScroll.call(this)}),this.attach()}return Object.defineProperties(OnScreen.prototype,{_debouncedScroll:{configurable:!1,writable:!1,enumerable:!1,value:debouncedScroll},attach:{configurable:!1,writable:!1,enumerable:!1,value:attach},destroy:{configurable:!1,writable:!1,enumerable:!1,value:destroy},off:{configurable:!1,writable:!1,enumerable:!1,value:off},on:{configurable:!1,writable:!1,enumerable:!1,value:on}}),OnScreen.check=inViewport,OnScreen});
|