import { Icon } from './icon'; /** * A short summary of one part of a config. * * The part can be a configured instance of a resource, such as one info * tile, or plain config, such as one account in a list. The summary tells * parts of the same kind apart, for example two info tiles that show * different filters. * * Every field is optional. A field that is set replaces what would be shown * otherwise, and a field that is left out keeps it. Text is already * translated. * * @see {@link ConfigDescriber} * @see {@link ConfigMetadata.describeConfig} * * @group Core * @beta */ export type ConfigDescription = { /** * A name for the part, for example the name of an account. */ title?: string; /** * An icon for the part. */ icon?: string | Icon; /** * A few short facts about the part, for example the limetype and the * filter. * * The most useful fact comes first, because there may be room for only the * first few. A fact with no value is left out. */ facts?: ConfigFact[]; /** * A short count or status for the part, for example "4/7" for four * options checked out of seven. * * A badge of `0` counts as no badge. */ badge?: string | number; }; /** * A function that describes one part of a config. * * It must be sync and cheap, because it can run for every part on the * screen. It must not throw. It returns `undefined` when it has nothing to * add. * * @param config - The part of the config to describe. * @returns A description of the part, or `undefined`. * * @see {@link ConfigRepository.registerDescriber} * * @group Core * @beta */ export type ConfigDescriber = (config: T) => ConfigDescription | undefined; /** * One labelled value in a {@link ConfigDescription}. * * @group Core * @beta */ export type ConfigFact = { /** * What the fact is about, for example "Filter". */ label: string; /** * The value, for example the name of the filter. */ text: string; /** * Optional icon to show next to the fact. */ icon?: string | Icon; };