@su-labs/scroll-spy 19.1.2 → 20.1.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.
package/README.md CHANGED
@@ -56,24 +56,24 @@ A lightweight Angular service and directive for managing active sections based o
56
56
  You can install this library via npm:
57
57
 
58
58
  ```sh
59
- npm install @su-labs/scroll-spy@ng19
59
+ npm install @su-labs/scroll-spy@ng20
60
60
  ```
61
61
 
62
- This is the Angular 19 version. For the newest Angular, install `@su-labs/scroll-spy` without a tag.
62
+ This is the Angular 20 version. For the newest Angular, install `@su-labs/scroll-spy` without a tag.
63
63
 
64
64
  ## Peer Dependencies
65
65
 
66
66
  This library requires the following peer dependencies:
67
67
 
68
68
  ```sh
69
- npm install @angular/common@^19 @angular/core@^19
69
+ npm install @angular/common@^20 @angular/core@^20
70
70
  ```
71
71
 
72
72
  ## Quick Start
73
73
 
74
74
  ```typescript
75
75
  // 1. Install
76
- npm install @su-labs/scroll-spy@ng19
76
+ npm install @su-labs/scroll-spy@ng20
77
77
 
78
78
  // 2. Add directive to your sections
79
79
  @for (section of sections; track section.id) {
@@ -204,7 +204,7 @@ The `ScrollSpyDirective` uses the browser's native [IntersectionObserver API](ht
204
204
 
205
205
  Works in all modern browsers that support:
206
206
  - IntersectionObserver API
207
- - Angular 19
207
+ - Angular 20
208
208
  - ES2022+
209
209
 
210
210
  | Browser | Version |
@@ -239,7 +239,7 @@ Make sure you've imported `ScrollSpyDirective` in your component's imports array
239
239
 
240
240
  ### TypeScript errors?
241
241
 
242
- Ensure you have Angular 19 and TypeScript 5.5+ installed.
242
+ Ensure you have Angular 20 and TypeScript 5.8+ installed.
243
243
 
244
244
  ## Support
245
245
 
@@ -11,7 +11,7 @@ import { observeSuScrollSpySection } from '@su-labs/core/scroll-spy';
11
11
  */
12
12
  class ScrollSpyService {
13
13
  /** ID of the currently visible section ('' until a section becomes active) */
14
- activeSection = signal('');
14
+ activeSection = signal('', ...(ngDevMode ? [{ debugName: "activeSection" }] : []));
15
15
  /**
16
16
  * Set the active section manually, for example when a navigation link is clicked.
17
17
  * @param id ID of the section.
@@ -19,10 +19,10 @@ class ScrollSpyService {
19
19
  setActiveSection(id) {
20
20
  this.activeSection.set(id);
21
21
  }
22
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ScrollSpyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
23
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ScrollSpyService, providedIn: 'root' });
22
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ScrollSpyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
23
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ScrollSpyService, providedIn: 'root' });
24
24
  }
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ScrollSpyService, decorators: [{
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ScrollSpyService, decorators: [{
26
26
  type: Injectable,
27
27
  args: [{ providedIn: 'root' }]
28
28
  }] });
@@ -47,10 +47,10 @@ class ScrollSpyDirective {
47
47
  ngOnDestroy() {
48
48
  this.stopObserving?.();
49
49
  }
50
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ScrollSpyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
51
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: ScrollSpyDirective, isStandalone: true, selector: "[appScrollSpy]", inputs: { sectionId: ["appScrollSpy", "sectionId"] }, ngImport: i0 });
50
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ScrollSpyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
51
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: ScrollSpyDirective, isStandalone: true, selector: "[appScrollSpy]", inputs: { sectionId: ["appScrollSpy", "sectionId"] }, ngImport: i0 });
52
52
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ScrollSpyDirective, decorators: [{
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ScrollSpyDirective, decorators: [{
54
54
  type: Directive,
55
55
  args: [{
56
56
  selector: '[appScrollSpy]',
@@ -1 +1 @@
1
- {"version":3,"file":"su-labs-scroll-spy.mjs","sources":["../../../../compat/angular-19/build/scroll-spy/src/lib/scroll-spy.service.ts","../../../../compat/angular-19/build/scroll-spy/src/lib/scroll-spy.directive.ts","../../../../compat/angular-19/build/scroll-spy/src/su-labs-scroll-spy.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\n\n/**\n * Service that keeps track of the currently active section while scrolling.\n * Can be injected into components to react to section changes.\n *\n * Sections are tracked by `ScrollSpyDirective`, which uses the framework-agnostic\n * observer from `@su-labs/core/scroll-spy`.\n */\n@Injectable({ providedIn: 'root' })\nexport class ScrollSpyService {\n /** ID of the currently visible section ('' until a section becomes active) */\n activeSection = signal<string>('');\n\n /**\n * Set the active section manually, for example when a navigation link is clicked.\n * @param id ID of the section.\n */\n setActiveSection(id: string): void {\n this.activeSection.set(id);\n }\n}\n","import { Directive, ElementRef, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { observeSuScrollSpySection } from '@su-labs/core/scroll-spy';\nimport { SuUnsubscribe } from '@su-labs/core';\nimport { ScrollSpyService } from './scroll-spy.service';\n\n/**\n * Directive that observes an element's visibility on the screen\n * and updates ScrollSpyService.activeSection when it reaches the vertical center of the viewport.\n *\n * Usage:\n * <section [appScrollSpy]=\"'home'\">...</section>\n */\n@Directive({\n selector: '[appScrollSpy]',\n standalone: true,\n})\nexport class ScrollSpyDirective implements OnInit, OnDestroy {\n /** ID of the observed section */\n @Input('appScrollSpy') sectionId!: string;\n\n private readonly el = inject<ElementRef<Element>>(ElementRef);\n private readonly scrollSpy = inject(ScrollSpyService);\n\n /** Stops observing the section */\n private stopObserving?: SuUnsubscribe;\n\n ngOnInit(): void {\n this.stopObserving = observeSuScrollSpySection(this.el.nativeElement, () =>\n this.scrollSpy.setActiveSection(this.sectionId),\n );\n }\n\n ngOnDestroy(): void {\n this.stopObserving?.();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAEA;;;;;;AAMG;MAEU,gBAAgB,CAAA;;AAE3B,IAAA,aAAa,GAAG,MAAM,CAAS,EAAE,CAAC;AAElC;;;AAGG;AACH,IAAA,gBAAgB,CAAC,EAAU,EAAA;AACzB,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5B;wGAVW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA;;4FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACJlC;;;;;;AAMG;MAKU,kBAAkB,CAAA;;AAEN,IAAA,SAAS;AAEf,IAAA,EAAE,GAAG,MAAM,CAAsB,UAAU,CAAC;AAC5C,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;;AAG7C,IAAA,aAAa;IAErB,QAAQ,GAAA;QACN,IAAI,CAAC,aAAa,GAAG,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,MACpE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAChD;IACH;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,aAAa,IAAI;IACxB;wGAlBW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,CAAA,cAAA,EAAA,WAAA,CAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;8BAGwB,SAAS,EAAA,CAAA;sBAA/B,KAAK;uBAAC,cAAc;;;AClBvB;;AAEG;;;;"}
1
+ {"version":3,"file":"su-labs-scroll-spy.mjs","sources":["../../../../compat/angular-20/build/scroll-spy/src/lib/scroll-spy.service.ts","../../../../compat/angular-20/build/scroll-spy/src/lib/scroll-spy.directive.ts","../../../../compat/angular-20/build/scroll-spy/src/su-labs-scroll-spy.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\n\n/**\n * Service that keeps track of the currently active section while scrolling.\n * Can be injected into components to react to section changes.\n *\n * Sections are tracked by `ScrollSpyDirective`, which uses the framework-agnostic\n * observer from `@su-labs/core/scroll-spy`.\n */\n@Injectable({ providedIn: 'root' })\nexport class ScrollSpyService {\n /** ID of the currently visible section ('' until a section becomes active) */\n activeSection = signal<string>('');\n\n /**\n * Set the active section manually, for example when a navigation link is clicked.\n * @param id ID of the section.\n */\n setActiveSection(id: string): void {\n this.activeSection.set(id);\n }\n}\n","import { Directive, ElementRef, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { observeSuScrollSpySection } from '@su-labs/core/scroll-spy';\nimport { SuUnsubscribe } from '@su-labs/core';\nimport { ScrollSpyService } from './scroll-spy.service';\n\n/**\n * Directive that observes an element's visibility on the screen\n * and updates ScrollSpyService.activeSection when it reaches the vertical center of the viewport.\n *\n * Usage:\n * <section [appScrollSpy]=\"'home'\">...</section>\n */\n@Directive({\n selector: '[appScrollSpy]',\n standalone: true,\n})\nexport class ScrollSpyDirective implements OnInit, OnDestroy {\n /** ID of the observed section */\n @Input('appScrollSpy') sectionId!: string;\n\n private readonly el = inject<ElementRef<Element>>(ElementRef);\n private readonly scrollSpy = inject(ScrollSpyService);\n\n /** Stops observing the section */\n private stopObserving?: SuUnsubscribe;\n\n ngOnInit(): void {\n this.stopObserving = observeSuScrollSpySection(this.el.nativeElement, () =>\n this.scrollSpy.setActiveSection(this.sectionId),\n );\n }\n\n ngOnDestroy(): void {\n this.stopObserving?.();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAEA;;;;;;AAMG;MAEU,gBAAgB,CAAA;;AAE3B,IAAA,aAAa,GAAG,MAAM,CAAS,EAAE,yDAAC;AAElC;;;AAGG;AACH,IAAA,gBAAgB,CAAC,EAAU,EAAA;AACzB,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5B;wGAVW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA;;4FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACJlC;;;;;;AAMG;MAKU,kBAAkB,CAAA;;AAEN,IAAA,SAAS;AAEf,IAAA,EAAE,GAAG,MAAM,CAAsB,UAAU,CAAC;AAC5C,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;;AAG7C,IAAA,aAAa;IAErB,QAAQ,GAAA;QACN,IAAI,CAAC,aAAa,GAAG,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,MACpE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAChD;IACH;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,aAAa,IAAI;IACxB;wGAlBW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,CAAA,cAAA,EAAA,WAAA,CAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;sBAGE,KAAK;uBAAC,cAAc;;;AClBvB;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,5 +1,43 @@
1
+ import * as i0 from '@angular/core';
2
+ import { OnInit, OnDestroy } from '@angular/core';
3
+
1
4
  /**
2
- * Generated bundle index. Do not edit.
5
+ * Service that keeps track of the currently active section while scrolling.
6
+ * Can be injected into components to react to section changes.
7
+ *
8
+ * Sections are tracked by `ScrollSpyDirective`, which uses the framework-agnostic
9
+ * observer from `@su-labs/core/scroll-spy`.
3
10
  */
4
- /// <amd-module name="@su-labs/scroll-spy" />
5
- export * from './public-api';
11
+ declare class ScrollSpyService {
12
+ /** ID of the currently visible section ('' until a section becomes active) */
13
+ activeSection: i0.WritableSignal<string>;
14
+ /**
15
+ * Set the active section manually, for example when a navigation link is clicked.
16
+ * @param id ID of the section.
17
+ */
18
+ setActiveSection(id: string): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollSpyService, never>;
20
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollSpyService>;
21
+ }
22
+
23
+ /**
24
+ * Directive that observes an element's visibility on the screen
25
+ * and updates ScrollSpyService.activeSection when it reaches the vertical center of the viewport.
26
+ *
27
+ * Usage:
28
+ * <section [appScrollSpy]="'home'">...</section>
29
+ */
30
+ declare class ScrollSpyDirective implements OnInit, OnDestroy {
31
+ /** ID of the observed section */
32
+ sectionId: string;
33
+ private readonly el;
34
+ private readonly scrollSpy;
35
+ /** Stops observing the section */
36
+ private stopObserving?;
37
+ ngOnInit(): void;
38
+ ngOnDestroy(): void;
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollSpyDirective, never>;
40
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollSpyDirective, "[appScrollSpy]", never, { "sectionId": { "alias": "appScrollSpy"; "required": false; }; }, {}, never, never, true, never>;
41
+ }
42
+
43
+ export { ScrollSpyDirective, ScrollSpyService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@su-labs/scroll-spy",
3
- "version": "19.1.2",
3
+ "version": "20.1.2",
4
4
  "description": "An Angular scroll spy utility based on IntersectionObserver for tracking active sections or menu items.",
5
5
  "keywords": [
6
6
  "angular",
@@ -29,8 +29,8 @@
29
29
  "url": "https://github.com/Greezaaa/settings-utils-lib/issues"
30
30
  },
31
31
  "peerDependencies": {
32
- "@angular/common": "^19.0.0",
33
- "@angular/core": "^19.0.0"
32
+ "@angular/common": "^20.0.0",
33
+ "@angular/core": "^20.0.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "@su-labs/core": "1.9.0",
@@ -1,21 +0,0 @@
1
- import { OnDestroy, OnInit } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Directive that observes an element's visibility on the screen
5
- * and updates ScrollSpyService.activeSection when it reaches the vertical center of the viewport.
6
- *
7
- * Usage:
8
- * <section [appScrollSpy]="'home'">...</section>
9
- */
10
- export declare class ScrollSpyDirective implements OnInit, OnDestroy {
11
- /** ID of the observed section */
12
- sectionId: string;
13
- private readonly el;
14
- private readonly scrollSpy;
15
- /** Stops observing the section */
16
- private stopObserving?;
17
- ngOnInit(): void;
18
- ngOnDestroy(): void;
19
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollSpyDirective, never>;
20
- static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollSpyDirective, "[appScrollSpy]", never, { "sectionId": { "alias": "appScrollSpy"; "required": false; }; }, {}, never, never, true, never>;
21
- }
@@ -1,19 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- /**
3
- * Service that keeps track of the currently active section while scrolling.
4
- * Can be injected into components to react to section changes.
5
- *
6
- * Sections are tracked by `ScrollSpyDirective`, which uses the framework-agnostic
7
- * observer from `@su-labs/core/scroll-spy`.
8
- */
9
- export declare class ScrollSpyService {
10
- /** ID of the currently visible section ('' until a section becomes active) */
11
- activeSection: import("@angular/core").WritableSignal<string>;
12
- /**
13
- * Set the active section manually, for example when a navigation link is clicked.
14
- * @param id ID of the section.
15
- */
16
- setActiveSection(id: string): void;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollSpyService, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<ScrollSpyService>;
19
- }
package/public-api.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './lib/scroll-spy.service';
2
- export * from './lib/scroll-spy.directive';