@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
File without changes
@@ -0,0 +1,7 @@
1
+ import "../import";
2
+ declare module "../import" {
3
+ interface Import {
4
+ (pkg: "@mappable/mappable-controls-extra"): Promise<typeof import("./controls-extra")>;
5
+ (pkg: "@mappable/mappable-reactify"): Promise<typeof import("../reactify")>;
6
+ }
7
+ }
@@ -0,0 +1,28 @@
1
+ import { MMapComplexEntity, MMapEntity } from "../../../imperative/MMapEnities";
2
+ import type { MMapHotspot } from "../../../imperative/MMapHotspot";
3
+ type MMapCursorProps = {
4
+ /** Layer to follow */
5
+ layer?: string;
6
+ /** Cursor to set */
7
+ cursor?: string;
8
+ /** Function to control active cursor state */
9
+ isActive?: (object?: MMapEntity<unknown> | MMapHotspot) => boolean;
10
+ };
11
+ declare const defaultProps: Readonly<{
12
+ layer: "any";
13
+ cursor: "pointer";
14
+ isActive: (object: MMapEntity<unknown> | MMapHotspot) => boolean;
15
+ }>;
16
+ type DefaultProps = typeof defaultProps;
17
+ declare class MMapCursor extends MMapComplexEntity<MMapCursorProps, DefaultProps> {
18
+ static defaultProps: Readonly<{
19
+ layer: "any";
20
+ cursor: "pointer";
21
+ isActive: (object: MMapEntity<unknown, {}> | MMapHotspot) => boolean;
22
+ }>;
23
+ constructor(props: MMapCursorProps);
24
+ protected __implGetDefaultProps(): DefaultProps;
25
+ private _onMouseMove;
26
+ private _onMouseLeave;
27
+ }
28
+ export { MMapCursorProps, MMapCursor };
@@ -0,0 +1 @@
1
+ export * from "./MMapCursor";
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@mappable-world/mappable-types",
3
+ "version": "0.0.1",
4
+ "description": "Types for mappable maps library",
5
+ "main": "",
6
+ "types": "index.d.ts",
7
+ "keywords": [
8
+ "mappable",
9
+ "api",
10
+ "map",
11
+ "mappable",
12
+ "types",
13
+ "js api"
14
+ ],
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org"
17
+ },
18
+ "homepage": "https://mappable.world",
19
+ "license": "MIT"
20
+ }
@@ -0,0 +1,49 @@
1
+ import type { Projection, LngLat, WorldCoordinates } from "../../common/types";
2
+ /**
3
+ * Creates a projection of a rectangular coordinate area into world coordinates.
4
+ * The area size in pixels is always 2*2.
5
+ *
6
+ * @name Cartesian
7
+ * @class Cartesian projection of a rectangular area.
8
+ * @augments Projection
9
+ * @param {[[Number, Number], [Number, Number]]} bounds An array of two points -
10
+ * coordinates of the lower left and upper right corners of the rectangular coordinate area.
11
+ * @param {Boolean[]} [cycled=[false, false]] An array of signs of map looping by x and y.
12
+ * @example
13
+ * ```js
14
+ * mappable.ready(async () => {
15
+ * const {MMaps} = mappable;
16
+ * // Calculate the size of all tiles at the maximum zoom.
17
+ * const worldSize = Math.pow(2, MAX_ZOOM) * 256;
18
+ * const PIC_WIDTH = 2526;
19
+ * const PIC_HEIGHT = 1642;
20
+ *
21
+ * const {Cartesian} = await mappable.import('@mappable/mappable-cartesian-projection@0.0.1');
22
+ * // We set as a projection Cartesian. With this calculation, the center of the image will lie in the coordinates [0, 0].
23
+ * const projection = new Cartesian([
24
+ * [-PIC_WIDTH / 2, PIC_HEIGHT / 2 - worldSize],
25
+ * [worldSize - PIC_WIDTH / 2, PIC_HEIGHT / 2],
26
+ * ]);
27
+ *
28
+ * const map = new MMaps({
29
+ * //...,
30
+ * projection: projection
31
+ * });
32
+ * });
33
+ * ```
34
+ */
35
+ export declare class Cartesian implements Projection {
36
+ private _bounds;
37
+ private _cycled;
38
+ private _xRange;
39
+ private _yRange;
40
+ constructor(bounds: [
41
+ LngLat,
42
+ LngLat
43
+ ], cycled?: [
44
+ boolean,
45
+ boolean
46
+ ]);
47
+ toWorldCoordinates(point: LngLat): WorldCoordinates;
48
+ fromWorldCoordinates(point: WorldCoordinates): LngLat;
49
+ }
@@ -0,0 +1,108 @@
1
+ import type { MMapEntity } from "../../..";
2
+ import type { LngLat } from "../../../common/types";
3
+ import { reactify } from "../../../reactify";
4
+ import type { ClustererObject, Feature, IClusterMethod } from "./interface";
5
+ /**
6
+ * MMapClusterer props
7
+ */
8
+ type MMapClustererProps = {
9
+ /** Clusterisation method */
10
+ method: IClusterMethod;
11
+ /** Features */
12
+ features: Feature[];
13
+ /** Function to create marker for point*/
14
+ marker: (feature: Feature) => MMapEntity<unknown>;
15
+ /** Function to create marker for cluster*/
16
+ cluster: (coordinates: LngLat, features: Feature[]) => MMapEntity<unknown>;
17
+ /** The amount of time that may be passed before the render method can be called again */
18
+ tickTimeout?: number;
19
+ /** Return false, if you want to override the render */
20
+ onRender?: (clusters: ClustererObject[]) => void | false;
21
+ };
22
+ type DefaultProps = typeof defaultProps;
23
+ declare const defaultProps: Readonly<{
24
+ tickTimeout: 100;
25
+ }>;
26
+ /**
27
+ * Display clustered features on a map.
28
+ *
29
+ * @example
30
+ * ```javascript
31
+ * const clusterer = new MMapClusterer({
32
+ * method: clusterByGrid({gridSize: 64}),
33
+ * features: POINTS,
34
+ * marker: (feature) => new MMapMarker({
35
+ * coordinates: feature.geometry.coordinates,
36
+ * source: 'my-source'
37
+ * }
38
+ * cluster: (coordinates, cluster) => new MMapMarker({
39
+ * coordinates,
40
+ * source: 'my-source'
41
+ * }
42
+ * });
43
+ *
44
+ * map.addChild(new MMapDefaultSchemeLayer())
45
+ * .addChild(new MMapFeatureDataSource({id: 'my-source'}))
46
+ * .addChild(new MMapLayer({source: 'my-source', type: 'markers'}))
47
+ * .addChild(clusterer);
48
+ * ```
49
+ */
50
+ declare class MMapClusterer extends mappable.MMapComplexEntity<MMapClustererProps, DefaultProps> {
51
+ static defaultProps: Readonly<{
52
+ tickTimeout: 100;
53
+ }>;
54
+ /** @internal */
55
+ static [reactify.overrideKey]: import("../../../reactify/reactify").CustomReactify<MMapClusterer, import("react").ForwardRefExoticComponent<MMapClustererProps & {
56
+ marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
57
+ cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
58
+ } & import("react").RefAttributes<MMapEntity<MMapClustererProps & {
59
+ marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
60
+ cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
61
+ }, {}>>>>;
62
+ /** All created entities with cluster id*/
63
+ private _entitiesData;
64
+ /** Viewport entities with cluster id */
65
+ private _visibleEntities;
66
+ /** Store to add entities on a map */
67
+ private _container;
68
+ /** Listener on map update and resize */
69
+ private _mapListener;
70
+ constructor(props: MMapClustererProps);
71
+ /**
72
+ * Compare feature coordinates with bounds
73
+ *
74
+ * @param feature
75
+ * @param bounds
76
+ * @param projection
77
+ * @returns either feature belongs to viewport or not
78
+ */
79
+ private _isVisible;
80
+ /**
81
+ * Get entity from store or create it
82
+ *
83
+ * @param feature
84
+ * @param entityId
85
+ * @param length count of entities in the cluster
86
+ * @returns ready to add to map entity
87
+ */
88
+ private _getEntity;
89
+ /**
90
+ * Generate map of new entities based on returned from method objects
91
+ *
92
+ * @param nextViewportObjects clustered objects
93
+ * @returns map of entities for new render
94
+ */
95
+ private _getVisibleEntities;
96
+ /**
97
+ * Removes unnecessary entities and adds new to the map
98
+ *
99
+ * @param nextVisibleEntities new entities for matching with existing entities
100
+ */
101
+ private _syncVisibleEntities;
102
+ private _render;
103
+ protected __implGetDefaultProps(): DefaultProps;
104
+ protected _onAttach(): void;
105
+ protected _onDetach(): void;
106
+ protected _onUpdate(): void;
107
+ }
108
+ export { MMapClusterer, MMapClustererProps };
@@ -0,0 +1 @@
1
+ export declare const THROTTLE_DEFAULT_TIMEOUT_MS = 100;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Throttles a function and delays its execution, so it's only called at most
3
+ * once within a given time period.
4
+ *
5
+ * @param {Function} fn The function to throttle.
6
+ * @param {number} wait The amount of time that must pass before the function can be called again.
7
+ * @return {Function} The throttled function.
8
+ */
9
+ /**
10
+ * Throttles a function and delays its execution, so it's only called at most
11
+ * once within a given time period.
12
+ *
13
+ * @param {Function} fn The function to throttle.
14
+ * @param {number} wait The amount of time that must pass before the function can be called again.
15
+ * @return {Function} The throttled function.
16
+ */
17
+ export declare const throttle: (fn: Function, wait: number) => (this: any) => void;
@@ -0,0 +1,3 @@
1
+ export * from "./interface";
2
+ export * from "./MMapClusterer";
3
+ export * from "./methods";
@@ -0,0 +1,31 @@
1
+ import type { MMap, MMapEntity } from "../../..";
2
+ import type { LngLat, WorldCoordinates, GenericPointFeature } from "../../../common/types";
3
+ /** Represents object on a map (either cluster or feature) */
4
+ type ClustererObject = {
5
+ world: WorldCoordinates;
6
+ lnglat: LngLat;
7
+ clusterId: string;
8
+ features: Feature[];
9
+ };
10
+ /** Feature to clusterize on a map */
11
+ type Feature = GenericPointFeature<LngLat>;
12
+ /** Cluster that contains cluster or feature and its sum of coordinates */
13
+ type Cluster = {
14
+ sumX: number;
15
+ sumY: number;
16
+ objects: ClustererObject[];
17
+ features: Feature[];
18
+ };
19
+ type ClustersCollection = Map<string, Cluster>;
20
+ /** Props for rendering */
21
+ type RenderProps = {
22
+ map: MMap;
23
+ features: Feature[];
24
+ };
25
+ /** Represents map of entities with its id */
26
+ type EntitiesMap = Record<string, MMapEntity<unknown> | undefined>;
27
+ /** Interface of method class*/
28
+ interface IClusterMethod {
29
+ render(props: RenderProps): ClustererObject[];
30
+ }
31
+ export type { EntitiesMap, ClustersCollection, ClustererObject, Feature, IClusterMethod, RenderProps };
@@ -0,0 +1,4 @@
1
+ import type { IClusterMethod } from "../interface";
2
+ export declare function clusterByGrid({ gridSize }: {
3
+ gridSize: number;
4
+ }): IClusterMethod;
@@ -0,0 +1 @@
1
+ export { clusterByGrid } from "./clusterByGrid";
@@ -0,0 +1,44 @@
1
+ import type TReact from "react";
2
+ import type { LngLat, MMapEntity } from "../../../..";
3
+ import type { CustomReactify } from "../../../../reactify/reactify";
4
+ import type { Feature } from "../interface";
5
+ import type { MMapClusterer as MMapClustererI, MMapClustererProps } from "../MMapClusterer";
6
+ /**
7
+ * Create reactified version of MMapCluster module
8
+ *
9
+ * @example
10
+ * ```jsx
11
+ * <MMap location={LOCATION} ref={x => map = x}>
12
+ * <MMapDefaultSchemeLayer />
13
+ * <MMapFeatureDataSource id="my-source"/>
14
+ * <MMapLayer source="my-source" type="markers" zIndex={1800}/>
15
+ * <MMapClusterer
16
+ * marker={(feature) => <MMapMarker
17
+ * coordinates={feature.geometry.coordinates}
18
+ * source={'my-source'} >
19
+ * <img src={'./pin.svg'}/>
20
+ * </MMapMarker>}
21
+ * cluster={(coordinates, features) => <MMapMarker
22
+ * coordinates={coordinates}
23
+ * source={'my-source'} >
24
+ * <div className="circle">
25
+ * <div className="circle-content">
26
+ * <span className="circle-text">{features.length}</span>
27
+ * </div>
28
+ * </div>
29
+ * </MMapMarker>}
30
+ * method={gridSizedMethod}
31
+ * features={points}
32
+ * />
33
+ * </MMap>
34
+ * ```
35
+ */
36
+ type MMapClustererReactifiedProps = MMapClustererProps & {
37
+ /** Function that returns MMapMarker react component to render marker*/
38
+ marker: (feature: Feature) => TReact.ReactElement;
39
+ /** Function that returns MMapMarker react component to render cluster*/
40
+ cluster: (coordinates: LngLat, features: Feature[]) => TReact.ReactElement;
41
+ };
42
+ type MMapClustererR = TReact.ForwardRefExoticComponent<MMapClustererReactifiedProps & React.RefAttributes<MMapEntity<MMapClustererReactifiedProps>>>;
43
+ export declare const MMapClustererReactifyOverride: CustomReactify<MMapClustererI, MMapClustererR>;
44
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./MMapClusterer/index";
@@ -0,0 +1,3 @@
1
+ type Module = import("../../../reactify").ReactifiedModule<typeof import("../index")>;
2
+ declare const module: Module;
3
+ export = module;
@@ -0,0 +1,6 @@
1
+ declare class MMapControlSpinner extends mappable.MMapComplexEntity<{}> {
2
+ private _detachDom?;
3
+ protected _onAttach(): void;
4
+ protected _onDetach(): void;
5
+ }
6
+ export { MMapControlSpinner };
@@ -0,0 +1,54 @@
1
+ import type { EasingFunctionDescription, LngLat } from "../../../common/types";
2
+ /**
3
+ * MMapGeolocationControl props
4
+ */
5
+ type MMapGeolocationControlProps = {
6
+ /** Geolocation request callback */
7
+ onGeolocatePosition?: (position: LngLat) => void;
8
+ /** Data source id for geolocation placemark */
9
+ source?: string;
10
+ /** Easing function for map location animation */
11
+ easing?: EasingFunctionDescription;
12
+ /** Map location animate duration */
13
+ duration?: number;
14
+ };
15
+ declare const defaultProps: Readonly<{
16
+ duration: 500;
17
+ }>;
18
+ type DefaultProps = typeof defaultProps;
19
+ /**
20
+ * Display geolocation control on a map.
21
+ *
22
+ * @example
23
+ * ```javascript
24
+ * const controls = new MMapControls({position: 'right'});
25
+ * const geolocationControl = new MMapGeolocationControl();
26
+ * controls.addChild(geolocationControl);
27
+ * map.addChild(controls);
28
+ * ```
29
+ */
30
+ declare class MMapGeolocationControl extends mappable.MMapGroupEntity<MMapGeolocationControlProps, DefaultProps> {
31
+ static defaultProps: Readonly<{
32
+ duration: 500;
33
+ }>;
34
+ private _control;
35
+ private _button;
36
+ private _spinner;
37
+ private _marker;
38
+ private _loading;
39
+ private _element;
40
+ private _unwatchMapContext?;
41
+ constructor(props: MMapGeolocationControlProps);
42
+ protected __implGetDefaultProps(): DefaultProps;
43
+ private _timeout;
44
+ private _setLoading;
45
+ private _position;
46
+ private _updatePosition;
47
+ private _handleGeolocationClick;
48
+ protected _onAttach(): void;
49
+ protected _onDetach(): void;
50
+ protected _onUpdate(props: Partial<MMapGeolocationControlProps>): void;
51
+ private _initMarker;
52
+ private _updateMarkerIcon;
53
+ }
54
+ export { MMapGeolocationControl, MMapGeolocationControlProps };
@@ -0,0 +1,45 @@
1
+ import type { EasingFunctionDescription } from "../../../common/types";
2
+ import type { MMapControlCommonButton } from "../../../imperative/MMapControl";
3
+ import type { MMapListener } from "../../../imperative/MMapListener";
4
+ /**
5
+ * MMapZoomControl props
6
+ */
7
+ type MMapZoomControlProps = {
8
+ /** Easing function for map location animation */
9
+ easing?: EasingFunctionDescription;
10
+ /** Map location animate duration */
11
+ duration?: number;
12
+ };
13
+ declare const defaultProps: Readonly<{
14
+ duration: 200;
15
+ }>;
16
+ type DefaultProps = typeof defaultProps;
17
+ /**
18
+ * Display zoom control on a map.
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * const controls = new MMapControls({position: 'right'});
23
+ * const {MMapZoomControl} = await mappable.import('@mappable/mappable-controls@0.0.1');
24
+ * const zoomControl = new MMapZoomControl();
25
+ * controls.addChild(zoomControl);
26
+ * map.addChild(controls);
27
+ * ```
28
+ */
29
+ declare class MMapZoomControl extends mappable.MMapControl<MMapZoomControlProps> {
30
+ static defaultProps: Readonly<{
31
+ duration: 200;
32
+ }>;
33
+ protected _zoomIn: MMapControlCommonButton;
34
+ protected _zoomOut: MMapControlCommonButton;
35
+ protected _listener: MMapListener;
36
+ private _currentZoom;
37
+ constructor(props: MMapZoomControlProps);
38
+ protected __implGetDefaultProps(): DefaultProps;
39
+ private _onMapUpdate;
40
+ private _changeZoom;
41
+ protected _onAttach(): void;
42
+ protected _onDetach(): void;
43
+ protected _onUpdate(props: MMapZoomControlProps): void;
44
+ }
45
+ export { MMapZoomControl, MMapZoomControlProps };
@@ -0,0 +1,2 @@
1
+ export { MMapZoomControl, MMapZoomControlProps } from "./MMapZoomControl";
2
+ export { MMapGeolocationControl, MMapGeolocationControlProps } from "./MMapGeolocationControl";
@@ -0,0 +1,3 @@
1
+ type Module = import("../../../reactify").ReactifiedModule<typeof import("../index")>;
2
+ declare const module: Module;
3
+ export = module;
@@ -0,0 +1,2 @@
1
+ import * as mappable from "../imperative";
2
+ export { mappable };
@@ -0,0 +1,57 @@
1
+ import type TReact from "react";
2
+ import type { MMapFeature, MMapMarker, MMapHotspot } from "../../../imperative";
3
+ import type { CustomReactify } from "../../../reactify/reactify";
4
+ import { reactify } from "../../../reactify";
5
+ type MMapHintProps = {
6
+ hint: (object: MMapFeature | MMapMarker | MMapHotspot | undefined) => unknown;
7
+ };
8
+ declare const MMapHintContext: import("../../../imperative/Entities").Context<unknown>;
9
+ /**
10
+ * Display hint on map elements.
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * const {MMapHint, MMapHintContext} = await mappable.import('@mappable/mappable-hint@0.0.1');
15
+ * map.addChild(defaultFeatures = new MMapDefaultFeaturesLayer());
16
+ * map.addChild(hint = MMapHint({
17
+ * layers: [defaultFeatures.layer],
18
+ * hint: object => object?.properties?.hint
19
+ * }));
20
+ *
21
+ * const {MMapDefaultMarker} = await mappable.import('@mappable/mappable-markers@0.0.1');
22
+ * map.addChild(new MMapDefaultMarker({coordinates: [37, 55], properties: {hint: 'Hello world!'}}));
23
+ *
24
+ * hint.addChild(new class MyHint extends mappable.MMapEntity {
25
+ * _onAttach() {
26
+ * this._element = document.createElement('div');
27
+ * this._element.className = 'my-hint';
28
+ *
29
+ * this._detachDom = mappable.useDomContext(this, this._element);
30
+ * this._watchContext(MMapHintContext, () => {
31
+ * this._element.textContent = this._consumeContext(MMapHintContext)?.hint;
32
+ * }, {immediate: true});
33
+ * }
34
+ *
35
+ * _onDetach() {
36
+ * this._detachDom();
37
+ * }
38
+ * });
39
+ * ```
40
+ */
41
+ declare class MMapHint extends mappable.MMapGroupEntity<MMapHintProps> {
42
+ /** @internal */
43
+ static [reactify.overrideKey]: CustomReactify<MMapHint, TReact.FC<MMapHintProps>>;
44
+ private _destroyDomContext;
45
+ private _detachDom;
46
+ private _element;
47
+ private _hintElement;
48
+ constructor(props: MMapHintProps);
49
+ protected _positionHintElement(screenCoordinates: [
50
+ number,
51
+ number
52
+ ]): void;
53
+ protected _toggleHint(add: boolean): void;
54
+ protected _onAttach(): void;
55
+ protected _onDetach(): void;
56
+ }
57
+ export { MMapHint, MMapHintContext };
@@ -0,0 +1 @@
1
+ export { MMapHint, MMapHintContext } from "./MMapHint";
@@ -0,0 +1,3 @@
1
+ type Module = import("../../../reactify").ReactifiedModule<typeof import("../index")>;
2
+ declare const module: Module;
3
+ export = module;
File without changes
@@ -0,0 +1,77 @@
1
+ import type { LngLat } from "../../../common/types";
2
+ import type { MMapMarkerProps } from "../../../imperative/MMapMarker";
3
+ import { reactify } from "../../../reactify";
4
+ type DefaultMarkerCustomProps = {
5
+ /** Marker title */
6
+ title?: string;
7
+ /** Marker subtitle */
8
+ subtitle?: string;
9
+ /** Marker icon color */
10
+ color?: string;
11
+ /** Popup */
12
+ popup?: {
13
+ /** Popup content */
14
+ content: string | ((close: () => void) => HTMLElement);
15
+ /** Popup position */
16
+ position: "left" | "right" | "top";
17
+ /** Should popup hide marker. Default is false */
18
+ hidesMarker?: boolean;
19
+ };
20
+ };
21
+ /**
22
+ * MMapDefaultMarker props
23
+ */
24
+ type MMapDefaultMarkerProps = MMapMarkerProps & DefaultMarkerCustomProps;
25
+ declare const defaultProps: Readonly<{
26
+ color: "#f33";
27
+ }>;
28
+ type DefaultProps = typeof defaultProps;
29
+ /**
30
+ * Default marker.
31
+ *
32
+ * @example
33
+ * ```javascript
34
+ * const {MMapDefaultMarker} = await mappable.import('@mappable/mappable-markers@0.0.1');
35
+ * map.addChild(new MMapDefaultMarker({
36
+ * coordinates: [34, 54],
37
+ * title: 'Hello World!',
38
+ * subtitle: 'kind and bright',
39
+ * color: 'blue'
40
+ * }));
41
+ * ```
42
+ */
43
+ declare class MMapDefaultMarker extends mappable.MMapComplexEntity<MMapDefaultMarkerProps, DefaultProps> {
44
+ static defaultProps: Readonly<{
45
+ color: "#f33";
46
+ }>;
47
+ /** @internal */
48
+ static [reactify.overrideKey]: import("../../../reactify/reactify").CustomReactify<MMapDefaultMarker, import("react").ForwardRefExoticComponent<{
49
+ coordinates: LngLat;
50
+ source?: string | undefined;
51
+ zIndex?: number | undefined;
52
+ properties?: Record<string, unknown> | undefined;
53
+ id?: string | undefined;
54
+ } & import("../../../imperative/MMapFeature/types").DraggableProps<import("../../../imperative/MMapMarker").MMapMarkerEventHandler> & import("../../../imperative/MMapFeature/types").FeatureClickEvents & DefaultMarkerCustomProps & {
55
+ children?: import("react").ReactNode;
56
+ } & import("react").RefAttributes<import("../../../imperative/MMapEnities").MMapEntity<MMapDefaultMarkerProps, {}>>>>;
57
+ private _marker;
58
+ private _container;
59
+ private _popup;
60
+ private _popupIsOpen;
61
+ private _popupProps;
62
+ get coordinates(): LngLat;
63
+ constructor(props: MMapDefaultMarkerProps);
64
+ private _createMarker;
65
+ private __onElementClick;
66
+ protected __implGetDefaultProps(): DefaultProps;
67
+ private _togglePopup;
68
+ private _createPopup;
69
+ protected _onUpdate(changedProps: Partial<MMapDefaultMarkerProps>): void;
70
+ private _getElement;
71
+ /**
72
+ * Hides/shows marker labels depending on whether they are empty
73
+ */
74
+ private _toggleCaption;
75
+ private _createContainer;
76
+ }
77
+ export { MMapDefaultMarker, MMapDefaultMarkerProps, DefaultMarkerCustomProps };
@@ -0,0 +1,8 @@
1
+ import type TReactNamespace from "react";
2
+ import type { CustomReactify } from "../../../../reactify/reactify";
3
+ import type { MMapEntity } from "../../../..";
4
+ import { MMapDefaultMarker, MMapDefaultMarkerProps } from "../index";
5
+ type MMapDefaultMarkerContainerProps = TReactNamespace.PropsWithChildren<MMapDefaultMarkerProps>;
6
+ type MMapDefaultMarkerR = TReactNamespace.ForwardRefExoticComponent<MMapDefaultMarkerContainerProps & React.RefAttributes<MMapEntity<MMapDefaultMarkerProps>>>;
7
+ export declare const MMapDefaultMarkerReactifyOverride: CustomReactify<MMapDefaultMarker, MMapDefaultMarkerR>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export { MMapDefaultMarker, MMapDefaultMarkerProps } from "./MMapDefaultMarker";
@@ -0,0 +1,3 @@
1
+ type Module = import("../../../reactify").ReactifiedModule<typeof import("../index")>;
2
+ declare const module: Module;
3
+ export = module;