@mappable-world/mappable-types 0.0.20 → 0.0.22

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 (62) hide show
  1. package/common/types/bounds.d.ts +2 -2
  2. package/common/types/data-source-description.d.ts +8 -0
  3. package/common/types/layer-implementation.d.ts +6 -2
  4. package/imperative/DomContext.d.ts +2 -2
  5. package/imperative/Entities.d.ts +1 -0
  6. package/imperative/MMap/index.d.ts +78 -8
  7. package/imperative/MMap/projection.d.ts +1 -1
  8. package/imperative/MMapCollection/index.d.ts +18 -0
  9. package/imperative/MMapContainer/index.d.ts +14 -0
  10. package/imperative/MMapContextProvider/index.d.ts +50 -0
  11. package/imperative/MMapControl/MMapControl.d.ts +2 -1
  12. package/imperative/MMapControl/MMapControlButton.d.ts +26 -3
  13. package/imperative/MMapControls/index.d.ts +1 -1
  14. package/imperative/MMapCopyrights/index.d.ts +15 -16
  15. package/imperative/MMapDefaultSchemeLayer/index.d.ts +33 -2
  16. package/imperative/MMapEnities.d.ts +48 -1
  17. package/imperative/MMapFeature/index.d.ts +23 -11
  18. package/imperative/MMapFeature/types.d.ts +28 -4
  19. package/imperative/MMapHotspot/index.d.ts +14 -0
  20. package/imperative/MMapListener/index.d.ts +3 -1
  21. package/imperative/MMapMarker/index.d.ts +5 -5
  22. package/imperative/MMapReactContainer/index.d.ts +12 -3
  23. package/imperative/MMapScaleControl/index.d.ts +22 -0
  24. package/imperative/MMapTileDataSource/index.d.ts +2 -3
  25. package/imperative/ThemeContext.d.ts +7 -1
  26. package/imperative/TypeContext.d.ts +9 -0
  27. package/imperative/config.d.ts +25 -0
  28. package/imperative/fetchConfig.d.ts +3 -1
  29. package/imperative/index.d.ts +3 -1
  30. package/imperative/{utils/projections → projections}/web-mercator.d.ts +5 -7
  31. package/modules/layers-extra/MMapCarparksLayer.d.ts +50 -0
  32. package/modules/layers-extra/MMapPanoramaLayer.d.ts +52 -0
  33. package/modules/layers-extra/MMapTrafficEventsLayer.d.ts +58 -0
  34. package/modules/layers-extra/MMapTrafficLayer.d.ts +36 -0
  35. package/modules/layers-extra/index.d.ts +4 -0
  36. package/modules/layers-extra/utils.d.ts +1 -0
  37. package/modules/ruler/EventsBlockerLayer.d.ts +10 -0
  38. package/modules/ruler/MMapRuler.d.ts +66 -0
  39. package/modules/ruler/MMapRulerCommon.d.ts +102 -0
  40. package/modules/ruler/index.d.ts +2 -0
  41. package/modules/ruler/react/MMapRuler.d.ts +11 -0
  42. package/modules/ruler/utils.d.ts +54 -0
  43. package/modules/ruler/vue/MMapRuler.d.ts +6 -0
  44. package/modules/types.d.ts +1 -0
  45. package/modules/vuefy/options/common.d.ts +2 -1
  46. package/package.json +1 -1
  47. package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +2 -2
  48. package/packages/hint/MMapHint/index.d.ts +1 -1
  49. package/packages/markers/MMapDefaultMarker/index.d.ts +5 -5
  50. package/reactify/reactify.d.ts +1 -0
  51. package/imperative/MMapCoverage/index.d.ts +0 -20
  52. package/imperative/utils/allowed-custom-layer-implementations.d.ts +0 -1
  53. package/imperative/utils/deepFreeze.d.ts +0 -2
  54. package/imperative/utils/errorLogger.d.ts +0 -29
  55. package/imperative/utils/id.d.ts +0 -2
  56. package/imperative/utils/index.d.ts +0 -3
  57. package/imperative/utils/jsonp.d.ts +0 -9
  58. package/imperative/utils/metrics.d.ts +0 -12
  59. package/imperative/utils/pEachChunk.d.ts +0 -2
  60. package/imperative/utils/removeUndefined.d.ts +0 -1
  61. package/imperative/utils/requestCoverage.d.ts +0 -10
  62. /package/imperative/{utils/projections → projections}/index.d.ts +0 -0
