@dxos/react-ui-geo 0.8.4-main.cb12b3f963 → 0.8.4-main.d05539e30a
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +15 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +15 -8
- 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 +2 -0
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/components/Globe/Globe.tsx +13 -4
- package/src/components/Map/Map.tsx +12 -6
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -696,14 +696,15 @@ var getProjection = (type = "orthographic") => {
|
|
|
696
696
|
}
|
|
697
697
|
return type ?? geoOrthographic();
|
|
698
698
|
};
|
|
699
|
-
var
|
|
699
|
+
var DEFAULT_ZOOM = 1.5;
|
|
700
|
+
var GlobeRoot = composable(({ children, center: centerProp, zoom: zoomProp = DEFAULT_ZOOM, translation: translationProp, rotation: rotationProp, ...props }, forwardedRef) => {
|
|
700
701
|
const localRef = useRef(null);
|
|
701
702
|
const composedRef = useComposedRefs(localRef, forwardedRef);
|
|
702
703
|
const { width, height } = useResizeDetector({
|
|
703
704
|
targetRef: localRef
|
|
704
705
|
});
|
|
705
706
|
const [center, setCenter] = useControlledState(centerProp);
|
|
706
|
-
const [zoom, setZoom] = useControlledState(zoomProp
|
|
707
|
+
const [zoom, setZoom] = useControlledState(zoomProp);
|
|
707
708
|
const [translation, setTranslation] = useControlledState(translationProp);
|
|
708
709
|
const [rotation, setRotation] = useControlledState(rotationProp);
|
|
709
710
|
return /* @__PURE__ */ React2.createElement(GlobeContext.Provider, {
|
|
@@ -750,7 +751,6 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: projectionProp, topo
|
|
|
750
751
|
const zoomRef = useDynamicRef(zoom);
|
|
751
752
|
useEffect4(() => {
|
|
752
753
|
if (center) {
|
|
753
|
-
setZoom(1);
|
|
754
754
|
setRotation(positionToRotation(geoToPosition(center)));
|
|
755
755
|
}
|
|
756
756
|
}, [
|
|
@@ -902,6 +902,14 @@ var MapContent = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = tr
|
|
|
902
902
|
const mapRef = useRef2(null);
|
|
903
903
|
const map = mapRef.current;
|
|
904
904
|
useImperativeHandle2(forwardedRef, () => ({
|
|
905
|
+
getCenter: () => {
|
|
906
|
+
const center2 = mapRef.current?.getCenter();
|
|
907
|
+
return center2 ? {
|
|
908
|
+
lat: center2.lat,
|
|
909
|
+
lng: center2.lng
|
|
910
|
+
} : void 0;
|
|
911
|
+
},
|
|
912
|
+
getZoom: () => mapRef.current?.getZoom(),
|
|
905
913
|
setCenter: (center2, zoom2) => {
|
|
906
914
|
mapRef.current?.setView(center2, zoom2);
|
|
907
915
|
},
|
|
@@ -943,7 +951,7 @@ var MapTiles = (_props) => {
|
|
|
943
951
|
const ref = useRef2(null);
|
|
944
952
|
const { onChange } = useMapContext(MAP_TILES_NAME);
|
|
945
953
|
useMapEvents({
|
|
946
|
-
|
|
954
|
+
moveend: (ev) => {
|
|
947
955
|
onChange?.({
|
|
948
956
|
center: ev.target.getCenter(),
|
|
949
957
|
zoom: ev.target.getZoom()
|
|
@@ -971,14 +979,13 @@ MapTiles.displayName = MAP_TILES_NAME;
|
|
|
971
979
|
var MapMarkers = ({ selected, markers }) => {
|
|
972
980
|
const map = useMap();
|
|
973
981
|
useEffect5(() => {
|
|
974
|
-
if (markers.length > 0) {
|
|
982
|
+
if (markers && markers.length > 0) {
|
|
975
983
|
const bounds = latLngBounds(markers.map((marker) => marker.location));
|
|
976
984
|
map.fitBounds(bounds);
|
|
977
|
-
} else {
|
|
978
|
-
map.setView(defaults.center, defaults.zoom);
|
|
979
985
|
}
|
|
980
986
|
}, [
|
|
981
|
-
markers
|
|
987
|
+
markers,
|
|
988
|
+
map
|
|
982
989
|
]);
|
|
983
990
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, markers?.map(({ id, title, location: { lat, lng } }) => {
|
|
984
991
|
return /* @__PURE__ */ React3.createElement(Marker, {
|
|
@@ -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 {\n type ThemeMode,\n type ThemedClassName,\n useComposedRefs,\n useControlledState,\n useDynamicRef,\n useThemeContext,\n} from '@dxos/react-ui';\nimport { composable, composableProps, mx } from '@dxos/ui-theme';\n\nimport { GlobeContext, type GlobeContextType, type Point, type Vector, useGlobeContext } 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 = Partial<Pick<GlobeContextType, 'center' | 'zoom' | 'translation' | 'rotation'>>;\n\nconst GlobeRoot = composable<HTMLDivElement, GlobeRootProps>(\n (\n { children, center: centerProp, zoom: zoomProp, translation: translationProp, rotation: rotationProp, ...props },\n forwardedRef,\n ) => {\n const localRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs<HTMLDivElement>(localRef, forwardedRef);\n const { width, height } = useResizeDetector<HTMLDivElement>({ targetRef: localRef });\n\n const [center, setCenter] = useControlledState(centerProp);\n const [zoom, setZoom] = useControlledState(zoomProp ?? 4);\n const [translation, setTranslation] = useControlledState<Point>(translationProp);\n const [rotation, setRotation] = useControlledState<Vector>(rotationProp);\n\n return (\n <GlobeContext.Provider\n value={{\n size: { width, height },\n center,\n zoom,\n translation,\n rotation,\n setCenter,\n setZoom,\n setTranslation,\n setRotation,\n }}\n >\n <div {...composableProps(props, { classNames: 'relative dx-container' })} ref={composedRef}>\n {children}\n </div>\n </GlobeContext.Provider>\n );\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: projectionProp, topology, features, styles: stylesProp }, forwardRef) => {\n const { themeMode } = useThemeContext();\n const styles = useMemo(() => stylesProp ?? defaultStyles[themeMode], [stylesProp, 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(projectionProp), [projectionProp]);\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: (state) => {\n if (typeof state === 'function') {\n const is = interpolateNumber(zoomRef.current, state(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(state);\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-sm',\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 { type Dispatch, type SetStateAction, createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type LatLngLiteral } from '../types';\n\n// TODO(burdon): Factor out common geometry types.\nexport type Size = { width: number; height: number };\n\nexport type Point = { x: number; y: number };\n\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\n/** @internal */\n// TODO(burdon): Replace with radix.\nexport const GlobeContext = createContext<GlobeContextType>(undefined);\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';\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';\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 // TODO(burdon): Redo controlled state.\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, useTranslation } from '@dxos/react-ui';\n\nimport { translationKey } from '#translations';\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 const { t } = useTranslation(translationKey);\n\n return (\n <Toolbar.Root classNames={['gap-2', classNames]}>\n <IconButton\n icon='ph--plus--regular'\n iconOnly\n label={t('zoom-in-icon.button')}\n onClick={() => onAction?.('zoom-in')}\n />\n <IconButton\n icon='ph--minus--regular'\n iconOnly\n label={t('zoom-out-icon.button')}\n onClick={() => onAction?.('zoom-out')}\n />\n </Toolbar.Root>\n );\n};\n\nexport const ActionControls = ({ classNames, onAction }: ControlProps) => {\n const { t } = useTranslation(translationKey);\n\n return (\n <Toolbar.Root classNames={['gap-2', classNames]}>\n <IconButton\n icon='ph--path--regular'\n iconOnly\n label={t('start-icon.button')}\n onClick={() => onAction?.('start')}\n />\n <IconButton\n icon='ph--globe-hemisphere-west--regular'\n iconOnly\n label={t('toggle-icon.button')}\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 } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { MapContainer, type MapContainerProps, Marker, Popup, TileLayer, useMap, useMapEvents } from 'react-leaflet';\n\nimport { type ThemedClassName, ThemeProvider, Tooltip } from '@dxos/react-ui';\nimport { composable, composableProps, defaultTx, mx } from '@dxos/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 [MapContextProvider, useMapContext] = createContext<MapContextValue>('Map');\n\n//\n// Root\n//\n\ntype MapRootProps = Pick<MapContextValue, 'onChange'>;\n\n/**\n * Context provider for the map. Must wrap Map.Content.\n */\nconst MapRoot = composable<HTMLDivElement, MapRootProps>(({ children, onChange, ...props }, forwardedRef) => {\n // TODO(burdon): Use attention: const [attention, setAttention] = useState(false);\n const attention = false;\n return (\n <MapContextProvider attention={attention} onChange={onChange}>\n <div\n {...composableProps(props, {\n role: 'none',\n classNames: 'dx-container grid dx-focus-ring-inset',\n })}\n ref={forwardedRef}\n >\n {children}\n </div>\n </MapContextProvider>\n );\n});\n\nMapRoot.displayName = 'Map.Root';\n\n//\n// Content\n//\n\ntype MapContentProps = ThemedClassName<Omit<MapContainerProps, 'children'> & PropsWithChildren>;\n\n/**\n * https://react-leaflet.js.org/docs/api-map\n */\nconst MAP_CONTENT_NAME = 'Map.Content';\n\nconst MapContent = forwardRef<MapController, MapContentProps>(\n (\n { classNames, scrollWheelZoom = true, doubleClickZoom = true, touchZoom = true, center, zoom, children, ...props },\n forwardedRef,\n ) => {\n const { attention } = useMapContext(MAP_CONTENT_NAME);\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 <MapContainer\n {...props}\n className={mx('group relative grid bg-base-surface!', 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 ref={mapRef}\n >\n {children}\n </MapContainer>\n );\n },\n);\n\nMapContent.displayName = 'Map.Content';\n\n//\n// Tiles\n// https://react-leaflet.js.org/docs/api-components/#tilelayer\n//\n\nconst MAP_TILES_NAME = 'Map.Tiles';\n\ntype MapTilesProps = {};\n\nconst MapTiles = (_props: MapTilesProps) => {\n const ref = useRef<L.TileLayer>(null);\n const { onChange } = useMapContext(MAP_TILES_NAME);\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(MAP_TILES_NAME);\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_NAME;\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 Content: MapContent,\n Tiles: MapTiles,\n Markers: MapMarkers,\n Zoom: MapZoom,\n Action: MapAction,\n};\n\nexport {\n type MapController,\n type MapRootProps,\n type MapContentProps,\n type MapTilesProps,\n type MapMarkersProps,\n type MapControlProps,\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAEEA,YACAC,YACAC,aACAC,iBACAC,WAAAA,UACAC,uBACAC,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AiBnB,QAAAA,CAAS,CAAA;AAC7EoB,eAASC,wBAAwBL,SAAAA;AACjCI,eAASE,yBAAyBN,SAAAA;AAElC,YAAMO,OAAOC,WAAWR,SAAAA;AACxBO,WAAKE,OACH,gBAAAtF,OAAA,cAACuF,eAAAA;QAAcC,IAAIC;SACjB,gBAAAzF,OAAA,cAAC0F,QAAQC,UAAQ,MAAEhG,QAAAA,CAAAA,CAAAA;AAIvB,aAAOkF;IACT;AAEAH,YAAQkB,MAAM7E,GAAAA;AACd,WAAO,MAAA;AACL2D,cAAQmB,OAAM;IAChB;EACF,GAAG;IAAC9E;IAAK8C;IAAUlE;GAAS;AAE5B,SAAO;AACT;AAIA,IAAMmG,UAAU,CAAC,EAAEC,UAAUlC,WAAW,cAAc,GAAGhE,MAAAA,MACvD,gBAAAG,OAAA,cAACyE,gBAAAA;EAAcZ;EAAqB,GAAGhE;GACrC,gBAAAG,OAAA,cAACgG,cAAAA;EAAaD;;AAIlB,IAAME,YAAY,CAAC,EAAEF,UAAUlC,WAAW,eAAe,GAAGhE,MAAAA,MAC1D,gBAAAG,OAAA,cAACyE,gBAAAA;EAAcZ;EAAqB,GAAGhE;GACrC,gBAAAG,OAAA,cAACkG,gBAAAA;EAAeH;;AAQb,IAAMI,MAAM;EACjBC,MAAM3G;EACN4G,SAAS7F;EACT8F,OAAOrE;EACPsE,SAASxD;EACTyD,MAAMV;EACNW,QAAQR;AACV;",
|
|
6
|
-
"names": ["easeLinear", "easeSinOut", "geoMercator", "geoOrthographic", "geoPath", "geoTransverseMercator", "interpolateNumber", "transition", "React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useRef", "useState", "useResizeDetector", "useComposedRefs", "useControlledState", "useDynamicRef", "useThemeContext", "composable", "composableProps", "mx", "createContext", "useContext", "raise", "GlobeContext", "undefined", "useGlobeContext", "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", "inertia", "geoInertiaDragHelper", "rotation", "rotate", "xAxis", "start", "move", "end", "stop", "finish", "time", "hold", "call", "on", "opt", "v0", "r0", "q0", "v10", "v11", "q10", "inertiaHelper", "cartesian", "invert", "position", "inv", "isNaN", "v1", "q1", "multiply", "delta", "r1", "r2", "velocity", "t", "A", "limit", "B", "Math", "log", "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", "radius", "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", "event", "setZoom", "zoom", "useCallback", "useMapZoomHandler", "controller", "event", "setZoom", "scale", "timer", "d3Timer", "useEffect", "useState", "useSpinner", "controller", "options", "running", "setRunning", "start", "delta", "t", "lastRotation", "projection", "rotate", "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", "useTranslation", "translationKey", "controlPositions", "topleft", "topright", "bottomleft", "bottomright", "ZoomControls", "classNames", "onAction", "t", "Root", "icon", "iconOnly", "label", "onClick", "ActionControls", "defaultStyles", "light", "background", "fillStyle", "water", "land", "line", "strokeStyle", "point", "strokeWidth", "pointRadius", "dark", "projectionMap", "orthographic", "geoOrthographic", "mercator", "geoMercator", "geoTransverseMercator", "getProjection", "type", "constructor", "GlobeRoot", "composable", "children", "center", "centerProp", "zoom", "zoomProp", "translation", "translationProp", "rotation", "rotationProp", "props", "forwardedRef", "localRef", "useRef", "composedRef", "useComposedRefs", "width", "height", "useResizeDetector", "targetRef", "setCenter", "useControlledState", "setZoom", "setTranslation", "setRotation", "React", "GlobeContext", "Provider", "value", "size", "div", "composableProps", "classNames", "ref", "GlobeCanvas", "forwardRef", "projection", "projectionProp", "topology", "features", "styles", "stylesProp", "themeMode", "useThemeContext", "useMemo", "canvas", "setCanvas", "useState", "canvasRef", "layers", "timer", "createLayers", "useGlobeContext", "zoomRef", "useDynamicRef", "useEffect", "positionToRotation", "geoToPosition", "zooming", "useImperativeHandle", "current", "state", "is", "interpolateNumber", "transition", "ease", "easeLinear", "easeSinOut", "duration", "tween", "t", "on", "generator", "geoPath", "getContext", "alpha", "scale", "Math", "min", "translate", "x", "y", "rotate", "renderLayers", "GlobeDebug", "position", "className", "mx", "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", "createRoot", "MapContainer", "Marker", "Popup", "TileLayer", "useMap", "useMapEvents", "ThemeProvider", "Tooltip", "composable", "composableProps", "defaultTx", "mx", "defaults", "center", "lat", "lng", "zoom", "MapContextProvider", "useMapContext", "createContext", "MapRoot", "composable", "children", "onChange", "props", "forwardedRef", "attention", "React", "div", "composableProps", "role", "classNames", "ref", "displayName", "MAP_CONTENT_NAME", "MapContent", "forwardRef", "scrollWheelZoom", "doubleClickZoom", "touchZoom", "mapRef", "useRef", "map", "current", "useImperativeHandle", "setCenter", "setView", "setZoom", "cb", "
|
|
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 {\n type ThemeMode,\n type ThemedClassName,\n useComposedRefs,\n useControlledState,\n useDynamicRef,\n useThemeContext,\n} from '@dxos/react-ui';\nimport { composable, composableProps, mx } from '@dxos/ui-theme';\n\nimport { GlobeContext, type GlobeContextType, type Point, type Vector, useGlobeContext } 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\nconst DEFAULT_ZOOM = 1.5;\n\ntype GlobeRootProps = Partial<Pick<GlobeContextType, 'center' | 'zoom' | 'translation' | 'rotation'>>;\n\nconst GlobeRoot = composable<HTMLDivElement, GlobeRootProps>(\n (\n {\n children,\n center: centerProp,\n zoom: zoomProp = DEFAULT_ZOOM,\n translation: translationProp,\n rotation: rotationProp,\n ...props\n },\n forwardedRef,\n ) => {\n const localRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs<HTMLDivElement>(localRef, forwardedRef);\n const { width, height } = useResizeDetector<HTMLDivElement>({ targetRef: localRef });\n\n const [center, setCenter] = useControlledState(centerProp);\n const [zoom, setZoom] = useControlledState(zoomProp);\n const [translation, setTranslation] = useControlledState<Point>(translationProp);\n const [rotation, setRotation] = useControlledState<Vector>(rotationProp);\n\n return (\n <GlobeContext.Provider\n value={{\n size: { width, height },\n center,\n zoom,\n translation,\n rotation,\n setCenter,\n setZoom,\n setTranslation,\n setRotation,\n }}\n >\n <div {...composableProps(props, { classNames: 'relative dx-container' })} ref={composedRef}>\n {children}\n </div>\n </GlobeContext.Provider>\n );\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: projectionProp, topology, features, styles: stylesProp }, forwardRef) => {\n const { themeMode } = useThemeContext();\n const styles = useMemo(() => stylesProp ?? defaultStyles[themeMode], [stylesProp, 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(projectionProp), [projectionProp]);\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 when the center changes. Preserve current zoom — callers can set zoom\n // independently via the `zoom` prop or `setZoom` on the controller.\n useEffect(() => {\n if (center) {\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: (state) => {\n if (typeof state === 'function') {\n const is = interpolateNumber(zoomRef.current, state(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(state);\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-sm',\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 { type Dispatch, type SetStateAction, createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type LatLngLiteral } from '../types';\n\n// TODO(burdon): Factor out common geometry types.\nexport type Size = { width: number; height: number };\n\nexport type Point = { x: number; y: number };\n\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\n/** @internal */\n// TODO(burdon): Replace with radix.\nexport const GlobeContext = createContext<GlobeContextType>(undefined);\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';\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';\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 // TODO(burdon): Redo controlled state.\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, useTranslation } from '@dxos/react-ui';\n\nimport { translationKey } from '#translations';\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 const { t } = useTranslation(translationKey);\n\n return (\n <Toolbar.Root classNames={['gap-2', classNames]}>\n <IconButton\n icon='ph--plus--regular'\n iconOnly\n label={t('zoom-in-icon.button')}\n onClick={() => onAction?.('zoom-in')}\n />\n <IconButton\n icon='ph--minus--regular'\n iconOnly\n label={t('zoom-out-icon.button')}\n onClick={() => onAction?.('zoom-out')}\n />\n </Toolbar.Root>\n );\n};\n\nexport const ActionControls = ({ classNames, onAction }: ControlProps) => {\n const { t } = useTranslation(translationKey);\n\n return (\n <Toolbar.Root classNames={['gap-2', classNames]}>\n <IconButton\n icon='ph--path--regular'\n iconOnly\n label={t('start-icon.button')}\n onClick={() => onAction?.('start')}\n />\n <IconButton\n icon='ph--globe-hemisphere-west--regular'\n iconOnly\n label={t('toggle-icon.button')}\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 } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { MapContainer, type MapContainerProps, Marker, Popup, TileLayer, useMap, useMapEvents } from 'react-leaflet';\n\nimport { type ThemedClassName, ThemeProvider, Tooltip } from '@dxos/react-ui';\nimport { composable, composableProps, defaultTx, mx } from '@dxos/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 getCenter: () => LatLngLiteral | undefined;\n getZoom: () => number | undefined;\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 [MapContextProvider, useMapContext] = createContext<MapContextValue>('Map');\n\n//\n// Root\n//\n\ntype MapRootProps = Pick<MapContextValue, 'onChange'>;\n\n/**\n * Context provider for the map. Must wrap Map.Content.\n */\nconst MapRoot = composable<HTMLDivElement, MapRootProps>(({ children, onChange, ...props }, forwardedRef) => {\n // TODO(burdon): Use attention: const [attention, setAttention] = useState(false);\n const attention = false;\n return (\n <MapContextProvider attention={attention} onChange={onChange}>\n <div\n {...composableProps(props, {\n role: 'none',\n classNames: 'dx-container grid dx-focus-ring-inset',\n })}\n ref={forwardedRef}\n >\n {children}\n </div>\n </MapContextProvider>\n );\n});\n\nMapRoot.displayName = 'Map.Root';\n\n//\n// Content\n//\n\ntype MapContentProps = ThemedClassName<Omit<MapContainerProps, 'children'> & PropsWithChildren>;\n\n/**\n * https://react-leaflet.js.org/docs/api-map\n */\nconst MAP_CONTENT_NAME = 'Map.Content';\n\nconst MapContent = forwardRef<MapController, MapContentProps>(\n (\n { classNames, scrollWheelZoom = true, doubleClickZoom = true, touchZoom = true, center, zoom, children, ...props },\n forwardedRef,\n ) => {\n const { attention } = useMapContext(MAP_CONTENT_NAME);\n const mapRef = useRef<L.Map>(null);\n const map = mapRef.current;\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n getCenter: () => {\n const center = mapRef.current?.getCenter();\n return center ? { lat: center.lat, lng: center.lng } : undefined;\n },\n getZoom: () => mapRef.current?.getZoom(),\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 <MapContainer\n {...props}\n className={mx('group relative grid bg-base-surface!', 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 ref={mapRef}\n >\n {children}\n </MapContainer>\n );\n },\n);\n\nMapContent.displayName = 'Map.Content';\n\n//\n// Tiles\n// https://react-leaflet.js.org/docs/api-components/#tilelayer\n//\n\nconst MAP_TILES_NAME = 'Map.Tiles';\n\ntype MapTilesProps = {};\n\nconst MapTiles = (_props: MapTilesProps) => {\n const ref = useRef<L.TileLayer>(null);\n const { onChange } = useMapContext(MAP_TILES_NAME);\n\n useMapEvents({\n moveend: (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(MAP_TILES_NAME);\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_NAME;\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 // Fit the viewport around the markers. When there are no markers, leave the current view alone\n // so caller-provided center/zoom (or the user's prior interaction) is preserved.\n useEffect(() => {\n if (markers && markers.length > 0) {\n const bounds = latLngBounds(markers.map((marker) => marker.location));\n map.fitBounds(bounds);\n }\n }, [markers, map]);\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 Content: MapContent,\n Tiles: MapTiles,\n Markers: MapMarkers,\n Zoom: MapZoom,\n Action: MapAction,\n};\n\nexport {\n type MapController,\n type MapRootProps,\n type MapContentProps,\n type MapTilesProps,\n type MapMarkersProps,\n type MapControlProps,\n};\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,SAGEC,iBACAC,oBACAC,eACAC,uBACK;AACP,SAASC,YAAYC,iBAAiBC,UAAU;;;AChChD,SAA6CC,eAAeC,kBAAkB;AAE9E,SAASC,aAAa;AAyBf,IAAMC,eAAeH,8BAAgC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WAAKE,OACH,gBAAAvF,OAAA,cAACwF,eAAAA;QAAcC,IAAIC;SACjB,gBAAA1F,OAAA,cAAC2F,QAAQC,UAAQ,MAAEjG,QAAAA,CAAAA,CAAAA;AAIvB,aAAOmF;IACT;AAEAH,YAAQkB,MAAM9E,GAAAA;AACd,WAAO,MAAA;AACL4D,cAAQmB,OAAM;IAChB;EACF,GAAG;IAAC/E;IAAK+C;IAAUnE;GAAS;AAE5B,SAAO;AACT;AAIA,IAAMoG,UAAU,CAAC,EAAEC,UAAUlC,WAAW,cAAc,GAAGjE,MAAAA,MACvD,gBAAAG,OAAA,cAAC0E,gBAAAA;EAAcZ;EAAqB,GAAGjE;GACrC,gBAAAG,OAAA,cAACiG,cAAAA;EAAaD;;AAIlB,IAAME,YAAY,CAAC,EAAEF,UAAUlC,WAAW,eAAe,GAAGjE,MAAAA,MAC1D,gBAAAG,OAAA,cAAC0E,gBAAAA;EAAcZ;EAAqB,GAAGjE;GACrC,gBAAAG,OAAA,cAACmG,gBAAAA;EAAeH;;AAQb,IAAMI,MAAM;EACjBC,MAAM5G;EACN6G,SAAS9F;EACT+F,OAAOpE;EACPqE,SAASxD;EACTyD,MAAMV;EACNW,QAAQR;AACV;",
|
|
6
|
+
"names": ["easeLinear", "easeSinOut", "geoMercator", "geoOrthographic", "geoPath", "geoTransverseMercator", "interpolateNumber", "transition", "React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useRef", "useState", "useResizeDetector", "useComposedRefs", "useControlledState", "useDynamicRef", "useThemeContext", "composable", "composableProps", "mx", "createContext", "useContext", "raise", "GlobeContext", "undefined", "useGlobeContext", "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", "inertia", "geoInertiaDragHelper", "rotation", "rotate", "xAxis", "start", "move", "end", "stop", "finish", "time", "hold", "call", "on", "opt", "v0", "r0", "q0", "v10", "v11", "q10", "inertiaHelper", "cartesian", "invert", "position", "inv", "isNaN", "v1", "q1", "multiply", "delta", "r1", "r2", "velocity", "t", "A", "limit", "B", "Math", "log", "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", "radius", "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", "event", "setZoom", "zoom", "useCallback", "useMapZoomHandler", "controller", "event", "setZoom", "scale", "timer", "d3Timer", "useEffect", "useState", "useSpinner", "controller", "options", "running", "setRunning", "start", "delta", "t", "lastRotation", "projection", "rotate", "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", "useTranslation", "translationKey", "controlPositions", "topleft", "topright", "bottomleft", "bottomright", "ZoomControls", "classNames", "onAction", "t", "Root", "icon", "iconOnly", "label", "onClick", "ActionControls", "defaultStyles", "light", "background", "fillStyle", "water", "land", "line", "strokeStyle", "point", "strokeWidth", "pointRadius", "dark", "projectionMap", "orthographic", "geoOrthographic", "mercator", "geoMercator", "geoTransverseMercator", "getProjection", "type", "constructor", "DEFAULT_ZOOM", "GlobeRoot", "composable", "children", "center", "centerProp", "zoom", "zoomProp", "translation", "translationProp", "rotation", "rotationProp", "props", "forwardedRef", "localRef", "useRef", "composedRef", "useComposedRefs", "width", "height", "useResizeDetector", "targetRef", "setCenter", "useControlledState", "setZoom", "setTranslation", "setRotation", "React", "GlobeContext", "Provider", "value", "size", "div", "composableProps", "classNames", "ref", "GlobeCanvas", "forwardRef", "projection", "projectionProp", "topology", "features", "styles", "stylesProp", "themeMode", "useThemeContext", "useMemo", "canvas", "setCanvas", "useState", "canvasRef", "layers", "timer", "createLayers", "useGlobeContext", "zoomRef", "useDynamicRef", "useEffect", "positionToRotation", "geoToPosition", "zooming", "useImperativeHandle", "current", "state", "is", "interpolateNumber", "transition", "ease", "easeLinear", "easeSinOut", "duration", "tween", "t", "on", "generator", "geoPath", "getContext", "alpha", "scale", "Math", "min", "translate", "x", "y", "rotate", "renderLayers", "GlobeDebug", "position", "className", "mx", "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", "createRoot", "MapContainer", "Marker", "Popup", "TileLayer", "useMap", "useMapEvents", "ThemeProvider", "Tooltip", "composable", "composableProps", "defaultTx", "mx", "defaults", "center", "lat", "lng", "zoom", "MapContextProvider", "useMapContext", "createContext", "MapRoot", "composable", "children", "onChange", "props", "forwardedRef", "attention", "React", "div", "composableProps", "role", "classNames", "ref", "displayName", "MAP_CONTENT_NAME", "MapContent", "forwardRef", "scrollWheelZoom", "doubleClickZoom", "touchZoom", "mapRef", "useRef", "map", "current", "useImperativeHandle", "getCenter", "undefined", "getZoom", "setCenter", "setView", "setZoom", "cb", "useEffect", "enable", "disable", "MapContainer", "className", "mx", "attributionControl", "zoomControl", "whenReady", "MAP_TILES_NAME", "MapTiles", "_props", "useMapEvents", "moveend", "ev", "target", "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", "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", "Content", "Tiles", "Markers", "Zoom", "Action"]
|
|
7
7
|
}
|