@mappable-world/mappable-types 0.0.8 → 0.0.9

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.
@@ -21,6 +21,9 @@ interface DrawingStyleIcon {
21
21
  ];
22
22
  readonly scale?: number;
23
23
  }
24
+ type HideOutsideRule = {
25
+ extent: number;
26
+ } | true | false;
24
27
  interface DrawingStyle {
25
28
  zIndex?: number;
26
29
  fill?: string;
@@ -33,4 +36,4 @@ interface DrawingStyle {
33
36
  icon?: DrawingStyleIcon;
34
37
  element?: HTMLElement;
35
38
  }
36
- export { DrawingStyle, Palette, StrokeStyle, Stroke, DrawingStyleIcon, FillRule };
39
+ export { DrawingStyle, Palette, StrokeStyle, Stroke, DrawingStyleIcon, FillRule, HideOutsideRule };
@@ -9,6 +9,7 @@ export * from "./zoom";
9
9
  export * from "./zoom-strategy";
10
10
  export * from "./geojson";
11
11
  export * from "./layer-description";
12
+ export * from "./layer-implementation";
12
13
  export * from "./indoor";
13
14
  export * from "./vec2";
14
15
  export * from "./camera";
@@ -18,3 +19,4 @@ export * from "./hotspot";
18
19
  export * from "./utils";
19
20
  export * from "./world-options";
20
21
  export * from "./data-source-description";
22
+ export * from "./matrix";
@@ -4,6 +4,9 @@ interface VectorObjectsInteractiveArea {
4
4
  /** Minimal size of the side of the icons interactive area. */
5
5
  minSize?: number;
6
6
  }
7
+ interface VectorModelsAnimationDescription {
8
+ duration: number;
9
+ }
7
10
  type RasterLayerOptions = Record<string, unknown> & {
8
11
  opacity?: number;
9
12
  /**
@@ -18,24 +21,12 @@ type RasterLayerOptions = Record<string, unknown> & {
18
21
  tileRevealDuration?: number;
19
22
  };
20
23
  type VectorLayerOptions = Record<string, unknown> & {
21
- modelsAppearingAnimation?: {
22
- duration: number;
23
- };
24
+ modelsAppearingAnimation?: VectorModelsAnimationDescription;
24
25
  iconsInteractiveArea?: VectorObjectsInteractiveArea;
25
- transformLayers?: Record<string, {
26
- color?: {
27
- r: number;
28
- g: number;
29
- b: number;
30
- a: number;
31
- };
32
- lightness?: number;
33
- saturation?: number;
34
- opacity?: number;
35
- }>;
26
+ /** @deprecated Use layer.grouppedWith instead */
36
27
  parentLayerId?: string;
37
28
  opacity?: number;
38
29
  /** Isolates colliding of the layer's objects, not colliding them with other layers' objects */
39
30
  isolateObjectsColliding?: boolean;
40
31
  };
41
- export { RasterLayerOptions, VectorLayerOptions, VectorObjectsInteractiveArea };
32
+ export { RasterLayerOptions, VectorLayerOptions, VectorObjectsInteractiveArea, VectorModelsAnimationDescription };
@@ -0,0 +1,65 @@
1
+ import type { Matrix4 } from "./matrix";
2
+ import type { RasterLayerOptions } from "./layer-description";
3
+ import type { Vec2 } from "./vec2";
4
+ import type { Camera } from "./camera";
5
+ import type { WorldOptions } from "./world-options";
6
+ import type { GenericProjection } from "./projection";
7
+ import type { PixelCoordinates } from "./coordinates";
8
+ interface WorldOffset {
9
+ readonly left: number;
10
+ readonly top: number;
11
+ readonly width: number;
12
+ readonly height: number;
13
+ }
14
+ interface LayerImplementationRenderProps {
15
+ size: PixelCoordinates;
16
+ }
17
+ interface RasterLayerImplementationRenderProps extends LayerImplementationRenderProps {
18
+ camera: Camera;
19
+ worlds: WorldOffset[];
20
+ }
21
+ interface RasterLayerImplementation {
22
+ destroy(): void;
23
+ render(props: RasterLayerImplementationRenderProps): void;
24
+ }
25
+ interface RasterLayerImplementationConstructorProps {
26
+ requestRender: () => void;
27
+ size: PixelCoordinates;
28
+ element: HTMLElement;
29
+ camera: Camera;
30
+ worldOptions: WorldOptions;
31
+ projection: GenericProjection<unknown>;
32
+ options?: RasterLayerOptions;
33
+ }
34
+ interface RasterLayerImplementationConstructor {
35
+ new (props: RasterLayerImplementationConstructorProps): RasterLayerImplementation;
36
+ }
37
+ interface VectorLayerImplementationRenderProps extends LayerImplementationRenderProps {
38
+ camera: Camera;
39
+ worlds: {
40
+ lookAt: Vec2;
41
+ viewProjMatrix: Matrix4;
42
+ }[];
43
+ }
44
+ interface VectorLayerImplementation {
45
+ render(props: VectorLayerImplementationRenderProps): {
46
+ color: WebGLTexture;
47
+ depth?: WebGLTexture;
48
+ };
49
+ destroy(): void;
50
+ }
51
+ interface VectorLayerImplementationConstructor {
52
+ new (gl: WebGLRenderingContext, options: {
53
+ requestRender: () => void;
54
+ }): VectorLayerImplementation;
55
+ }
56
+ type LayerImplementationClassesProps<Mode extends 'raster' | 'vector' = 'raster' | 'vector'> = {
57
+ source: string;
58
+ type: string;
59
+ effectiveMode: Mode;
60
+ };
61
+ interface LayerImplementationClasses {
62
+ <Result extends RasterLayerImplementationConstructor = RasterLayerImplementationConstructor>(props: LayerImplementationClassesProps<'raster'>): Result;
63
+ <Result extends VectorLayerImplementationConstructor = VectorLayerImplementationConstructor>(props: LayerImplementationClassesProps<'vector'>): Result;
64
+ }
65
+ export { WorldOffset, RasterLayerImplementation, RasterLayerImplementationRenderProps, RasterLayerImplementationConstructor, RasterLayerImplementationConstructorProps, VectorLayerImplementation, VectorLayerImplementationRenderProps, VectorLayerImplementationConstructor, LayerImplementationClassesProps, LayerImplementationClasses };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Matrix stored as an array in column-major order:
3
+ *
4
+ * ```
5
+ * [
6
+ * m11, m21, m31, m41,
7
+ * m12, m22, m32, m42,
8
+ * m13, m23, m33, m43,
9
+ * m14, m24, m34, m44
10
+ * ],
11
+ * ```
12
+ *
13
+ * where mij - matrix element in the i-th row and j-th column.
14
+ */
15
+ interface Matrix4 {
16
+ [i: number]: number;
17
+ readonly length: number;
18
+ }
19
+ export { Matrix4 };
@@ -16,6 +16,7 @@ export declare function createDomContext(containerEntity: GenericComplexEntity<u
16
16
  DomContextDestroy
17
17
  ];
18
18
  export declare function useDomContext(entity: GenericComplexEntity<unknown>, element: Element, container: Element | null): () => void;
19
+ /** @deprecated Use `useDomContext` instead. */
19
20
  export declare abstract class DomEntity<TProps, TElement extends Element = HTMLElement, DefaultProps extends {} = {}> extends MMapGroupEntity<TProps, DefaultProps> {
20
21
  protected _element?: TElement;
21
22
  private _detachDom?;
@@ -19,7 +19,6 @@ declare abstract class GenericEntity<Props, DefaultProps extends {} = {}, Root e
19
19
  * @param {DefaultProps} defaultProps
20
20
  */
21
21
  constructor(props: Props);
22
- destroy?(): void;
23
22
  update(changedProps: Partial<Props>): void;
24
23
  protected _onAttach?(): void;
25
24
  protected _onDetach?(): void;
@@ -57,6 +56,7 @@ declare abstract class GenericRootEntity<Props, DefaultProps extends {} = {}> ex
57
56
  get root(): this;
58
57
  protected _onAttach: undefined;
59
58
  protected _onDetach: undefined;
59
+ abstract destroy(): void;
60
60
  }
61
61
  type EntityProps<T extends GenericEntity<unknown>> = T extends GenericEntity<infer P> ? P : never;
62
62
  type EntityConstructor<TEntity extends GenericEntity<unknown>> = new (...args: any[]) => TEntity;
@@ -3,7 +3,7 @@ import type { MMapEntity } from "../MMapEnities";
3
3
  import { GenericRootEntity } from "../Entities";
4
4
  import { MMapCopyrightsPosition } from "../MMapCopyrights";
5
5
  import { Config } from "../config";
6
- import { reactify } from "../../reactify";
6
+ import { overrideKeyReactify } from "../wrappers";
7
7
  /**
8
8
  * Sets map center.
9
9
  */
@@ -161,6 +161,27 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
161
161
  readonly config: Config;
162
162
  projection: Projection;
163
163
  }>;
