@ng-web-apis/intersection-observer
Advanced tools
Comparing version 1.1.3 to 2.0.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@ng-web-apis/common'), require('@angular/core')) : | ||
typeof define === 'function' && define.amd ? define('@ng-web-apis/intersection-observer', ['exports', 'rxjs', 'rxjs/operators', '@ng-web-apis/common', '@angular/core'], factory) : | ||
(factory((global['ng-web-apis'] = global['ng-web-apis'] || {}, global['ng-web-apis']['intersection-observer'] = {}),global.rxjs,global.rxjs.operators,global.common,global.ng.core)); | ||
}(this, (function (exports,rxjs,operators,common,core) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@ng-web-apis/common')) : | ||
typeof define === 'function' && define.amd ? define('@ng-web-apis/intersection-observer', ['exports', 'rxjs', 'rxjs/operators', '@angular/core', '@ng-web-apis/common'], factory) : | ||
(factory((global['ng-web-apis'] = global['ng-web-apis'] || {}, global['ng-web-apis']['intersection-observer'] = {}),global.rxjs,global.rxjs.operators,global.ng.core,global.common)); | ||
}(this, (function (exports,rxjs,operators,core,common) { 'use strict'; | ||
@@ -59,2 +59,14 @@ /*! ***************************************************************************** | ||
*/ | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** @type {?} */ | ||
@@ -72,7 +84,11 @@ var INTERSECTION_THRESHOLD_DEFAULT = 0; | ||
*/ | ||
/** @type {?} */ | ||
var INTERSECTION_OBSERVER_SUPPORT = new core.InjectionToken('Intersection Observer API support', { | ||
providedIn: 'root', | ||
factory: function () { return !!core.inject(common.WINDOW).IntersectionObserver; }, | ||
}); | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
@@ -83,38 +99,105 @@ /** | ||
*/ | ||
var IntersectionObserverService = /** @class */ (function (_super) { | ||
__extends(IntersectionObserverService, _super); | ||
function IntersectionObserverService(_a, support, rootMargin, threshold, root) { | ||
var IntersectionObserverDirective = /** @class */ (function (_super) { | ||
__extends(IntersectionObserverDirective, _super); | ||
function IntersectionObserverDirective(root, rootMargin, threshold) { | ||
var _this = _super.call(this, function (entries) { | ||
_this.callbacks.forEach(function (callback, element) { | ||
/** @type {?} */ | ||
var filtered = entries.filter(function (_a) { | ||
var target = _a.target; | ||
return target === element; | ||
}); | ||
return filtered.length && callback(filtered, _this); | ||
}); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMarginFactory(rootMargin), | ||
threshold: thresholdFactory(threshold), | ||
}) || this; | ||
_this.callbacks = new Map(); | ||
return _this; | ||
} | ||
/** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.observe = /** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
function (target, callback) { | ||
if (callback === void 0) { | ||
callback = function () { }; | ||
} | ||
_super.prototype.observe.call(this, target); | ||
this.callbacks.set(target, callback); | ||
}; | ||
/** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.unobserve = /** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
function (target) { | ||
_super.prototype.unobserve.call(this, target); | ||
this.callbacks.delete(target); | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.ngOnDestroy = /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
this.disconnect(); | ||
}; | ||
IntersectionObserverDirective.decorators = [ | ||
{ type: core.Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
},] } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverDirective.ctorParameters = function () { | ||
return [ | ||
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [INTERSECTION_ROOT,] }] }, | ||
{ type: undefined, decorators: [{ type: core.Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: core.Attribute, args: ['waIntersectionThreshold',] }] } | ||
]; | ||
}; | ||
return IntersectionObserverDirective; | ||
}(IntersectionObserver)); | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
var IntersectionObserveeService = /** @class */ (function (_super) { | ||
__extends(IntersectionObserveeService, _super); | ||
function IntersectionObserveeService(_a, observer) { | ||
var nativeElement = _a.nativeElement; | ||
var _this = this; | ||
/** @type {?} */ | ||
var observer; | ||
_this = _super.call(this, function (subscriber) { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
observer = new IntersectionObserver(function (entries) { | ||
var _this = _super.call(this, function (subscriber) { | ||
observer.observe(nativeElement, function (entries) { | ||
subscriber.next(entries); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMargin, | ||
threshold: threshold, | ||
}); | ||
observer.observe(nativeElement); | ||
return function () { | ||
observer.unobserve(nativeElement); | ||
}; | ||
}) || this; | ||
return _this.pipe(operators.finalize(function () { return observer.disconnect(); }), operators.share()); | ||
return _this.pipe(operators.share()); | ||
} | ||
IntersectionObserverService.decorators = [ | ||
IntersectionObserveeService.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverService.ctorParameters = function () { | ||
IntersectionObserveeService.ctorParameters = function () { | ||
return [ | ||
{ type: core.ElementRef, decorators: [{ type: core.Inject, args: [core.ElementRef,] }] }, | ||
{ type: Boolean, decorators: [{ type: core.Inject, args: [INTERSECTION_OBSERVER_SUPPORT,] }] }, | ||
{ type: String, decorators: [{ type: core.Inject, args: [INTERSECTION_ROOT_MARGIN,] }] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INTERSECTION_THRESHOLD,] }] }, | ||
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [INTERSECTION_ROOT,] }] } | ||
{ type: IntersectionObserverDirective, decorators: [{ type: core.Inject, args: [IntersectionObserverDirective,] }] } | ||
]; | ||
}; | ||
return IntersectionObserverService; | ||
return IntersectionObserveeService; | ||
}(rxjs.Observable)); | ||
@@ -126,52 +209,21 @@ | ||
*/ | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
var IntersectionObserverDirective = /** @class */ (function () { | ||
function IntersectionObserverDirective(entries$, _margin, _threshold) { | ||
this.waIntersectionObserver = entries$; | ||
// @dynamic | ||
var IntersectionObserveeDirective = /** @class */ (function () { | ||
function IntersectionObserveeDirective(waIntersectionObservee) { | ||
this.waIntersectionObservee = waIntersectionObservee; | ||
} | ||
IntersectionObserverDirective.decorators = [ | ||
IntersectionObserveeDirective.decorators = [ | ||
{ type: core.Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
providers: [ | ||
IntersectionObserverService, | ||
{ | ||
provide: INTERSECTION_ROOT_MARGIN, | ||
deps: [[new core.Attribute('waIntersectionRootMargin')]], | ||
useFactory: rootMarginFactory, | ||
}, | ||
{ | ||
provide: INTERSECTION_THRESHOLD, | ||
deps: [[new core.Attribute('waIntersectionThreshold')]], | ||
useFactory: thresholdFactory, | ||
}, | ||
], | ||
selector: '[waIntersectionObservee]', | ||
outputs: ['waIntersectionObservee'], | ||
providers: [IntersectionObserveeService], | ||
},] } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverDirective.ctorParameters = function () { | ||
IntersectionObserveeDirective.ctorParameters = function () { | ||
return [ | ||
{ type: rxjs.Observable, decorators: [{ type: core.Inject, args: [IntersectionObserverService,] }] }, | ||
{ type: undefined, decorators: [{ type: core.Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: core.Attribute, args: ['waIntersectionThreshold',] }] } | ||
{ type: rxjs.Observable, decorators: [{ type: core.Inject, args: [IntersectionObserveeService,] }] } | ||
]; | ||
}; | ||
IntersectionObserverDirective.propDecorators = { | ||
waIntersectionObserver: [{ type: core.Output }] | ||
}; | ||
return IntersectionObserverDirective; | ||
return IntersectionObserveeDirective; | ||
}()); | ||
@@ -209,4 +261,12 @@ | ||
{ type: core.NgModule, args: [{ | ||
declarations: [IntersectionObserverDirective, IntersectionRootDirective], | ||
exports: [IntersectionObserverDirective, IntersectionRootDirective], | ||
declarations: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
exports: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
},] } | ||
@@ -221,2 +281,7 @@ ]; | ||
*/ | ||
/** @type {?} */ | ||
var INTERSECTION_OBSERVER_SUPPORT = new core.InjectionToken('Intersection Observer API support', { | ||
providedIn: 'root', | ||
factory: function () { return !!core.inject(common.WINDOW).IntersectionObserver; }, | ||
}); | ||
@@ -227,8 +292,56 @@ /** | ||
*/ | ||
var IntersectionObserverService = /** @class */ (function (_super) { | ||
__extends(IntersectionObserverService, _super); | ||
function IntersectionObserverService(_a, support, rootMargin, threshold, root) { | ||
var nativeElement = _a.nativeElement; | ||
var _this = _super.call(this, function (subscriber) { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
/** @type {?} */ | ||
var observer = new IntersectionObserver(function (entries) { | ||
subscriber.next(entries); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMargin, | ||
threshold: threshold, | ||
}); | ||
observer.observe(nativeElement); | ||
return function () { | ||
observer.disconnect(); | ||
}; | ||
}) || this; | ||
return _this.pipe(operators.share()); | ||
} | ||
IntersectionObserverService.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverService.ctorParameters = function () { | ||
return [ | ||
{ type: core.ElementRef, decorators: [{ type: core.Inject, args: [core.ElementRef,] }] }, | ||
{ type: Boolean, decorators: [{ type: core.Inject, args: [INTERSECTION_OBSERVER_SUPPORT,] }] }, | ||
{ type: String, decorators: [{ type: core.Inject, args: [INTERSECTION_ROOT_MARGIN,] }] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INTERSECTION_THRESHOLD,] }] }, | ||
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [INTERSECTION_ROOT,] }] } | ||
]; | ||
}; | ||
return IntersectionObserverService; | ||
}(rxjs.Observable)); | ||
exports.rootMarginFactory = rootMarginFactory; | ||
exports.thresholdFactory = thresholdFactory; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
exports.IntersectionObserveeDirective = IntersectionObserveeDirective; | ||
exports.IntersectionObserverDirective = IntersectionObserverDirective; | ||
exports.IntersectionRootDirective = IntersectionRootDirective; | ||
exports.IntersectionObserverModule = IntersectionObserverModule; | ||
exports.IntersectionObserveeService = IntersectionObserveeService; | ||
exports.IntersectionObserverService = IntersectionObserverService; | ||
@@ -235,0 +348,0 @@ exports.INTERSECTION_ROOT = INTERSECTION_ROOT; |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("rxjs"),require("rxjs/operators"),require("@ng-web-apis/common"),require("@angular/core")):"function"==typeof define&&define.amd?define("@ng-web-apis/intersection-observer",["exports","rxjs","rxjs/operators","@ng-web-apis/common","@angular/core"],r):r((e["ng-web-apis"]=e["ng-web-apis"]||{},e["ng-web-apis"]["intersection-observer"]={}),e.rxjs,e.rxjs.operators,e.common,e.ng.core)}(this,function(e,r,a,t,o){"use strict";var n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)};var p,s=new o.InjectionToken("Root element for IntersectionObserver"),i="0px 0px 0px 0px",c=new o.InjectionToken("rootMargin for IntersectionObserver",{providedIn:"root",factory:function(){return i}}),u=new o.InjectionToken("threshold for IntersectionObserver",{providedIn:"root",factory:function(){return 0}}),d=new o.InjectionToken("Intersection Observer API support",{providedIn:"root",factory:function(){return!!o.inject(t.WINDOW).IntersectionObserver}}),I=(function E(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}(f,p=r.Observable),f.decorators=[{type:o.Injectable}],f.ctorParameters=function(){return[{type:o.ElementRef,decorators:[{type:o.Inject,args:[o.ElementRef]}]},{type:Boolean,decorators:[{type:o.Inject,args:[d]}]},{type:String,decorators:[{type:o.Inject,args:[c]}]},{type:undefined,decorators:[{type:o.Inject,args:[u]}]},{type:undefined,decorators:[{type:o.Optional},{type:o.Inject,args:[s]}]}]},f);function f(e,t,o,n,s){var i,c=e.nativeElement;return(p.call(this,function(r){t||r.error("IntersectionObserver is not supported in your browser"),(i=new IntersectionObserver(function(e){r.next(e)},{root:s&&s.nativeElement,rootMargin:o,threshold:n})).observe(c)})||this).pipe(a.finalize(function(){return i.disconnect()}),a.share())}function v(e){return e||i}function y(e){return e?e.split(",").map(parseFloat):0}var O=(b.decorators=[{type:o.Directive,args:[{selector:"[waIntersectionObserver]",providers:[I,{provide:c,deps:[[new o.Attribute("waIntersectionRootMargin")]],useFactory:v},{provide:u,deps:[[new o.Attribute("waIntersectionThreshold")]],useFactory:y}]}]}],b.ctorParameters=function(){return[{type:r.Observable,decorators:[{type:o.Inject,args:[I]}]},{type:undefined,decorators:[{type:o.Attribute,args:["waIntersectionRootMargin"]}]},{type:undefined,decorators:[{type:o.Attribute,args:["waIntersectionThreshold"]}]}]},b.propDecorators={waIntersectionObserver:[{type:o.Output}]},b);function b(e,r,t){this.waIntersectionObserver=e}var l=(g.decorators=[{type:o.Directive,args:[{selector:"[waIntersectionRoot]",providers:[{provide:s,useExisting:o.ElementRef}]}]}],g);function g(){}var T=(w.decorators=[{type:o.NgModule,args:[{declarations:[O,l],exports:[O,l]}]}],w);function w(){}e.rootMarginFactory=v,e.thresholdFactory=y,e.IntersectionObserverDirective=O,e.IntersectionRootDirective=l,e.IntersectionObserverModule=T,e.IntersectionObserverService=I,e.INTERSECTION_ROOT=s,e.INTERSECTION_ROOT_MARGIN_DEFAULT=i,e.INTERSECTION_ROOT_MARGIN=c,e.INTERSECTION_THRESHOLD_DEFAULT=0,e.INTERSECTION_THRESHOLD=u,e.INTERSECTION_OBSERVER_SUPPORT=d,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("rxjs"),require("rxjs/operators"),require("@angular/core"),require("@ng-web-apis/common")):"function"==typeof define&&define.amd?define("@ng-web-apis/intersection-observer",["exports","rxjs","rxjs/operators","@angular/core","@ng-web-apis/common"],t):t((e["ng-web-apis"]=e["ng-web-apis"]||{},e["ng-web-apis"]["intersection-observer"]={}),e.rxjs,e.rxjs.operators,e.ng.core,e.common)}(this,function(e,t,c,r,n){"use strict";var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function s(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=new r.InjectionToken("Root element for IntersectionObserver"),a="0px 0px 0px 0px",p=new r.InjectionToken("rootMargin for IntersectionObserver",{providedIn:"root",factory:function(){return a}});var u=0,f=new r.InjectionToken("threshold for IntersectionObserver",{providedIn:"root",factory:function(){return u}});var v,l=(s(d,v=IntersectionObserver),d.prototype.observe=function(e,t){void 0===t&&(t=function(){}),v.prototype.observe.call(this,e),this.callbacks.set(e,t)},d.prototype.unobserve=function(e){v.prototype.unobserve.call(this,e),this.callbacks["delete"](e)},d.prototype.ngOnDestroy=function(){this.disconnect()},d.decorators=[{type:r.Directive,args:[{selector:"[waIntersectionObserver]"}]}],d.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Optional},{type:r.Inject,args:[i]}]},{type:undefined,decorators:[{type:r.Attribute,args:["waIntersectionRootMargin"]}]},{type:undefined,decorators:[{type:r.Attribute,args:["waIntersectionThreshold"]}]}]},d);function d(e,t,r){var o=v.call(this,function(n){o.callbacks.forEach(function(e,t){var r=n.filter(function(e){return e.target===t});return r.length&&e(r,o)})},{root:e&&e.nativeElement,rootMargin:function n(e){return e||a}(t),threshold:function s(e){return e?e.split(",").map(parseFloat):u}(r)})||this;return o.callbacks=new Map,o}var I,b=(s(y,I=t.Observable),y.decorators=[{type:r.Injectable}],y.ctorParameters=function(){return[{type:r.ElementRef,decorators:[{type:r.Inject,args:[r.ElementRef]}]},{type:l,decorators:[{type:r.Inject,args:[l]}]}]},y);function y(e,r){var n=e.nativeElement;return(I.call(this,function(t){return r.observe(n,function(e){t.next(e)}),function(){r.unobserve(n)}})||this).pipe(c.share())}var O=(g.decorators=[{type:r.Directive,args:[{selector:"[waIntersectionObservee]",outputs:["waIntersectionObservee"],providers:[b]}]}],g.ctorParameters=function(){return[{type:t.Observable,decorators:[{type:r.Inject,args:[b]}]}]},g);function g(e){this.waIntersectionObservee=e}var E=(h.decorators=[{type:r.Directive,args:[{selector:"[waIntersectionRoot]",providers:[{provide:i,useExisting:r.ElementRef}]}]}],h);function h(){}var j=(R.decorators=[{type:r.NgModule,args:[{declarations:[l,O,E],exports:[l,O,E]}]}],R);function R(){}var T,m=new r.InjectionToken("Intersection Observer API support",{providedIn:"root",factory:function(){return!!r.inject(n.WINDOW).IntersectionObserver}}),w=(s(_,T=t.Observable),_.decorators=[{type:r.Injectable}],_.ctorParameters=function(){return[{type:r.ElementRef,decorators:[{type:r.Inject,args:[r.ElementRef]}]},{type:Boolean,decorators:[{type:r.Inject,args:[m]}]},{type:String,decorators:[{type:r.Inject,args:[p]}]},{type:undefined,decorators:[{type:r.Inject,args:[f]}]},{type:undefined,decorators:[{type:r.Optional},{type:r.Inject,args:[i]}]}]},_);function _(e,r,n,o,s){var i=e.nativeElement;return(T.call(this,function(t){r||t.error("IntersectionObserver is not supported in your browser");var e=new IntersectionObserver(function(e){t.next(e)},{root:s&&s.nativeElement,rootMargin:n,threshold:o});return e.observe(i),function(){e.disconnect()}})||this).pipe(c.share())}e.IntersectionObserveeDirective=O,e.IntersectionObserverDirective=l,e.IntersectionRootDirective=E,e.IntersectionObserverModule=j,e.IntersectionObserveeService=b,e.IntersectionObserverService=w,e.INTERSECTION_ROOT=i,e.INTERSECTION_ROOT_MARGIN_DEFAULT=a,e.INTERSECTION_ROOT_MARGIN=p,e.INTERSECTION_THRESHOLD_DEFAULT=u,e.INTERSECTION_THRESHOLD=f,e.INTERSECTION_OBSERVER_SUPPORT=m,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ng-web-apis-intersection-observer.umd.min.js.map |
@@ -1,7 +0,8 @@ | ||
import { Observable } from 'rxjs'; | ||
export declare function rootMarginFactory(rootMargin: string | null): string; | ||
export declare function thresholdFactory(threshold: string | null): number | number[]; | ||
export declare class IntersectionObserverDirective { | ||
readonly waIntersectionObserver: Observable<IntersectionObserverEntry[]>; | ||
constructor(entries$: Observable<IntersectionObserverEntry[]>, _margin: string | null, _threshold: string | null); | ||
import { ElementRef, OnDestroy } from '@angular/core'; | ||
export declare class IntersectionObserverDirective extends IntersectionObserver implements OnDestroy { | ||
private readonly callbacks; | ||
constructor(root: ElementRef<Element> | null, rootMargin: string | null, threshold: string | null); | ||
observe(target: Element, callback?: IntersectionObserverCallback): void; | ||
unobserve(target: Element): void; | ||
ngOnDestroy(): void; | ||
} |
@@ -5,32 +5,49 @@ /** | ||
*/ | ||
import { Attribute, Directive, Inject, Output } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { IntersectionObserverService } from '../services/intersection-observer.service'; | ||
import { INTERSECTION_ROOT_MARGIN, INTERSECTION_ROOT_MARGIN_DEFAULT, } from '../tokens/intersection-root-margin'; | ||
import { INTERSECTION_THRESHOLD, INTERSECTION_THRESHOLD_DEFAULT, } from '../tokens/intersection-threshold'; | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
export function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
export function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
export class IntersectionObserverDirective { | ||
import { Attribute, Directive, Inject, Optional, } from '@angular/core'; | ||
import { INTERSECTION_ROOT } from '../tokens/intersection-root'; | ||
import { rootMarginFactory } from '../utils/root-margin-factory'; | ||
import { thresholdFactory } from '../utils/threshold-factory'; | ||
export class IntersectionObserverDirective extends IntersectionObserver { | ||
/** | ||
* @param {?} entries$ | ||
* @param {?} _margin | ||
* @param {?} _threshold | ||
* @param {?} root | ||
* @param {?} rootMargin | ||
* @param {?} threshold | ||
*/ | ||
constructor(entries$, _margin, _threshold) { | ||
this.waIntersectionObserver = entries$; | ||
constructor(root, rootMargin, threshold) { | ||
super(entries => { | ||
this.callbacks.forEach((callback, element) => { | ||
/** @type {?} */ | ||
const filtered = entries.filter(({ target }) => target === element); | ||
return filtered.length && callback(filtered, this); | ||
}); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMarginFactory(rootMargin), | ||
threshold: thresholdFactory(threshold), | ||
}); | ||
this.callbacks = new Map(); | ||
} | ||
/** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
observe(target, callback = () => { }) { | ||
super.observe(target); | ||
this.callbacks.set(target, callback); | ||
} | ||
/** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
unobserve(target) { | ||
super.unobserve(target); | ||
this.callbacks.delete(target); | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
ngOnDestroy() { | ||
this.disconnect(); | ||
} | ||
} | ||
@@ -40,15 +57,2 @@ IntersectionObserverDirective.decorators = [ | ||
selector: '[waIntersectionObserver]', | ||
providers: [ | ||
IntersectionObserverService, | ||
{ | ||
provide: INTERSECTION_ROOT_MARGIN, | ||
deps: [[new Attribute('waIntersectionRootMargin')]], | ||
useFactory: rootMarginFactory, | ||
}, | ||
{ | ||
provide: INTERSECTION_THRESHOLD, | ||
deps: [[new Attribute('waIntersectionThreshold')]], | ||
useFactory: thresholdFactory, | ||
}, | ||
], | ||
},] } | ||
@@ -58,13 +62,13 @@ ]; | ||
IntersectionObserverDirective.ctorParameters = () => [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [IntersectionObserverService,] }] }, | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionThreshold',] }] } | ||
]; | ||
IntersectionObserverDirective.propDecorators = { | ||
waIntersectionObserver: [{ type: Output }] | ||
}; | ||
if (false) { | ||
/** @type {?} */ | ||
IntersectionObserverDirective.prototype.waIntersectionObserver; | ||
/** | ||
* @type {?} | ||
* @private | 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cmlidXRlKCd3YUludGVyc2VjdGlvblJvb3RNYXJnaW4nKV1dLFxyXG4gICAgICAgICAgICB1c2VGYWN0b3J5OiByb290TWFyZ2luRmFjdG9yeSxcclxuICAgICAgICB9LFxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgcHJvdmlkZTogSU5URVJTRUNUSU9OX1RIUkVTSE9MRCxcclxuICAgICAgICAgICAgZGVwczogW1tuZXcgQXR0cmlidXRlKCd3YUludGVyc2VjdGlvblRocmVzaG9sZCcpXV0sXHJcbiAgICAgICAgICAgIHVzZUZhY3Rvcnk6IHRocmVzaG9sZEZhY3RvcnksXHJcbiAgICAgICAgfSxcclxuICAgIF0sXHJcbn0pXHJcbmV4cG9ydCBjbGFzcyBJbnRlcnNlY3Rpb25PYnNlcnZlckRpcmVjdGl2ZSB7XHJcbiAgICBAT3V0cHV0KClcclxuICAgIHJlYWRvbmx5IHdhSW50ZXJzZWN0aW9uT2JzZXJ2ZXI6IE9ic2VydmFibGU8SW50ZXJzZWN0aW9uT2JzZXJ2ZXJFbnRyeVtdPjtcclxuXHJcbiAgICBjb25zdHJ1Y3RvcihcclxuICAgICAgICBASW5qZWN0KEludGVyc2VjdGlvbk9ic2VydmVyU2VydmljZSlcclxuICAgICAgICBlbnRyaWVzJDogT2JzZXJ2YWJsZTxJbnRlcnNlY3Rpb25PYnNlcnZlckVudHJ5W10+LFxyXG4gICAgICAgIEBBdHRyaWJ1dGUoJ3dhSW50ZXJzZWN0aW9uUm9vdE1hcmdpbicpIF9tYXJnaW46IHN0cmluZyB8IG51bGwsXHJcbiAgICAgICAgQEF0dHJpYnV0ZSgnd2FJbnRlcnNlY3Rpb25UaHJlc2hvbGQnKSBfdGhyZXNob2xkOiBzdHJpbmcgfCBudWxsLFxyXG4gICAgKSB7XHJcbiAgICAgICAgdGhpcy53YUludGVyc2VjdGlvbk9ic2VydmVyID0gZW50cmllcyQ7XHJcbiAgICB9XHJcbn1cclxuIl19 | ||
//# sourceMappingURL=data:application/json;base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PbkRlc3Ryb3koKSB7XHJcbiAgICAgICAgdGhpcy5kaXNjb25uZWN0KCk7XHJcbiAgICB9XHJcbn1cclxuIl19 |
@@ -6,2 +6,3 @@ /** | ||
import { NgModule } from '@angular/core'; | ||
import { IntersectionObserveeDirective } from './directives/intersection-observee.directive'; | ||
import { IntersectionObserverDirective } from './directives/intersection-observer.directive'; | ||
@@ -13,6 +14,14 @@ import { IntersectionRootDirective } from './directives/intersection-root.directive'; | ||
{ type: NgModule, args: [{ | ||
declarations: [IntersectionObserverDirective, IntersectionRootDirective], | ||
exports: [IntersectionObserverDirective, IntersectionRootDirective], | ||
declarations: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
exports: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
},] } | ||
]; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLXdlYi1hcGlzL2ludGVyc2VjdGlvbi1vYnNlcnZlci8iLCJzb3VyY2VzIjpbIm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUN2QyxPQUFPLEVBQUMsNkJBQTZCLEVBQUMsTUFBTSw4Q0FBOEMsQ0FBQztBQUMzRixPQUFPLEVBQUMseUJBQXlCLEVBQUMsTUFBTSwwQ0FBMEMsQ0FBQztBQU1uRixNQUFNLE9BQU8sMEJBQTBCOzs7WUFKdEMsUUFBUSxTQUFDO2dCQUNOLFlBQVksRUFBRSxDQUFDLDZCQUE2QixFQUFFLHlCQUF5QixDQUFDO2dCQUN4RSxPQUFPLEVBQUUsQ0FBQyw2QkFBNkIsRUFBRSx5QkFBeUIsQ0FBQzthQUN0RSIsInNvdXJjZXN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ICAgICAgICBJbnRlcnNlY3Rpb25Sb290RGlyZWN0aXZlLFxyXG4gICAgXSxcclxufSlcclxuZXhwb3J0IGNsYXNzIEludGVyc2VjdGlvbk9ic2VydmVyTW9kdWxlIHt9XHJcbiJdfQ== |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export { rootMarginFactory, thresholdFactory, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT } from './public-api'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctd2ViLWFwaXMtaW50ZXJzZWN0aW9uLW9ic2VydmVyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLXdlYi1hcGlzL2ludGVyc2VjdGlvbi1vYnNlcnZlci8iLCJzb3VyY2VzIjpbIm5nLXdlYi1hcGlzLWludGVyc2VjdGlvbi1vYnNlcnZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBSUEsNlVBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19 | ||
export { IntersectionObserveeDirective, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserveeService, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT } from './public-api'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctd2ViLWFwaXMtaW50ZXJzZWN0aW9uLW9ic2VydmVyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLXdlYi1hcGlzL2ludGVyc2VjdGlvbi1vYnNlcnZlci8iLCJzb3VyY2VzIjpbIm5nLXdlYi1hcGlzLWludGVyc2VjdGlvbi1vYnNlcnZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBSUEsb1dBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19 |
@@ -9,3 +9,4 @@ /** | ||
/* Directives */ | ||
export { rootMarginFactory, thresholdFactory, IntersectionObserverDirective } from './directives/intersection-observer.directive'; | ||
export { IntersectionObserveeDirective } from './directives/intersection-observee.directive'; | ||
export { IntersectionObserverDirective } from './directives/intersection-observer.directive'; | ||
export { IntersectionRootDirective } from './directives/intersection-root.directive'; | ||
@@ -15,2 +16,3 @@ /* Modules */ | ||
/* Services */ | ||
export { IntersectionObserveeService } from './services/intersection-observee.service'; | ||
export { IntersectionObserverService } from './services/intersection-observer.service'; | ||
@@ -22,2 +24,2 @@ /* Tokens */ | ||
export { INTERSECTION_OBSERVER_SUPPORT } from './tokens/support'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZy13ZWItYXBpcy9pbnRlcnNlY3Rpb24tb2JzZXJ2ZXIvIiwic291cmNlcyI6WyJwdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBS0EsbUZBQWMsOENBQThDLENBQUM7QUFDN0QsMENBQWMsMENBQTBDLENBQUM7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uL3NlcnZpY2VzL2ludGVyc2VjdGlvbi1vYnNlcnZlci5zZXJ2aWNlJztcclxuXHJcbi8qIFRva2VucyAqL1xyXG5leHBvcnQgKiBmcm9tICcuL3Rva2Vucy9pbnRlcnNlY3Rpb24tcm9vdCc7XHJcbmV4cG9ydCAqIGZyb20gJy4vdG9rZW5zL2ludGVyc2VjdGlvbi1yb290LW1hcmdpbic7XHJcbmV4cG9ydCAqIGZyb20gJy4vdG9rZW5zL2ludGVyc2VjdGlvbi10aHJlc2hvbGQnO1xyXG5leHBvcnQgKiBmcm9tICcuL3Rva2Vucy9zdXBwb3J0JztcclxuIl19 |
@@ -7,3 +7,3 @@ /** | ||
import { Observable } from 'rxjs'; | ||
import { finalize, share } from 'rxjs/operators'; | ||
import { share } from 'rxjs/operators'; | ||
import { INTERSECTION_ROOT } from '../tokens/intersection-root'; | ||
@@ -22,4 +22,2 @@ import { INTERSECTION_ROOT_MARGIN } from '../tokens/intersection-root-margin'; | ||
constructor({ nativeElement }, support, rootMargin, threshold, root) { | ||
/** @type {?} */ | ||
let observer; | ||
super(subscriber => { | ||
@@ -29,3 +27,4 @@ if (!support) { | ||
} | ||
observer = new IntersectionObserver(entries => { | ||
/** @type {?} */ | ||
const observer = new IntersectionObserver(entries => { | ||
subscriber.next(entries); | ||
@@ -38,4 +37,7 @@ }, { | ||
observer.observe(nativeElement); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
}); | ||
return this.pipe(finalize(() => observer.disconnect()), share()); | ||
return this.pipe(share()); | ||
} | ||
@@ -54,2 +56,2 @@ } | ||
]; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJzZWN0aW9uLW9ic2VydmVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmctd2ViLWFwaXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLyIsInNvdXJjZXMiOlsic2VydmljZXMvaW50ZXJzZWN0aW9uLW9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ZW50cmllcyA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlci5uZXh0KGVudHJpZXMpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICByb290OiByb290ICYmIHJvb3QubmF0aXZlRWxlbWVudCxcclxuICAgICAgICAgICAgICAgICAgICByb290TWFyZ2luLFxyXG4gICAgICAgICAgICAgICAgICAgIHRocmVzaG9sZCxcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICk7XHJcbiAgICAgICAgICAgIG9ic2VydmVyLm9ic2VydmUobmF0aXZlRWxlbWVudCk7XHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgICAgIHJldHVybiB0aGlzLnBpcGUoXHJcbiAgICAgICAgICAgIGZpbmFsaXplKCgpID0+IG9ic2VydmVyLmRpc2Nvbm5lY3QoKSksXHJcbiAgICAgICAgICAgIHNoYXJlKCksXHJcbiAgICAgICAgKTtcclxuICAgIH1cclxufVxyXG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJzZWN0aW9uLW9ic2VydmVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmctd2ViLWFwaXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLyIsInNvdXJjZXMiOlsic2VydmljZXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBQyxVQUFVLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDdkUsT0FBTyxFQUFDLFVBQVUsRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUNoQyxPQUFPLEVBQUMsS0FBSyxFQUFDLE1BQU0sZ0JBQWdCLENBQUM7QUFD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jdChJTlRFUlNFQ1RJT05fT0JTRVJWRVJfU1VQUE9SVCkgc3VwcG9ydDogYm9vbGVhbixcclxuICAgICAgICBASW5qZWN0KElOVEVSU0VDVElPTl9ST09UX01BUkdJTikgcm9vdE1hcmdpbjogc3RyaW5nLFxyXG4gICAgICAgIEBJbmplY3QoSU5URVJTRUNUSU9OX1RIUkVTSE9MRCkgdGhyZXNob2xkOiBudW1iZXIgfCBudW1iZXJbXSxcclxuICAgICAgICBAT3B0aW9uYWwoKSBASW5qZWN0KElOVEVSU0VDVElPTl9ST09UKSByb290OiBFbGVtZW50UmVmPEVsZW1lbnQ+IHwgbnVsbCxcclxuICAgICkge1xyXG4gICAgICAgIHN1cGVyKHN1YnNjcmliZXIgPT4ge1xyXG4gICAgICAgICAgICBpZiAoIXN1cHBvcnQpIHtcclxuICAgICAgICAgICAgICAgIHN1YnNjcmliZXIuZXJyb3IoJ0ludGVyc2VjdGlvbk9ic2VydmVyIGlzIG5vdCBzdXBwb3J0ZWQgaW4geW91ciBicm93c2VyJyk7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGNvbnN0IG9ic2VydmVyID0gbmV3IEludGVyc2VjdGlvbk9ic2VydmVyKFxyXG4gICAgICAgICAgICAgICAgZW50cmllcyA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlci5uZXh0KGVudHJpZXMpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICByb290OiByb290ICYmIHJvb3QubmF0aXZlRWxlbWVudCxcclxuICAgICAgICAgICAgICAgICAgICByb290TWFyZ2luLFxyXG4gICAgICAgICAgICAgICAgICAgIHRocmVzaG9sZCxcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICk7XHJcblxyXG4gICAgICAgICAgICBvYnNlcnZlci5vYnNlcnZlKG5hdGl2ZUVsZW1lbnQpO1xyXG5cclxuICAgICAgICAgICAgcmV0dXJuICgpID0+IHtcclxuICAgICAgICAgICAgICAgIG9ic2VydmVyLmRpc2Nvbm5lY3QoKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgcmV0dXJuIHRoaXMucGlwZShzaGFyZSgpKTtcclxuICAgIH1cclxufVxyXG4iXX0= |
@@ -5,43 +5,66 @@ /** | ||
*/ | ||
import { Attribute, Directive, Inject, Output } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { IntersectionObserverService } from '../services/intersection-observer.service'; | ||
import { INTERSECTION_ROOT_MARGIN, INTERSECTION_ROOT_MARGIN_DEFAULT, } from '../tokens/intersection-root-margin'; | ||
import { INTERSECTION_THRESHOLD, INTERSECTION_THRESHOLD_DEFAULT, } from '../tokens/intersection-threshold'; | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
export function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
export function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
var IntersectionObserverDirective = /** @class */ (function () { | ||
function IntersectionObserverDirective(entries$, _margin, _threshold) { | ||
this.waIntersectionObserver = entries$; | ||
import * as tslib_1 from "tslib"; | ||
import { Attribute, Directive, Inject, Optional, } from '@angular/core'; | ||
import { INTERSECTION_ROOT } from '../tokens/intersection-root'; | ||
import { rootMarginFactory } from '../utils/root-margin-factory'; | ||
import { thresholdFactory } from '../utils/threshold-factory'; | ||
var IntersectionObserverDirective = /** @class */ (function (_super) { | ||
tslib_1.__extends(IntersectionObserverDirective, _super); | ||
function IntersectionObserverDirective(root, rootMargin, threshold) { | ||
var _this = _super.call(this, function (entries) { | ||
_this.callbacks.forEach(function (callback, element) { | ||
/** @type {?} */ | ||
var filtered = entries.filter(function (_a) { | ||
var target = _a.target; | ||
return target === element; | ||
}); | ||
return filtered.length && callback(filtered, _this); | ||
}); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMarginFactory(rootMargin), | ||
threshold: thresholdFactory(threshold), | ||
}) || this; | ||
_this.callbacks = new Map(); | ||
return _this; | ||
} | ||
/** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.observe = /** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
function (target, callback) { | ||
if (callback === void 0) { callback = function () { }; } | ||
_super.prototype.observe.call(this, target); | ||
this.callbacks.set(target, callback); | ||
}; | ||
/** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.unobserve = /** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
function (target) { | ||
_super.prototype.unobserve.call(this, target); | ||
this.callbacks.delete(target); | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.ngOnDestroy = /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
this.disconnect(); | ||
}; | ||
IntersectionObserverDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
providers: [ | ||
IntersectionObserverService, | ||
{ | ||
provide: INTERSECTION_ROOT_MARGIN, | ||
deps: [[new Attribute('waIntersectionRootMargin')]], | ||
useFactory: rootMarginFactory, | ||
}, | ||
{ | ||
provide: INTERSECTION_THRESHOLD, | ||
deps: [[new Attribute('waIntersectionThreshold')]], | ||
useFactory: thresholdFactory, | ||
}, | ||
], | ||
},] } | ||
@@ -51,16 +74,16 @@ ]; | ||
IntersectionObserverDirective.ctorParameters = function () { return [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [IntersectionObserverService,] }] }, | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionThreshold',] }] } | ||
]; }; | ||
IntersectionObserverDirective.propDecorators = { | ||
waIntersectionObserver: [{ type: Output }] | ||
}; | ||
return IntersectionObserverDirective; | ||
}()); | ||
}(IntersectionObserver)); | ||
export { IntersectionObserverDirective }; | ||
if (false) { | ||
/** @type {?} */ | ||
IntersectionObserverDirective.prototype.waIntersectionObserver; | ||
/** | ||
* @type {?} | ||
* @private | ||
*/ | ||
IntersectionObserverDirective.prototype.callbacks; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJzZWN0aW9uLW9ic2VydmVyLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZy13ZWItYXBpcy9pbnRlcnNlY3Rpb24tb2JzZXJ2ZXIvIiwic291cmNlcyI6WyJkaXJlY3RpdmVzL2ludGVyc2VjdGlvbi1vYnNlcnZlci5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBQyxTQUFTLEVBQUUsU0FBUyxFQUFFLE1BQU0sRUFBRSxNQUFNLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDbkUsT0FBTyxFQUFDLFVBQVUsRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUNoQyxPQUFPLEVBQUMsMkJBQTJCLEVBQUMsTUFBTSwyQ0FBMkMsQ0FBQztBQUN0RixPQUFPLEVBQ0gsd0JBQXdCLEVBQ3hCLGdDQUFnQyxHQUNuQyxNQUFNLG9DQUFvQyxDQUFDO0FBQzVDLE9BQU8sRUFDSCxzQkFBc0IsRUFDdEIsOEJBQThCLEdBQ2pDLE1BQU0sa0NBQWtDLENBQUM7Ozs7O0FBRTFDLE1BQU0sVUFBVSxpQkFBaUIsQ0FBQyxVQUF5QjtJQUN2RCxPQUFPLFV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2VjdGlvbk9ic2VydmVyQ2FsbGJhY2s+KCk7XHJcblxyXG4gICAgY29uc3RydWN0b3IoXHJcbiAgICAgICAgQE9wdGlvbmFsKCkgQEluamVjdChJTlRFUlNFQ1RJT05fUk9PVCkgcm9vdDogRWxlbWVudFJlZjxFbGVtZW50PiB8IG51bGwsXHJcbiAgICAgICAgQEF0dHJpYnV0ZSgnd2FJbnRlcnNlY3Rpb25Sb290TWFyZ2luJykgcm9vdE1hcmdpbjogc3RyaW5nIHwgbnVsbCxcclxuICAgICAgICBAQXR0cmlidXRlKCd3YUludGVyc2VjdGlvblRocmVzaG9sZCcpIHRocmVzaG9sZDogc3RyaW5nIHwgbnVsbCxcclxuICAgICkge1xyXG4gICAgICAgIHN1cGVyKFxyXG4gICAgICAgICAgICBlbnRyaWVzID0+IHtcclxuICAgICAgICAgICAgICAgIHRoaXMuY2FsbGJhY2tzLmZvckVhY2goKGNhbGxiYWNrLCBlbGVtZW50KSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZmlsdGVyZWQgPSBlbnRyaWVzLmZpbHRlcigoe3RhcmdldH0pID0+IHRhcmdldCA9PT0gZWxlbWVudCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmaWx0ZXJlZC5sZW5ndGggJiYgY2FsbGJhY2soZmlsdGVyZWQsIHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgIHJvb3Q6IHJvb3QgJiYgcm9vdC5uYXRpdmVFbGVtZW50LFxyXG4gICAgICAgICAgICAgICAgcm9vdE1hcmdpbjogcm9vdE1hcmdpbkZhY3Rvcnkocm9vdE1hcmdpbiksXHJcbiAgICAgICAgICAgICAgICB0aHJlc2hvbGQ6IHRocmVzaG9sZEZhY3RvcnkodGhyZXNob2xkKSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICApO1xyXG4gICAgfVxyXG5cclxuICAgIG9ic2VydmUodGFyZ2V0OiBFbGVtZW50LCBjYWxsYmFjazogSW50ZXJzZWN0aW9uT2JzZXJ2ZXJDYWxsYmFjayA9ICgpID0+IHt9KSB7XHJcbiAgICAgICAgc3VwZXIub2JzZXJ2ZSh0YXJnZXQpO1xyXG4gICAgICAgIHRoaXMuY2FsbGJhY2tzLnNldCh0YXJnZXQsIGNhbGxiYWNrKTtcclxuICAgIH1cclxuXHJcbiAgICB1bm9ic2VydmUodGFyZ2V0OiBFbGVtZW50KSB7XHJcbiAgICAgICAgc3VwZXIudW5vYnNlcnZlKHRhcmdldCk7XHJcbiAgICAgICAgdGhpcy5jYWxsYmFja3MuZGVsZXRlKHRhcmdldCk7XHJcbiAgICB9XHJcblxyXG4gICAgbmdPbkRlc3Ryb3koKSB7XHJcbiAgICAgICAgdGhpcy5kaXNjb25uZWN0KCk7XHJcbiAgICB9XHJcbn1cclxuIl19 |
@@ -6,2 +6,3 @@ /** | ||
import { NgModule } from '@angular/core'; | ||
import { IntersectionObserveeDirective } from './directives/intersection-observee.directive'; | ||
import { IntersectionObserverDirective } from './directives/intersection-observer.directive'; | ||
@@ -14,4 +15,12 @@ import { IntersectionRootDirective } from './directives/intersection-root.directive'; | ||
{ type: NgModule, args: [{ | ||
declarations: [IntersectionObserverDirective, IntersectionRootDirective], | ||
exports: [IntersectionObserverDirective, IntersectionRootDirective], | ||
declarations: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
exports: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
},] } | ||
@@ -22,2 +31,2 @@ ]; | ||
export { IntersectionObserverModule }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLXdlYi1hcGlzL2ludGVyc2VjdGlvbi1vYnNlcn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mVyRGlyZWN0aXZlfSBmcm9tICcuL2RpcmVjdGl2ZXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLmRpcmVjdGl2ZSc7XHJcbmltcG9ydCB7SW50ZXJzZWN0aW9uUm9vdERpcmVjdGl2ZX0gZnJvbSAnLi9kaXJlY3RpdmVzL2ludGVyc2VjdGlvbi1yb290LmRpcmVjdGl2ZSc7XHJcblxyXG5ATmdNb2R1bGUoe1xyXG4gICAgZGVjbGFyYXRpb25zOiBbXHJcbiAgICAgICAgSW50ZXJzZWN0aW9uT2JzZXJ2ZXJEaXJlY3RpdmUsXHJcbiAgICAgICAgSW50ZXJzZWN0aW9uT2JzZXJ2ZWVEaXJlY3RpdmUsXHJcbiAgICAgICAgSW50ZXJzZWN0aW9uUm9vdERpcmVjdGl2ZSxcclxuICAgIF0sXHJcbiAgICBleHBvcnRzOiBbXHJcbiAgICAgICAgSW50ZXJzZWN0aW9uT2JzZXJ2ZXJEaXJlY3RpdmUsXHJcbiAgICAgICAgSW50ZXJzZWN0aW9uT2JzZXJ2ZWVEaXJlY3RpdmUsXHJcbiAgICAgICAgSW50ZXJzZWN0aW9uUm9vdERpcmVjdGl2ZSxcclxuICAgIF0sXHJcbn0pXHJcbmV4cG9ydCBjbGFzcyBJbnRlcnNlY3Rpb25PYnNlcnZlck1vZHVsZSB7fVxyXG4iXX0= |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export { rootMarginFactory, thresholdFactory, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT } from './public-api'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctd2ViLWFwaXMtaW50ZXJzZWN0aW9uLW9ic2VydmVyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLXdlYi1hcGlzL2ludGVyc2VjdGlvbi1vYnNlcnZlci8iLCJzb3VyY2VzIjpbIm5nLXdlYi1hcGlzLWludGVyc2VjdGlvbi1vYnNlcnZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBSUEsNlVBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19 | ||
export { IntersectionObserveeDirective, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserveeService, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT } from './public-api'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctd2ViLWFwaXMtaW50ZXJzZWN0aW9uLW9ic2VydmVyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLXdlYi1hcGlzL2ludGVyc2VjdGlvbi1vYnNlcnZlci8iLCJzb3VyY2VzIjpbIm5nLXdlYi1hcGlzLWludGVyc2VjdGlvbi1vYnNlcnZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBSUEsb1dBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19 |
@@ -9,3 +9,4 @@ /** | ||
/* Directives */ | ||
export { rootMarginFactory, thresholdFactory, IntersectionObserverDirective } from './directives/intersection-observer.directive'; | ||
export { IntersectionObserveeDirective } from './directives/intersection-observee.directive'; | ||
export { IntersectionObserverDirective } from './directives/intersection-observer.directive'; | ||
export { IntersectionRootDirective } from './directives/intersection-root.directive'; | ||
@@ -15,2 +16,3 @@ /* Modules */ | ||
/* Services */ | ||
export { IntersectionObserveeService } from './services/intersection-observee.service'; | ||
export { IntersectionObserverService } from './services/intersection-observer.service'; | ||
@@ -22,2 +24,2 @@ /* Tokens */ | ||
export { INTERSECTION_OBSERVER_SUPPORT } from './tokens/support'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZy13ZWItYXBpcy9pbnRlcnNlY3Rpb24tb2JzZXJ2ZXIvIiwic291cmNlcyI6WyJwdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBS0EsbUZBQWMsOENBQThDLENBQUM7QUFDN0QsMENBQWMsMENBQTBDLENBQUM7O0FBR3pELDJDQUFjLFVBQVUsQ0FBQzs7QUFHekIsNENBQWMsMENBQTBDLENBQUM7O0FBR3pELGtDQUFjLDRCQUE0QixDQUFDO0FBQzNDLDJFQUFjLG1DQUFtQyxDQUFDO0FBQ2xELHVFQUFjLGlDQUFpQyxDQUFDO0FBQ2hELDhDQUFjLGtCQUFrQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBAbmctd2ViLWFwaXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyXHJcbiAqL1xyXG5cclxuLyogRGlyZWN0aXZlcyAqL1xyXG5leHBvcnQgKiBmcm9tICcuL2RpcmVjdGl2ZXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLmRpcmVjdGl2ZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vZGlyZWN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iOlsiLyoqXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBAbmctd2ViLWFwaXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyXHJcbiAqL1xyXG5cclxuLyogRGlyZWN0aXZlcyAqL1xyXG5leHBvcnQgKiBmcm9tICcuL2RpcmVjdGl2ZXMvaW50ZXJzZWN0aW9uLW9ic2VydmVlLmRpcmVjdGl2ZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vZGlyZWN0aXZlcy9pbnRlcnNlY3Rpb24tb2JzZXJ2ZXIuZGlyZWN0aXZlJztcclxuZXhwb3J0ICogZnJvbSAnLi9kaXJlY3RpdmVzL2ludGVyc2VjdGlvbi1yb290LmRpcmVjdGl2ZSc7XHJcblxyXG4vKiBNb2R1bGVzICovXHJcbmV4cG9ydCAqIGZyb20gJy4vbW9kdWxlJztcclxuXHJcbi8qIFNlcnZpY2VzICovXHJcbmV4cG9ydCAqIGZyb20gJy4vc2VydmljZXMvaW50ZXJzZWN0aW9uLW9ic2VydmVlLnNlcnZpY2UnO1xyXG5leHBvcnQgKiBmcm9tICcuL3NlcnZpY2VzL2ludGVyc2VjdGlvbi1vYnNlcnZlci5zZXJ2aWNlJztcclxuXHJcbi8qIFRva2VucyAqL1xyXG5leHBvcnQgKiBmcm9tICcuL3Rva2Vucy9pbnRlcnNlY3Rpb24tcm9vdCc7XHJcbmV4cG9ydCAqIGZyb20gJy4vdG9rZW5zL2ludGVyc2VjdGlvbi1yb290LW1hcmdpbic7XHJcbmV4cG9ydCAqIGZyb20gJy4vdG9rZW5zL2ludGVyc2VjdGlvbi10aHJlc2hvbGQnO1xyXG5leHBvcnQgKiBmcm9tICcuL3Rva2Vucy9zdXBwb3J0JztcclxuIl19 |
@@ -8,3 +8,3 @@ /** | ||
import { Observable } from 'rxjs'; | ||
import { finalize, share } from 'rxjs/operators'; | ||
import { share } from 'rxjs/operators'; | ||
import { INTERSECTION_ROOT } from '../tokens/intersection-root'; | ||
@@ -18,10 +18,8 @@ import { INTERSECTION_ROOT_MARGIN } from '../tokens/intersection-root-margin'; | ||
var nativeElement = _a.nativeElement; | ||
var _this = this; | ||
/** @type {?} */ | ||
var observer; | ||
_this = _super.call(this, function (subscriber) { | ||
var _this = _super.call(this, function (subscriber) { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
observer = new IntersectionObserver(function (entries) { | ||
/** @type {?} */ | ||
var observer = new IntersectionObserver(function (entries) { | ||
subscriber.next(entries); | ||
@@ -34,4 +32,7 @@ }, { | ||
observer.observe(nativeElement); | ||
return function () { | ||
observer.disconnect(); | ||
}; | ||
}) || this; | ||
return _this.pipe(finalize(function () { return observer.disconnect(); }), share()); | ||
return _this.pipe(share()); | ||
} | ||
@@ -52,2 +53,2 @@ IntersectionObserverService.decorators = [ | ||
export { IntersectionObserverService }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJzZWN0aW9uLW9ic2VydmVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmctd2ViLWFwaXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLyIsInNvdXJjZXMiOlsic2VydmljZXMvaW50ZXJzZWN0aW9uLW9ic2VydmVyLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3ZFLE9BQU8sRUFBQyxVQUFVLEVBQUMsTUFBTSxNQUFNLENBQUM7QUFDaEMsT0FBTyxFQUFDLFFBQVEsRUFBRSxLQUFLLEVBQUMsTUFBTSxnQkFBZ0IsQ0FBQztBQUMvQyxPQUFPLEVBQUMsaUJBQWlCLEVBQUMsTUFBTSw2QkFBNkIsQ0FBQztBQUM5RCxPQUFPLEVBQUMsd0JBQXd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VudFJlZjxFbGVtZW50PixcclxuICAgICAgICBASW5qZWN0KElOVEVSU0VDVElPTl9PQlNFUlZFUl9TVVBQT1JUKSBzdXBwb3J0OiBib29sZWFuLFxyXG4gICAgICAgIEBJbmplY3QoSU5URVJTRUNUSU9OX1JPT1RfTUFSR0lOKSByb290TWFyZ2luOiBzdHJpbmcsXHJcbiAgICAgICAgQEluamVjdChJTlRFUlNFQ1RJT05fVEhSRVNIT0xEKSB0aHJlc2hvbGQ6IG51bWJlciB8IG51bWJlcltdLFxyXG4gICAgICAgIEBPcHRpb25hbCgpIEBJbmplY3QoSU5URVJTRUNUSU9OX1JPT1QpIHJvb3Q6IEVsZW1lbnRSZWY8RWxlbWVudD4gfCBudWxsLFxyXG4gICAgKSB7XHJcbiAgICAgICAgbGV0IG9ic2VydmVyOiBJbnRlcnNlY3Rpb25PYnNlcnZlcjtcclxuXHJcbiAgICAgICAgc3VwZXIoc3Vic2NyaWJlciA9PiB7XHJcbiAgICAgICAgICAgIGlmICghc3VwcG9ydCkge1xyXG4gICAgICAgICAgICAgICAgc3Vic2NyaWJlci5lcnJvcignSW50ZXJzZWN0aW9uT2JzZXJ2ZXIgaXMgbm90IHN1cHBvcnRlZCBpbiB5b3VyIGJyb3dzZXInKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgb2JzZXJ2ZXIgPSBuZXcgSW50ZXJzZWN0aW9uT2JzZXJ2ZXIoXHJcbiAgICAgICAgICAgICAgICBlbnRyaWVzID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVyLm5leHQoZW50cmllcyk7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgIHJvb3Q6IHJvb3QgJiYgcm9vdC5uYXRpdmVFbGVtZW50LFxyXG4gICAgICAgICAgICAgICAgICAgIHJvb3RNYXJnaW4sXHJcbiAgICAgICAgICAgICAgICAgICAgdGhyZXNob2xkLF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aHJlc2hvbGQ6IG51bWJlciB8IG51bWJlcltdLFxyXG4gICAgICAgIEBPcHRpb25hbCgpIEBJbmplY3QoSU5URVJTRUNUSU9OX1JPT1QpIHJvb3Q6IEVsZW1lbnRSZWY8RWxlbWVudD4gfCBudWxsLFxyXG4gICAgKSB7XHJcbiAgICAgICAgc3VwZXIoc3Vic2NyaWJlciA9PiB7XHJcbiAgICAgICAgICAgIGlmICghc3VwcG9ydCkge1xyXG4gICAgICAgICAgICAgICAgc3Vic2NyaWJlci5lcnJvcignSW50ZXJzZWN0aW9uT2JzZXJ2ZXIgaXMgbm90IHN1cHBvcnRlZCBpbiB5b3VyIGJyb3dzZXInKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgY29uc3Qgb2JzZXJ2ZXIgPSBuZXcgSW50ZXJzZWN0aW9uT2JzZXJ2ZXIoXHJcbiAgICAgICAgICAgICAgICBlbnRyaWVzID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVyLm5leHQoZW50cmllcyk7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgIHJvb3Q6IHJvb3QgJiYgcm9vdC5uYXRpdmVFbGVtZW50LFxyXG4gICAgICAgICAgICAgICAgICAgIHJvb3RNYXJnaW4sXHJcbiAgICAgICAgICAgICAgICAgICAgdGhyZXNob2xkLFxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgKTtcclxuXHJcbiAgICAgICAgICAgIG9ic2VydmVyLm9ic2VydmUobmF0aXZlRWxlbWVudCk7XHJcblxyXG4gICAgICAgICAgICByZXR1cm4gKCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgb2JzZXJ2ZXIuZGlzY29ubmVjdCgpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICByZXR1cm4gdGhpcy5waXBlKHNoYXJlKCkpO1xyXG4gICAgfVxyXG59XHJcbiJdfQ== |
import { Observable } from 'rxjs'; | ||
import { finalize, share } from 'rxjs/operators'; | ||
import { share } from 'rxjs/operators'; | ||
import { InjectionToken, Attribute, Directive, Inject, Optional, ElementRef, Injectable, NgModule, inject } from '@angular/core'; | ||
import { WINDOW } from '@ng-web-apis/common'; | ||
import { InjectionToken, inject, ElementRef, Inject, Injectable, Optional, Attribute, Directive, Output, NgModule } from '@angular/core'; | ||
@@ -29,2 +29,14 @@ /** | ||
*/ | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** @type {?} */ | ||
@@ -42,7 +54,11 @@ const INTERSECTION_THRESHOLD_DEFAULT = 0; | ||
*/ | ||
/** @type {?} */ | ||
const INTERSECTION_OBSERVER_SUPPORT = new InjectionToken('Intersection Observer API support', { | ||
providedIn: 'root', | ||
factory: () => !!inject(WINDOW).IntersectionObserver, | ||
}); | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
@@ -53,39 +69,86 @@ /** | ||
*/ | ||
class IntersectionObserverService extends Observable { | ||
class IntersectionObserverDirective extends IntersectionObserver { | ||
/** | ||
* @param {?} __0 | ||
* @param {?} support | ||
* @param {?} root | ||
* @param {?} rootMargin | ||
* @param {?} threshold | ||
* @param {?} root | ||
*/ | ||
constructor({ nativeElement }, support, rootMargin, threshold, root) { | ||
/** @type {?} */ | ||
let observer; | ||
constructor(root, rootMargin, threshold) { | ||
super(entries => { | ||
this.callbacks.forEach((callback, element) => { | ||
/** @type {?} */ | ||
const filtered = entries.filter(({ target }) => target === element); | ||
return filtered.length && callback(filtered, this); | ||
}); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMarginFactory(rootMargin), | ||
threshold: thresholdFactory(threshold), | ||
}); | ||
this.callbacks = new Map(); | ||
} | ||
/** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
observe(target, callback = () => { }) { | ||
super.observe(target); | ||
this.callbacks.set(target, callback); | ||
} | ||
/** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
unobserve(target) { | ||
super.unobserve(target); | ||
this.callbacks.delete(target); | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
ngOnDestroy() { | ||
this.disconnect(); | ||
} | ||
} | ||
IntersectionObserverDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
},] } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverDirective.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionThreshold',] }] } | ||
]; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
class IntersectionObserveeService extends Observable { | ||
/** | ||
* @param {?} __0 | ||
* @param {?} observer | ||
*/ | ||
constructor({ nativeElement }, observer) { | ||
super(subscriber => { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
observer = new IntersectionObserver(entries => { | ||
observer.observe(nativeElement, entries => { | ||
subscriber.next(entries); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin, | ||
threshold, | ||
}); | ||
observer.observe(nativeElement); | ||
return () => { | ||
observer.unobserve(nativeElement); | ||
}; | ||
}); | ||
return this.pipe(finalize(() => observer.disconnect()), share()); | ||
return this.pipe(share()); | ||
} | ||
} | ||
IntersectionObserverService.decorators = [ | ||
IntersectionObserveeService.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverService.ctorParameters = () => [ | ||
IntersectionObserveeService.ctorParameters = () => [ | ||
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }, | ||
{ type: Boolean, decorators: [{ type: Inject, args: [INTERSECTION_OBSERVER_SUPPORT,] }] }, | ||
{ type: String, decorators: [{ type: Inject, args: [INTERSECTION_ROOT_MARGIN,] }] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INTERSECTION_THRESHOLD,] }] }, | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] } | ||
{ type: IntersectionObserverDirective, decorators: [{ type: Inject, args: [IntersectionObserverDirective,] }] } | ||
]; | ||
@@ -97,55 +160,22 @@ | ||
*/ | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
class IntersectionObserverDirective { | ||
// @dynamic | ||
class IntersectionObserveeDirective { | ||
/** | ||
* @param {?} entries$ | ||
* @param {?} _margin | ||
* @param {?} _threshold | ||
* @param {?} waIntersectionObservee | ||
*/ | ||
constructor(entries$, _margin, _threshold) { | ||
this.waIntersectionObserver = entries$; | ||
constructor(waIntersectionObservee) { | ||
this.waIntersectionObservee = waIntersectionObservee; | ||
} | ||
} | ||
IntersectionObserverDirective.decorators = [ | ||
IntersectionObserveeDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
providers: [ | ||
IntersectionObserverService, | ||
{ | ||
provide: INTERSECTION_ROOT_MARGIN, | ||
deps: [[new Attribute('waIntersectionRootMargin')]], | ||
useFactory: rootMarginFactory, | ||
}, | ||
{ | ||
provide: INTERSECTION_THRESHOLD, | ||
deps: [[new Attribute('waIntersectionThreshold')]], | ||
useFactory: thresholdFactory, | ||
}, | ||
], | ||
selector: '[waIntersectionObservee]', | ||
outputs: ['waIntersectionObservee'], | ||
providers: [IntersectionObserveeService], | ||
},] } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverDirective.ctorParameters = () => [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [IntersectionObserverService,] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionThreshold',] }] } | ||
IntersectionObserveeDirective.ctorParameters = () => [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [IntersectionObserveeService,] }] } | ||
]; | ||
IntersectionObserverDirective.propDecorators = { | ||
waIntersectionObserver: [{ type: Output }] | ||
}; | ||
@@ -178,4 +208,12 @@ /** | ||
{ type: NgModule, args: [{ | ||
declarations: [IntersectionObserverDirective, IntersectionRootDirective], | ||
exports: [IntersectionObserverDirective, IntersectionRootDirective], | ||
declarations: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
exports: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
},] } | ||
@@ -188,2 +226,7 @@ ]; | ||
*/ | ||
/** @type {?} */ | ||
const INTERSECTION_OBSERVER_SUPPORT = new InjectionToken('Intersection Observer API support', { | ||
providedIn: 'root', | ||
factory: () => !!inject(WINDOW).IntersectionObserver, | ||
}); | ||
@@ -194,5 +237,55 @@ /** | ||
*/ | ||
class IntersectionObserverService extends Observable { | ||
/** | ||
* @param {?} __0 | ||
* @param {?} support | ||
* @param {?} rootMargin | ||
* @param {?} threshold | ||
* @param {?} root | ||
*/ | ||
constructor({ nativeElement }, support, rootMargin, threshold, root) { | ||
super(subscriber => { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
/** @type {?} */ | ||
const observer = new IntersectionObserver(entries => { | ||
subscriber.next(entries); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin, | ||
threshold, | ||
}); | ||
observer.observe(nativeElement); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
}); | ||
return this.pipe(share()); | ||
} | ||
} | ||
IntersectionObserverService.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverService.ctorParameters = () => [ | ||
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }, | ||
{ type: Boolean, decorators: [{ type: Inject, args: [INTERSECTION_OBSERVER_SUPPORT,] }] }, | ||
{ type: String, decorators: [{ type: Inject, args: [INTERSECTION_ROOT_MARGIN,] }] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INTERSECTION_THRESHOLD,] }] }, | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] } | ||
]; | ||
export { rootMarginFactory, thresholdFactory, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
export { IntersectionObserveeDirective, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserveeService, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT }; | ||
//# sourceMappingURL=ng-web-apis-intersection-observer.js.map |
import { __extends } from 'tslib'; | ||
import { Observable } from 'rxjs'; | ||
import { finalize, share } from 'rxjs/operators'; | ||
import { share } from 'rxjs/operators'; | ||
import { InjectionToken, Attribute, Directive, Inject, Optional, ElementRef, Injectable, NgModule, inject } from '@angular/core'; | ||
import { WINDOW } from '@ng-web-apis/common'; | ||
import { InjectionToken, inject, ElementRef, Inject, Injectable, Optional, Attribute, Directive, Output, NgModule } from '@angular/core'; | ||
@@ -30,2 +30,14 @@ /** | ||
*/ | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** @type {?} */ | ||
@@ -43,7 +55,11 @@ var INTERSECTION_THRESHOLD_DEFAULT = 0; | ||
*/ | ||
/** @type {?} */ | ||
var INTERSECTION_OBSERVER_SUPPORT = new InjectionToken('Intersection Observer API support', { | ||
providedIn: 'root', | ||
factory: function () { return !!inject(WINDOW).IntersectionObserver; }, | ||
}); | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
@@ -54,36 +70,99 @@ /** | ||
*/ | ||
var IntersectionObserverService = /** @class */ (function (_super) { | ||
__extends(IntersectionObserverService, _super); | ||
function IntersectionObserverService(_a, support, rootMargin, threshold, root) { | ||
var IntersectionObserverDirective = /** @class */ (function (_super) { | ||
__extends(IntersectionObserverDirective, _super); | ||
function IntersectionObserverDirective(root, rootMargin, threshold) { | ||
var _this = _super.call(this, function (entries) { | ||
_this.callbacks.forEach(function (callback, element) { | ||
/** @type {?} */ | ||
var filtered = entries.filter(function (_a) { | ||
var target = _a.target; | ||
return target === element; | ||
}); | ||
return filtered.length && callback(filtered, _this); | ||
}); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMarginFactory(rootMargin), | ||
threshold: thresholdFactory(threshold), | ||
}) || this; | ||
_this.callbacks = new Map(); | ||
return _this; | ||
} | ||
/** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.observe = /** | ||
* @param {?} target | ||
* @param {?=} callback | ||
* @return {?} | ||
*/ | ||
function (target, callback) { | ||
if (callback === void 0) { callback = function () { }; } | ||
_super.prototype.observe.call(this, target); | ||
this.callbacks.set(target, callback); | ||
}; | ||
/** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.unobserve = /** | ||
* @param {?} target | ||
* @return {?} | ||
*/ | ||
function (target) { | ||
_super.prototype.unobserve.call(this, target); | ||
this.callbacks.delete(target); | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
IntersectionObserverDirective.prototype.ngOnDestroy = /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
this.disconnect(); | ||
}; | ||
IntersectionObserverDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
},] } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverDirective.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionThreshold',] }] } | ||
]; }; | ||
return IntersectionObserverDirective; | ||
}(IntersectionObserver)); | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
var IntersectionObserveeService = /** @class */ (function (_super) { | ||
__extends(IntersectionObserveeService, _super); | ||
function IntersectionObserveeService(_a, observer) { | ||
var nativeElement = _a.nativeElement; | ||
var _this = this; | ||
/** @type {?} */ | ||
var observer; | ||
_this = _super.call(this, function (subscriber) { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
observer = new IntersectionObserver(function (entries) { | ||
var _this = _super.call(this, function (subscriber) { | ||
observer.observe(nativeElement, function (entries) { | ||
subscriber.next(entries); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMargin, | ||
threshold: threshold, | ||
}); | ||
observer.observe(nativeElement); | ||
return function () { | ||
observer.unobserve(nativeElement); | ||
}; | ||
}) || this; | ||
return _this.pipe(finalize(function () { return observer.disconnect(); }), share()); | ||
return _this.pipe(share()); | ||
} | ||
IntersectionObserverService.decorators = [ | ||
IntersectionObserveeService.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverService.ctorParameters = function () { return [ | ||
IntersectionObserveeService.ctorParameters = function () { return [ | ||
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }, | ||
{ type: Boolean, decorators: [{ type: Inject, args: [INTERSECTION_OBSERVER_SUPPORT,] }] }, | ||
{ type: String, decorators: [{ type: Inject, args: [INTERSECTION_ROOT_MARGIN,] }] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INTERSECTION_THRESHOLD,] }] }, | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] } | ||
{ type: IntersectionObserverDirective, decorators: [{ type: Inject, args: [IntersectionObserverDirective,] }] } | ||
]; }; | ||
return IntersectionObserverService; | ||
return IntersectionObserveeService; | ||
}(Observable)); | ||
@@ -95,50 +174,19 @@ | ||
*/ | ||
/** | ||
* @param {?} rootMargin | ||
* @return {?} | ||
*/ | ||
function rootMarginFactory(rootMargin) { | ||
return rootMargin || INTERSECTION_ROOT_MARGIN_DEFAULT; | ||
} | ||
/** | ||
* @param {?} threshold | ||
* @return {?} | ||
*/ | ||
function thresholdFactory(threshold) { | ||
return threshold | ||
? threshold.split(',').map(parseFloat) | ||
: INTERSECTION_THRESHOLD_DEFAULT; | ||
} | ||
var IntersectionObserverDirective = /** @class */ (function () { | ||
function IntersectionObserverDirective(entries$, _margin, _threshold) { | ||
this.waIntersectionObserver = entries$; | ||
// @dynamic | ||
var IntersectionObserveeDirective = /** @class */ (function () { | ||
function IntersectionObserveeDirective(waIntersectionObservee) { | ||
this.waIntersectionObservee = waIntersectionObservee; | ||
} | ||
IntersectionObserverDirective.decorators = [ | ||
IntersectionObserveeDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[waIntersectionObserver]', | ||
providers: [ | ||
IntersectionObserverService, | ||
{ | ||
provide: INTERSECTION_ROOT_MARGIN, | ||
deps: [[new Attribute('waIntersectionRootMargin')]], | ||
useFactory: rootMarginFactory, | ||
}, | ||
{ | ||
provide: INTERSECTION_THRESHOLD, | ||
deps: [[new Attribute('waIntersectionThreshold')]], | ||
useFactory: thresholdFactory, | ||
}, | ||
], | ||
selector: '[waIntersectionObservee]', | ||
outputs: ['waIntersectionObservee'], | ||
providers: [IntersectionObserveeService], | ||
},] } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverDirective.ctorParameters = function () { return [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [IntersectionObserverService,] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionRootMargin',] }] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['waIntersectionThreshold',] }] } | ||
IntersectionObserveeDirective.ctorParameters = function () { return [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [IntersectionObserveeService,] }] } | ||
]; }; | ||
IntersectionObserverDirective.propDecorators = { | ||
waIntersectionObserver: [{ type: Output }] | ||
}; | ||
return IntersectionObserverDirective; | ||
return IntersectionObserveeDirective; | ||
}()); | ||
@@ -176,4 +224,12 @@ | ||
{ type: NgModule, args: [{ | ||
declarations: [IntersectionObserverDirective, IntersectionRootDirective], | ||
exports: [IntersectionObserverDirective, IntersectionRootDirective], | ||
declarations: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
exports: [ | ||
IntersectionObserverDirective, | ||
IntersectionObserveeDirective, | ||
IntersectionRootDirective, | ||
], | ||
},] } | ||
@@ -188,2 +244,7 @@ ]; | ||
*/ | ||
/** @type {?} */ | ||
var INTERSECTION_OBSERVER_SUPPORT = new InjectionToken('Intersection Observer API support', { | ||
providedIn: 'root', | ||
factory: function () { return !!inject(WINDOW).IntersectionObserver; }, | ||
}); | ||
@@ -194,5 +255,51 @@ /** | ||
*/ | ||
var IntersectionObserverService = /** @class */ (function (_super) { | ||
__extends(IntersectionObserverService, _super); | ||
function IntersectionObserverService(_a, support, rootMargin, threshold, root) { | ||
var nativeElement = _a.nativeElement; | ||
var _this = _super.call(this, function (subscriber) { | ||
if (!support) { | ||
subscriber.error('IntersectionObserver is not supported in your browser'); | ||
} | ||
/** @type {?} */ | ||
var observer = new IntersectionObserver(function (entries) { | ||
subscriber.next(entries); | ||
}, { | ||
root: root && root.nativeElement, | ||
rootMargin: rootMargin, | ||
threshold: threshold, | ||
}); | ||
observer.observe(nativeElement); | ||
return function () { | ||
observer.disconnect(); | ||
}; | ||
}) || this; | ||
return _this.pipe(share()); | ||
} | ||
IntersectionObserverService.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
IntersectionObserverService.ctorParameters = function () { return [ | ||
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }, | ||
{ type: Boolean, decorators: [{ type: Inject, args: [INTERSECTION_OBSERVER_SUPPORT,] }] }, | ||
{ type: String, decorators: [{ type: Inject, args: [INTERSECTION_ROOT_MARGIN,] }] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INTERSECTION_THRESHOLD,] }] }, | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [INTERSECTION_ROOT,] }] } | ||
]; }; | ||
return IntersectionObserverService; | ||
}(Observable)); | ||
export { rootMarginFactory, thresholdFactory, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
export { IntersectionObserveeDirective, IntersectionObserverDirective, IntersectionRootDirective, IntersectionObserverModule, IntersectionObserveeService, IntersectionObserverService, INTERSECTION_ROOT, INTERSECTION_ROOT_MARGIN_DEFAULT, INTERSECTION_ROOT_MARGIN, INTERSECTION_THRESHOLD_DEFAULT, INTERSECTION_THRESHOLD, INTERSECTION_OBSERVER_SUPPORT }; | ||
//# sourceMappingURL=ng-web-apis-intersection-observer.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"rootMarginFactory":{"__symbolic":"function","parameters":["rootMargin"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"rootMargin"},"right":{"__symbolic":"reference","name":"INTERSECTION_ROOT_MARGIN_DEFAULT"}}},"thresholdFactory":{"__symbolic":"function","parameters":["threshold"],"value":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"threshold"},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"threshold"},"member":"split"},"arguments":[","]},"member":"map"},"arguments":[{"__symbolic":"reference","name":"parseFloat"}]},"elseExpression":{"__symbolic":"reference","name":"INTERSECTION_THRESHOLD_DEFAULT"}}},"IntersectionObserverDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":22,"character":1},"arguments":[{"selector":"[waIntersectionObserver]","providers":[{"__symbolic":"reference","name":"IntersectionObserverService"},{"provide":{"__symbolic":"reference","name":"INTERSECTION_ROOT_MARGIN"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute","line":28,"character":24},"arguments":["waIntersectionRootMargin"]}]],"useFactory":{"__symbolic":"reference","name":"rootMarginFactory"}},{"provide":{"__symbolic":"reference","name":"INTERSECTION_THRESHOLD"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute","line":33,"character":24},"arguments":["waIntersectionThreshold"]}]],"useFactory":{"__symbolic":"reference","name":"thresholdFactory"}}]}]}],"members":{"waIntersectionObserver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":39,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":43,"character":9},"arguments":[{"__symbolic":"reference","name":"IntersectionObserverService"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute","line":45,"character":9},"arguments":["waIntersectionRootMargin"]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute","line":46,"character":9},"arguments":["waIntersectionThreshold"]}]],"parameters":[{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":44,"character":29,"context":{"typeName":"IntersectionObserverEntry"},"module":"./directives/intersection-observer.directive"}]}]},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}]}},"IntersectionRootDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":3,"character":1},"arguments":[{"selector":"[waIntersectionRoot]","providers":[{"provide":{"__symbolic":"reference","name":"INTERSECTION_ROOT"},"useExisting":{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":8,"character":25}}]}]}],"members":{}},"IntersectionObserverModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"IntersectionObserverDirective"},{"__symbolic":"reference","name":"IntersectionRootDirective"}],"exports":[{"__symbolic":"reference","name":"IntersectionObserverDirective"},{"__symbolic":"reference","name":"IntersectionRootDirective"}]}]}],"members":{}},"IntersectionObserverService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"Observable","line":9,"character":49},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":11,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":11,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":12,"character":9},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_OBSERVER_SUPPORT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":13,"character":9},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_ROOT_MARGIN"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":14,"character":9},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_THRESHOLD"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":15,"character":9}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":15,"character":21},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_ROOT"}]}]],"parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":15,"character":64,"context":{"typeName":"Element"},"module":"./services/intersection-observer.service"}]},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":15,"character":64,"context":{"typeName":"Element"},"module":"./services/intersection-observer.service"}]}]}]}},"INTERSECTION_ROOT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":2,"character":37},"arguments":["Root element for IntersectionObserver"]},"INTERSECTION_ROOT_MARGIN_DEFAULT":"0px 0px 0px 0px","INTERSECTION_ROOT_MARGIN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":44},"arguments":["rootMargin for IntersectionObserver",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":17,"module":"./tokens/intersection-root-margin"}]},"INTERSECTION_THRESHOLD":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":42},"arguments":["threshold for IntersectionObserver",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":17,"module":"./tokens/intersection-threshold"}]},"INTERSECTION_OBSERVER_SUPPORT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":10,"character":49},"arguments":["Intersection Observer API support",{"__symbolic":"error","message":"Lambda not supported","line":14,"character":17,"module":"./tokens/support"}]}},"origins":{"rootMarginFactory":"./directives/intersection-observer.directive","thresholdFactory":"./directives/intersection-observer.directive","IntersectionObserverDirective":"./directives/intersection-observer.directive","IntersectionRootDirective":"./directives/intersection-root.directive","IntersectionObserverModule":"./module","IntersectionObserverService":"./services/intersection-observer.service","INTERSECTION_ROOT":"./tokens/intersection-root","INTERSECTION_ROOT_MARGIN_DEFAULT":"./tokens/intersection-root-margin","INTERSECTION_ROOT_MARGIN":"./tokens/intersection-root-margin","INTERSECTION_THRESHOLD_DEFAULT":"./tokens/intersection-threshold","INTERSECTION_THRESHOLD":"./tokens/intersection-threshold","INTERSECTION_OBSERVER_SUPPORT":"./tokens/support"},"importAs":"@ng-web-apis/intersection-observer"} | ||
{"__symbolic":"module","version":4,"metadata":{"IntersectionObserveeDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"[waIntersectionObservee]","outputs":["waIntersectionObservee"],"providers":[{"__symbolic":"reference","name":"IntersectionObserveeService"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":12,"character":9},"arguments":[{"__symbolic":"reference","name":"IntersectionObserveeService"}]}]],"parameters":[{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":52,"context":{"typeName":"IntersectionObserverEntry"},"module":"./directives/intersection-observee.directive"}]}]}]}]}},"IntersectionObserverDirective":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"IntersectionObserver"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":12,"character":1},"arguments":[{"selector":"[waIntersectionObserver]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":20,"character":9}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":21},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_ROOT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute","line":21,"character":9},"arguments":["waIntersectionRootMargin"]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute","line":22,"character":9},"arguments":["waIntersectionThreshold"]}]],"parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":20,"character":64,"context":{"typeName":"Element"},"module":"./directives/intersection-observer.directive"}]},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}],"observe":[{"__symbolic":"method"}],"unobserve":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"IntersectionRootDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":3,"character":1},"arguments":[{"selector":"[waIntersectionRoot]","providers":[{"provide":{"__symbolic":"reference","name":"INTERSECTION_ROOT"},"useExisting":{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":8,"character":25}}]}]}],"members":{}},"IntersectionObserverModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":5,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"IntersectionObserverDirective"},{"__symbolic":"reference","name":"IntersectionObserveeDirective"},{"__symbolic":"reference","name":"IntersectionRootDirective"}],"exports":[{"__symbolic":"reference","name":"IntersectionObserverDirective"},{"__symbolic":"reference","name":"IntersectionObserveeDirective"},{"__symbolic":"reference","name":"IntersectionRootDirective"}]}]}],"members":{}},"IntersectionObserveeService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"Observable","line":6,"character":49},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":8,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":8,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":9,"character":9},"arguments":[{"__symbolic":"reference","name":"IntersectionObserverDirective"}]}]],"parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":56,"context":{"typeName":"Element"},"module":"./services/intersection-observee.service"}]},{"__symbolic":"reference","name":"IntersectionObserverDirective"}]}]}},"IntersectionObserverService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"Observable","line":9,"character":49},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":11,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":11,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":12,"character":9},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_OBSERVER_SUPPORT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":13,"character":9},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_ROOT_MARGIN"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":14,"character":9},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_THRESHOLD"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":15,"character":9}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":15,"character":21},"arguments":[{"__symbolic":"reference","name":"INTERSECTION_ROOT"}]}]],"parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":15,"character":64,"context":{"typeName":"Element"},"module":"./services/intersection-observer.service"}]},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":15,"character":64,"context":{"typeName":"Element"},"module":"./services/intersection-observer.service"}]}]}]}},"INTERSECTION_ROOT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":2,"character":37},"arguments":["Root element for IntersectionObserver"]},"INTERSECTION_ROOT_MARGIN_DEFAULT":"0px 0px 0px 0px","INTERSECTION_ROOT_MARGIN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":44},"arguments":["rootMargin for IntersectionObserver",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":17,"module":"./tokens/intersection-root-margin"}]},"INTERSECTION_THRESHOLD":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":42},"arguments":["threshold for IntersectionObserver",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":17,"module":"./tokens/intersection-threshold"}]},"INTERSECTION_OBSERVER_SUPPORT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":10,"character":49},"arguments":["Intersection Observer API support",{"__symbolic":"error","message":"Lambda not supported","line":14,"character":17,"module":"./tokens/support"}]}},"origins":{"IntersectionObserveeDirective":"./directives/intersection-observee.directive","IntersectionObserverDirective":"./directives/intersection-observer.directive","IntersectionRootDirective":"./directives/intersection-root.directive","IntersectionObserverModule":"./module","IntersectionObserveeService":"./services/intersection-observee.service","IntersectionObserverService":"./services/intersection-observer.service","INTERSECTION_ROOT":"./tokens/intersection-root","INTERSECTION_ROOT_MARGIN_DEFAULT":"./tokens/intersection-root-margin","INTERSECTION_ROOT_MARGIN":"./tokens/intersection-root-margin","INTERSECTION_THRESHOLD_DEFAULT":"./tokens/intersection-threshold","INTERSECTION_THRESHOLD":"./tokens/intersection-threshold","INTERSECTION_OBSERVER_SUPPORT":"./tokens/support"},"importAs":"@ng-web-apis/intersection-observer"} |
{ | ||
"name": "@ng-web-apis/intersection-observer", | ||
"version": "1.1.3", | ||
"version": "2.0.0", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/core": ">=6.0.0", |
/** | ||
* Public API Surface of @ng-web-apis/intersection-observer | ||
*/ | ||
export * from './directives/intersection-observee.directive'; | ||
export * from './directives/intersection-observer.directive'; | ||
export * from './directives/intersection-root.directive'; | ||
export * from './module'; | ||
export * from './services/intersection-observee.service'; | ||
export * from './services/intersection-observer.service'; | ||
@@ -8,0 +10,0 @@ export * from './tokens/intersection-root'; |
@@ -31,24 +31,56 @@ # Intersection Observer API for Angular | ||
1. Use `waIntersectionRoot` directive to designate root element | ||
for observer. | ||
2. Use `waIntersectionObserver` directive to observe an element: | ||
1. Create [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver) with `waIntersectionObserver` directive | ||
2. Observe elements with `waIntersectionObservee` directive | ||
3. _Optional:_ provide root element with `waIntersectionRoot` directive and | ||
use `waIntersectionThreshold` and `waIntersectionRootMargin` attributes to configure | ||
[IntersectionObserver options](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver) | ||
> **NOTE:** Keep in mind these are used one time in constructor so you cannot use binding, only strings. Pass comma separated numbers to set an array of thresholds.. | ||
## Examples | ||
Observing multiple elements intersecting with viewport using single observer | ||
```html | ||
<section waIntersectionObserver waIntersectionThreshold="0.5"> | ||
<div (waIntersectionObservee)="onIntersection($event)"> | ||
I'm being observed | ||
</div> | ||
<div (waIntersectionObservee)="onIntersection($event)"> | ||
I'm being observed | ||
</div> | ||
</section> | ||
``` | ||
Observing elements intersecting with parent element, | ||
each having different configuration therefore using individual observers: | ||
```html | ||
<section waIntersectionRoot> | ||
<h1 waIntersectionThreshold="0.5" (waIntersectionObserver)="onIntersection($event)"> | ||
<div | ||
waIntersectionObserver | ||
waIntersectionThreshold="0.5" | ||
(waIntersectionObservee)="onIntersection($event)" | ||
> | ||
I'm being observed | ||
</h1> | ||
</div> | ||
<div | ||
waIntersectionObserver | ||
waIntersectionThreshold="1,0.5,0" | ||
(waIntersectionObservee)="onIntersection($event)" | ||
> | ||
I'm being observed | ||
</div> | ||
</section> | ||
``` | ||
Use `waIntersectionThreshold` and `waIntersectionRootMargin` attributes to configure | ||
[IntersectionObserver options](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver) | ||
## Services | ||
**NOTE:** Keep in mind these are used one time in constructor so you cannot use | ||
binding, only strings. Pass coma separated numbers to set an array of thresholds. | ||
Alternatively you can use `Observable`-based services: | ||
## Service | ||
1. `IntersectionObserveeService` can be used to observe elements under `waIntersectionObserver` | ||
directive in the DI tree | ||
Alternatively you can use `Observable`-based `IntersectionObserverService` and provide tokens | ||
`INTERSECTION_ROOT_MARGIN` and `INTERSECTION_THRESHOLD` manually: | ||
2. `IntersectionObserverService` can be used to observe single element independently. | ||
Provide tokens manually to configure it: | ||
@@ -64,2 +96,6 @@ ```typescript | ||
}, | ||
{ | ||
provide: INTERSECTION_ROOT_MARGIN, | ||
useValue: '10px', | ||
}, | ||
], | ||
@@ -72,4 +108,2 @@ }) | ||
entries$.subscribe(entries => { | ||
// This will trigger once my-component becomes half way visible | ||
// in parent element designated with waIntersectionRoot directive | ||
// Don't forget to unsubscribe | ||
@@ -82,2 +116,5 @@ console.log(entries); | ||
> In this case provide `INTERSECTION_ROOT` up the DI tree if you | ||
> want to observe intersection with a particular parent element | ||
## Browser support | ||
@@ -84,0 +121,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
208316
54
1633
138
1