@rdlabo/ionic-angular-scroll-header 20.0.3 → 21.0.1

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,72 @@
1
+ ion-header.hidden ion-toolbar {
2
+ --border-width: 0;
3
+ --min-height: 0;
4
+ --background: transparent;
5
+ --border-color: transparent;
6
+ --padding-top: 0;
7
+ --padding-bottom: 0;
8
+ }
9
+
10
+ ion-header.native-header:not(.scroll-header-hidden) {
11
+ box-shadow: none;
12
+ }
13
+ ion-header.native-header:not(.scroll-header-hidden) > ion-toolbar {
14
+ --border-color: transparent;
15
+ }
16
+
17
+ ion-content ion-header,
18
+ ion-content > cdk-virtual-scroll-viewport ion-header {
19
+ opacity: 1;
20
+ }
21
+ ion-content ion-header > ion-toolbar:first-of-type,
22
+ ion-content > cdk-virtual-scroll-viewport ion-header > ion-toolbar:first-of-type {
23
+ padding-top: 0;
24
+ }
25
+ ion-content ion-header > ion-toolbar.large,
26
+ ion-content > cdk-virtual-scroll-viewport ion-header > ion-toolbar.large {
27
+ padding-top: 20px;
28
+ }
29
+ ion-content ion-header > ion-toolbar.large ion-title,
30
+ ion-content ion-header > ion-toolbar.large ion-text.title,
31
+ ion-content > cdk-virtual-scroll-viewport ion-header > ion-toolbar.large ion-title,
32
+ ion-content > cdk-virtual-scroll-viewport ion-header > ion-toolbar.large ion-text.title {
33
+ font-size: 1.5rem;
34
+ font-weight: bold;
35
+ }
36
+ ion-content ion-header > ion-toolbar.large ion-buttons[slot=end],
37
+ ion-content > cdk-virtual-scroll-viewport ion-header > ion-toolbar.large ion-buttons[slot=end] {
38
+ margin-right: 8px;
39
+ }
40
+ ion-content:not(.scroll-header-fixed).scroll-header-sticky ion-header,
41
+ ion-content > cdk-virtual-scroll-viewport:not(.scroll-header-fixed).scroll-header-sticky ion-header {
42
+ position: sticky;
43
+ top: 0;
44
+ will-change: transform, opacity;
45
+ }
46
+ ion-content:not(.scroll-header-fixed).scroll-header-sticky.scroll-header-animated ion-header,
47
+ ion-content > cdk-virtual-scroll-viewport:not(.scroll-header-fixed).scroll-header-sticky.scroll-header-animated ion-header {
48
+ transition: transform 0.4s ease 0s, opacity 0.4s ease 0s;
49
+ }
50
+ ion-content:not(.scroll-header-fixed).scroll-header-sticky:not(.scroll-header-hidden) ion-header,
51
+ ion-content > cdk-virtual-scroll-viewport:not(.scroll-header-fixed).scroll-header-sticky:not(.scroll-header-hidden) ion-header {
52
+ transform: translate3d(0, 0, 0);
53
+ }
54
+ ion-content:not(.scroll-header-fixed):not(.scroll-header-sticky).scroll-header-no-border ion-header,
55
+ ion-content > cdk-virtual-scroll-viewport:not(.scroll-header-fixed):not(.scroll-header-sticky).scroll-header-no-border ion-header {
56
+ box-shadow: none;
57
+ }
58
+ ion-content:not(.scroll-header-fixed):not(.scroll-header-sticky).scroll-header-no-border ion-header > ion-toolbar,
59
+ ion-content > cdk-virtual-scroll-viewport:not(.scroll-header-fixed):not(.scroll-header-sticky).scroll-header-no-border ion-header > ion-toolbar {
60
+ --border-color: transparent;
61
+ }
62
+ ion-content:not(.scroll-header-fixed).scroll-header-hidden ion-header,
63
+ ion-content > cdk-virtual-scroll-viewport:not(.scroll-header-fixed).scroll-header-hidden ion-header {
64
+ transform: translate3d(0, -100%, 0);
65
+ opacity: 0.2;
66
+ }
67
+
68
+ ion-content.scroll-header-hidden ion-button.get-current-timeline {
69
+ transform: translate3d(0, -150%, 0);
70
+ }
71
+
72
+ /*# sourceMappingURL=scroll-header.directive.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["../src/assets/scroll-header.directive.scss"],"names":[],"mappings":"AACE;EACE;EACA;EACA;EACA;EACA;EACA;;;AAKF;EAKE;;AAJA;EACE;;;AASJ;AAAA;EACE;;AAGE;AAAA;EAEE;;AAEF;AAAA;EACE;;AACA;AAAA;AAAA;AAAA;EAEE;EACA;;AAEF;AAAA;EACE;;AAQJ;AAAA;EACE;EACA;EACA;;AAGA;AAAA;EACE,YACE;;AAMJ;AAAA;EACE;;AAMJ;AAAA;EAKE;;AAJA;AAAA;EACE;;AAQJ;AAAA;EACE;EACA;;;AAON;EACE","file":"scroll-header.directive.css"}
@@ -7,12 +7,12 @@ ion-header.hidden ion-toolbar {
7
7
  --padding-bottom: 0;
8
8
  }
9
9
 
10
- ion-header.native-header:not(.scroll-header-hidden) {
11
- box-shadow: none;
12
- }
13
10
  ion-header.native-header:not(.scroll-header-hidden) > ion-toolbar {
14
11
  --border-color: transparent;
15
12
  }
13
+ ion-header.native-header:not(.scroll-header-hidden) {
14
+ box-shadow: none;
15
+ }
16
16
 
17
17
  ion-content ion-header,
18
18
  ion-content > cdk-virtual-scroll-viewport ion-header {
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/assets/scroll-header.directive.scss"],"names":[],"mappings":"AACE;EACE;EACA;EACA;EACA;EACA;EACA;;;AAKF;EAKE;;AAJA;EACE;;;AASJ;AAAA;EACE;;AAGE;AAAA;EAEE;;AAEF;AAAA;EACE;;AACA;AAAA;AAAA;AAAA;EAEE;EACA;;AAEF;AAAA;EACE;;AAQJ;AAAA;EACE;EACA;EACA;;AAGA;AAAA;EACE,YACE;;AAMJ;AAAA;EACE;;AAMJ;AAAA;EACE;;AACA;AAAA;EACE;;AAMJ;AAAA;EACE;EACA","file":"scroll-header.directive.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../src/assets/scroll-header.directive.scss"],"names":[],"mappings":"AACE;EACE;EACA;EACA;EACA;EACA;EACA;;;AAMA;EACE;;AAFJ;EAKE;;;AAMF;AAAA;EACE;;AAGE;AAAA;EAEE;;AAEF;AAAA;EACE;;AACA;AAAA;AAAA;AAAA;EAEE;EACA;;AAEF;AAAA;EACE;;AAQJ;AAAA;EACE;EACA;EACA;;AAGA;AAAA;EACE,YACE;;AAMJ;AAAA;EACE;;AAMJ;AAAA;EACE;;AACA;AAAA;EACE;;AAMJ;AAAA;EACE;EACA","file":"scroll-header.directive.css"}
@@ -0,0 +1,7 @@
1
+ // @ts-check
2
+ const tseslint = require("typescript-eslint");
3
+ const rootConfig = require("../../eslint.config.js");
4
+
5
+ module.exports = tseslint.config(
6
+ ...rootConfig,
7
+ );
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/scroll-header",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "assets": ["src/assets/**", "./css/**/*"]
8
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@rdlabo/ionic-angular-scroll-header",
3
- "version": "20.0.3",
3
+ "version": "21.0.1",
4
4
  "peerDependencies": {
5
- "@angular/cdk": "^20.0.0",
6
- "@angular/common": "^20.0.0",
5
+ "@angular/cdk": "^21.0.0",
6
+ "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^20.0.0"
8
8
  },
