lightgallery 2.3.0-beta.2 → 2.4.0-beta.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 (173) 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 +19 -27
  39. package/css/lightgallery-bundle.min.css +1 -1
  40. package/css/lightgallery-core.css +0 -20
  41. package/css/lightgallery.css +19 -27
  42. package/lg-events.d.ts +44 -0
  43. package/lg-settings.d.ts +20 -8
  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 -2
  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 +31 -20
  52. package/lib/lgQuery.js.map +1 -1
  53. package/lib/lightgallery.js +30 -19
  54. package/lib/lightgallery.js.map +1 -1
  55. package/lib/plugins/autoplay/lg-autoplay-settings.js +1 -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 +1 -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 +1 -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 +1 -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 +174 -139
  85. package/lightgallery.es5.js.map +1 -1
  86. package/lightgallery.min.js +2 -2
  87. package/lightgallery.umd.js +174 -139
  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 +6 -0
  93. package/plugins/autoplay/lg-autoplay.d.ts +2 -2
  94. package/plugins/autoplay/lg-autoplay.es5.js +25 -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 +25 -12
  98. package/plugins/autoplay/lg-autoplay.umd.js.map +1 -1
  99. package/plugins/comment/lg-comment-settings.d.ts +6 -0
  100. package/plugins/comment/lg-comment.es5.js +6 -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 +6 -2
  104. package/plugins/comment/lg-comment.umd.js.map +1 -1
  105. package/plugins/fullscreen/lg-fullscreen-settings.d.ts +6 -0
  106. package/plugins/fullscreen/lg-fullscreen.es5.js +3 -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 +3 -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 +12 -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 +9 -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 +6 -0
  144. package/plugins/thumbnail/lg-thumbnail.es5.js +8 -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 +8 -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 +6 -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 +203 -140
  162. package/react/Lightgallery.es5.js.map +1 -1
  163. package/react/Lightgallery.umd.js +203 -140
  164. package/react/Lightgallery.umd.js.map +1 -1
  165. package/scss/_lg-theme-default.scss +17 -10
  166. package/scss/lightgallery-core.scss +0 -25
  167. package/vue/LightGallery.vue.d.ts +5 -1
  168. package/vue/LightGalleryVue.common.js +317 -270
  169. package/vue/LightGalleryVue.common.js.map +1 -1
  170. package/vue/LightGalleryVue.umd.js +317 -270
  171. package/vue/LightGalleryVue.umd.js.map +1 -1
  172. package/vue/LightGalleryVue.umd.min.js +2 -2
  173. 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.2 | September 28th 2021
35
+ * lightgallery | 2.4.0-beta.0 | December 12th 2021
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 = [
@@ -222,7 +338,9 @@
222
338
  this._each(function (el) {
223
339
  // IE doesn't support multiple arguments
224
340
  classNames.split(' ').forEach(function (className) {
225
- el.classList.add(className);
341
+ if (className) {
342
+ el.classList.add(className);
343
+ }
226
344
  });
227
345
  });
228
346
  return this;
@@ -231,7 +349,9 @@
231
349
  this._each(function (el) {
232
350
  // IE doesn't support multiple arguments
233
351
  classNames.split(' ').forEach(function (className) {
234
- el.classList.remove(className);
352
+ if (className) {
353
+ el.classList.remove(className);
354
+ }
235
355
  });
236
356
  });
237
357
  return this;
@@ -431,6 +551,7 @@
431
551
  return lgQuery;
432
552
  }());
433
553
  function $LG(selector) {
554
+ initLgPolyfills();
434
555
  return new lgQuery(selector);
435
556
  }
436
557
 
@@ -554,9 +675,9 @@
554
675
  ', 1)';
555
676
  return transform;
556
677
  },
