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 +1 @@
1
- {"version":3,"file":"lg-comment.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/comment/lg-comment-settings.ts","../../../src/plugins/comment/lg-comment.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 CommentSettings {\n /**\n * Enable comment box\n */\n commentBox: boolean;\n /**\n * Enable facebook comment box\n */\n fbComments: boolean;\n /**\n * Enable disqus comment box\n */\n disqusComments: boolean;\n\n /**\n * Disqus comment config\n */\n disqusConfig: {\n title?: string;\n language: string;\n };\n\n /**\n * Facebook comments default markup\n */\n commentsMarkup: string;\n}\n\nexport const commentSettings: CommentSettings = {\n commentBox: false,\n fbComments: false,\n disqusComments: false,\n disqusConfig: {\n title: undefined,\n language: 'en',\n },\n commentsMarkup:\n '<div id=\"lg-comment-box\" class=\"lg-comment-box lg-fb-comment-box\"><div class=\"lg-comment-header\"><h3 class=\"lg-comment-title\">Leave a comment.</h3><span class=\"lg-comment-close lg-icon\"></span></div><div class=\"lg-comment-body\"></div></div>',\n};\n","/**\n * lightGallery comments module\n * Supports facebook and disqus comments\n *\n * @ref - https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables\n * @ref - https://github.com/disqus/DISQUS-API-Recipes/blob/master/snippets/js/disqus-reset/disqus_reset.html\n * @ref - https://css-tricks.com/lazy-loading-disqus-comments/\n * @ref - https://developers.facebook.com/docs/plugins/comments/#comments-plugin\n *\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { commentSettings, CommentSettings } from './lg-comment-settings';\ndeclare let FB: any;\ndeclare let DISQUS: any;\n\nexport default class CommentBox {\n core: LightGallery;\n settings: CommentSettings;\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 = { ...commentSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n if (!this.settings.commentBox) {\n return;\n }\n this.setMarkup();\n this.toggleCommentBox();\n if (this.settings.fbComments) {\n this.addFbComments();\n } else if (this.settings.disqusComments) {\n this.addDisqusComments();\n }\n }\n\n private setMarkup() {\n this.core.outer.append(\n this.settings.commentsMarkup +\n '<div class=\"lg-comment-overlay\"></div>',\n );\n\n const commentToggleBtn =\n '<button type=\"button\" aria-label=\"Toggle comments\" class=\"lg-comment-toggle lg-icon\"></button>';\n this.core.$toolbar.append(commentToggleBtn);\n }\n\n toggleCommentBox(): void {\n this.core.outer\n .find('.lg-comment-toggle')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.toggleClass('lg-comment-active');\n });\n\n this.core.outer\n .find('.lg-comment-overlay')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n this.core.outer\n .find('.lg-comment-close')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n }\n\n addFbComments() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, (event) => {\n const html = this.core.galleryItems[event.detail.index].fbHtml;\n this.core.outer.find('.lg-comment-body').html(html as string);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, function () {\n try {\n FB.XFBML.parse();\n } catch (err) {\n _this.$LG(window).on('fbAsyncInit', function () {\n FB.XFBML.parse();\n });\n }\n });\n }\n\n addDisqusComments(): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n const $disqusThread = this.$LG('#disqus_thread');\n $disqusThread.remove();\n this.core.outer\n .find('.lg-comment-body')\n .append('<div id=\"disqus_thread\"></div>');\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, () => {\n $disqusThread.html('');\n });\n\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, (event) => {\n const { index } = event.detail;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n // DISQUS needs sometime to intialize when lightGallery is opened from direct url(hash plugin).\n setTimeout(\n function () {\n try {\n DISQUS.reset({\n reload: true,\n config: function () {\n this.page.identifier =\n _this.core.galleryItems[\n index\n ].disqusIdentifier;\n this.page.url =\n _this.core.galleryItems[index].disqusURL;\n this.page.title =\n _this.settings.disqusConfig.title;\n this.language =\n _this.settings.disqusConfig.language;\n },\n });\n } catch (err) {\n console.error(\n 'Make sure you have included disqus JavaScript code in your document. Ex - https://lg-disqus.disqus.com/admin/install/platforms/universalcode/',\n );\n }\n },\n _this.core.lGalleryOn ? 0 : 1000,\n );\n });\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.comment');\n this.core.LGel.off('.comment');\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;;ACNM,IAAM,eAAe,GAAoB;IAC5C,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE;QACV,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EACV,kPAAkP;CACzP;;ACtCD;;;;;;;;;;;IAsBI,oBAAY,QAAsB,EAAE,GAAY;;QAE5C,IAAI,CAAC,IAAI,GAAG,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AC;AAAD,CAAC;;"}
1
+ {"version":3,"file":"lg-comment.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/comment/lg-comment-settings.ts","../../../src/plugins/comment/lg-comment.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 CommentSettings {\n /**\n * Enable comment box\n */\n commentBox: boolean;\n /**\n * Enable facebook comment box\n */\n fbComments: boolean;\n /**\n * Enable disqus comment box\n */\n disqusComments: boolean;\n\n /**\n * Disqus comment config\n */\n disqusConfig: {\n title?: string;\n language: string;\n };\n\n /**\n * Facebook comments default markup\n */\n commentsMarkup: string;\n}\n\nexport const commentSettings: CommentSettings = {\n commentBox: false,\n fbComments: false,\n disqusComments: false,\n disqusConfig: {\n title: undefined,\n language: 'en',\n },\n commentsMarkup:\n '<div id=\"lg-comment-box\" class=\"lg-comment-box lg-fb-comment-box\"><div class=\"lg-comment-header\"><h3 class=\"lg-comment-title\">Leave a comment.</h3><span class=\"lg-comment-close lg-icon\"></span></div><div class=\"lg-comment-body\"></div></div>',\n};\n","/**\n * lightGallery comments module\n * Supports facebook and disqus comments\n *\n * @ref - https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables\n * @ref - https://github.com/disqus/DISQUS-API-Recipes/blob/master/snippets/js/disqus-reset/disqus_reset.html\n * @ref - https://css-tricks.com/lazy-loading-disqus-comments/\n * @ref - https://developers.facebook.com/docs/plugins/comments/#comments-plugin\n *\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { commentSettings, CommentSettings } from './lg-comment-settings';\ndeclare let FB: any;\ndeclare let DISQUS: any;\n\nexport default class CommentBox {\n core: LightGallery;\n settings: CommentSettings;\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 = { ...commentSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n if (!this.settings.commentBox) {\n return;\n }\n this.setMarkup();\n this.toggleCommentBox();\n if (this.settings.fbComments) {\n this.addFbComments();\n } else if (this.settings.disqusComments) {\n this.addDisqusComments();\n }\n }\n\n private setMarkup() {\n this.core.outer.append(\n this.settings.commentsMarkup +\n '<div class=\"lg-comment-overlay\"></div>',\n );\n\n const commentToggleBtn =\n '<button type=\"button\" aria-label=\"Toggle comments\" class=\"lg-comment-toggle lg-icon\"></button>';\n this.core.$toolbar.append(commentToggleBtn);\n }\n\n toggleCommentBox(): void {\n this.core.outer\n .find('.lg-comment-toggle')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.toggleClass('lg-comment-active');\n });\n\n this.core.outer\n .find('.lg-comment-overlay')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n this.core.outer\n .find('.lg-comment-close')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n }\n\n addFbComments() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, (event) => {\n const html = this.core.galleryItems[event.detail.index].fbHtml;\n this.core.outer.find('.lg-comment-body').html(html as string);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, function () {\n try {\n FB.XFBML.parse();\n } catch (err) {\n _this.$LG(window).on('fbAsyncInit', function () {\n FB.XFBML.parse();\n });\n }\n });\n }\n\n addDisqusComments(): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n const $disqusThread = this.$LG('#disqus_thread');\n $disqusThread.remove();\n this.core.outer\n .find('.lg-comment-body')\n .append('<div id=\"disqus_thread\"></div>');\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, () => {\n $disqusThread.html('');\n });\n\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, (event) => {\n const { index } = event.detail;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n // DISQUS needs sometime to intialize when lightGallery is opened from direct url(hash plugin).\n setTimeout(\n function () {\n try {\n DISQUS.reset({\n reload: true,\n config: function () {\n this.page.identifier =\n _this.core.galleryItems[\n index\n ].disqusIdentifier;\n this.page.url =\n _this.core.galleryItems[index].disqusURL;\n this.page.title =\n _this.settings.disqusConfig.title;\n this.language =\n _this.settings.disqusConfig.language;\n },\n });\n } catch (err) {\n console.error(\n 'Make sure you have included disqus JavaScript code in your document. Ex - https://lg-disqus.disqus.com/admin/install/platforms/universalcode/',\n );\n }\n },\n _this.core.lGalleryOn ? 0 : 1000,\n );\n });\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.comment');\n this.core.LGel.off('.comment');\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;;ACNM,IAAM,eAAe,GAAoB;IAC5C,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE;QACV,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EACV,kPAAkP;CACzP;;ACtCD;;;;;;;;;;;IAsBI,oBAAY,QAAsB,EAAE,GAAY;;QAE5C,IAAI,CAA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KAClC;IACL,iBAAC;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-comment.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/comment/lg-comment-settings.ts","../../../src/plugins/comment/lg-comment.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 CommentSettings {\n /**\n * Enable comment box\n */\n commentBox: boolean;\n /**\n * Enable facebook comment box\n */\n fbComments: boolean;\n /**\n * Enable disqus comment box\n */\n disqusComments: boolean;\n\n /**\n * Disqus comment config\n */\n disqusConfig: {\n title?: string;\n language: string;\n };\n\n /**\n * Facebook comments default markup\n */\n commentsMarkup: string;\n}\n\nexport const commentSettings: CommentSettings = {\n commentBox: false,\n fbComments: false,\n disqusComments: false,\n disqusConfig: {\n title: undefined,\n language: 'en',\n },\n commentsMarkup:\n '<div id=\"lg-comment-box\" class=\"lg-comment-box lg-fb-comment-box\"><div class=\"lg-comment-header\"><h3 class=\"lg-comment-title\">Leave a comment.</h3><span class=\"lg-comment-close lg-icon\"></span></div><div class=\"lg-comment-body\"></div></div>',\n};\n","/**\n * lightGallery comments module\n * Supports facebook and disqus comments\n *\n * @ref - https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables\n * @ref - https://github.com/disqus/DISQUS-API-Recipes/blob/master/snippets/js/disqus-reset/disqus_reset.html\n * @ref - https://css-tricks.com/lazy-loading-disqus-comments/\n * @ref - https://developers.facebook.com/docs/plugins/comments/#comments-plugin\n *\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { commentSettings, CommentSettings } from './lg-comment-settings';\ndeclare let FB: any;\ndeclare let DISQUS: any;\n\nexport default class CommentBox {\n core: LightGallery;\n settings: CommentSettings;\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 = { ...commentSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n if (!this.settings.commentBox) {\n return;\n }\n this.setMarkup();\n this.toggleCommentBox();\n if (this.settings.fbComments) {\n this.addFbComments();\n } else if (this.settings.disqusComments) {\n this.addDisqusComments();\n }\n }\n\n private setMarkup() {\n this.core.outer.append(\n this.settings.commentsMarkup +\n '<div class=\"lg-comment-overlay\"></div>',\n );\n\n const commentToggleBtn =\n '<button type=\"button\" aria-label=\"Toggle comments\" class=\"lg-comment-toggle lg-icon\"></button>';\n this.core.$toolbar.append(commentToggleBtn);\n }\n\n toggleCommentBox(): void {\n this.core.outer\n .find('.lg-comment-toggle')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.toggleClass('lg-comment-active');\n });\n\n this.core.outer\n .find('.lg-comment-overlay')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n this.core.outer\n .find('.lg-comment-close')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n }\n\n addFbComments() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, (event) => {\n const html = this.core.galleryItems[event.detail.index].fbHtml;\n this.core.outer.find('.lg-comment-body').html(html as string);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, function () {\n try {\n FB.XFBML.parse();\n } catch (err) {\n _this.$LG(window).on('fbAsyncInit', function () {\n FB.XFBML.parse();\n });\n }\n });\n }\n\n addDisqusComments(): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n const $disqusThread = this.$LG('#disqus_thread');\n $disqusThread.remove();\n this.core.outer\n .find('.lg-comment-body')\n .append('<div id=\"disqus_thread\"></div>');\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, () => {\n $disqusThread.html('');\n });\n\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, (event) => {\n const { index } = event.detail;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n // DISQUS needs sometime to intialize when lightGallery is opened from direct url(hash plugin).\n setTimeout(\n function () {\n try {\n DISQUS.reset({\n reload: true,\n config: function () {\n this.page.identifier =\n _this.core.galleryItems[\n index\n ].disqusIdentifier;\n this.page.url =\n _this.core.galleryItems[index].disqusURL;\n this.page.title =\n _this.settings.disqusConfig.title;\n this.language =\n _this.settings.disqusConfig.language;\n },\n });\n } catch (err) {\n console.error(\n 'Make sure you have included disqus JavaScript code in your document. Ex - https://lg-disqus.disqus.com/admin/install/platforms/universalcode/',\n );\n }\n },\n _this.core.lGalleryOn ? 0 : 1000,\n );\n });\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.comment');\n this.core.LGel.off('.comment');\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,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CACtC,IAAI,CAAC,QAAQ;oCACT,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;6BAC5C;yBACJ,CAAC,CAAC;qBACN;oBAAC,OAAO,GAAG,EAAE;wBACV,OAAO,CAAC,KAAK,CACT,+IAA+I,CAClJ,CAAC;qBACL;iBACJ,EACD,KAAK,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,CACnC,CAAC;aACL,CAAC,CAAC;SACN;QAED,4BAAO,GAAP;YACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAClC;QACL,iBAAC;IAAD,CAAC;;;;"}
1
+ {"version":3,"file":"lg-comment.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/comment/lg-comment-settings.ts","../../../src/plugins/comment/lg-comment.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 CommentSettings {\n /**\n * Enable comment box\n */\n commentBox: boolean;\n /**\n * Enable facebook comment box\n */\n fbComments: boolean;\n /**\n * Enable disqus comment box\n */\n disqusComments: boolean;\n\n /**\n * Disqus comment config\n */\n disqusConfig: {\n title?: string;\n language: string;\n };\n\n /**\n * Facebook comments default markup\n */\n commentsMarkup: string;\n}\n\nexport const commentSettings: CommentSettings = {\n commentBox: false,\n fbComments: false,\n disqusComments: false,\n disqusConfig: {\n title: undefined,\n language: 'en',\n },\n commentsMarkup:\n '<div id=\"lg-comment-box\" class=\"lg-comment-box lg-fb-comment-box\"><div class=\"lg-comment-header\"><h3 class=\"lg-comment-title\">Leave a comment.</h3><span class=\"lg-comment-close lg-icon\"></span></div><div class=\"lg-comment-body\"></div></div>',\n};\n","/**\n * lightGallery comments module\n * Supports facebook and disqus comments\n *\n * @ref - https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables\n * @ref - https://github.com/disqus/DISQUS-API-Recipes/blob/master/snippets/js/disqus-reset/disqus_reset.html\n * @ref - https://css-tricks.com/lazy-loading-disqus-comments/\n * @ref - https://developers.facebook.com/docs/plugins/comments/#comments-plugin\n *\n */\n\nimport { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { commentSettings, CommentSettings } from './lg-comment-settings';\ndeclare let FB: any;\ndeclare let DISQUS: any;\n\nexport default class CommentBox {\n core: LightGallery;\n settings: CommentSettings;\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 = { ...commentSettings, ...this.core.settings };\n\n return this;\n }\n\n public init(): void {\n if (!this.settings.commentBox) {\n return;\n }\n this.setMarkup();\n this.toggleCommentBox();\n if (this.settings.fbComments) {\n this.addFbComments();\n } else if (this.settings.disqusComments) {\n this.addDisqusComments();\n }\n }\n\n private setMarkup() {\n this.core.outer.append(\n this.settings.commentsMarkup +\n '<div class=\"lg-comment-overlay\"></div>',\n );\n\n const commentToggleBtn =\n '<button type=\"button\" aria-label=\"Toggle comments\" class=\"lg-comment-toggle lg-icon\"></button>';\n this.core.$toolbar.append(commentToggleBtn);\n }\n\n toggleCommentBox(): void {\n this.core.outer\n .find('.lg-comment-toggle')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.toggleClass('lg-comment-active');\n });\n\n this.core.outer\n .find('.lg-comment-overlay')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n this.core.outer\n .find('.lg-comment-close')\n .first()\n .on('click.lg.comment', () => {\n this.core.outer.removeClass('lg-comment-active');\n });\n }\n\n addFbComments() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, (event) => {\n const html = this.core.galleryItems[event.detail.index].fbHtml;\n this.core.outer.find('.lg-comment-body').html(html as string);\n });\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, function () {\n try {\n FB.XFBML.parse();\n } catch (err) {\n _this.$LG(window).on('fbAsyncInit', function () {\n FB.XFBML.parse();\n });\n }\n });\n }\n\n addDisqusComments(): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n const $disqusThread = this.$LG('#disqus_thread');\n $disqusThread.remove();\n this.core.outer\n .find('.lg-comment-body')\n .append('<div id=\"disqus_thread\"></div>');\n\n this.core.LGel.on(`${lGEvents.beforeSlide}.comment`, () => {\n $disqusThread.html('');\n });\n\n this.core.LGel.on(`${lGEvents.afterSlide}.comment`, (event) => {\n const { index } = event.detail;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n // DISQUS needs sometime to intialize when lightGallery is opened from direct url(hash plugin).\n setTimeout(\n function () {\n try {\n DISQUS.reset({\n reload: true,\n config: function () {\n this.page.identifier =\n _this.core.galleryItems[\n index\n ].disqusIdentifier;\n this.page.url =\n _this.core.galleryItems[index].disqusURL;\n this.page.title =\n _this.settings.disqusConfig.title;\n this.language =\n _this.settings.disqusConfig.language;\n },\n });\n } catch (err) {\n console.error(\n 'Make sure you have included disqus JavaScript code in your document. Ex - https://lg-disqus.disqus.com/admin/install/platforms/universalcode/',\n );\n }\n },\n _this.core.lGalleryOn ? 0 : 1000,\n );\n });\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.comment');\n this.core.LGel.off('.comment');\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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AK;oCACX,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;gCACtC,IAAI,CAAC,QAAQ;oCACT,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;6BAC5C;yBACJ,CAAC,CAAC;qBACN;oBAAC,OAAO,GAAG,EAAE;wBACV,OAAO,CAAC,KAAK,CACT,+IAA+I,CAClJ,CAAC;qBACL;iBACJ,EACD,KAAK,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,CACnC,CAAC;aACL,CAAC,CAAC;SACN;QAED,4BAAO,GAAP;YACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAClC;QACL,iBAAC;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,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,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-hash.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n\n /**\n * True for first slide\n */\n isFirstSlide: boolean;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;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QACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,8BAA4B,IAAI,CAAC,IAAI,CAAC,IAAM,CAAC,CAAC;KACtE;IACL,WAAC;AAAD,CAAC;;"}
1
+ {"version":3,"file":"lg-hash.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,cAAc,EAAE,kBAAkB;IAClC,YAAY,EAAE,gBAAgB;CACjC;;AChBM,IAAM,YAAY,GAAiB;IACtC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,GAAG;IACd,eAAe,EAAE,KAAK;CACzB;;;ICZG,cAAY,QAAsB,EAAE,GAAY;;QAE5C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;;QAEf,IAAI,CAAC,QAAQ,yBAAQ,YAAY,GAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;KACf;IAEM,mBAA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EAAE,CAAC;SAC5B;KACJ;IAED,2BAAY,GAAZ;QACI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YACpB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;SACvD;KACJ;IAED,sBAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,8BAA4B,IAAI,CAAC,IAAI,CAAC,IAAM,CAAC,CAAC;KACtE;IACL,WAAC;AAAD,CAAC;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lightgallery | 2.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-hash.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n\n /**\n * True for first slide\n */\n isFirstSlide: boolean;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,GAEjB;QACA,gBAAgB,EAAE,oBAAoB;QACtC,IAAI,EAAE,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,a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ash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * Unique id for each gallery.\n * @description It is mandatory when you use hash plugin for multiple galleries on the same page.\n */\n galleryId: string;\n\n /**\n * Custom slide name to use in the url when hash plugin is enabled\n */\n customSlideName: boolean;\n}\n\nexport const hashSettings: HashSettings = {\n hash: true,\n galleryId: '1',\n customSlideName: false,\n};\n","import { lGEvents } from '../../lg-events';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { hashSettings, HashSettings } from './lg-hash-settings';\n\nexport default class Hash {\n core: LightGallery;\n settings: HashSettings;\n oldHash!: string;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n // extend module default settings with lightGallery core settings\n this.settings = { ...hashSettings, ...this.core.settings };\n return this;\n }\n\n public init(): void {\n if (!this.settings.hash) {\n return;\n }\n this.oldHash = window.location.hash;\n setTimeout(() => {\n this.buildFromHash();\n }, 100);\n // Change hash value on after each slide transition\n this.core.LGel.on(\n `${lGEvents.afterSlide}.hash`,\n this.onAfterSlide.bind(this),\n );\n this.core.LGel.on(\n `${lGEvents.afterClose}.hash`,\n this.onCloseAfter.bind(this),\n );\n\n // Listen hash change and change the slide according to slide value\n this.$LG(window).on(\n `hashchange.lg.hash.global${this.core.lgId}`,\n this.onHashchange.bind(this),\n );\n }\n\n private onAfterSlide(event: CustomEvent) {\n let slideName = this.core.galleryItems[event.detail.index].slideName;\n slideName = this.settings.customSlideName\n ? slideName || event.detail.index\n : event.detail.index;\n if (history.replaceState) {\n history.replaceState(\n null,\n '',\n window.location.pathname +\n window.location.search +\n '#lg=' +\n this.settings.galleryId +\n '&slide=' +\n slideName,\n );\n } else {\n window.location.hash =\n 'lg=' + this.settings.galleryId + '&slide=' + slideName;\n }\n }\n\n /**\n * Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin\n * @param {String} hash\n * @returns {Number} Index of the slide.\n */\n getIndexFromUrl(hash = window.location.hash): number {\n const slideName = hash.split('&slide=')[1];\n let _idx = 0;\n\n if (this.settings.customSlideName) {\n for (\n let index = 0;\n index < this.core.galleryItems.length;\n index++\n ) {\n const dynamicEl = this.core.galleryItems[index];\n if (dynamicEl.slideName === slideName) {\n _idx = index;\n break;\n }\n }\n } else {\n _idx = parseInt(slideName, 10);\n }\n\n return isNaN(_idx) ? 0 : _idx;\n }\n\n // Build Gallery if gallery id exist in the URL\n buildFromHash(): boolean | undefined {\n // if dynamic option is enabled execute immediately\n const _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.settings.galleryId) > 0) {\n // This class is used to remove the initial animation if galleryId present in the URL\n this.$LG(document.body).addClass('lg-from-hash');\n\n const index = this.getIndexFromUrl(_hash);\n\n this.core.openGallery(index);\n return true;\n }\n }\n\n private onCloseAfter() {\n // Reset to old hash value\n if (\n this.oldHash &&\n this.oldHash.indexOf('lg=' + this.settings.galleryId) < 0\n ) {\n if (history.replaceState) {\n history.replaceState(null, '', this.oldHash);\n } else {\n window.location.hash = this.oldHash;\n }\n } else {\n if (history.replaceState) {\n history.replaceState(\n null,\n document.title,\n window.location.pathname + window.location.search,\n );\n } else {\n window.location.hash = '';\n }\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = window.location.hash;\n const index = this.getIndexFromUrl(_hash);\n\n // it galleryId doesn't exist in the url close the gallery\n if (_hash.indexOf('lg=' + this.settings.galleryId) > -1) {\n this.core.slide(index, false, false);\n } else if (this.core.lGalleryOn) {\n this.core.closeGallery();\n }\n }\n\n closeGallery(): void {\n if (this.settings.hash) {\n this.$LG(document.body).removeClass('lg-from-hash');\n }\n }\n\n destroy(): void {\n this.core.LGel.off('.lg.hash');\n this.core.LGel.off('.hash');\n this.$LG(window).off(`hashchange.lg.hash.global${this.core.lgId}`);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,GAEjB;QACA,gBAAgB,EAAE,oBAAoB;QACtC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,YAA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AI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,8BAA4B,IAAI,CAAC,IAAI,CAAC,IAAM,CAAC,CAAC;SACtE;QACL,WAAC;IAAD,CAAC;;;;"}
@@ -1,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-medium-zoom.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n\n /**\n * True for first slide\n */\n isFirstSlide: boolean;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,WAAW;IACpB,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,eAAe;IAC5B,cAAc,EAAE,kBAAkB;IAClC,YAAY,EAAE,gBAAgB;CACjC;;AChBM,IAAM,kBAAkB,GAAuB;IA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QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;SAC/C;KACJ;IAED,yBAAI,GAAJ;QAAA,iBAgBC;QAfG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC3B,OAAO;SACV;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAI,QAAQ,CAAC,UAAU,YAAS,EAAE;YAC/C,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CACnB,kBAAkB,EAClB,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB;gBACrD,KAAI,CAAC,QAAQ,CAAC,eAAe,CACpC,CAAC;SACL,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE;YAClC,KAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B,CAAC,CAAC;KACN;IAED,4BAAO,GAAP;QACI,IAAI,CAAC,eAAe,EAAE,CAAC;KAC1B;IACL,iBAAC;AAAD,CAAC;;"}
1
+ {"version":3,"file":"lg-medium-zoom.es5.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;AAKO,IAAM,QAAQ,GAEjB;IACA,gBAAgB,EAAE,oBAAoB;IACtC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;IACtB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,sBAAsB;IAC1C,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE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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-medium-zoom.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n\n /**\n * True for first slide\n */\n isFirstSlide: boolean;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,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;;IChBM,IAAM,kBAAkB,GAAuB;QAClD,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,MAAM;KAC1B;;;QCTG,oBAAY,QAAsB,EAAE,GAAY;YAAhD,iBAqCC;;YAnCG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;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,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAI,QAAQ,CAAC,UAAU,YAAS,EAAE;gBAC/C,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CACnB,kBAAkB,EAClB,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB;oBACrD,KAAI,CAAC,QAAQ,CAAC,eAAe,CACpC,CAAC;aACL,CAAC,CAAC;YACH,IAAI,CAAC,eAAe,EAAE,CAAC;YAEvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE;gBAClC,KAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;aAC5B,CAAC,CAAC;SACN;QAED,4BAAO,GAAP;YACI,IAAI,CAAC,eAAe,EAAE,CAAC;SAC1B;QACL,iBAAC;IAAD,CAAC;;;;"}
1
+ {"version":3,"file":"lg-medium-zoom.umd.js","sources":["../../../src/lg-events.ts","../../../src/plugins/mediumZoom/lg-medium-zoom-settings.ts","../../../src/plugins/mediumZoom/lg-medium-zoom.ts"],"sourcesContent":["import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n};\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n","export interface MediumZoomSettings {\n /**\n * Enable/Disable medium like zoom experience\n */\n mediumZoom: boolean;\n\n /**\n * Space between the gallery outer area and images\n */\n margin: number;\n\n /**\n * Background color for the gallery\n * This can be overwritten by passing background color via `lg-background-color` for each item\n */\n backgroundColor: string;\n}\n\nexport const mediumZoomSettings: MediumZoomSettings = {\n margin: 40,\n mediumZoom: true,\n backgroundColor: '#000',\n};\n","import { lGEvents } from '../../lg-events';\nimport { LightGallerySettings } from '../../lg-settings';\nimport { LgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport {\n MediumZoomSettings,\n mediumZoomSettings,\n} from './lg-medium-zoom-settings';\n\nexport default class MediumZoom {\n core: LightGallery;\n settings: MediumZoomSettings;\n private $LG!: LgQuery;\n constructor(instance: LightGallery, $LG: LgQuery) {\n // get lightGallery core plugin instance\n this.core = instance;\n this.$LG = $LG;\n\n // Set margin\n this.core.getMediaContainerPosition = () => {\n return {\n top: this.settings.margin,\n bottom: this.settings.margin,\n };\n };\n\n // Override some of lightGallery default settings\n const defaultSettings: Partial<LightGallerySettings> = {\n controls: false,\n download: false,\n counter: false,\n showCloseIcon: false,\n extraProps: ['lgBackgroundColor'],\n closeOnTap: false,\n enableSwipe: false,\n enableDrag: false,\n swipeToClose: false,\n addClass: this.core.settings.addClass + ' lg-medium-zoom',\n };\n\n this.core.settings = { ...this.core.settings, ...defaultSettings };\n\n // extend module default settings with lightGallery core settings\n this.settings = {\n ...mediumZoomSettings,\n ...this.core.settings,\n ...defaultSettings,\n };\n\n return this;\n }\n\n private toggleItemClass() {\n for (let index = 0; index < this.core.items.length; index++) {\n const $element = this.$LG(this.core.items[index]);\n $element.toggleClass('lg-medium-zoom-item');\n }\n }\n\n init(): void {\n if (!this.settings.mediumZoom) {\n return;\n }\n this.core.LGel.on(`${lGEvents.beforeOpen}.medium`, () => {\n this.core.$backdrop.css(\n 'background-color',\n this.core.galleryItems[this.core.index].lgBackgroundColor ||\n this.settings.backgroundColor,\n );\n });\n this.toggleItemClass();\n\n this.core.outer.on('click.lg.medium', () => {\n this.core.closeGallery();\n });\n }\n\n destroy(): void {\n this.toggleItemClass();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGA;;;;;IAKO,IAAM,QAAQ,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,W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