加载与基础类型 API
JS 0.1.0-alpha.37 · 2026-10-09。来源为当前源码生成的 TypeScript 声明。优先使用 load() 返回的 Namespace;底层类的 Client 参数由绑定构造器注入,业务不需自行创建。private/protected 成员不属于公开接入。
index
export type { SdkLanguage } from './language';
export type { ApiCoordinateSystem } from './coordinate-mode';
import { WalkingNavi } from './walking-navigation';
export { WalkingNavi } from './walking-navigation';
export { WalkingNavigationEngine } from './walking-progress';
export type { WalkingUpdate, WalkingCue } from './walking-progress';
export type { ThemeMode, ResolvedTheme } from './theme';
import { CoordinateConverter } from './coordinates';
export * from './coordinates';
import { GeometryUtil } from './geometry';
export { GeometryUtil } from './geometry';
import { event } from './events';
import { HeatMap } from './heatmap';
import { MarkerCluster } from './clustering';
import { MouseTool, PolylineEditor, PolygonEditor } from './editors';
export { HeatMap } from './heatmap';
export type { HeatMapOptions, HeatMapPoint, HeatMapDataSet } from './heatmap';
export { MarkerCluster } from './clustering';
export type { ClusterPoint, MarkerClusterOptions, ClusterRenderContext } from './clustering';
export { MouseTool, PolylineEditor, PolygonEditor } from './editors';
export type { MoveOptions, MovePath } from './move-animation';
import { setErrorLogger } from './diagnostics';
export { setErrorLogger } from './diagnostics';
export type { SDKErrorLogger, SDKLogRecord } from './diagnostics';
import { TileLayer, MassMarks } from './layers';
export { TileLayer, MassMarks } from './layers';
export type { TileLayerOptions, MassMarksOptions, MassPoint, MassStyle } from './layers';
export { event } from './events';
import { Bootstrap, Config, LngLat, Pixel, Size, Bounds, ServiceCallback } from './core';
import { Map, MapOptions, Marker, Polyline, Polygon, Circle, InfoWindow, Scale, ToolBar } from './map';
import { PlaceSearch, SearchOptions, AutoComplete, AutoCompleteOptions, Driving, DrivingPolicy } from './services';
import { Walking } from './services';
import { SearchBox, LocationPicker, RoutePanel } from './components';
import { Navi } from './navigation';
export { Navi, NavigationEngine } from './navigation';
export type { NavigationRoute, Fix } from './navigation';
export * from './core';
export { Map, Marker, Polyline, Polygon, Circle, InfoWindow, Scale, ToolBar } from './map';
export type { ControlOptions, MapOptions, MapStatus, MarkerOptions, MarkerAnchor, PathOptions, CircleOptions, InfoWindowOptions } from './map';
export type { Poi, SearchOptions, AutoCompleteOptions, SearchResult, Route, RouteStep, DrivingResult, LocationResult, LocationOptions } from './services';
export type { AddressFields } from './location-address';
import { CompatGeolocation } from './compat-geolocation';
export { CompatGeolocation as Geolocation } from './compat-geolocation';
export type { CompatGeolocationOptions as GeolocationOptions } from './compat-geolocation';
export { DrivingPolicy } from './services';
export { SearchBox, LocationPicker, RoutePanel } from './components';
import { apiVersion } from './protocol';
export { apiVersion } from './protocol';
import { DeliveryTrackingMap, DeliveryPlacePicker, DeliveryTrackingOptions, DeliveryPlaceOptions } from './delivery';
export type { DeliveryPoint, DeliveryPosition, DeliverySnapshot, DeliveryPlaceResult, DeliveryTrackingOptions, DeliveryPlaceOptions } from './delivery';
import { Geocoder, GeocoderOptions } from './geocoder';
export type { GeocoderOptions, AddressComponent, Regeocode, RegeocodeResult, RegeocodeFeature, GeocodeResult } from './geocoder';
export { version } from './version';
export interface Namespace {
WalkingNavi: new () => WalkingNavi;
TileLayer: typeof TileLayer;
MassMarks: typeof MassMarks;
setErrorLogger: typeof setErrorLogger;
Walking: new (options?: {
map?: Map;
policy?: 'TIME' | 'DISTANCE';
}) => Walking;
HeatMap: typeof HeatMap;
MarkerCluster: typeof MarkerCluster;
MouseTool: typeof MouseTool;
PolylineEditor: typeof PolylineEditor;
PolygonEditor: typeof PolygonEditor;
GeometryUtil: typeof GeometryUtil;
event: typeof event;
readonly apiVersion: typeof apiVersion;
CoordinateConverter: typeof CoordinateConverter;
DeliveryTrackingMap: new (container: string | HTMLElement, options: DeliveryTrackingOptions) => DeliveryTrackingMap;
DeliveryPlacePicker: new (container: string | HTMLElement, options?: DeliveryPlaceOptions) => DeliveryPlacePicker;
Geocoder: new (options?: GeocoderOptions) => Geocoder;
Pixel: typeof Pixel;
Size: typeof Size;
Bounds: typeof Bounds;
Navi: new () => Navi;
version: string;
DrivingPolicy: typeof DrivingPolicy;
LngLat: typeof LngLat;
Marker: typeof Marker;
Polyline: typeof Polyline;
Polygon: typeof Polygon;
Circle: typeof Circle;
InfoWindow: typeof InfoWindow;
Scale: typeof Scale;
ToolBar: typeof ToolBar;
Geolocation: typeof CompatGeolocation;
Map: new (container: string | HTMLElement, options?: MapOptions) => Map;
PlaceSearch: new (options?: SearchOptions) => PlaceSearch;
AutoComplete: new (options?: AutoCompleteOptions) => AutoComplete;
Driving: new (options?: {
map?: Map;
policy?: 'TIME' | 'DISTANCE';
}) => Driving;
SearchBox: new (container: string | HTMLElement, options?: SearchOptions) => SearchBox;
LocationPicker: typeof LocationPicker;
RoutePanel: new (container: string | HTMLElement, options?: {
map?: Map;
policy?: 'TIME' | 'DISTANCE';
}) => RoutePanel;
plugin(names: string | string[], callback?: () => void): void;
getCapabilities(): Partial<Bootstrap>;
}
export declare function load(config: Config, callback?: ServiceCallback<Namespace>): Promise<Namespace>;
declare const _default: {
load: typeof load;
};
export default _default;
core
import { SdkLanguage } from './language';
import { CoordinateMode, ApiCoordinateSystem } from './coordinate-mode';
export declare class SDKError extends Error {
code: string;
requestId: string;
httpStatus: number;
retryAfterMillis: number | null;
constructor(code: string, message: string, requestId?: string, httpStatus?: number, retryAfterMillis?: number | null);
}
/** HTTP delta-seconds or IMF-fixdate; invalid/missing headers are not a zero delay. */
export declare function parseRetryAfter(value: string | null, now?: number): number | null;
export type LngLatLike = LngLat | [number, number] | {
longitude: number;
latitude: number;
} | {
lng: number;
lat: number;
};
export declare class LngLat {
readonly lng: number;
readonly lat: number;
constructor(lng: number, lat: number);
getLng(): number;
getLat(): number;
toString(): string;
toArray(): [number, number];
equals(other: LngLatLike): boolean;
distance(other: LngLatLike): number;
}
export declare function point(p: LngLatLike): LngLat;
export type Handler = (event: any) => void;
export declare class Evented {
on(type: string, handler: Handler, context?: unknown): this;
once(type: string, handler: Handler, context?: unknown): this;
off(type: string, handler?: Handler, context?: unknown): this;
hasEvents(type: string): boolean;
emit(type: string, data?: object): this;
clearEvents(type?: string): this;
}
export declare class Pixel {
readonly x: number;
readonly y: number;
constructor(x: number, y: number);
getX(): number;
getY(): number;
toString(): string;
equals(other: Pixel): boolean;
}
export declare class Size {
readonly width: number;
readonly height: number;
constructor(width: number, height: number);
getWidth(): number;
getHeight(): number;
toString(): string;
}
export declare class Bounds {
constructor(southwest: LngLatLike, northeast: LngLatLike);
getSouthWest(): LngLat;
getNorthEast(): LngLat;
getNorthWest(): LngLat;
getSouthEast(): LngLat;
getCenter(): LngLat;
contains(value: LngLatLike): boolean;
toString(): string;
}
export interface Config {
language?: SdkLanguage | string;
voiceLanguage?: SdkLanguage | string;
navigationTelemetry?: boolean;
coordinateSystem?: ApiCoordinateSystem;
voiceBaseUrl?: string;
workerUrl?: string;
key: string;
datasetId?: string;
serviceBaseUrl?: string;
version?: string;
plugins?: string[];
modules?: string[];
}
export interface Bootstrap {
apiCoordinateSystem?: ApiCoordinateSystem;
datasetId: string;
datasetVersion: string;
coordinateSystem: string;
capabilities: string[];
attributions: string[];
}
export declare class Client {
readonly language: SdkLanguage;
readonly voiceLanguage: SdkLanguage;
readonly coordinates: CoordinateMode;
readonly base: string;
bootstrap?: Bootstrap;
readonly config: Config & {
datasetId: string;
};
constructor(config: Config);
request<T>(path: string, params?: Record<string, unknown>, body?: unknown, signal?: AbortSignal): Promise<T>;
}
export type Callback<T> = (status: 'complete' | 'error' | 'no_data', result: T | SDKError) => void;
export type ServiceCallback<T> = (...args: [status: 'complete' | 'no_data', result: T] | [status: 'error', result: string]) => void;
export declare function callbackResult<T>(promise: Promise<T>, callback?: Callback<T>): Promise<T>;
/** Reject unsupported options instead of silently suggesting compatibility. */
export declare function validateOptions(value: object, allowed: readonly string[], api: string): void;
protocol
/** Wire contract is independent of package version and map datasetVersion. */
export declare const apiVersion = "v1";
export declare const sdkPlatform = "web";
version
export declare const version = "0.1.0-alpha.37";
theme
export type ThemeMode = 'auto' | 'day' | 'night';
export type ResolvedTheme = 'day' | 'night';
export declare function validateTheme(value: unknown): asserts value is ThemeMode;
/** NOAA solar position in UTC. No geolocation request or remote service. */
export declare function solarElevation(time: number, latitude: number, longitude: number): number;
export declare function resolveTheme(mode: ThemeMode, time: number, latitude: number, longitude: number, previous?: ResolvedTheme): ResolvedTheme;
events
import { Evented, Handler } from './core';
export interface EventHandle {
target: Evented;
type: string;
handler: Handler;
context: unknown;
}
/** Available from the normal SDK entry; no separate migration adapter is required. */
export declare const event: Readonly<{
addListener(target: Evented, type: string, handler: Handler, context?: unknown): EventHandle;
addListenerOnce(target: Evented, type: string, handler: Handler, context?: unknown): EventHandle;
removeListener(handle: EventHandle): void;
clearListeners(target: Evented, type: string): void;
trigger(target: Evented, type: string, data?: object): void;
}>;