557
- getIframeMarkup: function (iframeWidth, iframeHeight, src, iframeTitle) {
678
+ getIframeMarkup: function (iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
558
679
  var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
559
- 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>";
680
+ 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>";
560
681
  },
561
682
  getImgMarkup: function (index, src, altAttr, srcset, sizes, sources) {
562
683
  var srcsetAttr = srcset ? "srcset=\"" + srcset + "\"" : '';
@@ -617,7 +738,7 @@
617
738
  // No other way of checking: assume it’s ok.
618
739
  return true;
619
740
  },
620
- getVideoPosterMarkup: function (_poster, dummyImg, videoContStyle, _isVideo) {
741
+ getVideoPosterMarkup: function (_poster, dummyImg, videoContStyle, playVideoString, _isVideo) {
621
742
  var videoClass = '';
622
743
  if (_isVideo && _isVideo.youtube) {
623
744
  videoClass = 'lg-has-youtube';
@@ -628,7 +749,7 @@
628
749
  else {
629
750
  videoClass = 'lg-has-html5';
630
751
  }
631
- 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>";
752
+ 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>";
632
753
  },
633
754
  /**
634
755
  * @desc Create dynamic elements array from gallery items when dynamic option is false
@@ -716,103 +837,6 @@
716
837
  },
717
838
  };
718
839
 
719
- var lightGalleryCoreSettings = {
720
- mode: 'lg-slide',
721
- easing: 'ease',
722
- speed: 400,
723
- licenseKey: '0000-0000-000-0000',
724
- height: '100%',
725
- width: '100%',
726
- addClass: '',
727
- startClass: 'lg-start-zoom',
728
- backdropDuration: 300,
729
- container: document.body,
730
- startAnimationDuration: 400,
731
- zoomFromOrigin: true,
732
- hideBarsDelay: 0,
733
- showBarsAfter: 10000,
734
- slideDelay: 0,
735
- supportLegacyBrowser: true,
736
- allowMediaOverlap: false,
737
- videoMaxSize: '1280-720',
738
- defaultCaptionHeight: 0,
739
- ariaLabelledby: '',
740
- ariaDescribedby: '',
741
- closable: true,
742
- swipeToClose: true,
743
- closeOnTap: true,
744
- showCloseIcon: true,
745
- showMaximizeIcon: false,
746
- loop: true,
747
- escKey: true,
748
- keyPress: true,
749
- controls: true,
750
- slideEndAnimation: true,
751
- hideControlOnEnd: false,
752
- mousewheel: false,
753
- getCaptionFromTitleOrAlt: true,
754
- appendSubHtmlTo: '.lg-sub-html',
755
- subHtmlSelectorRelative: false,
756
- preload: 2,
757
- numberOfSlideItemsInDom: 10,
758
- showAfterLoad: true,
759
- selector: '',
760
- selectWithin: '',
761
- nextHtml: '',
762
- prevHtml: '',
763
- index: 0,
764
- iframeWidth: '100%',
765
- iframeHeight: '100%',
766
- download: true,
767
- counter: true,
768
- appendCounterTo: '.lg-toolbar',
769
- swipeThreshold: 50,
770
- enableSwipe: true,
771
- enableDrag: true,
772
- dynamic: false,
773
- dynamicEl: [],
774
- extraProps: [],
775
- exThumbImage: '',
776
- isMobile: undefined,
777
- mobileSettings: {
778
- controls: false,
779
- showCloseIcon: false,
780
- download: false,
781
- },
782
- plugins: [],
783
- };
784
-
785
- /**
786
- * List of lightGallery events
787
- * All events should be documented here
788
- * Below interfaces are used to build the website documentations
789
- * */
790
- var lGEvents = {
791
- afterAppendSlide: 'lgAfterAppendSlide',
792
- init: 'lgInit',
793
- hasVideo: 'lgHasVideo',
794
- containerResize: 'lgContainerResize',
795
- updateSlides: 'lgUpdateSlides',
796
- afterAppendSubHtml: 'lgAfterAppendSubHtml',
797
- beforeOpen: 'lgBeforeOpen',
798
- afterOpen: 'lgAfterOpen',
799
- slideItemLoad: 'lgSlideItemLoad',
800
- beforeSlide: 'lgBeforeSlide',
801
- afterSlide: 'lgAfterSlide',
802
- posterClick: 'lgPosterClick',
803
- dragStart: 'lgDragStart',
804
- dragMove: 'lgDragMove',
805
- dragEnd: 'lgDragEnd',
806
- beforeNextSlide: 'lgBeforeNextSlide',
807
- beforePrevSlide: 'lgBeforePrevSlide',
808
- beforeClose: 'lgBeforeClose',
809
- afterClose: 'lgAfterClose',
810
- rotateLeft: 'lgRotateLeft',
811
- rotateRight: 'lgRotateRight',
812
- flipHorizontal: 'lgFlipHorizontal',
813
- flipVertical: 'lgFlipVertical',
814
- };
815
-
816
840
  // @ref - https://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio
817
841
  // @ref - https://2ality.com/2017/04/setting-up-multi-platform-packages.html
818
842
  // Unique id for each gallery
@@ -984,7 +1008,7 @@
984
1008
  var subHtmlCont = '';
985
1009
  // Create controls
986
1010
  if (this.settings.controls) {
987
- 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>";
1011
+ 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>";
988
1012
  }
989
1013
  if (this.settings.appendSubHtmlTo !== '.lg-item') {
990
1014
  subHtmlCont =
@@ -1003,19 +1027,20 @@
1003
1027
  : '';
1004
1028
  var containerClassName = "lg-container " + this.settings.addClass + " " + (document.body !== this.settings.container ? 'lg-inline' : '');
1005
1029
  var closeIcon = this.settings.closable && this.settings.showCloseIcon
1006
- ? "<button type=\"button\" aria-label=\"Close gallery\" id=\"" + this.getIdName('lg-close') + "\" class=\"lg-close lg-icon\"></button>"
1030
+ ? "<button type=\"button\" aria-label=\"" + this.settings.strings['closeGallery'] + "\" id=\"" + this.getIdName('lg-close') + "\" class=\"lg-close lg-icon\"></button>"
1007
1031
  : '';
1008
1032
  var maximizeIcon = this.settings.showMaximizeIcon
1009
- ? "<button type=\"button\" aria-label=\"Toggle maximize\" id=\"" + this.getIdName('lg-maximize') + "\" class=\"lg-maximize lg-icon\"></button>"
1033
+ ? "<button type=\"button\" aria-label=\"" + this.settings.strings['toggleMaximize'] + "\" id=\"" + this.getIdName('lg-maximize') + "\" class=\"lg-maximize lg-icon\"></button>"
1010
1034
  : '';
1011
1035
  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'
1012
1036
  ? subHtmlCont
1013
1037
  : '') + "\n <div id=\"" + this.getIdName('lg-components') + "\" class=\"lg-components\">\n " + (this.settings.appendSubHtmlTo === '.lg-sub-html'
1014
1038
  ? subHtmlCont
1015
1039
  : '') + "\n </div>\n </div>\n </div>\n ";
1016
- $LG(this.settings.container)
1017
- .css('position', 'relative')
1018
- .append(template);
1040
+ $LG(this.settings.container).append(template);
1041
+ if (document.body !== this.settings.container) {
1042
+ $LG(this.settings.container).css('position', 'relative');
1043
+ }
1019
1044
  this.outer = this.getElementById('lg-outer');
1020
1045
  this.$lgComponents = this.getElementById('lg-components');
1021
1046
  this.$backdrop = this.getElementById('lg-backdrop');
@@ -1029,14 +1054,11 @@
1029
1054
  if (this.settings.enableDrag) {
1030
1055
  outerClassNames += 'lg-grab ';
1031
1056
  }
1032
- if (this.settings.showAfterLoad) {
1033
- outerClassNames += 'lg-show-after-load';
1034
- }
1035
1057
  this.outer.addClass(outerClassNames);
1036
1058
  this.$inner.css('transition-timing-function', this.settings.easing);
1037
1059
  this.$inner.css('transition-duration', this.settings.speed + 'ms');
1038
1060
  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>");
1061
+ 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
1062
  }
1041
1063
  this.counter();
1042
1064
  $LG(window).on("resize.lg.global" + this.lgId + " orientationchange.lg.global" + this.lgId, function () {
@@ -1555,8 +1577,15 @@
1555
1577
  };
1556
1578
  // Add video slideInfo
1557
1579
  LightGallery.prototype.addSlideVideoInfo = function (items) {
1580
+ var _this = this;
1558
1581
  items.forEach(function (element, index) {
1559
1582
  element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
1583
+ if (element.__slideVideoInfo &&
1584
+ _this.settings.loadYouTubePoster &&
1585
+ !element.poster &&
1586
+ element.__slideVideoInfo.youtube) {
1587
+ element.poster = "//img.youtube.com/vi/" + element.__slideVideoInfo.youtube[1] + "/maxresdefault.jpg";
1588
+ }
1560
1589
  });
1561
1590
  };
1562
1591
  /**
@@ -1598,7 +1627,7 @@
1598
1627
  lgVideoStyle = this.getVideoContStyle(videoSize);
1599
1628
  }
1600
1629
  if (iframe) {
1601
- var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, src, currentGalleryItem.iframeTitle);
1630
+ var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
1602
1631
  $currentSlide.prepend(markup);
1603
1632
  }
1604
1633
  else if (poster) {
@@ -1609,7 +1638,7 @@
1609
1638
  if (hasStartAnimation) {
1610
1639
  dummyImg = this.getDummyImageContent($currentSlide, index, '');
1611
1640
  }
1612
- var markup = utils.getVideoPosterMarkup(poster, dummyImg || '', lgVideoStyle, videoInfo);
1641
+ var markup = utils.getVideoPosterMarkup(poster, dummyImg || '', lgVideoStyle, this.settings.strings['playVideo'], videoInfo);
1613
1642
  $currentSlide.prepend(markup);
1614
1643
  }
1615
1644
  else if (videoInfo) {
@@ -2392,17 +2421,23 @@
2392
2421
  };
2393
2422
  LightGallery.prototype.mousewheel = function () {
2394
2423
  var _this = this;
2395
- this.outer.on('mousewheel.lg', function (e) {
2424
+ var lastCall = 0;
2425
+ this.outer.on('wheel.lg', function (e) {
2396
2426
  if (!e.deltaY || _this.galleryItems.length < 2) {
2397
2427
  return;
2398
2428
  }
2399
- if (e.deltaY > 0) {
2400
- _this.goToPrevSlide();
2429
+ e.preventDefault();
2430
+ var now = new Date().getTime();
2431
+ if (now - lastCall < 1000) {
2432
+ return;
2401
2433
  }
2402
- else {
2434
+ lastCall = now;
2435
+ if (e.deltaY > 0) {
2403
2436
  _this.goToNextSlide();
2404
2437
  }
2405
- e.preventDefault();
2438
+ else if (e.deltaY < 0) {
2439
+ _this.goToPrevSlide();
2440
+ }
2406
2441
  });
2407
2442
  };
2408
2443
  LightGallery.prototype.isSlideElement = function (target) {
@@ -2662,9 +2697,13 @@
2662
2697
  onBeforePrevSlide: 'lgBeforePrevSlide',
2663
2698
  onBeforeClose: 'lgBeforeClose',
2664
2699
  onAfterClose: 'lgAfterClose',
2700
+ onRotateLeft: 'lgRotateLeft',
2701
+ onRotateRight: 'lgRotateRight',
2702
+ onFlipHorizontal: 'lgFlipHorizontal',
2703
+ onFlipVertical: 'lgFlipVertical',
2665
2704
  };
2666
2705
  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"]);
2706
+ 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
2707
  var $lg = React.useRef(null);
2669
2708
  var registerEvents = React.useCallback(function () {
2670
2709
  if (onAfterAppendSlide && $lg && $lg.current) {
@@ -2757,10 +2796,34 @@
2757
2796
  onAfterClose(event.detail);
2758
2797
  }));
2759
2798
  }
2799
+ if (onRotateLeft && $lg && $lg.current) {
2800
+ $lg.current.addEventListener(LgMethods.onRotateLeft, (function (event) {
2801
+ onRotateLeft(event.detail);
2802
+ }));
2803
+ }
2804
+ if (onRotateRight && $lg && $lg.current) {
2805
+ $lg.current.addEventListener(LgMethods.onRotateRight, (function (event) {
2806
+ onRotateRight(event.detail);
2807
+ }));
2808
+ }
2809
+ if (onFlipHorizontal && $lg && $lg.current) {
2810
+ $lg.current.addEventListener(LgMethods.onFlipHorizontal, (function (event) {
2811
+ onFlipHorizontal(event.detail);
2812
+ }));
2813
+ }
2814
+ if (onFlipVertical && $lg && $lg.current) {
2815
+ $lg.current.addEventListener(LgMethods.onFlipVertical, (function (event) {
2816
+ onFlipVertical(event.detail);
2817
+ }));
2818
+ }
2760
2819
  }, [
2761
2820
  onAfterAppendSlide,
2762
2821
  onAfterAppendSubHtml,
2763
2822
  onAfterClose,
2823
+ onRotateLeft,
2824
+ onRotateRight,
2825
+ onFlipHorizontal,
2826
+ onFlipVertical,
2764
2827
  onAfterOpen,
2765
2828
  onAfterSlide,
2766
2829
  onBeforeClose,