lightgallery 2.3.0-beta.3 → 2.4.0

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.
Files changed (172) hide show
  1. package/README.md +4 -0
  2. package/angular/10/bundles/lightgallery-angular-10.umd.js +34 -1
  3. package/angular/10/bundles/lightgallery-angular-10.umd.js.map +1 -1
  4. package/angular/10/bundles/lightgallery-angular-10.umd.min.js +1 -1
  5. package/angular/10/bundles/lightgallery-angular-10.umd.min.js.map +1 -1
  6. package/angular/10/esm2015/lib/lightgallery-angular.component.js +35 -2
  7. package/angular/10/fesm2015/lightgallery-angular-10.js +34 -1
  8. package/angular/10/fesm2015/lightgallery-angular-10.js.map +1 -1
  9. package/angular/10/lib/lightgallery-angular.component.d.ts +6 -2
  10. package/angular/10/lib/lightgallery-angular.component.d.ts.map +1 -1
  11. package/angular/11/bundles/lightgallery-angular-11.umd.js +34 -1
  12. package/angular/11/bundles/lightgallery-angular-11.umd.js.map +1 -1
  13. package/angular/11/bundles/lightgallery-angular-11.umd.min.js +1 -1
  14. package/angular/11/bundles/lightgallery-angular-11.umd.min.js.map +1 -1
  15. package/angular/11/esm2015/lib/lightgallery-angular.component.js +35 -2
  16. package/angular/11/fesm2015/lightgallery-angular-11.js +34 -1
  17. package/angular/11/fesm2015/lightgallery-angular-11.js.map +1 -1
  18. package/angular/11/lib/lightgallery-angular.component.d.ts +6 -2
  19. package/angular/11/lib/lightgallery-angular.component.d.ts.map +1 -1
  20. package/angular/9/bundles/lightgallery-angular-9.umd.js +34 -1
  21. package/angular/9/bundles/lightgallery-angular-9.umd.js.map +1 -1
  22. package/angular/9/bundles/lightgallery-angular-9.umd.min.js +1 -1
  23. package/angular/9/bundles/lightgallery-angular-9.umd.min.js.map +1 -1
  24. package/angular/9/esm2015/lib/lightgallery-angular.component.js +35 -2
  25. package/angular/9/esm5/lib/lightgallery-angular.component.js +35 -2
  26. package/angular/9/fesm2015/lightgallery-angular-9.js +34 -1
  27. package/angular/9/fesm2015/lightgallery-angular-9.js.map +1 -1
  28. package/angular/9/fesm5/lightgallery-angular-9.js +34 -1
  29. package/angular/9/fesm5/lightgallery-angular-9.js.map +1 -1
  30. package/angular/9/lib/lightgallery-angular.component.d.ts +6 -2
  31. package/angular/bundles/lightgallery-angular.umd.js +34 -1
  32. package/angular/bundles/lightgallery-angular.umd.js.map +1 -1
  33. package/angular/esm2015/lib/lightgallery-angular.component.js +35 -2
  34. package/angular/fesm2015/lightgallery-angular.js +34 -1
  35. package/angular/fesm2015/lightgallery-angular.js.map +1 -1
  36. package/angular/lib/lightgallery-angular.component.d.ts +6 -2
  37. package/angular/lib/lightgallery-angular.component.d.ts.map +1 -1
  38. package/css/lightgallery-bundle.css +0 -1
  39. package/css/lightgallery-bundle.min.css +1 -1
  40. package/css/lightgallery-core.css +0 -1
  41. package/css/lightgallery.css +0 -1
  42. package/lg-events.d.ts +44 -0
  43. package/lg-settings.d.ts +30 -2
  44. package/lg-utils.d.ts +16 -4
  45. package/lib/lg-events.js +3 -0
  46. package/lib/lg-events.js.map +1 -1
  47. package/lib/lg-settings.js +12 -1
  48. package/lib/lg-settings.js.map +1 -1
  49. package/lib/lg-utils.js +4 -4
  50. package/lib/lg-utils.js.map +1 -1
  51. package/lib/lgQuery.js +29 -20
  52. package/lib/lgQuery.js.map +1 -1
  53. package/lib/lightgallery.js +30 -16
  54. package/lib/lightgallery.js.map +1 -1
  55. package/lib/plugins/autoplay/lg-autoplay-settings.js +3 -0
  56. package/lib/plugins/autoplay/lg-autoplay-settings.js.map +1 -1
  57. package/lib/plugins/autoplay/lg-autoplay.js +20 -11
  58. package/lib/plugins/autoplay/lg-autoplay.js.map +1 -1
  59. package/lib/plugins/comment/lg-comment-settings.js +3 -0
  60. package/lib/plugins/comment/lg-comment-settings.js.map +1 -1
  61. package/lib/plugins/comment/lg-comment.js +1 -1
  62. package/lib/plugins/comment/lg-comment.js.map +1 -1
  63. package/lib/plugins/fullscreen/lg-fullscreen-settings.js +3 -0
  64. package/lib/plugins/fullscreen/lg-fullscreen-settings.js.map +1 -1
  65. package/lib/plugins/fullscreen/lg-fullscreen.js +1 -2
  66. package/lib/plugins/fullscreen/lg-fullscreen.js.map +1 -1
  67. package/lib/plugins/rotate/lg-rotate-settings.js +6 -0
  68. package/lib/plugins/rotate/lg-rotate-settings.js.map +1 -1
  69. package/lib/plugins/rotate/lg-rotate.js +4 -8
  70. package/lib/plugins/rotate/lg-rotate.js.map +1 -1
  71. package/lib/plugins/share/lg-share-settings.js +1 -0
  72. package/lib/plugins/share/lg-share-settings.js.map +1 -1
  73. package/lib/plugins/share/lg-share.js +1 -1
  74. package/lib/plugins/share/lg-share.js.map +1 -1
  75. package/lib/plugins/thumbnail/lg-thumbnail-settings.js +3 -0
  76. package/lib/plugins/thumbnail/lg-thumbnail-settings.js.map +1 -1
  77. package/lib/plugins/thumbnail/lg-thumbnail.js +3 -1
  78. package/lib/plugins/thumbnail/lg-thumbnail.js.map +1 -1
  79. package/lib/plugins/zoom/lg-zoom-settings.js +5 -0
  80. package/lib/plugins/zoom/lg-zoom-settings.js.map +1 -1
  81. package/lib/plugins/zoom/lg-zoom.js +2 -2
  82. package/lib/plugins/zoom/lg-zoom.js.map +1 -1
  83. package/lightgallery.d.ts +1 -1
  84. package/lightgallery.es5.js +172 -135
  85. package/lightgallery.es5.js.map +1 -1
  86. package/lightgallery.min.js +2 -2
  87. package/lightgallery.umd.js +172 -135
  88. package/lightgallery.umd.js.map +1 -1
  89. package/lit/lightgallery.esm.js +7 -7
  90. package/lit/lightgallery.umd.js +3 -3
  91. package/package.json +1 -1
  92. package/plugins/autoplay/lg-autoplay-settings.d.ts +7 -0
  93. package/plugins/autoplay/lg-autoplay.d.ts +2 -2
  94. package/plugins/autoplay/lg-autoplay.es5.js +27 -12
  95. package/plugins/autoplay/lg-autoplay.es5.js.map +1 -1
  96. package/plugins/autoplay/lg-autoplay.min.js +2 -2
  97. package/plugins/autoplay/lg-autoplay.umd.js +27 -12
  98. package/plugins/autoplay/lg-autoplay.umd.js.map +1 -1
  99. package/plugins/comment/lg-comment-settings.d.ts +7 -0
  100. package/plugins/comment/lg-comment.es5.js +8 -2
  101. package/plugins/comment/lg-comment.es5.js.map +1 -1
  102. package/plugins/comment/lg-comment.min.js +2 -2
  103. package/plugins/comment/lg-comment.umd.js +8 -2
  104. package/plugins/comment/lg-comment.umd.js.map +1 -1
  105. package/plugins/fullscreen/lg-fullscreen-settings.d.ts +7 -0
  106. package/plugins/fullscreen/lg-fullscreen.es5.js +5 -3
  107. package/plugins/fullscreen/lg-fullscreen.es5.js.map +1 -1
  108. package/plugins/fullscreen/lg-fullscreen.min.js +2 -2
  109. package/plugins/fullscreen/lg-fullscreen.umd.js +5 -3
  110. package/plugins/fullscreen/lg-fullscreen.umd.js.map +1 -1
  111. package/plugins/hash/lg-hash.es5.js +4 -1
  112. package/plugins/hash/lg-hash.es5.js.map +1 -1
  113. package/plugins/hash/lg-hash.min.js +1 -1
  114. package/plugins/hash/lg-hash.umd.js +4 -1
  115. package/plugins/hash/lg-hash.umd.js.map +1 -1
  116. package/plugins/mediumZoom/lg-medium-zoom.es5.js +4 -1
  117. package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -1
  118. package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
  119. package/plugins/mediumZoom/lg-medium-zoom.umd.js +4 -1
  120. package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -1
  121. package/plugins/pager/lg-pager.es5.js +4 -1
  122. package/plugins/pager/lg-pager.es5.js.map +1 -1
  123. package/plugins/pager/lg-pager.min.js +1 -1
  124. package/plugins/pager/lg-pager.umd.js +4 -1
  125. package/plugins/pager/lg-pager.umd.js.map +1 -1
  126. package/plugins/relativeCaption/lg-relative-caption.es5.js +4 -1
  127. package/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -1
  128. package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
  129. package/plugins/relativeCaption/lg-relative-caption.umd.js +4 -1
  130. package/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -1
  131. package/plugins/rotate/lg-rotate-settings.d.ts +11 -0
  132. package/plugins/rotate/lg-rotate.es5.js +14 -9
  133. package/plugins/rotate/lg-rotate.es5.js.map +1 -1
  134. package/plugins/rotate/lg-rotate.min.js +2 -2
  135. package/plugins/rotate/lg-rotate.umd.js +14 -9
  136. package/plugins/rotate/lg-rotate.umd.js.map +1 -1
  137. package/plugins/share/lg-share-settings.d.ts +8 -0
  138. package/plugins/share/lg-share.es5.js +6 -2
  139. package/plugins/share/lg-share.es5.js.map +1 -1
  140. package/plugins/share/lg-share.min.js +2 -2
  141. package/plugins/share/lg-share.umd.js +6 -2
  142. package/plugins/share/lg-share.umd.js.map +1 -1
  143. package/plugins/thumbnail/lg-thumbnail-settings.d.ts +8 -0
  144. package/plugins/thumbnail/lg-thumbnail.es5.js +10 -2
  145. package/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -1
  146. package/plugins/thumbnail/lg-thumbnail.min.js +2 -2
  147. package/plugins/thumbnail/lg-thumbnail.umd.js +10 -2
  148. package/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -1
  149. package/plugins/video/lg-video.es5.js +4 -1
  150. package/plugins/video/lg-video.es5.js.map +1 -1
  151. package/plugins/video/lg-video.min.js +1 -1
  152. package/plugins/video/lg-video.umd.js +4 -1
  153. package/plugins/video/lg-video.umd.js.map +1 -1
  154. package/plugins/zoom/lg-zoom-settings.d.ts +9 -0
  155. package/plugins/zoom/lg-zoom.es5.js +11 -3
  156. package/plugins/zoom/lg-zoom.es5.js.map +1 -1
  157. package/plugins/zoom/lg-zoom.min.js +2 -2
  158. package/plugins/zoom/lg-zoom.umd.js +11 -3
  159. package/plugins/zoom/lg-zoom.umd.js.map +1 -1
  160. package/react/Lightgallery.d.ts +5 -1
  161. package/react/Lightgallery.es5.js +201 -136
  162. package/react/Lightgallery.es5.js.map +1 -1
  163. package/react/Lightgallery.umd.js +201 -136
  164. package/react/Lightgallery.umd.js.map +1 -1
  165. package/scss/lightgallery-core.scss +0 -1
  166. package/vue/LightGallery.vue.d.ts +5 -1
  167. package/vue/LightGalleryVue.common.js +314 -264
  168. package/vue/LightGalleryVue.common.js.map +1 -1
  169. package/vue/LightGalleryVue.umd.js +314 -264
  170. package/vue/LightGalleryVue.umd.js.map +1 -1
  171. package/vue/LightGalleryVue.umd.min.js +2 -2
  172. package/vue/LightGalleryVue.umd.min.js.map +1 -1
