@0m0g1/griot 0.1.11 → 0.1.12
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/package.json
CHANGED
|
@@ -11,15 +11,7 @@
|
|
|
11
11
|
// layouts: 'grid' | 'masonry' | 'carousel' | 'strip'
|
|
12
12
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
let _lightbox = null;
|
|
16
|
-
function getLightbox() {
|
|
17
|
-
if (!_lightbox) {
|
|
18
|
-
// Dynamic require/import — works in both CJS and ESM bundler contexts
|
|
19
|
-
_lightbox = require('./Lightbox.js').lightbox;
|
|
20
|
-
}
|
|
21
|
-
return _lightbox;
|
|
22
|
-
}
|
|
14
|
+
import { lightbox } from './Lightbox.js';
|
|
23
15
|
|
|
24
16
|
const VALID_LAYOUTS = new Set(['grid', 'masonry', 'carousel', 'strip']);
|
|
25
17
|
|
|
@@ -105,7 +97,7 @@ function _itemEl(item, index, allItems) {
|
|
|
105
97
|
img.decoding = 'async';
|
|
106
98
|
img.draggable = false;
|
|
107
99
|
|
|
108
|
-
img.addEventListener('click', () =>
|
|
100
|
+
img.addEventListener('click', () => lightbox.open(allItems, index));
|
|
109
101
|
|
|
110
102
|
el.appendChild(img);
|
|
111
103
|
|
|
@@ -150,7 +142,7 @@ function _carousel(items, wrap) {
|
|
|
150
142
|
|
|
151
143
|
// Click on carousel image → open lightbox at CURRENT idx (not i, since user
|
|
152
144
|
// may have navigated away from the first image)
|
|
153
|
-
img.addEventListener('click', () =>
|
|
145
|
+
img.addEventListener('click', () => lightbox.open(items, idx));
|
|
154
146
|
|
|
155
147
|
slide.appendChild(img);
|
|
156
148
|
|