@dxos/react-ui-geo 0.8.4-main.ae835ea → 0.8.4-main.bc674ce

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/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-geo",
3
- "version": "0.8.4-main.ae835ea",
3
+ "version": "0.8.4-main.bc674ce",
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
- "@preact-signals/safe-react": "^0.9.0",
40
- "@radix-ui/react-context": "^1.0.5",
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/async": "0.8.4-main.ae835ea",
53
- "@dxos/debug": "0.8.4-main.ae835ea",
54
- "@dxos/log": "0.8.4-main.ae835ea",
55
- "@dxos/node-std": "0.8.4-main.ae835ea",
56
- "@dxos/util": "0.8.4-main.ae835ea"
55
+ "@dxos/async": "0.8.4-main.bc674ce",
56
+ "@dxos/log": "0.8.4-main.bc674ce",
57
+ "@dxos/debug": "0.8.4-main.bc674ce",
58
+ "@dxos/node-std": "0.8.4-main.bc674ce",
59
+ "@dxos/util": "0.8.4-main.bc674ce"
57
60
  },
58
61
  "devDependencies": {
59
- "@react-three/drei": "^9.99.0",
60
- "@react-three/fiber": "^9.3.0",
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.2",
65
- "@types/react-dom": "~19.2.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.9.35",
73
- "react": "~19.2.0",
74
- "react-dom": "~19.2.0",
75
- "three": "0.165.0",
76
- "@dxos/storybook-utils": "0.8.4-main.ae835ea",
77
- "@dxos/react-ui-theme": "0.8.4-main.ae835ea",
78
- "@dxos/react-ui": "0.8.4-main.ae835ea"
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.bc674ce",
80
+ "@dxos/storybook-utils": "0.8.4-main.bc674ce",
81
+ "@dxos/ui-theme": "0.8.4-main.bc674ce"
79
82
  },
80
83
  "peerDependencies": {
81
- "react": "^19.0.0",
82
- "react-dom": "^19.0.0",
83
- "@dxos/react-ui": "0.8.4-main.ae835ea",
84
- "@dxos/react-ui-theme": "0.8.4-main.ae835ea"
84
+ "react": "~19.2.3",
85
+ "react-dom": "~19.2.3",
86
+ "@dxos/react-ui": "0.8.4-main.bc674ce",
87
+ "@dxos/ui-theme": "0.8.4-main.bc674ce"
85
88
  },
