rm-image-slider 19.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-26 Rajat
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 CHANGED
@@ -1,183 +1,302 @@
1
- <a href="https://github.com/malikrajat/rm-image-slider">
2
- <h1 align="center">Image Slider/ carousel</h1>
3
- <p align="center">Advanced, customizable, Optimized ,Minimal, light-weight and fully customizable pure angular component for carousel.</p>
4
- </a>
5
-
6
- [![npm](https://img.shields.io/npm/v/ngx-bar-rating.svg)](https://www.npmjs.com/package/rm-image-slider)
7
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/malikrajat/rm-image-slider)
8
-
9
- # Angular Image Slider with Lightbox
10
-
11
- An Angular responsive image slider with lightbox popup.
12
- Also support youtube and mp4 video urls. It is leazy loading and heigly optimized with standalone component.
13
-
14
- (Compatible Till Angular Version: 19)
15
-
16
- ## Features!
17
-
18
- - Responsive (support images width and height in both % and px)
19
- - captures swipes from phones and tablets
20
- - Compatible with Angular Universal
21
- - Image lightbox popup
22
- - captures keyboard next/previous arrow key event for lightbox image move
23
- - Support Images (jpeg, jpg, gif, png and Base64-String), Youtube url and MP4 video (url and Base64-String)
24
- - Handling runtime image arraylist changes
25
-
26
- # Installation
27
-
28
- Install rm-image-slider with npm amd yarn
29
-
30
- ```bash
31
-
32
- npm: npm install rm-image-slider--save
33
-
34
- yarn: yarn add rm-image-slider
35
-
36
- ```
37
-
38
- # Setup :
39
-
40
- **Import module in your component:**
41
-
42
- ```typescript
43
- import { RmImageSliderComponent, ImageObject } from 'rm-image-slider';
44
- ...
45
- @Component({
46
- selector: '',
47
- standalone: true,
48
- imports: [RmImageSliderComponent],
49
- templateUrl: '',
50
- styleUrl: '',
51
- })
52
-
53
- ```
54
-
55
- **Add component in your template file.**
56
-
57
- ```html
58
- <rm-image-slider [images]="imageObject" #nav></rm-image-slider>
59
- ```
60
-
61
- **ImageObject format**
62
-
63
- ```js
64
- imageObject: Array<ImageObject> = [{
65
- image: 'assets/img/slider/1.jpg',
66
- thumbImage: 'assets/img/slider/1_min.jpeg',
67
- alt: 'alt of image',
68
- title: 'title of image',
69
- index: 1
70
- }, {
71
- image: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
72
- thumbImage: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
73
- title: 'Image title', //Optional: You can use this key if want to show image with title
74
- alt: 'Image alt', //Optional: You can use this key if want to show image with alt
75
- order: 1, //Optional: if you pass this key then slider images will be arrange according @input: slideOrderType
76
- index: 2
77
- }
78
- ];
79
- ```
80
-
81
- **Image, Youtube and MP4 url's object format**
82
-
83
- ```js
84
- imageObject: Array<ImageObject> = [{
85
- video: 'https://youtu.be/....' // Youtube url
86
- index: 1
87
- },
88
- {
89
- video: 'assets/video/********.mp4', // MP4 Video url
90
- index: 2
91
- },
92
- {
93
- video: 'assets/video/movie2.mp4',
94
- posterImage: 'assets/img/slider/2_min.jpeg', //Optional: You can use this key if you want to show video poster image in slider
95
- title: 'Image title',
96
- index: 3
97
- },
98
- {
99
- image: 'assets/img/slider/1.jpg',
100
- thumbImage: 'assets/img/slider/1_min.jpeg',
101
- alt: 'Image alt',
102
- index: 4
103
- }
104
- ...
105
- ];
106
- ```
107
-
108
- ## API Reference (optional) :
109
-
110
- | Name | Type | Data Type | Description | Default |
111
- | ------------------ | ------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
112
- | infinite | @Input | boolean | Infinite sliding images if value is **true**. | false |
113
- | imagePopup | @Input | boolean | Enable image lightBox popup option on slider image click. | true |
114
- | animationSpeed | @Input | number | By this user can set slider animation speed. Minimum value is **0.1 second** and Maximum value is **5 second**. | 1 |
115
- | slideImage | @Input | number | Set how many images will move on left/right arrow click. | 1 |
116
- | imageSize | @Input | object | Set slider images width, height and space. space is use for set space between slider images. Pass object like `{width: '400px', height: '300px', space: 4}` or you can pass value in percentage `{width: '20%', height: '20%'}` OR set only space `{space: 4}` | `{width: 205, height: 200, space: 3}` |
117
- | manageImageRatio | @Input | boolean | Show images with aspect ratio if value is `true` and set imageSize width and height on parent div | false |
118
- | autoSlide | @Input | number/boolean/object | Auto slide images according provided time interval. Option will work only if **infinite** option is **true**. For number data type minimum value is 1 second and Maximum value is 5 second. By object data type you can prevent auto slide stop behaviour on mouse hover event. `{interval: 2, stopOnHover: false}` | 0 |
119
- | showArrow | @Input | boolean | Hide/Show slider arrow buttons | true |
120
- | arrowKeyMove | @Input | boolean | Disable slider and popup image left/right move on arrow key press event, if value is `false` | true |
121
- | videoAutoPlay | @Input | boolean | Auto play popup video | false |
122
- | showVideoControls | @Input | boolean | Hide video control if value is `false` | true |
123
- | direction | @Input | string | Set text direction. You can pass **rtl** / **ltr** / **auto** | ltr |
124
- | slideOrderType | @Input | string | Arrange slider images in Ascending order by `ASC` and in Descending order by `DESC`. `order` key must be exist with image object. | ASC |
125
- | lazyLoading | @Input | boolean | Lazy load images and Iframe if true. | false |
126
- | defaultActiveImage | @Input | number | Set image as selected on load. | null |
127
- | imageClick | @Output | n/a | Executes when click event on slider image. Return image index. | n/a |
128
- | arrowClick | @Output | n/a | Executes when click on slider left/right arrow. Returns current event name and next/previous button disabled status. | n/a |
129
- | lightboxClose | @Output | n/a | Executes when lightbox close. | n/a |
130
- | lightboxArrowClick | @Output | n/a | Executes when click on lightbox next/previous arrow. | n/a |
131
-
132
- ## Add custom navigation button
133
-
134
- ```typescript
135
- import { RmImageSliderComponent } from 'rm-image-slider';
136
-
137
- @Component({
138
- selector: 'sample',
139
- standalone: true,
140
- imports: [RmImageSliderComponent],
141
- template:`
142
- <rm-image-slider [images]="imageObject" #nav>
143
- </rm-image-slider>
144
- <button (click)="prevImageClick()">Prev</button>
145
- <button (click)="nextImageClick()">Next</button>
146
- `
147
- })
148
- class Sample {
149
- @ViewChild('nav') slider: RmImageSliderComponent;
150
- imageObject = [{...}]
151
-
152
- prevImageClick() {
153
- this.slider.prev();
154
- }
155
-
156
- nextImageClick() {
157
- this.slider.next();
158
- }
159
- }
160
- ```
161
- <a name="issues"/>
162
-
163
- ## Issues
164
-
165
- If you identify any errors in this component, or have an idea for an improvement, please open
166
- an [issue](https://github.com/malikrajat/rm-image-slider/issues). I am excited to see what the community thinks of this
167
- project, and I would love your input!
168
-
169
- ## Author services
170
-
171
- Are you interested in this library but lacks features? Write to the author, he can do it for you.
172
-
173
- ## Credits
174
-
175
- The library is inspired by one other library.
176
-
177
-
178
- <a name="author"/>
179
-
180
- ## Author
181
-
182
- **Rajat Malik**
183
- - [github/malikrajat](https://github.com/malikrajat)
1
+ <a href="https://github.com/malikrajat/rm-image-slider">
2
+ <h1 align="center">Image Slider/ carousel</h1>
3
+ <p align="center">Advanced, customizable, Optimized ,Minimal, light-weight and fully customizable pure angular component for carousel.</p>
4
+ </a>
5
+
6
+ [![npm](https://img.shields.io/npm/v/ngx-bar-rating.svg)](https://www.npmjs.com/package/rm-image-slider)
7
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/malikrajat/rm-image-slider)
8
+
9
+
10
+ # Angular Image Slider with Lightbox
11
+
12
+ An Angular responsive image slider with lightbox popup.
13
+ Also support youtube and mp4 video urls. It is leazy loading and heigly optimized with standalone component.
14
+
15
+
16
+ ## 🎬 Demo in Action
17
+
18
+ <div align="center">
19
+
20
+ ![rm-image-slider Demo](https://github.com/malikrajat/rm-image-slider/blob/main/assets/rm-image-slider-demo.gif)
21
+
22
+ *Experience the power: Image carousel, lightbox popup, video support, and touch gestures - all in one lightweight component!*
23
+
24
+ </div>
25
+
26
+ > **✨ What you're seeing:** Smooth transitions, responsive touch controls, lightbox with keyboard navigation, video playback support, and customizable styling - everything working seamlessly together.
27
+
28
+
29
+
30
+
31
+ ## Features!
32
+
33
+ - Responsive (support images width and height in both % and px)
34
+ - captures swipes from phones and tablets
35
+ - Compatible with Angular Universal
36
+ - Image lightbox popup
37
+ - captures keyboard next/previous arrow key event for lightbox image move
38
+ - Support Images (jpeg, jpg, gif, png and Base64-String), Youtube url and MP4 video (url and Base64-String)
39
+ - Handling runtime image arraylist changes
40
+
41
+
42
+ <div align="left">
43
+
44
+ ## 🚀 Live Demo & Examples
45
+
46
+ ### Try it out now! See all features in action 👇
47
+
48
+ <table>
49
+ <tr>
50
+ <td align="">
51
+ <a href="https://stackblitz.com/edit/stackblitz-starters-3kmpe6u9" target="_blank">
52
+ <img src="https://img.shields.io/badge/⚡_StackBlitz-1976D2?style=for-the-badge&logo=stackblitz&logoColor=white" alt="StackBlitz"/>
53
+ </a>
54
+ </td>
55
+ </tr>
56
+ </table>
57
+
58
+ ### 🎯 What you'll see:
59
+ • **Image Carousel** with smooth transitions
60
+ • **Lightbox Popup** with keyboard navigation
61
+ **Video Support** (YouTube & MP4)
62
+ • **Mobile Responsive** touch/swipe gestures
63
+ • **Customization Options** - size, speed, autoplay
64
+
65
+ </div>
66
+
67
+ ---
68
+
69
+ # Installation
70
+
71
+ Install rm-image-slider with npm amd yarn
72
+
73
+ ```bash
74
+
75
+ npm: npm install rm-image-slider--save
76
+
77
+ yarn: yarn add rm-image-slider
78
+
79
+ ```
80
+
81
+ # Setup :
82
+
83
+ **Import module in your component:**
84
+
85
+ ```typescript
86
+ import { RmImageSliderComponent, ImageObject } from 'rm-image-slider';
87
+ ...
88
+ @Component({
89
+ selector: '',
90
+ standalone: true,
91
+ imports: [RmImageSliderComponent],
92
+ templateUrl: '',
93
+ styleUrl: '',
94
+ })
95
+
96
+ ```
97
+
98
+ **Add component in your template file.**
99
+
100
+ ```html
101
+ <rm-image-slider [images]="imageObject" #nav></rm-image-slider>
102
+ ```
103
+
104
+ **ImageObject format**
105
+
106
+ ```js
107
+ imageObject: Array<ImageObject> = [{
108
+ image: 'assets/img/slider/1.jpg',
109
+ thumbImage: 'assets/img/slider/1_min.jpeg',
110
+ alt: 'alt of image',
111
+ title: 'title of image',
112
+ index: 1
113
+ }, {
114
+ image: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
115
+ thumbImage: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
116
+ title: 'Image title', //Optional: You can use this key if want to show image with title
117
+ alt: 'Image alt', //Optional: You can use this key if want to show image with alt
118
+ order: 1, //Optional: if you pass this key then slider images will be arrange according @input: slideOrderType
119
+ index: 2
120
+ }
121
+ ];
122
+ ```
123
+
124
+ **Image, Youtube and MP4 url's object format**
125
+
126
+ ```js
127
+ imageObject: Array<ImageObject> = [{
128
+ video: 'https://youtu.be/....' // Youtube url
129
+ index: 1
130
+ },
131
+ {
132
+ video: 'assets/video/********.mp4', // MP4 Video url
133
+ index: 2
134
+ },
135
+ {
136
+ video: 'assets/video/movie2.mp4',
137
+ posterImage: 'assets/img/slider/2_min.jpeg', //Optional: You can use this key if you want to show video poster image in slider
138
+ title: 'Image title',
139
+ index: 3
140
+ },
141
+ {
142
+ image: 'assets/img/slider/1.jpg',
143
+ thumbImage: 'assets/img/slider/1_min.jpeg',
144
+ alt: 'Image alt',
145
+ index: 4
146
+ }
147
+ ...
148
+ ];
149
+ ```
150
+
151
+ ## API Reference (optional) :
152
+
153
+ | Name | Type | Data Type | Description | Default |
154
+ | ------------------ | ------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
155
+ | infinite | @Input | boolean | Infinite sliding images if value is **true**. | false |
156
+ | imagePopup | @Input | boolean | Enable image lightBox popup option on slider image click. | true |
157
+ | animationSpeed | @Input | number | By this user can set slider animation speed. Minimum value is **0.1 second** and Maximum value is **5 second**. | 1 |
158
+ | slideImage | @Input | number | Set how many images will move on left/right arrow click. | 1 |
159
+ | imageSize | @Input | object | Set slider images width, height and space. space is use for set space between slider images. Pass object like `{width: '400px', height: '300px', space: 4}` or you can pass value in percentage `{width: '20%', height: '20%'}` OR set only space `{space: 4}` | `{width: 205, height: 200, space: 3}` |
160
+ | manageImageRatio | @Input | boolean | Show images with aspect ratio if value is `true` and set imageSize width and height on parent div | false |
161
+ | autoSlide | @Input | number/boolean/object | Auto slide images according provided time interval. Option will work only if **infinite** option is **true**. For number data type minimum value is 1 second and Maximum value is 5 second. By object data type you can prevent auto slide stop behaviour on mouse hover event. `{interval: 2, stopOnHover: false}` | 0 |
162
+ | showArrow | @Input | boolean | Hide/Show slider arrow buttons | true |
163
+ | arrowKeyMove | @Input | boolean | Disable slider and popup image left/right move on arrow key press event, if value is `false` | true |
164
+ | videoAutoPlay | @Input | boolean | Auto play popup video | false |
165
+ | showVideoControls | @Input | boolean | Hide video control if value is `false` | true |
166
+ | direction | @Input | string | Set text direction. You can pass **rtl** / **ltr** / **auto** | ltr |
167
+ | slideOrderType | @Input | string | Arrange slider images in Ascending order by `ASC` and in Descending order by `DESC`. `order` key must be exist with image object. | ASC |
168
+ | lazyLoading | @Input | boolean | Lazy load images and Iframe if true. | false |
169
+ | defaultActiveImage | @Input | number | Set image as selected on load. | null |
170
+ | imageClick | @Output | n/a | Executes when click event on slider image. Return image index. | n/a |
171
+ | arrowClick | @Output | n/a | Executes when click on slider left/right arrow. Returns current event name and next/previous button disabled status. | n/a |
172
+ | lightboxClose | @Output | n/a | Executes when lightbox close. | n/a |
173
+ | lightboxArrowClick | @Output | n/a | Executes when click on lightbox next/previous arrow. | n/a |
174
+
175
+ ## Add custom navigation button
176
+
177
+ ```typescript
178
+ import { Component, ViewChild } from '@angular/core';
179
+ import { RmImageSliderComponent } from 'rm-image-slider';
180
+
181
+ @Component({
182
+ selector: 'sample',
183
+ standalone: true,
184
+ imports: [RmImageSliderComponent],
185
+ template:`
186
+ <rm-image-slider [images]="imageObject" #nav>
187
+ </rm-image-slider>
188
+ <button (click)="prevImageClick()">Prev</button>
189
+ <button (click)="nextImageClick()">Next</button>
190
+ `
191
+ })
192
+ class Sample {
193
+ @ViewChild('nav') slider: RmImageSliderComponent;
194
+ imageObject = [{...}]
195
+
196
+ prevImageClick() {
197
+ this.slider.prev();
198
+ }
199
+
200
+ nextImageClick() {
201
+ this.slider.next();
202
+ }
203
+ }
204
+ ```
205
+
206
+ ---
207
+
208
+ ## 🧭 Compatibility
209
+
210
+ | Angular Version | Support | Standalone | Notes |
211
+ |-----------------|---------|------------|-------|
212
+ | 14.x | ✅ Full | ✅ Yes | Minimum required |
213
+ | 15.x | ✅ Full | ✅ Yes | Recommended |
214
+ | 16.x | ✅ Full | ✅ Yes | Recommended |
215
+ | 17.x | ✅ Full | ✅ Yes | Latest tested |
216
+ | 18.x+ | ✅ Expected | ✅ Yes | Should work |
217
+
218
+ ---
219
+
220
+ ### 🧭 Browser Support
221
+
222
+ | Browser | Version | Support |
223
+ |---------|---------|---------|
224
+ | Chrome | 80+ | ✅ Full |
225
+ | Firefox | 75+ | ✅ Full |
226
+ | Safari | 13+ | ✅ Full |
227
+ | Edge | 80+ | ✅ Full |
228
+
229
+ ---
230
+
231
+ ## 🌳 Tree-Shaking and Optimization
232
+
233
+ - The library is marked as `sideEffects: false` to support advanced tree-shaking.
234
+ - The service-based API is inherently tree-shakable; it won\'t be included in your bundle if it\'s not imported and used.
235
+
236
+ ---
237
+
238
+ ### Development Setup
239
+
240
+ ```bash
241
+ git clone https://github.com/malikrajat/rm-image-slider.git
242
+ cd rm-rm-image-slider
243
+ pnpm install
244
+ pnpm start # Serves test app on localhost:4200
245
+
246
+ ```
247
+
248
+ ---
249
+
250
+ ## 🐛 Issues & Support
251
+
252
+ - 🐛 [Report Bug](https://github.com/malikrajat/rm-image-slider/issues/new?template=bug_report.md)
253
+ - 💡 [Request Feature](https://github.com/malikrajat/rm-image-slider/issues/new?template=feature_request.md)
254
+ - 💬 [Discussions](https://github.com/malikrajat/rm-image-slider/discussions)
255
+ - 📧 [Email Support](mailto:mr.rajatmalik@gmail.com?subject=rm-image-slider%20Support)
256
+
257
+ ---
258
+
259
+ ## 📄 License
260
+
261
+ MIT License - see [LICENSE](LICENSE) file for details.
262
+
263
+ ---
264
+
265
+ ## 👨‍💻 Author
266
+
267
+ **Rajat Malik**
268
+ - 🌐 Website: [rajatmalik.dev](https://rajatmalik.dev)
269
+ - 📧 Email: [mr.rajatmalik@gmail.com](mailto:mr.rajatmalik@gmail.com)
270
+ - 💼 LinkedIn: [Connect with me](https://linkedin.com/in/errajatmalik)
271
+
272
+ ---
273
+
274
+ ## 💝 Show Your Support
275
+
276
+ If this library has saved you development time and helped create amazing image sliders in your projects, **please consider giving it a ⭐ star!**
277
+
278
+ 🌟 **Why star this repo?**
279
+ - Help other developers discover this lightweight, optimized solution
280
+ - Support continued development and improvements
281
+ - Show appreciation for free, quality tools
282
+ - Boost visibility in the Angular community
283
+
284
+ ### 🚀 **Want More Quality Libraries?**
285
+
286
+ This is just one of several useful libraries I've created. **[Explore my other Angular & web development libraries](https://github.com/malikrajat?tab=repositories)** that might solve your next challenge:
287
+
288
+ - 🔧 **Utility libraries** for common development tasks
289
+ - 🎨 **UI components** for better user experiences
290
+ - ⚡ **Performance tools** for optimization
291
+ - 📱 **Mobile-friendly solutions** for responsive apps
292
+
293
+ **Found them helpful?** A star on each repo you find useful helps tremendously! It takes just one click but means the world to open-source maintainers.
294
+
295
+ [![GitHub followers](https://img.shields.io/github/followers/malikrajat?style=social)](https://github.com/malikrajat)
296
+ [![GitHub stars](https://img.shields.io/github/stars/malikrajat/rm-image-slider?style=social)](https://github.com/malikrajat/rm-image-slider/stargazers)
297
+
298
+ ---
299
+
300
+ ## Credits
301
+
302
+ The library is inspired by one other library.
Binary file