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
|
@@ -5872,6 +5872,8 @@ var lightGalleryCoreSettings = {
|
|
|
5872
5872
|
defaultCaptionHeight: 0,
|
|
5873
5873
|
ariaLabelledby: '',
|
|
5874
5874
|
ariaDescribedby: '',
|
|
5875
|
+
resetScrollPosition: true,
|
|
5876
|
+
hideScrollbar: false,
|
|
5875
5877
|
closable: true,
|
|
5876
5878
|
swipeToClose: true,
|
|
5877
5879
|
closeOnTap: true,
|
|
@@ -5880,6 +5882,7 @@ var lightGalleryCoreSettings = {
|
|
|
5880
5882
|
loop: true,
|
|
5881
5883
|
escKey: true,
|
|
5882
5884
|
keyPress: true,
|
|
5885
|
+
trapFocus: true,
|
|
5883
5886
|
controls: true,
|
|
5884
5887
|
slideEndAnimation: true,
|
|
5885
5888
|
hideControlOnEnd: false,
|
|
@@ -6518,6 +6521,7 @@ function $LG(selector) {
|
|
|
6518
6521
|
|
|
6519
6522
|
|
|
6520
6523
|
|
|
6524
|
+
|
|
6521
6525
|
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
|
|
6522
6526
|
|
|
6523
6527
|
function convertToData(attr) {
|
|
@@ -6697,6 +6701,14 @@ var utils = {
|
|
|
6697
6701
|
|
|
6698
6702
|
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>");
|
|
6699
6703
|
},
|
|
6704
|
+
getFocusableElements: function getFocusableElements(container) {
|
|
6705
|
+
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])');
|
|
6706
|
+
var visibleElements = [].filter.call(elements, function (element) {
|
|
6707
|
+
var style = window.getComputedStyle(element);
|
|
6708
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
6709
|
+
});
|
|
6710
|
+
return visibleElements;
|
|
6711
|
+
},
|
|
6700
6712
|
|
|
6701
6713
|
/**
|
|
6702
6714
|
* @desc Create dynamic elements array from gallery items when dynamic option is false
|
|
@@ -6819,6 +6831,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
6819
6831
|
this.currentItemsInDom = []; // Scroll top value before lightGallery is opened
|
|
6820
6832
|
|
|
6821
6833
|
this.prevScrollTop = 0;
|
|
6834
|
+
this.bodyPaddingRight = 0;
|
|
6822
6835
|
this.isDummyImageRemoved = false;
|
|
6823
6836
|
this.dragOrSwipeEnabled = false;
|
|
6824
6837
|
this.mediaContainerPosition = {
|
|
@@ -7212,6 +7225,34 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7212
7225
|
return this.settings.dynamicEl || [];
|
|
7213
7226
|
}
|
|
7214
7227
|
}
|
|
7228
|
+
}, {
|
|
7229
|
+
key: "shouldHideScrollbar",
|
|
7230
|
+
value: function shouldHideScrollbar() {
|
|
7231
|
+
return this.settings.hideScrollbar && document.body === this.settings.container;
|
|
7232
|
+
}
|
|
7233
|
+
}, {
|
|
7234
|
+
key: "hideScrollbar",
|
|
7235
|
+
value: function hideScrollbar() {
|
|
7236
|
+
if (!this.shouldHideScrollbar()) {
|
|
7237
|
+
return;
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
this.bodyPaddingRight = parseFloat($LG('body').style().paddingRight);
|
|
7241
|
+
var bodyRect = document.documentElement.getBoundingClientRect();
|
|
7242
|
+
var scrollbarWidth = window.innerWidth - bodyRect.width;
|
|
7243
|
+
$LG(document.body).css('padding-right', scrollbarWidth + this.bodyPaddingRight + 'px');
|
|
7244
|
+
$LG(document.body).addClass('lg-overlay-open');
|
|
7245
|
+
}
|
|
7246
|
+
}, {
|
|
7247
|
+
key: "resetScrollBar",
|
|
7248
|
+
value: function resetScrollBar() {
|
|
7249
|
+
if (!this.shouldHideScrollbar()) {
|
|
7250
|
+
return;
|
|
7251
|
+
}
|
|
7252
|
+
|
|
7253
|
+
$LG(document.body).css('padding-right', this.bodyPaddingRight + 'px');
|
|
7254
|
+
$LG(document.body).removeClass('lg-overlay-open');
|
|
7255
|
+
}
|
|
7215
7256
|
/**
|
|
7216
7257
|
* Open lightGallery.
|
|
7217
7258
|
* Open gallery with specific slide by passing index of the slide as parameter.
|
|
@@ -7251,8 +7292,8 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7251
7292
|
// prevent accidental double execution
|
|
7252
7293
|
if (this.lgOpened) return;
|
|
7253
7294
|
this.lgOpened = true;
|
|
7254
|
-
this.outer.
|
|
7255
|
-
this.
|
|
7295
|
+
this.outer.removeClass('lg-hide-items');
|
|
7296
|
+
this.hideScrollbar(); // Add display block, but still has opacity 0
|
|
7256
7297
|
|
|
7257
7298
|
this.$container.addClass('lg-show');
|
|
7258
7299
|
var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, index);
|
|
@@ -7317,7 +7358,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7317
7358
|
_this5.$backdrop.addClass('in');
|
|
7318
7359
|
|
|
7319
7360
|
_this5.$container.addClass('lg-show-in');
|
|
7320
|
-
}, 10);
|
|
7361
|
+
}, 10);
|
|
7362
|
+
setTimeout(function () {
|
|
7363
|
+
if (_this5.settings.trapFocus && document.body === _this5.settings.container) {
|
|
7364
|
+
_this5.trapFocus();
|
|
7365
|
+
}
|
|
7366
|
+
}, _this5.settings.backdropDuration + 50); // lg-visible class resets gallery opacity to 1
|
|
7321
7367
|
|
|
7322
7368
|
if (!_this5.zoomFromOrigin || !transform) {
|
|
7323
7369
|
setTimeout(function () {
|
|
@@ -7761,7 +7807,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
7761
7807
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
7762
7808
|
setTimeout(function () {
|
|
7763
7809
|
if (_this10.getSlideType(currentGalleryItem) === 'image') {
|
|
7764
|
-
|
|
7810
|
+
var alt = currentGalleryItem.alt;
|
|
7811
|
+
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
7812
|
+
$currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, altAttr, srcset, sizes, currentGalleryItem.sources));
|
|
7765
7813
|
|
|
7766
7814
|
if (srcset || sources) {
|
|
7767
7815
|
var _$img = $currentSlide.find('.lg-object');
|
|
@@ -8645,15 +8693,51 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8645
8693
|
$element.off("click.lgcustom-item-".concat($element.attr('data-lg-id')));
|
|
8646
8694
|
}
|
|
8647
8695
|
}
|
|
8696
|
+
}, {
|
|
8697
|
+
key: "trapFocus",
|
|
8698
|
+
value: function trapFocus() {
|
|
8699
|
+
var _this26 = this;
|
|
8700
|
+
|
|
8701
|
+
this.$container.get().focus({
|
|
8702
|
+
preventScroll: true
|
|
8703
|
+
});
|
|
8704
|
+
$LG(window).on("keydown.lg.global".concat(this.lgId), function (e) {
|
|
8705
|
+
if (!_this26.lgOpened) {
|
|
8706
|
+
return;
|
|
8707
|
+
}
|
|
8708
|
+
|
|
8709
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === 9;
|
|
8710
|
+
|
|
8711
|
+
if (!isTabPressed) {
|
|
8712
|
+
return;
|
|
8713
|
+
}
|
|
8714
|
+
|
|
8715
|
+
var focusableEls = lg_utils.getFocusableElements(_this26.$container.get());
|
|
8716
|
+
var firstFocusableEl = focusableEls[0];
|
|
8717
|
+
var lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
8718
|
+
|
|
8719
|
+
if (e.shiftKey) {
|
|
8720
|
+
if (document.activeElement === firstFocusableEl) {
|
|
8721
|
+
lastFocusableEl.focus();
|
|
8722
|
+
e.preventDefault();
|
|
8723
|
+
}
|
|
8724
|
+
} else {
|
|
8725
|
+
if (document.activeElement === lastFocusableEl) {
|
|
8726
|
+
firstFocusableEl.focus();
|
|
8727
|
+
e.preventDefault();
|
|
8728
|
+
}
|
|
8729
|
+
}
|
|
8730
|
+
});
|
|
8731
|
+
}
|
|
8648
8732
|
}, {
|
|
8649
8733
|
key: "manageCloseGallery",
|
|
8650
8734
|
value: function manageCloseGallery() {
|
|
8651
|
-
var
|
|
8735
|
+
var _this27 = this;
|
|
8652
8736
|
|
|
8653
8737
|
if (!this.settings.closable) return;
|
|
8654
8738
|
var mousedown = false;
|
|
8655
8739
|
this.getElementById('lg-close').on('click.lg', function () {
|
|
8656
|
-
|
|
8740
|
+
_this27.closeGallery();
|
|
8657
8741
|
});
|
|
8658
8742
|
|
|
8659
8743
|
if (this.settings.closeOnTap) {
|
|
@@ -8662,7 +8746,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8662
8746
|
this.outer.on('mousedown.lg', function (e) {
|
|
8663
8747
|
var target = $LG(e.target);
|
|
8664
8748
|
|
|
8665
|
-
if (
|
|
8749
|
+
if (_this27.isSlideElement(target)) {
|
|
8666
8750
|
mousedown = true;
|
|
8667
8751
|
} else {
|
|
8668
8752
|
mousedown = false;
|
|
@@ -8674,9 +8758,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8674
8758
|
this.outer.on('mouseup.lg', function (e) {
|
|
8675
8759
|
var target = $LG(e.target);
|
|
8676
8760
|
|
|
8677
|
-
if (
|
|
8678
|
-
if (!
|
|
8679
|
-
|
|
8761
|
+
if (_this27.isSlideElement(target) && mousedown) {
|
|
8762
|
+
if (!_this27.outer.hasClass('lg-dragging')) {
|
|
8763
|
+
_this27.closeGallery();
|
|
8680
8764
|
}
|
|
8681
8765
|
}
|
|
8682
8766
|
});
|
|
@@ -8697,14 +8781,18 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8697
8781
|
}, {
|
|
8698
8782
|
key: "closeGallery",
|
|
8699
8783
|
value: function closeGallery(force) {
|
|
8700
|
-
var
|
|
8784
|
+
var _this28 = this;
|
|
8701
8785
|
|
|
8702
8786
|
if (!this.lgOpened || !this.settings.closable && !force) {
|
|
8703
8787
|
return 0;
|
|
8704
8788
|
}
|
|
8705
8789
|
|
|
8706
8790
|
this.LGel.trigger(lGEvents.beforeClose);
|
|
8707
|
-
|
|
8791
|
+
|
|
8792
|
+
if (this.settings.resetScrollPosition && !this.settings.hideScrollbar) {
|
|
8793
|
+
$LG(window).scrollTop(this.prevScrollTop);
|
|
8794
|
+
}
|
|
8795
|
+
|
|
8708
8796
|
var currentItem = this.items[this.index];
|
|
8709
8797
|
var transform;
|
|
8710
8798
|
|
|
@@ -8746,32 +8834,35 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8746
8834
|
this.$container.removeClass('lg-show-in'); // Once the closign animation is completed and gallery is invisible
|
|
8747
8835
|
|
|
8748
8836
|
setTimeout(function () {
|
|
8749
|
-
if (
|
|
8750
|
-
|
|
8837
|
+
if (_this28.zoomFromOrigin && transform) {
|
|
8838
|
+
_this28.outer.removeClass('lg-zoom-from-image');
|
|
8751
8839
|
}
|
|
8752
8840
|
|
|
8753
|
-
|
|
8841
|
+
_this28.$container.removeClass('lg-show'); // Reset scrollbar
|
|
8754
8842
|
|
|
8755
8843
|
|
|
8756
|
-
|
|
8844
|
+
_this28.resetScrollBar(); // Need to remove inline opacity as it is used in the stylesheet as well
|
|
8757
8845
|
|
|
8758
|
-
_this27.outer.removeClass("lg-closing ".concat(_this27.settings.startClass));
|
|
8759
8846
|
|
|
8760
|
-
|
|
8847
|
+
_this28.$backdrop.removeAttr('style').css('transition-duration', _this28.settings.backdropDuration + 'ms');
|
|
8761
8848
|
|
|
8762
|
-
|
|
8849
|
+
_this28.outer.removeClass("lg-closing ".concat(_this28.settings.startClass));
|
|
8763
8850
|
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8851
|
+
_this28.getSlideItem(_this28.index).removeClass('lg-start-end-progress');
|
|
8852
|
+
|
|
8853
|
+
_this28.$inner.empty();
|
|
8854
|
+
|
|
8855
|
+
if (_this28.lgOpened) {
|
|
8856
|
+
_this28.LGel.trigger(lGEvents.afterClose, {
|
|
8857
|
+
instance: _this28
|
|
8767
8858
|
});
|
|
8768
8859
|
}
|
|
8769
8860
|
|
|
8770
|
-
if (
|
|
8771
|
-
|
|
8861
|
+
if (_this28.$container.get()) {
|
|
8862
|
+
_this28.$container.get().blur();
|
|
8772
8863
|
}
|
|
8773
8864
|
|
|
8774
|
-
|
|
8865
|
+
_this28.lgOpened = false;
|
|
8775
8866
|
}, removeTimeout + 100);
|
|
8776
8867
|
return removeTimeout + 100;
|
|
8777
8868
|
}
|
|
@@ -8857,21 +8948,21 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
|
|
|
8857
8948
|
}, {
|
|
8858
8949
|
key: "destroy",
|
|
8859
8950
|
value: function destroy() {
|
|
8860
|
-
var
|
|
8951
|
+
var _this29 = this;
|
|
8861
8952
|
|
|
8862
8953
|
var closeTimeout = this.closeGallery(true);
|
|
8863
8954
|
setTimeout(function () {
|
|
8864
|
-
|
|
8955
|
+
_this29.destroyModules(true);
|
|
8865
8956
|
|
|
8866
|
-
if (!
|
|
8867
|
-
|
|
8957
|
+
if (!_this29.settings.dynamic) {
|
|
8958
|
+
_this29.invalidateItems();
|
|
8868
8959
|
}
|
|
8869
8960
|
|
|
8870
|
-
$LG(window).off(".lg.global".concat(
|
|
8961
|
+
$LG(window).off(".lg.global".concat(_this29.lgId));
|
|
8871
8962
|
|
|
8872
|
-
|
|
8963
|
+
_this29.LGel.off('.lg');
|
|
8873
8964
|
|
|
8874
|
-
|
|
8965
|
+
_this29.$container.remove();
|
|
8875
8966
|
}, closeTimeout);
|
|
8876
8967
|
return closeTimeout;
|
|
8877
8968
|
}
|