@open-pioneer/coordinate-search 1.2.0-dev.20260121105545 → 1.2.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 +6 -2
- package/_virtual/source-info.js +4 -0
- package/_virtual/source-info.js.map +1 -0
- package/coordinates.js +3 -2
- package/coordinates.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# @open-pioneer/coordinate-search
|
|
2
2
|
|
|
3
|
-
## 1.2.0
|
|
3
|
+
## 1.2.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- 9c29256: Update to core packages 4.4.0
|
|
7
8
|
- 279ca67: Use `workspace:*` instead of `workspace:^` for local package references as default. This ensures that trails packages from this repository are always referenced with their exact version to avoid potential issues with version mismatches. If a project specifically wants to use other versions for some trails packages, a pnpm override can be used to force other versions.
|
|
8
9
|
- 9580bb4: Update various dependencies.
|
|
9
10
|
- 9580bb4: Update to Chakra 3.31.0
|
|
11
|
+
- Updated dependencies [597584b]
|
|
12
|
+
- Updated dependencies [9c29256]
|
|
10
13
|
- Updated dependencies [279ca67]
|
|
14
|
+
- Updated dependencies [597584b]
|
|
11
15
|
- Updated dependencies [9580bb4]
|
|
12
16
|
- Updated dependencies [9580bb4]
|
|
13
|
-
- @open-pioneer/map@1.2.0
|
|
17
|
+
- @open-pioneer/map@1.2.0
|
|
14
18
|
|
|
15
19
|
## 1.1.0
|
|
16
20
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-info.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/coordinates.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { get, transform } from 'ol/proj.js';
|
|
2
1
|
import { createLogger } from '@open-pioneer/core';
|
|
2
|
+
import { get, transform } from 'ol/proj.js';
|
|
3
|
+
import { sourceId } from './_virtual/source-info.js';
|
|
3
4
|
|
|
4
|
-
const LOG = createLogger(
|
|
5
|
+
const LOG = createLogger(sourceId);
|
|
5
6
|
function parseCoordinates(input, numberParser, projection) {
|
|
6
7
|
if (input == "") return err("empty");
|
|
7
8
|
if (!input.includes(" ")) {
|
package/coordinates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinates.js","sources":["coordinates.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { NumberParserService, PackageIntl } from \"@open-pioneer/runtime\";\nimport { get as getProjection, Projection, transform } from \"ol/proj\";\nimport {
|
|
1
|
+
{"version":3,"file":"coordinates.js","sources":["coordinates.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger } from \"@open-pioneer/core\";\nimport { NumberParserService, PackageIntl } from \"@open-pioneer/runtime\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { get as getProjection, Projection, transform } from \"ol/proj\";\nimport { sourceId } from \"open-pioneer:source-info\";\n\nconst LOG = createLogger(sourceId);\n\nexport interface ParseSuccess {\n kind: \"success\";\n projection: Projection;\n coordinates: [number, number];\n}\n\nexport interface ParseError {\n // Double duty as i18n message at the moment\n kind:\n | \"empty\"\n | \"tooltip.space\"\n | \"tooltip.spaceOne\"\n | \"tooltip.2coords\"\n | \"tooltip.invalidNumbers\"\n | \"tooltip.extent\"\n | \"tooltip.projection\";\n}\n\nexport type ParseResult = ParseSuccess | ParseError;\n\nexport function parseCoordinates(\n input: string,\n numberParser: NumberParserService,\n projection: Projection\n): ParseResult {\n if (input == \"\") return err(\"empty\");\n\n if (!input.includes(\" \")) {\n return err(\"tooltip.space\");\n }\n if (input.indexOf(\" \") != input.lastIndexOf(\" \")) {\n return err(\"tooltip.spaceOne\");\n }\n\n const splitCoords = input.split(\" \");\n if (\n splitCoords[0] == undefined ||\n splitCoords[1] == undefined ||\n splitCoords[0] == \"\" ||\n splitCoords[1] == \"\"\n ) {\n return err(\"tooltip.2coords\");\n }\n\n const coordsString1 = numberParser.parseNumber(splitCoords[0]);\n const coordsString2 = numberParser.parseNumber(splitCoords[1]);\n\n const coords: [number, number] = [coordsString1, coordsString2];\n if (coords.some((number) => Number.isNaN(number))) {\n return err(\"tooltip.invalidNumbers\");\n }\n try {\n if (!checkIfCoordsInProjectionsExtent(projection, coords)) {\n return err(\"tooltip.extent\");\n }\n\n if (\n !checkIfCoordsInProjectionsExtent(\n getProjection(\"EPSG:4326\"),\n transform(coords, projection, \"EPSG:4326\")\n )\n ) {\n return err(\"tooltip.extent\");\n }\n } catch (e) {\n LOG.warn(\"Failed to check if coordinates are in projection extent\", e);\n return err(\"tooltip.projection\");\n }\n\n return {\n kind: \"success\",\n projection,\n coordinates: coords\n };\n}\n\nfunction err(kind: ParseError[\"kind\"]): ParseError {\n return { kind };\n}\n\n/* validate if the coordinates fit to the extent of the selected projection */\nfunction checkIfCoordsInProjectionsExtent(\n projection: Projection | null,\n coords: Coordinate\n): boolean {\n const extent = projection?.getExtent();\n if (!extent || extent.length !== 4) {\n // Some projections don't have an extent, cannot validate.\n return true;\n }\n if (!coords || coords.length !== 2) {\n throw new Error(`Internal error: invalid coordinates ${coords}.`);\n }\n\n return (\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n extent[0]! <= coords[0]! &&\n extent[1]! <= coords[1]! &&\n extent[2]! >= coords[0]! &&\n extent[3]! >= coords[1]!\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n );\n}\n\n/* Formats the coordinates as a string with given precision considering locales */\nexport function formatCoordinates(\n coordinates: number[],\n precision: number,\n intl: PackageIntl\n): string {\n if (coordinates[0] == null || coordinates[1] == null) {\n return \"\";\n }\n\n const [x, y] = coordinates;\n\n const xString = intl.formatNumber(x, {\n maximumFractionDigits: precision,\n minimumFractionDigits: precision\n });\n const yString = intl.formatNumber(y, {\n maximumFractionDigits: precision,\n minimumFractionDigits: precision\n });\n\n return xString + \" \" + yString;\n}\n"],"names":["getProjection"],"mappings":";;;;AAQA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAsB1B,SAAS,gBAAA,CACZ,KAAA,EACA,YAAA,EACA,UAAA,EACW;AACX,EAAA,IAAI,KAAA,IAAS,EAAA,EAAI,OAAO,GAAA,CAAI,OAAO,CAAA;AAEnC,EAAA,IAAI,CAAC,KAAA,CAAM,QAAA,CAAS,GAAG,CAAA,EAAG;AACtB,IAAA,OAAO,IAAI,eAAe,CAAA;AAAA,EAC9B;AACA,EAAA,IAAI,MAAM,OAAA,CAAQ,GAAG,KAAK,KAAA,CAAM,WAAA,CAAY,GAAG,CAAA,EAAG;AAC9C,IAAA,OAAO,IAAI,kBAAkB,CAAA;AAAA,EACjC;AAEA,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AACnC,EAAA,IACI,WAAA,CAAY,CAAC,CAAA,IAAK,MAAA,IAClB,YAAY,CAAC,CAAA,IAAK,MAAA,IAClB,WAAA,CAAY,CAAC,CAAA,IAAK,EAAA,IAClB,WAAA,CAAY,CAAC,KAAK,EAAA,EACpB;AACE,IAAA,OAAO,IAAI,iBAAiB,CAAA;AAAA,EAChC;AAEA,EAAA,MAAM,aAAA,GAAgB,YAAA,CAAa,WAAA,CAAY,WAAA,CAAY,CAAC,CAAC,CAAA;AAC7D,EAAA,MAAM,aAAA,GAAgB,YAAA,CAAa,WAAA,CAAY,WAAA,CAAY,CAAC,CAAC,CAAA;AAE7D,EAAA,MAAM,MAAA,GAA2B,CAAC,aAAA,EAAe,aAAa,CAAA;AAC9D,EAAA,IAAI,MAAA,CAAO,KAAK,CAAC,MAAA,KAAW,OAAO,KAAA,CAAM,MAAM,CAAC,CAAA,EAAG;AAC/C,IAAA,OAAO,IAAI,wBAAwB,CAAA;AAAA,EACvC;AACA,EAAA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AAA;AAG9B;AAGO,SAAS,iBAAA,CACZ,WAAA,EACA,SAAA,EACA,IAAA,EACM;AACN,EAAA,IAAI,YAAY,CAAC,CAAA,IAAK,QAAQ,WAAA,CAAY,CAAC,KAAK,IAAA,EAAM;AAClD,IAAA,OAAO,EAAA;AAAA,EACX;AAEA,EAAA,MAAM,CAAC,CAAA,EAAG,CAAC,CAAA,GAAI,WAAA;AAEf,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,YAAA,CAAa,CAAA,EAAG;AAAA,IACjC,qBAAA,EAAuB,SAAA;AAAA,IACvB,qBAAA,EAAuB;AAAA,GAC1B,CAAA;AACD,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,YAAA,CAAa,CAAA,EAAG;AAAA,IACjC,qBAAA,EAAuB,SAAA;AAAA,IACvB,qBAAA,EAAuB;AAAA,GAC1B,CAAA;AAED,EAAA,OAAO,UAAU,GAAA,GAAM,OAAA;AAC3B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/coordinate-search",
|
|
4
|
-
"version": "1.2.0
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "This package provides a UI component to search for entered coordinates in the choosen projection.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@chakra-ui/react": "^3.31.0",
|
|
18
18
|
"@conterra/reactivity-core": "^0.8.1",
|
|
19
|
-
"@open-pioneer/chakra-snippets": "4.4.0
|
|
20
|
-
"@open-pioneer/core": "4.4.0
|
|
21
|
-
"@open-pioneer/runtime": "4.4.0
|
|
22
|
-
"@open-pioneer/react-utils": "4.4.0
|
|
23
|
-
"@open-pioneer/reactivity": "4.4.0
|
|
19
|
+
"@open-pioneer/chakra-snippets": "^4.4.0",
|
|
20
|
+
"@open-pioneer/core": "^4.4.0",
|
|
21
|
+
"@open-pioneer/runtime": "^4.4.0",
|
|
22
|
+
"@open-pioneer/react-utils": "^4.4.0",
|
|
23
|
+
"@open-pioneer/reactivity": "^4.4.0",
|
|
24
24
|
"ol": "^10.7.0",
|
|
25
25
|
"react": "^19.2.3",
|
|
26
26
|
"react-icons": "^5.5.0",
|
|
27
|
-
"@open-pioneer/map": "1.2.0
|
|
27
|
+
"@open-pioneer/map": "1.2.0"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
"./package.json": "./package.json",
|