lightgallery 2.3.0-beta.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/css/lightgallery-bundle.css +19 -26
  2. package/css/lightgallery-bundle.min.css +1 -1
  3. package/css/lightgallery-core.css +0 -19
  4. package/css/lightgallery.css +19 -26
  5. package/lg-events.d.ts +0 -4
  6. package/lg-settings.d.ts +17 -8
  7. package/lg-utils.d.ts +25 -4
  8. package/lib/lg-settings.js +4 -2
  9. package/lib/lg-settings.js.map +1 -1
  10. package/lib/lg-utils.js +45 -5
  11. package/lib/lg-utils.js.map +1 -1
  12. package/lib/lgQuery.js +31 -20
  13. package/lib/lgQuery.js.map +1 -1
  14. package/lib/lightgallery.js +113 -119
  15. package/lib/lightgallery.js.map +1 -1
  16. package/lib/plugins/video/lg-video-settings.js.map +1 -1
  17. package/lib/plugins/video/lg-video-utils.js +24 -0
  18. package/lib/plugins/video/lg-video-utils.js.map +1 -0
  19. package/lib/plugins/video/lg-video.js +37 -31
  20. package/lib/plugins/video/lg-video.js.map +1 -1
  21. package/lib/plugins/zoom/lg-zoom.js +7 -8
  22. package/lib/plugins/zoom/lg-zoom.js.map +1 -1
  23. package/lightgallery.d.ts +18 -10
  24. package/lightgallery.es5.js +194 -147
  25. package/lightgallery.es5.js.map +1 -1
  26. package/lightgallery.min.js +2 -2
  27. package/lightgallery.umd.js +194 -147
  28. package/lightgallery.umd.js.map +1 -1
  29. package/lit/lightgallery.esm.js +7 -7
  30. package/lit/lightgallery.umd.js +3 -3
  31. package/package.json +1 -1
  32. package/plugins/autoplay/lg-autoplay.es5.js +1 -1
  33. package/plugins/autoplay/lg-autoplay.es5.js.map +1 -1
  34. package/plugins/autoplay/lg-autoplay.min.js +1 -1
  35. package/plugins/autoplay/lg-autoplay.umd.js +1 -1
  36. package/plugins/autoplay/lg-autoplay.umd.js.map +1 -1
  37. package/plugins/comment/lg-comment.es5.js +1 -1
  38. package/plugins/comment/lg-comment.es5.js.map +1 -1
  39. package/plugins/comment/lg-comment.min.js +1 -1
  40. package/plugins/comment/lg-comment.umd.js +1 -1
  41. package/plugins/comment/lg-comment.umd.js.map +1 -1
  42. package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
  43. package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
  44. package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
  45. package/plugins/hash/lg-hash.es5.js +1 -1
  46. package/plugins/hash/lg-hash.es5.js.map +1 -1
  47. package/plugins/hash/lg-hash.min.js +1 -1
  48. package/plugins/hash/lg-hash.umd.js +1 -1
  49. package/plugins/hash/lg-hash.umd.js.map +1 -1
  50. package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
  51. package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -1
  52. package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
  53. package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
  54. package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -1
  55. package/plugins/pager/lg-pager.es5.js +1 -1
  56. package/plugins/pager/lg-pager.es5.js.map +1 -1
  57. package/plugins/pager/lg-pager.min.js +1 -1
  58. package/plugins/pager/lg-pager.umd.js +1 -1
  59. package/plugins/pager/lg-pager.umd.js.map +1 -1
  60. package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
  61. package/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -1
  62. package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
  63. package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
  64. package/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -1
  65. package/plugins/rotate/lg-rotate.es5.js +1 -1
  66. package/plugins/rotate/lg-rotate.es5.js.map +1 -1
  67. package/plugins/rotate/lg-rotate.min.js +1 -1
  68. package/plugins/rotate/lg-rotate.umd.js +1 -1
  69. package/plugins/rotate/lg-rotate.umd.js.map +1 -1
  70. package/plugins/share/lg-share.es5.js +1 -1
  71. package/plugins/share/lg-share.es5.js.map +1 -1
  72. package/plugins/share/lg-share.min.js +1 -1
  73. package/plugins/share/lg-share.umd.js +1 -1
  74. package/plugins/share/lg-share.umd.js.map +1 -1
  75. package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
  76. package/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -1
  77. package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
  78. package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
  79. package/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -1
  80. package/plugins/video/lg-video-settings.d.ts +2 -1
  81. package/plugins/video/lg-video-utils.d.ts +6 -0
  82. package/plugins/video/lg-video.d.ts +6 -1
  83. package/plugins/video/lg-video.es5.js +56 -30
  84. package/plugins/video/lg-video.es5.js.map +1 -1
  85. package/plugins/video/lg-video.min.js +2 -2
  86. package/plugins/video/lg-video.umd.js +56 -30
  87. package/plugins/video/lg-video.umd.js.map +1 -1
  88. package/plugins/zoom/lg-zoom.es5.js +8 -9
  89. package/plugins/zoom/lg-zoom.es5.js.map +1 -1
  90. package/plugins/zoom/lg-zoom.min.js +2 -2
  91. package/plugins/zoom/lg-zoom.umd.js +8 -9
  92. package/plugins/zoom/lg-zoom.umd.js.map +1 -1
  93. package/react/Lightgallery.es5.js +194 -147
  94. package/react/Lightgallery.es5.js.map +1 -1
  95. package/react/Lightgallery.umd.js +194 -147
  96. package/react/Lightgallery.umd.js.map +1 -1
  97. package/scss/_lg-theme-default.scss +17 -10
  98. package/scss/lightgallery-core.scss +0 -24
  99. package/vue/LightGalleryVue.common.js +188 -150
  100. package/vue/LightGalleryVue.common.js.map +1 -1
  101. package/vue/LightGalleryVue.umd.js +188 -150
  102. package/vue/LightGalleryVue.umd.js.map +1 -1
  103. package/vue/LightGalleryVue.umd.min.js +2 -2
  104. package/vue/LightGalleryVue.umd.min.js.map +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -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 /**\n * True for first slide\n */\n isFirstSlide: 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,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,cAAc,EAAE,kBAAkB;IAClC,YAAY,EAAE,gBAAgB;CACjC;;AC3BM,I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BAAgB,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};\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,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB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AAY,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,5 +1,5 @@