@@ -8,10 +8,10 @@ export type GenericBounds<T> = [
8
8
  T
9
9
  ];
10
10
  /**
11
- * Rectangle bounded by bottom-left and top-right coordinates
11
+ * Rectangle bounded by top-left and bottom-right coordinates
12
12
  */
13
13
  export type LngLatBounds = GenericBounds<LngLat>;
14
14
  /**
15
- * Rectangle bounded by bottom-left and top-right world coordinates
15
+ * Rectangle bounded by top-left and bottom-right world coordinates
16
16
  */
17
17
  export type WorldBounds = GenericBounds<WorldCoordinates>;
@@ -122,11 +122,19 @@ interface VectorTileDataSourceDescription {
122
122
  meshRequestWithCredentials?: boolean;
123
123
  glyphRequestWithCredentials?: boolean;
124
124
  richModelRequestWithCredentials?: boolean;
125
+ indoorPlanRequestWithCredentials?: boolean;
126
+ styleRequestWithCredentials?: boolean;
127
+ fontListRequestWithCredentials?: boolean;
128
+ fontObjectRequestWithCredentials?: boolean;
125
129
  tileRequestHeaders?: Record<string, string>;
126
130
  iconRequestHeaders?: Record<string, string>;
127
131
  glyphRequestHeaders?: Record<string, string>;
128
132
  meshRequestHeaders?: Record<string, string>;
129
133
  richModelRequestHeaders?: Record<string, string>;
134
+ indoorPlanRequestHeaders?: Record<string, string>;
135
+ styleRequestHeaders?: Record<string, string>;
136
+ fontListRequestHeaders?: Record<string, string>;
137
+ fontObjectRequestHeaders?: Record<string, string>;
130
138
  priority: VectorDataSourcePriority;
131
139
  collisionPriority?: VectorObjectsCollisionPriority;
132
140
  requestTileSize?: VectorTileSize;
@@ -15,7 +15,9 @@ interface LayerImplementationRenderProps {
15
15
  size: PixelCoordinates;
16
16
  }
17
17
  interface RasterLayerImplementationRenderProps extends LayerImplementationRenderProps {
18
- camera: Camera;
18
+ camera: Camera & {
19
+ fov: number;
20
+ };
19
21
  worlds: WorldOffset[];
20
22
  }
21
23
  interface RasterLayerImplementation {
@@ -39,7 +41,9 @@ interface RasterLayerImplementationConstructor {
39
41
  new (props: RasterLayerImplementationConstructorProps): RasterLayerImplementation;
40
42
  }
41
43
  interface VectorLayerImplementationRenderProps extends LayerImplementationRenderProps {
42
- camera: Camera;
44
+ camera: Camera & {
45
+ fov: number;
46
+ };
43
47
  worlds: {
44
48
  lookAt: Vec2;
45
49
  viewProjMatrix: Matrix4;
@@ -18,8 +18,8 @@ export declare function createDomContext(containerEntity: GenericComplexEntity<u
18
18
  /**
19
19
  * Hook for providing DOM context in entity
20
20
  * @param entity - Entity to provide the DomContext
21
- * @param element - Dom element that is passed to DomContext
22
- * @param container - Inner DOM element that is passed to the DOMContext
21
+ * @param element - DOM element to attach
22
+ * @param container - DOM element to provide to descendants in new DomContext
23
23
  * @returns Function that detaches the DOM element and DomContext from the entity
24
24
  */
25
25
  export declare function useDomContext(entity: GenericComplexEntity<unknown>, element: Element, container: Element | null): DomDetach;
@@ -9,6 +9,7 @@ declare class ContextProvider<T> {
9
9
  consume(): T | undefined;
10
10
  provide(nextContext: T): void;
11
11
  }
12
+ export declare const __implEntityKeepOldPropValue: {};
12
13
  type WithDefaults<Props, DefaultProps extends Partial<Props>> = Props & {
13
14
  [K in keyof DefaultProps]: K extends keyof Props ? NonNullable<Props[K]> : never;
14
15
  };
@@ -6,29 +6,51 @@ import { Config } from "../config";
6
6
  import { MMapTheme } from "../ThemeContext";
7
7
  import { overrideKeyReactify } from "../wrappers";
8
8
  /**
9
- * Sets map center.
9
+ * Sets map center. In this case, the zoom of the map remains unchanged.
10
+ * ```javascript
11
+ * map.update({
12
+ * location: {center: [-0.118092, 51.509865]}
13
+ * });
14
+ * ```
10
15
  */
11
16
  export type MMapCenterLocation = {
12
17
  center: LngLat;
13
18
  };
14
19
  /**
15
- * Sets map zoom.
20
+ * Sets map zoom. In this case, the center of the map remains unchanged.
21
+ * ```javascript
22
+ * map.update({
23
+ * location: {zoom: 10}
24
+ * });
25
+ * ```
16
26
  */
17
27
  export type MMapZoomLocation = {
18
28
  zoom: number;
19
29
  };
20
30
  /**
21
- * Sets map bounds.
31
+ * Calculate the center and zoom by specifying the coordinates of the top left and bottom right corners of the map.
32
+ * In this case, the center of the map will be in the center of the rectangle described at the given coordinates.
33
+ * If the map have an aspect ratio different from this rectangle, the rectangle will be inscribed in height and the map will be centered in width.
34
+ * ```javascript
35
+ * map.update({
36
+ * location: {bounds: [[-0.118092, 51.509865], [-0.118092, 51.509865]]}
37
+ * });
38
+ * ```
22
39
  */
23
40
  export type MMapBoundsLocation = {
24
41
  bounds: LngLatBounds;
25
42
  };
26
43
  /**
27
44
  * Sets map center and zoom. Combination of MMapCenterLocation and MMapZoomLocation
45
+ * ```javascript
46
+ * map.update({
47
+ * location: {center: [-0.118092, 51.509865], zoom: 10}
48
+ * });
49
+ * ```
28
50
  */
29
51
  export type MMapCenterZoomLocation = MMapCenterLocation & MMapZoomLocation;
30
52
  /**
31
- * Sets map center and zoom or bounds. Combination of @mixes MMapZoomLocation and MMapBoundsLocation
53
+ * Union type for describing the position of the map through the center and zoom or through the bounds of the map
32
54
  */
33
55
  export type MMapLocation = MMapCenterZoomLocation & Partial<MMapBoundsLocation>;
34
56
  /**
@@ -41,7 +63,27 @@ export type MMapCamera = {
41
63
  azimuth?: number;
42
64
  };
43
65
  /**
44
- * Describes how to change current map location. Change can be instantenious or animated if duration property is set.
66
+ * Describes how to change current map location. Change can be instantaneous or animated if duration property is set.
67
+ * ```javascript
68
+ * map.update({
69
+ * location: {
70
+ * center: [-0.118092, 51.509865], // Center of the map
71
+ * zoom: 10, // Zoom level
72
+ * duration: 200, // Animation of moving map will take 200 milliseconds
73
+ * easing: 'ease-in-out' // Animation easing function
74
+ * }
75
+ * });
76
+ * ```
77
+ * or just change center of the map
78
+ * ```javascript
79
+ * map.update({
80
+ * location: {
81
+ * center: [-0.118092, 51.509865], // Center of the map
82
+ * duration: 200, // Animation of moving map will take 200 milliseconds
83
+ * easing: 'linear' // Animation easing function
84
+ * }
85
+ * })';
86
+ * ```
45
87
  */
46
88
  export type MMapLocationRequest = (MMapBoundsLocation | MMapCenterLocation | MMapZoomLocation | MMapCenterZoomLocation) & {
47
89
  /** Animation duration */
@@ -49,6 +91,17 @@ export type MMapLocationRequest = (MMapBoundsLocation | MMapCenterLocation | MMa
49
91
  /** Animation easing function */
50
92
  easing?: EasingFunctionDescription;
51
93
  };
94
+ /**
95
+ * Describes how to change current camera position. Change can be instantaneous or animated if duration property is set.
96
+ * ```javascript
97
+ * map.update({camera: {
98
+ * tilt: 45 * (Math.PI / 180), // 45 degrees
99
+ * azimuth: 30 * (Math.PI / 180) // 30 degrees
100
+ * duration: 200, // Animation of moving camera will take 200 milliseconds
101
+ * easing: 'ease-in-out'
102
+ * }});
103
+ * ```
104
+ */
52
105
  export type MMapCameraRequest = MMapCamera & {
53
106
  /** Animation duration */
54
107
  duration?: number;
@@ -56,7 +109,24 @@ export type MMapCameraRequest = MMapCamera & {
56
109
  easing?: EasingFunctionDescription;
57
110
  };
58
111
  /**
59
- * MMap props
112
+ * Map settings. Allow to set map mode, behaviors, margin, zoom rounding, zoom range, restrict map area, theme and other settings.
113
+ * ```javascript
114
+ * const map = new MMap(document.getElementById('map-root'), {
115
+ * className: 'custom-map',
116
+ * location: {center: [-0.118092, 51.509865], zoom: 10},
117
+ * camera: {tilt: 45 * (Math.PI / 180), azimuth: 30 * (Math.PI / 180)}
118
+ * mode: 'raster',
119
+ * behaviors: ['drag', 'scrollZoom', 'dblClick', 'mouseRotate', 'mouseTilt'],
120
+ * margin: [0, 100, 0, 0],
121
+ * theme: 'light'
122
+ * });
123
+ * ```
124
+ * But required only `location` prop.
125
+ * ```javascript
126
+ * const map = new MMap(document.getElementById('map-root'), {
127
+ * location: {center: [-0.118092, 51.509865], zoom: 10}
128
+ * });
129
+ * ```
60
130
  */
61
131
  export type MMapProps = {
62
132
  /** Map container css class name */
@@ -131,7 +201,7 @@ type DefaultProps = typeof defaultProps;
131
201
  * ```javascript
132
202
  * const map = new MMap(
133
203
  * document.getElementById('map-root'),
134
- * {location: {center: [37.622504, 55.753215], zoom: 10}}
204
+ * {location: {center: [-0.118092, 51.509865], zoom: 10}}
135
205
  * );
136
206
  * // add default Mappable scheme layer
137
207
  * map.addChild(new MMapDefaultSchemeLayer());
@@ -200,8 +270,8 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
200
270
  private __abortVectorLoad?;
201
271
  private _layers;
202
272
  private _copyrights;
203
- private _coverage;
204
273
  private _isDestroyed;
274
+ private _isVectorLoading;
205
275
  constructor(rootContainer: HTMLElement, props: MMapProps, children?: MMapEntity<unknown>[]);
206
276
  readonly children: MMapEntity<unknown>[];
207
277
  addChild(child: MMapEntity<unknown>, index?: number): this;
@@ -1,2 +1,2 @@
1
- import { WebMercator } from "../utils/projections/web-mercator";
1
+ import { WebMercator } from "../projections/web-mercator";
2
2
  export declare const projection: WebMercator;
@@ -1,3 +1,21 @@
1
1
  import { MMapGroupEntity } from "../MMapEnities";
2
+ /**
3
+ * MMapCollection is a collection of MMapEntity objects.
4
+ * Allow adding or removing [[MMapEntity]] objects.
5
+ * ```typescript
6
+ * const collection = new MMapCollection({});
7
+ * const markerElement = document.createElement('div');
8
+ * markerElement.className = 'marker';
9
+ *
10
+ * for (let i = 0; i < 10_000; i++) {
11
+ * collection.addChild(new MMapMarker({
12
+ * coordinates: [Math.random() * 180, Math.random() * 180]
13
+ * }, markerElement.cloneNode(true)));
14
+ * }
15
+ *
16
+ * map.addChild(collection); // Add collection to the map
17
+ * map.removeChild(collection); // Remove all markers from the map
18
+ * ```
19
+ */
2
20
  export declare class MMapCollection extends MMapGroupEntity<{}> {
3
21
  }
@@ -17,6 +17,20 @@ declare const defaultProps: {
17
17
  };
18
18
  type DefaultProps = typeof defaultProps;
19
19
  type ComputedMMapContainerProps<TContext> = MMapContainerProps<TContext> & MMapContainerPropsImpl<TContext>;
20
+ /**
21
+ * Allow adding or removing [[MMapEntity]] objects or usual DOM elements inside the MMap.
22
+ * ```tsx
23
+ * const container = <MMapContainer>
24
+ * <MMapMarker coordinates={[55.76, 37.64]}><div className="point"></div></MMapMarker>
25
+ * <div>Some text</div>
26
+ * </MMapContainer>;
27
+ *
28
+ * ReactDOM.render(<MMap>{container}</MMap, document.getElementById('root'));
29
+ * ```
30
+ * In this example, the `container` variable contains a `MMapContainer` object with two children: `MMapMarker` and `div`.
31
+ * - `MMapMarker` is a MMapEntity
32
+ * - `div` is a usual DOM element
33
+ */
20
34
  declare class MMapContainer extends MMapGroupEntity<ComputedMMapContainerProps<unknown>, DefaultProps> {
21
35
  static defaultProps: {
22
36
  tagName: string;
@@ -0,0 +1,50 @@
1
+ import { MMapGroupEntity } from "../MMapEnities";
2
+ import type { Context } from "../Entities";
3
+ /**
4
+ * MMapContextProvider props
5
+ */
6
+ export type MMapContextProviderProps<T> = {
7
+ /** Context that will receive the provided value */
8
+ context: Context<T>;
9
+ /** Value to be provided in the context. */
10
+ value: T;
11
+ };
12
+ /**
13
+ * Context provider for MMap, allowing to inject a context and its value.
14
+ *
15
+ * ```javascript
16
+ * const mapContextProvider = new MMapContextProvider({context: SomeMapContext, value: {your: 'value'}});
17
+ * map.addChild(mapContextProvider);
18
+ * ```
19
+ * And define context consumer:
20
+ * ```ts
21
+ * class SomeContextConsumer extends mappable.MMapEntity<{}> {
22
+ * constructor() {
23
+ * super({});
24
+ * }
25
+ *
26
+ * _onAttach() {
27
+ * const value = this._consumeContext(SomeMapContext);
28
+ * console.log(value); // {your: 'value'}
29
+ * }
30
+ * }
31
+ * ```
32
+ * When adding nested containers, the context will be available in them:
33
+ * ```ts
34
+ * mapContextProvider.addChild(new SomeContextConsumer());
35
+ * ```
36
+ * But the most important thing is that the context can be passed at any nesting level:
37
+ * ```tsx
38
+ * <MMapContextProvider context={SomeMapContext} value={{your: 'value'}}>
39
+ * <MMapContainer>
40
+ * <MMapContainer>
41
+ * <SomeContextConsumer />
42
+ * <MMapContainer>
43
+ * </MMapContainer>
44
+ * </MMapContextProvider>
45
+ * ```
46
+ */
47
+ export declare class MMapContextProvider<T> extends MMapGroupEntity<MMapContextProviderProps<T>> {
48
+ protected _onAttach(): void;
49
+ protected _onUpdate({ value }: Partial<MMapContextProviderProps<T>>): void;
50
+ }
@@ -50,9 +50,10 @@ export declare class MMapControl extends MMapGroupEntity<MMapControlProps, Defau
50
50
  key?: import("react").Key | null | undefined;
51
51
  }>>;
52
52
  private _element?;
53
+ private _innerElement?;
53
54
  private _detachDom?;
54
55
  private _unwatchThemeContext?;
55
- constructor(props?: MMapControlProps);
56
+ constructor(props?: MMapControlProps, element?: HTMLElement);
56
57
  protected _createDom(): HTMLElement;
57
58
  protected _onAttach(): void;
58
59
  protected _onUpdate(props: Partial<MMapControlProps>): void;
@@ -1,7 +1,18 @@
1
1
  import { MMapComplexEntity, MMapGroupEntity } from "../MMapEnities";
2
2
  import { overrideKeyReactify } from "../wrappers";
3
3
  /**
4
- * MMapControlButton props
4
+ * Properties for [[MMapControlCommonButton]]
5
+ * ```typescript
6
+ * const button = new MMapControlCommonButton({
7
+ * text: 'Click me!',
8
+ * disabled: false,
9
+ * color: 'black',
10
+ * background: 'white',
11
+ * onClick: () => {
12
+ * console.log('Button clicked');
13
+ * }
14
+ * });
15
+ * ```
5
16
  */
6
17
  export type MMapControlCommonButtonProps = {
7
18
  /** On click handler */
@@ -20,7 +31,19 @@ export type MMapControlCommonButtonProps = {
20
31
  export type MMapControlButtonProps = MMapControlCommonButtonProps;
21
32
  /** @module MMapControlButton */
22
33
  /**
23
- * Default control button.
34
+ * Default control button. Can be used as a base for custom controls.
35
+ * ```javascript
36
+ * const map = new mappable.MMap(document.getElementById('map-root'), {...});
37
+ * const controls = new mappable.MMapControls({position: 'bottom right'});
38
+ * const button = new mappable.MMapControlCommonButton({
39
+ * text: 'Click me!',
40
+ * onClick: () => {
41
+ * console.log('Button clicked');
42
+ * }
43
+ * });
44
+ * controls.addChild(button);
45
+ * ```
46
+ * More about controls: [Mappable Maps API controls](https://mappable.world/docs/js-api/dg/concepts/controls/index.html)
24
47
  */
25
48
  export declare class MMapControlCommonButton extends MMapGroupEntity<MMapControlCommonButtonProps> {
26
49
  private _element?;
@@ -48,7 +71,7 @@ export declare class MMapControlCommonButton extends MMapGroupEntity<MMapControl
48
71
  * map.addChild(controls);
49
72
  * ```
50
73
  *
51
- * @see https://mappable.world/docs/jsapi/dg/concepts/controls/about.html
74
+ * @see <https://mappable.world/docs/js-api/dg/concepts/controls/index.html>
52
75
  */
53
76
  export declare class MMapControlButton extends MMapComplexEntity<MMapControlButtonProps> {
54
77
  static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapControlButton, import("react").ForwardRefExoticComponent<{
@@ -49,7 +49,7 @@ export declare class MMapControls extends MMapGroupEntity<MMapControlsProps> {
49
49
  private _detachDom?;
50
50
  constructor(props: MMapControlsProps, children?: MMapEntity<unknown>[]);
51
51
  protected _onAttach(): void;
52
- protected _onUpdate(): void;
52
+ protected _onUpdate(diffProps: Partial<MMapControlsProps>): void;
53
53
  protected _onDetach(): void;
54
54
  }
55
55
  export {};
@@ -1,4 +1,13 @@
1
1
  import { MMapGroupEntity } from "../MMapEnities";
2
+ /**
3
+ * Copyrights position on the map container. By default, 'bottom right'.
4
+ * For example, 'top left' or 'bottom right'
5
+ * ```javascript
6
+ * const map = new mappable.MMap(document.getElementById('map-root'), {
7
+ * copyrightsPosition: 'top left'
8
+ * });
9
+ * ```
10
+ */
2
11
  type MMapCopyrightsPosition = "top left" | "top right" | "bottom left" | "bottom right";
3
12
  type MMapCopyrightsProps = {
4
13
  /** Position of copyright on the map */
@@ -20,35 +29,25 @@ declare class MMapCopyrights extends MMapGroupEntity<MMapCopyrightsProps, Defaul
20
29
  position: MMapCopyrightsPosition;
21
30
  showScale: false;
22
31
  }>;
23
- private _boxElement;
32
+ private _containerElement;
24
33
  private _copyrightsTextElement;
25
- private _linkElement;
34
+ private _agreementLinkElement;
26
35
  private _logoElement;
27
36
  private _copyrightsContainer;
28
37
  private _scaleElement;
29
38
  private _scaleControl;
30
- private _mapWidth;
31
39
  private _copyrights;
32
- private _fixedCopyrights;
33
- private _userAgreementText;
34
- private _userAgreementState;
35
- private _unwatchMapContext?;
36
- private _unwatchThemeContext?;
37
40
  private _detachDom?;
38
41
  constructor(props?: MMapCopyrightsProps);
39
42
  protected _onAttach(): void;
40
43
  protected _onUpdate(props: Partial<MMapCopyrightsProps>): void;
41
44
  protected _onDetach(): void;
42
45
  private _createDom;
43
- private _syncDom;
44
- private _syncMapWidth;
46
+ private _render;
45
47
  private _syncTheme;
46
- private _setUserAgreementText;
47
- private _setUserAgreementState;
48
- private _setCopyrights;
49
- private _setFixedCopyrights;
50
- private _copyrightsChangeHandler;
51
- private _adjustText;
48
+ private _applyCopyrights;
49
+ private _computeMaxWidth;
50
+ private _rearrange;
52
51
  private _toggleScaleControl;
53
52
  }
54
53
  export { MMapCopyrights, MMapCopyrightsPosition, MMapCopyrightsProps };
@@ -1,6 +1,16 @@
1
1
  import type { VectorCustomization } from "../../common/types";
2
2
  import { MMapLayerProps } from "../MMapLayer";
3
3
  import { MMapComplexEntity } from "../MMapEnities";
4
+ /**
5
+ * Types of underlay layers available in the default scheme.
6
+ * Each layer is displayed on the map according to its zIndex.
7
+ * By default, layers are displayed in the following order:
8
+ * 1. ground
9
+ * 2. buildings
10
+ * 3. icons
11
+ * 4. labels
12
+ * @see https://mappable.world/docs/js-api/dg/concepts/general.html#source-prepared
13
+ */
4
14
  type MMapDefaultSchemeLayerType = "ground" | "buildings" | "icons" | "labels";
5
15
  /**
6
16
  * MMapDefaultSchemeLayer props
@@ -22,6 +32,18 @@ type MMapDefaultSchemeLayerProps = {
22
32
  source?: string;
23
33
  /** Layers parameters */
24
34
  layers?: Partial<Record<MMapDefaultSchemeLayerType, Partial<MMapLayerProps>>>;
35
+ /**
36
+ * Allow to clamp map zoom. If you want the layer to not lock zoom when it reaches
37
+ * its maximum value, you can set this field to false.
38
+ * This may be necessary, for example, when your own layers are working at scales greater than 21.
39
+ * ```js
40
+ * const defaultSchemeLayer = new MMapDefaultSchemeLayer({clampMapZoom: false});
41
+ * map.addChild(defaultSchemeLayer);
42
+ * ```
43
+ * See example https://mappable.world/docs/js-api/examples/cases/over-zoom.html
44
+ * @default true
45
+ */
46
+ clampMapZoom?: boolean;
25
47
  };
26
48
  declare const defaultProps: {
27
49
  visible: boolean;
@@ -45,8 +67,15 @@ declare const defaultProps: {
45
67
  type: string;
46
68
  zIndex: number;
47
69
  }>;
70
+ clampMapZoom: boolean;
48
71
  };
49
72
  type DefaultProps = typeof defaultProps;
73
+ declare const MAP_TYPES: {
74
+ map: string;
75
+ admin: string;
76
+ driving: string;
77
+ transit: string;
78
+ };
50
79
  /**
51
80
  * Map default layer to show mappable-world scheme on map.
52
81
  *
@@ -82,15 +111,17 @@ declare class MMapDefaultSchemeLayer extends MMapComplexEntity<MMapDefaultScheme
82
111
  type: string;
83
112
  zIndex: number;
84
113
  }>;
114
+ clampMapZoom: boolean;
85
115
  };
86
116
  private _dataSource?;
87
117
  private _layers;
88
118
  private _unwatchMapContext?;
89
119
  private _unwatchThemeContext?;
120
+ private _coverageSubscription?;
90
121
  protected _onAttach(): void;
91
122
  protected _onDetach(): void;
92
123
  protected _onUpdate(propsDiff: Partial<MMapDefaultSchemeLayerProps>): void;
93
- private _getDataSourceDescription;
124
+ private _getTileDataSourceProps;
94
125
  private _updateTheme;
95
126
  }
96
- export { MMapDefaultSchemeLayer, MMapDefaultSchemeLayerProps };
127
+ export { MMapDefaultSchemeLayer, MMapDefaultSchemeLayerProps, MAP_TYPES };
@@ -91,4 +91,51 @@ declare abstract class MMapGroupEntity<Props, DefaultProps extends {} = {}> exte
91
91
  addChild(child: MMapEntity<unknown>, index?: number): this;
92
92
  removeChild(child: MMapEntity<unknown>): this;
93
93
  }
94
- export { MMapEntity, MMapComplexEntity, MMapGroupEntity, Context as MMapContext };
94
+ /**
95
+ * Context for MMap. It allows you to provide a value to the context and use it in the children of the context provider.
96
+ * ```ts
97
+ * const MMapSomeContext = new mappable.MMapContext('MMapSomeContext');
98
+ * class SomeValueProvider extends mappable.MMapGroupEntity<{}> {
99
+ * constructor() {
100
+ * super({});
101
+ * this._provideContext(MMapSomeContext, {your: 'value'}); // Special method to provide context value
102
+ * }
103
+ * }
104
+ * ```
105
+ * And some child entity can use this context:
106
+ * ```ts
107
+ * class SomeContextConsumer extends mappable.MMapEntity<{}> {
108
+ * constructor() {
109
+ * super({});
110
+ * }
111
+ *
112
+ * _onAttach() {
113
+ * const value = this._consumeContext(MMapSomeContext); // Special method to get context value
114
+ * console.log(value); // {your: 'value'}
115
+ * }
116
+ * }
117
+ * ```
118
+ * In any level of nesting:
119
+ * ```tsx
120
+ * <SomeValueProvider>
121
+ * <MMapContainer>
122
+ * <MMapContainer>
123
+ * <SomeContextConsumer />
124
+ * </MMapContainer>
125
+ * </MMapContainer>
126
+ * </SomeEntity>
127
+ * ```
128
+ * You can set the context value using [[MMapContextProvider]]:
129
+ * ```tsx
130
+ * <MMapContextProvider context={MMapSomeContext} value={{your: 'value'}}>
131
+ * <MMapContainer>
132
+ * <MMapContainer>
133
+ * <SomeContextConsumer />
134
+ * </MMapContainer>
135
+ * </MMapContainer>
136
+ * </SomeEntity>
137
+ * ```
138
+ */
139
+ declare class MMapContext<T> extends Context<T> {
140
+ }
141
+ export { MMapEntity, MMapComplexEntity, MMapGroupEntity, MMapContext };
@@ -23,9 +23,10 @@ type DefaultProps = typeof defaultProps & {
23
23
  id: string;
24
24
  };
25
25
  /**
26
- * The feature component on the map.
26
+ * Component for creating a geo object on the map.
27
+ * Supports drag-and-drop functionality, drawing styles, and event handling.
28
+ * Supported geometries: `Point`, `LineString`, `MultiLineString`, `Polygon` and `MultiPolygon`.
27
29
  *
28
- * @example
29
30
  * ```javascript
30
31
  * const feature = new MMapFeature({
31
32
  * geometry: {
@@ -43,6 +44,19 @@ type DefaultProps = typeof defaultProps & {
43
44
  * .addChild(new MMapDefaultFeaturesLayer())
44
45
  * .addChild(feature);
45
46
  * ```
47
+ * You can add Point geometry with HTMLElement:
48
+ * ```javascript
49
+ * const feature = new MMapFeature({
50
+ * geometry: {
51
+ * type: 'Point',
52
+ * coordinates: [37.40108963847453, 55.70173382087952]
53
+ * },
54
+ * style: {
55
+ * element: document.createElement('div')
56
+ * }
57
+ * });
58
+ * ```
59
+ * But better to use [[MMapMarker]] for this.
46
60
  */
47
61
  declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
48
62
  static defaultProps: Readonly<{
@@ -58,15 +72,13 @@ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
58
72
  get geometry(): GenericGeometry<LngLat>;
59
73
  protected _onAttach(): void;
60
74
  protected _onDetach(): void;
61
- protected _onUpdate({ id, source }: Partial<MMapFeatureProps>): void;
75
+ protected _onUpdate({ id, source, geometry }: Partial<MMapFeatureProps>): void;
62
76
  protected _getDefaultProps(): DefaultProps;
63
- private __onDragStart;
64
- private __onDragMove;
65
- private __onDragEnd;
66
- private __onClick;
67
- private __onDoubleClick;
68
- private __onFastClick;
69
- private __isMySomeObject;
70
- private __isMyDraggableObject;
77
+ private static _onDragStart;
78
+ private static _onDragMove;
79
+ private static _onDragEnd;
80
+ private static _onClick;
81
+ private static _onFastClick;
82
+ private static _onDoubleClick;
71
83
  }
72
84
  export { MMapFeature, MMapFeatureProps };