Add typing for Photoswipe options
This commit is contained in:
Generated
+11
@@ -31,6 +31,7 @@
|
||||
"concurrently": "^10.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"photoswipe": "^5.4.4",
|
||||
"tsx": "^4",
|
||||
"typescript": "^5.6.2",
|
||||
"vitest": "^4"
|
||||
@@ -5561,6 +5562,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/photoswipe": {
|
||||
"version": "5.4.4",
|
||||
"resolved": "https://registry.npmjs.org/photoswipe/-/photoswipe-5.4.4.tgz",
|
||||
"integrity": "sha512-WNFHoKrkZNnvFFhbHL93WDkW3ifwVOXSW3w1UuZZelSmgXpIGiZSNlZJq37rR8YejqME2rHs9EhH9ZvlvFH2NA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"concurrently": "^10.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"photoswipe": "^5.4.4",
|
||||
"tsx": "^4",
|
||||
"typescript": "^5.6.2",
|
||||
"vitest": "^4"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// @ts-expect-error - browser-only ESM URL
|
||||
import PhotoSwipeLightbox from '/share/static/photoswipe/photoswipe-lightbox.esm.js' // eslint-disable-line import/no-absolute-path
|
||||
|
||||
import type { PhotoSwipeOptions } from 'photoswipe'
|
||||
import { state, SIDEBAR_WIDTH, MOBILE_BREAKPOINT } from './state.js'
|
||||
import type { GalleryItem } from '../shared/types.js'
|
||||
import {
|
||||
@@ -95,7 +96,7 @@ export function initLightbox () {
|
||||
...configPadding
|
||||
}
|
||||
|
||||
state.lightbox = new PhotoSwipeLightbox({
|
||||
const lightboxOptions: PhotoSwipeOptions = {
|
||||
bgOpacity: 1,
|
||||
showHideAnimationType: 'fade',
|
||||
closeOnVerticalDrag: true,
|
||||
@@ -122,7 +123,9 @@ export function initLightbox () {
|
||||
dataSource: buildDataSource(),
|
||||
// @ts-expect-error - runtime URL resolved by Express static
|
||||
pswpModule: () => import('/share/static/photoswipe/photoswipe.esm.js') // eslint-disable-line import/no-absolute-path
|
||||
})
|
||||
}
|
||||
|
||||
state.lightbox = new PhotoSwipeLightbox(lightboxOptions)
|
||||
|
||||
registerBackButton(state.lightbox)
|
||||
if (state.lightboxConfig.showDownload) registerDownloadButton(state.lightbox)
|
||||
|
||||
Reference in New Issue
Block a user