@mappable-world/mappable-types 0.0.6 → 0.0.8
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.
- package/imperative/MMapControl/MMapControlButton.d.ts +1 -0
- package/imperative/MMapFeature/index.d.ts +3 -1
- package/imperative/MMapMarker/index.d.ts +3 -1
- package/imperative/MMapReactContainer/index.d.ts +3 -0
- package/imperative/config.d.ts +7 -2
- package/imperative/route/driving.d.ts +2 -3
- package/imperative/route/index.d.ts +2 -54
- package/imperative/route/interface.d.ts +47 -0
- package/imperative/route/utils/bounds.d.ts +2 -0
- package/imperative/route/utils/index.d.ts +2 -0
- package/imperative/route/utils/points.d.ts +4 -0
- package/package.json +1 -1
- package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +7 -0
- package/packages/clusterer/MMapClusterer/react/MMapClusterer.d.ts +3 -3
- package/packages/markers/MMapDefaultMarker/index.d.ts +10 -0
- package/reactify/overrides/MMapControlButton.d.ts +8 -0
- package/reactify/overrides/index.d.ts +1 -0
- package/reactify/reactify.d.ts +6 -5
- package/imperative/route/utils.d.ts +0 -21
|
@@ -11,6 +11,8 @@ type MMapFeatureProps = {
|
|
|
11
11
|
source?: string;
|
|
12
12
|
style?: DrawingStyle;
|
|
13
13
|
properties?: Record<string, unknown>;
|
|
14
|
+
/** Do not round coordinates */
|
|
15
|
+
disableRoundCoordinates?: boolean;
|
|
14
16
|
} & DraggableProps<MMapFeatureEventHandler> & FeatureClickEvents;
|
|
15
17
|
declare const defaultProps: Readonly<{
|
|
16
18
|
source: "mappable-default-feature";
|
|
@@ -53,7 +55,7 @@ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
|
|
|
53
55
|
get geometry(): GenericGeometry<LngLat>;
|
|
54
56
|
protected _onAttach(): void;
|
|
55
57
|
protected _onDetach(): void;
|
|
56
|
-
protected _onUpdate({ style, id, source }: Partial<MMapFeatureProps>): void;
|
|
58
|
+
protected _onUpdate({ style, id, source, disableRoundCoordinates }: Partial<MMapFeatureProps>): void;
|
|
57
59
|
private __onDragStart;
|
|
58
60
|
private __onDragMove;
|
|
59
61
|
private __onDragEnd;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LngLat } from "../../common/types";
|
|
2
2
|
import type { DraggableProps, FeatureClickEvents } from "../MMapFeature/types";
|
|
3
|
-
import { reactify } from "../../reactify";
|
|
4
3
|
import { MMapGroupEntity } from "../MMapEnities";
|
|
4
|
+
import { reactify } from "../../reactify";
|
|
5
5
|
/**
|
|
6
6
|
* MMapMarker events handler
|
|
7
7
|
*/
|
|
@@ -17,6 +17,8 @@ type MMapMarkerProps = {
|
|
|
17
17
|
zIndex?: number;
|
|
18
18
|
properties?: Record<string, unknown>;
|
|
19
19
|
id?: string;
|
|
20
|
+
/** Do not round coordinates */
|
|
21
|
+
disableRoundCoordinates?: boolean;
|
|
20
22
|
} & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents;
|
|
21
23
|
declare const defaultProps: Readonly<{
|
|
22
24
|
draggable: false;
|
|
@@ -21,6 +21,9 @@ declare class MMapReactContainer extends MMapGroupEntity<ComputedMMapReactContai
|
|
|
21
21
|
static defaultProps: {
|
|
22
22
|
tagName: string;
|
|
23
23
|
};
|
|
24
|
+
static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapReactContainer, TReact.FC<MMapReactContainerProps<unknown> & {
|
|
25
|
+
children?: TReact.ReactNode;
|
|
26
|
+
}>>;
|
|
24
27
|
element?: Element;
|
|
25
28
|
private _detachDom?;
|
|
26
29
|
private _disposeWatch?;
|
package/imperative/config.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
interface Apikeys {
|
|
2
|
+
suggest?: string;
|
|
3
|
+
router?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class Config {
|
|
2
6
|
readonly description: string;
|
|
3
7
|
setExperiments(experiments: Record<string, boolean>): void;
|
|
8
|
+
setApikeys(apikeys: Apikeys): void;
|
|
4
9
|
}
|
|
5
|
-
export function getDefaultConfig(): Config;
|
|
10
|
+
export declare function getDefaultConfig(): Config;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BaseRouteResponse, RouteFeature, RouteOptions } from ".";
|
|
1
|
+
import type { BaseRouteResponse, RouteFeature, RouteOptions, RawRoute } from "./interface";
|
|
3
2
|
export declare class DrivingRouteResponse implements BaseRouteResponse {
|
|
4
3
|
#private;
|
|
5
4
|
private _options?;
|
|
6
|
-
constructor(data:
|
|
5
|
+
constructor(data: RawRoute, options?: RouteOptions);
|
|
7
6
|
toRoute(): RouteFeature;
|
|
8
7
|
}
|
|
@@ -1,56 +1,4 @@
|
|
|
1
|
-
import type { GenericFeature, LineStringGeometry, LngLat, LngLatBounds } from "../../common/types";
|
|
2
1
|
import { Config } from "../config";
|
|
3
|
-
|
|
4
|
-
UNKNOWN = 1,
|
|
5
|
-
CLOSED = 2,
|
|
6
|
-
FREE = 3,
|
|
7
|
-
LIGHT = 4,
|
|
8
|
-
HARD = 5,
|
|
9
|
-
VERY_HARD = 6
|
|
10
|
-
}
|
|
11
|
-
export type MMapJamSegment = {
|
|
12
|
-
/**
|
|
13
|
-
* Traffic jam type, one of {@link MMapJamType MMapJamType}
|
|
14
|
-
* */
|
|
15
|
-
type: MMapJamType;
|
|
16
|
-
/**
|
|
17
|
-
* How many items of the {@link RouteFeature.coordinates RouteFeature.coordinates}
|
|
18
|
-
* array this {@link JamSegment JamSegment} spans across
|
|
19
|
-
* Use these values to build palettes for a {@link MMapFeature MMapFeature} stroke style
|
|
20
|
-
* */
|
|
21
|
-
count: number;
|
|
22
|
-
};
|
|
23
|
-
export interface RouteFeature extends GenericFeature<LngLat> {
|
|
24
|
-
geometry: LineStringGeometry;
|
|
25
|
-
properties: {
|
|
26
|
-
jams?: MMapJamSegment[];
|
|
27
|
-
bounds?: LngLatBounds;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface RoutePoint {
|
|
31
|
-
type: "way" | "via";
|
|
32
|
-
coordinates: LngLat;
|
|
33
|
-
}
|
|
34
|
-
export interface RouteOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Route points represented by {@link LngLat LngLat} coordinates.
|
|
37
|
-
* Its may be array of {@link LngLat LngLat} or array of {type, coordinates} objects.
|
|
38
|
-
* {@link LngLat LngLat}[] is a shorthand for {type: 'way', coordinates: {@link LngLat LngLat}}[].
|
|
39
|
-
**/
|
|
40
|
-
points: (RoutePoint | LngLat)[];
|
|
41
|
-
/** Route type. Only 'driving' type is available at this moment. */
|
|
42
|
-
type: "driving";
|
|
43
|
-
/** Maximum amount of returned routes. Only one result is available at this moment. */
|
|
44
|
-
results?: 1;
|
|
45
|
-
/** Traffic jams requesting flag. If specified, jams will be returned in properties. Default is `false`. */
|
|
46
|
-
jams?: boolean;
|
|
47
|
-
/** If specified, bounding box of the route will be returned in properties. Default is `false`. */
|
|
48
|
-
bounds?: boolean;
|
|
49
|
-
/** Avoid roads with tolls. Default is `false`. */
|
|
50
|
-
avoidTolls?: boolean;
|
|
51
|
-
}
|
|
52
|
-
export interface BaseRouteResponse {
|
|
53
|
-
/** Return requested route as {@link RouteFeature RouteFeature}. */
|
|
54
|
-
toRoute(): RouteFeature;
|
|
55
|
-
}
|
|
2
|
+
import type { BaseRouteResponse, RouteOptions } from "./interface";
|
|
56
3
|
export declare function route(options: RouteOptions, config?: Config | undefined): Promise<BaseRouteResponse[]>;
|
|
4
|
+
export { RouteOptions, BaseRouteResponse };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { GenericFeature, LineStringGeometry, LngLat, LngLatBounds } from "../../common/types";
|
|
2
|
+
export interface RawStep {
|
|
3
|
+
length: number;
|
|
4
|
+
duration: number;
|
|
5
|
+
mode: string;
|
|
6
|
+
polyline: {
|
|
7
|
+
points: LngLat[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface RawLeg {
|
|
11
|
+
status: string;
|
|
12
|
+
steps: RawStep[];
|
|
13
|
+
}
|
|
14
|
+
export interface RawRoute {
|
|
15
|
+
traffic: string;
|
|
16
|
+
route: {
|
|
17
|
+
legs: RawLeg[];
|
|
18
|
+
flags?: {
|
|
19
|
+
hasTolls?: boolean;
|
|
20
|
+
hasNonTransactionalTolls?: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface RouteFeature extends GenericFeature<LngLat> {
|
|
25
|
+
geometry: LineStringGeometry;
|
|
26
|
+
properties: {
|
|
27
|
+
bounds?: LngLatBounds;
|
|
28
|
+
flags?: {
|
|
29
|
+
hasTolls?: boolean;
|
|
30
|
+
hasNonTransactionalTolls?: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface BaseRouteResponse {
|
|
35
|
+
/** Return requested route as {@link RouteFeature RouteFeature}. */
|
|
36
|
+
toRoute(): RouteFeature;
|
|
37
|
+
}
|
|
38
|
+
export interface RouteOptions {
|
|
39
|
+
/** Route points represented by {@link LngLat LngLat} coordinates. */
|
|
40
|
+
points: LngLat[];
|
|
41
|
+
/** Route type. Only 'driving' type is available at this moment. */
|
|
42
|
+
type: 'driving';
|
|
43
|
+
/** If specified, bounding box of the route will be returned in properties. Default is `false`. */
|
|
44
|
+
bounds?: boolean;
|
|
45
|
+
/** Avoid roads with tolls. Default is `false`. */
|
|
46
|
+
avoidTolls?: boolean;
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -50,6 +50,13 @@ 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"> & {
|
|
54
|
+
marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
55
|
+
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
|
+
}, {}>>>>;
|
|
53
60
|
/** All created entities with cluster id*/
|
|
54
61
|
private _entitiesCache;
|
|
55
62
|
/** 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 } from "../../../../reactify/reactify";
|
|
3
|
+
import type { CustomReactify, OverrideProps } 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 = MMapClustererProps
|
|
36
|
+
type MMapClustererReactifiedProps = 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
|
-
}
|
|
41
|
+
}>;
|
|
42
42
|
type MMapClustererR = TReact.ForwardRefExoticComponent<MMapClustererReactifiedProps & React.RefAttributes<MMapEntity<MMapClustererReactifiedProps>>>;
|
|
43
43
|
export declare const MMapClustererReactifyOverride: CustomReactify<MMapClustererI, MMapClustererR>;
|
|
44
44
|
export {};
|
|
@@ -43,6 +43,16 @@ declare class MMapDefaultMarker extends mappable.MMapComplexEntity<MMapDefaultMa
|
|
|
43
43
|
static defaultProps: Readonly<{
|
|
44
44
|
color: "#f33";
|
|
45
45
|
}>;
|
|
46
|
+
static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapDefaultMarker, import("react").ForwardRefExoticComponent<{
|
|
47
|
+
coordinates: LngLat;
|
|
48
|
+
source?: string | undefined;
|
|
49
|
+
zIndex?: number | undefined;
|
|
50
|
+
properties?: Record<string, unknown> | undefined;
|
|
51
|
+
id?: string | undefined;
|
|
52
|
+
disableRoundCoordinates?: boolean | undefined;
|
|
53
|
+
} & import("../../../imperative/MMapFeature/types").DraggableProps<import("../../../imperative/MMapMarker").MMapMarkerEventHandler> & import("../../../imperative/MMapFeature/types").FeatureClickEvents & DefaultMarkerCustomProps & {
|
|
54
|
+
children?: import("react").ReactNode;
|
|
55
|
+
} & import("react").RefAttributes<import("../../../imperative/MMapEnities").MMapEntity<MMapDefaultMarkerProps, {}>>>>;
|
|
46
56
|
private _marker;
|
|
47
57
|
private _container;
|
|
48
58
|
private _popup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type TReact from "react";
|
|
2
|
+
import type { CustomReactify } from "../reactify";
|
|
3
|
+
import type { MMapControlButton as MMapControlButtonI, MMapControlButtonProps } from "../../imperative/MMapControl";
|
|
4
|
+
import type { GenericEntity } from "../../imperative/Entities";
|
|
5
|
+
type MMapControlButtonContainerProps = TReact.PropsWithChildren<MMapControlButtonProps>;
|
|
6
|
+
type MMapControlButtonR = TReact.ForwardRefExoticComponent<MMapControlButtonContainerProps & React.RefAttributes<GenericEntity<MMapControlButtonProps>>>;
|
|
7
|
+
export declare const MMapControlButtonReactifyOverride: CustomReactify<MMapControlButtonI, MMapControlButtonR>;
|
|
8
|
+
export {};
|
package/reactify/reactify.d.ts
CHANGED
|
@@ -26,20 +26,21 @@ export type CustomReactify<TEntity extends GenericEntity<unknown>, TResult> = (c
|
|
|
26
26
|
React: typeof TReact;
|
|
27
27
|
ReactDOM: typeof TReactDOM;
|
|
28
28
|
}) => TResult;
|
|
29
|
-
export type Overrided<TReactResult> = {
|
|
30
|
-
[overrideKeyReactify]: CustomReactify<
|
|
29
|
+
export type Overrided<TCtor extends EntityConstructor<GenericEntity<unknown>>, TReactResult> = {
|
|
30
|
+
[overrideKeyReactify]: CustomReactify<InstanceType<TCtor>, TReactResult>;
|
|
31
31
|
};
|
|
32
32
|
type InternalReactify<TEntity extends GenericEntity<unknown>> = (ctor: EntityConstructor<TEntity>, displayName?: string) => TReact.ForwardRefExoticComponent<TReact.PropsWithoutRef<TReact.PropsWithChildren<EntityProps<TEntity>>> & React.RefAttributes<TEntity | undefined>>;
|
|
33
|
-
type InternalReactifyEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = (ctor: TCtor, displayName?: string) => TCtor extends Overrided<infer TResult> ? TResult : ReturnType<InternalReactify<InstanceType<TCtor>>>;
|
|
33
|
+
type InternalReactifyEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = (ctor: TCtor, displayName?: string) => TCtor extends Overrided<TCtor, infer TResult> ? TResult : ReturnType<InternalReactify<InstanceType<TCtor>>>;
|
|
34
34
|
export type ReactifyEntity = <TCtor extends EntityConstructor<GenericEntity<unknown>>>(...args: Parameters<InternalReactifyEntity<TCtor>>) => ReturnType<InternalReactifyEntity<TCtor>>;
|
|
35
35
|
export type ReactifiedEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = ReturnType<InternalReactifyEntity<TCtor>>;
|
|
36
|
-
export interface ReactifyModule
|
|
37
|
-
(module: TModule): ReactifiedModule<TModule>;
|
|
36
|
+
export interface ReactifyModule {
|
|
37
|
+
<TModule extends BaseModule = BaseModule>(module: TModule): ReactifiedModule<TModule>;
|
|
38
38
|
}
|
|
39
39
|
export type GetReactContext<TContext extends Context<unknown>> = (context?: TContext | undefined) => React.Context<unknown>;
|
|
40
40
|
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 OverrideProps<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
44
45
|
export default function createReactify(React: typeof TReact, ReactDOM: typeof TReactDOM): Reactify;
|
|
45
46
|
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { GenericMappableFeatureCollection, LngLat, LngLatBounds } from "../../common/types";
|
|
2
|
-
import type { MMapJamSegment } from ".";
|
|
3
|
-
export declare function decodeRouteCoordinates(input: string): LngLat[];
|
|
4
|
-
interface EncodedPathFeatureCollection extends GenericMappableFeatureCollection<LngLat> {
|
|
5
|
-
properties: {
|
|
6
|
-
encodedCoordinates: string;
|
|
7
|
-
jams?: MMapJamSegment[];
|
|
8
|
-
boundedBy?: LngLatBounds;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export interface EncodedRouteFeatureCollection extends GenericMappableFeatureCollection<LngLat> {
|
|
12
|
-
features: EncodedPathFeatureCollection[];
|
|
13
|
-
}
|
|
14
|
-
export interface RawRouteResponse {
|
|
15
|
-
data: {
|
|
16
|
-
features: EncodedRouteFeatureCollection[];
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export declare function prepareRoutes({ data }: RawRouteResponse): EncodedRouteFeatureCollection[];
|
|
20
|
-
export declare function isFiniteBounds(bounds: LngLatBounds): boolean;
|
|
21
|
-
export {};
|