@maplibre/maplibre-react-native 11.0.3 → 11.1.0

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 (51) hide show
  1. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +2 -0
  2. package/android/src/main/java/org/maplibre/reactnative/components/layer/MLRNLayer.kt +34 -25
  3. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rasterdemsource/MLRNRasterDEMSource.kt +28 -0
  4. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rasterdemsource/MLRNRasterDEMSourceManager.kt +34 -0
  5. package/ios/components/layer/MLRNLayer.h +14 -1
  6. package/ios/components/layer/MLRNLayer.m +52 -37
  7. package/ios/components/layer/MLRNLayerComponentView.mm +26 -1
  8. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSource.h +10 -0
  9. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSource.m +39 -0
  10. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSourceComponentView.h +9 -0
  11. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSourceComponentView.mm +131 -0
  12. package/lib/commonjs/components/layer/LayerNativeComponent.ts +13 -1
  13. package/lib/commonjs/components/sources/raster-dem-source/RasterDEMSource.js +31 -0
  14. package/lib/commonjs/components/sources/raster-dem-source/RasterDEMSource.js.map +1 -0
  15. package/lib/commonjs/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.ts +25 -0
  16. package/lib/commonjs/components/sources/raster-source/RasterSourceNativeComponent.ts +2 -2
  17. package/lib/commonjs/index.js +7 -0
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/module/components/layer/LayerNativeComponent.ts +13 -1
  20. package/lib/module/components/sources/raster-dem-source/RasterDEMSource.js +26 -0
  21. package/lib/module/components/sources/raster-dem-source/RasterDEMSource.js.map +1 -0
  22. package/lib/module/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.ts +25 -0
  23. package/lib/module/components/sources/raster-source/RasterSourceNativeComponent.ts +2 -2
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/typescript/commonjs/components/layer/LayerNativeComponent.d.ts +1 -1
  27. package/lib/typescript/commonjs/components/layer/LayerNativeComponent.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSource.d.ts +58 -0
  29. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSource.d.ts.map +1 -0
  30. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts +15 -0
  31. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts.map +1 -0
  32. package/lib/typescript/commonjs/components/sources/raster-source/RasterSourceNativeComponent.d.ts +2 -2
  33. package/lib/typescript/commonjs/components/sources/raster-source/RasterSourceNativeComponent.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/index.d.ts +2 -1
  35. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  36. package/lib/typescript/module/components/layer/LayerNativeComponent.d.ts +1 -1
  37. package/lib/typescript/module/components/layer/LayerNativeComponent.d.ts.map +1 -1
  38. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSource.d.ts +58 -0
  39. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSource.d.ts.map +1 -0
  40. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts +15 -0
  41. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts.map +1 -0
  42. package/lib/typescript/module/components/sources/raster-source/RasterSourceNativeComponent.d.ts +2 -2
  43. package/lib/typescript/module/components/sources/raster-source/RasterSourceNativeComponent.d.ts.map +1 -1
  44. package/lib/typescript/module/index.d.ts +2 -1
  45. package/lib/typescript/module/index.d.ts.map +1 -1
  46. package/package.json +5 -4
  47. package/src/components/layer/LayerNativeComponent.ts +13 -1
  48. package/src/components/sources/raster-dem-source/RasterDEMSource.tsx +83 -0
  49. package/src/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.ts +25 -0
  50. package/src/components/sources/raster-source/RasterSourceNativeComponent.ts +2 -2
  51. package/src/index.ts +14 -9
