@dxos/react-ui-geo 0.8.3 → 0.8.4-main.1c7ec43d41

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.
Files changed (100) hide show
  1. package/data/airports.ts +1 -1
  2. package/data/cities.ts +1 -1
  3. package/data/countries-110m.ts +1 -1
  4. package/data/countries-dots-3.ts +1 -1
  5. package/data/countries-dots-4.ts +1 -1
  6. package/dist/lib/browser/{countries-110m-WI4PCLDF.mjs → countries-110m-RE5RNRQG.mjs} +2 -2
  7. package/dist/lib/browser/countries-110m-RE5RNRQG.mjs.map +7 -0
  8. package/dist/lib/browser/data.mjs +4 -3
  9. package/dist/lib/browser/data.mjs.map +4 -4
  10. package/dist/lib/browser/index.mjs +396 -466
  11. package/dist/lib/browser/index.mjs.map +3 -3
  12. package/dist/lib/browser/meta.json +1 -1
  13. package/dist/lib/browser/translations.mjs +19 -0
  14. package/dist/lib/browser/translations.mjs.map +7 -0
  15. package/dist/lib/node-esm/{countries-110m-DQ4XRC4B.mjs → countries-110m-4EDBXSFJ.mjs} +2 -2
  16. package/dist/lib/node-esm/countries-110m-4EDBXSFJ.mjs.map +7 -0
  17. package/dist/lib/node-esm/data.mjs +5 -3
  18. package/dist/lib/node-esm/data.mjs.map +4 -4
  19. package/dist/lib/node-esm/index.mjs +396 -465
  20. package/dist/lib/node-esm/index.mjs.map +3 -3
  21. package/dist/lib/node-esm/meta.json +1 -1
  22. package/dist/lib/node-esm/translations.mjs +21 -0
  23. package/dist/lib/node-esm/translations.mjs.map +7 -0
  24. package/dist/types/data/airports.d.ts +4 -4
  25. package/dist/types/data/airports.d.ts.map +1 -1
  26. package/dist/types/data/cities.d.ts.map +1 -1
  27. package/dist/types/data/countries-110m.d.ts.map +1 -1
  28. package/dist/types/data/countries-dots-3.d.ts.map +1 -1
  29. package/dist/types/data/countries-dots-4.d.ts.map +1 -1
  30. package/dist/types/src/components/Globe/Globe.d.ts +6 -4
  31. package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
  32. package/dist/types/src/components/Globe/Globe.stories.d.ts +27 -9
  33. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/Map/Map.d.ts +42 -18
  35. package/dist/types/src/components/Map/Map.d.ts.map +1 -1
  36. package/dist/types/src/components/Map/Map.stories.d.ts +14 -8
  37. package/dist/types/src/components/Map/Map.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
  39. package/dist/types/src/components/index.d.ts +0 -1
  40. package/dist/types/src/components/index.d.ts.map +1 -1
  41. package/dist/types/src/hooks/context.d.ts +6 -8
  42. package/dist/types/src/hooks/context.d.ts.map +1 -1
  43. package/dist/types/src/hooks/useDrag.d.ts.map +1 -1
  44. package/dist/types/src/hooks/useGlobeZoomHandler.d.ts +2 -2
  45. package/dist/types/src/hooks/useGlobeZoomHandler.d.ts.map +1 -1
  46. package/dist/types/src/hooks/useMapZoomHandler.d.ts +2 -2
  47. package/dist/types/src/hooks/useMapZoomHandler.d.ts.map +1 -1
  48. package/dist/types/src/hooks/useSpinner.d.ts +1 -1
  49. package/dist/types/src/hooks/useSpinner.d.ts.map +1 -1
  50. package/dist/types/src/hooks/useTour.d.ts +4 -3
  51. package/dist/types/src/hooks/useTour.d.ts.map +1 -1
  52. package/dist/types/src/index.d.ts +1 -2
  53. package/dist/types/src/index.d.ts.map +1 -1
  54. package/dist/types/src/translations.d.ts +12 -0
  55. package/dist/types/src/translations.d.ts.map +1 -0
  56. package/dist/types/src/types.d.ts +2 -1
  57. package/dist/types/src/types.d.ts.map +1 -1
  58. package/dist/types/src/util/debug.d.ts.map +1 -1
  59. package/dist/types/src/util/inertia.d.ts.map +1 -1
  60. package/dist/types/src/util/path.d.ts +5 -8
  61. package/dist/types/src/util/path.d.ts.map +1 -1
  62. package/dist/types/src/util/render.d.ts +4 -4
  63. package/dist/types/src/util/render.d.ts.map +1 -1
  64. package/dist/types/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +43 -34
  66. package/src/components/Globe/Globe.stories.tsx +85 -38
  67. package/src/components/Globe/Globe.tsx +124 -81
  68. package/src/components/Map/Map.stories.tsx +27 -15
  69. package/src/components/Map/Map.tsx +220 -94
  70. package/src/components/Toolbar/Controls.tsx +14 -20
  71. package/src/components/index.ts +0 -2
  72. package/src/hooks/context.tsx +11 -34
  73. package/src/hooks/useGlobeZoomHandler.ts +9 -3
  74. package/src/hooks/useMapZoomHandler.ts +1 -1
  75. package/src/hooks/useSpinner.ts +1 -1
  76. package/src/hooks/useTour.ts +10 -8
  77. package/src/index.ts +1 -2
  78. package/src/translations.ts +20 -0
  79. package/src/types.ts +3 -1
  80. package/src/util/inertia.ts +1 -1
  81. package/src/util/path.ts +5 -6
  82. package/src/util/render.ts +4 -3
  83. package/dist/lib/browser/chunk-ENCWOTYX.mjs +0 -9
  84. package/dist/lib/browser/chunk-ENCWOTYX.mjs.map +0 -7
  85. package/dist/lib/browser/countries-110m-WI4PCLDF.mjs.map +0 -7
  86. package/dist/lib/node/chunk-LAICG6L2.cjs +0 -40
  87. package/dist/lib/node/chunk-LAICG6L2.cjs.map +0 -7
  88. package/dist/lib/node/countries-110m-KQ5WAB2O.cjs +0 -37877
  89. package/dist/lib/node/countries-110m-KQ5WAB2O.cjs.map +0 -7
  90. package/dist/lib/node/data.cjs +0 -28
  91. package/dist/lib/node/data.cjs.map +0 -7
  92. package/dist/lib/node/index.cjs +0 -1187
  93. package/dist/lib/node/index.cjs.map +0 -7
  94. package/dist/lib/node/meta.json +0 -1
  95. package/dist/lib/node-esm/chunk-PIIEDZEU.mjs +0 -11
  96. package/dist/lib/node-esm/chunk-PIIEDZEU.mjs.map +0 -7
  97. package/dist/lib/node-esm/countries-110m-DQ4XRC4B.mjs.map +0 -7
  98. package/dist/types/src/components/types.d.ts +0 -15
  99. package/dist/types/src/components/types.d.ts.map +0 -1
  100. package/src/components/types.ts +0 -19
