import { Subset } from '../../../types/subset'; import { StorytellerListViewCellType } from '../../row/models/storytellerListViewCellType'; import { IUiTheme, UiTheme } from './theme/uiTheme'; import { UiStyle } from './uiStyle'; interface StorytellerPlayerConfiguration { basename?: string; theme: Subset | IUiTheme; uiStyle: UiStyle; } interface StorytellerListConfiguration extends StorytellerPlayerConfiguration { displayLimit?: number; } /** * Stories Grid (with categories) */ interface StorytellerStoriesListConfiguration extends StorytellerListConfiguration { categories: string[]; preload?: boolean; } /** * Stories Row (with categories + cellType) */ interface StorytellerStoriesRowViewListConfiguration extends StorytellerStoriesListConfiguration { cellType: StorytellerListViewCellType; } /** * Clips (with collection) */ interface StorytellerClipsListConfiguration extends StorytellerListConfiguration { collection: string; } interface StorytellerClipsPlayerConfiguration extends StorytellerPlayerConfiguration { collection: string; } type ListTypeToConfigMap = { StorytellerStoriesRowView: StorytellerStoriesRowViewListConfiguration; StorytellerStoriesGridView: StorytellerStoriesListConfiguration; StorytellerClipsRowView: StorytellerClipsListConfiguration; StorytellerClipsGridView: StorytellerClipsListConfiguration; StorytellerClipsPlayerView: StorytellerClipsPlayerConfiguration; }; export type ListConfiguration = ListType extends keyof ListTypeToConfigMap ? ListTypeToConfigMap[ListType] : StorytellerListConfiguration; /** * Helper type to enforce that if the user specifies a `theme`, * it should be Subset and not IUiTheme */ type UserListConfiguration = { [K in keyof T]?: K extends 'theme' ? Subset : T[K]; }; export type IListConfiguration = ListType extends keyof ListTypeToConfigMap ? UserListConfiguration : UserListConfiguration; export {};