get gallery functionality working again
- redefine gallery types - re-implement gallery list, tile, and view - no carousel yet for variants, but WithoutVariants works when url specified
This commit is contained in:
parent
07b37e0805
commit
8ac3ed16ff
9 changed files with 225 additions and 145 deletions
|
@ -6,17 +6,55 @@ import type { MediaEntry } from './shared'
|
|||
export type GalleryEntryFormat =
|
||||
| 'image'
|
||||
|
||||
/**
|
||||
* This describes additional information about a gallery entry
|
||||
* to display when listing the entry on the gallery-list page.
|
||||
*/
|
||||
export type GalleryEntry = {
|
||||
/**
|
||||
* Defines properties shared among the different versions of a {@link GalleryEntry}
|
||||
*/
|
||||
export type GalleryEntrySharedProperties = {
|
||||
/**
|
||||
* The kind of media the entry is
|
||||
*/
|
||||
format: GalleryEntryFormat
|
||||
} & MediaEntry
|
||||
|
||||
/**
|
||||
* This describes additional information about a gallery entry which does not contain any variants.
|
||||
* It contains a URL to the media that the entry represents.
|
||||
*/
|
||||
export type GalleryEntryWithoutVariants = {
|
||||
/**
|
||||
* URL to the markdown document of the gallery entry
|
||||
* URL to the entry
|
||||
*/
|
||||
url: string
|
||||
} & MediaEntry
|
||||
} & GalleryEntrySharedProperties
|
||||
|
||||
/**
|
||||
* This describes additional information about a gallery entry which contains variants.
|
||||
* It contains a collection of ids which map to a gallery entry without variants.
|
||||
*/
|
||||
export type GalleryEntryWithVariants = {
|
||||
/**
|
||||
* The id of the entry from the {@link GalleryEntry variants} collection to display when the page first loads.
|
||||
* If this is not defined, the first entry will be chosen instead.
|
||||
*/
|
||||
defaultVariant?: string
|
||||
/**
|
||||
* Variants are a collection of alternate media to display for the entry.
|
||||
* This changes based on the {@link GalleryEntryFormat format} of the entry:
|
||||
* - For music, this is treated like a tracklist for an album,
|
||||
* with the {@link GalleryEntry.defaultVariant default} or selected variant being treated as the current track in the player
|
||||
* - For all other media, this is put into a carousel,
|
||||
* where the {@link GalleryEntry.defaultVariant default} or selected variant is displayed in the main viewer
|
||||
*/
|
||||
variants: Record<string, GalleryEntryWithoutVariants>
|
||||
} & GalleryEntrySharedProperties
|
||||
|
||||
/**
|
||||
* This describes the overall structure of a gallery entry
|
||||
* to display when listing the entry on the gallery-list page.
|
||||
* Note that a {@link GalleryEntryWithVariants} will take priority
|
||||
* over a {@link GalleryEntryWithoutVariants}
|
||||
* if the parsed config results in one with fields from both types.
|
||||
*/
|
||||
export type GalleryEntry =
|
||||
| GalleryEntryWithoutVariants
|
||||
| GalleryEntryWithVariants
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue