In the current absence of @ts-thomas (his last commit was early December 2019), I wanted to post with my findings of this library - some issues for him to consider if/when he returns to this project and some discoveries that may help everyone else work around any issues they are experiencing.
First off, I want to add to the comments that I think @ts-thomas has done a great job with this library. Yes there are bugs, but this library does work as is and the end result looks very nice, in my opinion. I want to say thank you to @ts-thomas and I hope he (and all of you) are staying healthy in this crazy time in the world.
What Works
What seems to work perfectly fine is a predefined HTML gallery. If you can specify your complete gallery in HTML and use the data-* attributes to define the properties, most (if not all) things seem to work fine and as expected. So, do it like this if you can.
Where's The Bugs?
From what I have experienced so far is that all of the bugs occur when using the API. However, you CAN use the API. There seems to be some limitations though:
- The API doesn't seem to have the ability to generate custom elements. Everything is effectively an "Image".
- The API doesn't allow you to display ONLY the description tag.
Workarounds in Spotlight.show()
The Image Array (first parameter)
Each item in the array must define all three properties - src, title, and description. There doesn't seem to be a way around that for now.
The Configuration (second parameter)
It seems that show() does require the second parameter be set. While there are a lot of common and useful settings like index or infinite (both of which work fine for me), if you don't have or want to set anything, just give it an empty object, i.e. {}
.
The Title/Description Footer
If you don't have a title and/or description, you still need to set them.
You cannot set them to null, false, or a null string.
You can set them to a single space. This will cause the footer to display, but with no content in it.
If you don't want it to display at all, that is possible. After looking through the source code, I tried (with success) passing the STRING of "false" as the title and that successfully hides the footer completely. If you set description to "false", it renders the text... so that doesn't work.
It does seem that if you want the footer to render at all (say you have a title OR a description, but not both), then both the title and description will have a tag rendered for them - though setting the one you need and the other to a single space doesn't look bad at all. You could even add some CSS to clean it up if you have consistent enough use case (like never using titles or something).
In Ending...
I found these issues were the most interesting to deal with and the bare minimum to get the API working for my needs. Without the workarounds and notes from above, you can expect to get a lot of odd JS errors in your console while working with the API. So, if that is happening to you, hopefully this helps.
Hopefully @ts-thomas is well and will be returning soon to release 0.7.0; but even until then, he's created a nice and useful library here. Hopefully this helps him moving forward and hopefully it helps others maybe having troubles now.
~ Cheers :)