@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0m0g1/griot",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "A self-contained block-based rich text editor and renderer built for historical document authoring.",
5
5
  "type": "module",
6
6
  "main": "./src/Griot.js",
@@ -11,7 +11,15 @@
11
11
  // layouts: 'grid' | 'masonry' | 'carousel' | 'strip'
12
12
  // ─────────────────────────────────────────────────────────────────────────────
13
13
 
14
- import { lightbox } from './Lightbox.js';
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', () => lightbox.open(allItems, index));
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', () => lightbox.open(items, idx));
153
+ img.addEventListener('click', () => getLightbox().open(items, idx));
146
154
 
147
155
  slide.appendChild(img);
148
156