@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.
Files changed (125) hide show
  1. package/README.md +25 -0
  2. package/common/index.d.ts +0 -0
  3. package/common/types/behavior.d.ts +1 -0
  4. package/common/types/bounds.d.ts +17 -0
  5. package/common/types/camera.d.ts +8 -0
  6. package/common/types/coordinates.d.ts +30 -0
  7. package/common/types/data-source-description.d.ts +127 -0
  8. package/common/types/easing-function.d.ts +9 -0
  9. package/common/types/geojson.d.ts +58 -0
  10. package/common/types/graphics.d.ts +36 -0
  11. package/common/types/hotspot.d.ts +13 -0
  12. package/common/types/index.d.ts +20 -0
  13. package/common/types/indoor.d.ts +29 -0
  14. package/common/types/layer-description.d.ts +43 -0
  15. package/common/types/lng-lat.d.ts +14 -0
  16. package/common/types/map.d.ts +1 -0
  17. package/common/types/margin.d.ts +8 -0
  18. package/common/types/projection.d.ts +8 -0
  19. package/common/types/tile-data-source.d.ts +0 -0
  20. package/common/types/utils.d.ts +15 -0
  21. package/common/types/vec2.d.ts +14 -0
  22. package/common/types/world-options.d.ts +4 -0
  23. package/common/types/zoom-strategy.d.ts +1 -0
  24. package/common/types/zoom.d.ts +11 -0
  25. package/imperative/DomContext.d.ts +35 -0
  26. package/imperative/Entities.d.ts +120 -0
  27. package/imperative/MMap/index.d.ts +283 -0
  28. package/imperative/MMap/projection.d.ts +2 -0
  29. package/imperative/MMapCollection/index.d.ts +3 -0
  30. package/imperative/MMapControl/MMapControl.d.ts +45 -0
  31. package/imperative/MMapControl/MMapControlButton.d.ts +55 -0
  32. package/imperative/MMapControl/index.d.ts +2 -0
  33. package/imperative/MMapControls/index.d.ts +43 -0
  34. package/imperative/MMapCopyrights/index.d.ts +44 -0
  35. package/imperative/MMapCoverage/index.d.ts +19 -0
  36. package/imperative/MMapDefaultFeaturesLayer/index.d.ts +41 -0
  37. package/imperative/MMapDefaultSatelliteLayer/index.d.ts +41 -0
  38. package/imperative/MMapDefaultSchemeLayer/index.d.ts +92 -0
  39. package/imperative/MMapEnities.d.ts +18 -0
  40. package/imperative/MMapFeature/index.d.ts +66 -0
  41. package/imperative/MMapFeature/types.d.ts +34 -0
  42. package/imperative/MMapFeatureDataSource/index.d.ts +27 -0
  43. package/imperative/MMapHotspot/index.d.ts +11 -0
  44. package/imperative/MMapLayer/index.d.ts +38 -0
  45. package/imperative/MMapListener/index.d.ts +113 -0
  46. package/imperative/MMapMarker/index.d.ts +98 -0
  47. package/imperative/MMapReactContainer/index.d.ts +37 -0
  48. package/imperative/MMapTileDataSource/index.d.ts +57 -0
  49. package/imperative/config.d.ts +6 -0
  50. package/imperative/fetchConfig.d.ts +18 -0
  51. package/imperative/geolocation.d.ts +10 -0
  52. package/imperative/index.d.ts +26 -0
  53. package/imperative/mappableMaps.d.ts +7 -0
  54. package/imperative/route/driving.d.ts +8 -0
  55. package/imperative/route/index.d.ts +54 -0
  56. package/imperative/route/utils.d.ts +21 -0
  57. package/imperative/search.d.ts +83 -0
  58. package/imperative/suggest.d.ts +37 -0
  59. package/imperative/traverse.d.ts +19 -0
  60. package/imperative/utils/deepFreeze.d.ts +2 -0
  61. package/imperative/utils/errorLogger.d.ts +29 -0
  62. package/imperative/utils/id.d.ts +2 -0
  63. package/imperative/utils/index.d.ts +3 -0
  64. package/imperative/utils/jsonp.d.ts +9 -0
  65. package/imperative/utils/metrics.d.ts +16 -0
  66. package/imperative/utils/pEachChunk.d.ts +2 -0
  67. package/imperative/utils/projections/index.d.ts +1 -0
  68. package/imperative/utils/projections/spherical-mercator.d.ts +47 -0
  69. package/imperative/utils/removeUndefined.d.ts +1 -0
  70. package/imperative/utils/requestCoverage.d.ts +10 -0
  71. package/import.d.ts +28 -0
  72. package/index.d.ts +10 -0
  73. package/init.template.d.ts +33 -0
  74. package/main.d.ts +4 -0
  75. package/modules/controls-extra/MMapOpenMapsButton/index.d.ts +11 -0
  76. package/modules/controls-extra/index.d.ts +1 -0
  77. package/modules/editors/MMapFeatureEditor/MMapCustomDomLayer.d.ts +9 -0
  78. package/modules/editors/MMapFeatureEditor/MMapFeatureEditor.d.ts +55 -0
  79. package/modules/editors/MMapFeatureEditor/MMapFeatureEditorDefaultPoint.d.ts +9 -0
  80. package/modules/editors/MMapFeatureEditor/MMapFeatureEditorDefaultPreviewPoint.d.ts +6 -0
  81. package/modules/editors/MMapFeatureEditor/defaults.d.ts +17 -0
  82. package/modules/editors/MMapFeatureEditor/index.d.ts +2 -0
  83. package/modules/editors/MMapFeatureEditor/interface.d.ts +32 -0
  84. package/modules/editors/MMapFeatureEditor/math.d.ts +6 -0
  85. package/modules/editors/index.d.ts +1 -0
  86. package/modules/index.d.ts +0 -0
  87. package/modules/types.d.ts +7 -0
  88. package/modules/utils/MMapCursor/index.d.ts +28 -0
  89. package/modules/utils/index.d.ts +1 -0
  90. package/package.json +20 -0
  91. package/packages/cartesian-projection/index.d.ts +49 -0
  92. package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +108 -0
  93. package/packages/clusterer/MMapClusterer/constants.d.ts +1 -0
  94. package/packages/clusterer/MMapClusterer/helpers/throttle.d.ts +17 -0
  95. package/packages/clusterer/MMapClusterer/index.d.ts +3 -0
  96. package/packages/clusterer/MMapClusterer/interface.d.ts +31 -0
  97. package/packages/clusterer/MMapClusterer/methods/clusterByGrid.d.ts +4 -0
  98. package/packages/clusterer/MMapClusterer/methods/index.d.ts +1 -0
  99. package/packages/clusterer/MMapClusterer/react/MMapClusterer.d.ts +44 -0
  100. package/packages/clusterer/index.d.ts +1 -0
  101. package/packages/clusterer/react/index.d.ts +3 -0
  102. package/packages/controls/MMapGeolocationControl/MMapControlSpinner/index.d.ts +6 -0
  103. package/packages/controls/MMapGeolocationControl/index.d.ts +54 -0
  104. package/packages/controls/MMapZoomControl/index.d.ts +45 -0
  105. package/packages/controls/index.d.ts +2 -0
  106. package/packages/controls/react/index.d.ts +3 -0
  107. package/packages/external.d.ts +2 -0
  108. package/packages/hint/MMapHint/index.d.ts +57 -0
  109. package/packages/hint/index.d.ts +1 -0
  110. package/packages/hint/react/index.d.ts +3 -0
  111. package/packages/index.d.ts +0 -0
  112. package/packages/markers/MMapDefaultMarker/index.d.ts +77 -0
  113. package/packages/markers/MMapDefaultMarker/react/MMapDefaultMarker.d.ts +8 -0
  114. package/packages/markers/index.d.ts +1 -0
  115. package/packages/markers/react/index.d.ts +3 -0
  116. package/packages/spherical-mercator-projection/index.d.ts +38 -0
  117. package/packages/types.d.ts +11 -0
  118. package/react/index.d.ts +7 -0
  119. package/reactify/index.d.ts +10 -0
  120. package/reactify/overrides/MMap.d.ts +18 -0
  121. package/reactify/overrides/MMapControl.d.ts +11 -0
  122. package/reactify/overrides/MMapMarker.d.ts +11 -0
  123. package/reactify/overrides/MMapReactContainer.d.ts +6 -0
  124. package/reactify/overrides/index.d.ts +4 -0
  125. package/reactify/reactify.d.ts +43 -0