@@ -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[];
package/src/types.ts CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  import { type LatLngLiteral } from 'leaflet';
6
6
 
7
- export type MapMarker = {
7
+ export { type LatLngLiteral };
8
+
9
+ export type GeoMarker = {
8
10
  id: string;
9
11
  title?: string;
10
12
  location: LatLngLiteral;
@@ -4,7 +4,7 @@
4
4
  // https://github.com/Fil/d3-inertia
5
5
  //
6
6
 
7
- import { select, drag, timer } from 'd3';
7
+ import { drag, select, timer } from 'd3';
8
8
  import versor from 'versor';
9
9
 
10
10
  export const restrictAxis =
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 }: LatLng): [number, number] => [lng, lat];
13
+ export const geoToPosition = ({ lat, lng }: LatLngLiteral): [number, number] => [lng, lat];
15
14
 
16
- export const geoPoint = (point: LatLng): Point => ({ type: 'Point', coordinates: geoToPosition(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 }: LatLng, radius: number): Polygon =>
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: LatLng, p2: LatLng): GeoGeometryObjects => ({
21
+ export const geoLine = (p1: LatLngLiteral, p2: LatLngLiteral): GeoGeometryObjects => ({
23
22
  type: 'LineString',
24
23
  coordinates: [
25
24
  [p1.lng, p1.lat],
@@ -6,7 +6,8 @@ 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 LatLng, geoLine, geoPoint } from './path';
9
+ import { type LatLngLiteral } from '../types';
10
+ import { geoLine, geoPoint } from './path';
10
11
 
11
12
  export type Styles = Record<string, any>;
12
13
 
@@ -25,8 +26,8 @@ export type Style =
25
26
  export type StyleSet = Partial<Record<Style, Styles>>;
26
27
 
27
28
  export type Features = {
28
- points?: LatLng[];
29
- lines?: { source: LatLng; target: LatLng }[];
29
+ points?: LatLngLiteral[];
30
+ lines?: { source: LatLngLiteral; target: LatLngLiteral }[];
30
31
  };
31
32
 
32
33
  export type Layer = {
@@ -1,9 +0,0 @@
1
- // packages/ui/react-ui-geo/src/data.ts
2
- var loadTopology = async () => {
3
- return (await import("./countries-110m-WI4PCLDF.mjs")).default;
4
- };
5
-
6
- export {
7
- loadTopology
8
- };
9
- //# sourceMappingURL=chunk-ENCWOTYX.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/data.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Topology } from 'topojson-specification';\n\nexport const loadTopology = async (): Promise<Topology> => {\n return (await import('../data/countries-110m.ts')).default;\n};\n"],
5
- "mappings": ";AAMO,IAAMA,eAAe,YAAA;AAC1B,UAAQ,MAAM,OAAO,+BAAA,GAA8BC;AACrD;",
6
- "names": ["loadTopology", "default"]
7
- }