@@ -0,0 +1,83 @@
1
+ import { memo, type ReactNode } from "react";
2
+
3
+ import RasterDEMSourceNativeComponent from "./RasterDEMSourceNativeComponent";
4
+ import { useFrozenId } from "../../../hooks/useFrozenId";
5
+ import { type BaseProps } from "../../../types/BaseProps";
6
+ import { cloneReactChildrenWithProps } from "../../../utils";
7
+
8
+ export interface RasterDEMSourceProps extends BaseProps {
9
+ /**
10
+ * A string that uniquely identifies the source.
11
+ */
12
+ id?: string;
13
+
14
+ /**
15
+ * A URL to a TileJSON configuration file describing the source's contents and
16
+ * other metadata.
17
+ */
18
+ url?: string;
19
+
20
+ /**
21
+ * An array of tile URL templates. If multiple endpoints are specified, clients
22
+ * may use any combination of endpoints.
23
+ *
24
+ * @example "https://example.com/dem-tiles/{z}/{x}/{y}.png"
25
+ */
26
+ tiles?: string[];
27
+
28
+ /**
29
+ * An unsigned integer that specifies the minimum zoom level at which to display
30
+ * tiles from the source. The value should be between 0 and 22, inclusive, and
31
+ * less than maxzoom, if specified. The default value for this option is 0.
32
+ */
33
+ minzoom?: number;
34
+
35
+ /**
36
+ * An unsigned integer that specifies the maximum zoom level at which to display
37
+ * tiles from the source. The value should be between 0 and 22, inclusive, and
38
+ * greater than minzoom, if specified. The default value for this option is 22.
39
+ */
40
+ maxzoom?: number;
41
+
42
+ /**
43
+ * Size of the map tiles.
44
+ *
45
+ * @defaultValue 512
46
+ */
47
+ tileSize?: number;
48
+
49
+ /**
50
+ * An HTML or literal text string defining the buttons to be displayed in an
51
+ * action sheet when the source is part of a map view's style and the map view's
52
+ * attribution button is pressed.
53
+ */
54
+ attribution?: string;
55
+
56
+ /**
57
+ * The encoding formula for the raster DEM tileset.
58
+ *
59
+ * @defaultValue "mapbox"
60
+ */
61
+ encoding?: "mapbox" | "terrarium";
62
+
63
+ children?: ReactNode;
64
+ }
65
+
66
+ /**
67
+ * RasterDEMSource is a map content source that supplies rasterized digital
68
+ * elevation model (DEM) tiles to be shown on the map. Use it together with a
69
+ * hillshade layer to visualize terrain.
70
+ */
71
+ export const RasterDEMSource = memo(
72
+ ({ id, ...props }: RasterDEMSourceProps) => {
73
+ const frozenId = useFrozenId(id);
74
+
75
+ return (
76
+ <RasterDEMSourceNativeComponent id={frozenId} {...props}>
77
+ {cloneReactChildrenWithProps(props.children, {
78
+ source: frozenId,
79
+ })}
80
+ </RasterDEMSourceNativeComponent>
81
+ );
82
+ },
83
+ );
@@ -0,0 +1,25 @@
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type HostComponent,
5
+ type ViewProps,
6
+ } from "react-native";
7
+
8
+ type NativeDEMEncoding = "mapbox" | "terrarium";
9
+
10
+ export interface NativeProps extends ViewProps {
11
+ id: string;
12
+ url?: string;
13
+ tiles?: string[];
14
+
15
+ tileSize?: CodegenTypes.WithDefault<CodegenTypes.Int32, 512>;
16
+ minzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
17
+ maxzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
18
+ attribution?: string;
19
+
20
+ encoding?: CodegenTypes.WithDefault<NativeDEMEncoding, "mapbox">;
21
+ }
22
+
23
+ export default codegenNativeComponent<NativeProps>(
24
+ "MLRNRasterDEMSource",
25
+ ) as HostComponent<NativeProps>;
@@ -12,12 +12,12 @@ export interface NativeProps extends ViewProps {
12
12
  url?: string;
13
13
  tiles?: string[];
14
14
 
15
+ tileSize?: CodegenTypes.WithDefault<CodegenTypes.Int32, 512>;
15
16
  minzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
16
17
  maxzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
17
- scheme?: CodegenTypes.WithDefault<NativeScheme, "xyz">;
18
18
  attribution?: string;
19
19
 
20
- tileSize?: CodegenTypes.WithDefault<CodegenTypes.Int32, 512>;
20
+ scheme?: CodegenTypes.WithDefault<NativeScheme, "xyz">;
21
21
  }
22
22
 
23
23
  export default codegenNativeComponent<NativeProps>(
package/src/index.ts CHANGED
@@ -60,6 +60,10 @@ export {
60
60
  type RasterSourceProps,
61
61
  RasterSource,
62
62
  } from "./components/sources/raster-source/RasterSource";
63
+ export {
64
+ type RasterDEMSourceProps,
65
+ RasterDEMSource,
66
+ } from "./components/sources/raster-dem-source/RasterDEMSource";
63
67
 
64
68
  export {
65
69
  type VectorSourceRef,
@@ -84,24 +88,25 @@ export {
84
88
  export type {
85
89
  // Layers
86
90
  LayerSpecification,
87
- FillLayerSpecification,
88
- LineLayerSpecification,
89
- SymbolLayerSpecification,
91
+ BackgroundLayerSpecification,
90
92
  CircleLayerSpecification,
91
- HeatmapLayerSpecification,
93
+ ColorReliefLayerSpecification,
94
+ FillLayerSpecification,
92
95
  FillExtrusionLayerSpecification,
93
- RasterLayerSpecification,
96
+ HeatmapLayerSpecification,
94
97
  HillshadeLayerSpecification,
95
- BackgroundLayerSpecification,
98
+ LineLayerSpecification,
99
+ RasterLayerSpecification,
100
+ SymbolLayerSpecification,
96
101
 
97
102
  // Sources
98
103
  SourceSpecification,
99
- VectorSourceSpecification,
104
+ GeoJSONSourceSpecification,
105
+ ImageSourceSpecification,
100
106
  RasterSourceSpecification,
101
107
  RasterDEMSourceSpecification,
102
- GeoJSONSourceSpecification,
108
+ VectorSourceSpecification,
103
109
  VideoSourceSpecification,
104
- ImageSourceSpecification,
105
110
 
106
111
  // Filter
107
112
  FilterSpecification,