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-pager.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/pager/lg-pager-settings.ts","../../../src/plugins/pager/lg-pager.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 PagerSettings {\n /**\n * Enable/Disable pager option\n */\n pager: boolean;\n}\n\nexport const pagerSettings: PagerSettings = {\n pager: true,\n};\n","import { lGEvents } from '../../lg-events';\nimport { GalleryItem } from '../../lg-utils';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { PagerSettings, pagerSettings } from './lg-pager-settings';\n\nexport default class Pager {\n core: LightGallery;\n settings: PagerSettings;\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 = { ...pagerSettings, ...this.core.settings };\n\n return this;\n }\n\n private getPagerHtml(items: GalleryItem[]): string {\n let pagerList = '';\n for (let i = 0; i < items.length; i++) {\n pagerList += `<span data-lg-item-id=\"${i}\" class=\"lg-pager-cont\"> \n <span data-lg-item-id=\"${i}\" class=\"lg-pager\"></span>\n <div class=\"lg-pager-thumb-cont\"><span class=\"lg-caret\"></span> <img src=\"${items[i].thumb}\" /></div>\n </span>`;\n }\n return pagerList;\n }\n\n public init(): void {\n if (!this.settings.pager) {\n return;\n }\n let timeout: any;\n this.core.$lgComponents.prepend('<div class=\"lg-pager-outer\"></div>');\n\n const $pagerOuter = this.core.outer.find('.lg-pager-outer');\n\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n\n // @todo enable click\n $pagerOuter.first().on('click.lg touchend.lg', (event: MouseEvent) => {\n const $target = this.$LG(event.target);\n if (!$target.hasAttribute('data-lg-item-id')) {\n return;\n }\n const index = parseInt($target.attr('data-lg-item-id'));\n this.core.slide(index, false, true, false);\n });\n\n $pagerOuter.first().on('mouseover.lg', () => {\n clearTimeout(timeout);\n $pagerOuter.addClass('lg-pager-hover');\n });\n\n $pagerOuter.first().on('mouseout.lg', () => {\n timeout = setTimeout(() => {\n $pagerOuter.removeClass('lg-pager-hover');\n });\n });\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.pager`, (event) => {\n const { index } = event.detail;\n this.manageActiveClass.call(this, index);\n });\n\n this.core.LGel.on(`${lGEvents.updateSlides}.pager`, () => {\n $pagerOuter.empty();\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n this.manageActiveClass(this.core.index);\n });\n }\n\n private manageActiveClass(index: number): void {\n const $pagerCont = this.core.outer.find('.lg-pager-cont');\n $pagerCont.removeClass('lg-pager-active');\n $pagerCont.eq(index).addClass('lg-pager-active');\n }\n\n destroy(): void {\n this.core.outer.find('.lg-pager-outer').remove();\n this.core.LGel.off('.lg.pager');\n this.core.LGel.off('.pager');\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,WAA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Y,WAAQ,EAAE;YAChD,WAAW,CAAC,KAAK,EAAE,CAAC;YACpB,WAAW,CAAC,IAAI,CAAC,KAAI,CAAC,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YAC5D,KAAI,CAAC,iBAAiB,CAAC,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC3C,CAAC,CAAC;KACN;IAEO,iCAAiB,GAAzB,UAA0B,KAAa;QACnC,IAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1D,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC1C,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACpD;IAED,uBAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;KAChC;IACL,YAAC;AAAD,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"lg-pager.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/pager/lg-pager-settings.ts","../../../src/plugins/pager/lg-pager.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 PagerSettings {\n /**\n * Enable/Disable pager option\n */\n pager: boolean;\n}\n\nexport const pagerSettings: PagerSettings = {\n pager: true,\n};\n","import { lGEvents } from '../../lg-events';\nimport { GalleryItem } from '../../lg-utils';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { PagerSettings, pagerSettings } from './lg-pager-settings';\n\nexport default class Pager {\n core: LightGallery;\n settings: PagerSettings;\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 = { ...pagerSettings, ...this.core.settings };\n\n return this;\n }\n\n private getPagerHtml(items: GalleryItem[]): string {\n let pagerList = '';\n for (let i = 0; i < items.length; i++) {\n pagerList += `<span data-lg-item-id=\"${i}\" class=\"lg-pager-cont\"> \n <span data-lg-item-id=\"${i}\" class=\"lg-pager\"></span>\n <div class=\"lg-pager-thumb-cont\"><span class=\"lg-caret\"></span> <img src=\"${items[i].thumb}\" /></div>\n </span>`;\n }\n return pagerList;\n }\n\n public init(): void {\n if (!this.settings.pager) {\n return;\n }\n let timeout: any;\n this.core.$lgComponents.prepend('<div class=\"lg-pager-outer\"></div>');\n\n const $pagerOuter = this.core.outer.find('.lg-pager-outer');\n\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n\n // @todo enable click\n $pagerOuter.first().on('click.lg touchend.lg', (event: MouseEvent) => {\n const $target = this.$LG(event.target);\n if (!$target.hasAttribute('data-lg-item-id')) {\n return;\n }\n const index = parseInt($target.attr('data-lg-item-id'));\n this.core.slide(index, false, true, false);\n });\n\n $pagerOuter.first().on('mouseover.lg', () => {\n clearTimeout(timeout);\n $pagerOuter.addClass('lg-pager-hover');\n });\n\n $pagerOuter.first().on('mouseout.lg', () => {\n timeout = setTimeout(() => {\n $pagerOuter.removeClass('lg-pager-hover');\n });\n });\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.pager`, (event) => {\n const { index } = event.detail;\n this.manageActiveClass.call(this, index);\n });\n\n this.core.LGel.on(`${lGEvents.updateSlides}.pager`, () => {\n $pagerOuter.empty();\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n this.manageActiveClass(this.core.index);\n });\n }\n\n private manageActiveClass(index: number): void {\n const $pagerCont = this.core.outer.find('.lg-pager-cont');\n $pagerCont.removeClass('lg-pager-active');\n $pagerCont.eq(index).addClass('lg-pager-active');\n }\n\n destroy(): void {\n this.core.outer.find('.lg-pager-outer').remove();\n this.core.LGel.off('.lg.pager');\n this.core.LGel.off('.pager');\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,E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GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1D,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC1C,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACpD;IAED,uBAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;KAChC;IACL,YAAC;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 pagerSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-pager.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/pager/lg-pager-settings.ts","../../../src/plugins/pager/lg-pager.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 PagerSettings {\n /**\n * Enable/Disable pager option\n */\n pager: boolean;\n}\n\nexport const pagerSettings: PagerSettings = {\n pager: true,\n};\n","import { lGEvents } from '../../lg-events';\nimport { GalleryItem } from '../../lg-utils';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { PagerSettings, pagerSettings } from './lg-pager-settings';\n\nexport default class Pager {\n core: LightGallery;\n settings: PagerSettings;\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 = { ...pagerSettings, ...this.core.settings };\n\n return this;\n }\n\n private getPagerHtml(items: GalleryItem[]): string {\n let pagerList = '';\n for (let i = 0; i < items.length; i++) {\n pagerList += `<span data-lg-item-id=\"${i}\" class=\"lg-pager-cont\"> \n <span data-lg-item-id=\"${i}\" class=\"lg-pager\"></span>\n <div class=\"lg-pager-thumb-cont\"><span class=\"lg-caret\"></span> <img src=\"${items[i].thumb}\" /></div>\n </span>`;\n }\n return pagerList;\n }\n\n public init(): void {\n if (!this.settings.pager) {\n return;\n }\n let timeout: any;\n this.core.$lgComponents.prepend('<div class=\"lg-pager-outer\"></div>');\n\n const $pagerOuter = this.core.outer.find('.lg-pager-outer');\n\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n\n // @todo enable click\n $pagerOuter.first().on('click.lg touchend.lg', (event: MouseEvent) => {\n const $target = this.$LG(event.target);\n if (!$target.hasAttribute('data-lg-item-id')) {\n return;\n }\n const index = parseInt($target.attr('data-lg-item-id'));\n this.core.slide(index, false, true, false);\n });\n\n $pagerOuter.first().on('mouseover.lg', () => {\n clearTimeout(timeout);\n $pagerOuter.addClass('lg-pager-hover');\n });\n\n $pagerOuter.first().on('mouseout.lg', () => {\n timeout = setTimeout(() => {\n $pagerOuter.removeClass('lg-pager-hover');\n });\n });\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.pager`, (event) => {\n const { index } = event.detail;\n this.manageActiveClass.call(this, index);\n });\n\n this.core.LGel.on(`${lGEvents.updateSlides}.pager`, () => {\n $pagerOuter.empty();\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n this.manageActiveClass(this.core.index);\n });\n }\n\n private manageActiveClass(index: number): void {\n const $pagerCont = this.core.outer.find('.lg-pager-cont');\n $pagerCont.removeClass('lg-pager-active');\n $pagerCont.eq(index).addClass('lg-pager-active');\n }\n\n destroy(): void {\n this.core.outer.find('.lg-pager-outer').remove();\n this.core.LGel.off('.lg.pager');\n this.core.LGel.off('.pager');\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;QACpC,WAAW,EAAE,eAAe;QAC5B,UAAU,EAAE,cAAc;QAC1B,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,eAAe;QAC5B,cAAc,EAAE,kBAAkB;QAClC,YAAY,EAAE,gBAAgB;KACjC;;IC3BM,IAAM,aAAa,GAAkB;QACxC,KAAK,EAAE,IAAI;KACd;;;QCCG,eAAY,QAAsB,EAAE,GAAY;;YAE5C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;YACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;;YAEf,IAAI,CAAC,QAAQ,yBAAQ,aAAa,GAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAC;YAE5D,OAAO,IAAI,CAAC;SACf;QAEO,4BAAY,GAApB,UAAqB,KAAoB;YACrC,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,KAAK,IAAI,CAA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AAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAChC;QACL,YAAC;IAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"lg-pager.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/pager/lg-pager-settings.ts","../../../src/plugins/pager/lg-pager.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 PagerSettings {\n /**\n * Enable/Disable pager option\n */\n pager: boolean;\n}\n\nexport const pagerSettings: PagerSettings = {\n pager: true,\n};\n","import { lGEvents } from '../../lg-events';\nimport { GalleryItem } from '../../lg-utils';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { PagerSettings, pagerSettings } from './lg-pager-settings';\n\nexport default class Pager {\n core: LightGallery;\n settings: PagerSettings;\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 = { ...pagerSettings, ...this.core.settings };\n\n return this;\n }\n\n private getPagerHtml(items: GalleryItem[]): string {\n let pagerList = '';\n for (let i = 0; i < items.length; i++) {\n pagerList += `<span data-lg-item-id=\"${i}\" class=\"lg-pager-cont\"> \n <span data-lg-item-id=\"${i}\" class=\"lg-pager\"></span>\n <div class=\"lg-pager-thumb-cont\"><span class=\"lg-caret\"></span> <img src=\"${items[i].thumb}\" /></div>\n </span>`;\n }\n return pagerList;\n }\n\n public init(): void {\n if (!this.settings.pager) {\n return;\n }\n let timeout: any;\n this.core.$lgComponents.prepend('<div class=\"lg-pager-outer\"></div>');\n\n const $pagerOuter = this.core.outer.find('.lg-pager-outer');\n\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n\n // @todo enable click\n $pagerOuter.first().on('click.lg touchend.lg', (event: MouseEvent) => {\n const $target = this.$LG(event.target);\n if (!$target.hasAttribute('data-lg-item-id')) {\n return;\n }\n const index = parseInt($target.attr('data-lg-item-id'));\n this.core.slide(index, false, true, false);\n });\n\n $pagerOuter.first().on('mouseover.lg', () => {\n clearTimeout(timeout);\n $pagerOuter.addClass('lg-pager-hover');\n });\n\n $pagerOuter.first().on('mouseout.lg', () => {\n timeout = setTimeout(() => {\n $pagerOuter.removeClass('lg-pager-hover');\n });\n });\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.pager`, (event) => {\n const { index } = event.detail;\n this.manageActiveClass.call(this, index);\n });\n\n this.core.LGel.on(`${lGEvents.updateSlides}.pager`, () => {\n $pagerOuter.empty();\n $pagerOuter.html(this.getPagerHtml(this.core.galleryItems));\n this.manageActiveClass(this.core.index);\n });\n }\n\n private manageActiveClass(index: number): void {\n const $pagerCont = this.core.outer.find('.lg-pager-cont');\n $pagerCont.removeClass('lg-pager-active');\n $pagerCont.eq(index).addClass('lg-pager-active');\n }\n\n destroy(): void {\n this.core.outer.find('.lg-pager-outer').remove();\n this.core.LGel.off('.lg.pager');\n this.core.LGel.off('.pager');\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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|
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 relativeCaptionSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-relative-caption.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/relativeCaption/lg-relative-caption-settings.ts","../../../src/plugins/relativeCaption/lg-relative-caption.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 RelativeCaptionSettings {\n /**\n * Enable/Disable relative captions\n */\n relativeCaption: boolean;\n}\n\nexport const relativeCaptionSettings: RelativeCaptionSettings = {\n relativeCaption: false,\n};\n","/**\n * lightGallery caption for placing captions relative to the image\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LightGallery } from '../../lightgallery';\nimport {\n RelativeCaptionSettings,\n relativeCaptionSettings,\n} from './lg-relative-caption-settings';\n\nexport default class RelativeCaption {\n core: LightGallery;\n settings: RelativeCaptionSettings;\n constructor(instance: LightGallery) {\n // get lightGallery core plugin instance\n this.core = instance;\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n addClass: this.core.settings.addClass + ' lg-relative-caption',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...relativeCaptionSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n init(): void {\n if (!this.settings.relativeCaption) {\n return;\n }\n this.core.LGel.on(`${lGEvents.slideItemLoad}.caption`, (event) => {\n const { index, delay } = event.detail;\n setTimeout(() => {\n if (index === this.core.index) {\n this.setRelativeCaption(index);\n }\n }, delay);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-complete')) {\n this.setRelativeCaption(index);\n }\n });\n });\n this.core.LGel.on(`${lGEvents.beforeSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n slide.removeClass('lg-show-caption');\n });\n });\n this.core.LGel.on(`${lGEvents.containerResize}.caption`, (event) => {\n this.setRelativeCaption(this.core.index);\n });\n }\n\n private setCaptionStyle(\n index: number,\n rect: ClientRect,\n slideWrapRect: ClientRect,\n ) {\n const $subHtmlInner = this.core\n .getSlideItem(index)\n .find('.lg-relative-caption-item');\n const $subHtml = this.core.getSlideItem(index).find('.lg-sub-html');\n $subHtml.css('width', `${rect.width}px`).css('left', `${rect.left}px`);\n const subHtmlRect = $subHtmlInner.get().getBoundingClientRect();\n const bottom = slideWrapRect.bottom - rect.bottom - subHtmlRect.height;\n $subHtml.css('top', `auto`).css('bottom', `${Math.max(bottom, 0)}px`);\n }\n\n private setRelativeCaption(index: number) {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-current')) {\n const rect = this.core\n .getSlideItem(index)\n .find('.lg-object')\n .get()\n .getBoundingClientRect();\n const slideWrapRect = this.core\n .getSlideItem(index)\n .get()\n .getBoundingClientRect();\n this.setCaptionStyle(index, rect, slideWrapRect);\n slide.addClass('lg-show-caption');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.caption');\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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":["../../../src/lg-events.ts","../../../src/plugins/relativeCaption/lg-relative-caption-settings.ts","../../../src/plugins/relativeCaption/lg-relative-caption.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 RelativeCaptionSettings {\n /**\n * Enable/Disable relative captions\n */\n relativeCaption: boolean;\n}\n\nexport const relativeCaptionSettings: RelativeCaptionSettings = {\n relativeCaption: false,\n};\n","/**\n * lightGallery caption for placing captions relative to the image\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LightGallery } from '../../lightgallery';\nimport {\n RelativeCaptionSettings,\n relativeCaptionSettings,\n} from './lg-relative-caption-settings';\n\nexport default class RelativeCaption {\n core: LightGallery;\n settings: RelativeCaptionSettings;\n constructor(instance: LightGallery) {\n // get lightGallery core plugin instance\n this.core = instance;\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n addClass: this.core.settings.addClass + ' lg-relative-caption',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...relativeCaptionSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n init(): void {\n if (!this.settings.relativeCaption) {\n return;\n }\n this.core.LGel.on(`${lGEvents.slideItemLoad}.caption`, (event) => {\n const { index, delay } = event.detail;\n setTimeout(() => {\n if (index === this.core.index) {\n this.setRelativeCaption(index);\n }\n }, delay);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-complete')) {\n this.setRelativeCaption(index);\n }\n });\n });\n this.core.LGel.on(`${lGEvents.beforeSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n slide.removeClass('lg-show-caption');\n });\n });\n this.core.LGel.on(`${lGEvents.containerResize}.caption`, (event) => {\n this.setRelativeCaption(this.core.index);\n });\n }\n\n private setCaptionStyle(\n index: number,\n rect: ClientRect,\n slideWrapRect: ClientRect,\n ) {\n const $subHtmlInner = this.core\n .getSlideItem(index)\n .find('.lg-relative-caption-item');\n const $subHtml = this.core.getSlideItem(index).find('.lg-sub-html');\n $subHtml.css('width', `${rect.width}px`).css('left', `${rect.left}px`);\n const subHtmlRect = $subHtmlInner.get().getBoundingClientRect();\n const bottom = slideWrapRect.bottom - rect.bottom - subHtmlRect.height;\n $subHtml.css('top', `auto`).css('bottom', `${Math.max(bottom, 0)}px`);\n }\n\n private setRelativeCaption(index: number) {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-current')) {\n const rect = this.core\n .getSlideItem(index)\n .find('.lg-object')\n .get()\n .getBoundingClientRect();\n const slideWrapRect = this.core\n .getSlideItem(index)\n .get()\n .getBoundingClientRect();\n this.setCaptionStyle(index, rect, slideWrapRect);\n slide.addClass('lg-show-caption');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.caption');\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,YAA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AE,IAAI,EAAE,aAAa,CAAC,CAAC;YACjD,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;SACrC;KACJ;IAED,iCAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;KAClC;IACL,sBAAC;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 relativeCaptionSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-relative-caption.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/relativeCaption/lg-relative-caption-settings.ts","../../../src/plugins/relativeCaption/lg-relative-caption.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 RelativeCaptionSettings {\n /**\n * Enable/Disable relative captions\n */\n relativeCaption: boolean;\n}\n\nexport const relativeCaptionSettings: RelativeCaptionSettings = {\n relativeCaption: false,\n};\n","/**\n * lightGallery caption for placing captions relative to the image\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LightGallery } from '../../lightgallery';\nimport {\n RelativeCaptionSettings,\n relativeCaptionSettings,\n} from './lg-relative-caption-settings';\n\nexport default class RelativeCaption {\n core: LightGallery;\n settings: RelativeCaptionSettings;\n constructor(instance: LightGallery) {\n // get lightGallery core plugin instance\n this.core = instance;\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n addClass: this.core.settings.addClass + ' lg-relative-caption',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...relativeCaptionSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n init(): void {\n if (!this.settings.relativeCaption) {\n return;\n }\n this.core.LGel.on(`${lGEvents.slideItemLoad}.caption`, (event) => {\n const { index, delay } = event.detail;\n setTimeout(() => {\n if (index === this.core.index) {\n this.setRelativeCaption(index);\n }\n }, delay);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-complete')) {\n this.setRelativeCaption(index);\n }\n });\n });\n this.core.LGel.on(`${lGEvents.beforeSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n slide.removeClass('lg-show-caption');\n });\n });\n this.core.LGel.on(`${lGEvents.containerResize}.caption`, (event) => {\n this.setRelativeCaption(this.core.index);\n });\n }\n\n private setCaptionStyle(\n index: number,\n rect: ClientRect,\n slideWrapRect: ClientRect,\n ) {\n const $subHtmlInner = this.core\n .getSlideItem(index)\n .find('.lg-relative-caption-item');\n const $subHtml = this.core.getSlideItem(index).find('.lg-sub-html');\n $subHtml.css('width', `${rect.width}px`).css('left', `${rect.left}px`);\n const subHtmlRect = $subHtmlInner.get().getBoundingClientRect();\n const bottom = slideWrapRect.bottom - rect.bottom - subHtmlRect.height;\n $subHtml.css('top', `auto`).css('bottom', `${Math.max(bottom, 0)}px`);\n }\n\n private setRelativeCaption(index: number) {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-current')) {\n const rect = this.core\n .getSlideItem(index)\n .find('.lg-object')\n .get()\n .getBoundingClientRect();\n const slideWrapRect = this.core\n .getSlideItem(index)\n .get()\n .getBoundingClientRect();\n this.setCaptionStyle(index, rect, slideWrapRect);\n slide.addClass('lg-show-caption');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.caption');\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AC7B,IAAM,aAAa,GAAG,IAAI,CAAC,IAAI;qBAC1B,YAAY,CAAC,KAAK,CAAC;qBACnB,GAAG,EAAE;qBACL,qBAAqB,EAAE,CAAC;gBAC7B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;gBACjD,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;aACrC;SACJ;QAED,iCAAO,GAAP;YACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAClC;QACL,sBAAC;IAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"lg-relative-caption.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/relativeCaption/lg-relative-caption-settings.ts","../../../src/plugins/relativeCaption/lg-relative-caption.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 RelativeCaptionSettings {\n /**\n * Enable/Disable relative captions\n */\n relativeCaption: boolean;\n}\n\nexport const relativeCaptionSettings: RelativeCaptionSettings = {\n relativeCaption: false,\n};\n","/**\n * lightGallery caption for placing captions relative to the image\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LightGallery } from '../../lightgallery';\nimport {\n RelativeCaptionSettings,\n relativeCaptionSettings,\n} from './lg-relative-caption-settings';\n\nexport default class RelativeCaption {\n core: LightGallery;\n settings: RelativeCaptionSettings;\n constructor(instance: LightGallery) {\n // get lightGallery core plugin instance\n this.core = instance;\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n addClass: this.core.settings.addClass + ' lg-relative-caption',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...relativeCaptionSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n init(): void {\n if (!this.settings.relativeCaption) {\n return;\n }\n this.core.LGel.on(`${lGEvents.slideItemLoad}.caption`, (event) => {\n const { index, delay } = event.detail;\n setTimeout(() => {\n if (index === this.core.index) {\n this.setRelativeCaption(index);\n }\n }, delay);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-complete')) {\n this.setRelativeCaption(index);\n }\n });\n });\n this.core.LGel.on(`${lGEvents.beforeSlide}.caption`, (event) => {\n const { index } = event.detail;\n setTimeout(() => {\n const slide = this.core.getSlideItem(index);\n slide.removeClass('lg-show-caption');\n });\n });\n this.core.LGel.on(`${lGEvents.containerResize}.caption`, (event) => {\n this.setRelativeCaption(this.core.index);\n });\n }\n\n private setCaptionStyle(\n index: number,\n rect: ClientRect,\n slideWrapRect: ClientRect,\n ) {\n const $subHtmlInner = this.core\n .getSlideItem(index)\n .find('.lg-relative-caption-item');\n const $subHtml = this.core.getSlideItem(index).find('.lg-sub-html');\n $subHtml.css('width', `${rect.width}px`).css('left', `${rect.left}px`);\n const subHtmlRect = $subHtmlInner.get().getBoundingClientRect();\n const bottom = slideWrapRect.bottom - rect.bottom - subHtmlRect.height;\n $subHtml.css('top', `auto`).css('bottom', `${Math.max(bottom, 0)}px`);\n }\n\n private setRelativeCaption(index: number) {\n const slide = this.core.getSlideItem(index);\n if (slide.hasClass('lg-current')) {\n const rect = this.core\n .getSlideItem(index)\n .find('.lg-object')\n .get()\n .getBoundingClientRect();\n const slideWrapRect = this.core\n .getSlideItem(index)\n .get()\n .getBoundingClientRect();\n this.setCaptionStyle(index, rect, slideWrapRect);\n slide.addClass('lg-show-caption');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.caption');\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;QACpC,WAAW,EAAE,eAAe;QAC5B,UAAU,EAAE,cAAc;QAC1B,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,eAAe;QAC5B,cAAc,EAAE,kBAAkB;QAClC,YAAY,EAAE,gBAAgB;QAC9B,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,iBAAiB;QAChC,YAAY,EAAE,gBAAgB;KACjC;;IC9BM,IAAM,uBAAuB,GAA4B;QAC5D,eAAe,EAAE,KAAK;KACzB;;ICTD;;;;QAeI,yBAAY,QAAsB;;YAE9B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;;YAGrB,IAAM,eAAe,GAAkC;gBACnD,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ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KAAa;YACpC,IAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBAC9B,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI;qBACjB,YAAY,CAAC,KAAK,CAAC;qBACnB,IAAI,CAAC,YAAY,CAAC;qBAClB,GAAG,EAAE;qBACL,qBAAqB,EAAE,CAAC;gBAC7B,IAAM,aAAa,GAAG,IAAI,CAAC,IAAI;qBAC1B,YAAY,CAAC,KAAK,CAAC;qBACnB,GAAG,EAAE;qBACL,qBAAqB,EAAE,CAAC;gBAC7B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;gBACjD,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;aACrC;SACJ;QAED,iCAAO,GAAP;YACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAClC;QACL,sBAAC;IAAD,CAAC;;;;"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export interface RotateStrings {
|
|
2
|
+
flipVertical: string;
|
|
3
|
+
flipHorizontal: string;
|
|
4
|
+
rotateLeft: string;
|
|
5
|
+
rotateRight: string;
|
|
6
|
+
}
|
|
1
7
|
export interface RotateSettings {
|
|
2
8
|
/**
|
|
3
9
|
* Enable/Disable rotate option
|
|
@@ -23,6 +29,10 @@ export interface RotateSettings {
|
|
|
23
29
|
* Enable flip vertical.
|
|
24
30
|
*/
|
|
25
31
|
flipVertical: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom translation strings for aria-labels
|
|
34
|
+
*/
|
|
35
|
+
rotatePluginStrings: RotateStrings;
|
|
26
36
|
}
|
|
27
37
|
export declare const rotateSettings: {
|
|
28
38
|
rotate: boolean;
|
|
@@ -31,4 +41,5 @@ export declare const rotateSettings: {
|
|
|
31
41
|
rotateRight: boolean;
|
|
32
42
|
flipHorizontal: boolean;
|
|
33
43
|
flipVertical: boolean;
|
|
44
|
+
rotatePluginStrings: RotateStrings;
|
|
34
45
|
};
|
|
@@ -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 rotateSettings = {
|
|
@@ -69,6 +72,12 @@ var rotateSettings = {
|
|
|
69
72
|
rotateRight: true,
|
|
70
73
|
flipHorizontal: true,
|
|
71
74
|
flipVertical: true,
|
|
75
|
+
rotatePluginStrings: {
|
|
76
|
+
flipVertical: 'Flip vertical',
|
|
77
|
+
flipHorizontal: 'Flip horizontal',
|
|
78
|
+
rotateLeft: 'Rotate left',
|
|
79
|
+
rotateRight: 'Rotate right',
|
|
80
|
+
},
|
|
72
81
|
};
|
|
73
82
|
|
|
74
83
|
var Rotate = /** @class */ (function () {
|
|
@@ -83,20 +92,16 @@ var Rotate = /** @class */ (function () {
|
|
|
83
92
|
Rotate.prototype.buildTemplates = function () {
|
|
84
93
|
var rotateIcons = '';
|
|
85
94
|
if (this.settings.flipVertical) {
|
|
86
|
-
rotateIcons +=
|
|
87
|
-
'<button type="button" id="lg-flip-ver" aria-label="flip vertical" class="lg-flip-ver lg-icon"></button>';
|
|
95
|
+
rotateIcons += "<button type=\"button\" id=\"lg-flip-ver\" aria-label=\"" + this.settings.rotatePluginStrings['flipVertical'] + "\" class=\"lg-flip-ver lg-icon\"></button>";
|
|
88
96
|
}
|
|
89
97
|
if (this.settings.flipHorizontal) {
|
|
90
|
-
rotateIcons +=
|
|
91
|
-
'<button type="button" id="lg-flip-hor" aria-label="Flip horizontal" class="lg-flip-hor lg-icon"></button>';
|
|
98
|
+
rotateIcons += "<button type=\"button\" id=\"lg-flip-hor\" aria-label=\"" + this.settings.rotatePluginStrings['flipHorizontal'] + "\" class=\"lg-flip-hor lg-icon\"></button>";
|
|
92
99
|
}
|
|
93
100
|
if (this.settings.rotateLeft) {
|
|
94
|
-
rotateIcons +=
|
|
95
|
-
'<button type="button" id="lg-rotate-left" aria-label="Rotate left" class="lg-rotate-left lg-icon"></button>';
|
|
101
|
+
rotateIcons += "<button type=\"button\" id=\"lg-rotate-left\" aria-label=\"" + this.settings.rotatePluginStrings['rotateLeft'] + "\" class=\"lg-rotate-left lg-icon\"></button>";
|
|
96
102
|
}
|
|
97
103
|
if (this.settings.rotateRight) {
|
|
98
|
-
rotateIcons +=
|
|
99
|
-
'<button type="button" id="lg-rotate-right" aria-label="Rotate right" class="lg-rotate-right lg-icon"></button>';
|
|
104
|
+
rotateIcons += "<button type=\"button\" id=\"lg-rotate-right\" aria-label=\"" + this.settings.rotatePluginStrings['rotateRight'] + "\" class=\"lg-rotate-right lg-icon\"></button>";
|
|
100
105
|
}
|
|
101
106
|
this.core.$toolbar.append(rotateIcons);
|
|
102
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lg-rotate.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/rotate/lg-rotate-settings.ts","../../../src/plugins/rotate/lg-rotate.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 RotateSettings {\n /**\n * Enable/Disable rotate option\n */\n rotate: boolean;\n\n /**\n * Rotate speed in milliseconds\n */\n rotateSpeed: number;\n\n /**\n * Enable rotate left.\n */\n rotateLeft: boolean;\n\n /**\n * Enable rotate right.\n */\n rotateRight: boolean;\n\n /**\n * Enable flip horizontal.\n */\n flipHorizontal: boolean;\n\n /**\n * Enable flip vertical.\n */\n flipVertical: boolean;\n}\nexport const rotateSettings = {\n rotate: true,\n rotateSpeed: 400,\n rotateLeft: true,\n rotateRight: true,\n flipHorizontal: true,\n flipVertical: true,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { rotateSettings, RotateSettings } from './lg-rotate-settings';\n\nexport default class Rotate {\n core: LightGallery;\n settings: RotateSettings;\n rotateValuesList!: {\n [key: string]: any;\n };\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 = { ...rotateSettings, ...this.core.settings };\n\n return this;\n }\n buildTemplates(): void {\n let rotateIcons = '';\n if (this.settings.flipVertical) {\n rotateIcons +=\n '<button type=\"button\" id=\"lg-flip-ver\" aria-label=\"flip vertical\" class=\"lg-flip-ver lg-icon\"></button>';\n }\n if (this.settings.flipHorizontal) {\n rotateIcons +=\n '<button type=\"button\" id=\"lg-flip-hor\" aria-label=\"Flip horizontal\" class=\"lg-flip-hor lg-icon\"></button>';\n }\n if (this.settings.rotateLeft) {\n rotateIcons +=\n '<button type=\"button\" id=\"lg-rotate-left\" aria-label=\"Rotate left\" class=\"lg-rotate-left lg-icon\"></button>';\n }\n if (this.settings.rotateRight) {\n rotateIcons +=\n '<button type=\"button\" id=\"lg-rotate-right\" aria-label=\"Rotate right\" class=\"lg-rotate-right lg-icon\"></button>';\n }\n this.core.$toolbar.append(rotateIcons);\n }\n\n init(): void {\n if (!this.settings.rotate) {\n return;\n }\n this.buildTemplates();\n\n // Save rotate config for each item to persist its rotate, flip values\n // even after navigating to diferent slides\n this.rotateValuesList = {};\n\n // event triggered after appending slide content\n this.core.LGel.on(`${lGEvents.afterAppendSlide}.rotate`, (event) => {\n const { index } = event.detail;\n const imageWrap = this.core\n .getSlideItem(index)\n .find('.lg-img-wrap')\n .first();\n\n imageWrap.wrap('lg-img-rotate');\n this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .css('transition-duration', this.settings.rotateSpeed + 'ms');\n });\n\n this.core.outer\n .find('#lg-rotate-left')\n .first()\n .on('click.lg', this.rotateLeft.bind(this));\n\n this.core.outer\n .find('#lg-rotate-right')\n .first()\n .on('click.lg', this.rotateRight.bind(this));\n\n this.core.outer\n .find('#lg-flip-hor')\n .first()\n .on('click.lg', this.flipHorizontal.bind(this));\n\n this.core.outer\n .find('#lg-flip-ver')\n .first()\n .on('click.lg', this.flipVertical.bind(this));\n\n // Reset rotate on slide change\n this.core.LGel.on(`${lGEvents.beforeSlide}.rotate`, (event) => {\n if (!this.rotateValuesList[event.detail.index]) {\n this.rotateValuesList[event.detail.index] = {\n rotate: 0,\n flipHorizontal: 1,\n flipVertical: 1,\n };\n }\n });\n }\n\n applyStyles(): void {\n const $image = this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .first();\n\n $image.css(\n 'transform',\n 'rotate(' +\n this.rotateValuesList[this.core.index].rotate +\n 'deg)' +\n ' scale3d(' +\n this.rotateValuesList[this.core.index].flipHorizontal +\n ', ' +\n this.rotateValuesList[this.core.index].flipVertical +\n ', 1)',\n );\n }\n\n rotateLeft(): void {\n this.rotateValuesList[this.core.index].rotate -= 90;\n this.applyStyles();\n this.triggerEvents(lGEvents.rotateLeft, {\n rotate: this.rotateValuesList[this.core.index].rotate,\n });\n }\n\n rotateRight(): void {\n this.rotateValuesList[this.core.index].rotate += 90;\n this.applyStyles();\n this.triggerEvents(lGEvents.rotateRight, {\n rotate: this.rotateValuesList[this.core.index].rotate,\n });\n }\n\n getCurrentRotation(el: HTMLElement): number {\n if (!el) {\n return 0;\n }\n const st = this.$LG(el).style();\n const tm =\n st.getPropertyValue('-webkit-transform') ||\n st.getPropertyValue('-moz-transform') ||\n st.getPropertyValue('-ms-transform') ||\n st.getPropertyValue('-o-transform') ||\n st.getPropertyValue('transform') ||\n 'none';\n if (tm !== 'none') {\n const values = tm.split('(')[1].split(')')[0].split(',') as any;\n if (values) {\n const angle = Math.round(\n Math.atan2(values[1], values[0]) * (180 / Math.PI),\n );\n return angle < 0 ? angle + 360 : angle;\n }\n }\n return 0;\n }\n\n flipHorizontal(): void {\n const rotateEl = this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .first()\n .get();\n const currentRotation = this.getCurrentRotation(rotateEl);\n let rotateAxis = 'flipHorizontal';\n if (currentRotation === 90 || currentRotation === 270) {\n rotateAxis = 'flipVertical';\n }\n this.rotateValuesList[this.core.index][rotateAxis] *= -1;\n this.applyStyles();\n this.triggerEvents(lGEvents.flipHorizontal, {\n flipHorizontal: this.rotateValuesList[this.core.index][rotateAxis],\n });\n }\n\n flipVertical(): void {\n const rotateEl = this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .first()\n .get();\n const currentRotation = this.getCurrentRotation(rotateEl);\n let rotateAxis = 'flipVertical';\n if (currentRotation === 90 || currentRotation === 270) {\n rotateAxis = 'flipHorizontal';\n }\n this.rotateValuesList[this.core.index][rotateAxis] *= -1;\n\n this.applyStyles();\n\n this.triggerEvents(lGEvents.flipVertical, {\n flipVertical: this.rotateValuesList[this.core.index][rotateAxis],\n });\n }\n\n triggerEvents(event: string, detail: any): void {\n setTimeout(() => {\n this.core.LGel.trigger(event, detail);\n }, this.settings.rotateSpeed + 10);\n }\n\n isImageOrientationChanged(): boolean {\n const rotateValue = this.rotateValuesList[this.core.index];\n const isRotated = Math.abs(rotateValue.rotate) % 360 !== 0;\n const ifFlippedHor = rotateValue.flipHorizontal < 0;\n const ifFlippedVer = rotateValue.flipVertical < 0;\n return isRotated || ifFlippedHor || ifFlippedVer;\n }\n\n closeGallery(): void {\n if (this.isImageOrientationChanged()) {\n this.core.getSlideItem(this.core.index).css('opacity', 0);\n }\n this.rotateValuesList = {};\n }\n\n destroy(): void {\n // Unbind all events added by lightGallery rotate plugin\n this.core.LGel.off('.lg.rotate');\n this.core.LGel.off('.rotate');\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,YAAY,GAAG,WAAW,CAAC,cAAc,GAAG,CAAC,CAAC;QACpD,IAAM,YAAY,GAAG,WAAW,CAAC,YAAY,GAAG,CAAC,CAAC;QAClD,OAAO,SAAS,IAAI,YAAY,IAAI,YAAY,CAAC;KACpD;IAED,6BAAY,GAAZ;QACI,IAAI,IAAI,CAAC,yBAAyB,EAAE,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;SAC7D;QACD,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;KAC9B;IAED,wBAAO,GAAP;;QAEI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;KACjC;IACL,aAAC;AAAD,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"lg-rotate.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/rotate/lg-rotate-settings.ts","../../../src/plugins/rotate/lg-rotate.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 RotateStrings {\n flipVertical: string;\n flipHorizontal: string;\n rotateLeft: string;\n rotateRight: string;\n}\n\nexport interface RotateSettings {\n /**\n * Enable/Disable rotate option\n */\n rotate: boolean;\n\n /**\n * Rotate speed in milliseconds\n */\n rotateSpeed: number;\n\n /**\n * Enable rotate left.\n */\n rotateLeft: boolean;\n\n /**\n * Enable rotate right.\n */\n rotateRight: boolean;\n\n /**\n * Enable flip horizontal.\n */\n flipHorizontal: boolean;\n\n /**\n * Enable flip vertical.\n */\n flipVertical: boolean;\n\n /**\n * Custom translation strings for aria-labels\n */\n rotatePluginStrings: RotateStrings;\n}\nexport const rotateSettings = {\n rotate: true,\n rotateSpeed: 400,\n rotateLeft: true,\n rotateRight: true,\n flipHorizontal: true,\n flipVertical: true,\n rotatePluginStrings: {\n flipVertical: 'Flip vertical',\n flipHorizontal: 'Flip horizontal',\n rotateLeft: 'Rotate left',\n rotateRight: 'Rotate right',\n } as RotateStrings,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { rotateSettings, RotateSettings } from './lg-rotate-settings';\n\nexport default class Rotate {\n core: LightGallery;\n settings: RotateSettings;\n rotateValuesList!: {\n [key: string]: any;\n };\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 = { ...rotateSettings, ...this.core.settings };\n\n return this;\n }\n buildTemplates(): void {\n let rotateIcons = '';\n if (this.settings.flipVertical) {\n rotateIcons += `<button type=\"button\" id=\"lg-flip-ver\" aria-label=\"${this.settings.rotatePluginStrings['flipVertical']}\" class=\"lg-flip-ver lg-icon\"></button>`;\n }\n if (this.settings.flipHorizontal) {\n rotateIcons += `<button type=\"button\" id=\"lg-flip-hor\" aria-label=\"${this.settings.rotatePluginStrings['flipHorizontal']}\" class=\"lg-flip-hor lg-icon\"></button>`;\n }\n if (this.settings.rotateLeft) {\n rotateIcons += `<button type=\"button\" id=\"lg-rotate-left\" aria-label=\"${this.settings.rotatePluginStrings['rotateLeft']}\" class=\"lg-rotate-left lg-icon\"></button>`;\n }\n if (this.settings.rotateRight) {\n rotateIcons += `<button type=\"button\" id=\"lg-rotate-right\" aria-label=\"${this.settings.rotatePluginStrings['rotateRight']}\" class=\"lg-rotate-right lg-icon\"></button>`;\n }\n this.core.$toolbar.append(rotateIcons);\n }\n\n init(): void {\n if (!this.settings.rotate) {\n return;\n }\n this.buildTemplates();\n\n // Save rotate config for each item to persist its rotate, flip values\n // even after navigating to diferent slides\n this.rotateValuesList = {};\n\n // event triggered after appending slide content\n this.core.LGel.on(`${lGEvents.afterAppendSlide}.rotate`, (event) => {\n const { index } = event.detail;\n const imageWrap = this.core\n .getSlideItem(index)\n .find('.lg-img-wrap')\n .first();\n\n imageWrap.wrap('lg-img-rotate');\n this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .css('transition-duration', this.settings.rotateSpeed + 'ms');\n });\n\n this.core.outer\n .find('#lg-rotate-left')\n .first()\n .on('click.lg', this.rotateLeft.bind(this));\n\n this.core.outer\n .find('#lg-rotate-right')\n .first()\n .on('click.lg', this.rotateRight.bind(this));\n\n this.core.outer\n .find('#lg-flip-hor')\n .first()\n .on('click.lg', this.flipHorizontal.bind(this));\n\n this.core.outer\n .find('#lg-flip-ver')\n .first()\n .on('click.lg', this.flipVertical.bind(this));\n\n // Reset rotate on slide change\n this.core.LGel.on(`${lGEvents.beforeSlide}.rotate`, (event) => {\n if (!this.rotateValuesList[event.detail.index]) {\n this.rotateValuesList[event.detail.index] = {\n rotate: 0,\n flipHorizontal: 1,\n flipVertical: 1,\n };\n }\n });\n }\n\n applyStyles(): void {\n const $image = this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .first();\n\n $image.css(\n 'transform',\n 'rotate(' +\n this.rotateValuesList[this.core.index].rotate +\n 'deg)' +\n ' scale3d(' +\n this.rotateValuesList[this.core.index].flipHorizontal +\n ', ' +\n this.rotateValuesList[this.core.index].flipVertical +\n ', 1)',\n );\n }\n\n rotateLeft(): void {\n this.rotateValuesList[this.core.index].rotate -= 90;\n this.applyStyles();\n this.triggerEvents(lGEvents.rotateLeft, {\n rotate: this.rotateValuesList[this.core.index].rotate,\n });\n }\n\n rotateRight(): void {\n this.rotateValuesList[this.core.index].rotate += 90;\n this.applyStyles();\n this.triggerEvents(lGEvents.rotateRight, {\n rotate: this.rotateValuesList[this.core.index].rotate,\n });\n }\n\n getCurrentRotation(el: HTMLElement): number {\n if (!el) {\n return 0;\n }\n const st = this.$LG(el).style();\n const tm =\n st.getPropertyValue('-webkit-transform') ||\n st.getPropertyValue('-moz-transform') ||\n st.getPropertyValue('-ms-transform') ||\n st.getPropertyValue('-o-transform') ||\n st.getPropertyValue('transform') ||\n 'none';\n if (tm !== 'none') {\n const values = tm.split('(')[1].split(')')[0].split(',') as any;\n if (values) {\n const angle = Math.round(\n Math.atan2(values[1], values[0]) * (180 / Math.PI),\n );\n return angle < 0 ? angle + 360 : angle;\n }\n }\n return 0;\n }\n\n flipHorizontal(): void {\n const rotateEl = this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .first()\n .get();\n const currentRotation = this.getCurrentRotation(rotateEl);\n let rotateAxis = 'flipHorizontal';\n if (currentRotation === 90 || currentRotation === 270) {\n rotateAxis = 'flipVertical';\n }\n this.rotateValuesList[this.core.index][rotateAxis] *= -1;\n this.applyStyles();\n this.triggerEvents(lGEvents.flipHorizontal, {\n flipHorizontal: this.rotateValuesList[this.core.index][rotateAxis],\n });\n }\n\n flipVertical(): void {\n const rotateEl = this.core\n .getSlideItem(this.core.index)\n .find('.lg-img-rotate')\n .first()\n .get();\n const currentRotation = this.getCurrentRotation(rotateEl);\n let rotateAxis = 'flipVertical';\n if (currentRotation === 90 || currentRotation === 270) {\n rotateAxis = 'flipHorizontal';\n }\n this.rotateValuesList[this.core.index][rotateAxis] *= -1;\n\n this.applyStyles();\n\n this.triggerEvents(lGEvents.flipVertical, {\n flipVertical: this.rotateValuesList[this.core.index][rotateAxis],\n });\n }\n\n triggerEvents(event: string, detail: any): void {\n setTimeout(() => {\n this.core.LGel.trigger(event, detail);\n }, this.settings.rotateSpeed + 10);\n }\n\n isImageOrientationChanged(): boolean {\n const rotateValue = this.rotateValuesList[this.core.index];\n const isRotated = Math.abs(rotateValue.rotate) % 360 !== 0;\n const ifFlippedHor = rotateValue.flipHorizontal < 0;\n const ifFlippedVer = rotateValue.flipVertical < 0;\n return isRotated || ifFlippedHor || ifFlippedVer;\n }\n\n closeGallery(): void {\n if (this.isImageOrientationChanged()) {\n this.core.getSlideItem(this.core.index).css('opacity', 0);\n }\n this.rotateValuesList = {};\n }\n\n destroy(): void {\n // Unbind all events added by lightGallery rotate plugin\n this.core.LGel.off('.lg.rotate');\n this.core.LGel.off('.rotate');\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,iB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