import { type CityFrame, type CityNameTier, type NamedCity } from "./geometry.ts"; /** * The look of the city names, all optional: the text's font, size (pixels), weight and colour, the outline round it, and the dot's colour and radius (pixels). * * @example * ```ts * import type { CityNamesStyle } from "@johnmorrisdotca/chikyu-earth/realistic"; * * const look: CityNamesStyle = { font: "Georgia, serif", size: 13, colour: "#ffe9b0", halo: "#201400", dot: "#ffd166", dotSize: 3 }; * console.log(Object.keys(look).join(" ")); * ``` */ export interface CityNamesStyle { font?: string; size?: number; weight?: number | string; colour?: string; halo?: string; haloWidth?: number; dot?: string; dotSize?: number; } /** The styles of the layer, for an element to add to its own (`#cn-canvas`, `#cn-names` and the names in its shadow root). */ export declare const CITY_NAMES_STYLE: string; /** What an element tells the layer about the page. */ export interface CityHostOptions { /** 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 a tier of cities could not be loaded (kuni is not installed, or the file did not arrive). */ onError(error: unknown): void; /** Loads kuni's cities; the page's own copy when it has one (the property is for tests and for pages that bundle their own). */ load?(tier: CityNameTier): Promise; /** Told when the names were laid out again between draws (a tier arrived, the language or a font changed), so names that keep clear of these can be laid out again. */ onLayout?(): void; } export interface CityHost { /** * Tells where the Earth is in the picture just drawn, or `null` when there is no Earth to name. `taken` is the boxes the layers placed before this one (the places', the markers', the bodies' names) take: no name goes over one. * The list is read again whenever the names are laid out between draws, so the element refills the same array. */ frame(frame: CityFrame | 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 `cityNamesStyle`). */ setStyle(style: CityNamesStyle): void; readonly stats: { on: boolean; max: number; radius: number; tiers: CityNameTier[]; cities: number; names: number; renders: number; }; /** The boxes the names and their dots take in the picture just drawn, for other names to keep clear of. */ readonly boxes: { left: number; top: number; width: number; height: number; }[]; dispose(): void; } /** * The attributes the city names read: `city-names`. * * @example * ```ts * import { CITY_NAMES_ATTRIBUTES } from "@johnmorrisdotca/chikyu-earth/realistic"; * * console.log(CITY_NAMES_ATTRIBUTES.join(" ")); * ``` */ export declare const CITY_NAMES_ATTRIBUTES: readonly ["city-names"]; /** * Makes the layer of one element, inside its shadow root. Nothing of kuni is loaded, and nothing is added to the root, until `city-names` is there and the Earth is big enough for a name. * * @param options - The attribute reader, the language and the shadow root. * @returns The host. */ export declare function createCityHost(options: CityHostOptions): CityHost;