react-native-maplibre-lite 0.1.3 → 0.1.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 +133 -45
- package/lib/module/components/MapView.js +55 -20
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/webMapBuild.js +4 -0
- package/lib/module/components/webMapBuild.js.map +1 -0
- package/lib/typescript/src/components/MapView.d.ts +28 -2
- package/lib/typescript/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/src/components/types.d.ts +30 -5
- package/lib/typescript/src/components/types.d.ts.map +1 -1
- package/lib/typescript/src/components/webMapBuild.d.ts +2 -0
- package/lib/typescript/src/components/webMapBuild.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/components/MapView.tsx +72 -33
- package/src/components/types.ts +37 -6
- package/src/components/webMapBuild.ts +4 -0
- package/src/index.tsx +13 -1
- package/lib/module/components/webContent.js +0 -159
- package/lib/module/components/webContent.js.map +0 -1
- package/lib/module/components/webFunctions/addMarkerWeb.js +0 -83
- package/lib/module/components/webFunctions/addMarkerWeb.js.map +0 -1
- package/lib/module/components/webFunctions/addPolygonWeb.js +0 -62
- package/lib/module/components/webFunctions/addPolygonWeb.js.map +0 -1
- package/lib/module/components/webFunctions/addPolylineWeb.js +0 -48
- package/lib/module/components/webFunctions/addPolylineWeb.js.map +0 -1
- package/lib/module/components/webFunctions/fitBoundsWeb.js +0 -15
- package/lib/module/components/webFunctions/fitBoundsWeb.js.map +0 -1
- package/lib/module/components/webFunctions/flyToWeb.js +0 -14
- package/lib/module/components/webFunctions/flyToWeb.js.map +0 -1
- package/lib/module/components/webFunctions/initWeb.js +0 -188
- package/lib/module/components/webFunctions/initWeb.js.map +0 -1
- package/lib/module/components/webFunctions/removeMarkerWeb.js +0 -12
- package/lib/module/components/webFunctions/removeMarkerWeb.js.map +0 -1
- package/lib/module/components/webFunctions/removePolygonWeb.js +0 -22
- package/lib/module/components/webFunctions/removePolygonWeb.js.map +0 -1
- package/lib/module/components/webFunctions/removePolylineWeb.js +0 -17
- package/lib/module/components/webFunctions/removePolylineWeb.js.map +0 -1
- package/lib/module/components/webFunctions/updateWeb.js +0 -78
- package/lib/module/components/webFunctions/updateWeb.js.map +0 -1
- package/lib/typescript/src/components/webContent.d.ts +0 -3
- package/lib/typescript/src/components/webContent.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/addMarkerWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/addMarkerWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/addPolygonWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/addPolygonWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/addPolylineWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/addPolylineWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/fitBoundsWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/fitBoundsWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/flyToWeb.d.ts +0 -2
- package/lib/typescript/src/components/webFunctions/flyToWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/initWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/initWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/removeMarkerWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/removeMarkerWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/removePolygonWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/removePolygonWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/removePolylineWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/removePolylineWeb.d.ts.map +0 -1
- package/lib/typescript/src/components/webFunctions/updateWeb.d.ts +0 -3
- package/lib/typescript/src/components/webFunctions/updateWeb.d.ts.map +0 -1
- package/src/components/webContent.ts +0 -163
- package/src/components/webFunctions/addMarkerWeb.ts +0 -80
- package/src/components/webFunctions/addPolygonWeb.ts +0 -59
- package/src/components/webFunctions/addPolylineWeb.ts +0 -45
- package/src/components/webFunctions/fitBoundsWeb.ts +0 -12
- package/src/components/webFunctions/flyToWeb.ts +0 -11
- package/src/components/webFunctions/initWeb.ts +0 -185
- package/src/components/webFunctions/removeMarkerWeb.ts +0 -9
- package/src/components/webFunctions/removePolygonWeb.ts +0 -19
- package/src/components/webFunctions/removePolylineWeb.ts +0 -14
- package/src/components/webFunctions/updateWeb.ts +0 -75
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MAP_HTML"],"sourceRoot":"../../../src","sources":["components/webMapBuild.ts"],"mappings":"aAAA;AACA;AAEA,MAAO,MAAM,CAAAA,QAAQ,CAAG,y/4yCAAy/4yC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
-
import { type EventParams, type MarkerProps, type
|
|
2
|
+
import { type EventParams, type MapLiteWebError, type MarkerProps, type NavigatorInstructionParams, type NavigatorLang, type NavigatorPositionSetParams, type NavigatorRouteSetParams, type PolygonProps, type PolylineProps } from './types';
|
|
3
3
|
interface MapViewProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
placeholderTheme?: 'light' | 'dark';
|
|
@@ -28,11 +28,37 @@ interface MapViewProps {
|
|
|
28
28
|
performanceMode?: 'quality' | 'balanced' | 'performance';
|
|
29
29
|
pixelRatio?: number;
|
|
30
30
|
turboWhileMoving?: boolean;
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Включает режим навигатора в WebView (стрелка, маршрут GraphHopper, HUD).
|
|
33
|
+
* Должен совпадать с билдом `webMapBuild` / `MapLiteController`.
|
|
34
|
+
*/
|
|
35
|
+
navigator?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Базовый URL GraphHopper для маршрутов навигатора (без обязательного `/route`).
|
|
38
|
+
* Нужен для `setNavigatorPoint` и пересчёта маршрута.
|
|
39
|
+
*/
|
|
40
|
+
graphhopperUrl?: string;
|
|
41
|
+
/** Язык HUD и инструкций навигатора. По умолчанию веб-часть использует `ru`. */
|
|
42
|
+
navigatorLang?: NavigatorLang;
|
|
43
|
+
onNavigatorRouteSet?: (params: NavigatorRouteSetParams) => void;
|
|
44
|
+
onNavigatorInstruction?: (params: NavigatorInstructionParams) => void;
|
|
45
|
+
onNavigatorPositionSet?: (params: NavigatorPositionSetParams) => void;
|
|
46
|
+
/** Ошибки команд WebView (`type: 'error'` из карты). */
|
|
47
|
+
onMapLiteError?: (err: MapLiteWebError) => void;
|
|
32
48
|
}
|
|
33
49
|
export type MapViewRef = {
|
|
34
50
|
fitBounds: () => void;
|
|
35
51
|
flyTo: (center: [number, number], zoom: number) => void;
|
|
52
|
+
/** Построить маршрут до точки (нужен `navigator: true` в MapView). */
|
|
53
|
+
setNavigatorPoint: (latitude: number, longitude: number) => void;
|
|
54
|
+
/** Следующая пошаговая инструкция (для отладки / ручного шага). */
|
|
55
|
+
advanceNavigatorInstruction: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Обновить «текущую позицию» (GPS): snap / reroute / прибытие — на стороне WebView.
|
|
58
|
+
*/
|
|
59
|
+
setNavigatorPosition: (latitude: number, longitude: number) => void;
|
|
60
|
+
/** Режим «клик по карте = новая позиция» (удобно в dev). */
|
|
61
|
+
pickNavigatorPosition: () => void;
|
|
36
62
|
};
|
|
37
63
|
type MapViewRegistry = {
|
|
38
64
|
addMarker: (propsMarker: MarkerProps) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../../src/components/MapView.tsx"],"names":[],"mappings":"AAUA,OAAO,EACH,KAAK,SAAS,EAGd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AAKtB,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,WAAW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AE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,4DAA4D;IAC5D,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACrC,CAAC;AAEF,KAAK,eAAe,GAAG;IACnB,SAAS,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,WAAW,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,cAAc,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;IACvD,UAAU,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACjD,aAAa,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CACvD,CAAC;AAIF,eAAO,MAAM,iBAAiB,uBAI7B,CAAC;AA2BF,eAAO,MAAM,OAAO,qGAoUlB,CAAC"}
|
|
@@ -10,11 +10,6 @@ export type MarkerProps = {
|
|
|
10
10
|
iconHeight?: number;
|
|
11
11
|
html?: string;
|
|
12
12
|
};
|
|
13
|
-
export type SourcesProps = {
|
|
14
|
-
maplibreJS: string;
|
|
15
|
-
maplibreCSS: string;
|
|
16
|
-
pmtilesJS: string;
|
|
17
|
-
};
|
|
18
13
|
export type PolygonProps = {
|
|
19
14
|
ignoreFitBounds?: boolean;
|
|
20
15
|
uniqueId: string;
|
|
@@ -39,4 +34,34 @@ export type EventParams = {
|
|
|
39
34
|
};
|
|
40
35
|
zoom?: number;
|
|
41
36
|
};
|
|
37
|
+
export type NavigatorLang = 'ru' | 'en';
|
|
38
|
+
/** [longitude, latitude] — как в GeoJSON / GraphHopper. */
|
|
39
|
+
export type NavigatorLngLat = {
|
|
40
|
+
lng: number;
|
|
41
|
+
lat: number;
|
|
42
|
+
};
|
|
43
|
+
export type NavigatorRouteSetParams = {
|
|
44
|
+
destination: NavigatorLngLat;
|
|
45
|
+
distanceMeters?: number;
|
|
46
|
+
timeMs?: number;
|
|
47
|
+
pointsCount: number;
|
|
48
|
+
instructionsCount: number;
|
|
49
|
+
};
|
|
50
|
+
export type NavigatorInstructionParams = {
|
|
51
|
+
text: string;
|
|
52
|
+
streetName?: string;
|
|
53
|
+
sign: number;
|
|
54
|
+
distance: number;
|
|
55
|
+
time: number;
|
|
56
|
+
};
|
|
57
|
+
export type NavigatorPositionMode = 'noRoute' | 'arrived' | 'snapped' | 'rerouted';
|
|
58
|
+
export type NavigatorPositionSetParams = {
|
|
59
|
+
point: NavigatorLngLat;
|
|
60
|
+
mode: NavigatorPositionMode;
|
|
61
|
+
distanceFromRouteMeters: number;
|
|
62
|
+
};
|
|
63
|
+
export type MapLiteWebError = {
|
|
64
|
+
target: string;
|
|
65
|
+
message: string;
|
|
66
|
+
};
|
|
42
67
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CAEjB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAA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