@open-pioneer/geolocation 1.3.0-dev.20260211111005 → 1.3.0-dev.20260225083007
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 +5 -3
- package/Geolocation.js +6 -1
- package/Geolocation.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @open-pioneer/geolocation
|
|
2
2
|
|
|
3
|
-
## 1.3.0-dev.
|
|
3
|
+
## 1.3.0-dev.20260225083007
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
### Patch Changes
|
|
11
11
|
|
|
12
12
|
- Updated dependencies [9b5d5f3]
|
|
13
|
+
- Updated dependencies [fcbd505]
|
|
13
14
|
- Updated dependencies [2ceb1ca]
|
|
15
|
+
- Updated dependencies [fcbd505]
|
|
14
16
|
- Updated dependencies [d54ccfd]
|
|
15
17
|
- Updated dependencies [4bcc8ce]
|
|
16
18
|
- Updated dependencies [2ceb1ca]
|
|
17
|
-
- @open-pioneer/map-ui-components@1.3.0-dev.
|
|
18
|
-
- @open-pioneer/map@1.3.0-dev.
|
|
19
|
+
- @open-pioneer/map-ui-components@1.3.0-dev.20260225083007
|
|
20
|
+
- @open-pioneer/map@1.3.0-dev.20260225083007
|
|
19
21
|
|
|
20
22
|
## 1.2.0
|
|
21
23
|
|
package/Geolocation.js
CHANGED
|
@@ -88,7 +88,12 @@ function useController(map, maxZoom, trackingOptions, positionFeatureStyle, accu
|
|
|
88
88
|
message: description
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
-
const geolocationController = new GeolocationController(
|
|
91
|
+
const geolocationController = new GeolocationController(
|
|
92
|
+
map,
|
|
93
|
+
layerFactory,
|
|
94
|
+
onError,
|
|
95
|
+
trackingOptions
|
|
96
|
+
);
|
|
92
97
|
setController(geolocationController);
|
|
93
98
|
return () => {
|
|
94
99
|
geolocationController.destroy();
|
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 { 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
|
|
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, RefAttributes<HTMLButtonElement>, 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(\n map,\n layerFactory,\n onError,\n trackingOptions\n );\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":";;;;;;;;;;AA8CO,MAAM,WAAA,GAAoC,SAASA,YAAAA,CAAY,KAAA,EAAyB;AAC3F,EAAA,MAAM,EAAE,OAAA,EAAS,oBAAA,EAAs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": "@open-pioneer/geolocation",
|
|
4
|
-
"version": "1.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.20260225083007",
|
|
5
5
|
"description": "This package provides a component to locate a user's position.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"ol": "^10.7.0",
|
|
25
25
|
"react": "^19.2.4",
|
|
26
26
|
"react-icons": "^5.5.0",
|
|
27
|
-
"@open-pioneer/map
|
|
28
|
-
"@open-pioneer/map": "1.3.0-dev.
|
|
27
|
+
"@open-pioneer/map": "1.3.0-dev.20260225083007",
|
|
28
|
+
"@open-pioneer/map-ui-components": "1.3.0-dev.20260225083007"
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
31
|
"./package.json": "./package.json",
|