@mapcomponents/react-maplibre 0.1.73 → 0.1.74

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 (41) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +1 -1
  3. package/dist/components/MlOrderLayers/MlOrderLayers.d.ts +21 -0
  4. package/dist/components/MlOrderLayers/MlOrderLayers.stories.d.ts +15 -0
  5. package/dist/components/MlTemporalController/MlTemporalController.d.ts +175 -0
  6. package/dist/components/MlTemporalController/MlTemporalController.stories.d.ts +32 -0
  7. package/dist/components/MlTemporalController/utils/MlTemporalControllerLabels.d.ts +20 -0
  8. package/dist/components/MlTemporalController/utils/TemporalControllerPlayer.d.ts +21 -0
  9. package/dist/components/MlTemporalController/utils/paintPicker.d.ts +59 -0
  10. package/dist/components/MlTemporalController/utils/useFilterData.d.ts +14 -0
  11. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +22 -4
  12. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +5 -0
  13. package/dist/contexts/LayerContext.d.ts +43 -0
  14. package/dist/hooks/useLayer.d.ts +5 -3
  15. package/dist/hooks/useLayerContext.d.ts +2 -0
  16. package/dist/index.d.ts +20 -0
  17. package/dist/index.esm.js +13849 -147
  18. package/dist/index.esm.js.map +1 -1
  19. package/dist/omt_styles/config.d.ts +7 -0
  20. package/dist/omt_styles/gruvbox.d.ts +2420 -0
  21. package/dist/omt_styles/medieval_kingdom.d.ts +2420 -0
  22. package/dist/omt_styles/monokai.d.ts +2420 -0
  23. package/dist/omt_styles/oceanic_next.d.ts +2420 -0
  24. package/dist/omt_styles/solarized.d.ts +2420 -0
  25. package/dist/ui_components/AddLayerButton/AddLayerButton.d.ts +12 -0
  26. package/dist/ui_components/AddLayerButton/AddLayerButton.stories.d.ts +13 -0
  27. package/dist/ui_components/AddLayerButton/AddLayerPopup.d.ts +13 -0
  28. package/dist/ui_components/AddLayerButton/LayerConfigForms/GeoJsonLayerForm.d.ts +8 -0
  29. package/dist/ui_components/AddLayerButton/LayerConfigForms/LayerTypeForm.d.ts +9 -0
  30. package/dist/ui_components/AddLayerButton/LayerConfigForms/WmsLayerForm.d.ts +9 -0
  31. package/dist/ui_components/ConfirmDialog.d.ts +16 -0
  32. package/dist/ui_components/LayerList/LayerList.d.ts +3 -2
  33. package/dist/ui_components/LayerList/LayerList.stories.d.ts +1 -0
  34. package/dist/ui_components/LayerList/LayerListItem.d.ts +3 -1
  35. package/dist/ui_components/LayerList/LayerListItemFactory.d.ts +15 -0
  36. package/dist/ui_components/MapcomponentsTheme.d.ts +6 -1
  37. package/dist/ui_components/SelectStyleButton/SelectStyleButton.d.ts +17 -0
  38. package/dist/ui_components/SelectStyleButton/SelectStyleButton.stories.d.ts +15 -0
  39. package/dist/ui_components/SelectStyleButton/SelectStylePopup.d.ts +13 -0
  40. package/dist/ui_components/Sidebar.d.ts +1 -1
  41. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,6 +1,25 @@
1
1
  # Change Log
2
2
 
3
3
 
