import type { OrihonEvent } from "../events.js"; import { LatLng, Point, type LatLngLike, type PointLike } from "../geo.js"; import { Layer, type LayerOptions } from "../layer.js"; import type { Orihon } from "../map.js"; import { type LocaleInput } from "../ui/locale.js"; export interface OverlayContentContext { overlay: DivOverlay; map: Orihon | null; latlng: LatLng | null; source?: unknown; event?: OrihonEvent; data?: unknown; } export interface OverlayMountable { mount(container: HTMLElement, context: OverlayContentContext): void | (() => void) | { destroy(): void; } | Promise void) | { destroy(): void; }>; unmount?(container: HTMLElement, context: OverlayContentContext): void; } export type OverlayRenderable = string | number | Node | OverlayMountable | null | undefined; export type OverlayContentFactory = (context: OverlayContentContext) => OverlayRenderable | Promise; export type OverlayContent = OverlayRenderable | OverlayContentFactory; export interface DivOverlayOptions extends LayerOptions { className?: string; offset?: PointLike; } interface ResolvedDivOverlayOptions extends LayerOptions { pane: string; className: string; offset: Point; } export interface DivOverlayEventMap { contenterror: { error: unknown; }; } export interface OverlayLifecycleEventMap { open: { map: Orihon; }; close: { map: Orihon | null; }; } /** * Base for Popup and Tooltip. It extends `Layer`, not `InteractiveLayer`: `InteractiveLayer` * builds overlays through this module, so inheriting from it would make the two modules * mutually dependent at class-definition time. Binding an overlay to an overlay has no use * anyway — an overlay is already anchored by whatever opened it. */ export declare class DivOverlay extends Layer { #private; container: HTMLDivElement | null; contentNode: HTMLDivElement | null; protected content: OverlayContent; protected readonly _unsub: Array<() => void>; protected position: LatLng | null; protected contentContext: Pick; private _contentCleanup; private _contentGeneration; constructor(content: OverlayContent, options?: DivOverlayOptions); setLatLng(value: LatLngLike): this; getLatLng(): LatLng | null; setContent(content: OverlayContent): this; getContent(): OverlayContent; setContentContext(context: Pick): this; openOn(map: Orihon): this; close(): this; isOpen(): boolean; bringToFront(): this; onAdd(map: Orihon): void; onRemove(): void; render(): void; protected _renderContent(): void; /** Called after synchronous or asynchronous content has completed mounting. */ protected _contentDidRender(): void; } export interface PopupOptions extends DivOverlayOptions { closeButton?: boolean; autoClose?: boolean; closeOnClick?: boolean; autoPan?: boolean; autoPanPadding?: PointLike; keepInView?: boolean; ariaLabel?: string; locale?: LocaleInput; } interface ResolvedPopupOptions extends ResolvedDivOverlayOptions { closeButton: boolean; autoClose: boolean; closeOnClick: boolean; autoPan: boolean; autoPanPadding: Point; keepInView: boolean; ariaLabel: string; locale?: LocaleInput; } export declare class Popup extends DivOverlay { #private; private _mapClick; private _closeOnClickTimer; private _autoPanFrame; constructor(content: OverlayContent, options?: PopupOptions); onAdd(map: Orihon): void; onRemove(): void; setContent(content: OverlayContent): this; setLatLng(value: LatLngLike): this; protected _contentDidRender(): void; } export interface TooltipOptions extends DivOverlayOptions { permanent?: boolean; direction?: "top" | "right" | "bottom" | "left" | "center"; opacity?: number; } interface ResolvedTooltipOptions extends ResolvedDivOverlayOptions { permanent: boolean; direction: "top" | "right" | "bottom" | "left" | "center"; opacity: number; } export declare class Tooltip extends DivOverlay { constructor(content: OverlayContent, options?: TooltipOptions); onAdd(map: Orihon): void; onRemove(): void; } export declare function popup(content: OverlayContent, options?: PopupOptions): Popup; export declare function tooltip(content: OverlayContent, options?: TooltipOptions): Tooltip; export {}; //# sourceMappingURL=div-overlay.d.ts.map