lightgallery 2.3.0 → 2.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/angular/10/bundles/lightgallery-angular-10.umd.js +34 -1
- package/angular/10/bundles/lightgallery-angular-10.umd.js.map +1 -1
- package/angular/10/bundles/lightgallery-angular-10.umd.min.js +1 -1
- package/angular/10/bundles/lightgallery-angular-10.umd.min.js.map +1 -1
- package/angular/10/esm2015/lib/lightgallery-angular.component.js +35 -2
- package/angular/10/fesm2015/lightgallery-angular-10.js +34 -1
- package/angular/10/fesm2015/lightgallery-angular-10.js.map +1 -1
- package/angular/10/lib/lightgallery-angular.component.d.ts +6 -2
- package/angular/10/lib/lightgallery-angular.component.d.ts.map +1 -1
- package/angular/11/bundles/lightgallery-angular-11.umd.js +34 -1
- package/angular/11/bundles/lightgallery-angular-11.umd.js.map +1 -1
- package/angular/11/bundles/lightgallery-angular-11.umd.min.js +1 -1
- package/angular/11/bundles/lightgallery-angular-11.umd.min.js.map +1 -1
- package/angular/11/esm2015/lib/lightgallery-angular.component.js +35 -2
- package/angular/11/fesm2015/lightgallery-angular-11.js +34 -1
- package/angular/11/fesm2015/lightgallery-angular-11.js.map +1 -1
- package/angular/11/lib/lightgallery-angular.component.d.ts +6 -2
- package/angular/11/lib/lightgallery-angular.component.d.ts.map +1 -1
- package/angular/9/bundles/lightgallery-angular-9.umd.js +34 -1
- package/angular/9/bundles/lightgallery-angular-9.umd.js.map +1 -1
- package/angular/9/bundles/lightgallery-angular-9.umd.min.js +1 -1
- package/angular/9/bundles/lightgallery-angular-9.umd.min.js.map +1 -1
- package/angular/9/esm2015/lib/lightgallery-angular.component.js +35 -2
- package/angular/9/esm5/lib/lightgallery-angular.component.js +35 -2
- package/angular/9/fesm2015/lightgallery-angular-9.js +34 -1
- package/angular/9/fesm2015/lightgallery-angular-9.js.map +1 -1
- package/angular/9/fesm5/lightgallery-angular-9.js +34 -1
- package/angular/9/fesm5/lightgallery-angular-9.js.map +1 -1
- package/angular/9/lib/lightgallery-angular.component.d.ts +6 -2
- package/angular/bundles/lightgallery-angular.umd.js +34 -1
- package/angular/bundles/lightgallery-angular.umd.js.map +1 -1
- package/angular/esm2015/lib/lightgallery-angular.component.js +35 -2
- package/angular/fesm2015/lightgallery-angular.js +34 -1
- package/angular/fesm2015/lightgallery-angular.js.map +1 -1
- package/angular/lib/lightgallery-angular.component.d.ts +6 -2
- package/angular/lib/lightgallery-angular.component.d.ts.map +1 -1
- package/css/lightgallery-bundle.css +0 -1
- package/css/lightgallery-bundle.min.css +1 -1
- package/css/lightgallery-core.css +0 -1
- package/css/lightgallery.css +0 -1
- package/lg-events.d.ts +44 -0
- package/lg-settings.d.ts +15 -0
- package/lg-utils.d.ts +1 -1
- package/lib/lg-events.js +3 -0
- package/lib/lg-events.js.map +1 -1
- package/lib/lg-settings.js +8 -0
- package/lib/lg-settings.js.map +1 -1
- package/lib/lg-utils.js +2 -2
- package/lib/lg-utils.js.map +1 -1
- package/lib/lgQuery.js +4 -2
- package/lib/lgQuery.js.map +1 -1
- package/lib/lightgallery.js +11 -10
- package/lib/lightgallery.js.map +1 -1
- package/lib/plugins/autoplay/lg-autoplay-settings.js +3 -0
- package/lib/plugins/autoplay/lg-autoplay-settings.js.map +1 -1
- package/lib/plugins/autoplay/lg-autoplay.js +20 -11
- package/lib/plugins/autoplay/lg-autoplay.js.map +1 -1
- package/lib/plugins/comment/lg-comment-settings.js +3 -0
- package/lib/plugins/comment/lg-comment-settings.js.map +1 -1
- package/lib/plugins/comment/lg-comment.js +1 -1
- package/lib/plugins/comment/lg-comment.js.map +1 -1
- package/lib/plugins/fullscreen/lg-fullscreen-settings.js +3 -0
- package/lib/plugins/fullscreen/lg-fullscreen-settings.js.map +1 -1
- package/lib/plugins/fullscreen/lg-fullscreen.js +1 -2
- package/lib/plugins/fullscreen/lg-fullscreen.js.map +1 -1
- package/lib/plugins/rotate/lg-rotate-settings.js +6 -0
- package/lib/plugins/rotate/lg-rotate-settings.js.map +1 -1
- package/lib/plugins/rotate/lg-rotate.js +4 -8
- package/lib/plugins/rotate/lg-rotate.js.map +1 -1
- package/lib/plugins/share/lg-share-settings.js +1 -0
- package/lib/plugins/share/lg-share-settings.js.map +1 -1
- package/lib/plugins/share/lg-share.js +1 -1
- package/lib/plugins/share/lg-share.js.map +1 -1
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js +3 -0
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js.map +1 -1
- package/lib/plugins/thumbnail/lg-thumbnail.js +3 -1
- package/lib/plugins/thumbnail/lg-thumbnail.js.map +1 -1
- package/lib/plugins/video/lg-video-utils.js +13 -5
- package/lib/plugins/video/lg-video-utils.js.map +1 -1
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js +8 -0
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js.map +1 -0
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js +122 -0
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js.map +1 -0
- package/lib/plugins/zoom/lg-zoom-settings.js +5 -0
- package/lib/plugins/zoom/lg-zoom-settings.js.map +1 -1
- package/lib/plugins/zoom/lg-zoom.js +2 -2
- package/lib/plugins/zoom/lg-zoom.js.map +1 -1
- package/lightgallery.d.ts +1 -1
- package/lightgallery.es5.js +126 -112
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +126 -112
- package/lightgallery.umd.js.map +1 -1
- package/lit/lightgallery.esm.js +6 -6
- package/lit/lightgallery.umd.js +3 -3
- package/package.json +1 -1
- package/plugins/autoplay/lg-autoplay-settings.d.ts +7 -0
- package/plugins/autoplay/lg-autoplay.d.ts +2 -2
- package/plugins/autoplay/lg-autoplay.es5.js +27 -12
- package/plugins/autoplay/lg-autoplay.es5.js.map +1 -1
- package/plugins/autoplay/lg-autoplay.min.js +2 -2
- package/plugins/autoplay/lg-autoplay.umd.js +27 -12
- package/plugins/autoplay/lg-autoplay.umd.js.map +1 -1
- package/plugins/comment/lg-comment-settings.d.ts +7 -0
- package/plugins/comment/lg-comment.es5.js +8 -2
- package/plugins/comment/lg-comment.es5.js.map +1 -1
- package/plugins/comment/lg-comment.min.js +2 -2
- package/plugins/comment/lg-comment.umd.js +8 -2
- package/plugins/comment/lg-comment.umd.js.map +1 -1
- package/plugins/fullscreen/lg-fullscreen-settings.d.ts +7 -0
- package/plugins/fullscreen/lg-fullscreen.es5.js +5 -3
- package/plugins/fullscreen/lg-fullscreen.es5.js.map +1 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +2 -2
- package/plugins/fullscreen/lg-fullscreen.umd.js +5 -3
- package/plugins/fullscreen/lg-fullscreen.umd.js.map +1 -1
- package/plugins/hash/lg-hash.es5.js +4 -1
- package/plugins/hash/lg-hash.es5.js.map +1 -1
- package/plugins/hash/lg-hash.min.js +1 -1
- package/plugins/hash/lg-hash.umd.js +4 -1
- package/plugins/hash/lg-hash.umd.js.map +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +4 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +4 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -1
- package/plugins/pager/lg-pager.es5.js +4 -1
- package/plugins/pager/lg-pager.es5.js.map +1 -1
- package/plugins/pager/lg-pager.min.js +1 -1
- package/plugins/pager/lg-pager.umd.js +4 -1
- package/plugins/pager/lg-pager.umd.js.map +1 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js +4 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js +4 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -1
- package/plugins/rotate/lg-rotate-settings.d.ts +11 -0
- package/plugins/rotate/lg-rotate.es5.js +14 -9
- package/plugins/rotate/lg-rotate.es5.js.map +1 -1
- package/plugins/rotate/lg-rotate.min.js +2 -2
- package/plugins/rotate/lg-rotate.umd.js +14 -9
- package/plugins/rotate/lg-rotate.umd.js.map +1 -1
- package/plugins/share/lg-share-settings.d.ts +8 -0
- package/plugins/share/lg-share.es5.js +6 -2
- package/plugins/share/lg-share.es5.js.map +1 -1
- package/plugins/share/lg-share.min.js +2 -2
- package/plugins/share/lg-share.umd.js +6 -2
- package/plugins/share/lg-share.umd.js.map +1 -1
- package/plugins/thumbnail/lg-thumbnail-settings.d.ts +8 -0
- package/plugins/thumbnail/lg-thumbnail.es5.js +10 -2
- package/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +2 -2
- package/plugins/thumbnail/lg-thumbnail.umd.js +10 -2
- package/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -1
- package/plugins/video/lg-video.es5.js +17 -6
- package/plugins/video/lg-video.es5.js.map +1 -1
- package/plugins/video/lg-video.min.js +2 -2
- package/plugins/video/lg-video.umd.js +17 -6
- package/plugins/video/lg-video.umd.js.map +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.d.ts +11 -0
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.d.ts +14 -0
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +182 -0
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +1 -0
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +8 -0
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +190 -0
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +1 -0
- package/plugins/vimeoThumbnail/package.json +7 -0
- package/plugins/zoom/lg-zoom-settings.d.ts +9 -0
- package/plugins/zoom/lg-zoom.es5.js +11 -3
- package/plugins/zoom/lg-zoom.es5.js.map +1 -1
- package/plugins/zoom/lg-zoom.min.js +2 -2
- package/plugins/zoom/lg-zoom.umd.js +11 -3
- package/plugins/zoom/lg-zoom.umd.js.map +1 -1
- package/react/Lightgallery.d.ts +5 -1
- package/react/Lightgallery.es5.js +155 -113
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +155 -113
- package/react/Lightgallery.umd.js.map +1 -1
- package/scss/lightgallery-core.scss +0 -1
- package/vue/LightGallery.vue.d.ts +5 -1
- package/vue/LightGalleryVue.common.js +140 -110
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +140 -110
- package/vue/LightGalleryVue.umd.js.map +1 -1
- package/vue/LightGalleryVue.umd.min.js +1 -1
- package/vue/LightGalleryVue.umd.min.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-fullscreen.es5.js","sources":["../../../src/plugins/fullscreen/lg-fullscreen-settings.ts","../../../src/plugins/fullscreen/lg-fullscreen.ts"],"sourcesContent":["export interface FullscreenSettings {\n /**\n * Enable/Disable fullscreen option\n */\n fullScreen: boolean;\n}\n\nexport const fullscreenSettings: FullscreenSettings = {\n fullScreen: true,\n};\n","import { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n FullscreenSettings,\n fullscreenSettings,\n} from './lg-fullscreen-settings';\n\ndeclare let document: any;\n\nexport default class FullScreen {\n core: LightGallery;\n settings: FullscreenSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // extend module default settings with lightGallery core settings\n this.settings = { ...fullscreenSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n let fullScreen = '';\n if (this.settings.fullScreen) {\n // check for fullscreen browser support\n if (\n !document.fullscreenEnabled &&\n !document.webkitFullscreenEnabled &&\n !document.mozFullScreenEnabled &&\n !document.msFullscreenEnabled\n ) {\n return;\n } else {\n fullScreen
|
|
1
|
+
{"version":3,"file":"lg-fullscreen.es5.js","sources":["../../../src/plugins/fullscreen/lg-fullscreen-settings.ts","../../../src/plugins/fullscreen/lg-fullscreen.ts"],"sourcesContent":["export interface FullscreenStrings {\n toggleFullscreen: string;\n}\nexport interface FullscreenSettings {\n /**\n * Enable/Disable fullscreen option\n */\n fullScreen: boolean;\n\n /**\n * Custom translation strings for aria-labels\n */\n fullscreenPluginStrings: FullscreenStrings;\n}\n\nexport const fullscreenSettings: FullscreenSettings = {\n fullScreen: true,\n fullscreenPluginStrings: {\n toggleFullscreen: 'Toggle Fullscreen',\n } as FullscreenStrings,\n};\n","import { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n FullscreenSettings,\n fullscreenSettings,\n} from './lg-fullscreen-settings';\n\ndeclare let document: any;\n\nexport default class FullScreen {\n core: LightGallery;\n settings: FullscreenSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // extend module default settings with lightGallery core settings\n this.settings = { ...fullscreenSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n let fullScreen = '';\n if (this.settings.fullScreen) {\n // check for fullscreen browser support\n if (\n !document.fullscreenEnabled &&\n !document.webkitFullscreenEnabled &&\n !document.mozFullScreenEnabled &&\n !document.msFullscreenEnabled\n ) {\n return;\n } else {\n fullScreen = `<button type=\"button\" aria-label=\"${this.settings.fullscreenPluginStrings['toggleFullscreen']}\" class=\"lg-fullscreen lg-icon\"></button>`;\n this.core.$toolbar.append(fullScreen);\n this.fullScreen();\n }\n }\n }\n\n private isFullScreen(): boolean {\n return (\n document.fullscreenElement ||\n document.mozFullScreenElement ||\n document.webkitFullscreenElement ||\n document.msFullscreenElement\n );\n }\n\n private requestFullscreen(): void {\n const el = document.documentElement;\n if (el.requestFullscreen) {\n el.requestFullscreen();\n } else if (el.msRequestFullscreen) {\n el.msRequestFullscreen();\n } else if (el.mozRequestFullScreen) {\n el.mozRequestFullScreen();\n } else if (el.webkitRequestFullscreen) {\n el.webkitRequestFullscreen();\n }\n }\n\n private exitFullscreen(): void {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n }\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode\n private fullScreen(): void {\n this.$LG(document).on(\n `fullscreenchange.lg.global${this.core.lgId} \n webkitfullscreenchange.lg.global${this.core.lgId} \n mozfullscreenchange.lg.global${this.core.lgId} \n MSFullscreenChange.lg.global${this.core.lgId}`,\n () => {\n if (!this.core.lgOpened) return;\n this.core.outer.toggleClass('lg-fullscreen-on');\n },\n );\n\n this.core.outer\n .find('.lg-fullscreen')\n .first()\n .on('click.lg', () => {\n if (this.isFullScreen()) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n });\n }\n\n closeGallery(): void {\n // exit from fullscreen if activated\n if (this.isFullScreen()) {\n this.exitFullscreen();\n }\n }\n\n destroy(): void {\n this.$LG(document).off(\n `fullscreenchange.lg.global${this.core.lgId} \n webkitfullscreenchange.lg.global${this.core.lgId} \n mozfullscreenchange.lg.global${this.core.lgId} \n MSFullscreenChange.lg.global${this.core.lgId}`,\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,IAAM,kBAAkB,GAAuB;IAClD,UAAU,EAAE,IAAI;IAChB,uBAAuB,EAAE;QACrB,gBAAgB,EAAE,mBAAmB;KACnB;CACzB;;;ICPG,oBAAY,QAAsB,EAAE,GAAY;;QAE5C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;;QAGf,IA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AAI,CAAC,IAAI,CAAC,IAAI,oDACjB,IAAI,CAAC,IAAI,CAAC,IAAI,mDACf,IAAI,CAAC,IAAI,CAAC,IAAM,CACjD,CAAC;KACL;IACL,iBAAC;AAAD,CAAC;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.5.0-beta.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l():"function"==typeof define&&define.amd?define(l):(e="undefined"!=typeof globalThis?globalThis:e||self).lgFullscreen=l()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var l,n=1,t=arguments.length;n<t;n++)for(var c in l=arguments[n])Object.prototype.hasOwnProperty.call(l,c)&&(e[c]=l[c]);return e}).apply(this,arguments)},l={fullScreen:!0};return function(){function n(n,t){return this.core=n,this.$LG=t,this.settings=e(e({},l),this.core.settings),this}return n.prototype.init=function(){var e="";if(this.settings.fullScreen){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))return;e='<button type="button" aria-label="
|
|
8
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l():"function"==typeof define&&define.amd?define(l):(e="undefined"!=typeof globalThis?globalThis:e||self).lgFullscreen=l()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var l,n=1,t=arguments.length;n<t;n++)for(var c in l=arguments[n])Object.prototype.hasOwnProperty.call(l,c)&&(e[c]=l[c]);return e}).apply(this,arguments)},l={fullScreen:!0,fullscreenPluginStrings:{toggleFullscreen:"Toggle Fullscreen"}};return function(){function n(n,t){return this.core=n,this.$LG=t,this.settings=e(e({},l),this.core.settings),this}return n.prototype.init=function(){var e="";if(this.settings.fullScreen){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))return;e='<button type="button" aria-label="'+this.settings.fullscreenPluginStrings.toggleFullscreen+'" class="lg-fullscreen lg-icon"></button>',this.core.$toolbar.append(e),this.fullScreen()}},n.prototype.isFullScreen=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},n.prototype.requestFullscreen=function(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()},n.prototype.exitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},n.prototype.fullScreen=function(){var e=this;this.$LG(document).on("fullscreenchange.lg.global"+this.core.lgId+" \n webkitfullscreenchange.lg.global"+this.core.lgId+" \n mozfullscreenchange.lg.global"+this.core.lgId+" \n MSFullscreenChange.lg.global"+this.core.lgId,(function(){e.core.lgOpened&&e.core.outer.toggleClass("lg-fullscreen-on")})),this.core.outer.find(".lg-fullscreen").first().on("click.lg",(function(){e.isFullScreen()?e.exitFullscreen():e.requestFullscreen()}))},n.prototype.closeGallery=function(){this.isFullScreen()&&this.exitFullscreen()},n.prototype.destroy=function(){this.$LG(document).off("fullscreenchange.lg.global"+this.core.lgId+" \n webkitfullscreenchange.lg.global"+this.core.lgId+" \n mozfullscreenchange.lg.global"+this.core.lgId+" \n MSFullscreenChange.lg.global"+this.core.lgId)},n}()}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.5.0-beta.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
|
|
40
40
|
var fullscreenSettings = {
|
|
41
41
|
fullScreen: true,
|
|
42
|
+
fullscreenPluginStrings: {
|
|
43
|
+
toggleFullscreen: 'Toggle Fullscreen',
|
|
44
|
+
},
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
var FullScreen = /** @class */ (function () {
|
|
@@ -61,8 +64,7 @@
|
|
|
61
64
|
return;
|
|
62
65
|
}
|
|
63
66
|
else {
|
|
64
|
-
fullScreen =
|
|
65
|
-
'<button type="button" aria-label="Toggle fullscreen" class="lg-fullscreen lg-icon"></button>';
|
|
67
|
+
fullScreen = "<button type=\"button\" aria-label=\"" + this.settings.fullscreenPluginStrings['toggleFullscreen'] + "\" class=\"lg-fullscreen lg-icon\"></button>";
|
|
66
68
|
this.core.$toolbar.append(fullScreen);
|
|
67
69
|
this.fullScreen();
|
|
68
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-fullscreen.umd.js","sources":["../../../src/plugins/fullscreen/lg-fullscreen-settings.ts","../../../src/plugins/fullscreen/lg-fullscreen.ts"],"sourcesContent":["export interface FullscreenSettings {\n /**\n * Enable/Disable fullscreen option\n */\n fullScreen: boolean;\n}\n\nexport const fullscreenSettings: FullscreenSettings = {\n fullScreen: true,\n};\n","import { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n FullscreenSettings,\n fullscreenSettings,\n} from './lg-fullscreen-settings';\n\ndeclare let document: any;\n\nexport default class FullScreen {\n core: LightGallery;\n settings: FullscreenSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // extend module default settings with lightGallery core settings\n this.settings = { ...fullscreenSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n let fullScreen = '';\n if (this.settings.fullScreen) {\n // check for fullscreen browser support\n if (\n !document.fullscreenEnabled &&\n !document.webkitFullscreenEnabled &&\n !document.mozFullScreenEnabled &&\n !document.msFullscreenEnabled\n ) {\n return;\n } else {\n fullScreen
|
|
1
|
+
{"version":3,"file":"lg-fullscreen.umd.js","sources":["../../../src/plugins/fullscreen/lg-fullscreen-settings.ts","../../../src/plugins/fullscreen/lg-fullscreen.ts"],"sourcesContent":["export interface FullscreenStrings {\n toggleFullscreen: string;\n}\nexport interface FullscreenSettings {\n /**\n * Enable/Disable fullscreen option\n */\n fullScreen: boolean;\n\n /**\n * Custom translation strings for aria-labels\n */\n fullscreenPluginStrings: FullscreenStrings;\n}\n\nexport const fullscreenSettings: FullscreenSettings = {\n fullScreen: true,\n fullscreenPluginStrings: {\n toggleFullscreen: 'Toggle Fullscreen',\n } as FullscreenStrings,\n};\n","import { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n FullscreenSettings,\n fullscreenSettings,\n} from './lg-fullscreen-settings';\n\ndeclare let document: any;\n\nexport default class FullScreen {\n core: LightGallery;\n settings: FullscreenSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // extend module default settings with lightGallery core settings\n this.settings = { ...fullscreenSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n let fullScreen = '';\n if (this.settings.fullScreen) {\n // check for fullscreen browser support\n if (\n !document.fullscreenEnabled &&\n !document.webkitFullscreenEnabled &&\n !document.mozFullScreenEnabled &&\n !document.msFullscreenEnabled\n ) {\n return;\n } else {\n fullScreen = `<button type=\"button\" aria-label=\"${this.settings.fullscreenPluginStrings['toggleFullscreen']}\" class=\"lg-fullscreen lg-icon\"></button>`;\n this.core.$toolbar.append(fullScreen);\n this.fullScreen();\n }\n }\n }\n\n private isFullScreen(): boolean {\n return (\n document.fullscreenElement ||\n document.mozFullScreenElement ||\n document.webkitFullscreenElement ||\n document.msFullscreenElement\n );\n }\n\n private requestFullscreen(): void {\n const el = document.documentElement;\n if (el.requestFullscreen) {\n el.requestFullscreen();\n } else if (el.msRequestFullscreen) {\n el.msRequestFullscreen();\n } else if (el.mozRequestFullScreen) {\n el.mozRequestFullScreen();\n } else if (el.webkitRequestFullscreen) {\n el.webkitRequestFullscreen();\n }\n }\n\n private exitFullscreen(): void {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n }\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode\n private fullScreen(): void {\n this.$LG(document).on(\n `fullscreenchange.lg.global${this.core.lgId} \n webkitfullscreenchange.lg.global${this.core.lgId} \n mozfullscreenchange.lg.global${this.core.lgId} \n MSFullscreenChange.lg.global${this.core.lgId}`,\n () => {\n if (!this.core.lgOpened) return;\n this.core.outer.toggleClass('lg-fullscreen-on');\n },\n );\n\n this.core.outer\n .find('.lg-fullscreen')\n .first()\n .on('click.lg', () => {\n if (this.isFullScreen()) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n });\n }\n\n closeGallery(): void {\n // exit from fullscreen if activated\n if (this.isFullScreen()) {\n this.exitFullscreen();\n }\n }\n\n destroy(): void {\n this.$LG(document).off(\n `fullscreenchange.lg.global${this.core.lgId} \n webkitfullscreenchange.lg.global${this.core.lgId} \n mozfullscreenchange.lg.global${this.core.lgId} \n MSFullscreenChange.lg.global${this.core.lgId}`,\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAeO,IAAM,kBAAkB,GAAuB;QAClD,UAAU,EAAE,IAAI;QAChB,uBAAuB,EAAE;YACrB,gBAAgB,EAAE,mBAAmB;SACnB;KACzB;;;QCPG,oBAAY,QAAsB,EAAE,GAAY;;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;SACJ;QAED,4BAAO,GAAP;YACI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAClB,+BAA6B,IAAI,CAAC,IAAI,CAAC,IAAI,uDACT,IAAI,CAAC,IAAI,CAAC,IAAI,oDACjB,IAAI,CAAC,IAAI,CAAC,IAAI,mDACf,IAAI,CAAC,IAAI,CAAC,IAAM,CACjD,CAAC;SACL;QACL,iBAAC;IAAD,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.5.0-beta.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -60,6 +60,9 @@ var lGEvents = {
|
|
|
60
60
|
rotateRight: 'lgRotateRight',
|
|
61
61
|
flipHorizontal: 'lgFlipHorizontal',
|
|
62
62
|
flipVertical: 'lgFlipVertical',
|
|
63
|
+
autoplay: 'lgAutoplay',
|
|
64
|
+
autoplayStart: 'lgAutoplayStart',
|
|
65
|
+
autoplayStop: 'lgAutoplayStop',
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
var hashSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-hash.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,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AE,CAAC;aAC7B;SACJ;KACJ;IAEO,2BAAY,GAApB;QACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAChC,IAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QACnC,IAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;;QAG1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE;YACrD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SACxC;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B;KACJ;IAED,2BAAY,GAAZ;QACI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YACpB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;SACvD;KACJ;IAED,sBAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,8BAA4B,IAAI,CAAC,IAAI,CAAC,IAAM,CAAC,CAAC;KACtE;IACL,WAAC;AAAD,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"lg-hash.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n autoplay: 'lgAutoplay',\n autoplayStart: 'lgAutoplayStart',\n autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,cAAc,EAAE,kBAAkB;IAClC,YAAY,EAAE,gBAAgB;IAC9B,QAAQ,EAAE,YAAY;IACtB,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,gBAAgB;CACjC;;ACnBM,IAAM,YAAY,GAAiB;IACtC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,GAAG;IACd,eAAe,EAAE,KAAK;CACzB;;;ICZG,cAAY,QAAsB,EAAE,GAAY;;QAE5C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IA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,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SACxC;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B;KACJ;IAED,2BAAY,GAAZ;QACI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YACpB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;SACvD;KACJ;IAED,sBAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,8BAA4B,IAAI,CAAC,IAAI,CAAC,IAAM,CAAC,CAAC;KACtE;IACL,WAAC;AAAD,CAAC;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.5.0-beta.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
rotateRight: 'lgRotateRight',
|
|
67
67
|
flipHorizontal: 'lgFlipHorizontal',
|
|
68
68
|
flipVertical: 'lgFlipVertical',
|
|
69
|
+
autoplay: 'lgAutoplay',
|
|
70
|
+
autoplayStart: 'lgAutoplayStart',
|
|
71
|
+
autoplayStop: 'lgAutoplayStop',
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
var hashSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-hash.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,GAEjB;QACA,gBAAgB,EAAE,oBAAoB;QACtC,IAAI,EAAE,Q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,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,8BAA4B,IAAI,CAAC,IAAI,CAAC,IAAM,CAAC,CAAC;SACtE;QACL,WAAC;IAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"lg-hash.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n autoplay: 'lgAutoplay',\n autoplayStart: 'lgAutoplayStart',\n autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,GAEjB;QACA,gBAAgB,EAAE,oBAAoB;QACtC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE,mBAAmB;QACpC,YAAY,EAAE,gBAAgB;QAC9B,kBAAkB,EAAE,sBAAsB;QAC1C,UAAU,EAAE,cAAc;QAC1B,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,iBAAiB;QAChC,WAAW,EAAE,eAAe;QAC5B,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,eAAe;QAC5B,SAAS,EAAE,aAAa;QACxB,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,WAAW;QACpB,eAAe,EAAE,mBAAmB;QACpC,eAAe,EAAE,mBAAmB;QACp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.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -60,6 +60,9 @@ var lGEvents = {
|
|
|
60
60
|
rotateRight: 'lgRotateRight',
|
|
61
61
|
flipHorizontal: 'lgFlipHorizontal',
|
|
62
62
|
flipVertical: 'lgFlipVertical',
|
|
63
|
+
autoplay: 'lgAutoplay',
|
|
64
|
+
autoplayStart: 'lgAutoplayStart',
|
|
65
|
+
autoplayStop: 'lgAutoplayStop',
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
var mediumZoomSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-medium-zoom.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,cAAc,EAAE,kBAAkB;IAClC,YAAY,EAAE,gBAAgB;CACjC;;AChBM,I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AAC,CAAC,CAAC;YAClD,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;SAC/C;KACJ;IAED,yBAAI,GAAJ;QAAA,iBAgBC;QAfG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC3B,OAAO;SACV;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAI,QAAQ,CAAC,UAAU,YAAS,EAAE;YAC/C,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CACnB,kBAAkB,EAClB,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB;gBACrD,KAAI,CAAC,QAAQ,CAAC,eAAe,CACpC,CAAC;SACL,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE;YAClC,KAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B,CAAC,CAAC;KACN;IAED,4BAAO,GAAP;QACI,IAAI,CAAC,eAAe,EAAE,CAAC;KAC1B;IACL,iBAAC;AAAD,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"lg-medium-zoom.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n autoplay: 'lgAutoplay',\n autoplayStart: 'lgAutoplayStart',\n autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,cAAc,EAAE,kBAAkB;IAClC,YAAY,EAAE,gBAAgB;IAC9B,QAAQ,EAAE,YAAY;IACtB,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,gBAAgB;CACjC;;ACnBM,IAAM,kBAAkB,GAAuB;IAClD,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,MAAM;CAC1B;;;ICTG,oBAAY,QAAsB,EAAE,GAAY;QAAhD,iBAqCC;;QAnCG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;;QAGf,IA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,CAAC,UAAU,YAAS,EAAE;YAC/C,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CACnB,kBAAkB,EAClB,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB;gBACrD,KAAI,CAAC,QAAQ,CAAC,eAAe,CACpC,CAAC;SACL,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE;YAClC,KAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B,CAAC,CAAC;KACN;IAED,4BAAO,GAAP;QACI,IAAI,CAAC,eAAe,EAAE,CAAC;KAC1B;IACL,iBAAC;AAAD,CAAC;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.5.0-beta.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
rotateRight: 'lgRotateRight',
|
|
67
67
|
flipHorizontal: 'lgFlipHorizontal',
|
|
68
68
|
flipVertical: 'lgFlipVertical',
|
|
69
|
+
autoplay: 'lgAutoplay',
|
|
70
|
+
autoplayStart: 'lgAutoplayStart',
|
|
71
|
+
autoplayStop: 'lgAutoplayStop',
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
var mediumZoomSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-medium-zoom.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,GA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;gBAClC,KAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;aAC5B,CAAC,CAAC;SACN;QAED,4BAAO,GAAP;YACI,IAAI,CAAC,eAAe,EAAE,CAAC;SAC1B;QACL,iBAAC;IAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"lg-medium-zoom.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n autoplay: 'lgAutoplay',\n autoplayStart: 'lgAutoplayStart',\n autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,GAEjB;QACA,gBAAgB,EAAE,oBAAoB;QACtC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE,mBAAmB;QACpC,YAAY,EAAE,gBAAgB;QAC9B,kBAAkB,EAAE,sBAAsB;QAC1C,UAAU,EAAE,cAAc;QAC1B,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,iBAAiB;QAChC,WAAW,EAAE,eAAe;QAC5B,UAAU,EAAE,cAAc;QAC1B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|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.5.0-beta.1 | February 24th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -60,6 +60,9 @@ var lGEvents = {
|
|
|
60
60
|
rotateRight: 'lgRotateRight',
|
|
61
61
|
flipHorizontal: 'lgFlipHorizontal',
|
|
62
62
|
flipVertical: 'lgFlipVertical',
|
|
63
|
+
autoplay: 'lgAutoplay',
|
|
64
|
+
autoplayStart: 'lgAutoplayStart',
|
|
65
|
+
autoplayStop: 'lgAutoplayStop',
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
var pagerSettings = {
|