4
+ ## [v0.1.74] - 2023-04-03
5
+
6
+ ### Fixed
7
+ - 6e68b8c: fix wmsLoader feature info
8
+ - 3eac872: fix useLayer hook source attribution settings
9
+
10
+ ### Added
11
+ - 5a4c581: add component MlTemporalController
12
+ - a85a5b1: add LayerListItemFactory
13
+ - a85a5b1: add GeoJsonLayerForm
14
+ - a85a5b1: add WmsLayerForm
15
+ - a85a5b1: add LayerTypeForm
16
+ - a85a5b1: add AddLayerButton
17
+ - a85a5b1: add MlWmsLoader featureInfo configuration prop and queryable indicator next to layer
18
+ - a85a5b1: add LayerContext and localStorage persistence to AddLayerButton story
19
+
20
+ ### Changed
21
+ - a85a5b1: change MlWmsLoader to return LayerListItem compatible list elements
22
+
4
23
  ## [v0.1.73] - 2023-03-11
5
24
 
6
25
  ### Fixed
@@ -56,7 +56,7 @@ export type MlGeoJsonLayerProps = {
56
56
  /**
57
57
  * Javascript object that is spread into the addLayer commands first parameter.
58
58
  */
59
- options?: Exclude<LayerSpecification, RasterLayerSpecification>;
59
+ options?: useLayerProps['options'];
60
60
  /**
61
61
  * Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
62
62
  */
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ export interface MlOrderLayersProps {
3
+ /**
4
+ * Id of the target MapLibre instance in mapContext
5
+ */
6
+ mapId?: string;
7
+ layerIds: string[];
8
+ insertBeforeLayer?: string;
9
+ }
10
+ /**
11
+ * Creates an invisible layer for each entry in props.layerIds with the id `order-{entry}` and a reliable order
12
+ *
13
+ */
14
+ declare const MlOrderLayers: {
15
+ (props: MlOrderLayersProps): JSX.Element;
16
+ defaultProps: {
17
+ mapId: undefined;
18
+ insertBeforeLayer: undefined;
19
+ };
20
+ };
21
+ export default MlOrderLayers;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ declare const storyoptions: {
3
+ title: string;
4
+ component: {
5
+ (props: import("./MlOrderLayers").MlOrderLayersProps): JSX.Element;
6
+ defaultProps: {
7
+ mapId: undefined;
8
+ insertBeforeLayer: undefined;
9
+ };
10
+ };
11
+ argTypes: {};
12
+ decorators: ((Story: any, context: any) => JSX.Element)[];
13
+ };
14
+ export default storyoptions;
15
+ export declare const ExampleConfig: any;
@@ -0,0 +1,175 @@
1
+ import React from 'react';
2
+ import { FeatureCollection } from '@turf/turf';
3
+ import { LineLayerSpecification, CircleLayerSpecification, FillLayerSpecification, SymbolLayoutProps, SymbolPaintProps } from 'maplibre-gl';
4
+ import { useLayerProps } from 'src/hooks/useLayer';
5
+ export interface MlTemporalControllerProps {
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
+ * GeoJSON data that is supposed to be rendered by this component.
17
+ */
18
+ geojson: FeatureCollection;
19
+ /**
20
+ * If true,the component creates and loads a MlGeoJsonLayer to show the data.
21
+ */
22
+ ownLayer?: boolean;
23
+ /**
24
+ * MapLibre attribution shown in the bottom right of the map, if this layer is visible
25
+ */
26
+ attribution?: string;
27
+ /**
28
+ * Type of the layer that will be added to the MapLibre instance.
29
+ * Possible values: "line", "circle", "fill"
30
+ */
31
+ type?: 'fill' | 'line' | 'circle';
32
+ /**
33
+ * Property field where the time informations is available.
34
+ */
35
+ timeField: string;
36
+ /**
37
+ * Lowest time value to be shown in the time line.
38
+ * By default, it is set to the lowest value in the time field.
39
+ */
40
+ minVal?: number;
41
+ /**
42
+ *When true, a label layer will be added by the component. In that case, the "labelField" propertie is mandatory.
43
+ */
44
+ label?: boolean;
45
+ /**
46
+ * Property field where the label information is available.
47
+ */
48
+ labelField?: string;
49
+ /**
50
+ * Highest time value to be shown in the time line.
51
+ * By default, it is set to the highest value in the time field.
52
+ */
53
+ maxVal?: number;
54
+ /**
55
+ * the value at which the component is to be loaded.
56
+ * If not specified, the component starts at the minimum value.
57
+ */
58
+ initialVal?: number;
59
+ /**
60
+ * When true, the features will be accumulated in the map.
61
+ * This option ist by default false.
62
+ */
63
+ accumulate?: boolean;
64
+ /**
65
+ * When true, the component will fit the map bounds to the shown features.
66
+ * This option ist by default true.
67
+ */
68
+ fitBounds?: boolean;
69
+ /**
70
+ * Boolean value that disables and enables the controls drawer.
71
+ */
72
+ showControls?: boolean;
73
+ /**
74
+ * Paint property object for the features layer.
75
+ * Possible props depend on the layer type.
76
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
77
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
78
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
79
+ */
80
+ paint?: CircleLayerSpecification['paint'] | FillLayerSpecification['paint'] | LineLayerSpecification['paint'];
81
+ /**
82
+ * Sets the color of the features rendered by this component.
83
+ */
84
+ featuresColor?: string;
85
+ /**
86
+ * How many units the timeline runs through at each step.
87
+ * By default it is set to 1.
88
+ */
89
+ step?: number;
90
+ /**
91
+ * A numeric value that sets how many steps before the feature starts to appear.
92
+ * By default it is set to 5 steps.
93
+ */
94
+ fadeIn?: number;
95
+ /**
96
+ * A numeric value that sets how many steps the feature fades out after it proper time value.
97
+ * By default it is set to 5 steps.
98
+ */
99
+ fadeOut?: number;
100
+ /**
101
+ * Sets the color of the features rendered by this component.
102
+ */
103
+ labelColor?: string;
104
+ /**
105
+ * Layout property object, that is passed to the labels layer.
106
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#symbol
107
+ */
108
+ labelLayout?: SymbolLayoutProps;
109
+ /**
110
+ * Paint property object for the features layer.
111
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#symbol
112
+ */
113
+ labelPaint?: SymbolPaintProps;
114
+ /**
115
+ * Hover event handler that is executed whenever a geometry rendered by this component is hovered.
116
+ */
117
+ /**
118
+ * A numeric value that sets how many steps before the labels start to appear.
119
+ * By default it is set to 5 steps.
120
+ */
121
+ labelFadeIn?: number;
122
+ /**
123
+ * A numeric value that sets how many steps the labels fade out after their proper time value.
124
+ * By default it is set to 5 steps.
125
+ */
126
+ labelFadeOut?: number;
127
+ /**
128
+ * If true, the current time value will be displayed in the controlls panel.
129
+ */
130
+ displayCurrentValue?: boolean;
131
+ /**
132
+ * Click event handler that is executed whenever a geometry rendered by this component is clicked.
133
+ */
134
+ onClick?: useLayerProps['onClick'];
135
+ /**
136
+ * Click event handler that is executed whenever a geometry rendered by this component is hovered.
137
+ */
138
+ onHover?: useLayerProps['onHover'];
139
+ /**
140
+ * Leave event handler that is executed whenever a geometry rendered by this component is
141
+ * left/unhovered.
142
+ */
143
+ onLeave?: useLayerProps['onLeave'];
144
+ /**
145
+ * Callback function defined by the user to recive the current time value and paint property in the parent component.
146
+ */
147
+ onStateChange?: React.Dispatch<React.SetStateAction<TemporalControllerValues | undefined>>;
148
+ }
149
+ /**
150
+ * Select a GeoJSON object to be displayed in a temporal line.
151
+ *@component
152
+ */
153
+ export interface TemporalControllerValues {
154
+ current: number;
155
+ paint: CircleLayerSpecification['paint'] | FillLayerSpecification['paint'] | LineLayerSpecification['paint'];
156
+ }
157
+ declare const MlTemporalController: {
158
+ (props: MlTemporalControllerProps): JSX.Element;
159
+ defaultProps: {
160
+ mapId: undefined;
161
+ ownLayer: boolean;
162
+ type: string;
163
+ step: number;
164
+ fadeIn: number;
165
+ fadeOut: number;
166
+ labelFadeIn: number;
167
+ labelFadeOut: number;
168
+ accumulate: boolean;
169
+ fitBounds: boolean;
170
+ label: boolean;
171
+ attribution: string;
172
+ displayCurrentValue: boolean;
173
+ };
174
+ };
175
+ export default MlTemporalController;
@@ -0,0 +1,32 @@
1
+ /// <reference types="react" />
2
+ import { MlTemporalControllerProps } from './MlTemporalController';
3
+ declare const storyoptions: {
4
+ title: string;
5
+ component: {
6
+ (props: MlTemporalControllerProps): JSX.Element;
7
+ defaultProps: {
8
+ mapId: undefined;
9
+ ownLayer: boolean;
10
+ type: string;
11
+ step: number;
12
+ fadeIn: number;
13
+ fadeOut: number;
14
+ labelFadeIn: number;
15
+ labelFadeOut: number;
16
+ accumulate: boolean;
17
+ fitBounds: boolean;
18
+ label: boolean;
19
+ attribution: string;
20
+ displayCurrentValue: boolean;
21
+ };
22
+ };
23
+ argTypes: {};
24
+ decorators: ((Story: any, context: any) => JSX.Element)[];
25
+ parameters: {
26
+ sourceLink: string;
27
+ };
28
+ };
29
+ export default storyoptions;
30
+ export declare const FillConfig: any;
31
+ export declare const CircleConfig: any;
32
+ export declare const LineConfig: any;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { SymbolLayerSpecification, SymbolLayoutProps } from 'maplibre-gl';
3
+ import { FeatureCollection } from '@turf/turf';
4
+ interface MlTemporalControllerLabelsProps {
5
+ data: FeatureCollection;
6
+ currentVal: number;
7
+ fadeIn: number;
8
+ fadeOut: number;
9
+ step: number;
10
+ labelField: string;
11
+ labelColor: string;
12
+ timeField: string;
13
+ minVal: number;
14
+ accumulate: boolean;
15
+ isPlaying: boolean;
16
+ labelLayout?: SymbolLayoutProps;
17
+ labelPaint?: SymbolLayerSpecification;
18
+ }
19
+ export default function MlTemporalControllerLabels(props: MlTemporalControllerLabelsProps): JSX.Element;
20
+ export {};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export interface TemporalControllerPlayerProps {
3
+ currentVal: number;
4
+ isPlaying: boolean;
5
+ step: number;
6
+ minVal: number;
7
+ maxVal: number;
8
+ returnCurrent: React.Dispatch<React.SetStateAction<number>>;
9
+ returnPlaying: React.Dispatch<React.SetStateAction<boolean>>;
10
+ fadeIn: number;
11
+ open: boolean;
12
+ fadeOut: number;
13
+ featuresColor: string;
14
+ labels: boolean;
15
+ labelColor: string;
16
+ labelFadeIn: number;
17
+ labelFadeOut: number;
18
+ accumulate: boolean;
19
+ display: boolean;
20
+ }
21
+ export default function TemporalControllerPlayer(props: TemporalControllerPlayerProps): JSX.Element;
@@ -0,0 +1,59 @@
1
+ import { LineLayerSpecification, CircleLayerSpecification, FillLayerSpecification } from 'maplibre-gl';
2
+ interface paintPickerProps {
3
+ type: 'fill' | 'line' | 'circle' | undefined;
4
+ timeField: string;
5
+ currentVal: number;
6
+ minVal: number;
7
+ isPlaying: boolean;
8
+ fadeIn: number;
9
+ fadeOut: number;
10
+ step: number;
11
+ featuresColor: string;
12
+ accumulate: boolean;
13
+ userPaint: CircleLayerSpecification['paint'] | FillLayerSpecification['paint'] | LineLayerSpecification['paint'];
14
+ }
15
+ export default function paintPicker(props: paintPickerProps): {
16
+ "circle-radius"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
17
+ "circle-color"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
18
+ "circle-blur"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
19
+ "circle-opacity"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
20
+ "circle-translate"?: import("maplibre-gl").PropertyValueSpecification<[number, number]> | undefined;
21
+ "circle-translate-anchor"?: import("maplibre-gl").PropertyValueSpecification<"map" | "viewport"> | undefined;
22
+ "circle-pitch-scale"?: import("maplibre-gl").PropertyValueSpecification<"map" | "viewport"> | undefined;
23
+ "circle-pitch-alignment"?: import("maplibre-gl").PropertyValueSpecification<"map" | "viewport"> | undefined;
24
+ "circle-stroke-width"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
25
+ "circle-stroke-color"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
26
+ "circle-stroke-opacity"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
27
+ } | {
28
+ "fill-antialias"?: import("maplibre-gl").PropertyValueSpecification<boolean> | undefined;
29
+ "fill-opacity"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
30
+ "fill-color"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
31
+ "fill-outline-color"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
32
+ "fill-translate"?: import("maplibre-gl").PropertyValueSpecification<[number, number]> | undefined;
33
+ "fill-translate-anchor"?: import("maplibre-gl").PropertyValueSpecification<"map" | "viewport"> | undefined;
34
+ "fill-pattern"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
35
+ } | {
36
+ "line-opacity"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
37
+ "line-color"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
38
+ "line-translate"?: import("maplibre-gl").PropertyValueSpecification<[number, number]> | undefined;
39
+ "line-translate-anchor"?: import("maplibre-gl").PropertyValueSpecification<"map" | "viewport"> | undefined;
40
+ "line-width"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
41
+ "line-gap-width"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
42
+ "line-offset"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
43
+ "line-blur"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<number> | undefined;
44
+ "line-dasharray"?: import("maplibre-gl").PropertyValueSpecification<number[]> | undefined;
45
+ "line-pattern"?: import("maplibre-gl").DataDrivenPropertyValueSpecification<string> | undefined;
46
+ "line-gradient"?: import("maplibre-gl").ExpressionSpecification | undefined;
47
+ } | {
48
+ 'circle-color': string;
49
+ } | {
50
+ 'fill-color': string;
51
+ 'fill-outline-color': string;
52
+ } | {
53
+ 'line-color': string;
54
+ } | {
55
+ 'fill-color': string;
56
+ 'fill-opacity': (string | number | string[])[];
57
+ 'fill-outline-color': (string | number | string[])[];
58
+ };
59
+ export {};
@@ -0,0 +1,14 @@
1
+ import { FeatureCollection } from '@turf/turf';
2
+ export interface useTemporalControllerProps {
3
+ geojson: FeatureCollection;
4
+ timeField: string;
5
+ initialVal?: number;
6
+ minVal?: number;
7
+ maxVal?: number;
8
+ mapId: string | undefined;
9
+ }
10
+ export default function useFilterData(props: useTemporalControllerProps): {
11
+ filteredData: FeatureCollection<import("@turf/turf").Geometry | import("@turf/turf").GeometryCollection, import("@turf/turf").Properties> | undefined;
12
+ minVal: any;
13
+ maxVal: any;
14
+ };
@@ -2,6 +2,15 @@
2
2
  import { useWmsProps } from '../../hooks/useWms';
3
3
  import { LngLat } from 'maplibre-gl';
4
4
  import { Layer2 } from 'wms-capabilities';
5
+ import { useWmsReturnType } from '../../hooks/useWms';
6
+ export interface WmsConfig {
7
+ getFeatureInfoUrl: useWmsReturnType['getFeatureInfoUrl'];
8
+ wmsUrl: useWmsReturnType['wmsUrl'];
9
+ layers: LayerType[];
10
+ visible: boolean;
11
+ open: boolean;
12
+ name?: string;
13
+ }
5
14
  export interface MlWmsLoaderProps {
6
15
  /**
7
16
  * WMS URL
@@ -10,7 +19,8 @@ export interface MlWmsLoaderProps {
10
19
  /**
11
20
  * Id of the target MapLibre instance in mapContext
12
21
  */
13
- mapId: string;
22
+ mapId?: string;
23
+ insertBeforeLayer?: string;
14
24
  /**
15
25
  * URL parameters that will be used in the getCapabilities request
16
26
  */
@@ -21,8 +31,14 @@ export interface MlWmsLoaderProps {
21
31
  wmsUrlParameters?: {
22
32
  [key: string]: string;
23
33
  };
34
+ zoomToExtent?: boolean;
24
35
  lngLat?: LngLat;
25
36
  idPrefix?: string;
37
+ featureInfoEnabled?: boolean;
38
+ config?: WmsConfig;
39
+ onConfigChange?: (config: WmsConfig | false) => void;
40
+ setLayers?: (layers: LayerType[]) => void;
41
+ showDeleteButton?: boolean;
26
42
  }
27
43
  export type LayerType = {
28
44
  visible: boolean;
@@ -30,18 +46,17 @@ export type LayerType = {
30
46
  Attribution?: {
31
47
  Title: string;
32
48
  };
33
- } & Omit<Layer2, 'Layer'> & Partial<Pick<Layer2, 'Layer'>>;
49
+ } & Omit<Layer2, 'Layer' | 'CRS'> & Partial<Pick<Layer2, 'Layer'>>;
34
50
  /**
35
51
  * Loads a WMS getCapabilities xml document and adds a MlWmsLayer component for each layer that is
36
52
  * offered by the WMS.
37
53
  *
38
- * TODO: EaseTo the extend offered by the WMS in a zoom level that is supported
39
- *
40
54
  * @component
41
55
  */
42
56
  declare const MlWmsLoader: {
43
57
  (props: MlWmsLoaderProps): JSX.Element;
44
58
  defaultProps: {
59
+ mapId: undefined;
45
60
  url: string;
46
61
  urlParameters: {
47
62
  SERVICE: string;
@@ -51,6 +66,9 @@ declare const MlWmsLoader: {
51
66
  wmsUrlParameters: {
52
67
  TRANSPARENT: string;
53
68
  };
69
+ featureInfoEnabled: boolean;
70
+ zoomToExtent: boolean;
71
+ showDeleteButton: boolean;
54
72
  };
55
73
  };
56
74
  export default MlWmsLoader;
@@ -4,6 +4,7 @@ declare const storyoptions: {
4
4
  component: {
5
5
  (props: import("./MlWmsLoader").MlWmsLoaderProps): JSX.Element;
6
6
  defaultProps: {
7
+ mapId: undefined;
7
8
  url: string;
8
9
  urlParameters: {
9
10
  SERVICE: string;
@@ -13,6 +14,9 @@ declare const storyoptions: {
13
14
  wmsUrlParameters: {
14
15
  TRANSPARENT: string;
15
16
  };
17
+ featureInfoEnabled: boolean;
18
+ zoomToExtent: boolean;
19
+ showDeleteButton: boolean;
16
20
  };
17
21
  };
18
22
  argTypes: {
@@ -23,3 +27,4 @@ declare const storyoptions: {
23
27
  };
24
28
  export default storyoptions;
25
29
  export declare const ExampleConfig: any;
30
+ export declare const ExampleFixedConfig: any;
@@ -0,0 +1,43 @@
1
+ import { StyleSpecification } from 'maplibre-gl';
2
+ import React from 'react';
3
+ import { MlVectorTileLayerProps } from '../components/MlVectorTileLayer/MlVectorTileLayer';
4
+ import { MlWmsLoaderProps } from '../components/MlWmsLoader/MlWmsLoader';
5
+ import { MlGeoJsonLayerProps } from '../components/MlGeoJsonLayer/MlGeoJsonLayer';
6
+ export interface LayerContextProps {
7
+ children: React.ReactNode;
8
+ }
9
+ export type WmsLayerConfig = {
10
+ type: 'wms';
11
+ name?: string;
12
+ id?: string;
13
+ config: MlWmsLoaderProps;
14
+ };
15
+ export type GeojsonLayerConfig = {
16
+ type: 'geojson';
17
+ name?: string;
18
+ id?: string;
19
+ config: MlGeoJsonLayerProps;
20
+ };
21
+ export type VtLayerConfig = {
22
+ type: 'vt';
23
+ name?: string;
24
+ id?: string;
25
+ config: MlVectorTileLayerProps;
26
+ };
27
+ export type LayerConfig = WmsLayerConfig | GeojsonLayerConfig | VtLayerConfig;
28
+ export interface LayerContextType {
29
+ layers: LayerConfig[];
30
+ setLayers: (layers: LayerConfig[] | ((layers: LayerConfig[]) => LayerConfig[])) => void;
31
+ backgroundLayers: MlVectorTileLayerProps['layers'];
32
+ setBackgroundLayers: (layers: MlVectorTileLayerProps['layers'] | ((layers: MlVectorTileLayerProps['layers']) => MlVectorTileLayerProps['layers'])) => void;
33
+ symbolLayers: MlVectorTileLayerProps['layers'];
34
+ setSymbolLayers: (layers: MlVectorTileLayerProps['layers'] | ((layers: MlVectorTileLayerProps['layers']) => MlVectorTileLayerProps['layers'])) => void;
35
+ updateStyle: (style: StyleSpecification) => void;
36
+ vtLayerConfig: Partial<MlVectorTileLayerProps>;
37
+ setTileUrl: (url: string) => void;
38
+ tileUrl: string;
39
+ }
40
+ declare const LayerContext: React.Context<LayerContextType>;
41
+ declare function LayerContextProvider(props: LayerContextProps): JSX.Element;
42
+ export default LayerContext;
43
+ export { LayerContextProvider };
@@ -1,5 +1,5 @@
1
1
  import { useMapType } from './useMap';
2
- import { SourceSpecification, LayerSpecification, MapMouseEvent, GeoJSONFeature, Style, MapEventType, Map } from 'maplibre-gl';
2
+ import { SourceSpecification, LayerSpecification, MapMouseEvent, GeoJSONFeature, Style, MapEventType, Map, RasterLayerSpecification, BackgroundLayerSpecification, VideoSourceSpecification, ImageSourceSpecification, HillshadeLayerSpecification } from 'maplibre-gl';
3
3
  import MapLibreGlWrapper from '../components/MapLibreMap/lib/MapLibreGlWrapper';
4
4
  import { GeoJSONObject } from '@turf/turf';
5
5
  type getLayerType = Style['getLayer'];
@@ -20,8 +20,10 @@ export interface useLayerProps {
20
20
  insertBeforeLayer?: string;
21
21
  insertBeforeFirstSymbolLayer?: boolean;
22
22
  geojson?: GeoJSONObject;
23
- source?: SourceSpecification | string;
24
- options: Partial<LayerSpecification>;
23
+ options: Partial<Exclude<LayerSpecification, RasterLayerSpecification | BackgroundLayerSpecification | HillshadeLayerSpecification> & {
24
+ source?: Partial<Exclude<SourceSpecification, VideoSourceSpecification | ImageSourceSpecification>>;
25
+ id?: string;
26
+ }>;
25
27
  onHover?: (ev: MapEventType & unknown) => Map | void;
26
28
  onClick?: (ev: MapEventType & unknown) => Map | void;
27
29
  onLeave?: (ev: MapEventType & unknown) => Map | void;
@@ -0,0 +1,2 @@
1
+ declare const useLayerContext: () => import("../contexts/LayerContext").LayerContextType;
2
+ export default useLayerContext;
package/dist/index.d.ts CHANGED
@@ -31,7 +31,9 @@ export { default as MlVectorTileLayer } from "./components/MlVectorTileLayer/MlV
31
31
  export { default as MlWmsFeatureInfoPopup } from "./components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup";
32
32
  export { default as MlWmsLayer } from "./components/MlWmsLayer/MlWmsLayer";
33
33
  export { default as MlWmsLoader } from "./components/MlWmsLoader/MlWmsLoader";
34
+ export { default as MlTemporalController } from "./components/MlTemporalController/MlTemporalController";
34
35
  export { default as MlBasicComponent } from "./components/MlBasicComponent.js";
36
+ export { default as MlOrderLayers } from "./components/MlOrderLayers/MlOrderLayers";
35
37
  export { default as useCameraFollowPath } from "./hooks/useCameraFollowPath/useCameraFollowPath";
36
38
  export { default as useExportMap } from "./hooks/useExportMap";
37
39
  export { default as useGpx } from "./hooks/useGpx/useGpx";
@@ -43,16 +45,34 @@ export { default as useMap } from "./hooks/useMap";
43
45
  export { default as useMapState } from "./hooks/useMapState";
44
46
  export { default as useSource } from "./hooks/useSource";
45
47
  export { default as useWms } from "./hooks/useWms";
48
+ export { default as useFilterData } from "./components/MlTemporalController/utils/useFilterData";
49
+ export { default as useLayerContext } from "./hooks/useLayerContext";
46
50
  export { MapComponentsProvider } from "./contexts/MapContext";
47
51
  export { default as MapContext } from "./contexts/MapContext";
48
52
  export { default as SimpleDataProvider } from "./contexts/SimpleDataProvider";
49
53
  export { default as SimpleDataContext } from "./contexts/SimpleDataContext";
54
+ export { default as LayerContext } from "./contexts/LayerContext";
55
+ export { LayerContextProvider } from "./contexts/LayerContext";
50
56
  export { default as getTheme } from './ui_components/MapcomponentsTheme';
51
57
  export { default as LayerList } from './ui_components/LayerList/LayerList';
52
58
  export { default as LayerListItem } from './ui_components/LayerList/LayerListItem';
53
59
  export { default as LayerListFolder } from './ui_components/LayerList/LayerListFolder';
54
60
  export { default as LayerPropertyForm } from './ui_components/LayerList/util/LayerPropertyForm';
55
61
  export { default as LayerListItemVectorLayer } from './ui_components/LayerList/util/LayerListItemVectorLayer';
62
+ export { default as AddLayerButton } from './ui_components/AddLayerButton/AddLayerButton';
63
+ export { default as AddLayerPopup } from './ui_components/AddLayerButton/AddLayerPopup';
64
+ export { default as GeoJsonLayerForm } from './ui_components/AddLayerButton/LayerConfigForms/GeoJsonLayerForm';
65
+ export { default as LayerTypeForm } from './ui_components/AddLayerButton/LayerConfigForms/LayerTypeForm';
66
+ export { default as WmsLayerForm } from './ui_components/AddLayerButton/LayerConfigForms/WmsLayerForm';
56
67
  export { default as ColorPicker } from './ui_components/LayerList/util/input/ColorPicker';
57
68
  export { default as TopToolbar } from './ui_components/TopToolbar';
58
69
  export { default as Sidebar } from './ui_components/Sidebar';
70
+ export { default as UploadButton } from './ui_components/UploadButton';
71
+ export { default as SelectStyleButton } from './ui_components/SelectStyleButton/SelectStyleButton';
72
+ export { default as SelectStylePopup } from './ui_components/SelectStyleButton/SelectStylePopup';
73
+ export { default as ConfirmDialog } from './ui_components/ConfirmDialog';
74
+ export { default as GruvboxStyle } from './omt_styles/gruvbox';
75
+ export { default as MedievalKingdomStyle } from './omt_styles/medieval_kingdom';
76
+ export { default as MonokaiStyle } from './omt_styles/monokai';
77
+ export { default as OceanicNextStyle } from './omt_styles/oceanic_next';
78
+ export { default as SolarizedStyle } from './omt_styles/solarized';