@rdlabo/ionic-angular-scroll-header 21.6.10 → 21.7.0

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
@@ -1,8 +1,22 @@
1
1
  # @rdlabo/ionic-angular-scroll-header
2
2
 
3
+ ## Overview
4
+
3
5
  This is directive for scroll with Header.
4
6
 
5
- **Documentation:** [Read the full documentation](https://docs.rdlabo.dev/projects/ionic-angular-scroll-header)
7
+ ## Features
8
+
9
+ ### Choose by header layout
10
+
11
+ | Goal | Guide |
12
+ | --- | --- |
13
+ | Hide and reveal headers on IonContent | [IonContent](./docs/ion-content.md) |
14
+ | Coordinate headers with CDK virtual scroll | [Virtual Scroll](./docs/virtual-scroll.md) |
15
+ | Keep a native header always visible | [Safe Area](./docs/safe-area.md) |
16
+
17
+ ## Quick start
18
+
19
+ After [Installation](#installation), attach the directive to `ion-content`. See [IonContent](./docs/ion-content.md).
6
20
 
7
21
  ## Installation
8
22
 
@@ -11,6 +25,7 @@ npm install @rdlabo/ionic-angular-scroll-header
11
25
  ```
12
26
 
13
27
  And import CSS for directive:
28
+
14
29
  ```diff
15
30
  + @import '@rdlabo/ionic-angular-scroll-header/css/scroll-header.directive.css';
16
31
 
@@ -24,103 +39,15 @@ And import CSS for directive:
24
39
  + }
25
40
  ```
26
41
 
27
- ## Usage
28
-
29
- ### Scroll of IonContent
30
-
31
- - Demo: https://rdlabo-ionic-angular-library.netlify.app/main/scroll-header
32
- - Source: https://github.com/rdlabo-dev/ionic-angular-library/blob/main/projects/demo/src/app/scroll-header/scroll-header.page.html
33
-
34
- ```ts
35
- import { ScrollHeaderDirective } from '@rdlabo/ionic-angular-scroll-header';
36
- @Component({
37
- ...
38
- imports: [
39
- ScrollHeaderDirective
40
- ],
41
- })
42
- ```
43
-
44
- ```html
45
- <ion-header class="hidden"><ion-toolbar></ion-toolbar></ion-header> <!-- set hidden header for safe-area -->
46
- <ion-content rdlaboScrollHeader>
47
- <ion-header>
48
- <ion-toolbar>...</ion-toolbar> <!-- Default Header for display -->
49
- </ion-header>
50
- ...Your Content
51
- </ion-content>
52
- ```
53
-
54
- ### Scroll of CdkVirtualScroll (Angular Material)
55
-
56
- - Demo: https://rdlabo-ionic-angular-library.netlify.app/main/virtual-scroll-header
57
- - Source: https://github.com/rdlabo-dev/ionic-angular-library/blob/main/projects/demo/src/app/virtual-scroll-header/virtual-scroll-header.page.html
58
42
 
59
- ```ts
60
- import { VirtualScrollHeaderDirective } from '@rdlabo/ionic-angular-scroll-header';
43
+ ## Documentation
61
44
 
62
- @Component({
63
- ...
64
- imports: [
65
- VirtualScrollHeaderDirective
66
- ],
67
- })
68
- ```
45
+ Start with [Installation](#installation), then pick a guide.
69
46
 
70
- ```html
71
- <ion-header class="hidden"><ion-toolbar></ion-toolbar></ion-header> <!-- set hidden header for safe-area -->
72
- <ion-content rdlaboVirtualScrollHeader>
73
- <ion-header>
74
- <ion-toolbar>...</ion-toolbar> <!-- Default Header for display -->
75
- </ion-header>
76
- <cdk-virtual-scroll-viewport minBufferPx="900" maxBufferPx="1350" [itemSize]="44" class="ion-content-scroll-host">
77
- ...Your Content
78
- </cdk-virtual-scroll-viewport>
79
- </ion-content>
80
- ```
47
+ - [IonContent](./docs/ion-content.md) — scroll-aware Ionic headers.
48
+ - [Virtual Scroll](./docs/virtual-scroll.md) — CDK viewports and the flicker fix.
49
+ - [Safe Area](./docs/safe-area.md) — hidden and native headers.
81
50
 
82
- ### Fix https://github.com/angular/components/issues/27104
83
-
84
- > bug(COMPONENT): CDK Virtual Scroller jump back/flickers to items on top #27104
85
-
86
- ```ts
87
- import { FixVirtualScrollElementDirective } from '@rdlabo/ionic-angular-scroll-header';
88
-
89
- @Component({
90
- ...
91
- imports: [
92
- FixVirtualScrollElementDirective
93
- ],
94
- })
95
- ```
96
-
97
- ```html
98
- <ion-content>
99
- <cdk-virtual-scroll-viewport rdlaboFixVirtualScrollElement minBufferPx="900" maxBufferPx="1350" [itemSize]="44" class="ion-content-scroll-host">
100
- ...Your Content
101
- </cdk-virtual-scroll-viewport>
102
- </ion-content>
103
- ```
104
-
105
- # FQA
106
- ## Why do I need to set hidden header for safe-area?
107
- Of course, it is also possible to set a safe-area in ion-content as follows.
108
-
109
- ```css
110
- ion-content {
111
- padding-top: var(--ion-safe-area-top, 0);
112
- }
113
- ```
114
-
115
- But I preferred to explicitly set up ion-header and ion-toolbar for safe-area.
116
-
117
- ## I also need a Header that is always visible, apart from the Header that follows Scroll and hides it
118
-
119
- it is possible: by adding `native-header` to the class name, you can have two Headers more smoothly.
120
-
121
- ```diff
122
- - <ion-header class="hidden"><ion-toolbar></ion-toolbar></ion-header>
123
- + <ion-header class="native-header">
124
- + <ion-toolbar><ion-title>Native Header</ion-title></ion-toolbar>
125
- + </ion-header>
126
- ```
51
+ <!-- rdlabo-docs-omit -->
52
+ **Full documentation:** [https://docs.rdlabo.dev/projects/ionic-angular-scroll-header](https://docs.rdlabo.dev/projects/ionic-angular-scroll-header)
53
+ <!-- /rdlabo-docs-omit -->
@@ -0,0 +1,26 @@
1
+ Attach scroll-aware headers to Ionic content. Call this after [Installation](../README.md#installation).
2
+
3
+ - Demo: https://rdlabo-ionic-angular-library.netlify.app/main/scroll-header
4
+ - Source: https://github.com/rdlabo-dev/ionic-angular-library/blob/v21.6.2/projects/demo/src/app/scroll-header/scroll-header.page.html
5
+
6
+ ```ts
7
+ import { ScrollHeaderDirective } from '@rdlabo/ionic-angular-scroll-header';
8
+ @Component({
9
+ ...
10
+ imports: [
11
+ ScrollHeaderDirective
12
+ ],
13
+ })
14
+ ```
15
+
16
+ ```html
17
+ <ion-header class="hidden"><ion-toolbar></ion-toolbar></ion-header>
18
+ <!-- set hidden header for safe-area -->
19
+ <ion-content rdlaboScrollHeader>
20
+ <ion-header>
21
+ <ion-toolbar>...</ion-toolbar>
22
+ <!-- Default Header for display -->
23
+ </ion-header>
24
+ ...Your Content
25
+ </ion-content>
26
+ ```
@@ -0,0 +1,24 @@
1
+ Hidden safe-area headers and always-visible native headers.
2
+
3
+ ## Why do I need to set hidden header for safe-area?
4
+
5
+ Of course, it is also possible to set a safe-area in ion-content as follows.
6
+
7
+ ```css
8
+ ion-content {
9
+ padding-top: var(--ion-safe-area-top, 0);
10
+ }
11
+ ```
12
+
13
+ But I preferred to explicitly set up ion-header and ion-toolbar for safe-area.
14
+
15
+ ## I also need a Header that is always visible, apart from the Header that follows Scroll and hides it
16
+
17
+ it is possible: by adding `native-header` to the class name, you can have two Headers more smoothly.
18
+
19
+ ```diff
20
+ - <ion-header class="hidden"><ion-toolbar></ion-toolbar></ion-header>
21
+ + <ion-header class="native-header">
22
+ + <ion-toolbar><ion-title>Native Header</ion-title></ion-toolbar>
23
+ + </ion-header>
24
+ ```
@@ -0,0 +1,63 @@
1
+ Coordinate headers with Angular CDK virtual viewports. Call this after [Installation](../README.md#installation).
2
+
3
+ - Demo: https://rdlabo-ionic-angular-library.netlify.app/main/virtual-scroll-header
4
+ - Source: https://github.com/rdlabo-dev/ionic-angular-library/blob/v21.6.2/projects/demo/src/app/virtual-scroll-header/virtual-scroll-header.page.html
5
+
6
+ ```ts
7
+ import { VirtualScrollHeaderDirective } from '@rdlabo/ionic-angular-scroll-header';
8
+
9
+ @Component({
10
+ ...
11
+ imports: [
12
+ VirtualScrollHeaderDirective
13
+ ],
14
+ })
15
+ ```
16
+
17
+ ```html
18
+ <ion-header class="hidden"><ion-toolbar></ion-toolbar></ion-header>
19
+ <!-- set hidden header for safe-area -->
20
+ <ion-content rdlaboVirtualScrollHeader>
21
+ <ion-header>
22
+ <ion-toolbar>...</ion-toolbar>
23
+ <!-- Default Header for display -->
24
+ </ion-header>
25
+ <cdk-virtual-scroll-viewport
26
+ minBufferPx="900"
27
+ maxBufferPx="1350"
28
+ [itemSize]="44"
29
+ class="ion-content-scroll-host"
30
+ >
31
+ ...Your Content
32
+ </cdk-virtual-scroll-viewport>
33
+ </ion-content>
34
+ ```
35
+
36
+ ### Fix https://github.com/angular/components/issues/27104
37
+
38
+ > bug(COMPONENT): CDK Virtual Scroller jump back/flickers to items on top #27104
39
+
40
+ ```ts
41
+ import { FixVirtualScrollElementDirective } from '@rdlabo/ionic-angular-scroll-header';
42
+
43
+ @Component({
44
+ ...
45
+ imports: [
46
+ FixVirtualScrollElementDirective
47
+ ],
48
+ })
49
+ ```
50
+
51
+ ```html
52
+ <ion-content>
53
+ <cdk-virtual-scroll-viewport
54
+ rdlaboFixVirtualScrollElement
55
+ minBufferPx="900"
56
+ maxBufferPx="1350"
57
+ [itemSize]="44"
58
+ class="ion-content-scroll-host"
59
+ >
60
+ ...Your Content
61
+ </cdk-virtual-scroll-viewport>
62
+ </ion-content>
63
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdlabo/ionic-angular-scroll-header",
3
- "version": "21.6.10",
3
+ "version": "21.7.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:rdlabo-dev/ionic-angular-library.git"