@mapcomponents/react-maplibre 0.1.87 → 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 (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +2 -1
  3. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +8 -0
  4. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +1 -0
  5. package/dist/components/MlLayer/MlLayer.d.ts +3 -2
  6. package/dist/components/MlScaleReference/MlScaleReference.stories.d.ts +3 -2
  7. package/dist/contexts/LayerContext.d.ts +15 -2
  8. package/dist/hooks/useAddImage/useaddImage.cy.d.ts +1 -0
  9. package/dist/hooks/useAddProtocol/useAddProtocol.stories.d.ts +9 -1
  10. package/dist/hooks/useFitLayerBounds.d.ts +8 -0
  11. package/dist/index.esm.js +812 -39
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/omt_styles/bright.d.ts +2495 -0
  14. package/dist/protocol_handlers/csv.d.ts +8 -0
  15. package/dist/protocol_handlers/mbtiles.d.ts +2 -2
  16. package/dist/protocol_handlers/osm.d.ts +11 -0
  17. package/dist/protocol_handlers/topojson.d.ts +9 -0
  18. package/dist/protocol_handlers/utils/getProtocolData.d.ts +1 -0
  19. package/dist/protocol_handlers/utils/protocolPathParser.d.ts +7 -0
  20. package/dist/protocol_handlers/xml.d.ts +10 -0
  21. package/dist/ui_components/AddLayerButton/AddLayerButton.d.ts +5 -0
  22. package/dist/ui_components/AddLayerButton/AddLayerPopup.d.ts +1 -0
  23. package/dist/ui_components/AddLayerButton/LayerConfigForms/LayerTypeForm.d.ts +1 -0
  24. package/dist/ui_components/AddLayerButton/LayerConfigForms/MbtilesLayerForm.d.ts +13 -0
  25. package/dist/ui_components/AddLayerButton/LayerConfigForms/ProtocolHandlerLayerForm.d.ts +10 -0
  26. package/dist/ui_components/AddLayerButton/LayerConfigForms/WmsLayerForm.d.ts +2 -1
  27. package/dist/ui_components/AddLayerButton/LayerConfigForms/utils/CSVOptionsFomular.d.ts +6 -0
  28. package/dist/ui_components/AddLayerButton/LayerConfigForms/utils/MbtilesLayerPropFormular.d.ts +7 -0
  29. package/dist/ui_components/AddLayerButton/LayerConfigForms/utils/OsmOptionsFomular.d.ts +6 -0
  30. package/dist/ui_components/DemoDescriptions.d.ts +12 -0
  31. package/dist/ui_components/LayerList/LayerListItemFactory.d.ts +2 -0
  32. package/package.json +6 -1
@@ -0,0 +1,8 @@
1
+ import { RequestParameters, ResponseCallback } from 'maplibre-gl';
2
+ import { FeatureCollection } from '@turf/turf';
3
+ import * as csv2geojsonType from './csv2geojson';
4
+ declare function convertCsv(filename: string, options: csv2geojsonType.csvOptions): Promise<FeatureCollection>;
5
+ declare const CSVProtocolHandler: (params: RequestParameters, callback: ResponseCallback<any>) => {
6
+ cancel: () => void;
7
+ };
8
+ export { CSVProtocolHandler, convertCsv };
@@ -1,5 +1,5 @@
1
1
  import { RequestParameters, ResponseCallback } from 'maplibre-gl';
2
- declare const parseParams: (url: string) => {
2
+ declare const parseTileParams: (url: string) => {
3
3
  filename: string;
4
4
  z: string;
5
5
  x: string;
@@ -30,4 +30,4 @@ declare function getBufferFromMbtiles(params: {
30
30
  declare const mbTilesProtocolHandler: (params: RequestParameters, callback: ResponseCallback<any>) => {
31
31
  cancel: () => void;
32
32
  };
33
- export { mbTilesProtocolHandler, parseParams, getBufferFromMbtiles, getMbtilesDbHandler };
33
+ export { mbTilesProtocolHandler, parseTileParams, getBufferFromMbtiles, getMbtilesDbHandler };
@@ -0,0 +1,11 @@
1
+ import { RequestParameters, ResponseCallback } from 'maplibre-gl';
2
+ import { FeatureCollection } from '@turf/turf';
3
+ import osm2geojson from 'osm2geojson-lite';
4
+ declare function convertOSM(params: {
5
+ filename: string;
6
+ options: osm2geojson.Options;
7
+ }): Promise<FeatureCollection>;
8
+ declare const OSMProtocolHandler: (params: RequestParameters, callback: ResponseCallback<any>) => {
9
+ cancel: () => void;
10
+ };
11
+ export { OSMProtocolHandler, convertOSM };
@@ -0,0 +1,9 @@
1
+ import { RequestParameters, ResponseCallback } from 'maplibre-gl';
2
+ import { FeatureCollection } from '@turf/turf';
3
+ declare function convertTopojson(params: {
4
+ filename: string;
5
+ }): Promise<FeatureCollection>;
6
+ declare const TopojsonProtocolHandler: (params: RequestParameters, callback: ResponseCallback<any>) => {
7
+ cancel: () => void;
8
+ };
9
+ export { TopojsonProtocolHandler, convertTopojson };
@@ -0,0 +1 @@
1
+ export default function getProtocolData(path: string): Promise<any>;
@@ -0,0 +1,7 @@
1
+ export default function protocolPathParser(url: string): {
2
+ protocolId: string;
3
+ filename: string;
4
+ options: {
5
+ [k: string]: string;
6
+ };
7
+ };
@@ -0,0 +1,10 @@
1
+ import { RequestParameters, ResponseCallback } from 'maplibre-gl';
2
+ import { FeatureCollection } from '@turf/turf';
3
+ declare function convertXML(params: {
4
+ filename: string;
5
+ protocolId: string;
6
+ }): Promise<FeatureCollection>;
7
+ declare const XMLProtocolHandler: (params: RequestParameters, callback: ResponseCallback<any>) => {
8
+ cancel: () => void;
9
+ };
10
+ export { XMLProtocolHandler, convertXML };
@@ -3,6 +3,11 @@ import { SxProps } from '@mui/material';
3
3
  import { LayerConfig } from '../../contexts/LayerContext';
4
4
  export interface AddLayerButtonProps {
5
5
  sx?: SxProps;
6
+ /**
7
+ * An string array, to filter the supported file types that would be shown to the user
8
+ * Default is: ['geojson', 'wms', 'csv', 'topojson', 'osm', 'gpx', 'kml', 'tcx']
9
+ */
10
+ layerTypes?: string[];
6
11
  onComplete?: (config: LayerConfig) => void;
7
12
  }
8
13
  declare const AddLayerButton: {
@@ -3,6 +3,7 @@ import { LayerConfig } from 'src/contexts/LayerContext';
3
3
  export interface AddLayerPopupProps {
4
4
  open: boolean;
5
5
  config?: LayerConfig;
6
+ layerTypes: string[];
6
7
  setOpen: (open: boolean) => void;
7
8
  onChange?: (config: LayerConfig) => void;
8
9
  onComplete?: (config: LayerConfig) => void;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface LayerTypeFormProps {
3
3
  onSelect: (type: string) => void;
4
+ layerTypes: string[];
4
5
  }
5
6
  declare const LayerTypeForm: {
6
7
  (props: LayerTypeFormProps): JSX.Element;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { MlVectorTileLayerProps } from 'src/components/MlVectorTileLayer/MlVectorTileLayer';
3
+ export interface WmsLayerConfig {
4
+ url: string;
5
+ }
6
+ export interface MbtilesLayerFormProps {
7
+ originType: string;
8
+ config: MlVectorTileLayerProps;
9
+ mapId?: string;
10
+ onSubmit: (config: MlVectorTileLayerProps) => void;
11
+ onCancel: () => void;
12
+ }
13
+ export default function MbtilesLayerForm(props: MbtilesLayerFormProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { MlGeoJsonLayerProps } from 'src/components/MlGeoJsonLayer/MlGeoJsonLayer';
3
+ export interface ProtocolHandlerLayerFormProps {
4
+ originType: string;
5
+ config?: MlGeoJsonLayerProps;
6
+ mapId?: string;
7
+ onSubmit: (config: MlGeoJsonLayerProps) => void;
8
+ onCancel: () => void;
9
+ }
10
+ export default function ProtocolHandlerLayerForm(props: ProtocolHandlerLayerFormProps): JSX.Element;
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { wmsConfig } from 'src/contexts/LayerContext';
2
3
  export interface WmsLayerConfig {
3
4
  url: string;
4
5
  }
5
6
  export interface WmsLayerFormProps {
6
- onSubmit: (config: WmsLayerConfig) => void;
7
+ onSubmit: (config: wmsConfig) => void;
7
8
  onCancel: () => void;
8
9
  }
9
10
  export default function WmsLayerForm(props: WmsLayerFormProps): JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface CSVOptionsFormulaProps {
3
+ setter: any;
4
+ }
5
+ declare function CSVOptionsFormular(props: CSVOptionsFormulaProps): JSX.Element;
6
+ export default CSVOptionsFormular;
@@ -0,0 +1,7 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { LayerSpecification } from 'maplibre-gl';
3
+ interface MbtilesLayerPropFormularProps {
4
+ setter: Dispatch<SetStateAction<LayerSpecification[]>>;
5
+ }
6
+ export default function MbtilesLayerPropFormular(props: MbtilesLayerPropFormularProps): JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface OsmOptionsFomularProps {
3
+ setter: any;
4
+ }
5
+ declare function OsmOptionsFomular(props: OsmOptionsFomularProps): JSX.Element;
6
+ export default OsmOptionsFomular;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export interface DemoDescriptionItem {
3
+ item: string;
4
+ description: string;
5
+ }
6
+ interface DemoDescriptionsProps {
7
+ section: string;
8
+ json: DemoDescriptionItem[];
9
+ title: string;
10
+ }
11
+ declare function DemoDescriptions(props: DemoDescriptionsProps): JSX.Element;
12
+ export default DemoDescriptions;
@@ -1,11 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { LayerConfig } from '../../contexts/LayerContext';
3
+ import { FitBoundsOptions } from 'maplibre-gl';
3
4
  export interface LayerListItemFactoryProps {
4
5
  mapId?: string;
5
6
  layers: LayerConfig[];
6
7
  setLayers?: (layers: LayerConfig[] | ((state: LayerConfig[]) => LayerConfig[])) => void;
7
8
  insertBeforeLayer?: string;
8
9
  sortable?: boolean;
10
+ fitBoundsOptions?: FitBoundsOptions;
9
11
  }
10
12
  declare function LayerListItemFactory(props: LayerListItemFactoryProps): JSX.Element;
11
13
  declare namespace LayerListItemFactory {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcomponents/react-maplibre",
3
- "version": "0.1.87",
3
+ "version": "0.1.88",
4
4
  "main": "dist/index.esm.js",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.esm.js",
@@ -29,16 +29,21 @@
29
29
  "@mapbox/mapbox-gl-sync-move": "^0.3.1",
30
30
  "@mui/icons-material": "^5.11.0",
31
31
  "@mui/material": "^5.12.3",
32
+ "@tmcw/togeojson": "^5.7.0",
32
33
  "@turf/turf": "^6.5.0",
33
34
  "@types/react-color": "^3.0.6",
35
+ "@types/topojson-client": "^3.1.1",
34
36
  "@xmldom/xmldom": "^0.8.10",
37
+ "csv2geojson": "^5.1.2",
35
38
  "d3": "^7.8.2",
36
39
  "jspdf": "^2.5.1",
37
40
  "maplibre-gl": "^2.4.0",
41
+ "osm2geojson-lite": "^0.9.2",
38
42
  "pako": "^2.1.0",
39
43
  "react-color": "^2.19.3",
40
44
  "react-moveable": "^0.46.1",
41
45
  "three": "^0.149.0",
46
+ "topojson-client": "^3.1.0",
42
47
  "traverse": "^0.6.7",
43
48
  "uuid": "^9.0.0",
44
49
  "wms-capabilities": "^0.6.0"