@@ -32,7 +32,7 @@
32
32
  }
33
33
 
34
34
  /*!
35
- * lightgallery | 2.3.0-beta.3 | October 9th 2021
35
+ * lightgallery | 2.4.0 | January 29th 2022
36
36
  * http://www.lightgalleryjs.com/
37
37
  * Copyright (c) 2020 Sachin Neravath;
38
38
  * @license GPLv3
@@ -72,24 +72,140 @@
72
72
  return r;
73
73
  }
74
74
 
75
- (function () {
76
- if (typeof window.CustomEvent === 'function')
77
- return false;
78
- function CustomEvent(event, params) {
79
- params = params || { bubbles: false, cancelable: false, detail: null };
80
- var evt = document.createEvent('CustomEvent');
81
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
82
- return evt;
83
- }
84
- window.CustomEvent = CustomEvent;
85
- })();
86
- (function () {
87
- if (!Element.prototype.matches) {
88
- Element.prototype.matches =
89
- Element.prototype.msMatchesSelector ||
90
- Element.prototype.webkitMatchesSelector;
91
- }
92
- })();
75
+ /**
76
+ * List of lightGallery events
77
+ * All events should be documented here
78
+ * Below interfaces are used to build the website documentations
79
+ * */
80
+ var lGEvents = {
81
+ afterAppendSlide: 'lgAfterAppendSlide',
82
+ init: 'lgInit',
83
+ hasVideo: 'lgHasVideo',
84
+ containerResize: 'lgContainerResize',
85
+ updateSlides: 'lgUpdateSlides',
86
+ afterAppendSubHtml: 'lgAfterAppendSubHtml',
87
+ beforeOpen: 'lgBeforeOpen',
88
+ afterOpen: 'lgAfterOpen',
89
+ slideItemLoad: 'lgSlideItemLoad',
90
+ beforeSlide: 'lgBeforeSlide',
91
+ afterSlide: 'lgAfterSlide',
92
+ posterClick: 'lgPosterClick',
93
+ dragStart: 'lgDragStart',
94
+ dragMove: 'lgDragMove',
95
+ dragEnd: 'lgDragEnd',
96
+ beforeNextSlide: 'lgBeforeNextSlide',
97
+ beforePrevSlide: 'lgBeforePrevSlide',
98
+ beforeClose: 'lgBeforeClose',
99
+ afterClose: 'lgAfterClose',
100
+ rotateLeft: 'lgRotateLeft',
101
+ rotateRight: 'lgRotateRight',
102
+ flipHorizontal: 'lgFlipHorizontal',
103
+ flipVertical: 'lgFlipVertical',
104
+ autoplay: 'lgAutoplay',
105
+ autoplayStart: 'lgAutoplayStart',
106
+ autoplayStop: 'lgAutoplayStop',
107
+ };
108
+
109
+ var lightGalleryCoreSettings = {
110
+ mode: 'lg-slide',
111
+ easing: 'ease',
112
+ speed: 400,
113
+ licenseKey: '0000-0000-000-0000',
114
+ height: '100%',
115
+ width: '100%',
116
+ addClass: '',
117
+ startClass: 'lg-start-zoom',
118
+ backdropDuration: 300,
119
+ container: '',
120
+ startAnimationDuration: 400,
121
+ zoomFromOrigin: true,
122
+ hideBarsDelay: 0,
123
+ showBarsAfter: 10000,
124
+ slideDelay: 0,
125
+ supportLegacyBrowser: true,
126
+ allowMediaOverlap: false,
127
+ videoMaxSize: '1280-720',
128
+ loadYouTubePoster: true,
129
+ defaultCaptionHeight: 0,
130
+ ariaLabelledby: '',
131
+ ariaDescribedby: '',
132
+ closable: true,
133
+ swipeToClose: true,
134
+ closeOnTap: true,
135
+ showCloseIcon: true,
136
+ showMaximizeIcon: false,
137
+ loop: true,
138
+ escKey: true,
139
+ keyPress: true,
140
+ controls: true,
141
+ slideEndAnimation: true,
142
+ hideControlOnEnd: false,
143
+ mousewheel: false,
144
+ getCaptionFromTitleOrAlt: true,
145
+ appendSubHtmlTo: '.lg-sub-html',
146
+ subHtmlSelectorRelative: false,
147
+ preload: 2,
148
+ numberOfSlideItemsInDom: 10,
149
+ selector: '',
150
+ selectWithin: '',
151
+ nextHtml: '',
152
+ prevHtml: '',
153
+ index: 0,
154
+ iframeWidth: '100%',
155
+ iframeHeight: '100%',
156
+ iframeMaxWidth: '100%',
157
+ iframeMaxHeight: '100%',
158
+ download: true,
159
+ counter: true,
160
+ appendCounterTo: '.lg-toolbar',
161
+ swipeThreshold: 50,
162
+ enableSwipe: true,
163
+ enableDrag: true,
164
+ dynamic: false,
165
+ dynamicEl: [],
166
+ extraProps: [],
167
+ exThumbImage: '',
168
+ isMobile: undefined,
169
+ mobileSettings: {
170
+ controls: false,
171
+ showCloseIcon: false,
172
+ download: false,
173
+ },
174
+ plugins: [],
175
+ strings: {
176
+ closeGallery: 'Close gallery',
177
+ toggleMaximize: 'Toggle maximize',
178
+ previousSlide: 'Previous slide',
179
+ nextSlide: 'Next slide',
180
+ download: 'Download',
181
+ playVideo: 'Play video',
182
+ },
183
+ };
184
+
185
+ function initLgPolyfills() {
186
+ (function () {
187
+ if (typeof window.CustomEvent === 'function')
188
+ return false;
189
+ function CustomEvent(event, params) {
190
+ params = params || {
191
+ bubbles: false,
192
+ cancelable: false,
193
+ detail: null,
194
+ };
195
+ var evt = document.createEvent('CustomEvent');
196
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
197
+ return evt;
198
+ }
199
+ window.CustomEvent = CustomEvent;
200
+ })();
201
+ (function () {
202
+ if (!Element.prototype.matches) {
203
+ Element.prototype.matches =
204
+ Element.prototype.msMatchesSelector ||
205
+ Element.prototype.webkitMatchesSelector;
206
+ }
207
+ })();
208
+ }
93
209
  var lgQuery = /** @class */ (function () {
94
210
  function lgQuery(selector) {
95
211
  this.cssVenderPrefixes = [
@@ -323,8 +439,10 @@
323
439
  // Does not support IE
324
440
  lgQuery.prototype.load = function (url) {
325
441
  var _this = this;
326
- fetch(url).then(function (res) {
327
- _this.selector.innerHTML = res;
442
+ fetch(url)
443
+ .then(function (res) { return res.text(); })
444
+ .then(function (html) {
445
+ _this.selector.innerHTML = html;
328
446
  });
329
447
  return this;
330
448
  };
@@ -435,6 +553,7 @@
435
553
  return lgQuery;
436
554
  }());
437
555
  function $LG(selector) {
556
+ initLgPolyfills();
438
557
  return new lgQuery(selector);
439
558
  }
440
559
 
@@ -558,9 +677,9 @@
558
677
  ', 1)';
559
678
  return transform;
560
679
  },
561
- getIframeMarkup: function (iframeWidth, iframeHeight, src, iframeTitle) {
680
+ getIframeMarkup: function (iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
562
681
  var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
563
- return "<div class=\"lg-video-cont lg-has-iframe\" style=\"width:" + iframeWidth + "; height: " + iframeHeight + "\">\n <iframe class=\"lg-object\" frameborder=\"0\" " + title + " src=\"" + src + "\" allowfullscreen=\"true\"></iframe>\n </div>";
682
+ return "<div class=\"lg-video-cont lg-has-iframe\" style=\"width:" + iframeWidth + "; max-width:" + iframeMaxWidth + "; height: " + iframeHeight + "; max-height:" + iframeMaxHeight + "\">\n <iframe class=\"lg-object\" frameborder=\"0\" " + title + " src=\"" + src + "\" allowfullscreen=\"true\"></iframe>\n </div>";
564
683
  },
565
684
  getImgMarkup: function (index, src, altAttr, srcset, sizes, sources) {
566
685
  var srcsetAttr = srcset ? "srcset=\"" + srcset + "\"" : '';
@@ -621,7 +740,7 @@
621
740
  // No other way of checking: assume it’s ok.
622
741
  return true;
623
742
  },
624
- getVideoPosterMarkup: function (_poster, dummyImg, videoContStyle, _isVideo) {
743
+ getVideoPosterMarkup: function (_poster, dummyImg, videoContStyle, playVideoString, _isVideo) {
625
744
  var videoClass = '';
626
745
  if (_isVideo && _isVideo.youtube) {
627
746
  videoClass = 'lg-has-youtube';
@@ -632,7 +751,7 @@
632
751
  else {
633
752
  videoClass = 'lg-has-html5';
634
753
  }
635
- 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=\"Play video\"\n role=\"img\"\n class=\"lg-video-play-icon\"\n >\n <title>Play video</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>";
754
+ 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>";
636
755
  },
637
756
  /**
638
757
  * @desc Create dynamic elements array from gallery items when dynamic option is false
@@ -720,102 +839,6 @@
720
839
  },
721
840
  };
722
841
 
723
- var lightGalleryCoreSettings = {
724
- mode: 'lg-slide',
725
- easing: 'ease',
726
- speed: 400,
727
- licenseKey: '0000-0000-000-0000',
728
- height: '100%',
729
- width: '100%',
730
- addClass: '',
731
- startClass: 'lg-start-zoom',
732
- backdropDuration: 300,
733
- container: document.body,
734
- startAnimationDuration: 400,
735
- zoomFromOrigin: true,
736
- hideBarsDelay: 0,
737
- showBarsAfter: 10000,
738
- slideDelay: 0,
739
- supportLegacyBrowser: true,
740
- allowMediaOverlap: false,
741
- videoMaxSize: '1280-720',
742
- defaultCaptionHeight: 0,
743
- ariaLabelledby: '',
744
- ariaDescribedby: '',
745
- closable: true,
746
- swipeToClose: true,
747
- closeOnTap: true,
748
- showCloseIcon: true,
749
- showMaximizeIcon: false,
750
- loop: true,
751
- escKey: true,
752
- keyPress: true,
753
- controls: true,
754
- slideEndAnimation: true,
755
- hideControlOnEnd: false,
756
- mousewheel: false,
757
- getCaptionFromTitleOrAlt: true,
758
- appendSubHtmlTo: '.lg-sub-html',
759
- subHtmlSelectorRelative: false,
760
- preload: 2,
761
- numberOfSlideItemsInDom: 10,
762
- selector: '',
763
- selectWithin: '',
764
- nextHtml: '',
765
- prevHtml: '',
766
- index: 0,
767
- iframeWidth: '100%',
768
- iframeHeight: '100%',
769
- download: true,
770
- counter: true,
771
- appendCounterTo: '.lg-toolbar',
772
- swipeThreshold: 50,
773
- enableSwipe: true,
774
- enableDrag: true,
775
- dynamic: false,
776
- dynamicEl: [],
777
- extraProps: [],
778
- exThumbImage: '',
779
- isMobile: undefined,
780
- mobileSettings: {
781
- controls: false,
782
- showCloseIcon: false,
783
- download: false,
784
- },
785
- plugins: [],
786
- };
787
-
788
- /**
789
- * List of lightGallery events
790
- * All events should be documented here
791
- * Below interfaces are used to build the website documentations
792
- * */
793
- var lGEvents = {
794
- afterAppendSlide: 'lgAfterAppendSlide',
795
- init: 'lgInit',
796
- hasVideo: 'lgHasVideo',
797
- containerResize: 'lgContainerResize',
798
- updateSlides: 'lgUpdateSlides',
799
- afterAppendSubHtml: 'lgAfterAppendSubHtml',
800
- beforeOpen: 'lgBeforeOpen',
801
- afterOpen: 'lgAfterOpen',
802
- slideItemLoad: 'lgSlideItemLoad',
803
- beforeSlide: 'lgBeforeSlide',
804
- afterSlide: 'lgAfterSlide',
805
- posterClick: 'lgPosterClick',
806
- dragStart: 'lgDragStart',
807
- dragMove: 'lgDragMove',
808
- dragEnd: 'lgDragEnd',
809
- beforeNextSlide: 'lgBeforeNextSlide',
810
- beforePrevSlide: 'lgBeforePrevSlide',
811
- beforeClose: 'lgBeforeClose',
812
- afterClose: 'lgAfterClose',
813
- rotateLeft: 'lgRotateLeft',
814
- rotateRight: 'lgRotateRight',
815
- flipHorizontal: 'lgFlipHorizontal',
816
- flipVertical: 'lgFlipVertical',
817
- };
818
-
819
842
  // @ref - https://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio
820
843
  // @ref - https://2ality.com/2017/04/setting-up-multi-platform-packages.html
821
844
  // Unique id for each gallery
@@ -987,7 +1010,7 @@
987
1010
  var subHtmlCont = '';
988
1011
  // Create controls
989
1012
  if (this.settings.controls) {
990
- controls = "<button type=\"button\" id=\"" + this.getIdName('lg-prev') + "\" aria-label=\"Previous slide\" class=\"lg-prev lg-icon\"> " + this.settings.prevHtml + " </button>\n <button type=\"button\" id=\"" + this.getIdName('lg-next') + "\" aria-label=\"Next slide\" class=\"lg-next lg-icon\"> " + this.settings.nextHtml + " </button>";
1013
+ controls = "<button type=\"button\" id=\"" + this.getIdName('lg-prev') + "\" aria-label=\"" + this.settings.strings['previousSlide'] + "\" class=\"lg-prev lg-icon\"> " + this.settings.prevHtml + " </button>\n <button type=\"button\" id=\"" + this.getIdName('lg-next') + "\" aria-label=\"" + this.settings.strings['nextSlide'] + "\" class=\"lg-next lg-icon\"> " + this.settings.nextHtml + " </button>";
991
1014
  }
992
1015
  if (this.settings.appendSubHtmlTo !== '.lg-item') {
993
1016
  subHtmlCont =
@@ -1006,19 +1029,20 @@
1006
1029
  : '';
1007
1030
  var containerClassName = "lg-container " + this.settings.addClass + " " + (document.body !== this.settings.container ? 'lg-inline' : '');
1008
1031
  var closeIcon = this.settings.closable && this.settings.showCloseIcon
1009
- ? "<button type=\"button\" aria-label=\"Close gallery\" id=\"" + this.getIdName('lg-close') + "\" class=\"lg-close lg-icon\"></button>"
1032
+ ? "<button type=\"button\" aria-label=\"" + this.settings.strings['closeGallery'] + "\" id=\"" + this.getIdName('lg-close') + "\" class=\"lg-close lg-icon\"></button>"
1010
1033
  : '';
1011
1034
  var maximizeIcon = this.settings.showMaximizeIcon
1012
- ? "<button type=\"button\" aria-label=\"Toggle maximize\" id=\"" + this.getIdName('lg-maximize') + "\" class=\"lg-maximize lg-icon\"></button>"
1035
+ ? "<button type=\"button\" aria-label=\"" + this.settings.strings['toggleMaximize'] + "\" id=\"" + this.getIdName('lg-maximize') + "\" class=\"lg-maximize lg-icon\"></button>"
1013
1036
  : '';
1014
1037
  var template = "\n <div class=\"" + containerClassName + "\" id=\"" + this.getIdName('lg-container') + "\" tabindex=\"-1\" aria-modal=\"true\" " + ariaLabelledby + " " + ariaDescribedby + " role=\"dialog\"\n >\n <div id=\"" + this.getIdName('lg-backdrop') + "\" class=\"lg-backdrop\"></div>\n\n <div id=\"" + this.getIdName('lg-outer') + "\" class=\"lg-outer lg-use-css3 lg-css3 lg-hide-items " + addClasses + " \">\n\n <div id=\"" + this.getIdName('lg-content') + "\" class=\"lg-content\">\n <div id=\"" + this.getIdName('lg-inner') + "\" class=\"lg-inner\">\n </div>\n " + controls + "\n </div>\n <div id=\"" + this.getIdName('lg-toolbar') + "\" class=\"lg-toolbar lg-group\">\n " + maximizeIcon + "\n " + closeIcon + "\n </div>\n " + (this.settings.appendSubHtmlTo === '.lg-outer'
1015
1038
  ? subHtmlCont
1016
1039
  : '') + "\n <div id=\"" + this.getIdName('lg-components') + "\" class=\"lg-components\">\n " + (this.settings.appendSubHtmlTo === '.lg-sub-html'
1017
1040
  ? subHtmlCont
1018
1041
  : '') + "\n </div>\n </div>\n </div>\n ";
1019
- $LG(this.settings.container)
1020
- .css('position', 'relative')
1021
- .append(template);
1042
+ $LG(this.settings.container).append(template);
1043
+ if (document.body !== this.settings.container) {
1044
+ $LG(this.settings.container).css('position', 'relative');
1045
+ }
1022
1046
  this.outer = this.getElementById('lg-outer');
1023
1047
  this.$lgComponents = this.getElementById('lg-components');
1024
1048
  this.$backdrop = this.getElementById('lg-backdrop');
@@ -1036,7 +1060,7 @@
1036
1060
  this.$inner.css('transition-timing-function', this.settings.easing);
1037
1061
  this.$inner.css('transition-duration', this.settings.speed + 'ms');
1038
1062
  if (this.settings.download) {
1039
- this.$toolbar.append("<a id=\"" + this.getIdName('lg-download') + "\" target=\"_blank\" rel=\"noopener\" aria-label=\"Download\" download class=\"lg-download lg-icon\"></a>");
1063
+ this.$toolbar.append("<a id=\"" + this.getIdName('lg-download') + "\" target=\"_blank\" rel=\"noopener\" aria-label=\"" + this.settings.strings['download'] + "\" download class=\"lg-download lg-icon\"></a>");
1040
1064
  }
1041
1065
  this.counter();
1042
1066
  $LG(window).on("resize.lg.global" + this.lgId + " orientationchange.lg.global" + this.lgId, function () {
@@ -1555,8 +1579,15 @@
1555
1579
  };
1556
1580
  // Add video slideInfo
1557
1581
  LightGallery.prototype.addSlideVideoInfo = function (items) {
1582
+ var _this = this;
1558
1583
  items.forEach(function (element, index) {
1559
1584
  element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
1585
+ if (element.__slideVideoInfo &&
1586
+ _this.settings.loadYouTubePoster &&
1587
+ !element.poster &&
1588
+ element.__slideVideoInfo.youtube) {
1589
+ element.poster = "//img.youtube.com/vi/" + element.__slideVideoInfo.youtube[1] + "/maxresdefault.jpg";
1590
+ }
1560
1591
  });
1561
1592
  };
1562
1593
  /**
@@ -1598,7 +1629,7 @@
1598
1629
  lgVideoStyle = this.getVideoContStyle(videoSize);
1599
1630
  }
1600
1631
  if (iframe) {
1601
- var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, src, currentGalleryItem.iframeTitle);
1632
+ var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
1602
1633
  $currentSlide.prepend(markup);
1603
1634
  }
1604
1635
  else if (poster) {
@@ -1609,7 +1640,7 @@
1609
1640
  if (hasStartAnimation) {
1610
1641
  dummyImg = this.getDummyImageContent($currentSlide, index, '');
1611
1642
  }
1612
- var markup = utils.getVideoPosterMarkup(poster, dummyImg || '', lgVideoStyle, videoInfo);
1643
+ var markup = utils.getVideoPosterMarkup(poster, dummyImg || '', lgVideoStyle, this.settings.strings['playVideo'], videoInfo);
1613
1644
  $currentSlide.prepend(markup);
1614
1645
  }
1615
1646
  else if (videoInfo) {
@@ -2392,17 +2423,23 @@
2392
2423
  };
2393
2424
  LightGallery.prototype.mousewheel = function () {
2394
2425
  var _this = this;
2395
- this.outer.on('mousewheel.lg', function (e) {
2426
+ var lastCall = 0;
2427
+ this.outer.on('wheel.lg', function (e) {
2396
2428
  if (!e.deltaY || _this.galleryItems.length < 2) {
2397
2429
  return;
2398
2430
  }
2399
- if (e.deltaY > 0) {
2400
- _this.goToPrevSlide();
2431
+ e.preventDefault();
2432
+ var now = new Date().getTime();
2433
+ if (now - lastCall < 1000) {
2434
+ return;
2401
2435
  }
2402
- else {
2436
+ lastCall = now;
2437
+ if (e.deltaY > 0) {
2403
2438
  _this.goToNextSlide();
2404
2439
  }
2405
- e.preventDefault();
2440
+ else if (e.deltaY < 0) {
2441
+ _this.goToPrevSlide();
2442
+ }
2406
2443
  });
2407
2444
  };
2408
2445
  LightGallery.prototype.isSlideElement = function (target) {
@@ -2662,9 +2699,13 @@
2662
2699
  onBeforePrevSlide: 'lgBeforePrevSlide',
2663
2700
  onBeforeClose: 'lgBeforeClose',
2664
2701
  onAfterClose: 'lgAfterClose',
2702
+ onRotateLeft: 'lgRotateLeft',
2703
+ onRotateRight: 'lgRotateRight',
2704
+ onFlipHorizontal: 'lgFlipHorizontal',
2705
+ onFlipVertical: 'lgFlipVertical',
2665
2706
  };
2666
2707
  var LG = function (_a) {
2667
- var children = _a.children, elementClassNames = _a.elementClassNames, onAfterAppendSlide = _a.onAfterAppendSlide, onInit = _a.onInit, onHasVideo = _a.onHasVideo, onContainerResize = _a.onContainerResize, onAfterAppendSubHtml = _a.onAfterAppendSubHtml, onBeforeOpen = _a.onBeforeOpen, onAfterOpen = _a.onAfterOpen, onSlideItemLoad = _a.onSlideItemLoad, onBeforeSlide = _a.onBeforeSlide, onAfterSlide = _a.onAfterSlide, onPosterClick = _a.onPosterClick, onDragStart = _a.onDragStart, onDragMove = _a.onDragMove, onDragEnd = _a.onDragEnd, onBeforeNextSlide = _a.onBeforeNextSlide, onBeforePrevSlide = _a.onBeforePrevSlide, onBeforeClose = _a.onBeforeClose, onAfterClose = _a.onAfterClose, restProps = __rest(_a, ["children", "elementClassNames", "onAfterAppendSlide", "onInit", "onHasVideo", "onContainerResize", "onAfterAppendSubHtml", "onBeforeOpen", "onAfterOpen", "onSlideItemLoad", "onBeforeSlide", "onAfterSlide", "onPosterClick", "onDragStart", "onDragMove", "onDragEnd", "onBeforeNextSlide", "onBeforePrevSlide", "onBeforeClose", "onAfterClose"]);
2708
+ var children = _a.children, elementClassNames = _a.elementClassNames, onAfterAppendSlide = _a.onAfterAppendSlide, onInit = _a.onInit, onHasVideo = _a.onHasVideo, onContainerResize = _a.onContainerResize, onAfterAppendSubHtml = _a.onAfterAppendSubHtml, onBeforeOpen = _a.onBeforeOpen, onAfterOpen = _a.onAfterOpen, onSlideItemLoad = _a.onSlideItemLoad, onBeforeSlide = _a.onBeforeSlide, onAfterSlide = _a.onAfterSlide, onPosterClick = _a.onPosterClick, onDragStart = _a.onDragStart, onDragMove = _a.onDragMove, onDragEnd = _a.onDragEnd, onBeforeNextSlide = _a.onBeforeNextSlide, onBeforePrevSlide = _a.onBeforePrevSlide, onBeforeClose = _a.onBeforeClose, onAfterClose = _a.onAfterClose, onRotateLeft = _a.onRotateLeft, onRotateRight = _a.onRotateRight, onFlipHorizontal = _a.onFlipHorizontal, onFlipVertical = _a.onFlipVertical, restProps = __rest(_a, ["children", "elementClassNames", "onAfterAppendSlide", "onInit", "onHasVideo", "onContainerResize", "onAfterAppendSubHtml", "onBeforeOpen", "onAfterOpen", "onSlideItemLoad", "onBeforeSlide", "onAfterSlide", "onPosterClick", "onDragStart", "onDragMove", "onDragEnd", "onBeforeNextSlide", "onBeforePrevSlide", "onBeforeClose", "onAfterClose", "onRotateLeft", "onRotateRight", "onFlipHorizontal", "onFlipVertical"]);
2668
2709
  var $lg = React.useRef(null);
2669
2710
  var registerEvents = React.useCallback(function () {
2670
2711
  if (onAfterAppendSlide && $lg && $lg.current) {
@@ -2757,10 +2798,34 @@
2757
2798
  onAfterClose(event.detail);
2758
2799
  }));
2759
2800
  }
2801
+ if (onRotateLeft && $lg && $lg.current) {
2802
+ $lg.current.addEventListener(LgMethods.onRotateLeft, (function (event) {
2803
+ onRotateLeft(event.detail);
2804
+ }));
2805
+ }
2806
+ if (onRotateRight && $lg && $lg.current) {
2807
+ $lg.current.addEventListener(LgMethods.onRotateRight, (function (event) {
2808
+ onRotateRight(event.detail);
2809
+ }));
2810
+ }
2811
+ if (onFlipHorizontal && $lg && $lg.current) {
2812
+ $lg.current.addEventListener(LgMethods.onFlipHorizontal, (function (event) {
2813
+ onFlipHorizontal(event.detail);
2814
+ }));
2815
+ }
2816
+ if (onFlipVertical && $lg && $lg.current) {
2817
+ $lg.current.addEventListener(LgMethods.onFlipVertical, (function (event) {
2818
+ onFlipVertical(event.detail);
2819
+ }));
2820
+ }
2760
2821
  }, [
2761
2822
  onAfterAppendSlide,
2762
2823
  onAfterAppendSubHtml,
2763
2824
  onAfterClose,
2825
+ onRotateLeft,
2826
+ onRotateRight,
2827
+ onFlipHorizontal,
2828
+ onFlipVertical,
2764
2829
  onAfterOpen,
2765
2830
  onAfterSlide,
2766
2831
  onBeforeClose,