@open-pioneer/map 1.4.0-dev.20260529073212 → 1.4.0-dev.20260625074633
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
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# @open-pioneer/map
|
|
2
2
|
|
|
3
|
-
## 1.4.0-dev.
|
|
3
|
+
## 1.4.0-dev.20260625074633
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- c30396d: Update Chakra to 3.36.0
|
|
7
8
|
- c9b3ced: Provide reactive rotation in MapModel
|
|
8
9
|
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- b58a50f: Use new `shallowEqual` function to compare attribution arrays.
|
|
13
|
+
|
|
9
14
|
## 1.3.0
|
|
10
15
|
|
|
11
16
|
### Minor Changes
|
package/model/MapAttributions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { reactive, computed, effect } from '@conterra/reactivity-core';
|
|
2
|
-
import { destroyResources } from '@open-pioneer/core';
|
|
2
|
+
import { shallowEqual, destroyResources } from '@open-pioneer/core';
|
|
3
3
|
import Attribution from 'ol/control/Attribution.js';
|
|
4
4
|
import { sanitizeHtml } from '../utils/sanitize.js';
|
|
5
5
|
|
|
@@ -81,9 +81,6 @@ function createDummyTargetNode() {
|
|
|
81
81
|
node.className = "map-attribution-dummy-target";
|
|
82
82
|
return node;
|
|
83
83
|
}
|
|
84
|
-
function shallowEqual(a, b) {
|
|
85
|
-
return a.length === b.length && a.every((v, i) => v == b[i]);
|
|
86
|
-
}
|
|
87
84
|
|
|
88
85
|
export { MapAttributions };
|
|
89
86
|
//# sourceMappingURL=MapAttributions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapAttributions.js","sources":["MapAttributions.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, effect, reactive, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { destroyResources, Resource } from \"@open-pioneer/core\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport OlMap, { FrameState } from \"ol/Map\";\nimport Attribution from \"ol/control/Attribution\";\nimport { sanitizeHtml } from \"../utils/sanitize\";\nimport { AttributionItem } from \"./MapModel\";\n\nexport class MapAttributions {\n #olMap: OlMap;\n #intl: ReadonlyReactive<PackageIntl>;\n\n /**\n * When default rendering of attributions is active, we simply display this control on the map (otherwise: hidden).\n *\n * The control is always active (even if invisible) because we re-use its rendering code to extract the attribution items.\n * There is no real API to extract the attributions from OpenLayers, and we don't want to re-implement that logic right now.\n * We will see if that approach remains stable.\n */\n #control: Attribution;\n\n #attributionStrings = reactive<string[]>([], { equal: shallowEqual });\n\n // Attribution strings wrapped in objects, for forward compat.\n #attributionItems = computed<AttributionItem[]>(() =>\n this.#attributionStrings.value.map((attribution) => ({\n text: attribution\n }))\n );\n\n #resources: Resource[] = [];\n\n constructor(options: {\n olMap: OlMap;\n /** false: not rendered */\n showControl: boolean;\n intl: ReadonlyReactive<PackageIntl>;\n }) {\n this.#olMap = options.olMap;\n this.#intl = options.intl;\n\n const control = (this.#control = new Attribution({\n collapsible: false,\n target: options.showControl ? undefined : createDummyTargetNode()\n }));\n interceptAttributions(\n control,\n // Called by the attributions widgets as a side effect.\n // NOTE: this is currently called very often (~ every map render).\n (attributions) => {\n this.#attributionStrings.value = attributions;\n }\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const element = (control as any).element as HTMLElement | undefined;\n if (element) {\n element.role = \"region\";\n this.#resources.push(\n effect(() => {\n element.ariaLabel = this.#intl.value.formatMessage({ id: \"attribution.label\" });\n })\n );\n }\n\n this.#olMap.addControl(control);\n }\n\n destroy() {\n this.#olMap.removeControl(this.#control);\n destroyResources(this.#resources);\n this.#control.dispose();\n }\n\n get attributionItems(): AttributionItem[] {\n return this.#attributionItems.value;\n }\n}\n\n// Overrides the OpenLayers widget to sanitize HTML attributions and to intercept the computed array of strings.\n// Note that this depends on OpenLayers internals that may change between versions.\nfunction interceptAttributions(attr: Attribution, onUpdate: (attributions: string[]) => void) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-function-type\n const originalCollectSourceAttributions = (attr as any).collectSourceAttributions_ as Function;\n if (!originalCollectSourceAttributions) {\n throw new Error(\"Internal error: failed to override attributions widget\");\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (attr as any).collectSourceAttributions_ = (frameState: FrameState) => {\n const rawAttributions = originalCollectSourceAttributions.call(\n attr,\n frameState\n ) as string[];\n if (!Array.isArray(rawAttributions)) {\n throw new Error(\"Internal error: unexpected attributions result (should be an array)\");\n }\n const sanitizedAttributions = rawAttributions.map((a) => sanitizeHtml(a));\n onUpdate(sanitizedAttributions);\n return sanitizedAttributions;\n };\n}\n\nfunction createDummyTargetNode() {\n const node = document.createElement(\"div\");\n node.style.display = \"none\";\n node.className = \"map-attribution-dummy-target\";\n return node;\n}\n
|
|
1
|
+
{"version":3,"file":"MapAttributions.js","sources":["MapAttributions.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, effect, reactive, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { destroyResources, Resource, shallowEqual } from \"@open-pioneer/core\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport OlMap, { FrameState } from \"ol/Map\";\nimport Attribution from \"ol/control/Attribution\";\nimport { sanitizeHtml } from \"../utils/sanitize\";\nimport { AttributionItem } from \"./MapModel\";\n\nexport class MapAttributions {\n #olMap: OlMap;\n #intl: ReadonlyReactive<PackageIntl>;\n\n /**\n * When default rendering of attributions is active, we simply display this control on the map (otherwise: hidden).\n *\n * The control is always active (even if invisible) because we re-use its rendering code to extract the attribution items.\n * There is no real API to extract the attributions from OpenLayers, and we don't want to re-implement that logic right now.\n * We will see if that approach remains stable.\n */\n #control: Attribution;\n\n #attributionStrings = reactive<string[]>([], { equal: shallowEqual });\n\n // Attribution strings wrapped in objects, for forward compat.\n #attributionItems = computed<AttributionItem[]>(() =>\n this.#attributionStrings.value.map((attribution) => ({\n text: attribution\n }))\n );\n\n #resources: Resource[] = [];\n\n constructor(options: {\n olMap: OlMap;\n /** false: not rendered */\n showControl: boolean;\n intl: ReadonlyReactive<PackageIntl>;\n }) {\n this.#olMap = options.olMap;\n this.#intl = options.intl;\n\n const control = (this.#control = new Attribution({\n collapsible: false,\n target: options.showControl ? undefined : createDummyTargetNode()\n }));\n interceptAttributions(\n control,\n // Called by the attributions widgets as a side effect.\n // NOTE: this is currently called very often (~ every map render).\n (attributions) => {\n this.#attributionStrings.value = attributions;\n }\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const element = (control as any).element as HTMLElement | undefined;\n if (element) {\n element.role = \"region\";\n this.#resources.push(\n effect(() => {\n element.ariaLabel = this.#intl.value.formatMessage({ id: \"attribution.label\" });\n })\n );\n }\n\n this.#olMap.addControl(control);\n }\n\n destroy() {\n this.#olMap.removeControl(this.#control);\n destroyResources(this.#resources);\n this.#control.dispose();\n }\n\n get attributionItems(): AttributionItem[] {\n return this.#attributionItems.value;\n }\n}\n\n// Overrides the OpenLayers widget to sanitize HTML attributions and to intercept the computed array of strings.\n// Note that this depends on OpenLayers internals that may change between versions.\nfunction interceptAttributions(attr: Attribution, onUpdate: (attributions: string[]) => void) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-function-type\n const originalCollectSourceAttributions = (attr as any).collectSourceAttributions_ as Function;\n if (!originalCollectSourceAttributions) {\n throw new Error(\"Internal error: failed to override attributions widget\");\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (attr as any).collectSourceAttributions_ = (frameState: FrameState) => {\n const rawAttributions = originalCollectSourceAttributions.call(\n attr,\n frameState\n ) as string[];\n if (!Array.isArray(rawAttributions)) {\n throw new Error(\"Internal error: unexpected attributions result (should be an array)\");\n }\n const sanitizedAttributions = rawAttributions.map((a) => sanitizeHtml(a));\n onUpdate(sanitizedAttributions);\n return sanitizedAttributions;\n };\n}\n\nfunction createDummyTargetNode() {\n const node = document.createElement(\"div\");\n node.style.display = \"none\";\n node.className = \"map-attribution-dummy-target\";\n return node;\n}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,eAAA,CAAgB;AAAA,EACzB,MAAA;AAAA,EACA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,QAAA;AAAA,EAEA,sBAAsB,QAAA,CAAmB,IAAI,EAAE,KAAA,EAAO,cAAc,CAAA;AAAA;AAAA,EAGpE,iBAAA,GAAoB,QAAA;AAAA,IAA4B,MAC5C,IAAA,CAAK,mBAAA,CAAoB,KAAA,CAAM,GAAA,CAAI,CAAC,WAAA,MAAiB;AAAA,MACjD,IAAA,EAAM;AAAA,KACV,CAAE;AAAA,GACN;AAAA,EAEA,aAAyB,EAAC;AAAA,EAE1B,YAAY,OAAA,EAKT;AACC,IAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,KAAA;AACtB,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,IAAA;AAErB,IAAA,MAAM,OAAA,GAAW,IAAA,CAAK,QAAA,GAAW,IAAI,WAAA,CAAY;AAAA,MAC7C,WAAA,EAAa,KAAA;AAAA,MACb,MAAA,EAAQ,OAAA,CAAQ,WAAA,GAAc,MAAA,GAAY,qBAAA;AAAsB,KACnE,CAAA;AACD,IAAA,qBAAA;AAAA,MACI,OAAA;AAAA;AAAA;AAAA,MAGA,CAAC,YAAA,KAAiB;AACd,QAAA,IAAA,CAAK,oBAAoB,KAAA,GAAQ,YAAA;AAAA,MACrC;AAAA,KACJ;AAGA,IAAA,MAAM,UAAW,OAAA,CAAgB,OAAA;AACjC,IAAA,IAAI,OAAA,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qBAAA;AAAA,EACX,CAAA;AACJ;AAEA,SAAS,qBAAA,GAAwB;AAC7B,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AACzC,EAAA,IAAA,CAAK,MAAM,OAAA,GAAU,MAAA;AACrB,EAAA,IAAA,CAAK,SAAA,GAAY,8BAAA;AACjB,EAAA,OAAO,IAAA;AACX;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/map",
|
|
4
|
-
"version": "1.4.0-dev.
|
|
4
|
+
"version": "1.4.0-dev.20260625074633",
|
|
5
5
|
"description": "This package integrates OpenLayers maps into an open pioneer trails application.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"directory": "src/packages/map"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@chakra-ui/react": "^3.
|
|
18
|
-
"@conterra/reactivity-core": "^0.8.
|
|
19
|
-
"@conterra/reactivity-events": "^0.8.
|
|
17
|
+
"@chakra-ui/react": "^3.36.0",
|
|
18
|
+
"@conterra/reactivity-core": "^0.8.6",
|
|
19
|
+
"@conterra/reactivity-events": "^0.8.6",
|
|
20
20
|
"@esri/arcgis-html-sanitizer": "^4.1.0",
|
|
21
|
-
"@open-pioneer/core": "
|
|
22
|
-
"@open-pioneer/http": "
|
|
23
|
-
"@open-pioneer/react-utils": "
|
|
24
|
-
"@open-pioneer/reactivity": "
|
|
25
|
-
"@open-pioneer/runtime": "
|
|
21
|
+
"@open-pioneer/core": "4.7.0-dev.20260624141040",
|
|
22
|
+
"@open-pioneer/http": "4.7.0-dev.20260624141040",
|
|
23
|
+
"@open-pioneer/react-utils": "4.7.0-dev.20260624141040",
|
|
24
|
+
"@open-pioneer/reactivity": "4.7.0-dev.20260624141040",
|
|
25
|
+
"@open-pioneer/runtime": "4.7.0-dev.20260624141040",
|
|
26
26
|
"ol": "^10.9.0",
|
|
27
|
-
"proj4": "^2.20.
|
|
28
|
-
"react-dom": "^19.2.
|
|
29
|
-
"react-use": "^17.6.
|
|
30
|
-
"react": "^19.2.
|
|
27
|
+
"proj4": "^2.20.9",
|
|
28
|
+
"react-dom": "^19.2.7",
|
|
29
|
+
"react-use": "^17.6.1",
|
|
30
|
+
"react": "^19.2.7",
|
|
31
31
|
"uuid": "^14.0.0"
|
|
32
32
|
},
|
|
33
33
|
"exports": {
|
|
@@ -19,7 +19,7 @@ import { MapModelProps } from "./hooks/useMapModel";
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function DefaultMapProvider(props: Required<MapModelProps> & {
|
|
21
21
|
children?: React.ReactNode;
|
|
22
|
-
}): import("react
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
23
|
/**
|
|
24
24
|
* Accesses the default map props provided by {@link DefaultMapProvider} (or returns undefined).
|
|
25
25
|
*
|
package/ui/MapContainer.d.ts
CHANGED
|
@@ -73,4 +73,4 @@ export interface MapContainerProps extends CommonComponentProps, MapModelProps {
|
|
|
73
73
|
*
|
|
74
74
|
* @group UI Components and Hooks
|
|
75
75
|
*/
|
|
76
|
-
export declare function MapContainer(props: MapContainerProps): import("react
|
|
76
|
+
export declare function MapContainer(props: MapContainerProps): import("react").JSX.Element;
|
package/ui/OverlaysRenderer.d.ts
CHANGED