@mapcomponents/react-maplibre 0.1.78 → 0.1.79

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 (49) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +3 -40
  3. package/dist/components/MlTerrainLayer/MlTerrainLayer.cy.d.ts +1 -0
  4. package/dist/components/MlTerrainLayer/MlTerrainLayer.d.ts +28 -0
  5. package/dist/components/MlTerrainLayer/MlTerrainLayer.stories.d.ts +14 -0
  6. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.d.ts +24 -9
  7. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +1 -1
  8. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +49 -3
  9. package/dist/contexts/LayerContext.d.ts +2 -0
  10. package/dist/hooks/useFeatureEditor.d.ts +46 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.esm.js +270 -1383
  13. package/dist/index.esm.js.map +1 -1
  14. package/dist/ui_components/LayerList/LayerListItem.d.ts +4 -0
  15. package/dist/ui_components/LayerList/LayerListItemFactory.d.ts +0 -1
  16. package/dist/ui_components/SpeedDial/SpeedDial.d.ts +14 -0
  17. package/dist/ui_components/SpeedDial/SpeedDial.stories.d.ts +21 -0
  18. package/package.json +5 -5
  19. package/dist/components/MlFeatureEditor/custom-direct-select-mode.d.ts +0 -37
  20. package/dist/components/MlFeatureEditor/custom-polygon-mode.d.ts +0 -16
  21. package/dist/components/MlFeatureEditor/custom-select-mode.d.ts +0 -37
  22. package/dist/components/MlFeatureEditor/lib/common_selectors.d.ts +0 -11
  23. package/dist/components/MlFeatureEditor/lib/constants.d.ts +0 -85
  24. package/dist/components/MlFeatureEditor/lib/constrain_feature_movement.d.ts +0 -2
  25. package/dist/components/MlFeatureEditor/lib/create_midpoint.d.ts +0 -15
  26. package/dist/components/MlFeatureEditor/lib/create_supplementary_points.d.ts +0 -2
  27. package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +0 -13
  28. package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +0 -5
  29. package/dist/components/MlFeatureEditor/lib/euclidean_distance.d.ts +0 -5
  30. package/dist/components/MlFeatureEditor/lib/features_at.d.ts +0 -7
  31. package/dist/components/MlFeatureEditor/lib/get_features_and_set_cursor.d.ts +0 -1
  32. package/dist/components/MlFeatureEditor/lib/is_click.d.ts +0 -1
  33. package/dist/components/MlFeatureEditor/lib/is_event_at_coordinates.d.ts +0 -6
  34. package/dist/components/MlFeatureEditor/lib/is_tap.d.ts +0 -3
  35. package/dist/components/MlFeatureEditor/lib/map_event_to_bounding_box.d.ts +0 -12
  36. package/dist/components/MlFeatureEditor/lib/mode_handler.d.ts +0 -24
  37. package/dist/components/MlFeatureEditor/lib/mouse_event_point.d.ts +0 -11
  38. package/dist/components/MlFeatureEditor/lib/move_features.d.ts +0 -2
  39. package/dist/components/MlFeatureEditor/lib/sort_features.d.ts +0 -2
  40. package/dist/components/MlFeatureEditor/lib/string_set.d.ts +0 -21
  41. package/dist/components/MlFeatureEditor/lib/string_sets_are_equal.d.ts +0 -5
  42. package/dist/components/MlFeatureEditor/lib/theme.d.ts +0 -88
  43. package/dist/components/MlFeatureEditor/lib/to_dense_array.d.ts +0 -12
  44. package/dist/components/MlFeatureEditor/lib/utils.d.ts +0 -10
  45. package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +0 -10
  46. package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +0 -6
  47. package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +0 -12
  48. package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +0 -10
  49. package/dist/components/MlThreeJsLayer/MlThreejsLayer.d.ts +0 -30
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.1.79] - 2023-05-31
4
+
5
+ ### Added
6
+
7
+ - f253071: Reliable & adjustable layer order (#105) …
8
+ - c7c4fdf: add MlTerrainLayer component (#108) …
9
+ - 70c18d7: optimize map libre map stories presentation (#103) …
10
+ - a02db81: add missing catalogue descriptions (#109) …
11
+ - bdd32ae: add SpeedDial UI component (#106) …
12
+
13
+ ### Changed
14
+
15
+ - **Breaking:** 36be5ab: change MlFeatureEditor to useFeatureEditor hook, replace custom draw modes with default modes, draw mode strings require adjustment to the equivalent default mode (#110) …
16
+
17
+
18
+ ### Fixed
19
+
20
+ - c0c302a: Feature/fix wmsloader featureinfo (#111) …
21
+ - e743b79: Fix/cypress config (#104) …
22
+
3
23
  ## [v0.1.78] - 2023-04-28
4
24
 
5
25
  ### Added
@@ -87,7 +107,7 @@
87
107
  ## [v0.1.69] - 2023-02-07
88
108
 
89
109
  ### Changed
90
- - readd dependencies to package.dependencies
110
+ - read dependencies from package.dependencies
91
111
 
92
112
  ## [v0.1.68] - 2023-02-07
93
113
 
@@ -186,7 +206,7 @@
186
206
 
187
207
  ### Changed
188
208
 
189
- - 7687eec: change MlVectorTileLayer layers prop type from object to array
209
+ - **Breaking:** 7687eec: change MlVectorTileLayer layers prop type from object to array
190
210
 
191
211
  ## [v0.1.59] - 2022-10-04
192
212
 
@@ -1,42 +1,5 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
+ import { useFeatureEditorProps } from '../../hooks/useFeatureEditor';
2
3
  import './MlFeatureEditor.css';
3
- import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
4
- import { GeoJSONObject, Feature } from '@turf/turf';
5
- interface MlFeatureEditorProps {
6
- /**
7
- * Id of the target MapLibre instance in mapContext
8
- */
9
- mapId?: string;
10
- /**
11
- * Id of an existing layer in the mapLibre instance to help specify the layer order
12
- * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
13
- */
14
- insertBeforeLayer?: string;
15
- /**
16
- * Input GeoJson data at initialization
17
- */
18
- geojson?: Feature;
19
- /**
20
- * Callback function that is called each time the GeoJson data within has changed within MlFeatureEditor.
21
- * First parameter is the new GeoJson feature.
22
- */
23
- onChange?: (para: GeoJSONObject[]) => void;
24
- /**
25
- * Callback function that is called each time the GeoJson data within has been finished within MlFeatureEditor.
26
- * First parameter is the new GeoJson feature.
27
- */
28
- onFinish?: () => void;
29
- /**
30
- * Feature editor mode:
31
- * - "custom_select" edit features
32
- * - "custom_polygon" draw Polygon
33
- * - "draw_point" draw Point
34
- * - "draw_line_string" draw LineString
35
- */
36
- mode?: string;
37
- }
38
- /**
39
- * GeoJson Feature editor that allows to create or manipulate GeoJson data
40
- */
41
- declare const MlFeatureEditor: (props: MlFeatureEditorProps) => JSX.Element;
4
+ declare const MlFeatureEditor: React.FC<useFeatureEditorProps>;
42
5
  export default MlFeatureEditor;
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import { TerrainSpecification } from 'maplibre-gl';
3
+ interface MlTerrainLayerProps {
4
+ /**
5
+ * Id of the target MapLibre instance in mapContext
6
+ */
7
+ mapId?: string;
8
+ /**
9
+ * Source of tiles with possibles options
10
+ */
11
+ sourceOptions?: object;
12
+ /**
13
+ * Options for new exaggeration value
14
+ */
15
+ terrainOptions?: TerrainSpecification;
16
+ }
17
+ export type { MlTerrainLayerProps };
18
+ /**
19
+ * Create Terrain Layer Component
20
+ *
21
+ */
22
+ declare const MlTerrainLayer: {
23
+ (props: MlTerrainLayerProps): JSX.Element;
24
+ defaultProps: {
25
+ mapId: undefined;
26
+ };
27
+ };
28
+ export default MlTerrainLayer;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ declare const storyoptions: {
3
+ title: string;
4
+ component: {
5
+ (props: import("./MlTerrainLayer").MlTerrainLayerProps): JSX.Element;
6
+ defaultProps: {
7
+ mapId: undefined;
8
+ };
9
+ };
10
+ argTypes: {};
11
+ decorators: ((Story: any, context: any) => JSX.Element)[];
12
+ };
13
+ export default storyoptions;
14
+ export declare const ExampleConfig: any;
@@ -1,15 +1,30 @@
1
- export default MlThreeJsLayer;
1
+ /// <reference types="react" />
2
+ import PropTypes from 'prop-types';
2
3
  /**
3
4
  * Renders obj or gltf 3D Models on the MapLibreMap referenced by props.mapId
4
5
  *
5
6
  * @component
6
7
  */
7
- declare function MlThreeJsLayer(props: any): JSX.Element;
8
- declare namespace MlThreeJsLayer {
9
- namespace propTypes {
10
- const mapId: PropTypes.Requireable<string>;
11
- const init: PropTypes.Requireable<(...args: any[]) => any>;
12
- const onDone: PropTypes.Requireable<(...args: any[]) => any>;
13
- }
8
+ export interface MlThreeJsLayerProps {
9
+ mapId?: string;
10
+ init?: object;
11
+ onDone?: () => void;
14
12
  }
15
- import PropTypes from "prop-types";
13
+ declare const MlThreeJsLayer: {
14
+ (props: MlThreeJsLayerProps): JSX.Element;
15
+ propTypes: {
16
+ /**
17
+ * Id of the target MapLibre instance in mapContext
18
+ */
19
+ mapId: PropTypes.Requireable<string>;
20
+ /**
21
+ * function that gets called when initialized
22
+ */
23
+ init: PropTypes.Requireable<(...args: any[]) => any>;
24
+ /**
25
+ * function that gets called when models are loaded
26
+ */
27
+ onDone: PropTypes.Requireable<(...args: any[]) => any>;
28
+ };
29
+ };
30
+ export default MlThreeJsLayer;
@@ -2,7 +2,7 @@
2
2
  declare const storyoptions: {
3
3
  title: string;
4
4
  component: {
5
- (props: any): JSX.Element;
5
+ (props: import("./MlThreeJsLayer").MlThreeJsLayerProps): JSX.Element;
6
6
  propTypes: {
7
7
  mapId: import("prop-types").Requireable<string>;
8
8
  init: import("prop-types").Requireable<(...args: any[]) => any>;
@@ -1,14 +1,31 @@
1
1
  /// <reference types="react" />
2
2
  import { useWmsProps } from '../../hooks/useWms';
3
- import { LngLat } from 'maplibre-gl';
4
3
  import { Layer2 } from 'wms-capabilities';
5
4
  import { useWmsReturnType } from '../../hooks/useWms';
6
5
  export interface WmsConfig {
6
+ /**
7
+ * The URL to use for the getFeatureInfo request
8
+ */
7
9
  getFeatureInfoUrl: useWmsReturnType['getFeatureInfoUrl'];
10
+ /**
11
+ * The URL of the WMS service
12
+ */
8
13
  wmsUrl: useWmsReturnType['wmsUrl'];
14
+ /**
15
+ * The layers to display on the map
16
+ */
9
17
  layers: LayerType[];
18
+ /**
19
+ * If true, the WMS layer is visible
20
+ */
10
21
  visible: boolean;
22
+ /**
23
+ * If true, the WMS layer is open
24
+ */
11
25
  open: boolean;
26
+ /**
27
+ * The name of the WMS layer
28
+ */
12
29
  name?: string;
13
30
  }
14
31
  export interface MlWmsLoaderProps {
@@ -31,17 +48,46 @@ export interface MlWmsLoaderProps {
31
48
  wmsUrlParameters?: {
32
49
  [key: string]: string;
33
50
  };
51
+ /**
52
+ * If true, zooms to the extent of the WMS layer after loading the getCapabilities response
53
+ */
34
54
  zoomToExtent?: boolean;
35
- lngLat?: LngLat;
36
- idPrefix?: string;
55
+ /**
56
+ * The name of the ListItem element representing the WmsLoader
57
+ */
37
58
  name?: string;
59
+ /**
60
+ * If true, enables the feature info functionality
61
+ */
38
62
  featureInfoEnabled?: boolean;
63
+ /**
64
+ * If true, the feature info functionality is active
65
+ */
39
66
  featureInfoActive?: boolean;
67
+ /**
68
+ * A function to set the feature info active state
69
+ */
40
70
  setFeatureInfoActive?: (val: boolean | ((current: boolean) => boolean)) => void;
71
+ /**
72
+ * The WMS configuration object
73
+ */
41
74
  config?: WmsConfig;
75
+ /**
76
+ * A function to handle changes to the WMS configuration
77
+ */
42
78
  onConfigChange?: (config: WmsConfig | false) => void;
79
+ /**
80
+ * A function to update a LayerType config array that is passed to this component at props.config.layers
81
+ */
43
82
  setLayers?: (layers: LayerType[]) => void;
83
+ /**
84
+ * If true, shows the delete button for the WMSLoader
85
+ */
44
86
  showDeleteButton?: boolean;
87
+ /**
88
+ * Custom buttons to display for the WMSLoader
89
+ */
90
+ buttons?: JSX.Element;
45
91
  }
46
92
  export type LayerType = {
47
93
  visible: boolean;
@@ -36,6 +36,8 @@ export interface LayerContextType {
36
36
  vtLayerConfig: Partial<MlVectorTileLayerProps>;
37
37
  setTileUrl: (url: string) => void;
38
38
  tileUrl: string;
39
+ moveUp: (layerId: string) => void;
40
+ moveDown: (layerId: string) => void;
39
41
  }
40
42
  declare const LayerContext: React.Context<LayerContextType>;
41
43
  declare function LayerContextProvider(props: LayerContextProps): JSX.Element;
@@ -0,0 +1,46 @@
1
+ import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
2
+ import MapboxDraw from '@mapbox/mapbox-gl-draw';
3
+ import { GeoJSONObject, Feature } from '@turf/turf';
4
+ export interface useFeatureEditorProps {
5
+ /**
6
+ * Id of the target MapLibre instance in mapContext
7
+ */
8
+ mapId?: string;
9
+ /**
10
+ * Id of an existing layer in the mapLibre instance to help specify the layer order
11
+ * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
12
+ */
13
+ insertBeforeLayer?: string;
14
+ /**
15
+ * Input GeoJson data at initialization
16
+ */
17
+ geojson?: Feature;
18
+ /**
19
+ * Callback function that is called each time the GeoJson data within has changed within MlFeatureEditor.
20
+ * First parameter is the new GeoJson feature.
21
+ */
22
+ onChange?: (para: GeoJSONObject[]) => void;
23
+ /**
24
+ * Callback function that is called each time the GeoJson data within has been finished within MlFeatureEditor.
25
+ * First parameter is the new GeoJson feature.
26
+ */
27
+ onFinish?: () => void;
28
+ /**
29
+ * Feature editor modes:
30
+ * - draw_line_string
31
+ * - draw_polygon
32
+ * - draw_point
33
+ * - simple_select
34
+ * - direct_select
35
+ */
36
+ mode?: keyof MapboxDraw.Modes;
37
+ }
38
+ /**
39
+ * GeoJson Feature editor that allows to create or manipulate GeoJson data
40
+ */
41
+ declare const useFeatureEditor: (props: useFeatureEditorProps) => {
42
+ feature: GeoJSONObject[] | undefined;
43
+ drawToolsReady: boolean;
44
+ draw: MapboxDraw | undefined;
45
+ };
46
+ export default useFeatureEditor;
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export { default as MlWmsLoader } from "./components/MlWmsLoader/MlWmsLoader";
34
34
  export { default as MlTemporalController } from "./components/MlTemporalController/MlTemporalController";
35
35
  export { default as MlBasicComponent } from "./components/MlBasicComponent.js";
36
36
  export { default as MlOrderLayers } from "./components/MlOrderLayers/MlOrderLayers";
37
+ export { default as MlTerrainLayer } from "./components/MlTerrainLayer/MlTerrainLayer";
37
38
  export { default as useCameraFollowPath } from "./hooks/useCameraFollowPath/useCameraFollowPath";
38
39
  export { default as useExportMap } from "./hooks/useExportMap";
39
40
  export { default as useGpx } from "./hooks/useGpx/useGpx";
@@ -47,6 +48,7 @@ export { default as useSource } from "./hooks/useSource";
47
48
  export { default as useWms } from "./hooks/useWms";
48
49
  export { default as useFilterData } from "./components/MlTemporalController/utils/useFilterData";
49
50
  export { default as useLayerContext } from "./hooks/useLayerContext";
51
+ export { default as useFeatureEditor } from "./hooks/useFeatureEditor";
50
52
  export { MapComponentsProvider } from "./contexts/MapContext";
51
53
  export { default as MapContext } from "./contexts/MapContext";
52
54
  export { default as SimpleDataProvider } from "./contexts/SimpleDataProvider";
@@ -72,6 +74,7 @@ export { default as UploadButton } from './ui_components/UploadButton';
72
74
  export { default as SelectStyleButton } from './ui_components/SelectStyleButton/SelectStyleButton';
73
75
  export { default as SelectStylePopup } from './ui_components/SelectStyleButton/SelectStylePopup';
74
76
  export { default as ConfirmDialog } from './ui_components/ConfirmDialog';
77
+ export { default as SpeedDial } from './ui_components/SpeedDial/SpeedDial';
75
78
  export { default as GruvboxStyle } from './omt_styles/gruvbox';
76
79
  export { default as MedievalKingdomStyle } from './omt_styles/medieval_kingdom';
77
80
  export { default as MonokaiStyle } from './omt_styles/monokai';