import type { Culture } from "@johnmorrisdotca/hoshi-stars/culture"; import { type SkyKeepClear } from "./keep-clear.ts"; import type { SkyFrame } from "./frame.ts"; import type { SkyLabelStyle } from "./style.ts"; /** The styles of the layer, for an element to add to its own (`#sk-canvas`, `#sk-names` and the labels in its shadow root). */ export declare const SKY_STYLE: string; export interface SkyHost { /** Tells where the sky falls in the picture just drawn, or `null` when there is no picture. */ frame(frame: SkyFrame | null): void; /** What the settings are now (`star-names`, `star-names-magnitude`, `constellation-lines`, the language): read again after any of them changed. */ refresh(): void; /** The places where the sky's names must not go (the property `keepClear`): rectangles in the element's pixels, or elements of the page. `null` for none. */ setKeepClear(areas: readonly SkyKeepClear[] | null): void; /** Lays the names out once more on the last frame, where a layer placed before this one has moved between draws (a marker list changed, city names arrived). Nothing happens when there is no frame or no name is asked for. */ relayout(): void; /** The look of the names, as a partial hoshi-stars `LabelStyle` (the property `skyStyle`). */ setStyle(style: Partial): void; /** Picks a constellation by its IAU abbreviation (`Ori`), or lets it go (`null`): the property `constellation`. Sends no event. */ pick(abbreviation: string | null): void; /** The picked constellation's IAU abbreviation, or `null`. */ readonly picked: string | null; readonly stats: { on: boolean; loaded: boolean; names: number; figures: number; picked: string | null; pick: string | null; hover: string | null; constellations: number; culture: string; renders: number; lang: string; stars: { text: string; x: number; y: number; }[]; }; dispose(): void; } export interface SkyHostOptions { /** 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 and its host. */ root: ShadowRoot; /** Told when the layer could not be made (hoshi-stars is not installed, or its font did not load). */ onError(error: unknown): void; /** Loads Michroma for the names, when the page has named no font of its own: kazoku-ui's `loadBodyLabelFont`. */ loadFont(): Promise; /** Brings hoshi-stars' `sky-labels` in: a dynamic import of the package by default, a page's own (or a test's) where it has one. */ importer?: () => Promise; /** Brings hoshi-stars' `constellations` in, for the names of the figures: a dynamic import by default. */ constellations?: () => Promise; /** * The boxes the layers placed before the sky take in the picture just drawn (the places' names and marks, the markers' labels, the bodies' and the cities' names), as left, top, width and height from the picture's top left. No star name, ring or figure name goes over one. * Read when the names are laid out; the element refills the same list, so nothing is made at a draw. */ taken?: () => readonly { left: number; top: number; width: number; height: number; }[]; /** Brings a sky culture of hoshi-stars in (`western`, `japanese` or `chinese`): a dynamic import of the culture by default, a page's own (or a test's) where it has one. */ cultures?: (id: string) => Promise; } /** The attributes this layer reads. */ export declare const SKY_ATTRIBUTES: readonly ["star-names", "star-names-magnitude", "constellation-lines", "constellation-names", "constellation-culture", "keep-clear"]; /** * Makes the layer of one element, inside its shadow root. Nothing of hoshi-stars is loaded, and nothing is added to the root, until one of the three attributes is there. * * @param options - The attribute reader, the language and the shadow root. * @returns The host. */ export declare function createSkyHost(options: SkyHostOptions): SkyHost;