@mappable-world/mappable-types 0.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.
- package/README.md +25 -0
- package/common/index.d.ts +0 -0
- package/common/types/behavior.d.ts +1 -0
- package/common/types/bounds.d.ts +17 -0
- package/common/types/camera.d.ts +8 -0
- package/common/types/coordinates.d.ts +30 -0
- package/common/types/data-source-description.d.ts +127 -0
- package/common/types/easing-function.d.ts +9 -0
- package/common/types/geojson.d.ts +58 -0
- package/common/types/graphics.d.ts +36 -0
- package/common/types/hotspot.d.ts +13 -0
- package/common/types/index.d.ts +20 -0
- package/common/types/indoor.d.ts +29 -0
- package/common/types/layer-description.d.ts +43 -0
- package/common/types/lng-lat.d.ts +14 -0
- package/common/types/map.d.ts +1 -0
- package/common/types/margin.d.ts +8 -0
- package/common/types/projection.d.ts +8 -0
- package/common/types/tile-data-source.d.ts +0 -0
- package/common/types/utils.d.ts +15 -0
- package/common/types/vec2.d.ts +14 -0
- package/common/types/world-options.d.ts +4 -0
- package/common/types/zoom-strategy.d.ts +1 -0
- package/common/types/zoom.d.ts +11 -0
- package/imperative/DomContext.d.ts +35 -0
- package/imperative/Entities.d.ts +120 -0
- package/imperative/MMap/index.d.ts +283 -0
- package/imperative/MMap/projection.d.ts +2 -0
- package/imperative/MMapCollection/index.d.ts +3 -0
- package/imperative/MMapControl/MMapControl.d.ts +45 -0
- package/imperative/MMapControl/MMapControlButton.d.ts +55 -0
- package/imperative/MMapControl/index.d.ts +2 -0
- package/imperative/MMapControls/index.d.ts +43 -0
- package/imperative/MMapCopyrights/index.d.ts +44 -0
- package/imperative/MMapCoverage/index.d.ts +19 -0
- package/imperative/MMapDefaultFeaturesLayer/index.d.ts +41 -0
- package/imperative/MMapDefaultSatelliteLayer/index.d.ts +41 -0
- package/imperative/MMapDefaultSchemeLayer/index.d.ts +92 -0
- package/imperative/MMapEnities.d.ts +18 -0
- package/imperative/MMapFeature/index.d.ts +66 -0
- package/imperative/MMapFeature/types.d.ts +34 -0
- package/imperative/MMapFeatureDataSource/index.d.ts +27 -0
- package/imperative/MMapHotspot/index.d.ts +11 -0
- package/imperative/MMapLayer/index.d.ts +38 -0
- package/imperative/MMapListener/index.d.ts +113 -0
- package/imperative/MMapMarker/index.d.ts +98 -0
- package/imperative/MMapReactContainer/index.d.ts +37 -0
- package/imperative/MMapTileDataSource/index.d.ts +57 -0
- package/imperative/config.d.ts +6 -0
- package/imperative/fetchConfig.d.ts +18 -0
- package/imperative/geolocation.d.ts +10 -0
- package/imperative/index.d.ts +26 -0
- package/imperative/mappableMaps.d.ts +7 -0
- package/imperative/route/driving.d.ts +8 -0
- package/imperative/route/index.d.ts +54 -0
- package/imperative/route/utils.d.ts +21 -0
- package/imperative/search.d.ts +83 -0
- package/imperative/suggest.d.ts +37 -0
- package/imperative/traverse.d.ts +19 -0
- package/imperative/utils/deepFreeze.d.ts +2 -0
- package/imperative/utils/errorLogger.d.ts +29 -0
- package/imperative/utils/id.d.ts +2 -0
- package/imperative/utils/index.d.ts +3 -0
- package/imperative/utils/jsonp.d.ts +9 -0
- package/imperative/utils/metrics.d.ts +16 -0
- package/imperative/utils/pEachChunk.d.ts +2 -0
- package/imperative/utils/projections/index.d.ts +1 -0
- package/imperative/utils/projections/spherical-mercator.d.ts +47 -0
- package/imperative/utils/removeUndefined.d.ts +1 -0
- package/imperative/utils/requestCoverage.d.ts +10 -0
- package/import.d.ts +28 -0
- package/index.d.ts +10 -0
- package/init.template.d.ts +33 -0
- package/main.d.ts +4 -0
- package/modules/controls-extra/MMapOpenMapsButton/index.d.ts +11 -0
- package/modules/controls-extra/index.d.ts +1 -0
- package/modules/editors/MMapFeatureEditor/MMapCustomDomLayer.d.ts +9 -0
- package/modules/editors/MMapFeatureEditor/MMapFeatureEditor.d.ts +55 -0
- package/modules/editors/MMapFeatureEditor/MMapFeatureEditorDefaultPoint.d.ts +9 -0
- package/modules/editors/MMapFeatureEditor/MMapFeatureEditorDefaultPreviewPoint.d.ts +6 -0
- package/modules/editors/MMapFeatureEditor/defaults.d.ts +17 -0
- package/modules/editors/MMapFeatureEditor/index.d.ts +2 -0
- package/modules/editors/MMapFeatureEditor/interface.d.ts +32 -0
- package/modules/editors/MMapFeatureEditor/math.d.ts +6 -0
- package/modules/editors/index.d.ts +1 -0
- package/modules/index.d.ts +0 -0
- package/modules/types.d.ts +7 -0
- package/modules/utils/MMapCursor/index.d.ts +28 -0
- package/modules/utils/index.d.ts +1 -0
- package/package.json +20 -0
- package/packages/cartesian-projection/index.d.ts +49 -0
- package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +108 -0
- package/packages/clusterer/MMapClusterer/constants.d.ts +1 -0
- package/packages/clusterer/MMapClusterer/helpers/throttle.d.ts +17 -0
- package/packages/clusterer/MMapClusterer/index.d.ts +3 -0
- package/packages/clusterer/MMapClusterer/interface.d.ts +31 -0
- package/packages/clusterer/MMapClusterer/methods/clusterByGrid.d.ts +4 -0
- package/packages/clusterer/MMapClusterer/methods/index.d.ts +1 -0
- package/packages/clusterer/MMapClusterer/react/MMapClusterer.d.ts +44 -0
- package/packages/clusterer/index.d.ts +1 -0
- package/packages/clusterer/react/index.d.ts +3 -0
- package/packages/controls/MMapGeolocationControl/MMapControlSpinner/index.d.ts +6 -0
- package/packages/controls/MMapGeolocationControl/index.d.ts +54 -0
- package/packages/controls/MMapZoomControl/index.d.ts +45 -0
- package/packages/controls/index.d.ts +2 -0
- package/packages/controls/react/index.d.ts +3 -0
- package/packages/external.d.ts +2 -0
- package/packages/hint/MMapHint/index.d.ts +57 -0
- package/packages/hint/index.d.ts +1 -0
- package/packages/hint/react/index.d.ts +3 -0
- package/packages/index.d.ts +0 -0
- package/packages/markers/MMapDefaultMarker/index.d.ts +77 -0
- package/packages/markers/MMapDefaultMarker/react/MMapDefaultMarker.d.ts +8 -0
- package/packages/markers/index.d.ts +1 -0
- package/packages/markers/react/index.d.ts +3 -0
- package/packages/spherical-mercator-projection/index.d.ts +38 -0
- package/packages/types.d.ts +11 -0
- package/react/index.d.ts +7 -0
- package/reactify/index.d.ts +10 -0
- package/reactify/overrides/MMap.d.ts +18 -0
- package/reactify/overrides/MMapControl.d.ts +11 -0
- package/reactify/overrides/MMapMarker.d.ts +11 -0
- package/reactify/overrides/MMapReactContainer.d.ts +6 -0
- package/reactify/overrides/index.d.ts +4 -0
- package/reactify/reactify.d.ts +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Types for mappable Maps JS API
|
|
2
|
+
|
|
3
|
+
Type definitions for Mappable Maps JavaScript API (https://mappable.world).
|
|
4
|
+
|
|
5
|
+
> Types are automatically generated based on source files.
|
|
6
|
+
|
|
7
|
+
## Getting started
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i @mappable/mappable-types -D
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
tsconfig.json
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"compilerOptions": {
|
|
18
|
+
"types": ["@mappable/mappable-types"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
And you can use `mappable` global variable in your code.
|
|
24
|
+
|
|
25
|
+
> Don't forget to connect the script with the Maps JS API: https://mappable.world
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type BehaviorType = 'drag' | 'pinchZoom' | 'scrollZoom' | 'dblClick' | 'magnifier' | 'oneFingerZoom' | 'mouseRotate' | 'mouseTilt' | 'pinchRotate' | 'panTilt';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LngLat } from "./lng-lat";
|
|
2
|
+
import type { WorldCoordinates } from "./coordinates";
|
|
3
|
+
/**
|
|
4
|
+
* Generic for rectangle bounded by bottom-left and top-right coordinates
|
|
5
|
+
*/
|
|
6
|
+
export type GenericBounds<T> = [
|
|
7
|
+
T,
|
|
8
|
+
T
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Rectangle bounded by bottom-left and top-right coordinates
|
|
12
|
+
*/
|
|
13
|
+
export type LngLatBounds = GenericBounds<LngLat>;
|
|
14
|
+
/**
|
|
15
|
+
* Rectangle bounded by bottom-left and top-right world coordinates
|
|
16
|
+
*/
|
|
17
|
+
export type WorldBounds = GenericBounds<WorldCoordinates>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Vec2 } from "./vec2";
|
|
2
|
+
/**
|
|
3
|
+
* Coordinates in [-1 ... +1].
|
|
4
|
+
* Left bottom is (-1; -1).
|
|
5
|
+
* Right top is (+1; +1).
|
|
6
|
+
* Center is (0; 0).
|
|
7
|
+
*/
|
|
8
|
+
interface WorldCoordinates extends Vec2 {
|
|
9
|
+
readonly type?: 'world';
|
|
10
|
+
z?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Global pixel coordinates. World size depends on zoom.
|
|
14
|
+
* Left top is (0; 0).
|
|
15
|
+
* Right bottom is (2**(zoom + 8); 2**(zoom + 8)).
|
|
16
|
+
*/
|
|
17
|
+
interface PixelCoordinates extends Vec2 {
|
|
18
|
+
readonly type?: 'pixel';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Coordinate in Tile CS. Tile CS uses tile as unit. GlobalPixelCoordinate / tileSize.
|
|
22
|
+
* Left top is (0, 0).
|
|
23
|
+
* Right bottom is (2**(zoom + 8) / tileSize; 2**(zoom + 8) / tileSize).
|
|
24
|
+
* Left top of any tile is integers withou any fractional part. Aka tile number.
|
|
25
|
+
* Center of any tile is (smth.5, smth.5).
|
|
26
|
+
*/
|
|
27
|
+
interface TileCoordinates extends Vec2 {
|
|
28
|
+
readonly type?: 'tile';
|
|
29
|
+
}
|
|
30
|
+
export { WorldCoordinates, PixelCoordinates, TileCoordinates };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { WorldCoordinates } from "./coordinates";
|
|
2
|
+
import type { GenericGeometry } from "./geojson";
|
|
3
|
+
import type { PixelCoordinates } from "./coordinates";
|
|
4
|
+
import type { HotspotFeature } from "./hotspot";
|
|
5
|
+
type VectorCustomizationStyler = {
|
|
6
|
+
zoom?: number | [
|
|
7
|
+
number,
|
|
8
|
+
number
|
|
9
|
+
];
|
|
10
|
+
visibility?: 'off';
|
|
11
|
+
hue?: string;
|
|
12
|
+
saturation?: number;
|
|
13
|
+
lightness?: number;
|
|
14
|
+
color?: string;
|
|
15
|
+
'secondary-color'?: string;
|
|
16
|
+
'tertiary-color'?: string;
|
|
17
|
+
opacity?: number;
|
|
18
|
+
scale?: number;
|
|
19
|
+
};
|
|
20
|
+
type VectorCustomizationTypes = 'point' | 'polyline' | 'polygon';
|
|
21
|
+
type VectorCustomizationElements = 'geometry' | 'geometry.fill' | 'geometry.fill.pattern' | 'geometry.outline' | 'label' | 'label.icon' | 'label.text' | 'label.text.fill' | 'label.text.outline';
|
|
22
|
+
type VectorCustomization = {
|
|
23
|
+
tags?: {
|
|
24
|
+
all?: string | string[];
|
|
25
|
+
any?: string | string[];
|
|
26
|
+
none?: string | string[];
|
|
27
|
+
} | string;
|
|
28
|
+
types?: VectorCustomizationTypes | VectorCustomizationTypes[];
|
|
29
|
+
elements?: VectorCustomizationElements | VectorCustomizationElements[];
|
|
30
|
+
stylers?: VectorCustomizationStyler | VectorCustomizationStyler[];
|
|
31
|
+
}[];
|
|
32
|
+
interface WorldHotspot {
|
|
33
|
+
readonly type: 'world';
|
|
34
|
+
readonly feature: HotspotFeature<unknown>;
|
|
35
|
+
readonly geometry: GenericGeometry<WorldCoordinates>;
|
|
36
|
+
}
|
|
37
|
+
interface RenderedHotspot {
|
|
38
|
+
readonly type: 'rendered';
|
|
39
|
+
readonly feature: HotspotFeature<unknown>;
|
|
40
|
+
readonly geometry: GenericGeometry<PixelCoordinates>;
|
|
41
|
+
}
|
|
42
|
+
type Hotspot = WorldHotspot | RenderedHotspot;
|
|
43
|
+
interface FetchedTile {
|
|
44
|
+
image: HTMLImageElement | HTMLCanvasElement | ImageBitmap;
|
|
45
|
+
}
|
|
46
|
+
type FetchTileFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => Promise<FetchedTile>;
|
|
47
|
+
type ComposeTileUrlFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Provides hotspots for given tile coordinates and zoom.
|
|
50
|
+
* @param x Tile X
|
|
51
|
+
* @param y Tile Y
|
|
52
|
+
* @param z Tile Z
|
|
53
|
+
* @param signal is used to abort request in case if hotspots for given tile are no longer required
|
|
54
|
+
*/
|
|
55
|
+
type FetchHotspotsFunction = (x: number, y: number, z: number, signal: AbortSignal) => Promise<Hotspot[]>;
|
|
56
|
+
interface RasterTileDataSourceDescription {
|
|
57
|
+
/**
|
|
58
|
+
* Either template tile url:
|
|
59
|
+
* - {{x}} {{y}} {{z}} placeholders for tile coordinates
|
|
60
|
+
* - {{scale}} placeholders for pixel scale (e.g. retina is 2)
|
|
61
|
+
* Or function that returns final url.
|
|
62
|
+
* Or function that fetches tile manually.
|
|
63
|
+
*/
|
|
64
|
+
fetchTile: string | ComposeTileUrlFunction | FetchTileFunction;
|
|
65
|
+
/** Name of data provided by this data source. Should be referenced in layer. */
|
|
66
|
+
type: string;
|
|
67
|
+
/** Tile size in pixels. Default is 256. */
|
|
68
|
+
size?: number;
|
|
69
|
+
transparent?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Returns promise that is going to be resolved by hotspots for tile, or rejected with {name: 'AbortError'}.
|
|
72
|
+
* Hotspots are expected to be sorted from bottom to top (aka far to near).
|
|
73
|
+
*/
|
|
74
|
+
fetchHotspots?: FetchHotspotsFunction;
|
|
75
|
+
/**
|
|
76
|
+
* Defines maximum distance between tile and pointer, till which we keep alive unfinished requests
|
|
77
|
+
* for hotspots for that tile.
|
|
78
|
+
*/
|
|
79
|
+
hotspotAbortRadius?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Defines how far inside into tile hotspots from other tile can go.
|
|
82
|
+
* For example, tile may have a little part of POI from neightbour tile, but no hotspot for it in data.
|
|
83
|
+
*/
|
|
84
|
+
hotspotInset?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Defines how much pixels should be added to hotspot to increase its area.
|
|
87
|
+
* Moves each point of hotspot X pixels away from the center of the hotspots.
|
|
88
|
+
* NOTE: Currently works only on hotspots with Polygon geometry.
|
|
89
|
+
*/
|
|
90
|
+
hotspotPadding?: number;
|
|
91
|
+
}
|
|
92
|
+
interface HotspotsOptions {
|
|
93
|
+
minZoom?: number;
|
|
94
|
+
}
|
|
95
|
+
type MapTheme = 'dark';
|
|
96
|
+
type VectorTileSize = 'X1' | 'X4' | 'X16';
|
|
97
|
+
type VectorDataSourcePriority = 'low' | 'medium' | 'high';
|
|
98
|
+
type VectorObjectsCollisionPriority = 'low' | 'medium' | 'high' | 'ultra';
|
|
99
|
+
interface VectorTileDataSourceDescription {
|
|
100
|
+
tileUrl: string;
|
|
101
|
+
imageUrl?: string;
|
|
102
|
+
meshUrl?: string;
|
|
103
|
+
glyphRangeUrl?: string;
|
|
104
|
+
indoorPlanUrl?: string;
|
|
105
|
+
tileRequestWithCredentials?: boolean;
|
|
106
|
+
imageRequestWithCredentials?: boolean;
|
|
107
|
+
meshRequestWithCredentials?: boolean;
|
|
108
|
+
glyphRequestWithCredentials?: boolean;
|
|
109
|
+
tileRequestHeaders?: Record<string, string>;
|
|
110
|
+
iconRequestHeaders?: Record<string, string>;
|
|
111
|
+
glyphRequestHeaders?: Record<string, string>;
|
|
112
|
+
meshRequestHeaders?: Record<string, string>;
|
|
113
|
+
priority: VectorDataSourcePriority;
|
|
114
|
+
collisionPriority?: VectorObjectsCollisionPriority;
|
|
115
|
+
requestTileSize?: VectorTileSize;
|
|
116
|
+
tileBeltSize?: number;
|
|
117
|
+
lowPrecisionBeltTiles?: boolean;
|
|
118
|
+
tileCacheSize?: number;
|
|
119
|
+
allObjectsInteractive?: boolean;
|
|
120
|
+
/** Forces tiles to wait for the icons, disables hiding icons by zoom diff */
|
|
121
|
+
iconsOnlyTiles?: boolean;
|
|
122
|
+
customization?: VectorCustomization;
|
|
123
|
+
theme?: MapTheme;
|
|
124
|
+
/** Defines how hotspots of type should be treated: enabled/disabled or use custom hotspots instead. */
|
|
125
|
+
hotspots?: Record<string, boolean | FetchHotspotsFunction | HotspotsOptions>;
|
|
126
|
+
}
|
|
127
|
+
export { VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedTile, MapTheme };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Vec2 } from "./vec2";
|
|
2
|
+
type EasingBezierPreset = {
|
|
3
|
+
p1: Vec2;
|
|
4
|
+
p2: Vec2;
|
|
5
|
+
};
|
|
6
|
+
type EasingFunction = (x: number) => number;
|
|
7
|
+
type EasingPresetName = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
8
|
+
type EasingFunctionDescription = EasingPresetName | EasingBezierPreset | EasingFunction;
|
|
9
|
+
export { EasingFunctionDescription, EasingPresetName, EasingBezierPreset, EasingFunction };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { LngLat } from "./lng-lat";
|
|
2
|
+
interface GenericPolygonGeometry<TCoordinates> {
|
|
3
|
+
type: 'Polygon';
|
|
4
|
+
/**
|
|
5
|
+
* Polygon's rings.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Inner rings may extend beyond outer ring.
|
|
9
|
+
* GeoJSON doesn't allow this, but there's a lot of data like this in this JS API.
|
|
10
|
+
*/
|
|
11
|
+
coordinates: TCoordinates[][];
|
|
12
|
+
}
|
|
13
|
+
interface GenericMultiPolygonGeometry<TCoordinates> {
|
|
14
|
+
type: 'MultiPolygon';
|
|
15
|
+
/** Array of polygons. See {@link GenericPolygonGeometry}. */
|
|
16
|
+
coordinates: TCoordinates[][][];
|
|
17
|
+
}
|
|
18
|
+
interface GenericLineStringGeometry<TCoordinates> {
|
|
19
|
+
type: 'LineString';
|
|
20
|
+
coordinates: TCoordinates[];
|
|
21
|
+
}
|
|
22
|
+
interface GenericMultiLineStringGeometry<TCoordinates> {
|
|
23
|
+
type: 'MultiLineString';
|
|
24
|
+
coordinates: TCoordinates[][];
|
|
25
|
+
}
|
|
26
|
+
interface GenericPointGeometry<TCoordinates> {
|
|
27
|
+
type: 'Point';
|
|
28
|
+
coordinates: TCoordinates;
|
|
29
|
+
}
|
|
30
|
+
type GenericGeometry<TCoordinates> = GenericPolygonGeometry<TCoordinates> | GenericMultiPolygonGeometry<TCoordinates> | GenericLineStringGeometry<TCoordinates> | GenericMultiLineStringGeometry<TCoordinates> | GenericPointGeometry<TCoordinates>;
|
|
31
|
+
interface GenericFeature<TCoordinates> {
|
|
32
|
+
type: 'Feature';
|
|
33
|
+
id: string;
|
|
34
|
+
geometry: GenericGeometry<TCoordinates>;
|
|
35
|
+
properties?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
interface GenericPointFeature<TCoordinates> extends GenericFeature<TCoordinates> {
|
|
38
|
+
geometry: GenericPointGeometry<TCoordinates>;
|
|
39
|
+
}
|
|
40
|
+
interface GenericMappableFeatureCollection<TCoordinates> {
|
|
41
|
+
type: 'FeatureCollection';
|
|
42
|
+
/**
|
|
43
|
+
* Could be collection of features or collection of feature collections.
|
|
44
|
+
* This is not defined by GEO JSON spec, but there is such cases in our data.
|
|
45
|
+
*/
|
|
46
|
+
features: (GenericFeature<TCoordinates> | GenericMappableFeatureCollection<TCoordinates>)[];
|
|
47
|
+
properties?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
interface GenericFeatureCollection<TCoordinates> extends GenericMappableFeatureCollection<TCoordinates> {
|
|
50
|
+
id: string;
|
|
51
|
+
features: GenericFeature<TCoordinates>[];
|
|
52
|
+
}
|
|
53
|
+
type LineStringGeometry = GenericLineStringGeometry<LngLat>;
|
|
54
|
+
type MultiLineStringGeometry = GenericMultiLineStringGeometry<LngLat>;
|
|
55
|
+
type MultiPolygonGeometry = GenericMultiPolygonGeometry<LngLat>;
|
|
56
|
+
type PointGeometry = GenericPointGeometry<LngLat>;
|
|
57
|
+
type PolygonGeometry = GenericPolygonGeometry<LngLat>;
|
|
58
|
+
export { GenericPolygonGeometry, GenericMultiPolygonGeometry, GenericLineStringGeometry, GenericMultiLineStringGeometry, GenericPointGeometry, GenericGeometry, GenericFeature, GenericPointFeature, GenericFeatureCollection, GenericMappableFeatureCollection, LineStringGeometry, MultiLineStringGeometry, MultiPolygonGeometry, PointGeometry, PolygonGeometry };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type FillRule = 'evenodd' | 'nonzero';
|
|
2
|
+
interface PaletteEntry {
|
|
3
|
+
count: number;
|
|
4
|
+
color: string;
|
|
5
|
+
}
|
|
6
|
+
type Palette = PaletteEntry[];
|
|
7
|
+
interface StrokeStyle {
|
|
8
|
+
width?: number;
|
|
9
|
+
opacity?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
palette?: Palette;
|
|
12
|
+
simplifyPalette?: boolean;
|
|
13
|
+
dash?: number[];
|
|
14
|
+
}
|
|
15
|
+
type Stroke = StrokeStyle[];
|
|
16
|
+
interface DrawingStyleIcon {
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly offset?: [
|
|
19
|
+
number,
|
|
20
|
+
number
|
|
21
|
+
];
|
|
22
|
+
readonly scale?: number;
|
|
23
|
+
}
|
|
24
|
+
interface DrawingStyle {
|
|
25
|
+
zIndex?: number;
|
|
26
|
+
fill?: string;
|
|
27
|
+
fillOpacity?: number;
|
|
28
|
+
fillRule?: FillRule;
|
|
29
|
+
stroke?: Stroke;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
interactive?: boolean;
|
|
32
|
+
simplificationRate?: number;
|
|
33
|
+
icon?: DrawingStyleIcon;
|
|
34
|
+
element?: HTMLElement;
|
|
35
|
+
}
|
|
36
|
+
export { DrawingStyle, Palette, StrokeStyle, Stroke, DrawingStyleIcon, FillRule };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GenericGeometry } from "./geojson";
|
|
2
|
+
import type { LngLat } from "./lng-lat";
|
|
3
|
+
interface HotspotFeature<TCoordinates> {
|
|
4
|
+
type: 'Feature';
|
|
5
|
+
id: string;
|
|
6
|
+
geometry?: GenericGeometry<TCoordinates>;
|
|
7
|
+
properties: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
interface HotspotObject {
|
|
10
|
+
type: 'hotspot';
|
|
11
|
+
feature: HotspotFeature<LngLat>;
|
|
12
|
+
}
|
|
13
|
+
export { HotspotFeature, HotspotObject };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from "./coordinates";
|
|
2
|
+
export * from "./lng-lat";
|
|
3
|
+
export * from "./bounds";
|
|
4
|
+
export * from "./behavior";
|
|
5
|
+
export * from "./projection";
|
|
6
|
+
export * from "./map";
|
|
7
|
+
export * from "./margin";
|
|
8
|
+
export * from "./zoom";
|
|
9
|
+
export * from "./zoom-strategy";
|
|
10
|
+
export * from "./geojson";
|
|
11
|
+
export * from "./layer-description";
|
|
12
|
+
export * from "./indoor";
|
|
13
|
+
export * from "./vec2";
|
|
14
|
+
export * from "./camera";
|
|
15
|
+
export * from "./easing-function";
|
|
16
|
+
export * from "./graphics";
|
|
17
|
+
export * from "./hotspot";
|
|
18
|
+
export * from "./utils";
|
|
19
|
+
export * from "./world-options";
|
|
20
|
+
export * from "./data-source-description";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface IndoorLevel {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
isUnderground?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface IndoorPlan {
|
|
7
|
+
source: string;
|
|
8
|
+
getId(): string;
|
|
9
|
+
/** Returns bounds of indoor plan in [[lng, lat], [lng, lat]]. */
|
|
10
|
+
getBounds(): [
|
|
11
|
+
[
|
|
12
|
+
number,
|
|
13
|
+
number
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
number,
|
|
17
|
+
number
|
|
18
|
+
]
|
|
19
|
+
];
|
|
20
|
+
isVisible(): boolean;
|
|
21
|
+
setVisible(value: boolean): void;
|
|
22
|
+
getLevels(): IndoorLevel[];
|
|
23
|
+
getDefaultLevel(): IndoorLevel;
|
|
24
|
+
getActiveLevel(): IndoorLevel;
|
|
25
|
+
setActiveLevel(id: string): void;
|
|
26
|
+
getOpacity(): number;
|
|
27
|
+
setOpacity(value: number): void;
|
|
28
|
+
}
|
|
29
|
+
export { IndoorLevel, IndoorPlan };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface VectorObjectsInteractiveArea {
|
|
2
|
+
/** Additional interactive field around the icon, in px. */
|
|
3
|
+
field?: number;
|
|
4
|
+
/** Minimal size of the side of the icons interactive area. */
|
|
5
|
+
minSize?: number;
|
|
6
|
+
}
|
|
7
|
+
type RasterLayerOptions = Record<string, unknown> & {
|
|
8
|
+
opacity?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Show all tiles simultaneously on a first display
|
|
11
|
+
* However if map state changed original logic is applied
|
|
12
|
+
*/
|
|
13
|
+
awaitAllTilesOnFirstDisplay?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Controls animation duration of the revealing newly downloaded tiles
|
|
16
|
+
* Values less than or equal to zero turn off animation
|
|
17
|
+
*/
|
|
18
|
+
tileRevealDuration?: number;
|
|
19
|
+
};
|
|
20
|
+
type VectorLayerOptions = Record<string, unknown> & {
|
|
21
|
+
modelsAppearingAnimation?: {
|
|
22
|
+
transitionZoom: number;
|
|
23
|
+
duration: number;
|
|
24
|
+
limitByZoom: number;
|
|
25
|
+
};
|
|
26
|
+
iconsInteractiveArea?: VectorObjectsInteractiveArea;
|
|
27
|
+
transformLayers?: Record<string, {
|
|
28
|
+
color?: {
|
|
29
|
+
r: number;
|
|
30
|
+
g: number;
|
|
31
|
+
b: number;
|
|
32
|
+
a: number;
|
|
33
|
+
};
|
|
34
|
+
lightness?: number;
|
|
35
|
+
saturation?: number;
|
|
36
|
+
opacity?: number;
|
|
37
|
+
}>;
|
|
38
|
+
parentLayerId?: string;
|
|
39
|
+
opacity?: number;
|
|
40
|
+
/** Isolates colliding of the layer's objects, not colliding them with other layers' objects */
|
|
41
|
+
isolateObjectsColliding?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export { RasterLayerOptions, VectorLayerOptions, VectorObjectsInteractiveArea };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuple with geodesic coordinates in longitude latitude order.
|
|
3
|
+
* GeoJSON also uses this order https://tools.ietf.org/html/rfc7946#appendix-A.1
|
|
4
|
+
*/
|
|
5
|
+
type LngLat = [
|
|
6
|
+
lon: number,
|
|
7
|
+
lat: number,
|
|
8
|
+
alt?: number
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Readonly version of {@link LngLat}
|
|
12
|
+
*/
|
|
13
|
+
type ReadonlyLngLat = Readonly<LngLat>;
|
|
14
|
+
export { LngLat, ReadonlyLngLat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MapMode = 'raster' | 'vector' | 'auto';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LngLat } from "./lng-lat";
|
|
2
|
+
import type { WorldCoordinates } from "./coordinates";
|
|
3
|
+
interface GenericProjection<TSource> {
|
|
4
|
+
toWorldCoordinates(point: TSource): WorldCoordinates;
|
|
5
|
+
fromWorldCoordinates(coordinates: WorldCoordinates): TSource;
|
|
6
|
+
}
|
|
7
|
+
type Projection = GenericProjection<LngLat>;
|
|
8
|
+
export { Projection, GenericProjection };
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type DeepReadonly<T> = T extends (infer R)[] ? DeepReadonlyArray<R> : T extends Function ? T : T extends object ? DeepReadonlyObject<T> : T;
|
|
2
|
+
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {
|
|
3
|
+
}
|
|
4
|
+
type DeepReadonlyObject<T> = {
|
|
5
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
6
|
+
};
|
|
7
|
+
type Nullable<T> = T | null;
|
|
8
|
+
type Change<T> = {
|
|
9
|
+
old: T;
|
|
10
|
+
new: T;
|
|
11
|
+
} | null;
|
|
12
|
+
type Changes<T> = {
|
|
13
|
+
readonly [TKey in keyof T]: Change<T[TKey]>;
|
|
14
|
+
};
|
|
15
|
+
export { DeepReadonly, DeepReadonlyArray, DeepReadonlyObject, Nullable, Change, Changes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ZoomStrategy = 'zoomToCenter' | 'zoomToPointer';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ZoomRange {
|
|
2
|
+
min: number;
|
|
3
|
+
max: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Set rounding for zoom.
|
|
7
|
+
* If `auto` is selected, zoom will be `snap` for `raster` and `smooth` for `vector` `MapMode`.
|
|
8
|
+
* Default is `auto`.
|
|
9
|
+
*/
|
|
10
|
+
type ZoomRounding = 'snap' | 'smooth' | 'auto';
|
|
11
|
+
export { ZoomRange, ZoomRounding };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Context, GenericComplexEntity, GenericEntity } from "./Entities";
|
|
2
|
+
import { MMapEntity, MMapGroupEntity } from "./MMapEnities";
|
|
3
|
+
export type DomDetach = () => void;
|
|
4
|
+
type DomContext = {
|
|
5
|
+
attach(entity: GenericEntity<unknown>, element: Element): DomDetach;
|
|
6
|
+
};
|
|
7
|
+
export declare const DomContext: Context<DomContext>;
|
|
8
|
+
export type DomContextDestroy = () => void;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
* Creates DomContext for specified container for entity.
|
|
12
|
+
* NB: Does not allow to change container element on the fly.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createDomContext(containerEntity: GenericComplexEntity<unknown>, containerElement: Element, containerEndElement?: Element): [
|
|
15
|
+
DomContext,
|
|
16
|
+
DomContextDestroy
|
|
17
|
+
];
|
|
18
|
+
export declare function useDomContext(entity: GenericComplexEntity<unknown>, element: Element, container: Element | null): () => void;
|
|
19
|
+
export declare abstract class DomEntity<TProps, TElement extends Element = HTMLElement, DefaultProps extends {} = {}> extends MMapGroupEntity<TProps, DefaultProps> {
|
|
20
|
+
protected _element?: TElement;
|
|
21
|
+
private _detachDom?;
|
|
22
|
+
private _destroyDomCtx?;
|
|
23
|
+
constructor(props: TProps, children?: MMapEntity<unknown>[]);
|
|
24
|
+
protected _onAttach(): void;
|
|
25
|
+
protected _onDetach(): void;
|
|
26
|
+
protected _onUpdate(props: Partial<TProps>): void;
|
|
27
|
+
protected abstract _createDom(): TElement | {
|
|
28
|
+
element: TElement;
|
|
29
|
+
container: Element;
|
|
30
|
+
containerEndElement?: Element;
|
|
31
|
+
};
|
|
32
|
+
protected abstract _updateDom(element: TElement, props: Partial<TProps>): void;
|
|
33
|
+
protected _destroyDom(_element: TElement): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|