ngx-scrollreveal
Version:
Angular directives for ScrollReveal : a JavaScript library for easily animating elements as they enter/leave the viewport.
3 lines (2 loc) • 5.58 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","@angular/common"],t):t(e.ngxScrollreveal={},e.ng.core,e.rxjs,e.ng.common)}(this,function(e,t,n,r){"use strict";var o=function(){function e(){this.delay=0,this.distance="0px",this.duration=600,this.easing="cubic-bezier(0.5, 0, 0, 1)",this.interval=0,this.opacity=0,this.origin="bottom",this.rotate={x:0,y:0,z:0},this.scale=.9,this.cleanup=!1,this.desktop=!0,this.mobile=!0,this.reset=!1,this.useDelay="always",this.viewFactor=.2,this.viewOffset={top:0,right:0,bottom:0,left:0}}return e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),i=function(){function e(){}return Object.defineProperty(e.prototype,"nativeWindow",{get:function(){return"undefined"!=typeof window?window:void 0},enumerable:!0,configurable:!0}),e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var s,c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a=function(){function e(e,t){this.beforeRevealSource=new n.Subject,this.afterRevealSource=new n.Subject,this.beforeResetSource=new n.Subject,this.afterResetSource=new n.Subject,this.beforeReveal$=this.beforeRevealSource.asObservable(),this.afterReveal$=this.afterRevealSource.asObservable(),this.beforeReset$=this.beforeResetSource.asObservable(),this.afterReset$=this.afterResetSource.asObservable(),this.window=t.nativeWindow,this.init(e)}return e.prototype.init=function(e){var t=this;this.window&&(this.config=e,this.config.beforeReveal=function(e){return t.beforeRevealSource.next(e)},this.config.afterReveal=function(e){return t.afterRevealSource.next(e)},this.config.beforeReset=function(e){return t.beforeResetSource.next(e)},this.config.afterReset=function(e){return t.afterResetSource.next(e)},this.sr=ScrollReveal(e))},e.prototype.getConfig=function(){return this.config},e.prototype.reveal=function(e,t){this.window&&e.nativeElement&&this.sr.reveal(e.nativeElement,t)},e.prototype.revealSet=function(e,t,n,r){if(this.window&&e.nativeElement){var o=c({},r,{interval:n});this.sr.reveal(t,o)}},e.prototype.sync=function(){this.window&&this.sr.sync()},e.prototype.destroy=function(){this.window&&this.sr.destroy()},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:o},{type:i}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(o),t.inject(i))},token:e,providedIn:"root"}),e}(),f=function(){function e(e){this.ngsRevealService=e}return e.prototype._initConfig=function(e){e&&"string"==typeof e?this.config=JSON.parse(e):e&&"object"==typeof e&&(this.config=e)},e}(),u=(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=function(e){function n(t,n){var r=e.call(this,n)||this;return r.elementRef=t,r.visibility="hidden",r}return u(n,e),Object.defineProperty(n.prototype,"_config",{set:function(e){this._initConfig(e)},enumerable:!0,configurable:!0}),n.prototype.ngOnInit=function(){this.ngsRevealService.reveal(this.elementRef,this.config)},n.decorators=[{type:t.Directive,args:[{selector:"[ngsReveal]"}]}],n.ctorParameters=function(){return[{type:t.ElementRef},{type:a}]},n.propDecorators={visibility:[{type:t.HostBinding,args:["style.visibility"]}],_config:[{type:t.Input,args:["ngsReveal"]}]},n}(f),p=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=function(e){function n(t,n){var r=e.call(this,n)||this;return r.elementRef=t,r}return p(n,e),Object.defineProperty(n.prototype,"_config",{set:function(e){this._initConfig(e)},enumerable:!0,configurable:!0}),n.prototype.ngOnInit=function(){if(this.ngsSelector||!console)this.ngsRevealService.revealSet(this.elementRef,this.ngsSelector,this.ngsInterval,this.config);else{var e=this.elementRef.nativeElement?this.elementRef.nativeElement.className:"";console.error('[ngx-scrollreveal] You must set "[ngsSelector]" attribute on item \''+e+'\' when using "ngsRevealSet"')}},n.prototype.ngOnChanges=function(e){"ngsSync"in e&&!e.ngsSync.isFirstChange()&&!e.ngsSync.currentValue()&&this.ngsRevealService.sync()},n.decorators=[{type:t.Directive,args:[{selector:"[ngsRevealSet]"}]}],n.ctorParameters=function(){return[{type:t.ElementRef},{type:a}]},n.propDecorators={_config:[{type:t.Input,args:["ngsRevealSet"]}],ngsSelector:[{type:t.Input}],ngsInterval:[{type:t.Input}],ngsSync:[{type:t.Input}]},n}(f),g=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[r.CommonModule],exports:[l,v],declarations:[l,v]}]}],e}();e.WindowService=i,e.NgsRevealService=a,e.NgsRevealConfig=o,e.NgsRevealDirective=l,e.NgsRevealSetDirective=v,e.NgsRevealModule=g,e.ɵa=f,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-scrollreveal.umd.min.js.map