@open-pioneer/geolocation 1.0.0-dev.20251021074813 → 1.0.0
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 +9 -5
- package/Geolocation.js +3 -2
- package/Geolocation.js.map +1 -1
- package/GeolocationController.d.ts +2 -2
- package/GeolocationController.js +12 -7
- package/GeolocationController.js.map +1 -1
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# @open-pioneer/geolocation
|
|
2
2
|
|
|
3
|
-
## 1.0.0
|
|
3
|
+
## 1.0.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- 2732052: Icons have been changed to unify the appearance of the components. Preferably, Lucide react-icons are used.
|
|
8
|
-
- 2abcaaf: Update to chakra-ui 3.
|
|
8
|
+
- 2abcaaf: Update to chakra-ui 3.28.0
|
|
9
9
|
|
|
10
10
|
### Patch Changes
|
|
11
11
|
|
|
12
12
|
- 10d2fe7: Update dependencies
|
|
13
|
-
-
|
|
13
|
+
- 4f1e7bd: The highlight layer(s) created by this package now uses the map model's `topmost` option to register an (internal) layer.
|
|
14
|
+
The previous implementation was based on adding a "raw" OpenLayers layer to the `olMap`.
|
|
15
|
+
- 138d85b: Update core packages to 4.2.0
|
|
14
16
|
- da6a410: Update dependencies
|
|
15
17
|
- Updated dependencies [c6180c6]
|
|
16
18
|
- Updated dependencies [29a10df]
|
|
17
19
|
- Updated dependencies [10d2fe7]
|
|
20
|
+
- Updated dependencies [4f1e7bd]
|
|
18
21
|
- Updated dependencies [2702df4]
|
|
19
22
|
- Updated dependencies [12561fe]
|
|
20
23
|
- Updated dependencies [5df900f]
|
|
@@ -22,6 +25,7 @@
|
|
|
22
25
|
- Updated dependencies [b3709f1]
|
|
23
26
|
- Updated dependencies [14c484e]
|
|
24
27
|
- Updated dependencies [138d85b]
|
|
28
|
+
- Updated dependencies [4f1e7bd]
|
|
25
29
|
- Updated dependencies [aeb9000]
|
|
26
30
|
- Updated dependencies [9e9bc6e]
|
|
27
31
|
- Updated dependencies [b3709f1]
|
|
@@ -33,8 +37,8 @@
|
|
|
33
37
|
- Updated dependencies [773fa2d]
|
|
34
38
|
- Updated dependencies [2abcaaf]
|
|
35
39
|
- Updated dependencies [da6a410]
|
|
36
|
-
- @open-pioneer/map@1.0.0
|
|
37
|
-
- @open-pioneer/map-ui-components@1.0.0
|
|
40
|
+
- @open-pioneer/map@1.0.0
|
|
41
|
+
- @open-pioneer/map-ui-components@1.0.0
|
|
38
42
|
|
|
39
43
|
## 0.11.0
|
|
40
44
|
|
package/Geolocation.js
CHANGED
|
@@ -65,6 +65,7 @@ const GeolocationImpl = function GeolocationImpl2(props) {
|
|
|
65
65
|
function useController(map, maxZoom, trackingOptions, positionFeatureStyle, accuracyFeatureStyle) {
|
|
66
66
|
const intl = useIntl();
|
|
67
67
|
const notificationService = useService("notifier.NotificationService");
|
|
68
|
+
const layerFactory = useService("map.LayerFactory");
|
|
68
69
|
const [controller, setController] = useState();
|
|
69
70
|
useEffect(() => {
|
|
70
71
|
const onError = (error) => {
|
|
@@ -87,13 +88,13 @@ function useController(map, maxZoom, trackingOptions, positionFeatureStyle, accu
|
|
|
87
88
|
message: description
|
|
88
89
|
});
|
|
89
90
|
};
|
|
90
|
-
const geolocationController = new GeolocationController(map, onError, trackingOptions);
|
|
91
|
+
const geolocationController = new GeolocationController(map, layerFactory, onError, trackingOptions);
|
|
91
92
|
setController(geolocationController);
|
|
92
93
|
return () => {
|
|
93
94
|
geolocationController.destroy();
|
|
94
95
|
setController(void 0);
|
|
95
96
|
};
|
|
96
|
-
}, [map, trackingOptions, intl, notificationService]);
|
|
97
|
+
}, [map, trackingOptions, intl, notificationService, layerFactory]);
|
|
97
98
|
useEffect(() => {
|
|
98
99
|
controller?.setPositionFeatureStyle(positionFeatureStyle);
|
|
99
100
|
}, [controller, positionFeatureStyle]);
|
package/Geolocation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Geolocation.js","sources":["Geolocation.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@chakra-ui/react\";\nimport { MapModel, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { StyleLike } from \"ol/style/Style\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, RefAttributes, useEffect, useState } from \"react\";\nimport { LuLocateFixed } from \"react-icons/lu\";\nimport { GeolocationController, OnErrorCallback } from \"./GeolocationController\";\n\n/**\n * These are properties supported by the {@link Geolocation} component.\n */\nexport interface GeolocationProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n /**\n * The default maximal zoom level\n */\n maxZoom?: number;\n /**\n * Style to be applied for the positioning highlight feature.\n */\n positionFeatureStyle?: StyleLike;\n /**\n * Style to be applied for the accuracy highlight of the positioning feature.\n */\n accuracyFeatureStyle?: StyleLike;\n /**\n * Position options for the Geolocation-Object.\n * See [PositionOptions](https://www.w3.org/TR/geolocation/#position_options_interface) for more details.\n *\n * NOTE: Changing the tracking options at runtime will reset the component's state.\n */\n trackingOptions?: PositionOptions;\n}\n\nexport const Geolocation: FC<GeolocationProps> = function Geolocation(props: GeolocationProps) {\n const { maxZoom, positionFeatureStyle, accuracyFeatureStyle, trackingOptions, ref } = props;\n const map = useMapModelValue(props);\n const controller = useController(\n map,\n maxZoom,\n trackingOptions,\n positionFeatureStyle,\n accuracyFeatureStyle\n );\n return controller && <GeolocationImpl {...props} controller={controller} ref={ref} />;\n};\n\n// This is a separate component so we can act like the controller is always present.\n// This is the case in practice (except for the initial loading phase where the component is not-yet-mounted).\nconst GeolocationImpl = function GeolocationImpl(\n props: GeolocationProps & { controller: GeolocationController }\n) {\n const { controller, buttonProps, ref } = props;\n const { containerProps } = useCommonComponentProps(\"geolocation\", props);\n const { isLoading, isActive } = useReactiveSnapshot(() => {\n return {\n isLoading: controller.loading,\n isActive: controller.active\n };\n }, [controller]);\n\n const intl = useIntl();\n const label = (() => {\n if (!controller.supported) {\n return intl.formatMessage({ id: \"locateNotSupported\" });\n }\n\n if (isActive) {\n return intl.formatMessage({ id: \"locateMeEnd\" });\n } else {\n return intl.formatMessage({ id: \"locateMeStart\" });\n }\n })();\n\n const toggleActiveState = () => {\n if (controller.active) {\n controller.stopGeolocation();\n } else {\n controller.startGeolocation();\n }\n };\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={label}\n icon={<LuLocateFixed />}\n onClick={() => toggleActiveState()}\n active={isActive}\n loading={isLoading}\n disabled={!controller.supported}\n {...containerProps}\n />\n );\n};\n\nfunction useController(\n map: MapModel,\n maxZoom: number | undefined,\n trackingOptions: PositionOptions | undefined,\n positionFeatureStyle: StyleLike | undefined,\n accuracyFeatureStyle: StyleLike | undefined\n): GeolocationController | undefined {\n const intl = useIntl();\n const notificationService = useService<NotificationService>(\"notifier.NotificationService\");\n const [controller, setController] = useState<GeolocationController>();\n useEffect(() => {\n const onError: OnErrorCallback = (error) => {\n const title = intl.formatMessage({ id: \"error\" });\n const description = (() => {\n switch (error) {\n case \"permission-denied\":\n return intl.formatMessage({ id: \"permissionDenied\" });\n case \"position-unavailable\":\n return intl.formatMessage({ id: \"positionUnavailable\" });\n case \"timeout\":\n return intl.formatMessage({ id: \"timeout\" });\n case \"unknown\":\n return intl.formatMessage({ id: \"unknownError\" });\n }\n })();\n\n notificationService.notify({\n level: \"error\",\n title: title,\n message: description\n });\n };\n\n const geolocationController = new GeolocationController(map, onError, trackingOptions);\n setController(geolocationController);\n\n return () => {\n geolocationController.destroy();\n setController(undefined);\n };\n }, [map, trackingOptions, intl, notificationService]);\n useEffect(() => {\n controller?.setPositionFeatureStyle(positionFeatureStyle);\n }, [controller, positionFeatureStyle]);\n useEffect(() => {\n controller?.setAccuracyFeatureStyle(accuracyFeatureStyle);\n }, [controller, accuracyFeatureStyle]);\n useEffect(() => {\n controller?.setMaxZoom(maxZoom);\n }, [controller, maxZoom]);\n return controller;\n}\n"],"names":["Geolocation","GeolocationImpl"],"mappings":";;;;;;;;;;AAgDO,MAAM,WAAA,GAAoC,SAASA,YAAAA,CAAY,KAAA,EAAyB;AAC3F,EAAA,MAAM,EAAE,OAAA,EAAS,oBAAA,EAAsB,oBAAA,EAAsB,eAAA,EAAiB,KAAI,GAAI,KAAA;AACtF,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,UAAA,GAAa,aAAA;AAAA,IACf,GAAA;AAAA,IACA,OAAA;AAAA,IACA,eAAA;AAAA,IACA,oBAAA;AAAA,IACA;AAAA,GACJ;AACA,EAAA,OAAO,8BAAc,GAAA,CAAC,eAAA,EAAA,EAAiB,GAAG,KAAA,EAAO,YAAwB,GAAA,EAAU,CAAA;AACvF;AAIA,MAAM,eAAA,GAAkB,SAASC,gBAAAA,CAC7B,KAAA,EACF;AACE,EAAA,MAAM,EAAE,UAAA,EAAY,WAAA,EAAa,GAAA,EAAI,GAAI,KAAA;AACzC,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,eAAe,KAAK,CAAA;AACvE,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAS,GAAI,oBAAoB,MAAM;AACtD,IAAA,OAAO;AAAA,MACH,WAAW,UAAA,CAAW,OAAA;AAAA,MACtB,UAAU,UAAA,CAAW;AAAA,KACzB;AAAA,EACJ,CAAA,EAAG,CAAC,UAAU,CAAC,C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A,SAAA,CAAU,MAAM;AACZ,IAAA,MAAM,OAAA,GAA2B,CAAC,KAAA,KAAU;AACxC,MAAA,MAAM,QAAQ,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,SAAS,CAAA;AAChD,MAAA,MAAM,eAAe,MAAM;AACvB,QAAA,QAAQ,KAAA;AAAO,UACX,KAAK,mBAAA;AACD,YAAA,OAAO,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,oBAAoB,CAAA;AAAA,UACxD,KAAK,sBAAA;AACD,YAAA,OAAO,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,uBAAuB,CAAA;AAAA,UAC3D,KAAK,SAAA;AACD,YAAA,OAAO,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,WAAW,CAAA;AAAA,UAC/C,KAAK,SAAA;AACD,YAAA,OAAO,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,gBAAgB,CAAA;AAAA;AACxD,MACJ,CAAA,GAAG;AAEH,MAAA,mBAAA,CAAoB,MAAA,CAAO;AAAA,QACvB,KAAA,EAAO,OAAA;AAAA,QACP,KAAA;AAAA,QACA,OAAA,EAAS;AAAA,OACZ,CAAA;AAAA,IACL,CAAA;AAEA,IAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"Geolocation.js","sources":["Geolocation.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@chakra-ui/react\";\nimport { LayerFactory, MapModel, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { StyleLike } from \"ol/style/Style\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, RefAttributes, useEffect, useState } from \"react\";\nimport { LuLocateFixed } from \"react-icons/lu\";\nimport { GeolocationController, OnErrorCallback } from \"./GeolocationController\";\n\n/**\n * These are properties supported by the {@link Geolocation} component.\n */\nexport interface GeolocationProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n /**\n * The default maximal zoom level\n */\n maxZoom?: number;\n /**\n * Style to be applied for the positioning highlight feature.\n */\n positionFeatureStyle?: StyleLike;\n /**\n * Style to be applied for the accuracy highlight of the positioning feature.\n */\n accuracyFeatureStyle?: StyleLike;\n /**\n * Position options for the Geolocation-Object.\n * See [PositionOptions](https://www.w3.org/TR/geolocation/#position_options_interface) for more details.\n *\n * NOTE: Changing the tracking options at runtime will reset the component's state.\n */\n trackingOptions?: PositionOptions;\n}\n\nexport const Geolocation: FC<GeolocationProps> = function Geolocation(props: GeolocationProps) {\n const { maxZoom, positionFeatureStyle, accuracyFeatureStyle, trackingOptions, ref } = props;\n const map = useMapModelValue(props);\n const controller = useController(\n map,\n maxZoom,\n trackingOptions,\n positionFeatureStyle,\n accuracyFeatureStyle\n );\n return controller && <GeolocationImpl {...props} controller={controller} ref={ref} />;\n};\n\n// This is a separate component so we can act like the controller is always present.\n// This is the case in practice (except for the initial loading phase where the component is not-yet-mounted).\nconst GeolocationImpl = function GeolocationImpl(\n props: GeolocationProps & { controller: GeolocationController }\n) {\n const { controller, buttonProps, ref } = props;\n const { containerProps } = useCommonComponentProps(\"geolocation\", props);\n const { isLoading, isActive } = useReactiveSnapshot(() => {\n return {\n isLoading: controller.loading,\n isActive: controller.active\n };\n }, [controller]);\n\n const intl = useIntl();\n const label = (() => {\n if (!controller.supported) {\n return intl.formatMessage({ id: \"locateNotSupported\" });\n }\n\n if (isActive) {\n return intl.formatMessage({ id: \"locateMeEnd\" });\n } else {\n return intl.formatMessage({ id: \"locateMeStart\" });\n }\n })();\n\n const toggleActiveState = () => {\n if (controller.active) {\n controller.stopGeolocation();\n } else {\n controller.startGeolocation();\n }\n };\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={label}\n icon={<LuLocateFixed />}\n onClick={() => toggleActiveState()}\n active={isActive}\n loading={isLoading}\n disabled={!controller.supported}\n {...containerProps}\n />\n );\n};\n\nfunction useController(\n map: MapModel,\n maxZoom: number | undefined,\n trackingOptions: PositionOptions | undefined,\n positionFeatureStyle: StyleLike | undefined,\n accuracyFeatureStyle: StyleLike | undefined\n): GeolocationController | undefined {\n const intl = useIntl();\n const notificationService = useService<NotificationService>(\"notifier.NotificationService\");\n const layerFactory = useService<LayerFactory>(\"map.LayerFactory\");\n const [controller, setController] = useState<GeolocationController>();\n useEffect(() => {\n const onError: OnErrorCallback = (error) => {\n const title = intl.formatMessage({ id: \"error\" });\n const description = (() => {\n switch (error) {\n case \"permission-denied\":\n return intl.formatMessage({ id: \"permissionDenied\" });\n case \"position-unavailable\":\n return intl.formatMessage({ id: \"positionUnavailable\" });\n case \"timeout\":\n return intl.formatMessage({ id: \"timeout\" });\n case \"unknown\":\n return intl.formatMessage({ id: \"unknownError\" });\n }\n })();\n\n notificationService.notify({\n level: \"error\",\n title: title,\n message: description\n });\n };\n\n const geolocationController = new GeolocationController(map, layerFactory, onError, trackingOptions);\n setController(geolocationController);\n\n return () => {\n geolocationController.destroy();\n setController(undefined);\n };\n }, [map, trackingOptions, intl, notificationService, layerFactory]);\n useEffect(() => {\n controller?.setPositionFeatureStyle(positionFeatureStyle);\n }, [controller, positionFeatureStyle]);\n useEffect(() => {\n controller?.setAccuracyFeatureStyle(accuracyFeatureStyle);\n }, [controller, accuracyFeatureStyle]);\n useEffect(() => {\n controller?.setMaxZoom(maxZoom);\n }, [controller, maxZoom]);\n return controller;\n}\n"],"names":["Geolocation","GeolocationImpl"],"mappings":";;;;;;;;;;AAgDO,MAAM,WAAA,GAAoC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
|
-
import { MapModel } from "@open-pioneer/map";
|
|
1
|
+
import { LayerFactory, MapModel } from "@open-pioneer/map";
|
|
2
2
|
import Feature from "ol/Feature";
|
|
3
3
|
import olGeolocation from "ol/Geolocation";
|
|
4
4
|
import { Style } from "ol/style";
|
|
@@ -20,7 +20,7 @@ export declare class GeolocationController {
|
|
|
20
20
|
private setMapToPosition;
|
|
21
21
|
private trackingOptions;
|
|
22
22
|
private isInitialZoom;
|
|
23
|
-
constructor(map: MapModel, onError: OnErrorCallback, trackingOptions?: PositionOptions);
|
|
23
|
+
constructor(map: MapModel, layerFactory: LayerFactory, onError: OnErrorCallback, trackingOptions?: PositionOptions);
|
|
24
24
|
destroy(): void;
|
|
25
25
|
startGeolocation(): void;
|
|
26
26
|
stopGeolocation(): void;
|
package/GeolocationController.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { reactive } from '@conterra/reactivity-core';
|
|
2
2
|
import { createLogger } from '@open-pioneer/core';
|
|
3
|
-
import {
|
|
3
|
+
import { SimpleLayer, calculateBufferedExtent } from '@open-pioneer/map';
|
|
4
4
|
import Feature from 'ol/Feature.js';
|
|
5
5
|
import olGeolocation from 'ol/Geolocation.js';
|
|
6
6
|
import { unByKey } from 'ol/Observable.js';
|
|
@@ -27,7 +27,7 @@ class GeolocationController {
|
|
|
27
27
|
isInitialZoom = true;
|
|
28
28
|
#loading = reactive(false);
|
|
29
29
|
#active = reactive(false);
|
|
30
|
-
constructor(map, onError, trackingOptions) {
|
|
30
|
+
constructor(map, layerFactory, onError, trackingOptions) {
|
|
31
31
|
this.map = map;
|
|
32
32
|
this.onError = onError;
|
|
33
33
|
this.isInitialZoom = true;
|
|
@@ -35,12 +35,17 @@ class GeolocationController {
|
|
|
35
35
|
this.accuracyFeature.setStyle(getDefaultAccuracyStyle());
|
|
36
36
|
this.positionFeature = new Feature();
|
|
37
37
|
this.positionFeature.setStyle(getDefaultPositionStyle());
|
|
38
|
-
|
|
38
|
+
const olLayer = new VectorLayer({
|
|
39
39
|
source: new VectorSource({
|
|
40
40
|
features: [this.accuracyFeature, this.positionFeature]
|
|
41
41
|
})
|
|
42
42
|
});
|
|
43
|
-
this.positionHighlightLayer.
|
|
43
|
+
this.positionHighlightLayer = layerFactory.create({
|
|
44
|
+
type: SimpleLayer,
|
|
45
|
+
title: "geolocation-highlight-layer",
|
|
46
|
+
internal: true,
|
|
47
|
+
olLayer
|
|
48
|
+
});
|
|
44
49
|
const geolocationTrackingOptions = trackingOptions || getDefaultTrackingOptions();
|
|
45
50
|
this.geolocation = new olGeolocation({
|
|
46
51
|
tracking: false,
|
|
@@ -54,9 +59,9 @@ class GeolocationController {
|
|
|
54
59
|
this.stopGeolocation();
|
|
55
60
|
this.geolocation?.setTracking(false);
|
|
56
61
|
this.geolocation.dispose();
|
|
62
|
+
this.positionHighlightLayer.destroy();
|
|
57
63
|
this.accuracyFeature = void 0;
|
|
58
64
|
this.positionFeature = void 0;
|
|
59
|
-
this.positionHighlightLayer.dispose();
|
|
60
65
|
}
|
|
61
66
|
startGeolocation() {
|
|
62
67
|
if (this.#active.value) {
|
|
@@ -119,7 +124,7 @@ class GeolocationController {
|
|
|
119
124
|
resolutionChangeHandler,
|
|
120
125
|
draggingHandler
|
|
121
126
|
);
|
|
122
|
-
this.map.
|
|
127
|
+
this.map.layers.addLayer(this.positionHighlightLayer, { at: "topmost" });
|
|
123
128
|
});
|
|
124
129
|
geolocationPromise.then(() => {
|
|
125
130
|
this.#loading.value = false;
|
|
@@ -140,7 +145,7 @@ class GeolocationController {
|
|
|
140
145
|
this.changeHandlers = [];
|
|
141
146
|
this.accuracyFeature?.setGeometry(void 0);
|
|
142
147
|
this.positionFeature?.setGeometry(void 0);
|
|
143
|
-
this.map.
|
|
148
|
+
this.map.layers.removeLayer(this.positionHighlightLayer);
|
|
144
149
|
}
|
|
145
150
|
/** True if the position is being tracked. */
|
|
146
151
|
get active() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeolocationController.js","sources":["GeolocationController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive } from \"@conterra/reactivity-core\";\nimport { createLogger } from \"@open-pioneer/core\";\nimport { calculateBufferedExtent, MapModel, TOPMOST_LAYER_Z } from \"@open-pioneer/map\";\nimport Feature from \"ol/Feature\";\nimport olGeolocation, { GeolocationError } from \"ol/Geolocation\";\nimport { unByKey } from \"ol/Observable\";\nimport { Coordinate } from \"ol/coordinate\";\nimport type { EventsKey } from \"ol/events\";\nimport { Extent } from \"ol/extent\";\nimport { Polygon } from \"ol/geom\";\nimport Point from \"ol/geom/Point\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport VectorSource from \"ol/source/Vector\";\nimport { Circle as CircleStyle, Fill, Stroke, Style } from \"ol/style\";\nimport { StyleLike } from \"ol/style/Style\";\n\nconst LOG = createLogger(\"geolocation:GeolocationController\");\nconst DEFAULT_MAX_ZOOM = 17;\n\nexport type ErrorEvent = \"permission-denied\" | \"position-unavailable\" | \"timeout\" | \"unknown\";\n\nexport type OnErrorCallback = (errorEvent: ErrorEvent) => void;\n\nexport class GeolocationController {\n /** True if location tracking is supported by the browser. */\n public readonly supported = !!navigator.geolocation;\n\n private readonly map: MapModel;\n private readonly positionHighlightLayer: VectorLayer<VectorSource, Feature>;\n private readonly geolocation: olGeolocation;\n private readonly onError: OnErrorCallback;\n\n private maxZoom: number = DEFAULT_MAX_ZOOM;\n private accuracyFeature: Feature | undefined;\n private positionFeature: Feature | undefined;\n private changeHandlers: EventsKey[] = [];\n private setMapToPosition: boolean = true;\n private trackingOptions: PositionOptions = {};\n private isInitialZoom: boolean = true;\n\n #loading = reactive(false);\n #active = reactive(false);\n\n constructor(map: MapModel, onError: OnErrorCallback, trackingOptions?: PositionOptions) {\n this.map = map;\n this.onError = onError;\n this.isInitialZoom = true;\n\n this.accuracyFeature = new Feature();\n this.accuracyFeature.setStyle(getDefaultAccuracyStyle());\n\n this.positionFeature = new Feature();\n this.positionFeature.setStyle(getDefaultPositionStyle());\n\n this.positionHighlightLayer = new VectorLayer({\n source: new VectorSource({\n features: [this.accuracyFeature, this.positionFeature]\n })\n });\n this.positionHighlightLayer.setZIndex(TOPMOST_LAYER_Z);\n\n const geolocationTrackingOptions: PositionOptions =\n trackingOptions || getDefaultTrackingOptions();\n\n this.geolocation = new olGeolocation({\n tracking: false,\n trackingOptions: geolocationTrackingOptions,\n projection: map.olView?.getProjection()\n });\n\n this.trackingOptions = geolocationTrackingOptions;\n this.geolocation.on(\"error\", (event) => this.handleGeolocationError(event));\n }\n\n destroy() {\n this.stopGeolocation();\n this.geolocation?.setTracking(false);\n this.geolocation.dispose();\n this.accuracyFeature = undefined;\n this.positionFeature = undefined;\n this.positionHighlightLayer.dispose();\n }\n\n startGeolocation() {\n if (this.#active.value) {\n return;\n }\n\n const geolocationPromise = new Promise<void>((resolve) => {\n this.#active.value = true;\n this.#loading.value = true;\n\n this.geolocation?.setProjection(this.map.olView?.getProjection());\n this.geolocation?.setTracking(true);\n\n const accuracyChangeHandler: EventsKey = this.geolocation.on(\n \"change:accuracyGeometry\",\n () => {\n const accuracyGeometry: Polygon | undefined =\n this.geolocation.getAccuracyGeometry() || undefined;\n this.accuracyFeature?.setGeometry(accuracyGeometry);\n if (this.accuracyFeature?.getGeometry() !== undefined) {\n resolve();\n }\n if (this.isInitialZoom) {\n const accuracyGeometryExtent: Extent | undefined = this?.accuracyFeature\n ?.getGeometry()\n ?.getExtent();\n if (accuracyGeometryExtent) {\n const bufferedExtent = calculateBufferedExtent(accuracyGeometryExtent);\n if (!bufferedExtent) {\n return;\n }\n this.map.olView.fit(bufferedExtent, {\n maxZoom: this.maxZoom\n });\n this.isInitialZoom = false;\n }\n }\n }\n );\n\n const positionChangeHandler: EventsKey = this.geolocation.on(\"change:position\", () => {\n const coordinates: Coordinate | undefined = this.geolocation.getPosition();\n if (coordinates && (coordinates[0] || coordinates[1]) !== undefined) {\n this.positionFeature?.setGeometry(new Point(coordinates));\n if (this.setMapToPosition) {\n this.map.olView.setCenter(coordinates);\n }\n if (this.positionFeature?.getGeometry() !== undefined) {\n resolve();\n }\n }\n });\n\n // zoom changes\n const resolutionChangeHandler: EventsKey = this.map.olView.on(\n \"change:resolution\",\n () => {\n this.setMapToPosition = this.isInitialZoom;\n }\n );\n\n // pointermove is triggered when a pointer is moved.\n // Note that on touch devices this is triggered when the map is panned,\n // so is not the same as mousemove.\n const draggingHandler: EventsKey = this.map.olMap.on(\"pointermove\", (evt) => {\n if (evt.dragging) {\n this.setMapToPosition = false;\n }\n });\n\n this.changeHandlers.push(\n accuracyChangeHandler,\n positionChangeHandler,\n resolutionChangeHandler,\n draggingHandler\n );\n\n this.map.olMap.addLayer(this.positionHighlightLayer);\n });\n\n geolocationPromise\n .then(() => {\n // Promise resolves once we have a position\n this.#loading.value = false;\n })\n .catch((error: Error) => {\n LOG.error(\"Failed to determine location\", error);\n });\n }\n\n stopGeolocation() {\n this.geolocation?.setTracking(false);\n this.#active.value = false;\n this.#loading.value = false;\n this.trackingOptions = {};\n this.setMapToPosition = true;\n this.isInitialZoom = true;\n\n this.changeHandlers.forEach((handler) => {\n unByKey(handler);\n });\n this.changeHandlers = [];\n this.accuracyFeature?.setGeometry(undefined);\n this.positionFeature?.setGeometry(undefined);\n this.map.olMap.removeLayer(this.positionHighlightLayer);\n }\n\n /** True if the position is being tracked. */\n get active(): boolean {\n return this.#active.value;\n }\n\n /**\n * True if loading (active but no position available yet).\n * Use this to show a progress indicator.\n */\n get loading(): boolean {\n return this.#loading.value;\n }\n\n setPositionFeatureStyle(styleLike: StyleLike | undefined) {\n this.positionFeature?.setStyle(styleLike ?? getDefaultPositionStyle());\n }\n\n setAccuracyFeatureStyle(styleLike: StyleLike | undefined) {\n this.accuracyFeature?.setStyle(styleLike ?? getDefaultAccuracyStyle());\n }\n\n setMaxZoom(maxZoom: number | undefined) {\n this.maxZoom = maxZoom ?? DEFAULT_MAX_ZOOM;\n }\n\n getMaxZoom() {\n return this.maxZoom;\n }\n\n getPositionFeature() {\n return this.positionFeature;\n }\n\n getAccuracyFeature() {\n return this.accuracyFeature;\n }\n\n getTrackingOptions() {\n return this.trackingOptions;\n }\n\n getGeolocation() {\n return this.geolocation;\n }\n\n private handleGeolocationError(event: GeolocationError) {\n LOG.error(\"Error from geolocation API:\", event.message);\n\n this.stopGeolocation();\n const error: ErrorEvent = (() => {\n switch (event.code) {\n case 1:\n return \"permission-denied\";\n case 2:\n return \"position-unavailable\";\n case 3:\n return \"timeout\";\n default:\n return \"unknown\";\n }\n })();\n this.onError(error);\n }\n}\n\nexport const getDefaultPositionStyle = () => {\n return new Style({\n image: new CircleStyle({\n radius: 6,\n fill: new Fill({\n color: \"#3399CC\"\n }),\n stroke: new Stroke({\n color: \"#fff\",\n width: 2\n })\n })\n });\n};\n\nexport const getDefaultAccuracyStyle = () => {\n return new Style({\n stroke: new Stroke({\n color: \"#3399CC\",\n width: 3\n }),\n fill: new Fill({\n color: \"rgba(0, 0, 255, 0.05)\"\n })\n });\n};\n\nexport const getDefaultTrackingOptions = (): PositionOptions => {\n return {\n \"enableHighAccuracy\": true,\n \"timeout\": 60000,\n \"maximumAge\": 600000\n };\n};\n"],"names":["CircleStyle"],"mappings":";;;;;;;;;;;AAkBA,MAAM,GAAA,GAAM,aAAa,mCAAmC,CAAA;AAC5D,MAAM,gBAAA,GAAmB,EAAA;AAMlB,MAAM,qBAAA,CAAsB;AAAA;AAAA,EAEf,SAAA,GAAY,CAAC,CAAC,SAAA,CAAU,WAAA;AAAA,EAEvB,GAAA;AAAA,EACA,sBAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EAET,OAAA,GAAkB,gBAAA;AAAA,EAClB,eAAA;AAAA,EACA,eAAA;AAAA,EACA,iBAA8B,EAAC;AAAA,EAC/B,gBAAA,GAA4B,IAAA;AAAA,EAC5B,kBAAmC,EAAC;AAAA,EACpC,aAAA,GAAyB,I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A,OAAO,SAAA;AAAA;AACf,IACJ,CAAA,GAAG;AACH,IAAA,IAAA,CAAK,QAAQ,KAAK,CAAA;AAAA,EACtB;AACJ;AAEO,MAAM,0BAA0B,MAAM;AACzC,EAAA,OAAO,IAAI,KAAA,CAAM;AAAA,IACb,KAAA,EAAO,IAAIA,MAAA,CAAY;AAAA,MACnB,MAAA,EAAQ,CAAA;AAAA,MACR,IAAA,EAAM,IAAI,IAAA,CAAK;AAAA,QACX,KAAA,EAAO;AAAA,OACV,CAAA;AAAA,MACD,MAAA,EAAQ,IAAI,MAAA,CAAO;AAAA,QACf,KAAA,EAAO,MAAA;AAAA,QACP,KAAA,EAAO;AAAA,OACV;AAAA,KACJ;AAAA,GACJ,CAAA;AACL;AAEO,MAAM,0BAA0B,MAAM;AACzC,EAAA,OAAO,IAAI,KAAA,CAAM;AAAA,IACb,MAAA,EAAQ,IAAI,MAAA,CAAO;AAAA,MACf,KAAA,EAAO,SAAA;AAAA,MACP,KAAA,EAAO;AAAA,KACV,CAAA;AAAA,IACD,IAAA,EAAM,IAAI,IAAA,CAAK;AAAA,MACX,KAAA,EAAO;AAAA,KACV;AAAA,GACJ,CAAA;AACL;AAEO,MAAM,4BAA4B,MAAuB;AAC5D,EAAA,OAAO;AAAA,IACH,oBAAA,EAAsB,IAAA;AAAA,IACtB,SAAA,EAAW,GAAA;AAAA,IACX,YAAA,EAAc;AAAA,GAClB;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"GeolocationController.js","sources":["GeolocationController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive } from \"@conterra/reactivity-core\";\nimport { createLogger } from \"@open-pioneer/core\";\nimport { calculateBufferedExtent, LayerFactory, MapModel, SimpleLayer } from \"@open-pioneer/map\";\nimport Feature from \"ol/Feature\";\nimport olGeolocation, { GeolocationError } from \"ol/Geolocation\";\nimport { unByKey } from \"ol/Observable\";\nimport { Coordinate } from \"ol/coordinate\";\nimport type { EventsKey } from \"ol/events\";\nimport { Extent } from \"ol/extent\";\nimport { Polygon } from \"ol/geom\";\nimport Point from \"ol/geom/Point\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport VectorSource from \"ol/source/Vector\";\nimport { Circle as CircleStyle, Fill, Stroke, Style } from \"ol/style\";\nimport { StyleLike } from \"ol/style/Style\";\n\nconst LOG = createLogger(\"geolocation:GeolocationController\");\nconst DEFAULT_MAX_ZOOM = 17;\n\nexport type ErrorEvent = \"permission-denied\" | \"position-unavailable\" | \"timeout\" | \"unknown\";\n\nexport type OnErrorCallback = (errorEvent: ErrorEvent) => void;\n\nexport class GeolocationController {\n /** True if location tracking is supported by the browser. */\n public readonly supported = !!navigator.geolocation;\n\n private readonly map: MapModel;\n private readonly positionHighlightLayer: SimpleLayer;\n private readonly geolocation: olGeolocation;\n private readonly onError: OnErrorCallback;\n\n private maxZoom: number = DEFAULT_MAX_ZOOM;\n private accuracyFeature: Feature | undefined;\n private positionFeature: Feature | undefined;\n private changeHandlers: EventsKey[] = [];\n private setMapToPosition: boolean = true;\n private trackingOptions: PositionOptions = {};\n private isInitialZoom: boolean = true;\n\n #loading = reactive(false);\n #active = reactive(false);\n\n constructor(\n map: MapModel,\n layerFactory: LayerFactory,\n onError: OnErrorCallback,\n trackingOptions?: PositionOptions\n ) {\n this.map = map;\n this.onError = onError;\n this.isInitialZoom = true;\n\n this.accuracyFeature = new Feature();\n this.accuracyFeature.setStyle(getDefaultAccuracyStyle());\n\n this.positionFeature = new Feature();\n this.positionFeature.setStyle(getDefaultPositionStyle());\n\n const olLayer = new VectorLayer({\n source: new VectorSource({\n features: [this.accuracyFeature, this.positionFeature]\n })\n });\n this.positionHighlightLayer = layerFactory.create({\n type: SimpleLayer,\n title: \"geolocation-highlight-layer\",\n internal: true,\n olLayer: olLayer\n });\n\n const geolocationTrackingOptions: PositionOptions =\n trackingOptions || getDefaultTrackingOptions();\n\n this.geolocation = new olGeolocation({\n tracking: false,\n trackingOptions: geolocationTrackingOptions,\n projection: map.olView?.getProjection()\n });\n\n this.trackingOptions = geolocationTrackingOptions;\n this.geolocation.on(\"error\", (event) => this.handleGeolocationError(event));\n }\n\n destroy() {\n this.stopGeolocation();\n this.geolocation?.setTracking(false);\n this.geolocation.dispose();\n this.positionHighlightLayer.destroy();\n this.accuracyFeature = undefined;\n this.positionFeature = undefined;\n }\n\n startGeolocation() {\n if (this.#active.value) {\n return;\n }\n\n const geolocationPromise = new Promise<void>((resolve) => {\n this.#active.value = true;\n this.#loading.value = true;\n\n this.geolocation?.setProjection(this.map.olView?.getProjection());\n this.geolocation?.setTracking(true);\n\n const accuracyChangeHandler: EventsKey = this.geolocation.on(\n \"change:accuracyGeometry\",\n () => {\n const accuracyGeometry: Polygon | undefined =\n this.geolocation.getAccuracyGeometry() || undefined;\n this.accuracyFeature?.setGeometry(accuracyGeometry);\n if (this.accuracyFeature?.getGeometry() !== undefined) {\n resolve();\n }\n if (this.isInitialZoom) {\n const accuracyGeometryExtent: Extent | undefined = this?.accuracyFeature\n ?.getGeometry()\n ?.getExtent();\n if (accuracyGeometryExtent) {\n const bufferedExtent = calculateBufferedExtent(accuracyGeometryExtent);\n if (!bufferedExtent) {\n return;\n }\n this.map.olView.fit(bufferedExtent, {\n maxZoom: this.maxZoom\n });\n this.isInitialZoom = false;\n }\n }\n }\n );\n\n const positionChangeHandler: EventsKey = this.geolocation.on(\"change:position\", () => {\n const coordinates: Coordinate | undefined = this.geolocation.getPosition();\n if (coordinates && (coordinates[0] || coordinates[1]) !== undefined) {\n this.positionFeature?.setGeometry(new Point(coordinates));\n if (this.setMapToPosition) {\n this.map.olView.setCenter(coordinates);\n }\n if (this.positionFeature?.getGeometry() !== undefined) {\n resolve();\n }\n }\n });\n\n // zoom changes\n const resolutionChangeHandler: EventsKey = this.map.olView.on(\n \"change:resolution\",\n () => {\n this.setMapToPosition = this.isInitialZoom;\n }\n );\n\n // pointermove is triggered when a pointer is moved.\n // Note that on touch devices this is triggered when the map is panned,\n // so is not the same as mousemove.\n const draggingHandler: EventsKey = this.map.olMap.on(\"pointermove\", (evt) => {\n if (evt.dragging) {\n this.setMapToPosition = false;\n }\n });\n\n this.changeHandlers.push(\n accuracyChangeHandler,\n positionChangeHandler,\n resolutionChangeHandler,\n draggingHandler\n );\n\n this.map.layers.addLayer(this.positionHighlightLayer, { at: \"topmost\" });\n });\n\n geolocationPromise\n .then(() => {\n // Promise resolves once we have a position\n this.#loading.value = false;\n })\n .catch((error: Error) => {\n LOG.error(\"Failed to determine location\", error);\n });\n }\n\n stopGeolocation() {\n this.geolocation?.setTracking(false);\n this.#active.value = false;\n this.#loading.value = false;\n this.trackingOptions = {};\n this.setMapToPosition = true;\n this.isInitialZoom = true;\n\n this.changeHandlers.forEach((handler) => {\n unByKey(handler);\n });\n this.changeHandlers = [];\n this.accuracyFeature?.setGeometry(undefined);\n this.positionFeature?.setGeometry(undefined);\n this.map.layers.removeLayer(this.positionHighlightLayer);\n }\n\n /** True if the position is being tracked. */\n get active(): boolean {\n return this.#active.value;\n }\n\n /**\n * True if loading (active but no position available yet).\n * Use this to show a progress indicator.\n */\n get loading(): boolean {\n return this.#loading.value;\n }\n\n setPositionFeatureStyle(styleLike: StyleLike | undefined) {\n this.positionFeature?.setStyle(styleLike ?? getDefaultPositionStyle());\n }\n\n setAccuracyFeatureStyle(styleLike: StyleLike | undefined) {\n this.accuracyFeature?.setStyle(styleLike ?? getDefaultAccuracyStyle());\n }\n\n setMaxZoom(maxZoom: number | undefined) {\n this.maxZoom = maxZoom ?? DEFAULT_MAX_ZOOM;\n }\n\n getMaxZoom() {\n return this.maxZoom;\n }\n\n getPositionFeature() {\n return this.positionFeature;\n }\n\n getAccuracyFeature() {\n return this.accuracyFeature;\n }\n\n getTrackingOptions() {\n return this.trackingOptions;\n }\n\n getGeolocation() {\n return this.geolocation;\n }\n\n private handleGeolocationError(event: GeolocationError) {\n LOG.error(\"Error from geolocation API:\", event.message);\n\n this.stopGeolocation();\n const error: ErrorEvent = (() => {\n switch (event.code) {\n case 1:\n return \"permission-denied\";\n case 2:\n return \"position-unavailable\";\n case 3:\n return \"timeout\";\n default:\n return \"unknown\";\n }\n })();\n this.onError(error);\n }\n}\n\nexport const getDefaultPositionStyle = () => {\n return new Style({\n image: new CircleStyle({\n radius: 6,\n fill: new Fill({\n color: \"#3399CC\"\n }),\n stroke: new Stroke({\n color: \"#fff\",\n width: 2\n })\n })\n });\n};\n\nexport const getDefaultAccuracyStyle = () => {\n return new Style({\n stroke: new Stroke({\n color: \"#3399CC\",\n width: 3\n }),\n fill: new Fill({\n color: \"rgba(0, 0, 255, 0.05)\"\n })\n });\n};\n\nexport const getDefaultTrackingOptions = (): PositionOptions => {\n return {\n \"enableHighAccuracy\": true,\n \"timeout\": 60000,\n \"maximumAge\": 600000\n };\n};\n"],"names":["CircleStyle"],"mappings":";;;;;;;;;;;AAkBA,MAAM,GAAA,GAAM,aAAa,mCAAmC,CAAA;AAC5D,MAAM,gBAAA,GAAmB,EAAA;AAMlB,MAAM,qBAAA,CAAsB;AAAA;AAAA,EAEf,SAAA,GAAY,CAAC,CAAC,SAAA,CAAU,WAAA;AAAA,EAEvB,GAAA;AAAA,EACA,sBAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EAET,OAAA,GAAkB,gBAAA;AAAA,EAClB,eAAA;AAAA,EACA,eAAA;AAAA,EACA,iBAA8B,EAAC;AAAA,EAC/B,gBAAA,GAA4B,IAAA;AAAA,EAC5B,kBAAmC,EAAC;AAAA,EACpC,aAAA,GAAyB,IAAA;AAAA,EAEjC,QAAA,GAAW,SAAS,KAAK,CAAA;AAAA,EACzB,OAAA,GAAU,SAAS,KAAK,CAAA;AAAA,EAExB,WAAA,CACI,GAAA,EACA,YAAA,EACA,OAAA,EACA,eAAA,EACF;AACE,IAAA,IAAA,CAAK,GAAA,GAAM,GAAA;AACX,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA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BAA0B,MAAM;AACzC,EAAA,OAAO,IAAI,KAAA,CAAM;AAAA,IACb,KAAA,EAAO,IAAIA,MAAA,CAAY;AAAA,MACnB,MAAA,EAAQ,CAAA;AAAA,MACR,IAAA,EAAM,IAAI,IAAA,CAAK;AAAA,QACX,KAAA,EAAO;AAAA,OACV,CAAA;AAAA,MACD,MAAA,EAAQ,IAAI,MAAA,CAAO;AAAA,QACf,KAAA,EAAO,MAAA;AAAA,QACP,KAAA,EAAO;AAAA,OACV;AAAA,KACJ;AAAA,GACJ,CAAA;AACL;AAEO,MAAM,0BAA0B,MAAM;AACzC,EAAA,OAAO,IAAI,KAAA,CAAM;AAAA,IACb,MAAA,EAAQ,IAAI,MAAA,CAAO;AAAA,MACf,KAAA,EAAO,SAAA;AAAA,MACP,KAAA,EAAO;AAAA,KACV,CAAA;AAAA,IACD,IAAA,EAAM,IAAI,IAAA,CAAK;AAAA,MACX,KAAA,EAAO;AAAA,KACV;AAAA,GACJ,CAAA;AACL;AAEO,MAAM,4BAA4B,MAAuB;AAC5D,EAAA,OAAO;AAAA,IACH,oBAAA,EAAsB,IAAA;AAAA,IACtB,SAAA,EAAW,GAAA;AAAA,IACX,YAAA,EAAc;AAAA,GAClB;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/geolocation",
|
|
4
|
-
"version": "1.0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "This package provides a component to locate a user's position.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@conterra/reactivity-core": "^0.8.0",
|
|
18
18
|
"@chakra-ui/react": "^3.28.0",
|
|
19
|
-
"@open-pioneer/core": "4.2.0
|
|
20
|
-
"@open-pioneer/notifier": "4.2.0
|
|
21
|
-
"@open-pioneer/react-utils": "4.2.0
|
|
22
|
-
"@open-pioneer/reactivity": "4.2.0
|
|
23
|
-
"@open-pioneer/runtime": "4.2.0
|
|
19
|
+
"@open-pioneer/core": "^4.2.0",
|
|
20
|
+
"@open-pioneer/notifier": "^4.2.0",
|
|
21
|
+
"@open-pioneer/react-utils": "^4.2.0",
|
|
22
|
+
"@open-pioneer/reactivity": "^4.2.0",
|
|
23
|
+
"@open-pioneer/runtime": "^4.2.0",
|
|
24
24
|
"ol": "^10.6.1",
|
|
25
25
|
"react": "^19.2.0",
|
|
26
26
|
"react-icons": "^5.5.0",
|
|
27
|
-
"@open-pioneer/map": "1.0.0
|
|
28
|
-
"@open-pioneer/map-ui-components": "1.0.0
|
|
27
|
+
"@open-pioneer/map": "^1.0.0",
|
|
28
|
+
"@open-pioneer/map-ui-components": "^1.0.0"
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
31
|
"./package.json": "./package.json",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
{
|
|
48
48
|
"type": "unique",
|
|
49
49
|
"interfaceName": "notifier.NotificationService"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "unique",
|
|
53
|
+
"interfaceName": "map.LayerFactory"
|
|
50
54
|
}
|
|
51
55
|
]
|
|
52
56
|
},
|