@mapcomponents/react-maplibre 0.1.86 → 0.1.88

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 (44) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/MlFeatureEditor/MlFeatureEditor.stories.d.ts +1 -0
  3. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +1 -1
  4. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.d.ts +26 -9
  5. package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +2 -1
  6. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +8 -0
  7. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +2 -0
  8. package/dist/components/MlLayer/MlLayer.d.ts +3 -2
  9. package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +12 -2
  10. package/dist/components/MlMeasureTool/MlMeasureTool.stories.d.ts +1 -0
  11. package/dist/components/MlNavigationCompass/MlNavigationCompass.stories.d.ts +1 -1
  12. package/dist/components/MlNavigationTools/MlNavigationTools.stories.d.ts +2 -1
  13. package/dist/components/MlScaleReference/MlScaleReference.stories.d.ts +2 -1
  14. package/dist/components/MlTemporalController/MlTemporalController.stories.d.ts +1 -0
  15. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +2 -0
  16. package/dist/contexts/LayerContext.d.ts +16 -2
  17. package/dist/hooks/useAddImage/useaddImage.cy.d.ts +1 -0
  18. package/dist/hooks/useAddProtocol/useAddProtocol.stories.d.ts +9 -1
  19. package/dist/hooks/useFitLayerBounds.d.ts +8 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.esm.js +1552 -575
  22. package/dist/index.esm.js.map +1 -1
  23. package/dist/omt_styles/bright.d.ts +2495 -0
  24. package/dist/protocol_handlers/csv.d.ts +8 -0
  25. package/dist/protocol_handlers/mbtiles.d.ts +2 -2
  26. package/dist/protocol_handlers/osm.d.ts +11 -0
  27. package/dist/protocol_handlers/topojson.d.ts +9 -0
  28. package/dist/protocol_handlers/utils/getProtocolData.d.ts +1 -0
  29. package/dist/protocol_handlers/utils/protocolPathParser.d.ts +7 -0
  30. package/dist/protocol_handlers/xml.d.ts +10 -0
  31. package/dist/ui_components/AddLayerButton/AddLayerButton.d.ts +5 -0
  32. package/dist/ui_components/AddLayerButton/AddLayerPopup.d.ts +1 -0
  33. package/dist/ui_components/AddLayerButton/LayerConfigForms/LayerTypeForm.d.ts +1 -0
  34. package/dist/ui_components/AddLayerButton/LayerConfigForms/MbtilesLayerForm.d.ts +13 -0
  35. package/dist/ui_components/AddLayerButton/LayerConfigForms/ProtocolHandlerLayerForm.d.ts +10 -0
  36. package/dist/ui_components/AddLayerButton/LayerConfigForms/WmsLayerForm.d.ts +2 -1
  37. package/dist/ui_components/AddLayerButton/LayerConfigForms/utils/CSVOptionsFomular.d.ts +6 -0
  38. package/dist/ui_components/AddLayerButton/LayerConfigForms/utils/MbtilesLayerPropFormular.d.ts +7 -0
  39. package/dist/ui_components/AddLayerButton/LayerConfigForms/utils/OsmOptionsFomular.d.ts +6 -0
  40. package/dist/ui_components/DemoDescriptions.d.ts +12 -0
  41. package/dist/ui_components/LayerList/LayerListItem.d.ts +2 -0
  42. package/dist/ui_components/LayerList/LayerListItemFactory.d.ts +3 -0
  43. package/dist/ui_components/LayerList/util/SortableContainer.d.ts +7 -0
  44. package/package.json +9 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,25 @@
1
1
  # Change Log
