/** * A tile source describes *where* to fetch raster XYZ tiles and what * attribution text the renderer must display in the chrome canvas. * Implementations are stateless — the tile loader handles caching and * in-flight dedup. */ export interface TileSource { /** * Build the URL for tile (z, x, y). Implementations typically * substitute a template like `{z}/{x}/{y}` and may rotate * subdomains for browsers that throttle concurrent connections * per host. */ urlFor(z: number, x: number, y: number): string; /** * Plain-text attribution shown in the bottom-right of the chrome * canvas. Required by every major tile provider's terms of use — * do not suppress it without provider-side opt-out. */ readonly attribution: string; /** * Side length of one tile in pixels. Tile providers ship 256 by * default; a few offer 512 (`@2x`) variants. Used by the zoom- * level picker to convert meters-per-pixel into a zoom level. */ readonly tileSize: number; /** * Maximum zoom level the provider serves. Tiles requested above * this fall back to the deepest available level with sub-tile * UVs — same trick used during async loads. */ readonly maxZoom: number; /** * Stable identifier for caching. Two `TileSource` instances with * the same `id` share a tile cache; switching source (e.g. theme * change) invalidates and re-fetches. */ readonly id: string; } /** * Subdomain-rotated URL template. Replaces `{s}` with one of the * provided subdomains hashed by `(x + y)`, and `{z}`, `{x}`, `{y}` * with the tile address. Most major tile providers fit this shape. */ export declare class TemplatedTileSource implements TileSource { readonly id: string; private readonly template; readonly attribution: string; readonly tileSize: number; readonly maxZoom: number; private readonly subdomains; constructor(id: string, template: string, attribution: string, tileSize?: number, maxZoom?: number, subdomains?: readonly string[]); urlFor(z: number, x: number, y: number): string; } /** * Identifier of the default tile providers shipped with `viewer-charts`. * Surfaced as the `map_tile_provider` PluginConfig enum so users can * pick light vs. dark vs. labels-only without writing a custom source. */ export type TileProviderId = "carto-positron" | "carto-dark-matter" | "carto-voyager"; /** * Resolve a `TileProviderId` (from PluginConfig) to a concrete * `TileSource`. Unknown ids fall back to Positron so a misconfigured * `_pluginConfig` never produces a blank map. */ export declare function tileSourceFor(id: TileProviderId | string): TileSource;