@superrouteca/smap 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,116 @@
1
+ Copyright (c) 2023, MapLibre contributors
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+ * Neither the name of MapLibre GL JS nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software
15
+ without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+
30
+ -------------------------------------------------------------------------------
31
+
32
+ Contains code from mapbox-gl-js v1.13 and earlier
33
+
34
+ Version v1.13 of mapbox-gl-js and earlier are licensed under a BSD-3-Clause license
35
+
36
+ Copyright (c) 2020, Mapbox
37
+ Redistribution and use in source and binary forms, with or without modification,
38
+ are permitted provided that the following conditions are met:
39
+
40
+ * Redistributions of source code must retain the above copyright notice,
41
+ this list of conditions and the following disclaimer.
42
+ * Redistributions in binary form must reproduce the above copyright notice,
43
+ this list of conditions and the following disclaimer in the documentation
44
+ and/or other materials provided with the distribution.
45
+ * Neither the name of Mapbox GL JS nor the names of its contributors
46
+ may be used to endorse or promote products derived from this software
47
+ without specific prior written permission.
48
+
49
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
53
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
54
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
55
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
56
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
57
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
58
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
59
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
+
61
+
62
+ -------------------------------------------------------------------------------
63
+
64
+ Contains code from glfx.js
65
+
66
+ Copyright (C) 2011 by Evan Wallace
67
+
68
+ Permission is hereby granted, free of charge, to any person obtaining a copy
69
+ of this software and associated documentation files (the "Software"), to deal
70
+ in the Software without restriction, including without limitation the rights
71
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
72
+ copies of the Software, and to permit persons to whom the Software is
73
+ furnished to do so, subject to the following conditions:
74
+
75
+ The above copyright notice and this permission notice shall be included in
76
+ all copies or substantial portions of the Software.
77
+
78
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
79
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
80
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
81
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
82
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
83
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
84
+ THE SOFTWARE.
85
+
86
+ --------------------------------------------------------------------------------
87
+
88
+ Contains a portion of d3-color https://github.com/d3/d3-color
89
+
90
+ Copyright 2010-2016 Mike Bostock
91
+ All rights reserved.
92
+
93
+ Redistribution and use in source and binary forms, with or without modification,
94
+ are permitted provided that the following conditions are met:
95
+
96
+ * Redistributions of source code must retain the above copyright notice, this
97
+ list of conditions and the following disclaimer.
98
+
99
+ * Redistributions in binary form must reproduce the above copyright notice,
100
+ this list of conditions and the following disclaimer in the documentation
101
+ and/or other materials provided with the distribution.
102
+
103
+ * Neither the name of the author nor the names of contributors may be used to
104
+ endorse or promote products derived from this software without specific prior
105
+ written permission.
106
+
107
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
108
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
109
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
110
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
111
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
112
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
113
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
114
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
115
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
116
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "@superrouteca/smap",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "sMap for the web: maps from Superroute's sMap service, the Web SDK (map view) and the JS client (tokens, nearest node, styles, tiles).",
5
+ "license": "MIT",
6
+ "author": "Goodneo Solutions",
7
+ "homepage": "https://github.com/Goodneo-Solutions/smap-sdk/tree/main/js#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Goodneo-Solutions/smap-sdk.git",
11
+ "directory": "js"
12
+ },
13
+ "keywords": [
14
+ "map",
15
+ "maps",
16
+ "vector-tiles",
17
+ "smap",
18
+ "superroute"
19
+ ],
20
+ "sideEffects": [
21
+ "*.css"
22
+ ],
23
+ "main": "./dist/smap.cjs",
24
+ "module": "./dist/smap.mjs",
25
+ "types": "./types/smap.d.cts",
26
+ "exports": {
27
+ ".": {
28
+ "import": {
29
+ "types": "./types/smap.d.mts",
30
+ "default": "./dist/smap.mjs"
31
+ },
32
+ "require": {
33
+ "types": "./types/smap.d.cts",
34
+ "default": "./dist/smap.cjs"
35
+ }
36
+ },
37
+ "./client": {
38
+ "import": {
39
+ "types": "./dist/smap-client.d.mts",
40
+ "default": "./dist/smap-client.mjs"
41
+ },
42
+ "require": {
43
+ "types": "./dist/smap-client.d.cts",
44
+ "default": "./dist/smap-client.cjs"
45
+ }
46
+ },
47
+ "./smap.css": "./dist/smap.css",
48
+ "./package.json": "./package.json"
49
+ },
50
+ "files": [
51
+ "dist",
52
+ "types",
53
+ "README.md",
54
+ "CHANGELOG.md",
55
+ "LICENSE"
56
+ ],
57
+ "engines": {
58
+ "node": ">=18"
59
+ },
60
+ "scripts": {
61
+ "build": "node build.mjs",
62
+ "prepack": "cp ../LICENSE LICENSE",
63
+ "test": "node --test test/*.test.mjs test/*.test.cjs"
64
+ },
65
+ "devDependencies": {
66
+ "esbuild": "0.28.2",
67
+ "maplibre-gl": "6.16.0"
68
+ }
69
+ }
@@ -0,0 +1,185 @@
1
+ // Types of the sMap Web SDK (`@superrouteca/smap`). Kept by hand beside the generated code in dist/; smap.d.mts and
2
+ // smap.d.cts hold the same text (test/types.test.mjs checks).
3
+
4
+ export type StyleFlavor = 'light' | 'white' | 'grayscale' | 'dark' | 'black';
5
+
6
+ /** A position as [longitude, latitude]. */
7
+ export type LngLatLike = [number, number] | { lng: number; lat: number } | { lon: number; lat: number };
8
+
9
+ export type GeoJSONGeometry = { type: string; coordinates?: unknown; geometries?: unknown[] };
10
+ export interface GeoJSONFeature<P = Record<string, unknown>> {
11
+ type: 'Feature';
12
+ id?: string | number;
13
+ properties: P | null;
14
+ geometry: GeoJSONGeometry;
15
+ }
16
+ export interface GeoJSONFeatureCollection<P = Record<string, unknown>> {
17
+ type: 'FeatureCollection';
18
+ features: GeoJSONFeature<P>[];
19
+ }
20
+
21
+ /** A point given as an object: `{lng, lat}` (or `lon` / `longitude` / `latitude`, or `coordinates`) plus properties. */
22
+ export interface PointInput {
23
+ lat?: number;
24
+ lng?: number;
25
+ lon?: number;
26
+ latitude?: number;
27
+ longitude?: number;
28
+ coordinates?: [number, number];
29
+ id?: string | number;
30
+ [property: string]: unknown;
31
+ }
32
+
33
+ /** Layer data: GeoJSON (a FeatureCollection or a Feature) or an array of points or features. */
34
+ export type LayerData = GeoJSONFeatureCollection | GeoJSONFeature | Array<PointInput | GeoJSONFeature> | null | undefined;
35
+
36
+ /** The event of a click on a layer's feature (the engine's map mouse event). */
37
+ export interface LayerClickEvent {
38
+ lngLat: { lng: number; lat: number };
39
+ point: { x: number; y: number };
40
+ features?: GeoJSONFeature[];
41
+ originalEvent?: Event;
42
+ [key: string]: unknown;
43
+ }
44
+
45
+ interface CommonLayerOptions {
46
+ /** Higher draws on top; equal values keep the order added. */
47
+ zIndex?: number;
48
+ minzoom?: number;
49
+ maxzoom?: number;
50
+ /** A feature property used as the feature id. */
51
+ idProperty?: string;
52
+ /**
53
+ * A popup opened on click, from the clicked feature's properties: an HTML string, inserted as it is and never
54
+ * sanitized (so it must be trusted; escape any feature data you put in it), or a DOM node.
55
+ */
56
+ popup?: (properties: Record<string, unknown>, feature: GeoJSONFeature) => string | Node | null | undefined | false;
57
+ onClick?: (feature: GeoJSONFeature, event: LayerClickEvent) => void;
58
+ }
59
+
60
+ export interface PointOptions extends CommonLayerOptions {
61
+ /** Groups nearby points into circles sized by their count; a click zooms in to split them. */
62
+ cluster?: boolean | { radius?: number; maxZoom?: number };
63
+ clusterColor?: string;
64
+ color?: string;
65
+ radius?: number;
66
+ strokeColor?: string;
67
+ strokeWidth?: number;
68
+ /** An image URL drawn instead of a circle. */
69
+ icon?: string;
70
+ iconSize?: number;
71
+ iconAnchor?: string;
72
+ /** The property written under each point. */
73
+ label?: string;
74
+ }
75
+
76
+ export interface LineOptions extends CommonLayerOptions {
77
+ color?: string;
78
+ width?: number;
79
+ /** Dash and gap lengths in line widths, e.g. [2, 2]. */
80
+ dash?: number[];
81
+ opacity?: number;
82
+ }
83
+
84
+ export interface PolygonOptions extends CommonLayerOptions {
85
+ fill?: string;
86
+ color?: string;
87
+ opacity?: number;
88
+ outline?: string;
89
+ outlineWidth?: number;
90
+ /** Draws the areas in 3D: a height and a base in metres, each a number or the name of a property. */
91
+ extrude?: { height?: number | string; base?: number | string };
92
+ }
93
+
94
+ export interface BuildingsOptions {
95
+ color?: string;
96
+ opacity?: number;
97
+ }
98
+
99
+ export interface MapOptions {
100
+ /** The element (or its id) the map is drawn in. */
101
+ container: string | HTMLElement;
102
+ /** A map token; or */
103
+ token?: string;
104
+ /** Called at start and again two minutes before each token expires. */
105
+ getToken?: () => string | Promise<string>;
106
+ /** A map key (`smk_…`) whose allowlist names this site; with a token both are sent and the token is checked first. */
107
+ apiKey?: string;
108
+ /** A colour scheme, or a style URL or object of your own. */
109
+ style?: StyleFlavor | string | Record<string, unknown>;
110
+ /** Label language as a BCP-47 tag (`en`, `fr`, `zh-Hans`, …); the browser language by default. */
111
+ language?: string;
112
+ /** The map service, `https://tile.srsr.ca` by default. */
113
+ baseUrl?: string;
114
+ /** Read from the nearest service node (default true). */
115
+ nearest?: boolean;
116
+ /** Node URLs known in advance, used while `baseUrl` is down. */
117
+ nodes?: string[];
118
+ projection?: 'mercator' | 'globe';
119
+ center?: LngLatLike;
120
+ zoom?: number;
121
+ bearing?: number;
122
+ pitch?: number;
123
+ minZoom?: number;
124
+ maxZoom?: number;
125
+ /** Every other option goes to the rendering engine. */
126
+ [engineOption: string]: unknown;
127
+ }
128
+
129
+ export interface FlyToOptions {
130
+ center?: LngLatLike;
131
+ zoom?: number;
132
+ bearing?: number;
133
+ pitch?: number;
134
+ duration?: number;
135
+ [engineOption: string]: unknown;
136
+ }
137
+
138
+ export interface FitOptions {
139
+ padding?: number | { top?: number; bottom?: number; left?: number; right?: number };
140
+ maxZoom?: number;
141
+ duration?: number;
142
+ [engineOption: string]: unknown;
143
+ }
144
+
145
+ /** A map. Create it in a browser only (the constructor throws elsewhere). */
146
+ export declare class Map {
147
+ constructor(options: MapOptions);
148
+ /** Resolves once the first style has loaded. */
149
+ readonly ready: Promise<Map>;
150
+ /** The rendering engine's map, for anything the SDK does not wrap (set once `ready` resolves). */
151
+ readonly engine: any;
152
+ setStyle(style: StyleFlavor | string | Record<string, unknown>): this;
153
+ setLanguage(language: string): this;
154
+ setProjection(projection: 'mercator' | 'globe'): this;
155
+ setBuildings3D(on: boolean, options?: BuildingsOptions): this;
156
+ addPoints(id: string, data: LayerData, options?: PointOptions): this;
157
+ addLines(id: string, data: LayerData, options?: LineOptions): this;
158
+ addPolygons(id: string, data: LayerData, options?: PolygonOptions): this;
159
+ setData(id: string, data: LayerData): this;
160
+ setVisible(id: string, visible: boolean): this;
161
+ removeLayer(id: string): this;
162
+ /** Layer ids in draw order, bottom first. */
163
+ layers(): string[];
164
+ fitLayer(id: string, options?: FitOptions): this;
165
+ flyTo(options: FlyToOptions): this;
166
+ on(type: string, ...args: any[]): this;
167
+ off(type: string, ...args: any[]): this;
168
+ once(type: string, ...args: any[]): any;
169
+ remove(): void;
170
+ }
171
+
172
+ /** The SDK version. */
173
+ export declare const version: string;
174
+ /** The colour schemes. */
175
+ export declare const styles: StyleFlavor[];
176
+ /** The bundled rendering engine, for anything the SDK does not wrap (loaded on the first call). */
177
+ export declare function getEngine(): any;
178
+
179
+ declare const sMap: {
180
+ Map: typeof Map;
181
+ version: string;
182
+ styles: StyleFlavor[];
183
+ getEngine: typeof getEngine;
184
+ };
185
+ export default sMap;
@@ -0,0 +1,185 @@
1
+ // Types of the sMap Web SDK (`@superrouteca/smap`). Kept by hand beside the generated code in dist/; smap.d.mts and
2
+ // smap.d.cts hold the same text (test/types.test.mjs checks).
3
+
4
+ export type StyleFlavor = 'light' | 'white' | 'grayscale' | 'dark' | 'black';
5
+
6
+ /** A position as [longitude, latitude]. */
7
+ export type LngLatLike = [number, number] | { lng: number; lat: number } | { lon: number; lat: number };
8
+
9
+ export type GeoJSONGeometry = { type: string; coordinates?: unknown; geometries?: unknown[] };
10
+ export interface GeoJSONFeature<P = Record<string, unknown>> {
11
+ type: 'Feature';
12
+ id?: string | number;
13
+ properties: P | null;
14
+ geometry: GeoJSONGeometry;
15
+ }
16
+ export interface GeoJSONFeatureCollection<P = Record<string, unknown>> {
17
+ type: 'FeatureCollection';
18
+ features: GeoJSONFeature<P>[];
19
+ }
20
+
21
+ /** A point given as an object: `{lng, lat}` (or `lon` / `longitude` / `latitude`, or `coordinates`) plus properties. */
22
+ export interface PointInput {
23
+ lat?: number;
24
+ lng?: number;
25
+ lon?: number;
26
+ latitude?: number;
27
+ longitude?: number;
28
+ coordinates?: [number, number];
29
+ id?: string | number;
30
+ [property: string]: unknown;
31
+ }
32
+
33
+ /** Layer data: GeoJSON (a FeatureCollection or a Feature) or an array of points or features. */
34
+ export type LayerData = GeoJSONFeatureCollection | GeoJSONFeature | Array<PointInput | GeoJSONFeature> | null | undefined;
35
+
36
+ /** The event of a click on a layer's feature (the engine's map mouse event). */
37
+ export interface LayerClickEvent {
38
+ lngLat: { lng: number; lat: number };
39
+ point: { x: number; y: number };
40
+ features?: GeoJSONFeature[];
41
+ originalEvent?: Event;
42
+ [key: string]: unknown;
43
+ }
44
+
45
+ interface CommonLayerOptions {
46
+ /** Higher draws on top; equal values keep the order added. */
47
+ zIndex?: number;
48
+ minzoom?: number;
49
+ maxzoom?: number;
50
+ /** A feature property used as the feature id. */
51
+ idProperty?: string;
52
+ /**
53
+ * A popup opened on click, from the clicked feature's properties: an HTML string, inserted as it is and never
54
+ * sanitized (so it must be trusted; escape any feature data you put in it), or a DOM node.
55
+ */
56
+ popup?: (properties: Record<string, unknown>, feature: GeoJSONFeature) => string | Node | null | undefined | false;
57
+ onClick?: (feature: GeoJSONFeature, event: LayerClickEvent) => void;
58
+ }
59
+
60
+ export interface PointOptions extends CommonLayerOptions {
61
+ /** Groups nearby points into circles sized by their count; a click zooms in to split them. */
62
+ cluster?: boolean | { radius?: number; maxZoom?: number };
63
+ clusterColor?: string;
64
+ color?: string;
65
+ radius?: number;
66
+ strokeColor?: string;
67
+ strokeWidth?: number;
68
+ /** An image URL drawn instead of a circle. */
69
+ icon?: string;
70
+ iconSize?: number;
71
+ iconAnchor?: string;
72
+ /** The property written under each point. */
73
+ label?: string;
74
+ }
75
+
76
+ export interface LineOptions extends CommonLayerOptions {
77
+ color?: string;
78
+ width?: number;
79
+ /** Dash and gap lengths in line widths, e.g. [2, 2]. */
80
+ dash?: number[];
81
+ opacity?: number;
82
+ }
83
+
84
+ export interface PolygonOptions extends CommonLayerOptions {
85
+ fill?: string;
86
+ color?: string;
87
+ opacity?: number;
88
+ outline?: string;
89
+ outlineWidth?: number;
90
+ /** Draws the areas in 3D: a height and a base in metres, each a number or the name of a property. */
91
+ extrude?: { height?: number | string; base?: number | string };
92
+ }
93
+
94
+ export interface BuildingsOptions {
95
+ color?: string;
96
+ opacity?: number;
97
+ }
98
+
99
+ export interface MapOptions {
100
+ /** The element (or its id) the map is drawn in. */
101
+ container: string | HTMLElement;
102
+ /** A map token; or */
103
+ token?: string;
104
+ /** Called at start and again two minutes before each token expires. */
105
+ getToken?: () => string | Promise<string>;
106
+ /** A map key (`smk_…`) whose allowlist names this site; with a token both are sent and the token is checked first. */
107
+ apiKey?: string;
108
+ /** A colour scheme, or a style URL or object of your own. */
109
+ style?: StyleFlavor | string | Record<string, unknown>;
110
+ /** Label language as a BCP-47 tag (`en`, `fr`, `zh-Hans`, …); the browser language by default. */
111
+ language?: string;
112
+ /** The map service, `https://tile.srsr.ca` by default. */
113
+ baseUrl?: string;
114
+ /** Read from the nearest service node (default true). */
115
+ nearest?: boolean;
116
+ /** Node URLs known in advance, used while `baseUrl` is down. */
117
+ nodes?: string[];
118
+ projection?: 'mercator' | 'globe';
119
+ center?: LngLatLike;
120
+ zoom?: number;
121
+ bearing?: number;
122
+ pitch?: number;
123
+ minZoom?: number;
124
+ maxZoom?: number;
125
+ /** Every other option goes to the rendering engine. */
126
+ [engineOption: string]: unknown;
127
+ }
128
+
129
+ export interface FlyToOptions {
130
+ center?: LngLatLike;
131
+ zoom?: number;
132
+ bearing?: number;
133
+ pitch?: number;
134
+ duration?: number;
135
+ [engineOption: string]: unknown;
136
+ }
137
+
138
+ export interface FitOptions {
139
+ padding?: number | { top?: number; bottom?: number; left?: number; right?: number };
140
+ maxZoom?: number;
141
+ duration?: number;
142
+ [engineOption: string]: unknown;
143
+ }
144
+
145
+ /** A map. Create it in a browser only (the constructor throws elsewhere). */
146
+ export declare class Map {
147
+ constructor(options: MapOptions);
148
+ /** Resolves once the first style has loaded. */
149
+ readonly ready: Promise<Map>;
150
+ /** The rendering engine's map, for anything the SDK does not wrap (set once `ready` resolves). */
151
+ readonly engine: any;
152
+ setStyle(style: StyleFlavor | string | Record<string, unknown>): this;
153
+ setLanguage(language: string): this;
154
+ setProjection(projection: 'mercator' | 'globe'): this;
155
+ setBuildings3D(on: boolean, options?: BuildingsOptions): this;
156
+ addPoints(id: string, data: LayerData, options?: PointOptions): this;
157
+ addLines(id: string, data: LayerData, options?: LineOptions): this;
158
+ addPolygons(id: string, data: LayerData, options?: PolygonOptions): this;
159
+ setData(id: string, data: LayerData): this;
160
+ setVisible(id: string, visible: boolean): this;
161
+ removeLayer(id: string): this;
162
+ /** Layer ids in draw order, bottom first. */
163
+ layers(): string[];
164
+ fitLayer(id: string, options?: FitOptions): this;
165
+ flyTo(options: FlyToOptions): this;
166
+ on(type: string, ...args: any[]): this;
167
+ off(type: string, ...args: any[]): this;
168
+ once(type: string, ...args: any[]): any;
169
+ remove(): void;
170
+ }
171
+
172
+ /** The SDK version. */
173
+ export declare const version: string;
174
+ /** The colour schemes. */
175
+ export declare const styles: StyleFlavor[];
176
+ /** The bundled rendering engine, for anything the SDK does not wrap (loaded on the first call). */
177
+ export declare function getEngine(): any;
178
+
179
+ declare const sMap: {
180
+ Map: typeof Map;
181
+ version: string;
182
+ styles: StyleFlavor[];
183
+ getEngine: typeof getEngine;
184
+ };
185
+ export default sMap;