lightgallery 2.9.0 → 3.0.0-beta.3

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 (619) hide show
  1. package/LICENSE +690 -0
  2. package/README.md +31 -21
  3. package/dist/README.md +229 -0
  4. package/{css → dist/css}/lg-autoplay.css +7 -4
  5. package/{css → dist/css}/lg-autoplay.css.map +1 -1
  6. package/{css → dist/css}/lg-comments.css +0 -6
  7. package/{css → dist/css}/lg-comments.css.map +1 -1
  8. package/dist/css/lg-fullscreen.css +11 -0
  9. package/dist/css/lg-fullscreen.css.map +1 -0
  10. package/dist/css/lg-justified.css +37 -0
  11. package/dist/css/lg-justified.css.map +1 -0
  12. package/{css → dist/css}/lg-pager.css.map +1 -1
  13. package/{css → dist/css}/lg-rotate.css +0 -16
  14. package/{css → dist/css}/lg-rotate.css.map +1 -1
  15. package/dist/css/lg-rtl.css +94 -0
  16. package/dist/css/lg-rtl.css.map +1 -0
  17. package/{css → dist/css}/lg-share.css +4 -32
  18. package/dist/css/lg-share.css.map +1 -0
  19. package/{css → dist/css}/lg-thumbnail.css +7 -3
  20. package/dist/css/lg-thumbnail.css.map +1 -0
  21. package/{css → dist/css}/lg-transitions.css +10 -0
  22. package/dist/css/lg-transitions.css.map +1 -0
  23. package/{css → dist/css}/lg-zoom.css +20 -9
  24. package/dist/css/lg-zoom.css.map +1 -0
  25. package/{css → dist/css}/lightgallery-bundle.css +150 -118
  26. package/dist/css/lightgallery-bundle.css.map +1 -0
  27. package/dist/css/lightgallery-bundle.min.css +1 -0
  28. package/{css → dist/css}/lightgallery-core.css +49 -7
  29. package/dist/css/lightgallery-core.css.map +1 -0
  30. package/{css → dist/css}/lightgallery.css +105 -44
  31. package/dist/css/lightgallery.css.map +1 -0
  32. package/dist/lightgallery.es5.js +3797 -0
  33. package/dist/lightgallery.es5.js.map +1 -0
  34. package/dist/lightgallery.min.js +1 -0
  35. package/dist/lightgallery.umd.js +3800 -0
  36. package/dist/lightgallery.umd.js.map +1 -0
  37. package/dist/package.json +33 -0
  38. package/dist/plugins/autoplay/lg-autoplay.es5.js +193 -0
  39. package/dist/plugins/autoplay/lg-autoplay.es5.js.map +1 -0
  40. package/dist/plugins/autoplay/lg-autoplay.min.js +1 -0
  41. package/dist/plugins/autoplay/lg-autoplay.umd.js +196 -0
  42. package/dist/plugins/autoplay/lg-autoplay.umd.js.map +1 -0
  43. package/dist/plugins/autoplay/package.json +7 -0
  44. package/dist/plugins/comment/lg-comment.es5.js +136 -0
  45. package/dist/plugins/comment/lg-comment.es5.js.map +1 -0
  46. package/dist/plugins/comment/lg-comment.min.js +1 -0
  47. package/dist/plugins/comment/lg-comment.umd.js +139 -0
  48. package/dist/plugins/comment/lg-comment.umd.js.map +1 -0
  49. package/dist/plugins/comment/package.json +7 -0
  50. package/dist/plugins/fullscreen/lg-fullscreen.es5.js +114 -0
  51. package/dist/plugins/fullscreen/lg-fullscreen.es5.js.map +1 -0
  52. package/dist/plugins/fullscreen/lg-fullscreen.min.js +1 -0
  53. package/dist/plugins/fullscreen/lg-fullscreen.umd.js +117 -0
  54. package/dist/plugins/fullscreen/lg-fullscreen.umd.js.map +1 -0
  55. package/dist/plugins/fullscreen/package.json +7 -0
  56. package/dist/plugins/hash/lg-hash.es5.js +207 -0
  57. package/dist/plugins/hash/lg-hash.es5.js.map +1 -0
  58. package/dist/plugins/hash/lg-hash.min.js +1 -0
  59. package/dist/plugins/hash/lg-hash.umd.js +210 -0
  60. package/dist/plugins/hash/lg-hash.umd.js.map +1 -0
  61. package/dist/plugins/hash/package.json +7 -0
  62. package/dist/plugins/justified/lg-justified.es5.js +415 -0
  63. package/dist/plugins/justified/lg-justified.es5.js.map +1 -0
  64. package/dist/plugins/justified/lg-justified.min.js +1 -0
  65. package/dist/plugins/justified/lg-justified.umd.js +418 -0
  66. package/dist/plugins/justified/lg-justified.umd.js.map +1 -0
  67. package/dist/plugins/justified/package.json +7 -0
  68. package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js +95 -0
  69. package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -0
  70. package/dist/plugins/mediumZoom/lg-medium-zoom.min.js +1 -0
  71. package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js +98 -0
  72. package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -0
  73. package/dist/plugins/mediumZoom/package.json +7 -0
  74. package/dist/plugins/originCrop/lg-origin-crop.es5.js +622 -0
  75. package/dist/plugins/originCrop/lg-origin-crop.es5.js.map +1 -0
  76. package/dist/plugins/originCrop/lg-origin-crop.min.js +1 -0
  77. package/dist/plugins/originCrop/lg-origin-crop.umd.js +625 -0
  78. package/dist/plugins/originCrop/lg-origin-crop.umd.js.map +1 -0
  79. package/dist/plugins/pager/lg-pager.es5.js +96 -0
  80. package/dist/plugins/pager/lg-pager.es5.js.map +1 -0
  81. package/dist/plugins/pager/lg-pager.min.js +1 -0
  82. package/dist/plugins/pager/lg-pager.umd.js +99 -0
  83. package/dist/plugins/pager/lg-pager.umd.js.map +1 -0
  84. package/dist/plugins/pager/package.json +7 -0
  85. package/dist/plugins/relativeCaption/lg-relative-caption.es5.js +98 -0
  86. package/dist/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -0
  87. package/dist/plugins/relativeCaption/lg-relative-caption.min.js +1 -0
  88. package/dist/plugins/relativeCaption/lg-relative-caption.umd.js +101 -0
  89. package/dist/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -0
  90. package/dist/plugins/relativeCaption/package.json +7 -0
  91. package/dist/plugins/rotate/lg-rotate.es5.js +226 -0
  92. package/dist/plugins/rotate/lg-rotate.es5.js.map +1 -0
  93. package/dist/plugins/rotate/lg-rotate.min.js +1 -0
  94. package/dist/plugins/rotate/lg-rotate.umd.js +229 -0
  95. package/dist/plugins/rotate/lg-rotate.umd.js.map +1 -0
  96. package/dist/plugins/rotate/package.json +7 -0
  97. package/dist/plugins/share/lg-share.es5.js +309 -0
  98. package/dist/plugins/share/lg-share.es5.js.map +1 -0
  99. package/dist/plugins/share/lg-share.min.js +1 -0
  100. package/dist/plugins/share/lg-share.umd.js +312 -0
  101. package/dist/plugins/share/lg-share.umd.js.map +1 -0
  102. package/dist/plugins/share/package.json +7 -0
  103. package/dist/plugins/thumbnail/lg-thumbnail.es5.js +792 -0
  104. package/dist/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -0
  105. package/dist/plugins/thumbnail/lg-thumbnail.min.js +1 -0
  106. package/dist/plugins/thumbnail/lg-thumbnail.umd.js +795 -0
  107. package/dist/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -0
  108. package/dist/plugins/thumbnail/package.json +7 -0
  109. package/dist/plugins/video/lg-video.es5.js +518 -0
  110. package/dist/plugins/video/lg-video.es5.js.map +1 -0
  111. package/dist/plugins/video/lg-video.min.js +1 -0
  112. package/dist/plugins/video/lg-video.umd.js +521 -0
  113. package/dist/plugins/video/lg-video.umd.js.map +1 -0
  114. package/dist/plugins/video/package.json +7 -0
  115. package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +72 -0
  116. package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +1 -0
  117. package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +1 -0
  118. package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +75 -0
  119. package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +1 -0
  120. package/dist/plugins/vimeoThumbnail/package.json +7 -0
  121. package/dist/plugins/zoom/lg-zoom.es5.js +1412 -0
  122. package/dist/plugins/zoom/lg-zoom.es5.js.map +1 -0
  123. package/dist/plugins/zoom/lg-zoom.min.js +1 -0
  124. package/dist/plugins/zoom/lg-zoom.umd.js +1415 -0
  125. package/dist/plugins/zoom/lg-zoom.umd.js.map +1 -0
  126. package/dist/plugins/zoom/package.json +7 -0
  127. package/{scss → dist/scss}/_lg-theme-default.scss +68 -18
  128. package/{scss → dist/scss}/_lg-variables.scss +0 -1
  129. package/{scss → dist/scss}/lg-autoplay.scss +10 -4
  130. package/{scss → dist/scss}/lg-comments.scss +0 -8
  131. package/dist/scss/lg-fullscreen.scss +15 -0
  132. package/dist/scss/lg-justified.scss +63 -0
  133. package/{scss → dist/scss}/lg-rotate.scss +0 -24
  134. package/dist/scss/lg-rtl.scss +145 -0
  135. package/{scss → dist/scss}/lg-share.scss +6 -33
  136. package/{scss → dist/scss}/lg-thumbnail.scss +16 -5
  137. package/{scss → dist/scss}/lg-zoom.scss +46 -9
  138. package/{scss → dist/scss}/lightgallery-bundle.scss +0 -1
  139. package/{scss → dist/scss}/lightgallery-core.scss +73 -6
  140. package/{scss → dist/scss}/lightgallery.scss +0 -1
  141. package/{scss → dist/scss}/transitions/_lg-scale-up.scss +6 -0
  142. package/{scss → dist/scss}/transitions/_lg-slide-circular-vertical.scss +6 -0
  143. package/{scss → dist/scss}/transitions/_lg-slide-circular.scss +6 -0
  144. package/{scss → dist/scss}/transitions/_lg-soft-zoom.scss +6 -0
  145. package/{scss → dist/scss}/transitions/_lg-zoom-in-big.scss +6 -0
  146. package/{scss → dist/scss}/transitions/_lg-zoom-in-out.scss +6 -0
  147. package/{scss → dist/scss}/transitions/_lg-zoom-in.scss +6 -0
  148. package/{scss → dist/scss}/transitions/_lg-zoom-out-big.scss +6 -0
  149. package/{scss → dist/scss}/transitions/_lg-zoom-out-in.scss +6 -0
  150. package/{scss → dist/scss}/transitions/_lg-zoom-out.scss +6 -0
  151. package/dist/types/headless/announce.d.ts +22 -0
  152. package/dist/types/headless/emitter.d.ts +14 -0
  153. package/dist/types/headless/gestures.d.ts +128 -0
  154. package/dist/types/headless/hash-driver.d.ts +77 -0
  155. package/dist/types/headless/icons.d.ts +56 -0
  156. package/dist/types/headless/index.d.ts +34 -0
  157. package/dist/types/headless/items.d.ts +92 -0
  158. package/dist/types/headless/justified-layout.d.ts +71 -0
  159. package/dist/types/headless/license.d.ts +35 -0
  160. package/dist/types/headless/origin-crop.d.ts +135 -0
  161. package/dist/types/headless/origin.d.ts +65 -0
  162. package/dist/types/headless/plugin-slices.d.ts +64 -0
  163. package/dist/types/headless/preload.d.ts +36 -0
  164. package/dist/types/headless/responsive.d.ts +90 -0
  165. package/dist/types/headless/settings.d.ts +268 -0
  166. package/dist/types/headless/share-urls.d.ts +60 -0
  167. package/dist/types/headless/spring.d.ts +42 -0
  168. package/dist/types/headless/state.d.ts +63 -0
  169. package/dist/types/headless/thumb-math.d.ts +85 -0
  170. package/dist/types/headless/toolbar-overflow.d.ts +61 -0
  171. package/dist/types/headless/transition.d.ts +33 -0
  172. package/dist/types/headless/velocity.d.ts +31 -0
  173. package/dist/types/headless/video-urls.d.ts +64 -0
  174. package/dist/types/headless/zoom-math.d.ts +89 -0
  175. package/{index.d.ts → dist/types/index.d.ts} +9 -4
  176. package/{lg-events.d.ts → dist/types/lg-events.d.ts} +300 -300
  177. package/dist/types/lg-icons.d.ts +27 -0
  178. package/{lg-plugin.d.ts → dist/types/lg-plugin.d.ts} +7 -7
  179. package/{lg-settings.d.ts → dist/types/lg-settings.d.ts} +549 -425
  180. package/dist/types/lg-spring-runner.d.ts +14 -0
  181. package/dist/types/lg-toolbar-overflow.d.ts +36 -0
  182. package/{lg-utils.d.ts → dist/types/lg-utils.d.ts} +236 -228
  183. package/{lgQuery.d.ts → dist/types/lgQuery.d.ts} +56 -56
  184. package/{lightgallery.d.ts → dist/types/lightgallery.d.ts} +384 -305
  185. package/{plugins → dist/types/plugins}/autoplay/lg-autoplay-settings.d.ts +41 -38
  186. package/{plugins → dist/types/plugins}/autoplay/lg-autoplay.d.ts +22 -22
  187. package/{plugins → dist/types/plugins}/comment/lg-comment-settings.d.ts +36 -33
  188. package/{plugins → dist/types/plugins}/comment/lg-comment.d.ts +25 -25
  189. package/{plugins → dist/types/plugins}/fullscreen/lg-fullscreen-settings.d.ts +17 -14
  190. package/{plugins → dist/types/plugins}/fullscreen/lg-fullscreen.d.ts +16 -16
  191. package/dist/types/plugins/hash/lg-hash-settings.d.ts +28 -0
  192. package/{plugins → dist/types/plugins}/hash/lg-hash.d.ts +25 -23
  193. package/dist/types/plugins/justified/lg-justified-settings.d.ts +42 -0
  194. package/dist/types/plugins/justified/lg-justified.d.ts +55 -0
  195. package/{plugins → dist/types/plugins}/mediumZoom/lg-medium-zoom-settings.d.ts +16 -16
  196. package/{plugins → dist/types/plugins}/mediumZoom/lg-medium-zoom.d.ts +12 -12
  197. package/dist/types/plugins/originCrop/lg-origin-crop-settings.d.ts +12 -0
  198. package/dist/types/plugins/originCrop/lg-origin-crop.d.ts +79 -0
  199. package/{plugins → dist/types/plugins}/pager/lg-pager-settings.d.ts +7 -7
  200. package/{plugins → dist/types/plugins}/pager/lg-pager.d.ts +13 -13
  201. package/{plugins → dist/types/plugins}/relativeCaption/lg-relative-caption-settings.d.ts +7 -7
  202. package/{plugins → dist/types/plugins}/relativeCaption/lg-relative-caption.d.ts +14 -14
  203. package/{plugins → dist/types/plugins}/rotate/lg-rotate-settings.d.ts +47 -45
  204. package/{plugins → dist/types/plugins}/rotate/lg-rotate.d.ts +25 -24
  205. package/{plugins → dist/types/plugins}/share/lg-fb-share-utils.d.ts +2 -2
  206. package/{plugins → dist/types/plugins}/share/lg-pinterest-share-utils.d.ts +2 -2
  207. package/{plugins → dist/types/plugins}/share/lg-share-settings.d.ts +71 -56
  208. package/dist/types/plugins/share/lg-share.d.ts +33 -0
  209. package/dist/types/plugins/share/lg-twitter-share-utils.d.ts +4 -0
  210. package/{plugins → dist/types/plugins}/share/types.d.ts +6 -6
  211. package/{plugins → dist/types/plugins}/thumbnail/lg-thumbnail-settings.d.ts +85 -70
  212. package/dist/types/plugins/thumbnail/lg-thumbnail.d.ts +88 -0
  213. package/{plugins → dist/types/plugins}/video/lg-video-settings.d.ts +94 -71
  214. package/{plugins → dist/types/plugins}/video/lg-video.d.ts +116 -104
  215. package/{plugins → dist/types/plugins}/video/types.d.ts +8 -8
  216. package/{plugins → dist/types/plugins}/vimeoThumbnail/lg-vimeo-thumbnail-settings.d.ts +11 -11
  217. package/{plugins → dist/types/plugins}/vimeoThumbnail/lg-vimeo-thumbnail.d.ts +14 -14
  218. package/{plugins → dist/types/plugins}/zoom/lg-zoom-settings.d.ts +54 -51
  219. package/{plugins → dist/types/plugins}/zoom/lg-zoom.d.ts +145 -108
  220. package/{types.d.ts → dist/types/types.d.ts} +40 -40
  221. package/package.json +222 -8
  222. package/angular/10/README.md +0 -24
  223. package/angular/10/bundles/lightgallery-angular-10.umd.js +0 -289
  224. package/angular/10/bundles/lightgallery-angular-10.umd.js.map +0 -1
  225. package/angular/10/bundles/lightgallery-angular-10.umd.min.js +0 -2
  226. package/angular/10/bundles/lightgallery-angular-10.umd.min.js.map +0 -1
  227. package/angular/10/esm2015/lib/lightgallery-angular.component.js +0 -225
  228. package/angular/10/esm2015/lib/lightgallery-angular.module.js +0 -17
  229. package/angular/10/esm2015/lib/lightgallery-angular.service.js +0 -14
  230. package/angular/10/esm2015/lightgallery-angular-10.js +0 -5
  231. package/angular/10/esm2015/public-api.js +0 -7
  232. package/angular/10/fesm2015/lightgallery-angular-10.js +0 -261
  233. package/angular/10/fesm2015/lightgallery-angular-10.js.map +0 -1
  234. package/angular/10/lib/lightgallery-angular.component.d.ts +0 -39
  235. package/angular/10/lib/lightgallery-angular.component.d.ts.map +0 -1
  236. package/angular/10/lib/lightgallery-angular.module.d.ts +0 -7
  237. package/angular/10/lib/lightgallery-angular.module.d.ts.map +0 -1
  238. package/angular/10/lib/lightgallery-angular.service.d.ts +0 -7
  239. package/angular/10/lib/lightgallery-angular.service.d.ts.map +0 -1
  240. package/angular/10/lightgallery-angular-10.d.ts +0 -6
  241. package/angular/10/lightgallery-angular-10.d.ts.map +0 -1
  242. package/angular/10/package.json +0 -21
  243. package/angular/10/public-api.d.ts +0 -4
  244. package/angular/10/public-api.d.ts.map +0 -1
  245. package/angular/11/README.md +0 -24
  246. package/angular/11/bundles/lightgallery-angular-11.umd.js +0 -290
  247. package/angular/11/bundles/lightgallery-angular-11.umd.js.map +0 -1
  248. package/angular/11/bundles/lightgallery-angular-11.umd.min.js +0 -2
  249. package/angular/11/bundles/lightgallery-angular-11.umd.min.js.map +0 -1
  250. package/angular/11/esm2015/lib/lightgallery-angular.component.js +0 -225
  251. package/angular/11/esm2015/lib/lightgallery-angular.module.js +0 -18
  252. package/angular/11/esm2015/lib/lightgallery-angular.service.js +0 -14
  253. package/angular/11/esm2015/lightgallery-angular-11.js +0 -5
  254. package/angular/11/esm2015/public-api.js +0 -7
  255. package/angular/11/fesm2015/lightgallery-angular-11.js +0 -262
  256. package/angular/11/fesm2015/lightgallery-angular-11.js.map +0 -1
  257. package/angular/11/lib/lightgallery-angular.component.d.ts +0 -39
  258. package/angular/11/lib/lightgallery-angular.component.d.ts.map +0 -1
  259. package/angular/11/lib/lightgallery-angular.module.d.ts +0 -8
  260. package/angular/11/lib/lightgallery-angular.module.d.ts.map +0 -1
  261. package/angular/11/lib/lightgallery-angular.service.d.ts +0 -7
  262. package/angular/11/lib/lightgallery-angular.service.d.ts.map +0 -1
  263. package/angular/11/lightgallery-angular-11.d.ts +0 -6
  264. package/angular/11/lightgallery-angular-11.d.ts.map +0 -1
  265. package/angular/11/package.json +0 -21
  266. package/angular/11/public-api.d.ts +0 -4
  267. package/angular/11/public-api.d.ts.map +0 -1
  268. package/angular/12/README.md +0 -24
  269. package/angular/12/bundles/lightgallery-angular-12.umd.js +0 -296
  270. package/angular/12/bundles/lightgallery-angular-12.umd.js.map +0 -1
  271. package/angular/12/esm2015/lib/lightgallery-angular.component.js +0 -221
  272. package/angular/12/esm2015/lib/lightgallery-angular.module.js +0 -17
  273. package/angular/12/esm2015/lib/lightgallery-angular.service.js +0 -14
  274. package/angular/12/esm2015/lightgallery-angular-12.js +0 -5
  275. package/angular/12/esm2015/public-api.js +0 -7
  276. package/angular/12/fesm2015/lightgallery-angular-12.js +0 -258
  277. package/angular/12/fesm2015/lightgallery-angular-12.js.map +0 -1
  278. package/angular/12/lib/lightgallery-angular.component.d.ts +0 -38
  279. package/angular/12/lib/lightgallery-angular.module.d.ts +0 -7
  280. package/angular/12/lib/lightgallery-angular.service.d.ts +0 -6
  281. package/angular/12/lightgallery-angular-12.d.ts +0 -5
  282. package/angular/12/package.json +0 -18
  283. package/angular/12/public-api.d.ts +0 -3
  284. package/angular/13/README.md +0 -24
  285. package/angular/13/esm2020/lib/lightgallery-angular.component.mjs +0 -221
  286. package/angular/13/esm2020/lib/lightgallery-angular.module.mjs +0 -17
  287. package/angular/13/esm2020/lib/lightgallery-angular.service.mjs +0 -14
  288. package/angular/13/esm2020/lightgallery-angular-13.mjs +0 -5
  289. package/angular/13/esm2020/public-api.mjs +0 -7
  290. package/angular/13/fesm2015/lightgallery-angular-13.mjs +0 -258
  291. package/angular/13/fesm2015/lightgallery-angular-13.mjs.map +0 -1
  292. package/angular/13/fesm2020/lightgallery-angular-13.mjs +0 -258
  293. package/angular/13/fesm2020/lightgallery-angular-13.mjs.map +0 -1
  294. package/angular/13/lib/lightgallery-angular.component.d.ts +0 -38
  295. package/angular/13/lib/lightgallery-angular.module.d.ts +0 -7
  296. package/angular/13/lib/lightgallery-angular.service.d.ts +0 -6
  297. package/angular/13/lightgallery-angular-13.d.ts +0 -5
  298. package/angular/13/package.json +0 -31
  299. package/angular/13/public-api.d.ts +0 -3
  300. package/angular/14/README.md +0 -24
  301. package/angular/14/esm2020/lib/lightgallery-angular.component.mjs +0 -217
  302. package/angular/14/esm2020/lib/lightgallery-angular.module.mjs +0 -17
  303. package/angular/14/esm2020/lib/lightgallery-angular.service.mjs +0 -14
  304. package/angular/14/esm2020/lightgallery-angular-14.mjs +0 -5
  305. package/angular/14/esm2020/public-api.mjs +0 -7
  306. package/angular/14/fesm2015/lightgallery-angular-14.mjs +0 -254
  307. package/angular/14/fesm2015/lightgallery-angular-14.mjs.map +0 -1
  308. package/angular/14/fesm2020/lightgallery-angular-14.mjs +0 -254
  309. package/angular/14/fesm2020/lightgallery-angular-14.mjs.map +0 -1
  310. package/angular/14/index.d.ts +0 -5
  311. package/angular/14/lib/lightgallery-angular.component.d.ts +0 -38
  312. package/angular/14/lib/lightgallery-angular.module.d.ts +0 -7
  313. package/angular/14/lib/lightgallery-angular.service.d.ts +0 -6
  314. package/angular/14/package.json +0 -31
  315. package/angular/14/public-api.d.ts +0 -3
  316. package/angular/15/README.md +0 -24
  317. package/angular/15/esm2022/lib/lightgallery-angular.component.mjs +0 -218
  318. package/angular/15/esm2022/lib/lightgallery-angular.module.mjs +0 -18
  319. package/angular/15/esm2022/lib/lightgallery-angular.service.mjs +0 -15
  320. package/angular/15/esm2022/lightgallery-angular-15.mjs +0 -5
  321. package/angular/15/esm2022/public-api.mjs +0 -7
  322. package/angular/15/fesm2022/lightgallery-angular-15.mjs +0 -254
  323. package/angular/15/fesm2022/lightgallery-angular-15.mjs.map +0 -1
  324. package/angular/15/index.d.ts +0 -5
  325. package/angular/15/lib/lightgallery-angular.component.d.ts +0 -38
  326. package/angular/15/lib/lightgallery-angular.module.d.ts +0 -7
  327. package/angular/15/lib/lightgallery-angular.service.d.ts +0 -6
  328. package/angular/15/package.json +0 -25
  329. package/angular/15/public-api.d.ts +0 -3
  330. package/angular/16/README.md +0 -24
  331. package/angular/16/esm2022/lib/lightgallery-angular.component.mjs +0 -218
  332. package/angular/16/esm2022/lib/lightgallery-angular.module.mjs +0 -18
  333. package/angular/16/esm2022/lib/lightgallery-angular.service.mjs +0 -15
  334. package/angular/16/esm2022/lightgallery-angular-16.mjs +0 -5
  335. package/angular/16/esm2022/public-api.mjs +0 -7
  336. package/angular/16/fesm2022/lightgallery-angular-16.mjs +0 -254
  337. package/angular/16/fesm2022/lightgallery-angular-16.mjs.map +0 -1
  338. package/angular/16/index.d.ts +0 -5
  339. package/angular/16/lib/lightgallery-angular.component.d.ts +0 -38
  340. package/angular/16/lib/lightgallery-angular.module.d.ts +0 -7
  341. package/angular/16/lib/lightgallery-angular.service.d.ts +0 -6
  342. package/angular/16/package.json +0 -25
  343. package/angular/16/public-api.d.ts +0 -3
  344. package/angular/9/README.md +0 -24
  345. package/angular/9/bundles/lightgallery-angular-9.umd.js +0 -271
  346. package/angular/9/bundles/lightgallery-angular-9.umd.js.map +0 -1
  347. package/angular/9/bundles/lightgallery-angular-9.umd.min.js +0 -2
  348. package/angular/9/bundles/lightgallery-angular-9.umd.min.js.map +0 -1
  349. package/angular/9/esm2015/lib/lightgallery-angular.component.js +0 -225
  350. package/angular/9/esm2015/lib/lightgallery-angular.module.js +0 -17
  351. package/angular/9/esm2015/lib/lightgallery-angular.service.js +0 -14
  352. package/angular/9/esm2015/lightgallery-angular-9.js +0 -5
  353. package/angular/9/esm2015/public-api.js +0 -7
  354. package/angular/9/esm5/lib/lightgallery-angular.component.js +0 -228
  355. package/angular/9/esm5/lib/lightgallery-angular.module.js +0 -21
  356. package/angular/9/esm5/lib/lightgallery-angular.service.js +0 -17
  357. package/angular/9/esm5/lightgallery-angular-9.js +0 -5
  358. package/angular/9/esm5/public-api.js +0 -7
  359. package/angular/9/fesm2015/lightgallery-angular-9.js +0 -261
  360. package/angular/9/fesm2015/lightgallery-angular-9.js.map +0 -1
  361. package/angular/9/fesm5/lightgallery-angular-9.js +0 -268
  362. package/angular/9/fesm5/lightgallery-angular-9.js.map +0 -1
  363. package/angular/9/lib/lightgallery-angular.component.d.ts +0 -38
  364. package/angular/9/lib/lightgallery-angular.module.d.ts +0 -6
  365. package/angular/9/lib/lightgallery-angular.service.d.ts +0 -6
  366. package/angular/9/lightgallery-angular-9.d.ts +0 -5
  367. package/angular/9/package.json +0 -23
  368. package/angular/9/public-api.d.ts +0 -3
  369. package/angular/README.md +0 -24
  370. package/angular/esm2022/lib/lightgallery-angular.component.mjs +0 -218
  371. package/angular/esm2022/lib/lightgallery-angular.module.mjs +0 -18
  372. package/angular/esm2022/lib/lightgallery-angular.service.mjs +0 -15
  373. package/angular/esm2022/lightgallery-angular.mjs +0 -5
  374. package/angular/esm2022/public-api.mjs +0 -7
  375. package/angular/fesm2022/lightgallery-angular.mjs +0 -254
  376. package/angular/fesm2022/lightgallery-angular.mjs.map +0 -1
  377. package/angular/index.d.ts +0 -5
  378. package/angular/lib/lightgallery-angular.component.d.ts +0 -38
  379. package/angular/lib/lightgallery-angular.module.d.ts +0 -7
  380. package/angular/lib/lightgallery-angular.service.d.ts +0 -6
  381. package/angular/package.json +0 -25
  382. package/angular/public-api.d.ts +0 -3
  383. package/css/lg-fullscreen.css +0 -8
  384. package/css/lg-fullscreen.css.map +0 -1
  385. package/css/lg-share.css.map +0 -1
  386. package/css/lg-thumbnail.css.map +0 -1
  387. package/css/lg-transitions.css.map +0 -1
  388. package/css/lg-zoom.css.map +0 -1
  389. package/css/lightgallery-bundle.css.map +0 -1
  390. package/css/lightgallery-bundle.min.css +0 -1
  391. package/css/lightgallery-core.css.map +0 -1
  392. package/css/lightgallery.css.map +0 -1
  393. package/fonts/lg.svg +0 -54
  394. package/fonts/lg.ttf +0 -0
  395. package/fonts/lg.woff +0 -0
  396. package/fonts/lg.woff2 +0 -0
  397. package/lib/index.js +0 -8
  398. package/lib/index.js.map +0 -1
  399. package/lib/lg-events.js +0 -37
  400. package/lib/lg-events.js.map +0 -1
  401. package/lib/lg-plugin.js +0 -13
  402. package/lib/lg-plugin.js.map +0 -1
  403. package/lib/lg-settings.js +0 -83
  404. package/lib/lg-settings.js.map +0 -1
  405. package/lib/lg-utils.js +0 -328
  406. package/lib/lg-utils.js.map +0 -1
  407. package/lib/lgQuery.js +0 -385
  408. package/lib/lgQuery.js.map +0 -1
  409. package/lib/lightgallery.js +0 -1949
  410. package/lib/lightgallery.js.map +0 -1
  411. package/lib/plugins/autoplay/lg-autoplay-settings.js +0 -16
  412. package/lib/plugins/autoplay/lg-autoplay-settings.js.map +0 -1
  413. package/lib/plugins/autoplay/lg-autoplay.js +0 -184
  414. package/lib/plugins/autoplay/lg-autoplay.js.map +0 -1
  415. package/lib/plugins/comment/lg-comment-settings.js +0 -17
  416. package/lib/plugins/comment/lg-comment-settings.js.map +0 -1
  417. package/lib/plugins/comment/lg-comment.js +0 -140
  418. package/lib/plugins/comment/lg-comment.js.map +0 -1
  419. package/lib/plugins/fullscreen/lg-fullscreen-settings.js +0 -10
  420. package/lib/plugins/fullscreen/lg-fullscreen-settings.js.map +0 -1
  421. package/lib/plugins/fullscreen/lg-fullscreen.js +0 -108
  422. package/lib/plugins/fullscreen/lg-fullscreen.js.map +0 -1
  423. package/lib/plugins/hash/lg-hash-settings.js +0 -9
  424. package/lib/plugins/hash/lg-hash-settings.js.map +0 -1
  425. package/lib/plugins/hash/lg-hash.js +0 -139
  426. package/lib/plugins/hash/lg-hash.js.map +0 -1
  427. package/lib/plugins/mediumZoom/lg-medium-zoom-settings.js +0 -9
  428. package/lib/plugins/mediumZoom/lg-medium-zoom-settings.js.map +0 -1
  429. package/lib/plugins/mediumZoom/lg-medium-zoom.js +0 -73
  430. package/lib/plugins/mediumZoom/lg-medium-zoom.js.map +0 -1
  431. package/lib/plugins/pager/lg-pager-settings.js +0 -7
  432. package/lib/plugins/pager/lg-pager-settings.js.map +0 -1
  433. package/lib/plugins/pager/lg-pager.js +0 -82
  434. package/lib/plugins/pager/lg-pager.js.map +0 -1
  435. package/lib/plugins/relativeCaption/lg-relative-caption-settings.js +0 -7
  436. package/lib/plugins/relativeCaption/lg-relative-caption-settings.js.map +0 -1
  437. package/lib/plugins/relativeCaption/lg-relative-caption.js +0 -97
  438. package/lib/plugins/relativeCaption/lg-relative-caption.js.map +0 -1
  439. package/lib/plugins/rotate/lg-rotate-settings.js +0 -18
  440. package/lib/plugins/rotate/lg-rotate-settings.js.map +0 -1
  441. package/lib/plugins/rotate/lg-rotate.js +0 -206
  442. package/lib/plugins/rotate/lg-rotate.js.map +0 -1
  443. package/lib/plugins/share/lg-fb-share-utils.js +0 -10
  444. package/lib/plugins/share/lg-fb-share-utils.js.map +0 -1
  445. package/lib/plugins/share/lg-pinterest-share-utils.js +0 -17
  446. package/lib/plugins/share/lg-pinterest-share-utils.js.map +0 -1
  447. package/lib/plugins/share/lg-share-settings.js +0 -15
  448. package/lib/plugins/share/lg-share-settings.js.map +0 -1
  449. package/lib/plugins/share/lg-share.js +0 -130
  450. package/lib/plugins/share/lg-share.js.map +0 -1
  451. package/lib/plugins/share/lg-twitter-share-utils.js +0 -11
  452. package/lib/plugins/share/lg-twitter-share-utils.js.map +0 -1
  453. package/lib/plugins/share/types.js +0 -3
  454. package/lib/plugins/share/types.js.map +0 -1
  455. package/lib/plugins/thumbnail/lg-thumbnail-settings.js +0 -23
  456. package/lib/plugins/thumbnail/lg-thumbnail-settings.js.map +0 -1
  457. package/lib/plugins/thumbnail/lg-thumbnail.js +0 -414
  458. package/lib/plugins/thumbnail/lg-thumbnail.js.map +0 -1
  459. package/lib/plugins/video/lg-video-settings.js +0 -15
  460. package/lib/plugins/video/lg-video-settings.js.map +0 -1
  461. package/lib/plugins/video/lg-video-utils.js +0 -84
  462. package/lib/plugins/video/lg-video-utils.js.map +0 -1
  463. package/lib/plugins/video/lg-video.js +0 -411
  464. package/lib/plugins/video/lg-video.js.map +0 -1
  465. package/lib/plugins/video/types.js +0 -3
  466. package/lib/plugins/video/types.js.map +0 -1
  467. package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js +0 -8
  468. package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js.map +0 -1
  469. package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js +0 -122
  470. package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js.map +0 -1
  471. package/lib/plugins/zoom/lg-zoom-settings.js +0 -21
  472. package/lib/plugins/zoom/lg-zoom-settings.js.map +0 -1
  473. package/lib/plugins/zoom/lg-zoom.js +0 -909
  474. package/lib/plugins/zoom/lg-zoom.js.map +0 -1
  475. package/lib/types.js +0 -3
  476. package/lib/types.js.map +0 -1
  477. package/lightgallery-2.9.0.tgz +0 -0
  478. package/lightgallery.es5.js +0 -2786
  479. package/lightgallery.es5.js.map +0 -1
  480. package/lightgallery.min.js +0 -8
  481. package/lightgallery.umd.js +0 -2794
  482. package/lightgallery.umd.js.map +0 -1
  483. package/lit/custom-elements.json +0 -82
  484. package/lit/lightgallery.esm.js +0 -59
  485. package/lit/lightgallery.umd.js +0 -37
  486. package/lit/package.json +0 -8
  487. package/plugins/autoplay/lg-autoplay.es5.js +0 -250
  488. package/plugins/autoplay/lg-autoplay.es5.js.map +0 -1
  489. package/plugins/autoplay/lg-autoplay.min.js +0 -8
  490. package/plugins/autoplay/lg-autoplay.umd.js +0 -258
  491. package/plugins/autoplay/lg-autoplay.umd.js.map +0 -1
  492. package/plugins/autoplay/package.json +0 -7
  493. package/plugins/comment/lg-comment.es5.js +0 -205
  494. package/plugins/comment/lg-comment.es5.js.map +0 -1
  495. package/plugins/comment/lg-comment.min.js +0 -8
  496. package/plugins/comment/lg-comment.umd.js +0 -213
  497. package/plugins/comment/lg-comment.umd.js.map +0 -1
  498. package/plugins/comment/package.json +0 -7
  499. package/plugins/fullscreen/lg-fullscreen.es5.js +0 -135
  500. package/plugins/fullscreen/lg-fullscreen.es5.js.map +0 -1
  501. package/plugins/fullscreen/lg-fullscreen.min.js +0 -8
  502. package/plugins/fullscreen/lg-fullscreen.umd.js +0 -143
  503. package/plugins/fullscreen/lg-fullscreen.umd.js.map +0 -1
  504. package/plugins/fullscreen/package.json +0 -7
  505. package/plugins/hash/lg-hash-settings.d.ts +0 -16
  506. package/plugins/hash/lg-hash.es5.js +0 -198
  507. package/plugins/hash/lg-hash.es5.js.map +0 -1
  508. package/plugins/hash/lg-hash.min.js +0 -8
  509. package/plugins/hash/lg-hash.umd.js +0 -206
  510. package/plugins/hash/lg-hash.umd.js.map +0 -1
  511. package/plugins/hash/package.json +0 -7
  512. package/plugins/mediumZoom/lg-medium-zoom.es5.js +0 -132
  513. package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +0 -1
  514. package/plugins/mediumZoom/lg-medium-zoom.min.js +0 -8
  515. package/plugins/mediumZoom/lg-medium-zoom.umd.js +0 -140
  516. package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +0 -1
  517. package/plugins/mediumZoom/package.json +0 -7
  518. package/plugins/pager/lg-pager.es5.js +0 -139
  519. package/plugins/pager/lg-pager.es5.js.map +0 -1
  520. package/plugins/pager/lg-pager.min.js +0 -8
  521. package/plugins/pager/lg-pager.umd.js +0 -147
  522. package/plugins/pager/lg-pager.umd.js.map +0 -1
  523. package/plugins/pager/package.json +0 -7
  524. package/plugins/relativeCaption/lg-relative-caption.es5.js +0 -154
  525. package/plugins/relativeCaption/lg-relative-caption.es5.js.map +0 -1
  526. package/plugins/relativeCaption/lg-relative-caption.min.js +0 -8
  527. package/plugins/relativeCaption/lg-relative-caption.umd.js +0 -162
  528. package/plugins/relativeCaption/lg-relative-caption.umd.js.map +0 -1
  529. package/plugins/relativeCaption/package.json +0 -7
  530. package/plugins/rotate/lg-rotate.es5.js +0 -274
  531. package/plugins/rotate/lg-rotate.es5.js.map +0 -1
  532. package/plugins/rotate/lg-rotate.min.js +0 -8
  533. package/plugins/rotate/lg-rotate.umd.js +0 -282
  534. package/plugins/rotate/lg-rotate.umd.js.map +0 -1
  535. package/plugins/rotate/package.json +0 -7
  536. package/plugins/share/lg-share.d.ts +0 -15
  537. package/plugins/share/lg-share.es5.js +0 -219
  538. package/plugins/share/lg-share.es5.js.map +0 -1
  539. package/plugins/share/lg-share.min.js +0 -8
  540. package/plugins/share/lg-share.umd.js +0 -227
  541. package/plugins/share/lg-share.umd.js.map +0 -1
  542. package/plugins/share/lg-twitter-share-utils.d.ts +0 -2
  543. package/plugins/share/package.json +0 -7
  544. package/plugins/thumbnail/lg-thumbnail.d.ts +0 -48
  545. package/plugins/thumbnail/lg-thumbnail.es5.js +0 -487
  546. package/plugins/thumbnail/lg-thumbnail.es5.js.map +0 -1
  547. package/plugins/thumbnail/lg-thumbnail.min.js +0 -8
  548. package/plugins/thumbnail/lg-thumbnail.umd.js +0 -495
  549. package/plugins/thumbnail/lg-thumbnail.umd.js.map +0 -1
  550. package/plugins/thumbnail/package.json +0 -7
  551. package/plugins/video/lg-video-utils.d.ts +0 -10
  552. package/plugins/video/lg-video.es5.js +0 -545
  553. package/plugins/video/lg-video.es5.js.map +0 -1
  554. package/plugins/video/lg-video.min.js +0 -8
  555. package/plugins/video/lg-video.umd.js +0 -553
  556. package/plugins/video/lg-video.umd.js.map +0 -1
  557. package/plugins/video/package.json +0 -7
  558. package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +0 -182
  559. package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +0 -1
  560. package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +0 -8
  561. package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +0 -190
  562. package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +0 -1
  563. package/plugins/vimeoThumbnail/package.json +0 -7
  564. package/plugins/zoom/lg-zoom.es5.js +0 -980
  565. package/plugins/zoom/lg-zoom.es5.js.map +0 -1
  566. package/plugins/zoom/lg-zoom.min.js +0 -8
  567. package/plugins/zoom/lg-zoom.umd.js +0 -988
  568. package/plugins/zoom/lg-zoom.umd.js.map +0 -1
  569. package/plugins/zoom/package.json +0 -7
  570. package/react/Lightgallery.d.ts +0 -33
  571. package/react/Lightgallery.es5.js +0 -2988
  572. package/react/Lightgallery.es5.js.map +0 -1
  573. package/react/Lightgallery.umd.js +0 -2994
  574. package/react/Lightgallery.umd.js.map +0 -1
  575. package/react/package.json +0 -7
  576. package/scss/_lg-fonts.scss +0 -27
  577. package/scss/lg-fullscreen.scss +0 -9
  578. package/vue/LightGallery.vue.d.ts +0 -37
  579. package/vue/LightGalleryVue.common.js +0 -9343
  580. package/vue/LightGalleryVue.common.js.map +0 -1
  581. package/vue/LightGalleryVue.umd.js +0 -9353
  582. package/vue/LightGalleryVue.umd.js.map +0 -1
  583. package/vue/LightGalleryVue.umd.min.js +0 -8
  584. package/vue/LightGalleryVue.umd.min.js.map +0 -1
  585. package/vue/package.json +0 -7
  586. /package/{css → dist/css}/lg-medium-zoom.css +0 -0
  587. /package/{css → dist/css}/lg-medium-zoom.css.map +0 -0
  588. /package/{css → dist/css}/lg-pager.css +0 -0
  589. /package/{css → dist/css}/lg-relative-caption.css +0 -0
  590. /package/{css → dist/css}/lg-relative-caption.css.map +0 -0
  591. /package/{css → dist/css}/lg-video.css +0 -0
  592. /package/{css → dist/css}/lg-video.css.map +0 -0
  593. /package/{images → dist/images}/loading.gif +0 -0
  594. /package/{scss → dist/scss}/_lg-mixins.scss +0 -0
  595. /package/{scss → dist/scss}/lg-medium-zoom.scss +0 -0
  596. /package/{scss → dist/scss}/lg-pager.scss +0 -0
  597. /package/{scss → dist/scss}/lg-relative-caption.scss +0 -0
  598. /package/{scss → dist/scss}/lg-transitions.scss +0 -0
  599. /package/{scss → dist/scss}/lg-video.scss +0 -0
  600. /package/{scss → dist/scss}/transitions/_index.scss +0 -0
  601. /package/{scss → dist/scss}/transitions/_lg-lollipop-rev.scss +0 -0
  602. /package/{scss → dist/scss}/transitions/_lg-lollipop.scss +0 -0
  603. /package/{scss → dist/scss}/transitions/_lg-rotate-rev.scss +0 -0
  604. /package/{scss → dist/scss}/transitions/_lg-rotate.scss +0 -0
  605. /package/{scss → dist/scss}/transitions/_lg-slide-skew-cross-rev.scss +0 -0
  606. /package/{scss → dist/scss}/transitions/_lg-slide-skew-cross.scss +0 -0
  607. /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-rev.scss +0 -0
  608. /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-y-rev.scss +0 -0
  609. /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-y.scss +0 -0
  610. /package/{scss → dist/scss}/transitions/_lg-slide-skew-only.scss +0 -0
  611. /package/{scss → dist/scss}/transitions/_lg-slide-skew-rev.scss +0 -0
  612. /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-cross-rev.scss +0 -0
  613. /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-cross.scss +0 -0
  614. /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-rev.scss +0 -0
  615. /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver.scss +0 -0
  616. /package/{scss → dist/scss}/transitions/_lg-slide-skew.scss +0 -0
  617. /package/{scss → dist/scss}/transitions/_lg-slide-vertical-growth.scss +0 -0
  618. /package/{scss → dist/scss}/transitions/_lg-slide-vertical.scss +0 -0
  619. /package/{scss → dist/scss}/transitions/_lg-tube.scss +0 -0
