lightgallery 2.5.0-beta.1 → 2.5.0-beta.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/README.md +4 -4
- package/css/lightgallery-bundle.css +15 -0
- package/css/lightgallery-bundle.min.css +1 -1
- package/css/lightgallery-core.css +4 -0
- package/css/lightgallery.css +15 -0
- package/lg-settings.d.ts +14 -0
- package/lg-utils.d.ts +1 -0
- package/lib/lg-settings.js +3 -0
- package/lib/lg-settings.js.map +1 -1
- package/lib/lg-utils.js +8 -0
- package/lib/lg-utils.js.map +1 -1
- package/lib/lightgallery.js +66 -4
- package/lib/lightgallery.js.map +1 -1
- package/lib/plugins/video/lg-video-settings.js +1 -0
- package/lib/plugins/video/lg-video-settings.js.map +1 -1
- package/lib/plugins/video/lg-video.js +3 -1
- package/lib/plugins/video/lg-video.js.map +1 -1
- package/lightgallery.d.ts +5 -0
- package/lightgallery.es5.js +78 -5
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +78 -5
- package/lightgallery.umd.js.map +1 -1
- package/lit/lightgallery.esm.js +7 -7
- package/lit/lightgallery.umd.js +3 -3
- package/package.json +1 -1
- package/plugins/autoplay/lg-autoplay.es5.js +1 -1
- package/plugins/autoplay/lg-autoplay.min.js +1 -1
- package/plugins/autoplay/lg-autoplay.umd.js +1 -1
- package/plugins/comment/lg-comment.es5.js +1 -1
- package/plugins/comment/lg-comment.min.js +1 -1
- package/plugins/comment/lg-comment.umd.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
- package/plugins/hash/lg-hash.es5.js +1 -1
- package/plugins/hash/lg-hash.min.js +1 -1
- package/plugins/hash/lg-hash.umd.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
- package/plugins/pager/lg-pager.es5.js +1 -1
- package/plugins/pager/lg-pager.min.js +1 -1
- package/plugins/pager/lg-pager.umd.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
- package/plugins/rotate/lg-rotate.es5.js +1 -1
- package/plugins/rotate/lg-rotate.min.js +1 -1
- package/plugins/rotate/lg-rotate.umd.js +1 -1
- package/plugins/share/lg-share.es5.js +1 -1
- package/plugins/share/lg-share.min.js +1 -1
- package/plugins/share/lg-share.umd.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
- package/plugins/video/lg-video-settings.d.ts +6 -1
- package/plugins/video/lg-video.es5.js +5 -2
- package/plugins/video/lg-video.es5.js.map +1 -1
- package/plugins/video/lg-video.min.js +2 -2
- package/plugins/video/lg-video.umd.js +5 -2
- package/plugins/video/lg-video.umd.js.map +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +1 -1
- package/plugins/zoom/lg-zoom.es5.js +1 -1
- package/plugins/zoom/lg-zoom.min.js +1 -1
- package/plugins/zoom/lg-zoom.umd.js +1 -1
- package/react/Lightgallery.es5.js +78 -5
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +78 -5
- package/react/Lightgallery.umd.js.map +1 -1
- package/scss/_lg-theme-default.scss +16 -0
- package/scss/lightgallery-core.scss +3 -0
- package/vue/LightGalleryVue.common.js +120 -31
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +120 -31
- package/vue/LightGalleryVue.umd.js.map +1 -1
- package/vue/LightGalleryVue.umd.min.js +2 -2
- package/vue/LightGalleryVue.umd.min.js.map +1 -1
|
@@ -28,7 +28,7 @@ function __rest(s, e) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/*!
|
|
31
|
-
* lightgallery | 2.5.0-beta.
|
|
31
|
+
* lightgallery | 2.5.0-beta.4 | May 9th 2022
|
|
32
32
|
* http://www.lightgalleryjs.com/
|
|
33
33
|
* Copyright (c) 2020 Sachin Neravath;
|
|
34
34
|
* @license GPLv3
|
|
@@ -125,6 +125,8 @@ var lightGalleryCoreSettings = {
|
|
|
125
125
|
defaultCaptionHeight: 0,
|
|
126
126
|
ariaLabelledby: '',
|
|
127
127
|
ariaDescribedby: '',
|
|
128
|
+
resetScrollPosition: true,
|
|
129
|
+
hideScrollbar: false,
|
|
128
130
|
closable: true,
|
|
129
131
|
swipeToClose: true,
|
|
130
132
|
closeOnTap: true,
|
|
@@ -133,6 +135,7 @@ var lightGalleryCoreSettings = {
|
|
|
133
135
|
loop: true,
|
|
134
136
|
escKey: true,
|
|
135
137
|
keyPress: true,
|
|
138
|
+
trapFocus: true,
|
|
136
139
|
controls: true,
|
|
137
140
|
slideEndAnimation: true,
|
|
138
141
|
hideControlOnEnd: false,
|
|
@@ -749,6 +752,14 @@ var utils = {
|
|
|
749
752
|
}
|
|
750
753
|
return "<div class=\"lg-video-cont " + videoClass + "\" style=\"" + videoContStyle + "\">\n <div class=\"lg-video-play-button\">\n <svg\n viewBox=\"0 0 20 20\"\n preserveAspectRatio=\"xMidYMid\"\n focusable=\"false\"\n aria-labelledby=\"" + playVideoString + "\"\n role=\"img\"\n class=\"lg-video-play-icon\"\n >\n <title>" + playVideoString + "</title>\n <polygon class=\"lg-video-play-icon-inner\" points=\"1,0 20,10 1,20\"></polygon>\n </svg>\n <svg class=\"lg-video-play-icon-bg\" viewBox=\"0 0 50 50\" focusable=\"false\">\n <circle cx=\"50%\" cy=\"50%\" r=\"20\"></circle></svg>\n <svg class=\"lg-video-play-icon-circle\" viewBox=\"0 0 50 50\" focusable=\"false\">\n <circle cx=\"50%\" cy=\"50%\" r=\"20\"></circle>\n </svg>\n </div>\n " + (dummyImg || '') + "\n <img class=\"lg-object lg-video-poster\" src=\"" + _poster + "\" />\n </div>";
|
|
751
754
|
},
|
|
755
|
+
getFocusableElements: function (container) {
|
|
756
|
+
var elements = container.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
|
|
757
|
+
var visibleElements = [].filter.call(elements, function (element) {
|
|
758
|
+
var style = window.getComputedStyle(element);
|
|
759
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
760
|
+
});
|
|
761
|
+
return visibleElements;
|
|
762
|
+
},
|
|
752
763
|
/**
|
|
753
764
|
* @desc Create dynamic elements array from gallery items when dynamic option is false
|
|
754
765
|
* It helps to avoid frequent DOM interaction
|
|
@@ -852,6 +863,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
852
863
|
this.currentItemsInDom = [];
|
|
853
864
|
// Scroll top value before lightGallery is opened
|
|
854
865
|
this.prevScrollTop = 0;
|
|
866
|
+
this.bodyPaddingRight = 0;
|
|
855
867
|
this.isDummyImageRemoved = false;
|
|
856
868
|
this.dragOrSwipeEnabled = false;
|
|
857
869
|
this.mediaContainerPosition = {
|
|
@@ -1199,6 +1211,27 @@ var LightGallery = /** @class */ (function () {
|
|
|
1199
1211
|
return this.settings.dynamicEl || [];
|
|
1200
1212
|
}
|
|
1201
1213
|
};
|
|
1214
|
+
LightGallery.prototype.shouldHideScrollbar = function () {
|
|
1215
|
+
return (this.settings.hideScrollbar &&
|
|
1216
|
+
document.body === this.settings.container);
|
|
1217
|
+
};
|
|
1218
|
+
LightGallery.prototype.hideScrollbar = function () {
|
|
1219
|
+
if (!this.shouldHideScrollbar()) {
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
this.bodyPaddingRight = parseFloat($LG('body').style().paddingRight);
|
|
1223
|
+
var bodyRect = document.documentElement.getBoundingClientRect();
|
|
1224
|
+
var scrollbarWidth = window.innerWidth - bodyRect.width;
|
|
1225
|
+
$LG(document.body).css('padding-right', scrollbarWidth + this.bodyPaddingRight + 'px');
|
|
1226
|
+
$LG(document.body).addClass('lg-overlay-open');
|
|
1227
|
+
};
|
|
1228
|
+
LightGallery.prototype.resetScrollBar = function () {
|
|
1229
|
+
if (!this.shouldHideScrollbar()) {
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
$LG(document.body).css('padding-right', this.bodyPaddingRight + 'px');
|
|
1233
|
+
$LG(document.body).removeClass('lg-overlay-open');
|
|
1234
|
+
};
|
|
1202
1235
|
/**
|
|
1203
1236
|
* Open lightGallery.
|
|
1204
1237
|
* Open gallery with specific slide by passing index of the slide as parameter.
|
|
@@ -1234,8 +1267,8 @@ var LightGallery = /** @class */ (function () {
|
|
|
1234
1267
|
if (this.lgOpened)
|
|
1235
1268
|
return;
|
|
1236
1269
|
this.lgOpened = true;
|
|
1237
|
-
this.outer.get().focus();
|
|
1238
1270
|
this.outer.removeClass('lg-hide-items');
|
|
1271
|
+
this.hideScrollbar();
|
|
1239
1272
|
// Add display block, but still has opacity 0
|
|
1240
1273
|
this.$container.addClass('lg-show');
|
|
1241
1274
|
var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, index);
|
|
@@ -1294,6 +1327,12 @@ var LightGallery = /** @class */ (function () {
|
|
|
1294
1327
|
_this.$backdrop.addClass('in');
|
|
1295
1328
|
_this.$container.addClass('lg-show-in');
|
|
1296
1329
|
}, 10);
|
|
1330
|
+
setTimeout(function () {
|
|
1331
|
+
if (_this.settings.trapFocus &&
|
|
1332
|
+
document.body === _this.settings.container) {
|
|
1333
|
+
_this.trapFocus();
|
|
1334
|
+
}
|
|
1335
|
+
}, _this.settings.backdropDuration + 50);
|
|
1297
1336
|
// lg-visible class resets gallery opacity to 1
|
|
1298
1337
|
if (!_this.zoomFromOrigin || !transform) {
|
|
1299
1338
|
setTimeout(function () {
|
|
@@ -2469,6 +2508,36 @@ var LightGallery = /** @class */ (function () {
|
|
|
2469
2508
|
$element.off("click.lgcustom-item-" + $element.attr('data-lg-id'));
|
|
2470
2509
|
}
|
|
2471
2510
|
};
|
|
2511
|
+
LightGallery.prototype.trapFocus = function () {
|
|
2512
|
+
var _this = this;
|
|
2513
|
+
this.$container.get().focus({
|
|
2514
|
+
preventScroll: true,
|
|
2515
|
+
});
|
|
2516
|
+
$LG(window).on("keydown.lg.global" + this.lgId, function (e) {
|
|
2517
|
+
if (!_this.lgOpened) {
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === 9;
|
|
2521
|
+
if (!isTabPressed) {
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2524
|
+
var focusableEls = utils.getFocusableElements(_this.$container.get());
|
|
2525
|
+
var firstFocusableEl = focusableEls[0];
|
|
2526
|
+
var lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
2527
|
+
if (e.shiftKey) {
|
|
2528
|
+
if (document.activeElement === firstFocusableEl) {
|
|
2529
|
+
lastFocusableEl.focus();
|
|
2530
|
+
e.preventDefault();
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
else {
|
|
2534
|
+
if (document.activeElement === lastFocusableEl) {
|
|
2535
|
+
firstFocusableEl.focus();
|
|
2536
|
+
e.preventDefault();
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
});
|
|
2540
|
+
};
|
|
2472
2541
|
LightGallery.prototype.manageCloseGallery = function () {
|
|
2473
2542
|
var _this = this;
|
|
2474
2543
|
if (!this.settings.closable)
|
|
@@ -2519,7 +2588,9 @@ var LightGallery = /** @class */ (function () {
|
|
|
2519
2588
|
return 0;
|
|
2520
2589
|
}
|
|
2521
2590
|
this.LGel.trigger(lGEvents.beforeClose);
|
|
2522
|
-
|
|
2591
|
+
if (this.settings.resetScrollPosition && !this.settings.hideScrollbar) {
|
|
2592
|
+
$LG(window).scrollTop(this.prevScrollTop);
|
|
2593
|
+
}
|
|
2523
2594
|
var currentItem = this.items[this.index];
|
|
2524
2595
|
var transform;
|
|
2525
2596
|
if (this.zoomFromOrigin && currentItem) {
|
|
@@ -2564,6 +2635,8 @@ var LightGallery = /** @class */ (function () {
|
|
|
2564
2635
|
_this.outer.removeClass('lg-zoom-from-image');
|
|
2565
2636
|
}
|
|
2566
2637
|
_this.$container.removeClass('lg-show');
|
|
2638
|
+
// Reset scrollbar
|
|
2639
|
+
_this.resetScrollBar();
|
|
2567
2640
|
// Need to remove inline opacity as it is used in the stylesheet as well
|
|
2568
2641
|
_this.$backdrop
|
|
2569
2642
|
.removeAttr('style')
|
|
@@ -2576,8 +2649,8 @@ var LightGallery = /** @class */ (function () {
|
|
|
2576
2649
|
instance: _this,
|
|
2577
2650
|
});
|
|
2578
2651
|
}
|
|
2579
|
-
if (_this.
|
|
2580
|
-
_this.
|
|
2652
|
+
if (_this.$container.get()) {
|
|
2653
|
+
_this.$container.get().blur();
|
|
2581
2654
|
}
|
|
2582
2655
|
_this.lgOpened = false;
|
|
2583
2656
|
}, removeTimeout + 100);
|