@dxos/react-ui-geo 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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/data/airports.ts +1 -1
- package/data/cities.ts +1 -1
- package/data/countries-110m.ts +1 -1
- package/data/countries-dots-3.ts +1 -1
- package/data/countries-dots-4.ts +1 -1
- package/dist/lib/browser/chunk-GMWLKTLN.mjs +9 -0
- package/dist/lib/browser/{countries-110m-37VAAFCK.mjs → countries-110m-ZM3ZIEFS.mjs} +1 -1
- package/dist/lib/browser/countries-110m-ZM3ZIEFS.mjs.map +7 -0
- package/dist/lib/browser/data.mjs +1 -1
- package/dist/lib/browser/index.mjs +215 -178
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/{chunk-OPJPAAEK.mjs → chunk-JODBF4CC.mjs} +2 -2
- package/dist/lib/node-esm/{countries-110m-36TTKK5B.mjs → countries-110m-3SFASWVD.mjs} +1 -1
- package/dist/lib/node-esm/countries-110m-3SFASWVD.mjs.map +7 -0
- package/dist/lib/node-esm/data.mjs +1 -1
- package/dist/lib/node-esm/index.mjs +215 -178
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +25 -9
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.d.ts +27 -17
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.stories.d.ts +14 -8
- package/dist/types/src/components/Map/Map.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts +7 -7
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useSpinner.d.ts +1 -1
- package/dist/types/src/hooks/useSpinner.d.ts.map +1 -1
- package/dist/types/src/hooks/useTour.d.ts +4 -3
- package/dist/types/src/hooks/useTour.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +12 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +2 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/path.d.ts +5 -8
- package/dist/types/src/util/path.d.ts.map +1 -1
- package/dist/types/src/util/render.d.ts +4 -4
- package/dist/types/src/util/render.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -19
- package/src/components/Globe/Globe.stories.tsx +82 -34
- package/src/components/Globe/Globe.tsx +79 -62
- package/src/components/Map/Map.stories.tsx +25 -14
- package/src/components/Map/Map.tsx +180 -95
- package/src/components/Toolbar/Controls.tsx +14 -20
- package/src/components/index.ts +0 -2
- package/src/hooks/context.tsx +22 -16
- package/src/hooks/useGlobeZoomHandler.ts +9 -3
- package/src/hooks/useMapZoomHandler.ts +1 -1
- package/src/hooks/useSpinner.ts +2 -1
- package/src/hooks/useTour.ts +10 -8
- package/src/index.ts +2 -1
- package/src/translations.ts +20 -0
- package/src/types.ts +3 -1
- package/src/util/inertia.ts +1 -1
- package/src/util/path.ts +5 -6
- package/src/util/render.ts +5 -3
- package/dist/lib/browser/chunk-CYCBMCOP.mjs +0 -9
- package/dist/lib/browser/countries-110m-37VAAFCK.mjs.map +0 -7
- package/dist/lib/node-esm/countries-110m-36TTKK5B.mjs.map +0 -7
- package/dist/types/src/components/types.d.ts +0 -15
- package/dist/types/src/components/types.d.ts.map +0 -1
- package/src/components/types.ts +0 -19
- /package/dist/lib/browser/{chunk-CYCBMCOP.mjs.map → chunk-GMWLKTLN.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-OPJPAAEK.mjs.map → chunk-JODBF4CC.mjs.map} +0 -0
package/src/util/path.ts
CHANGED
|
@@ -4,22 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import { type GeoGeometryObjects, geoCircle as d3GeoCircle } from 'd3';
|
|
6
6
|
import { type Point, type Polygon, type Position } from 'geojson';
|
|
7
|
+
import { type LatLngLiteral } from 'leaflet';
|
|
7
8
|
|
|
8
9
|
import type { Vector } from '../hooks';
|
|
9
10
|
|
|
10
|
-
export type LatLng = { lat: number; lng: number };
|
|
11
|
-
|
|
12
11
|
export const positionToRotation = ([lng, lat]: [number, number], tilt = 0): Vector => [-lng, tilt - lat, 0];
|
|
13
12
|
|
|
14
|
-
export const geoToPosition = ({ lat, lng }:
|
|
13
|
+
export const geoToPosition = ({ lat, lng }: LatLngLiteral): [number, number] => [lng, lat];
|
|
15
14
|
|
|
16
|
-
export const geoPoint = (point:
|
|
15
|
+
export const geoPoint = (point: LatLngLiteral): Point => ({ type: 'Point', coordinates: geoToPosition(point) });
|
|
17
16
|
|
|
18
17
|
// https://github.com/d3/d3-geo#geoCircle
|
|
19
|
-
export const geoCircle = ({ lat, lng }:
|
|
18
|
+
export const geoCircle = ({ lat, lng }: LatLngLiteral, radius: number): Polygon =>
|
|
20
19
|
d3GeoCircle().radius(radius).center([lng, lat])();
|
|
21
20
|
|
|
22
|
-
export const geoLine = (p1:
|
|
21
|
+
export const geoLine = (p1: LatLngLiteral, p2: LatLngLiteral): GeoGeometryObjects => ({
|
|
23
22
|
type: 'LineString',
|
|
24
23
|
coordinates: [
|
|
25
24
|
[p1.lng, p1.lat],
|
package/src/util/render.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { type GeoPath, type GeoPermissibleObjects, geoGraticule } from 'd3';
|
|
|
6
6
|
import { feature, mesh } from 'topojson-client';
|
|
7
7
|
import { type Topology } from 'topojson-specification';
|
|
8
8
|
|
|
9
|
-
import { type
|
|
9
|
+
import { type LatLngLiteral } from '../types';
|
|
10
|
+
|
|
11
|
+
import { geoLine, geoPoint } from './path';
|
|
10
12
|
|
|
11
13
|
export type Styles = Record<string, any>;
|
|
12
14
|
|
|
@@ -25,8 +27,8 @@ export type Style =
|
|
|
25
27
|
export type StyleSet = Partial<Record<Style, Styles>>;
|
|
26
28
|
|
|
27
29
|
export type Features = {
|
|
28
|
-
points?:
|
|
29
|
-
lines?: { source:
|
|
30
|
+
points?: LatLngLiteral[];
|
|
31
|
+
lines?: { source: LatLngLiteral; target: LatLngLiteral }[];
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
export type Layer = {
|