@open-pioneer/overview-map 1.5.0-dev.20260911123645 → 1.5.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 +16 -14
- package/OverviewMap.js +25 -8
- package/OverviewMap.js.map +1 -1
- package/_virtual/hooks.js.map +1 -1
- package/_virtual/source-info.js +4 -0
- package/_virtual/source-info.js.map +1 -0
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# @open-pioneer/overview-map
|
|
2
2
|
|
|
3
|
-
## 1.5.0
|
|
3
|
+
## 1.5.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- f790fda: Update to Chakra 3.37.0
|
|
8
|
+
- a186f5d: Update core packages to 4.8.0.
|
|
8
9
|
|
|
9
10
|
### Patch Changes
|
|
10
11
|
|
|
12
|
+
- 0d9a9d0: Adapt to timing changes during map initialization.
|
|
11
13
|
- 09ec7c7: Updated dependencies
|
|
12
14
|
|
|
13
15
|
## 1.4.0
|
|
@@ -73,17 +75,17 @@
|
|
|
73
75
|
- 193068a: Deprecate the `mapId` property on React components.
|
|
74
76
|
Use the `MapModel` directly instead to pass a reference to the map.
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
Example:
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
```tsx
|
|
81
|
+
// Default map for entire component tree
|
|
82
|
+
<DefaultMapProvider map={mapModel}>
|
|
83
|
+
<Toc />
|
|
84
|
+
</DefaultMapProvider>
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
// Map for specific component
|
|
87
|
+
<Toc map={mapModel} />
|
|
88
|
+
```
|
|
87
89
|
|
|
88
90
|
### Patch Changes
|
|
89
91
|
|
|
@@ -106,9 +108,9 @@
|
|
|
106
108
|
### Minor Changes
|
|
107
109
|
|
|
108
110
|
- 2fa8020: Update trails core package dependencies.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
- Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
|
|
112
|
+
- Removes any obsolete references to `@chakra-ui/system`.
|
|
113
|
+
This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
|
|
112
114
|
|
|
113
115
|
### Patch Changes
|
|
114
116
|
|
|
@@ -126,7 +128,7 @@
|
|
|
126
128
|
- 583f1d6: The `mapId` or `map` properties are now optional on individual components.
|
|
127
129
|
You can use the `DefaultMapProvider` to configure an implicit default value.
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
|
|
130
132
|
|
|
131
133
|
- 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
|
|
132
134
|
- a8b3449: Switch to a new versioning strategy.
|
package/OverviewMap.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { createLogger, isAbortError } from '@open-pioneer/core';
|
|
3
4
|
import { useMapModelValue } from '@open-pioneer/map';
|
|
4
5
|
import { useCommonComponentProps, mergeChakraProps } from '@open-pioneer/react-utils';
|
|
5
6
|
import { OverviewMap as OverviewMap$1 } from 'ol/control.js';
|
|
6
7
|
import { useIntl } from './_virtual/hooks.js';
|
|
8
|
+
import { sourceId } from './_virtual/source-info.js';
|
|
7
9
|
import { useRef, useEffect, useMemo } from 'react';
|
|
8
10
|
|
|
11
|
+
const LOG = createLogger(sourceId);
|
|
9
12
|
const DEFAULT_HEIGHT = "200px";
|
|
10
13
|
const DEFAULT_WIDTH = "300px";
|
|
11
14
|
const OverviewMap = (props) => {
|
|
@@ -17,16 +20,30 @@ const OverviewMap = (props) => {
|
|
|
17
20
|
useEffect(() => {
|
|
18
21
|
if (overviewMapControlElem.current && olLayer) {
|
|
19
22
|
const olMap = map.olMap;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const element = overviewMapControlElem.current;
|
|
24
|
+
let overviewMapControl;
|
|
25
|
+
let cancelled = false;
|
|
26
|
+
map.whenDisplayed().then(() => {
|
|
27
|
+
if (cancelled) return;
|
|
28
|
+
overviewMapControl = new OverviewMap$1({
|
|
29
|
+
className: "ol-overviewmap",
|
|
30
|
+
layers: [olLayer],
|
|
31
|
+
collapsible: false,
|
|
32
|
+
collapsed: false,
|
|
33
|
+
target: element
|
|
34
|
+
});
|
|
35
|
+
olMap.addControl(overviewMapControl);
|
|
36
|
+
}).catch((error) => {
|
|
37
|
+
if (!isAbortError(error) && !cancelled) {
|
|
38
|
+
LOG.error("Error displaying overview map control:", error);
|
|
39
|
+
}
|
|
26
40
|
});
|
|
27
|
-
olMap.addControl(overviewMapControl);
|
|
28
41
|
return () => {
|
|
29
|
-
|
|
42
|
+
if (overviewMapControl) {
|
|
43
|
+
olMap.removeControl(overviewMapControl);
|
|
44
|
+
overviewMapControl.dispose();
|
|
45
|
+
}
|
|
46
|
+
cancelled = true;
|
|
30
47
|
};
|
|
31
48
|
}
|
|
32
49
|
}, [map, olLayer]);
|
package/OverviewMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverviewMap.js","sources":["OverviewMap.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { OverviewMap as OlOverviewMap } from \"ol/control\";\nimport OlBaseLayer from \"ol/layer/Base\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useMemo, useRef } from \"react\";\n\n/**\n * These are properties supported by the {@link OverviewMap}.\n */\nexport interface OverviewMapProps extends CommonComponentProps, MapModelProps {\n /**\n * The layer shown in the overview map.\n */\n olLayer: OlBaseLayer;\n\n /**\n * The height of the map.\n * This defaults to a reasonable pixel size.\n */\n height?: BoxProps[\"height\"];\n\n /**\n * The width of the map.\n * This defaults to a reasonable pixel size.\n */\n width?: BoxProps[\"width\"];\n}\n\nconst DEFAULT_HEIGHT = \"200px\";\nconst DEFAULT_WIDTH = \"300px\";\n\n/**\n * The `OverviewMap` component can be used in an app to have a better overview of the current location in the map.\n */\nexport const OverviewMap: FC<OverviewMapProps> = (props) => {\n const { olLayer, height = DEFAULT_HEIGHT, width = DEFAULT_WIDTH } = props;\n const { containerProps } = useCommonComponentProps(\"overview-map\", props);\n const intl = useIntl();\n\n const map = useMapModelValue(props);\n const overviewMapControlElem = useRef(null);\n\n useEffect(() => {\n if (overviewMapControlElem.current && olLayer) {\n const olMap = map.olMap;\n const overviewMapControl: OlOverviewMap = new OlOverviewMap({\n
|
|
1
|
+
{"version":3,"file":"OverviewMap.js","sources":["OverviewMap.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport { isAbortError, createLogger } from \"@open-pioneer/core\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { OverviewMap as OlOverviewMap } from \"ol/control\";\nimport OlBaseLayer from \"ol/layer/Base\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { FC, useEffect, useMemo, useRef } from \"react\";\n\nconst LOG = createLogger(sourceId);\n\n/**\n * These are properties supported by the {@link OverviewMap}.\n */\nexport interface OverviewMapProps extends CommonComponentProps, MapModelProps {\n /**\n * The layer shown in the overview map.\n */\n olLayer: OlBaseLayer;\n\n /**\n * The height of the map.\n * This defaults to a reasonable pixel size.\n */\n height?: BoxProps[\"height\"];\n\n /**\n * The width of the map.\n * This defaults to a reasonable pixel size.\n */\n width?: BoxProps[\"width\"];\n}\n\nconst DEFAULT_HEIGHT = \"200px\";\nconst DEFAULT_WIDTH = \"300px\";\n\n/**\n * The `OverviewMap` component can be used in an app to have a better overview of the current location in the map.\n */\nexport const OverviewMap: FC<OverviewMapProps> = (props) => {\n const { olLayer, height = DEFAULT_HEIGHT, width = DEFAULT_WIDTH } = props;\n const { containerProps } = useCommonComponentProps(\"overview-map\", props);\n const intl = useIntl();\n\n const map = useMapModelValue(props);\n const overviewMapControlElem = useRef(null);\n\n useEffect(() => {\n if (overviewMapControlElem.current && olLayer) {\n const olMap = map.olMap;\n const element = overviewMapControlElem.current;\n\n let overviewMapControl: OlOverviewMap | undefined;\n let cancelled = false;\n map.whenDisplayed()\n .then(() => {\n if (cancelled) return;\n overviewMapControl = new OlOverviewMap({\n className: \"ol-overviewmap\",\n layers: [olLayer],\n collapsible: false,\n collapsed: false,\n target: element\n });\n olMap.addControl(overviewMapControl);\n })\n .catch((error) => {\n if (!isAbortError(error) && !cancelled) {\n LOG.error(\"Error displaying overview map control:\", error);\n }\n });\n\n return () => {\n if (overviewMapControl) {\n olMap.removeControl(overviewMapControl);\n overviewMapControl.dispose();\n }\n cancelled = true;\n };\n }\n }, [map, olLayer]);\n\n const mergedBoxProps = useMemo(\n () =>\n mergeChakraProps<BoxProps>(\n {\n height,\n width,\n role: \"region\",\n \"aria-label\": intl.formatMessage({ id: \"ariaLabel\" }),\n \"aria-description\": intl.formatMessage({ id: \"ariaDescription\" }),\n tabIndex: 0\n },\n containerProps\n ),\n [height, width, intl, containerProps]\n );\n\n return <Box ref={overviewMapControlElem} {...mergedBoxProps} />;\n};\n"],"names":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A,CAAM,0CAA0C,KAAK,CAAA;AAAA,QAC7D;AAAA,MACJ,CAAC,CAAA;AAEL,MAAA,OAAO,MAAM;AACT,QAAA,IAAI,kBAAA,EAAoB;AACpB,UAAA,KAAA,CAAM,cAAc,kBAAkB,CAAA;AACtC,UAAA,kBAAA,CAAmB,OAAA,EAAQ;AAAA,QAC/B;AACA,QAAA,SAAA,GAAY,IAAA;AAAA,MAChB,CAAA;AAAA,IACJ;AAAA,EACJ,CAAA,EAAG,CAAC,GAAA,EAAK,OAAO,CAAC,CAAA;AAEjB,EAAA,MAAM,cAAA,GAAiB,OAAA;AAAA,IACnB,MACI,gBAAA;AAAA,MACI;AAAA,QACI,MAAA;AAAA,QACA,KAAA;AAAA,QACA,IAAA,EAAM,QAAA;AAAA,QACN,cAAc,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,aAAa,CAAA;AAAA,QACpD,oBAAoB,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,mBAAmB,CAAA;AAAA,QAChE,QAAA,EAAU;AAAA,OACd;AAAA,MACA;AAAA,KACJ;AAAA,IACJ,CAAC,MAAA,EAAQ,KAAA,EAAO,IAAA,EAAM,cAAc;AAAA,GACxC;AAEA,EAAA,uBAAO,GAAA,CAAC,GAAA,EAAA,EAAI,GAAA,EAAK,sBAAA,EAAyB,GAAG,cAAA,EAAgB,CAAA;AACjE;;"}
|
package/_virtual/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-info.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/overview-map",
|
|
4
|
-
"version": "1.5.0
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"description": "This package offers a UI component with which an overview map can be integrated.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@chakra-ui/react": "^3.37.0",
|
|
18
|
-
"@open-pioneer/
|
|
19
|
-
"@open-pioneer/
|
|
20
|
-
"@open-pioneer/
|
|
18
|
+
"@open-pioneer/core": "^4.8.0",
|
|
19
|
+
"@open-pioneer/map": "1.5.0",
|
|
20
|
+
"@open-pioneer/react-utils": "^4.8.0",
|
|
21
|
+
"@open-pioneer/runtime": "^4.8.0",
|
|
21
22
|
"ol": "^10.10.0",
|
|
22
|
-
"react": "^19.
|
|
23
|
+
"react": "^19.3.0"
|
|
23
24
|
},
|
|
24
25
|
"publishConfig": {
|
|
25
26
|
"directory": "dist",
|