@rnmapbox/maps 10.0.0-beta.74 → 10.0.0-beta.75

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 (96) hide show
  1. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +61 -46
  2. package/index.d.ts +28 -257
  3. package/javascript/components/ImageSource.tsx +81 -0
  4. package/javascript/components/{MapView.js → MapView.tsx} +456 -383
  5. package/javascript/components/NativeBridgeComponent.tsx +1 -1
  6. package/javascript/components/RasterDemSource.tsx +105 -0
  7. package/javascript/components/RasterSource.tsx +124 -0
  8. package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +21 -6
  9. package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +19 -4
  10. package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +77 -21
  11. package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +27 -3
  12. package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +1 -1
  13. package/javascript/utils/geoUtils.ts +91 -0
  14. package/javascript/utils/{index.js → index.ts} +41 -19
  15. package/lib/commonjs/components/ImageSource.js +8 -25
  16. package/lib/commonjs/components/ImageSource.js.map +1 -1
  17. package/lib/commonjs/components/MapView.js +30 -289
  18. package/lib/commonjs/components/MapView.js.map +1 -1
  19. package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
  20. package/lib/commonjs/components/RasterDemSource.js +3 -37
  21. package/lib/commonjs/components/RasterDemSource.js.map +1 -1
  22. package/lib/commonjs/components/RasterSource.js +2 -46
  23. package/lib/commonjs/components/RasterSource.js.map +1 -1
  24. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -4
  25. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  26. package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
  27. package/lib/commonjs/modules/offline/offlineManager.js +1 -2
  28. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  29. package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
  30. package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
  31. package/lib/commonjs/utils/geoUtils.js +15 -23
  32. package/lib/commonjs/utils/geoUtils.js.map +1 -1
  33. package/lib/commonjs/utils/index.js +3 -6
  34. package/lib/commonjs/utils/index.js.map +1 -1
  35. package/lib/module/components/ImageSource.js +8 -25
  36. package/lib/module/components/ImageSource.js.map +1 -1
  37. package/lib/module/components/MapView.js +31 -290
  38. package/lib/module/components/MapView.js.map +1 -1
  39. package/lib/module/components/NativeBridgeComponent.js.map +1 -1
  40. package/lib/module/components/RasterDemSource.js +4 -38
  41. package/lib/module/components/RasterDemSource.js.map +1 -1
  42. package/lib/module/components/RasterSource.js +3 -47
  43. package/lib/module/components/RasterSource.js.map +1 -1
  44. package/lib/module/modules/offline/OfflineCreatePackOptions.js +2 -4
  45. package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  46. package/lib/module/modules/offline/OfflinePack.js.map +1 -1
  47. package/lib/module/modules/offline/offlineManager.js +0 -1
  48. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  49. package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
  50. package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
  51. package/lib/module/utils/geoUtils.js +7 -18
  52. package/lib/module/utils/geoUtils.js.map +1 -1
  53. package/lib/module/utils/index.js +3 -5
  54. package/lib/module/utils/index.js.map +1 -1
  55. package/lib/typescript/components/ImageSource.d.ts +32 -0
  56. package/lib/typescript/components/ImageSource.d.ts.map +1 -0
  57. package/lib/typescript/components/MapView.d.ts +472 -0
  58. package/lib/typescript/components/MapView.d.ts.map +1 -0
  59. package/lib/typescript/components/NativeBridgeComponent.d.ts +1 -1
  60. package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -1
  61. package/lib/typescript/components/PointAnnotation.d.ts +1 -1
  62. package/lib/typescript/components/RasterDemSource.d.ts +46 -0
  63. package/lib/typescript/components/RasterDemSource.d.ts.map +1 -0
  64. package/lib/typescript/components/RasterSource.d.ts +59 -0
  65. package/lib/typescript/components/RasterSource.d.ts.map +1 -0
  66. package/lib/typescript/components/ShapeSource.d.ts +1 -1
  67. package/lib/typescript/components/VectorSource.d.ts +1 -1
  68. package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts +22 -0
  69. package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -0
  70. package/lib/typescript/modules/offline/OfflinePack.d.ts +24 -0
  71. package/lib/typescript/modules/offline/OfflinePack.d.ts.map +1 -0
  72. package/lib/typescript/modules/offline/offlineManager.d.ts +219 -0
  73. package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -0
  74. package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts +41 -0
  75. package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts.map +1 -0
  76. package/lib/typescript/modules/snapshot/snapshotManager.d.ts +51 -0
  77. package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -0
  78. package/lib/typescript/utils/geoUtils.d.ts +23 -0
  79. package/lib/typescript/utils/geoUtils.d.ts.map +1 -0
  80. package/lib/typescript/utils/index.d.ts +48 -0
  81. package/lib/typescript/utils/index.d.ts.map +1 -0
  82. package/package.json +3 -1
  83. package/javascript/components/ImageSource.js +0 -82
  84. package/javascript/components/RasterDemSource.js +0 -106
  85. package/javascript/components/RasterSource.js +0 -124
  86. package/javascript/utils/geoUtils.d.ts +0 -10
  87. package/javascript/utils/geoUtils.js +0 -73
  88. package/javascript/utils/index.d.ts +0 -27
  89. package/lib/commonjs/utils/geoUtils.d.js +0 -2
  90. package/lib/commonjs/utils/geoUtils.d.js.map +0 -1
  91. package/lib/commonjs/utils/index.d.js +0 -2
  92. package/lib/commonjs/utils/index.d.js.map +0 -1
  93. package/lib/module/utils/geoUtils.d.js +0 -2
  94. package/lib/module/utils/geoUtils.d.js.map +0 -1
  95. package/lib/module/utils/index.d.js +0 -2
  96. package/lib/module/utils/index.d.js.map +0 -1