@@ -0,0 +1,41 @@
1
+ import { MMapComplexEntity } from "../MMapEnities";
2
+ /**
3
+ * MMapDefaultSatelliteLayer props
4
+ */
5
+ type MMapDefaultSatelliteLayerProps = {
6
+ /** Should show layer */
7
+ visible?: boolean;
8
+ };
9
+ declare const defaultProps: {
10
+ readonly visible: true;
11
+ readonly source: "mappable-default-satellite";
12
+ };
13
+ type DefaultProps = typeof defaultProps;
14
+ /**
15
+ * Map satellite layer to show satellite tiles on map.
16
+ *
17
+ * @example
18
+ * ```javascript
19
+ * const defaultSatelliteLayer = new MMapDefaultSatelliteLayer();
20
+ * // add to map
21
+ * map.addChild(defaultSatelliteLayer);
22
+ * // update
23
+ * defaultSatelliteLayer.update({visible: false});
24
+ * ```
25
+ */
26
+ declare class MMapDefaultSatelliteLayer extends MMapComplexEntity<MMapDefaultSatelliteLayerProps, DefaultProps> {
27
+ static defaultProps: {
28
+ readonly visible: true;
29
+ readonly source: "mappable-default-satellite";
30
+ };
31
+ private _dataSource?;
32
+ private _layer?;
33
+ private _unwatchMapContext?;
34
+ protected __implGetDefaultProps(): DefaultProps;
35
+ protected _onAttach(): void;
36
+ protected _onDetach(): void;
37
+ protected _onUpdate(propsDiff: Partial<MMapDefaultSatelliteLayerProps>): void;
38
+ private _createTileUrl;
39
+ private _getDataSourceDescription;
40
+ }
41
+ export { MMapDefaultSatelliteLayer, MMapDefaultSatelliteLayerProps };
@@ -0,0 +1,92 @@
1
+ import type { VectorCustomization } from "../../common/types";
2
+ import { MMapComplexEntity } from "../MMapEnities";
3
+ /**
4
+ * MMapDefaultSchemeLayer props
5
+ */
6
+ type MMapDefaultSchemeLayerProps = {
7
+ /** Should show layer */
8
+ visible?: boolean;
9
+ /** Vector tiles customization. Not allowed on a free tariff. */
10
+ customization?: VectorCustomization;
11
+ /**
12
+ * Should to fetch hotspots
13
+ * @internal
14
+ */
15
+ hotspotsEnabled?: boolean;
16
+ /** Theme applied to the scheme */
17
+ theme?: "dark" | "light";
18
+ };
19
+ declare const defaultProps: {
20
+ visible: boolean;
21
+ source: string;
22
+ /** @internal */
23
+ hotspotsEnabled: boolean;
24
+ layersInfo: {
25
+ ground: {
26
+ type: string;
27
+ zIndex: number;
28
+ };
29
+ buildings: {
30
+ type: string;
31
+ zIndex: number;
32
+ };
33
+ icons: {
34
+ type: string;
35
+ zIndex: number;
36
+ };
37
+ labels: {
38
+ type: string;
39
+ zIndex: number;
40
+ };
41
+ };
42
+ };
43
+ type DefaultProps = typeof defaultProps;
44
+ /**
45
+ * Map default layer to show mappable scheme on map.
46
+ *
47
+ * @example
48
+ * ```javascript
49
+ * const defaultSchemeLayer = new MMapDefaultSchemeLayer({theme: 'dark'});
50
+ * // add to map
51
+ * map.addChild(defaultSchemeLayer);
52
+ * // update
53
+ * defaultSchemeLayer.update({theme: 'light'});
54
+ * ```
55
+ */
56
+ declare class MMapDefaultSchemeLayer extends MMapComplexEntity<MMapDefaultSchemeLayerProps, DefaultProps> {
57
+ static defaultProps: {
58
+ visible: boolean;
59
+ source: string;
60
+ /** @internal */
61
+ hotspotsEnabled: boolean;
62
+ layersInfo: {
63
+ ground: {
64
+ type: string;
65
+ zIndex: number;
66
+ };
67
+ buildings: {
68
+ type: string;
69
+ zIndex: number;
70
+ };
71
+ icons: {
72
+ type: string;
73
+ zIndex: number;
74
+ };
75
+ labels: {
76
+ type: string;
77
+ zIndex: number;
78
+ };
79
+ };
80
+ };
81
+ private _dataSource?;
82
+ private _layers;
83
+ private _unwatchMapContext?;
84
+ protected __implGetDefaultProps(): DefaultProps;
85
+ protected _onAttach(): void;
86
+ protected _onDetach(): void;
87
+ protected _onUpdate(propsDiff: Partial<MMapDefaultSchemeLayerProps>): void;
88
+ private _createTileUrl;
89
+ private _getProjectionQuery;
90
+ private _getDataSourceDescription;
91
+ }
92
+ export { MMapDefaultSchemeLayer, MMapDefaultSchemeLayerProps };
@@ -0,0 +1,18 @@
1
+ import type { MMap } from "./MMap";
2
+ import { GenericComplexEntity, GenericEntity, GenericGroupEntity, Context } from "./Entities";
3
+ declare abstract class MMapEntity<Props, DefaultProps extends {} = {}> extends GenericEntity<Props, DefaultProps, MMap> {
4
+ get root(): null | MMap;
5
+ get parent(): null | MMapComplexEntity<unknown>;
6
+ }
7
+ declare abstract class MMapComplexEntity<Props, DefaultProps extends {} = {}> extends GenericComplexEntity<Props, DefaultProps, MMap> implements MMapEntity<Props, DefaultProps> {
8
+ get root(): null | MMap;
9
+ get parent(): null | MMapComplexEntity<unknown>;
10
+ }
11
+ declare abstract class MMapGroupEntity<Props, DefaultProps extends {} = {}> extends GenericGroupEntity<Props, DefaultProps, MMap> implements MMapComplexEntity<Props, DefaultProps> {
12
+ get root(): null | MMap;
13
+ get parent(): null | MMapComplexEntity<unknown>;
14
+ readonly children: readonly MMapEntity<unknown>[];
15
+ addChild(child: MMapEntity<unknown>, index?: number): this;
16
+ removeChild(child: MMapEntity<unknown>): this;
17
+ }
18
+ export { MMapEntity, MMapComplexEntity, MMapGroupEntity, Context as MMapContext };
@@ -0,0 +1,66 @@
1
+ import type { DrawingStyle, GenericGeometry, LngLat } from "../../common/types";
2
+ import type { DraggableProps, FeatureClickEvents } from "./types";
3
+ import { MMapEntity } from "../MMapEnities";
4
+ import type { Geometry, MMapFeatureEventHandler } from "./types";
5
+ /**
6
+ * MMapFeature props
7
+ */
8
+ type MMapFeatureProps = {
9
+ id?: string;
10
+ geometry: Geometry;
11
+ source?: string;
12
+ style?: DrawingStyle;
13
+ properties?: Record<string, unknown>;
14
+ } & DraggableProps<MMapFeatureEventHandler> & FeatureClickEvents;
15
+ declare const defaultProps: Readonly<{
16
+ source: "mappable-default-feature";
17
+ }>;
18
+ type DefaultProps = typeof defaultProps & {
19
+ id: string;
20
+ };
21
+ /**
22
+ * The feature component on the map.
23
+ *
24
+ * @example
25
+ * ```javascript
26
+ * const feature = new MMapFeature({
27
+ * geometry: {
28
+ * type: 'LineString',
29
+ * coordinates: [
30
+ * [37.40108963847453, 55.70173382087952],
31
+ * [37.60954231796791, 55.57717912610197]
32
+ * ]
33
+ * },
34
+ * style: {
35
+ * stroke: [{width: 12, color: 'rgb(14, 194, 219)'}]
36
+ * }})
37
+ * map
38
+ * .addChild(new MMapDefaultSchemeLayer())
39
+ * .addChild(new MMapDefaultFeaturesLayer())
40
+ * .addChild(feature);
41
+ * ```
42
+ */
43
+ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
44
+ static defaultProps: Readonly<{
45
+ source: "mappable-default-feature";
46
+ }>;
47
+ private static _uid;
48
+ private _id;
49
+ private _source;
50
+ private _isDragging;
51
+ constructor(props: MMapFeatureProps);
52
+ get properties(): Record<string, unknown> | undefined;
53
+ get geometry(): GenericGeometry<LngLat>;
54
+ protected _onAttach(): void;
55
+ protected _onDetach(): void;
56
+ protected _onUpdate({ style, id, source }: Partial<MMapFeatureProps>): void;
57
+ protected __implGetDefaultProps(): DefaultProps;
58
+ private __onDragStart;
59
+ private __onDragMove;
60
+ private __onDragEnd;
61
+ private __onClick;
62
+ private __onDoubleClick;
63
+ private __onFastClick;
64
+ private __isMy;
65
+ }
66
+ export { MMapFeature, MMapFeatureProps };
@@ -0,0 +1,34 @@
1
+ import type { LineStringGeometry, Margin, MultiLineStringGeometry, MultiPolygonGeometry, PointGeometry, PolygonGeometry } from "../../common/types";
2
+ export interface DraggableProps<Callback> {
3
+ /** Feature can be draggable */
4
+ draggable?: boolean;
5
+ /** Will map center follows marker on drag if marker near the edge of the map */
6
+ mapFollowsOnDrag?: boolean | {
7
+ activeZoneMargin?: Margin;
8
+ };
9
+ /** Fires on drag start */
10
+ onDragStart?: Callback;
11
+ /**
12
+ * Maybe a function which will be called when the user drags and drops the element to a new position in the map.
13
+ * The arguments to the function will be with new coordinates.
14
+ * A component using with component should immediately store the new coordinates into its state and then pass
15
+ * the new coordinates as the marker's props.
16
+ * */
17
+ onDragEnd?: Callback;
18
+ /** Fires on drag move */
19
+ onDragMove?: Callback;
20
+ /** Will block maps events on marker */
21
+ blockEvents?: boolean;
22
+ /** Will block maps behaviors on marker */
23
+ blockBehaviors?: boolean;
24
+ }
25
+ export interface FeatureClickEvents {
26
+ /** Double click handler */
27
+ onDoubleClick?: (event: MouseEvent) => void;
28
+ /** Click handler */
29
+ onClick?: (event: MouseEvent) => void;
30
+ /** Fast click handler */
31
+ onFastClick?: (event: MouseEvent) => void;
32
+ }
33
+ export type Geometry = PolygonGeometry | MultiPolygonGeometry | LineStringGeometry | MultiLineStringGeometry | PointGeometry;
34
+ export type MMapFeatureEventHandler = (coordinates: Geometry['coordinates']) => void | false;
@@ -0,0 +1,27 @@
1
+ import { MMapEntity } from "../MMapEnities";
2
+ /**
3
+ * MMapFeatureDataSource props
4
+ */
5
+ type MMapFeatureDataSourceProps = {
6
+ /** Data source id */
7
+ id: string;
8
+ };
9
+ /**
10
+ * Map geojson data source. Used to upload objects to the map in geojson format
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * const ID = 'id';
15
+ * const dataSource = new MMapFeatureDataSource({id: ID});
16
+ * const layer = new MMapLayer({source: ID, type: 'features', zIndex: 10});
17
+ * map
18
+ * .addChild(dataSource)
19
+ * .addChild(layer);
20
+ * ```
21
+ */
22
+ declare class MMapFeatureDataSource extends MMapEntity<MMapFeatureDataSourceProps> {
23
+ protected _onAttach(): void;
24
+ protected _onDetach(): void;
25
+ protected _onUpdate(): void;
26
+ }
27
+ export { MMapFeatureDataSource, MMapFeatureDataSourceProps };
@@ -0,0 +1,11 @@
1
+ import type { GenericGeometry, LngLat } from "../../common/types";
2
+ /**
3
+ * This is not a real MMapEntity, it cannot be added to the map.
4
+ * But you can check it by `instance of` in MMapListener handlers
5
+ */
6
+ declare class MMapHotspot {
7
+ readonly geometry?: GenericGeometry<LngLat>;
8
+ readonly properties: Record<string, unknown>;
9
+ constructor(geometry: GenericGeometry<LngLat> | undefined, properties: Record<string, unknown>);
10
+ }
11
+ export { MMapHotspot };
@@ -0,0 +1,38 @@
1
+ import type { RasterLayerOptions } from "../../common/types";
2
+ import { MMapEntity } from "../MMapEnities";
3
+ /**
4
+ * MMapLayer props
5
+ */
6
+ type MMapLayerProps = {
7
+ /** Layer id */
8
+ id?: string;
9
+ /** Layer source */
10
+ source: string;
11
+ /** Layer type. For tile data sources should use 'ground' */
12
+ type: string;
13
+ /** Layer z-index to control order. Default is 1500 */
14
+ zIndex?: number;
15
+ /** Layer options */
16
+ options?: {
17
+ raster?: RasterLayerOptions;
18
+ };
19
+ };
20
+ declare const defaultProps: Readonly<{
21
+ zIndex: 1500;
22
+ }>;
23
+ type DefaultProps = typeof defaultProps & {
24
+ id: string;
25
+ };
26
+ /**
27
+ * Map layer.
28
+ */
29
+ declare class MMapLayer extends MMapEntity<MMapLayerProps, DefaultProps> {
30
+ static defaultProps: Readonly<{
31
+ zIndex: 1500;
32
+ }>;
33
+ protected __implGetDefaultProps(props: MMapLayerProps): DefaultProps;
34
+ protected _onAttach(): void;
35
+ protected _onDetach(): void;
36
+ protected _onUpdate(): void;
37
+ }
38
+ export { MMapLayer, MMapLayerProps };
@@ -0,0 +1,113 @@
1
+ import type { IndoorPlan, PixelCoordinates } from "../../common/types";
2
+ import { MMapFeature } from "../MMapFeature";
3
+ import { MMapMarker } from "../MMapMarker";
4
+ import type { BehaviorType, LngLat } from "../../common/types";
5
+ import { MMapEntity } from "../MMapEnities";
6
+ import { MMapHotspot } from "../MMapHotspot";
7
+ import type { MMapCamera, MMapLocation } from "../MMap";
8
+ export interface DomEvent {
9
+ coordinates: LngLat;
10
+ screenCoordinates: [
11
+ number,
12
+ number
13
+ ];
14
+ }
15
+ type HandlerEntity<TType extends string, TEntity> = {
16
+ type: TType;
17
+ entity: TEntity;
18
+ };
19
+ export type DomEventHandlerObject = HandlerEntity<"feature", MMapFeature> | HandlerEntity<"marker", MMapMarker> | HandlerEntity<"hotspot", MMapHotspot> | undefined;
20
+ export type DomEventHandler = (object: DomEventHandlerObject, event: DomEvent) => void;
21
+ type Location = Required<MMapLocation>;
22
+ interface UpdateObject {
23
+ type: "update";
24
+ location: Location;
25
+ camera: MMapCamera;
26
+ mapInAction: boolean;
27
+ }
28
+ interface ResizeObject {
29
+ type: "resize";
30
+ size: Readonly<PixelCoordinates>;
31
+ mapInAction: boolean;
32
+ }
33
+ type MapEventHandler<TObject> = (object: TObject) => void;
34
+ export type MapEventUpdateHandler = MapEventHandler<UpdateObject>;
35
+ export type MapEventResizeHandler = MapEventHandler<ResizeObject>;
36
+ export type IndoorPlansHandler = (object: {
37
+ type: IndoorPlanType;
38
+ indoorPlans: readonly IndoorPlan[] | null;
39
+ }) => void;
40
+ export type BehaviorMapEventHandler = (object: {
41
+ type: BehaviorType;
42
+ location: Location;
43
+ camera: MMapCamera;
44
+ }) => void;
45
+ export type DomEvents = {
46
+ onTouchStart: DomEventHandler;
47
+ onTouchMove: DomEventHandler;
48
+ onTouchEnd: DomEventHandler;
49
+ onTouchCancel: DomEventHandler;
50
+ onPointerDown: DomEventHandler;
51
+ onPointerMove: DomEventHandler;
52
+ onPointerUp: DomEventHandler;
53
+ onPointerCancel: DomEventHandler;
54
+ onFastClick: DomEventHandler;
55
+ onClick: DomEventHandler;
56
+ onDblClick: DomEventHandler;
57
+ onMouseUp: DomEventHandler;
58
+ onMouseDown: DomEventHandler;
59
+ onMouseEnter: DomEventHandler;
60
+ onMouseLeave: DomEventHandler;
61
+ onMouseMove: DomEventHandler;
62
+ onContextMenu: DomEventHandler;
63
+ onRightDblClick: DomEventHandler;
64
+ };
65
+ export type MapEvents = {
66
+ onUpdate: MapEventUpdateHandler;
67
+ onResize: MapEventResizeHandler;
68
+ /** @internal */
69
+ onIndoorPlansChanged: IndoorPlansHandler;
70
+ };
71
+ export type BehaviorEvents = {
72
+ onActionStart: BehaviorMapEventHandler;
73
+ onActionEnd: BehaviorMapEventHandler;
74
+ };
75
+ type IndoorPlanType = "indoorPlansChanged";
76
+ export type NullablePartial<T> = {
77
+ [P in keyof T]?: T[P] | null;
78
+ };
79
+ type DomEventsProps = Partial<DomEvents> & {
80
+ layer?: string;
81
+ };
82
+ type MMapListenerProps = DomEventsProps | NullablePartial<MapEvents> | NullablePartial<BehaviorEvents>;
83
+ /**
84
+ * A component for handling events of the map and its child elements. DOM events are also hung through this component.
85
+ * @example
86
+ * ```javascript
87
+ * const clickCallback = () => alert("Clicked!");
88
+ *
89
+ * const mapListener = new MMapListener({
90
+ * layerId: "any",
91
+ * onClick: clickCallback,
92
+ * });
93
+ *
94
+ * map.addChild(mapListener);
95
+ * ```
96
+ * @see [More about events](https://mappable.world/docs/jsapi/dg/concepts/events.html)
97
+ */
98
+ declare class MMapListener extends MMapEntity<MMapListenerProps> {
99
+ private _domHandlers;
100
+ private _mapHandlers;
101
+ private _behaviorsHandlers;
102
+ private _subscribeDomEvent;
103
+ private _subscribeMapEvent;
104
+ private _subscribeMapIndoorPlansEvent;
105
+ private _subscribeActionEvent;
106
+ private _subscribe;
107
+ private _unsubscribe;
108
+ protected _onAttach(): void;
109
+ protected _onDetach(): void;
110
+ protected _onUpdate(): void;
111
+ private __getRealCookie;
112
+ }
113
+ export { MMapListener, MMapListenerProps };
@@ -0,0 +1,98 @@
1
+ import type { LngLat } from "../../common/types";
2
+ import type { DraggableProps, FeatureClickEvents } from "../MMapFeature/types";
3
+ import { reactify } from "../../reactify";
4
+ import { MMapGroupEntity } from "../MMapEnities";
5
+ /**
6
+ * MMapMarker events handler
7
+ */
8
+ type MMapMarkerEventHandler = (coordinates: LngLat) => void | false;
9
+ /**
10
+ * MMapMarker props
11
+ */
12
+ type MMapMarkerProps = {
13
+ /** Coordinates of the marker */
14
+ coordinates: LngLat;
15
+ source?: string;
16
+ /** z index of the marker, defaults to 0 */
17
+ zIndex?: number;
18
+ properties?: Record<string, unknown>;
19
+ id?: string;
20
+ } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents;
21
+ declare const defaultProps: Readonly<{
22
+ draggable: false;
23
+ mapFollowsOnDrag: false;
24
+ blockEvents: false;
25
+ blockBehaviors: false;
26
+ zIndex: 0;
27
+ source: "mappable-default-feature";
28
+ }>;
29
+ type DefaultProps = typeof defaultProps;
30
+ /**
31
+ * The marker component on the map. Allows you to insert your own DOM implementation of the marker.
32
+ * > Does not provide a default implementation. See [[MMapDefaultMarker]]
33
+ *
34
+ * @example
35
+ * ```javascript
36
+ * const content = document.createElement('div');
37
+ * content.innerHTML = '<p>Draggable paragraph</p>';
38
+ * map.addChild(new MMapDefaultFeaturesLayer({zIndex: 1800}))
39
+ * map.addChild(new MMapMarker({
40
+ * coordinates: [37, 55],
41
+ * draggable: true
42
+ * }, content));
43
+ *```
44
+ * > Note: to insert a marker on the map, you need a [[MMapLayer]] layer with type 'markers'.
45
+ * The example above uses [[MMapDefaultFeaturesLayer]], which automatically adds the layer and the required datasource.
46
+ */
47
+ declare class MMapMarker extends MMapGroupEntity<MMapMarkerProps, DefaultProps> {
48
+ static defaultProps: Readonly<{
49
+ draggable: false;
50
+ mapFollowsOnDrag: false;
51
+ blockEvents: false;
52
+ blockBehaviors: false;
53
+ zIndex: 0;
54
+ source: "mappable-default-feature";
55
+ }>;
56
+ /** @internal */
57
+ static [reactify.overrideKey]: import("../../reactify/reactify").CustomReactify<MMapMarker, import("react").ForwardRefExoticComponent<{
58
+ /** Coordinates of the marker */
59
+ coordinates: LngLat;
60
+ source?: string | undefined;
61
+ /** z index of the marker, defaults to 0 */
62
+ zIndex?: number | undefined;
63
+ properties?: Record<string, unknown> | undefined;
64
+ id?: string | undefined;
65
+ } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents & {
66
+ markerElement?: HTMLElement | undefined;
67
+ } & {
68
+ children?: import("react").ReactNode;
69
+ } & import("react").RefAttributes<import("../Entities").GenericEntity<{
70
+ /** Coordinates of the marker */
71
+ coordinates: LngLat;
72
+ source?: string | undefined;
73
+ /** z index of the marker, defaults to 0 */
74
+ zIndex?: number | undefined;
75
+ properties?: Record<string, unknown> | undefined;
76
+ id?: string | undefined;
77
+ } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents & {
78
+ markerElement?: HTMLElement | undefined;
79
+ }, {}, import("../Entities").GenericRootEntity<unknown, {}>>>>>;
80
+ readonly element: HTMLElement;
81
+ private _destroyDomCtx?;
82
+ constructor(props: MMapMarkerProps, element?: HTMLElement);
83
+ protected _getDefaultProps(): Readonly<{
84
+ draggable: false;
85
+ mapFollowsOnDrag: false;
86
+ blockEvents: false;
87
+ blockBehaviors: false;
88
+ zIndex: 0;
89
+ source: "mappable-default-feature";
90
+ }>;
91
+ private __feature;
92
+ get properties(): Record<string, unknown> | undefined;
93
+ get coordinates(): LngLat;
94
+ _onAttach(): void;
95
+ _onDetach(): void;
96
+ protected _onUpdate({ coordinates, zIndex, ...props }: Partial<MMapMarkerProps>): void;
97
+ }
98
+ export { MMapMarker, MMapMarkerProps, MMapMarkerEventHandler };
@@ -0,0 +1,37 @@
1
+ import type TReact from "react";
2
+ import type { Context } from "../Entities";
3
+ import { reactify } from "../../reactify";
4
+ import { MMapGroupEntity } from "../MMapEnities";
5
+ interface MMapReactContainerPropsImpl<TContext> {
6
+ onElement: (element?: Element) => void;
7
+ onContext: (context?: TContext) => void;
8
+ }
9
+ interface MMapReactContainerProps<TContext> {
10
+ tagName?: string;
11
+ className?: string;
12
+ style?: TReact.CSSProperties;
13
+ context?: Context<TContext>;
14
+ }
15
+ declare const defaultProps: {
16
+ tagName: string;
17
+ };
18
+ type DefaultProps = typeof defaultProps;
19
+ type ComputedMMapReactContainerProps<TContext> = MMapReactContainerProps<TContext> & MMapReactContainerPropsImpl<TContext>;
20
+ declare class MMapReactContainer extends MMapGroupEntity<ComputedMMapReactContainerProps<unknown>, DefaultProps> {
21
+ static defaultProps: {
22
+ tagName: string;
23
+ };
24
+ /** @internal */
25
+ static [reactify.overrideKey]: import("../../reactify/reactify").CustomReactify<MMapReactContainer, TReact.FC<MMapReactContainerProps<unknown> & {
26
+ children?: TReact.ReactNode;
27
+ }>>;
28
+ element?: Element;
29
+ private _detachDom?;
30
+ private _disposeWatch?;
31
+ protected __implGetDefaultProps(): DefaultProps;
32
+ protected _onAttach(): void;
33
+ private _adjustContext;
34
+ protected _onDetach(): void;
35
+ protected _onUpdate(props: Partial<ComputedMMapReactContainerProps<unknown>>): void;
36
+ }
37
+ export { MMapReactContainer, MMapReactContainerProps, MMapReactContainerPropsImpl };
@@ -0,0 +1,57 @@
1
+ import type { RasterTileDataSourceDescription, ZoomRange } from "../../common/types";
2
+ import { MMapEntity } from "../MMapEnities";
3
+ /**
4
+ * MMapTileDataSource props
5
+ */
6
+ type MMapTileDataSourceProps = {
7
+ /** Data source id */
8
+ id: string;
9
+ /** Min and max zoom for tiles */
10
+ zoomRange?: ZoomRange;
11
+ /**
12
+ * Restrict min and max map zoom.
13
+ * Result map zoomRange will be the intersection of the map zoomRange
14
+ * and all data sources with the clampMapZoom option enabled
15
+ **/
16
+ clampMapZoom?: boolean;
17
+ /** Raster data source description */
18
+ raster?: RasterTileDataSourceDescription;
19
+ /** Data source copyrights */
20
+ copyrights?: string[];
21
+ };
22
+ /**
23
+ * Create map tile data source.
24
+ *
25
+ * @example
26
+ * ```javascript
27
+ * const layer = new MMapLayer({
28
+ * id: 'layer-source-ground',
29
+ * source: 'source',
30
+ * type: 'ground',
31
+ * raster: {
32
+ * awaitAllTilesOnFirstDisplay: true
33
+ * }
34
+ * });
35
+ * const map = new MMap(ref.current, {
36
+ * location: [37.622504, 55.753215],
37
+ * mode: 'vector'
38
+ * });
39
+ * map.addChild(new MMapTileDataSource({
40
+ * id: 'source',
41
+ * raster: {
42
+ * type: 'ground',
43
+ * fetchTile: 'https://my.host.example/tiles?x={{x}}&y={{y}}&z={{z}}&scale={{scale}}'
44
+ * },
45
+ * zoomRange: {min: 0, max: 19},
46
+ * clampMapZoom: true
47
+ * }));
48
+ * map.addChild(layer);
49
+ * ```
50
+ */
51
+ declare class MMapTileDataSource extends MMapEntity<MMapTileDataSourceProps> {
52
+ private _id?;
53
+ protected _onAttach(): void;
54
+ protected _onDetach(): void;
55
+ protected _onUpdate(props: Partial<MMapTileDataSourceProps>): void;
56
+ }
57
+ export { MMapTileDataSource, MMapTileDataSourceProps };
@@ -0,0 +1,6 @@
1
+ export class Config {
2
+ }
3
+ export type ConfigMeta = {
4
+ hosts: {};
5
+ };
6
+ export type ConfigMetaMetrics = {};
@@ -0,0 +1,18 @@
1
+ import { Config } from "./config";
2
+ /**
3
+ * Request options
4
+ */
5
+ export type FetchConfigOptions = {
6
+ /** Language */
7
+ lang: string;
8
+ /** Signal to abort request */
9
+ signal?: AbortSignal;
10
+ };
11
+ /**
12
+ * Requests config which is necessary for a map construction
13
+ *
14
+ * @param {FetchConfigOptions} options Request options
15
+ * @param {Config} config Current config
16
+ * @returns {Promise<Config>} config for map construction
17
+ */
18
+ export declare function fetchConfig(options: FetchConfigOptions, config?: Config | undefined): Promise<Config>;
@@ -0,0 +1,10 @@
1
+ import type { LngLat } from "../common/types";
2
+ import { Config } from "./config";
3
+ declare const geolocation: {
4
+ getPosition: typeof getPosition;
5
+ };
6
+ export declare function getPosition(options?: PositionOptions, config?: Config | undefined): Promise<{
7
+ coords: LngLat;
8
+ accuracy?: number;
9
+ }>;
10
+ export { geolocation };