henrygd / bigger-picture

JavaScript lightbox gallery for images, video, audio, iframes, html. Zoomable, responsive, accessible, lightweight.
https://biggerpicture.henrygd.me
MIT License
231 stars 17 forks source link

expose Svelte stores #46

Closed warren-bank closed 4 months ago

warren-bank commented 4 months ago

Your BiggerPictureThumbnails demo component needs to import stores.js.

However, package.json prevents directly importing this file from the npm package.

My request is for the default export for svelte to include an export for stores.

Specifically:

...which would allow a user to create a custom component (such as BiggerPictureThumbnails) with the import:

  import {stores} from 'bigger-picture/svelte'
henrygd commented 4 months ago

I added a way to import it in the @next release and will be included in full releases going forward. That file is internal stuff so I'm not going to add it to the docs and can't promise that it won't be modified in the future. It's unlikely to be though.

pnpm install bigger-picture@next
import { prefersReducedMotion, closing } from 'bigger-picture/svelte/stores'

console.log('prefersReducedMotion', prefersReducedMotion)

closing.subscribe((bool) => {
    console.log('gallery is closing', bool)
})

Let me know if that doesn't work for you. It does require svelte to be installed.

warren-bank commented 4 months ago

Looks good to me. Thanks :smiley: