@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,120 @@
1
+ type ContextWatcherFn = () => void;
2
+ declare class Context<_T> {
3
+ readonly name: string;
4
+ constructor(name: string);
5
+ }
6
+ declare class ContextProvider<T> {
7
+ private _context?;
8
+ watchers: Set<ContextWatcherFn>;
9
+ consume(): T | undefined;
10
+ provide(nextContext: T): void;
11
+ }
12
+ /** @internal */
13
+ export interface __ImplEntity {
14
+ __implUpdateProps(props: unknown): void;
15
+ __implAttach(): void;
16
+ __implDetach(): void;
17
+ __implAttachTo?(parent: GenericComplexEntity<unknown> | null): void;
18
+ readonly children?: ReadonlyArray<GenericEntity<unknown>>;
19
+ readonly __implChildren?: ReadonlyArray<GenericEntity<unknown>>;
20
+ readonly __implParent: GenericComplexEntity<unknown> | null;
21
+ __implNotifyDomContextOnDescendantMoved: boolean;
22
+ addChild(child: GenericEntity<unknown>, before?: GenericEntity<unknown>): this;
23
+ removeChild(child: GenericEntity<unknown>): this;
24
+ _consumeContext<T>(consumer: Context<T>): T | undefined;
25
+ _provideContext<T>(consumer: Context<T>, ctx: T): void;
26
+ }
27
+ /** @internal */
28
+ export declare const __implHooks: {
29
+ DomContextOnDescendantMoved?: (entity: GenericComplexEntity<unknown>, descendant: GenericEntity<unknown>) => void;
30
+ };
31
+ type WithDefaults<Props, DefaultProps extends Partial<Props>> = Props & {
32
+ [K in keyof DefaultProps]: K extends keyof Props ? NonNullable<Props[K]> : never;
33
+ };
34
+ /** @internal */
35
+ declare abstract class GenericEntity<Props, DefaultProps extends {} = {}, Root extends GenericRootEntity<unknown> = GenericRootEntity<unknown>> {
36
+ protected _props: WithDefaults<Props, DefaultProps>;
37
+ private __implRoot;
38
+ private __implParent;
39
+ protected __implProxyParent: GenericComplexEntity<unknown> | null;
40
+ protected __implNotifyDomContextOnDescendantMoved: boolean;
41
+ private __implCtxMap?;
42
+ private __implCtxWatchers?;
43
+ /**
44
+ * @internal
45
+ * @param {Props} props
46
+ * @param {DefaultProps} defaultProps
47
+ */
48
+ constructor(props: Props);
49
+ protected __implGetDefaultProps(_props: Props): DefaultProps | undefined;
50
+ destroy?(): void;
51
+ update(changedProps: Partial<Props>): void;
52
+ private __implUpdateProps;
53
+ protected _onAttach?(): void;
54
+ protected _onDetach?(): void;
55
+ protected _onUpdate?(props: Partial<Props>, oldProps: Props): void;
56
+ protected __implAttachExtra(): void;
57
+ protected __implDetachExtra(): void;
58
+ protected __implAttachTo?(parent: GenericComplexEntity<unknown> | null): void;
59
+ get parent(): GenericComplexEntity<unknown> | null;
60
+ get root(): Root | null;
61
+ private __implFindRoot;
62
+ private __implAttach;
63
+ private __implDetach;
64
+ protected _provideContext<T>(consumer: Context<T>, ctx: T): void;
65
+ private __implGetContextProvider;
66
+ protected _consumeContext<T>(consumer: Context<T>): T | undefined;
67
+ /**
68
+ * Subscribes to changes in a context.
69
+ * @param context
70
+ * @param watcher
71
+ * @param params
72
+ * @param params.immediate Calls watcher immediately. For most handlers it allows to inline watcher function.
73
+ * @returns Function to unsubscribe from changes context.
74
+ * For most handlers it can be, because it is called automatically on detach.
75
+ * @internal
76
+ */
77
+ protected _watchContext<T>(context: Context<T>, watcher: ContextWatcherFn, params?: {
78
+ immediate: boolean;
79
+ }): () => void;
80
+ protected __implReposition(): void;
81
+ }
82
+ interface ComplexOptions<Root extends GenericRootEntity<unknown> = GenericRootEntity<unknown>> {
83
+ children?: GenericEntity<unknown, {}, Root>[];
84
+ container?: boolean;
85
+ }
86
+ /** @internal */
87
+ declare class GenericComplexEntity<Props, DefaultProps extends {} = {}, Root extends GenericRootEntity<unknown> = GenericRootEntity<unknown>> extends GenericEntity<Props, DefaultProps, Root> {
88
+ private __implChildren;
89
+ protected readonly children: readonly GenericEntity<unknown, {}, Root>[];
90
+ protected readonly _childContainer: GenericComplexEntity<unknown, {}, Root>;
91
+ constructor(props: Props, options?: ComplexOptions<Root>);
92
+ protected __makeProxyContainer(): GenericComplexEntity<unknown, {}, Root>;
93
+ /**
94
+ * Adds a child directly to __implChildren, without _childContainer
95
+ */
96
+ protected _addDirectChild(child: GenericEntity<unknown, {}, Root>, index?: number): void;
97
+ protected addChild(child: GenericEntity<unknown, {}, Root>, index?: number): this;
98
+ protected _removeDirectChild(child: GenericEntity<unknown, {}, Root>): void;
99
+ protected removeChild(child: GenericEntity<unknown, {}, Root>): this;
100
+ protected __implAttachExtra(): void;
101
+ protected __implDetachExtra(): void;
102
+ }
103
+ /** @internal */
104
+ declare class GenericGroupEntity<Props, DefaultProps extends {} = {}, Root extends GenericRootEntity<unknown> = GenericRootEntity<unknown>> extends GenericComplexEntity<Props, DefaultProps, Root> {
105
+ readonly children: readonly GenericEntity<unknown, {}, Root>[];
106
+ protected readonly _childContainer: GenericGroupEntity<unknown, {}, Root>;
107
+ protected __makeProxyContainer(): GenericGroupEntity<unknown, {}, Root>;
108
+ addChild(child: GenericEntity<unknown, {}, Root>, index?: number): this;
109
+ removeChild(child: GenericEntity<unknown, {}, Root>): this;
110
+ }
111
+ /** @internal */
112
+ declare abstract class GenericRootEntity<Props, DefaultProps extends {} = {}> extends GenericGroupEntity<Props, DefaultProps> {
113
+ get root(): this;
114
+ protected _onAttach: undefined;
115
+ protected _onDetach: undefined;
116
+ protected __implAttachTo: undefined;
117
+ }
118
+ type EntityProps<T extends GenericEntity<unknown>> = T extends GenericEntity<infer P> ? P : never;
119
+ type EntityConstructor<TEntity extends GenericEntity<unknown>> = new (...args: any[]) => TEntity;
120
+ export { GenericEntity, GenericComplexEntity, GenericGroupEntity, GenericRootEntity, Context, ContextProvider, EntityConstructor, EntityProps };
@@ -0,0 +1,283 @@
1
+ import type { BehaviorType, LngLat, MapMode, Margin, PixelCoordinates, Projection, ReadonlyLngLat, LngLatBounds, ZoomRange, ZoomRounding, WorldOptions, ZoomStrategy, EasingFunctionDescription } from "../../common/types";
2
+ import type { MMapEntity } from "../MMapEnities";
3
+ import { GenericRootEntity } from "../Entities";
4
+ import { MMapCopyrightsPosition } from "../MMapCopyrights";
5
+ import { Config } from "../config";
6
+ import { reactify } from "../../reactify";
7
+ /**
8
+ * Sets map center.
9
+ */
10
+ export type MMapCenterLocation = {
11
+ center: LngLat;
12
+ };
13
+ /**
14
+ * Sets map zoom.
15
+ */
16
+ export type MMapZoomLocation = {
17
+ zoom: number;
18
+ };
19
+ /**
20
+ * Sets map bounds.
21
+ */
22
+ export type MMapBoundsLocation = {
23
+ bounds: LngLatBounds;
24
+ };
25
+ /**
26
+ * Sets map center and zoom. Combination of MMapCenterLocation and MMapZoomLocation
27
+ */
28
+ export type MMapCenterZoomLocation = MMapCenterLocation & MMapZoomLocation;
29
+ /**
30
+ * Sets map center and zoom or bounds. Combination of @mixes MMapZoomLocation and MMapBoundsLocation
31
+ */
32
+ export type MMapLocation = MMapCenterZoomLocation & Partial<MMapBoundsLocation>;
33
+ /**
34
+ * Observer camera position
35
+ */
36
+ export type MMapCamera = {
37
+ /** Map tilt in radians. Can take values from 0 to 45 degrees (degrees * (Math.PI / 180)) */
38
+ tilt?: number;
39
+ /** Map rotation in degrees. Can take values from -180 to 180 degrees */
40
+ azimuth?: number;
41
+ };
42
+ /**
43
+ * Describes how to change current map location. Change can be instantenious or animated if duration property is set.
44
+ */
45
+ export type MMapLocationRequest = (MMapBoundsLocation | MMapCenterLocation | MMapZoomLocation | MMapCenterZoomLocation) & {
46
+ /** Animation duration */
47
+ duration?: number;
48
+ /** Animation easing function */
49
+ easing?: EasingFunctionDescription;
50
+ };
51
+ export type MMapCameraRequest = MMapCamera & {
52
+ /** Animation duration */
53
+ duration?: number;
54
+ /** Animation easing function */
55
+ easing?: EasingFunctionDescription;
56
+ };
57
+ /**
58
+ * MMap props
59
+ */
60
+ export type MMapProps = {
61
+ /** Map container css class name */
62
+ className?: string;
63
+ /** Initial location or request to change location with duration */
64
+ location: MMapLocationRequest;
65
+ /** Initial camera or request to change camera with duration */
66
+ camera?: MMapCameraRequest;
67
+ /** Map mode, 'auto' (default. Show raster tiles while vector tiles are loading), 'raster' or 'vector' (without raster preloading). */
68
+ mode?: MapMode;
69
+ /** Active behaviors */
70
+ behaviors?: BehaviorType[];
71
+ /** Sets the map view area so that the user cannot move outside of this area. */
72
+ restrictMapArea?: LngLatBounds | false;
73
+ /** Restrict min and max map zoom */
74
+ zoomRange?: ZoomRange;
75
+ /** Zoom strategy describes if map center is bound to the zoom point or not */
76
+ zoomStrategy?: ZoomStrategy;
77
+ /** Set rounding for zoom. If `auto` is selected, zoom will be `snap` for `raster` and `smooth` for `vector` `MapMode`. Default is `auto`.*/
78
+ zoomRounding?: ZoomRounding;
79
+ /** Map margins */
80
+ margin?: Margin;
81
+ /** Other configs */
82
+ config?: Config;
83
+ /** Strategy for fetching hotspots, for whole viewport or for tiles that pointer is hovering at */
84
+ hotspotsStrategy?: "forViewport" | "forPointerPosition";
85
+ /**
86
+ * Whether to show map copyrights.
87
+ * > The option is ignored if `config.meta.copyrights.allowRemove` has a falsy value
88
+ * @internal
89
+ */
90
+ copyrights?: boolean;
91
+ /** Position of copyright on the page. Default is 'bottom right' */
92
+ copyrightsPosition?: MMapCopyrightsPosition;
93
+ /**
94
+ * Projection used in map
95
+ */
96
+ projection?: Projection;
97
+ /**
98
+ * Whether to repeat the world in X and Y
99
+ */
100
+ worldOptions?: WorldOptions;
101
+ };
102
+ export interface Experiments {
103
+ mappableVectorGraphics?: boolean;
104
+ }
105
+ declare const defaultProps: Readonly<{
106
+ className: "";
107
+ camera: {
108
+ tilt: number;
109
+ azimuth: number;
110
+ };
111
+ mode: "auto";
112
+ zoomRounding: "auto";
113
+ hotspotsStrategy: "forViewport" | "forPointerPosition";
114
+ zoomRange: ZoomRange;
115
+ zoomStrategy: "zoomToPointer";
116
+ behaviors: string[];
117
+ margin: Margin | undefined;
118
+ copyrights: true;
119
+ copyrightsPosition: "bottom right";
120
+ worldOptions: {
121
+ cycledX: boolean;
122
+ cycledY: boolean;
123
+ };
124
+ restrictMapArea: false;
125
+ readonly config: Config | undefined;
126
+ projection: Projection;
127
+ }>;
128
+ type DefaultProps = typeof defaultProps;
129
+ /**
130
+ * Main API class. Create a map container.
131
+ *
132
+ * @example
133
+ * ```javascript
134
+ * const map = new MMap(
135
+ * document.getElementById('map-root'),
136
+ * {location: {center: [37.622504, 55.753215], zoom: 10}}
137
+ * );
138
+ * // add default Mappable scheme layer
139
+ * map.addChild(new MMapDefaultSchemeLayer());
140
+ * // relocate map to another point with animation in 200 milliseconds
141
+ * map.setLocation({center: [48.707067, 44.516975], duration: 200});
142
+ * // change mode from default `auto` to `raster`
143
+ * map.setMode('raster');
144
+ * // get map zoom for some calculations
145
+ * const zoom = map.zoom;
146
+ * ```
147
+ */
148
+ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
149
+ #private;
150
+ static defaultProps: Readonly<{
151
+ className: "";
152
+ camera: {
153
+ tilt: number;
154
+ azimuth: number;
155
+ };
156
+ mode: "auto";
157
+ zoomRounding: "auto";
158
+ hotspotsStrategy: "forViewport" | "forPointerPosition";
159
+ zoomRange: ZoomRange;
160
+ zoomStrategy: "zoomToPointer";
161
+ behaviors: string[];
162
+ margin: Margin | undefined;
163
+ copyrights: true;
164
+ copyrightsPosition: "bottom right";
165
+ worldOptions: {
166
+ cycledX: boolean;
167
+ cycledY: boolean;
168
+ };
169
+ restrictMapArea: false;
170
+ readonly config: Config | undefined;
171
+ projection: Projection;
172
+ }>;
173
+ /** @internal */
174
+ static [reactify.overrideKey]: import("../../reactify/reactify").CustomReactify<MMap, import("react").ForwardRefExoticComponent<MMapProps & {
175
+ children?: import("react").ReactNode;
176
+ } & import("react").RefAttributes<GenericRootEntity<MMapProps & {
177
+ container: HTMLElement;
178
+ }, {}>>>>;
179
+ private readonly _rootContainer;
180
+ private readonly _container;
181
+ private readonly _resizeObserver;
182
+ private _vectorInitFailed;
183
+ private __abortVectorLoad?;
184
+ private _layers;
185
+ private _copyrights;
186
+ private _coverage;
187
+ constructor(rootContainer: HTMLElement, props: MMapProps, children?: MMapEntity<unknown>[]);
188
+ readonly children: MMapEntity<unknown>[];
189
+ addChild(child: MMapEntity<unknown>, index?: number): this;
190
+ removeChild(child: MMapEntity<unknown>): this;
191
+ protected __implGetDefaultProps(): DefaultProps;
192
+ private _canBeMainLayer;
193
+ private _prepareLayersToSet;
194
+ private _filterLayers;
195
+ private _upsertLayer;
196
+ private _removeLayer;
197
+ /**
198
+ * Main map container
199
+ */
200
+ get container(): HTMLElement;
201
+ /**
202
+ * getter for {@link MMapProps}.location.center prop
203
+ */
204
+ get center(): ReadonlyLngLat;
205
+ /**
206
+ * getter for {@link MMapProps}.location.zoom prop
207
+ */
208
+ get zoom(): number;
209
+ get tilt(): number;
210
+ get azimuth(): number;
211
+ /**
212
+ * getter for {@link MMapProps}.location.bounds prop
213
+ */
214
+ get bounds(): LngLatBounds;
215
+ /**
216
+ * getter for {@link MMapProps}.zoomRange prop
217
+ */
218
+ get zoomRange(): Readonly<ZoomRange>;
219
+ /**
220
+ * getter for {@link MMapProps}.projection prop
221
+ */
222
+ get projection(): Projection;
223
+ /**
224
+ * getter for map size
225
+ */
226
+ get size(): PixelCoordinates;
227
+ /**
228
+ * getter for {@link MMapProps}.behaviors prop
229
+ */
230
+ get behaviors(): Readonly<BehaviorType[]>;
231
+ /**
232
+ * getter for {@link MMapProps}.config prop
233
+ */
234
+ get config(): Readonly<Config>;
235
+ /**
236
+ * setter for {@link MMapProps}.location prop
237
+ * @param location
238
+ */
239
+ setLocation(location: MMapLocationRequest): void;
240
+ private __setLocation;
241
+ /**
242
+ * setter for {@link MMapProps}.mode prop
243
+ * @param {MapMode} mode
244
+ */
245
+ setMode(mode: MapMode): void;
246
+ /**
247
+ * setter for {@link MMapProps}.zoomRange prop
248
+ * @param {ZoomRange} zoomRange
249
+ */
250
+ setZoomRange(zoomRange: ZoomRange): void;
251
+ /**
252
+ * setter for {@link MMapProps}.behaviors prop
253
+ * @param {BehaviorType[]} behaviors
254
+ */
255
+ setBehaviors(behaviors: BehaviorType[]): void;
256
+ /**
257
+ * setter for {@link MMapProps}.zoomRounding prop
258
+ * @param {ZoomRounding} zoomRounding
259
+ */
260
+ setZoomRounding(zoomRounding: ZoomRounding): void;
261
+ /**
262
+ * setter for {@link MMapProps}.margin prop
263
+ * @param {Margin} margin
264
+ */
265
+ setMargin(margin: Margin): void;
266
+ /**
267
+ * setter for {@link MMapProps}.config prop
268
+ * @param {Config} config
269
+ */
270
+ setConfig(config: Config): void;
271
+ /**
272
+ * Destroy map and remove it from user DOM-element
273
+ */
274
+ destroy(): void;
275
+ private _createMap;
276
+ private get _correctMode();
277
+ protected _onUpdate(propsDiff: Partial<MMapProps>): void;
278
+ private _loadVector;
279
+ private __onVectorInitFailed;
280
+ private __loadVectorEngine;
281
+ private __toggleCopyrights;
282
+ }
283
+ export { MMap };
@@ -0,0 +1,2 @@
1
+ import { sphericalMercator } from "../utils/projections/spherical-mercator";
2
+ export { sphericalMercator as projection };
@@ -0,0 +1,3 @@
1
+ import { MMapGroupEntity } from "../MMapEnities";
2
+ export declare class MMapCollection extends MMapGroupEntity<{}> {
3
+ }
@@ -0,0 +1,45 @@
1
+ import { DomEntity } from "../DomContext";
2
+ import { reactify } from "../../reactify";
3
+ /**
4
+ * MMapControl props
5
+ */
6
+ export type MMapControlProps = {};
7
+ /**
8
+ * DOM wrapper for creating custom controls. Connects the styles required by the control.
9
+ *
10
+ * @example
11
+ * ```javascript
12
+ * const control = new MMapControl({});
13
+ * class MMapSomeController extends DomEntity {
14
+ * _createDom() {
15
+ * const element = document.createElement('button');
16
+ * this._updateDom(element, this._props, true);
17
+ * return element;
18
+ * }
19
+ * _updateDom(element, props, init = false) {
20
+ * element.innerText = props.title;
21
+ * }
22
+ * }
23
+ * const button = new MMapSomeController({
24
+ * title: 'Click me!'
25
+ * });
26
+ * control.addChild(button);
27
+ * map.addChild(control);
28
+ * @see [[MMapControlCommonButton]]
29
+ * ```
30
+ *
31
+ * @module MMapControl
32
+ */
33
+ export declare class MMapControl<T extends MMapControlProps = MMapControlProps> extends DomEntity<T> {
34
+ /** @internal */
35
+ static [reactify.overrideKey]: import("../../reactify/reactify").CustomReactify<MMapControl<MMapControlProps>, import("react").ForwardRefExoticComponent<{
36
+ children?: import("react").ReactNode;
37
+ } & import("react").RefAttributes<import("../Entities").GenericEntity<{
38
+ controlElement: HTMLElement;
39
+ }, {}, import("../Entities").GenericRootEntity<unknown, {}>>>>>;
40
+ protected _createDom(): {
41
+ element: HTMLElement;
42
+ container: HTMLElement;
43
+ };
44
+ protected _updateDom(element: HTMLElement): void;
45
+ }
@@ -0,0 +1,55 @@
1
+ import { DomEntity } from "../DomContext";
2
+ import { MMapComplexEntity } from "../MMapEnities";
3
+ /**
4
+ * MMapControlButton props
5
+ */
6
+ export type MMapControlCommonButtonProps = {
7
+ /** On click handler */
8
+ onClick?: () => void;
9
+ /** Should be disabled */
10
+ disabled?: boolean;
11
+ /** Text content */
12
+ text?: string;
13
+ /** Text color */
14
+ color?: string;
15
+ /** Background color */
16
+ background?: string;
17
+ /** HTML element */
18
+ element?: HTMLElement;
19
+ };
20
+ export type MMapControlButtonProps = MMapControlCommonButtonProps;
21
+ /**
22
+ * Default control button.
23
+ */
24
+ export declare class MMapControlCommonButton extends DomEntity<MMapControlCommonButtonProps, HTMLButtonElement> {
25
+ protected _createDom(): {
26
+ element: HTMLButtonElement;
27
+ container: HTMLElement;
28
+ };
29
+ protected _updateDom(element: HTMLButtonElement, props: Partial<MMapControlCommonButtonProps>, init?: boolean): void;
30
+ }
31
+ /**
32
+ * The control element - button.
33
+ * ```javascript
34
+ * const map = new MMap(document.getElementById('map-root'), {...});
35
+ * const controls = new MMapControls({position: 'top left horizontal'});
36
+ * let count = 0;
37
+ * const button = new MMapControlButton({
38
+ * text: 'Click me!',
39
+ * onClick: () => {
40
+ * button.update({text: 'Clicked:' + ++count});
41
+ * }
42
+ * });
43
+ * controls.addChild(button);
44
+ * map.addChild(controls);
45
+ * ```
46
+ *
47
+ * @see https://mappable.world/docs/jsapi/dg/concepts/controls/about.html
48
+ */
49
+ export declare class MMapControlButton extends MMapComplexEntity<MMapControlButtonProps> {
50
+ private _control;
51
+ private _button;
52
+ constructor(props: MMapControlButtonProps);
53
+ protected _onUpdate(props: Partial<MMapControlButtonProps>): void;
54
+ get text(): string | undefined;
55
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./MMapControl";
2
+ export * from "./MMapControlButton";
@@ -0,0 +1,43 @@
1
+ import { DomEntity } from "../DomContext";
2
+ type VerlicalPosition = "top" | "bottom";
3
+ type HorizontalPosition = "left" | "right";
4
+ type Orientation = "horizontal" | "vertical";
5
+ /**
6
+ * Describes controls position.
7
+ */
8
+ type Position = VerlicalPosition | HorizontalPosition | `${VerlicalPosition} ${HorizontalPosition}` | `${HorizontalPosition} ${VerlicalPosition}`;
9
+ /**
10
+ * MMapControls props
11
+ */
12
+ export type MMapControlsProps = {
13
+ /** Controls position. */
14
+ position: Position;
15
+ /** Controls orientation. */
16
+ orientation?: Orientation;
17
+ };
18
+ /**
19
+ * DOM container for grouping a number of controls to group and position them
20
+ * @example
21
+ *```javascript
22
+ * const map = new MMap(document.getElementById('map-root'), {
23
+ * location: [37.622504, 55.753215],
24
+ * mode: 'raster'
25
+ * });
26
+ * const controls = new MMapControls({position: 'top left horizontal'});
27
+ * const button = text => new MMapControlButton({
28
+ * text: 'Click me',
29
+ * onClick: () => {
30
+ * alert('Click');
31
+ * }
32
+ * });
33
+ * map.addChild(controls);
34
+ * ```
35
+ */
36
+ export declare class MMapControls extends DomEntity<MMapControlsProps> {
37
+ protected _createDom(): {
38
+ element: HTMLElement;
39
+ container: HTMLElement;
40
+ };
41
+ protected _updateDom(element: HTMLElement): void;
42
+ }
43
+ export {};
@@ -0,0 +1,44 @@
1
+ import { DomEntity } from "../DomContext";
2
+ type MMapCopyrightsPosition = "top left" | "top right" | "bottom left" | "bottom right";
3
+ type MMapCopyrightsProps = {
4
+ /** Position of copyright on the map */
5
+ position?: MMapCopyrightsPosition;
6
+ };
7
+ declare const defaultProps: Readonly<{
8
+ position: MMapCopyrightsPosition;
9
+ }>;
10
+ type DefaultProps = typeof defaultProps;
11
+ /**
12
+ * The copyright display component on the map.
13
+ * Data for display uses from the `MMapCoverage` component
14
+ */
15
+ declare class MMapCopyrights extends DomEntity<MMapCopyrightsProps, HTMLElement, DefaultProps> {
16
+ static defaultProps: Readonly<{
17
+ position: MMapCopyrightsPosition;
18
+ }>;
19
+ private _boxElement;
20
+ private _copyrightsTextElement;
21
+ private _linkElement;
22
+ private _logoElement;
23
+ private _mapWidth;
24
+ private _copyrights;
25
+ private _fixedCopyrights;
26
+ private _userAgreementText;
27
+ private _userAgreementState;
28
+ private _unwatchMapContext?;
29
+ constructor(props?: MMapCopyrightsProps);
30
+ protected __implGetDefaultProps(): DefaultProps;
31
+ protected _updateDom(): void;
32
+ protected _onAttach(): void;
33
+ protected _onDetach(): void;
34
+ protected _createDom(): HTMLDivElement;
35
+ private _syncDom;
36
+ private _syncMapWidth;
37
+ private _setUserAgreementText;
38
+ private _setUserAgreementState;
39
+ private _setCopyrights;
40
+ private _setFixedCopyrights;
41
+ private _copyrightsChangeHandler;
42
+ private _adjustText;
43
+ }
44
+ export { MMapCopyrights, MMapCopyrightsProps, MMapCopyrightsPosition };
@@ -0,0 +1,19 @@
1
+ import { MMapComplexEntity } from "../MMapEnities";
2
+ interface MMapCoverageProps {
3
+ onError?: (e: Error) => void;
4
+ }
5
+ /**
6
+ * The component of loading data on copyrights on the map and the zoom range for
7
+ * the area where the center of the map is located
8
+ */
9
+ declare class MMapCoverage extends MMapComplexEntity<MMapCoverageProps, {}> {
10
+ private _abortController?;
11
+ private _prevMeta;
12
+ private _unwatchMapContext?;
13
+ constructor(props?: MMapCoverageProps);
14
+ protected _onAttach(): void;
15
+ protected _onDetach(): void;
16
+ private _compareIfMetaDiffers;
17
+ private _attemptCoverageRequest;
18
+ }
19
+ export { MMapCoverage, MMapCoverageProps };
@@ -0,0 +1,41 @@
1
+ import { MMapComplexEntity } from "../MMapEnities";
2
+ /**
3
+ * MMapDefaultFeaturesLayer props
4
+ */
5
+ type MMapDefaultFeaturesLayerProps = {
6
+ /** Should show layer. Default is true */
7
+ visible?: boolean;
8
+ /** Layer z-index */
9
+ zIndex?: number;
10
+ };
11
+ declare const defaultProps: Readonly<{
12
+ visible: true;
13
+ source: "mappable-default-feature";
14
+ }>;
15
+ type DefaultProps = typeof defaultProps;
16
+ /**
17
+ * Map defaults layer to show features on map.
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * const defaultFeaturesLayer = new MMapDefaultFeaturesLayer();
22
+ * // add to map
23
+ * map.addChild(defaultFeaturesLayer);
24
+ * // update
25
+ * defaultFeaturesLayer.update({zIndex: 1501});
26
+ * ```
27
+ */
28
+ declare class MMapDefaultFeaturesLayer extends MMapComplexEntity<MMapDefaultFeaturesLayerProps, DefaultProps> {
29
+ static defaultProps: Readonly<{
30
+ visible: true;
31
+ source: "mappable-default-feature";
32
+ }>;
33
+ private _dataSource?;
34
+ private _featuresLayer?;
35
+ private _markerLayer?;
36
+ protected __implGetDefaultProps(): DefaultProps;
37
+ protected _onAttach(): void;
38
+ protected _onUpdate(propsDiff: Partial<MMapDefaultFeaturesLayerProps>): void;
39
+ protected _onDetach(): void;
40
+ }
41
+ export { MMapDefaultFeaturesLayer, MMapDefaultFeaturesLayerProps };