@mappable-world/mappable-types 0.0.14 → 0.0.16
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/common/types/data-source-description.d.ts +12 -3
- package/common/types/index.d.ts +1 -0
- package/common/types/tilt-range.d.ts +8 -0
- package/imperative/Entities.d.ts +12 -0
- package/imperative/MMap/index.d.ts +14 -3
- package/imperative/MMapControl/MMapControl.d.ts +20 -6
- package/imperative/MMapControls/index.d.ts +13 -2
- package/imperative/MMapCopyrights/index.d.ts +8 -1
- package/imperative/MMapCoverage/index.d.ts +1 -1
- package/imperative/MMapDefaultFeaturesLayer/index.d.ts +2 -0
- package/imperative/MMapDefaultSchemeLayer/index.d.ts +22 -11
- package/imperative/MMapFeature/index.d.ts +3 -1
- package/{modules/controls-extra → imperative}/MMapScaleControl/index.d.ts +4 -4
- package/imperative/MMapTileDataSource/index.d.ts +4 -1
- package/imperative/index.d.ts +2 -1
- package/imperative/route/index.d.ts +2 -2
- package/import.d.ts +7 -0
- package/modules/analytics/index.d.ts +4 -0
- package/modules/analytics/src/DataProviders/BaseDataProvider.d.ts +40 -0
- package/modules/analytics/src/DataProviders/JSONDataProvider.d.ts +27 -0
- package/modules/analytics/src/DataProviders/JSONLinesDataProvider.d.ts +41 -0
- package/modules/analytics/src/DataProviders/StaticDataProvider.d.ts +18 -0
- package/modules/analytics/src/DataProviders/index.d.ts +4 -0
- package/modules/analytics/src/DataProviders/utils/loadByChunk.d.ts +1 -0
- package/modules/analytics/src/MMapDataAnalyticsLayer/MMapDataAnalyticsLayer.d.ts +90 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/MMapDefaultVectorLayerImplementation.d.ts +95 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/atlas.d.ts +27 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/calculateNormalsForVertices.d.ts +5 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/frameBuffer.d.ts +29 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/memoryManager.d.ts +49 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/program.d.ts +10 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/scheduleManager.d.ts +44 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/utils.d.ts +35 -0
- package/modules/analytics/src/MMapGeoJsonLayer/MMapGeoJsonImplementation.d.ts +3 -0
- package/modules/analytics/src/MMapGeoJsonLayer/MMapGeoJsonLayer.d.ts +64 -0
- package/modules/analytics/src/MMapGeoJsonLayer/renders/geojson.d.ts +3 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/constants.d.ts +17 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generateGeometryBuffers.d.ts +17 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generateLineGeometry.d.ts +6 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generatePointGeometry.d.ts +4 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generatePolygonGeometry.d.ts +2 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/utils.d.ts +37 -0
- package/modules/analytics/src/MMapHeatmapLayer/MMapHeatmapLayer.d.ts +38 -0
- package/modules/analytics/src/MMapHeatmapLayer/MMapHeatmapLayerImplementation.d.ts +3 -0
- package/modules/analytics/src/MMapHeatmapLayer/renders/gradient.d.ts +3 -0
- package/modules/analytics/src/MMapHeatmapLayer/renders/heatmap.d.ts +3 -0
- package/modules/analytics/src/interface.d.ts +42 -0
- package/modules/analytics/src/types.d.ts +8 -0
- package/modules/types.d.ts +1 -0
- package/package.json +1 -1
- package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +4 -3
- package/packages/controls/MMapZoomControl/index.d.ts +5 -17
- /package/{modules/controls-extra → imperative}/MMapScaleControl/distance-utils.d.ts +0 -0
|
@@ -41,10 +41,17 @@ interface RenderedHotspot {
|
|
|
41
41
|
readonly geometry: GenericGeometry<PixelCoordinates>;
|
|
42
42
|
}
|
|
43
43
|
type Hotspot = WorldHotspot | RenderedHotspot;
|
|
44
|
-
interface
|
|
44
|
+
interface FetchedCommonTile {
|
|
45
|
+
destroy?(): void;
|
|
46
|
+
}
|
|
47
|
+
interface FetchedRasterTile extends FetchedCommonTile {
|
|
45
48
|
image: HTMLImageElement | HTMLCanvasElement | ImageBitmap;
|
|
46
49
|
}
|
|
47
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use FetchedRasterTile instead
|
|
52
|
+
*/
|
|
53
|
+
type FetchedTile = FetchedRasterTile;
|
|
54
|
+
type FetchTileFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => Promise<FetchedCommonTile | FetchedRasterTile>;
|
|
48
55
|
type ComposeTileUrlFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => string;
|
|
49
56
|
/**
|
|
50
57
|
* Provides hotspots for given tile coordinates and zoom.
|
|
@@ -127,12 +134,14 @@ interface VectorTileDataSourceDescription {
|
|
|
127
134
|
tileCacheSize?: number;
|
|
128
135
|
richModelCacheSize?: number;
|
|
129
136
|
richModelEnabled?: boolean;
|
|
137
|
+
richPointEnabled?: boolean;
|
|
130
138
|
allObjectsInteractive?: boolean;
|
|
131
139
|
/** Forces tiles to wait for the icons, disables hiding icons by zoom diff */
|
|
132
140
|
iconsOnlyTiles?: boolean;
|
|
141
|
+
richModelDecoderWorkerUrl?: string;
|
|
133
142
|
customization?: VectorCustomization;
|
|
134
143
|
theme?: MapTheme;
|
|
135
144
|
/** Defines how hotspots of type should be treated: enabled/disabled or use custom hotspots instead. */
|
|
136
145
|
hotspots?: Record<string, boolean | FetchHotspotsFunction | HotspotsOptions>;
|
|
137
146
|
}
|
|
138
|
-
export { VectorCustomizationTypes, VectorCustomizationElements, VectorCustomizationItem, VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedTile, MapTheme };
|
|
147
|
+
export { VectorCustomizationTypes, VectorCustomizationElements, VectorCustomizationItem, VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedRasterTile, FetchedTile, FetchedCommonTile, MapTheme };
|
package/common/types/index.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TiltRange {
|
|
2
|
+
/** Minimum tilt in radians. */
|
|
3
|
+
readonly min: number;
|
|
4
|
+
/** Maximum tilt in radians. */
|
|
5
|
+
readonly max: number;
|
|
6
|
+
/** Behavior tilt expansion in radians. E.g. you can tilt map with fingers a little bit more than `max`. */
|
|
7
|
+
readonly expansion: number;
|
|
8
|
+
}
|
package/imperative/Entities.d.ts
CHANGED
|
@@ -91,6 +91,18 @@ declare abstract class GenericEntity<Props, DefaultProps extends {} = {}, Root e
|
|
|
91
91
|
* @returns Context value.
|
|
92
92
|
*/
|
|
93
93
|
protected _consumeContext<T>(consumer: Context<T>): T | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Subscribes to changes in a context
|
|
96
|
+
* @param context - The context that provides access to the context value.
|
|
97
|
+
* @param watcher - Callback function that is called when the context value is changed.
|
|
98
|
+
* @param params - Params for watcher.
|
|
99
|
+
* @param params.immediate - Calls watcher immediately. For most handlers it allows to inline watcher function.
|
|
100
|
+
* @returns Function to unsubscribe from changes context.
|
|
101
|
+
* For most handlers it can be, because it is called automatically on detach.
|
|
102
|
+
*/
|
|
103
|
+
protected _watchContext<T>(context: Context<T>, watcher: ContextWatcherFn, params?: {
|
|
104
|
+
immediate: boolean;
|
|
105
|
+
}): () => void;
|
|
94
106
|
}
|
|
95
107
|
interface ComplexOptions<Root extends GenericRootEntity<unknown> = GenericRootEntity<unknown>> {
|
|
96
108
|
children?: GenericEntity<unknown, {}, Root>[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BehaviorType, LngLat, MapMode, Margin, PixelCoordinates, Projection, ReadonlyLngLat, LngLatBounds, ZoomRange, ZoomRounding, WorldOptions, ZoomStrategy, EasingFunctionDescription } from "../../common/types";
|
|
1
|
+
import type { BehaviorType, LngLat, MapMode, Margin, PixelCoordinates, Projection, ReadonlyLngLat, LngLatBounds, ZoomRange, ZoomRounding, WorldOptions, ZoomStrategy, EasingFunctionDescription, TiltRange } from "../../common/types";
|
|
2
2
|
import type { MMapEntity } from "../MMapEnities";
|
|
3
3
|
import { GenericRootEntity } from "../Entities";
|
|
4
4
|
import { MMapCopyrightsPosition } from "../MMapCopyrights";
|
|
@@ -35,9 +35,9 @@ export type MMapLocation = MMapCenterZoomLocation & Partial<MMapBoundsLocation>;
|
|
|
35
35
|
* Observer camera position
|
|
36
36
|
*/
|
|
37
37
|
export type MMapCamera = {
|
|
38
|
-
/** Map tilt in radians. Can take values from 0 to
|
|
38
|
+
/** Map tilt in radians. Can take values from 0 to 50 degrees (degrees * (Math.PI / 180)) */
|
|
39
39
|
tilt?: number;
|
|
40
|
-
/** Map rotation in
|
|
40
|
+
/** Map rotation in radians. Can take values from -Math.PI to Math.PI */
|
|
41
41
|
azimuth?: number;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
@@ -85,6 +85,8 @@ export type MMapProps = {
|
|
|
85
85
|
hotspotsStrategy?: "forViewport" | "forPointerPosition";
|
|
86
86
|
/** Position of copyright on the page. Default is 'bottom right' */
|
|
87
87
|
copyrightsPosition?: MMapCopyrightsPosition;
|
|
88
|
+
/** Show the map scale next to copyright */
|
|
89
|
+
showScaleInCopyrights?: boolean;
|
|
88
90
|
/**
|
|
89
91
|
* Projection used in map
|
|
90
92
|
*/
|
|
@@ -111,6 +113,7 @@ declare const defaultProps: Readonly<{
|
|
|
111
113
|
margin: Margin | undefined;
|
|
112
114
|
copyrights: true;
|
|
113
115
|
copyrightsPosition: "bottom right";
|
|
116
|
+
showScaleInCopyrights: false;
|
|
114
117
|
worldOptions: {
|
|
115
118
|
cycledX: boolean;
|
|
116
119
|
cycledY: boolean;
|
|
@@ -157,6 +160,7 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
|
|
|
157
160
|
margin: Margin | undefined;
|
|
158
161
|
copyrights: true;
|
|
159
162
|
copyrightsPosition: "bottom right";
|
|
163
|
+
showScaleInCopyrights: false;
|
|
160
164
|
worldOptions: {
|
|
161
165
|
cycledX: boolean;
|
|
162
166
|
cycledY: boolean;
|
|
@@ -181,6 +185,7 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
|
|
|
181
185
|
hotspotsStrategy?: "forViewport" | "forPointerPosition" | undefined;
|
|
182
186
|
copyrights?: boolean | undefined;
|
|
183
187
|
copyrightsPosition?: MMapCopyrightsPosition | undefined;
|
|
188
|
+
showScaleInCopyrights?: boolean | undefined;
|
|
184
189
|
projection?: Projection | undefined;
|
|
185
190
|
worldOptions?: WorldOptions | undefined;
|
|
186
191
|
theme?: MMapTheme | undefined;
|
|
@@ -228,6 +233,7 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
|
|
|
228
233
|
* getter for {@link MMapProps}.zoomRange prop
|
|
229
234
|
*/
|
|
230
235
|
get zoomRange(): Readonly<ZoomRange>;
|
|
236
|
+
get tiltRange(): Readonly<TiltRange>;
|
|
231
237
|
/**
|
|
232
238
|
* getter for {@link MMapProps}.projection prop
|
|
233
239
|
*/
|
|
@@ -257,6 +263,11 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
|
|
|
257
263
|
* @param location
|
|
258
264
|
*/
|
|
259
265
|
setLocation(location: MMapLocationRequest): void;
|
|
266
|
+
/**
|
|
267
|
+
* setter for {@link MMapProps}.camera prop
|
|
268
|
+
* @param camera
|
|
269
|
+
*/
|
|
270
|
+
setCamera(camera: MMapCameraRequest): void;
|
|
260
271
|
private __setLocation;
|
|
261
272
|
/**
|
|
262
273
|
* setter for {@link MMapProps}.mode prop
|
|
@@ -3,7 +3,14 @@ import { MMapGroupEntity } from "../MMapEnities";
|
|
|
3
3
|
/**
|
|
4
4
|
* MMapControl props
|
|
5
5
|
*/
|
|
6
|
-
export type MMapControlProps = {
|
|
6
|
+
export type MMapControlProps = {
|
|
7
|
+
/** Makes the control transparent by removing background color and shadows */
|
|
8
|
+
transparent?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const defaultProps: Readonly<{
|
|
11
|
+
transparent: false;
|
|
12
|
+
}>;
|
|
13
|
+
type DefaultProps = typeof defaultProps;
|
|
7
14
|
/**
|
|
8
15
|
* DOM wrapper for creating custom controls. Connects the styles required by the control.
|
|
9
16
|
*
|
|
@@ -30,20 +37,27 @@ export type MMapControlProps = {};
|
|
|
30
37
|
*
|
|
31
38
|
* @module MMapControl
|
|
32
39
|
*/
|
|
33
|
-
export declare class MMapControl
|
|
34
|
-
static
|
|
40
|
+
export declare class MMapControl extends MMapGroupEntity<MMapControlProps, DefaultProps> {
|
|
41
|
+
static defaultProps: Readonly<{
|
|
42
|
+
transparent: false;
|
|
43
|
+
}>;
|
|
44
|
+
static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapControl, import("react").ForwardRefExoticComponent<{
|
|
45
|
+
transparent?: boolean | undefined;
|
|
35
46
|
children?: import("react").ReactNode;
|
|
36
|
-
ref?: import("react").Ref<import("../Entities").GenericEntity<{
|
|
47
|
+
ref?: import("react").Ref<import("../Entities").GenericEntity<MMapControlProps & {
|
|
37
48
|
controlElement: HTMLElement;
|
|
38
49
|
}, {}, import("../Entities").GenericRootEntity<unknown, {}>>> | undefined;
|
|
39
50
|
key?: import("react").Key | null | undefined;
|
|
40
51
|
}>>;
|
|
41
|
-
private _detachDom?;
|
|
42
52
|
private _element?;
|
|
53
|
+
private _detachDom?;
|
|
43
54
|
private _unwatchThemeContext?;
|
|
44
|
-
constructor();
|
|
55
|
+
constructor(props?: MMapControlProps);
|
|
45
56
|
protected _createDom(): HTMLElement;
|
|
46
57
|
protected _onAttach(): void;
|
|
58
|
+
protected _onUpdate(props: Partial<MMapControlProps>): void;
|
|
59
|
+
private __watchThemeContext;
|
|
47
60
|
protected _onDetach(): void;
|
|
48
61
|
private _updateTheme;
|
|
49
62
|
}
|
|
63
|
+
export {};
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
import { Context } from "../Entities";
|
|
1
2
|
import { MMapEntity, MMapGroupEntity } from "../MMapEnities";
|
|
2
|
-
type
|
|
3
|
+
type VerticalPosition = "top" | "bottom";
|
|
4
|
+
type ComputedVerticalPosition = "top" | "center" | "bottom";
|
|
3
5
|
type HorizontalPosition = "left" | "right";
|
|
6
|
+
type ComputedHorizontalPosition = "left" | "center" | "right";
|
|
4
7
|
type Orientation = "horizontal" | "vertical";
|
|
8
|
+
export type MMapControlContext = {
|
|
9
|
+
position: [
|
|
10
|
+
ComputedVerticalPosition,
|
|
11
|
+
ComputedHorizontalPosition,
|
|
12
|
+
Orientation
|
|
13
|
+
];
|
|
14
|
+
};
|
|
15
|
+
export declare const ControlContext: Context<MMapControlContext>;
|
|
5
16
|
/**
|
|
6
17
|
* Describes controls position.
|
|
7
18
|
*/
|
|
8
|
-
type Position =
|
|
19
|
+
type Position = VerticalPosition | HorizontalPosition | `${VerticalPosition} ${HorizontalPosition}` | `${HorizontalPosition} ${VerticalPosition}`;
|
|
9
20
|
/**
|
|
10
21
|
* MMapControls props
|
|
11
22
|
*/
|
|
@@ -3,9 +3,12 @@ type MMapCopyrightsPosition = "top left" | "top right" | "bottom left" | "bottom
|
|
|
3
3
|
type MMapCopyrightsProps = {
|
|
4
4
|
/** Position of copyright on the map */
|
|
5
5
|
position?: MMapCopyrightsPosition;
|
|
6
|
+
/** Show the map scale next to the map */
|
|
7
|
+
showScale?: boolean;
|
|
6
8
|
};
|
|
7
9
|
declare const defaultProps: Readonly<{
|
|
8
10
|
position: MMapCopyrightsPosition;
|
|
11
|
+
showScale: false;
|
|
9
12
|
}>;
|
|
10
13
|
type DefaultProps = typeof defaultProps;
|
|
11
14
|
/**
|
|
@@ -15,12 +18,15 @@ type DefaultProps = typeof defaultProps;
|
|
|
15
18
|
declare class MMapCopyrights extends MMapGroupEntity<MMapCopyrightsProps, DefaultProps> {
|
|
16
19
|
static defaultProps: Readonly<{
|
|
17
20
|
position: MMapCopyrightsPosition;
|
|
21
|
+
showScale: false;
|
|
18
22
|
}>;
|
|
19
23
|
private _boxElement;
|
|
20
24
|
private _copyrightsTextElement;
|
|
21
25
|
private _linkElement;
|
|
22
26
|
private _logoElement;
|
|
23
27
|
private _copyrightsContainer;
|
|
28
|
+
private _scaleElement;
|
|
29
|
+
private _scaleControl;
|
|
24
30
|
private _mapWidth;
|
|
25
31
|
private _copyrights;
|
|
26
32
|
private _fixedCopyrights;
|
|
@@ -30,8 +36,8 @@ declare class MMapCopyrights extends MMapGroupEntity<MMapCopyrightsProps, Defaul
|
|
|
30
36
|
private _unwatchThemeContext?;
|
|
31
37
|
private _detachDom?;
|
|
32
38
|
constructor(props?: MMapCopyrightsProps);
|
|
33
|
-
protected _updateDom(): void;
|
|
34
39
|
protected _onAttach(): void;
|
|
40
|
+
protected _onUpdate(props: Partial<MMapCopyrightsProps>): void;
|
|
35
41
|
protected _onDetach(): void;
|
|
36
42
|
private _createDom;
|
|
37
43
|
private _syncDom;
|
|
@@ -43,5 +49,6 @@ declare class MMapCopyrights extends MMapGroupEntity<MMapCopyrightsProps, Defaul
|
|
|
43
49
|
private _setFixedCopyrights;
|
|
44
50
|
private _copyrightsChangeHandler;
|
|
45
51
|
private _adjustText;
|
|
52
|
+
private _toggleScaleControl;
|
|
46
53
|
}
|
|
47
54
|
export { MMapCopyrights, MMapCopyrightsPosition, MMapCopyrightsProps };
|
|
@@ -2,7 +2,7 @@ import { MMapComplexEntity } from "../MMapEnities";
|
|
|
2
2
|
interface MMapCoverageProps {
|
|
3
3
|
onError?: (e: Error) => void;
|
|
4
4
|
}
|
|
5
|
-
export declare const COVERAGE_LAYERS_TO_SOURCES:
|
|
5
|
+
export declare const COVERAGE_LAYERS_TO_SOURCES: Map<string, string>;
|
|
6
6
|
/**
|
|
7
7
|
* The component of loading data on copyrights on the map and the zoom range for
|
|
8
8
|
* the area where the center of the map is located
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { VectorCustomization } from "../../common/types";
|
|
2
|
+
import { MMapLayerProps } from "../MMapLayer";
|
|
2
3
|
import { MMapComplexEntity } from "../MMapEnities";
|
|
4
|
+
type MMapDefaultSchemeLayerType = "ground" | "buildings" | "icons" | "labels";
|
|
3
5
|
/**
|
|
4
6
|
* MMapDefaultSchemeLayer props
|
|
5
7
|
*/
|
|
6
8
|
type MMapDefaultSchemeLayerProps = {
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Should show layers
|
|
11
|
+
* @deprecated use {@link MMapDefaultSchemeLayerProps}.layers instead
|
|
12
|
+
*/
|
|
8
13
|
visible?: boolean;
|
|
9
14
|
/** Vector tiles customization. */
|
|
10
15
|
customization?: VectorCustomization;
|
|
@@ -13,28 +18,33 @@ type MMapDefaultSchemeLayerProps = {
|
|
|
13
18
|
* @deprecated use {@link MMapProps}.theme prop in {@link MMap} instead
|
|
14
19
|
* */
|
|
15
20
|
theme?: "dark" | "light";
|
|
21
|
+
/** Name for source */
|
|
22
|
+
source?: string;
|
|
23
|
+
/** Layers parameters */
|
|
24
|
+
layers?: Partial<Record<MMapDefaultSchemeLayerType, Partial<MMapLayerProps>>>;
|
|
16
25
|
};
|
|
17
26
|
declare const defaultProps: {
|
|
18
27
|
visible: boolean;
|
|
19
28
|
source: string;
|
|
20
|
-
|
|
29
|
+
layers: {
|
|
21
30
|
ground: {
|
|
22
|
-
type: string;
|
|
23
31
|
zIndex: number;
|
|
24
32
|
};
|
|
25
33
|
buildings: {
|
|
26
|
-
type: string;
|
|
27
34
|
zIndex: number;
|
|
28
35
|
};
|
|
29
36
|
icons: {
|
|
30
|
-
type: string;
|
|
31
37
|
zIndex: number;
|
|
32
38
|
};
|
|
33
39
|
labels: {
|
|
34
|
-
type: string;
|
|
35
40
|
zIndex: number;
|
|
36
41
|
};
|
|
37
42
|
};
|
|
43
|
+
/** @deprecated use {@link DefaultProps}.layers instead */
|
|
44
|
+
readonly layersInfo: Record<MMapDefaultSchemeLayerType, {
|
|
45
|
+
type: string;
|
|
46
|
+
zIndex: number;
|
|
47
|
+
}>;
|
|
38
48
|
};
|
|
39
49
|
type DefaultProps = typeof defaultProps;
|
|
40
50
|
/**
|
|
@@ -53,24 +63,25 @@ declare class MMapDefaultSchemeLayer extends MMapComplexEntity<MMapDefaultScheme
|
|
|
53
63
|
static defaultProps: {
|
|
54
64
|
visible: boolean;
|
|
55
65
|
source: string;
|
|
56
|
-
|
|
66
|
+
layers: {
|
|
57
67
|
ground: {
|
|
58
|
-
type: string;
|
|
59
68
|
zIndex: number;
|
|
60
69
|
};
|
|
61
70
|
buildings: {
|
|
62
|
-
type: string;
|
|
63
71
|
zIndex: number;
|
|
64
72
|
};
|
|
65
73
|
icons: {
|
|
66
|
-
type: string;
|
|
67
74
|
zIndex: number;
|
|
68
75
|
};
|
|
69
76
|
labels: {
|
|
70
|
-
type: string;
|
|
71
77
|
zIndex: number;
|
|
72
78
|
};
|
|
73
79
|
};
|
|
80
|
+
/** @deprecated use {@link DefaultProps}.layers instead */
|
|
81
|
+
readonly layersInfo: Record<MMapDefaultSchemeLayerType, {
|
|
82
|
+
type: string;
|
|
83
|
+
zIndex: number;
|
|
84
|
+
}>;
|
|
74
85
|
};
|
|
75
86
|
private _dataSource?;
|
|
76
87
|
private _layers;
|
|
@@ -52,6 +52,7 @@ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
|
|
|
52
52
|
private _id;
|
|
53
53
|
private _source;
|
|
54
54
|
private _defaultPropsId?;
|
|
55
|
+
get id(): string;
|
|
55
56
|
constructor(props: MMapFeatureProps);
|
|
56
57
|
get properties(): Record<string, unknown> | undefined;
|
|
57
58
|
get geometry(): GenericGeometry<LngLat>;
|
|
@@ -64,6 +65,7 @@ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
|
|
|
64
65
|
private __onClick;
|
|
65
66
|
private __onDoubleClick;
|
|
66
67
|
private __onFastClick;
|
|
67
|
-
private
|
|
68
|
+
private __isMySomeObject;
|
|
69
|
+
private __isMyDraggableObject;
|
|
68
70
|
}
|
|
69
71
|
export { MMapFeature, MMapFeatureProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MMapComplexEntity } from "
|
|
2
|
-
export type UnitType =
|
|
1
|
+
import { MMapComplexEntity } from "../MMapEnities";
|
|
2
|
+
export type UnitType = "imperial" | "metric" | "nautical";
|
|
3
3
|
type MMapScaleControlProps = {
|
|
4
4
|
/** Maximum width of scale line in pixels */
|
|
5
5
|
maxWidth?: number;
|
|
@@ -7,13 +7,13 @@ type MMapScaleControlProps = {
|
|
|
7
7
|
unit?: UnitType;
|
|
8
8
|
};
|
|
9
9
|
declare const defaultProps: Readonly<{
|
|
10
|
-
maxWidth:
|
|
10
|
+
maxWidth: 74;
|
|
11
11
|
unit: "metric";
|
|
12
12
|
}>;
|
|
13
13
|
type DefaultProps = typeof defaultProps;
|
|
14
14
|
declare class MMapScaleControl extends MMapComplexEntity<MMapScaleControlProps, DefaultProps> {
|
|
15
15
|
static defaultProps: Readonly<{
|
|
16
|
-
maxWidth:
|
|
16
|
+
maxWidth: 74;
|
|
17
17
|
unit: "metric";
|
|
18
18
|
}>;
|
|
19
19
|
private _unwatchThemeContext?;
|
|
@@ -50,9 +50,12 @@ type MMapTileDataSourceProps = {
|
|
|
50
50
|
*/
|
|
51
51
|
declare class MMapTileDataSource extends MMapEntity<MMapTileDataSourceProps> {
|
|
52
52
|
private _id;
|
|
53
|
+
private _unwatchVectorContext?;
|
|
53
54
|
protected _onAttach(): void;
|
|
54
55
|
protected _onDetach(): void;
|
|
55
56
|
protected _onUpdate(props: Partial<MMapTileDataSourceProps>): void;
|
|
56
|
-
private
|
|
57
|
+
private _getDataSourceDescription;
|
|
58
|
+
private _onVectorContextUpdate;
|
|
59
|
+
private _prepareVectorSource;
|
|
57
60
|
}
|
|
58
61
|
export { MMapTileDataSource, MMapTileDataSourceProps };
|
package/imperative/index.d.ts
CHANGED
|
@@ -13,10 +13,11 @@ export * from "./MMapHotspot";
|
|
|
13
13
|
export * from "./wrappers";
|
|
14
14
|
export { MMapMarker, MMapMarkerProps, MMapMarkerEventHandler } from "./MMapMarker";
|
|
15
15
|
export { MMapTileDataSource, MMapTileDataSourceProps } from "./MMapTileDataSource";
|
|
16
|
-
export
|
|
16
|
+
export * from "./MMapControls";
|
|
17
17
|
export { MMapControl, MMapControlProps, MMapControlButton, MMapControlButtonProps, MMapControlCommonButton } from "./MMapControl";
|
|
18
18
|
export { MMapCollection } from "./MMapCollection";
|
|
19
19
|
export { MMapContainer, MMapContainerProps, MMapContainerPropsImpl, ComputedMMapContainerProps } from "./MMapContainer";
|
|
20
|
+
export { MMapScaleControl, MMapScaleControlProps } from "./MMapScaleControl";
|
|
20
21
|
export * from "./mappable-worldMaps";
|
|
21
22
|
export * from "./search";
|
|
22
23
|
export * from "./suggest";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Config } from "../config";
|
|
2
|
-
import type { BaseRouteResponse, RouteOptions } from "./interface";
|
|
2
|
+
import type { BaseRouteResponse, RouteOptions, RouteFeature } from "./interface";
|
|
3
3
|
export declare function route(options: RouteOptions, config?: Config | undefined): Promise<BaseRouteResponse[]>;
|
|
4
|
-
export { RouteOptions, BaseRouteResponse };
|
|
4
|
+
export { RouteOptions, BaseRouteResponse, RouteFeature };
|
package/import.d.ts
CHANGED
|
@@ -4,9 +4,16 @@ export type Module = Function | null | {
|
|
|
4
4
|
[key: string]: Function | object;
|
|
5
5
|
};
|
|
6
6
|
export type Loader = (pkg: string) => Promise<Module> | Module;
|
|
7
|
+
type Packages = Record<string, {
|
|
8
|
+
version: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
export?: string;
|
|
11
|
+
}>;
|
|
7
12
|
export interface Import {
|
|
8
13
|
loaders: Loader[];
|
|
9
14
|
default: Loader;
|
|
15
|
+
cdn: (templatePath: string, packages: Packages | string[] | string) => Loader;
|
|
16
|
+
registerCdn: (templatePath: string, packages: Packages | string[] | string) => void;
|
|
10
17
|
script: (url: string) => Promise<unknown>;
|
|
11
18
|
cssText: (cssText: string, name: string) => Promise<unknown>;
|
|
12
19
|
style: (url: string) => Promise<unknown>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Flatbush from "flatbush";
|
|
2
|
+
import type { LngLat, Projection, WorldCoordinates } from "../../../../common/types";
|
|
3
|
+
import type { GeoJSONFeature } from "../interface";
|
|
4
|
+
export interface BaseDataProviderOptions<Feature extends GeoJSONFeature> {
|
|
5
|
+
filter(item: Feature, tx: number, ty: number, tz: number): boolean;
|
|
6
|
+
getFeatures: (json: unknown) => Feature[];
|
|
7
|
+
convert: (item: unknown) => Feature;
|
|
8
|
+
getBound(item: Feature): [
|
|
9
|
+
LngLat,
|
|
10
|
+
LngLat
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class BaseDataProvider<Feature extends GeoJSONFeature, Options extends BaseDataProviderOptions<Feature> = BaseDataProviderOptions<Feature>> {
|
|
14
|
+
protected __version: number;
|
|
15
|
+
protected __flatbush: Flatbush[];
|
|
16
|
+
protected __options: Options;
|
|
17
|
+
protected readonly __projection: Projection;
|
|
18
|
+
constructor(projection: Projection, options?: Partial<BaseDataProviderOptions<Feature>>);
|
|
19
|
+
protected __waitFirstChunk: Promise<void>;
|
|
20
|
+
protected __data: GeoJSONFeature[][];
|
|
21
|
+
fetchTile(tx: number, ty: number, tz: number, signal: AbortSignal): Promise<{
|
|
22
|
+
data: GeoJSONFeature[];
|
|
23
|
+
total: number;
|
|
24
|
+
version: number;
|
|
25
|
+
}>;
|
|
26
|
+
on(event: "update", handler: () => void): void;
|
|
27
|
+
off(event: "update", handler: () => void): void;
|
|
28
|
+
private readonly __eventHandlers;
|
|
29
|
+
protected _emit(event: "update"): void;
|
|
30
|
+
protected __isLoading: boolean;
|
|
31
|
+
protected _clusterize(part: GeoJSONFeature[]): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert tile coordinates to special world coordinates.
|
|
35
|
+
* It's not a real some standard, but it's used in mappable.
|
|
36
|
+
*/
|
|
37
|
+
export declare function tileToWorld(tx: number, ty: number, tz: number): [
|
|
38
|
+
WorldCoordinates,
|
|
39
|
+
WorldCoordinates
|
|
40
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Projection } from "../../../../common/types";
|
|
2
|
+
import type { GeoJSONFeature } from "../interface";
|
|
3
|
+
import { BaseDataProvider } from "./BaseDataProvider";
|
|
4
|
+
/**
|
|
5
|
+
* Loads GeoJSON data from a URL. The data is expected to be in the GeoJSON format.
|
|
6
|
+
* But you can specify the `convert` option to convert the data to the GeoJSON format.
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const {JSONDataProvider} = await mappable.import('@mappable-world/mappable-analytics');
|
|
9
|
+
* const dataProvider = new JSONDataProvider('https://example.com/data.json', map.projection, {
|
|
10
|
+
* convert: (item) => item as GeoJSONFeature,
|
|
11
|
+
* });
|
|
12
|
+
* dataProvider.load();
|
|
13
|
+
* const layer = new MMapGeoJsonLayer({
|
|
14
|
+
* dataProvider,
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
* @param url - URL to load the data from.
|
|
18
|
+
*/
|
|
19
|
+
export declare class JSONDataProvider<Feature extends GeoJSONFeature = GeoJSONFeature> extends BaseDataProvider<Feature> {
|
|
20
|
+
readonly url: string;
|
|
21
|
+
constructor(url: string, projection: Projection, options?: {});
|
|
22
|
+
/**
|
|
23
|
+
* Starts loading the data from the URL.
|
|
24
|
+
*/
|
|
25
|
+
load(): Promise<void> | undefined;
|
|
26
|
+
private __loadGeoJSON;
|
|
27
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Projection } from "../../../../common/types";
|
|
2
|
+
import type { GeoJSONFeature } from "../interface";
|
|
3
|
+
import { BaseDataProvider, type BaseDataProviderOptions } from "./BaseDataProvider";
|
|
4
|
+
interface JSONLinesDataProviderDataProviderOptions<Feature extends GeoJSONFeature = GeoJSONFeature> extends BaseDataProviderOptions<Feature> {
|
|
5
|
+
chunkSize: number;
|
|
6
|
+
total: number;
|
|
7
|
+
progress: (progress: number) => void;
|
|
8
|
+
tickTimeout: number;
|
|
9
|
+
convert: (item: unknown) => Feature;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Loads GeoJSON lines data from a URL. The data is expected to be in the JSON lines format.
|
|
13
|
+
* Each line should be a valid JSON object.
|
|
14
|
+
* But you can specify the `convert` option to convert the data to the GeoJSON format.
|
|
15
|
+
* ```javascript
|
|
16
|
+
* const {JSONLinesDataProvider} = await mappable.import('@mappable-world/mappable-analytics');
|
|
17
|
+
* const dataProvider = new JSONLinesDataProvider('https://example.com/data.json', map.projection, {
|
|
18
|
+
* chunkSize: 10000,
|
|
19
|
+
* total: 1500000,
|
|
20
|
+
* progress: (progress) => {
|
|
21
|
+
* console.log(progress);
|
|
22
|
+
* },
|
|
23
|
+
* convert: (item) => item as GeoJSONFeature,
|
|
24
|
+
* });
|
|
25
|
+
* dataProvider.load();
|
|
26
|
+
* const layer = new MMapGeoJsonLayer({
|
|
27
|
+
* dataProvider,
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class JSONLinesDataProvider<Feature extends GeoJSONFeature = GeoJSONFeature> extends BaseDataProvider<Feature, JSONLinesDataProviderDataProviderOptions<Feature>> {
|
|
32
|
+
readonly url: string;
|
|
33
|
+
constructor(url: string, projection: Projection, options?: Partial<JSONLinesDataProviderDataProviderOptions<Feature>>);
|
|
34
|
+
/**
|
|
35
|
+
* Starts loading the data from the URL.
|
|
36
|
+
*/
|
|
37
|
+
load(): Promise<number> | undefined;
|
|
38
|
+
private __loadByChunks;
|
|
39
|
+
private __parseJSONLines;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Projection } from "../../../../common/types";
|
|
2
|
+
import type { GeoJSONFeature } from "../interface";
|
|
3
|
+
import { BaseDataProvider } from "./BaseDataProvider";
|
|
4
|
+
/**
|
|
5
|
+
* Static data provider. The data for the provider is set in the constructor and can be changed using the `setData` method.
|
|
6
|
+
* ```javascript
|
|
7
|
+
* const {StaticDataProvider} = await mappable.import('@mappable-world/mappable-analytics');
|
|
8
|
+
* const dataProvider = new StaticDataProvider(data, map.projection);
|
|
9
|
+
* const layer = new MMapGeoJsonLayer({
|
|
10
|
+
* dataProvider,
|
|
11
|
+
* });
|
|
12
|
+
* dataProvider.setData(newData);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class StaticDataProvider<Feature extends GeoJSONFeature = GeoJSONFeature> extends BaseDataProvider<Feature> {
|
|
16
|
+
constructor(data: unknown, projection: Projection);
|
|
17
|
+
setData(data: unknown): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadNewChunk(url: string, size?: number): AsyncGenerator<string[], void, unknown>;
|