angular-infinity-scrolling 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/angular-infinity-scroller",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,41 +1,31 @@
1
- {
2
- "name": "angular-infinity-scrolling",
3
- "version": "1.5.0",
4
- "repository": {
5
- "type": "git",
6
- "url": "https://github.com/Jayant061/angular-infinity-scroller"
7
- },
8
- "bugs": {
9
- "url": "https://github.com/Jayant061/angular-infinity-scroller/issues"
10
- },
11
- "keywords": [
12
- "Angular-infinity-scroller",
13
- "infinity-scroller",
14
- "Angular-infinite-scroller",
15
- "Angular-infinite-scroll",
16
- "infinte-scroll",
17
- "infinite",
18
- "Angular"
19
- ],
20
- "author": "Jayant Thakur",
21
- "license": "ISC",
22
- "peerDependencies": {
23
- "@angular/common": "^19.0.0",
24
- "@angular/core": "^19.0.0"
25
- },
26
- "dependencies": {
27
- "tslib": "^2.3.0"
28
- },
29
- "sideEffects": false,
30
- "module": "fesm2022/angular-infinity-scrolling.mjs",
31
- "typings": "index.d.ts",
32
- "exports": {
33
- "./package.json": {
34
- "default": "./package.json"
35
- },
36
- ".": {
37
- "types": "./index.d.ts",
38
- "default": "./fesm2022/angular-infinity-scrolling.mjs"
39
- }
40
- }
41
- }
1
+ {
2
+ "name": "angular-infinity-scrolling",
3
+ "version": "1.5.2",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/Jayant061/angular-infinity-scroller"
7
+ },
8
+ "bugs": {
9
+ "url": "https://github.com/Jayant061/angular-infinity-scroller/issues"
10
+ },
11
+ "keywords": [
12
+ "Angular-infinity-scrolling",
13
+ "Angular-infinity-scroller",
14
+ "infinity-scroller",
15
+ "Angular-infinite-scroller",
16
+ "Angular-infinite-scroll",
17
+ "infinte-scroll",
18
+ "infinite",
19
+ "Angular"
20
+ ],
21
+ "author": "Jayant Thakur",
22
+ "license": "ISC",
23
+ "peerDependencies": {
24
+ "@angular/common": "^19.0.0",
25
+ "@angular/core": "^19.0.0"
26
+ },
27
+ "dependencies": {
28
+ "tslib": "^2.3.0"
29
+ },
30
+ "sideEffects": false
31
+ }
@@ -0,0 +1,8 @@
1
+ import { AngularInfinityScrollerDirective } from './angular-infinity-scroller.directive';
2
+
3
+ describe('AngularInfinityScrollerDirective', () => {
4
+ it('should create an instance', () => {
5
+ const directive = new AngularInfinityScrollerDirective();
6
+ expect(directive).toBeTruthy();
7
+ });
8
+ });
@@ -0,0 +1,39 @@
1
+ import { Directive, ElementRef, inject, input, output } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[angularInfinityScroller]',
5
+ standalone: true
6
+ })
7
+ export class AngularInfinityScrollerDirective {
8
+
9
+ constructor() { }
10
+ public scrollDistance = input<number>();
11
+ public onScrolled = output();
12
+ private el:ElementRef<HTMLDivElement> = inject(ElementRef);
13
+ private prevScrollHeight:number = 0;
14
+ ngAfterViewInit(): void {
15
+ this.el.nativeElement.addEventListener('scroll',this.onScroll.bind(this));
16
+ }
17
+
18
+ ngOnDestroy(): void {
19
+ this.el.nativeElement.removeEventListener('scroll',this.onScroll.bind(this));
20
+ }
21
+ private isEmit:boolean = true;
22
+ private onScroll():void{
23
+ const height = Math.floor(this.el?.nativeElement.scrollHeight - this.el.nativeElement.clientHeight);
24
+ const scrollValue = Math.floor(this.el?.nativeElement.scrollTop);
25
+ const emitTriggerHeight = Math.ceil((1-((this.scrollDistance()??2)/10))*height);
26
+ if(scrollValue>= (emitTriggerHeight) && !this.isEmit){
27
+ return;
28
+ }
29
+ else if(scrollValue < (emitTriggerHeight)){
30
+ this.isEmit = true;
31
+ }
32
+ if(scrollValue>= (emitTriggerHeight) && this.prevScrollHeight !== height){
33
+ this.onScrolled.emit();
34
+ this.prevScrollHeight = height;
35
+ this.isEmit = false;
36
+ }
37
+ }
38
+
39
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of angular-infinity-scroller
3
+ */
4
+
5
+ export * from './lib/angular-infinity-scroller.directive'
@@ -0,0 +1,15 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/lib",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "types": []
11
+ },
12
+ "exclude": [
13
+ "**/*.spec.ts"
14
+ ]
15
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "types": [
8
+ "jasmine"
9
+ ]
10
+ },
11
+ "include": [
12
+ "**/*.spec.ts",
13
+ "**/*.d.ts"
14
+ ]
15
+ }
@@ -1,53 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { input, output, inject, ElementRef, Directive } from '@angular/core';
3
-
4
- class AngularInfinityScrollerDirective {
5
- constructor() { }
6
- scrollDistance = input();
7
- onScrolled = output();
8
- el = inject(ElementRef);
9
- prevScrollHeight = 0;
10
- ngAfterViewInit() {
11
- this.el.nativeElement.addEventListener('scroll', this.onScroll.bind(this));
12
- }
13
- ngOnDestroy() {
14
- this.el.nativeElement.removeEventListener('scroll', this.onScroll.bind(this));
15
- }
16
- isEmit = true;
17
- onScroll() {
18
- const height = Math.floor(this.el?.nativeElement.scrollHeight - this.el.nativeElement.clientHeight);
19
- const scrollValue = Math.floor(this.el?.nativeElement.scrollTop);
20
- const emitTriggerHeight = Math.ceil((1 - ((this.scrollDistance() ?? 2) / 10)) * height);
21
- if (scrollValue >= (emitTriggerHeight) && !this.isEmit) {
22
- return;
23
- }
24
- else if (scrollValue < (emitTriggerHeight)) {
25
- this.isEmit = true;
26
- }
27
- if (scrollValue >= (emitTriggerHeight) && this.prevScrollHeight !== height) {
28
- this.onScrolled.emit();
29
- this.prevScrollHeight = height;
30
- this.isEmit = false;
31
- }
32
- }
33
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: AngularInfinityScrollerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
34
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.1", type: AngularInfinityScrollerDirective, isStandalone: true, selector: "[angularInfinityScroller]", inputs: { scrollDistance: { classPropertyName: "scrollDistance", publicName: "scrollDistance", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScrolled: "onScrolled" }, ngImport: i0 });
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: AngularInfinityScrollerDirective, decorators: [{
37
- type: Directive,
38
- args: [{
39
- selector: '[angularInfinityScroller]',
40
- standalone: true
41
- }]
42
- }], ctorParameters: () => [] });
43
-
44
- /*
45
- * Public API Surface of angular-infinity-scroller
46
- */
47
-
48
- /**
49
- * Generated bundle index. Do not edit.
50
- */
51
-
52
- export { AngularInfinityScrollerDirective };
53
- //# sourceMappingURL=angular-infinity-scrolling.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"angular-infinity-scrolling.mjs","sources":["../../../projects/angular-infinity-scroller/src/lib/angular-infinity-scroller.directive.ts","../../../projects/angular-infinity-scroller/src/public-api.ts","../../../projects/angular-infinity-scroller/src/angular-infinity-scrolling.ts"],"sourcesContent":["import { Directive, ElementRef, inject, input, output } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[angularInfinityScroller]',\r\n standalone: true\r\n})\r\nexport class AngularInfinityScrollerDirective {\r\n\r\n constructor() { }\r\n public scrollDistance = input<number>();\r\n public onScrolled = output();\r\n private el:ElementRef<HTMLDivElement> = inject(ElementRef);\r\n private prevScrollHeight:number = 0;\r\n ngAfterViewInit(): void {\r\n this.el.nativeElement.addEventListener('scroll',this.onScroll.bind(this));\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.el.nativeElement.removeEventListener('scroll',this.onScroll.bind(this));\r\n }\r\n private isEmit:boolean = true;\r\n private onScroll():void{\r\n const height = Math.floor(this.el?.nativeElement.scrollHeight - this.el.nativeElement.clientHeight);\r\n const scrollValue = Math.floor(this.el?.nativeElement.scrollTop);\r\n const emitTriggerHeight = Math.ceil((1-((this.scrollDistance()??2)/10))*height);\r\n if(scrollValue>= (emitTriggerHeight) && !this.isEmit){\r\n return;\r\n }\r\n else if(scrollValue < (emitTriggerHeight)){\r\n this.isEmit = true;\r\n }\r\n if(scrollValue>= (emitTriggerHeight) && this.prevScrollHeight !== height){\r\n this.onScrolled.emit();\r\n this.prevScrollHeight = height;\r\n this.isEmit = false;\r\n }\r\n }\r\n\r\n}\r\n","/*\r\n * Public API Surface of angular-infinity-scroller\r\n */\r\n\r\nexport * from './lib/angular-infinity-scroller.directive'\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAMa,gCAAgC,CAAA;AAE3C,IAAA,WAAA,GAAA;IACO,cAAc,GAAG,KAAK,EAAU;IAChC,UAAU,GAAG,MAAM,EAAE;AACpB,IAAA,EAAE,G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A,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAhC,gCAAgC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,2BAAA,EAAA,MAAA,EAAA,EAAA,cAAA,EAAA,EAAA,iBAAA,EAAA,gBAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAhC,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAJ5C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,2BAA2B;AACrC,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACLD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="angular-infinity-scrolling" />
5
- export * from './public-api';
@@ -1,14 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class AngularInfinityScrollerDirective {
3
- constructor();
4
- scrollDistance: import("@angular/core").InputSignal<number | undefined>;
5
- onScrolled: import("@angular/core").OutputEmitterRef<void>;
6
- private el;
7
- private prevScrollHeight;
8
- ngAfterViewInit(): void;
9
- ngOnDestroy(): void;
10
- private isEmit;
11
- private onScroll;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<AngularInfinityScrollerDirective, never>;
13
- static ɵdir: i0.ɵɵDirectiveDeclaration<AngularInfinityScrollerDirective, "[angularInfinityScroller]", never, { "scrollDistance": { "alias": "scrollDistance"; "required": false; "isSignal": true; }; }, { "onScrolled": "onScrolled"; }, never, never, true, never>;
14
- }
package/public-api.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './lib/angular-infinity-scroller.directive';