@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { MMap, MMapProps, MMapCenterLocation, MMapZoomLocation, MMapBoundsLocation, MMapCenterZoomLocation, MMapLocationRequest } from "./MMap";
|
|
2
|
+
export { MMapCopyrightsPosition } from "./MMapCopyrights";
|
|
3
|
+
export { MMapEntity, MMapComplexEntity, MMapGroupEntity, MMapContext } from "./MMapEnities";
|
|
4
|
+
export { MMapDefaultFeaturesLayer, MMapDefaultFeaturesLayerProps } from "./MMapDefaultFeaturesLayer";
|
|
5
|
+
export { MMapDefaultSchemeLayer, MMapDefaultSchemeLayerProps } from "./MMapDefaultSchemeLayer";
|
|
6
|
+
export { MMapDefaultSatelliteLayer, MMapDefaultSatelliteLayerProps } from "./MMapDefaultSatelliteLayer";
|
|
7
|
+
export * from "./MMapFeature";
|
|
8
|
+
export { MMapFeatureDataSource, MMapFeatureDataSourceProps } from "./MMapFeatureDataSource";
|
|
9
|
+
export { MMapLayer, MMapLayerProps } from "./MMapLayer";
|
|
10
|
+
export * from "./MMapListener";
|
|
11
|
+
export * from "./MMapHotspot";
|
|
12
|
+
export { MMapMarker, MMapMarkerProps, MMapMarkerEventHandler } from "./MMapMarker";
|
|
13
|
+
export { MMapTileDataSource, MMapTileDataSourceProps } from "./MMapTileDataSource";
|
|
14
|
+
export { MMapControls, MMapControlsProps } from "./MMapControls";
|
|
15
|
+
export { MMapControl, MMapControlProps, MMapControlButton, MMapControlButtonProps, MMapControlCommonButton } from "./MMapControl";
|
|
16
|
+
export { MMapCollection } from "./MMapCollection";
|
|
17
|
+
export * from "./mappableMaps";
|
|
18
|
+
export * from "./search";
|
|
19
|
+
export * from "./suggest";
|
|
20
|
+
export * from "./route";
|
|
21
|
+
export { geolocation } from "./geolocation";
|
|
22
|
+
export { useDomContext } from "./DomContext";
|
|
23
|
+
export { Config } from "./config";
|
|
24
|
+
export { fetchConfig, FetchConfigOptions } from "./fetchConfig";
|
|
25
|
+
export * as projections from "./utils/projections";
|
|
26
|
+
export type { LngLat, ReadonlyLngLat, LngLatBounds, BehaviorType, MapMode, Margin, ZoomRange, ZoomStrategy, ZoomRounding, VectorCustomization, RasterTileDataSourceDescription, VectorTileDataSourceDescription, RasterLayerOptions, EasingFunctionDescription, EasingPresetName, EasingBezierPreset, EasingFunction, DrawingStyle, DrawingStyleIcon, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority } from "../common/types";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EncodedRouteFeatureCollection } from "./utils";
|
|
2
|
+
import type { BaseRouteResponse, RouteFeature, RouteOptions } from ".";
|
|
3
|
+
export declare class DrivingRouteResponse implements BaseRouteResponse {
|
|
4
|
+
#private;
|
|
5
|
+
private _options?;
|
|
6
|
+
constructor(data: EncodedRouteFeatureCollection, options?: RouteOptions);
|
|
7
|
+
toRoute(): RouteFeature;
|
|
8
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { GenericFeature, LineStringGeometry, LngLat, LngLatBounds } from "../../common/types";
|
|
2
|
+
import { Config } from "../config";
|
|
3
|
+
export declare enum MMapJamType {
|
|
4
|
+
UNKNOWN = 1,
|
|
5
|
+
CLOSED = 2,
|
|
6
|
+
FREE = 3,
|
|
7
|
+
LIGHT = 4,
|
|
8
|
+
HARD = 5,
|
|
9
|
+
VERY_HARD = 6
|
|
10
|
+
}
|
|
11
|
+
export type MMapJamSegment = {
|
|
12
|
+
/**
|
|
13
|
+
* Traffic jam type, one of {@link MMapJamType MMapJamType}
|
|
14
|
+
* */
|
|
15
|
+
type: MMapJamType;
|
|
16
|
+
/**
|
|
17
|
+
* How many items of the {@link RouteFeature.coordinates RouteFeature.coordinates}
|
|
18
|
+
* array this {@link JamSegment JamSegment} spans across
|
|
19
|
+
* Use these values to build palettes for a {@link MMapFeature MMapFeature} stroke style
|
|
20
|
+
* */
|
|
21
|
+
count: number;
|
|
22
|
+
};
|
|
23
|
+
export interface RouteFeature extends GenericFeature<LngLat> {
|
|
24
|
+
geometry: LineStringGeometry;
|
|
25
|
+
properties: {
|
|
26
|
+
jams?: MMapJamSegment[];
|
|
27
|
+
bounds?: LngLatBounds;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface RoutePoint {
|
|
31
|
+
type: "way" | "via";
|
|
32
|
+
coordinates: LngLat;
|
|
33
|
+
}
|
|
34
|
+
export interface RouteOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Route points represented by {@link LngLat LngLat} coordinates.
|
|
37
|
+
* Its may be array of {@link LngLat LngLat} or array of {type, coordinates} objects.
|
|
38
|
+
* {@link LngLat LngLat}[] is a shorthand for {type: 'way', coordinates: {@link LngLat LngLat}}[].
|
|
39
|
+
**/
|
|
40
|
+
points: (RoutePoint | LngLat)[];
|
|
41
|
+
/** Route type. Only 'driving' type is available at this moment. */
|
|
42
|
+
type: "driving";
|
|
43
|
+
/** Maximum amount of returned routes. Only one result is available at this moment. */
|
|
44
|
+
results?: 1;
|
|
45
|
+
/** Traffic jams requesting flag. If specified, jams will be returned in properties. Default is `false`. */
|
|
46
|
+
jams?: boolean;
|
|
47
|
+
/** Traffic jams requesting flag. If specified, jams will be returned in properties. Default is `false`. */
|
|
48
|
+
bounds?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface BaseRouteResponse {
|
|
51
|
+
/** Return requested route as {@link RouteFeature RouteFeature}. */
|
|
52
|
+
toRoute(): RouteFeature;
|
|
53
|
+
}
|
|
54
|
+
export declare function route(options: RouteOptions, config?: Config | undefined): Promise<BaseRouteResponse[]>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GenericMappableFeatureCollection, LngLat, LngLatBounds } from "../../common/types";
|
|
2
|
+
import type { MMapJamSegment } from ".";
|
|
3
|
+
export declare function decodeRouteCoordinates(input: string): LngLat[];
|
|
4
|
+
interface EncodedPathFeatureCollection extends GenericMappableFeatureCollection<LngLat> {
|
|
5
|
+
properties: {
|
|
6
|
+
encodedCoordinates: string;
|
|
7
|
+
jams?: MMapJamSegment[];
|
|
8
|
+
boundedBy?: LngLatBounds;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface EncodedRouteFeatureCollection extends GenericMappableFeatureCollection<LngLat> {
|
|
12
|
+
features: EncodedPathFeatureCollection[];
|
|
13
|
+
}
|
|
14
|
+
export interface RawRouteResponse {
|
|
15
|
+
data: {
|
|
16
|
+
features: EncodedRouteFeatureCollection[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function prepareRoutes({ data }: RawRouteResponse): EncodedRouteFeatureCollection[];
|
|
20
|
+
export declare function isFiniteBounds(bounds: LngLatBounds): boolean;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { LngLat, LngLatBounds } from "../common/types";
|
|
2
|
+
import { Config } from "./config";
|
|
3
|
+
declare const geocoderSearchTypes: {
|
|
4
|
+
businesses: string;
|
|
5
|
+
toponyms: string;
|
|
6
|
+
};
|
|
7
|
+
type GeocoderSearchType = keyof typeof geocoderSearchTypes;
|
|
8
|
+
type SearchOptions = {
|
|
9
|
+
/** Request string represented by a text or {@link LngLat LngLat} point. */
|
|
10
|
+
text: string;
|
|
11
|
+
/**
|
|
12
|
+
* {@link type `type`} parameter specifies the type of
|
|
13
|
+
* objects that are being searched (and the order of objects
|
|
14
|
+
* if both types are queried):
|
|
15
|
+
* - toponyms
|
|
16
|
+
* - businesses
|
|
17
|
+
* */
|
|
18
|
+
type?: GeocoderSearchType[];
|
|
19
|
+
/** Map zoom. */
|
|
20
|
+
zoom?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Flag that defines whether
|
|
23
|
+
* search area is restricted by the provided parameters.
|
|
24
|
+
*
|
|
25
|
+
* Area restriction is specified by {@link SearchOptions.center `center`}
|
|
26
|
+
* and {@link SearchOptions.span `span`} parameters
|
|
27
|
+
* or {@link SearchOptions.bounds `bounds`} parameter.
|
|
28
|
+
*
|
|
29
|
+
* false — the search area is *not* restricted
|
|
30
|
+
*
|
|
31
|
+
* true — the search area is restricted
|
|
32
|
+
* */
|
|
33
|
+
strictBounds?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The maximum amount of returned objects.
|
|
36
|
+
*
|
|
37
|
+
* Parameter has to be specified explicitly if {@link SearchOptions.offset `offset`} parameter is provided.
|
|
38
|
+
*
|
|
39
|
+
* **10** is default.
|
|
40
|
+
*
|
|
41
|
+
* **100** is maximum.
|
|
42
|
+
* */
|
|
43
|
+
limit?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The amount of objects (if any returned) that are skipped starting from the first one.
|
|
46
|
+
*
|
|
47
|
+
* Parameter {@link SearchOptions.limit `limit`} must be provided.
|
|
48
|
+
* */
|
|
49
|
+
offset?: number;
|
|
50
|
+
/**
|
|
51
|
+
* {@link LngLat `LngLat`} of the center point of search area.
|
|
52
|
+
*
|
|
53
|
+
* {@link SearchOptions.span `span`} parameter sets the length of the search area.
|
|
54
|
+
* */
|
|
55
|
+
center?: LngLat;
|
|
56
|
+
/**
|
|
57
|
+
* Parameter {@link span `span`} is specified with two numbers that represent
|
|
58
|
+
* differences between the minimum and maximum:
|
|
59
|
+
* - longitude of the area
|
|
60
|
+
* - latitude of the area
|
|
61
|
+
*/
|
|
62
|
+
span?: LngLat;
|
|
63
|
+
/**
|
|
64
|
+
* {@link bounds `bounds`} parameter has priority over
|
|
65
|
+
* {@link SearchOptions.ll `ll`} and {@link SearchOptions.spn `span`}
|
|
66
|
+
* */
|
|
67
|
+
bounds?: LngLatBounds;
|
|
68
|
+
};
|
|
69
|
+
type RawFeature = {
|
|
70
|
+
properties: {
|
|
71
|
+
name: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
geometry?: {
|
|
75
|
+
type: "Point";
|
|
76
|
+
coordinates: LngLat;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type Feature = RawFeature;
|
|
80
|
+
type SearchResponse = Feature[];
|
|
81
|
+
declare function search(options: SearchOptions, config?: Config | undefined): Promise<SearchResponse>;
|
|
82
|
+
export { search };
|
|
83
|
+
export type { SearchOptions, SearchResponse };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LngLat, LngLatBounds } from "../common/types";
|
|
2
|
+
import { Config } from "./config";
|
|
3
|
+
type GeoSuggestType = "all" | "toponyms" | "addresses" | "organizations";
|
|
4
|
+
export type SuggestOptions = {
|
|
5
|
+
text: string;
|
|
6
|
+
center?: LngLat;
|
|
7
|
+
span?: LngLat;
|
|
8
|
+
bounds?: LngLatBounds;
|
|
9
|
+
countries?: string;
|
|
10
|
+
type?: GeoSuggestType;
|
|
11
|
+
limit?: number;
|
|
12
|
+
localOnly?: number;
|
|
13
|
+
highlight?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type ObjectType = "unknown" | "toponym" | "business" | "transit";
|
|
16
|
+
/** Positions of chars to highlight between */
|
|
17
|
+
type Highlight = [
|
|
18
|
+
number,
|
|
19
|
+
number
|
|
20
|
+
];
|
|
21
|
+
type TextWithHighlight = {
|
|
22
|
+
text: string;
|
|
23
|
+
hl: Highlight[];
|
|
24
|
+
};
|
|
25
|
+
export type SuggestResponseItem = {
|
|
26
|
+
/** Type of suggested object */
|
|
27
|
+
type?: ObjectType;
|
|
28
|
+
/** Human-readable object title with matching highlighting */
|
|
29
|
+
title: TextWithHighlight;
|
|
30
|
+
/** Human-readable object subtitle with matching highlighting */
|
|
31
|
+
subtitle?: TextWithHighlight;
|
|
32
|
+
/** Object value. Useful for next substitution in mappable.search function */
|
|
33
|
+
value: string;
|
|
34
|
+
};
|
|
35
|
+
export type SuggestResponse = SuggestResponseItem[];
|
|
36
|
+
export declare function suggest(options: SuggestOptions, config?: Config | undefined): Promise<SuggestResponse>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GenericComplexEntity, GenericEntity } from "./Entities";
|
|
2
|
+
export declare const enum TraverseOrder {
|
|
3
|
+
PREORDER = 1,
|
|
4
|
+
POSTORDER = -1
|
|
5
|
+
}
|
|
6
|
+
export type TraverseOptions = {
|
|
7
|
+
readonly order: TraverseOrder;
|
|
8
|
+
readonly recurse: (node: GenericComplexEntity<unknown>) => boolean;
|
|
9
|
+
};
|
|
10
|
+
export type TraverseState = TraverseOptions & {
|
|
11
|
+
path: {
|
|
12
|
+
node: GenericComplexEntity<unknown>;
|
|
13
|
+
next: number;
|
|
14
|
+
}[];
|
|
15
|
+
current?: GenericEntity<unknown>;
|
|
16
|
+
};
|
|
17
|
+
export declare function traverseInit(entity: GenericComplexEntity<unknown>, options: TraverseOptions): TraverseState;
|
|
18
|
+
export declare function traverseStep(state: TraverseState): void;
|
|
19
|
+
export declare function traverseUntil(traverse: TraverseState, predicate: (entity: GenericEntity<unknown>) => boolean): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface MappableError extends Error {
|
|
2
|
+
additionalInfo?: Additional;
|
|
3
|
+
logged?: boolean;
|
|
4
|
+
}
|
|
5
|
+
type Additional = Record<string, unknown>;
|
|
6
|
+
interface LogErrorOptions {
|
|
7
|
+
message?: string;
|
|
8
|
+
service?: string;
|
|
9
|
+
source?: string;
|
|
10
|
+
sourceMethod?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
block?: string;
|
|
13
|
+
method?: string;
|
|
14
|
+
page?: string;
|
|
15
|
+
additional?: Additional;
|
|
16
|
+
level?: "info" | "debug" | "warn" | "error" | "critical" | "trace";
|
|
17
|
+
}
|
|
18
|
+
interface LogErrorInitSettings {
|
|
19
|
+
project?: string;
|
|
20
|
+
unhandledRejection?: boolean;
|
|
21
|
+
uncaughtException?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type ErrorLoggerInitFunction = (settings: LogErrorInitSettings) => ErrorLoggerFunction;
|
|
24
|
+
type ErrorLoggerFunction = (options: LogErrorOptions, error?: MappableError) => void;
|
|
25
|
+
export type MappableReactError = Omit<MappableError, "logged">;
|
|
26
|
+
export { ErrorLoggerInitFunction };
|
|
27
|
+
export declare function errorLoggerFactory(initLogger: ErrorLoggerInitFunction): void;
|
|
28
|
+
export declare function logError(error: MappableReactError, options?: Record<string, unknown>): void;
|
|
29
|
+
export declare function throwError(error: MappableReactError): never;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type BooleanFlag = 0 | 1;
|
|
2
|
+
type JsonpRequest = {
|
|
3
|
+
url: string;
|
|
4
|
+
callbackName: string;
|
|
5
|
+
};
|
|
6
|
+
declare function boolToFlag(value: undefined | boolean): undefined | BooleanFlag;
|
|
7
|
+
declare function composeUrl(baseUrl: string, params: Record<string, string | number | undefined>): string;
|
|
8
|
+
declare function jsonp<JsonpResponse>({ url, callbackName }: JsonpRequest): Promise<JsonpResponse>;
|
|
9
|
+
export { jsonp, composeUrl, boolToFlag };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConfigMetaMetrics } from "../config";
|
|
2
|
+
type Metrics = {};
|
|
3
|
+
type TransportOptions = {
|
|
4
|
+
share?: number;
|
|
5
|
+
};
|
|
6
|
+
type MetricsTransport<T> = (metrics: T, options?: TransportOptions) => void;
|
|
7
|
+
type CreateTransportOptions = {
|
|
8
|
+
prefix?: string;
|
|
9
|
+
/** Events with share (if defined) less than this value will not be sent, should be in [0, 1] range */
|
|
10
|
+
sendBoundary?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function createMetricsTransport<T extends Record<string, unknown>>(metaMetrics: ConfigMetaMetrics, options?: CreateTransportOptions): MetricsTransport<T>;
|
|
13
|
+
export declare const SEND_BOUNDARY: number;
|
|
14
|
+
export declare function initMetrics(config: ConfigMetaMetrics): void;
|
|
15
|
+
export declare function sendMetrics(data: Metrics, options?: TransportOptions): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./spherical-mercator";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Projection, LngLat, WorldCoordinates } from "../../../common/types";
|
|
2
|
+
/**
|
|
3
|
+
* @class Mercator projection onto a sphere.
|
|
4
|
+
* Used by many mapping services, in particular OpenStreetMap.
|
|
5
|
+
* @name projection.sphericalMercator
|
|
6
|
+
* @augments Projection
|
|
7
|
+
* @static
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* // Create a map in the spherical Mercator projection
|
|
11
|
+
* const map = new mappable.MMap(document.getElementById('MMapsID'), {
|
|
12
|
+
* location: {
|
|
13
|
+
* center: [37, 55],
|
|
14
|
+
* zoom: 6
|
|
15
|
+
* },
|
|
16
|
+
* projection: new mappable.SphericalMercator()
|
|
17
|
+
* });
|
|
18
|
+
* const dataSourceProps = {
|
|
19
|
+
* raster: {
|
|
20
|
+
* type: 'ground',
|
|
21
|
+
* fetchTile: "https://tile.openstreetmap.org/{{z}}/{{y}}/{{x}}"
|
|
22
|
+
* }
|
|
23
|
+
* };
|
|
24
|
+
* // Add osm tiles
|
|
25
|
+
* const dataSource = new mappable.MMapTileDataSource({
|
|
26
|
+
* id: "osmSource",
|
|
27
|
+
* ...dataSourceProps,
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const layer = new mappable.MMapLayer({
|
|
31
|
+
* id: "osm",
|
|
32
|
+
* source: "osmSource",
|
|
33
|
+
* type: "ground",
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare class SphericalMercator implements Projection {
|
|
38
|
+
private _maxLatitudeRad;
|
|
39
|
+
toWorldCoordinates(coords: LngLat): WorldCoordinates;
|
|
40
|
+
fromWorldCoordinates(world: WorldCoordinates): LngLat;
|
|
41
|
+
private _worldXToLongitude;
|
|
42
|
+
private _longitudeToWorldX;
|
|
43
|
+
private _latitudeToWorldY;
|
|
44
|
+
private _worldYToLatitude;
|
|
45
|
+
}
|
|
46
|
+
declare const sphericalMercator: SphericalMercator;
|
|
47
|
+
export { sphericalMercator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function removeUndefined<T extends {}>(obj: T, recursive?: boolean): T;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReadonlyLngLat, ZoomRange } from "../../common/types";
|
|
2
|
+
export type LayerInfo = {
|
|
3
|
+
id: string;
|
|
4
|
+
zoomRange?: ZoomRange;
|
|
5
|
+
copyrights?: string[];
|
|
6
|
+
LayerMetaData?: unknown[];
|
|
7
|
+
};
|
|
8
|
+
export type Coverage = LayerInfo[];
|
|
9
|
+
declare function requestCoverage(host: string, layers: string[], coordinates: ReadonlyLngLat, zoom: number, lang: string, signal?: AbortSignal): Promise<Coverage>;
|
|
10
|
+
export { requestCoverage };
|
package/import.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "./modules/types";
|
|
2
|
+
import "./packages/types";
|
|
3
|
+
export type Module = Function | null | {
|
|
4
|
+
[key: string]: Function | object;
|
|
5
|
+
};
|
|
6
|
+
export type Loader = (pkg: string) => Promise<Module> | Module;
|
|
7
|
+
export interface Import {
|
|
8
|
+
/** @internal */
|
|
9
|
+
__implCache: Record<string, Promise<Module>>;
|
|
10
|
+
/** @internal */
|
|
11
|
+
__implInit(base: string, ready: Promise<unknown>): void;
|
|
12
|
+
/** @internal */
|
|
13
|
+
__implInlineModules: Record<string, () => Promise<Module>>;
|
|
14
|
+
loaders: Loader[];
|
|
15
|
+
default: Loader;
|
|
16
|
+
script: (url: string) => Promise<unknown>;
|
|
17
|
+
cssText: (cssText: string, name: string) => Promise<unknown>;
|
|
18
|
+
style: (url: string) => Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
const __MODULES__: string[];
|
|
22
|
+
const __PACKAGES__: string[];
|
|
23
|
+
const __VENDOR__: "mappable" | "mappable";
|
|
24
|
+
const __NAMESPACE__: "mappable" | "mappable";
|
|
25
|
+
const __LOGO_WIDHT__: `${number}px`;
|
|
26
|
+
}
|
|
27
|
+
declare const mappableImport: Import;
|
|
28
|
+
export { mappableImport };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./modules/types";
|
|
2
|
+
import "./packages/types";
|
|
3
|
+
export * from "./imperative";
|
|
4
|
+
export * from "./common/types";
|
|
5
|
+
export const ready: Promise<void>;
|
|
6
|
+
declare const import_: import("./import").Import;
|
|
7
|
+
export { import_ as import };
|
|
8
|
+
declare global {
|
|
9
|
+
const mappable: typeof import("./index");
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ConfigMeta } from "./imperative/config";
|
|
2
|
+
import type { Import } from "./import";
|
|
3
|
+
import { mappableImport } from "./import";
|
|
4
|
+
interface Config {
|
|
5
|
+
meta?: ConfigMeta;
|
|
6
|
+
src: {
|
|
7
|
+
base: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface AdhocConfig {
|
|
11
|
+
/** All logic with this field is for development and CI only. */
|
|
12
|
+
adhoc?: {
|
|
13
|
+
meta: {
|
|
14
|
+
hosts: ConfigMeta["hosts"];
|
|
15
|
+
apikey: string;
|
|
16
|
+
};
|
|
17
|
+
options: {
|
|
18
|
+
lang: string;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type MainModule = typeof import("./main");
|
|
24
|
+
interface MMaps3 extends MainModule {
|
|
25
|
+
import: Import;
|
|
26
|
+
ready: Promise<void>;
|
|
27
|
+
__implReactify: typeof import("./reactify");
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
const __CFG__: Config & AdhocConfig;
|
|
31
|
+
}
|
|
32
|
+
declare const ready: Promise<MMaps3>;
|
|
33
|
+
export { mappableImport as import, ready };
|
package/main.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MMapEntity } from "../../../imperative/MMapEnities";
|
|
2
|
+
/**
|
|
3
|
+
* MMapOpenMapsButton props
|
|
4
|
+
*/
|
|
5
|
+
type MMapOpenMapsButtonProps = {
|
|
6
|
+
/** Button title */
|
|
7
|
+
title?: string;
|
|
8
|
+
};
|
|
9
|
+
declare class MMapOpenMapsButton extends MMapEntity<MMapOpenMapsButtonProps> {
|
|
10
|
+
}
|
|
11
|
+
export { MMapOpenMapsButton, MMapOpenMapsButtonProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MMapOpenMapsButton";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MMapComplexEntity } from "../../../imperative/MMapEnities";
|
|
2
|
+
type MMapCustomDomLayerProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
zIndex: number;
|
|
5
|
+
};
|
|
6
|
+
declare class MMapCustomDomLayer extends MMapComplexEntity<MMapCustomDomLayerProps> {
|
|
7
|
+
constructor(props: MMapCustomDomLayerProps);
|
|
8
|
+
}
|
|
9
|
+
export { MMapCustomDomLayer, MMapCustomDomLayerProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MMapComplexEntity } from "../../../imperative/MMapEnities";
|
|
2
|
+
import type { MMapFeatureEditorProps } from "./interface";
|
|
3
|
+
import { MMapFeatureEditorDefaultPreviewPoint } from "./MMapFeatureEditorDefaultPreviewPoint";
|
|
4
|
+
import { MMapFeatureEditorDefaultPoint } from "./MMapFeatureEditorDefaultPoint";
|
|
5
|
+
declare const defaultProps: Readonly<{
|
|
6
|
+
isActive: true;
|
|
7
|
+
featureStyle: {};
|
|
8
|
+
prefix: "EDITOR";
|
|
9
|
+
zIndex: 2600;
|
|
10
|
+
pointZIndex: 1900;
|
|
11
|
+
previewPointZIndex: 1800;
|
|
12
|
+
previewPointElement: MMapFeatureEditorDefaultPreviewPoint;
|
|
13
|
+
renderPoint: () => MMapFeatureEditorDefaultPoint;
|
|
14
|
+
}>;
|
|
15
|
+
type DefaultProps = typeof defaultProps;
|
|
16
|
+
declare class MMapFeatureEditor extends MMapComplexEntity<MMapFeatureEditorProps, DefaultProps> {
|
|
17
|
+
static defaultProps: Readonly<{
|
|
18
|
+
isActive: true;
|
|
19
|
+
featureStyle: {};
|
|
20
|
+
prefix: "EDITOR";
|
|
21
|
+
zIndex: 2600;
|
|
22
|
+
pointZIndex: 1900;
|
|
23
|
+
previewPointZIndex: 1800;
|
|
24
|
+
previewPointElement: MMapFeatureEditorDefaultPreviewPoint;
|
|
25
|
+
renderPoint: () => MMapFeatureEditorDefaultPoint;
|
|
26
|
+
}>;
|
|
27
|
+
private _previewPoint;
|
|
28
|
+
private _draggingPoint;
|
|
29
|
+
private _getName;
|
|
30
|
+
private _getZIndex;
|
|
31
|
+
private shape;
|
|
32
|
+
private line;
|
|
33
|
+
constructor(props: MMapFeatureEditorProps);
|
|
34
|
+
protected __implGetDefaultProps(): DefaultProps;
|
|
35
|
+
private _updatePreviewPoint;
|
|
36
|
+
private _updateDraggingPoint;
|
|
37
|
+
protected _onUpdate({ points, geometry, featureStyle, isActive, prefix, zIndex }: Partial<MMapFeatureEditorProps>): void;
|
|
38
|
+
private _markers;
|
|
39
|
+
private _upsertMarker;
|
|
40
|
+
private _previewMarker;
|
|
41
|
+
private _upsertPreviewPoint;
|
|
42
|
+
private handleLayerClick;
|
|
43
|
+
private handlePointClick;
|
|
44
|
+
private handlePointDblClick;
|
|
45
|
+
private _handleDragStart;
|
|
46
|
+
private handlePreviewDragStart;
|
|
47
|
+
private handleDragMove;
|
|
48
|
+
private handlePreviewDragMove;
|
|
49
|
+
private handleMouseMove;
|
|
50
|
+
private handlePreviewPointClick;
|
|
51
|
+
private _handleDragEnd;
|
|
52
|
+
}
|
|
53
|
+
export declare function getCorrectName(prefix: string, postfix: string): string;
|
|
54
|
+
export declare function getCorrectZIndex(zIndex: number, offset: number): number;
|
|
55
|
+
export { MMapFeatureEditor, MMapFeatureEditorProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DomEntity } from "../../../imperative/DomContext";
|
|
2
|
+
declare class MMapFeatureEditorDefaultPoint extends DomEntity<{}> {
|
|
3
|
+
protected _createDom(): {
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
container: HTMLElement;
|
|
6
|
+
};
|
|
7
|
+
protected _updateDom(): void;
|
|
8
|
+
}
|
|
9
|
+
export { MMapFeatureEditorDefaultPoint };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const DEFAULT_PREFIX = "EDITOR";
|
|
2
|
+
export declare const DEFAULT_Z_INDEX = 2600;
|
|
3
|
+
export declare const DEFAULT_POINT_Z_INDEX = 1900;
|
|
4
|
+
export declare const DEFAULT_PREVIEW_POINT_Z_INDEX = 1800;
|
|
5
|
+
export declare const EVENT_BLOCKER_LAYER_POSTFIX = "EVENT_BLOCKER_LAYER";
|
|
6
|
+
export declare const EVENT_BLOCKER_LAYER_Z_INDEX_OFFSET = 0;
|
|
7
|
+
export declare const FEATURE_POLYGON_SOURCE_POSTFIX = "FEATURE_POLYGON_SOURCE";
|
|
8
|
+
export declare const FEATURE_POLYGON_LAYER_POSTFIX = "FEATURE_POLYGON_LAYER";
|
|
9
|
+
export declare const FEATURE_POLYGON_LAYER_Z_INDEX_OFFSET = 100;
|
|
10
|
+
export declare const FEATURE_LINE_SOURCE_POSTFIX = "FEATURE_LINE_SOURCE";
|
|
11
|
+
export declare const FEATURE_LINE_LAYER_POSTFIX = "FEATURE_LINE_LAYER";
|
|
12
|
+
export declare const FEATURE_LINE_LAYER_Z_INDEX_OFFSET = 200;
|
|
13
|
+
export declare const MARKER_SOURCE_POSTFIX = "MARKER_SOURCE";
|
|
14
|
+
export declare const MARKER_LAYER_POSTFIX = "MARKER_LAYER";
|
|
15
|
+
export declare const MARKER_LAYER_Z_INDEX_OFFSET = 300;
|
|
16
|
+
export declare const LINE_POSTFIX = "LINE";
|
|
17
|
+
export declare const POLYGON_POSTFIX = "POLYGON";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LngLat, DrawingStyle, GenericLineStringGeometry, GenericPolygonGeometry } from "../../../common/types";
|
|
2
|
+
import type { DomEntity } from "../../../imperative/DomContext";
|
|
3
|
+
export type Geometry = GenericPolygonGeometry<LngLat> | GenericLineStringGeometry<LngLat>;
|
|
4
|
+
export interface DraggingPoint {
|
|
5
|
+
point: LngLat;
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PreviewPoint {
|
|
9
|
+
point: LngLat;
|
|
10
|
+
segmentIndex: number;
|
|
11
|
+
}
|
|
12
|
+
export type MMapFeatureEditorProps = {
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
points: LngLat[];
|
|
15
|
+
geometry: Geometry;
|
|
16
|
+
featureStyle?: DrawingStyle;
|
|
17
|
+
renderPoint?: (index: number) => HTMLElement | DomEntity<unknown>;
|
|
18
|
+
previewPointElement?: false | HTMLElement | DomEntity<unknown>;
|
|
19
|
+
onLayerClick?: (coordinates: LngLat, index: number) => void;
|
|
20
|
+
onPointClick?: (index: number) => void;
|
|
21
|
+
onPointDblClick?: (index: number) => void;
|
|
22
|
+
onPointDrag?: (coordinates: LngLat, index: number) => void;
|
|
23
|
+
onPreviewPointClick?: (coordinates: LngLat, index: number) => void;
|
|
24
|
+
onPreviewPointDragStart?: (coordinates: LngLat, index: number) => void;
|
|
25
|
+
onPreviewPointDrag?: (coordinates: LngLat, index: number) => void;
|
|
26
|
+
onDrag?: (newGeometry: Geometry) => void;
|
|
27
|
+
prefix?: string;
|
|
28
|
+
zIndex?: number;
|
|
29
|
+
/** z index of marker point/preview point, defaults to {@link DEFAULT_Z_INDEX} */
|
|
30
|
+
pointZIndex?: number;
|
|
31
|
+
previewPointZIndex?: number;
|
|
32
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LngLat, Projection } from "../../../common/types";
|
|
2
|
+
import type { PreviewPoint } from "./interface";
|
|
3
|
+
declare function getPointWorld(point: LngLat): number;
|
|
4
|
+
declare function findPointProjectionOnLine(projection: Projection, lineCoordinates: LngLat[], point: LngLat, lineWidth: number, zoom: number): PreviewPoint | undefined;
|
|
5
|
+
declare function findIndexForNewPoint(coordinates: LngLat[], points: LngLat[], pointIndex: number): number;
|
|
6
|
+
export { getPointWorld, findIndexForNewPoint, findPointProjectionOnLine, PreviewPoint };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MMapFeatureEditor";
|