@@ -1,106 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { NativeModules, requireNativeComponent } from 'react-native';
4
-
5
- import { cloneReactChildrenWithProps, viewPropTypes } from '../utils';
6
-
7
- import AbstractSource from './AbstractSource';
8
-
9
- const isTileTemplateUrl = (url) =>
10
- url &&
11
- (url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
12
-
13
- const MapboxGL = NativeModules.MGLModule;
14
-
15
- export const NATIVE_MODULE_NAME = 'RCTMGLRasterDemSource';
16
-
17
- class RasterDemSource extends AbstractSource {
18
- static propTypes = {
19
- ...viewPropTypes,
20
-
21
- /**
22
- * A string that uniquely identifies the source.
23
- */
24
- id: PropTypes.string.isRequired,
25
-
26
- /**
27
- * A URL to a TileJSON configuration file describing the source’s contents and other metadata.
28
- */
29
- url: PropTypes.string,
30
-
31
- /**
32
- * An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
33
- * Example: https://example.com/raster-tiles/{z}/{x}/{y}.png
34
- */
35
- tileUrlTemplates: PropTypes.arrayOf(PropTypes.string),
36
-
37
- /**
38
- * An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
39
- * The value should be between 0 and 22, inclusive, and less than
40
- * maxZoomLevel, if specified. The default value for this option is 0.
41
- */
42
- minZoomLevel: PropTypes.number,
43
-
44
- /**
45
- * An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
46
- * The value should be between 0 and 22, inclusive, and less than
47
- * minZoomLevel, if specified. The default value for this option is 22.
48
- */
49
- maxZoomLevel: PropTypes.number,
50
-
51
- /**
52
- * Size of the map tiles.
53
- * Mapbox urls default to 256, all others default to 512.
54
- */
55
- tileSize: PropTypes.number,
56
- };
57
-
58
- static defaultProps = {
59
- id: MapboxGL.StyleSource.DefaultSourceID,
60
- };
61
-
62
- constructor(props) {
63
- super(props);
64
- if (isTileTemplateUrl(props.url)) {
65
- console.warn(
66
- `RasterDemSource 'url' property contains a Tile URL Template, but is intended for a StyleJSON URL. Please migrate your VectorSource to use: \`tileUrlTemplates=["${props.url}"]\` instead.`,
67
- );
68
- }
69
- }
70
-
71
- render() {
72
- let { url } = this.props;
73
- let { tileUrlTemplates } = this.props;
74
-
75
- // Swapping url for tileUrlTemplates to provide backward compatibility
76
- // when RasterSource supported only tile url as url prop
77
- if (isTileTemplateUrl(url)) {
78
- tileUrlTemplates = [url];
79
- url = undefined;
80
- }
81
-
82
- const props = {
83
- ...this.props,
84
- id: this.props.id,
85
- url,
86
- tileUrlTemplates,
87
- minZoomLevel: this.props.minZoomLevel,
88
- maxZoomLevel: this.props.maxZoomLevel,
89
- tileSize: this.props.tileSize,
90
- };
91
- return (
92
- <RCTMGLRasterDemSource ref="nativeSource" {...props}>
93
- {cloneReactChildrenWithProps(this.props.children, {
94
- sourceID: this.props.id,
95
- })}
96
- </RCTMGLRasterDemSource>
97
- );
98
- }
99
- }
100
-
101
- const RCTMGLRasterDemSource = requireNativeComponent(
102
- NATIVE_MODULE_NAME,
103
- RasterDemSource,
104
- );
105
-
106
- export default RasterDemSource;
@@ -1,124 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { NativeModules, requireNativeComponent } from 'react-native';
4
-
5
- import { cloneReactChildrenWithProps, viewPropTypes } from '../utils';
6
-
7
- import AbstractSource from './AbstractSource';
8
-
9
- const MapboxGL = NativeModules.MGLModule;
10
-
11
- export const NATIVE_MODULE_NAME = 'RCTMGLRasterSource';
12
-
13
- const isTileTemplateUrl = (url) =>
14
- url &&
15
- (url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
16
-
17
- /**
18
- * RasterSource is a map content source that supplies raster image tiles to be shown on the map.
19
- * The location of and metadata about the tiles are defined either by an option dictionary
20
- * or by an external file that conforms to the TileJSON specification.
21
- */
22
- class RasterSource extends AbstractSource {
23
- static propTypes = {
24
- ...viewPropTypes,
25
-
26
- /**
27
- * A string that uniquely identifies the source.
28
- */
29
- id: PropTypes.string.isRequired,
30
-
31
- /**
32
- * A URL to a TileJSON configuration file describing the source’s contents and other metadata.
33
- */
34
- url: PropTypes.string,
35
-
36
- /**
37
- * An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
38
- * Example: https://example.com/raster-tiles/{z}/{x}/{y}.png
39
- */
40
- tileUrlTemplates: PropTypes.arrayOf(PropTypes.string),
41
-
42
- /**
43
- * An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
44
- * The value should be between 0 and 22, inclusive, and less than
45
- * maxZoomLevel, if specified. The default value for this option is 0.
46
- */
47
- minZoomLevel: PropTypes.number,
48
-
49
- /**
50
- * An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
51
- * The value should be between 0 and 22, inclusive, and less than
52
- * minZoomLevel, if specified. The default value for this option is 22.
53
- */
54
- maxZoomLevel: PropTypes.number,
55
-
56
- /**
57
- * Size of the map tiles.
58
- * Mapbox urls default to 256, all others default to 512.
59
- */
60
- tileSize: PropTypes.number,
61
-
62
- /**
63
- * Influences the y direction of the tile coordinates. (tms inverts y axis)
64
- */
65
- tms: PropTypes.bool,
66
-
67
- /**
68
- * An HTML or literal text string defining the buttons to be displayed in an action sheet when the
69
- * source is part of a map view’s style and the map view’s attribution button is pressed.
70
- */
71
- attribution: PropTypes.string,
72
- };
73
-
74
- static defaultProps = {
75
- id: MapboxGL.StyleSource.DefaultSourceID,
76
- };
77
-
78
- constructor(props) {
79
- super(props);
80
- if (isTileTemplateUrl(props.url)) {
81
- console.warn(
82
- `RasterSource 'url' property contains a Tile URL Template, but is intended for a StyleJSON URL. Please migrate your VectorSource to use: \`tileUrlTemplates=["${props.url}"]\` instead.`,
83
- );
84
- }
85
- }
86
-
87
- render() {
88
- let { url } = this.props;
89
- let { tileUrlTemplates } = this.props;
90
-
91
- // Swapping url for tileUrlTemplates to provide backward compatibility
92
- // when RasterSource supported only tile url as url prop
93
- if (isTileTemplateUrl(url)) {
94
- tileUrlTemplates = [url];
95
- url = undefined;
96
- }
97
-
98
- const props = {
99
- ...this.props,
100
- id: this.props.id,
101
- url,
102
- tileUrlTemplates,
103
- minZoomLevel: this.props.minZoomLevel,
104
- maxZoomLevel: this.props.maxZoomLevel,
105
- tileSize: this.props.tileSize,
106
- tms: this.props.tms,
107
- attribution: this.props.attribution,
108
- };
109
- return (
110
- <RCTMGLRasterSource ref={this.setNativeRef} {...props}>
111
- {cloneReactChildrenWithProps(this.props.children, {
112
- sourceID: this.props.id,
113
- })}
114
- </RCTMGLRasterSource>
115
- );
116
- }
117
- }
118
-
119
- const RCTMGLRasterSource = requireNativeComponent(
120
- NATIVE_MODULE_NAME,
121
- RasterSource,
122
- );
123
-
124
- export default RasterSource;
@@ -1,10 +0,0 @@
1
- export function makeLatLngBounds<G = Geometry, P = Properties>(
2
- northEastCoordinates: Position[],
3
- southWestCoordinates: Position[],
4
- ): FeatureCollection<G, P>;
5
-
6
- export function makePoint<P = Properties>(
7
- coordinates: Position,
8
- properties?: P,
9
- options?: PositionsOptions,
10
- ): Feature<GeoJSON.Point, P>;
@@ -1,73 +0,0 @@
1
- import { featureCollection, point, feature, lineString } from '@turf/helpers';
2
- import distance from '@turf/distance';
3
- import along from '@turf/along';
4
- import geoViewport from '@mapbox/geo-viewport';
5
-
6
- const VECTOR_TILE_SIZE = 512;
7
-
8
- export function makePoint(coordinates, properties, options) {
9
- return point(coordinates, properties, options);
10
- }
11
-
12
- export function makeLineString(coordinates, properties, options) {
13
- return lineString(coordinates, properties, options);
14
- }
15
-
16
- export function makeLatLngBounds(northEastCoordinates, southWestCoordinates) {
17
- return featureCollection([
18
- point(northEastCoordinates),
19
- point(southWestCoordinates),
20
- ]);
21
- }
22
-
23
- export function makeFeature(geometry, properties) {
24
- return feature(geometry, properties);
25
- }
26
-
27
- export function makeFeatureCollection(features = [], options) {
28
- return featureCollection(features, options);
29
- }
30
-
31
- export function addToFeatureCollection(newFeatureCollection, newFeature) {
32
- return {
33
- ...newFeatureCollection,
34
- features: [...newFeatureCollection.features, newFeature],
35
- };
36
- }
37
-
38
- export function calculateDistance(origin, dest, options) {
39
- return distance(origin, dest, options);
40
- }
41
-
42
- export function pointAlongLine(newLineString, distAlong, options) {
43
- return along(newLineString, distAlong, options);
44
- }
45
-
46
- export function getOrCalculateVisibleRegion(
47
- coord,
48
- zoomLevel,
49
- width,
50
- height,
51
- nativeRegion,
52
- ) {
53
- const region = {
54
- ne: [0, 0],
55
- sw: [0, 0],
56
- };
57
-
58
- if (!nativeRegion || !Array.isArray(nativeRegion.visibleBounds)) {
59
- const bounds = geoViewport.bounds(
60
- coord,
61
- zoomLevel,
62
- [width, height],
63
- VECTOR_TILE_SIZE,
64
- );
65
- region.ne = [bounds[3], bounds[2]];
66
- region.sw = [bounds[1], bounds[0]];
67
- } else {
68
- region.ne = nativeRegion.properties.visibleBounds[0];
69
- region.sw = nativeRegion.properties.visibleBounds[1];
70
- }
71
-
72
- return region;
73
- }
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
-
3
- export type NativeArg =
4
- | string
5
- | number
6
- | { [k: string]: NativeArg }
7
- | NativeArg[];
8
-
9
- export function isAndroid(): boolean;
10
- export function isBoolean(argument: unknown): argument is boolean;
11
- export function isNumber(argument: unknown): argument is number;
12
- export function isString(argument: unknown): argument is string;
13
- // eslint-disable-next-line @typescript-eslint/ban-types
14
- export function isFunction(argument: unknown): argument is Function;
15
-
16
- export function toJSONString(_: unknown): string;
17
- export function runNativeCommand<RefType, ReturnType = NativeArg>(
18
- module: string,
19
- name: string,
20
- nativeRef: RefType,
21
- args: NativeArg[],
22
- ): Promise<ReturnType>;
23
-
24
- export function cloneReactChildrenWithProps(
25
- children: React.ReactElement | React.ReactElement[],
26
- propsToAdd: { [key: string]: string } = {},
27
- ): React.ReactElement | React.ReactElement[];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=geoUtils.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../javascript","sources":["utils/geoUtils.d.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../javascript","sources":["utils/index.d.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=geoUtils.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../javascript","sources":["utils/geoUtils.d.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../javascript","sources":["utils/index.d.ts"],"mappings":""}