@canopy-iiif/app 1.10.3 → 1.10.4

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": "@canopy-iiif/app",
3
- "version": "1.10.3",
3
+ "version": "1.10.4",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",
package/ui/dist/index.mjs CHANGED
@@ -48472,6 +48472,55 @@ var INLINE_SCRIPT = `(() => {
48472
48472
  emitModalState(previous, 'close');
48473
48473
  }
48474
48474
 
48475
+ function closeModalFromBackground(modal) {
48476
+ if (!modal) return;
48477
+ const closeId = modal.getAttribute('data-canopy-gallery-close');
48478
+ const targetHash = closeId ? '#' + closeId : '';
48479
+ if (targetHash) {
48480
+ if (window.location.hash === targetHash) {
48481
+ try {
48482
+ window.location.hash = targetHash;
48483
+ } catch (_) {}
48484
+ } else {
48485
+ window.location.hash = targetHash;
48486
+ }
48487
+ } else {
48488
+ window.location.hash = '';
48489
+ }
48490
+ }
48491
+
48492
+ function shouldCloseFromBackground(event, modal) {
48493
+ if (!event || !modal) return false;
48494
+ const target = event.target;
48495
+ if (!target) return false;
48496
+ const panel = modal.querySelector('.canopy-gallery__modal-panel');
48497
+ if (panel && panel.contains(target)) return false;
48498
+ const actions = modal.querySelector('.canopy-gallery__modal-actions');
48499
+ if (actions && actions.contains(target)) return false;
48500
+ if (target === modal) return true;
48501
+ const scrim = modal.querySelector('.canopy-gallery__modal-scrim');
48502
+ if (scrim && scrim.contains(target)) return true;
48503
+ return false;
48504
+ }
48505
+
48506
+ function bindModalDismissal(modal) {
48507
+ if (!modal || modal.getAttribute('data-canopy-gallery-dismiss-bound') === '1') {
48508
+ return;
48509
+ }
48510
+ modal.setAttribute('data-canopy-gallery-dismiss-bound', '1');
48511
+ modal.addEventListener('click', function (event) {
48512
+ if (!shouldCloseFromBackground(event, modal)) return;
48513
+ event.preventDefault();
48514
+ closeModalFromBackground(modal);
48515
+ });
48516
+ }
48517
+
48518
+ function bindModalDismissals() {
48519
+ const modals = document.querySelectorAll('[data-canopy-gallery-modal]');
48520
+ if (!modals || !modals.length) return;
48521
+ Array.prototype.forEach.call(modals, bindModalDismissal);
48522
+ }
48523
+
48475
48524
  function modalFromHash() {
48476
48525
  const id = window.location.hash.replace(/^#/, '');
48477
48526
  if (!id) return null;
@@ -48755,10 +48804,12 @@ var INLINE_SCRIPT = `(() => {
48755
48804
  window.addEventListener('pageshow', function () {
48756
48805
  syncFromHash();
48757
48806
  bindGalleryNavs();
48807
+ bindModalDismissals();
48758
48808
  refreshGalleryNavs({reveal: true});
48759
48809
  });
48760
48810
  syncFromHash();
48761
48811
  bindGalleryNavs();
48812
+ bindModalDismissals();
48762
48813
  refreshGalleryNavs({reveal: true});
48763
48814
  })()`;
48764
48815
  var galleryInstanceCounter = 0;
@@ -49126,7 +49177,7 @@ function GalleryItem() {
49126
49177
  GalleryItem.displayName = "GalleryItem";
49127
49178
  function normalizePopupSize(value) {
49128
49179
  const normalized = String(value || "full").toLowerCase();
49129
- return normalized === "medium" ? "medium" : "full";
49180
+ return normalized === "window" ? "window" : "full";
49130
49181
  }
49131
49182
  function Gallery({
49132
49183
  children,
@@ -49150,7 +49201,7 @@ function Gallery({
49150
49201
  const orderedItems = orderMode === "random" ? shuffleItems(items) : items;
49151
49202
  const rootClassName = [
49152
49203
  "canopy-gallery",
49153
- popupMode === "medium" ? "canopy-gallery--popup-medium" : "canopy-gallery--popup-full",
49204
+ popupMode === "window" ? "canopy-gallery--popup-window" : "canopy-gallery--popup-full",
49154
49205
  className
49155
49206
  ].filter(Boolean).join(" ");
49156
49207
  const navGroupName = `${galleryId}-nav`;