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.
- package/LICENSE +690 -0
- package/README.md +31 -21
- package/dist/README.md +229 -0
- package/{css → dist/css}/lg-autoplay.css +7 -4
- package/{css → dist/css}/lg-autoplay.css.map +1 -1
- package/{css → dist/css}/lg-comments.css +0 -6
- package/{css → dist/css}/lg-comments.css.map +1 -1
- package/dist/css/lg-fullscreen.css +11 -0
- package/dist/css/lg-fullscreen.css.map +1 -0
- package/dist/css/lg-justified.css +37 -0
- package/dist/css/lg-justified.css.map +1 -0
- package/{css → dist/css}/lg-pager.css.map +1 -1
- package/{css → dist/css}/lg-rotate.css +0 -16
- package/{css → dist/css}/lg-rotate.css.map +1 -1
- package/dist/css/lg-rtl.css +94 -0
- package/dist/css/lg-rtl.css.map +1 -0
- package/{css → dist/css}/lg-share.css +4 -32
- package/dist/css/lg-share.css.map +1 -0
- package/{css → dist/css}/lg-thumbnail.css +7 -3
- package/dist/css/lg-thumbnail.css.map +1 -0
- package/{css → dist/css}/lg-transitions.css +10 -0
- package/dist/css/lg-transitions.css.map +1 -0
- package/{css → dist/css}/lg-zoom.css +20 -9
- package/dist/css/lg-zoom.css.map +1 -0
- package/{css → dist/css}/lightgallery-bundle.css +150 -118
- package/dist/css/lightgallery-bundle.css.map +1 -0
- package/dist/css/lightgallery-bundle.min.css +1 -0
- package/{css → dist/css}/lightgallery-core.css +49 -7
- package/dist/css/lightgallery-core.css.map +1 -0
- package/{css → dist/css}/lightgallery.css +105 -44
- package/dist/css/lightgallery.css.map +1 -0
- package/dist/lightgallery.es5.js +3797 -0
- package/dist/lightgallery.es5.js.map +1 -0
- package/dist/lightgallery.min.js +1 -0
- package/dist/lightgallery.umd.js +3800 -0
- package/dist/lightgallery.umd.js.map +1 -0
- package/dist/package.json +33 -0
- package/dist/plugins/autoplay/lg-autoplay.es5.js +193 -0
- package/dist/plugins/autoplay/lg-autoplay.es5.js.map +1 -0
- package/dist/plugins/autoplay/lg-autoplay.min.js +1 -0
- package/dist/plugins/autoplay/lg-autoplay.umd.js +196 -0
- package/dist/plugins/autoplay/lg-autoplay.umd.js.map +1 -0
- package/dist/plugins/autoplay/package.json +7 -0
- package/dist/plugins/comment/lg-comment.es5.js +136 -0
- package/dist/plugins/comment/lg-comment.es5.js.map +1 -0
- package/dist/plugins/comment/lg-comment.min.js +1 -0
- package/dist/plugins/comment/lg-comment.umd.js +139 -0
- package/dist/plugins/comment/lg-comment.umd.js.map +1 -0
- package/dist/plugins/comment/package.json +7 -0
- package/dist/plugins/fullscreen/lg-fullscreen.es5.js +114 -0
- package/dist/plugins/fullscreen/lg-fullscreen.es5.js.map +1 -0
- package/dist/plugins/fullscreen/lg-fullscreen.min.js +1 -0
- package/dist/plugins/fullscreen/lg-fullscreen.umd.js +117 -0
- package/dist/plugins/fullscreen/lg-fullscreen.umd.js.map +1 -0
- package/dist/plugins/fullscreen/package.json +7 -0
- package/dist/plugins/hash/lg-hash.es5.js +207 -0
- package/dist/plugins/hash/lg-hash.es5.js.map +1 -0
- package/dist/plugins/hash/lg-hash.min.js +1 -0
- package/dist/plugins/hash/lg-hash.umd.js +210 -0
- package/dist/plugins/hash/lg-hash.umd.js.map +1 -0
- package/dist/plugins/hash/package.json +7 -0
- package/dist/plugins/justified/lg-justified.es5.js +415 -0
- package/dist/plugins/justified/lg-justified.es5.js.map +1 -0
- package/dist/plugins/justified/lg-justified.min.js +1 -0
- package/dist/plugins/justified/lg-justified.umd.js +418 -0
- package/dist/plugins/justified/lg-justified.umd.js.map +1 -0
- package/dist/plugins/justified/package.json +7 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js +95 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.min.js +1 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js +98 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -0
- package/dist/plugins/mediumZoom/package.json +7 -0
- package/dist/plugins/originCrop/lg-origin-crop.es5.js +622 -0
- package/dist/plugins/originCrop/lg-origin-crop.es5.js.map +1 -0
- package/dist/plugins/originCrop/lg-origin-crop.min.js +1 -0
- package/dist/plugins/originCrop/lg-origin-crop.umd.js +625 -0
- package/dist/plugins/originCrop/lg-origin-crop.umd.js.map +1 -0
- package/dist/plugins/pager/lg-pager.es5.js +96 -0
- package/dist/plugins/pager/lg-pager.es5.js.map +1 -0
- package/dist/plugins/pager/lg-pager.min.js +1 -0
- package/dist/plugins/pager/lg-pager.umd.js +99 -0
- package/dist/plugins/pager/lg-pager.umd.js.map +1 -0
- package/dist/plugins/pager/package.json +7 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.es5.js +98 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.min.js +1 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.umd.js +101 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -0
- package/dist/plugins/relativeCaption/package.json +7 -0
- package/dist/plugins/rotate/lg-rotate.es5.js +226 -0
- package/dist/plugins/rotate/lg-rotate.es5.js.map +1 -0
- package/dist/plugins/rotate/lg-rotate.min.js +1 -0
- package/dist/plugins/rotate/lg-rotate.umd.js +229 -0
- package/dist/plugins/rotate/lg-rotate.umd.js.map +1 -0
- package/dist/plugins/rotate/package.json +7 -0
- package/dist/plugins/share/lg-share.es5.js +309 -0
- package/dist/plugins/share/lg-share.es5.js.map +1 -0
- package/dist/plugins/share/lg-share.min.js +1 -0
- package/dist/plugins/share/lg-share.umd.js +312 -0
- package/dist/plugins/share/lg-share.umd.js.map +1 -0
- package/dist/plugins/share/package.json +7 -0
- package/dist/plugins/thumbnail/lg-thumbnail.es5.js +792 -0
- package/dist/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -0
- package/dist/plugins/thumbnail/lg-thumbnail.min.js +1 -0
- package/dist/plugins/thumbnail/lg-thumbnail.umd.js +795 -0
- package/dist/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -0
- package/dist/plugins/thumbnail/package.json +7 -0
- package/dist/plugins/video/lg-video.es5.js +518 -0
- package/dist/plugins/video/lg-video.es5.js.map +1 -0
- package/dist/plugins/video/lg-video.min.js +1 -0
- package/dist/plugins/video/lg-video.umd.js +521 -0
- package/dist/plugins/video/lg-video.umd.js.map +1 -0
- package/dist/plugins/video/package.json +7 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +72 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +1 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +1 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +75 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +1 -0
- package/dist/plugins/vimeoThumbnail/package.json +7 -0
- package/dist/plugins/zoom/lg-zoom.es5.js +1412 -0
- package/dist/plugins/zoom/lg-zoom.es5.js.map +1 -0
- package/dist/plugins/zoom/lg-zoom.min.js +1 -0
- package/dist/plugins/zoom/lg-zoom.umd.js +1415 -0
- package/dist/plugins/zoom/lg-zoom.umd.js.map +1 -0
- package/dist/plugins/zoom/package.json +7 -0
- package/{scss → dist/scss}/_lg-theme-default.scss +68 -18
- package/{scss → dist/scss}/_lg-variables.scss +0 -1
- package/{scss → dist/scss}/lg-autoplay.scss +10 -4
- package/{scss → dist/scss}/lg-comments.scss +0 -8
- package/dist/scss/lg-fullscreen.scss +15 -0
- package/dist/scss/lg-justified.scss +63 -0
- package/{scss → dist/scss}/lg-rotate.scss +0 -24
- package/dist/scss/lg-rtl.scss +145 -0
- package/{scss → dist/scss}/lg-share.scss +6 -33
- package/{scss → dist/scss}/lg-thumbnail.scss +16 -5
- package/{scss → dist/scss}/lg-zoom.scss +46 -9
- package/{scss → dist/scss}/lightgallery-bundle.scss +0 -1
- package/{scss → dist/scss}/lightgallery-core.scss +73 -6
- package/{scss → dist/scss}/lightgallery.scss +0 -1
- package/{scss → dist/scss}/transitions/_lg-scale-up.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-slide-circular-vertical.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-slide-circular.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-soft-zoom.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-in-big.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-in-out.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-in.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-out-big.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-out-in.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-out.scss +6 -0
- package/dist/types/headless/announce.d.ts +22 -0
- package/dist/types/headless/emitter.d.ts +14 -0
- package/dist/types/headless/gestures.d.ts +128 -0
- package/dist/types/headless/hash-driver.d.ts +77 -0
- package/dist/types/headless/icons.d.ts +56 -0
- package/dist/types/headless/index.d.ts +34 -0
- package/dist/types/headless/items.d.ts +92 -0
- package/dist/types/headless/justified-layout.d.ts +71 -0
- package/dist/types/headless/license.d.ts +35 -0
- package/dist/types/headless/origin-crop.d.ts +135 -0
- package/dist/types/headless/origin.d.ts +65 -0
- package/dist/types/headless/plugin-slices.d.ts +64 -0
- package/dist/types/headless/preload.d.ts +36 -0
- package/dist/types/headless/responsive.d.ts +90 -0
- package/dist/types/headless/settings.d.ts +268 -0
- package/dist/types/headless/share-urls.d.ts +60 -0
- package/dist/types/headless/spring.d.ts +42 -0
- package/dist/types/headless/state.d.ts +63 -0
- package/dist/types/headless/thumb-math.d.ts +85 -0
- package/dist/types/headless/toolbar-overflow.d.ts +61 -0
- package/dist/types/headless/transition.d.ts +33 -0
- package/dist/types/headless/velocity.d.ts +31 -0
- package/dist/types/headless/video-urls.d.ts +64 -0
- package/dist/types/headless/zoom-math.d.ts +89 -0
- package/{index.d.ts → dist/types/index.d.ts} +9 -4
- package/{lg-events.d.ts → dist/types/lg-events.d.ts} +300 -300
- package/dist/types/lg-icons.d.ts +27 -0
- package/{lg-plugin.d.ts → dist/types/lg-plugin.d.ts} +7 -7
- package/{lg-settings.d.ts → dist/types/lg-settings.d.ts} +549 -425
- package/dist/types/lg-spring-runner.d.ts +14 -0
- package/dist/types/lg-toolbar-overflow.d.ts +36 -0
- package/{lg-utils.d.ts → dist/types/lg-utils.d.ts} +236 -228
- package/{lgQuery.d.ts → dist/types/lgQuery.d.ts} +56 -56
- package/{lightgallery.d.ts → dist/types/lightgallery.d.ts} +384 -305
- package/{plugins → dist/types/plugins}/autoplay/lg-autoplay-settings.d.ts +41 -38
- package/{plugins → dist/types/plugins}/autoplay/lg-autoplay.d.ts +22 -22
- package/{plugins → dist/types/plugins}/comment/lg-comment-settings.d.ts +36 -33
- package/{plugins → dist/types/plugins}/comment/lg-comment.d.ts +25 -25
- package/{plugins → dist/types/plugins}/fullscreen/lg-fullscreen-settings.d.ts +17 -14
- package/{plugins → dist/types/plugins}/fullscreen/lg-fullscreen.d.ts +16 -16
- package/dist/types/plugins/hash/lg-hash-settings.d.ts +28 -0
- package/{plugins → dist/types/plugins}/hash/lg-hash.d.ts +25 -23
- package/dist/types/plugins/justified/lg-justified-settings.d.ts +42 -0
- package/dist/types/plugins/justified/lg-justified.d.ts +55 -0
- package/{plugins → dist/types/plugins}/mediumZoom/lg-medium-zoom-settings.d.ts +16 -16
- package/{plugins → dist/types/plugins}/mediumZoom/lg-medium-zoom.d.ts +12 -12
- package/dist/types/plugins/originCrop/lg-origin-crop-settings.d.ts +12 -0
- package/dist/types/plugins/originCrop/lg-origin-crop.d.ts +79 -0
- package/{plugins → dist/types/plugins}/pager/lg-pager-settings.d.ts +7 -7
- package/{plugins → dist/types/plugins}/pager/lg-pager.d.ts +13 -13
- package/{plugins → dist/types/plugins}/relativeCaption/lg-relative-caption-settings.d.ts +7 -7
- package/{plugins → dist/types/plugins}/relativeCaption/lg-relative-caption.d.ts +14 -14
- package/{plugins → dist/types/plugins}/rotate/lg-rotate-settings.d.ts +47 -45
- package/{plugins → dist/types/plugins}/rotate/lg-rotate.d.ts +25 -24
- package/{plugins → dist/types/plugins}/share/lg-fb-share-utils.d.ts +2 -2
- package/{plugins → dist/types/plugins}/share/lg-pinterest-share-utils.d.ts +2 -2
- package/{plugins → dist/types/plugins}/share/lg-share-settings.d.ts +71 -56
- package/dist/types/plugins/share/lg-share.d.ts +33 -0
- package/dist/types/plugins/share/lg-twitter-share-utils.d.ts +4 -0
- package/{plugins → dist/types/plugins}/share/types.d.ts +6 -6
- package/{plugins → dist/types/plugins}/thumbnail/lg-thumbnail-settings.d.ts +85 -70
- package/dist/types/plugins/thumbnail/lg-thumbnail.d.ts +88 -0
- package/{plugins → dist/types/plugins}/video/lg-video-settings.d.ts +94 -71
- package/{plugins → dist/types/plugins}/video/lg-video.d.ts +116 -104
- package/{plugins → dist/types/plugins}/video/types.d.ts +8 -8
- package/{plugins → dist/types/plugins}/vimeoThumbnail/lg-vimeo-thumbnail-settings.d.ts +11 -11
- package/{plugins → dist/types/plugins}/vimeoThumbnail/lg-vimeo-thumbnail.d.ts +14 -14
- package/{plugins → dist/types/plugins}/zoom/lg-zoom-settings.d.ts +54 -51
- package/{plugins → dist/types/plugins}/zoom/lg-zoom.d.ts +145 -108
- package/{types.d.ts → dist/types/types.d.ts} +40 -40
- package/package.json +222 -8
- package/angular/10/README.md +0 -24
- package/angular/10/bundles/lightgallery-angular-10.umd.js +0 -289
- package/angular/10/bundles/lightgallery-angular-10.umd.js.map +0 -1
- package/angular/10/bundles/lightgallery-angular-10.umd.min.js +0 -2
- package/angular/10/bundles/lightgallery-angular-10.umd.min.js.map +0 -1
- package/angular/10/esm2015/lib/lightgallery-angular.component.js +0 -225
- package/angular/10/esm2015/lib/lightgallery-angular.module.js +0 -17
- package/angular/10/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/10/esm2015/lightgallery-angular-10.js +0 -5
- package/angular/10/esm2015/public-api.js +0 -7
- package/angular/10/fesm2015/lightgallery-angular-10.js +0 -261
- package/angular/10/fesm2015/lightgallery-angular-10.js.map +0 -1
- package/angular/10/lib/lightgallery-angular.component.d.ts +0 -39
- package/angular/10/lib/lightgallery-angular.component.d.ts.map +0 -1
- package/angular/10/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/10/lib/lightgallery-angular.module.d.ts.map +0 -1
- package/angular/10/lib/lightgallery-angular.service.d.ts +0 -7
- package/angular/10/lib/lightgallery-angular.service.d.ts.map +0 -1
- package/angular/10/lightgallery-angular-10.d.ts +0 -6
- package/angular/10/lightgallery-angular-10.d.ts.map +0 -1
- package/angular/10/package.json +0 -21
- package/angular/10/public-api.d.ts +0 -4
- package/angular/10/public-api.d.ts.map +0 -1
- package/angular/11/README.md +0 -24
- package/angular/11/bundles/lightgallery-angular-11.umd.js +0 -290
- package/angular/11/bundles/lightgallery-angular-11.umd.js.map +0 -1
- package/angular/11/bundles/lightgallery-angular-11.umd.min.js +0 -2
- package/angular/11/bundles/lightgallery-angular-11.umd.min.js.map +0 -1
- package/angular/11/esm2015/lib/lightgallery-angular.component.js +0 -225
- package/angular/11/esm2015/lib/lightgallery-angular.module.js +0 -18
- package/angular/11/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/11/esm2015/lightgallery-angular-11.js +0 -5
- package/angular/11/esm2015/public-api.js +0 -7
- package/angular/11/fesm2015/lightgallery-angular-11.js +0 -262
- package/angular/11/fesm2015/lightgallery-angular-11.js.map +0 -1
- package/angular/11/lib/lightgallery-angular.component.d.ts +0 -39
- package/angular/11/lib/lightgallery-angular.component.d.ts.map +0 -1
- package/angular/11/lib/lightgallery-angular.module.d.ts +0 -8
- package/angular/11/lib/lightgallery-angular.module.d.ts.map +0 -1
- package/angular/11/lib/lightgallery-angular.service.d.ts +0 -7
- package/angular/11/lib/lightgallery-angular.service.d.ts.map +0 -1
- package/angular/11/lightgallery-angular-11.d.ts +0 -6
- package/angular/11/lightgallery-angular-11.d.ts.map +0 -1
- package/angular/11/package.json +0 -21
- package/angular/11/public-api.d.ts +0 -4
- package/angular/11/public-api.d.ts.map +0 -1
- package/angular/12/README.md +0 -24
- package/angular/12/bundles/lightgallery-angular-12.umd.js +0 -296
- package/angular/12/bundles/lightgallery-angular-12.umd.js.map +0 -1
- package/angular/12/esm2015/lib/lightgallery-angular.component.js +0 -221
- package/angular/12/esm2015/lib/lightgallery-angular.module.js +0 -17
- package/angular/12/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/12/esm2015/lightgallery-angular-12.js +0 -5
- package/angular/12/esm2015/public-api.js +0 -7
- package/angular/12/fesm2015/lightgallery-angular-12.js +0 -258
- package/angular/12/fesm2015/lightgallery-angular-12.js.map +0 -1
- package/angular/12/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/12/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/12/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/12/lightgallery-angular-12.d.ts +0 -5
- package/angular/12/package.json +0 -18
- package/angular/12/public-api.d.ts +0 -3
- package/angular/13/README.md +0 -24
- package/angular/13/esm2020/lib/lightgallery-angular.component.mjs +0 -221
- package/angular/13/esm2020/lib/lightgallery-angular.module.mjs +0 -17
- package/angular/13/esm2020/lib/lightgallery-angular.service.mjs +0 -14
- package/angular/13/esm2020/lightgallery-angular-13.mjs +0 -5
- package/angular/13/esm2020/public-api.mjs +0 -7
- package/angular/13/fesm2015/lightgallery-angular-13.mjs +0 -258
- package/angular/13/fesm2015/lightgallery-angular-13.mjs.map +0 -1
- package/angular/13/fesm2020/lightgallery-angular-13.mjs +0 -258
- package/angular/13/fesm2020/lightgallery-angular-13.mjs.map +0 -1
- package/angular/13/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/13/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/13/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/13/lightgallery-angular-13.d.ts +0 -5
- package/angular/13/package.json +0 -31
- package/angular/13/public-api.d.ts +0 -3
- package/angular/14/README.md +0 -24
- package/angular/14/esm2020/lib/lightgallery-angular.component.mjs +0 -217
- package/angular/14/esm2020/lib/lightgallery-angular.module.mjs +0 -17
- package/angular/14/esm2020/lib/lightgallery-angular.service.mjs +0 -14
- package/angular/14/esm2020/lightgallery-angular-14.mjs +0 -5
- package/angular/14/esm2020/public-api.mjs +0 -7
- package/angular/14/fesm2015/lightgallery-angular-14.mjs +0 -254
- package/angular/14/fesm2015/lightgallery-angular-14.mjs.map +0 -1
- package/angular/14/fesm2020/lightgallery-angular-14.mjs +0 -254
- package/angular/14/fesm2020/lightgallery-angular-14.mjs.map +0 -1
- package/angular/14/index.d.ts +0 -5
- package/angular/14/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/14/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/14/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/14/package.json +0 -31
- package/angular/14/public-api.d.ts +0 -3
- package/angular/15/README.md +0 -24
- package/angular/15/esm2022/lib/lightgallery-angular.component.mjs +0 -218
- package/angular/15/esm2022/lib/lightgallery-angular.module.mjs +0 -18
- package/angular/15/esm2022/lib/lightgallery-angular.service.mjs +0 -15
- package/angular/15/esm2022/lightgallery-angular-15.mjs +0 -5
- package/angular/15/esm2022/public-api.mjs +0 -7
- package/angular/15/fesm2022/lightgallery-angular-15.mjs +0 -254
- package/angular/15/fesm2022/lightgallery-angular-15.mjs.map +0 -1
- package/angular/15/index.d.ts +0 -5
- package/angular/15/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/15/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/15/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/15/package.json +0 -25
- package/angular/15/public-api.d.ts +0 -3
- package/angular/16/README.md +0 -24
- package/angular/16/esm2022/lib/lightgallery-angular.component.mjs +0 -218
- package/angular/16/esm2022/lib/lightgallery-angular.module.mjs +0 -18
- package/angular/16/esm2022/lib/lightgallery-angular.service.mjs +0 -15
- package/angular/16/esm2022/lightgallery-angular-16.mjs +0 -5
- package/angular/16/esm2022/public-api.mjs +0 -7
- package/angular/16/fesm2022/lightgallery-angular-16.mjs +0 -254
- package/angular/16/fesm2022/lightgallery-angular-16.mjs.map +0 -1
- package/angular/16/index.d.ts +0 -5
- package/angular/16/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/16/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/16/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/16/package.json +0 -25
- package/angular/16/public-api.d.ts +0 -3
- package/angular/9/README.md +0 -24
- package/angular/9/bundles/lightgallery-angular-9.umd.js +0 -271
- package/angular/9/bundles/lightgallery-angular-9.umd.js.map +0 -1
- package/angular/9/bundles/lightgallery-angular-9.umd.min.js +0 -2
- package/angular/9/bundles/lightgallery-angular-9.umd.min.js.map +0 -1
- package/angular/9/esm2015/lib/lightgallery-angular.component.js +0 -225
- package/angular/9/esm2015/lib/lightgallery-angular.module.js +0 -17
- package/angular/9/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/9/esm2015/lightgallery-angular-9.js +0 -5
- package/angular/9/esm2015/public-api.js +0 -7
- package/angular/9/esm5/lib/lightgallery-angular.component.js +0 -228
- package/angular/9/esm5/lib/lightgallery-angular.module.js +0 -21
- package/angular/9/esm5/lib/lightgallery-angular.service.js +0 -17
- package/angular/9/esm5/lightgallery-angular-9.js +0 -5
- package/angular/9/esm5/public-api.js +0 -7
- package/angular/9/fesm2015/lightgallery-angular-9.js +0 -261
- package/angular/9/fesm2015/lightgallery-angular-9.js.map +0 -1
- package/angular/9/fesm5/lightgallery-angular-9.js +0 -268
- package/angular/9/fesm5/lightgallery-angular-9.js.map +0 -1
- package/angular/9/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/9/lib/lightgallery-angular.module.d.ts +0 -6
- package/angular/9/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/9/lightgallery-angular-9.d.ts +0 -5
- package/angular/9/package.json +0 -23
- package/angular/9/public-api.d.ts +0 -3
- package/angular/README.md +0 -24
- package/angular/esm2022/lib/lightgallery-angular.component.mjs +0 -218
- package/angular/esm2022/lib/lightgallery-angular.module.mjs +0 -18
- package/angular/esm2022/lib/lightgallery-angular.service.mjs +0 -15
- package/angular/esm2022/lightgallery-angular.mjs +0 -5
- package/angular/esm2022/public-api.mjs +0 -7
- package/angular/fesm2022/lightgallery-angular.mjs +0 -254
- package/angular/fesm2022/lightgallery-angular.mjs.map +0 -1
- package/angular/index.d.ts +0 -5
- package/angular/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/package.json +0 -25
- package/angular/public-api.d.ts +0 -3
- package/css/lg-fullscreen.css +0 -8
- package/css/lg-fullscreen.css.map +0 -1
- package/css/lg-share.css.map +0 -1
- package/css/lg-thumbnail.css.map +0 -1
- package/css/lg-transitions.css.map +0 -1
- package/css/lg-zoom.css.map +0 -1
- package/css/lightgallery-bundle.css.map +0 -1
- package/css/lightgallery-bundle.min.css +0 -1
- package/css/lightgallery-core.css.map +0 -1
- package/css/lightgallery.css.map +0 -1
- package/fonts/lg.svg +0 -54
- package/fonts/lg.ttf +0 -0
- package/fonts/lg.woff +0 -0
- package/fonts/lg.woff2 +0 -0
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/lg-events.js +0 -37
- package/lib/lg-events.js.map +0 -1
- package/lib/lg-plugin.js +0 -13
- package/lib/lg-plugin.js.map +0 -1
- package/lib/lg-settings.js +0 -83
- package/lib/lg-settings.js.map +0 -1
- package/lib/lg-utils.js +0 -328
- package/lib/lg-utils.js.map +0 -1
- package/lib/lgQuery.js +0 -385
- package/lib/lgQuery.js.map +0 -1
- package/lib/lightgallery.js +0 -1949
- package/lib/lightgallery.js.map +0 -1
- package/lib/plugins/autoplay/lg-autoplay-settings.js +0 -16
- package/lib/plugins/autoplay/lg-autoplay-settings.js.map +0 -1
- package/lib/plugins/autoplay/lg-autoplay.js +0 -184
- package/lib/plugins/autoplay/lg-autoplay.js.map +0 -1
- package/lib/plugins/comment/lg-comment-settings.js +0 -17
- package/lib/plugins/comment/lg-comment-settings.js.map +0 -1
- package/lib/plugins/comment/lg-comment.js +0 -140
- package/lib/plugins/comment/lg-comment.js.map +0 -1
- package/lib/plugins/fullscreen/lg-fullscreen-settings.js +0 -10
- package/lib/plugins/fullscreen/lg-fullscreen-settings.js.map +0 -1
- package/lib/plugins/fullscreen/lg-fullscreen.js +0 -108
- package/lib/plugins/fullscreen/lg-fullscreen.js.map +0 -1
- package/lib/plugins/hash/lg-hash-settings.js +0 -9
- package/lib/plugins/hash/lg-hash-settings.js.map +0 -1
- package/lib/plugins/hash/lg-hash.js +0 -139
- package/lib/plugins/hash/lg-hash.js.map +0 -1
- package/lib/plugins/mediumZoom/lg-medium-zoom-settings.js +0 -9
- package/lib/plugins/mediumZoom/lg-medium-zoom-settings.js.map +0 -1
- package/lib/plugins/mediumZoom/lg-medium-zoom.js +0 -73
- package/lib/plugins/mediumZoom/lg-medium-zoom.js.map +0 -1
- package/lib/plugins/pager/lg-pager-settings.js +0 -7
- package/lib/plugins/pager/lg-pager-settings.js.map +0 -1
- package/lib/plugins/pager/lg-pager.js +0 -82
- package/lib/plugins/pager/lg-pager.js.map +0 -1
- package/lib/plugins/relativeCaption/lg-relative-caption-settings.js +0 -7
- package/lib/plugins/relativeCaption/lg-relative-caption-settings.js.map +0 -1
- package/lib/plugins/relativeCaption/lg-relative-caption.js +0 -97
- package/lib/plugins/relativeCaption/lg-relative-caption.js.map +0 -1
- package/lib/plugins/rotate/lg-rotate-settings.js +0 -18
- package/lib/plugins/rotate/lg-rotate-settings.js.map +0 -1
- package/lib/plugins/rotate/lg-rotate.js +0 -206
- package/lib/plugins/rotate/lg-rotate.js.map +0 -1
- package/lib/plugins/share/lg-fb-share-utils.js +0 -10
- package/lib/plugins/share/lg-fb-share-utils.js.map +0 -1
- package/lib/plugins/share/lg-pinterest-share-utils.js +0 -17
- package/lib/plugins/share/lg-pinterest-share-utils.js.map +0 -1
- package/lib/plugins/share/lg-share-settings.js +0 -15
- package/lib/plugins/share/lg-share-settings.js.map +0 -1
- package/lib/plugins/share/lg-share.js +0 -130
- package/lib/plugins/share/lg-share.js.map +0 -1
- package/lib/plugins/share/lg-twitter-share-utils.js +0 -11
- package/lib/plugins/share/lg-twitter-share-utils.js.map +0 -1
- package/lib/plugins/share/types.js +0 -3
- package/lib/plugins/share/types.js.map +0 -1
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js +0 -23
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js.map +0 -1
- package/lib/plugins/thumbnail/lg-thumbnail.js +0 -414
- package/lib/plugins/thumbnail/lg-thumbnail.js.map +0 -1
- package/lib/plugins/video/lg-video-settings.js +0 -15
- package/lib/plugins/video/lg-video-settings.js.map +0 -1
- package/lib/plugins/video/lg-video-utils.js +0 -84
- package/lib/plugins/video/lg-video-utils.js.map +0 -1
- package/lib/plugins/video/lg-video.js +0 -411
- package/lib/plugins/video/lg-video.js.map +0 -1
- package/lib/plugins/video/types.js +0 -3
- package/lib/plugins/video/types.js.map +0 -1
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js +0 -8
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js.map +0 -1
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js +0 -122
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js.map +0 -1
- package/lib/plugins/zoom/lg-zoom-settings.js +0 -21
- package/lib/plugins/zoom/lg-zoom-settings.js.map +0 -1
- package/lib/plugins/zoom/lg-zoom.js +0 -909
- package/lib/plugins/zoom/lg-zoom.js.map +0 -1
- package/lib/types.js +0 -3
- package/lib/types.js.map +0 -1
- package/lightgallery-2.9.0.tgz +0 -0
- package/lightgallery.es5.js +0 -2786
- package/lightgallery.es5.js.map +0 -1
- package/lightgallery.min.js +0 -8
- package/lightgallery.umd.js +0 -2794
- package/lightgallery.umd.js.map +0 -1
- package/lit/custom-elements.json +0 -82
- package/lit/lightgallery.esm.js +0 -59
- package/lit/lightgallery.umd.js +0 -37
- package/lit/package.json +0 -8
- package/plugins/autoplay/lg-autoplay.es5.js +0 -250
- package/plugins/autoplay/lg-autoplay.es5.js.map +0 -1
- package/plugins/autoplay/lg-autoplay.min.js +0 -8
- package/plugins/autoplay/lg-autoplay.umd.js +0 -258
- package/plugins/autoplay/lg-autoplay.umd.js.map +0 -1
- package/plugins/autoplay/package.json +0 -7
- package/plugins/comment/lg-comment.es5.js +0 -205
- package/plugins/comment/lg-comment.es5.js.map +0 -1
- package/plugins/comment/lg-comment.min.js +0 -8
- package/plugins/comment/lg-comment.umd.js +0 -213
- package/plugins/comment/lg-comment.umd.js.map +0 -1
- package/plugins/comment/package.json +0 -7
- package/plugins/fullscreen/lg-fullscreen.es5.js +0 -135
- package/plugins/fullscreen/lg-fullscreen.es5.js.map +0 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +0 -8
- package/plugins/fullscreen/lg-fullscreen.umd.js +0 -143
- package/plugins/fullscreen/lg-fullscreen.umd.js.map +0 -1
- package/plugins/fullscreen/package.json +0 -7
- package/plugins/hash/lg-hash-settings.d.ts +0 -16
- package/plugins/hash/lg-hash.es5.js +0 -198
- package/plugins/hash/lg-hash.es5.js.map +0 -1
- package/plugins/hash/lg-hash.min.js +0 -8
- package/plugins/hash/lg-hash.umd.js +0 -206
- package/plugins/hash/lg-hash.umd.js.map +0 -1
- package/plugins/hash/package.json +0 -7
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +0 -132
- package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +0 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +0 -8
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +0 -140
- package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +0 -1
- package/plugins/mediumZoom/package.json +0 -7
- package/plugins/pager/lg-pager.es5.js +0 -139
- package/plugins/pager/lg-pager.es5.js.map +0 -1
- package/plugins/pager/lg-pager.min.js +0 -8
- package/plugins/pager/lg-pager.umd.js +0 -147
- package/plugins/pager/lg-pager.umd.js.map +0 -1
- package/plugins/pager/package.json +0 -7
- package/plugins/relativeCaption/lg-relative-caption.es5.js +0 -154
- package/plugins/relativeCaption/lg-relative-caption.es5.js.map +0 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +0 -8
- package/plugins/relativeCaption/lg-relative-caption.umd.js +0 -162
- package/plugins/relativeCaption/lg-relative-caption.umd.js.map +0 -1
- package/plugins/relativeCaption/package.json +0 -7
- package/plugins/rotate/lg-rotate.es5.js +0 -274
- package/plugins/rotate/lg-rotate.es5.js.map +0 -1
- package/plugins/rotate/lg-rotate.min.js +0 -8
- package/plugins/rotate/lg-rotate.umd.js +0 -282
- package/plugins/rotate/lg-rotate.umd.js.map +0 -1
- package/plugins/rotate/package.json +0 -7
- package/plugins/share/lg-share.d.ts +0 -15
- package/plugins/share/lg-share.es5.js +0 -219
- package/plugins/share/lg-share.es5.js.map +0 -1
- package/plugins/share/lg-share.min.js +0 -8
- package/plugins/share/lg-share.umd.js +0 -227
- package/plugins/share/lg-share.umd.js.map +0 -1
- package/plugins/share/lg-twitter-share-utils.d.ts +0 -2
- package/plugins/share/package.json +0 -7
- package/plugins/thumbnail/lg-thumbnail.d.ts +0 -48
- package/plugins/thumbnail/lg-thumbnail.es5.js +0 -487
- package/plugins/thumbnail/lg-thumbnail.es5.js.map +0 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +0 -8
- package/plugins/thumbnail/lg-thumbnail.umd.js +0 -495
- package/plugins/thumbnail/lg-thumbnail.umd.js.map +0 -1
- package/plugins/thumbnail/package.json +0 -7
- package/plugins/video/lg-video-utils.d.ts +0 -10
- package/plugins/video/lg-video.es5.js +0 -545
- package/plugins/video/lg-video.es5.js.map +0 -1
- package/plugins/video/lg-video.min.js +0 -8
- package/plugins/video/lg-video.umd.js +0 -553
- package/plugins/video/lg-video.umd.js.map +0 -1
- package/plugins/video/package.json +0 -7
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +0 -182
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +0 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +0 -8
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +0 -190
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +0 -1
- package/plugins/vimeoThumbnail/package.json +0 -7
- package/plugins/zoom/lg-zoom.es5.js +0 -980
- package/plugins/zoom/lg-zoom.es5.js.map +0 -1
- package/plugins/zoom/lg-zoom.min.js +0 -8
- package/plugins/zoom/lg-zoom.umd.js +0 -988
- package/plugins/zoom/lg-zoom.umd.js.map +0 -1
- package/plugins/zoom/package.json +0 -7
- package/react/Lightgallery.d.ts +0 -33
- package/react/Lightgallery.es5.js +0 -2988
- package/react/Lightgallery.es5.js.map +0 -1
- package/react/Lightgallery.umd.js +0 -2994
- package/react/Lightgallery.umd.js.map +0 -1
- package/react/package.json +0 -7
- package/scss/_lg-fonts.scss +0 -27
- package/scss/lg-fullscreen.scss +0 -9
- package/vue/LightGallery.vue.d.ts +0 -37
- package/vue/LightGalleryVue.common.js +0 -9343
- package/vue/LightGalleryVue.common.js.map +0 -1
- package/vue/LightGalleryVue.umd.js +0 -9353
- package/vue/LightGalleryVue.umd.js.map +0 -1
- package/vue/LightGalleryVue.umd.min.js +0 -8
- package/vue/LightGalleryVue.umd.min.js.map +0 -1
- package/vue/package.json +0 -7
- /package/{css → dist/css}/lg-medium-zoom.css +0 -0
- /package/{css → dist/css}/lg-medium-zoom.css.map +0 -0
- /package/{css → dist/css}/lg-pager.css +0 -0
- /package/{css → dist/css}/lg-relative-caption.css +0 -0
- /package/{css → dist/css}/lg-relative-caption.css.map +0 -0
- /package/{css → dist/css}/lg-video.css +0 -0
- /package/{css → dist/css}/lg-video.css.map +0 -0
- /package/{images → dist/images}/loading.gif +0 -0
- /package/{scss → dist/scss}/_lg-mixins.scss +0 -0
- /package/{scss → dist/scss}/lg-medium-zoom.scss +0 -0
- /package/{scss → dist/scss}/lg-pager.scss +0 -0
- /package/{scss → dist/scss}/lg-relative-caption.scss +0 -0
- /package/{scss → dist/scss}/lg-transitions.scss +0 -0
- /package/{scss → dist/scss}/lg-video.scss +0 -0
- /package/{scss → dist/scss}/transitions/_index.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-lollipop-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-lollipop.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-rotate-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-rotate.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-cross-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-cross.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-y-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-y.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-cross-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-cross.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-vertical-growth.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-vertical.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-tube.scss +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.lgHash = factory());
|
|
3
|
+
})(this, function() {
|
|
4
|
+
"use strict";/*!
|
|
5
|
+
* lightgallery | 3.0.0-beta.3 | October 1st 2026
|
|
6
|
+
* http://www.lightgalleryjs.com/
|
|
7
|
+
* Copyright (c) 2020 Sachin Neravath;
|
|
8
|
+
* @license GPLv3
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function createHistoryHashDriver(win) {
|
|
12
|
+
return {
|
|
13
|
+
kind: "history",
|
|
14
|
+
getHash: () => win.location.hash || "",
|
|
15
|
+
replaceHash: (hash) => win.history.replaceState(
|
|
16
|
+
null,
|
|
17
|
+
"",
|
|
18
|
+
win.location.pathname + win.location.search + hash
|
|
19
|
+
),
|
|
20
|
+
clearHash: () => win.history.replaceState(
|
|
21
|
+
null,
|
|
22
|
+
"",
|
|
23
|
+
win.location.pathname + win.location.search
|
|
24
|
+
),
|
|
25
|
+
subscribe: (onChange) => {
|
|
26
|
+
win.addEventListener("hashchange", onChange);
|
|
27
|
+
return () => win.removeEventListener("hashchange", onChange);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function settleNavigateResult(result) {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
const promises = result;
|
|
34
|
+
(_b = (_a = promises == null ? void 0 : promises.committed) == null ? void 0 : _a.catch) == null ? void 0 : _b.call(_a, () => void 0);
|
|
35
|
+
(_d = (_c = promises == null ? void 0 : promises.finished) == null ? void 0 : _c.catch) == null ? void 0 : _d.call(_c, () => void 0);
|
|
36
|
+
}
|
|
37
|
+
function createNavigationHashDriver(win, navigation) {
|
|
38
|
+
const getHash = () => {
|
|
39
|
+
var _a;
|
|
40
|
+
const url = (_a = navigation.currentEntry) == null ? void 0 : _a.url;
|
|
41
|
+
if (typeof url === "string") {
|
|
42
|
+
const index = url.indexOf("#");
|
|
43
|
+
return index === -1 ? "" : url.slice(index);
|
|
44
|
+
}
|
|
45
|
+
return win.location.hash || "";
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
kind: "navigation",
|
|
49
|
+
getHash,
|
|
50
|
+
replaceHash: (hash) => settleNavigateResult(
|
|
51
|
+
navigation.navigate(
|
|
52
|
+
win.location.pathname + win.location.search + hash,
|
|
53
|
+
{ history: "replace", state: { lgHash: hash } }
|
|
54
|
+
)
|
|
55
|
+
),
|
|
56
|
+
clearHash: () => (
|
|
57
|
+
// Not navigate(): a destination without a fragment is a
|
|
58
|
+
// *cross-document* navigation (the same-document fast path
|
|
59
|
+
// requires the destination to have one), so clearing the hash
|
|
60
|
+
// through it reloads the page every time a gallery closes.
|
|
61
|
+
// replaceState drops the fragment in place, and the entry
|
|
62
|
+
// change still reaches `currententrychange` subscribers.
|
|
63
|
+
win.history.replaceState(
|
|
64
|
+
null,
|
|
65
|
+
"",
|
|
66
|
+
win.location.pathname + win.location.search
|
|
67
|
+
)
|
|
68
|
+
),
|
|
69
|
+
subscribe: (onChange) => {
|
|
70
|
+
navigation.addEventListener("currententrychange", onChange);
|
|
71
|
+
return () => navigation.removeEventListener("currententrychange", onChange);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function createHashDriver(win, preference = "auto") {
|
|
76
|
+
const navigation = win.navigation;
|
|
77
|
+
const navigationCapable = !!navigation && typeof navigation.navigate === "function" && typeof navigation.addEventListener === "function" && typeof navigation.removeEventListener === "function";
|
|
78
|
+
if (preference !== "history" && navigationCapable) {
|
|
79
|
+
return createNavigationHashDriver(win, navigation);
|
|
80
|
+
}
|
|
81
|
+
return createHistoryHashDriver(win);
|
|
82
|
+
}
|
|
83
|
+
const lGEvents = {
|
|
84
|
+
afterSlide: "lgAfterSlide",
|
|
85
|
+
afterClose: "lgAfterClose"
|
|
86
|
+
};
|
|
87
|
+
const hashSettings = {
|
|
88
|
+
hash: true,
|
|
89
|
+
hashDriver: "auto",
|
|
90
|
+
galleryId: "1",
|
|
91
|
+
customSlideName: false
|
|
92
|
+
};
|
|
93
|
+
var __defProp = Object.defineProperty;
|
|
94
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
95
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
96
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
97
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
98
|
+
var __spreadValues = (a, b) => {
|
|
99
|
+
for (var prop in b || (b = {}))
|
|
100
|
+
if (__hasOwnProp.call(b, prop))
|
|
101
|
+
__defNormalProp(a, prop, b[prop]);
|
|
102
|
+
if (__getOwnPropSymbols)
|
|
103
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
104
|
+
if (__propIsEnum.call(b, prop))
|
|
105
|
+
__defNormalProp(a, prop, b[prop]);
|
|
106
|
+
}
|
|
107
|
+
return a;
|
|
108
|
+
};
|
|
109
|
+
class Hash {
|
|
110
|
+
constructor(instance, $LG) {
|
|
111
|
+
this.core = instance;
|
|
112
|
+
this.$LG = $LG;
|
|
113
|
+
this.settings = __spreadValues(__spreadValues({}, hashSettings), this.core.settings);
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
init() {
|
|
117
|
+
if (!this.settings.hash) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.driver = createHashDriver(
|
|
121
|
+
window,
|
|
122
|
+
this.settings.hashDriver
|
|
123
|
+
);
|
|
124
|
+
this.oldHash = this.driver.getHash();
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
this.buildFromHash();
|
|
127
|
+
}, 100);
|
|
128
|
+
this.core.LGel.on(
|
|
129
|
+
`${lGEvents.afterSlide}.hash`,
|
|
130
|
+
this.onAfterSlide.bind(this)
|
|
131
|
+
);
|
|
132
|
+
this.core.LGel.on(
|
|
133
|
+
`${lGEvents.afterClose}.hash`,
|
|
134
|
+
this.onCloseAfter.bind(this)
|
|
135
|
+
);
|
|
136
|
+
this.unsubscribeDriver = this.driver.subscribe(
|
|
137
|
+
this.onHashchange.bind(this)
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
onAfterSlide(event) {
|
|
141
|
+
let slideName = this.core.galleryItems[event.detail.index].slideName;
|
|
142
|
+
slideName = this.settings.customSlideName ? slideName || event.detail.index : event.detail.index;
|
|
143
|
+
this.driver.replaceHash(
|
|
144
|
+
"#lg=" + this.settings.galleryId + "&slide=" + slideName
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get index of the slide from custom slideName. Has to be a public method. Used in hash plugin
|
|
149
|
+
* @param {String} hash
|
|
150
|
+
* @returns {Number} Index of the slide.
|
|
151
|
+
*/
|
|
152
|
+
getIndexFromUrl(hash = this.driver.getHash()) {
|
|
153
|
+
const slideName = hash.split("&slide=")[1];
|
|
154
|
+
let _idx = 0;
|
|
155
|
+
if (this.settings.customSlideName) {
|
|
156
|
+
for (let index = 0; index < this.core.galleryItems.length; index++) {
|
|
157
|
+
const dynamicEl = this.core.galleryItems[index];
|
|
158
|
+
if (dynamicEl.slideName === slideName) {
|
|
159
|
+
_idx = index;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
_idx = parseInt(slideName, 10);
|
|
165
|
+
}
|
|
166
|
+
return isNaN(_idx) ? 0 : _idx;
|
|
167
|
+
}
|
|
168
|
+
// Build Gallery if gallery id exist in the URL
|
|
169
|
+
buildFromHash() {
|
|
170
|
+
const _hash = this.driver.getHash();
|
|
171
|
+
if (_hash.indexOf("lg=" + this.settings.galleryId) > 0) {
|
|
172
|
+
this.$LG(document.body).addClass("lg-from-hash");
|
|
173
|
+
const index = this.getIndexFromUrl(_hash);
|
|
174
|
+
this.core.openGallery(index);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
onCloseAfter() {
|
|
179
|
+
if (this.oldHash && this.oldHash.indexOf("lg=" + this.settings.galleryId) < 0) {
|
|
180
|
+
this.driver.replaceHash(this.oldHash);
|
|
181
|
+
} else {
|
|
182
|
+
this.driver.clearHash();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
onHashchange() {
|
|
186
|
+
if (!this.core.lgOpened) return;
|
|
187
|
+
const _hash = this.driver.getHash();
|
|
188
|
+
const index = this.getIndexFromUrl(_hash);
|
|
189
|
+
if (_hash.indexOf("lg=" + this.settings.galleryId) > -1) {
|
|
190
|
+
this.core.slide(index, false, false);
|
|
191
|
+
} else if (this.core.lGalleryOn) {
|
|
192
|
+
this.core.closeGallery();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
closeGallery() {
|
|
196
|
+
if (this.settings.hash) {
|
|
197
|
+
this.$LG(document.body).removeClass("lg-from-hash");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
destroy() {
|
|
201
|
+
var _a;
|
|
202
|
+
this.core.LGel.off(".lg.hash");
|
|
203
|
+
this.core.LGel.off(".hash");
|
|
204
|
+
(_a = this.unsubscribeDriver) == null ? void 0 : _a.call(this);
|
|
205
|
+
this.unsubscribeDriver = void 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return Hash;
|
|
209
|
+
});
|
|
210
|
+
//# sourceMappingURL=lg-hash.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lg-hash.umd.js","sources":["../../../packages/headless/src/hash-driver.ts","../../../src/lg-events.ts","../../../src/plugins/hash/lg-hash-settings.ts","../../../src/plugins/hash/lg-hash.ts"],"sourcesContent":["/**\n * URL-hash drivers for the hash plugin (plan 012). The plugin's history\n * side-effects — replace-write the deep link, restore/clear on close,\n * follow back/forward — sit behind one interface with two engines:\n *\n * - `history`: today's behavior (history.replaceState + `hashchange`) —\n * the default fallback everywhere.\n * - `navigation`: the Navigation API (Baseline Newly Available, Jan\n * 2026) — replace-navigations carry entry state, and back/forward is\n * observed via `currententrychange`. Strictly a feature-detected\n * enhancement: nothing here is load-bearing (Safari's missing\n * `precommitHandler` is irrelevant — we never intercept), and any\n * missing capability falls back to the history driver.\n *\n * The deep-link URL format (`#lg=<galleryId>&slide=<index|name>`) is\n * public API and identical across drivers — pinned by the parity tests.\n *\n * Everything is structurally typed (the runtimes pass `window`); nothing\n * in this module touches DOM globals directly.\n *\n * Revisit note: flip the docs' default emphasis toward `navigation` once\n * the API reaches Widely Available (~2028 per current projection).\n */\n\nexport interface HashDriver {\n /** Which engine this driver runs on (also used by the parity tests). */\n readonly kind: 'history' | 'navigation';\n /** The current URL hash including the leading '#', or ''. */\n getHash(): string;\n /** Replace the current entry's hash (never grows history). */\n replaceHash(hash: string): void;\n /** Replace the current entry with the bare URL (drops the hash). */\n clearHash(): void;\n /**\n * Notify on URL changes the driver did not itself cause is NOT\n * guaranteed — subscribers must be re-entrant-safe (the hash plugin's\n * handlers already are: same-slide jumps no-op and close checks the\n * open flag).\n */\n subscribe(onChange: () => void): () => void;\n}\n\nexport interface HashHistoryWindow {\n location: { hash: string; pathname: string; search: string };\n history: {\n replaceState(data: unknown, unused: string, url?: string): void;\n };\n addEventListener(type: string, listener: () => void): void;\n removeEventListener(type: string, listener: () => void): void;\n}\n\n/** Structural slice of the Navigation API the driver uses. */\nexport interface NavigationLike {\n currentEntry?: { url?: string | null } | null;\n navigate(\n url: string,\n options?: {\n history?: 'auto' | 'push' | 'replace';\n state?: unknown;\n },\n ): unknown;\n addEventListener(type: string, listener: () => void): void;\n removeEventListener(type: string, listener: () => void): void;\n}\n\nexport interface HashNavigationWindow extends HashHistoryWindow {\n navigation?: NavigationLike;\n}\n\nexport type HashDriverPreference = 'auto' | 'history' | 'navigation';\n\nexport function createHistoryHashDriver(win: HashHistoryWindow): HashDriver {\n return {\n kind: 'history',\n getHash: () => win.location.hash || '',\n replaceHash: (hash) =>\n win.history.replaceState(\n null,\n '',\n win.location.pathname + win.location.search + hash,\n ),\n clearHash: () =>\n win.history.replaceState(\n null,\n '',\n win.location.pathname + win.location.search,\n ),\n subscribe: (onChange) => {\n win.addEventListener('hashchange', onChange);\n return () => win.removeEventListener('hashchange', onChange);\n },\n };\n}\n\n/** Swallow the navigate() result promises — a dismissed/aborted\n * navigation has nothing to clean up (same posture as the share sheet). */\nfunction settleNavigateResult(result: unknown): void {\n const promises = result as {\n committed?: Promise<unknown>;\n finished?: Promise<unknown>;\n } | null;\n promises?.committed?.catch?.(() => undefined);\n promises?.finished?.catch?.(() => undefined);\n}\n\nexport function createNavigationHashDriver(\n win: HashHistoryWindow,\n navigation: NavigationLike,\n): HashDriver {\n const getHash = (): string => {\n const url = navigation.currentEntry?.url;\n if (typeof url === 'string') {\n const index = url.indexOf('#');\n return index === -1 ? '' : url.slice(index);\n }\n return win.location.hash || '';\n };\n return {\n kind: 'navigation',\n getHash,\n replaceHash: (hash) =>\n settleNavigateResult(\n navigation.navigate(\n win.location.pathname + win.location.search + hash,\n { history: 'replace', state: { lgHash: hash } },\n ),\n ),\n clearHash: () =>\n // Not navigate(): a destination without a fragment is a\n // *cross-document* navigation (the same-document fast path\n // requires the destination to have one), so clearing the hash\n // through it reloads the page every time a gallery closes.\n // replaceState drops the fragment in place, and the entry\n // change still reaches `currententrychange` subscribers.\n win.history.replaceState(\n null,\n '',\n win.location.pathname + win.location.search,\n ),\n subscribe: (onChange) => {\n // currententrychange also fires for the driver's own replace\n // navigations — safe by contract (see HashDriver.subscribe).\n navigation.addEventListener('currententrychange', onChange);\n return () =>\n navigation.removeEventListener('currententrychange', onChange);\n },\n };\n}\n\n/**\n * Pick a driver: `navigation` when preferred-or-auto and the Navigation\n * API is present with everything the driver needs; the history driver in\n * every other case (including an explicit `navigation` preference on a\n * browser without support — the enhancement is never load-bearing).\n */\nexport function createHashDriver(\n win: HashNavigationWindow,\n preference: HashDriverPreference = 'auto',\n): HashDriver {\n const navigation = win.navigation;\n const navigationCapable =\n !!navigation &&\n typeof navigation.navigate === 'function' &&\n typeof navigation.addEventListener === 'function' &&\n typeof navigation.removeEventListener === 'function';\n if (preference !== 'history' && navigationCapable) {\n return createNavigationHashDriver(win, navigation);\n }\n return createHistoryHashDriver(win);\n}\n","import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n [key: string]: string;\n} = {\n afterAppendSlide: 'lgAfterAppendSlide',\n init: 'lgInit',\n hasVideo: 'lgHasVideo',\n containerResize: 'lgContainerResize',\n updateSlides: 'lgUpdateSlides',\n afterAppendSubHtml: 'lgAfterAppendSubHtml',\n beforeOpen: 'lgBeforeOpen',\n afterOpen: 'lgAfterOpen',\n slideItemLoad: 'lgSlideItemLoad',\n beforeSlide: 'lgBeforeSlide',\n afterSlide: 'lgAfterSlide',\n posterClick: 'lgPosterClick',\n dragStart: 'lgDragStart',\n dragMove: 'lgDragMove',\n dragEnd: 'lgDragEnd',\n beforeNextSlide: 'lgBeforeNextSlide',\n beforePrevSlide: 'lgBeforePrevSlide',\n beforeClose: 'lgBeforeClose',\n afterClose: 'lgAfterClose',\n rotateLeft: 'lgRotateLeft',\n rotateRight: 'lgRotateRight',\n flipHorizontal: 'lgFlipHorizontal',\n flipVertical: 'lgFlipVertical',\n autoplay: 'lgAutoplay',\n autoplayStart: 'lgAutoplayStart',\n autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action on lightGallery initialization.\n * // Init event returns the plugin instance that can be used to call any lightGalley public method\n * let pluginInstance = null;\n * lg.addEventListener('lgInit', (event) => {\n * pluginInstance = event.detail.instance;\n * });\n * lightGallery(lg);\n * @see <a href=\"/docs/methods/\">Methods</a>\n */\nexport interface InitDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n * This delay is required for the transition effect when the slide item is displayed\n * Respect the delay when you use this event\n */\n delay: number;\n\n // Will be true for the first slide\n isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n * const lg = document.getElementById('custom-events-demo');\n * // Perform any action before each slide transition\n * lg.addEventListener('lgBeforeSlide', (event) => {\n * const { index, prevIndex } = event.detail;\n * alert(index, prevIndex);\n * });\n * lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n /**\n * Index of the previous slide\n */\n prevIndex: number;\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n /**\n * true if slide function called via thumbnail click\n */\n fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n /**\n * lightGallery plugin instance\n */\n instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n /**\n * Index of the slide\n */\n index: number;\n /**\n * true if slide function called via touch event or mouse drag\n */\n fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n /**\n * Index of the slide,\n */\n index: number;\n /**\n * Video source\n */\n src: string;\n /**\n * HTML5 video source if available\n * <p>\n HTML5 video source = source: {\n src: string;\n type: string;\n }[];\n attributes: HTMLVideoElement;\n * </p>\n */\n html5Video: VideoSource;\n /**\n * True if video has poster\n */\n hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n /**\n * Index of the slide\n */\n index: number;\n}\n","import { HashDriverPreference } from '@lightgallery/headless';\n\nexport interface HashSettings {\n /**\n * Enable/Disable hash option\n */\n hash: boolean;\n\n /**\n * URL engine behind the hash syncing.\n * @description 'auto' uses the Navigation API where the browser\n * supports it and falls back to the History API everywhere else;\n * 'history' and 'navigation' force an engine (an unsupported\n * 'navigation' quietly falls back, the enhancement is never\n * load-bearing). The deep-link URL format is identical either way.\n * See <a href=\"/docs/hash-drivers/\">Hash drivers</a>.\n * @version V3.0.0\n */\n hashDriver: HashDriverPreference;\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 hashDriver: 'auto',\n galleryId: '1',\n customSlideName: false,\n};\n","import {\n createHashDriver,\n type HashDriver,\n type HashNavigationWindow,\n} from '@lightgallery/headless';\n\nimport { 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 // URL engine (plan 012): History API today, Navigation API where the\n // browser has it, same URLs either way.\n private driver!: HashDriver;\n private unsubscribeDriver?: () => void;\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.driver = createHashDriver(\n window as unknown as HashNavigationWindow,\n this.settings.hashDriver,\n );\n this.oldHash = this.driver.getHash();\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 // Follow back/forward URL changes (hashchange on the history\n // driver, currententrychange on the navigation driver).\n this.unsubscribeDriver = this.driver.subscribe(\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 this.driver.replaceHash(\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 = this.driver.getHash()): 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 = this.driver.getHash();\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 this.driver.replaceHash(this.oldHash);\n } else {\n this.driver.clearHash();\n }\n }\n\n private onHashchange() {\n if (!this.core.lgOpened) return;\n const _hash = this.driver.getHash();\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.unsubscribeDriver?.();\n this.unsubscribeDriver = undefined;\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,415 @@
|
|
|
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
|
+
function parseImageSize(lgSize, viewportWidth) {
|
|
8
|
+
if (!lgSize) {
|
|
9
|
+
return void 0;
|
|
10
|
+
}
|
|
11
|
+
let size = lgSize;
|
|
12
|
+
const responsiveSizes = lgSize.split(",");
|
|
13
|
+
if (responsiveSizes[1]) {
|
|
14
|
+
for (let i = 0; i < responsiveSizes.length; i++) {
|
|
15
|
+
const candidate = responsiveSizes[i].trim();
|
|
16
|
+
const responsiveWidth = parseInt(candidate.split("-")[2], 10);
|
|
17
|
+
if (responsiveWidth > viewportWidth) {
|
|
18
|
+
size = candidate;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
if (i === responsiveSizes.length - 1) {
|
|
22
|
+
size = candidate;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const parts = size.trim().split("-");
|
|
27
|
+
const width = parseInt(parts[0], 10);
|
|
28
|
+
const height = parseInt(parts[1], 10);
|
|
29
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
return { width, height };
|
|
33
|
+
}
|
|
34
|
+
const DEFAULT_TARGET_ROW_HEIGHT = 180;
|
|
35
|
+
const DEFAULT_GAP = 8;
|
|
36
|
+
const DEFAULT_MAX_SCALE = 1.75;
|
|
37
|
+
function sanitizeRatios(ratios) {
|
|
38
|
+
let warned = false;
|
|
39
|
+
return ratios.map((ratio) => {
|
|
40
|
+
if (Number.isFinite(ratio) && ratio > 0) {
|
|
41
|
+
return ratio;
|
|
42
|
+
}
|
|
43
|
+
if (!warned && typeof console !== "undefined") {
|
|
44
|
+
warned = true;
|
|
45
|
+
console.warn(
|
|
46
|
+
"lightGallery justified layout: invalid aspect ratio, treating as 1 (square). See https://www.lightgalleryjs.com/docs/justified-layout/"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return 1;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function renderRow(options) {
|
|
53
|
+
const { row, firstIndex, top, containerWidth, gap, fill, boxes } = options;
|
|
54
|
+
const height = Math.round(options.height);
|
|
55
|
+
let start = 0;
|
|
56
|
+
row.forEach((ratio, offset) => {
|
|
57
|
+
let width = Math.round(ratio * height);
|
|
58
|
+
if (fill && offset === row.length - 1) {
|
|
59
|
+
width = containerWidth - start;
|
|
60
|
+
}
|
|
61
|
+
boxes[firstIndex + offset] = { top, start, width, height };
|
|
62
|
+
start += width + gap;
|
|
63
|
+
});
|
|
64
|
+
return height;
|
|
65
|
+
}
|
|
66
|
+
function getJustifiedLayout(options) {
|
|
67
|
+
const {
|
|
68
|
+
containerWidth,
|
|
69
|
+
targetRowHeight = DEFAULT_TARGET_ROW_HEIGHT,
|
|
70
|
+
gap = DEFAULT_GAP,
|
|
71
|
+
lastRow = "start",
|
|
72
|
+
maxScale = DEFAULT_MAX_SCALE
|
|
73
|
+
} = options;
|
|
74
|
+
const ratios = sanitizeRatios(options.ratios);
|
|
75
|
+
const boxes = new Array(ratios.length);
|
|
76
|
+
const maxHeight = targetRowHeight * maxScale;
|
|
77
|
+
const fillHeight = (row2) => {
|
|
78
|
+
const available = containerWidth - gap * (row2.length - 1);
|
|
79
|
+
const ratioSum = row2.reduce((sum, ratio) => sum + ratio, 0);
|
|
80
|
+
return available / ratioSum;
|
|
81
|
+
};
|
|
82
|
+
let top = 0;
|
|
83
|
+
let row = [];
|
|
84
|
+
let firstIndex = 0;
|
|
85
|
+
const closeRow = (height, fill) => {
|
|
86
|
+
const rendered = renderRow({
|
|
87
|
+
row,
|
|
88
|
+
firstIndex,
|
|
89
|
+
top,
|
|
90
|
+
height: Math.min(height, maxHeight),
|
|
91
|
+
containerWidth,
|
|
92
|
+
gap,
|
|
93
|
+
// A clamped row no longer fills the width — never stretch it.
|
|
94
|
+
fill: fill && height <= maxHeight,
|
|
95
|
+
boxes
|
|
96
|
+
});
|
|
97
|
+
top += rendered + gap;
|
|
98
|
+
firstIndex += row.length;
|
|
99
|
+
row = [];
|
|
100
|
+
};
|
|
101
|
+
ratios.forEach((ratio) => {
|
|
102
|
+
row.push(ratio);
|
|
103
|
+
const height = fillHeight(row);
|
|
104
|
+
if (height > targetRowHeight) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const heightWithout = row.length > 1 ? fillHeight(row.slice(0, -1)) : null;
|
|
108
|
+
if (heightWithout !== null && heightWithout - targetRowHeight < targetRowHeight - height) {
|
|
109
|
+
const carried = row.pop();
|
|
110
|
+
closeRow(heightWithout, true);
|
|
111
|
+
row = [carried];
|
|
112
|
+
if (fillHeight(row) <= targetRowHeight) {
|
|
113
|
+
closeRow(fillHeight(row), true);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
closeRow(height, true);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
if (row.length > 0) {
|
|
120
|
+
if (lastRow === "hide") {
|
|
121
|
+
row.forEach((_, offset) => {
|
|
122
|
+
boxes[firstIndex + offset] = {
|
|
123
|
+
top: 0,
|
|
124
|
+
start: 0,
|
|
125
|
+
width: 0,
|
|
126
|
+
height: 0
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
} else if (lastRow === "justify") {
|
|
130
|
+
closeRow(fillHeight(row), true);
|
|
131
|
+
} else {
|
|
132
|
+
closeRow(targetRowHeight, false);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
boxes,
|
|
137
|
+
containerHeight: firstIndex > 0 || row.length > 0 ? Math.max(top - gap, 0) : 0
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function getJustifiedRows(boxes) {
|
|
141
|
+
const rows = [];
|
|
142
|
+
let rowTop = -1;
|
|
143
|
+
boxes.forEach((box, index) => {
|
|
144
|
+
if (box.width === 0 && box.height === 0) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!rows.length || box.top !== rowTop) {
|
|
148
|
+
rows.push([]);
|
|
149
|
+
rowTop = box.top;
|
|
150
|
+
}
|
|
151
|
+
rows[rows.length - 1].push(index);
|
|
152
|
+
});
|
|
153
|
+
return rows;
|
|
154
|
+
}
|
|
155
|
+
function getRevealableItems(rows, isLoaded, reveal) {
|
|
156
|
+
if (reveal === "image") {
|
|
157
|
+
return [].concat(...rows).filter(isLoaded);
|
|
158
|
+
}
|
|
159
|
+
const revealable = [];
|
|
160
|
+
for (const row of rows) {
|
|
161
|
+
if (!row.every(isLoaded)) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
revealable.push(...row);
|
|
165
|
+
}
|
|
166
|
+
return revealable;
|
|
167
|
+
}
|
|
168
|
+
const lGEvents = {
|
|
169
|
+
updateSlides: "lgUpdateSlides"
|
|
170
|
+
};
|
|
171
|
+
const justifiedSettings = {
|
|
172
|
+
justified: true,
|
|
173
|
+
justifiedRowHeight: 180,
|
|
174
|
+
justifiedGap: 8,
|
|
175
|
+
justifiedLastRow: "start",
|
|
176
|
+
justifiedMaxScale: 1.75,
|
|
177
|
+
justifiedReveal: "row"
|
|
178
|
+
};
|
|
179
|
+
var __defProp = Object.defineProperty;
|
|
180
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
181
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
182
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
183
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
184
|
+
var __spreadValues = (a, b) => {
|
|
185
|
+
for (var prop in b || (b = {}))
|
|
186
|
+
if (__hasOwnProp.call(b, prop))
|
|
187
|
+
__defNormalProp(a, prop, b[prop]);
|
|
188
|
+
if (__getOwnPropSymbols)
|
|
189
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
190
|
+
if (__propIsEnum.call(b, prop))
|
|
191
|
+
__defNormalProp(a, prop, b[prop]);
|
|
192
|
+
}
|
|
193
|
+
return a;
|
|
194
|
+
};
|
|
195
|
+
class Justified {
|
|
196
|
+
constructor(instance, $LG) {
|
|
197
|
+
this.triggers = [];
|
|
198
|
+
this.ratios = [];
|
|
199
|
+
this.layoutWidth = 0;
|
|
200
|
+
this.pendingLoads = [];
|
|
201
|
+
this.rows = [];
|
|
202
|
+
this.loaded = /* @__PURE__ */ new Set();
|
|
203
|
+
this.loadWatchers = /* @__PURE__ */ new Map();
|
|
204
|
+
this.originalContainerStyle = "";
|
|
205
|
+
this.originalTriggerStyles = /* @__PURE__ */ new Map();
|
|
206
|
+
this.core = instance;
|
|
207
|
+
this.$LG = $LG;
|
|
208
|
+
this.settings = __spreadValues(__spreadValues({}, justifiedSettings), this.core.settings);
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
init() {
|
|
212
|
+
if (!this.settings.justified || this.core.settings.dynamic) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
this.collectTriggers();
|
|
216
|
+
if (!this.triggers.length) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.originalContainerStyle = this.core.el.getAttribute("style") || "";
|
|
220
|
+
this.core.el.classList.add("lg-justified", "lg-justified-reveal");
|
|
221
|
+
this.resolveRatios();
|
|
222
|
+
this.layout();
|
|
223
|
+
this.core.LGel.on(`${lGEvents.updateSlides}.justified`, () => {
|
|
224
|
+
this.pendingLoads.forEach((cancel) => cancel());
|
|
225
|
+
this.pendingLoads = [];
|
|
226
|
+
this.cancelLoadWatchers();
|
|
227
|
+
this.collectTriggers();
|
|
228
|
+
this.resolveRatios();
|
|
229
|
+
this.layout();
|
|
230
|
+
});
|
|
231
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
232
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
233
|
+
if (this.core.el.clientWidth !== this.layoutWidth) {
|
|
234
|
+
this.layout();
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
this.resizeObserver.observe(this.core.el);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** Adopt the core's current trigger list into the layout. */
|
|
241
|
+
collectTriggers() {
|
|
242
|
+
this.triggers = Array.prototype.slice.call(this.core.items);
|
|
243
|
+
this.triggers.forEach((trigger) => {
|
|
244
|
+
if (!this.originalTriggerStyles.has(trigger)) {
|
|
245
|
+
this.originalTriggerStyles.set(
|
|
246
|
+
trigger,
|
|
247
|
+
trigger.getAttribute("style") || ""
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
trigger.classList.add("lg-justified-item");
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/** Best-known aspect ratio per trigger; unknowns resolve on load. */
|
|
254
|
+
resolveRatios() {
|
|
255
|
+
this.ratios = this.triggers.map((trigger, index) => {
|
|
256
|
+
const size = parseImageSize(
|
|
257
|
+
trigger.getAttribute("data-lg-size") || void 0,
|
|
258
|
+
window.innerWidth
|
|
259
|
+
);
|
|
260
|
+
if (size) {
|
|
261
|
+
return size.width / size.height;
|
|
262
|
+
}
|
|
263
|
+
const img = trigger.querySelector("img");
|
|
264
|
+
if (!img) {
|
|
265
|
+
return 1;
|
|
266
|
+
}
|
|
267
|
+
const width = parseInt(img.getAttribute("width") || "", 10);
|
|
268
|
+
const height = parseInt(img.getAttribute("height") || "", 10);
|
|
269
|
+
if (width > 0 && height > 0) {
|
|
270
|
+
return width / height;
|
|
271
|
+
}
|
|
272
|
+
if (img.complete && img.naturalWidth > 0) {
|
|
273
|
+
return img.naturalWidth / img.naturalHeight;
|
|
274
|
+
}
|
|
275
|
+
this.watchImageLoad(img, index);
|
|
276
|
+
return null;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/** Relayout once when the last unknown thumbnail resolves. */
|
|
280
|
+
watchImageLoad(img, index) {
|
|
281
|
+
const cancel = () => {
|
|
282
|
+
img.removeEventListener("load", onDone);
|
|
283
|
+
img.removeEventListener("error", onDone);
|
|
284
|
+
};
|
|
285
|
+
const onDone = () => {
|
|
286
|
+
cancel();
|
|
287
|
+
this.pendingLoads = this.pendingLoads.filter((c) => c !== cancel);
|
|
288
|
+
this.ratios[index] = img.naturalWidth > 0 ? img.naturalWidth / img.naturalHeight : 1;
|
|
289
|
+
if (this.ratios.every((ratio) => ratio !== null)) {
|
|
290
|
+
this.layout();
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
img.addEventListener("load", onDone);
|
|
294
|
+
img.addEventListener("error", onDone);
|
|
295
|
+
this.pendingLoads.push(cancel);
|
|
296
|
+
}
|
|
297
|
+
layout() {
|
|
298
|
+
const containerWidth = this.core.el.clientWidth;
|
|
299
|
+
if (!containerWidth) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
this.layoutWidth = containerWidth;
|
|
303
|
+
const { boxes, containerHeight } = getJustifiedLayout({
|
|
304
|
+
// Unknown ratios render square until their image resolves.
|
|
305
|
+
ratios: this.ratios.map((ratio) => ratio != null ? ratio : 1),
|
|
306
|
+
containerWidth,
|
|
307
|
+
targetRowHeight: this.settings.justifiedRowHeight,
|
|
308
|
+
gap: this.settings.justifiedGap,
|
|
309
|
+
lastRow: this.settings.justifiedLastRow,
|
|
310
|
+
maxScale: this.settings.justifiedMaxScale
|
|
311
|
+
});
|
|
312
|
+
const startSide = this.core.settings.direction === "rtl" ? "right" : "left";
|
|
313
|
+
const endSide = startSide === "left" ? "right" : "left";
|
|
314
|
+
this.core.el.style.height = `${containerHeight}px`;
|
|
315
|
+
this.triggers.forEach((trigger, index) => {
|
|
316
|
+
const box = boxes[index];
|
|
317
|
+
const hidden = box.width === 0 && box.height === 0;
|
|
318
|
+
trigger.classList.toggle("lg-justified-item-hidden", hidden);
|
|
319
|
+
if (hidden) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
trigger.style.top = `${box.top}px`;
|
|
323
|
+
trigger.style[startSide] = `${box.start}px`;
|
|
324
|
+
trigger.style[endSide] = "auto";
|
|
325
|
+
trigger.style.width = `${box.width}px`;
|
|
326
|
+
trigger.style.height = `${box.height}px`;
|
|
327
|
+
const img = trigger.querySelector("img");
|
|
328
|
+
if (img && img.hasAttribute("srcset")) {
|
|
329
|
+
img.setAttribute("sizes", `${box.width}px`);
|
|
330
|
+
}
|
|
331
|
+
this.watchLoad(trigger, img);
|
|
332
|
+
});
|
|
333
|
+
this.rows = getJustifiedRows(boxes).map(
|
|
334
|
+
(row) => row.map((index) => this.triggers[index])
|
|
335
|
+
);
|
|
336
|
+
this.reveal();
|
|
337
|
+
}
|
|
338
|
+
/** Track when the trigger's thumbnail has settled (loaded or failed). */
|
|
339
|
+
watchLoad(trigger, img) {
|
|
340
|
+
if (this.loaded.has(trigger) || this.loadWatchers.has(trigger)) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (!img || img.complete) {
|
|
344
|
+
this.loaded.add(trigger);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const onDone = () => {
|
|
348
|
+
cancel();
|
|
349
|
+
this.loaded.add(trigger);
|
|
350
|
+
this.reveal();
|
|
351
|
+
};
|
|
352
|
+
const cancel = () => {
|
|
353
|
+
img.removeEventListener("load", onDone);
|
|
354
|
+
img.removeEventListener("error", onDone);
|
|
355
|
+
this.loadWatchers.delete(trigger);
|
|
356
|
+
};
|
|
357
|
+
img.addEventListener("load", onDone);
|
|
358
|
+
img.addEventListener("error", onDone);
|
|
359
|
+
this.loadWatchers.set(trigger, cancel);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Fade in what may show now (see `justifiedReveal`). Never re-hides:
|
|
363
|
+
* a relayout regroups the rows, already visible triggers stay.
|
|
364
|
+
*/
|
|
365
|
+
reveal() {
|
|
366
|
+
getRevealableItems(
|
|
367
|
+
this.rows,
|
|
368
|
+
(trigger) => this.loaded.has(trigger),
|
|
369
|
+
this.settings.justifiedReveal
|
|
370
|
+
).forEach((trigger) => {
|
|
371
|
+
trigger.classList.add("lg-justified-item-visible");
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
cancelLoadWatchers() {
|
|
375
|
+
Array.from(this.loadWatchers.values()).forEach((cancel) => cancel());
|
|
376
|
+
}
|
|
377
|
+
closeGallery() {
|
|
378
|
+
}
|
|
379
|
+
destroy() {
|
|
380
|
+
var _a;
|
|
381
|
+
(_a = this.resizeObserver) == null ? void 0 : _a.disconnect();
|
|
382
|
+
this.pendingLoads.forEach((cancel) => cancel());
|
|
383
|
+
this.pendingLoads = [];
|
|
384
|
+
this.cancelLoadWatchers();
|
|
385
|
+
this.loaded.clear();
|
|
386
|
+
this.rows = [];
|
|
387
|
+
if (!this.triggers.length) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
this.core.LGel.off(".justified");
|
|
391
|
+
this.core.el.classList.remove("lg-justified", "lg-justified-reveal");
|
|
392
|
+
if (this.originalContainerStyle) {
|
|
393
|
+
this.core.el.setAttribute("style", this.originalContainerStyle);
|
|
394
|
+
} else {
|
|
395
|
+
this.core.el.removeAttribute("style");
|
|
396
|
+
}
|
|
397
|
+
this.triggers.forEach((trigger) => {
|
|
398
|
+
trigger.classList.remove(
|
|
399
|
+
"lg-justified-item",
|
|
400
|
+
"lg-justified-item-hidden",
|
|
401
|
+
"lg-justified-item-visible"
|
|
402
|
+
);
|
|
403
|
+
const original = this.originalTriggerStyles.get(trigger);
|
|
404
|
+
if (original) {
|
|
405
|
+
trigger.setAttribute("style", original);
|
|
406
|
+
} else {
|
|
407
|
+
trigger.removeAttribute("style");
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
export {
|
|
413
|
+
Justified as default
|
|
414
|
+
};
|
|
415
|
+
//# sourceMappingURL=lg-justified.es5.js.map
|