2
+
3
+ ## [v0.1.88] - 2023-12-22
4
+
5
+ ### Added
6
+ - e45ff67: add labelProp and labelOptions to MlGeojsonLayer
7
+ - 5f7d750: add useAddProtocol handlers new formats (csv, osm, tcx, kml, gpx, Topojson)
8
+
9
+ ### Fixed
10
+ - a5b9d87: fix MlMeasureTool conversion
11
+ - 90befdb: fix compass needle aligment
12
+ - ecb1c48: fix Storybook demos
13
+
14
+ ## [v0.1.87] - 2023-10-25
15
+
16
+ ### Changed
17
+ - 27f1cb2: show measured value in m and in units if measured value is < 0.1km or 0.1mi
18
+ - e606c7c: add catalogue specific demo storybook stories to be able to also provide more useful stories for developers not shown in the catalogue
19
+
20
+ ### Added
21
+ - cb3057f: make layerlist items in layerlistitemfactory sortable via drag & drop
22
+
2
23
  ## [v0.1.86] - 2023-09-13
3
24
 
4
25
  ### Fixed
@@ -13,3 +13,4 @@ export declare const EditLinestring: any;
13
13
  export declare const DrawPolygon: any;
14
14
  export declare const DrawPoint: any;
15
15
  export declare const DrawLinestring: any;
