@dxos/react-ui-geo 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44
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/dist/lib/browser/index.mjs +331 -422
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +331 -422
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Map/Map.d.ts +1 -1
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts +1 -1
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -23
- package/src/components/Globe/Globe.stories.tsx +1 -1
- package/src/components/Globe/Globe.tsx +8 -8
- package/src/components/Map/Map.stories.tsx +1 -1
- package/src/components/Map/Map.tsx +6 -4
- package/src/hooks/context.tsx +8 -8
- package/src/translations.ts +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-geo",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.ef1bc66f44",
|
|
4
4
|
"description": "Geo components.",
|
|
5
5
|
"homepage": "https://github.com/dxos",
|
|
6
6
|
"bugs": "https://github.com/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
@@ -36,8 +40,7 @@
|
|
|
36
40
|
"src"
|
|
37
41
|
],
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@radix-ui/react-context": "^1.1.1",
|
|
43
|
+
"@radix-ui/react-context": "1.1.1",
|
|
41
44
|
"d3": "^7.9.0",
|
|
42
45
|
"d3-geo-projection": "^4.0.0",
|
|
43
46
|
"d3-hexbin": "^0.2.2",
|
|
@@ -49,39 +52,39 @@
|
|
|
49
52
|
"topojson-client": "^3.1.0",
|
|
50
53
|
"topojson-simplify": "^3.0.3",
|
|
51
54
|
"versor": "^0.2.0",
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/node-std": "0.8.4-main.
|
|
55
|
-
"@dxos/util": "0.8.4-main.
|
|
56
|
-
"@dxos/log": "0.8.4-main.
|
|
55
|
+
"@dxos/async": "0.8.4-main.ef1bc66f44",
|
|
56
|
+
"@dxos/debug": "0.8.4-main.ef1bc66f44",
|
|
57
|
+
"@dxos/node-std": "0.8.4-main.ef1bc66f44",
|
|
58
|
+
"@dxos/util": "0.8.4-main.ef1bc66f44",
|
|
59
|
+
"@dxos/log": "0.8.4-main.ef1bc66f44"
|
|
57
60
|
},
|
|
58
61
|
"devDependencies": {
|
|
59
|
-
"@react-three/drei": "^
|
|
60
|
-
"@react-three/fiber": "^9.
|
|
62
|
+
"@react-three/drei": "^10.7.7",
|
|
63
|
+
"@react-three/fiber": "^9.5.0",
|
|
61
64
|
"@types/d3": "^7.4.3",
|
|
62
65
|
"@types/geojson": "^7946.0.14",
|
|
63
66
|
"@types/leaflet": "^1.9.16",
|
|
64
|
-
"@types/react": "~19.2.
|
|
65
|
-
"@types/react-dom": "~19.2.
|
|
67
|
+
"@types/react": "~19.2.7",
|
|
68
|
+
"@types/react-dom": "~19.2.3",
|
|
66
69
|
"@types/three": "0.165.0",
|
|
67
70
|
"@types/topojson-client": "^3.1.4",
|
|
68
71
|
"@types/topojson-simplify": "^3.0.3",
|
|
69
72
|
"@types/topojson-specification": "^1.0.5",
|
|
70
73
|
"JSONStream": "^1.3.5",
|
|
71
74
|
"geojson2h3": "^1.2.0",
|
|
72
|
-
"leva": "^0.
|
|
73
|
-
"react": "~19.2.
|
|
74
|
-
"react-dom": "~19.2.
|
|
75
|
-
"three": "0.
|
|
76
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
77
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
78
|
-
"@dxos/
|
|
75
|
+
"leva": "^0.10.1",
|
|
76
|
+
"react": "~19.2.3",
|
|
77
|
+
"react-dom": "~19.2.3",
|
|
78
|
+
"three": "^0.178.0",
|
|
79
|
+
"@dxos/react-ui": "0.8.4-main.ef1bc66f44",
|
|
80
|
+
"@dxos/storybook-utils": "0.8.4-main.ef1bc66f44",
|
|
81
|
+
"@dxos/ui-theme": "0.8.4-main.ef1bc66f44"
|
|
79
82
|
},
|
|
80
83
|
"peerDependencies": {
|
|
81
|
-
"react": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/
|
|
84
|
+
"react": "~19.2.3",
|
|
85
|
+
"react-dom": "~19.2.3",
|
|
86
|
+
"@dxos/react-ui": "0.8.4-main.ef1bc66f44",
|
|
87
|
+
"@dxos/ui-theme": "0.8.4-main.ef1bc66f44"
|
|
85
88
|
},
|
|
86
89
|
"publishConfig": {
|
|
87
90
|
"access": "public"
|
|
@@ -27,7 +27,7 @@ import { useResizeDetector } from 'react-resize-detector';
|
|
|
27
27
|
import { type Topology } from 'topojson-specification';
|
|
28
28
|
|
|
29
29
|
import { type ThemeMode, type ThemedClassName, useDynamicRef, useThemeContext } from '@dxos/react-ui';
|
|
30
|
-
import { mx } from '@dxos/
|
|
30
|
+
import { mx } from '@dxos/ui-theme';
|
|
31
31
|
|
|
32
32
|
import {
|
|
33
33
|
GlobeContextProvider,
|
|
@@ -157,16 +157,16 @@ type GlobeCanvasProps = {
|
|
|
157
157
|
*/
|
|
158
158
|
// TODO(burdon): Move controller to root.
|
|
159
159
|
const GlobeCanvas = forwardRef<GlobeController, GlobeCanvasProps>(
|
|
160
|
-
({ projection:
|
|
160
|
+
({ projection: projectionProp, topology, features, styles: stylesProp }, forwardRef) => {
|
|
161
161
|
const { themeMode } = useThemeContext();
|
|
162
|
-
const styles = useMemo(() =>
|
|
162
|
+
const styles = useMemo(() => stylesProp ?? defaultStyles[themeMode], [stylesProp, themeMode]);
|
|
163
163
|
|
|
164
164
|
// Canvas.
|
|
165
165
|
const [canvas, setCanvas] = useState<HTMLCanvasElement>(null);
|
|
166
166
|
const canvasRef = (canvas: HTMLCanvasElement) => setCanvas(canvas);
|
|
167
167
|
|
|
168
168
|
// Projection.
|
|
169
|
-
const projection = useMemo(() => getProjection(
|
|
169
|
+
const projection = useMemo(() => getProjection(projectionProp), [projectionProp]);
|
|
170
170
|
|
|
171
171
|
// Layers.
|
|
172
172
|
// TODO(burdon): Generate on the fly based on what is visible.
|
|
@@ -200,9 +200,9 @@ const GlobeCanvas = forwardRef<GlobeController, GlobeCanvasProps>(
|
|
|
200
200
|
translation,
|
|
201
201
|
rotation,
|
|
202
202
|
setCenter,
|
|
203
|
-
setZoom: (
|
|
204
|
-
if (typeof
|
|
205
|
-
const is = interpolateNumber(zoomRef.current,
|
|
203
|
+
setZoom: (state) => {
|
|
204
|
+
if (typeof state === 'function') {
|
|
205
|
+
const is = interpolateNumber(zoomRef.current, state(zoomRef.current));
|
|
206
206
|
// Stop easing if already zooming.
|
|
207
207
|
transition()
|
|
208
208
|
.ease(zooming.current ? easeLinear : easeSinOut)
|
|
@@ -212,7 +212,7 @@ const GlobeCanvas = forwardRef<GlobeController, GlobeCanvasProps>(
|
|
|
212
212
|
zooming.current = false;
|
|
213
213
|
});
|
|
214
214
|
} else {
|
|
215
|
-
setZoom(
|
|
215
|
+
setZoom(state);
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
setTranslation,
|
|
@@ -11,7 +11,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
11
11
|
import { MapContainer, type MapContainerProps, Marker, Popup, TileLayer, useMap, useMapEvents } from 'react-leaflet';
|
|
12
12
|
|
|
13
13
|
import { ThemeProvider, type ThemedClassName, Tooltip } from '@dxos/react-ui';
|
|
14
|
-
import { defaultTx, mx } from '@dxos/
|
|
14
|
+
import { defaultTx, mx } from '@dxos/ui-theme';
|
|
15
15
|
|
|
16
16
|
import { type GeoMarker } from '../../types';
|
|
17
17
|
import { ActionControls, type ControlProps, ZoomControls, controlPositions } from '../Toolbar';
|
|
@@ -118,11 +118,13 @@ MapRoot.displayName = 'Map.Root';
|
|
|
118
118
|
// https://react-leaflet.js.org/docs/api-components/#tilelayer
|
|
119
119
|
//
|
|
120
120
|
|
|
121
|
+
const MAP_TILES_NAME = 'Map.Tiles';
|
|
122
|
+
|
|
121
123
|
type MapTilesProps = {};
|
|
122
124
|
|
|
123
125
|
const MapTiles = (_props: MapTilesProps) => {
|
|
124
126
|
const ref = useRef<L.TileLayer>(null);
|
|
125
|
-
const { onChange } = useMapContext(
|
|
127
|
+
const { onChange } = useMapContext(MAP_TILES_NAME);
|
|
126
128
|
|
|
127
129
|
useMapEvents({
|
|
128
130
|
zoomstart: (ev) => {
|
|
@@ -135,7 +137,7 @@ const MapTiles = (_props: MapTilesProps) => {
|
|
|
135
137
|
|
|
136
138
|
// NOTE: Need to dynamically update data attribute since TileLayer doesn't update, but
|
|
137
139
|
// Tailwind requires setting the property for static analysis.
|
|
138
|
-
const { attention } = useMapContext(
|
|
140
|
+
const { attention } = useMapContext(MAP_TILES_NAME);
|
|
139
141
|
useEffect(() => {
|
|
140
142
|
if (ref.current) {
|
|
141
143
|
ref.current.getContainer().dataset.attention = attention ? '1' : '0';
|
|
@@ -176,7 +178,7 @@ const MapTiles = (_props: MapTilesProps) => {
|
|
|
176
178
|
);
|
|
177
179
|
};
|
|
178
180
|
|
|
179
|
-
MapTiles.displayName =
|
|
181
|
+
MapTiles.displayName = MAP_TILES_NAME;
|
|
180
182
|
|
|
181
183
|
//
|
|
182
184
|
// Markers
|
package/src/hooks/context.tsx
CHANGED
|
@@ -41,15 +41,15 @@ export type GlobeContextProviderProps = PropsWithChildren<
|
|
|
41
41
|
export const GlobeContextProvider = ({
|
|
42
42
|
children,
|
|
43
43
|
size,
|
|
44
|
-
center:
|
|
45
|
-
zoom:
|
|
46
|
-
translation:
|
|
47
|
-
rotation:
|
|
44
|
+
center: centerProp = defaults.center,
|
|
45
|
+
zoom: zoomProp = defaults.zoom,
|
|
46
|
+
translation: translationProp,
|
|
47
|
+
rotation: rotationProp,
|
|
48
48
|
}: GlobeContextProviderProps) => {
|
|
49
|
-
const [center, setCenter] = useControlledState(
|
|
50
|
-
const [zoom, setZoom] = useControlledState(
|
|
51
|
-
const [translation, setTranslation] = useControlledState<Point>(
|
|
52
|
-
const [rotation, setRotation] = useControlledState<Vector>(
|
|
49
|
+
const [center, setCenter] = useControlledState(centerProp);
|
|
50
|
+
const [zoom, setZoom] = useControlledState(zoomProp);
|
|
51
|
+
const [translation, setTranslation] = useControlledState<Point>(translationProp);
|
|
52
|
+
const [rotation, setRotation] = useControlledState<Vector>(rotationProp);
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
55
|
<GlobeContext.Provider
|