@trackunit/react-map-adapter-shared 0.0.102 → 0.0.103-alpha-59d0c758b8f.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/index.cjs.js +8 -2
- package/index.esm.js +9 -3
- package/package.json +4 -4
- package/src/restrictBounds.d.ts +1 -1
- package/src/types.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -1682,7 +1682,7 @@ const mapStateEquals = (a, b) => cameraStateEquals(a, b) && statusEquals(a, b);
|
|
|
1682
1682
|
/**
|
|
1683
1683
|
* Resolve effective restrict bounds from config.
|
|
1684
1684
|
* Returns null if no restriction; GeoJsonBbox otherwise.
|
|
1685
|
-
* Validates custom bbox with
|
|
1685
|
+
* Validates custom bbox with geoJsonBboxSchema; on failure, console.warn and fallback to null.
|
|
1686
1686
|
*
|
|
1687
1687
|
* @note - Why fallback to null and not WORLD_BBOX?
|
|
1688
1688
|
* Different map providers handle full world bounds differently.
|
|
@@ -1692,7 +1692,13 @@ const mapStateEquals = (a, b) => cameraStateEquals(a, b) && statusEquals(a, b);
|
|
|
1692
1692
|
function getEffectiveRestrictBounds(configValue) {
|
|
1693
1693
|
if (configValue === null || configValue === undefined)
|
|
1694
1694
|
return null;
|
|
1695
|
-
|
|
1695
|
+
const result = geoJsonUtils.geoJsonBboxSchema.safeParse(configValue);
|
|
1696
|
+
if (!result.success) {
|
|
1697
|
+
// eslint-disable-next-line no-console -- Intentional: warn devs when invalid restrictBounds bbox is passed; fallback to null
|
|
1698
|
+
console.warn("[restrictBounds]", result.error.message);
|
|
1699
|
+
return null;
|
|
1700
|
+
}
|
|
1701
|
+
return result.data;
|
|
1696
1702
|
}
|
|
1697
1703
|
|
|
1698
1704
|
/**
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validatePosition, validateBbox } from '@trackunit/geo-json-utils';
|
|
1
|
+
import { validatePosition, validateBbox, geoJsonBboxSchema } from '@trackunit/geo-json-utils';
|
|
2
2
|
import { color } from '@trackunit/ui-design-tokens';
|
|
3
3
|
import { isEqual } from 'es-toolkit';
|
|
4
4
|
import { z } from 'zod';
|
|
@@ -1680,7 +1680,7 @@ const mapStateEquals = (a, b) => cameraStateEquals(a, b) && statusEquals(a, b);
|
|
|
1680
1680
|
/**
|
|
1681
1681
|
* Resolve effective restrict bounds from config.
|
|
1682
1682
|
* Returns null if no restriction; GeoJsonBbox otherwise.
|
|
1683
|
-
* Validates custom bbox with
|
|
1683
|
+
* Validates custom bbox with geoJsonBboxSchema; on failure, console.warn and fallback to null.
|
|
1684
1684
|
*
|
|
1685
1685
|
* @note - Why fallback to null and not WORLD_BBOX?
|
|
1686
1686
|
* Different map providers handle full world bounds differently.
|
|
@@ -1690,7 +1690,13 @@ const mapStateEquals = (a, b) => cameraStateEquals(a, b) && statusEquals(a, b);
|
|
|
1690
1690
|
function getEffectiveRestrictBounds(configValue) {
|
|
1691
1691
|
if (configValue === null || configValue === undefined)
|
|
1692
1692
|
return null;
|
|
1693
|
-
|
|
1693
|
+
const result = geoJsonBboxSchema.safeParse(configValue);
|
|
1694
|
+
if (!result.success) {
|
|
1695
|
+
// eslint-disable-next-line no-console -- Intentional: warn devs when invalid restrictBounds bbox is passed; fallback to null
|
|
1696
|
+
console.warn("[restrictBounds]", result.error.message);
|
|
1697
|
+
return null;
|
|
1698
|
+
}
|
|
1699
|
+
return result.data;
|
|
1694
1700
|
}
|
|
1695
1701
|
|
|
1696
1702
|
/**
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-map-adapter-shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103-alpha-59d0c758b8f.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/react-map-color-utils": "0.0.
|
|
11
|
-
"@trackunit/geo-json-utils": "1.15.
|
|
12
|
-
"@trackunit/ui-design-tokens": "1.15.
|
|
10
|
+
"@trackunit/react-map-color-utils": "0.0.83-alpha-59d0c758b8f.0",
|
|
11
|
+
"@trackunit/geo-json-utils": "1.15.22-alpha-59d0c758b8f.0",
|
|
12
|
+
"@trackunit/ui-design-tokens": "1.15.10-alpha-59d0c758b8f.0",
|
|
13
13
|
"es-toolkit": "^1.39.10",
|
|
14
14
|
"zod": "^3.25.76"
|
|
15
15
|
},
|
package/src/restrictBounds.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type GeoJsonBbox } from "@trackunit/geo-json-utils";
|
|
|
2
2
|
/**
|
|
3
3
|
* Resolve effective restrict bounds from config.
|
|
4
4
|
* Returns null if no restriction; GeoJsonBbox otherwise.
|
|
5
|
-
* Validates custom bbox with
|
|
5
|
+
* Validates custom bbox with geoJsonBboxSchema; on failure, console.warn and fallback to null.
|
|
6
6
|
*
|
|
7
7
|
* @note - Why fallback to null and not WORLD_BBOX?
|
|
8
8
|
* Different map providers handle full world bounds differently.
|
package/src/types.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type BaseAdapterConfig = Readonly<{
|
|
|
39
39
|
* - `undefined` (default): no restriction (infinite horizontal scroll)
|
|
40
40
|
* - `null`: no restriction (infinite horizontal scroll)
|
|
41
41
|
* - `GeoJsonBbox`: restrict to custom region (e.g. Europe only)
|
|
42
|
-
* Invalid bboxes are validated with
|
|
42
|
+
* Invalid bboxes are validated with geoJsonBboxSchema; on failure, console.warn is emitted
|
|
43
43
|
* and null (no restriction) is used as fallback.
|
|
44
44
|
*/
|
|
45
45
|
restrictBounds?: GeoJsonBbox | null;
|