16
+ export declare const catalogueDemo: any;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- interface MlFillExtrusionLayerProps {
2
+ export interface MlFillExtrusionLayerProps {
3
3
  /**
4
4
  * Id of the target MapLibre instance in mapContext
5
5
  */
@@ -1,10 +1,27 @@
1
+ /// <reference types="react" />
2
+ import { MlFillExtrusionLayerProps } from './MlFillExtrusionLayer';
3
+ declare const storyoptions: {
4
+ title: string;
5
+ component: {
6
+ (props: MlFillExtrusionLayerProps): JSX.Element;
7
+ defaultProps: {
8
+ mapId: undefined;
9
+ paint: {
10
+ "fill-extrusion-color": string;
11
+ "fill-extrusion-height": {
12
+ property: string;
13
+ type: string;
14
+ };
15
+ "fill-extrusion-base": {
16
+ property: string;
17
+ type: string;
18
+ };
19
+ "fill-extrusion-opacity": number;
20
+ };
21
+ };
22
+ };
23
+ argTypes: {};
24
+ decorators: ((Story: any, context: any) => JSX.Element)[];
25
+ };
1
26
  export default storyoptions;
2
- export const ExampleConfig: any;
3
- declare namespace storyoptions {
4
- export const title: string;
5
- export { MlFillExtrusionLayer as component };
6
- export const argTypes: {};
7
- export { mapContextDecorator as decorators };
8
- }
9
- import MlFillExtrusionLayer from "./MlFillExtrusionLayer";
10
- import mapContextDecorator from "../../decorators/MapContextDecorator";
27
+ export declare const ExampleConfig: any;
@@ -1,5 +1,6 @@
1
1
  export default storyoptions;
2
- export const ExampleConfig: any;
2
+ export const standardConfig: any;
3
+ export const catalogueDemo: any;
3
4
  declare namespace storyoptions {
4
5
  export const title: string;
5
6
  export { MlFollowGps as component };
@@ -65,6 +65,14 @@ export type MlGeoJsonLayerProps = {
65
65
  fill?: FillLayerSpecification['paint'];
66
66
  line?: LineLayerSpecification['paint'];
67
67
  };
68
+ /**
69
+ * Property name in the GeoJSON object to be used as a label.
70
+ */
71
+ labelProp?: string;
72
+ /**
73
+ * Label configuration options.
74
+ */
75
+ labelOptions?: useLayerProps['options'];
68
76
  /**
69
77
  * Hover event handler that is executed whenever a geometry rendered by this component is hovered.
70
78
  */
@@ -8,8 +8,10 @@ declare const storyoptions: {
8
8
  };
9
9
  export default storyoptions;
10
10
  export declare const Circle: any;
11
+ export declare const Label: any;
11
12
  export declare const Linestring: any;
12
13
  export declare const Polygon: any;
13
14
  export declare const HeatMap: any;
14
15
  export declare const Symbol: any;
15
16
  export declare const DefaultPaintOverrides: any;
17
+ export declare const catalogueDemo: any;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { Feature, FeatureCollection } from "@turf/turf";
2
+ import { useLayerProps } from '../../hooks/useLayer';
3
+ import { Feature, FeatureCollection } from '@turf/turf';
3
4
  interface MlLayerProps {
4
5
  /**
5
6
  * Id of the target MapLibre instance in mapContext
@@ -17,7 +18,7 @@ interface MlLayerProps {
17
18
  /**
18
19
  * Javascript object that is passed the addLayer command as first parameter.
19
20
  */
20
- options?: any;
21
+ options?: useLayerProps['options'];
21
22
  /**
22
23
  * GeoJSON data that is supposed to be rendered by this component.
23
24
  */
@@ -1,14 +1,24 @@
1
1
  /// <reference types="react" />
2
- import * as turf from "@turf/turf";
2
+ import * as turf from '@turf/turf';
3
+ import { GeoJSONObject } from '@turf/turf';
3
4
  interface MlMeasureToolProps {
4
5
  /**
5
6
  * String that specify if the Tool measures an area ("polygon") or length ("line")
6
7
  */
7
- measureType?: string;
8
+ measureType?: 'polygon' | 'line';
8
9
  /**
9
10
  * String that dictates which unit of measurement is used
10
11
  */
11
12
  unit?: turf.Units;
13
+ /**
14
+ * Callback function that is called each time measurment geometry within has changed within MlMeasureTool.
15
+ * First parameter is the new GeoJson feature.
16
+ */
17
+ onChange?: (options: {
18
+ value: number;
19
+ unit: string | undefined;
20
+ geojson: GeoJSONObject;
21
+ }) => void;
12
22
  }
13
23
  declare const MlMeasureTool: {
14
24
  (props: MlMeasureToolProps): JSX.Element;
@@ -1,6 +1,7 @@
1
1
  export default storyoptions;
2
2
  export const MeasureLine: any;
3
3
  export const MeasurePolygon: any;
4
+ export const catalogueDemo: any;
4
5
  declare namespace storyoptions {
5
6
  export const title: string;
6
7
  export { MlMeasureTool as component };
@@ -1,5 +1,5 @@
1
1
  export default storyoptions;
2
- export const Standard: any;
2
+ export const catalogueDemo: any;
3
3
  export const StyleExample: any;
4
4
  declare namespace storyoptions {
5
5
  export const title: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MlNavigationToolsProps } from "./MlNavigationTools";
2
+ import { MlNavigationToolsProps } from './MlNavigationTools';
3
3
  declare const storyoptions: {
4
4
  title: string;
5
5
  component: {
@@ -26,3 +26,4 @@ export declare const AlternativePosition: any;
26
26
  export declare const NoZoomButtons: any;
27
27
  export declare const NoFollowGpsButton: any;
28
28
  export declare const CustomButton: any;
29
+ export declare const catalogueDemo: any;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MlScaleReferenceProps } from "./MlScaleReference";
2
+ import { MlScaleReferenceProps } from './MlScaleReference';
3
3
  declare const storyoptions: {
4
4
  title: string;
5
5
  component: (props: MlScaleReferenceProps) => JSX.Element;
@@ -12,3 +12,4 @@ declare const storyoptions: {
12
12
  export default storyoptions;
13
13
  export declare const Toolbar: any;
14
14
  export declare const Overlay: any;
15
+ export declare const catalogueDemo: any;
@@ -31,3 +31,4 @@ export default storyoptions;
31
31
  export declare const FillConfig: any;
32
32
  export declare const CircleConfig: any;
33
33
  export declare const LineConfig: any;
34
+ export declare const catalogueDemo: any;
@@ -37,6 +37,7 @@ export interface MlWmsLoaderProps {
37
37
  * Id of the target MapLibre instance in mapContext
38
38
  */
39
39
  mapId?: string;
40
+ layerId?: string;
40
41
  insertBeforeLayer?: string;
41
42
  /**
42
43
  * URL parameters that will be used in the getCapabilities request
@@ -88,6 +89,7 @@ export interface MlWmsLoaderProps {
88
89
  * Custom buttons to display for the WMSLoader
89
90
  */
90
91
  buttons?: JSX.Element;
92
+ sortable?: boolean;
91
93
  }
92
94
  export type LayerType = {
93
95
  visible: boolean;
@@ -1,16 +1,29 @@
1
1
  import { StyleSpecification } from 'maplibre-gl';
2
2
  import React from 'react';
3
3
  import { MlVectorTileLayerProps } from '../components/MlVectorTileLayer/MlVectorTileLayer';
4
- import { MlWmsLoaderProps } from '../components/MlWmsLoader/MlWmsLoader';
5
4
  import { MlGeoJsonLayerProps } from '../components/MlGeoJsonLayer/MlGeoJsonLayer';
5
+ import { Layer } from 'wms-capabilities';
6
6
  export interface LayerContextProps {
7
7
  children: React.ReactNode;
8
8
  }
9
+ export interface wmsLoaderConfigProps {
10
+ getFeatureInfoUrl: string;
11
+ layers: Layer[];
12
+ name: string;
13
+ open: boolean;
14
+ visible: boolean;
15
+ wmsUrl: string;
16
+ }
17
+ export interface wmsConfig {
18
+ featureInfoActive?: boolean;
19
+ config?: wmsLoaderConfigProps;
20
+ url: string;
21
+ }
9
22
  export type WmsLayerConfig = {
10
23
  type: 'wms';
11
24
  name?: string;
12
25
  id?: string;
13
- config: MlWmsLoaderProps;
26
+ config: wmsConfig;
14
27
  };
15
28
  export type GeojsonLayerConfig = {
16
29
  type: 'geojson';
@@ -38,6 +51,7 @@ export interface LayerContextType {
38
51
  tileUrl: string;
39
52
  moveUp: (layerId: string) => void;
40
53
  moveDown: (layerId: string) => void;
54
+ moveLayer: (layerId: string, getNewPos: (oldPos: number) => number) => void;
41
55
  }
42
56
  declare const LayerContext: React.Context<LayerContextType>;
43
57
  declare function LayerContextProvider(props: LayerContextProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -11,4 +11,12 @@ declare const storyoptions: {
11
11
  decorators: ((Story: any, context: any) => JSX.Element)[];
12
12
  };
13
13
  export default storyoptions;
14
- export declare const ExampleConfig: any;
14
+ export declare const MbTiles: any;
15
+ export declare const CSVOrTSV: any;
16
+ export declare const CSVWithOptions: any;
17
+ export declare const OSM: any;
18
+ export declare const GPX: any;
19
+ export declare const KML: any;
20
+ export declare const TCX: any;
21
+ export declare const Topojson: any;
22
+ export declare const CatalogueDemo: any;
@@ -0,0 +1,8 @@
1
+ import { FitBoundsOptions } from 'maplibre-gl';
2
+ export interface useFitLayerBoundsPros {
3
+ layerId: string;
4
+ type: "geojson" | "wms" | "vt";
5
+ fitBoundsOptions?: FitBoundsOptions;
6
+ }
7
+ declare function useFitLayerBounds(props: useFitLayerBoundsPros): void;
8
+ export default useFitLayerBounds;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ export { default as MlTemporalController } from "./components/MlTemporalControll
35
35
  export { default as MlBasicComponent } from "./components/MlBasicComponent.js";
36
36
  export { default as MlOrderLayers } from "./components/MlOrderLayers/MlOrderLayers";
37
37
  export { default as MlTerrainLayer } from "./components/MlTerrainLayer/MlTerrainLayer";
38
+ export { default as MlSketchTool } from './components/MlSketchTool/MlSketchTool';
38
39
  export { default as useCameraFollowPath } from "./hooks/useCameraFollowPath/useCameraFollowPath";
39
40
  export { default as useExportMap } from "./hooks/useExportMap";
40
41
  export { default as useGpx } from "./hooks/useGpx/useGpx";