@dxos/react-ui-geo 0.7.5-main.b19bfc8 → 0.7.5-main.c41020f
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 +33 -33
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +12 -12
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +33 -33
- 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 +3 -2
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/components/Map/Map.tsx +1 -1
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/ui/react-ui-geo/src/components/Globe/Globe.tsx
|
|
6
6
|
import * as d37 from "d3";
|
|
7
|
-
import
|
|
7
|
+
import React3, { forwardRef, useEffect as useEffect4, useImperativeHandle, useMemo, useRef, useState as useState3 } from "react";
|
|
8
8
|
import { useResizeDetector } from "react-resize-detector";
|
|
9
9
|
import { useDynamicRef, useThemeContext } from "@dxos/react-ui";
|
|
10
10
|
import { mx } from "@dxos/react-ui-theme";
|
|
11
11
|
|
|
12
12
|
// packages/ui/react-ui-geo/src/hooks/context.tsx
|
|
13
|
-
import
|
|
13
|
+
import React, { createContext, useContext } from "react";
|
|
14
14
|
import { raise } from "@dxos/debug";
|
|
15
15
|
import { useControlledState } from "@dxos/react-ui";
|
|
16
16
|
var GlobeContext = /* @__PURE__ */ createContext(void 0);
|
|
@@ -19,7 +19,7 @@ var GlobeContextProvider = ({ children, size, center: _center, scale: _scale, tr
|
|
|
19
19
|
const [scale, setScale] = useControlledState(_scale);
|
|
20
20
|
const [translation, setTranslation] = useControlledState(_translation);
|
|
21
21
|
const [rotation, setRotation] = useControlledState(_rotation);
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ React.createElement(GlobeContext.Provider, {
|
|
23
23
|
value: {
|
|
24
24
|
size,
|
|
25
25
|
center,
|
|
@@ -622,7 +622,7 @@ var useTour = (controller, points, options = {}) => {
|
|
|
622
622
|
};
|
|
623
623
|
|
|
624
624
|
// packages/ui/react-ui-geo/src/components/Toolbar/Controls.tsx
|
|
625
|
-
import
|
|
625
|
+
import React2 from "react";
|
|
626
626
|
import { IconButton, Toolbar } from "@dxos/react-ui";
|
|
627
627
|
var controlPositions = {
|
|
628
628
|
topleft: "top-2 left-2",
|
|
@@ -631,12 +631,12 @@ var controlPositions = {
|
|
|
631
631
|
bottomright: "bottom-2 right-2"
|
|
632
632
|
};
|
|
633
633
|
var ZoomControls = ({ classNames, onAction }) => {
|
|
634
|
-
return /* @__PURE__ */
|
|
634
|
+
return /* @__PURE__ */ React2.createElement(Toolbar.Root, {
|
|
635
635
|
classNames: [
|
|
636
636
|
"gap-1",
|
|
637
637
|
classNames
|
|
638
638
|
]
|
|
639
|
-
}, /* @__PURE__ */
|
|
639
|
+
}, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
640
640
|
//
|
|
641
641
|
icon: "ph--plus--regular",
|
|
642
642
|
label: "zoom in",
|
|
@@ -644,7 +644,7 @@ var ZoomControls = ({ classNames, onAction }) => {
|
|
|
644
644
|
size: 5,
|
|
645
645
|
classNames: "px-0 aspect-square",
|
|
646
646
|
onClick: () => onAction?.("zoom-in")
|
|
647
|
-
}), /* @__PURE__ */
|
|
647
|
+
}), /* @__PURE__ */ React2.createElement(IconButton, {
|
|
648
648
|
//
|
|
649
649
|
icon: "ph--minus--regular",
|
|
650
650
|
label: "zoom out",
|
|
@@ -655,12 +655,12 @@ var ZoomControls = ({ classNames, onAction }) => {
|
|
|
655
655
|
}));
|
|
656
656
|
};
|
|
657
657
|
var ActionControls = ({ classNames, onAction }) => {
|
|
658
|
-
return /* @__PURE__ */
|
|
658
|
+
return /* @__PURE__ */ React2.createElement(Toolbar.Root, {
|
|
659
659
|
classNames: [
|
|
660
660
|
"gap-1",
|
|
661
661
|
classNames
|
|
662
662
|
]
|
|
663
|
-
}, /* @__PURE__ */
|
|
663
|
+
}, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
664
664
|
//
|
|
665
665
|
icon: "ph--play--regular",
|
|
666
666
|
label: "start",
|
|
@@ -668,7 +668,7 @@ var ActionControls = ({ classNames, onAction }) => {
|
|
|
668
668
|
size: 5,
|
|
669
669
|
classNames: "px-0 aspect-square",
|
|
670
670
|
onClick: () => onAction?.("start")
|
|
671
|
-
}), /* @__PURE__ */
|
|
671
|
+
}), /* @__PURE__ */ React2.createElement(IconButton, {
|
|
672
672
|
//
|
|
673
673
|
icon: "ph--globe-hemisphere-west--regular",
|
|
674
674
|
label: "toggle",
|
|
@@ -736,10 +736,10 @@ var getProjection = (type = "orthographic") => {
|
|
|
736
736
|
};
|
|
737
737
|
var GlobeRoot = ({ classNames, children, ...props }) => {
|
|
738
738
|
const { ref, width, height } = useResizeDetector();
|
|
739
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
740
740
|
ref,
|
|
741
741
|
className: mx("relative flex grow overflow-hidden", classNames)
|
|
742
|
-
}, /* @__PURE__ */
|
|
742
|
+
}, /* @__PURE__ */ React3.createElement(GlobeContextProvider, {
|
|
743
743
|
size: {
|
|
744
744
|
width,
|
|
745
745
|
height
|
|
@@ -834,7 +834,7 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topolog
|
|
|
834
834
|
if (!size.width || !size.height) {
|
|
835
835
|
return null;
|
|
836
836
|
}
|
|
837
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ React3.createElement("canvas", {
|
|
838
838
|
ref: canvasRef,
|
|
839
839
|
width: size.width,
|
|
840
840
|
height: size.height
|
|
@@ -842,9 +842,9 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topolog
|
|
|
842
842
|
});
|
|
843
843
|
var GlobeDebug = ({ position = "topleft" }) => {
|
|
844
844
|
const { size, scale, translation, rotation } = useGlobeContext();
|
|
845
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
846
846
|
className: mx("z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded", controlPositions[position])
|
|
847
|
-
}, /* @__PURE__ */
|
|
847
|
+
}, /* @__PURE__ */ React3.createElement("pre", {
|
|
848
848
|
className: "font-mono text-xs text-green-700"
|
|
849
849
|
}, JSON.stringify({
|
|
850
850
|
size,
|
|
@@ -854,28 +854,28 @@ var GlobeDebug = ({ position = "topleft" }) => {
|
|
|
854
854
|
}, null, 2)));
|
|
855
855
|
};
|
|
856
856
|
var GlobePanel = ({ position, classNames, children }) => {
|
|
857
|
-
return /* @__PURE__ */
|
|
857
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
858
858
|
className: mx("z-10 absolute overflow-hidden", controlPositions[position], classNames)
|
|
859
859
|
}, children);
|
|
860
860
|
};
|
|
861
861
|
var CustomControl = ({ position, children }) => {
|
|
862
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
863
863
|
className: mx("z-10 absolute overflow-hidden", controlPositions[position])
|
|
864
864
|
}, children);
|
|
865
865
|
};
|
|
866
866
|
var Globe = {
|
|
867
867
|
Root: GlobeRoot,
|
|
868
868
|
Canvas: GlobeCanvas,
|
|
869
|
-
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */
|
|
869
|
+
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */ React3.createElement(CustomControl, {
|
|
870
870
|
position,
|
|
871
871
|
...props
|
|
872
|
-
}, /* @__PURE__ */
|
|
872
|
+
}, /* @__PURE__ */ React3.createElement(ZoomControls, {
|
|
873
873
|
onAction
|
|
874
874
|
})),
|
|
875
|
-
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */
|
|
875
|
+
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */ React3.createElement(CustomControl, {
|
|
876
876
|
position,
|
|
877
877
|
...props
|
|
878
|
-
}, /* @__PURE__ */
|
|
878
|
+
}, /* @__PURE__ */ React3.createElement(ActionControls, {
|
|
879
879
|
onAction
|
|
880
880
|
})),
|
|
881
881
|
Debug: GlobeDebug,
|
|
@@ -885,7 +885,7 @@ var Globe = {
|
|
|
885
885
|
// packages/ui/react-ui-geo/src/components/Map/Map.tsx
|
|
886
886
|
import "leaflet/dist/leaflet.css";
|
|
887
887
|
import L, { Control, DomEvent, DomUtil, latLngBounds } from "leaflet";
|
|
888
|
-
import { forwardRef as forwardRef2, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
888
|
+
import React4, { forwardRef as forwardRef2, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
889
889
|
import { createRoot } from "react-dom/client";
|
|
890
890
|
import { MapContainer, Marker, Popup, TileLayer, useMap } from "react-leaflet";
|
|
891
891
|
import { useResizeDetector as useResizeDetector2 } from "react-resize-detector";
|
|
@@ -901,7 +901,7 @@ var defaults = {
|
|
|
901
901
|
zoom: 4
|
|
902
902
|
};
|
|
903
903
|
var MapRoot = ({ classNames, center = defaults.center, zoom = defaults.zoom, ...props }) => {
|
|
904
|
-
return /* @__PURE__ */
|
|
904
|
+
return /* @__PURE__ */ React4.createElement(MapContainer, {
|
|
905
905
|
className: mx2("relative flex w-full h-full grow bg-baseSurface", classNames),
|
|
906
906
|
attributionControl: false,
|
|
907
907
|
// TODO(burdon): Only if attention.
|
|
@@ -972,14 +972,14 @@ var MapCanvas = /* @__PURE__ */ forwardRef2(({ markers, center, zoom, onChange }
|
|
|
972
972
|
}, [
|
|
973
973
|
markers
|
|
974
974
|
]);
|
|
975
|
-
return /* @__PURE__ */
|
|
975
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
976
976
|
ref,
|
|
977
977
|
className: "flex w-full h-full overflow-hidden bg-baseSurface"
|
|
978
|
-
}, /* @__PURE__ */
|
|
978
|
+
}, /* @__PURE__ */ React4.createElement(TileLayer, {
|
|
979
979
|
className: "dark:filter dark:grayscale dark:invert",
|
|
980
980
|
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
981
981
|
}), markers?.map(({ id, title, location: { lat, lng } }) => {
|
|
982
|
-
return /* @__PURE__ */
|
|
982
|
+
return /* @__PURE__ */ React4.createElement(Marker, {
|
|
983
983
|
key: id,
|
|
984
984
|
position: {
|
|
985
985
|
lat,
|
|
@@ -1009,7 +1009,7 @@ var MapCanvas = /* @__PURE__ */ forwardRef2(({ markers, center, zoom, onChange }
|
|
|
1009
1009
|
]
|
|
1010
1010
|
})
|
|
1011
1011
|
)
|
|
1012
|
-
}, title && /* @__PURE__ */
|
|
1012
|
+
}, title && /* @__PURE__ */ React4.createElement(Popup, null, title));
|
|
1013
1013
|
}));
|
|
1014
1014
|
});
|
|
1015
1015
|
var CustomControl2 = ({ position, children }) => {
|
|
@@ -1023,9 +1023,9 @@ var CustomControl2 = ({ position, children }) => {
|
|
|
1023
1023
|
DomEvent.disableClickPropagation(container);
|
|
1024
1024
|
DomEvent.disableScrollPropagation(container);
|
|
1025
1025
|
const root = createRoot(container);
|
|
1026
|
-
root.render(/* @__PURE__ */
|
|
1026
|
+
root.render(/* @__PURE__ */ React4.createElement(ThemeProvider, {
|
|
1027
1027
|
tx: defaultTx
|
|
1028
|
-
}, /* @__PURE__ */
|
|
1028
|
+
}, /* @__PURE__ */ React4.createElement(Tooltip.Provider, null, children)));
|
|
1029
1029
|
return container;
|
|
1030
1030
|
};
|
|
1031
1031
|
control.addTo(map);
|
|
@@ -1042,16 +1042,16 @@ var CustomControl2 = ({ position, children }) => {
|
|
|
1042
1042
|
var Map = {
|
|
1043
1043
|
Root: MapRoot,
|
|
1044
1044
|
Canvas: MapCanvas,
|
|
1045
|
-
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */
|
|
1045
|
+
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */ React4.createElement(CustomControl2, {
|
|
1046
1046
|
position,
|
|
1047
1047
|
...props
|
|
1048
|
-
}, /* @__PURE__ */
|
|
1048
|
+
}, /* @__PURE__ */ React4.createElement(ZoomControls, {
|
|
1049
1049
|
onAction
|
|
1050
1050
|
})),
|
|
1051
|
-
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */
|
|
1051
|
+
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */ React4.createElement(CustomControl2, {
|
|
1052
1052
|
position,
|
|
1053
1053
|
...props
|
|
1054
|
-
}, /* @__PURE__ */
|
|
1054
|
+
}, /* @__PURE__ */ React4.createElement(ActionControls, {
|
|
1055
1055
|
onAction
|
|
1056
1056
|
}))
|
|
1057
1057
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Globe/Globe.tsx", "../../../src/hooks/context.tsx", "../../../src/hooks/useDrag.ts", "../../../src/util/debug.ts", "../../../src/util/inertia.ts", "../../../src/util/path.ts", "../../../src/util/render.ts", "../../../src/hooks/useGlobeZoomHandler.ts", "../../../src/hooks/useMapZoomHandler.ts", "../../../src/hooks/useSpinner.ts", "../../../src/hooks/useTour.ts", "../../../src/components/Toolbar/Controls.tsx", "../../../src/components/Map/Map.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2018 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type GeoProjection } from 'd3';\nimport { type ControlPosition } from 'leaflet';\nimport React, {\n type PropsWithChildren,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\nimport { type Topology } from 'topojson-specification';\n\nimport { type ThemedClassName, type ThemeMode, useDynamicRef, useThemeContext } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport {\n GlobeContextProvider,\n type GlobeContextProviderProps,\n type GlobeContextType,\n useGlobeContext,\n} from '../../hooks';\nimport {\n type Features,\n type StyleSet,\n createLayers,\n geoToPosition,\n positionToRotation,\n renderLayers,\n timer,\n} from '../../util';\nimport { ZoomControls, ActionControls, type ControlProps, controlPositions } from '../Toolbar';\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute\n */\nconst defaultStyles: Record<ThemeMode, StyleSet> = {\n light: {\n background: {\n fillStyle: '#EEE',\n },\n\n water: {\n fillStyle: '#555',\n },\n\n land: {\n fillStyle: '#999',\n },\n\n line: {\n strokeStyle: 'darkred',\n },\n\n point: {\n fillStyle: '#111111',\n strokeStyle: '#111111',\n strokeWidth: 1,\n pointRadius: 0.5,\n },\n },\n dark: {\n background: {\n fillStyle: '#111111',\n },\n\n water: {\n fillStyle: '#123E6A',\n },\n\n land: {\n fillStyle: '#032153',\n },\n\n line: {\n strokeStyle: '#111111',\n },\n\n point: {\n fillStyle: '#111111',\n strokeStyle: '#111111',\n strokeWidth: 1,\n pointRadius: 0.5,\n },\n },\n};\n\nexport type GlobeController = {\n canvas: HTMLCanvasElement;\n projection: GeoProjection;\n} & Pick<GlobeContextType, 'scale' | 'translation' | 'rotation' | 'setScale' | 'setTranslation' | 'setRotation'>;\n\nexport type ProjectionType = 'orthographic' | 'mercator' | 'transverse-mercator';\n\nconst projectionMap: Record<ProjectionType, () => GeoProjection> = {\n orthographic: d3.geoOrthographic,\n mercator: d3.geoMercator,\n 'transverse-mercator': d3.geoTransverseMercator,\n};\n\nconst getProjection = (type: GlobeCanvasProps['projection'] = 'orthographic'): GeoProjection => {\n if (typeof type === 'string') {\n const constructor = projectionMap[type] ?? d3.geoOrthographic;\n return constructor();\n }\n\n return type ?? d3.geoOrthographic();\n};\n\n//\n// Root\n//\n\ntype GlobeRootProps = PropsWithChildren<ThemedClassName<GlobeContextProviderProps>>;\n\nconst GlobeRoot = ({ classNames, children, ...props }: GlobeRootProps) => {\n const { ref, width, height } = useResizeDetector<HTMLDivElement>();\n return (\n <div ref={ref} className={mx('relative flex grow overflow-hidden', classNames)}>\n <GlobeContextProvider size={{ width, height }} {...props}>\n {children}\n </GlobeContextProvider>\n </div>\n );\n};\n\n//\n// Canvas\n//\n\ntype GlobeCanvasProps = {\n projection?: ProjectionType | GeoProjection;\n topology?: Topology;\n features?: Features;\n styles?: StyleSet;\n};\n\n/**\n * Basic globe renderer.\n * https://github.com/topojson/world-atlas\n */\nconst GlobeCanvas = forwardRef<GlobeController, GlobeCanvasProps>(\n ({ projection: _projection, topology, features, styles: _styles }, forwardRef) => {\n const { themeMode } = useThemeContext();\n const styles = useMemo(() => _styles ?? defaultStyles[themeMode], [_styles, themeMode]);\n\n // Canvas.\n const [canvas, setCanvas] = useState<HTMLCanvasElement>(null);\n const canvasRef = (canvas: HTMLCanvasElement) => setCanvas(canvas);\n\n // Projection.\n const projection = useMemo(() => getProjection(_projection), [_projection]);\n\n // Layers.\n // TODO(burdon): Generate on the fly based on what is visible.\n const layers = useMemo(() => {\n return timer(() => createLayers(topology as Topology, features, styles));\n }, [topology, features, styles]);\n\n // State.\n const { size, center, scale, translation, rotation, setCenter, setScale, setTranslation, setRotation } =\n useGlobeContext();\n\n const scaleRef = useDynamicRef(scale);\n\n // Update rotation.\n useEffect(() => {\n if (center) {\n setScale(1);\n setRotation(positionToRotation(geoToPosition(center)));\n }\n }, [center]);\n\n // External controller.\n const zooming = useRef(false);\n useImperativeHandle<GlobeController, GlobeController>(\n forwardRef,\n () => {\n return {\n canvas,\n projection,\n center,\n get scale() {\n return scaleRef.current;\n },\n translation,\n rotation,\n setCenter,\n setScale: (s) => {\n if (typeof s === 'function') {\n const is = d3.interpolateNumber(scaleRef.current, s(scaleRef.current));\n // Stop easing if already zooming.\n d3.transition()\n .ease(zooming.current ? d3.easeLinear : d3.easeSinOut)\n .duration(200)\n .tween('scale', () => (t) => setScale(is(t)))\n .on('end', () => {\n zooming.current = false;\n });\n } else {\n setScale(s);\n }\n },\n setTranslation,\n setRotation,\n };\n },\n [canvas],\n );\n\n // https://d3js.org/d3-geo/path#geoPath\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n const generator = useMemo(\n () => canvas && projection && d3.geoPath(projection, canvas.getContext('2d', { alpha: false })),\n [canvas, projection],\n );\n\n // Render on change.\n useEffect(() => {\n if (canvas && projection) {\n timer(() => {\n // https://d3js.org/d3-geo/projection\n projection\n .scale((Math.min(size.width, size.height) / 2) * scale)\n .translate([size.width / 2 + (translation?.x ?? 0), size.height / 2 + (translation?.y ?? 0)])\n .rotate(rotation ?? [0, 0, 0]);\n\n renderLayers(generator, layers, scale, styles);\n });\n }\n }, [generator, size, scale, translation, rotation, layers]);\n\n if (!size.width || !size.height) {\n return null;\n }\n\n return <canvas ref={canvasRef} width={size.width} height={size.height} />;\n },\n);\n\nconst GlobeDebug = ({ position = 'topleft' }: { position?: ControlPosition }) => {\n const { size, scale, translation, rotation } = useGlobeContext();\n return (\n <div\n className={mx(\n 'z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded',\n controlPositions[position],\n )}\n >\n <pre className='font-mono text-xs text-green-700'>\n {JSON.stringify({ size, scale, translation, rotation }, null, 2)}\n </pre>\n </div>\n );\n};\n\nconst GlobePanel = ({\n position,\n classNames,\n children,\n}: ThemedClassName<PropsWithChildren & { position?: ControlPosition }>) => {\n return <div className={mx('z-10 absolute overflow-hidden', controlPositions[position], classNames)}>{children}</div>;\n};\n\nconst CustomControl = ({ position, children }: PropsWithChildren<{ position: ControlPosition }>) => {\n return <div className={mx('z-10 absolute overflow-hidden', controlPositions[position])}>{children}</div>;\n};\n\ntype GlobeControlProps = { position?: ControlPosition } & Pick<ControlProps, 'onAction'>;\n\nexport const Globe = {\n Root: GlobeRoot,\n Canvas: GlobeCanvas,\n Zoom: ({ onAction, position = 'bottomleft', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n ),\n Action: ({ onAction, position = 'bottomright', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n ),\n Debug: GlobeDebug,\n Panel: GlobePanel,\n};\n\nexport type { GlobeRootProps, GlobeCanvasProps };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { createContext, type Dispatch, type PropsWithChildren, type SetStateAction, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { useControlledState } from '@dxos/react-ui';\n\nimport { type LatLng } from '../util';\n\n// TODO(burdon): Factor out common geometry types.\nexport type Size = { width: number; height: number };\nexport type Point = { x: number; y: number };\nexport type Vector = [number, number, number];\n\nexport type GlobeContextType = {\n size: Size;\n center: LatLng;\n scale: number;\n translation: Point;\n rotation: Vector;\n setCenter: Dispatch<SetStateAction<LatLng>>;\n setScale: Dispatch<SetStateAction<number>>;\n setTranslation: Dispatch<SetStateAction<Point>>;\n setRotation: Dispatch<SetStateAction<Vector>>;\n};\n\nconst GlobeContext = createContext<GlobeContextType>(undefined);\n\nexport type GlobeContextProviderProps = PropsWithChildren<\n Partial<Pick<GlobeContextType, 'size' | 'center' | 'scale' | 'translation' | 'rotation'>>\n>;\n\nexport const GlobeContextProvider = ({\n children,\n size,\n center: _center,\n scale: _scale,\n translation: _translation,\n rotation: _rotation,\n}: GlobeContextProviderProps) => {\n const [center, setCenter] = useControlledState(_center);\n const [scale, setScale] = useControlledState(_scale);\n const [translation, setTranslation] = useControlledState<Point>(_translation);\n const [rotation, setRotation] = useControlledState<Vector>(_rotation);\n\n return (\n <GlobeContext.Provider\n value={{ size, center, scale, translation, rotation, setCenter, setScale, setTranslation, setRotation }}\n >\n {children}\n </GlobeContext.Provider>\n );\n};\n\nexport const useGlobeContext = () => {\n return useContext(GlobeContext) ?? raise(new Error('Missing GlobeContext'));\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { useEffect } from 'react';\n\nimport { type GlobeController } from '../components';\nimport { geoInertiaDrag } from '../util';\n\nexport type GlobeDragEvent = {\n type: 'start' | 'move' | 'end';\n controller: GlobeController;\n};\n\nexport type DragOptions = {\n disabled?: boolean;\n duration?: number;\n xAxis?: boolean; // TODO(burdon): Generalize.\n onUpdate?: (event: GlobeDragEvent) => void;\n};\n\n/**\n * Allows user to drag globe.\n */\nexport const useDrag = (controller?: GlobeController | null, options: DragOptions = {}) => {\n useEffect(() => {\n const canvas = controller?.canvas;\n if (!canvas || options.disabled) {\n return;\n }\n\n geoInertiaDrag(\n d3.select(canvas),\n () => {\n controller.setRotation(controller.projection.rotate());\n options.onUpdate?.({ type: 'move', controller });\n },\n controller.projection,\n {\n xAxis: options.xAxis,\n time: 3_000,\n start: () => options.onUpdate?.({ type: 'start', controller }),\n finish: () => options.onUpdate?.({ type: 'end', controller }),\n },\n );\n\n // TODO(burdon): Cancel drag timer.\n return () => {\n cancelDrag(d3.select(canvas));\n };\n }, [controller, JSON.stringify(options)]);\n};\n\nconst cancelDrag = (node) => node.on('.drag', null);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nconst debug = false;\n\nexport const timer = <T = void>(cb: () => T): T => {\n const start = Date.now();\n const data = cb();\n const t = Date.now() - start / 1_000;\n if (debug) {\n // eslint-disable-next-line no-console\n console.log({ t, data });\n }\n\n return data;\n};\n", "//\n// Copyright 2017 Philippe Rivière\n// Copyright 2024 DXOS.org\n// https://github.com/Fil/d3-inertia\n//\n\nimport * as d3 from 'd3';\nimport versor from 'versor';\n\nexport const restrictAxis =\n (axis: boolean[]) =>\n (original: number[], current: number[]): number[] =>\n current.map((d, i) => (axis[i] ? d : original[i]));\n\n/**\n * Applies a drag handler to the specified target element.\n */\n// TODO(burdon): Define type.\nexport const geoInertiaDrag = (target, render, projection, options) => {\n if (!options) {\n options = {};\n }\n\n // Target can be an element, a selector, a function, or a selection\n // but in case of a selection we make sure to reselect it with d3-selection.\n if (target.node) {\n target = target.node();\n }\n target = d3.select(target);\n\n // Complete params: (projection, render, startDrag, dragging, endDrag).\n const inertia = geoInertiaDragHelper({\n projection,\n render: (rotation) => {\n projection.rotate(rotation);\n render && render();\n },\n axis: restrictAxis(options.xAxis ? [true, false, false] : [true, true, true]),\n start: options.start,\n move: options.move,\n end: options.end,\n stop: options.stop,\n finish: options.finish,\n time: options.time,\n hold: options.hold,\n });\n\n target.call(d3.drag().on('start', inertia.start).on('drag', inertia.move).on('end', inertia.end));\n return inertia;\n};\n\n/**\n * A versor is a compact way to describe a rotation in 3D space.\n * It consists of four components [𝑤,x,y,z], where:\n * 𝑤 is a scalar representing the angle of rotation.\n * x, y, z are the vector components, representing the axis of rotation.\n */\nconst geoInertiaDragHelper = (opt) => {\n const projection = opt.projection;\n\n let v0; // Mouse position in Cartesian coordinates at start of drag gesture.\n let r0; // Projection rotation as Euler angles at start.\n let q0; // Projection rotation as versor at start.\n let v10; // Mouse position in Cartesian coordinates just before end of drag gesture.\n let v11; // Mouse position in Cartesian coordinates at end.\n let q10; // Projection rotation as versor at end.\n\n const inertia = inertiaHelper({\n axis: opt.axis,\n\n start: () => {\n v0 = versor.cartesian(projection.invert(inertia.position));\n r0 = projection.rotate();\n q0 = versor(r0);\n opt.start && opt.start();\n },\n\n move: () => {\n const inv = projection.rotate(r0).invert(inertia.position);\n if (isNaN(inv[0])) {\n return;\n }\n const v1 = versor.cartesian(inv);\n const q1 = versor.multiply(q0, versor.delta(v0, v1));\n const r1 = versor.rotation(q1);\n const r2 = opt.axis(r0, r1);\n opt.render(r2);\n opt.move && opt.move();\n },\n\n end: () => {\n // Velocity.\n v10 = versor.cartesian(projection.invert(inertia.position.map((d, i) => d - inertia.velocity[i] / 1_000)));\n q10 = versor(projection.rotate());\n v11 = versor.cartesian(projection.invert(inertia.position));\n opt.end && opt.end();\n },\n\n stop: opt.stop,\n\n finish: opt.finish,\n\n render: (t) => {\n const r1 = versor.rotation(versor.multiply(q10, versor.delta(v10, v11, t * 1_000)));\n const r2 = opt.axis(r0, r1);\n opt.render && opt.render(r2);\n },\n\n time: opt.time,\n });\n\n return inertia;\n};\n\nfunction inertiaHelper(opt) {\n const A = opt.time || 5_000; // Reference time in ms.\n const limit = 1.0001;\n const B = -Math.log(1 - 1 / limit);\n const inertia = {\n position: [0, 0],\n velocity: [0, 0], // Velocity in pixels/s.\n timer: d3.timer(() => {}),\n time: 0,\n t: 0,\n\n start: function (ev) {\n const position = [ev.x, ev.y];\n inertia.position = position;\n inertia.velocity = [0, 0];\n inertia.timer.stop();\n this.classList.remove('inertia');\n this.classList.add('dragging');\n opt.start && opt.start.call(this, position);\n },\n\n move: function (ev) {\n const position = [ev.x, ev.y];\n\n const time = performance.now();\n const deltaTime = time - inertia.time;\n const decay = 1 - Math.exp(-deltaTime / 1_000);\n inertia.velocity = inertia.velocity.map((d, i) => {\n const deltaPos = position[i] - inertia.position[i];\n const deltaTime = time - inertia.time;\n return (1_000 * (1 - decay) * deltaPos) / deltaTime + d * decay;\n });\n\n // Clamp velocity axis.\n inertia.velocity = opt.axis([0, 0], inertia.velocity);\n\n inertia.time = time;\n inertia.position = position;\n opt.move && opt.move.call(this, position);\n },\n\n end: function (ev) {\n this.classList.remove('dragging', 'inertia');\n\n const v = inertia.velocity;\n if (v[0] * v[0] + v[1] * v[1] < 100) {\n inertia.timer.stop();\n return opt.stop && opt.stop();\n }\n\n const time = performance.now();\n const deltaTime = time - inertia.time;\n\n if (opt.hold === undefined) {\n opt.hold = 100;\n } // Default flick->drag threshold time (0 disables inertia).\n\n if (deltaTime >= opt.hold) {\n inertia.timer.stop();\n return opt.stop && opt.stop();\n }\n\n this.classList.add('inertia');\n opt.end && opt.end();\n\n const self = this;\n inertia.timer.restart((e) => {\n inertia.t = limit * (1 - Math.exp((-B * e) / A));\n opt.render && opt.render(inertia.t);\n if (inertia.t > 1) {\n inertia.timer.stop();\n self.classList.remove('inertia');\n inertia.velocity = [0, 0];\n inertia.t = 1;\n opt.finish && opt.finish();\n }\n });\n },\n };\n\n inertia.timer.stop();\n return inertia;\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type GeoGeometryObjects } from 'd3';\nimport { type Point, type Polygon, type Position } from 'geojson';\n\nimport type { Vector } from '../hooks';\n\nexport type LatLng = { lat: number; lng: number };\n\n// TODO(burdon): Clean-up.\n\nexport const positionToRotation = ([lng, lat]: [number, number], tilt = 0): Vector => [-lng, tilt - lat, 0];\n\nexport const geoToPosition = ({ lat, lng }: LatLng): [number, number] => [lng, lat];\n\nexport const geoPoint = (point: LatLng): Point => ({ type: 'Point', coordinates: geoToPosition(point) });\n\n// https://github.com/d3/d3-geo#geoCircle\nexport const geoCircle = ({ lat, lng }: LatLng, radius: number): Polygon =>\n d3.geoCircle().radius(radius).center([lng, lat])();\n\nexport const geoLine = (p1: LatLng, p2: LatLng): GeoGeometryObjects => ({\n type: 'LineString',\n coordinates: [\n [p1.lng, p1.lat],\n [p2.lng, p2.lat],\n ],\n});\n\nexport const closestPoint = (points: Position[], target: Position): Position | null => {\n if (points.length === 0) {\n return target;\n }\n\n let closestPoint = points[0];\n let minDistance = getDistance(points[0], target);\n\n for (const point of points) {\n const distance = getDistance(point, target);\n if (distance < minDistance) {\n minDistance = distance;\n closestPoint = point;\n }\n }\n\n return closestPoint;\n};\n\nexport const getDistance = (point1: Position, point2: Position): number => {\n const dx = point1[0] - point2[0];\n const dy = point1[1] - point2[1];\n return Math.sqrt(dx * dx + dy * dy);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type GeoPath, type GeoPermissibleObjects } from 'd3';\nimport * as topojson from 'topojson-client';\nimport { type Topology } from 'topojson-specification';\n\nimport { type LatLng, geoLine, geoPoint } from './path';\n\nexport type Styles = Record<string, any>;\n\nexport type Style =\n | 'background'\n | 'water'\n | 'graticule'\n | 'land'\n | 'border'\n | 'dots'\n | 'point'\n | 'line'\n | 'cursor'\n | 'arc';\n\nexport type StyleSet = Partial<Record<Style, Styles>>;\n\nexport type Features = {\n points?: LatLng[];\n lines?: { source: LatLng; target: LatLng }[];\n};\n\nexport type Layer = {\n styles: Styles;\n path: GeoPermissibleObjects;\n};\n\n/**\n * Create rendering layers.\n */\nexport const createLayers = (topology: Topology, features: Features, styles: StyleSet): Layer[] => {\n const layers: Layer[] = [];\n\n if (styles.water) {\n layers.push({\n styles: styles.water,\n path: {\n type: 'Sphere',\n },\n });\n }\n\n if (styles.graticule) {\n layers.push({\n styles: styles.graticule,\n path: d3.geoGraticule().step([6, 6])(),\n });\n }\n\n //\n // Topology.\n //\n\n if (topology) {\n if (topology.objects.land && styles.land) {\n layers.push({\n styles: styles.land,\n path: topojson.feature(topology, topology.objects.land),\n });\n }\n\n if (topology.objects.countries && styles.border) {\n layers.push({\n styles: styles.border,\n path: topojson.mesh(topology, topology.objects.countries, (a: any, b: any) => a !== b),\n });\n }\n\n if (topology.objects.dots && styles.dots) {\n layers.push({\n styles: styles.dots,\n path: topology.objects.dots as any, // TODO(burdon): Type.\n });\n }\n }\n\n //\n // Features.\n //\n\n if (features) {\n const { points, lines } = features;\n\n if (points && styles.point) {\n layers.push({\n styles: styles.point,\n path: {\n type: 'GeometryCollection',\n geometries: points.map((point) => geoPoint(point)),\n },\n });\n }\n\n if (lines && styles.line) {\n layers.push({\n styles: styles.line,\n path: {\n type: 'GeometryCollection',\n geometries: lines.map(({ source, target }) => geoLine(source, target)),\n },\n });\n }\n }\n\n return layers;\n};\n\n/**\n * Render layers created above.\n */\nexport const renderLayers = (generator: GeoPath, layers: Layer[] = [], scale: number, styles: StyleSet) => {\n const context: CanvasRenderingContext2D = generator.context();\n const {\n canvas: { width, height },\n } = context;\n context.reset();\n\n // Clear background.\n if (styles.background) {\n context.fillStyle = styles.background.fillStyle;\n context.fillRect(0, 0, width, height);\n } else {\n context.clearRect(0, 0, width, height);\n }\n\n // Render features.\n // https://github.com/d3/d3-geo#_path\n layers.forEach(({ path, styles }) => {\n context.save();\n let fill = false;\n let stroke = false;\n if (styles) {\n Object.entries(styles).forEach(([key, value]) => {\n if (key === 'pointRadius') {\n generator.pointRadius(value * scale);\n } else {\n context[key] = value;\n fill ||= key === 'fillStyle';\n stroke ||= key === 'strokeStyle';\n }\n });\n }\n\n context.beginPath();\n\n generator(path);\n fill && context.fill();\n stroke && context.stroke();\n context.restore();\n });\n\n return context;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type GlobeController, type ControlProps } from '../components';\n\nexport const useGlobeZoomHandler = (controller: GlobeController | null | undefined): ControlProps['onAction'] => {\n return useCallback<ControlProps['onAction']>(\n (event) => {\n if (!controller) {\n return;\n }\n\n switch (event) {\n case 'zoom-in': {\n controller.setScale((scale) => scale * 1.1);\n break;\n }\n case 'zoom-out': {\n controller.setScale((scale) => scale * 0.9);\n break;\n }\n }\n },\n [controller],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type MapController, type ControlProps } from '../components';\n\nexport const useMapZoomHandler = (controller: MapController | null | undefined): ControlProps['onAction'] => {\n return useCallback<ControlProps['onAction']>(\n (event) => {\n if (!controller) {\n return;\n }\n\n switch (event) {\n case 'zoom-in': {\n controller.setZoom((scale) => scale + 1);\n break;\n }\n case 'zoom-out': {\n controller.setZoom((scale) => scale - 1);\n break;\n }\n }\n },\n [controller],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type Timer } from 'd3';\nimport { useEffect, useState } from 'react';\n\nimport { type Vector } from './context';\nimport { type GlobeController } from '../components';\n\nexport type SpinnerOptions = {\n disabled?: boolean;\n delta?: Vector;\n};\n\n/**\n * Rotates globe.\n */\nexport const useSpinner = (controller?: GlobeController | null, options: SpinnerOptions = {}) => {\n const [running, setRunning] = useState(false);\n useEffect(() => {\n let timer: Timer | undefined;\n\n const start = () => {\n const delta: Vector = options.delta ?? [0.001, 0, 0];\n\n let t = 0;\n let lastRotation = controller.projection.rotate();\n timer = d3.timer((elapsed) => {\n const dt = elapsed - t;\n t = elapsed;\n\n const rotation: Vector = [\n lastRotation[0] + delta[0] * dt,\n lastRotation[1] + delta[1] * dt,\n lastRotation[2] + delta[2] * dt,\n ];\n\n lastRotation = rotation;\n controller.setRotation(rotation);\n });\n };\n\n const stop = () => {\n if (timer) {\n timer.stop();\n timer = undefined;\n }\n };\n\n if (controller && running) {\n start();\n } else {\n stop();\n }\n\n return () => stop();\n }, [controller, running]);\n\n return [\n () => {\n if (!options.disabled) {\n setRunning(true);\n }\n },\n () => setRunning(false),\n ];\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type Dispatch, type SetStateAction, useEffect, useState } from 'react';\nimport versor from 'versor';\n\nimport { log } from '@dxos/log';\n\nimport type { GlobeController } from '../components';\nimport { geoToPosition, type LatLng, positionToRotation, type StyleSet } from '../util';\n\nconst TRANSITION_NAME = 'globe-tour';\n\nconst defaultDuration = 1_500;\n\nexport type TourOptions = {\n running?: boolean;\n disabled?: boolean;\n duration?: number;\n loop?: boolean;\n tilt?: number;\n autoRotate?: boolean;\n styles?: StyleSet;\n};\n\n/**\n * Iterates between points.\n * Inspired by: https://observablehq.com/@mbostock/top-100-cities\n */\nexport const useTour = (\n controller?: GlobeController | null,\n points?: LatLng[],\n options: TourOptions = {},\n): [boolean, Dispatch<SetStateAction<boolean>>] => {\n const selection = d3.selection();\n const [running, setRunning] = useState(options.running ?? false);\n useEffect(() => {\n if (!running) {\n selection.interrupt(TRANSITION_NAME);\n return;\n }\n\n let t: ReturnType<typeof setTimeout>;\n if (controller && running) {\n t = setTimeout(async () => {\n const { canvas, projection, setRotation } = controller;\n const context = canvas.getContext('2d', { alpha: false });\n const path = d3.geoPath(projection, context).pointRadius(2);\n\n const tilt = options.tilt ?? 0;\n let last: LatLng;\n try {\n const p = [...points];\n if (options.loop) {\n p.push(p[0]);\n }\n\n for (const next of p) {\n if (!running) {\n break;\n }\n\n // Points.\n const p1 = last ? geoToPosition(last) : undefined;\n const p2 = geoToPosition(next);\n const ip = d3.geoInterpolate(p1 || p2, p2);\n const distance = d3.geoDistance(p1 || p2, p2);\n\n // Rotation.\n const r1 = p1 ? positionToRotation(p1, tilt) : controller.projection.rotate();\n const r2 = positionToRotation(p2, tilt);\n const iv = versor.interpolate(r1, r2);\n\n const transition = selection\n .transition(TRANSITION_NAME)\n .duration(Math.max(options.duration ?? defaultDuration, distance * 2_000))\n .tween('render', () => (t) => {\n const t1 = Math.max(0, Math.min(1, t * 2 - 1));\n const t2 = Math.min(1, t * 2);\n\n context.save();\n {\n context.beginPath();\n context.strokeStyle = options?.styles?.arc?.strokeStyle ?? 'yellow';\n context.lineWidth = (options?.styles?.arc?.lineWidth ?? 1.5) * (controller?.scale ?? 1);\n context.setLineDash(options?.styles?.arc?.lineDash ?? []);\n path({ type: 'LineString', coordinates: [ip(t1), ip(t2)] });\n context.stroke();\n\n context.beginPath();\n context.fillStyle = options?.styles?.cursor?.fillStyle ?? 'orange';\n path.pointRadius((options?.styles?.cursor?.pointRadius ?? 2) * (controller?.scale ?? 1));\n path({ type: 'Point', coordinates: ip(t2) });\n context.fill();\n }\n context.restore();\n\n // TODO(burdon): This has to come after rendering above. Add to features to correct order?\n if (options.autoRotate) {\n projection.rotate(iv(t));\n setRotation(projection.rotate());\n }\n });\n\n // Throws if interrupted.\n await transition.end();\n last = next;\n }\n } catch (err) {\n log.catch(err);\n } finally {\n setRunning(false);\n }\n });\n\n return () => {\n clearTimeout(t);\n selection.interrupt(TRANSITION_NAME);\n };\n }\n }, [controller, running, JSON.stringify(options)]);\n\n return [running, setRunning];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ControlPosition } from 'leaflet';\nimport React from 'react';\n\nimport { IconButton, type ThemedClassName, Toolbar } from '@dxos/react-ui';\n\nexport type ControlAction = 'toggle' | 'start' | 'zoom-in' | 'zoom-out';\n\nexport type ControlProps = ThemedClassName<{\n onAction?: (action: ControlAction) => void;\n}>;\n\nexport const controlPositions: Record<ControlPosition, string> = {\n topleft: 'top-2 left-2',\n topright: 'top-2 right-2',\n bottomleft: 'bottom-2 left-2',\n bottomright: 'bottom-2 right-2',\n};\n\nexport const ZoomControls = ({ classNames, onAction }: ControlProps) => {\n return (\n <Toolbar.Root classNames={['gap-1', classNames]}>\n <IconButton\n //\n icon='ph--plus--regular'\n label='zoom in'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('zoom-in')}\n />\n <IconButton\n //\n icon='ph--minus--regular'\n label='zoom out'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('zoom-out')}\n />\n </Toolbar.Root>\n );\n};\n\nexport const ActionControls = ({ classNames, onAction }: ControlProps) => {\n return (\n <Toolbar.Root classNames={['gap-1', classNames]}>\n <IconButton\n //\n icon='ph--play--regular'\n label='start'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('start')}\n />\n <IconButton\n //\n icon='ph--globe-hemisphere-west--regular'\n label='toggle'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('toggle')}\n />\n </Toolbar.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// eslint-disable-next-line no-restricted-imports\nimport 'leaflet/dist/leaflet.css';\n\nimport L, { Control, DomEvent, DomUtil, latLngBounds, type ControlPosition, type LatLngExpression } from 'leaflet';\nimport { forwardRef, useEffect, useImperativeHandle, type PropsWithChildren } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport type { MapContainerProps } from 'react-leaflet';\nimport { MapContainer, Marker, Popup, TileLayer, useMap } from 'react-leaflet';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { debounce } from '@dxos/async';\nimport { ThemeProvider, Tooltip, type ThemedClassName } from '@dxos/react-ui';\nimport { defaultTx, mx } from '@dxos/react-ui-theme';\n\nimport { ActionControls, controlPositions, ZoomControls, type ControlProps } from '../Toolbar';\nimport { type MapCanvasProps } from '../types';\n\n// TODO(burdon): Explore plugins: https://www.npmjs.com/search?q=keywords%3Areact-leaflet-v4\n// TODO(burdon): react-leaflet v5 is not compatible with react 18.\n\nconst defaults = {\n // TODO(burdon): Guess location.\n center: { lat: 51, lng: 0 } as L.LatLngExpression,\n zoom: 4,\n};\n\n//\n// Root\n//\n\ntype MapRootProps = ThemedClassName<MapContainerProps>;\n\n// https://react-leaflet.js.org/docs/api-map\nconst MapRoot = ({ classNames, center = defaults.center, zoom = defaults.zoom, ...props }: MapRootProps) => {\n return (\n <MapContainer\n className={mx('relative flex w-full h-full grow bg-baseSurface', classNames)}\n attributionControl={false}\n // TODO(burdon): Only if attention.\n scrollWheelZoom={true}\n zoomControl={false}\n center={center}\n zoom={zoom}\n {...props}\n />\n );\n};\n\n//\n// Control\n//\n\n// TODO(burdon): Normalize with Globe.\ntype MapController = {\n setCenter: (center: LatLngExpression, zoom?: number) => void;\n setZoom: (cb: (zoom: number) => number) => void;\n};\n\nconst MapCanvas = forwardRef<MapController, MapCanvasProps>(({ markers, center, zoom, onChange }, forwardedRef) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const map = useMap();\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n setCenter: (center: LatLngExpression, zoom?: number) => {\n map.setView(center, zoom);\n },\n setZoom: (cb) => {\n map.setZoom(cb(map.getZoom()));\n },\n }),\n [map],\n );\n\n // Resize.\n useEffect(() => {\n if (width && height) {\n map.invalidateSize();\n }\n }, [width, height]);\n\n // Position.\n useEffect(() => {\n if (center) {\n map.setView(center, zoom);\n } else if (zoom !== undefined) {\n map.setZoom(zoom);\n }\n }, [center, zoom]);\n\n // Events.\n useEffect(() => {\n const handler = debounce(() => {\n onChange?.({ center: map.getCenter(), zoom: map.getZoom() });\n }, 100);\n map.on('move', handler);\n map.on('zoom', handler);\n return () => {\n map.off('move', handler);\n map.off('zoom', handler);\n };\n }, [map, onChange]);\n\n // Set the viewport around the markers, or show the whole world map if `markers` is empty.\n useEffect(() => {\n if (markers.length > 0) {\n const bounds = latLngBounds(markers.map((marker) => marker.location));\n map.fitBounds(bounds);\n } else {\n map.setView(defaults.center, defaults.zoom);\n }\n }, [markers]);\n\n return (\n <div ref={ref} className='flex w-full h-full overflow-hidden bg-baseSurface'>\n {/* Map tiles. */}\n <TileLayer\n className='dark:filter dark:grayscale dark:invert'\n url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'\n />\n\n {/* Markers. */}\n {markers?.map(({ id, title, location: { lat, lng } }) => {\n return (\n <Marker\n key={id}\n position={{ lat, lng }}\n icon={\n // TODO(burdon): Create custom icon from bundled assets.\n new L.Icon({\n iconUrl: 'https://dxos.network/marker-icon.png',\n iconRetinaUrl: 'https://dxos.network/marker-icon-2x.png',\n shadowUrl: 'https://dxos.network/marker-shadow.png',\n iconSize: [25, 41],\n iconAnchor: [12, 41],\n popupAnchor: [1, -34],\n shadowSize: [41, 41],\n })\n }\n >\n {title && <Popup>{title}</Popup>}\n </Marker>\n );\n })}\n </div>\n );\n});\n\n//\n// Controls\n// Integrates with Leaflet custom controls.\n//\n\nconst CustomControl = ({\n position,\n children,\n}: PropsWithChildren<{\n position: ControlPosition;\n}>) => {\n const map = useMap();\n\n useEffect(() => {\n const control = new Control({ position });\n control.onAdd = () => {\n const container = DomUtil.create('div', mx('!m-0', controlPositions[position]));\n DomEvent.disableClickPropagation(container);\n DomEvent.disableScrollPropagation(container);\n\n const root = createRoot(container);\n root.render(\n <ThemeProvider tx={defaultTx}>\n <Tooltip.Provider>{children}</Tooltip.Provider>\n </ThemeProvider>,\n );\n\n return container;\n };\n\n control.addTo(map);\n return () => {\n control.remove();\n };\n }, [map, position, children]);\n\n return null;\n};\n\ntype MapControlProps = { position?: ControlPosition } & Pick<ControlProps, 'onAction'>;\n\n//\n// Map\n//\n\nexport const Map = {\n Root: MapRoot,\n Canvas: MapCanvas,\n Zoom: ({ onAction, position = 'bottomleft', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n ),\n Action: ({ onAction, position = 'bottomright', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n ),\n};\n\nexport { type MapCanvasProps, type MapController };\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,YAAYA,SAAQ;AAGpB,OAAOC,UAELC,YACAC,aAAAA,YACAC,qBACAC,SACAC,QACAC,YAAAA,iBACK;AACP,SAASC,yBAAyB;AAGlC,SAA+CC,eAAeC,uBAAuB;AACrF,SAASC,UAAU;;;AChBnB,OAAOC,UAASC,eAA2EC,kBAAkB;AAE7G,SAASC,aAAa;AACtB,SAASC,0BAA0B;AAqBnC,IAAMC,eAAeC,8BAAgCC,MAAAA;AAM9C,IAAMC,uBAAuB,CAAC,EACnCC,UACAC,MACAC,QAAQC,SACRC,OAAOC,QACPC,aAAaC,cACbC,UAAUC,UAAS,MACO;AAC1B,QAAM,CAACP,QAAQQ,SAAAA,IAAaC,mBAAmBR,OAAAA;AAC/C,QAAM,CAACC,OAAOQ,QAAAA,IAAYD,mBAAmBN,MAAAA;AAC7C,QAAM,CAACC,aAAaO,cAAAA,IAAkBF,mBAA0BJ,YAAAA;AAChE,QAAM,CAACC,UAAUM,WAAAA,IAAeH,mBAA2BF,SAAAA;AAE3D,SACE,gBAAAM,OAAA,cAACnB,aAAaoB,UAAQ;IACpBC,OAAO;MAAEhB;MAAMC;MAAQE;MAAOE;MAAaE;MAAUE;MAAWE;MAAUC;MAAgBC;IAAY;KAErGd,QAAAA;AAGP;AAEO,IAAMkB,kBAAkB,MAAA;AAC7B,SAAOC,WAAWvB,YAAAA,KAAiBwB,MAAM,IAAIC,MAAM,sBAAA,CAAA;AACrD;;;ACtDA,YAAYC,SAAQ;AACpB,SAASC,iBAAiB;;;ACD1B,IAAMC,QAAQ;AAEP,IAAMC,QAAQ,CAAWC,OAAAA;AAC9B,QAAMC,QAAQC,KAAKC,IAAG;AACt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Detector", "useDynamicRef", "useThemeContext", "mx", "React", "createContext", "useContext", "raise", "useControlledState", "GlobeContext", "createContext", "undefined", "GlobeContextProvider", "children", "size", "center", "_center", "scale", "_scale", "translation", "_translation", "rotation", "_rotation", "setCenter", "useControlledState", "setScale", "setTranslation", "setRotation", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2018 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type GeoProjection } from 'd3';\nimport { type ControlPosition } from 'leaflet';\nimport React, {\n type PropsWithChildren,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\nimport { type Topology } from 'topojson-specification';\n\nimport { type ThemedClassName, type ThemeMode, useDynamicRef, useThemeContext } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport {\n GlobeContextProvider,\n type GlobeContextProviderProps,\n type GlobeContextType,\n useGlobeContext,\n} from '../../hooks';\nimport {\n type Features,\n type StyleSet,\n createLayers,\n geoToPosition,\n positionToRotation,\n renderLayers,\n timer,\n} from '../../util';\nimport { ZoomControls, ActionControls, type ControlProps, controlPositions } from '../Toolbar';\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute\n */\nconst defaultStyles: Record<ThemeMode, StyleSet> = {\n light: {\n background: {\n fillStyle: '#EEE',\n },\n\n water: {\n fillStyle: '#555',\n },\n\n land: {\n fillStyle: '#999',\n },\n\n line: {\n strokeStyle: 'darkred',\n },\n\n point: {\n fillStyle: '#111111',\n strokeStyle: '#111111',\n strokeWidth: 1,\n pointRadius: 0.5,\n },\n },\n dark: {\n background: {\n fillStyle: '#111111',\n },\n\n water: {\n fillStyle: '#123E6A',\n },\n\n land: {\n fillStyle: '#032153',\n },\n\n line: {\n strokeStyle: '#111111',\n },\n\n point: {\n fillStyle: '#111111',\n strokeStyle: '#111111',\n strokeWidth: 1,\n pointRadius: 0.5,\n },\n },\n};\n\nexport type GlobeController = {\n canvas: HTMLCanvasElement;\n projection: GeoProjection;\n} & Pick<GlobeContextType, 'scale' | 'translation' | 'rotation' | 'setScale' | 'setTranslation' | 'setRotation'>;\n\nexport type ProjectionType = 'orthographic' | 'mercator' | 'transverse-mercator';\n\nconst projectionMap: Record<ProjectionType, () => GeoProjection> = {\n orthographic: d3.geoOrthographic,\n mercator: d3.geoMercator,\n 'transverse-mercator': d3.geoTransverseMercator,\n};\n\nconst getProjection = (type: GlobeCanvasProps['projection'] = 'orthographic'): GeoProjection => {\n if (typeof type === 'string') {\n const constructor = projectionMap[type] ?? d3.geoOrthographic;\n return constructor();\n }\n\n return type ?? d3.geoOrthographic();\n};\n\n//\n// Root\n//\n\ntype GlobeRootProps = PropsWithChildren<ThemedClassName<GlobeContextProviderProps>>;\n\nconst GlobeRoot = ({ classNames, children, ...props }: GlobeRootProps) => {\n const { ref, width, height } = useResizeDetector<HTMLDivElement>();\n return (\n <div ref={ref} className={mx('relative flex grow overflow-hidden', classNames)}>\n <GlobeContextProvider size={{ width, height }} {...props}>\n {children}\n </GlobeContextProvider>\n </div>\n );\n};\n\n//\n// Canvas\n//\n\ntype GlobeCanvasProps = {\n projection?: ProjectionType | GeoProjection;\n topology?: Topology;\n features?: Features;\n styles?: StyleSet;\n};\n\n/**\n * Basic globe renderer.\n * https://github.com/topojson/world-atlas\n */\nconst GlobeCanvas = forwardRef<GlobeController, GlobeCanvasProps>(\n ({ projection: _projection, topology, features, styles: _styles }, forwardRef) => {\n const { themeMode } = useThemeContext();\n const styles = useMemo(() => _styles ?? defaultStyles[themeMode], [_styles, themeMode]);\n\n // Canvas.\n const [canvas, setCanvas] = useState<HTMLCanvasElement>(null);\n const canvasRef = (canvas: HTMLCanvasElement) => setCanvas(canvas);\n\n // Projection.\n const projection = useMemo(() => getProjection(_projection), [_projection]);\n\n // Layers.\n // TODO(burdon): Generate on the fly based on what is visible.\n const layers = useMemo(() => {\n return timer(() => createLayers(topology as Topology, features, styles));\n }, [topology, features, styles]);\n\n // State.\n const { size, center, scale, translation, rotation, setCenter, setScale, setTranslation, setRotation } =\n useGlobeContext();\n\n const scaleRef = useDynamicRef(scale);\n\n // Update rotation.\n useEffect(() => {\n if (center) {\n setScale(1);\n setRotation(positionToRotation(geoToPosition(center)));\n }\n }, [center]);\n\n // External controller.\n const zooming = useRef(false);\n useImperativeHandle<GlobeController, GlobeController>(\n forwardRef,\n () => {\n return {\n canvas,\n projection,\n center,\n get scale() {\n return scaleRef.current;\n },\n translation,\n rotation,\n setCenter,\n setScale: (s) => {\n if (typeof s === 'function') {\n const is = d3.interpolateNumber(scaleRef.current, s(scaleRef.current));\n // Stop easing if already zooming.\n d3.transition()\n .ease(zooming.current ? d3.easeLinear : d3.easeSinOut)\n .duration(200)\n .tween('scale', () => (t) => setScale(is(t)))\n .on('end', () => {\n zooming.current = false;\n });\n } else {\n setScale(s);\n }\n },\n setTranslation,\n setRotation,\n };\n },\n [canvas],\n );\n\n // https://d3js.org/d3-geo/path#geoPath\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n const generator = useMemo(\n () => canvas && projection && d3.geoPath(projection, canvas.getContext('2d', { alpha: false })),\n [canvas, projection],\n );\n\n // Render on change.\n useEffect(() => {\n if (canvas && projection) {\n timer(() => {\n // https://d3js.org/d3-geo/projection\n projection\n .scale((Math.min(size.width, size.height) / 2) * scale)\n .translate([size.width / 2 + (translation?.x ?? 0), size.height / 2 + (translation?.y ?? 0)])\n .rotate(rotation ?? [0, 0, 0]);\n\n renderLayers(generator, layers, scale, styles);\n });\n }\n }, [generator, size, scale, translation, rotation, layers]);\n\n if (!size.width || !size.height) {\n return null;\n }\n\n return <canvas ref={canvasRef} width={size.width} height={size.height} />;\n },\n);\n\nconst GlobeDebug = ({ position = 'topleft' }: { position?: ControlPosition }) => {\n const { size, scale, translation, rotation } = useGlobeContext();\n return (\n <div\n className={mx(\n 'z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded',\n controlPositions[position],\n )}\n >\n <pre className='font-mono text-xs text-green-700'>\n {JSON.stringify({ size, scale, translation, rotation }, null, 2)}\n </pre>\n </div>\n );\n};\n\nconst GlobePanel = ({\n position,\n classNames,\n children,\n}: ThemedClassName<PropsWithChildren & { position?: ControlPosition }>) => {\n return <div className={mx('z-10 absolute overflow-hidden', controlPositions[position], classNames)}>{children}</div>;\n};\n\nconst CustomControl = ({ position, children }: PropsWithChildren<{ position: ControlPosition }>) => {\n return <div className={mx('z-10 absolute overflow-hidden', controlPositions[position])}>{children}</div>;\n};\n\ntype GlobeControlProps = { position?: ControlPosition } & Pick<ControlProps, 'onAction'>;\n\nexport const Globe = {\n Root: GlobeRoot,\n Canvas: GlobeCanvas,\n Zoom: ({ onAction, position = 'bottomleft', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n ),\n Action: ({ onAction, position = 'bottomright', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n ),\n Debug: GlobeDebug,\n Panel: GlobePanel,\n};\n\nexport type { GlobeRootProps, GlobeCanvasProps };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { createContext, type Dispatch, type PropsWithChildren, type SetStateAction, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { useControlledState } from '@dxos/react-ui';\n\nimport { type LatLng } from '../util';\n\n// TODO(burdon): Factor out common geometry types.\nexport type Size = { width: number; height: number };\nexport type Point = { x: number; y: number };\nexport type Vector = [number, number, number];\n\nexport type GlobeContextType = {\n size: Size;\n center: LatLng;\n scale: number;\n translation: Point;\n rotation: Vector;\n setCenter: Dispatch<SetStateAction<LatLng>>;\n setScale: Dispatch<SetStateAction<number>>;\n setTranslation: Dispatch<SetStateAction<Point>>;\n setRotation: Dispatch<SetStateAction<Vector>>;\n};\n\nconst GlobeContext = createContext<GlobeContextType>(undefined);\n\nexport type GlobeContextProviderProps = PropsWithChildren<\n Partial<Pick<GlobeContextType, 'size' | 'center' | 'scale' | 'translation' | 'rotation'>>\n>;\n\nexport const GlobeContextProvider = ({\n children,\n size,\n center: _center,\n scale: _scale,\n translation: _translation,\n rotation: _rotation,\n}: GlobeContextProviderProps) => {\n const [center, setCenter] = useControlledState(_center);\n const [scale, setScale] = useControlledState(_scale);\n const [translation, setTranslation] = useControlledState<Point>(_translation);\n const [rotation, setRotation] = useControlledState<Vector>(_rotation);\n\n return (\n <GlobeContext.Provider\n value={{ size, center, scale, translation, rotation, setCenter, setScale, setTranslation, setRotation }}\n >\n {children}\n </GlobeContext.Provider>\n );\n};\n\nexport const useGlobeContext = () => {\n return useContext(GlobeContext) ?? raise(new Error('Missing GlobeContext'));\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { useEffect } from 'react';\n\nimport { type GlobeController } from '../components';\nimport { geoInertiaDrag } from '../util';\n\nexport type GlobeDragEvent = {\n type: 'start' | 'move' | 'end';\n controller: GlobeController;\n};\n\nexport type DragOptions = {\n disabled?: boolean;\n duration?: number;\n xAxis?: boolean; // TODO(burdon): Generalize.\n onUpdate?: (event: GlobeDragEvent) => void;\n};\n\n/**\n * Allows user to drag globe.\n */\nexport const useDrag = (controller?: GlobeController | null, options: DragOptions = {}) => {\n useEffect(() => {\n const canvas = controller?.canvas;\n if (!canvas || options.disabled) {\n return;\n }\n\n geoInertiaDrag(\n d3.select(canvas),\n () => {\n controller.setRotation(controller.projection.rotate());\n options.onUpdate?.({ type: 'move', controller });\n },\n controller.projection,\n {\n xAxis: options.xAxis,\n time: 3_000,\n start: () => options.onUpdate?.({ type: 'start', controller }),\n finish: () => options.onUpdate?.({ type: 'end', controller }),\n },\n );\n\n // TODO(burdon): Cancel drag timer.\n return () => {\n cancelDrag(d3.select(canvas));\n };\n }, [controller, JSON.stringify(options)]);\n};\n\nconst cancelDrag = (node) => node.on('.drag', null);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nconst debug = false;\n\nexport const timer = <T = void>(cb: () => T): T => {\n const start = Date.now();\n const data = cb();\n const t = Date.now() - start / 1_000;\n if (debug) {\n // eslint-disable-next-line no-console\n console.log({ t, data });\n }\n\n return data;\n};\n", "//\n// Copyright 2017 Philippe Rivière\n// Copyright 2024 DXOS.org\n// https://github.com/Fil/d3-inertia\n//\n\nimport * as d3 from 'd3';\nimport versor from 'versor';\n\nexport const restrictAxis =\n (axis: boolean[]) =>\n (original: number[], current: number[]): number[] =>\n current.map((d, i) => (axis[i] ? d : original[i]));\n\n/**\n * Applies a drag handler to the specified target element.\n */\n// TODO(burdon): Define type.\nexport const geoInertiaDrag = (target, render, projection, options) => {\n if (!options) {\n options = {};\n }\n\n // Target can be an element, a selector, a function, or a selection\n // but in case of a selection we make sure to reselect it with d3-selection.\n if (target.node) {\n target = target.node();\n }\n target = d3.select(target);\n\n // Complete params: (projection, render, startDrag, dragging, endDrag).\n const inertia = geoInertiaDragHelper({\n projection,\n render: (rotation) => {\n projection.rotate(rotation);\n render && render();\n },\n axis: restrictAxis(options.xAxis ? [true, false, false] : [true, true, true]),\n start: options.start,\n move: options.move,\n end: options.end,\n stop: options.stop,\n finish: options.finish,\n time: options.time,\n hold: options.hold,\n });\n\n target.call(d3.drag().on('start', inertia.start).on('drag', inertia.move).on('end', inertia.end));\n return inertia;\n};\n\n/**\n * A versor is a compact way to describe a rotation in 3D space.\n * It consists of four components [𝑤,x,y,z], where:\n * 𝑤 is a scalar representing the angle of rotation.\n * x, y, z are the vector components, representing the axis of rotation.\n */\nconst geoInertiaDragHelper = (opt) => {\n const projection = opt.projection;\n\n let v0; // Mouse position in Cartesian coordinates at start of drag gesture.\n let r0; // Projection rotation as Euler angles at start.\n let q0; // Projection rotation as versor at start.\n let v10; // Mouse position in Cartesian coordinates just before end of drag gesture.\n let v11; // Mouse position in Cartesian coordinates at end.\n let q10; // Projection rotation as versor at end.\n\n const inertia = inertiaHelper({\n axis: opt.axis,\n\n start: () => {\n v0 = versor.cartesian(projection.invert(inertia.position));\n r0 = projection.rotate();\n q0 = versor(r0);\n opt.start && opt.start();\n },\n\n move: () => {\n const inv = projection.rotate(r0).invert(inertia.position);\n if (isNaN(inv[0])) {\n return;\n }\n const v1 = versor.cartesian(inv);\n const q1 = versor.multiply(q0, versor.delta(v0, v1));\n const r1 = versor.rotation(q1);\n const r2 = opt.axis(r0, r1);\n opt.render(r2);\n opt.move && opt.move();\n },\n\n end: () => {\n // Velocity.\n v10 = versor.cartesian(projection.invert(inertia.position.map((d, i) => d - inertia.velocity[i] / 1_000)));\n q10 = versor(projection.rotate());\n v11 = versor.cartesian(projection.invert(inertia.position));\n opt.end && opt.end();\n },\n\n stop: opt.stop,\n\n finish: opt.finish,\n\n render: (t) => {\n const r1 = versor.rotation(versor.multiply(q10, versor.delta(v10, v11, t * 1_000)));\n const r2 = opt.axis(r0, r1);\n opt.render && opt.render(r2);\n },\n\n time: opt.time,\n });\n\n return inertia;\n};\n\nfunction inertiaHelper(opt) {\n const A = opt.time || 5_000; // Reference time in ms.\n const limit = 1.0001;\n const B = -Math.log(1 - 1 / limit);\n const inertia = {\n position: [0, 0],\n velocity: [0, 0], // Velocity in pixels/s.\n timer: d3.timer(() => {}),\n time: 0,\n t: 0,\n\n start: function (ev) {\n const position = [ev.x, ev.y];\n inertia.position = position;\n inertia.velocity = [0, 0];\n inertia.timer.stop();\n this.classList.remove('inertia');\n this.classList.add('dragging');\n opt.start && opt.start.call(this, position);\n },\n\n move: function (ev) {\n const position = [ev.x, ev.y];\n\n const time = performance.now();\n const deltaTime = time - inertia.time;\n const decay = 1 - Math.exp(-deltaTime / 1_000);\n inertia.velocity = inertia.velocity.map((d, i) => {\n const deltaPos = position[i] - inertia.position[i];\n const deltaTime = time - inertia.time;\n return (1_000 * (1 - decay) * deltaPos) / deltaTime + d * decay;\n });\n\n // Clamp velocity axis.\n inertia.velocity = opt.axis([0, 0], inertia.velocity);\n\n inertia.time = time;\n inertia.position = position;\n opt.move && opt.move.call(this, position);\n },\n\n end: function (ev) {\n this.classList.remove('dragging', 'inertia');\n\n const v = inertia.velocity;\n if (v[0] * v[0] + v[1] * v[1] < 100) {\n inertia.timer.stop();\n return opt.stop && opt.stop();\n }\n\n const time = performance.now();\n const deltaTime = time - inertia.time;\n\n if (opt.hold === undefined) {\n opt.hold = 100;\n } // Default flick->drag threshold time (0 disables inertia).\n\n if (deltaTime >= opt.hold) {\n inertia.timer.stop();\n return opt.stop && opt.stop();\n }\n\n this.classList.add('inertia');\n opt.end && opt.end();\n\n const self = this;\n inertia.timer.restart((e) => {\n inertia.t = limit * (1 - Math.exp((-B * e) / A));\n opt.render && opt.render(inertia.t);\n if (inertia.t > 1) {\n inertia.timer.stop();\n self.classList.remove('inertia');\n inertia.velocity = [0, 0];\n inertia.t = 1;\n opt.finish && opt.finish();\n }\n });\n },\n };\n\n inertia.timer.stop();\n return inertia;\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type GeoGeometryObjects } from 'd3';\nimport { type Point, type Polygon, type Position } from 'geojson';\n\nimport type { Vector } from '../hooks';\n\nexport type LatLng = { lat: number; lng: number };\n\n// TODO(burdon): Clean-up.\n\nexport const positionToRotation = ([lng, lat]: [number, number], tilt = 0): Vector => [-lng, tilt - lat, 0];\n\nexport const geoToPosition = ({ lat, lng }: LatLng): [number, number] => [lng, lat];\n\nexport const geoPoint = (point: LatLng): Point => ({ type: 'Point', coordinates: geoToPosition(point) });\n\n// https://github.com/d3/d3-geo#geoCircle\nexport const geoCircle = ({ lat, lng }: LatLng, radius: number): Polygon =>\n d3.geoCircle().radius(radius).center([lng, lat])();\n\nexport const geoLine = (p1: LatLng, p2: LatLng): GeoGeometryObjects => ({\n type: 'LineString',\n coordinates: [\n [p1.lng, p1.lat],\n [p2.lng, p2.lat],\n ],\n});\n\nexport const closestPoint = (points: Position[], target: Position): Position | null => {\n if (points.length === 0) {\n return target;\n }\n\n let closestPoint = points[0];\n let minDistance = getDistance(points[0], target);\n\n for (const point of points) {\n const distance = getDistance(point, target);\n if (distance < minDistance) {\n minDistance = distance;\n closestPoint = point;\n }\n }\n\n return closestPoint;\n};\n\nexport const getDistance = (point1: Position, point2: Position): number => {\n const dx = point1[0] - point2[0];\n const dy = point1[1] - point2[1];\n return Math.sqrt(dx * dx + dy * dy);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type GeoPath, type GeoPermissibleObjects } from 'd3';\nimport * as topojson from 'topojson-client';\nimport { type Topology } from 'topojson-specification';\n\nimport { type LatLng, geoLine, geoPoint } from './path';\n\nexport type Styles = Record<string, any>;\n\nexport type Style =\n | 'background'\n | 'water'\n | 'graticule'\n | 'land'\n | 'border'\n | 'dots'\n | 'point'\n | 'line'\n | 'cursor'\n | 'arc';\n\nexport type StyleSet = Partial<Record<Style, Styles>>;\n\nexport type Features = {\n points?: LatLng[];\n lines?: { source: LatLng; target: LatLng }[];\n};\n\nexport type Layer = {\n styles: Styles;\n path: GeoPermissibleObjects;\n};\n\n/**\n * Create rendering layers.\n */\nexport const createLayers = (topology: Topology, features: Features, styles: StyleSet): Layer[] => {\n const layers: Layer[] = [];\n\n if (styles.water) {\n layers.push({\n styles: styles.water,\n path: {\n type: 'Sphere',\n },\n });\n }\n\n if (styles.graticule) {\n layers.push({\n styles: styles.graticule,\n path: d3.geoGraticule().step([6, 6])(),\n });\n }\n\n //\n // Topology.\n //\n\n if (topology) {\n if (topology.objects.land && styles.land) {\n layers.push({\n styles: styles.land,\n path: topojson.feature(topology, topology.objects.land),\n });\n }\n\n if (topology.objects.countries && styles.border) {\n layers.push({\n styles: styles.border,\n path: topojson.mesh(topology, topology.objects.countries, (a: any, b: any) => a !== b),\n });\n }\n\n if (topology.objects.dots && styles.dots) {\n layers.push({\n styles: styles.dots,\n path: topology.objects.dots as any, // TODO(burdon): Type.\n });\n }\n }\n\n //\n // Features.\n //\n\n if (features) {\n const { points, lines } = features;\n\n if (points && styles.point) {\n layers.push({\n styles: styles.point,\n path: {\n type: 'GeometryCollection',\n geometries: points.map((point) => geoPoint(point)),\n },\n });\n }\n\n if (lines && styles.line) {\n layers.push({\n styles: styles.line,\n path: {\n type: 'GeometryCollection',\n geometries: lines.map(({ source, target }) => geoLine(source, target)),\n },\n });\n }\n }\n\n return layers;\n};\n\n/**\n * Render layers created above.\n */\nexport const renderLayers = (generator: GeoPath, layers: Layer[] = [], scale: number, styles: StyleSet) => {\n const context: CanvasRenderingContext2D = generator.context();\n const {\n canvas: { width, height },\n } = context;\n context.reset();\n\n // Clear background.\n if (styles.background) {\n context.fillStyle = styles.background.fillStyle;\n context.fillRect(0, 0, width, height);\n } else {\n context.clearRect(0, 0, width, height);\n }\n\n // Render features.\n // https://github.com/d3/d3-geo#_path\n layers.forEach(({ path, styles }) => {\n context.save();\n let fill = false;\n let stroke = false;\n if (styles) {\n Object.entries(styles).forEach(([key, value]) => {\n if (key === 'pointRadius') {\n generator.pointRadius(value * scale);\n } else {\n context[key] = value;\n fill ||= key === 'fillStyle';\n stroke ||= key === 'strokeStyle';\n }\n });\n }\n\n context.beginPath();\n\n generator(path);\n fill && context.fill();\n stroke && context.stroke();\n context.restore();\n });\n\n return context;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type GlobeController, type ControlProps } from '../components';\n\nexport const useGlobeZoomHandler = (controller: GlobeController | null | undefined): ControlProps['onAction'] => {\n return useCallback<ControlProps['onAction']>(\n (event) => {\n if (!controller) {\n return;\n }\n\n switch (event) {\n case 'zoom-in': {\n controller.setScale((scale) => scale * 1.1);\n break;\n }\n case 'zoom-out': {\n controller.setScale((scale) => scale * 0.9);\n break;\n }\n }\n },\n [controller],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type MapController, type ControlProps } from '../components';\n\nexport const useMapZoomHandler = (controller: MapController | null | undefined): ControlProps['onAction'] => {\n return useCallback<ControlProps['onAction']>(\n (event) => {\n if (!controller) {\n return;\n }\n\n switch (event) {\n case 'zoom-in': {\n controller.setZoom((scale) => scale + 1);\n break;\n }\n case 'zoom-out': {\n controller.setZoom((scale) => scale - 1);\n break;\n }\n }\n },\n [controller],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type Timer } from 'd3';\nimport { useEffect, useState } from 'react';\n\nimport { type Vector } from './context';\nimport { type GlobeController } from '../components';\n\nexport type SpinnerOptions = {\n disabled?: boolean;\n delta?: Vector;\n};\n\n/**\n * Rotates globe.\n */\nexport const useSpinner = (controller?: GlobeController | null, options: SpinnerOptions = {}) => {\n const [running, setRunning] = useState(false);\n useEffect(() => {\n let timer: Timer | undefined;\n\n const start = () => {\n const delta: Vector = options.delta ?? [0.001, 0, 0];\n\n let t = 0;\n let lastRotation = controller.projection.rotate();\n timer = d3.timer((elapsed) => {\n const dt = elapsed - t;\n t = elapsed;\n\n const rotation: Vector = [\n lastRotation[0] + delta[0] * dt,\n lastRotation[1] + delta[1] * dt,\n lastRotation[2] + delta[2] * dt,\n ];\n\n lastRotation = rotation;\n controller.setRotation(rotation);\n });\n };\n\n const stop = () => {\n if (timer) {\n timer.stop();\n timer = undefined;\n }\n };\n\n if (controller && running) {\n start();\n } else {\n stop();\n }\n\n return () => stop();\n }, [controller, running]);\n\n return [\n () => {\n if (!options.disabled) {\n setRunning(true);\n }\n },\n () => setRunning(false),\n ];\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as d3 from 'd3';\nimport { type Dispatch, type SetStateAction, useEffect, useState } from 'react';\nimport versor from 'versor';\n\nimport { log } from '@dxos/log';\n\nimport type { GlobeController } from '../components';\nimport { geoToPosition, type LatLng, positionToRotation, type StyleSet } from '../util';\n\nconst TRANSITION_NAME = 'globe-tour';\n\nconst defaultDuration = 1_500;\n\nexport type TourOptions = {\n running?: boolean;\n disabled?: boolean;\n duration?: number;\n loop?: boolean;\n tilt?: number;\n autoRotate?: boolean;\n styles?: StyleSet;\n};\n\n/**\n * Iterates between points.\n * Inspired by: https://observablehq.com/@mbostock/top-100-cities\n */\nexport const useTour = (\n controller?: GlobeController | null,\n points?: LatLng[],\n options: TourOptions = {},\n): [boolean, Dispatch<SetStateAction<boolean>>] => {\n const selection = d3.selection();\n const [running, setRunning] = useState(options.running ?? false);\n useEffect(() => {\n if (!running) {\n selection.interrupt(TRANSITION_NAME);\n return;\n }\n\n let t: ReturnType<typeof setTimeout>;\n if (controller && running) {\n t = setTimeout(async () => {\n const { canvas, projection, setRotation } = controller;\n const context = canvas.getContext('2d', { alpha: false });\n const path = d3.geoPath(projection, context).pointRadius(2);\n\n const tilt = options.tilt ?? 0;\n let last: LatLng;\n try {\n const p = [...points];\n if (options.loop) {\n p.push(p[0]);\n }\n\n for (const next of p) {\n if (!running) {\n break;\n }\n\n // Points.\n const p1 = last ? geoToPosition(last) : undefined;\n const p2 = geoToPosition(next);\n const ip = d3.geoInterpolate(p1 || p2, p2);\n const distance = d3.geoDistance(p1 || p2, p2);\n\n // Rotation.\n const r1 = p1 ? positionToRotation(p1, tilt) : controller.projection.rotate();\n const r2 = positionToRotation(p2, tilt);\n const iv = versor.interpolate(r1, r2);\n\n const transition = selection\n .transition(TRANSITION_NAME)\n .duration(Math.max(options.duration ?? defaultDuration, distance * 2_000))\n .tween('render', () => (t) => {\n const t1 = Math.max(0, Math.min(1, t * 2 - 1));\n const t2 = Math.min(1, t * 2);\n\n context.save();\n {\n context.beginPath();\n context.strokeStyle = options?.styles?.arc?.strokeStyle ?? 'yellow';\n context.lineWidth = (options?.styles?.arc?.lineWidth ?? 1.5) * (controller?.scale ?? 1);\n context.setLineDash(options?.styles?.arc?.lineDash ?? []);\n path({ type: 'LineString', coordinates: [ip(t1), ip(t2)] });\n context.stroke();\n\n context.beginPath();\n context.fillStyle = options?.styles?.cursor?.fillStyle ?? 'orange';\n path.pointRadius((options?.styles?.cursor?.pointRadius ?? 2) * (controller?.scale ?? 1));\n path({ type: 'Point', coordinates: ip(t2) });\n context.fill();\n }\n context.restore();\n\n // TODO(burdon): This has to come after rendering above. Add to features to correct order?\n if (options.autoRotate) {\n projection.rotate(iv(t));\n setRotation(projection.rotate());\n }\n });\n\n // Throws if interrupted.\n await transition.end();\n last = next;\n }\n } catch (err) {\n log.catch(err);\n } finally {\n setRunning(false);\n }\n });\n\n return () => {\n clearTimeout(t);\n selection.interrupt(TRANSITION_NAME);\n };\n }\n }, [controller, running, JSON.stringify(options)]);\n\n return [running, setRunning];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ControlPosition } from 'leaflet';\nimport React from 'react';\n\nimport { IconButton, type ThemedClassName, Toolbar } from '@dxos/react-ui';\n\nexport type ControlAction = 'toggle' | 'start' | 'zoom-in' | 'zoom-out';\n\nexport type ControlProps = ThemedClassName<{\n onAction?: (action: ControlAction) => void;\n}>;\n\nexport const controlPositions: Record<ControlPosition, string> = {\n topleft: 'top-2 left-2',\n topright: 'top-2 right-2',\n bottomleft: 'bottom-2 left-2',\n bottomright: 'bottom-2 right-2',\n};\n\nexport const ZoomControls = ({ classNames, onAction }: ControlProps) => {\n return (\n <Toolbar.Root classNames={['gap-1', classNames]}>\n <IconButton\n //\n icon='ph--plus--regular'\n label='zoom in'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('zoom-in')}\n />\n <IconButton\n //\n icon='ph--minus--regular'\n label='zoom out'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('zoom-out')}\n />\n </Toolbar.Root>\n );\n};\n\nexport const ActionControls = ({ classNames, onAction }: ControlProps) => {\n return (\n <Toolbar.Root classNames={['gap-1', classNames]}>\n <IconButton\n //\n icon='ph--play--regular'\n label='start'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('start')}\n />\n <IconButton\n //\n icon='ph--globe-hemisphere-west--regular'\n label='toggle'\n iconOnly\n size={5}\n classNames='px-0 aspect-square'\n onClick={() => onAction?.('toggle')}\n />\n </Toolbar.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// eslint-disable-next-line no-restricted-imports\nimport 'leaflet/dist/leaflet.css';\n\nimport L, { Control, DomEvent, DomUtil, latLngBounds, type ControlPosition, type LatLngExpression } from 'leaflet';\nimport React, { forwardRef, useEffect, useImperativeHandle, type PropsWithChildren } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport type { MapContainerProps } from 'react-leaflet';\nimport { MapContainer, Marker, Popup, TileLayer, useMap } from 'react-leaflet';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { debounce } from '@dxos/async';\nimport { ThemeProvider, Tooltip, type ThemedClassName } from '@dxos/react-ui';\nimport { defaultTx, mx } from '@dxos/react-ui-theme';\n\nimport { ActionControls, controlPositions, ZoomControls, type ControlProps } from '../Toolbar';\nimport { type MapCanvasProps } from '../types';\n\n// TODO(burdon): Explore plugins: https://www.npmjs.com/search?q=keywords%3Areact-leaflet-v4\n// TODO(burdon): react-leaflet v5 is not compatible with react 18.\n\nconst defaults = {\n // TODO(burdon): Guess location.\n center: { lat: 51, lng: 0 } as L.LatLngExpression,\n zoom: 4,\n};\n\n//\n// Root\n//\n\ntype MapRootProps = ThemedClassName<MapContainerProps>;\n\n// https://react-leaflet.js.org/docs/api-map\nconst MapRoot = ({ classNames, center = defaults.center, zoom = defaults.zoom, ...props }: MapRootProps) => {\n return (\n <MapContainer\n className={mx('relative flex w-full h-full grow bg-baseSurface', classNames)}\n attributionControl={false}\n // TODO(burdon): Only if attention.\n scrollWheelZoom={true}\n zoomControl={false}\n center={center}\n zoom={zoom}\n {...props}\n />\n );\n};\n\n//\n// Control\n//\n\n// TODO(burdon): Normalize with Globe.\ntype MapController = {\n setCenter: (center: LatLngExpression, zoom?: number) => void;\n setZoom: (cb: (zoom: number) => number) => void;\n};\n\nconst MapCanvas = forwardRef<MapController, MapCanvasProps>(({ markers, center, zoom, onChange }, forwardedRef) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const map = useMap();\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n setCenter: (center: LatLngExpression, zoom?: number) => {\n map.setView(center, zoom);\n },\n setZoom: (cb) => {\n map.setZoom(cb(map.getZoom()));\n },\n }),\n [map],\n );\n\n // Resize.\n useEffect(() => {\n if (width && height) {\n map.invalidateSize();\n }\n }, [width, height]);\n\n // Position.\n useEffect(() => {\n if (center) {\n map.setView(center, zoom);\n } else if (zoom !== undefined) {\n map.setZoom(zoom);\n }\n }, [center, zoom]);\n\n // Events.\n useEffect(() => {\n const handler = debounce(() => {\n onChange?.({ center: map.getCenter(), zoom: map.getZoom() });\n }, 100);\n map.on('move', handler);\n map.on('zoom', handler);\n return () => {\n map.off('move', handler);\n map.off('zoom', handler);\n };\n }, [map, onChange]);\n\n // Set the viewport around the markers, or show the whole world map if `markers` is empty.\n useEffect(() => {\n if (markers.length > 0) {\n const bounds = latLngBounds(markers.map((marker) => marker.location));\n map.fitBounds(bounds);\n } else {\n map.setView(defaults.center, defaults.zoom);\n }\n }, [markers]);\n\n return (\n <div ref={ref} className='flex w-full h-full overflow-hidden bg-baseSurface'>\n {/* Map tiles. */}\n <TileLayer\n className='dark:filter dark:grayscale dark:invert'\n url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'\n />\n\n {/* Markers. */}\n {markers?.map(({ id, title, location: { lat, lng } }) => {\n return (\n <Marker\n key={id}\n position={{ lat, lng }}\n icon={\n // TODO(burdon): Create custom icon from bundled assets.\n new L.Icon({\n iconUrl: 'https://dxos.network/marker-icon.png',\n iconRetinaUrl: 'https://dxos.network/marker-icon-2x.png',\n shadowUrl: 'https://dxos.network/marker-shadow.png',\n iconSize: [25, 41],\n iconAnchor: [12, 41],\n popupAnchor: [1, -34],\n shadowSize: [41, 41],\n })\n }\n >\n {title && <Popup>{title}</Popup>}\n </Marker>\n );\n })}\n </div>\n );\n});\n\n//\n// Controls\n// Integrates with Leaflet custom controls.\n//\n\nconst CustomControl = ({\n position,\n children,\n}: PropsWithChildren<{\n position: ControlPosition;\n}>) => {\n const map = useMap();\n\n useEffect(() => {\n const control = new Control({ position });\n control.onAdd = () => {\n const container = DomUtil.create('div', mx('!m-0', controlPositions[position]));\n DomEvent.disableClickPropagation(container);\n DomEvent.disableScrollPropagation(container);\n\n const root = createRoot(container);\n root.render(\n <ThemeProvider tx={defaultTx}>\n <Tooltip.Provider>{children}</Tooltip.Provider>\n </ThemeProvider>,\n );\n\n return container;\n };\n\n control.addTo(map);\n return () => {\n control.remove();\n };\n }, [map, position, children]);\n\n return null;\n};\n\ntype MapControlProps = { position?: ControlPosition } & Pick<ControlProps, 'onAction'>;\n\n//\n// Map\n//\n\nexport const Map = {\n Root: MapRoot,\n Canvas: MapCanvas,\n Zoom: ({ onAction, position = 'bottomleft', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n ),\n Action: ({ onAction, position = 'bottomright', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n ),\n};\n\nexport { type MapCanvasProps, type MapController };\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,YAAYA,SAAQ;AAGpB,OAAOC,UAELC,YACAC,aAAAA,YACAC,qBACAC,SACAC,QACAC,YAAAA,iBACK;AACP,SAASC,yBAAyB;AAGlC,SAA+CC,eAAeC,uBAAuB;AACrF,SAASC,UAAU;;;AChBnB,OAAOC,SAASC,eAA2EC,kBAAkB;AAE7G,SAASC,aAAa;AACtB,SAASC,0BAA0B;AAqBnC,IAAMC,eAAeC,8BAAgCC,MAAAA;AAM9C,IAAMC,uBAAuB,CAAC,EACnCC,UACAC,MACAC,QAAQC,SACRC,OAAOC,QACPC,aAAaC,cACbC,UAAUC,UAAS,MACO;AAC1B,QAAM,CAACP,QAAQQ,SAAAA,IAAaC,mBAAmBR,OAAAA;AAC/C,QAAM,CAACC,OAAOQ,QAAAA,IAAYD,mBAAmBN,MAAAA;AAC7C,QAAM,CAACC,aAAaO,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AACd,WAAO,MAAA;AACL2C,cAAQmB,OAAM;IAChB;EACF,GAAG;IAAC9D;IAAK6B;IAAUa;GAAS;AAE5B,SAAO;AACT;AAQO,IAAMqB,MAAM;EACjBC,MAAMpF;EACNqF,QAAQ3E;EACR4E,MAAM,CAAC,EAAEC,UAAUtC,WAAW,cAAc,GAAG/C,MAAAA,MAC7C,gBAAAC,OAAA,cAAC0D,gBAAAA;IAAcZ;IAAqB,GAAG/C;KACrC,gBAAAC,OAAA,cAACqF,cAAAA;IAAaD;;EAGlBE,QAAQ,CAAC,EAAEF,UAAUtC,WAAW,eAAe,GAAG/C,MAAAA,MAChD,gBAAAC,OAAA,cAAC0D,gBAAAA;IAAcZ;IAAqB,GAAG/C;KACrC,gBAAAC,OAAA,cAACuF,gBAAAA;IAAeH;;AAGtB;",
|
|
6
|
+
"names": ["d3", "React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useRef", "useState", "useResizeDetector", "useDynamicRef", "useThemeContext", "mx", "React", "createContext", "useContext", "raise", "useControlledState", "GlobeContext", "createContext", "undefined", "GlobeContextProvider", "children", "size", "center", "_center", "scale", "_scale", "translation", "_translation", "rotation", "_rotation", "setCenter", "useControlledState", "setScale", "setTranslation", "setRotation", "Provider", "value", "useGlobeContext", "useContext", "raise", "Error", "d3", "useEffect", "debug", "timer", "cb", "start", "Date", "now", "data", "t", "console", "log", "d3", "versor", "restrictAxis", "axis", "original", "current", "map", "d", "i", "geoInertiaDrag", "target", "render", "projection", "options", "node", "select", "inertia", "geoInertiaDragHelper", "rotation", "rotate", "xAxis", "start", "move", "end", "stop", "finish", "time", "hold", "call", "drag", "on", "opt", "v0", "r0", "q0", "v10", "v11", "q10", "inertiaHelper", "versor", "cartesian", "invert", "position", "inv", "isNaN", "v1", "q1", "multiply", "delta", "r1", "r2", "velocity", "t", "A", "limit", "B", "Math", "log", "timer", "ev", "x", "y", "classList", "remove", "add", "performance", "now", "deltaTime", "decay", "exp", "deltaPos", "v", "undefined", "self", "restart", "e", "d3", "positionToRotation", "lng", "lat", "tilt", "geoToPosition", "geoPoint", "point", "type", "coordinates", "geoCircle", "radius", "center", "geoLine", "p1", "p2", "closestPoint", "points", "target", "length", "minDistance", "getDistance", "distance", "point1", "point2", "dx", "dy", "Math", "sqrt", "d3", "topojson", "createLayers", "topology", "features", "styles", "layers", "water", "push", "path", "type", "graticule", "geoGraticule", "step", "objects", "land", "feature", "countries", "border", "mesh", "a", "b", "dots", "points", "lines", "point", "geometries", "map", "geoPoint", "line", "source", "target", "geoLine", "renderLayers", "generator", "scale", "context", "canvas", "width", "height", "reset", "background", "fillStyle", "fillRect", "clearRect", "forEach", "save", "fill", "stroke", "Object", "entries", "key", "value", "pointRadius", "beginPath", "restore", "useDrag", "controller", "options", "useEffect", "canvas", "disabled", "geoInertiaDrag", "select", "setRotation", "projection", "rotate", "onUpdate", "type", "xAxis", "time", "start", "finish", "cancelDrag", "JSON", "stringify", "node", "on", "useCallback", "useGlobeZoomHandler", "controller", "useCallback", "event", "setScale", "scale", "useCallback", "useMapZoomHandler", "controller", "useCallback", "event", "setZoom", "scale", "d3", "useEffect", "useState", "useSpinner", "controller", "options", "running", "setRunning", "useState", "useEffect", "timer", "start", "delta", "t", "lastRotation", "projection", "rotate", "elapsed", "dt", "rotation", "setRotation", "stop", "undefined", "disabled", "d3", "useEffect", "useState", "versor", "log", "TRANSITION_NAME", "defaultDuration", "useTour", "controller", "points", "options", "selection", "running", "setRunning", "useState", "useEffect", "interrupt", "t", "setTimeout", "canvas", "projection", "setRotation", "context", "getContext", "alpha", "path", "geoPath", "pointRadius", "tilt", "last", "p", "loop", "push", "next", "p1", "geoToPosition", "undefined", "p2", "ip", "geoInterpolate", "distance", "geoDistance", "r1", "positionToRotation", "rotate", "r2", "iv", "versor", "interpolate", "transition", "duration", "Math", "max", "tween", "t1", "min", "t2", "save", "beginPath", "strokeStyle", "styles", "arc", "lineWidth", "scale", "setLineDash", "lineDash", "type", "coordinates", "stroke", "fillStyle", "cursor", "fill", "restore", "autoRotate", "end", "err", "log", "catch", "clearTimeout", "JSON", "stringify", "React", "IconButton", "Toolbar", "controlPositions", "topleft", "topright", "bottomleft", "bottomright", "ZoomControls", "classNames", "onAction", "React", "Toolbar", "Root", "IconButton", "icon", "label", "iconOnly", "size", "onClick", "ActionControls", "defaultStyles", "light", "background", "fillStyle", "water", "land", "line", "strokeStyle", "point", "strokeWidth", "pointRadius", "dark", "projectionMap", "orthographic", "geoOrthographic", "mercator", "geoMercator", "geoTransverseMercator", "getProjection", "type", "constructor", "GlobeRoot", "classNames", "children", "props", "ref", "width", "height", "useResizeDetector", "React", "div", "className", "mx", "GlobeContextProvider", "size", "GlobeCanvas", "forwardRef", "projection", "_projection", "topology", "features", "styles", "_styles", "themeMode", "useThemeContext", "useMemo", "canvas", "setCanvas", "useState", "canvasRef", "layers", "timer", "createLayers", "center", "scale", "translation", "rotation", "setCenter", "setScale", "setTranslation", "setRotation", "useGlobeContext", "scaleRef", "useDynamicRef", "useEffect", "positionToRotation", "geoToPosition", "zooming", "useRef", "useImperativeHandle", "current", "s", "is", "interpolateNumber", "d3", "transition", "ease", "easeLinear", "easeSinOut", "duration", "tween", "t", "on", "generator", "geoPath", "getContext", "alpha", "Math", "min", "translate", "x", "y", "rotate", "renderLayers", "GlobeDebug", "position", "controlPositions", "pre", "JSON", "stringify", "GlobePanel", "CustomControl", "Globe", "Root", "Canvas", "Zoom", "onAction", "ZoomControls", "Action", "ActionControls", "Debug", "Panel", "L", "Control", "DomEvent", "DomUtil", "latLngBounds", "React", "forwardRef", "useEffect", "useImperativeHandle", "createRoot", "MapContainer", "Marker", "Popup", "TileLayer", "useMap", "useResizeDetector", "debounce", "ThemeProvider", "Tooltip", "defaultTx", "mx", "defaults", "center", "lat", "lng", "zoom", "MapRoot", "classNames", "props", "React", "MapContainer", "className", "mx", "attributionControl", "scrollWheelZoom", "zoomControl", "MapCanvas", "forwardRef", "markers", "onChange", "forwardedRef", "ref", "width", "height", "useResizeDetector", "refreshRate", "map", "useMap", "useImperativeHandle", "setCenter", "setView", "setZoom", "cb", "getZoom", "useEffect", "invalidateSize", "undefined", "handler", "debounce", "getCenter", "on", "off", "length", "bounds", "latLngBounds", "marker", "location", "fitBounds", "div", "TileLayer", "url", "id", "title", "Marker", "key", "position", "icon", "L", "Icon", "iconUrl", "iconRetinaUrl", "shadowUrl", "iconSize", "iconAnchor", "popupAnchor", "shadowSize", "Popup", "CustomControl", "children", "control", "Control", "onAdd", "container", "DomUtil", "create", "controlPositions", "DomEvent", "disableClickPropagation", "disableScrollPropagation", "root", "createRoot", "render", "ThemeProvider", "tx", "defaultTx", "Tooltip", "Provider", "addTo", "remove", "Map", "Root", "Canvas", "Zoom", "onAction", "ZoomControls", "Action", "ActionControls"]
|
|
7
7
|
}
|