@dxos/react-ui-geo 0.8.4-main.406dc2a → 0.8.4-main.548089c
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 +47 -55
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +47 -55
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.d.ts +6 -9
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts +1 -1
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/components/Globe/Globe.tsx +4 -3
- package/src/components/Map/Map.tsx +18 -48
- package/src/components/Toolbar/Controls.tsx +4 -8
- package/src/hooks/context.tsx +14 -8
- package/src/hooks/useGlobeZoomHandler.ts +8 -2
|
@@ -15,14 +15,21 @@ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
|
15
15
|
import React, { createContext, useContext } from "react";
|
|
16
16
|
import { raise } from "@dxos/debug";
|
|
17
17
|
import { useControlledState } from "@dxos/react-ui";
|
|
18
|
+
var defaults = {
|
|
19
|
+
center: {
|
|
20
|
+
lat: 51,
|
|
21
|
+
lng: 0
|
|
22
|
+
},
|
|
23
|
+
zoom: 4
|
|
24
|
+
};
|
|
18
25
|
var GlobeContext = /* @__PURE__ */ createContext(void 0);
|
|
19
|
-
var GlobeContextProvider = ({ children, size, center:
|
|
26
|
+
var GlobeContextProvider = ({ children, size, center: centerParam = defaults.center, zoom: zoomParam = defaults.zoom, translation: translationParam, rotation: rotationParam }) => {
|
|
20
27
|
var _effect = _useSignals();
|
|
21
28
|
try {
|
|
22
|
-
const [center, setCenter] = useControlledState(
|
|
23
|
-
const [zoom, setZoom] = useControlledState(
|
|
24
|
-
const [translation, setTranslation] = useControlledState(
|
|
25
|
-
const [rotation, setRotation] = useControlledState(
|
|
29
|
+
const [center, setCenter] = useControlledState(centerParam);
|
|
30
|
+
const [zoom, setZoom] = useControlledState(zoomParam);
|
|
31
|
+
const [translation, setTranslation] = useControlledState(translationParam);
|
|
32
|
+
const [rotation, setRotation] = useControlledState(rotationParam);
|
|
26
33
|
return /* @__PURE__ */ React.createElement(GlobeContext.Provider, {
|
|
27
34
|
value: {
|
|
28
35
|
size,
|
|
@@ -376,8 +383,8 @@ var renderLayers = (generator, layers = [], scale, styles) => {
|
|
|
376
383
|
generator.pointRadius(value * scale);
|
|
377
384
|
} else {
|
|
378
385
|
context[key] = value;
|
|
379
|
-
fill
|
|
380
|
-
stroke
|
|
386
|
+
fill ||= key === "fillStyle";
|
|
387
|
+
stroke ||= key === "strokeStyle";
|
|
381
388
|
}
|
|
382
389
|
});
|
|
383
390
|
}
|
|
@@ -427,6 +434,7 @@ var cancelDrag = (node) => node.on(".drag", null);
|
|
|
427
434
|
|
|
428
435
|
// src/hooks/useGlobeZoomHandler.ts
|
|
429
436
|
import { useCallback } from "react";
|
|
437
|
+
var ZOOM_FACTOR = 0.1;
|
|
430
438
|
var useGlobeZoomHandler = (controller) => {
|
|
431
439
|
return useCallback((event) => {
|
|
432
440
|
if (!controller) {
|
|
@@ -434,11 +442,15 @@ var useGlobeZoomHandler = (controller) => {
|
|
|
434
442
|
}
|
|
435
443
|
switch (event) {
|
|
436
444
|
case "zoom-in": {
|
|
437
|
-
controller.setZoom((zoom) =>
|
|
445
|
+
controller.setZoom((zoom) => {
|
|
446
|
+
return zoom * (1 + ZOOM_FACTOR);
|
|
447
|
+
});
|
|
438
448
|
break;
|
|
439
449
|
}
|
|
440
450
|
case "zoom-out": {
|
|
441
|
-
controller.setZoom((zoom) =>
|
|
451
|
+
controller.setZoom((zoom) => {
|
|
452
|
+
return zoom * (1 - ZOOM_FACTOR);
|
|
453
|
+
});
|
|
442
454
|
break;
|
|
443
455
|
}
|
|
444
456
|
}
|
|
@@ -640,15 +652,13 @@ var ZoomControls = ({ classNames, onAction }) => {
|
|
|
640
652
|
icon: "ph--plus--regular",
|
|
641
653
|
label: "zoom in",
|
|
642
654
|
iconOnly: true,
|
|
643
|
-
|
|
644
|
-
classNames: "px-0 aspect-square",
|
|
655
|
+
classNames: "pli-0 aspect-square",
|
|
645
656
|
onClick: () => onAction?.("zoom-in")
|
|
646
657
|
}), /* @__PURE__ */ React2.createElement(IconButton, {
|
|
647
658
|
icon: "ph--minus--regular",
|
|
648
659
|
label: "zoom out",
|
|
649
660
|
iconOnly: true,
|
|
650
|
-
|
|
651
|
-
classNames: "px-0 aspect-square",
|
|
661
|
+
classNames: "pli-0 aspect-square",
|
|
652
662
|
onClick: () => onAction?.("zoom-out")
|
|
653
663
|
}));
|
|
654
664
|
} finally {
|
|
@@ -667,15 +677,13 @@ var ActionControls = ({ classNames, onAction }) => {
|
|
|
667
677
|
icon: "ph--play--regular",
|
|
668
678
|
label: "start",
|
|
669
679
|
iconOnly: true,
|
|
670
|
-
|
|
671
|
-
classNames: "px-0 aspect-square",
|
|
680
|
+
classNames: "pli-0 aspect-square",
|
|
672
681
|
onClick: () => onAction?.("start")
|
|
673
682
|
}), /* @__PURE__ */ React2.createElement(IconButton, {
|
|
674
683
|
icon: "ph--globe-hemisphere-west--regular",
|
|
675
684
|
label: "toggle",
|
|
676
685
|
iconOnly: true,
|
|
677
|
-
|
|
678
|
-
classNames: "px-0 aspect-square",
|
|
686
|
+
classNames: "pli-0 aspect-square",
|
|
679
687
|
onClick: () => onAction?.("toggle")
|
|
680
688
|
}));
|
|
681
689
|
} finally {
|
|
@@ -756,18 +764,18 @@ var GlobeRoot = ({ classNames, children, ...props }) => {
|
|
|
756
764
|
_effect.f();
|
|
757
765
|
}
|
|
758
766
|
};
|
|
759
|
-
var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection:
|
|
767
|
+
var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: projectionParam, topology, features, styles: stylesParam }, forwardRef3) => {
|
|
760
768
|
var _effect = _useSignals3();
|
|
761
769
|
try {
|
|
762
770
|
const { themeMode } = useThemeContext();
|
|
763
|
-
const styles = useMemo2(() =>
|
|
764
|
-
|
|
771
|
+
const styles = useMemo2(() => stylesParam ?? defaultStyles[themeMode], [
|
|
772
|
+
stylesParam,
|
|
765
773
|
themeMode
|
|
766
774
|
]);
|
|
767
775
|
const [canvas, setCanvas] = useState3(null);
|
|
768
776
|
const canvasRef = (canvas2) => setCanvas(canvas2);
|
|
769
|
-
const projection = useMemo2(() => getProjection(
|
|
770
|
-
|
|
777
|
+
const projection = useMemo2(() => getProjection(projectionParam), [
|
|
778
|
+
projectionParam
|
|
771
779
|
]);
|
|
772
780
|
const layers = useMemo2(() => {
|
|
773
781
|
return timer(() => createLayers(topology, features, styles));
|
|
@@ -934,11 +942,10 @@ import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
|
934
942
|
import L, { Control, DomEvent, DomUtil, latLngBounds } from "leaflet";
|
|
935
943
|
import React4, { forwardRef as forwardRef2, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2, useRef as useRef2, useState as useState4 } from "react";
|
|
936
944
|
import { createRoot } from "react-dom/client";
|
|
937
|
-
import { MapContainer, Marker, Popup, TileLayer, useMap } from "react-leaflet";
|
|
938
|
-
import { debounce } from "@dxos/async";
|
|
945
|
+
import { MapContainer, Marker, Popup, TileLayer, useMap, useMapEvents } from "react-leaflet";
|
|
939
946
|
import { ThemeProvider, Tooltip } from "@dxos/react-ui";
|
|
940
947
|
import { defaultTx, mx as mx2 } from "@dxos/react-ui-theme";
|
|
941
|
-
var
|
|
948
|
+
var defaults2 = {
|
|
942
949
|
center: {
|
|
943
950
|
lat: 51,
|
|
944
951
|
lng: 0
|
|
@@ -946,7 +953,7 @@ var defaults = {
|
|
|
946
953
|
zoom: 4
|
|
947
954
|
};
|
|
948
955
|
var [MapContextProvier, useMapContext] = createContext2("Map");
|
|
949
|
-
var MapRoot = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true, doubleClickZoom = true, touchZoom = true, center
|
|
956
|
+
var MapRoot = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true, doubleClickZoom = true, touchZoom = true, center, zoom, onChange, ...props }, forwardedRef) => {
|
|
950
957
|
var _effect = _useSignals4();
|
|
951
958
|
try {
|
|
952
959
|
const [attention, setAttention] = useState4(false);
|
|
@@ -960,31 +967,6 @@ var MapRoot = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true,
|
|
|
960
967
|
mapRef.current?.setZoom(cb(mapRef.current?.getZoom() ?? 0));
|
|
961
968
|
}
|
|
962
969
|
}), []);
|
|
963
|
-
useEffect5(() => {
|
|
964
|
-
if (!map) {
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
const handler = debounce(() => {
|
|
968
|
-
setAttention(true);
|
|
969
|
-
onChange?.({
|
|
970
|
-
center: map.getCenter(),
|
|
971
|
-
zoom: map.getZoom()
|
|
972
|
-
});
|
|
973
|
-
}, 100);
|
|
974
|
-
map.on("move", handler);
|
|
975
|
-
map.on("zoom", handler);
|
|
976
|
-
map.on("focus", () => setAttention(true));
|
|
977
|
-
map.on("blur", () => setAttention(false));
|
|
978
|
-
return () => {
|
|
979
|
-
map.off("move");
|
|
980
|
-
map.off("zoom");
|
|
981
|
-
map.off("focus");
|
|
982
|
-
map.off("blur");
|
|
983
|
-
};
|
|
984
|
-
}, [
|
|
985
|
-
map,
|
|
986
|
-
onChange
|
|
987
|
-
]);
|
|
988
970
|
useEffect5(() => {
|
|
989
971
|
if (!map) {
|
|
990
972
|
return;
|
|
@@ -999,7 +981,8 @@ var MapRoot = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true,
|
|
|
999
981
|
attention
|
|
1000
982
|
]);
|
|
1001
983
|
return /* @__PURE__ */ React4.createElement(MapContextProvier, {
|
|
1002
|
-
attention
|
|
984
|
+
attention,
|
|
985
|
+
onChange
|
|
1003
986
|
}, /* @__PURE__ */ React4.createElement(MapContainer, {
|
|
1004
987
|
...props,
|
|
1005
988
|
ref: mapRef,
|
|
@@ -1009,8 +992,8 @@ var MapRoot = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true,
|
|
|
1009
992
|
scrollWheelZoom,
|
|
1010
993
|
doubleClickZoom,
|
|
1011
994
|
touchZoom,
|
|
1012
|
-
center,
|
|
1013
|
-
zoom
|
|
995
|
+
center: center ?? defaults2.center,
|
|
996
|
+
zoom: zoom ?? defaults2.zoom
|
|
1014
997
|
}));
|
|
1015
998
|
} finally {
|
|
1016
999
|
_effect.f();
|
|
@@ -1021,6 +1004,15 @@ var MapTiles = (_props) => {
|
|
|
1021
1004
|
var _effect = _useSignals4();
|
|
1022
1005
|
try {
|
|
1023
1006
|
const ref = useRef2(null);
|
|
1007
|
+
const { onChange } = useMapContext(MapTiles.displayName);
|
|
1008
|
+
useMapEvents({
|
|
1009
|
+
zoomstart: (ev) => {
|
|
1010
|
+
onChange?.({
|
|
1011
|
+
center: ev.target.getCenter(),
|
|
1012
|
+
zoom: ev.target.getZoom()
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1024
1016
|
const { attention } = useMapContext(MapTiles.displayName);
|
|
1025
1017
|
useEffect5(() => {
|
|
1026
1018
|
if (ref.current) {
|
|
@@ -1051,7 +1043,7 @@ var MapMarkers = ({ selected, markers }) => {
|
|
|
1051
1043
|
const bounds = latLngBounds(markers.map((marker) => marker.location));
|
|
1052
1044
|
map.fitBounds(bounds);
|
|
1053
1045
|
} else {
|
|
1054
|
-
map.setView(
|
|
1046
|
+
map.setView(defaults2.center, defaults2.zoom);
|
|
1055
1047
|
}
|
|
1056
1048
|
}, [
|
|
1057
1049
|
markers
|
|
@@ -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 {\n type GeoProjection,\n easeLinear,\n easeSinOut,\n geoMercator,\n geoOrthographic,\n geoPath,\n geoTransverseMercator,\n interpolateNumber,\n transition,\n} 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 ThemeMode, type ThemedClassName, 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 { ActionControls, type ControlProps, ZoomControls, 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, 'zoom' | 'translation' | 'rotation' | 'setZoom' | 'setTranslation' | 'setRotation'>;\n\nexport type ProjectionType = 'orthographic' | 'mercator' | 'transverse-mercator';\n\nconst projectionMap: Record<ProjectionType, () => GeoProjection> = {\n orthographic: geoOrthographic,\n mercator: geoMercator,\n 'transverse-mercator': geoTransverseMercator,\n};\n\nconst getProjection = (type: GlobeCanvasProps['projection'] = 'orthographic'): GeoProjection => {\n if (typeof type === 'string') {\n const constructor = projectionMap[type] ?? geoOrthographic;\n return constructor();\n }\n\n return type ?? 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 */\n// TODO(burdon): Move controller to root.\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, zoom, translation, rotation, setCenter, setZoom, setTranslation, setRotation } =\n useGlobeContext();\n const zoomRef = useDynamicRef(zoom);\n\n // Update rotation.\n useEffect(() => {\n if (center) {\n setZoom(1);\n setRotation(positionToRotation(geoToPosition(center)));\n }\n }, [center]);\n\n // External controller.\n const zooming = useRef(false);\n useImperativeHandle<GlobeController, GlobeController>(forwardRef, () => {\n return {\n canvas,\n projection,\n center,\n get zoom() {\n return zoomRef.current;\n },\n translation,\n rotation,\n setCenter,\n setZoom: (s) => {\n if (typeof s === 'function') {\n const is = interpolateNumber(zoomRef.current, s(zoomRef.current));\n // Stop easing if already zooming.\n transition()\n .ease(zooming.current ? easeLinear : easeSinOut)\n .duration(200)\n .tween('scale', () => (t) => setZoom(is(t)))\n .on('end', () => {\n zooming.current = false;\n });\n } else {\n setZoom(s);\n }\n },\n setTranslation,\n setRotation,\n };\n }, [canvas]);\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 && 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) * zoom)\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, zoom, styles);\n });\n }\n }, [generator, size, zoom, 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\n//\n// Debug\n//\n\nconst GlobeDebug = ({ position = 'topleft' }: { position?: ControlPosition }) => {\n const { size, zoom, 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, zoom, translation, rotation }, null, 2)}\n </pre>\n </div>\n );\n};\n\n//\n// Panel\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\n//\n// Controls\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\nconst GlobeZoom = ({ onAction, position = 'bottomleft', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n);\n\nconst GlobeAction = ({ onAction, position = 'bottomright', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n);\n\n//\n// Globe\n//\n\nexport const Globe = {\n Root: GlobeRoot,\n Canvas: GlobeCanvas,\n Zoom: GlobeZoom,\n Action: GlobeAction,\n Debug: GlobeDebug,\n Panel: GlobePanel,\n};\n\nexport type { GlobeRootProps, GlobeCanvasProps };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type Dispatch, type PropsWithChildren, type SetStateAction, createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { useControlledState } from '@dxos/react-ui';\n\nimport { type LatLngLiteral } from '../types';\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?: LatLngLiteral;\n zoom: number;\n translation: Point;\n rotation: Vector;\n setCenter: Dispatch<SetStateAction<LatLngLiteral>>;\n setZoom: 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' | 'zoom' | 'translation' | 'rotation'>>\n>;\n\nexport const GlobeContextProvider = ({\n children,\n size,\n center: _center,\n zoom: _zoom,\n translation: _translation,\n rotation: _rotation,\n}: GlobeContextProviderProps) => {\n const [center, setCenter] = useControlledState(_center);\n const [zoom, setZoom] = useControlledState(_zoom);\n const [translation, setTranslation] = useControlledState<Point>(_translation);\n const [rotation, setRotation] = useControlledState<Vector>(_rotation);\n\n return (\n <GlobeContext.Provider\n value={{ size, center, zoom, translation, rotation, setCenter, setZoom, 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 { select } 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 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(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 { drag, select, timer } 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 = 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(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: 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 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 { type GeoGeometryObjects, geoCircle as d3GeoCircle } from 'd3';\nimport { type Point, type Polygon, type Position } from 'geojson';\nimport { type LatLngLiteral } from 'leaflet';\n\nimport type { Vector } from '../hooks';\n\nexport const positionToRotation = ([lng, lat]: [number, number], tilt = 0): Vector => [-lng, tilt - lat, 0];\n\nexport const geoToPosition = ({ lat, lng }: LatLngLiteral): [number, number] => [lng, lat];\n\nexport const geoPoint = (point: LatLngLiteral): Point => ({ type: 'Point', coordinates: geoToPosition(point) });\n\n// https://github.com/d3/d3-geo#geoCircle\nexport const geoCircle = ({ lat, lng }: LatLngLiteral, radius: number): Polygon =>\n d3GeoCircle().radius(radius).center([lng, lat])();\n\nexport const geoLine = (p1: LatLngLiteral, p2: LatLngLiteral): 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 { type GeoPath, type GeoPermissibleObjects, geoGraticule } from 'd3';\nimport { feature, mesh } from 'topojson-client';\nimport { type Topology } from 'topojson-specification';\n\nimport { type LatLngLiteral } from '../types';\n\nimport { 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?: LatLngLiteral[];\n lines?: { source: LatLngLiteral; target: LatLngLiteral }[];\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: 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: feature(topology, topology.objects.land),\n });\n }\n\n if (topology.objects.countries && styles.border) {\n layers.push({\n styles: styles.border,\n path: 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 ControlProps, type GlobeController } 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.setZoom((zoom) => zoom * 1.1);\n break;\n }\n case 'zoom-out': {\n controller.setZoom((zoom) => zoom * 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 ControlProps, type MapController } 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 { timer as d3Timer } from 'd3';\nimport { type Timer } from 'd3';\nimport { useEffect, useState } from 'react';\n\nimport { type GlobeController } from '../components';\n\nimport { type Vector } from './context';\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 = d3Timer((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 { selection as d3Selection, geoDistance, geoInterpolate, geoPath } from 'd3';\nimport { type Dispatch, type SetStateAction, useEffect, useMemo, useState } from 'react';\nimport versor from 'versor';\n\nimport type { GlobeController } from '../components';\nimport { type LatLngLiteral } from '../types';\nimport { type StyleSet, geoToPosition, positionToRotation } 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?: LatLngLiteral[],\n options: TourOptions = {},\n): [boolean, Dispatch<SetStateAction<boolean>>] => {\n const selection = useMemo(() => d3Selection(), []);\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 = geoPath(projection, context).pointRadius(2);\n\n const tilt = options.tilt ?? 0;\n let last: LatLngLiteral;\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 = geoInterpolate(p1 || p2, p2);\n const distance = 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?.zoom ?? 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?.zoom ?? 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 projection.rotate(iv(t));\n setRotation(projection.rotate());\n });\n\n // Throws if interrupted.\n await transition.end();\n last = next;\n }\n } catch {\n // Ignore.\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-2', classNames]}>\n <IconButton\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 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-2', classNames]}>\n <IconButton\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 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\nimport 'leaflet/dist/leaflet.css';\n\nimport { createContext } from '@radix-ui/react-context';\nimport L, { Control, type ControlPosition, DomEvent, DomUtil, type LatLngLiteral, latLngBounds } from 'leaflet';\nimport React, { type PropsWithChildren, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport type { MapContainerProps } from 'react-leaflet';\nimport { MapContainer, Marker, Popup, TileLayer, useMap } from 'react-leaflet';\n\nimport { debounce } from '@dxos/async';\nimport { ThemeProvider, type ThemedClassName, Tooltip } from '@dxos/react-ui';\nimport { defaultTx, mx } from '@dxos/react-ui-theme';\n\nimport { type GeoMarker } from '../../types';\nimport { ActionControls, type ControlProps, ZoomControls, controlPositions } from '../Toolbar';\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// TODO(burdon): Guess initial location.\n\nconst defaults = {\n center: { lat: 51, lng: 0 } as L.LatLngLiteral,\n zoom: 4,\n};\n\n//\n// Controller\n//\n\ntype MapController = {\n setCenter: (center: LatLngLiteral, zoom?: number) => void;\n setZoom: (cb: (zoom: number) => number) => void;\n};\n\n//\n// Context\n//\n\ntype MapContextValue = {\n attention?: boolean;\n};\n\nconst [MapContextProvier, useMapContext] = createContext<MapContextValue>('Map');\n\n//\n// Root\n//\n\ntype MapRootProps = ThemedClassName<\n MapContainerProps & {\n onChange?: (ev: { center: LatLngLiteral; zoom: number }) => void;\n }\n>;\n\n/**\n * https://react-leaflet.js.org/docs/api-map\n */\nconst MapRoot = forwardRef<MapController, MapRootProps>(\n (\n {\n classNames,\n scrollWheelZoom = true,\n doubleClickZoom = true,\n touchZoom = true,\n center = defaults.center,\n zoom = defaults.zoom,\n onChange,\n ...props\n },\n forwardedRef,\n ) => {\n const [attention, setAttention] = useState(false);\n const mapRef = useRef<L.Map>(null);\n const map = mapRef.current;\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n setCenter: (center: LatLngLiteral, zoom?: number) => {\n mapRef.current?.setView(center, zoom);\n },\n setZoom: (cb: (zoom: number) => number) => {\n mapRef.current?.setZoom(cb(mapRef.current?.getZoom() ?? 0));\n },\n }),\n [],\n );\n\n // Events.\n useEffect(() => {\n if (!map) {\n return;\n }\n\n const handler = debounce(() => {\n setAttention(true);\n onChange?.({\n center: map.getCenter(),\n zoom: map.getZoom(),\n });\n }, 100);\n\n map.on('move', handler);\n map.on('zoom', handler);\n map.on('focus', () => setAttention(true));\n map.on('blur', () => setAttention(false));\n return () => {\n map.off('move');\n map.off('zoom');\n map.off('focus');\n map.off('blur');\n };\n }, [map, onChange]);\n\n // Enable/disable scroll wheel zoom.\n // TODO(burdon): Use attention:\n // const {hasAttention} = useAttention(props.id);\n useEffect(() => {\n if (!map) {\n return;\n }\n\n if (attention) {\n map.scrollWheelZoom.enable();\n } else {\n map.scrollWheelZoom.disable();\n }\n }, [map, attention]);\n\n return (\n <MapContextProvier attention={attention}>\n <MapContainer\n {...props}\n ref={mapRef}\n className={mx('group relative grid bs-full is-full !bg-baseSurface dx-focus-ring-inset', classNames)}\n attributionControl={false}\n zoomControl={false}\n scrollWheelZoom={scrollWheelZoom}\n doubleClickZoom={doubleClickZoom}\n touchZoom={touchZoom}\n center={center}\n zoom={zoom}\n // whenReady={() => {}}\n />\n </MapContextProvier>\n );\n },\n);\n\nMapRoot.displayName = 'Map.Root';\n\n//\n// Tiles\n// https://react-leaflet.js.org/docs/api-components/#tilelayer\n//\n\ntype MapTilesProps = {};\n\nconst MapTiles = (_props: MapTilesProps) => {\n const ref = useRef<L.TileLayer>(null);\n\n // NOTE: Need to dynamically update data attribute since TileLayer doesn't update, but\n // Tailwind requires setting the property for static analysis.\n const { attention } = useMapContext(MapTiles.displayName);\n useEffect(() => {\n if (ref.current) {\n ref.current.getContainer().dataset.attention = attention ? '1' : '0';\n }\n }, [attention]);\n\n // TODO(burdon): Option to add class 'invert'.\n return (\n <>\n <TileLayer\n ref={ref}\n data-attention={attention}\n detectRetina={true}\n className='dark:grayscale dark:invert data-[attention=\"0\"]:!opacity-80'\n url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'\n keepBuffer={4}\n // opacity={attention ? 1 : 0.7}\n />\n\n {/* Temperature map. */}\n {/* <WMSTileLayer\n url='https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi'\n layers='MODIS_Terra_Land_Surface_Temp_Day'\n format='image/png'\n transparent={true}\n version='1.3.0'\n attribution='NASA GIBS'\n /> */}\n\n {/* US Weather. */}\n {/* <WMSTileLayer\n url='https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi'\n layers='nexrad-n0r' // layers='nexrad-n0r'\n format='image/png'\n transparent={true}\n /> */}\n </>\n );\n};\n\nMapTiles.displayName = 'Map.Tiles';\n\n//\n// Markers\n//\n\ntype MapMarkersProps = {\n markers?: GeoMarker[];\n selected?: string[];\n};\n\nconst MapMarkers = ({ selected, markers }: MapMarkersProps) => {\n const map = useMap();\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 <>\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 // TODO(burdon): Selection state.\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 </>\n );\n};\n\nMapMarkers.displayName = 'Map.Markers';\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\nconst MapZoom = ({ onAction, position = 'bottomleft', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n);\n\nconst MapAction = ({ onAction, position = 'bottomright', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n);\n\n//\n// Map\n//\n\nexport const Map = {\n Root: MapRoot,\n Tiles: MapTiles,\n Markers: MapMarkers,\n Zoom: MapZoom,\n Action: MapAction,\n};\n\nexport { type MapController, type MapRootProps, type MapTilesProps, type MapMarkersProps, type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AAiBpB,QAAAA,CAAS,CAAA;AAC7EqB,iBAASC,wBAAwBL,SAAAA;AACjCI,iBAASE,yBAAyBN,SAAAA;AAElC,cAAMO,OAAOC,WAAWR,SAAAA;AACxBO,aAAKE,OACH,gBAAAzD,OAAA,cAAC0D,eAAAA;UAAcC,IAAIC;WACjB,gBAAA5D,OAAA,cAAC6D,QAAQC,UAAQ,MAAElB,QAAAA,CAAAA,CAAAA;AAIvB,eAAOI;MACT;AAEAH,cAAQkB,MAAM/E,GAAAA;AACd,aAAO,MAAA;AACL6D,gBAAQmB,OAAM;MAChB;IACF,GAAG;MAAChF;MAAK+C;MAAUa;KAAS;AAE5B,WAAO;;;;AACT;AAIA,IAAMqB,UAAU,CAAC,EAAEC,UAAUnC,WAAW,cAAc,GAAGtD,MAAAA,MAAwB;;;WAC/E,gBAAAuB,OAAA,cAAC2C,gBAAAA;MAAcZ;MAAqB,GAAGtD;OACrC,gBAAAuB,OAAA,cAACmE,cAAAA;MAAaD;;;;;;AAIlB,IAAME,YAAY,CAAC,EAAEF,UAAUnC,WAAW,eAAe,GAAGtD,MAAAA,MAAwB;;;WAClF,gBAAAuB,OAAA,cAAC2C,gBAAAA;MAAcZ;MAAqB,GAAGtD;OACrC,gBAAAuB,OAAA,cAACqE,gBAAAA;MAAeH;;;;;;AAQb,IAAMI,MAAM;EACjBC,MAAMrG;EACNsG,OAAOhE;EACPiE,SAASxD;EACTyD,MAAMT;EACNU,QAAQP;AACV;",
|
|
6
|
-
"names": ["easeLinear", "easeSinOut", "geoMercator", "geoOrthographic", "geoPath", "geoTransverseMercator", "interpolateNumber", "transition", "React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useRef", "useState", "useResizeDetector", "useDynamicRef", "useThemeContext", "mx", "React", "createContext", "useContext", "raise", "useControlledState", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2018 DXOS.org\n//\n\nimport {\n type GeoProjection,\n easeLinear,\n easeSinOut,\n geoMercator,\n geoOrthographic,\n geoPath,\n geoTransverseMercator,\n interpolateNumber,\n transition,\n} 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 ThemeMode, type ThemedClassName, 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 { ActionControls, type ControlProps, ZoomControls, 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, 'zoom' | 'translation' | 'rotation' | 'setZoom' | 'setTranslation' | 'setRotation'>;\n\nexport type ProjectionType = 'orthographic' | 'mercator' | 'transverse-mercator';\n\nconst projectionMap: Record<ProjectionType, () => GeoProjection> = {\n orthographic: geoOrthographic,\n mercator: geoMercator,\n 'transverse-mercator': geoTransverseMercator,\n};\n\nconst getProjection = (type: GlobeCanvasProps['projection'] = 'orthographic'): GeoProjection => {\n if (typeof type === 'string') {\n const constructor = projectionMap[type] ?? geoOrthographic;\n return constructor();\n }\n\n return type ?? 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\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 */\n// TODO(burdon): Move controller to root.\nconst GlobeCanvas = forwardRef<GlobeController, GlobeCanvasProps>(\n ({ projection: projectionParam, topology, features, styles: stylesParam }, forwardRef) => {\n const { themeMode } = useThemeContext();\n const styles = useMemo(() => stylesParam ?? defaultStyles[themeMode], [stylesParam, 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(projectionParam), [projectionParam]);\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, zoom, translation, rotation, setCenter, setZoom, setTranslation, setRotation } =\n useGlobeContext();\n const zoomRef = useDynamicRef(zoom);\n\n // Update rotation.\n useEffect(() => {\n if (center) {\n setZoom(1);\n setRotation(positionToRotation(geoToPosition(center)));\n }\n }, [center]);\n\n // External controller.\n const zooming = useRef(false);\n useImperativeHandle<GlobeController, GlobeController>(forwardRef, () => {\n return {\n canvas,\n projection,\n center,\n get zoom() {\n return zoomRef.current;\n },\n translation,\n rotation,\n setCenter,\n setZoom: (s) => {\n if (typeof s === 'function') {\n const is = interpolateNumber(zoomRef.current, s(zoomRef.current));\n // Stop easing if already zooming.\n transition()\n .ease(zooming.current ? easeLinear : easeSinOut)\n .duration(200)\n .tween('scale', () => (t) => setZoom(is(t)))\n .on('end', () => {\n zooming.current = false;\n });\n } else {\n setZoom(s);\n }\n },\n setTranslation,\n setRotation,\n };\n }, [canvas]);\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 && 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) * zoom)\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, zoom, styles);\n });\n }\n }, [generator, size, zoom, 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\n//\n// Debug\n//\n\nconst GlobeDebug = ({ position = 'topleft' }: { position?: ControlPosition }) => {\n const { size, zoom, 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, zoom, translation, rotation }, null, 2)}\n </pre>\n </div>\n );\n};\n\n//\n// Panel\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\n//\n// Controls\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\nconst GlobeZoom = ({ onAction, position = 'bottomleft', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n);\n\nconst GlobeAction = ({ onAction, position = 'bottomright', ...props }: GlobeControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n);\n\n//\n// Globe\n//\n\nexport const Globe = {\n Root: GlobeRoot,\n Canvas: GlobeCanvas,\n Zoom: GlobeZoom,\n Action: GlobeAction,\n Debug: GlobeDebug,\n Panel: GlobePanel,\n};\n\nexport type { GlobeRootProps, GlobeCanvasProps };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type Dispatch, type PropsWithChildren, type SetStateAction, createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { useControlledState } from '@dxos/react-ui';\n\nimport { type LatLngLiteral } from '../types';\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?: LatLngLiteral;\n zoom: number;\n translation: Point;\n rotation: Vector;\n setCenter: Dispatch<SetStateAction<LatLngLiteral>>;\n setZoom: Dispatch<SetStateAction<number>>;\n setTranslation: Dispatch<SetStateAction<Point>>;\n setRotation: Dispatch<SetStateAction<Vector>>;\n};\n\nconst defaults = {\n center: { lat: 51, lng: 0 } as LatLngLiteral,\n zoom: 4,\n} as const;\n\n// TODO(burdon): Replace with radix.\nconst GlobeContext = createContext<GlobeContextType>(undefined);\n\nexport type GlobeContextProviderProps = PropsWithChildren<\n Partial<Pick<GlobeContextType, 'size' | 'center' | 'zoom' | 'translation' | 'rotation'>>\n>;\n\nexport const GlobeContextProvider = ({\n children,\n size,\n center: centerParam = defaults.center,\n zoom: zoomParam = defaults.zoom,\n translation: translationParam,\n rotation: rotationParam,\n}: GlobeContextProviderProps) => {\n const [center, setCenter] = useControlledState(centerParam);\n const [zoom, setZoom] = useControlledState(zoomParam);\n const [translation, setTranslation] = useControlledState<Point>(translationParam);\n const [rotation, setRotation] = useControlledState<Vector>(rotationParam);\n\n return (\n <GlobeContext.Provider\n value={{ size, center, zoom, translation, rotation, setCenter, setZoom, 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 { select } 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 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(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 { drag, select, timer } 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 = 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(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: 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 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 { type GeoGeometryObjects, geoCircle as d3GeoCircle } from 'd3';\nimport { type Point, type Polygon, type Position } from 'geojson';\nimport { type LatLngLiteral } from 'leaflet';\n\nimport type { Vector } from '../hooks';\n\nexport const positionToRotation = ([lng, lat]: [number, number], tilt = 0): Vector => [-lng, tilt - lat, 0];\n\nexport const geoToPosition = ({ lat, lng }: LatLngLiteral): [number, number] => [lng, lat];\n\nexport const geoPoint = (point: LatLngLiteral): Point => ({ type: 'Point', coordinates: geoToPosition(point) });\n\n// https://github.com/d3/d3-geo#geoCircle\nexport const geoCircle = ({ lat, lng }: LatLngLiteral, radius: number): Polygon =>\n d3GeoCircle().radius(radius).center([lng, lat])();\n\nexport const geoLine = (p1: LatLngLiteral, p2: LatLngLiteral): 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 { type GeoPath, type GeoPermissibleObjects, geoGraticule } from 'd3';\nimport { feature, mesh } from 'topojson-client';\nimport { type Topology } from 'topojson-specification';\n\nimport { type LatLngLiteral } from '../types';\n\nimport { 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?: LatLngLiteral[];\n lines?: { source: LatLngLiteral; target: LatLngLiteral }[];\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: 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: feature(topology, topology.objects.land),\n });\n }\n\n if (topology.objects.countries && styles.border) {\n layers.push({\n styles: styles.border,\n path: 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 ControlProps, type GlobeController } from '../components';\n\nconst ZOOM_FACTOR = 0.1;\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.setZoom((zoom) => {\n return zoom * (1 + ZOOM_FACTOR);\n });\n break;\n }\n case 'zoom-out': {\n controller.setZoom((zoom) => {\n return zoom * (1 - ZOOM_FACTOR);\n });\n break;\n }\n }\n },\n [controller],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type ControlProps, type MapController } 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 { timer as d3Timer } from 'd3';\nimport { type Timer } from 'd3';\nimport { useEffect, useState } from 'react';\n\nimport { type GlobeController } from '../components';\n\nimport { type Vector } from './context';\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 = d3Timer((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 { selection as d3Selection, geoDistance, geoInterpolate, geoPath } from 'd3';\nimport { type Dispatch, type SetStateAction, useEffect, useMemo, useState } from 'react';\nimport versor from 'versor';\n\nimport type { GlobeController } from '../components';\nimport { type LatLngLiteral } from '../types';\nimport { type StyleSet, geoToPosition, positionToRotation } 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?: LatLngLiteral[],\n options: TourOptions = {},\n): [boolean, Dispatch<SetStateAction<boolean>>] => {\n const selection = useMemo(() => d3Selection(), []);\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 = geoPath(projection, context).pointRadius(2);\n\n const tilt = options.tilt ?? 0;\n let last: LatLngLiteral;\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 = geoInterpolate(p1 || p2, p2);\n const distance = 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?.zoom ?? 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?.zoom ?? 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 projection.rotate(iv(t));\n setRotation(projection.rotate());\n });\n\n // Throws if interrupted.\n await transition.end();\n last = next;\n }\n } catch {\n // Ignore.\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-2', classNames]}>\n <IconButton\n icon='ph--plus--regular'\n label='zoom in'\n iconOnly\n classNames='pli-0 aspect-square'\n onClick={() => onAction?.('zoom-in')}\n />\n <IconButton\n icon='ph--minus--regular'\n label='zoom out'\n iconOnly\n classNames='pli-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-2', classNames]}>\n <IconButton\n icon='ph--play--regular'\n label='start'\n iconOnly\n classNames='pli-0 aspect-square'\n onClick={() => onAction?.('start')}\n />\n <IconButton\n icon='ph--globe-hemisphere-west--regular'\n label='toggle'\n iconOnly\n classNames='pli-0 aspect-square'\n onClick={() => onAction?.('toggle')}\n />\n </Toolbar.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport 'leaflet/dist/leaflet.css';\n\nimport { createContext } from '@radix-ui/react-context';\nimport L, { Control, type ControlPosition, DomEvent, DomUtil, type LatLngLiteral, latLngBounds } from 'leaflet';\nimport React, { type PropsWithChildren, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { MapContainer, type MapContainerProps, Marker, Popup, TileLayer, useMap, useMapEvents } from 'react-leaflet';\n\nimport { ThemeProvider, type ThemedClassName, Tooltip } from '@dxos/react-ui';\nimport { defaultTx, mx } from '@dxos/react-ui-theme';\n\nimport { type GeoMarker } from '../../types';\nimport { ActionControls, type ControlProps, ZoomControls, controlPositions } from '../Toolbar';\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// TODO(burdon): Guess initial location.\n\nconst defaults = {\n center: { lat: 51, lng: 0 } as L.LatLngLiteral,\n zoom: 4,\n} as const;\n\n//\n// Controller\n//\n\ntype MapController = {\n setCenter: (center: LatLngLiteral, zoom?: number) => void;\n setZoom: (cb: (zoom: number) => number) => void;\n};\n\n//\n// Context\n//\n\ntype MapContextValue = {\n attention?: boolean;\n onChange?: (ev: { center: LatLngLiteral; zoom: number }) => void;\n};\n\nconst [MapContextProvier, useMapContext] = createContext<MapContextValue>('Map');\n\n//\n// Root\n//\n\ntype MapRootProps = ThemedClassName<MapContainerProps & Pick<MapContextValue, 'onChange'>>;\n\n/**\n * https://react-leaflet.js.org/docs/api-map\n */\nconst MapRoot = forwardRef<MapController, MapRootProps>(\n (\n { classNames, scrollWheelZoom = true, doubleClickZoom = true, touchZoom = true, center, zoom, onChange, ...props },\n forwardedRef,\n ) => {\n const [attention, setAttention] = useState(false);\n const mapRef = useRef<L.Map>(null);\n const map = mapRef.current;\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n setCenter: (center: LatLngLiteral, zoom?: number) => {\n mapRef.current?.setView(center, zoom);\n },\n setZoom: (cb: (zoom: number) => number) => {\n mapRef.current?.setZoom(cb(mapRef.current?.getZoom() ?? 0));\n },\n }),\n [],\n );\n\n // Enable/disable scroll wheel zoom.\n // TODO(burdon): Use attention:\n // const {hasAttention} = useAttention(props.id);\n useEffect(() => {\n if (!map) {\n return;\n }\n\n if (attention) {\n map.scrollWheelZoom.enable();\n } else {\n map.scrollWheelZoom.disable();\n }\n }, [map, attention]);\n\n return (\n <MapContextProvier attention={attention} onChange={onChange}>\n <MapContainer\n {...props}\n ref={mapRef}\n className={mx('group relative grid bs-full is-full !bg-baseSurface dx-focus-ring-inset', classNames)}\n attributionControl={false}\n zoomControl={false}\n scrollWheelZoom={scrollWheelZoom}\n doubleClickZoom={doubleClickZoom}\n touchZoom={touchZoom}\n center={center ?? defaults.center}\n zoom={zoom ?? defaults.zoom}\n // whenReady={() => {}}\n />\n </MapContextProvier>\n );\n },\n);\n\nMapRoot.displayName = 'Map.Root';\n\n//\n// Tiles\n// https://react-leaflet.js.org/docs/api-components/#tilelayer\n//\n\ntype MapTilesProps = {};\n\nconst MapTiles = (_props: MapTilesProps) => {\n const ref = useRef<L.TileLayer>(null);\n const { onChange } = useMapContext(MapTiles.displayName);\n\n useMapEvents({\n zoomstart: (ev) => {\n onChange?.({\n center: ev.target.getCenter(),\n zoom: ev.target.getZoom(),\n });\n },\n });\n\n // NOTE: Need to dynamically update data attribute since TileLayer doesn't update, but\n // Tailwind requires setting the property for static analysis.\n const { attention } = useMapContext(MapTiles.displayName);\n useEffect(() => {\n if (ref.current) {\n ref.current.getContainer().dataset.attention = attention ? '1' : '0';\n }\n }, [attention]);\n\n // TODO(burdon): Option to add class 'invert'.\n return (\n <>\n <TileLayer\n ref={ref}\n data-attention={attention}\n detectRetina={true}\n className='dark:grayscale dark:invert data-[attention=\"0\"]:!opacity-80'\n url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'\n keepBuffer={4}\n // opacity={attention ? 1 : 0.7}\n />\n\n {/* Temperature map. */}\n {/* <WMSTileLayer\n url='https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi'\n layers='MODIS_Terra_Land_Surface_Temp_Day'\n format='image/png'\n transparent={true}\n version='1.3.0'\n attribution='NASA GIBS'\n /> */}\n\n {/* US Weather. */}\n {/* <WMSTileLayer\n url='https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi'\n layers='nexrad-n0r' // layers='nexrad-n0r'\n format='image/png'\n transparent={true}\n /> */}\n </>\n );\n};\n\nMapTiles.displayName = 'Map.Tiles';\n\n//\n// Markers\n//\n\ntype MapMarkersProps = {\n markers?: GeoMarker[];\n selected?: string[];\n};\n\nconst MapMarkers = ({ selected, markers }: MapMarkersProps) => {\n const map = useMap();\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 <>\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 // TODO(burdon): Selection state.\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 </>\n );\n};\n\nMapMarkers.displayName = 'Map.Markers';\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\nconst MapZoom = ({ onAction, position = 'bottomleft', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ZoomControls onAction={onAction} />\n </CustomControl>\n);\n\nconst MapAction = ({ onAction, position = 'bottomright', ...props }: MapControlProps) => (\n <CustomControl position={position} {...props}>\n <ActionControls onAction={onAction} />\n </CustomControl>\n);\n\n//\n// Map\n//\n\nexport const Map = {\n Root: MapRoot,\n Tiles: MapTiles,\n Markers: MapMarkers,\n Zoom: MapZoom,\n Action: MapAction,\n};\n\nexport { type MapController, type MapRootProps, type MapTilesProps, type MapMarkersProps, type MapControlProps };\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAEEA,YACAC,YACAC,aACAC,iBACAC,WAAAA,UACAC,uBACAC,mBACAC,kBACK;AAEP,OAAOC,UAELC,YACAC,aAAAA,YACAC,qBACAC,WAAAA,UACAC,QACAC,YAAAA,iBACK;AACP,SAASC,yBAAyB;AAGlC,SAA+CC,eAAeC,uBAAuB;AACrF,SAASC,UAAU;;;;ACzBnB,OAAOC,SAAqEC,eAAeC,kBAAkB;AAE7G,SAASC,aAAa;AACtB,SAASC,0BAA0B;AAqBnC,IAAMC,WAAW;EACfC,QAAQ;IAAEC,KAAK;IAAIC,KAAK;EAAE;EAC1BC,MAAM;AACR;AAGA,IAAMC,eAAeC,8BAAgCC,MAAA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CAAC,EAAEF,UAAUnC,WAAW,eAAe,GAAGtD,MAAAA,MAAwB;;;WAClF,gBAAAkB,OAAA,cAACgD,gBAAAA;MAAcZ;MAAqB,GAAGtD;OACrC,gBAAAkB,OAAA,cAAC0E,gBAAAA;MAAeH;;;;;;AAQb,IAAMI,MAAM;EACjBC,MAAMrG;EACNsG,OAAOrE;EACPsE,SAASxD;EACTyD,MAAMT;EACNU,QAAQP;AACV;",
|
|
6
|
+
"names": ["easeLinear", "easeSinOut", "geoMercator", "geoOrthographic", "geoPath", "geoTransverseMercator", "interpolateNumber", "transition", "React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useRef", "useState", "useResizeDetector", "useDynamicRef", "useThemeContext", "mx", "React", "createContext", "useContext", "raise", "useControlledState", "defaults", "center", "lat", "lng", "zoom", "GlobeContext", "createContext", "undefined", "GlobeContextProvider", "children", "size", "centerParam", "zoomParam", "translation", "translationParam", "rotation", "rotationParam", "setCenter", "useControlledState", "setZoom", "setTranslation", "setRotation", "Provider", "value", "useGlobeContext", "useContext", "raise", "Error", "select", "useEffect", "debug", "timer", "cb", "start", "Date", "now", "data", "t", "console", "log", "drag", "select", "timer", "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", "geoCircle", "d3GeoCircle", "positionToRotation", "lng", "lat", "tilt", "geoToPosition", "geoPoint", "point", "type", "coordinates", "geoCircle", "radius", "d3GeoCircle", "center", "geoLine", "p1", "p2", "closestPoint", "points", "target", "length", "minDistance", "getDistance", "distance", "point1", "point2", "dx", "dy", "Math", "sqrt", "geoGraticule", "feature", "mesh", "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", "ZOOM_FACTOR", "useGlobeZoomHandler", "controller", "useCallback", "event", "setZoom", "zoom", "useCallback", "useMapZoomHandler", "controller", "useCallback", "event", "setZoom", "scale", "timer", "d3Timer", "useEffect", "useState", "useSpinner", "controller", "options", "running", "setRunning", "useState", "useEffect", "timer", "start", "delta", "t", "lastRotation", "projection", "rotate", "d3Timer", "elapsed", "dt", "rotation", "setRotation", "stop", "undefined", "disabled", "selection", "d3Selection", "geoDistance", "geoInterpolate", "geoPath", "useEffect", "useMemo", "useState", "versor", "TRANSITION_NAME", "defaultDuration", "useTour", "controller", "points", "options", "selection", "useMemo", "d3Selection", "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", "zoom", "setLineDash", "lineDash", "type", "coordinates", "stroke", "fillStyle", "cursor", "fill", "restore", "end", "clearTimeout", "JSON", "stringify", "React", "IconButton", "Toolbar", "controlPositions", "topleft", "topright", "bottomleft", "bottomright", "ZoomControls", "classNames", "onAction", "React", "Toolbar", "Root", "IconButton", "icon", "label", "iconOnly", "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", "projectionParam", "topology", "features", "styles", "stylesParam", "themeMode", "useThemeContext", "useMemo", "canvas", "setCanvas", "useState", "canvasRef", "layers", "timer", "createLayers", "center", "zoom", "translation", "rotation", "setCenter", "setZoom", "setTranslation", "setRotation", "useGlobeContext", "zoomRef", "useDynamicRef", "useEffect", "positionToRotation", "geoToPosition", "zooming", "useRef", "useImperativeHandle", "current", "s", "is", "interpolateNumber", "transition", "ease", "easeLinear", "easeSinOut", "duration", "tween", "t", "on", "generator", "geoPath", "getContext", "alpha", "scale", "Math", "min", "translate", "x", "y", "rotate", "renderLayers", "GlobeDebug", "position", "controlPositions", "pre", "JSON", "stringify", "GlobePanel", "CustomControl", "GlobeZoom", "onAction", "ZoomControls", "GlobeAction", "ActionControls", "Globe", "Root", "Canvas", "Zoom", "Action", "Debug", "Panel", "createContext", "L", "Control", "DomEvent", "DomUtil", "latLngBounds", "React", "forwardRef", "useEffect", "useImperativeHandle", "useRef", "useState", "createRoot", "MapContainer", "Marker", "Popup", "TileLayer", "useMap", "useMapEvents", "ThemeProvider", "Tooltip", "defaultTx", "mx", "defaults", "center", "lat", "lng", "zoom", "MapContextProvier", "useMapContext", "createContext", "MapRoot", "forwardRef", "classNames", "scrollWheelZoom", "doubleClickZoom", "touchZoom", "onChange", "props", "forwardedRef", "attention", "setAttention", "useState", "mapRef", "useRef", "map", "current", "useImperativeHandle", "setCenter", "setView", "setZoom", "cb", "getZoom", "useEffect", "enable", "disable", "React", "MapContainer", "ref", "className", "mx", "attributionControl", "zoomControl", "displayName", "MapTiles", "_props", "useMapEvents", "zoomstart", "ev", "target", "getCenter", "getContainer", "dataset", "TileLayer", "data-attention", "detectRetina", "url", "keepBuffer", "MapMarkers", "selected", "markers", "useMap", "length", "bounds", "latLngBounds", "marker", "location", "fitBounds", "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", "MapZoom", "onAction", "ZoomControls", "MapAction", "ActionControls", "Map", "Root", "Tiles", "Markers", "Zoom", "Action"]
|
|
7
7
|
}
|