lightgallery 2.5.0-beta.2 → 2.5.0-beta.5
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 +3 -3
- 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 +69 -5
- package/lib/lightgallery.js.map +1 -1
- package/lightgallery.d.ts +5 -0
- package/lightgallery.es5.js +81 -6
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +81 -6
- 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.es5.js +1 -1
- package/plugins/video/lg-video.min.js +1 -1
- package/plugins/video/lg-video.umd.js +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 +81 -6
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +81 -6
- 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 +123 -32
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +123 -32
- 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
|
@@ -241,3 +241,19 @@ body:not(.lg-from-hash) {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
+
|
|
245
|
+
.lg-icon {
|
|
246
|
+
&:focus-visible {
|
|
247
|
+
color: #fff;
|
|
248
|
+
border-radius: 3px;
|
|
249
|
+
outline: 1px dashed rgba(255, 255, 255, 0.6);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
.lg-toolbar {
|
|
253
|
+
.lg-icon {
|
|
254
|
+
&:focus-visible {
|
|
255
|
+
border-radius: 8px;
|
|
256
|
+
outline-offset: -5px;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
@@ -5863,6 +5863,8 @@ var lightGalleryCoreSettings = {
|
|
|
5863
5863
|
defaultCaptionHeight: 0,
|
|
5864
5864
|
ariaLabelledby: '',
|
|
5865
5865
|
ariaDescribedby: '',
|
|
5866
|
+
resetScrollPosition: true,
|
|
5867
|
+
hideScrollbar: false,
|
|
5866
5868
|
closable: true,
|
|
5867
5869
|
swipeToClose: true,
|
|
5868
5870
|
closeOnTap: true,
|
|
@@ -5871,6 +5873,7 @@ var lightGalleryCoreSettings = {
|
|
|
5871
5873
|
loop: true,
|
|
5872
5874
|
escKey: true,
|
|
5873
5875
|
keyPress: true,
|
|
5876
|
+
trapFocus: true,
|
|
5874
5877
|
controls: true,
|
|
5875
5878
|
slideEndAnimation: true,
|
|
5876
5879
|
hideControlOnEnd: false,
|
|
@@ -6509,6 +6512,7 @@ function $LG(selector) {
|
|
|
6509
6512
|
|
|
6510
6513
|
|
|
6511
6514
|
|
|
6515
|
+
|
|
6512
6516
|
var defaultDynamicOptions = ['src', 'sources', 'subHtml', 'subHtmlUrl', 'html', 'video', 'poster', 'slideName', 'responsive', 'srcset', 'sizes', 'iframe', 'downloadUrl', 'download', 'width', 'facebookShareUrl', 'tweetText', 'iframeTitle', 'twitterShareUrl', 'pinterestShareUrl', 'pinterestText', 'fbHtml', 'disqusIdentifier', 'disqusUrl']; // Convert html data-attribute to camalcase
|
|
6513
6517
|
|
|
6514
6518
|
function convertToData(attr) {
|
|
@@ -6688,6 +6692,14 @@ var utils = {
|
|
|
6688
6692
|
|
|
6689
6693
|
return "<div class=\"lg-video-cont ".concat(videoClass, "\" style=\"").concat(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=\"").concat(playVideoString, "\"\n role=\"img\"\n class=\"lg-video-play-icon\"\n >\n <title>").concat(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 ").concat(dummyImg || '', "\n <img class=\"lg-object lg-video-poster\" src=\"").concat(_poster, "\" />\n </div>");
|
|
6690
6694
|
},
|
|
6695
|
+
getFocusableElements: function getFocusableElements(container) {
|
|
6696
|
+
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])');
|
|
6697
|
+
var visibleElements = [].filter.call(elements, function (element) {
|
|
6698
|
+
var style = window.getComputedStyle(element);
|
|
6699
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
6700
|
+
});
|
|
6701
|
+
return visibleElements;
|
|
6702
|
+
},
|
|
6691
6703
|
|
|
6692
6704
|
/**
|
|
6693
6705
|
* @desc Create dynamic elements array from gallery items when dynamic option is false
|
|
@@ -6810,6 +6822,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
6810
6822
|
this.currentItemsInDom = []; // Scroll top value before lightGallery is opened
|
|
6811
6823
|
|
|
6812
6824
|
this.prevScrollTop = 0;
|
|
6825
|
+
this.bodyPaddingRight = 0;
|
|
6813
6826
|
this.isDummyImageRemoved = false;
|
|
6814
6827
|
this.dragOrSwipeEnabled = false;
|
|
6815
6828
|
this.mediaContainerPosition = {
|
|
@@ -7203,6 +7216,34 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7203
7216
|
return this.settings.dynamicEl || [];
|
|
7204
7217
|
}
|
|
7205
7218
|
}
|
|
7219
|
+
}, {
|
|
7220
|
+
key: "shouldHideScrollbar",
|
|
7221
|
+
value: function shouldHideScrollbar() {
|
|
7222
|
+
return this.settings.hideScrollbar && document.body === this.settings.container;
|
|
7223
|
+
}
|
|
7224
|
+
}, {
|
|
7225
|
+
key: "hideScrollbar",
|
|
7226
|
+
value: function hideScrollbar() {
|
|
7227
|
+
if (!this.shouldHideScrollbar()) {
|
|
7228
|
+
return;
|
|
7229
|
+
}
|
|
7230
|
+
|
|
7231
|
+
this.bodyPaddingRight = parseFloat($LG('body').style().paddingRight);
|
|
7232
|
+
var bodyRect = document.documentElement.getBoundingClientRect();
|
|
7233
|
+
var scrollbarWidth = window.innerWidth - bodyRect.width;
|
|
7234
|
+
$LG(document.body).css('padding-right', scrollbarWidth + this.bodyPaddingRight + 'px');
|
|
7235
|
+
$LG(document.body).addClass('lg-overlay-open');
|
|
7236
|
+
}
|
|
7237
|
+
}, {
|
|
7238
|
+
key: "resetScrollBar",
|
|
7239
|
+
value: function resetScrollBar() {
|
|
7240
|
+
if (!this.shouldHideScrollbar()) {
|
|
7241
|
+
return;
|
|
7242
|
+
}
|
|
7243
|
+
|
|
7244
|
+
$LG(document.body).css('padding-right', this.bodyPaddingRight + 'px');
|
|
7245
|
+
$LG(document.body).removeClass('lg-overlay-open');
|
|
7246
|
+
}
|
|
7206
7247
|
/**
|
|
7207
7248
|
* Open lightGallery.
|
|
7208
7249
|
* Open gallery with specific slide by passing index of the slide as parameter.
|
|
@@ -7242,8 +7283,8 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7242
7283
|
// prevent accidental double execution
|
|
7243
7284
|
if (this.lgOpened) return;
|
|
7244
7285
|
this.lgOpened = true;
|
|
7245
|
-
this.outer.
|
|
7246
|
-
this.
|
|
7286
|
+
this.outer.removeClass('lg-hide-items');
|
|
7287
|
+
this.hideScrollbar(); // Add display block, but still has opacity 0
|
|
7247
7288
|
|
|
7248
7289
|
this.$container.addClass('lg-show');
|
|
7249
7290
|
var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, index);
|
|
@@ -7308,7 +7349,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7308
7349
|
_this5.$backdrop.addClass('in');
|
|
7309
7350
|
|
|
7310
7351
|
_this5.$container.addClass('lg-show-in');
|
|
7311
|
-
}, 10);
|
|
7352
|
+
}, 10);
|
|
7353
|
+
setTimeout(function () {
|
|
7354
|
+
if (_this5.settings.trapFocus && document.body === _this5.settings.container) {
|
|
7355
|
+
_this5.trapFocus();
|
|
7356
|
+
}
|
|
7357
|
+
}, _this5.settings.backdropDuration + 50); // lg-visible class resets gallery opacity to 1
|
|
7312
7358
|
|
|
7313
7359
|
if (!_this5.zoomFromOrigin || !transform) {
|
|
7314
7360
|
setTimeout(function () {
|
|
@@ -7752,7 +7798,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7752
7798
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
7753
7799
|
setTimeout(function () {
|
|
7754
7800
|
if (_this10.getSlideType(currentGalleryItem) === 'image') {
|
|
7755
|
-
|
|
7801
|
+
var alt = currentGalleryItem.alt;
|
|
7802
|
+
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
7803
|
+
$currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, altAttr, srcset, sizes, currentGalleryItem.sources));
|
|
7756
7804
|
|
|
7757
7805
|
if (srcset || sources) {
|
|
7758
7806
|
var _$img = $currentSlide.find('.lg-object');
|
|
@@ -8636,15 +8684,51 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8636
8684
|
$element.off("click.lgcustom-item-".concat($element.attr('data-lg-id')));
|
|
8637
8685
|
}
|
|
8638
8686
|
}
|
|
8687
|
+
}, {
|
|
8688
|
+
key: "trapFocus",
|
|
8689
|
+
value: function trapFocus() {
|
|
8690
|
+
var _this26 = this;
|
|
8691
|
+
|
|
8692
|
+
this.$container.get().focus({
|
|
8693
|
+
preventScroll: true
|
|
8694
|
+
});
|
|
8695
|
+
$LG(window).on("keydown.lg.global".concat(this.lgId), function (e) {
|
|
8696
|
+
if (!_this26.lgOpened) {
|
|
8697
|
+
return;
|
|
8698
|
+
}
|
|
8699
|
+
|
|
8700
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === 9;
|
|
8701
|
+
|
|
8702
|
+
if (!isTabPressed) {
|
|
8703
|
+
return;
|
|
8704
|
+
}
|
|
8705
|
+
|
|
8706
|
+
var focusableEls = lg_utils.getFocusableElements(_this26.$container.get());
|
|
8707
|
+
var firstFocusableEl = focusableEls[0];
|
|
8708
|
+
var lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
8709
|
+
|
|
8710
|
+
if (e.shiftKey) {
|
|
8711
|
+
if (document.activeElement === firstFocusableEl) {
|
|
8712
|
+
lastFocusableEl.focus();
|
|
8713
|
+
e.preventDefault();
|
|
8714
|
+
}
|
|
8715
|
+
} else {
|
|
8716
|
+
if (document.activeElement === lastFocusableEl) {
|
|
8717
|
+
firstFocusableEl.focus();
|
|
8718
|
+
e.preventDefault();
|
|
8719
|
+
}
|
|
8720
|
+
}
|
|
8721
|
+
});
|
|
8722
|
+
}
|
|
8639
8723
|
}, {
|
|
8640
8724
|
key: "manageCloseGallery",
|
|
8641
8725
|
value: function manageCloseGallery() {
|
|
8642
|
-
var
|
|
8726
|
+
var _this27 = this;
|
|
8643
8727
|
|
|
8644
8728
|
if (!this.settings.closable) return;
|
|
8645
8729
|
var mousedown = false;
|
|
8646
8730
|
this.getElementById('lg-close').on('click.lg', function () {
|
|
8647
|
-
|
|
8731
|
+
_this27.closeGallery();
|
|
8648
8732
|
});
|
|
8649
8733
|
|
|
8650
8734
|
if (this.settings.closeOnTap) {
|
|
@@ -8653,7 +8737,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8653
8737
|
this.outer.on('mousedown.lg', function (e) {
|
|
8654
8738
|
var target = $LG(e.target);
|
|
8655
8739
|
|
|
8656
|
-
if (
|
|
8740
|
+
if (_this27.isSlideElement(target)) {
|
|
8657
8741
|
mousedown = true;
|
|
8658
8742
|
} else {
|
|
8659
8743
|
mousedown = false;
|
|
@@ -8665,9 +8749,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8665
8749
|
this.outer.on('mouseup.lg', function (e) {
|
|
8666
8750
|
var target = $LG(e.target);
|
|
8667
8751
|
|
|
8668
|
-
if (
|
|
8669
|
-
if (!
|
|
8670
|
-
|
|
8752
|
+
if (_this27.isSlideElement(target) && mousedown) {
|
|
8753
|
+
if (!_this27.outer.hasClass('lg-dragging')) {
|
|
8754
|
+
_this27.closeGallery();
|
|
8671
8755
|
}
|
|
8672
8756
|
}
|
|
8673
8757
|
});
|
|
@@ -8688,14 +8772,18 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8688
8772
|
}, {
|
|
8689
8773
|
key: "closeGallery",
|
|
8690
8774
|
value: function closeGallery(force) {
|
|
8691
|
-
var
|
|
8775
|
+
var _this28 = this;
|
|
8692
8776
|
|
|
8693
8777
|
if (!this.lgOpened || !this.settings.closable && !force) {
|
|
8694
8778
|
return 0;
|
|
8695
8779
|
}
|
|
8696
8780
|
|
|
8697
8781
|
this.LGel.trigger(lGEvents.beforeClose);
|
|
8698
|
-
|
|
8782
|
+
|
|
8783
|
+
if (this.settings.resetScrollPosition && !this.settings.hideScrollbar) {
|
|
8784
|
+
$LG(window).scrollTop(this.prevScrollTop);
|
|
8785
|
+
}
|
|
8786
|
+
|
|
8699
8787
|
var currentItem = this.items[this.index];
|
|
8700
8788
|
var transform;
|
|
8701
8789
|
|
|
@@ -8737,32 +8825,35 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8737
8825
|
this.$container.removeClass('lg-show-in'); // Once the closign animation is completed and gallery is invisible
|
|
8738
8826
|
|
|
8739
8827
|
setTimeout(function () {
|
|
8740
|
-
if (
|
|
8741
|
-
|
|
8828
|
+
if (_this28.zoomFromOrigin && transform) {
|
|
8829
|
+
_this28.outer.removeClass('lg-zoom-from-image');
|
|
8742
8830
|
}
|
|
8743
8831
|
|
|
8744
|
-
|
|
8832
|
+
_this28.$container.removeClass('lg-show'); // Reset scrollbar
|
|
8745
8833
|
|
|
8746
8834
|
|
|
8747
|
-
|
|
8835
|
+
_this28.resetScrollBar(); // Need to remove inline opacity as it is used in the stylesheet as well
|
|
8748
8836
|
|
|
8749
|
-
_this27.outer.removeClass("lg-closing ".concat(_this27.settings.startClass));
|
|
8750
8837
|
|
|
8751
|
-
|
|
8838
|
+
_this28.$backdrop.removeAttr('style').css('transition-duration', _this28.settings.backdropDuration + 'ms');
|
|
8752
8839
|
|
|
8753
|
-
|
|
8840
|
+
_this28.outer.removeClass("lg-closing ".concat(_this28.settings.startClass));
|
|
8754
8841
|
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8842
|
+
_this28.getSlideItem(_this28.index).removeClass('lg-start-end-progress');
|
|
8843
|
+
|
|
8844
|
+
_this28.$inner.empty();
|
|
8845
|
+
|
|
8846
|
+
if (_this28.lgOpened) {
|
|
8847
|
+
_this28.LGel.trigger(lGEvents.afterClose, {
|
|
8848
|
+
instance: _this28
|
|
8758
8849
|
});
|
|
8759
8850
|
}
|
|
8760
8851
|
|
|
8761
|
-
if (
|
|
8762
|
-
|
|
8852
|
+
if (_this28.$container.get()) {
|
|
8853
|
+
_this28.$container.get().blur();
|
|
8763
8854
|
}
|
|
8764
8855
|
|
|
8765
|
-
|
|
8856
|
+
_this28.lgOpened = false;
|
|
8766
8857
|
}, removeTimeout + 100);
|
|
8767
8858
|
return removeTimeout + 100;
|
|
8768
8859
|
}
|
|
@@ -8848,21 +8939,21 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8848
8939
|
}, {
|
|
8849
8940
|
key: "destroy",
|
|
8850
8941
|
value: function destroy() {
|
|
8851
|
-
var
|
|
8942
|
+
var _this29 = this;
|
|
8852
8943
|
|
|
8853
8944
|
var closeTimeout = this.closeGallery(true);
|
|
8854
8945
|
setTimeout(function () {
|
|
8855
|
-
|
|
8946
|
+
_this29.destroyModules(true);
|
|
8856
8947
|
|
|
8857
|
-
if (!
|
|
8858
|
-
|
|
8948
|
+
if (!_this29.settings.dynamic) {
|
|
8949
|
+
_this29.invalidateItems();
|
|
8859
8950
|
}
|
|
8860
8951
|
|
|
8861
|
-
$LG(window).off(".lg.global".concat(
|
|
8952
|
+
$LG(window).off(".lg.global".concat(_this29.lgId));
|
|
8862
8953
|
|
|
8863
|
-
|
|
8954
|
+
_this29.LGel.off('.lg');
|
|
8864
8955
|
|
|
8865
|
-
|
|
8956
|
+
_this29.$container.remove();
|
|
8866
8957
|
}, closeTimeout);
|
|
8867
8958
|
return closeTimeout;
|
|
8868
8959
|
}
|