@mappable-world/mappable-types 0.0.2 → 0.0.4
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/README.md +2 -2
- package/imperative/MMapDefaultSchemeLayer/index.d.ts +1 -1
- package/imperative/MMapReactContainer/index.d.ts +2 -2
- package/imperative/index.d.ts +4 -1
- package/imperative/route/index.d.ts +3 -1
- package/imperative/suggest.d.ts +21 -7
- package/imperative/wrappers.d.ts +42 -0
- package/import.d.ts +1 -1
- package/main.d.ts +7 -3
- package/modules/types.d.ts +2 -2
- package/package.json +2 -2
- package/packages/cartesian-projection/index.d.ts +1 -1
- package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +1 -2
- package/packages/controls/MMapZoomControl/index.d.ts +1 -1
- package/packages/hint/MMapHint/index.d.ts +2 -2
- package/packages/markers/MMapDefaultMarker/index.d.ts +3 -4
- package/packages/spherical-mercator-projection/index.d.ts +1 -1
- package/packages/types.d.ts +6 -6
- package/reactify/index.d.ts +10 -2
- package/reactify/reactify.d.ts +6 -4
- /package/imperative/{mappableMaps.d.ts → mappable-worldMaps.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Type definitions for Mappable Maps JavaScript API (https://mappable.world).
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm i @mappable/mappable-types -D
|
|
10
|
+
npm i @mappable-world/mappable-types -D
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
tsconfig.json
|
|
@@ -15,7 +15,7 @@ tsconfig.json
|
|
|
15
15
|
```json
|
|
16
16
|
{
|
|
17
17
|
"compilerOptions": {
|
|
18
|
-
"types": ["@mappable/mappable-types"]
|
|
18
|
+
"types": ["@mappable-world/mappable-types"]
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type TReact from "react";
|
|
2
2
|
import type { Context } from "../Entities";
|
|
3
|
-
import { reactify } from "../../reactify";
|
|
4
3
|
import { MMapGroupEntity } from "../MMapEnities";
|
|
4
|
+
import { overrideKeyReactify } from "../wrappers";
|
|
5
5
|
interface MMapReactContainerPropsImpl<TContext> {
|
|
6
6
|
onElement: (element?: Element) => void;
|
|
7
7
|
onContext: (context?: TContext) => void;
|
|
@@ -22,7 +22,7 @@ declare class MMapReactContainer extends MMapGroupEntity<ComputedMMapReactContai
|
|
|
22
22
|
tagName: string;
|
|
23
23
|
};
|
|
24
24
|
/** @internal */
|
|
25
|
-
static [
|
|
25
|
+
static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<MMapReactContainer, TReact.FC<MMapReactContainerProps<unknown> & {
|
|
26
26
|
children?: TReact.ReactNode;
|
|
27
27
|
}>>;
|
|
28
28
|
element?: Element;
|
package/imperative/index.d.ts
CHANGED
|
@@ -8,12 +8,13 @@ export { MMapFeatureDataSource, MMapFeatureDataSourceProps } from "./MMapFeature
|
|
|
8
8
|
export { MMapLayer, MMapLayerProps } from "./MMapLayer";
|
|
9
9
|
export * from "./MMapListener";
|
|
10
10
|
export * from "./MMapHotspot";
|
|
11
|
+
export * from "./wrappers";
|
|
11
12
|
export { MMapMarker, MMapMarkerProps, MMapMarkerEventHandler } from "./MMapMarker";
|
|
12
13
|
export { MMapTileDataSource, MMapTileDataSourceProps } from "./MMapTileDataSource";
|
|
13
14
|
export { MMapControls, MMapControlsProps } from "./MMapControls";
|
|
14
15
|
export { MMapControl, MMapControlProps, MMapControlButton, MMapControlButtonProps, MMapControlCommonButton } from "./MMapControl";
|
|
15
16
|
export { MMapCollection } from "./MMapCollection";
|
|
16
|
-
export * from "./
|
|
17
|
+
export * from "./mappable-worldMaps";
|
|
17
18
|
export * from "./search";
|
|
18
19
|
export * from "./suggest";
|
|
19
20
|
export * from "./route";
|
|
@@ -22,4 +23,6 @@ export { useDomContext } from "./DomContext";
|
|
|
22
23
|
export { Config, getDefaultConfig } from "./config";
|
|
23
24
|
export { fetchConfig, FetchConfigOptions } from "./fetchConfig";
|
|
24
25
|
export * as projections from "./utils/projections";
|
|
26
|
+
/** Toggle this to enable/disable strict mode. */
|
|
27
|
+
export declare let strictMode: boolean;
|
|
25
28
|
export type { LngLat, ReadonlyLngLat, LngLatBounds, BehaviorType, MapMode, Margin, ZoomRange, ZoomStrategy, ZoomRounding, VectorCustomization, RasterTileDataSourceDescription, VectorTileDataSourceDescription, RasterLayerOptions, EasingFunctionDescription, EasingPresetName, EasingBezierPreset, EasingFunction, DrawingStyle, DrawingStyleIcon, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority } from "../common/types";
|
|
@@ -44,8 +44,10 @@ export interface RouteOptions {
|
|
|
44
44
|
results?: 1;
|
|
45
45
|
/** Traffic jams requesting flag. If specified, jams will be returned in properties. Default is `false`. */
|
|
46
46
|
jams?: boolean;
|
|
47
|
-
/**
|
|
47
|
+
/** If specified, bounding box of the route will be returned in properties. Default is `false`. */
|
|
48
48
|
bounds?: boolean;
|
|
49
|
+
/** Avoid roads with tolls. Default is `false`. */
|
|
50
|
+
avoidTolls?: boolean;
|
|
49
51
|
}
|
|
50
52
|
export interface BaseRouteResponse {
|
|
51
53
|
/** Return requested route as {@link RouteFeature RouteFeature}. */
|
package/imperative/suggest.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { LngLat, LngLatBounds } from "../common/types";
|
|
2
2
|
import { Config } from "./config";
|
|
3
|
-
type
|
|
3
|
+
type DeprecatedGeoSuggestType = "all" | "toponyms" | "addresses" | "organizations";
|
|
4
|
+
type GeoSuggestType = "biz" | "geo" | "street" | "metro" | "district" | "locality" | "area" | "province" | "country" | "house";
|
|
4
5
|
export type SuggestOptions = {
|
|
5
6
|
text: string;
|
|
6
7
|
center?: LngLat;
|
|
7
8
|
span?: LngLat;
|
|
8
9
|
bounds?: LngLatBounds;
|
|
9
|
-
countries?: string;
|
|
10
|
-
type?: GeoSuggestType;
|
|
11
10
|
limit?: number;
|
|
12
11
|
localOnly?: number;
|
|
13
12
|
highlight?: boolean;
|
|
13
|
+
types?: GeoSuggestType[];
|
|
14
|
+
/** @deprecated */
|
|
15
|
+
countries?: string;
|
|
16
|
+
/** @deprecated use types instead */
|
|
17
|
+
type?: DeprecatedGeoSuggestType;
|
|
14
18
|
};
|
|
15
|
-
type
|
|
19
|
+
type DeprecatedObjectType = "unknown" | "toponym" | "business" | "transit";
|
|
16
20
|
/** Positions of chars to highlight between */
|
|
17
21
|
type Highlight = [
|
|
18
22
|
number,
|
|
@@ -22,15 +26,25 @@ type TextWithHighlight = {
|
|
|
22
26
|
text: string;
|
|
23
27
|
hl: Highlight[];
|
|
24
28
|
};
|
|
29
|
+
type Distance = {
|
|
30
|
+
text: string;
|
|
31
|
+
value: number;
|
|
32
|
+
};
|
|
25
33
|
export type SuggestResponseItem = {
|
|
26
|
-
/** Type of suggested object */
|
|
27
|
-
type?: ObjectType;
|
|
28
34
|
/** Human-readable object title with matching highlighting */
|
|
29
35
|
title: TextWithHighlight;
|
|
30
36
|
/** Human-readable object subtitle with matching highlighting */
|
|
31
37
|
subtitle?: TextWithHighlight;
|
|
32
|
-
/**
|
|
38
|
+
/** Distance to the object in meters */
|
|
39
|
+
distance?: Distance;
|
|
40
|
+
/** Additional object information that can be used in a Geocoder HTTP API request. */
|
|
41
|
+
uri?: string;
|
|
42
|
+
/** Object tags. Possible values: business, street, metro, district, locality, area, province, country, hydro, railway, station, route, vegetation, airport, other, house */
|
|
43
|
+
tags?: string[];
|
|
44
|
+
/** @deprecated Use uri instead */
|
|
33
45
|
value: string;
|
|
46
|
+
/** @deprecated Use tags instead */
|
|
47
|
+
type?: DeprecatedObjectType;
|
|
34
48
|
};
|
|
35
49
|
export type SuggestResponse = SuggestResponseItem[];
|
|
36
50
|
export declare function suggest(options: SuggestOptions, config?: Config | undefined): Promise<SuggestResponse>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key is used in `reactify` wrapper, to define custom implementations for react mappable.MMapEntity entities
|
|
3
|
+
* ```typescript
|
|
4
|
+
* type MMapSomeClassProps = {
|
|
5
|
+
* id: string;
|
|
6
|
+
* };
|
|
7
|
+
* export class MMapSomeClass extends mappable.MMapComplexEntity<MMapSomeClassProps> {
|
|
8
|
+
* static [mappable.overrideKeyReactify] = MMapSomeClassReactifyOverride;
|
|
9
|
+
* //...
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
* and
|
|
13
|
+
* ```jsx
|
|
14
|
+
* export const MMapSomeClassReactifyOverride = (
|
|
15
|
+
* MMapSomeClassI, // it is same MMapSomeClass
|
|
16
|
+
* {reactify, React}
|
|
17
|
+
* ) => {
|
|
18
|
+
* const MMapSomeClassReactified = reactify.entity(MMapSomeClassI); // Standard reactivation method
|
|
19
|
+
* const MMapSomeClassR = React.forwardRef((props, ref) => {
|
|
20
|
+
* return (<>
|
|
21
|
+
* <MMapSomeClassReactified {...props} ref={ref} ... />
|
|
22
|
+
* </>);
|
|
23
|
+
* })
|
|
24
|
+
* return MMapSomeClassR;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
* and in the end app
|
|
28
|
+
* ```jsx
|
|
29
|
+
* import {MMapSomeClass} from './some-class';
|
|
30
|
+
* import React from 'react';
|
|
31
|
+
* import ReactDOM from 'react-dom';
|
|
32
|
+
* // ...
|
|
33
|
+
* const mappableReact = await mappable.import('@mappable-world/mappable-reactify');
|
|
34
|
+
* const reactify = mappableReact.reactify.bindTo(React, ReactDOM);
|
|
35
|
+
* const {MMapSomeClass as MMapSomeClassR} = reactify.module({MMapSomeClass});
|
|
36
|
+
*
|
|
37
|
+
* function App() {
|
|
38
|
+
* return <MMapSomeClassR id="some_id"/>;
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const overrideKeyReactify: unique symbol;
|
package/import.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface Import {
|
|
|
20
20
|
declare global {
|
|
21
21
|
const __MODULES__: string[];
|
|
22
22
|
const __PACKAGES__: string[];
|
|
23
|
-
const __VENDOR__: "mappable" | "mappable";
|
|
23
|
+
const __VENDOR__: "mappable-world" | "mappable-world";
|
|
24
24
|
const __NAMESPACE__: "mappable" | "mappable";
|
|
25
25
|
const __LOGO_WIDHT__: `${number}px`;
|
|
26
26
|
}
|
package/main.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "./imperative";
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
|
|
2
|
+
export * as __implReactify from "./reactify";
|
|
3
|
+
export declare const __implReactifyOverride: (reactify: import("./reactify").Reactify) => {
|
|
4
|
+
reactify: import("./reactify").Reactify;
|
|
5
|
+
MMapReactContainer: import("react").FC<import("./imperative/MMapReactContainer").MMapReactContainerProps<unknown> & {
|
|
6
|
+
children?: import("react").ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
package/modules/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../import";
|
|
2
2
|
declare module "../import" {
|
|
3
3
|
interface Import {
|
|
4
|
-
(pkg: "@mappable/mappable-controls-extra"): Promise<typeof import("./controls-extra")>;
|
|
5
|
-
(pkg: "@mappable/mappable-reactify"): Promise<typeof import("../reactify")>;
|
|
4
|
+
(pkg: "@mappable-world/mappable-controls-extra"): Promise<typeof import("./controls-extra")>;
|
|
5
|
+
(pkg: "@mappable-world/mappable-reactify"): Promise<typeof import("../reactify")>;
|
|
6
6
|
}
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappable-world/mappable-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Types for mappable maps library",
|
|
5
5
|
"main": "",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"keywords": [
|
|
8
|
-
"mappable",
|
|
8
|
+
"mappable-world",
|
|
9
9
|
"api",
|
|
10
10
|
"map",
|
|
11
11
|
"mappable",
|
|
@@ -18,7 +18,7 @@ import type { Projection, LngLat, WorldCoordinates } from "../../common/types";
|
|
|
18
18
|
* const PIC_WIDTH = 2526;
|
|
19
19
|
* const PIC_HEIGHT = 1642;
|
|
20
20
|
*
|
|
21
|
-
* const {Cartesian} = await mappable.import('@mappable/mappable-cartesian-projection@0.0.1');
|
|
21
|
+
* const {Cartesian} = await mappable.import('@mappable-world/mappable-cartesian-projection@0.0.1');
|
|
22
22
|
* // We set as a projection Cartesian. With this calculation, the center of the image will lie in the coordinates [0, 0].
|
|
23
23
|
* const projection = new Cartesian([
|
|
24
24
|
* [-PIC_WIDTH / 2, PIC_HEIGHT / 2 - worldSize],
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MMapEntity } from "../../..";
|
|
2
2
|
import type { LngLat } from "../../../common/types";
|
|
3
|
-
import { reactify } from "../../../reactify";
|
|
4
3
|
import type { ClustererObject, Feature, IClusterMethod } from "./interface";
|
|
5
4
|
/**
|
|
6
5
|
* MMapClusterer props
|
|
@@ -52,7 +51,7 @@ declare class MMapClusterer extends mappable.MMapComplexEntity<MMapClustererProp
|
|
|
52
51
|
tickTimeout: 200;
|
|
53
52
|
}>;
|
|
54
53
|
/** @internal */
|
|
55
|
-
static [
|
|
54
|
+
static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapClusterer, import("react").ForwardRefExoticComponent<MMapClustererProps & {
|
|
56
55
|
marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
57
56
|
cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
58
57
|
} & import("react").RefAttributes<MMapEntity<MMapClustererProps & {
|
|
@@ -20,7 +20,7 @@ type DefaultProps = typeof defaultProps;
|
|
|
20
20
|
* @example
|
|
21
21
|
* ```javascript
|
|
22
22
|
* const controls = new MMapControls({position: 'right'});
|
|
23
|
-
* const {MMapZoomControl} = await mappable.import('@mappable/mappable-controls@0.0.1');
|
|
23
|
+
* const {MMapZoomControl} = await mappable.import('@mappable-world/mappable-controls@0.0.1');
|
|
24
24
|
* const zoomControl = new MMapZoomControl();
|
|
25
25
|
* controls.addChild(zoomControl);
|
|
26
26
|
* map.addChild(controls);
|
|
@@ -11,14 +11,14 @@ declare const MMapHintContext: import("../../../imperative/Entities").Context<un
|
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```javascript
|
|
14
|
-
* const {MMapHint, MMapHintContext} = await mappable.import('@mappable/mappable-hint@0.0.1');
|
|
14
|
+
* const {MMapHint, MMapHintContext} = await mappable.import('@mappable-world/mappable-hint@0.0.1');
|
|
15
15
|
* map.addChild(defaultFeatures = new MMapDefaultFeaturesLayer());
|
|
16
16
|
* map.addChild(hint = MMapHint({
|
|
17
17
|
* layers: [defaultFeatures.layer],
|
|
18
18
|
* hint: object => object?.properties?.hint
|
|
19
19
|
* }));
|
|
20
20
|
*
|
|
21
|
-
* const {MMapDefaultMarker} = await mappable.import('@mappable/mappable-markers@0.0.1');
|
|
21
|
+
* const {MMapDefaultMarker} = await mappable.import('@mappable-world/mappable-markers@0.0.1');
|
|
22
22
|
* map.addChild(new MMapDefaultMarker({coordinates: [37, 55], properties: {hint: 'Hello world!'}}));
|
|
23
23
|
*
|
|
24
24
|
* hint.addChild(new class MyHint extends mappable.MMapEntity {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { LngLat } from "../../../common/types";
|
|
2
2
|
import type { MMapMarkerProps } from "../../../imperative/MMapMarker";
|
|
3
|
-
import { reactify } from "../../../reactify";
|
|
4
3
|
type DefaultMarkerCustomProps = {
|
|
5
4
|
/** Marker title */
|
|
6
5
|
title?: string;
|
|
@@ -31,7 +30,7 @@ type DefaultProps = typeof defaultProps;
|
|
|
31
30
|
*
|
|
32
31
|
* @example
|
|
33
32
|
* ```javascript
|
|
34
|
-
* const {MMapDefaultMarker} = await mappable.import('@mappable/mappable-markers@0.0.1');
|
|
33
|
+
* const {MMapDefaultMarker} = await mappable.import('@mappable-world/mappable-markers@0.0.1');
|
|
35
34
|
* map.addChild(new MMapDefaultMarker({
|
|
36
35
|
* coordinates: [34, 54],
|
|
37
36
|
* title: 'Hello World!',
|
|
@@ -45,8 +44,8 @@ declare class MMapDefaultMarker extends mappable.MMapComplexEntity<MMapDefaultMa
|
|
|
45
44
|
color: "#f33";
|
|
46
45
|
}>;
|
|
47
46
|
/** @internal */
|
|
48
|
-
static [
|
|
49
|
-
coordinates: LngLat;
|
|
47
|
+
static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapDefaultMarker, import("react").ForwardRefExoticComponent<{
|
|
48
|
+
coordinates: LngLat; /** Should popup hide marker. Default is false */
|
|
50
49
|
source?: string | undefined;
|
|
51
50
|
zIndex?: number | undefined;
|
|
52
51
|
properties?: Record<string, unknown> | undefined;
|
|
@@ -7,7 +7,7 @@ import type { Projection } from "../../common/types";
|
|
|
7
7
|
* @static
|
|
8
8
|
* @example
|
|
9
9
|
* ```js
|
|
10
|
-
* const { SphericalMercator } = await mappable.import('@mappable/mappable-spherical-mercator-projection@0.0.1');
|
|
10
|
+
* const { SphericalMercator } = await mappable.import('@mappable-world/mappable-spherical-mercator-projection@0.0.1');
|
|
11
11
|
* // Create a map in the spherical Mercator projection
|
|
12
12
|
* const map = new mappable.MMap(document.getElementById('MMapsID'), {
|
|
13
13
|
* location: {
|
package/packages/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../import";
|
|
2
2
|
declare module "../import" {
|
|
3
3
|
interface Import {
|
|
4
|
-
(pkg: "@mappable/mappable-cartesian-projection@0.0.1"): Promise<typeof import("./cartesian-projection")>;
|
|
5
|
-
(pkg: "@mappable/mappable-spherical-mercator-projection@0.0.1"): Promise<typeof import("./spherical-mercator-projection")>;
|
|
6
|
-
(pkg: "@mappable/mappable-controls@0.0.1"): Promise<typeof import("./controls")>;
|
|
7
|
-
(pkg: "@mappable/mappable-markers@0.0.1"): Promise<typeof import("./markers")>;
|
|
8
|
-
(pkg: "@mappable/mappable-hint@0.0.1"): Promise<typeof import("./hint")>;
|
|
9
|
-
(pkg: "@mappable/mappable-clusterer@0.0.1"): Promise<typeof import("./clusterer")>;
|
|
4
|
+
(pkg: "@mappable-world/mappable-cartesian-projection@0.0.1"): Promise<typeof import("./cartesian-projection")>;
|
|
5
|
+
(pkg: "@mappable-world/mappable-spherical-mercator-projection@0.0.1"): Promise<typeof import("./spherical-mercator-projection")>;
|
|
6
|
+
(pkg: "@mappable-world/mappable-controls@0.0.1"): Promise<typeof import("./controls")>;
|
|
7
|
+
(pkg: "@mappable-world/mappable-markers@0.0.1"): Promise<typeof import("./markers")>;
|
|
8
|
+
(pkg: "@mappable-world/mappable-hint@0.0.1"): Promise<typeof import("./hint")>;
|
|
9
|
+
(pkg: "@mappable-world/mappable-clusterer@0.0.1"): Promise<typeof import("./clusterer")>;
|
|
10
10
|
}
|
|
11
11
|
}
|
package/reactify/index.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { Reactify, ReactifyEntity, ReactifiedEntity, ReactifyModule, ReactifiedModule } from "./reactify";
|
|
2
|
-
import {
|
|
2
|
+
import type { MMapReactContainer } from "../imperative/MMapReactContainer";
|
|
3
|
+
import { overrideKeyReactify } from "../imperative/wrappers";
|
|
3
4
|
type TReact = typeof import("react");
|
|
4
5
|
type TReactDOM = typeof import("react-dom");
|
|
5
6
|
export type { Reactify, ReactifyEntity, ReactifiedEntity, ReactifyModule, ReactifiedModule };
|
|
6
7
|
export type GenericReactify = {
|
|
7
|
-
readonly overrideKey: typeof
|
|
8
|
+
readonly overrideKey: typeof overrideKeyReactify;
|
|
8
9
|
bindTo(React: TReact, ReactDOM: TReactDOM): Reactify;
|
|
9
10
|
};
|
|
10
11
|
export declare const reactify: Readonly<GenericReactify>;
|
|
12
|
+
declare module "./reactify" {
|
|
13
|
+
interface ReactifyModule<TModule extends BaseModule = BaseModule> {
|
|
14
|
+
(module: typeof import("../index")): ReactifiedModule<BaseModule & typeof import("../index") & {
|
|
15
|
+
MMapReactContainer: typeof MMapReactContainer;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/reactify/reactify.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type TReact from "react";
|
|
2
2
|
import type TReactDOM from "react-dom";
|
|
3
3
|
import { GenericEntity, Context, EntityConstructor, EntityProps } from "../imperative/Entities";
|
|
4
|
+
import { overrideKeyReactify } from "../imperative/wrappers";
|
|
4
5
|
type RefInstance<TEntity extends GenericEntity<unknown>> = React.MutableRefObject<TEntity | undefined>;
|
|
5
6
|
interface ReactParent {
|
|
6
7
|
entityRef: RefInstance<GenericEntity<unknown>>;
|
|
@@ -15,10 +16,9 @@ export type Reactify = {
|
|
|
15
16
|
entity: ReactifyEntity;
|
|
16
17
|
};
|
|
17
18
|
export declare const moduleOverrideExport: string;
|
|
18
|
-
export declare const overrideKey: unique symbol;
|
|
19
19
|
export type CustomReactify<TEntity extends GenericEntity<unknown>, TResult> = (ctor: EntityConstructor<TEntity>, params: {
|
|
20
20
|
reactify: {
|
|
21
|
-
module:
|
|
21
|
+
module: ReactifyModule;
|
|
22
22
|
entity<T extends EntityConstructor<GenericEntity<unknown>> = EntityConstructor<TEntity>>(...args: Parameters<InternalReactifyEntity<T>>): ReturnType<InternalReactifyEntity<T>>;
|
|
23
23
|
context: <TContext extends Context<unknown>>(context?: TContext) => TReact.Context<unknown>;
|
|
24
24
|
};
|
|
@@ -27,13 +27,15 @@ export type CustomReactify<TEntity extends GenericEntity<unknown>, TResult> = (c
|
|
|
27
27
|
ReactDOM: typeof TReactDOM;
|
|
28
28
|
}) => TResult;
|
|
29
29
|
export type Overrided<TReactResult> = {
|
|
30
|
-
[
|
|
30
|
+
[overrideKeyReactify]: CustomReactify<GenericEntity<unknown>, 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
33
|
type InternalReactifyEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = (ctor: TCtor, displayName?: string) => TCtor extends Overrided<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
|
|
36
|
+
export interface ReactifyModule<TModule extends BaseModule = BaseModule> {
|
|
37
|
+
(module: TModule): ReactifiedModule<TModule>;
|
|
38
|
+
}
|
|
37
39
|
export type GetReactContext<TContext extends Context<unknown>> = (context?: TContext | undefined) => React.Context<unknown>;
|
|
38
40
|
export type ReactifiedModule<TModule extends BaseModule> = {
|
|
39
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];
|
|
File without changes
|