ngx-radiant 21.0.0 → 21.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to Ngx Radiant are documented in this file.
4
4
 
5
+ ## 21.1.0 - 2026-06-28
6
+
7
+ ### Added
8
+
9
+ - Mobile horizontal swipe navigation for image galleries.
10
+ - Pinch zoom and mobile double-tap zoom for image items.
11
+ - Lazy-loaded thumbnail images and configurable nearby image preloading.
12
+ - New config options: `swipeNavigation`, `swipeThreshold`, `pinchZoom`, `doubleTapZoom`, `lazyLoad`, `preloadImages`, and `preloadRadius`.
13
+ - Fullscreen toolbar action powered by the browser Fullscreen API.
14
+ - Download and open-original toolbar actions, including optional per-item `downloadName`.
15
+ - Configurable `toolbarActions` plus focus trap and restore-focus accessibility behavior.
16
+
5
17
  ## 21.0.0 - 2026-06-28
6
18
 
7
19
  ### Added
package/README.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # ngx-radiant
2
2
 
3
- A modern Angular 21+ lightbox library for image galleries and media previews.
3
+ [![npm version](https://img.shields.io/npm/v/ngx-radiant.svg)](https://www.npmjs.com/package/ngx-radiant)
4
+ [![npm downloads](https://img.shields.io/npm/dm/ngx-radiant.svg)](https://www.npmjs.com/package/ngx-radiant)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/edward124689/ngx-radiant/blob/main/LICENSE)
6
+
7
+ Angular 21+ lightbox gallery library with directive triggers, image zoom, thumbnails, captions, keyboard navigation, video previews, fullscreen toolbar controls, download/open-original actions, and iframe/YouTube embeds.
8
+
9
+ ## Mobile and performance defaults
10
+
11
+ Ngx Radiant enables swipe navigation, pinch zoom, double-tap zoom, lazy thumbnail loading, and nearby image preloading by default. Disable or tune them through `NgxRadiantConfig` when an app needs stricter behavior.
4
12
 
5
13
  ## Demo
6
14
 
@@ -16,7 +24,7 @@ npm install ngx-radiant
16
24
 
17
25
  ## Compatibility
18
26
 
19
- - Library version: `21.0.0`
27
+ - Library version: `21.1.0`
20
28
  - Angular compatibility: `21+`
21
29
 
22
30
  ## Component usage
@@ -49,6 +57,12 @@ export class GalleryComponent {
49
57
  maxZoom: 8,
50
58
  showZoomSlider: true,
51
59
  showThumbnails: true,
60
+ swipeNavigation: true,
61
+ pinchZoom: true,
62
+ preloadImages: true,
63
+ showFullscreenButton: true,
64
+ showDownload: true,
65
+ showOpenOriginal: true,
52
66
  };
53
67
 
54
68
  readonly items: NgxRadiantItem[] = [
@@ -89,7 +103,7 @@ export class GalleryComponent {
89
103
  }
90
104
  ```
91
105
 
92
- Images can zoom beyond the fitted viewport. When zoomed in, users can drag the image to inspect details.
106
+ Images can zoom beyond the fitted viewport. When zoomed in, users can drag the image to inspect details. On touch devices, users can swipe between gallery items, pinch to zoom, and double-tap image items to jump between min/max zoom.
93
107
 
94
108
  Single-image shorthand automatically hides the counter and previous/next controls:
95
109
 
@@ -107,7 +121,7 @@ Single-image shorthand automatically hides the counter and previous/next control
107
121
 
108
122
  Iframe / YouTube example:
109
123
 
110
- > Iframe sources must be application-controlled. Ngx Radiant only allows `http:`/`https:` iframe URLs by default. Use `iframeAllowedOrigins` when you want a stricter allowlist. Autoplay does not enable muted mode automatically; set `iframeMuted: true` only when you want muted autoplay params.
124
+ > Iframe sources must be application-controlled. Ngx Radiant only allows `http:`/`https:` iframe URLs by default, but empty `iframeAllowedOrigins` means any HTTP(S) origin can render. If iframe data can come from a CMS, database, API response, or user-controlled content, set `iframeAllowedOrigins` to a strict provider list such as `['https://www.youtube.com']`. Autoplay does not enable muted mode automatically; set `iframeMuted: true` only when you want muted autoplay params.
111
125
 
112
126
  ```ts
113
127
  readonly mediaItems: NgxRadiantItem[] = [
@@ -123,12 +137,43 @@ readonly mediaItems: NgxRadiantItem[] = [
123
137
  <button
124
138
  type="button"
125
139
  [ngxRadiant]="mediaItems"
126
- [radiantConfig]="{ showCounter: false, showNavigation: false, zoomable: false }"
140
+ [radiantConfig]="{
141
+ showCounter: false,
142
+ showNavigation: false,
143
+ zoomable: false,
144
+ iframeAllowedOrigins: ['https://www.youtube.com']
145
+ }"
127
146
  >
128
147
  Open YouTube
129
148
  </button>
130
149
  ```
131
150
 
151
+
152
+ ## Toolbar actions
153
+
154
+ Use `toolbarActions` to choose which built-in controls are visible. Enable optional actions with the matching config flag.
155
+
156
+ ```ts
157
+ const config: NgxRadiantConfig = {
158
+ showFullscreenButton: true,
159
+ showDownload: true,
160
+ showOpenOriginal: true,
161
+ toolbarActions: ['zoomOut', 'resetZoom', 'zoomIn', 'fullscreen', 'download', 'openOriginal', 'close'],
162
+ };
163
+
164
+ const items: NgxRadiantItem[] = [
165
+ {
166
+ src: '/assets/gallery/aurora.jpg',
167
+ caption: 'Aurora over a mountain ridge',
168
+ downloadName: 'aurora.jpg',
169
+ },
170
+ ];
171
+ ```
172
+
173
+ The dialog traps keyboard focus while open and restores focus to the trigger when it closes by default.
174
+
175
+ Download and open-original actions only run for relative URLs or `http:`/`https:` URLs. Other protocols are ignored for safer defaults.
176
+
132
177
  ## API
133
178
 
134
179
  ### `NgxRadiantLightbox`
@@ -151,6 +196,20 @@ readonly mediaItems: NgxRadiantItem[] = [
151
196
  | `maxZoom` | `number` | `3` | Maximum image zoom level. Overrides `config.maxZoom`. |
152
197
  | `zoomStep` | `number` | `0.25` | Amount changed by each zoom in/out action. Overrides `config.zoomStep`. |
153
198
  | `showZoomSlider` | `boolean` | `false` | Render a range slider for direct zoom control. Overrides `config.showZoomSlider`. |
199
+ | `swipeNavigation` | `boolean` | `true` | Enable horizontal swipe navigation on image galleries. Overrides `config.swipeNavigation`. |
200
+ | `swipeThreshold` | `number` | `48` | Minimum horizontal swipe distance in pixels. Overrides `config.swipeThreshold`. |
201
+ | `pinchZoom` | `boolean` | `true` | Enable two-finger pinch zoom on image items. Overrides `config.pinchZoom`. |
202
+ | `doubleTapZoom` | `boolean` | `true` | Enable mobile double-tap zoom toggling on image items. Overrides `config.doubleTapZoom`. |
203
+ | `lazyLoad` | `boolean` | `true` | Lazy-load thumbnails and mark the active image as eager. Overrides `config.lazyLoad`. |
204
+ | `preloadImages` | `boolean` | `true` | Preload nearby image items for faster navigation. Overrides `config.preloadImages`. |
205
+ | `preloadRadius` | `number` | `1` | Number of previous/next image items to preload. Overrides `config.preloadRadius`. |
206
+ | `toolbarActions` | `NgxRadiantToolbarAction[]` | built-in action list | Choose which toolbar actions are visible. Overrides `config.toolbarActions`. |
207
+ | `fullscreen` | `boolean` | `true` | Enable Fullscreen API support. Overrides `config.fullscreen`. |
208
+ | `showFullscreenButton` | `boolean` | `true` | Render the fullscreen toolbar action when supported. Overrides `config.showFullscreenButton`. |
209
+ | `showDownload` | `boolean` | `false` | Render the download toolbar action. Overrides `config.showDownload`. |
210
+ | `showOpenOriginal` | `boolean` | `false` | Render the open-original toolbar action. Overrides `config.showOpenOriginal`. |
211
+ | `trapFocus` | `boolean` | `true` | Keep Tab focus inside the open dialog. Overrides `config.trapFocus`. |
212
+ | `restoreFocus` | `boolean` | `true` | Restore focus to the previous active element on close. Overrides `config.restoreFocus`. |
154
213
  | `iframeAspectRatio` | `string` | `'16 / 9'` | CSS aspect-ratio for iframe embeds. Overrides `config.iframeAspectRatio`. |
155
214
  | `iframeAutoplay` | `boolean` | `false` | Appends `autoplay=1` to iframe URLs. Overrides `config.iframeAutoplay`. |
156
215
  | `iframeMuted` | `boolean` | `false` | Appends `mute=1&muted=1` only when explicitly enabled. Overrides `config.iframeMuted`. |
@@ -189,6 +248,20 @@ interface NgxRadiantConfig {
189
248
  maxZoom?: number;
190
249
  zoomStep?: number;
191
250
  showZoomSlider?: boolean;
251
+ swipeNavigation?: boolean;
252
+ swipeThreshold?: number;
253
+ pinchZoom?: boolean;
254
+ doubleTapZoom?: boolean;
255
+ lazyLoad?: boolean;
256
+ preloadImages?: boolean;
257
+ preloadRadius?: number;
258
+ toolbarActions?: NgxRadiantToolbarAction[];
259
+ fullscreen?: boolean;
260
+ showFullscreenButton?: boolean;
261
+ showDownload?: boolean;
262
+ showOpenOriginal?: boolean;
263
+ trapFocus?: boolean;
264
+ restoreFocus?: boolean;
192
265
  iframeAspectRatio?: string;
193
266
  iframeAutoplay?: boolean;
194
267
  iframeMuted?: boolean;
@@ -205,6 +278,7 @@ interface NgxRadiantItem {
205
278
  alt?: string;
206
279
  caption?: string;
207
280
  thumb?: string;
281
+ downloadName?: string;
208
282
  }
209
283
  ```
210
284