86
89
  "publishConfig": {
87
90
  "access": "public"
@@ -214,7 +214,7 @@ const DefaultStory = ({
214
214
  <Globe.Zoom onAction={handleAction} />
215
215
  <Globe.Action onAction={handleAction} />
216
216
  <Globe.Debug />
217
- <Globe.Panel position='topright' classNames='w-20 h-20'>
217
+ <Globe.Panel position='topright' classNames='is-20 bs-20'>
218
218
  <Leva />
219
219
  </Globe.Panel>
220
220
  </Globe.Root>
@@ -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/react-ui-theme';
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: projectionParam, topology, features, styles: stylesParam }, forwardRef) => {
160
+ ({ projection: projectionProp, topology, features, styles: stylesProp }, forwardRef) => {
161
161
  const { themeMode } = useThemeContext();
162
- const styles = useMemo(() => stylesParam ?? defaultStyles[themeMode], [stylesParam, themeMode]);
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(projectionParam), [projectionParam]);
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.
@@ -259,7 +259,7 @@ const GlobeDebug = ({ position = 'topleft' }: { position?: ControlPosition }) =>
259
259
  return (
260
260
  <div
261
261
  className={mx(
262
- 'z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded',
262
+ 'z-10 absolute is-96 p-2 overflow-hidden border border-green-700 rounded',
263
263
  controlPositions[position],
264
264
  )}
265
265
  >
@@ -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/react-ui-theme';
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';
@@ -5,7 +5,9 @@
5
5
  import { type ControlPosition } from 'leaflet';
6
6
  import React from 'react';
7
7
 
8
- import { IconButton, type ThemedClassName, Toolbar } from '@dxos/react-ui';
8
+ import { IconButton, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
9
+
10
+ import { translationKey } from '../../translations';
9
11
 
10
12
  export type ControlAction = 'toggle' | 'start' | 'zoom-in' | 'zoom-out';
11
13
 
@@ -21,22 +23,20 @@ export const controlPositions: Record<ControlPosition, string> = {
21
23
  };
22
24
 
23
25
  export const ZoomControls = ({ classNames, onAction }: ControlProps) => {
26
+ const { t } = useTranslation(translationKey);
27
+
24
28
  return (
25
29
  <Toolbar.Root classNames={['gap-2', classNames]}>
26
30
  <IconButton
27
31
  icon='ph--plus--regular'
28
- label='zoom in'
29
32
  iconOnly
30
- size={5}
31
- classNames='px-0 aspect-square'
33
+ label={t('zoom in icon button')}
32
34
  onClick={() => onAction?.('zoom-in')}
33
35
  />
34
36
  <IconButton
35
37
  icon='ph--minus--regular'
36
- label='zoom out'
37
38
  iconOnly
38
- size={5}
39
- classNames='px-0 aspect-square'
39
+ label={t('zoom out icon button')}
40
40
  onClick={() => onAction?.('zoom-out')}
41
41
  />
42
42
  </Toolbar.Root>
@@ -44,22 +44,20 @@ export const ZoomControls = ({ classNames, onAction }: ControlProps) => {
44
44
  };
45
45
 
46
46
  export const ActionControls = ({ classNames, onAction }: ControlProps) => {
47
+ const { t } = useTranslation(translationKey);
48
+
47
49
  return (
48
50
  <Toolbar.Root classNames={['gap-2', classNames]}>
49
51
  <IconButton
50
- icon='ph--play--regular'
51
- label='start'
52
+ icon='ph--path--regular'
52
53
  iconOnly
53
- size={5}
54
- classNames='px-0 aspect-square'
54
+ label={t('start icon button')}
55
55
  onClick={() => onAction?.('start')}
56
56
  />
57
57
  <IconButton
58
58
  icon='ph--globe-hemisphere-west--regular'
59
- label='toggle'
60
59
  iconOnly
61
- size={5}
62
- classNames='px-0 aspect-square'
60
+ label={t('toggle icon button')}
63
61
  onClick={() => onAction?.('toggle')}
64
62
  />
65
63
  </Toolbar.Root>
@@ -41,15 +41,15 @@ export type GlobeContextProviderProps = PropsWithChildren<
41
41
  export const GlobeContextProvider = ({
42
42
  children,
43
43
  size,
44
- center: centerParam = defaults.center,
45
- zoom: zoomParam = defaults.zoom,
46
- translation: translationParam,
47
- rotation: rotationParam,
44
+ center: centerProp = defaults.center,
45
+ zoom: zoomProp = defaults.zoom,
46
+ translation: translationProp,
47
+ rotation: rotationProp,
48
48
  }: GlobeContextProviderProps) => {
49
- const [center, setCenter] = useControlledState(centerParam);
50
- const [zoom, setZoom] = useControlledState(zoomParam);
51
- const [translation, setTranslation] = useControlledState<Point>(translationParam);
52
- const [rotation, setRotation] = useControlledState<Vector>(rotationParam);
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
@@ -34,6 +34,7 @@ export const useTour = (
34
34
  options: TourOptions = {},
35
35
  ): [boolean, Dispatch<SetStateAction<boolean>>] => {
36
36
  const selection = useMemo(() => d3Selection(), []);
37
+ // TODO(burdon): Redo controlled state.
37
38
  const [running, setRunning] = useState(options.running ?? false);
38
39
  useEffect(() => {
39
40
  if (!running) {
package/src/index.ts CHANGED
@@ -5,5 +5,6 @@
5
5
  export * from './components';
6
6
  export * from './data';
7
7
  export * from './hooks';
8
+ export * from './translations';
8
9
  export type * from './types';
9
10
  export * from './util';
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Resource } from '@dxos/react-ui';
6
+
7
+ export const translationKey = '@dxos/react-ui-geo';
8
+
9
+ export const translations = [
10
+ {
11
+ 'en-US': {
12
+ [translationKey]: {
13
+ 'zoom in icon button': 'Zoom in',
14
+ 'zoom out icon button': 'Zoom out',
15
+ 'start icon button': 'Start',
16
+ 'toggle icon button': 'Toggle',
17
+ },
18
+ },
19
+ },
20
+ ] as const satisfies Resource[];