/** How a flag is framed: `round` for a circle, `square` as wide as it is tall, `rect` in its own proportions. */ export type FlagShape = "round" | "square" | "rect"; /** What a drawing asks a `flags` renderer for. */ export interface FlagRequest { shape: FlagShape; /** The width in pixels the flag is drawn at, nominally (a drawing scales, so this is the size of a typical use): the diameter of a round flag. */ size: number; /** `light` or `dark` for a drawing in that look, else `inherit`. */ theme: "inherit" | "light" | "dark"; } /** * A function from a country code and a request to an SVG string, or `null` or `undefined` for a code it has no flag for. It must be synchronous: a drawing is a pure function of its * options. `@johnmorrisdotca/hata`'s `flag()` is asynchronous, so load the flags first (`await flag(code, { shape: "round" })` for each code) and pass a lookup. */ export type FlagRenderer = (code: string, request: FlagRequest) => string | null | undefined; /** * Plug a renderer of country flags into kyogijo, for every drawing on the page: after this a team's `flag: "CA"` is drawn. Call it once, at start-up. Without one a team's `flag` is * ignored and its `logo` (or its initials) is drawn. `useFlags(undefined)` unplugs it. * @example * ```ts * import { useFlags } from "@johnmorrisdotca/kyogijo-stadiums"; * const loaded = { round: { CA: "..." } } as Record>; * useFlags((code, { shape }) => loaded[shape]?.[code.toUpperCase()]); * ``` */ export declare function useFlags(render: FlagRenderer | undefined): void; /** Run a drawing with a renderer for that drawing alone (the `flags` option), putting back whatever was there. Without a renderer it runs as it is. */ export declare function withFlags(render: FlagRenderer | undefined, draw: () => T): T; /** The renderer in use: the drawing's own, else the page's, else none. */ export declare function flagRenderer(): FlagRenderer | undefined; /** * The flag of a country code as an SVG document, drawn by the renderer in use, or `undefined`: no renderer, a value that does not look like a code, a code the renderer has no flag for, * a renderer that throws, or one that returns something that is not an ``. It never throws. */ export declare function flagDocument(code: unknown, request: FlagRequest): string | undefined; /** The theme a drawing tells a renderer: `light` or `dark` when the options say so, else `inherit`. */ export declare const flagTheme: (theme: unknown) => FlagRequest["theme"];