@mapcomponents/react-maplibre 0.1.80 → 0.1.82
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.
- package/CHANGELOG.md +14 -1
- package/README.md +4 -4
- package/dist/hooks/useAddProtocol/useAddProtocol.d.ts +23 -0
- package/dist/hooks/useAddProtocol/useAddProtocol.stories.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +25 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/protocol_handlers/mbtiles.d.ts +33 -0
- package/package.json +5 -1
- /package/dist/decorators/{TemporalControllerDecorator.d.ts → LowZoomDecorator.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## [v0.1.
|
|
3
|
+
## [v0.1.82] - 2023-06-12
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- b89794a: remove mbTilesProtocolHandler from export to remove sql.js dependency as it breaks app builds
|
|
8
|
+
|
|
9
|
+
## [v0.1.81] - 2023-06-12
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- 2ba02ba: add useAddProtocol hook
|
|
14
|
+
- 2ba02ba: add mbTilesProtocolHandler
|
|
15
|
+
|
|
16
|
+
## [v0.1.80] - 2023-06-01
|
|
4
17
|
|
|
5
18
|
### Added
|
|
6
19
|
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Use our Codesandbox template to quickly try out this library without any setup r
|
|
|
20
20
|
|
|
21
21
|
### **... a new project**
|
|
22
22
|
|
|
23
|
-
The easiest way to start a new project using this framework is to bootstrap a react application using our [
|
|
23
|
+
The easiest way to start a new project using this framework is to bootstrap a react application using our [vite-template](https://github.com/mapcomponents/template).
|
|
24
24
|
|
|
25
25
|
**Requirements:**
|
|
26
26
|
|
|
@@ -29,12 +29,12 @@ The easiest way to start a new project using this framework is to bootstrap a re
|
|
|
29
29
|
|
|
30
30
|
Run the following commands in the terminal:
|
|
31
31
|
|
|
32
|
-
1. `npx
|
|
32
|
+
1. `npx degit mapcomponents/template {your-app-name}`
|
|
33
33
|
2. `cd {your-app-name}`
|
|
34
34
|
3. `yarn`
|
|
35
|
-
4. `yarn
|
|
35
|
+
4. `yarn dev`
|
|
36
36
|
|
|
37
|
-
This will start a development server that serves the mapcomponents app on port
|
|
37
|
+
This will start a development server that serves the mapcomponents app on port 5174 of your local machine as well as a browser tab with live reload enabled. This reloads the affected parts of the application if changes are detected to the corresponding files in the filesystem. Open the project folder in the IDE of your choice and start building your map client.
|
|
38
38
|
|
|
39
39
|
### **... an existing react project**
|
|
40
40
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Cancelable, RequestParameters, ResponseCallback } from 'maplibre-gl';
|
|
2
|
+
export interface useAddProtocolProps {
|
|
3
|
+
/**
|
|
4
|
+
* the protocol string, for example `mbtiles`
|
|
5
|
+
* In this example the handler function is called for all tile requests that start with the string `mbtiles://`
|
|
6
|
+
*/
|
|
7
|
+
protocol: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom load tile function that will be called when using a source that starts with a custom url schema.
|
|
10
|
+
*/
|
|
11
|
+
handler: (requestParameters: RequestParameters, callback: ResponseCallback<any>) => Cancelable;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Enables the use of custom protocols (basically custom tile load functions) in the maplibre-gl-js library.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
declare const useAddProtocol: {
|
|
18
|
+
(props: useAddProtocolProps): {};
|
|
19
|
+
defaultProps: {
|
|
20
|
+
mapId: undefined;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default useAddProtocol;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const storyoptions: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: {
|
|
5
|
+
(props: import("./useAddProtocol").useAddProtocolProps): {};
|
|
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;
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export { default as useWms } from "./hooks/useWms";
|
|
|
49
49
|
export { default as useFilterData } from "./components/MlTemporalController/utils/useFilterData";
|
|
50
50
|
export { default as useLayerContext } from "./hooks/useLayerContext";
|
|
51
51
|
export { default as useFeatureEditor } from "./hooks/useFeatureEditor";
|
|
52
|
+
export { default as useAddProtocol } from "./hooks/useAddProtocol/useAddProtocol";
|
|
52
53
|
export { MapComponentsProvider } from "./contexts/MapContext";
|
|
53
54
|
export { default as MapContext } from "./contexts/MapContext";
|
|
54
55
|
export { default as SimpleDataProvider } from "./contexts/SimpleDataProvider";
|
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var maplibregl = require('maplibre-gl');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var styles = require('@mui/material/styles');
|
|
8
8
|
var uuid = require('uuid');
|
|
@@ -90,6 +90,7 @@ function _interopNamespace(e) {
|
|
|
90
90
|
return Object.freeze(n);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
var maplibregl__default = /*#__PURE__*/_interopDefaultLegacy(maplibregl);
|
|
93
94
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
94
95
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
95
96
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
@@ -738,7 +739,7 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
738
739
|
_a.sent();
|
|
739
740
|
_a.label = 2;
|
|
740
741
|
case 2:
|
|
741
|
-
self.map = new
|
|
742
|
+
self.map = new maplibregl.Map(props.mapOptions);
|
|
742
743
|
self.addNativeMaplibreFunctionsAndProps();
|
|
743
744
|
self.wrapper.refreshViewport();
|
|
744
745
|
self.wrapper.fire('viewportchange');
|
|
@@ -1439,7 +1440,7 @@ var createExport = function (options) {
|
|
|
1439
1440
|
_loop_1(name_1);
|
|
1440
1441
|
}
|
|
1441
1442
|
// Create a new MapLibre-gl instance
|
|
1442
|
-
var renderMap = new
|
|
1443
|
+
var renderMap = new maplibregl.Map({
|
|
1443
1444
|
container: container,
|
|
1444
1445
|
center: options.map.map.getCenter(),
|
|
1445
1446
|
zoom: options.map.map.getZoom(),
|
|
@@ -4191,7 +4192,7 @@ var useLayerHoverPopup = function (props) {
|
|
|
4191
4192
|
mapId: props.mapId,
|
|
4192
4193
|
waitForLayer: props.layerId,
|
|
4193
4194
|
});
|
|
4194
|
-
var popup = React.useRef(new
|
|
4195
|
+
var popup = React.useRef(new maplibregl.Popup({
|
|
4195
4196
|
closeButton: false,
|
|
4196
4197
|
closeOnClick: true,
|
|
4197
4198
|
}));
|
|
@@ -6188,6 +6189,25 @@ var useLayerContext = function () {
|
|
|
6188
6189
|
return layerContext;
|
|
6189
6190
|
};
|
|
6190
6191
|
|
|
6192
|
+
/**
|
|
6193
|
+
* Enables the use of custom protocols (basically custom tile load functions) in the maplibre-gl-js library.
|
|
6194
|
+
*
|
|
6195
|
+
*/
|
|
6196
|
+
var useAddProtocol = function (props) {
|
|
6197
|
+
React.useEffect(function () {
|
|
6198
|
+
if (!props.protocol || typeof props.handler !== 'function')
|
|
6199
|
+
return;
|
|
6200
|
+
maplibregl__default["default"].addProtocol(props.protocol, props.handler);
|
|
6201
|
+
return function () {
|
|
6202
|
+
maplibregl__default["default"].removeProtocol(props.protocol);
|
|
6203
|
+
};
|
|
6204
|
+
}, []);
|
|
6205
|
+
return {};
|
|
6206
|
+
};
|
|
6207
|
+
useAddProtocol.defaultProps = {
|
|
6208
|
+
mapId: undefined,
|
|
6209
|
+
};
|
|
6210
|
+
|
|
6191
6211
|
var SimpleDataContext = /*#__PURE__*/React__default["default"].createContext({});
|
|
6192
6212
|
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
6193
6213
|
|
|
@@ -19932,6 +19952,7 @@ exports.TopToolbar = TopToolbar;
|
|
|
19932
19952
|
exports.UploadButton = UploadButton;
|
|
19933
19953
|
exports.WmsLayerForm = WmsLayerForm;
|
|
19934
19954
|
exports.getTheme = getTheme;
|
|
19955
|
+
exports.useAddProtocol = useAddProtocol;
|
|
19935
19956
|
exports.useCameraFollowPath = useCameraFollowPath;
|
|
19936
19957
|
exports.useExportMap = useExportMap;
|
|
19937
19958
|
exports.useFeatureEditor = useFeatureEditor;
|