ng-images-preview 1.0.3 → 2.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/README.md +43 -5
- package/fesm2022/ng-images-preview.mjs +682 -192
- package/fesm2022/ng-images-preview.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ng-images-preview.d.ts +163 -13
package/README.md
CHANGED
|
@@ -28,12 +28,16 @@ Check out the component in action: **[https://lanxuexing.github.io/ng-images-pre
|
|
|
28
28
|
- 🎨 **Vanilla CSS**: Zero dependencies, fully customizable via CSS variables.
|
|
29
29
|
- 🖼️ **Multi-Image Gallery**: Navigate through a list of images with arrows or swipe gestures.
|
|
30
30
|
- 📱 **Mobile Ready**: Swipe to navigate, double-tap to zoom, pinch-to-zoom gestures.
|
|
31
|
+
- 👆 **Pull-to-Close**: Drag down to close the preview (like native apps).
|
|
32
|
+
- 🎞️ **Thumbnail Strip**: Quick preview and navigation with an auto-scrolling strip.
|
|
33
|
+
- 🧩 **Toolbar Extensions**: Inject custom buttons (like Download) into the toolbar.
|
|
34
|
+
- 🤝 **Hybrid Support**: Fully compatible with both Standalone and NgModule-based apps.
|
|
31
35
|
- ⌨️ **Keyboard Support**: Arrow keys to navigate, ESC to close.
|
|
32
36
|
- 🔍 **Zoom & Pan**: Smooth zooming and panning interactions.
|
|
33
37
|
- 🔄 **Rotate & Flip**: Built-in toolbar for image manipulation.
|
|
34
|
-
-
|
|
38
|
+
- 🎨 **Custom Template**: Complete control over the preview UI via `ng-template`.
|
|
35
39
|
- ♿ **Accessible**: ARIA labels and focus management.
|
|
36
|
-
- ⚡ **Performance**: Smart image preloading for smoother
|
|
40
|
+
- ⚡ **Performance**: Smart image preloading and buffering for smoother navigation.
|
|
37
41
|
- 🌏 **SSR Safe**: Fully compatible with Angular Universal/SSR.
|
|
38
42
|
- 🌗 **Dark Mode Ready**: Inherits system preferences or app styles seamlessly.
|
|
39
43
|
|
|
@@ -70,10 +74,9 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
70
74
|
export class AppModule { }
|
|
71
75
|
```
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Register `ImagesPreviewDirective` in your standalone component or module.
|
|
77
|
+
Register the library in your standalone component or module.
|
|
76
78
|
|
|
79
|
+
#### Standalone (Recommended)
|
|
77
80
|
```typescript
|
|
78
81
|
import { ImagesPreviewDirective } from 'ng-images-preview';
|
|
79
82
|
|
|
@@ -84,6 +87,16 @@ import { ImagesPreviewDirective } from 'ng-images-preview';
|
|
|
84
87
|
export class MyComponent {}
|
|
85
88
|
```
|
|
86
89
|
|
|
90
|
+
#### NgModule (Legacy Support)
|
|
91
|
+
```typescript
|
|
92
|
+
import { NgImagesPreviewModule } from 'ng-images-preview';
|
|
93
|
+
|
|
94
|
+
@NgModule({
|
|
95
|
+
imports: [NgImagesPreviewModule, ...]
|
|
96
|
+
})
|
|
97
|
+
export class AppModule {}
|
|
98
|
+
```
|
|
99
|
+
|
|
87
100
|
### 2. Basic Usage
|
|
88
101
|
|
|
89
102
|
**Option A: Zero Config** (Auto-detects source)
|
|
@@ -175,6 +188,31 @@ When using `previewTemplate`, you get access to:
|
|
|
175
188
|
| `next()` | Go to next image (if gallery). |
|
|
176
189
|
| `prev()` | Go to previous image (if gallery). |
|
|
177
190
|
|
|
191
|
+
### CSS Variables (Theming)
|
|
192
|
+
|
|
193
|
+
You can customize the look and feel by overriding these CSS variables in your `styles.css` or component styles:
|
|
194
|
+
|
|
195
|
+
```css
|
|
196
|
+
:root {
|
|
197
|
+
/* Overlay Background */
|
|
198
|
+
--ng-img-background: rgba(0, 0, 0, 0.95);
|
|
199
|
+
|
|
200
|
+
/* Text & Icons */
|
|
201
|
+
--ng-img-text-color: rgba(255, 255, 255, 0.8);
|
|
202
|
+
|
|
203
|
+
/* Z-Index */
|
|
204
|
+
--ng-img-z-index: 50;
|
|
205
|
+
|
|
206
|
+
/* Toolbar */
|
|
207
|
+
--ng-img-toolbar-bg: rgba(255, 255, 255, 0.1);
|
|
208
|
+
--ng-img-toolbar-hover: rgba(255, 255, 255, 0.2);
|
|
209
|
+
--ng-img-gap: 16px;
|
|
210
|
+
|
|
211
|
+
/* Counters */
|
|
212
|
+
--ng-img-item-bg: rgba(0, 0, 0, 0.3);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
178
216
|
|
|
179
217
|
|
|
180
218
|
## 🛠 Development
|