164
+ static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMap, import("react").ForwardRefExoticComponent<{
165
+ className?: string | undefined;
166
+ location: MMapLocationRequest;
167
+ camera?: MMapCameraRequest | undefined;
168
+ mode?: MapMode | undefined;
169
+ behaviors?: BehaviorType[] | undefined;
170
+ restrictMapArea?: false | LngLatBounds | undefined;
171
+ zoomRange?: ZoomRange | undefined;
172
+ zoomStrategy?: ZoomStrategy | undefined;
173
+ zoomRounding?: ZoomRounding | undefined;
174
+ margin?: Margin | undefined;
175
+ config?: Config | undefined;
176
+ hotspotsStrategy?: "forViewport" | "forPointerPosition" | undefined;
177
+ copyrights?: boolean | undefined;
178
+ copyrightsPosition?: MMapCopyrightsPosition | undefined;
179
+ projection?: Projection | undefined;
180
+ worldOptions?: WorldOptions | undefined;
181
+ children?: import("react").ReactNode;
182
+ ref?: import("react").Ref<MMap> | undefined;
183
+ key?: import("react").Key | null | undefined;
184
+ }>>;
164
185
  private readonly _rootContainer;
165
186
  private readonly _container;
166
187
  private readonly _resizeObserver;
@@ -169,6 +190,7 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
169
190
  private _layers;