@@ -0,0 +1,1412 @@
1
+ /*!
2
+ * lightgallery | 3.0.0-beta.3 | October 1st 2026
3
+ * http://www.lightgalleryjs.com/
4
+ * Copyright (c) 2020 Sachin Neravath;
5
+ * @license GPLv3
6
+ */
7
+ const SPRING_SETTLE_DAMPING = 1;
8
+ const SPRING_BOUNCE_DAMPING = 0.82;
9
+ const SPRING_NATURAL_FREQUENCY = 12;
10
+ const DECELERATION_RATE = 0.995;
11
+ function project(velocity, decelerationRate = DECELERATION_RATE) {
12
+ return velocity * decelerationRate / (1 - decelerationRate);
13
+ }
14
+ function stepSpring(state, target, dtMs, {
15
+ dampingRatio = SPRING_SETTLE_DAMPING,
16
+ naturalFrequency = SPRING_NATURAL_FREQUENCY
17
+ } = {}) {
18
+ const t = dtMs / 1e3;
19
+ const w0 = naturalFrequency;
20
+ const zeta = Math.min(dampingRatio, 1);
21
+ const x0 = state.position - target;
22
+ const v0 = state.velocity * 1e3;
23
+ const decay = Math.exp(-zeta * w0 * t);
24
+ let x;
25
+ let v;
26
+ if (zeta < 1) {
27
+ const wd = w0 * Math.sqrt(1 - zeta * zeta);
28
+ const a = x0;
29
+ const b = (v0 + zeta * w0 * x0) / wd;
30
+ const cos = Math.cos(wd * t);
31
+ const sin = Math.sin(wd * t);
32
+ x = decay * (a * cos + b * sin);
33
+ v = decay * ((b * wd - zeta * w0 * a) * cos - (a * wd + zeta * w0 * b) * sin);
34
+ } else {
35
+ const b = v0 + w0 * x0;
36
+ x = decay * (x0 + b * t);
37
+ v = decay * (b - w0 * (x0 + b * t));
38
+ }
39
+ return { position: target + x, velocity: v / 1e3 };
40
+ }
41
+ function isSpringSettled(state, target, restDelta = 0.3, restVelocity = 0.012) {
42
+ return Math.abs(state.position - target) < restDelta && Math.abs(state.velocity) < restVelocity;
43
+ }
44
+ function parseImageSize(lgSize, viewportWidth) {
45
+ if (!lgSize) {
46
+ return void 0;
47
+ }
48
+ let size = lgSize;
49
+ const responsiveSizes = lgSize.split(",");
50
+ if (responsiveSizes[1]) {
51
+ for (let i = 0; i < responsiveSizes.length; i++) {
52
+ const candidate = responsiveSizes[i].trim();
53
+ const responsiveWidth = parseInt(candidate.split("-")[2], 10);
54
+ if (responsiveWidth > viewportWidth) {
55
+ size = candidate;
56
+ break;
57
+ }
58
+ if (i === responsiveSizes.length - 1) {
59
+ size = candidate;
60
+ }
61
+ }
62
+ }
63
+ const parts = size.trim().split("-");
64
+ const width = parseInt(parts[0], 10);
65
+ const height = parseInt(parts[1], 10);
66
+ if (!Number.isFinite(width) || !Number.isFinite(height)) {
67
+ return void 0;
68
+ }
69
+ return { width, height };
70
+ }
71
+ function fitImageSize(size, containerWidth, containerHeight) {
72
+ const maxWidth = Math.min(containerWidth, size.width);
73
+ const maxHeight = Math.min(containerHeight, size.height);
74
+ const ratio = Math.min(maxWidth / size.width, maxHeight / size.height);
75
+ return { width: size.width * ratio, height: size.height * ratio };
76
+ }
77
+ const zoomDefaultIcons = {
78
+ zoomIn: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path transform="translate(0, 960) scale(1, -1)" d="M512 512.667h-86v-86h-42v86h-86v42h86v86h42v-86h86v-42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z"/></svg>',
79
+ zoomOut: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path transform="translate(0, 960) scale(1, -1)" d="M298 554.667h214v-42h-214v42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z"/></svg>',
80
+ actualSize: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path transform="translate(0, 960) scale(1, -1)" d="M384 853.334h426.667q53 0 90.5-37.5t37.5-90.5v-426.667q0-53-37.5-90.5t-90.5-37.5h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 53 37.5 90.5t90.5 37.5zM170.667 675.334v-547.333q0-17.667 12.5-30.167t30.167-12.5h547.333q-13.333-37.667-46.333-61.5t-74.333-23.833h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 41.333 23.833 74.333t61.5 46.333zM810.667 768h-426.667q-17.667 0-30.167-12.5t-12.5-30.167v-426.667q0-17.667 12.5-30.167t30.167-12.5h426.667q17.667 0 30.167 12.5t12.5 30.167v426.667q0 17.667-12.5 30.167t-30.167 12.5z"/></svg>'
81
+ };
82
+ function getPanBounds(imageWidth, imageHeight, containerWidth, containerHeight, scale) {
83
+ return {
84
+ maxX: Math.max(0, (imageWidth * scale - containerWidth) / 2),
85
+ maxY: Math.max(0, (imageHeight * scale - containerHeight) / 2)
86
+ };
87
+ }
88
+ function getActualSizeScale(naturalWidth, renderedWidth) {
89
+ if (!renderedWidth) {
90
+ return 2;
91
+ }
92
+ return naturalWidth / renderedWidth || 2;
93
+ }
94
+ function getPointZoomPan(point, prevPan, prevScale, newScale) {
95
+ const ratio = newScale / prevScale;
96
+ return {
97
+ x: point.x - (point.x - prevPan.x) * ratio,
98
+ y: point.y - (point.y - prevPan.y) * ratio
99
+ };
100
+ }
101
+ function clampPanToStage(pan, bounds, stageBottomExtra) {
102
+ const floorY = Math.min(-bounds.maxY + stageBottomExtra, bounds.maxY);
103
+ return {
104
+ x: Math.min(Math.max(pan.x, -bounds.maxX), bounds.maxX),
105
+ y: Math.min(Math.max(pan.y, floorY), bounds.maxY)
106
+ };
107
+ }
108
+ function getPinchPan(currentMid, startMid, startPan, startScale, scale) {
109
+ const projected = getPointZoomPan(startMid, startPan, startScale, scale);
110
+ return {
111
+ x: projected.x + (currentMid.x - startMid.x),
112
+ y: projected.y + (currentMid.y - startMid.y)
113
+ };
114
+ }
115
+ function getPointerDistance(a, b) {
116
+ return Math.sqrt(
117
+ (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)
118
+ );
119
+ }
120
+ const PINCH_UNDER_FRICTION = 0.15;
121
+ const PINCH_OVER_FRICTION = 0.05;
122
+ function getPinchScale(startDistance, currentDistance, startScale, maxScale, infiniteZoom, pinchToCloseArmed = false) {
123
+ if (startDistance <= 0) {
124
+ return startScale;
125
+ }
126
+ let scale = currentDistance / startDistance * startScale;
127
+ if (scale < 1 && !pinchToCloseArmed) {
128
+ scale = 1 + (scale - 1) * PINCH_UNDER_FRICTION;
129
+ }
130
+ const cap = Math.max(maxScale, 1);
131
+ if (!infiniteZoom && scale > cap) {
132
+ scale = cap + (scale - cap) * PINCH_OVER_FRICTION;
133
+ }
134
+ return scale;
135
+ }
136
+ function shouldCloseOnPinch(input) {
137
+ return input.pinchToClose && input.closable && input.scale < 1 && input.maxGestureScale <= 1;
138
+ }
139
+ function parseSrcset(srcset) {
140
+ const candidates = [];
141
+ if (typeof srcset !== "string") {
142
+ return candidates;
143
+ }
144
+ for (const entry of srcset.split(",")) {
145
+ const parts = entry.trim().split(/\s+/);
146
+ const url = parts[0];
147
+ if (!url) {
148
+ continue;
149
+ }
150
+ const descriptor = parts[1];
151
+ if (!descriptor) {
152
+ candidates.push({ url, density: 1 });
153
+ continue;
154
+ }
155
+ const value = parseFloat(descriptor);
156
+ if (Number.isNaN(value) || value <= 0) {
157
+ continue;
158
+ }
159
+ if (descriptor.endsWith("w")) {
160
+ candidates.push({ url, width: value });
161
+ } else if (descriptor.endsWith("x")) {
162
+ candidates.push({ url, density: value });
163
+ }
164
+ }
165
+ return candidates;
166
+ }
167
+ function matchesMedia(media, viewport) {
168
+ if (!media) {
169
+ return true;
170
+ }
171
+ const condition = /^\(\s*(min|max)-width:\s*([\d.]+)px\s*\)$/.exec(
172
+ media.trim()
173
+ );
174
+ if (!condition) {
175
+ return false;
176
+ }
177
+ const bound = parseFloat(condition[2]);
178
+ return condition[1] === "min" ? viewport.width >= bound : viewport.width <= bound;
179
+ }
180
+ function getActualSizeWidth(item, viewport, naturalWidth) {
181
+ if (item.width) {
182
+ const declared = parseFloat(item.width);
183
+ if (!Number.isNaN(declared) && declared > 0) {
184
+ return declared;
185
+ }
186
+ }
187
+ let candidates = [];
188
+ const sources = Array.isArray(item.sources) ? item.sources : [];
189
+ for (const source of sources) {
190
+ if (matchesMedia(source.media, viewport)) {
191
+ candidates = parseSrcset(source.srcset);
192
+ break;
193
+ }
194
+ }
195
+ if (!candidates.length && item.srcset) {
196
+ candidates = parseSrcset(item.srcset);
197
+ }
198
+ const widths = candidates.map((candidate) => candidate.width).filter((width) => width !== void 0);
199
+ if (widths.length) {
200
+ return Math.max(...widths);
201
+ }
202
+ const natural = parseImageSize(item.lgSize, viewport.width);
203
+ if (natural && natural.width > 0) {
204
+ return natural.width;
205
+ }
206
+ return naturalWidth;
207
+ }
208
+ const VELOCITY_WINDOW_MS = 100;
209
+ const MIN_DISPLACEMENT = 1;
210
+ const MIN_WINDOW_SPAN_MS = 5;
211
+ function pushVelocitySample(samples, sample, windowMs = VELOCITY_WINDOW_MS) {
212
+ return [...samples.filter((s) => sample.t - s.t <= windowMs), sample];
213
+ }
214
+ function getWindowedVelocity(samples, releaseTime, windowMs = VELOCITY_WINDOW_MS) {
215
+ const recent = samples.filter((s) => releaseTime - s.t <= windowMs);
216
+ if (recent.length < 2) {
217
+ return { x: 0, y: 0 };
218
+ }
219
+ const first = recent[0];
220
+ const last = recent[recent.length - 1];
221
+ const dt = last.t - first.t;
222
+ if (dt < MIN_WINDOW_SPAN_MS) {
223
+ return { x: 0, y: 0 };
224
+ }
225
+ const dx = last.x - first.x;
226
+ const dy = last.y - first.y;
227
+ return {
228
+ x: Math.abs(dx) > MIN_DISPLACEMENT ? dx / dt : 0,
229
+ y: Math.abs(dy) > MIN_DISPLACEMENT ? dy / dt : 0
230
+ };
231
+ }
232
+ function getRotatedVisualSize(width, height, transform) {
233
+ if (!transform) {
234
+ return { width, height };
235
+ }
236
+ const rotate = /rotate\((-?\d+(?:\.\d+)?)deg\)/.exec(transform);
237
+ const scale = /scale3d\((-?\d+(?:\.\d+)?)/.exec(transform);
238
+ const fit = (scale == null ? void 0 : scale[1]) ? Math.abs(parseFloat(scale[1])) : 1;
239
+ const degrees = (rotate == null ? void 0 : rotate[1]) ? parseFloat(rotate[1]) : 0;
240
+ const normalized = (degrees % 360 + 360) % 360;
241
+ return normalized === 90 || normalized === 270 ? { width: height * fit, height: width * fit } : { width: width * fit, height: height * fit };
242
+ }
243
+ const MAX_FRAME_MS = 64;
244
+ function runSprings(tracks, onFrame, onDone) {
245
+ let raf = 0;
246
+ let last = Date.now();
247
+ const states = tracks.map((t) => ({
248
+ position: t.from,
249
+ velocity: t.velocity
250
+ }));
251
+ const frame = () => {
252
+ const now = Date.now();
253
+ const dt = Math.min(Math.max(now - last, 0), MAX_FRAME_MS);
254
+ last = now;
255
+ let settled = true;
256
+ tracks.forEach((t, i) => {
257
+ states[i] = stepSpring(states[i], t.target, dt, t);
258
+ if (!isSpringSettled(states[i], t.target)) {
259
+ settled = false;
260
+ }
261
+ });
262
+ if (settled) {
263
+ onFrame(tracks.map((t) => t.target));
264
+ onDone == null ? void 0 : onDone();
265
+ return;
266
+ }
267
+ onFrame(states.map((s) => s.position));
268
+ raf = requestAnimationFrame(frame);
269
+ };
270
+ raf = requestAnimationFrame(frame);
271
+ return () => cancelAnimationFrame(raf);
272
+ }
273
+ const zoomSettings = {
274
+ scale: 1,
275
+ zoom: true,
276
+ infiniteZoom: true,
277
+ actualSize: true,
278
+ showZoomInOutIcons: false,
279
+ actualSizeIcons: {
280
+ zoomIn: "lg-zoom-in",
281
+ zoomOut: "lg-zoom-out"
282
+ },
283
+ enableZoomAfter: 300
284
+ };
285
+ const lGEvents = {
286
+ containerResize: "lgContainerResize",
287
+ beforeOpen: "lgBeforeOpen",
288
+ afterOpen: "lgAfterOpen",
289
+ slideItemLoad: "lgSlideItemLoad",
290
+ afterSlide: "lgAfterSlide",
291
+ rotateLeft: "lgRotateLeft",
292
+ rotateRight: "lgRotateRight",
293
+ flipHorizontal: "lgFlipHorizontal",
294
+ flipVertical: "lgFlipVertical"
295
+ };
296
+ var __defProp = Object.defineProperty;
297
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
298
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
299
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
300
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
301
+ var __spreadValues = (a, b) => {
302
+ for (var prop in b || (b = {}))
303
+ if (__hasOwnProp.call(b, prop))
304
+ __defNormalProp(a, prop, b[prop]);
305
+ if (__getOwnPropSymbols)
306
+ for (var prop of __getOwnPropSymbols(b)) {
307
+ if (__propIsEnum.call(b, prop))
308
+ __defNormalProp(a, prop, b[prop]);
309
+ }
310
+ return a;
311
+ };
312
+ const ZOOM_TRANSITION_DURATION = 500;
313
+ class Zoom {
314
+ constructor(instance, $LG) {
315
+ this.core = instance;
316
+ this.$LG = $LG;
317
+ this.settings = __spreadValues(__spreadValues({}, zoomSettings), this.core.settings);
318
+ return this;
319
+ }
320
+ // Append Zoom controls. Actual size, Zoom-in, Zoom-out
321
+ buildTemplates() {
322
+ var _a, _b, _c, _d, _e, _f;
323
+ const gestureButtons = this.core.settings.showGestureButtons !== false;
324
+ let zoomIcons = gestureButtons && this.settings.showZoomInOutIcons ? `<button id="${this.core.getIdName(
325
+ "lg-zoom-in"
326
+ )}" type="button" aria-label="${(_b = (_a = this.settings.zoomPluginStrings) == null ? void 0 : _a.zoomIn) != null ? _b : this.core.settings.strings.zoomIn}" class="lg-zoom-in lg-icon"></button><button id="${this.core.getIdName(
327
+ "lg-zoom-out"
328
+ )}" type="button" aria-label="${(_d = (_c = this.settings.zoomPluginStrings) == null ? void 0 : _c.zoomOut) != null ? _d : this.core.settings.strings.zoomOut}" class="lg-zoom-out lg-icon"></button>` : "";
329
+ if (gestureButtons && this.settings.actualSize) {
330
+ zoomIcons += `<button id="${this.core.getIdName(
331
+ "lg-actual-size"
332
+ )}" type="button" aria-label="${(_f = (_e = this.settings.zoomPluginStrings) == null ? void 0 : _e.viewActualSize) != null ? _f : this.core.settings.strings.viewActualSize}" class="${this.settings.actualSizeIcons.zoomIn} lg-icon"></button>`;
333
+ }
334
+ this.core.outer.addClass("lg-use-transition-for-zoom");
335
+ this.core.$toolbar.first().append(zoomIcons);
336
+ }
337
+ /**
338
+ * @desc Enable zoom option only once the image is completely loaded
339
+ * If zoomFromOrigin is true, Zoom is enabled once the dummy image has been inserted
340
+ *
341
+ * Zoom styles are defined under lg-zoomable CSS class.
342
+ */
343
+ enableZoom(event) {
344
+ let _speed = this.settings.enableZoomAfter + event.detail.delay;
345
+ if (this.$LG("body").first().hasClass("lg-from-hash") && event.detail.delay) {
346
+ _speed = 0;
347
+ } else {
348
+ this.$LG("body").first().removeClass("lg-from-hash");
349
+ }
350
+ this.zoomableTimeout = setTimeout(() => {
351
+ if (!this.isImageSlide(this.core.index)) {
352
+ return;
353
+ }
354
+ this.core.getSlideItem(event.detail.index).addClass("lg-zoomable");
355
+ if (event.detail.index === this.core.index) {
356
+ this.setZoomEssentials();
357
+ }
358
+ }, _speed + 30);
359
+ }
360
+ enableZoomOnSlideItemLoad() {
361
+ this.core.LGel.on(
362
+ `${lGEvents.slideItemLoad}.zoom`,
363
+ this.enableZoom.bind(this)
364
+ );
365
+ }
366
+ getDragCords(e) {
367
+ return {
368
+ x: e.pageX,
369
+ y: e.pageY
370
+ };
371
+ }
372
+ getSwipeCords(e) {
373
+ const x = e.touches[0].pageX;
374
+ const y = e.touches[0].pageY;
375
+ return {
376
+ x,
377
+ y
378
+ };
379
+ }
380
+ getDragAllowedAxises(scale, scaleDiff) {
381
+ if (!this.containerRect) {
382
+ return {
383
+ allowX: false,
384
+ allowY: false
385
+ };
386
+ }
387
+ const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first().get();
388
+ let height = 0;
389
+ let width = 0;
390
+ const rect = $image.getBoundingClientRect();
391
+ if (scale) {
392
+ const visual = this.getVisualImageSize(
393
+ $image,
394
+ $image.offsetWidth,
395
+ $image.offsetHeight
396
+ );
397
+ height = visual.height * scale;
398
+ width = visual.width * scale;
399
+ } else if (scaleDiff) {
400
+ height = rect.height + scaleDiff * rect.height;
401
+ width = rect.width + scaleDiff * rect.width;
402
+ } else if (this.core.currentImageSize) {
403
+ const visual = this.getVisualImageSize(
404
+ $image,
405
+ this.core.currentImageSize.width,
406
+ this.core.currentImageSize.height
407
+ );
408
+ height = visual.height * this.scale;
409
+ width = visual.width * this.scale;
410
+ } else {
411
+ height = rect.height;
412
+ width = rect.width;
413
+ }
414
+ const allowY = height > this.containerRect.height;
415
+ const allowX = width > this.containerRect.width;
416
+ return {
417
+ allowX,
418
+ allowY
419
+ };
420
+ }
421
+ setZoomEssentials() {
422
+ this.containerRect = this.core.$content.get().getBoundingClientRect();
423
+ }
424
+ /**
425
+ * @desc Image zoom
426
+ * Translate the wrap and scale the image to get better user experience
427
+ *
428
+ * @param {String} scale - Zoom decrement/increment value
429
+ */
430
+ zoomImage(scale, scaleDiff, reposition, resetToMax) {
431
+ if (!this.containerRect || Math.abs(scaleDiff) <= 0) return;
432
+ const offsetX = this.containerRect.width / 2 + this.containerRect.left;
433
+ const offsetY = this.containerRect.height / 2 + this.containerRect.top + this.scrollTop;
434
+ let originalX;
435
+ let originalY;
436
+ if (scale === 1) {
437
+ this.positionChanged = false;
438
+ }
439
+ if (this.positionChanged) {
440
+ const previousScale = this.scale - scaleDiff;
441
+ originalX = previousScale ? this.left / previousScale : 0;
442
+ originalY = previousScale ? this.top / previousScale : 0;
443
+ this.pageX = offsetX - originalX;
444
+ this.pageY = offsetY - originalY;
445
+ this.positionChanged = false;
446
+ }
447
+ let x;
448
+ let y;
449
+ let _x = offsetX - this.pageX;
450
+ let _y = offsetY - this.pageY;
451
+ if (scale - scaleDiff > 1) {
452
+ const scaleVal = (scale - scaleDiff) / Math.abs(scaleDiff);
453
+ _x = (scaleDiff < 0 ? -_x : _x) + this.left * (scaleVal + (scaleDiff < 0 ? -1 : 1));
454
+ _y = (scaleDiff < 0 ? -_y : _y) + this.top * (scaleVal + (scaleDiff < 0 ? -1 : 1));
455
+ x = _x / scaleVal;
456
+ y = _y / scaleVal;
457
+ } else {
458
+ const scaleVal = (scale - scaleDiff) * scaleDiff;
459
+ x = _x * scaleVal;
460
+ y = _y * scaleVal;
461
+ }
462
+ if (reposition) {
463
+ const clamped = this.clampPinchPan({ x, y }, scale);
464
+ x = clamped.x;
465
+ y = clamped.y;
466
+ }
467
+ this.setZoomStyles({
468
+ x,
469
+ y,
470
+ scale
471
+ });
472
+ this.left = x;
473
+ this.top = y;
474
+ if (resetToMax) {
475
+ this.setZoomImageSize();
476
+ }
477
+ }
478
+ resetImageTranslate(index) {
479
+ if (!this.isImageSlide(index)) {
480
+ return;
481
+ }
482
+ const $image = this.core.getSlideItem(index).find(".lg-image").first();
483
+ this.imageReset = false;
484
+ $image.removeClass(
485
+ "reset-transition reset-transition-y reset-transition-x"
486
+ );
487
+ this.core.outer.removeClass("lg-actual-size");
488
+ $image.css("width", "auto").css("height", "auto");
489
+ setTimeout(() => {
490
+ $image.removeClass("no-transition");
491
+ }, 10);
492
+ }
493
+ setZoomImageSize(delay = ZOOM_TRANSITION_DURATION) {
494
+ const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
495
+ setTimeout(() => {
496
+ if (this.core.touchAction) {
497
+ return;
498
+ }
499
+ const actualSizeScale = this.getCurrentImageActualSizeScale();
500
+ if (this.scale >= actualSizeScale) {
501
+ $image.addClass("no-transition");
502
+ this.imageReset = true;
503
+ }
504
+ }, delay);
505
+ setTimeout(() => {
506
+ if (this.core.touchAction) {
507
+ return;
508
+ }
509
+ const actualSizeScale = this.getCurrentImageActualSizeScale();
510
+ if (this.scale >= actualSizeScale) {
511
+ const dragAllowedAxises = this.getDragAllowedAxises(this.scale);
512
+ const image = $image.get();
513
+ const referenceWidth = this.getNaturalWidth(this.core.index);
514
+ const referenceHeight = image.naturalWidth > 0 ? referenceWidth * image.naturalHeight / image.naturalWidth : image.naturalHeight;
515
+ $image.css("width", referenceWidth + "px").css("height", referenceHeight + "px");
516
+ this.core.outer.addClass("lg-actual-size");
517
+ if (dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
518
+ $image.addClass("reset-transition");
519
+ } else if (dragAllowedAxises.allowX && !dragAllowedAxises.allowY) {
520
+ $image.addClass("reset-transition-x");
521
+ } else if (!dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
522
+ $image.addClass("reset-transition-y");
523
+ }
524
+ }
525
+ }, delay + 50);
526
+ }
527
+ /**
528
+ * @desc apply scale3d to image and translate to image wrap
529
+ * @param {style} X,Y and scale
530
+ */
531
+ setZoomStyles(style) {
532
+ const $imageWrap = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
533
+ const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
534
+ const $dummyImage = this.core.outer.find(".lg-current .lg-dummy-img").first();
535
+ this.scale = style.scale;
536
+ $image.css(
537
+ "transform",
538
+ "scale3d(" + style.scale + ", " + style.scale + ", 1)"
539
+ );
540
+ $dummyImage.css(
541
+ "transform",
542
+ "scale3d(" + style.scale + ", " + style.scale + ", 1)"
543
+ );
544
+ const transform = "translate3d(" + style.x + "px, " + style.y + "px, 0)";
545
+ $imageWrap.css("transform", transform);
546
+ }
547
+ /**
548
+ * @param index - Index of the current slide
549
+ * @param event - event will be available only if the function is called on clicking/taping the imags
550
+ */
551
+ setActualSize(index, event) {
552
+ if (this.zoomInProgress) {
553
+ return;
554
+ }
555
+ this.zoomInProgress = true;
556
+ const currentItem = this.core.galleryItems[this.core.index];
557
+ this.resetImageTranslate(index);
558
+ setTimeout(() => {
559
+ if (!currentItem.src || this.core.outer.hasClass("lg-first-slide-loading")) {
560
+ return;
561
+ }
562
+ const scale = this.getCurrentImageActualSizeScale();
563
+ const prevScale = this.scale;
564
+ if (this.core.outer.hasClass("lg-zoomed")) {
565
+ this.scale = 1;
566
+ } else {
567
+ this.scale = this.getScale(scale);
568
+ }
569
+ this.setPageCords(event);
570
+ this.beginZoom(this.scale);
571
+ this.zoomImage(this.scale, this.scale - prevScale, true, true);
572
+ }, 50);
573
+ setTimeout(() => {
574
+ this.core.outer.removeClass("lg-grabbing").addClass("lg-grab");
575
+ }, 60);
576
+ setTimeout(() => {
577
+ this.zoomInProgress = false;
578
+ }, ZOOM_TRANSITION_DURATION + 110);
579
+ }
580
+ getNaturalWidth(index) {
581
+ const $image = this.core.getSlideItem(index).find(".lg-image").first();
582
+ return getActualSizeWidth(
583
+ this.core.galleryItems[index],
584
+ {
585
+ width: window.innerWidth
586
+ },
587
+ $image.get().naturalWidth
588
+ );
589
+ }
590
+ getActualSizeScale(naturalWidth, width) {
591
+ let scale;
592
+ if (naturalWidth >= width) {
593
+ scale = getActualSizeScale(naturalWidth, width);
594
+ } else {
595
+ scale = 1;
596
+ }
597
+ return scale;
598
+ }
599
+ getCurrentImageActualSizeScale() {
600
+ var _a;
601
+ const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
602
+ const image = $image.get();
603
+ let width = (_a = this.core.currentImageSize) == null ? void 0 : _a.width;
604
+ if (!width) {
605
+ if (this.core.outer.hasClass("lg-actual-size")) {
606
+ if (!this.containerRect) {
607
+ this.setZoomEssentials();
608
+ }
609
+ const referenceWidth = this.getNaturalWidth(this.core.index);
610
+ const referenceHeight = image.naturalWidth > 0 ? referenceWidth * image.naturalHeight / image.naturalWidth : image.naturalHeight;
611
+ width = fitImageSize(
612
+ {
613
+ width: referenceWidth,
614
+ height: referenceHeight
615
+ },
616
+ this.containerRect.width,
617
+ this.containerRect.height
618
+ ).width;
619
+ } else {
620
+ width = image.offsetWidth;
621
+ }
622
+ }
623
+ const naturalWidth = this.getNaturalWidth(this.core.index) || width;
624
+ return this.getActualSizeScale(naturalWidth, width);
625
+ }
626
+ getPageCords(event) {
627
+ const cords = {};
628
+ if (event) {
629
+ cords.x = event.pageX || event.touches[0].pageX;
630
+ cords.y = event.pageY || event.touches[0].pageY;
631
+ } else {
632
+ const containerRect = this.core.$content.get().getBoundingClientRect();
633
+ cords.x = containerRect.width / 2 + containerRect.left;
634
+ cords.y = containerRect.height / 2 + this.scrollTop + containerRect.top;
635
+ }
636
+ return cords;
637
+ }
638
+ setPageCords(event) {
639
+ const pageCords = this.getPageCords(event);
640
+ this.pageX = pageCords.x;
641
+ this.pageY = pageCords.y;
642
+ }
643
+ manageActualPixelClassNames() {
644
+ const $actualSize = this.core.getElementById("lg-actual-size");
645
+ $actualSize.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut);
646
+ }
647
+ // If true, zoomed - in else zoomed out
648
+ beginZoom(scale) {
649
+ this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging");
650
+ if (scale > 1) {
651
+ this.core.outer.addClass("lg-zoomed");
652
+ this.manageActualPixelClassNames();
653
+ } else {
654
+ this.resetZoom();
655
+ }
656
+ return scale > 1;
657
+ }
658
+ getScale(scale) {
659
+ const actualSizeScale = this.getCurrentImageActualSizeScale();
660
+ if (scale < 1) {
661
+ scale = 1;
662
+ } else if (scale > actualSizeScale) {
663
+ scale = actualSizeScale;
664
+ }
665
+ return scale;
666
+ }
667
+ init() {
668
+ this.core.registerDefaultIcons(zoomDefaultIcons);
669
+ if (!this.settings.zoom) {
670
+ return;
671
+ }
672
+ this.buildTemplates();
673
+ this.enableZoomOnSlideItemLoad();
674
+ let tapped = null;
675
+ this.core.outer.on("dblclick.lg", (event) => {
676
+ if (!this.$LG(event.target).hasClass("lg-image")) {
677
+ return;
678
+ }
679
+ this.setActualSize(this.core.index, event);
680
+ });
681
+ this.core.outer.on("touchstart.lg", (event) => {
682
+ const $target = this.$LG(event.target);
683
+ if (event.touches.length === 1 && $target.hasClass("lg-image")) {
684
+ if (!tapped) {
685
+ tapped = setTimeout(() => {
686
+ tapped = null;
687
+ }, 300);
688
+ } else {
689
+ clearTimeout(tapped);
690
+ tapped = null;
691
+ event.preventDefault();
692
+ this.setActualSize(this.core.index, event);
693
+ }
694
+ }
695
+ });
696
+ this.core.LGel.on(
697
+ `${lGEvents.containerResize}.zoom ${lGEvents.rotateRight}.zoom ${lGEvents.rotateLeft}.zoom ${lGEvents.flipHorizontal}.zoom ${lGEvents.flipVertical}.zoom`,
698
+ () => {
699
+ if (!this.core.lgOpened || !this.isImageSlide(this.core.index) || this.core.touchAction) {
700
+ return;
701
+ }
702
+ this.stopZoomSpring();
703
+ const _LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
704
+ this.top = 0;
705
+ this.left = 0;
706
+ this.setZoomEssentials();
707
+ this.setZoomSwipeStyles(_LGel, { x: 0, y: 0 });
708
+ this.positionChanged = true;
709
+ }
710
+ );
711
+ this.$LG(window).on(`scroll.lg.zoom.global${this.core.lgId}`, () => {
712
+ if (!this.core.lgOpened) return;
713
+ this.scrollTop = this.$LG(window).scrollTop();
714
+ });
715
+ this.core.getElementById("lg-zoom-out").on("click.lg", () => {
716
+ if (!this.isImageSlide(this.core.index)) {
717
+ return;
718
+ }
719
+ let timeout = 0;
720
+ if (this.imageReset) {
721
+ this.resetImageTranslate(this.core.index);
722
+ timeout = 50;
723
+ }
724
+ setTimeout(() => {
725
+ let scale = this.scale - this.settings.scale;
726
+ if (scale < 1) {
727
+ scale = 1;
728
+ }
729
+ this.beginZoom(scale);
730
+ this.zoomImage(
731
+ scale,
732
+ -this.settings.scale,
733
+ true,
734
+ !this.settings.infiniteZoom
735
+ );
736
+ }, timeout);
737
+ });
738
+ this.core.getElementById("lg-zoom-in").on("click.lg", () => {
739
+ this.zoomIn();
740
+ });
741
+ this.core.getElementById("lg-actual-size").on("click.lg", () => {
742
+ this.setActualSize(this.core.index);
743
+ });
744
+ this.core.LGel.on(`${lGEvents.beforeOpen}.zoom`, () => {
745
+ this.core.outer.find(".lg-item").removeClass("lg-zoomable");
746
+ });
747
+ this.core.LGel.on(`${lGEvents.afterOpen}.zoom`, () => {
748
+ this.scrollTop = this.$LG(window).scrollTop();
749
+ this.pageX = this.core.outer.width() / 2;
750
+ this.pageY = this.core.outer.height() / 2 + this.scrollTop;
751
+ this.scale = 1;
752
+ });
753
+ this.core.LGel.on(
754
+ `${lGEvents.afterSlide}.zoom`,
755
+ (event) => {
756
+ const { prevIndex } = event.detail;
757
+ this.scale = 1;
758
+ this.positionChanged = false;
759
+ this.zoomInProgress = false;
760
+ this.resetZoom(prevIndex);
761
+ this.resetImageTranslate(prevIndex);
762
+ if (this.isImageSlide(this.core.index)) {
763
+ this.setZoomEssentials();
764
+ }
765
+ }
766
+ );
767
+ this.zoomDrag();
768
+ this.pinchZoom();
769
+ this.zoomSwipe();
770
+ this.zoomableTimeout = false;
771
+ this.positionChanged = false;
772
+ this.zoomInProgress = false;
773
+ }
774
+ zoomIn() {
775
+ if (!this.isImageSlide(this.core.index)) {
776
+ return;
777
+ }
778
+ let scale = this.scale + this.settings.scale;
779
+ if (!this.settings.infiniteZoom) {
780
+ scale = this.getScale(scale);
781
+ }
782
+ this.beginZoom(scale);
783
+ this.zoomImage(
784
+ scale,
785
+ Math.min(this.settings.scale, scale - this.scale),
786
+ true,
787
+ !this.settings.infiniteZoom
788
+ );
789
+ }
790
+ // Reset zoom effect
791
+ resetZoom(index) {
792
+ this.stopZoomSpring();
793
+ this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");
794
+ const $actualSize = this.core.getElementById("lg-actual-size");
795
+ const $item = this.core.getSlideItem(
796
+ index !== void 0 ? index : this.core.index
797
+ );
798
+ $actualSize.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn);
799
+ $item.find(".lg-img-wrap").first().removeAttr("style");
800
+ $item.find(".lg-image").first().removeAttr("style");
801
+ this.scale = 1;
802
+ this.left = 0;
803
+ this.top = 0;
804
+ this.setPageCords();
805
+ }
806
+ /** Stop a running release spring; state stays at its live values. */
807
+ stopZoomSpring() {
808
+ if (this.cancelZoomSpring) {
809
+ this.cancelZoomSpring();
810
+ this.cancelZoomSpring = void 0;
811
+ }
812
+ }
813
+ /**
814
+ * Any gesture end must leave the image inside its pan bounds: a tap
815
+ * interrupts a settling spring (stopZoomSpring at its touchstart),
816
+ * and if it never turns into a drag nothing else re-clamps, the
817
+ * fused pinch pan can legitimately be far outside mid-settle.
818
+ * Springs home from wherever the interruption stopped it; a no-op
819
+ * when already in bounds (the common tap).
820
+ */
821
+ settleIntoBounds() {
822
+ this.setZoomEssentials();
823
+ const rect = this.core.getSlideItem(this.core.index).find(".lg-image").first().get().getBoundingClientRect();
824
+ const actualSizeScale = this.getCurrentImageActualSizeScale();
825
+ const targetScale = this.settings.infiniteZoom ? Math.max(this.scale, 1) : Math.min(Math.max(this.scale, 1), Math.max(actualSizeScale, 1));
826
+ const sizeRatio = this.scale > 0 ? targetScale / this.scale : 1;
827
+ const width = rect.width * sizeRatio;
828
+ const height = rect.height * sizeRatio;
829
+ const { bottom } = this.core.mediaContainerPosition;
830
+ const halfX = Math.abs(width - this.containerRect.width) / 2;
831
+ const halfY = Math.abs(height - this.containerRect.height) / 2;
832
+ const floorY = height > this.containerRect.height ? Math.min(-halfY + bottom, halfY) : -halfY;
833
+ const targetX = Math.min(Math.max(this.left, -halfX), halfX);
834
+ const targetY = Math.min(Math.max(this.top, floorY), halfY);
835
+ if (Math.abs(targetX - this.left) < 1 && Math.abs(targetY - this.top) < 1 && Math.abs(targetScale - this.scale) < 1e-3) {
836
+ return;
837
+ }
838
+ this.core.outer.addClass("lg-zoom-drag-transition lg-zoom-dragging");
839
+ this.stopZoomSpring();
840
+ this.cancelZoomSpring = runSprings(
841
+ [
842
+ { from: this.scale, velocity: 0, target: targetScale },
843
+ { from: this.left, velocity: 0, target: targetX },
844
+ { from: this.top, velocity: 0, target: targetY }
845
+ ],
846
+ ([scale, x, y]) => {
847
+ this.left = x;
848
+ this.top = y;
849
+ this.setZoomStyles({ x, y, scale });
850
+ },
851
+ () => {
852
+ this.cancelZoomSpring = void 0;
853
+ this.core.outer.removeClass(
854
+ "lg-zoom-dragging lg-zoom-drag-transition"
855
+ );
856
+ if (targetScale > 1 && targetScale >= Math.max(actualSizeScale, 1)) {
857
+ this.setZoomImageSize(0);
858
+ }
859
+ }
860
+ );
861
+ }
862
+ getTouchDistance(e) {
863
+ return getPointerDistance(
864
+ { x: e.touches[0].pageX, y: e.touches[0].pageY },
865
+ { x: e.touches[1].pageX, y: e.touches[1].pageY }
866
+ );
867
+ }
868
+ /**
869
+ * Pinch midpoint relative to the stage centre, the focal anchor the
870
+ * whole gesture projects through.
871
+ */
872
+ getPinchMidPoint(e) {
873
+ const centerX = this.containerRect.width / 2 + this.containerRect.left;
874
+ const centerY = this.containerRect.height / 2 + this.containerRect.top + this.scrollTop;
875
+ return {
876
+ x: (e.touches[0].pageX + e.touches[1].pageX) / 2 - centerX,
877
+ y: (e.touches[0].pageY + e.touches[1].pageY) / 2 - centerY
878
+ };
879
+ }
880
+ /**
881
+ * Clamp a pan into the stage-aware bounds at the given scale,
882
+ * measured from the untransformed layout size (offset dimensions
883
+ * ignore transforms, so this stays correct mid-gesture). Y matches
884
+ * `getPossibleSwipeDragCords`: the vacated components strip belongs
885
+ * to the stage, so the pan-up floor sits where the image's bottom
886
+ * edge meets the SCREEN bottom, not the content box.
887
+ */
888
+ /**
889
+ * Bounds-relevant size of the image: layout offsets swapped and
890
+ * shrunk by the rotate plugin's wrapper transform when present,
891
+ * at 90°/270° the visual width runs along the layout height, and
892
+ * offsets don't see transforms.
893
+ */
894
+ getVisualImageSize($image, width, height) {
895
+ const rotateWrap = $image.closest(".lg-img-rotate");
896
+ return getRotatedVisualSize(width, height, rotateWrap == null ? void 0 : rotateWrap.style.transform);
897
+ }
898
+ clampPinchPan(pan, scale) {
899
+ const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first().get();
900
+ const visual = this.getVisualImageSize(
901
+ $image,
902
+ $image.offsetWidth,
903
+ $image.offsetHeight
904
+ );
905
+ const bounds = getPanBounds(
906
+ visual.width,
907
+ visual.height,
908
+ this.containerRect.width,
909
+ this.containerRect.height,
910
+ scale
911
+ );
912
+ return clampPanToStage(
913
+ pan,
914
+ bounds,
915
+ this.core.mediaContainerPosition.bottom
916
+ );
917
+ }
918
+ pinchZoom() {
919
+ let startDist = 0;
920
+ let pinchStarted = false;
921
+ let initScale = 1;
922
+ let startMaxScale = 1;
923
+ let startPan = { x: 0, y: 0 };
924
+ let startMid = { x: 0, y: 0 };
925
+ let maxGestureScale = 1;
926
+ let lastMid = { x: 0, y: 0 };
927
+ let midSamples = [];
928
+ let $item = this.core.getSlideItem(this.core.index);
929
+ this.core.outer.on("touchstart.lg", (e) => {
930
+ $item = this.core.getSlideItem(this.core.index);
931
+ if (!this.isImageSlide(this.core.index)) {
932
+ return;
933
+ }
934
+ if (e.touches.length === 2) {
935
+ e.preventDefault();
936
+ if (this.core.outer.hasClass("lg-first-slide-loading")) {
937
+ return;
938
+ }
939
+ this.stopZoomSpring();
940
+ this.setZoomEssentials();
941
+ initScale = this.scale || 1;
942
+ startPan = { x: this.left, y: this.top };
943
+ startMid = this.getPinchMidPoint(e);
944
+ this.core.outer.addClass(
945
+ "lg-zoom-drag-transition lg-zoom-dragging"
946
+ );
947
+ this.setPageCords(e);
948
+ this.resetImageTranslate(this.core.index);
949
+ startMaxScale = this.getCurrentImageActualSizeScale();
950
+ this.core.touchAction = "pinch";
951
+ startDist = this.getTouchDistance(e);
952
+ maxGestureScale = initScale;
953
+ lastMid = startMid;
954
+ midSamples = [{ x: startMid.x, y: startMid.y, t: Date.now() }];
955
+ }
956
+ });
957
+ this.core.$inner.on("touchmove.lg", (e) => {
958
+ if (e.touches.length === 2 && this.core.touchAction === "pinch" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
959
+ e.preventDefault();
960
+ const endDist = this.getTouchDistance(e);
961
+ const distance = startDist - endDist;
962
+ if (!pinchStarted && Math.abs(distance) > 5) {
963
+ pinchStarted = true;
964
+ }
965
+ if (pinchStarted) {
966
+ const closeArmed = this.core.settings.pinchToClose && this.core.settings.closable && maxGestureScale <= 1;
967
+ const _scale = getPinchScale(
968
+ startDist,
969
+ endDist,
970
+ initScale,
971
+ startMaxScale,
972
+ this.settings.infiniteZoom,
973
+ closeArmed
974
+ );
975
+ const scale = Math.round((_scale + Number.EPSILON) * 1e4) / 1e4;
976
+ const mid = this.getPinchMidPoint(e);
977
+ lastMid = mid;
978
+ midSamples = pushVelocitySample(midSamples, {
979
+ x: mid.x,
980
+ y: mid.y,
981
+ t: Date.now()
982
+ });
983
+ const pan = getPinchPan(
984
+ mid,
985
+ startMid,
986
+ startPan,
987
+ initScale,
988
+ scale
989
+ );
990
+ this.left = pan.x;
991
+ this.top = pan.y;
992
+ this.setZoomStyles({ x: pan.x, y: pan.y, scale });
993
+ maxGestureScale = Math.max(maxGestureScale, scale);
994
+ }
995
+ }
996
+ });
997
+ this.core.$inner.on("touchend.lg", (e) => {
998
+ if (this.core.touchAction === "pinch" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
999
+ pinchStarted = false;
1000
+ startDist = 0;
1001
+ if (shouldCloseOnPinch({
1002
+ scale: this.scale,
1003
+ maxGestureScale,
1004
+ pinchToClose: this.core.settings.pinchToClose,
1005
+ closable: this.core.settings.closable
1006
+ })) {
1007
+ this.core.outer.removeClass("lg-zoom-dragging");
1008
+ this.resetZoom();
1009
+ this.core.closeGallery();
1010
+ } else if (this.scale <= 1) {
1011
+ this.core.outer.removeClass("lg-zoomed");
1012
+ this.stopZoomSpring();
1013
+ this.cancelZoomSpring = runSprings(
1014
+ [
1015
+ { from: this.scale, velocity: 0, target: 1 },
1016
+ { from: this.left, velocity: 0, target: 0 },
1017
+ { from: this.top, velocity: 0, target: 0 }
1018
+ ],
1019
+ ([scale, x, y]) => {
1020
+ this.left = x;
1021
+ this.top = y;
1022
+ this.setZoomStyles({
1023
+ x,
1024
+ y,
1025
+ scale
1026
+ });
1027
+ },
1028
+ () => {
1029
+ this.cancelZoomSpring = void 0;
1030
+ this.core.outer.removeClass("lg-zoom-dragging");
1031
+ this.resetZoom();
1032
+ }
1033
+ );
1034
+ } else {
1035
+ const actualSizeScale = startMaxScale;
1036
+ const targetScale = Math.min(
1037
+ this.scale,
1038
+ Math.max(actualSizeScale, 1)
1039
+ );
1040
+ const midVelocity = getWindowedVelocity(
1041
+ midSamples,
1042
+ Date.now()
1043
+ );
1044
+ const basePan = getPinchPan(
1045
+ lastMid,
1046
+ startMid,
1047
+ startPan,
1048
+ initScale,
1049
+ targetScale
1050
+ );
1051
+ const glide = {
1052
+ x: basePan.x + project(midVelocity.x),
1053
+ y: basePan.y + project(midVelocity.y)
1054
+ };
1055
+ const pan = this.clampPinchPan(glide, targetScale);
1056
+ this.positionChanged = true;
1057
+ this.manageActualPixelClassNames();
1058
+ this.core.outer.addClass("lg-zoomed");
1059
+ this.stopZoomSpring();
1060
+ this.cancelZoomSpring = runSprings(
1061
+ [
1062
+ {
1063
+ from: this.scale,
1064
+ velocity: 0,
1065
+ target: targetScale
1066
+ },
1067
+ {
1068
+ from: this.left,
1069
+ velocity: midVelocity.x,
1070
+ target: pan.x,
1071
+ dampingRatio: pan.x !== glide.x ? SPRING_BOUNCE_DAMPING : 1
1072
+ },
1073
+ {
1074
+ from: this.top,
1075
+ velocity: midVelocity.y,
1076
+ target: pan.y,
1077
+ dampingRatio: pan.y !== glide.y ? SPRING_BOUNCE_DAMPING : 1
1078
+ }
1079
+ ],
1080
+ ([scale, x, y]) => {
1081
+ this.left = x;
1082
+ this.top = y;
1083
+ this.setZoomStyles({
1084
+ x,
1085
+ y,
1086
+ scale
1087
+ });
1088
+ },
1089
+ () => {
1090
+ this.cancelZoomSpring = void 0;
1091
+ this.core.outer.removeClass(
1092
+ "lg-zoom-dragging lg-zoom-drag-transition"
1093
+ );
1094
+ if (targetScale >= actualSizeScale) {
1095
+ this.setZoomImageSize(0);
1096
+ }
1097
+ }
1098
+ );
1099
+ }
1100
+ this.core.touchAction = void 0;
1101
+ }
1102
+ });
1103
+ }
1104
+ touchendZoom(startCoords, endCoords, allowX, allowY, velocity) {
1105
+ const _LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
1106
+ const possibleSwipeCords = this.getPossibleSwipeDragCords();
1107
+ const current = this.getZoomSwipeCords(
1108
+ startCoords,
1109
+ endCoords,
1110
+ allowX,
1111
+ allowY,
1112
+ possibleSwipeCords
1113
+ );
1114
+ const clampAxis = (value, min, max) => Math.min(Math.max(value, max), min);
1115
+ const targetX = allowX ? clampAxis(
1116
+ current.x + project(velocity.x),
1117
+ possibleSwipeCords.minX,
1118
+ possibleSwipeCords.maxX
1119
+ ) : this.left;
1120
+ const targetY = allowY ? clampAxis(
1121
+ current.y + project(velocity.y),
1122
+ possibleSwipeCords.minY,
1123
+ possibleSwipeCords.maxY
1124
+ ) : this.top;
1125
+ this.positionChanged = true;
1126
+ if (Math.abs(targetX - current.x) < 1 && Math.abs(targetY - current.y) < 1) {
1127
+ this.left = targetX;
1128
+ this.top = targetY;
1129
+ this.setZoomSwipeStyles(_LGel, { x: targetX, y: targetY });
1130
+ this.core.outer.removeClass(
1131
+ "lg-zoom-dragging lg-zoom-drag-transition"
1132
+ );
1133
+ return;
1134
+ }
1135
+ this.core.outer.addClass("lg-zoom-dragging");
1136
+ this.stopZoomSpring();
1137
+ this.cancelZoomSpring = runSprings(
1138
+ [
1139
+ {
1140
+ from: current.x,
1141
+ velocity: velocity.x,
1142
+ target: targetX,
1143
+ dampingRatio: targetX !== current.x + project(velocity.x) ? SPRING_BOUNCE_DAMPING : 1
1144
+ },
1145
+ {
1146
+ from: current.y,
1147
+ velocity: velocity.y,
1148
+ target: targetY,
1149
+ dampingRatio: targetY !== current.y + project(velocity.y) ? SPRING_BOUNCE_DAMPING : 1
1150
+ }
1151
+ ],
1152
+ ([x, y]) => {
1153
+ this.left = x;
1154
+ this.top = y;
1155
+ this.setZoomSwipeStyles(_LGel, { x, y });
1156
+ },
1157
+ () => {
1158
+ this.cancelZoomSpring = void 0;
1159
+ this.core.outer.removeClass(
1160
+ "lg-zoom-dragging lg-zoom-drag-transition"
1161
+ );
1162
+ }
1163
+ );
1164
+ }
1165
+ getZoomSwipeCords(startCoords, endCoords, allowX, allowY, possibleSwipeCords) {
1166
+ const distance = {};
1167
+ if (allowY) {
1168
+ distance.y = this.top + (endCoords.y - startCoords.y);
1169
+ if (this.isBeyondPossibleTop(distance.y, possibleSwipeCords.minY)) {
1170
+ const diffMinY = possibleSwipeCords.minY - distance.y;
1171
+ distance.y = possibleSwipeCords.minY - diffMinY / 6;
1172
+ } else if (this.isBeyondPossibleBottom(distance.y, possibleSwipeCords.maxY)) {
1173
+ const diffMaxY = distance.y - possibleSwipeCords.maxY;
1174
+ distance.y = possibleSwipeCords.maxY + diffMaxY / 6;
1175
+ }
1176
+ } else {
1177
+ distance.y = this.top;
1178
+ }
1179
+ if (allowX) {
1180
+ distance.x = this.left + (endCoords.x - startCoords.x);
1181
+ if (this.isBeyondPossibleLeft(distance.x, possibleSwipeCords.minX)) {
1182
+ const diffMinX = possibleSwipeCords.minX - distance.x;
1183
+ distance.x = possibleSwipeCords.minX - diffMinX / 6;
1184
+ } else if (this.isBeyondPossibleRight(distance.x, possibleSwipeCords.maxX)) {
1185
+ const difMaxX = distance.x - possibleSwipeCords.maxX;
1186
+ distance.x = possibleSwipeCords.maxX + difMaxX / 6;
1187
+ }
1188
+ } else {
1189
+ distance.x = this.left;
1190
+ }
1191
+ return distance;
1192
+ }
1193
+ isBeyondPossibleLeft(x, minX) {
1194
+ return x >= minX;
1195
+ }
1196
+ isBeyondPossibleRight(x, maxX) {
1197
+ return x <= maxX;
1198
+ }
1199
+ isBeyondPossibleTop(y, minY) {
1200
+ return y >= minY;
1201
+ }
1202
+ isBeyondPossibleBottom(y, maxY) {
1203
+ return y <= maxY;
1204
+ }
1205
+ isImageSlide(index) {
1206
+ const currentItem = this.core.galleryItems[index];
1207
+ return this.core.getSlideType(currentItem) === "image";
1208
+ }
1209
+ getPossibleSwipeDragCords(scale) {
1210
+ const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
1211
+ const imgRect = $image.get().getBoundingClientRect();
1212
+ let imageHeight = imgRect.height;
1213
+ let imageWidth = imgRect.width;
1214
+ if (scale) {
1215
+ imageHeight = imageHeight + scale * imageHeight;
1216
+ imageWidth = imageWidth + scale * imageWidth;
1217
+ }
1218
+ const { bottom } = this.core.mediaContainerPosition;
1219
+ const minY = (imageHeight - this.containerRect.height) / 2;
1220
+ const maxY = (this.containerRect.height - imageHeight) / 2 + bottom;
1221
+ const minX = (imageWidth - this.containerRect.width) / 2;
1222
+ const maxX = (this.containerRect.width - imageWidth) / 2;
1223
+ const possibleSwipeCords = {
1224
+ minY,
1225
+ maxY,
1226
+ minX,
1227
+ maxX
1228
+ };
1229
+ return possibleSwipeCords;
1230
+ }
1231
+ setZoomSwipeStyles(LGel, distance) {
1232
+ LGel.css(
1233
+ "transform",
1234
+ "translate3d(" + distance.x + "px, " + distance.y + "px, 0)"
1235
+ );
1236
+ }
1237
+ zoomSwipe() {
1238
+ let startCoords = {};
1239
+ let endCoords = {};
1240
+ let isMoved = false;
1241
+ let allowX = false;
1242
+ let allowY = false;
1243
+ let samples = [];
1244
+ let possibleSwipeCords;
1245
+ let _LGel;
1246
+ let $item = this.core.getSlideItem(this.core.index);
1247
+ this.core.$inner.on("touchstart.lg", (e) => {
1248
+ if (!this.isImageSlide(this.core.index)) {
1249
+ return;
1250
+ }
1251
+ $item = this.core.getSlideItem(this.core.index);
1252
+ if ((this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target)) && e.touches.length === 1 && this.core.outer.hasClass("lg-zoomed")) {
1253
+ e.preventDefault();
1254
+ this.stopZoomSpring();
1255
+ isMoved = false;
1256
+ endCoords = {};
1257
+ const startPoint = this.getSwipeCords(e);
1258
+ samples = [{ x: startPoint.x, y: startPoint.y, t: Date.now() }];
1259
+ this.core.touchAction = "zoomSwipe";
1260
+ _LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
1261
+ const dragAllowedAxises = this.getDragAllowedAxises(0);
1262
+ allowY = dragAllowedAxises.allowY;
1263
+ allowX = dragAllowedAxises.allowX;
1264
+ startCoords = this.getSwipeCords(e);
1265
+ possibleSwipeCords = this.getPossibleSwipeDragCords();
1266
+ this.core.outer.addClass(
1267
+ "lg-zoom-dragging lg-zoom-drag-transition"
1268
+ );
1269
+ }
1270
+ });
1271
+ this.core.$inner.on("touchmove.lg", (e) => {
1272
+ if (e.touches.length === 1 && this.core.touchAction === "zoomSwipe" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
1273
+ e.preventDefault();
1274
+ this.core.touchAction = "zoomSwipe";
1275
+ endCoords = this.getSwipeCords(e);
1276
+ samples = pushVelocitySample(samples, {
1277
+ x: endCoords.x,
1278
+ y: endCoords.y,
1279
+ t: Date.now()
1280
+ });
1281
+ const distance = this.getZoomSwipeCords(
1282
+ startCoords,
1283
+ endCoords,
1284
+ allowX,
1285
+ allowY,
1286
+ possibleSwipeCords
1287
+ );
1288
+ if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) {
1289
+ isMoved = true;
1290
+ this.setZoomSwipeStyles(_LGel, distance);
1291
+ }
1292
+ }
1293
+ });
1294
+ this.core.$inner.on("touchend.lg", (e) => {
1295
+ if (this.core.touchAction === "zoomSwipe" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
1296
+ e.preventDefault();
1297
+ this.core.touchAction = void 0;
1298
+ this.core.outer.removeClass("lg-zoom-dragging");
1299
+ if (!isMoved) {
1300
+ this.settleIntoBounds();
1301
+ return;
1302
+ }
1303
+ isMoved = false;
1304
+ this.touchendZoom(
1305
+ startCoords,
1306
+ endCoords,
1307
+ allowX,
1308
+ allowY,
1309
+ getWindowedVelocity(samples, Date.now())
1310
+ );
1311
+ }
1312
+ });
1313
+ }
1314
+ zoomDrag() {
1315
+ let startCoords = {};
1316
+ let endCoords = {};
1317
+ let isDragging = false;
1318
+ let isMoved = false;
1319
+ let allowX = false;
1320
+ let allowY = false;
1321
+ let dragSamples = [];
1322
+ let possibleSwipeCords;
1323
+ let _LGel;
1324
+ this.core.outer.on("mousedown.lg.zoom", (e) => {
1325
+ if (!this.isImageSlide(this.core.index)) {
1326
+ return;
1327
+ }
1328
+ const $item = this.core.getSlideItem(this.core.index);
1329
+ if (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target)) {
1330
+ if (this.core.outer.hasClass("lg-zoomed")) {
1331
+ this.stopZoomSpring();
1332
+ }
1333
+ dragSamples = [{ x: e.pageX, y: e.pageY, t: Date.now() }];
1334
+ _LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
1335
+ const dragAllowedAxises = this.getDragAllowedAxises(0);
1336
+ allowY = dragAllowedAxises.allowY;
1337
+ allowX = dragAllowedAxises.allowX;
1338
+ if (this.core.outer.hasClass("lg-zoomed")) {
1339
+ if (this.$LG(e.target).hasClass("lg-object") && (allowX || allowY)) {
1340
+ e.preventDefault();
1341
+ startCoords = this.getDragCords(e);
1342
+ possibleSwipeCords = this.getPossibleSwipeDragCords();
1343
+ isDragging = true;
1344
+ this.core.outer.removeClass("lg-grab").addClass(
1345
+ "lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"
1346
+ );
1347
+ }
1348
+ }
1349
+ }
1350
+ });
1351
+ this.$LG(window).on(
1352
+ `mousemove.lg.zoom.global${this.core.lgId}`,
1353
+ (e) => {
1354
+ if (isDragging) {
1355
+ isMoved = true;
1356
+ endCoords = this.getDragCords(e);
1357
+ dragSamples = pushVelocitySample(dragSamples, {
1358
+ x: endCoords.x,
1359
+ y: endCoords.y,
1360
+ t: Date.now()
1361
+ });
1362
+ const distance = this.getZoomSwipeCords(
1363
+ startCoords,
1364
+ endCoords,
1365
+ allowX,
1366
+ allowY,
1367
+ possibleSwipeCords
1368
+ );
1369
+ this.setZoomSwipeStyles(_LGel, distance);
1370
+ }
1371
+ }
1372
+ );
1373
+ this.$LG(window).on(`mouseup.lg.zoom.global${this.core.lgId}`, (e) => {
1374
+ if (isDragging) {
1375
+ isDragging = false;
1376
+ this.core.outer.removeClass("lg-zoom-dragging");
1377
+ if (isMoved && (startCoords.x !== endCoords.x || startCoords.y !== endCoords.y)) {
1378
+ endCoords = this.getDragCords(e);
1379
+ this.touchendZoom(
1380
+ startCoords,
1381
+ endCoords,
1382
+ allowX,
1383
+ allowY,
1384
+ getWindowedVelocity(dragSamples, Date.now())
1385
+ );
1386
+ } else {
1387
+ this.settleIntoBounds();
1388
+ }
1389
+ isMoved = false;
1390
+ }
1391
+ this.core.outer.removeClass("lg-grabbing").addClass("lg-grab");
1392
+ });
1393
+ }
1394
+ closeGallery() {
1395
+ if (this.imageReset) {
1396
+ this.resetImageTranslate(this.core.index);
1397
+ }
1398
+ this.resetZoom();
1399
+ this.zoomInProgress = false;
1400
+ }
1401
+ destroy() {
1402
+ this.$LG(window).off(`.lg.zoom.global${this.core.lgId}`);
1403
+ this.core.LGel.off(".lg.zoom");
1404
+ this.core.LGel.off(".zoom");
1405
+ clearTimeout(this.zoomableTimeout);
1406
+ this.zoomableTimeout = false;
1407
+ }
1408
+ }
1409
+ export {
1410
+ Zoom as default
1411
+ };
1412
+ //# sourceMappingURL=lg-zoom.es5.js.map