1
1
  /**
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -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 /**\n * True for first slide\n */\n isFirstSlide: 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;Q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ACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI,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};\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;;IC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KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC1D,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;YAC1C,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;SACpD;QAED,uBAAO,GAAP;YACI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,CAAC;YACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAChC;QACL,YAAC;IAAD,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -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 /**\n * True for first slide\n */\n isFirstSlide: 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":";;;;;;;;;;;;;;;;;;;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C;iBACnB,GAAG,EAAE;iBACL,qBAAqB,EAAE,CAAC;YAC7B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,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
+ {"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,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IAC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.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -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 /**\n * True for first slide\n */\n isFirstSlide: 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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g-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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,uBAAuB,GAA4B;QAC5D,eAAe,EAAE,KAAK;KACzB;;ICTD;;;;QAeI,yBAAY,QA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AM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAK,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,OAAI,CAAC,CAAC;SACzE;QAEO,4CAAkB,GAA1B,UAA2B,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,5 +1,5 @@
1
1
  /*!
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -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 /**\n * True for first slide\n */\n isFirstSlide: 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.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G,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QAC3D,IAAM,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};\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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AAY,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,5 +1,5 @@
1
1
  /**
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * lightgallery | 2.3.0-beta.1 | August 31st 2021
2
+ * lightgallery | 2.3.0 | October 28th 2021
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
5
5
  * @license GPLv3