import { type CountryFrame, type CountryName, type NamedShape } from "./geometry.ts"; /** * The look of the country names, all optional: the text's font, weight and colour, the outline round it, and the smallest and largest size in pixels. * * @example * ```ts * import type { CountryNamesStyle } from "@johnmorrisdotca/chikyu-earth/realistic"; * * const look: CountryNamesStyle = { font: "Georgia, serif", colour: "#fff3d6", halo: "#1a1000", smallest: 11, largest: 18 }; * console.log(Object.keys(look).join(" ")); * ``` */ export interface CountryNamesStyle { font?: string; weight?: number | string; colour?: string; halo?: string; haloWidth?: number; smallest?: number; largest?: number; } /** The styles of the layer, for an element to add to its own (`#co-names` and the names in its shadow root). */ export declare const COUNTRY_NAMES_STYLE: string; /** What an element tells the layer about the page. */ export interface CountryHostOptions { /** Reads one of the element's attributes. */ attribute(name: string): string | null; /** The page's language, `en` or `ja`. */ language(): "en" | "ja"; /** The shadow root the layer is made in. */ root: ShadowRoot; /** Told when the outlines could not be loaded. */ onError(error: unknown): void; /** Loads the outlines with their names: chizu's `world-geo` by default. */ load?(): Promise<{ features: readonly NamedShape[]; }>; } /** * What the country names did: whether `country-names` is set and the most it asks for, the countries loaded, the names shown at the last draw, how many times the layer was laid out, and * whether the outlines could not be loaded. * * @example * ```ts no-run * import type { CountryNamesStats } from "@johnmorrisdotca/chikyu-earth/realistic"; * * const none: CountryNamesStats = { on: false, max: 0, countries: 0, names: 0, renders: 0, failed: false }; * console.log(none); * ``` */ export interface CountryNamesStats { on: boolean; max: number; countries: number; names: number; renders: number; failed: boolean; } export interface CountryHost { /** Tells where the Earth is in the picture just drawn (or `null` when there is no Earth to name), and the boxes other names use there. */ frame(frame: CountryFrame | null, taken?: readonly { left: number; top: number; width: number; height: number; }[]): void; /** Reads the attribute and the language again after either changed. */ refresh(): void; /** The look of the names (the property `countryNamesStyle`). */ setStyle(style: CountryNamesStyle): void; /** The names shown at the last draw. */ readonly shown: readonly CountryName[]; readonly stats: CountryNamesStats; dispose(): void; } /** * Makes the layer of one element, inside its shadow root. Nothing is loaded, and nothing is added to the root, until `country-names` is there. * * @param options - The attribute reader, the language and the shadow root. * @returns The host. */ export declare function createCountryHost(options: CountryHostOptions): CountryHost;