170
191
  private _copyrights;
171
192
  private _coverage;
193
+ private _isDestroyed;
172
194
  constructor(rootContainer: HTMLElement, props: MMapProps, children?: MMapEntity<unknown>[]);
173
195
  readonly children: MMapEntity<unknown>[];
174
196
  addChild(child: MMapEntity<unknown>, index?: number): this;
@@ -1,5 +1,5 @@
1
1
  import { DomEntity } from "../DomContext";
2
- import { reactify } from "../../reactify";
2
+ import { overrideKeyReactify } from "../wrappers";
3
3
  /**
4
4
  * MMapControl props
5
5
  */
@@ -31,6 +31,13 @@ export type MMapControlProps = {};
31
31
  * @module MMapControl
32
32
  */
33
33
  export declare class MMapControl<T extends MMapControlProps = MMapControlProps> extends DomEntity<T> {
34
+ static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapControl<MMapControlProps>, import("react").ForwardRefExoticComponent<{
35
+ children?: import("react").ReactNode;
36
+ ref?: import("react").Ref<import("../Entities").GenericEntity<{
37
+ controlElement: HTMLElement;
38
+ }, {}, import("../Entities").GenericRootEntity<unknown, {}>>> | undefined;
39
+ key?: import("react").Key | null | undefined;
40
+ }>>;
34
41
  protected _createDom(): {
35
42
  element: HTMLElement;
36
43
  container: HTMLElement;
@@ -1,6 +1,6 @@
1
1
  import { DomEntity } from "../DomContext";
2
2
  import { MMapComplexEntity } from "../MMapEnities";
3
- import { reactify } from "../../reactify";
3
+ import { overrideKeyReactify } from "../wrappers";
4
4
  /**
5
5
  * MMapControlButton props
6
6
  */
@@ -49,6 +49,17 @@ export declare class MMapControlCommonButton extends DomEntity<MMapControlCommon
49
49
  * @see https://mappable.world/docs/jsapi/dg/concepts/controls/about.html
50
50
  */
51
51
  export declare class MMapControlButton extends MMapComplexEntity<MMapControlButtonProps> {
52
+ static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapControlButton, import("react").ForwardRefExoticComponent<{
53
+ onClick?: (() => void) | undefined;
54
+ disabled?: boolean | undefined;
55
+ text?: string | undefined;
56
+ color?: string | undefined;
57
+ background?: string | undefined;
58
+ element?: HTMLElement | undefined;
59
+ children?: import("react").ReactNode;
60
+ ref?: import("react").Ref<import("../Entities").GenericEntity<MMapControlCommonButtonProps, {}, import("../Entities").GenericRootEntity<unknown, {}>>> | undefined;
61
+ key?: import("react").Key | null | undefined;
62
+ }>>;
52
63
  private _control;
53
64
  private _button;
54
65
  constructor(props: MMapControlButtonProps);
@@ -1,4 +1,4 @@
1
- import type { DrawingStyle, GenericGeometry, LngLat } from "../../common/types";
1
+ import type { DrawingStyle, GenericGeometry, LngLat, HideOutsideRule } from "../../common/types";
2
2
  import type { DraggableProps, FeatureClickEvents } from "./types";
3
3
  import { MMapEntity } from "../MMapEnities";
4
4
  import type { Geometry, MMapFeatureEventHandler } from "./types";
@@ -13,6 +13,8 @@ type MMapFeatureProps = {
13
13
  properties?: Record<string, unknown>;
14
14
  /** Do not round coordinates */
15
15
  disableRoundCoordinates?: boolean;
16
+ /** Hide the marker if it goes beyond the edge of the viewport */
17
+ hideOutsideViewport?: HideOutsideRule;
16
18
  } & DraggableProps<MMapFeatureEventHandler> & FeatureClickEvents;
17
19
  declare const defaultProps: Readonly<{
18
20
  source: "mappable-default-feature";
@@ -55,7 +57,7 @@ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
55
57
  get geometry(): GenericGeometry<LngLat>;
56
58
  protected _onAttach(): void;
57
59
  protected _onDetach(): void;
58
- protected _onUpdate({ style, id, source, disableRoundCoordinates }: Partial<MMapFeatureProps>): void;
60
+ protected _onUpdate({ style, id, source, disableRoundCoordinates, hideOutsideViewport: newHideOutsideViewport }: Partial<MMapFeatureProps>): void;
59
61
  private __onDragStart;
60
62
  private __onDragMove;
61
63
  private __onDragEnd;
@@ -1,21 +1,26 @@
1
1
  import type { RasterLayerOptions } from "../../common/types";
2
2
  import { MMapEntity } from "../MMapEnities";
3
+ import type { LayerImplementationClasses } from "../../common/types/layer-implementation";
3
4
  /**
4
5
  * MMapLayer props
5
6
  */
6
7
  type MMapLayerProps = {
7
8
  /** Layer id */
8
9
  id?: string;
9
- /** Layer source */
10
- source: string;
11
10
  /** Layer type. For tile data sources should use 'ground' */
12
11
  type: string;
12
+ /** Layer source */
13
+ source?: string;
13
14
  /** Layer z-index to control order. Default is 1500 */
14
15
  zIndex?: number;
16
+ /** Layer id to control order in parent group */
17
+ grouppedWith?: string;
15
18
  /** Layer options */
16
19
  options?: {
17
20
  raster?: RasterLayerOptions;
18
21
  };
22
+ /** Method, allows you to define your own implementation of the layer */
23
+ implementation?: LayerImplementationClasses;
19
24
  };
20
25
  declare const defaultProps: Readonly<{
21
26
  zIndex: 1500;
@@ -1,7 +1,7 @@
1
- import type { LngLat } from "../../common/types";
1
+ import type { HideOutsideRule, LngLat } from "../../common/types";
2
2
  import type { DraggableProps, FeatureClickEvents } from "../MMapFeature/types";
3
3
  import { MMapGroupEntity } from "../MMapEnities";
4
- import { reactify } from "../../reactify";
4
+ import { overrideKeyReactify } from "../wrappers";
5
5
  /**
6
6
  * MMapMarker events handler
7
7
  */
@@ -19,12 +19,37 @@ type MMapMarkerProps = {
19
19
  id?: string;
20
20
  /** Do not round coordinates */
21
21
  disableRoundCoordinates?: boolean;
22
+ /**
23
+ * Hide the marker if it goes beyond the edge of the viewport.
24
+ * Two modes of operation are supported true and {extent: number}
25
+ * ```js
26
+ * const marker = new MMapMarker({
27
+ * //...,
28
+ * hideOutsideViewport: true
29
+ * })
30
+ * ```
31
+ * A point element will be removed from the map to optimize DOM size if its coordinates are 100px outside the visible area of the map.
32
+ * For most markers, this is sufficient.
33
+ * But for very large markers, this can cause an unpleasant blinking effect.
34
+ *
35
+ * ```js
36
+ * const marker = new MMapMarker({
37
+ * //...,
38
+ * hideOutsideViewport: {
39
+ * extent: 1000
40
+ * }
41
+ * })
42
+ * ```
43
+ * A point will be removed from the map if its coordinates are 1000px outside the visible area of the map.
44
+ */
45
+ hideOutsideViewport?: HideOutsideRule;
22
46
  } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents;
23
47
  declare const defaultProps: Readonly<{
24
48
  draggable: false;
25
49
  mapFollowsOnDrag: false;
26
50
  blockEvents: false;
27
51
  blockBehaviors: false;
52
+ hideOutsideViewport: false;
28
53
  zIndex: 0;
29
54
  source: "mappable-default-feature";
30
55
  }>;
@@ -52,9 +77,71 @@ declare class MMapMarker extends MMapGroupEntity<MMapMarkerProps, DefaultProps>
52
77
  mapFollowsOnDrag: false;
53
78
  blockEvents: false;
54
79
  blockBehaviors: false;
80
+ hideOutsideViewport: false;
55
81
  zIndex: 0;
56
82
  source: "mappable-default-feature";
57
83
  }>;
84
+ static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapMarker, import("react").ForwardRefExoticComponent<{
85
+ coordinates: LngLat;
86
+ source?: string | undefined;
87
+ zIndex?: number | undefined;
88
+ properties?: Record<string, unknown> | undefined;
89
+ id?: string | undefined;
90
+ disableRoundCoordinates?: boolean | undefined;
91
+ hideOutsideViewport?: HideOutsideRule | undefined;
92
+ draggable?: boolean | undefined;
93
+ mapFollowsOnDrag?: boolean | {
94
+ activeZoneMargin?: import("../../common/types/margin").Margin | undefined;
95
+ } | undefined;
96
+ onDragStart?: MMapMarkerEventHandler | undefined;
97
+ onDragEnd?: MMapMarkerEventHandler | undefined;
98
+ onDragMove?: MMapMarkerEventHandler | undefined;
99
+ blockEvents?: boolean | undefined;
100
+ blockBehaviors?: boolean | undefined;
101
+ onDoubleClick?: ((event: MouseEvent) => void) | undefined;
102
+ onClick?: ((event: MouseEvent) => void) | undefined;
103
+ onFastClick?: ((event: MouseEvent) => void) | undefined;
104
+ markerElement?: HTMLElement | undefined;
105
+ children?: import("react").ReactNode;
106
+ ref?: import("react").Ref<import("../Entities").GenericEntity<{
107
+ /** Coordinates of the marker */
108
+ coordinates: LngLat;
109
+ source?: string | undefined;
110
+ /** z index of the marker, defaults to 0 */
111
+ zIndex?: number | undefined;
112
+ properties?: Record<string, unknown> | undefined;
113
+ id?: string | undefined;
114
+ /** Do not round coordinates */
115
+ disableRoundCoordinates?: boolean | undefined;
116
+ /**
117
+ * Hide the marker if it goes beyond the edge of the viewport.
118
+ * Two modes of operation are supported true and {extent: number}
119
+ * ```js
120
+ * const marker = new MMapMarker({
121
+ * //...,
122
+ * hideOutsideViewport: true
123
+ * })
124
+ * ```
125
+ * A point element will be removed from the map to optimize DOM size if its coordinates are 100px outside the visible area of the map.
126
+ * For most markers, this is sufficient.
127
+ * But for very large markers, this can cause an unpleasant blinking effect.
128
+ *
129
+ * ```js
130
+ * const marker = new MMapMarker({
131
+ * //...,
132
+ * hideOutsideViewport: {
133
+ * extent: 1000
134
+ * }
135
+ * })
136
+ * ```
137
+ * A point will be removed from the map if its coordinates are 1000px outside the visible area of the map.
138
+ */
139
+ hideOutsideViewport?: HideOutsideRule | undefined;
140
+ } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents & {
141
+ markerElement?: HTMLElement | undefined;
142
+ }, {}, import("../Entities").GenericRootEntity<unknown, {}>>> | undefined;
143
+ key?: import("react").Key | null | undefined;
144
+ }>>;
58
145
  readonly element: HTMLElement;
59
146
  private _destroyDomCtx?;
60
147
  constructor(props: MMapMarkerProps, element?: HTMLElement);
@@ -63,6 +150,7 @@ declare class MMapMarker extends MMapGroupEntity<MMapMarkerProps, DefaultProps>
63
150
  mapFollowsOnDrag: false;
64
151
  blockEvents: false;
65
152
  blockBehaviors: false;
153
+ hideOutsideViewport: false;
66
154
  zIndex: 0;
67
155
  source: "mappable-default-feature";
68
156
  }>;
@@ -1,11 +1,7 @@
1
- import type { LngLat, LngLatBounds } from "../common/types";
2
- import { Config } from "./config";
3
- declare const geocoderSearchTypes: {
4
- businesses: string;
5
- toponyms: string;
6
- };
7
- type GeocoderSearchType = keyof typeof geocoderSearchTypes;
8
- type SearchOptions = {
1
+ import type { LngLat, LngLatBounds } from "../../common/types";
2
+ import { Config } from "../config";
3
+ export type SearchType = "businesses" | "toponyms";
4
+ export type SearchOptions = {
9
5
  /** Request string represented by a text or {@link LngLat LngLat} point. */
10
6
  text: string;
11
7
  /**
@@ -14,9 +10,12 @@ type SearchOptions = {
14
10
  * if both types are queried):
15
11
  * - toponyms
16
12
  * - businesses
17
- * */
18
- type?: GeocoderSearchType[];
19
- /** Map zoom. */
13
+ **/
14
+ type?: SearchType[];
15
+ /**
16
+ * @deprecated
17
+ * Map zoom.
18
+ **/
20
19
  zoom?: number;
21
20
  /**
22
21
  * Flag that defines whether
@@ -29,7 +28,7 @@ type SearchOptions = {
29
28
  * false — the search area is *not* restricted
30
29
  *
31
30
  * true — the search area is restricted
32
- * */
31
+ **/
33
32
  strictBounds?: boolean;
34
33
  /**
35
34
  * The maximum amount of returned objects.
@@ -39,19 +38,19 @@ type SearchOptions = {
39
38
  * **10** is default.
40
39
  *
41
40
  * **100** is maximum.
42
- * */
41
+ **/
43
42
  limit?: number;
44
43
  /**
45
44
  * The amount of objects (if any returned) that are skipped starting from the first one.
46
45
  *
47
46
  * Parameter {@link SearchOptions.limit `limit`} must be provided.
48
- * */
47
+ **/
49
48
  offset?: number;
50
49
  /**
51
50
  * {@link LngLat `LngLat`} of the center point of search area.
52
51
  *
53
52
  * {@link SearchOptions.span `span`} parameter sets the length of the search area.
54
- * */
53
+ **/
55
54
  center?: LngLat;
56
55
  /**
57
56
  * Parameter {@link span `span`} is specified with two numbers that represent
@@ -62,11 +61,11 @@ type SearchOptions = {
62
61
  span?: LngLat;
63
62
  /**
64
63
  * {@link bounds `bounds`} parameter has priority over
65
- * {@link SearchOptions.ll `ll`} and {@link SearchOptions.spn `span`}
66
- * */
64
+ * {@link SearchOptions.center `center`} and {@link SearchOptions.spn `span`}
65
+ **/
67
66
  bounds?: LngLatBounds;
68
67
  };
69
- type RawFeature = {
68
+ export type Feature = {
70
69
  properties: {
71
70
  name: string;
72
71
  description: string;
@@ -76,8 +75,13 @@ type RawFeature = {
76
75
  coordinates: LngLat;
77
76
  };
78
77
  };
79
- type Feature = RawFeature;
80
- type SearchResponse = Feature[];
81
- declare function search(options: SearchOptions, config?: Config | undefined): Promise<SearchResponse>;
82
- export { search };
83
- export type { SearchOptions, SearchResponse };
78
+ export type SearchResponse = Feature[];
79
+ /**
80
+ * Static function to work with Search API.
81
+ *
82
+ *
83
+ * @param {SearchOptions} options Request options
84
+ * @param {Config} config Current config
85
+ * @returns {Promise<SearchResponse>}
86
+ */
87
+ export declare function search(options: SearchOptions, config?: Config | undefined): Promise<SearchResponse>;
@@ -1,5 +1,5 @@
1
- import type { LngLat, LngLatBounds } from "../common/types";
2
- import { Config } from "./config";
1
+ import type { LngLat, LngLatBounds } from "../../common/types";
2
+ import { Config } from "../config";
3
3
  type DeprecatedGeoSuggestType = "all" | "toponyms" | "addresses" | "organizations";
4
4
  type GeoSuggestType = "biz" | "geo" | "street" | "metro" | "district" | "locality" | "area" | "province" | "country" | "house";
5
5
  export type SuggestOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappable-world/mappable-types",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Types for mappable maps library",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
@@ -50,13 +50,23 @@ declare class MMapClusterer extends mappable.MMapComplexEntity<MMapClustererProp
50
50
  static defaultProps: Readonly<{
51
51
  tickTimeout: 200;
52
52
  }>;
53
- static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapClusterer, import("react").ForwardRefExoticComponent<Pick<MMapClustererProps, "features" | "tickTimeout" | "method" | "onRender"> & {
53
+ static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapClusterer, import("react").ForwardRefExoticComponent<{
54
+ features: Feature[];
55
+ method: IClusterMethod;
56
+ tickTimeout?: number | undefined;
57
+ onRender?: ((clusters: ClustererObject[]) => false | void) | undefined;
54
58
  marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
55
59
  cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
56
- } & import("react").RefAttributes<MMapEntity<Pick<MMapClustererProps, "features" | "tickTimeout" | "method" | "onRender"> & {
57
- marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
58
- cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
59
- }, {}>>>>;
60
+ ref?: import("react").Ref<MMapEntity<{
61
+ features: Feature[];
62
+ method: IClusterMethod;
63
+ tickTimeout?: number | undefined;
64
+ onRender?: ((clusters: ClustererObject[]) => false | void) | undefined;
65
+ marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
66
+ cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
67
+ }, {}>> | undefined;
68
+ key?: import("react").Key | null | undefined;
69
+ }>>;
60
70
  /** All created entities with cluster id*/
61
71
  private _entitiesCache;
62
72
  /** Viewport entities with cluster id */
@@ -1,6 +1,6 @@
1
1
  import type TReact from "react";
2
2
  import type { LngLat, MMapEntity } from "../../../..";
3
- import type { CustomReactify, OverrideProps } from "../../../../reactify/reactify";
3
+ import type { CustomReactify, OverrideProps, Prettify } from "../../../../reactify/reactify";
4
4
  import type { Feature } from "../interface";
5
5
  import type { MMapClusterer as MMapClustererI, MMapClustererProps } from "../MMapClusterer";
6
6
  /**
@@ -33,12 +33,12 @@ import type { MMapClusterer as MMapClustererI, MMapClustererProps } from "../MMa
33
33
  * </MMap>
34
34
  * ```
35
35
  */
36
- type MMapClustererReactifiedProps = OverrideProps<MMapClustererProps, {
36
+ type MMapClustererReactifiedProps = Prettify<OverrideProps<MMapClustererProps, {
37
37
  /** Function that returns MMapMarker react component to render marker*/
38
38
  marker: (feature: Feature) => TReact.ReactElement;
39
39
  /** Function that returns MMapMarker react component to render cluster*/
40
40
  cluster: (coordinates: LngLat, features: Feature[]) => TReact.ReactElement;
41
- }>;
42
- type MMapClustererR = TReact.ForwardRefExoticComponent<MMapClustererReactifiedProps & React.RefAttributes<MMapEntity<MMapClustererReactifiedProps>>>;
41
+ }>>;
42
+ type MMapClustererR = TReact.ForwardRefExoticComponent<Prettify<MMapClustererReactifiedProps & React.RefAttributes<MMapEntity<MMapClustererReactifiedProps>>>>;
43
43
  export declare const MMapClustererReactifyOverride: CustomReactify<MMapClustererI, MMapClustererR>;
44
44
  export {};
@@ -1,7 +1,7 @@
1
1
  import type TReact from "react";
2
2
  import type { MMapFeature, MMapMarker, MMapHotspot } from "../../../imperative";
3
3
  import type { CustomReactify } from "../../../reactify/reactify";
4
- import { reactify } from "../../../reactify";
4
+ import { overrideKeyReactify } from "../../../imperative/wrappers";
5
5
  type MMapHintProps = {
6
6
  hint: (object: MMapFeature | MMapMarker | MMapHotspot | undefined) => unknown;
7
7
  };
@@ -39,6 +39,7 @@ declare const MMapHintContext: import("../../../imperative/Entities").Context<un
39
39
  * ```
40
40
  */
41
41
  declare class MMapHint extends mappable.MMapGroupEntity<MMapHintProps> {
42
+ static [overrideKeyReactify]: CustomReactify<MMapHint, TReact.FC<MMapHintProps>>;
42
43
  private _destroyDomContext;
43
44
  private _detachDom;
44
45
  private _element;
@@ -23,6 +23,7 @@ type DefaultMarkerCustomProps = {
23
23
  type MMapDefaultMarkerProps = MMapMarkerProps & DefaultMarkerCustomProps;
24
24
  declare const defaultProps: Readonly<{
25
25
  color: "#f33";
26
+ hideOutsideViewport: true;
26
27
  }>;
27
28
  type DefaultProps = typeof defaultProps;
28
29
  /**
@@ -42,6 +43,7 @@ type DefaultProps = typeof defaultProps;
42
43
  declare class MMapDefaultMarker extends mappable.MMapComplexEntity<MMapDefaultMarkerProps, DefaultProps> {
43
44
  static defaultProps: Readonly<{
44
45
  color: "#f33";
46
+ hideOutsideViewport: true;
45
47
  }>;
46
48
  static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapDefaultMarker, import("react").ForwardRefExoticComponent<{
47
49
  coordinates: LngLat;
@@ -50,9 +52,34 @@ declare class MMapDefaultMarker extends mappable.MMapComplexEntity<MMapDefaultMa
50
52
  properties?: Record<string, unknown> | undefined;
51
53
  id?: string | undefined;
52
54
  disableRoundCoordinates?: boolean | undefined;
53
- } & import("../../../imperative/MMapFeature/types").DraggableProps<import("../../../imperative/MMapMarker").MMapMarkerEventHandler> & import("../../../imperative/MMapFeature/types").FeatureClickEvents & DefaultMarkerCustomProps & {
55
+ hideOutsideViewport?: import("../../../common/types/graphics").HideOutsideRule | undefined;
56
+ draggable?: boolean | undefined;
57
+ mapFollowsOnDrag?: boolean | {
58
+ activeZoneMargin?: import("../../../common/types/margin").Margin | undefined;
59
+ } | undefined;
60
+ onDragStart?: import("../../../imperative/MMapMarker").MMapMarkerEventHandler | undefined;
61
+ onDragEnd?: import("../../../imperative/MMapMarker").MMapMarkerEventHandler | undefined;
62
+ onDragMove?: import("../../../imperative/MMapMarker").MMapMarkerEventHandler | undefined;
63
+ blockEvents?: boolean | undefined;
64
+ blockBehaviors?: boolean | undefined;
65
+ onDoubleClick?: ((event: MouseEvent) => void) | undefined;
66
+ onClick?: ((event: MouseEvent) => void) | undefined;
67
+ onFastClick?: ((event: MouseEvent) => void) | undefined;
68
+ title?: string | undefined;
69
+ subtitle?: string | undefined;
70
+ color?: string | undefined;
71
+ popup?: {
72
+ /** Popup content */
73
+ content: string | ((close: () => void) => HTMLElement);
74
+ /** Popup position */
75
+ position: "top" | "left" | "right";
76
+ /** Should popup hide marker. Default is false */
77
+ hidesMarker?: boolean | undefined;
78
+ } | undefined;
54
79
  children?: import("react").ReactNode;
55
- } & import("react").RefAttributes<import("../../../imperative/MMapEnities").MMapEntity<MMapDefaultMarkerProps, {}>>>>;
80
+ ref?: import("react").Ref<import("../../../imperative/MMapEnities").MMapEntity<MMapDefaultMarkerProps, {}>> | undefined;
81
+ key?: import("react").Key | null | undefined;
82
+ }>>;
56
83
  private _marker;
57
84
  private _container;
58
85
  private _popup;
@@ -1,8 +1,8 @@
1
1
  import type TReactNamespace from "react";
2
- import type { CustomReactify } from "../../../../reactify/reactify";
2
+ import type { CustomReactify, Prettify } from "../../../../reactify/reactify";
3
3
  import type { MMapEntity } from "../../../..";
4
4
  import { MMapDefaultMarker, MMapDefaultMarkerProps } from "../index";
5
5
  type MMapDefaultMarkerContainerProps = TReactNamespace.PropsWithChildren<MMapDefaultMarkerProps>;
6
- type MMapDefaultMarkerR = TReactNamespace.ForwardRefExoticComponent<MMapDefaultMarkerContainerProps & React.RefAttributes<MMapEntity<MMapDefaultMarkerProps>>>;
6
+ type MMapDefaultMarkerR = TReactNamespace.ForwardRefExoticComponent<Prettify<MMapDefaultMarkerContainerProps & React.RefAttributes<MMapEntity<MMapDefaultMarkerProps>>>>;
7
7
  export declare const MMapDefaultMarkerReactifyOverride: CustomReactify<MMapDefaultMarker, MMapDefaultMarkerR>;
8
8
  export {};
@@ -1,7 +1,6 @@
1
1
  import type TReact from "react";
2
- import type { CustomReactify } from "../reactify";
3
- import type { GenericRootEntity } from "../../imperative/Entities";
4
- import type { MMap as MMapI, MMapProps } from "../../imperative/MMap";
2
+ import type { CustomReactify, Prettify } from "../reactify";
3
+ import type { MMap as MMapI, MMapProps as MMapPropsI } from "../../imperative/MMap";
5
4
  declare global {
6
5
  namespace JSX {
7
6
  interface IntrinsicElements {
@@ -9,10 +8,7 @@ declare global {
9
8
  }
10
9
  }
11
10
  }
12
- type ComputedMMapProps = MMapProps & {
13
- container: HTMLElement;
14
- };
15
- type MMapContainerProps = TReact.PropsWithChildren<MMapProps>;
16
- type MMapR = TReact.ForwardRefExoticComponent<MMapContainerProps & TReact.RefAttributes<GenericRootEntity<ComputedMMapProps>>>;
11
+ type MMapContainerProps = TReact.PropsWithChildren<MMapPropsI>;
12
+ type MMapR = TReact.ForwardRefExoticComponent<Prettify<MMapContainerProps & TReact.RefAttributes<MMapI>>>;
17
13
  export declare const MMapReactifyOverride: CustomReactify<MMapI, MMapR>;
18
14
  export {};
@@ -1,11 +1,11 @@
1
1
  import type TReact from "react";
2
- import type { CustomReactify } from "../reactify";
2
+ import type { CustomReactify, Prettify } from "../reactify";
3
3
  import type { GenericEntity } from "../../imperative/Entities";
4
4
  import type { MMapControl as MMapControlI, MMapControlProps } from "../../imperative/MMapControl";
5
5
  type ComputedMMapControlProps = MMapControlProps & {
6
6
  controlElement: HTMLElement;
7
7
  };
8
8
  type MMapControlContainerProps = TReact.PropsWithChildren<MMapControlProps>;
9
- type MMapControlR = TReact.ForwardRefExoticComponent<MMapControlContainerProps & React.RefAttributes<GenericEntity<ComputedMMapControlProps>>>;
9
+ type MMapControlR = TReact.ForwardRefExoticComponent<Prettify<MMapControlContainerProps & React.RefAttributes<GenericEntity<ComputedMMapControlProps>>>>;
10
10
  export declare const MMapControlReactifyOverride: CustomReactify<MMapControlI, MMapControlR>;
11
11
  export {};
@@ -1,8 +1,8 @@
1
1
  import type TReact from "react";
2
- import type { CustomReactify } from "../reactify";
2
+ import type { CustomReactify, Prettify } from "../reactify";
3
3
  import type { MMapControlButton as MMapControlButtonI, MMapControlButtonProps } from "../../imperative/MMapControl";
4
4
  import type { GenericEntity } from "../../imperative/Entities";
5
5
  type MMapControlButtonContainerProps = TReact.PropsWithChildren<MMapControlButtonProps>;
6
- type MMapControlButtonR = TReact.ForwardRefExoticComponent<MMapControlButtonContainerProps & React.RefAttributes<GenericEntity<MMapControlButtonProps>>>;
6
+ type MMapControlButtonR = TReact.ForwardRefExoticComponent<Prettify<MMapControlButtonContainerProps & React.RefAttributes<GenericEntity<MMapControlButtonProps>>>>;
7
7
  export declare const MMapControlButtonReactifyOverride: CustomReactify<MMapControlButtonI, MMapControlButtonR>;
8
8
  export {};
@@ -1,11 +1,11 @@
1
1
  import type TReactNamespace from "react";
2
- import type { CustomReactify } from "../reactify";
2
+ import type { CustomReactify, Prettify } from "../reactify";
3
3
  import type { GenericEntity } from "../../imperative/Entities";
4
4
  import type { MMapMarker as MMapMarkerI, MMapMarkerProps } from "../../imperative/MMapMarker";
5
5
  type ComputedMMapMarkerProps = MMapMarkerProps & {
6
6
  markerElement?: HTMLElement;
7
7
  };
8
8
  type MMapMarkerContainerProps = TReactNamespace.PropsWithChildren<ComputedMMapMarkerProps>;
9
- type MMapMarkerR = TReactNamespace.ForwardRefExoticComponent<MMapMarkerContainerProps & React.RefAttributes<GenericEntity<ComputedMMapMarkerProps>>>;
9
+ type MMapMarkerR = TReactNamespace.ForwardRefExoticComponent<Prettify<MMapMarkerContainerProps & React.RefAttributes<GenericEntity<ComputedMMapMarkerProps>>>>;
10
10
  export declare const MMapMarkerReactifyOverride: CustomReactify<MMapMarkerI, MMapMarkerR>;
11
11
  export {};
@@ -41,6 +41,9 @@ export type ReactifiedModule<TModule extends BaseModule> = {
41
41
  [Property in keyof TModule]: TModule[Property] extends EntityConstructor<GenericEntity<unknown>> ? ReturnType<InternalReactifyEntity<TModule[Property]>> : TModule[Property] extends typeof Context ? ReturnType<GetReactContext<TModule[Property]>> : TModule[Property];
42
42
  };
43
43
  export type BaseModule = Record<string | symbol, unknown>;
44
+ export type Prettify<T> = {
45
+ [K in keyof T]: T[K];
46
+ } & {};
44
47
  export type OverrideProps<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
45
48
  export default function createReactify(React: typeof TReact, ReactDOM: typeof TReactDOM): Reactify;
46
49
  export {};