ngx-radiant 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/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +216 -0
- package/fesm2022/ngx-radiant.mjs +721 -0
- package/fesm2022/ngx-radiant.mjs.map +1 -0
- package/package.json +43 -0
- package/types/ngx-radiant.d.ts +143 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Ngx Radiant are documented in this file.
|
|
4
|
+
|
|
5
|
+
## 21.0.0 - 2026-06-28
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Initial public Angular 21+ standalone lightbox library release.
|
|
10
|
+
- `NgxRadiantLightbox` component with controlled `open/openChange` and `index/indexChange` bindings.
|
|
11
|
+
- `NgxRadiantDirective` trigger API for opening galleries or single images from any element.
|
|
12
|
+
- Image, video, and iframe item support, including YouTube embed URLs.
|
|
13
|
+
- Configurable iframe behavior:
|
|
14
|
+
- `iframeAspectRatio`, defaulting to `16 / 9`.
|
|
15
|
+
- `iframeAutoplay`, which appends `autoplay=1` without forcing muted mode.
|
|
16
|
+
- `iframeMuted`, which appends `mute=1&muted=1` only when explicitly enabled.
|
|
17
|
+
- `iframeAllowedOrigins` for optional iframe origin allowlisting.
|
|
18
|
+
- Image zoom controls with zoom in/out/reset, optional zoom slider, and bounded drag/pan while zoomed.
|
|
19
|
+
- Automatic hiding of counter and previous/next navigation for single-item overlays.
|
|
20
|
+
- Captions, counters, thumbnails, backdrop close, keyboard navigation, and CSS custom properties for theming.
|
|
21
|
+
- GitHub Pages demo covering component usage, directive usage, single-image usage, zoom, and iframe media.
|
|
22
|
+
|
|
23
|
+
### Security
|
|
24
|
+
|
|
25
|
+
- Iframe URLs are validated before being trusted as Angular resource URLs.
|
|
26
|
+
- Unsupported iframe protocols and disallowed origins render `about:blank`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Edward
|
|
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,216 @@
|
|
|
1
|
+
# ngx-radiant
|
|
2
|
+
|
|
3
|
+
A modern Angular 21+ lightbox library for image galleries and media previews.
|
|
4
|
+
|
|
5
|
+
## Demo
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
https://edward124689.github.io/ngx-radiant/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install ngx-radiant
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Compatibility
|
|
18
|
+
|
|
19
|
+
- Library version: `21.0.0`
|
|
20
|
+
- Angular compatibility: `21+`
|
|
21
|
+
|
|
22
|
+
## Component usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { Component, signal } from '@angular/core';
|
|
26
|
+
import { NgxRadiantConfig, NgxRadiantItem, NgxRadiantLightbox } from 'ngx-radiant';
|
|
27
|
+
|
|
28
|
+
@Component({
|
|
29
|
+
selector: 'app-gallery',
|
|
30
|
+
imports: [NgxRadiantLightbox],
|
|
31
|
+
template: `
|
|
32
|
+
<button type="button" (click)="isOpen.set(true)">Open gallery</button>
|
|
33
|
+
|
|
34
|
+
<ngx-radiant-lightbox
|
|
35
|
+
[items]="items"
|
|
36
|
+
[open]="isOpen()"
|
|
37
|
+
(openChange)="isOpen.set($event)"
|
|
38
|
+
[index]="activeIndex()"
|
|
39
|
+
(indexChange)="activeIndex.set($event)"
|
|
40
|
+
[config]="config"
|
|
41
|
+
/>
|
|
42
|
+
`,
|
|
43
|
+
})
|
|
44
|
+
export class GalleryComponent {
|
|
45
|
+
readonly isOpen = signal(false);
|
|
46
|
+
readonly activeIndex = signal(0);
|
|
47
|
+
readonly config: NgxRadiantConfig = {
|
|
48
|
+
zoomStep: 0.5,
|
|
49
|
+
maxZoom: 8,
|
|
50
|
+
showZoomSlider: true,
|
|
51
|
+
showThumbnails: true,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
readonly items: NgxRadiantItem[] = [
|
|
55
|
+
{
|
|
56
|
+
src: '/assets/gallery/aurora.jpg',
|
|
57
|
+
thumb: '/assets/gallery/aurora-thumb.jpg',
|
|
58
|
+
alt: 'Aurora over a mountain ridge',
|
|
59
|
+
caption: 'Aurora over a mountain ridge',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Directive usage
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { Component } from '@angular/core';
|
|
69
|
+
import { NgxRadiantDirective, NgxRadiantItem } from 'ngx-radiant';
|
|
70
|
+
|
|
71
|
+
@Component({
|
|
72
|
+
selector: 'app-gallery',
|
|
73
|
+
imports: [NgxRadiantDirective],
|
|
74
|
+
template: `
|
|
75
|
+
<button type="button" [ngxRadiant]="items" [radiantIndex]="0">
|
|
76
|
+
Open gallery
|
|
77
|
+
</button>
|
|
78
|
+
`,
|
|
79
|
+
})
|
|
80
|
+
export class GalleryComponent {
|
|
81
|
+
readonly items: NgxRadiantItem[] = [
|
|
82
|
+
{
|
|
83
|
+
src: '/assets/gallery/aurora.jpg',
|
|
84
|
+
thumb: '/assets/gallery/aurora-thumb.jpg',
|
|
85
|
+
alt: 'Aurora over a mountain ridge',
|
|
86
|
+
caption: 'Aurora over a mountain ridge',
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Images can zoom beyond the fitted viewport. When zoomed in, users can drag the image to inspect details.
|
|
93
|
+
|
|
94
|
+
Single-image shorthand automatically hides the counter and previous/next controls:
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
ngxRadiant="/assets/gallery/aurora.jpg"
|
|
100
|
+
radiantAlt="Aurora over a mountain ridge"
|
|
101
|
+
radiantCaption="Aurora over a mountain ridge"
|
|
102
|
+
[radiantConfig]="{ zoomStep: 0.5, maxZoom: 3 }"
|
|
103
|
+
>
|
|
104
|
+
Open image
|
|
105
|
+
</button>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Iframe / YouTube example:
|
|
109
|
+
|
|
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.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
readonly mediaItems: NgxRadiantItem[] = [
|
|
114
|
+
{
|
|
115
|
+
src: 'https://www.youtube.com/embed/jYqX4YUzcKs',
|
|
116
|
+
type: 'iframe',
|
|
117
|
+
caption: 'YouTube embed',
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
[ngxRadiant]="mediaItems"
|
|
126
|
+
[radiantConfig]="{ showCounter: false, showNavigation: false, zoomable: false }"
|
|
127
|
+
>
|
|
128
|
+
Open YouTube
|
|
129
|
+
</button>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## API
|
|
133
|
+
|
|
134
|
+
### `NgxRadiantLightbox`
|
|
135
|
+
|
|
136
|
+
| Input/output | Type | Default | Description |
|
|
137
|
+
| --- | --- | --- | --- |
|
|
138
|
+
| `items` | `NgxRadiantItem[]` | `[]` | Gallery items to display. |
|
|
139
|
+
| `open` / `openChange` | `boolean` | `false` | Controls visibility. |
|
|
140
|
+
| `index` / `indexChange` | `number` | `0` | Controls the selected item. |
|
|
141
|
+
| `config` | `NgxRadiantConfig` | `null` | Shared config object for controls, zoom, and UI visibility. |
|
|
142
|
+
| `ariaLabel` | `string` | `Image gallery lightbox` | Accessible dialog label. Overrides `config.ariaLabel`. |
|
|
143
|
+
| `closeOnEscape` | `boolean` | `true` | Close the lightbox when Escape is pressed. Overrides `config.closeOnEscape`. |
|
|
144
|
+
| `loop` | `boolean` | `true` | Wrap navigation at the first/last item. Overrides `config.loop`. |
|
|
145
|
+
| `showThumbnails` | `boolean` | `true` | Render the thumbnail strip when possible. Overrides `config.showThumbnails`. |
|
|
146
|
+
| `showCounter` | `boolean` | `true` | Render the counter when there is more than one item. Overrides `config.showCounter`. |
|
|
147
|
+
| `showNavigation` | `boolean` | `true` | Render previous/next controls when there is more than one item. Overrides `config.showNavigation`. |
|
|
148
|
+
| `zoomable` | `boolean` | `true` | Enable zoom controls for image items. Overrides `config.zoomable`. |
|
|
149
|
+
| `initialZoom` | `number` | `1` | Initial image zoom level. Overrides `config.initialZoom`. |
|
|
150
|
+
| `minZoom` | `number` | `1` | Minimum image zoom level. Overrides `config.minZoom`. |
|
|
151
|
+
| `maxZoom` | `number` | `3` | Maximum image zoom level. Overrides `config.maxZoom`. |
|
|
152
|
+
| `zoomStep` | `number` | `0.25` | Amount changed by each zoom in/out action. Overrides `config.zoomStep`. |
|
|
153
|
+
| `showZoomSlider` | `boolean` | `false` | Render a range slider for direct zoom control. Overrides `config.showZoomSlider`. |
|
|
154
|
+
| `iframeAspectRatio` | `string` | `'16 / 9'` | CSS aspect-ratio for iframe embeds. Overrides `config.iframeAspectRatio`. |
|
|
155
|
+
| `iframeAutoplay` | `boolean` | `false` | Appends `autoplay=1` to iframe URLs. Overrides `config.iframeAutoplay`. |
|
|
156
|
+
| `iframeMuted` | `boolean` | `false` | Appends `mute=1&muted=1` only when explicitly enabled. Overrides `config.iframeMuted`. |
|
|
157
|
+
| `iframeAllowedOrigins` | `string[]` | `[]` | Optional iframe origin allowlist. Empty means any `http:`/`https:` origin is allowed; unsupported protocols render `about:blank`. |
|
|
158
|
+
|
|
159
|
+
### `NgxRadiantDirective`
|
|
160
|
+
|
|
161
|
+
| Input | Type | Default | Description |
|
|
162
|
+
| --- | --- | --- | --- |
|
|
163
|
+
| `ngxRadiant` | `NgxRadiantItem \| NgxRadiantItem[] \| string` | `null` | Item, item list, or single image URL to open. |
|
|
164
|
+
| `radiantItems` | `NgxRadiantItem[]` | `null` | Optional explicit gallery items. |
|
|
165
|
+
| `radiantIndex` | `number` | `0` | Initial item index. |
|
|
166
|
+
| `radiantAlt` | `string` | `undefined` | Alt text for string shorthand. |
|
|
167
|
+
| `radiantCaption` | `string` | `undefined` | Caption for string shorthand. |
|
|
168
|
+
| `radiantThumb` | `string` | `undefined` | Thumbnail for string shorthand. |
|
|
169
|
+
| `radiantType` | `'image' \| 'video' \| 'iframe'` | `undefined` | Media type for string shorthand. |
|
|
170
|
+
| `radiantAriaLabel` | `string` | `Image gallery lightbox` | Accessible dialog label. |
|
|
171
|
+
| `radiantConfig` | `NgxRadiantConfig` | `null` | Shared config object passed to the created lightbox. |
|
|
172
|
+
| `radiantCloseOnEscape` | `boolean` | `true` | Close the overlay when Escape is pressed. |
|
|
173
|
+
| `radiantLoop` | `boolean` | `true` | Wrap navigation at the first/last item. |
|
|
174
|
+
| `radiantShowThumbnails` | `boolean` | `true` | Render the thumbnail strip when possible. |
|
|
175
|
+
|
|
176
|
+
### `NgxRadiantConfig`
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
interface NgxRadiantConfig {
|
|
180
|
+
ariaLabel?: string;
|
|
181
|
+
closeOnEscape?: boolean;
|
|
182
|
+
loop?: boolean;
|
|
183
|
+
showThumbnails?: boolean;
|
|
184
|
+
showCounter?: boolean;
|
|
185
|
+
showNavigation?: boolean;
|
|
186
|
+
zoomable?: boolean;
|
|
187
|
+
initialZoom?: number;
|
|
188
|
+
minZoom?: number;
|
|
189
|
+
maxZoom?: number;
|
|
190
|
+
zoomStep?: number;
|
|
191
|
+
showZoomSlider?: boolean;
|
|
192
|
+
iframeAspectRatio?: string;
|
|
193
|
+
iframeAutoplay?: boolean;
|
|
194
|
+
iframeMuted?: boolean;
|
|
195
|
+
iframeAllowedOrigins?: string[];
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `NgxRadiantItem`
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
interface NgxRadiantItem {
|
|
203
|
+
src: string;
|
|
204
|
+
type?: 'image' | 'video' | 'iframe';
|
|
205
|
+
alt?: string;
|
|
206
|
+
caption?: string;
|
|
207
|
+
thumb?: string;
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Commands
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npm run build:lib
|
|
215
|
+
npm test -- --watch=false
|
|
216
|
+
```
|