@0m0g1/griot 0.1.10 → 0.1.11
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,7 +11,15 @@
|
|
|
11
11
|
// layouts: 'grid' | 'masonry' | 'carousel' | 'strip'
|
|
12
12
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
// Lazy import avoids circular dependency when both are re-exported from Griot.js
|
|
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
|
+
}
|
|
15
23
|
|
|
16
24
|
const VALID_LAYOUTS = new Set(['grid', 'masonry', 'carousel', 'strip']);
|
|
17
25
|
|
|
@@ -97,7 +105,7 @@ function _itemEl(item, index, allItems) {
|
|
|
97
105
|
img.decoding = 'async';
|
|
98
106
|
img.draggable = false;
|
|
99
107
|
|
|
100
|
-
img.addEventListener('click', () =>
|
|
108
|
+
img.addEventListener('click', () => getLightbox().open(allItems, index));
|
|
101
109
|
|
|
102
110
|
el.appendChild(img);
|
|
103
111
|
|
|
@@ -142,7 +150,7 @@ function _carousel(items, wrap) {
|
|
|
142
150
|
|
|
143
151
|
// Click on carousel image → open lightbox at CURRENT idx (not i, since user
|
|
144
152
|
// may have navigated away from the first image)
|
|
145
|
-
img.addEventListener('click', () =>
|
|
153
|
+
img.addEventListener('click', () => getLightbox().open(items, idx));
|
|
146
154
|
|
|
147
155
|
slide.appendChild(img);
|
|
148
156
|
|