ngx-zoneless-scrollbar 1.0.0 → 21.0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +210 -0
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Legalfina Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,210 @@
1
+ # ngx-zoneless-scrollbar
2
+
3
+ A lightweight, zoneless-compatible scrollbar component for Angular. Uses native browser scrolling with CSS-styled scrollbars, designed specifically for Angular's zoneless change detection mode.
4
+
5
+ ## Why ngx-zoneless-scrollbar?
6
+
7
+ Angular's zoneless mode (`provideZonelessChangeDetection()`) offers significant performance benefits, but many existing scrollbar libraries rely on Zone.js for change detection and `afterRenderEffect` callbacks that may not work correctly in zoneless mode.
8
+
9
+ **ngx-zoneless-scrollbar** solves this by:
10
+
11
+ - Using **native browser scrolling** - 100% reliable, no Zone.js dependency
12
+ - Using **ResizeObserver** directly - detects content changes without Angular's lifecycle
13
+ - Being **fully signal-based** - works seamlessly with Angular's reactive primitives
14
+ - Providing **CSS-styled scrollbars** - customizable appearance on all modern browsers
15
+
16
+ ## Features
17
+
18
+ ✅ **Zoneless Compatible** - Works perfectly with `provideZonelessChangeDetection()`
19
+ ✅ **Lightweight** - No heavy dependencies, uses native browser APIs
20
+ ✅ **Signal-based** - Exposes scrollability state as Angular signals
21
+ ✅ **Touch Friendly** - Supports momentum scrolling on mobile devices
22
+ ✅ **Customizable** - Easy to style with CSS variables
23
+ ✅ **Standalone** - Works with Angular's standalone components
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install ngx-zoneless-scrollbar
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ### Basic Usage
34
+
35
+ ```typescript
36
+ import { Component } from '@angular/core';
37
+ import { NgxZonelessScrollbar } from 'ngx-zoneless-scrollbar';
38
+
39
+ @Component({
40
+ standalone: true,
41
+ imports: [NgxZonelessScrollbar],
42
+ template: `
43
+ <ngx-zoneless-scrollbar>
44
+ <div>Your scrollable content here</div>
45
+ </ngx-zoneless-scrollbar>
46
+ `,
47
+ styles: [
48
+ `
49
+ ngx-zoneless-scrollbar {
50
+ height: 400px; /* Required: Set a height for scrolling to work */
51
+ }
52
+ `,
53
+ ],
54
+ })
55
+ export class MyComponent {}
56
+ ```
57
+
58
+ ### With Event Binding
59
+
60
+ ```typescript
61
+ import { Component } from '@angular/core';
62
+ import { NgxZonelessScrollbar, ScrollbarUpdateEvent } from 'ngx-zoneless-scrollbar';
63
+
64
+ @Component({
65
+ standalone: true,
66
+ imports: [NgxZonelessScrollbar],
67
+ template: `
68
+ <ngx-zoneless-scrollbar #scrollbar (afterUpdate)="onScrollbarUpdate($event)">
69
+ <div>Your content</div>
70
+ </ngx-zoneless-scrollbar>
71
+
72
+ <p *ngIf="scrollbar.isVerticallyScrollable()">Content is scrollable!</p>
73
+ `,
74
+ })
75
+ export class MyComponent {
76
+ onScrollbarUpdate(event: ScrollbarUpdateEvent) {
77
+ console.log('Vertically scrollable:', event.isVerticallyScrollable);
78
+ console.log('Horizontally scrollable:', event.isHorizontallyScrollable);
79
+ }
80
+ }
81
+ ```
82
+
83
+ ### Programmatic Scrolling
84
+
85
+ ```typescript
86
+ import { Component, ViewChild } from '@angular/core';
87
+ import { NgxZonelessScrollbar } from 'ngx-zoneless-scrollbar';
88
+
89
+ @Component({
90
+ standalone: true,
91
+ imports: [NgxZonelessScrollbar],
92
+ template: `
93
+ <ngx-zoneless-scrollbar #scrollbar>
94
+ <div>Your content</div>
95
+ </ngx-zoneless-scrollbar>
96
+
97
+ <button (click)="scrollToTop()">Scroll to Top</button>
98
+ `,
99
+ })
100
+ export class MyComponent {
101
+ @ViewChild('scrollbar') scrollbar!: NgxZonelessScrollbar;
102
+
103
+ scrollToTop() {
104
+ this.scrollbar.scrollTo({ top: 0, behavior: 'smooth' });
105
+ }
106
+ }
107
+ ```
108
+
109
+ ## API Reference
110
+
111
+ ### Inputs
112
+
113
+ | Input | Type | Default | Description |
114
+ | ------------- | ---------------------------------------------- | ------------ | ---------------- |
115
+ | `orientation` | `'vertical' &#124; 'horizontal' &#124; 'auto'` | `'vertical'` | Scroll direction |
116
+
117
+ ### Outputs
118
+
119
+ | Output | Type | Description |
120
+ | ------------- | ---------------------- | -------------------------------------- |
121
+ | `afterUpdate` | `ScrollbarUpdateEvent` | Emits when scrollability state changes |
122
+
123
+ ### Public Properties (Signals)
124
+
125
+ | Property | Type | Description |
126
+ | -------------------------- | ----------------- | ------------------------------------------ |
127
+ | `isVerticallyScrollable` | `Signal<boolean>` | Whether content is vertically scrollable |
128
+ | `isHorizontallyScrollable` | `Signal<boolean>` | Whether content is horizontally scrollable |
129
+
130
+ ### Public Methods
131
+
132
+ | Method | Description |
133
+ | ------------------------------------ | -------------------------------------- |
134
+ | `scrollTo(options: ScrollToOptions)` | Scroll to a specific position |
135
+ | `update()` | Manually trigger a scrollability check |
136
+ | `viewportElement` | Get the native viewport element |
137
+
138
+ ## Styling
139
+
140
+ ### CSS Variables
141
+
142
+ Customize the scrollbar appearance using CSS:
143
+
144
+ ```css
145
+ ngx-zoneless-scrollbar {
146
+ /* Scrollbar size */
147
+ --scrollbar-size: 8px;
148
+
149
+ /* Track styling */
150
+ --scrollbar-track-color: transparent;
151
+ --scrollbar-track-radius: 4px;
152
+
153
+ /* Thumb styling */
154
+ --scrollbar-thumb-color: rgba(0, 0, 0, 0.3);
155
+ --scrollbar-thumb-color-hover: rgba(0, 0, 0, 0.5);
156
+ --scrollbar-thumb-radius: 4px;
157
+ }
158
+ ```
159
+
160
+ ### Custom Styles Example
161
+
162
+ ```css
163
+ /* Dark theme scrollbar */
164
+ .dark-theme ngx-zoneless-scrollbar {
165
+ --scrollbar-thumb-color: rgba(255, 255, 255, 0.3);
166
+ --scrollbar-thumb-color-hover: rgba(255, 255, 255, 0.5);
167
+ }
168
+
169
+ /* Thin scrollbar */
170
+ .thin-scrollbar ngx-zoneless-scrollbar {
171
+ --scrollbar-size: 4px;
172
+ }
173
+ ```
174
+
175
+ ## Browser Support
176
+
177
+ - ✅ Chrome 88+
178
+ - ✅ Firefox 64+
179
+ - ✅ Safari 14+
180
+ - ✅ Edge 88+
181
+
182
+ All browsers that support CSS `scrollbar-width` and `::-webkit-scrollbar` pseudo-elements.
183
+
184
+ ## Migration from ngx-scrollbar
185
+
186
+ If you're migrating from `ngx-scrollbar` due to zoneless compatibility issues:
187
+
188
+ ```html
189
+ <!-- Before (ngx-scrollbar) -->
190
+ <ng-scrollbar #scrollbar="ngScrollbar" (afterUpdate)="onUpdate(scrollbar.adapter.isVerticallyScrollable())">
191
+ <content />
192
+ </ng-scrollbar>
193
+
194
+ <!-- After (ngx-zoneless-scrollbar) -->
195
+ <ngx-zoneless-scrollbar #scrollbar (afterUpdate)="onUpdate($event.isVerticallyScrollable)">
196
+ <content />
197
+ </ngx-zoneless-scrollbar>
198
+ ```
199
+
200
+ ## Contributing
201
+
202
+ Contributions are welcome! Please feel free to submit a Pull Request.
203
+
204
+ ## Contributors
205
+
206
+ - [Farshad Hemmati](https://github.com/farshadhemmati)
207
+
208
+ ## License
209
+
210
+ MIT © [Legalfina](https://www.legalfina.com/en)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-zoneless-scrollbar",
3
- "version": "1.0.0",
3
+ "version": "21.0.0",
4
4
  "description": "A lightweight, zoneless-compatible scrollbar component for Angular. Uses native browser scrolling with CSS-styled scrollbars, designed for Angular's zoneless change detection mode.",
5
5
  "keywords": [
6
6
  "angular",