criss-cross
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -10,2 +10,8 @@ # Changelog | ||
## [0.0.8] - 2017-11-20 | ||
### Added | ||
- add `force` for update | ||
## [0.0.7] - 2017-11-20 | ||
@@ -12,0 +18,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("crissCross",[],t):"object"==typeof exports?exports.crissCross=t():e.crissCross=t()}(this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ENTER_VIEWPORT="enterViewport",t.FULLY_ENTER_VIEWPORT="fullyEnterViewport",t.EXIT_VIEWPORT="exitViewport",t.FULLY_EXIT_VIEWPORT="fullyExitViewport",t.VISIBILITY_CHANGE="visibilityChange",t.STATE_CHANGE="stateChange"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),o=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=new o.default,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(0),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),l=r(3),a=function(e){return e&&e.__esModule?e:{default:e}}(l),f=new WeakMap,c=new WeakMap,p=function(){function e(){i(this,e),f.set(this,[]),c.set(this,[]),this._intersected=this._intersected.bind(this)}return n(e,[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n,u=t;if("string"==typeof u&&(u=document.querySelector(t)),!(u&&u instanceof HTMLElement))throw new Error("[🎤 criss-cross] Invalid target. Should be an HTMLElement.");if(null!==s&&!s.contains(u))throw new Error("[🎤 criss-cross] Invalid target. Should be a child of root.");var l=e._setOptions(o,s),a=this._createObserver(l),f=this._createItem(u,a);return f.init(),f}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n;t.pause(),this._destroyObserver(t.observer);var u=e._setOptions(o,s),l=this._createObserver(u);t.observer=l,t.update()}},{key:"destroy",value:function(){var e=f.get(this),t=c.get(this);e.length=0,t.forEach(function(e){e.disconnect()}),t.length=0}},{key:"_intersected",value:function(e,t){var r=this._getItems(t);e.forEach(function(e){var t=r.find(function(t){return t.isLocked?t.$ghost===e.target:t.$el===e.target});t.isBeforeViewport=e.boundingClientRect.top<e.rootBounds.top,t.isAfterViewport=e.boundingClientRect.top+e.boundingClientRect.height>e.rootBounds.top+e.rootBounds.height,e.isIntersecting?(t.isInViewport=!0,e.intersectionRatio>=1?t.isFullyInViewport=!0:t.isFullyInViewport=!1):(t.isInViewport=!1,t.isFullyInViewport=!1),void 0===t.wasInViewport?(t.isInViewport&&!t.isFullyInViewport&&(t.isAfterViewport&&t.trigger(u.ENTER_VIEWPORT),t.isBeforeViewport&&t.trigger(u.EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),t.isFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),!t.isInViewport&&t.isBeforeViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.FULLY_EXIT_VIEWPORT))):(t.isInViewport&&!t.wasInViewport&&(t.trigger(u.ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE)),t.isFullyInViewport&&!t.wasFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isFullyInViewport&&t.wasFullyInViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isInViewport&&t.wasInViewport&&(t.trigger(u.FULLY_EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE))),t.wasBeforeViewport=t.isBeforeViewport,t.wasInViewport=t.isInViewport,t.wasFullyInViewport=t.isFullyInViewport,t.wasAfterViewport=t.isAfterViewport})}},{key:"_createObserver",value:function(e){var t=this._getObserver(e);if(t)return t;var r=new IntersectionObserver(this._intersected,e);return this._addObserver(r),r}},{key:"_addObserver",value:function(e){c.get(this).push(e)}},{key:"_getObserver",value:function(e){return c.get(this).find(function(t){return t.root===e.root&&t.rootMargin===e.rootMargin})}},{key:"_destroyObserver",value:function(e){var t=c.get(this),r=t.indexOf(e);e.disconnect(),t.splice(r,1)}},{key:"_createItem",value:function(e,t){var r=new a.default(e,t,this);return this._addItem(r),r}},{key:"_addItem",value:function(e){f.get(this).push(e)}},{key:"_getItems",value:function(e){return f.get(this).filter(function(t){return t.observer===e})}},{key:"_destroyItem",value:function(e){var t=f.get(this),r=t.indexOf(e),i=e.observer;t.splice(r,1),0===this._getItems(i).length&&this._destroyObserver(i)}}],[{key:"_setOptions",value:function(e,t){var r={root:null,rootMargin:"0px 0px 0px 0px",threshold:[0,1]};if("object"===(void 0===e?"undefined":o(e))){var i=e.top||0,n=e.bottom||0;r.rootMargin=i+"px 0px "+n+"px 0px"}else r.rootMargin=e+"px 0px "+e+"px 0px";return r.root=t,r}}]),e}();t.default=p,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=r(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),u=r(4),l=Object.values(s),a=new WeakMap,f=function(){function e(t,r,o){var n=this;i(this,e),this.$el=t,this.observer=r,this.manager=o,this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,a.set(this,{}),l.forEach(function(e){a.get(n)[e]=[]})}return o(e,[{key:"init",value:function(){this.observe()}},{key:"observe",value:function(){this.observer.observe(this.target)}},{key:"pause",value:function(){this.observer.unobserve(this.target)}},{key:"resume",value:function(){this.observe()}},{key:"update",value:function(){this.isLocked&&(this.$ghost.style.height=(0,u.$outerHeight)(this.$el)+"px"),this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,this.observe()}},{key:"destroy",value:function(){this.pause(),this.manager._destroyItem(this)}},{key:"lock",value:function(){if(!this.isLocked){if("absolute"!==getComputedStyle(this.$el).position)throw new Error("[🎤 criss-cross] Target should be in absolute position.");for(var e=this.$el.cloneNode(!1),t=e.classList;t.length>0;)t.remove(t.item(0));e.style.position="absolute",e.style.top=this.$el.offsetTop+"px",e.style.left=this.$el.offsetLeft+"px",e.style.width="100%",e.style.height=(0,u.$outerHeight)(this.$el)+"px",e.style.visibility="hidden",e.style.opacity=0,this.$ghost=e,this.observer.unobserve(this.$el),this.observer.observe(this.$ghost),this.isLocked=!0,(0,u.$insertAfter)(e,this.$el)}}},{key:"unlock",value:function(){this.isLocked&&(this.observer.unobserve(this.$ghost),this.observer.observe(this.$el),this.isLocked=!1,this.$ghost.remove())}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=a.get(this);if(!i[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");i[e].push({cb:t,one:r})}},{key:"one",value:function(e,t){this.on(e,t,!0)}},{key:"off",value:function(e,t){var r=a.get(this);if(!r[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");r[e].some(function(i,o){return i.cb===t&&r[e].splice(o,1),i.cb===t})}},{key:"trigger",value:function(e){var t=this,r=a.get(this);r[e].length>0&&r[e].forEach(function(r){r.cb(t),r.one&&t.off(e,r.cb)})}},{key:"target",get:function(){return this.isLocked?this.$ghost:this.$el}}]),e}();l.forEach(function(e){f.prototype[e]=function(t){this.on(e,t)}}),t.default=f,e.exports=t.default},function(e,t,r){"use strict";function i(e){var t=e.offsetWidth,r=getComputedStyle(e);return t+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function o(e){var t=e.offsetHeight,r=getComputedStyle(e);return t+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function n(e,t){t.parentNode.insertBefore(e,t.nextSibling)}Object.defineProperty(t,"__esModule",{value:!0}),t.$outerWidth=i,t.$outerHeight=o,t.$insertAfter=n}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("crissCross",[],t):"object"==typeof exports?exports.crissCross=t():e.crissCross=t()}(this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ENTER_VIEWPORT="enterViewport",t.FULLY_ENTER_VIEWPORT="fullyEnterViewport",t.EXIT_VIEWPORT="exitViewport",t.FULLY_EXIT_VIEWPORT="fullyExitViewport",t.VISIBILITY_CHANGE="visibilityChange",t.STATE_CHANGE="stateChange"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),o=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=new o.default,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(0),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),l=r(3),a=function(e){return e&&e.__esModule?e:{default:e}}(l),f=new WeakMap,c=new WeakMap,p=function(){function e(){i(this,e),f.set(this,[]),c.set(this,[]),this._intersected=this._intersected.bind(this)}return n(e,[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n,u=t;if("string"==typeof u&&(u=document.querySelector(t)),!(u&&u instanceof HTMLElement))throw new Error("[🎤 criss-cross] Invalid target. Should be an HTMLElement.");if(null!==s&&!s.contains(u))throw new Error("[🎤 criss-cross] Invalid target. Should be a child of root.");var l=e._setOptions(o,s),a=this._createObserver(l),f=this._createItem(u,a);return f.init(),f}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.pause(),this._destroyObserver(t.observer);var l=e._setOptions(o,s),a=this._createObserver(l);t.observer=a,t.update(u)}},{key:"destroy",value:function(){var e=f.get(this),t=c.get(this);e.length=0,t.forEach(function(e){e.disconnect()}),t.length=0}},{key:"_intersected",value:function(e,t){var r=this._getItems(t);e.forEach(function(e){var t=r.find(function(t){return t.isLocked?t.$ghost===e.target:t.$el===e.target});t.isBeforeViewport=e.boundingClientRect.top<e.rootBounds.top,t.isAfterViewport=e.boundingClientRect.top+e.boundingClientRect.height>e.rootBounds.top+e.rootBounds.height,e.isIntersecting?(t.isInViewport=!0,e.intersectionRatio>=1?t.isFullyInViewport=!0:t.isFullyInViewport=!1):(t.isInViewport=!1,t.isFullyInViewport=!1),void 0===t.wasInViewport?(t.isInViewport&&!t.isFullyInViewport&&(t.isAfterViewport&&t.trigger(u.ENTER_VIEWPORT),t.isBeforeViewport&&t.trigger(u.EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),t.isFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),!t.isInViewport&&t.isBeforeViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.FULLY_EXIT_VIEWPORT))):(t.isInViewport&&!t.wasInViewport&&(t.trigger(u.ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE)),t.isFullyInViewport&&!t.wasFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isFullyInViewport&&t.wasFullyInViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isInViewport&&t.wasInViewport&&(t.trigger(u.FULLY_EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE))),t.wasBeforeViewport=t.isBeforeViewport,t.wasInViewport=t.isInViewport,t.wasFullyInViewport=t.isFullyInViewport,t.wasAfterViewport=t.isAfterViewport})}},{key:"_createObserver",value:function(e){var t=this._getObserver(e);if(t)return t;var r=new IntersectionObserver(this._intersected,e);return this._addObserver(r),r}},{key:"_addObserver",value:function(e){c.get(this).push(e)}},{key:"_getObserver",value:function(e){return c.get(this).find(function(t){return t.root===e.root&&t.rootMargin===e.rootMargin})}},{key:"_destroyObserver",value:function(e){var t=c.get(this),r=t.indexOf(e);e.disconnect(),t.splice(r,1)}},{key:"_createItem",value:function(e,t){var r=new a.default(e,t,this);return this._addItem(r),r}},{key:"_addItem",value:function(e){f.get(this).push(e)}},{key:"_getItems",value:function(e){return f.get(this).filter(function(t){return t.observer===e})}},{key:"_destroyItem",value:function(e){var t=f.get(this),r=t.indexOf(e),i=e.observer;t.splice(r,1),0===this._getItems(i).length&&this._destroyObserver(i)}}],[{key:"_setOptions",value:function(e,t){var r={root:null,rootMargin:"0px 0px 0px 0px",threshold:[0,1]};if("object"===(void 0===e?"undefined":o(e))){var i=e.top||0,n=e.bottom||0;r.rootMargin=i+"px 0px "+n+"px 0px"}else r.rootMargin=e+"px 0px "+e+"px 0px";return r.root=t,r}}]),e}();t.default=p,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=r(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),u=r(4),l=Object.values(s),a=new WeakMap,f=function(){function e(t,r,o){var n=this;i(this,e),this.$el=t,this.observer=r,this.manager=o,this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,a.set(this,{}),l.forEach(function(e){a.get(n)[e]=[]})}return o(e,[{key:"init",value:function(){this.observe()}},{key:"observe",value:function(){this.observer.observe(this.target)}},{key:"pause",value:function(){this.observer.unobserve(this.target)}},{key:"resume",value:function(){this.observe()}},{key:"update",value:function(e){this.isLocked&&(this.$ghost.style.height=(0,u.$outerHeight)(this.$el)+"px"),e&&(this.wasInViewport=void 0),this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,this.observe()}},{key:"destroy",value:function(){this.pause(),this.manager._destroyItem(this)}},{key:"lock",value:function(){if(!this.isLocked){if("absolute"!==getComputedStyle(this.$el).position)throw new Error("[🎤 criss-cross] Target should be in absolute position.");for(var e=this.$el.cloneNode(!1),t=e.classList;t.length>0;)t.remove(t.item(0));e.style.position="absolute",e.style.top=this.$el.offsetTop+"px",e.style.left=this.$el.offsetLeft+"px",e.style.width="100%",e.style.height=(0,u.$outerHeight)(this.$el)+"px",e.style.visibility="hidden",e.style.opacity=0,this.$ghost=e,this.observer.unobserve(this.$el),this.observer.observe(this.$ghost),this.isLocked=!0,(0,u.$insertAfter)(e,this.$el)}}},{key:"unlock",value:function(){this.isLocked&&(this.observer.unobserve(this.$ghost),this.observer.observe(this.$el),this.isLocked=!1,this.$ghost.remove())}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=a.get(this);if(!i[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");i[e].push({cb:t,one:r})}},{key:"one",value:function(e,t){this.on(e,t,!0)}},{key:"off",value:function(e,t){var r=a.get(this);if(!r[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");r[e].some(function(i,o){return i.cb===t&&r[e].splice(o,1),i.cb===t})}},{key:"trigger",value:function(e){var t=this,r=a.get(this);r[e].length>0&&r[e].forEach(function(r){r.cb(t),r.one&&t.off(e,r.cb)})}},{key:"target",get:function(){return this.isLocked?this.$ghost:this.$el}}]),e}();l.forEach(function(e){f.prototype[e]=function(t){this.on(e,t)}}),t.default=f,e.exports=t.default},function(e,t,r){"use strict";function i(e){var t=e.offsetWidth,r=getComputedStyle(e);return t+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function o(e){var t=e.offsetHeight,r=getComputedStyle(e);return t+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function n(e,t){t.parentNode.insertBefore(e,t.nextSibling)}Object.defineProperty(t,"__esModule",{value:!0}),t.$outerWidth=i,t.$outerHeight=o,t.$insertAfter=n}])}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("crissCross",[],t):"object"==typeof exports?exports.crissCross=t():e.crissCross=t()}(this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ENTER_VIEWPORT="enterViewport",t.FULLY_ENTER_VIEWPORT="fullyEnterViewport",t.EXIT_VIEWPORT="exitViewport",t.FULLY_EXIT_VIEWPORT="fullyExitViewport",t.VISIBILITY_CHANGE="visibilityChange",t.STATE_CHANGE="stateChange"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),o=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=new o.default,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(0),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),l=r(3),a=function(e){return e&&e.__esModule?e:{default:e}}(l),f=new WeakMap,c=new WeakMap,p=function(){function e(){i(this,e),f.set(this,[]),c.set(this,[]),this._intersected=this._intersected.bind(this)}return n(e,[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n,u=t;if("string"==typeof u&&(u=document.querySelector(t)),!(u&&u instanceof HTMLElement))throw new Error("[🎤 criss-cross] Invalid target. Should be an HTMLElement.");if(null!==s&&!s.contains(u))throw new Error("[🎤 criss-cross] Invalid target. Should be a child of root.");var l=e._setOptions(o,s),a=this._createObserver(l),f=this._createItem(u,a);return f.init(),f}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n;t.pause(),this._destroyObserver(t.observer);var u=e._setOptions(o,s),l=this._createObserver(u);t.observer=l,t.update()}},{key:"destroy",value:function(){var e=f.get(this),t=c.get(this);e.length=0,t.forEach(function(e){e.disconnect()}),t.length=0}},{key:"_intersected",value:function(e,t){var r=this._getItems(t);e.forEach(function(e){var t=r.find(function(t){return t.isLocked?t.$ghost===e.target:t.$el===e.target});t.isBeforeViewport=e.boundingClientRect.top<e.rootBounds.top,t.isAfterViewport=e.boundingClientRect.top+e.boundingClientRect.height>e.rootBounds.top+e.rootBounds.height,e.isIntersecting?(t.isInViewport=!0,e.intersectionRatio>=1?t.isFullyInViewport=!0:t.isFullyInViewport=!1):(t.isInViewport=!1,t.isFullyInViewport=!1),void 0===t.wasInViewport?(t.isInViewport&&!t.isFullyInViewport&&(t.isAfterViewport&&t.trigger(u.ENTER_VIEWPORT),t.isBeforeViewport&&t.trigger(u.EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),t.isFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),!t.isInViewport&&t.isBeforeViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.FULLY_EXIT_VIEWPORT))):(t.isInViewport&&!t.wasInViewport&&(t.trigger(u.ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE)),t.isFullyInViewport&&!t.wasFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isFullyInViewport&&t.wasFullyInViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isInViewport&&t.wasInViewport&&(t.trigger(u.FULLY_EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE))),t.wasBeforeViewport=t.isBeforeViewport,t.wasInViewport=t.isInViewport,t.wasFullyInViewport=t.isFullyInViewport,t.wasAfterViewport=t.isAfterViewport})}},{key:"_createObserver",value:function(e){var t=this._getObserver(e);if(t)return t;var r=new IntersectionObserver(this._intersected,e);return this._addObserver(r),r}},{key:"_addObserver",value:function(e){c.get(this).push(e)}},{key:"_getObserver",value:function(e){return c.get(this).find(function(t){return t.root===e.root&&t.rootMargin===e.rootMargin})}},{key:"_destroyObserver",value:function(e){var t=c.get(this),r=t.indexOf(e);e.disconnect(),t.splice(r,1)}},{key:"_createItem",value:function(e,t){var r=new a.default(e,t,this);return this._addItem(r),r}},{key:"_addItem",value:function(e){f.get(this).push(e)}},{key:"_getItems",value:function(e){return f.get(this).filter(function(t){return t.observer===e})}},{key:"_destroyItem",value:function(e){var t=f.get(this),r=t.indexOf(e),i=e.observer;t.splice(r,1),0===this._getItems(i).length&&this._destroyObserver(i)}}],[{key:"_setOptions",value:function(e,t){var r={root:null,rootMargin:"0px 0px 0px 0px",threshold:[0,1]};if("object"===(void 0===e?"undefined":o(e))){var i=e.top||0,n=e.bottom||0;r.rootMargin=i+"px 0px "+n+"px 0px"}else r.rootMargin=e+"px 0px "+e+"px 0px";return r.root=t,r}}]),e}();t.default=p,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=r(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),u=r(4),l=Object.values(s),a=new WeakMap,f=function(){function e(t,r,o){var n=this;i(this,e),this.$el=t,this.observer=r,this.manager=o,this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,a.set(this,{}),l.forEach(function(e){a.get(n)[e]=[]})}return o(e,[{key:"init",value:function(){this.observe()}},{key:"observe",value:function(){this.observer.observe(this.target)}},{key:"pause",value:function(){this.observer.unobserve(this.target)}},{key:"resume",value:function(){this.observe()}},{key:"update",value:function(){this.isLocked&&(this.$ghost.style.height=(0,u.$outerHeight)(this.$el)+"px"),this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,this.observe()}},{key:"destroy",value:function(){this.pause(),this.manager._destroyItem(this)}},{key:"lock",value:function(){if(!this.isLocked){if("absolute"!==getComputedStyle(this.$el).position)throw new Error("[🎤 criss-cross] Target should be in absolute position.");for(var e=this.$el.cloneNode(!1),t=e.classList;t.length>0;)t.remove(t.item(0));e.style.position="absolute",e.style.top=this.$el.offsetTop+"px",e.style.left=this.$el.offsetLeft+"px",e.style.width="100%",e.style.height=(0,u.$outerHeight)(this.$el)+"px",e.style.visibility="hidden",e.style.opacity=0,this.$ghost=e,this.observer.unobserve(this.$el),this.observer.observe(this.$ghost),this.isLocked=!0,(0,u.$insertAfter)(e,this.$el)}}},{key:"unlock",value:function(){this.isLocked&&(this.observer.unobserve(this.$ghost),this.observer.observe(this.$el),this.isLocked=!1,this.$ghost.remove())}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=a.get(this);if(!i[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");i[e].push({cb:t,one:r})}},{key:"one",value:function(e,t){this.on(e,t,!0)}},{key:"off",value:function(e,t){var r=a.get(this);if(!r[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");r[e].some(function(i,o){return i.cb===t&&r[e].splice(o,1),i.cb===t})}},{key:"trigger",value:function(e){var t=this,r=a.get(this);r[e].length>0&&r[e].forEach(function(r){r.cb(t),r.one&&t.off(e,r.cb)})}},{key:"target",get:function(){return this.isLocked?this.$ghost:this.$el}}]),e}();l.forEach(function(e){f.prototype[e]=function(t){this.on(e,t)}}),t.default=f,e.exports=t.default},function(e,t,r){"use strict";function i(e){var t=e.offsetWidth,r=getComputedStyle(e);return t+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function o(e){var t=e.offsetHeight,r=getComputedStyle(e);return t+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function n(e,t){t.parentNode.insertBefore(e,t.nextSibling)}Object.defineProperty(t,"__esModule",{value:!0}),t.$outerWidth=i,t.$outerHeight=o,t.$insertAfter=n}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("crissCross",[],t):"object"==typeof exports?exports.crissCross=t():e.crissCross=t()}(this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ENTER_VIEWPORT="enterViewport",t.FULLY_ENTER_VIEWPORT="fullyEnterViewport",t.EXIT_VIEWPORT="exitViewport",t.FULLY_EXIT_VIEWPORT="fullyExitViewport",t.VISIBILITY_CHANGE="visibilityChange",t.STATE_CHANGE="stateChange"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),o=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=new o.default,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(0),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),l=r(3),a=function(e){return e&&e.__esModule?e:{default:e}}(l),f=new WeakMap,c=new WeakMap,p=function(){function e(){i(this,e),f.set(this,[]),c.set(this,[]),this._intersected=this._intersected.bind(this)}return n(e,[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n,u=t;if("string"==typeof u&&(u=document.querySelector(t)),!(u&&u instanceof HTMLElement))throw new Error("[🎤 criss-cross] Invalid target. Should be an HTMLElement.");if(null!==s&&!s.contains(u))throw new Error("[🎤 criss-cross] Invalid target. Should be a child of root.");var l=e._setOptions(o,s),a=this._createObserver(l),f=this._createItem(u,a);return f.init(),f}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.offset,o=void 0===i?0:i,n=r.root,s=void 0===n?null:n,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.pause(),this._destroyObserver(t.observer);var l=e._setOptions(o,s),a=this._createObserver(l);t.observer=a,t.update(u)}},{key:"destroy",value:function(){var e=f.get(this),t=c.get(this);e.length=0,t.forEach(function(e){e.disconnect()}),t.length=0}},{key:"_intersected",value:function(e,t){var r=this._getItems(t);e.forEach(function(e){var t=r.find(function(t){return t.isLocked?t.$ghost===e.target:t.$el===e.target});t.isBeforeViewport=e.boundingClientRect.top<e.rootBounds.top,t.isAfterViewport=e.boundingClientRect.top+e.boundingClientRect.height>e.rootBounds.top+e.rootBounds.height,e.isIntersecting?(t.isInViewport=!0,e.intersectionRatio>=1?t.isFullyInViewport=!0:t.isFullyInViewport=!1):(t.isInViewport=!1,t.isFullyInViewport=!1),void 0===t.wasInViewport?(t.isInViewport&&!t.isFullyInViewport&&(t.isAfterViewport&&t.trigger(u.ENTER_VIEWPORT),t.isBeforeViewport&&t.trigger(u.EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),t.isFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE)),!t.isInViewport&&t.isBeforeViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.FULLY_EXIT_VIEWPORT))):(t.isInViewport&&!t.wasInViewport&&(t.trigger(u.ENTER_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE)),t.isFullyInViewport&&!t.wasFullyInViewport&&(t.trigger(u.FULLY_ENTER_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isFullyInViewport&&t.wasFullyInViewport&&(t.trigger(u.EXIT_VIEWPORT),t.trigger(u.STATE_CHANGE)),!t.isInViewport&&t.wasInViewport&&(t.trigger(u.FULLY_EXIT_VIEWPORT),t.trigger(u.VISIBILITY_CHANGE),t.trigger(u.STATE_CHANGE))),t.wasBeforeViewport=t.isBeforeViewport,t.wasInViewport=t.isInViewport,t.wasFullyInViewport=t.isFullyInViewport,t.wasAfterViewport=t.isAfterViewport})}},{key:"_createObserver",value:function(e){var t=this._getObserver(e);if(t)return t;var r=new IntersectionObserver(this._intersected,e);return this._addObserver(r),r}},{key:"_addObserver",value:function(e){c.get(this).push(e)}},{key:"_getObserver",value:function(e){return c.get(this).find(function(t){return t.root===e.root&&t.rootMargin===e.rootMargin})}},{key:"_destroyObserver",value:function(e){var t=c.get(this),r=t.indexOf(e);e.disconnect(),t.splice(r,1)}},{key:"_createItem",value:function(e,t){var r=new a.default(e,t,this);return this._addItem(r),r}},{key:"_addItem",value:function(e){f.get(this).push(e)}},{key:"_getItems",value:function(e){return f.get(this).filter(function(t){return t.observer===e})}},{key:"_destroyItem",value:function(e){var t=f.get(this),r=t.indexOf(e),i=e.observer;t.splice(r,1),0===this._getItems(i).length&&this._destroyObserver(i)}}],[{key:"_setOptions",value:function(e,t){var r={root:null,rootMargin:"0px 0px 0px 0px",threshold:[0,1]};if("object"===(void 0===e?"undefined":o(e))){var i=e.top||0,n=e.bottom||0;r.rootMargin=i+"px 0px "+n+"px 0px"}else r.rootMargin=e+"px 0px "+e+"px 0px";return r.root=t,r}}]),e}();t.default=p,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=r(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),u=r(4),l=Object.values(s),a=new WeakMap,f=function(){function e(t,r,o){var n=this;i(this,e),this.$el=t,this.observer=r,this.manager=o,this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,a.set(this,{}),l.forEach(function(e){a.get(n)[e]=[]})}return o(e,[{key:"init",value:function(){this.observe()}},{key:"observe",value:function(){this.observer.observe(this.target)}},{key:"pause",value:function(){this.observer.unobserve(this.target)}},{key:"resume",value:function(){this.observe()}},{key:"update",value:function(e){this.isLocked&&(this.$ghost.style.height=(0,u.$outerHeight)(this.$el)+"px"),e&&(this.wasInViewport=void 0),this.isInViewport=!1,this.isFullyInViewport=!1,this.isBeforeViewport=!1,this.isAfterViewport=!1,this.observe()}},{key:"destroy",value:function(){this.pause(),this.manager._destroyItem(this)}},{key:"lock",value:function(){if(!this.isLocked){if("absolute"!==getComputedStyle(this.$el).position)throw new Error("[🎤 criss-cross] Target should be in absolute position.");for(var e=this.$el.cloneNode(!1),t=e.classList;t.length>0;)t.remove(t.item(0));e.style.position="absolute",e.style.top=this.$el.offsetTop+"px",e.style.left=this.$el.offsetLeft+"px",e.style.width="100%",e.style.height=(0,u.$outerHeight)(this.$el)+"px",e.style.visibility="hidden",e.style.opacity=0,this.$ghost=e,this.observer.unobserve(this.$el),this.observer.observe(this.$ghost),this.isLocked=!0,(0,u.$insertAfter)(e,this.$el)}}},{key:"unlock",value:function(){this.isLocked&&(this.observer.unobserve(this.$ghost),this.observer.observe(this.$el),this.isLocked=!1,this.$ghost.remove())}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=a.get(this);if(!i[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");i[e].push({cb:t,one:r})}},{key:"one",value:function(e,t){this.on(e,t,!0)}},{key:"off",value:function(e,t){var r=a.get(this);if(!r[e])throw new Error("[🎤 criss-cross] Unavailable listener '"+e+"' ["+l.join(", ")+"]");r[e].some(function(i,o){return i.cb===t&&r[e].splice(o,1),i.cb===t})}},{key:"trigger",value:function(e){var t=this,r=a.get(this);r[e].length>0&&r[e].forEach(function(r){r.cb(t),r.one&&t.off(e,r.cb)})}},{key:"target",get:function(){return this.isLocked?this.$ghost:this.$el}}]),e}();l.forEach(function(e){f.prototype[e]=function(t){this.on(e,t)}}),t.default=f,e.exports=t.default},function(e,t,r){"use strict";function i(e){var t=e.offsetWidth,r=getComputedStyle(e);return t+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function o(e){var t=e.offsetHeight,r=getComputedStyle(e);return t+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function n(e,t){t.parentNode.insertBefore(e,t.nextSibling)}Object.defineProperty(t,"__esModule",{value:!0}),t.$outerWidth=i,t.$outerHeight=o,t.$insertAfter=n}])}); |
@@ -66,2 +66,4 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
item.pause(); | ||
@@ -74,3 +76,3 @@ this._destroyObserver(item.observer); | ||
item.observer = observer; | ||
item.update(); | ||
item.update(force); | ||
} | ||
@@ -77,0 +79,0 @@ }, { |
@@ -55,3 +55,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
key: 'update', | ||
value: function update() { | ||
value: function update(force) { | ||
if (this.isLocked) { | ||
@@ -61,4 +61,5 @@ this.$ghost.style.height = $outerHeight(this.$el) + 'px'; | ||
// !DEV to be tested deeper | ||
// this.wasInViewport = undefined; | ||
if (force) { | ||
this.wasInViewport = undefined; | ||
} | ||
this.isInViewport = false; | ||
@@ -65,0 +66,0 @@ this.isFullyInViewport = false; |
@@ -81,2 +81,4 @@ 'use strict'; | ||
var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
item.pause(); | ||
@@ -89,3 +91,3 @@ this._destroyObserver(item.observer); | ||
item.observer = observer; | ||
item.update(); | ||
item.update(force); | ||
} | ||
@@ -92,0 +94,0 @@ }, { |
@@ -66,3 +66,3 @@ 'use strict'; | ||
key: 'update', | ||
value: function update() { | ||
value: function update(force) { | ||
if (this.isLocked) { | ||
@@ -72,4 +72,5 @@ this.$ghost.style.height = (0, _dom.$outerHeight)(this.$el) + 'px'; | ||
// !DEV to be tested deeper | ||
// this.wasInViewport = undefined; | ||
if (force) { | ||
this.wasInViewport = undefined; | ||
} | ||
this.isInViewport = false; | ||
@@ -76,0 +77,0 @@ this.isFullyInViewport = false; |
{ | ||
"name": "criss-cross", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A simple and fast API to manage viewport and DOM elements intersections as you scroll", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/thierrymichel/criss-cross#readme", |
@@ -106,3 +106,3 @@ # 🎤 criss-cross | ||
### update(watchItem, [options]) | ||
### update(watchItem, [options, force]) | ||
@@ -121,2 +121,9 @@ #### target | ||
#### force | ||
Type: `Boolean` | ||
Default: `false` | ||
Force `was…` properties to be resetted to `undefined` | ||
--- | ||
@@ -123,0 +130,0 @@ |
@@ -48,3 +48,3 @@ import * as events from './event-types'; | ||
root = null, | ||
} = {}) { | ||
} = {}, force = false) { | ||
item.pause(); | ||
@@ -57,3 +57,3 @@ this._destroyObserver(item.observer); | ||
item.observer = observer; | ||
item.update(); | ||
item.update(force); | ||
} | ||
@@ -60,0 +60,0 @@ |
@@ -48,3 +48,3 @@ import * as events from './event-types'; | ||
update() { | ||
update(force) { | ||
if (this.isLocked) { | ||
@@ -54,4 +54,5 @@ this.$ghost.style.height = `${$outerHeight(this.$el)}px`; | ||
// !DEV to be tested deeper | ||
// this.wasInViewport = undefined; | ||
if (force) { | ||
this.wasInViewport = undefined; | ||
} | ||
this.isInViewport = false; | ||
@@ -58,0 +59,0 @@ this.isFullyInViewport = false; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70536
1276
184