import { LabelLike } from "./labels.mjs"; /** * One row in the sidebar group. */ export interface ColophonItem { /** * Stable key. Identifies the row in React and in the duplicate-key error. */ key: string; /** * Row label. A record is resolved against the admin language. Defaults to `key`. */ label?: LabelLike | undefined; /** * Environment variable names, tried in order. The first one that is set to * a non-empty value wins. */ env?: string[] | undefined; /** * Used when no name in `env` is set. A row that resolves to nothing is dropped. */ fallback?: string | undefined; /** * Computes the value outright, ahead of `env` and `fallback`. * * Runs on every admin render and is not memoized, so it has to be pure and * cheap. Anything that needs real work belongs in `fallback`, computed once * where the Payload config is built. */ value?: (() => string | undefined) | undefined; /** * Last transform before display, e.g. shortening a commit sha. */ format?: ((value: string) => string) | undefined; } /** * A row that resolved to something worth rendering. */ export interface ResolvedColophonItem { key: string; label: LabelLike; /** * What the row shows, after `format`. */ display: string; /** * What `format` was given, kept for the row's tooltip. */ full: string; } /** * The rows a project gets without configuring any. * This is an opinionated set of items, which can be overridden. */ export declare const defaultColophonItems: ColophonItem[]; /** * Validates the configured rows and fills in the label default. * * Runs once, where the plugin is applied, so a mistake surfaces at boot rather * than as a missing row somebody notices weeks later. * * @throws If two rows share a key, which would collide as a React key and * leave one of the two silently unrendered. */ export declare const normalizeItems: (items: ColophonItem[]) => ColophonItem[]; /** * Reported when a row's own functions throw, so one bad row is diagnosable. */ export type ColophonWarn = (message: string, error: unknown) => void; /** * Resolves every row against the current environment. * * Rows that resolve to nothing are dropped rather than rendered as "unknown": * the group is a statement of what this build is, and a row nobody configured * says nothing. * * Each row is resolved in isolation. `value` and `format` are consumer code * running inside the admin's navigation, and one of them throwing must cost * its own row and nothing else. */ export declare const resolveItems: (items: ColophonItem[], warn?: ColophonWarn) => ResolvedColophonItem[];