neiki-gallery 1.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 +21 -0
- package/README.md +233 -0
- package/dist/neiki-gallery.css +675 -0
- package/dist/neiki-gallery.js +955 -0
- package/dist/neiki-gallery.min.css +1 -0
- package/dist/neiki-gallery.min.js +12 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 neikiri
|
|
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,233 @@
|
|
|
1
|
+
<h1 align="center">Neiki Gallery</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="logo.png" alt="neiki-gallery" width="400">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E" alt="JavaScript">
|
|
9
|
+
<img src="https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white" alt="HTML5">
|
|
10
|
+
<img src="https://img.shields.io/badge/css-%23663399.svg?style=for-the-badge&logo=css&logoColor=white" alt="CSS">
|
|
11
|
+
<br>
|
|
12
|
+
<img src="https://img.shields.io/badge/License-MIT-2563EB?style=for-the-badge&logo=open-source-initiative&logoColor=white&labelColor=000F15&logoWidth=20" alt="License">
|
|
13
|
+
<img src="https://img.shields.io/badge/Version-1.0.0-2563EB?style=for-the-badge&logo=semantic-release&logoColor=white&labelColor=000F15&logoWidth=20" alt="Version">
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<b>Vanilla JavaScript Image Gallery & Lightbox</b><br>
|
|
18
|
+
<i>Beautiful, responsive, zero dependencies.</i>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<img src="https://img.shields.io/badge/Layouts-Masonry%20%26%20Grid-3b82f6?style=flat&labelColor=383C43" />
|
|
23
|
+
<img src="https://img.shields.io/badge/Themes-Light%20%26%20Dark-8b5cf6?style=flat&labelColor=383C43" />
|
|
24
|
+
<img src="https://img.shields.io/badge/Setup-Zero%20Config-22c55e?style=flat&labelColor=383C43" />
|
|
25
|
+
<img src="https://img.shields.io/badge/Size-Lightweight-f97316?style=flat&labelColor=383C43" />
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📖 About
|
|
31
|
+
|
|
32
|
+
**Neiki Gallery** is a production-ready image gallery and lightbox library built with vanilla JavaScript and CSS. No frameworks, no dependencies — just drop two files into your project and you're ready to go.
|
|
33
|
+
|
|
34
|
+
## ✨ Features
|
|
35
|
+
|
|
36
|
+
- **Masonry & Grid layouts** — switchable via option or `data-` attribute
|
|
37
|
+
- **Lightbox** — smooth open/close animations with fade or slide transitions
|
|
38
|
+
- **Keyboard navigation** — arrow keys, Escape, Home/End, F for fullscreen
|
|
39
|
+
- **Touch / swipe support** — mobile-friendly left/right swipe to navigate
|
|
40
|
+
- **Lazy loading** — IntersectionObserver-powered with shimmer placeholders
|
|
41
|
+
- **Image captions** — via `data-caption` attribute
|
|
42
|
+
- **Thumbnail strip** — optional scrollable thumbnails in lightbox
|
|
43
|
+
- **Zoom** — click to toggle zoom in/out
|
|
44
|
+
- **Fullscreen mode** — native Fullscreen API
|
|
45
|
+
- **Image counter** — e.g. "3 / 12"
|
|
46
|
+
- **Loading spinner** — pure CSS spinner while images load
|
|
47
|
+
- **Deep linking** — URL hash support (`#neiki-1=3` opens image 3)
|
|
48
|
+
- **Multiple instances** — independent galleries on one page
|
|
49
|
+
- **Dark & light themes** — via CSS custom properties and `data-theme`
|
|
50
|
+
- **Accessibility** — ARIA attributes, focus management, `prefers-reduced-motion`
|
|
51
|
+
- **Preloading** — adjacent images preloaded for instant navigation
|
|
52
|
+
- **Infinite loop** — optional wrap-around navigation
|
|
53
|
+
- **Event system** — `open`, `close`, `change` events
|
|
54
|
+
- **Clean destroy** — full cleanup of DOM nodes and event listeners
|
|
55
|
+
- **Cross-browser** — Chrome, Firefox, Safari, Edge
|
|
56
|
+
|
|
57
|
+
## 🚀 Quick Start
|
|
58
|
+
|
|
59
|
+
### CDN (Recommended)
|
|
60
|
+
|
|
61
|
+
Add these two lines to your HTML — that's all you need:
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<link rel="stylesheet" href="http://cdn.neiki.eu/neiki-gallery/neiki-gallery.min.css">
|
|
65
|
+
<script src="http://cdn.neiki.eu/neiki-gallery/neiki-gallery.min.js"></script>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then create your gallery markup:
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<div data-neiki-gallery data-layout="masonry" data-theme="dark">
|
|
72
|
+
<a href="images/photo1-full.jpg" data-caption="Beautiful sunset">
|
|
73
|
+
<img src="images/photo1-thumb.jpg" alt="Sunset">
|
|
74
|
+
</a>
|
|
75
|
+
<a href="images/photo2-full.jpg" data-caption="Mountain view">
|
|
76
|
+
<img src="images/photo2-thumb.jpg" alt="Mountains">
|
|
77
|
+
</a>
|
|
78
|
+
</div>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That's it — galleries with `data-neiki-gallery` auto-initialize on page load.
|
|
82
|
+
|
|
83
|
+
> **Unminified files** are also available if you need them for debugging:
|
|
84
|
+
> ```
|
|
85
|
+
> http://cdn.neiki.eu/neiki-gallery/neiki-gallery.js
|
|
86
|
+
> http://cdn.neiki.eu/neiki-gallery/neiki-gallery.css
|
|
87
|
+
> ```
|
|
88
|
+
|
|
89
|
+
> **Pin a specific version** to avoid unexpected changes:
|
|
90
|
+
> ```
|
|
91
|
+
> http://cdn.neiki.eu/neiki-gallery/1.0.0/neiki-gallery.min.js
|
|
92
|
+
> http://cdn.neiki.eu/neiki-gallery/1.0.0/neiki-gallery.min.css
|
|
93
|
+
> ```
|
|
94
|
+
|
|
95
|
+
### Self-Hosting (Local)
|
|
96
|
+
|
|
97
|
+
Download or clone the repository from GitHub:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/neikiri/neiki-gallery.git
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Copy the files from the `dist/` folder into your project and link them directly:
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<link rel="stylesheet" href="path/to/neiki-gallery.min.css">
|
|
107
|
+
<script src="path/to/neiki-gallery.min.js"></script>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The `dist/` folder contains both minified and unminified versions:
|
|
111
|
+
|
|
112
|
+
| File | Description |
|
|
113
|
+
|------|-------------|
|
|
114
|
+
| `neiki-gallery.min.js` | Minified JS (production) |
|
|
115
|
+
| `neiki-gallery.min.css` | Minified CSS (production) |
|
|
116
|
+
| `neiki-gallery.js` | Full JS (development / debugging) |
|
|
117
|
+
| `neiki-gallery.css` | Full CSS (development / debugging) |
|
|
118
|
+
|
|
119
|
+
### Manual Initialization
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
const gallery = new NeikiGallery('#my-gallery', {
|
|
123
|
+
layout: 'masonry', // 'masonry' | 'grid'
|
|
124
|
+
loop: true,
|
|
125
|
+
thumbnails: true,
|
|
126
|
+
zoom: true,
|
|
127
|
+
fullscreen: true,
|
|
128
|
+
transition: 'fade', // 'fade' | 'slide'
|
|
129
|
+
theme: 'dark', // 'dark' | 'light'
|
|
130
|
+
hashNavigation: true,
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 🔧 API
|
|
135
|
+
|
|
136
|
+
### Methods
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
gallery.open(index); // Open lightbox at image index
|
|
140
|
+
gallery.close(); // Close lightbox
|
|
141
|
+
gallery.next(); // Go to next image
|
|
142
|
+
gallery.prev(); // Go to previous image
|
|
143
|
+
gallery.destroy(); // Remove gallery, clean up all listeners & DOM
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Events
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
gallery.on('open', (index) => {
|
|
150
|
+
console.log('Opened image', index);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
gallery.on('close', () => {
|
|
154
|
+
console.log('Lightbox closed');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
gallery.on('change', (index) => {
|
|
158
|
+
console.log('Now showing image', index);
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Options
|
|
163
|
+
|
|
164
|
+
| Option | Type | Default | Description |
|
|
165
|
+
|--------|------|---------|-------------|
|
|
166
|
+
| `layout` | `string` | `'masonry'` | Grid layout: `'masonry'` or `'grid'` |
|
|
167
|
+
| `loop` | `boolean` | `false` | Enable infinite loop navigation |
|
|
168
|
+
| `thumbnails` | `boolean` | `true` | Show thumbnail strip in lightbox |
|
|
169
|
+
| `zoom` | `boolean` | `true` | Enable zoom on image click |
|
|
170
|
+
| `fullscreen` | `boolean` | `true` | Show fullscreen button |
|
|
171
|
+
| `transition` | `string` | `'fade'` | Transition effect: `'fade'` or `'slide'` |
|
|
172
|
+
| `theme` | `string` | `'dark'` | Theme: `'dark'` or `'light'` |
|
|
173
|
+
| `hashNavigation` | `boolean` | `true` | Enable URL hash deep linking |
|
|
174
|
+
| `counter` | `boolean` | `true` | Show image counter |
|
|
175
|
+
| `captions` | `boolean` | `true` | Show image captions |
|
|
176
|
+
| `preload` | `number` | `1` | Number of adjacent images to preload |
|
|
177
|
+
| `lazyLoad` | `boolean` | `true` | Lazy load grid thumbnails |
|
|
178
|
+
|
|
179
|
+
### Data Attributes
|
|
180
|
+
|
|
181
|
+
All options can also be set via `data-` attributes on the container:
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<div data-neiki-gallery
|
|
185
|
+
data-layout="grid"
|
|
186
|
+
data-theme="light"
|
|
187
|
+
data-transition="slide"
|
|
188
|
+
data-loop="true"
|
|
189
|
+
data-thumbnails="true"
|
|
190
|
+
data-zoom="true"
|
|
191
|
+
data-fullscreen="true"
|
|
192
|
+
data-hash-navigation="true">
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 🎨 Theming
|
|
196
|
+
|
|
197
|
+
Neiki Gallery uses CSS custom properties for full theming control:
|
|
198
|
+
|
|
199
|
+
```css
|
|
200
|
+
:root {
|
|
201
|
+
--neiki-columns: 4;
|
|
202
|
+
--neiki-gap: 12px;
|
|
203
|
+
--neiki-border-radius: 6px;
|
|
204
|
+
--neiki-overlay-bg: rgba(0, 0, 0, 0.92);
|
|
205
|
+
--neiki-btn-bg: rgba(255, 255, 255, 0.12);
|
|
206
|
+
--neiki-btn-color: #fff;
|
|
207
|
+
--neiki-caption-color: #fff;
|
|
208
|
+
--neiki-spinner-color: #fff;
|
|
209
|
+
--neiki-thumb-size: 56px;
|
|
210
|
+
--neiki-zoom-scale: 2;
|
|
211
|
+
--neiki-transition-duration: 0.3s;
|
|
212
|
+
/* ... and more */
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Switch themes at runtime by setting `data-theme="light"` or `data-theme="dark"` on the gallery container.
|
|
217
|
+
|
|
218
|
+
## 🌐 Browser Support
|
|
219
|
+
|
|
220
|
+
| Browser | Version |
|
|
221
|
+
|---------|---------|
|
|
222
|
+
| Chrome | 60+ |
|
|
223
|
+
| Firefox | 55+ |
|
|
224
|
+
| Safari | 12+ |
|
|
225
|
+
| Edge | 79+ |
|
|
226
|
+
|
|
227
|
+
## 📄 License
|
|
228
|
+
|
|
229
|
+
This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
|
|
230
|
+
|
|
231
|
+
## 📬 Contact
|
|
232
|
+
|
|
233
|
+
- **Email:** [dev@neiki.eu](mailto:dev@neiki.eu)
|