@maplibre/maplibre-react-native 10.0.0-alpha.22 → 10.0.0-alpha.24

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 (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/CONTRIBUTING.md +20 -14
  3. package/README.md +12 -13
  4. package/android/install.md +3 -2
  5. package/android/rctmln/build.gradle +5 -0
  6. package/android/rctmln/src/main/java/com/maplibre/rctmln/components/AbstractEventEmitter.java +9 -1
  7. package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNLocationModule.java +1 -1
  8. package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNLogging.java +1 -1
  9. package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNModule.java +1 -1
  10. package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNOfflineModule.java +1 -1
  11. package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNSnapshotModule.java +1 -1
  12. package/babel.config.js +1 -1
  13. package/docs/Camera.md +1 -1
  14. package/docs/GettingStarted.md +3 -4
  15. package/docs/MapView.md +3 -9
  16. package/docs/ShapeSource.md +4 -7
  17. package/docs/docs.json +15 -15
  18. package/ios/RCTMLN.xcodeproj/project.pbxproj +1 -775
  19. package/ios/install.md +1 -1
  20. package/javascript/MLNModule.ts +1 -1
  21. package/javascript/components/Camera.tsx +8 -8
  22. package/javascript/components/HeadingIndicator.tsx +1 -0
  23. package/javascript/components/MapView.tsx +2 -3
  24. package/javascript/components/MarkerView.tsx +2 -2
  25. package/javascript/components/PointAnnotation.tsx +2 -2
  26. package/javascript/components/ShapeSource.tsx +29 -28
  27. package/javascript/components/Style.tsx +1 -1
  28. package/javascript/modules/offline/OfflineCreatePackOptions.ts +2 -9
  29. package/javascript/modules/snapshot/SnapshotOptions.ts +4 -5
  30. package/javascript/utils/StyleValue.ts +3 -1
  31. package/javascript/utils/makeNativeBounds.ts +5 -0
  32. package/maplibre-react-native.podspec +7 -7
  33. package/package.json +12 -15
  34. package/plugin/build/withMapLibre.js +16 -1
  35. package/plugin/install.md +1 -8
  36. package/scripts/utils/template-globals.js +1 -1
  37. package/style-spec/v8.json +32 -1
  38. package/assets/mapbox_logo.png +0 -0
  39. package/javascript/types/png.d.ts +0 -1
  40. package/javascript/utils/geoUtils.ts +0 -79
@@ -1,79 +0,0 @@
1
- import geoViewport from "@mapbox/geo-viewport";
2
- import along from "@turf/along";
3
- import distance from "@turf/distance";
4
- import {
5
- featureCollection,
6
- point,
7
- feature,
8
- lineString,
9
- Id,
10
- Properties,
11
- } from "@turf/helpers";
12
-
13
- const VECTOR_TILE_SIZE = 512;
14
-
15
- export const makePoint = point;
16
-
17
- export const makeLineString = lineString;
18
-
19
- export function makeLatLngBounds(
20
- northEastCoordinates: GeoJSON.Position,
21
- southWestCoordinates: GeoJSON.Position,
22
- ): GeoJSON.FeatureCollection {
23
- return featureCollection([
24
- point(northEastCoordinates),
25
- point(southWestCoordinates),
26
- ]);
27
- }
28
-
29
- export const makeFeature = feature;
30
-
31
- export function makeFeatureCollection(
32
- features: GeoJSON.Feature[] = [],
33
- options?: { bbox?: GeoJSON.BBox; id?: Id },
34
- ): GeoJSON.FeatureCollection {
35
- return featureCollection(features, options);
36
- }
37
-
38
- export function addToFeatureCollection<T extends GeoJSON.Geometry>(
39
- newFeatureCollection: GeoJSON.FeatureCollection<T, Properties>,
40
- newFeature: GeoJSON.Feature<T, Properties>,
41
- ): GeoJSON.FeatureCollection<T, Properties> {
42
- return {
43
- ...newFeatureCollection,
44
- features: [...newFeatureCollection.features, newFeature],
45
- };
46
- }
47
-
48
- export const calculateDistance = distance;
49
-
50
- export const pointAlongLine = along;
51
-
52
- export function getOrCalculateVisibleRegion(
53
- coord: [number, number] | { lon: number; lat: number },
54
- zoomLevel: number,
55
- width: number,
56
- height: number,
57
- nativeRegion: { properties: { visibleBounds: [number, number][] } },
58
- ): { ne: [number, number]; sw: [number, number] } {
59
- const region = {
60
- ne: [0, 0] as [number, number],
61
- sw: [0, 0] as [number, number],
62
- };
63
-
64
- if (!nativeRegion || !Array.isArray(nativeRegion.properties.visibleBounds)) {
65
- const bounds = geoViewport.bounds(
66
- coord,
67
- zoomLevel,
68
- [width, height],
69
- VECTOR_TILE_SIZE,
70
- );
71
- region.ne = [bounds[3], bounds[2]];
72
- region.sw = [bounds[1], bounds[0]];
73
- } else {
74
- region.ne = nativeRegion.properties.visibleBounds[0];
75
- region.sw = nativeRegion.properties.visibleBounds[1];
76
- }
77
-
78
- return region;
79
- }