9
9
  "dependencies": {
@@ -12,16 +12,7 @@
12
12
  "exports": {
13
13
  "./css/*": {
14
14
  "style": "./css/*"
15
- },
16
- "./package.json": {
17
- "default": "./package.json"
18
- },
19
- ".": {
20
- "types": "./index.d.ts",
21
- "default": "./fesm2022/rdlabo-ionic-angular-scroll-header.mjs"
22
15
  }
23
16
  },
24
- "sideEffects": false,
25
- "module": "fesm2022/rdlabo-ionic-angular-scroll-header.mjs",
26
- "typings": "index.d.ts"
27
- }
17
+ "sideEffects": false
18
+ }
@@ -0,0 +1,36 @@
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
4
+ import { FixVirtualScrollElementDirective } from './fix-virtual-scroll-element.directive';
5
+ import { testConfig } from '../../../../util/test.config';
6
+
7
+ @Component({
8
+ template: `
9
+ <cdk-virtual-scroll-viewport itemSize="50" style="height: 200px" rdlaboFixVirtualScrollElement>
10
+ <div *cdkVirtualFor="let item of items">{{ item }}</div>
11
+ </cdk-virtual-scroll-viewport>
12
+ `,
13
+ imports: [CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, FixVirtualScrollElementDirective, CdkVirtualForOf],
14
+ })
15
+ class TestComponent {
16
+ items = [1, 2, 3, 4, 5];
17
+ }
18
+
19
+ describe('FixVirtualScrollElementDirective', () => {
20
+ let fixture: ComponentFixture<TestComponent>;
21
+
22
+ beforeEach(() => {
23
+ TestBed.configureTestingModule({
24
+ providers: testConfig.providers,
25
+ });
26
+ fixture = TestBed.createComponent(TestComponent);
27
+ fixture.detectChanges();
28
+ });
29
+
30
+ it('should create the directive instance', () => {
31
+ const directiveEl = fixture.debugElement.query((el) => el.nativeElement.tagName.toLowerCase() === 'cdk-virtual-scroll-viewport');
32
+
33
+ const directiveInstance = directiveEl.injector.get(FixVirtualScrollElementDirective);
34
+ expect(directiveInstance).toBeTruthy();
35
+ });
36
+ });
@@ -0,0 +1,20 @@
1
+ import { Directive, ElementRef, inject, OnInit } from '@angular/core';
2
+ import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
3
+
4
+ @Directive({
5
+ selector: 'cdk-virtual-scroll-viewport[rdlaboFixVirtualScrollElement]',
6
+ })
7
+ export class FixVirtualScrollElementDirective implements OnInit {
8
+ readonly #elementRef = inject(ElementRef<CdkVirtualScrollViewport>);
9
+
10
+ ngOnInit() {
11
+ const nativeEl = this.#elementRef.nativeElement;
12
+ if (nativeEl) {
13
+ const last = nativeEl.lastElementChild;
14
+ if (nativeEl.firstElementChild && last) {
15
+ nativeEl.replaceChild(nativeEl.firstElementChild, nativeEl.lastElementChild);
16
+ nativeEl.insertBefore(last, nativeEl.firstElementChild);
17
+ }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,59 @@
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { IonContent, IonHeader } from '@ionic/angular/standalone';
4
+ import { ScrollHeaderDirective } from './scroll-header.directive';
5
+ import { testConfig } from '../../../../util/test.config';
6
+
7
+ @Component({
8
+ template: `
9
+ <ion-content rdlaboScrollHeader>
10
+ <ion-header>
11
+ <div>Header Content</div>
12
+ </ion-header>
13
+ <div>Content</div>
14
+ </ion-content>
15
+ `,
16
+ imports: [IonContent, IonHeader, ScrollHeaderDirective],
17
+ })
18
+ class TestComponent {}
19
+
20
+ describe('ScrollHeaderDirective', () => {
21
+ let fixture: ComponentFixture<TestComponent>;
22
+ let directive: ScrollHeaderDirective;
23
+
24
+ beforeEach(() => {
25
+ TestBed.configureTestingModule({
26
+ providers: testConfig.providers,
27
+ });
28
+ fixture = TestBed.createComponent(TestComponent);
29
+ fixture.detectChanges();
30
+
31
+ const directiveEl = fixture.debugElement.query((el) => el.nativeElement.tagName.toLowerCase() === 'ion-content');
32
+ directive = directiveEl.injector.get(ScrollHeaderDirective);
33
+ });
34
+
35
+ it('should create an instance', () => {
36
+ expect(directive).toBeTruthy();
37
+ });
38
+
39
+ it('should initialize with correct properties', () => {
40
+ expect(directive.scrollHeader()).toBeTruthy();
41
+ });
42
+
43
+ it('should handle scroll events', () => {
44
+ const contentEl = fixture.debugElement.query((el) => el.nativeElement.tagName.toLowerCase() === 'ion-content').nativeElement;
45
+
46
+ // スクロールイベントをシミュレート
47
+ const scrollEvent = new CustomEvent('ionScroll', {
48
+ detail: {
49
+ scrollTop: 100,
50
+ scrollLeft: 0,
51
+ type: 'scroll',
52
+ },
53
+ });
54
+ contentEl.dispatchEvent(scrollEvent);
55
+
56
+ // スクロール後のクラスを確認
57
+ expect(contentEl.classList.contains('scroll-header-sticky')).toBeTruthy();
58
+ });
59
+ });
@@ -0,0 +1,106 @@
1
+ import { contentChild, Directive, ElementRef, HostListener, inject, OnInit, signal } from '@angular/core';
2
+ import { IonContent, IonHeader, ScrollDetail } from '@ionic/angular/standalone';
3
+ import { waitFindDom } from '../util';
4
+
5
+ @Directive({
6
+ selector: 'ion-content[rdlaboScrollHeader]',
7
+ })
8
+ export class ScrollHeaderDirective implements OnInit {
9
+ readonly #elementRef = inject(ElementRef<IonContent>);
10
+
11
+ readonly scrollHeader = contentChild(IonHeader, { read: ElementRef });
12
+ readonly #nativeHeader = signal<HTMLElement | undefined>(undefined);
13
+ readonly #scrollHeaderSize = signal<number>(0);
14
+ readonly #beforeScrollTop = signal<number>(0);
15
+
16
+ readonly #minScrollAmount = 16;
17
+ readonly #scrollThrottle = 16; // 60fps
18
+ #lastScrollTime = 0;
19
+
20
+ async ngOnInit() {
21
+ await waitFindDom(this.#elementRef.nativeElement, 'ion-header');
22
+ this.#elementRef.nativeElement.scrollEvents = true;
23
+ if (
24
+ this.#elementRef.nativeElement.previousElementSibling &&
25
+ this.#elementRef.nativeElement.previousElementSibling.classList.contains('native-header')
26
+ ) {
27
+ this.#nativeHeader.set(this.#elementRef.nativeElement.previousElementSibling);
28
+ }
29
+ }
30
+
31
+ @HostListener('ionScroll', ['$event'])
32
+ onWindowScroll($event: CustomEvent<ScrollDetail>) {
33
+ // スロットリングによる最適化
34
+ const now = performance.now();
35
+ if (now - this.#lastScrollTime < this.#scrollThrottle) {
36
+ return;
37
+ }
38
+ this.#lastScrollTime = now;
39
+
40
+ if (this.scrollHeader() === undefined) {
41
+ return;
42
+ }
43
+
44
+ if (this.#elementRef.nativeElement.classList.contains('fixed')) {
45
+ // ion-headerに.fixedが指定されている場合は固定
46
+ this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
47
+ return;
48
+ }
49
+
50
+ if (!this.#scrollHeaderSize()) {
51
+ // 表示サイズを挿入
52
+ this.#scrollHeaderSize.set(this.scrollHeader()?.nativeElement.clientHeight);
53
+ }
54
+
55
+ if ($event.detail.scrollTop === 0) {
56
+ // 上部にきたら解除
57
+ this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
58
+ this.#elementRef.nativeElement.classList.remove('scroll-header-animated');
59
+ }
60
+
61
+ const scrollAmount = $event.detail.scrollTop - this.#beforeScrollTop();
62
+ if (Math.abs(scrollAmount) < this.#minScrollAmount) {
63
+ return;
64
+ }
65
+
66
+ if (scrollAmount < 0) {
67
+ // 上へスクロール
68
+ this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
69
+ if (this.#nativeHeader()) {
70
+ this.#nativeHeader.update((v) => {
71
+ v!.classList.remove('scroll-header-hidden');
72
+ return v;
73
+ });
74
+ }
75
+ if ($event.detail.scrollTop > this.#scrollHeaderSize()) {
76
+ this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
77
+ this.#elementRef.nativeElement.classList.add('scroll-header-animated');
78
+ }
79
+ } else {
80
+ // 下にスクロール
81
+ if ($event.detail.scrollTop <= this.#scrollHeaderSize()) {
82
+ this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
83
+ this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
84
+ this.#elementRef.nativeElement.classList.remove('scroll-header-animated');
85
+ if (this.#nativeHeader()) {
86
+ this.#nativeHeader.update((v) => {
87
+ v!.classList.remove('scroll-header-hidden');
88
+ return v;
89
+ });
90
+ }
91
+ } else {
92
+ this.#elementRef.nativeElement.classList.add('scroll-header-hidden');
93
+ this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
94
+ if (this.#nativeHeader()) {
95
+ this.#nativeHeader.update((v) => {
96
+ v!.classList.add('scroll-header-hidden');
97
+ return v;
98
+ });
99
+ }
100
+ requestAnimationFrame(() => this.#elementRef.nativeElement.classList.add('scroll-header-animated'));
101
+ }
102
+ }
103
+
104
+ this.#beforeScrollTop.set($event.detail.scrollTop);
105
+ }
106
+ }
@@ -0,0 +1,64 @@
1
+ import { Component, ElementRef, viewChild } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { IonContent, IonHeader } from '@ionic/angular/standalone';
4
+ import { VirtualScrollHeaderDirective } from './virtual-scroll-header.directive';
5
+ import { CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
6
+ import { testConfig } from '../../../../util/test.config';
7
+ import { Signal } from '@angular/core';
8
+ import { waitFindDom } from '../util';
9
+
10
+ @Component({
11
+ template: `
12
+ <ion-content rdlaboVirtualScrollHeader>
13
+ <ion-header>
14
+ <div>Header Content</div>
15
+ </ion-header>
16
+ <cdk-virtual-scroll-viewport minBufferPx="900" maxBufferPx="1350" [itemSize]="44" class="ion-content-scroll-host">
17
+ <div *cdkVirtualFor="let item of items">
18
+ {{ item }}
19
+ </div>
20
+ </cdk-virtual-scroll-viewport>
21
+ </ion-content>
22
+ `,
23
+ imports: [IonContent, IonHeader, VirtualScrollHeaderDirective, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf],
24
+ })
25
+ class TestComponent {
26
+ viewport = viewChild(CdkVirtualScrollViewport);
27
+ items = Array.from({ length: 100 }, (_, i) => `Item ${i}`);
28
+ }
29
+
30
+ describe('VirtualScrollHeaderDirective', () => {
31
+ let fixture: ComponentFixture<TestComponent>;
32
+ let directive: VirtualScrollHeaderDirective;
33
+ let viewport: Signal<CdkVirtualScrollViewport>;
34
+
35
+ beforeEach(() => {
36
+ TestBed.configureTestingModule({
37
+ providers: testConfig.providers,
38
+ });
39
+ fixture = TestBed.createComponent(TestComponent);
40
+ if (fixture.componentInstance.viewport() === undefined) {
41
+ throw 'viewport is undefined';
42
+ }
43
+ viewport = fixture.componentInstance.viewport as Signal<CdkVirtualScrollViewport>;
44
+ fixture.detectChanges();
45
+
46
+ const directiveEl = fixture.debugElement.query((el) => el.nativeElement.tagName.toLowerCase() === 'ion-content');
47
+ directive = directiveEl.injector.get(VirtualScrollHeaderDirective);
48
+ });
49
+
50
+ it('should create an instance', () => {
51
+ expect(directive).toBeTruthy();
52
+ });
53
+
54
+ it('should initialize with correct properties', () => {
55
+ expect(directive.virtualScroll()).toBeTruthy();
56
+ expect(directive.scrollHeader()).toBeTruthy();
57
+ });
58
+
59
+ it('should add class scroll-header-animated', async () => {
60
+ const contentEl = fixture.debugElement.query((el) => el.nativeElement.tagName.toLowerCase() === 'ion-content').nativeElement;
61
+ await waitFindDom(contentEl, 'ion-header');
62
+ expect(contentEl.classList.contains('scroll-header-animated')).toBeTruthy();
63
+ });
64
+ });
@@ -0,0 +1,131 @@
1
+ import { contentChild, Directive, ElementRef, inject, OnDestroy, OnInit, signal } from '@angular/core';
2
+ import { IonContent, IonHeader } from '@ionic/angular/standalone';
3
+ import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
4
+ import { fromEvent, Subscription } from 'rxjs';
5
+ import { waitFindDom } from '../util';
6
+
7
+ @Directive({
8
+ selector: 'ion-content[rdlaboVirtualScrollHeader]',
9
+ })
10
+ export class VirtualScrollHeaderDirective implements OnInit, OnDestroy {
11
+ readonly #elementRef = inject(ElementRef<IonContent>);
12
+
13
+ readonly virtualScroll = contentChild(CdkVirtualScrollViewport);
14
+ readonly scrollHeader = contentChild(IonHeader, { read: ElementRef });
15
+
16
+ readonly #minScrollAmount = 16;
17
+ readonly #scrollThrottle = 16; // 60fps
18
+ #lastScrollTime = 0;
19
+ readonly #nativeHeader = signal<HTMLElement | undefined>(undefined);
20
+ readonly #scrollRefresher = signal<HTMLElement | undefined>(undefined);
21
+ readonly #scrollHeaderSize = signal<number>(0);
22
+ readonly #beforeScrollTop = signal<number>(0);
23
+ readonly #scrollSubscription = new Subscription();
24
+
25
+ async ngOnInit() {
26
+ await Promise.all([
27
+ waitFindDom(this.#elementRef.nativeElement, 'ion-header'),
28
+ waitFindDom(this.#elementRef.nativeElement, 'cdk-virtual-scroll-viewport'),
29
+ ]);
30
+
31
+ this.#elementRef.nativeElement.classList.add('scroll-header-animated');
32
+
33
+ if (
34
+ this.#elementRef.nativeElement.previousElementSibling &&
35
+ this.#elementRef.nativeElement.previousElementSibling.classList.contains('native-header')
36
+ ) {
37
+ this.#nativeHeader.set(this.#elementRef.nativeElement.previousElementSibling);
38
+ }
39
+
40
+ this.#scrollSubscription.add(
41
+ fromEvent(this.virtualScroll()!.elementRef.nativeElement, 'scroll').subscribe(() => {
42
+ this.onWindowScroll(this.virtualScroll()!.measureScrollOffset('top'));
43
+ }),
44
+ );
45
+ }
46
+
47
+ ngOnDestroy() {
48
+ this.#scrollSubscription.unsubscribe();
49
+ }
50
+
51
+ onWindowScroll(scrollOffset: number) {
52
+ // スロットリングによる最適化
53
+ const now = performance.now();
54
+ if (now - this.#lastScrollTime < this.#scrollThrottle) {
55
+ return;
56
+ }
57
+ this.#lastScrollTime = now;
58
+
59
+ if (this.scrollHeader() === undefined || this.virtualScroll() === undefined) {
60
+ return;
61
+ }
62
+
63
+ if (this.#elementRef.nativeElement.classList.contains('fixed')) {
64
+ // ion-headerに.fixedが指定されている場合は固定
65
+ this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
66
+ return;
67
+ }
68
+
69
+ if (!this.#scrollHeaderSize()) {
70
+ // 表示サイズを挿入
71
+ this.#scrollHeaderSize.set(this.scrollHeader()!.nativeElement.clientHeight);
72
+ this.virtualScroll()!.elementRef.nativeElement.style.marginTop = this.scrollHeader()!.nativeElement.clientHeight * -1 + 'px';
73
+ this.virtualScroll()!.elementRef.nativeElement.style.paddingTop = this.scrollHeader()!.nativeElement.clientHeight + 'px';
74
+
75
+ this.#scrollRefresher.set(this.#elementRef.nativeElement.querySelector('ion-refresher'));
76
+ if (this.#scrollRefresher()) {
77
+ this.#scrollRefresher.update((v) => {
78
+ v!.style.marginTop = this.scrollHeader()!.nativeElement.clientHeight + 'px';
79
+ return v;
80
+ });
81
+ }
82
+ }
83
+
84
+ if (scrollOffset === 0) {
85
+ // 上部にきたら解除
86
+ this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
87
+ }
88
+
89
+ const scrollAmount = scrollOffset - this.#beforeScrollTop();
90
+ if (Math.abs(scrollAmount) < this.#minScrollAmount) {
91
+ return;
92
+ }
93
+
94
+ if (scrollAmount < 0) {
95
+ // 上へスクロール
96
+ this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
97
+ if (this.#nativeHeader()) {
98
+ this.#nativeHeader.update((v) => {
99
+ v!.classList.remove('scroll-header-hidden');
100
+ return v;
101
+ });
102
+ }
103
+ if (scrollOffset > this.#scrollHeaderSize() / 1.5) {
104
+ this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
105
+ }
106
+ } else {
107
+ // 下にスクロール
108
+ if (scrollOffset <= this.#scrollHeaderSize() / 1.5) {
109
+ this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
110
+ this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
111
+ if (this.#nativeHeader()) {
112
+ this.#nativeHeader.update((v) => {
113
+ v!.classList.remove('scroll-header-hidden');
114
+ return v;
115
+ });
116
+ }
117
+ } else {
118
+ this.#elementRef.nativeElement.classList.add('scroll-header-hidden');
119
+ this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
120
+ if (this.#nativeHeader()) {
121
+ this.#nativeHeader.update((v) => {
122
+ v!.classList.add('scroll-header-hidden');
123
+ return v;
124
+ });
125
+ }
126
+ }
127
+ }
128
+
129
+ this.#beforeScrollTop.set(scrollOffset);
130
+ }
131
+ }
@@ -0,0 +1,11 @@
1
+ export const waitFindDom = (nativeElement: HTMLElement, selector: string): Promise<void> => {
2
+ return new Promise<void>((resolve) => {
3
+ const interval = setInterval(() => {
4
+ const find = nativeElement.querySelector(selector);
5
+ if (find) {
6
+ clearInterval(interval);
7
+ resolve();
8
+ }
9
+ });
10
+ });
11
+ };
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Public API Surface of scroll-header
3
+ */
4
+
5
+ export * from './lib/directives/scroll-header.directive';
6
+ export * from './lib/directives/virtual-scroll-header.directive';
7
+ export * from './lib/directives/fix-virtual-scroll-element.directive';
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "types": []
10
+ },
11
+ "exclude": [
12
+ "**/*.spec.ts"
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "include": [
11
+ "**/*.spec.ts",
12
+ "**/*.d.ts"
13
+ ]
14
+ }
@@ -1,282 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, ElementRef, contentChild, signal, HostListener, Directive } from '@angular/core';
3
- import { IonHeader } from '@ionic/angular/standalone';
4
- import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
5
- import { Subscription, fromEvent } from 'rxjs';
6
-
7
- const waitFindDom = (nativeElement, selector) => {
8
- return new Promise((resolve) => {
9
- const interval = setInterval(() => {
10
- const find = nativeElement.querySelector(selector);
11
- if (find) {
12
- clearInterval(interval);
13
- resolve();
14
- }
15
- });
16
- });
17
- };
18
-
19
- class ScrollHeaderDirective {
20
- constructor() {
21
- this.#elementRef = inject((ElementRef));
22
- this.scrollHeader = contentChild(IonHeader, { read: ElementRef });
23
- this.#nativeHeader = signal(undefined);
24
- this.#scrollHeaderSize = signal(0);
25
- this.#beforeScrollTop = signal(0);
26
- this.#minScrollAmount = 16;
27
- this.#scrollThrottle = 16; // 60fps
28
- this.#lastScrollTime = 0;
29
- }
30
- #elementRef;
31
- #nativeHeader;
32
- #scrollHeaderSize;
33
- #beforeScrollTop;
34
- #minScrollAmount;
35
- #scrollThrottle; // 60fps
36
- #lastScrollTime;
37
- async ngOnInit() {
38
- await waitFindDom(this.#elementRef.nativeElement, 'ion-header');
39
- this.#elementRef.nativeElement.scrollEvents = true;
40
- if (this.#elementRef.nativeElement.previousElementSibling &&
41
- this.#elementRef.nativeElement.previousElementSibling.classList.contains('native-header')) {
42
- this.#nativeHeader.set(this.#elementRef.nativeElement.previousElementSibling);
43
- }
44
- }
45
- onWindowScroll($event) {
46
- // スロットリングによる最適化
47
- const now = performance.now();
48
- if (now - this.#lastScrollTime < this.#scrollThrottle) {
49
- return;
50
- }
51
- this.#lastScrollTime = now;
52
- if (this.scrollHeader() === undefined) {
53
- return;
54
- }
55
- if (this.#elementRef.nativeElement.classList.contains('fixed')) {
56
- // ion-headerに.fixedが指定されている場合は固定
57
- this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
58
- return;
59
- }
60
- if (!this.#scrollHeaderSize()) {
61
- // 表示サイズを挿入
62
- this.#scrollHeaderSize.set(this.scrollHeader()?.nativeElement.clientHeight);
63
- }
64
- if ($event.detail.scrollTop === 0) {
65
- // 上部にきたら解除
66
- this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
67
- this.#elementRef.nativeElement.classList.remove('scroll-header-animated');
68
- }
69
- const scrollAmount = $event.detail.scrollTop - this.#beforeScrollTop();
70
- if (Math.abs(scrollAmount) < this.#minScrollAmount) {
71
- return;
72
- }
73
- if (scrollAmount < 0) {
74
- // 上へスクロール
75
- this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
76
- if (this.#nativeHeader()) {
77
- this.#nativeHeader.update((v) => {
78
- v.classList.remove('scroll-header-hidden');
79
- return v;
80
- });
81
- }
82
- if ($event.detail.scrollTop > this.#scrollHeaderSize()) {
83
- this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
84
- this.#elementRef.nativeElement.classList.add('scroll-header-animated');
85
- }
86
- }
87
- else {
88
- // 下にスクロール
89
- if ($event.detail.scrollTop <= this.#scrollHeaderSize()) {
90
- this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
91
- this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
92
- this.#elementRef.nativeElement.classList.remove('scroll-header-animated');
93
- if (this.#nativeHeader()) {
94
- this.#nativeHeader.update((v) => {
95
- v.classList.remove('scroll-header-hidden');
96
- return v;
97
- });
98
- }
99
- }
100
- else {
101
- this.#elementRef.nativeElement.classList.add('scroll-header-hidden');
102
- this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
103
- if (this.#nativeHeader()) {
104
- this.#nativeHeader.update((v) => {
105
- v.classList.add('scroll-header-hidden');
106
- return v;
107
- });
108
- }
109
- requestAnimationFrame(() => this.#elementRef.nativeElement.classList.add('scroll-header-animated'));
110
- }
111
- }
112
- this.#beforeScrollTop.set($event.detail.scrollTop);
113
- }
114
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ScrollHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
115
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.0", type: ScrollHeaderDirective, isStandalone: true, selector: "ion-content[rdlaboScrollHeader]", host: { listeners: { "ionScroll": "onWindowScroll($event)" } }, queries: [{ propertyName: "scrollHeader", first: true, predicate: IonHeader, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0 }); }
116
- }
117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ScrollHeaderDirective, decorators: [{
118
- type: Directive,
119
- args: [{
120
- selector: 'ion-content[rdlaboScrollHeader]',
121
- }]
122
- }], propDecorators: { onWindowScroll: [{
123
- type: HostListener,
124
- args: ['ionScroll', ['$event']]
125
- }] } });
126
-
127
- class VirtualScrollHeaderDirective {
128
- constructor() {
129
- this.#elementRef = inject((ElementRef));
130
- this.virtualScroll = contentChild(CdkVirtualScrollViewport);
131
- this.scrollHeader = contentChild(IonHeader, { read: ElementRef });
132
- this.#minScrollAmount = 16;
133
- this.#scrollThrottle = 16; // 60fps
134
- this.#lastScrollTime = 0;
135
- this.#nativeHeader = signal(undefined);
136
- this.#scrollRefresher = signal(undefined);
137
- this.#scrollHeaderSize = signal(0);
138
- this.#beforeScrollTop = signal(0);
139
- this.#scrollSubscription = new Subscription();
140
- }
141
- #elementRef;
142
- #minScrollAmount;
143
- #scrollThrottle; // 60fps
144
- #lastScrollTime;
145
- #nativeHeader;
146
- #scrollRefresher;
147
- #scrollHeaderSize;
148
- #beforeScrollTop;
149
- #scrollSubscription;
150
- async ngOnInit() {
151
- await Promise.all([
152
- waitFindDom(this.#elementRef.nativeElement, 'ion-header'),
153
- waitFindDom(this.#elementRef.nativeElement, 'cdk-virtual-scroll-viewport'),
154
- ]);
155
- this.#elementRef.nativeElement.classList.add('scroll-header-animated');
156
- if (this.#elementRef.nativeElement.previousElementSibling &&
157
- this.#elementRef.nativeElement.previousElementSibling.classList.contains('native-header')) {
158
- this.#nativeHeader.set(this.#elementRef.nativeElement.previousElementSibling);
159
- }
160
- this.#scrollSubscription.add(fromEvent(this.virtualScroll().elementRef.nativeElement, 'scroll').subscribe(() => {
161
- this.onWindowScroll(this.virtualScroll().measureScrollOffset('top'));
162
- }));
163
- }
164
- ngOnDestroy() {
165
- this.#scrollSubscription.unsubscribe();
166
- }
167
- onWindowScroll(scrollOffset) {
168
- // スロットリングによる最適化
169
- const now = performance.now();
170
- if (now - this.#lastScrollTime < this.#scrollThrottle) {
171
- return;
172
- }
173
- this.#lastScrollTime = now;
174
- if (this.scrollHeader() === undefined || this.virtualScroll() === undefined) {
175
- return;
176
- }
177
- if (this.#elementRef.nativeElement.classList.contains('fixed')) {
178
- // ion-headerに.fixedが指定されている場合は固定
179
- this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
180
- return;
181
- }
182
- if (!this.#scrollHeaderSize()) {
183
- // 表示サイズを挿入
184
- this.#scrollHeaderSize.set(this.scrollHeader().nativeElement.clientHeight);
185
- this.virtualScroll().elementRef.nativeElement.style.marginTop = this.scrollHeader().nativeElement.clientHeight * -1 + 'px';
186
- this.virtualScroll().elementRef.nativeElement.style.paddingTop = this.scrollHeader().nativeElement.clientHeight + 'px';
187
- this.#scrollRefresher.set(this.#elementRef.nativeElement.querySelector('ion-refresher'));
188
- if (this.#scrollRefresher()) {
189
- this.#scrollRefresher.update((v) => {
190
- v.style.marginTop = this.scrollHeader().nativeElement.clientHeight + 'px';
191
- return v;
192
- });
193
- }
194
- }
195
- if (scrollOffset === 0) {
196
- // 上部にきたら解除
197
- this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
198
- }
199
- const scrollAmount = scrollOffset - this.#beforeScrollTop();
200
- if (Math.abs(scrollAmount) < this.#minScrollAmount) {
201
- return;
202
- }
203
- if (scrollAmount < 0) {
204
- // 上へスクロール
205
- this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
206
- if (this.#nativeHeader()) {
207
- this.#nativeHeader.update((v) => {
208
- v.classList.remove('scroll-header-hidden');
209
- return v;
210
- });
211
- }
212
- if (scrollOffset > this.#scrollHeaderSize() / 1.5) {
213
- this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
214
- }
215
- }
216
- else {
217
- // 下にスクロール
218
- if (scrollOffset <= this.#scrollHeaderSize() / 1.5) {
219
- this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');
220
- this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');
221
- if (this.#nativeHeader()) {
222
- this.#nativeHeader.update((v) => {
223
- v.classList.remove('scroll-header-hidden');
224
- return v;
225
- });
226
- }
227
- }
228
- else {
229
- this.#elementRef.nativeElement.classList.add('scroll-header-hidden');
230
- this.#elementRef.nativeElement.classList.add('scroll-header-sticky');
231
- if (this.#nativeHeader()) {
232
- this.#nativeHeader.update((v) => {
233
- v.classList.add('scroll-header-hidden');
234
- return v;
235
- });
236
- }
237
- }
238
- }
239
- this.#beforeScrollTop.set(scrollOffset);
240
- }
241
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: VirtualScrollHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
242
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.0", type: VirtualScrollHeaderDirective, isStandalone: true, selector: "ion-content[rdlaboVirtualScrollHeader]", queries: [{ propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }, { propertyName: "scrollHeader", first: true, predicate: IonHeader, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0 }); }
243
- }
244
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: VirtualScrollHeaderDirective, decorators: [{
245
- type: Directive,
246
- args: [{
247
- selector: 'ion-content[rdlaboVirtualScrollHeader]',
248
- }]
249
- }] });
250
-
251
- class FixVirtualScrollElementDirective {
252
- #elementRef = inject((ElementRef));
253
- ngOnInit() {
254
- const nativeEl = this.#elementRef.nativeElement;
255
- if (nativeEl) {
256
- const last = nativeEl.lastElementChild;
257
- if (nativeEl.firstElementChild && last) {
258
- nativeEl.replaceChild(nativeEl.firstElementChild, nativeEl.lastElementChild);
259
- nativeEl.insertBefore(last, nativeEl.firstElementChild);
260
- }
261
- }
262
- }
263
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: FixVirtualScrollElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
264
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: FixVirtualScrollElementDirective, isStandalone: true, selector: "cdk-virtual-scroll-viewport[rdlaboFixVirtualScrollElement]", ngImport: i0 }); }
265
- }
266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: FixVirtualScrollElementDirective, decorators: [{
267
- type: Directive,
268
- args: [{
269
- selector: 'cdk-virtual-scroll-viewport[rdlaboFixVirtualScrollElement]',
270
- }]
271
- }] });
272
-
273
- /*
274
- * Public API Surface of scroll-header
275
- */
276
-
277
- /**
278
- * Generated bundle index. Do not edit.
279
- */
280
-
281
- export { FixVirtualScrollElementDirective, ScrollHeaderDirective, VirtualScrollHeaderDirective };
282
- //# sourceMappingURL=rdlabo-ionic-angular-scroll-header.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rdlabo-ionic-angular-scroll-header.mjs","sources":["../../../projects/scroll-header/src/lib/util.ts","../../../projects/scroll-header/src/lib/directives/scroll-header.directive.ts","../../../projects/scroll-header/src/lib/directives/virtual-scroll-header.directive.ts","../../../projects/scroll-header/src/lib/directives/fix-virtual-scroll-element.directive.ts","../../../projects/scroll-header/src/public-api.ts","../../../projects/scroll-header/src/rdlabo-ionic-angular-scroll-header.ts"],"sourcesContent":["export const waitFindDom = (nativeElement: HTMLElement, selector: string): Promise<void> => {\n return new Promise<void>((resolve) => {\n const interval = setInterval(() => {\n const find = nativeElement.querySelector(selector);\n if (find) {\n clearInterval(interval);\n resolve();\n }\n });\n });\n};\n","import { contentChild, Directive, ElementRef, HostListener, inject, OnInit, signal } from '@angular/core';\nimport { IonContent, IonHeader, ScrollDetail } from '@ionic/angular/standalone';\nimport { waitFindDom } from '../util';\n\n@Directive({\n selector: 'ion-content[rdlaboScrollHeader]',\n})\nexport class ScrollHeaderDirective implements OnInit {\n readonly #elementRef = inject(ElementRef<IonContent>);\n\n readonly scrollHeader = contentChild(IonHeader, { read: ElementRef });\n readonly #nativeHeader = signal<HTMLElement | undefined>(undefined);\n readonly #scrollHeaderSize = signal<number>(0);\n readonly #beforeScrollTop = signal<number>(0);\n\n readonly #minScrollAmount = 16;\n readonly #scrollThrottle = 16; // 60fps\n #lastScrollTime = 0;\n\n async ngOnInit() {\n await waitFindDom(this.#elementRef.nativeElement, 'ion-header');\n this.#elementRef.nativeElement.scrollEvents = true;\n if (\n this.#elementRef.nativeElement.previousElementSibling &&\n this.#elementRef.nativeElement.previousElementSibling.classList.contains('native-header')\n ) {\n this.#nativeHeader.set(this.#elementRef.nativeElement.previousElementSibling);\n }\n }\n\n @HostListener('ionScroll', ['$event'])\n onWindowScroll($event: CustomEvent<ScrollDetail>) {\n // スロットリングによる最適化\n const now = performance.now();\n if (now - this.#lastScrollTime < this.#scrollThrottle) {\n return;\n }\n this.#lastScrollTime = now;\n\n if (this.scrollHeader() === undefined) {\n return;\n }\n\n if (this.#elementRef.nativeElement.classList.contains('fixed')) {\n // ion-headerに.fixedが指定されている場合は固定\n this.#elementRef.nativeElement.classList.add('scroll-header-sticky');\n return;\n }\n\n if (!this.#scrollHeaderSize()) {\n // 表示サイズを挿入\n this.#scrollHeaderSize.set(this.scrollHeader()?.nativeElement.clientHeight);\n }\n\n if ($event.detail.scrollTop === 0) {\n // 上部にきたら解除\n this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');\n this.#elementRef.nativeElement.classList.remove('scroll-header-animated');\n }\n\n const scrollAmount = $event.detail.scrollTop - this.#beforeScrollTop();\n if (Math.abs(scrollAmount) < this.#minScrollAmount) {\n return;\n }\n\n if (scrollAmount < 0) {\n // 上へスクロール\n this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');\n if (this.#nativeHeader()) {\n this.#nativeHeader.update((v) => {\n v!.classList.remove('scroll-header-hidden');\n return v;\n });\n }\n if ($event.detail.scrollTop > this.#scrollHeaderSize()) {\n this.#elementRef.nativeElement.classList.add('scroll-header-sticky');\n this.#elementRef.nativeElement.classList.add('scroll-header-animated');\n }\n } else {\n // 下にスクロール\n if ($event.detail.scrollTop <= this.#scrollHeaderSize()) {\n this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');\n this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');\n this.#elementRef.nativeElement.classList.remove('scroll-header-animated');\n if (this.#nativeHeader()) {\n this.#nativeHeader.update((v) => {\n v!.classList.remove('scroll-header-hidden');\n return v;\n });\n }\n } else {\n this.#elementRef.nativeElement.classList.add('scroll-header-hidden');\n this.#elementRef.nativeElement.classList.add('scroll-header-sticky');\n if (this.#nativeHeader()) {\n this.#nativeHeader.update((v) => {\n v!.classList.add('scroll-header-hidden');\n return v;\n });\n }\n requestAnimationFrame(() => this.#elementRef.nativeElement.classList.add('scroll-header-animated'));\n }\n }\n\n this.#beforeScrollTop.set($event.detail.scrollTop);\n }\n}\n","import { contentChild, Directive, ElementRef, inject, OnDestroy, OnInit, signal } from '@angular/core';\nimport { IonContent, IonHeader } from '@ionic/angular/standalone';\nimport { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { waitFindDom } from '../util';\n\n@Directive({\n selector: 'ion-content[rdlaboVirtualScrollHeader]',\n})\nexport class VirtualScrollHeaderDirective implements OnInit, OnDestroy {\n readonly #elementRef = inject(ElementRef<IonContent>);\n\n readonly virtualScroll = contentChild(CdkVirtualScrollViewport);\n readonly scrollHeader = contentChild(IonHeader, { read: ElementRef });\n\n readonly #minScrollAmount = 16;\n readonly #scrollThrottle = 16; // 60fps\n #lastScrollTime = 0;\n readonly #nativeHeader = signal<HTMLElement | undefined>(undefined);\n readonly #scrollRefresher = signal<HTMLElement | undefined>(undefined);\n readonly #scrollHeaderSize = signal<number>(0);\n readonly #beforeScrollTop = signal<number>(0);\n readonly #scrollSubscription = new Subscription();\n\n async ngOnInit() {\n await Promise.all([\n waitFindDom(this.#elementRef.nativeElement, 'ion-header'),\n waitFindDom(this.#elementRef.nativeElement, 'cdk-virtual-scroll-viewport'),\n ]);\n\n this.#elementRef.nativeElement.classList.add('scroll-header-animated');\n\n if (\n this.#elementRef.nativeElement.previousElementSibling &&\n this.#elementRef.nativeElement.previousElementSibling.classList.contains('native-header')\n ) {\n this.#nativeHeader.set(this.#elementRef.nativeElement.previousElementSibling);\n }\n\n this.#scrollSubscription.add(\n fromEvent(this.virtualScroll()!.elementRef.nativeElement, 'scroll').subscribe(() => {\n this.onWindowScroll(this.virtualScroll()!.measureScrollOffset('top'));\n }),\n );\n }\n\n ngOnDestroy() {\n this.#scrollSubscription.unsubscribe();\n }\n\n onWindowScroll(scrollOffset: number) {\n // スロットリングによる最適化\n const now = performance.now();\n if (now - this.#lastScrollTime < this.#scrollThrottle) {\n return;\n }\n this.#lastScrollTime = now;\n\n if (this.scrollHeader() === undefined || this.virtualScroll() === undefined) {\n return;\n }\n\n if (this.#elementRef.nativeElement.classList.contains('fixed')) {\n // ion-headerに.fixedが指定されている場合は固定\n this.#elementRef.nativeElement.classList.add('scroll-header-sticky');\n return;\n }\n\n if (!this.#scrollHeaderSize()) {\n // 表示サイズを挿入\n this.#scrollHeaderSize.set(this.scrollHeader()!.nativeElement.clientHeight);\n this.virtualScroll()!.elementRef.nativeElement.style.marginTop = this.scrollHeader()!.nativeElement.clientHeight * -1 + 'px';\n this.virtualScroll()!.elementRef.nativeElement.style.paddingTop = this.scrollHeader()!.nativeElement.clientHeight + 'px';\n\n this.#scrollRefresher.set(this.#elementRef.nativeElement.querySelector('ion-refresher'));\n if (this.#scrollRefresher()) {\n this.#scrollRefresher.update((v) => {\n v!.style.marginTop = this.scrollHeader()!.nativeElement.clientHeight + 'px';\n return v;\n });\n }\n }\n\n if (scrollOffset === 0) {\n // 上部にきたら解除\n this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');\n }\n\n const scrollAmount = scrollOffset - this.#beforeScrollTop();\n if (Math.abs(scrollAmount) < this.#minScrollAmount) {\n return;\n }\n\n if (scrollAmount < 0) {\n // 上へスクロール\n this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');\n if (this.#nativeHeader()) {\n this.#nativeHeader.update((v) => {\n v!.classList.remove('scroll-header-hidden');\n return v;\n });\n }\n if (scrollOffset > this.#scrollHeaderSize() / 1.5) {\n this.#elementRef.nativeElement.classList.add('scroll-header-sticky');\n }\n } else {\n // 下にスクロール\n if (scrollOffset <= this.#scrollHeaderSize() / 1.5) {\n this.#elementRef.nativeElement.classList.remove('scroll-header-hidden');\n this.#elementRef.nativeElement.classList.remove('scroll-header-sticky');\n if (this.#nativeHeader()) {\n this.#nativeHeader.update((v) => {\n v!.classList.remove('scroll-header-hidden');\n return v;\n });\n }\n } else {\n this.#elementRef.nativeElement.classList.add('scroll-header-hidden');\n this.#elementRef.nativeElement.classList.add('scroll-header-sticky');\n if (this.#nativeHeader()) {\n this.#nativeHeader.update((v) => {\n v!.classList.add('scroll-header-hidden');\n return v;\n });\n }\n }\n }\n\n this.#beforeScrollTop.set(scrollOffset);\n }\n}\n","import { Directive, ElementRef, inject, OnInit } from '@angular/core';\nimport { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\n\n@Directive({\n selector: 'cdk-virtual-scroll-viewport[rdlaboFixVirtualScrollElement]',\n})\nexport class FixVirtualScrollElementDirective implements OnInit {\n readonly #elementRef = inject(ElementRef<CdkVirtualScrollViewport>);\n\n ngOnInit() {\n const nativeEl = this.#elementRef.nativeElement;\n if (nativeEl) {\n const last = nativeEl.lastElementChild;\n if (nativeEl.firstElementChild && last) {\n nativeEl.replaceChild(nativeEl.firstElementChild, nativeEl.lastElementChild);\n nativeEl.insertBefore(last, nativeEl.firstElementChild);\n }\n }\n }\n}\n","/*\n * Public API Surface of scroll-header\n */\n\nexport * from './lib/directives/scroll-header.directive';\nexport * from './lib/directives/virtual-scroll-header.directive';\nexport * from './lib/directives/fix-virtual-scroll-element.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAO,MAAM,WAAW,GAAG,CAAC,aAA0B,EAAE,QAAgB,KAAmB;AACzF,IAAA,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,KAAI;AACnC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAK;YAChC,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC;YAClD,IAAI,IAAI,EAAE;gBACR,aAAa,CAAC,QAAQ,CAAC;AACvB,gBAAA,OAAO,EAAE;;AAEb,SAAC,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;;MCHY,qBAAqB,CAAA;AAHlC,IAAA,WAAA,GAAA;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ic/angular/standalone';
4
- import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
5
-
6
- declare class ScrollHeaderDirective implements OnInit {
7
- #private;
8
- readonly scrollHeader: i0.Signal<ElementRef<any> | undefined>;
9
- ngOnInit(): Promise<void>;
10
- onWindowScroll($event: CustomEvent<ScrollDetail>): void;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollHeaderDirective, never>;
12
- static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollHeaderDirective, "ion-content[rdlaboScrollHeader]", never, {}, {}, ["scrollHeader"], never, true, never>;
13
- }
14
-
15
- declare class VirtualScrollHeaderDirective implements OnInit, OnDestroy {
16
- #private;
17
- readonly virtualScroll: i0.Signal<CdkVirtualScrollViewport | undefined>;
18
- readonly scrollHeader: i0.Signal<ElementRef<any> | undefined>;
19
- ngOnInit(): Promise<void>;
20
- ngOnDestroy(): void;
21
- onWindowScroll(scrollOffset: number): void;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<VirtualScrollHeaderDirective, never>;
23
- static ɵdir: i0.ɵɵDirectiveDeclaration<VirtualScrollHeaderDirective, "ion-content[rdlaboVirtualScrollHeader]", never, {}, {}, ["virtualScroll", "scrollHeader"], never, true, never>;
24
- }
25
-
26
- declare class FixVirtualScrollElementDirective implements OnInit {
27
- #private;
28
- ngOnInit(): void;
29
- static ɵfac: i0.ɵɵFactoryDeclaration<FixVirtualScrollElementDirective, never>;
30
- static ɵdir: i0.ɵɵDirectiveDeclaration<FixVirtualScrollElementDirective, "cdk-virtual-scroll-viewport[rdlaboFixVirtualScrollElement]", never, {}, {}, never, never, true, never>;
31
- }
32
-
33
- export { FixVirtualScrollElementDirective, ScrollHeaderDirective, VirtualScrollHeaderDirective };