@trackunit/react-map 0.2.138 → 0.2.141
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 +7 -3
- package/index.esm.js +8 -4
- package/package.json +10 -10
- package/src/layers/useShapes/useShapes.d.ts +4 -2
package/index.cjs.js
CHANGED
|
@@ -6796,8 +6796,10 @@ const extractPositions = (features) => {
|
|
|
6796
6796
|
/**
|
|
6797
6797
|
* `useShapes` -- creates a shape layer handle from a GeoJSON FeatureCollection.
|
|
6798
6798
|
*
|
|
6799
|
-
* Input is
|
|
6800
|
-
*
|
|
6799
|
+
* Input is GeoJSON. Polygons that cross the antimeridian as a single
|
|
6800
|
+
* seam-jumping ring (the form site APIs return) are split into RFC 7946
|
|
6801
|
+
* MultiPolygon halves so fill tiling and hit-testing clip per hemisphere.
|
|
6802
|
+
* Adapters merge those halves back into one outline at render time.
|
|
6801
6803
|
*
|
|
6802
6804
|
* @example
|
|
6803
6805
|
* ```tsx
|
|
@@ -6819,7 +6821,9 @@ const useShapes = (options) => {
|
|
|
6819
6821
|
// objects do NOT trigger handle re-creation (same pattern as stableStyle).
|
|
6820
6822
|
const validatedFeatures = react.useMemo(() => {
|
|
6821
6823
|
const validated = geoJsonUtils.validateFeatureCollection(rawFeatures, "[useShapes]");
|
|
6822
|
-
|
|
6824
|
+
if (validated === null)
|
|
6825
|
+
return geoJsonUtils.EMPTY_FEATURE_COLLECTION;
|
|
6826
|
+
return geoJsonUtils.splitAntimeridianCrossingFeatures(validated);
|
|
6823
6827
|
}, [rawFeatures]);
|
|
6824
6828
|
const [features, setFeatures] = react.useState(validatedFeatures);
|
|
6825
6829
|
if (validatedFeatures !== features && !esToolkit.isEqual(validatedFeatures, features)) {
|
package/index.esm.js
CHANGED
|
@@ -14,7 +14,7 @@ import { Checkbox, ToggleSwitch, RadioGroup as RadioGroup$1, RadioItem, FormGrou
|
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { PieChart } from 'react-minimal-pie-chart';
|
|
16
16
|
import { tailwindPalette } from '@trackunit/ui-design-tokens';
|
|
17
|
-
import { lngLatToMercatorPxWS, validateBboxWithFallback, extractPositionsFromGeometry, geoJsonPositionSchema, validateFeatureCollection, EMPTY_FEATURE_COLLECTION, validateBbox, projectPolygonalToWebMercator, geoJsonPolygonDifference, unprojectPolygonalFromWebMercator, geoJsonPolygonSchema, geoJsonMultiPolygonSchema, distanceToGeoJsonPolygonBoundary, getGeoJsonPolygonIntersection, isFullyContainedInGeometry, isGeoJsonPointInPolygon, isBboxInsideFeatureCollection, extractEdges, computeGeometryCentroid, mercatorPxToLngLatWS, isPositionInsideRing, lngLatToWebMercatorPx, edgePixelLength, isFullyContainedInGeoJsonGeometry } from '@trackunit/geo-json-utils';
|
|
17
|
+
import { lngLatToMercatorPxWS, validateBboxWithFallback, extractPositionsFromGeometry, geoJsonPositionSchema, validateFeatureCollection, EMPTY_FEATURE_COLLECTION, splitAntimeridianCrossingFeatures, validateBbox, projectPolygonalToWebMercator, geoJsonPolygonDifference, unprojectPolygonalFromWebMercator, geoJsonPolygonSchema, geoJsonMultiPolygonSchema, distanceToGeoJsonPolygonBoundary, getGeoJsonPolygonIntersection, isFullyContainedInGeometry, isGeoJsonPointInPolygon, isBboxInsideFeatureCollection, extractEdges, computeGeometryCentroid, mercatorPxToLngLatWS, isPositionInsideRing, lngLatToWebMercatorPx, edgePixelLength, isFullyContainedInGeoJsonGeometry } from '@trackunit/geo-json-utils';
|
|
18
18
|
import { darkenColor, lightenColor } from '@trackunit/react-map-color-utils';
|
|
19
19
|
|
|
20
20
|
var defaultTranslations = {
|
|
@@ -6795,8 +6795,10 @@ const extractPositions = (features) => {
|
|
|
6795
6795
|
/**
|
|
6796
6796
|
* `useShapes` -- creates a shape layer handle from a GeoJSON FeatureCollection.
|
|
6797
6797
|
*
|
|
6798
|
-
* Input is
|
|
6799
|
-
*
|
|
6798
|
+
* Input is GeoJSON. Polygons that cross the antimeridian as a single
|
|
6799
|
+
* seam-jumping ring (the form site APIs return) are split into RFC 7946
|
|
6800
|
+
* MultiPolygon halves so fill tiling and hit-testing clip per hemisphere.
|
|
6801
|
+
* Adapters merge those halves back into one outline at render time.
|
|
6800
6802
|
*
|
|
6801
6803
|
* @example
|
|
6802
6804
|
* ```tsx
|
|
@@ -6818,7 +6820,9 @@ const useShapes = (options) => {
|
|
|
6818
6820
|
// objects do NOT trigger handle re-creation (same pattern as stableStyle).
|
|
6819
6821
|
const validatedFeatures = useMemo(() => {
|
|
6820
6822
|
const validated = validateFeatureCollection(rawFeatures, "[useShapes]");
|
|
6821
|
-
|
|
6823
|
+
if (validated === null)
|
|
6824
|
+
return EMPTY_FEATURE_COLLECTION;
|
|
6825
|
+
return splitAntimeridianCrossingFeatures(validated);
|
|
6822
6826
|
}, [rawFeatures]);
|
|
6823
6827
|
const [features, setFeatures] = useState(validatedFeatures);
|
|
6824
6828
|
if (validatedFeatures !== features && !isEqual(validatedFeatures, features)) {
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-map",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.141",
|
|
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-components": "2.13.
|
|
11
|
-
"@trackunit/css-class-variance-utilities": "2.0.
|
|
12
|
-
"@trackunit/react-form-components": "2.6.
|
|
13
|
-
"@trackunit/react-core-hooks": "1.21.
|
|
14
|
-
"@trackunit/geo-json-utils": "1.15.
|
|
15
|
-
"@trackunit/i18n-library-translation": "2.4.
|
|
10
|
+
"@trackunit/react-components": "2.13.14",
|
|
11
|
+
"@trackunit/css-class-variance-utilities": "2.0.10",
|
|
12
|
+
"@trackunit/react-form-components": "2.6.62",
|
|
13
|
+
"@trackunit/react-core-hooks": "1.21.54",
|
|
14
|
+
"@trackunit/geo-json-utils": "1.15.42",
|
|
15
|
+
"@trackunit/i18n-library-translation": "2.4.54",
|
|
16
16
|
"react-minimal-pie-chart": "^8.4.0",
|
|
17
|
-
"@trackunit/react-map-adapter-shared": "0.0.
|
|
18
|
-
"@trackunit/react-map-color-utils": "0.0.
|
|
19
|
-
"@trackunit/ui-design-tokens": "1.15.
|
|
17
|
+
"@trackunit/react-map-adapter-shared": "0.0.124",
|
|
18
|
+
"@trackunit/react-map-color-utils": "0.0.103",
|
|
19
|
+
"@trackunit/ui-design-tokens": "1.15.29",
|
|
20
20
|
"@floating-ui/react": "^0.26.25",
|
|
21
21
|
"es-toolkit": "^1.39.10",
|
|
22
22
|
"tailwind-merge": "^2.0.0",
|
|
@@ -54,8 +54,10 @@ export type UseShapesReturn = ShapeLayerHandle;
|
|
|
54
54
|
/**
|
|
55
55
|
* `useShapes` -- creates a shape layer handle from a GeoJSON FeatureCollection.
|
|
56
56
|
*
|
|
57
|
-
* Input is
|
|
58
|
-
*
|
|
57
|
+
* Input is GeoJSON. Polygons that cross the antimeridian as a single
|
|
58
|
+
* seam-jumping ring (the form site APIs return) are split into RFC 7946
|
|
59
|
+
* MultiPolygon halves so fill tiling and hit-testing clip per hemisphere.
|
|
60
|
+
* Adapters merge those halves back into one outline at render time.
|
|
59
61
|
*
|
|
60
62
|
* @example
|
|
61
63
|
* ```tsx
|