@dxos/react-ui-geo 0.8.4-staging.ac66bdf99f → 0.9.0
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/data/countries-10m.ts +12 -0
- package/data/countries-110m.ts +4 -10579
- package/data/countries-50m.ts +12 -0
- package/dist/lib/browser/chunk-SC2FBYFU.mjs +17 -0
- package/dist/lib/browser/chunk-SC2FBYFU.mjs.map +7 -0
- package/dist/lib/browser/countries-10m-CWWDOKH7.mjs +6 -0
- package/dist/lib/browser/countries-10m-CWWDOKH7.mjs.map +7 -0
- package/dist/lib/browser/countries-110m-72QBAA5E.mjs +6 -0
- package/dist/lib/browser/countries-110m-72QBAA5E.mjs.map +7 -0
- package/dist/lib/browser/countries-50m-H7SL7KVF.mjs +6 -0
- package/dist/lib/browser/countries-50m-H7SL7KVF.mjs.map +7 -0
- package/dist/lib/browser/data.mjs +1 -1
- package/dist/lib/browser/index.mjs +774 -223
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +19 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VZENBYLJ.mjs +19 -0
- package/dist/lib/node-esm/chunk-VZENBYLJ.mjs.map +7 -0
- package/dist/lib/node-esm/countries-10m-DJZV66KG.mjs +8 -0
- package/dist/lib/node-esm/countries-10m-DJZV66KG.mjs.map +7 -0
- package/dist/lib/node-esm/countries-110m-H3WY6K4Q.mjs +8 -0
- package/dist/lib/node-esm/countries-110m-H3WY6K4Q.mjs.map +7 -0
- package/dist/lib/node-esm/countries-50m-ZY7Z3IWD.mjs +8 -0
- package/dist/lib/node-esm/countries-50m-ZY7Z3IWD.mjs.map +7 -0
- package/dist/lib/node-esm/data.mjs +1 -1
- package/dist/lib/node-esm/index.mjs +774 -223
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +21 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/data/airports.d.ts +4 -4
- package/dist/types/data/airports.d.ts.map +1 -1
- package/dist/types/data/cities.d.ts.map +1 -1
- package/dist/types/data/countries-10m.d.ts +8 -0
- package/dist/types/data/countries-10m.d.ts.map +1 -0
- package/dist/types/data/countries-110m.d.ts +2 -30
- package/dist/types/data/countries-110m.d.ts.map +1 -1
- package/dist/types/data/countries-50m.d.ts +8 -0
- package/dist/types/data/countries-50m.d.ts.map +1 -0
- package/dist/types/data/countries-dots-3.d.ts.map +1 -1
- package/dist/types/data/countries-dots-4.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +18 -10
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +16 -8
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.d.ts +49 -13
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.stories.d.ts +9 -5
- package/dist/types/src/components/Map/Map.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
- package/dist/types/src/data.d.ts +9 -1
- package/dist/types/src/data.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts +37 -0
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrag.d.ts +22 -2
- package/dist/types/src/hooks/useDrag.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts +3 -2
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useSimplifiedTopology.d.ts +32 -0
- package/dist/types/src/hooks/useSimplifiedTopology.d.ts.map +1 -0
- package/dist/types/src/hooks/useSpinner.d.ts +1 -1
- package/dist/types/src/hooks/useSpinner.d.ts.map +1 -1
- package/dist/types/src/hooks/useTopology.d.ts +26 -0
- package/dist/types/src/hooks/useTopology.d.ts.map +1 -0
- package/dist/types/src/hooks/useTour.d.ts +3 -2
- package/dist/types/src/hooks/useTour.d.ts.map +1 -1
- package/dist/types/src/hooks/useWheel.d.ts +24 -0
- package/dist/types/src/hooks/useWheel.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -4
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/animation.d.ts +16 -0
- package/dist/types/src/util/animation.d.ts.map +1 -0
- package/dist/types/src/util/debug.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/inertia.d.ts.map +1 -1
- package/dist/types/src/util/path.d.ts.map +1 -1
- package/dist/types/src/util/render.d.ts +25 -1
- package/dist/types/src/util/render.d.ts.map +1 -1
- package/dist/types/src/util/styles.d.ts +4 -0
- package/dist/types/src/util/styles.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -24
- package/src/components/Globe/Globe.stories.tsx +135 -58
- package/src/components/Globe/Globe.tsx +237 -120
- package/src/components/Map/Map.stories.tsx +58 -12
- package/src/components/Map/Map.tsx +293 -91
- package/src/components/Toolbar/Controls.tsx +1 -1
- package/src/data.ts +19 -2
- package/src/hooks/context.tsx +44 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useDrag.ts +33 -5
- package/src/hooks/useGlobeZoomHandler.ts +2 -1
- package/src/hooks/useSimplifiedTopology.ts +81 -0
- package/src/hooks/useSpinner.ts +1 -1
- package/src/hooks/useTopology.ts +95 -0
- package/src/hooks/useTour.ts +70 -81
- package/src/hooks/useWheel.ts +83 -0
- package/src/index.ts +0 -2
- package/src/util/animation.ts +35 -0
- package/src/util/index.ts +2 -0
- package/src/util/inertia.ts +87 -4
- package/src/util/render.ts +105 -16
- package/src/util/styles.ts +62 -0
- package/dist/lib/browser/chunk-GMWLKTLN.mjs +0 -9
- package/dist/lib/browser/chunk-GMWLKTLN.mjs.map +0 -7
- package/dist/lib/browser/countries-110m-ZM3ZIEFS.mjs +0 -37859
- package/dist/lib/browser/countries-110m-ZM3ZIEFS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JODBF4CC.mjs +0 -11
- package/dist/lib/node-esm/chunk-JODBF4CC.mjs.map +0 -7
- package/dist/lib/node-esm/countries-110m-3SFASWVD.mjs +0 -37861
- package/dist/lib/node-esm/countries-110m-3SFASWVD.mjs.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 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/
|
|
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 { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-geo';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'zoom-in-icon.button': 'Zoom in',\n 'zoom-out-icon.button': 'Zoom out',\n 'start-icon.button': 'Start',\n 'toggle-icon.button': 'Toggle',\n },\n },\n },\n] as const satisfies Resource[];\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,mBACAC,kBACK;AAEP,OAAOC,UAELC,YACAC,aAAAA,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AAA;AACvCa,YAAQE,QAAQ,MAAA;AACd,YAAMC,YAAYC,QAAQC,OAAO,OAAOnD,IAAG,QAAQoD,iBAAiBnB,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", "createContext", "undefined", "useGlobeContext", "useContext", "raise", "Error", "select", "useEffect", "debug", "timer", "cb", "start", "Date", "now", "data", "t", "console", "log", "drag", "select", "timer", "versor", "restrictAxis", "axis", "original", "current", "map", "d", "i", "geoInertiaDrag", "target", "render", "projection", "options", "node", "select", "inertia", "geoInertiaDragHelper", "rotation", "rotate", "xAxis", "start", "move", "end", "stop", "finish", "time", "hold", "call", "drag", "on", "opt", "v0", "r0", "q0", "v10", "v11", "q10", "inertiaHelper", "versor", "cartesian", "invert", "position", "inv", "isNaN", "v1", "q1", "multiply", "delta", "r1", "r2", "velocity", "t", "A", "limit", "B", "Math", "log", "timer", "ev", "x", "y", "classList", "remove", "add", "performance", "now", "deltaTime", "decay", "exp", "deltaPos", "v", "undefined", "self", "restart", "e", "geoCircle", "d3GeoCircle", "positionToRotation", "lng", "lat", "tilt", "geoToPosition", "geoPoint", "point", "type", "coordinates", "geoCircle", "radius", "d3GeoCircle", "center", "geoLine", "p1", "p2", "closestPoint", "points", "target", "length", "minDistance", "getDistance", "distance", "point1", "point2", "dx", "dy", "Math", "sqrt", "geoGraticule", "feature", "mesh", "createLayers", "topology", "features", "styles", "layers", "water", "push", "path", "type", "graticule", "geoGraticule", "step", "objects", "land", "feature", "countries", "border", "mesh", "a", "b", "dots", "points", "lines", "point", "geometries", "map", "geoPoint", "line", "source", "target", "geoLine", "renderLayers", "generator", "scale", "context", "canvas", "width", "height", "reset", "background", "fillStyle", "fillRect", "clearRect", "forEach", "save", "fill", "stroke", "Object", "entries", "key", "value", "pointRadius", "beginPath", "restore", "useDrag", "controller", "options", "useEffect", "canvas", "disabled", "geoInertiaDrag", "select", "setRotation", "projection", "rotate", "onUpdate", "type", "xAxis", "time", "start", "finish", "cancelDrag", "JSON", "stringify", "node", "on", "useCallback", "ZOOM_FACTOR", "useGlobeZoomHandler", "controller", "useCallback", "event", "setZoom", "zoom", "useCallback", "useMapZoomHandler", "controller", "useCallback", "event", "setZoom", "scale", "timer", "d3Timer", "useEffect", "useState", "useSpinner", "controller", "options", "running", "setRunning", "useState", "useEffect", "timer", "start", "delta", "t", "lastRotation", "projection", "rotate", "d3Timer", "elapsed", "dt", "rotation", "setRotation", "stop", "undefined", "disabled", "selection", "d3Selection", "geoDistance", "geoInterpolate", "geoPath", "useEffect", "useMemo", "useState", "versor", "TRANSITION_NAME", "defaultDuration", "useTour", "controller", "points", "options", "selection", "useMemo", "d3Selection", "running", "setRunning", "useState", "useEffect", "interrupt", "t", "setTimeout", "canvas", "projection", "setRotation", "context", "getContext", "alpha", "path", "geoPath", "pointRadius", "tilt", "last", "p", "loop", "push", "next", "p1", "geoToPosition", "undefined", "p2", "ip", "geoInterpolate", "distance", "geoDistance", "r1", "positionToRotation", "rotate", "r2", "iv", "versor", "interpolate", "transition", "duration", "Math", "max", "tween", "t1", "min", "t2", "save", "beginPath", "strokeStyle", "styles", "arc", "lineWidth", "zoom", "setLineDash", "lineDash", "type", "coordinates", "stroke", "fillStyle", "cursor", "fill", "restore", "end", "clearTimeout", "JSON", "stringify", "React", "IconButton", "Toolbar", "useTranslation", "translationKey", "translations", "controlPositions", "topleft", "topright", "bottomleft", "bottomright", "ZoomControls", "classNames", "onAction", "t", "useTranslation", "translationKey", "Toolbar", "Root", "IconButton", "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", "getZoom", "useEffect", "enable", "disable", "MapContainer", "className", "mx", "attributionControl", "zoomControl", "whenReady", "MAP_TILES_NAME", "MapTiles", "_props", "useMapEvents", "zoomstart", "ev", "target", "getCenter", "getContainer", "dataset", "TileLayer", "data-attention", "detectRetina", "url", "keepBuffer", "MapMarkers", "selected", "markers", "useMap", "length", "bounds", "latLngBounds", "marker", "location", "fitBounds", "id", "title", "Marker", "key", "position", "icon", "L", "Icon", "iconUrl", "iconRetinaUrl", "shadowUrl", "iconSize", "iconAnchor", "popupAnchor", "shadowSize", "Popup", "CustomControl", "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"]
|
|
3
|
+
"sources": ["../../../src/components/Globe/Globe.tsx", "../../../src/hooks/context.tsx", "../../../src/hooks/useDrag.ts", "../../../src/util/animation.ts", "../../../src/util/debug.ts", "../../../src/util/inertia.ts", "../../../src/util/path.ts", "../../../src/util/render.ts", "../../../src/util/styles.ts", "../../../src/hooks/useGlobeZoomHandler.ts", "../../../src/hooks/useMapZoomHandler.ts", "../../../src/hooks/useSimplifiedTopology.ts", "../../../src/hooks/useSpinner.ts", "../../../src/hooks/useTopology.ts", "../../../src/hooks/useTour.ts", "../../../src/hooks/useWheel.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 selection as d3Selection,\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 useCallback,\n useEffect,\n useId,\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 } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport {\n GlobeContext,\n type GlobeContextType,\n type GlobeController,\n type Point,\n type Size,\n type Vector,\n useGlobeContext,\n} from '../../hooks';\nimport {\n type Features,\n type StyleSet,\n createLayers,\n createRotationTween,\n flyDuration,\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 water: {\n fillStyle: '#555',\n },\n land: {\n fillStyle: '#999',\n },\n line: {\n strokeStyle: 'darkred',\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 water: {\n fillStyle: '#123E6A',\n },\n land: {\n fillStyle: '#032153',\n },\n line: {\n strokeStyle: '#111111',\n },\n point: {\n fillStyle: '#111111',\n strokeStyle: '#111111',\n strokeWidth: 1,\n pointRadius: 0.5,\n },\n },\n};\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 PropsWithChildren;\n\n/**\n * Headless context/state provider for the globe. Renders no DOM; wrap a `Globe.Viewport` to mount\n * the measured container. The current `GlobeController` (built by `Globe.Canvas`) is exposed via\n * this component's `ref`.\n */\nconst GlobeRoot = forwardRef<GlobeController | null, GlobeRootProps>(\n (\n {\n children,\n center: centerProp,\n zoom: zoomProp = DEFAULT_ZOOM,\n translation: translationProp,\n rotation: rotationProp,\n },\n forwardedRef,\n ) => {\n const [size, setSize] = useState<Size>({ width: 0, height: 0 });\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 // The controller is built by Globe.Canvas and registered here; Globe.Root re-exposes it via its\n // ref. Held in state (not a ref) so that when Globe.Canvas registers a new controller, Root\n // re-renders and the imperative handle below updates — re-running consumer effects keyed on the\n // controller (e.g. useDrag/useWheel) once the canvas mounts.\n const [controller, setController] = useState<GlobeController | null>(null);\n const registerController = useCallback((next: GlobeController | null) => setController(next), []);\n\n // Expose the live controller (or null until Globe.Canvas mounts) via Root's ref.\n useImperativeHandle(forwardedRef, () => controller, [controller]);\n\n return (\n <GlobeContext.Provider\n value={{\n size,\n center,\n zoom,\n translation,\n rotation,\n setSize,\n setCenter,\n setZoom,\n setTranslation,\n setRotation,\n registerController,\n }}\n >\n {children}\n </GlobeContext.Provider>\n );\n },\n);\n\nGlobeRoot.displayName = 'Globe.Root';\n\n//\n// Viewport\n//\n\n/** Consumer-facing props for `Globe.Viewport` (classNames + children). */\ntype GlobeViewportProps = ThemedClassName<PropsWithChildren>;\n\n/**\n * Measured container for the globe. Renders the `relative dx-container` div, observes its size, and\n * publishes measurements to the context so `Globe.Canvas` can size the canvas.\n */\nconst GlobeViewport = composable<HTMLDivElement>(({ children, ...props }, forwardedRef) => {\n const { setSize } = useGlobeContext();\n const localRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs<HTMLDivElement>(localRef, forwardedRef);\n const { width, height } = useResizeDetector<HTMLDivElement>({ targetRef: localRef });\n\n useEffect(() => {\n setSize({ width: width ?? 0, height: height ?? 0 });\n }, [width, height, setSize]);\n\n return (\n <div {...composableProps(props, { classNames: 'relative dx-container' })} ref={composedRef}>\n {children}\n </div>\n );\n});\n\nGlobeViewport.displayName = 'Globe.Viewport';\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. Builds the imperative `GlobeController` and registers it with `Globe.Root`\n * (via `registerController` from context) so consumers reading the controller from Root's ref get\n * the live instance.\n * https://github.com/topojson/world-atlas\n */\nconst GlobeCanvas = ({ projection: projectionProp, topology, features, styles: stylesProp }: GlobeCanvasProps) => {\n const { themeMode } = useThemeContext();\n const styles = useMemo(() => stylesProp ?? defaultStyles[themeMode], [stylesProp, themeMode]);\n const { size, center, zoom, translation, rotation, setZoom, setTranslation, setRotation, registerController } =\n useGlobeContext();\n\n const zoomRef = useDynamicRef(zoom);\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 // 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 // Per-instance flyTo plumbing. d3 named transitions are scoped per DOM\n // element and `d3Selection()` returns the documentElement root, so a\n // shared name would let one globe's flyTo interrupt another's. The\n // useId-scoped name keeps each Globe.Canvas's transition isolated.\n const flyToSelection = useMemo(() => d3Selection(), []);\n const flyToTransitionName = `globe-fly-to-${useId()}`;\n useEffect(\n () => () => {\n flyToSelection.interrupt(flyToTransitionName);\n },\n [flyToSelection, flyToTransitionName],\n );\n\n // External controller.\n const zooming = useRef(false);\n const controller = useMemo<GlobeController>(() => {\n return {\n canvas,\n projection,\n get zoom() {\n return zoomRef.current;\n },\n translation,\n rotation,\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 flyTo: (target, options = {}) => {\n const { duration = 1_200, tilt = 0, onTick } = options;\n const p2 = geoToPosition(target);\n const r1 = projection.rotate() as Vector;\n const r2 = positionToRotation(p2, tilt);\n\n // Approximate current centre from the inverse of the rotation.\n const p1: [number, number] = [-r1[0], -r1[1]];\n const rotationTween = createRotationTween(projection, setRotation, r1, r2);\n const iz = target.zoom !== undefined ? interpolateNumber(zoomRef.current, target.zoom) : undefined;\n\n flyToSelection.interrupt(flyToTransitionName);\n const tx = flyToSelection.transition(flyToTransitionName).duration(flyDuration(p1, p2, duration, 1_500));\n if (onTick) {\n tx.tween('flyToOnTick', () => onTick);\n }\n tx.tween('flyToRotation', () => rotationTween);\n if (iz) {\n tx.tween('flyToZoom', () => (t: number) => setZoom(iz(t)));\n }\n return tx.end();\n },\n cancelFlyTo: () => {\n flyToSelection.interrupt(flyToTransitionName);\n },\n };\n // Keep the controller IDENTITY stable: only rebuild on these mount-stable deps. Deliberately\n // exclude `center`/`translation`/`rotation` — they are read here as closure snapshots, and\n // callers pass them as inline literals (e.g. `rotation={[0, 0, 0]}`), so a fresh reference every\n // render would rebuild the controller, re-fire `registerController`, re-render Root, hand a new\n // controller back through the consumer's `ref={setController}`, and loop forever. `projection`\n // must stay in deps: switching between stories that pass different projection types creates a new\n // instance via useMemo, and any consumer reading controller.projection (e.g. useDrag) would\n // otherwise mutate a dead instance while the canvas renders the new one. The `useControlledState`\n // setters and `zoomRef` are stable, so they need not be listed.\n }, [canvas, projection, flyToSelection, flyToTransitionName]);\n\n // Register the controller with Globe.Root and clear it on unmount.\n useEffect(() => {\n registerController(controller);\n return () => registerController(null);\n }, [registerController, controller]);\n\n // https://d3js.org/d3-geo/path#geoPath\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n // Keep the context alpha-enabled: when a style set omits `background`, `renderLayers`\n // clears to transparent so the canvas's themed CSS background (below) shows through the\n // area outside the globe — correct in both light and dark mode.\n const generator = useMemo(\n () => canvas && projection && geoPath(projection, canvas.getContext('2d')),\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 // Provide a view-center for per-frame culling — only meaningful for\n // projections that present a single visible hemisphere (e.g.\n // orthographic). For Mercator/transverse-mercator the whole sphere\n // is always visible, so we skip culling.\n const isOrthographic = !projectionProp || projectionProp === 'orthographic';\n const [lambda, phi] = (rotation ?? [0, 0, 0]) as Vector;\n const viewCenter: [number, number] | undefined = isOrthographic ? [-lambda, -phi] : undefined;\n\n renderLayers(generator, layers, zoom, styles, viewCenter);\n });\n }\n }, [generator, size, zoom, translation, rotation, layers, projectionProp]);\n\n if (!size.width || !size.height) {\n return null;\n }\n\n return <canvas ref={canvasRef} className='bg-base-surface' width={size.width} height={size.height} />;\n};\n\nGlobeCanvas.displayName = 'Globe.Canvas';\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 Viewport: GlobeViewport,\n Canvas: GlobeCanvas,\n Zoom: GlobeZoom,\n Action: GlobeAction,\n Debug: GlobeDebug,\n Panel: GlobePanel,\n};\n\nexport type { GlobeRootProps, GlobeViewportProps, GlobeCanvasProps };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type GeoProjection } from 'd3';\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 setSize: Dispatch<SetStateAction<Size>>;\n setCenter: Dispatch<SetStateAction<LatLngLiteral>>;\n setZoom: Dispatch<SetStateAction<number>>;\n setTranslation: Dispatch<SetStateAction<Point>>;\n setRotation: Dispatch<SetStateAction<Vector>>;\n /** Registers (or clears) the controller built by Globe.Canvas so Globe.Root can expose it via its ref. */\n registerController: (controller: GlobeController | null) => void;\n};\n\n//\n// Controller\n//\n\n/**\n * Imperative options accepted by GlobeController.flyTo.\n */\nexport type FlyToOptions = {\n /** Base duration in ms (scales with great-circle distance). */\n duration?: number;\n /** Optional pitch offset applied along the latitude axis of the target. */\n tilt?: number;\n /**\n * Optional per-frame callback fired before the rotation tween advances.\n * Useful for layered animations (e.g. cursor / arc trails in tours).\n * `t` runs 0→1 across the eased duration.\n */\n onTick?: (t: number) => void;\n};\n\nexport type FlyToTarget = LatLngLiteral & {\n /** Optional zoom factor; interpolated alongside rotation when set. */\n zoom?: number;\n};\n\nexport type GlobeController = {\n canvas: HTMLCanvasElement;\n projection: GeoProjection;\n /**\n * Animates the globe to the given lat/lng (and optional zoom) along a\n * great-circle arc. Returns a Promise that resolves on completion and\n * rejects if interrupted (e.g. by another flyTo on the same globe).\n */\n flyTo: (target: FlyToTarget, options?: FlyToOptions) => Promise<void>;\n /**\n * Interrupts any in-flight `flyTo` (used by tours when stopped mid-segment).\n */\n cancelFlyTo: () => void;\n} & Pick<GlobeContextType, 'zoom' | 'translation' | 'rotation' | 'setZoom' | 'setTranslation' | 'setRotation'>;\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 { geoInertiaDrag } from '../util';\nimport { type GlobeController } from './context';\n\nexport type GlobeDragEvent = {\n type: 'start' | 'move' | 'end';\n controller: GlobeController;\n};\n\nexport type DragOptions = {\n disabled?: boolean;\n duration?: number;\n /**\n * When true, drag is constrained to rotation around the polar (vertical)\n * axis only — i.e. longitude changes freely but the camera's tilt\n * (latitude / phi) stays pinned at whatever value the root's `rotation`\n * prop was initialised with. Useful for \"earth-spinning-at-an-angle\"\n * presentations where the inclination should not change.\n */\n lockTilt?: boolean;\n /**\n * Drag rotation mode:\n * - `linear` (default): direct pixel-to-Euler mapping (Δx → lambda,\n * Δy → phi, gamma fixed at 0). Rotation is constrained to two axes;\n * no roll. The dragged point does not track the cursor exactly.\n * - `versor`: quaternion-based rotation so that the dragged point\n * follows the cursor exactly. May induce roll (gamma).\n */\n mode?: 'linear' | 'versor';\n /**\n * Degrees of rotation per pixel of drag, in linear mode. Default 0.25.\n */\n sensitivity?: number;\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 const inertia = geoInertiaDrag(\n select(canvas),\n () => {\n controller.setRotation(controller.projection.rotate());\n options.onUpdate?.({ type: 'move', controller });\n },\n controller.projection,\n {\n lockTilt: options.lockTilt,\n mode: options.mode,\n sensitivity: options.sensitivity,\n // Zoom-driven gain: matches useWheel — degrees-per-pixel shrinks as the\n // globe gets larger on screen so the drag feel is consistent across zoom.\n getZoom: () => controller.zoom,\n time: 3_000,\n start: () => options.onUpdate?.({ type: 'start', controller }),\n finish: () => options.onUpdate?.({ type: 'end', controller }),\n },\n );\n\n return () => {\n cancelDrag(select(canvas));\n // Stop any in-flight inertia: otherwise its d3-timer keeps writing\n // through the (stable) setRotation closure into the live React state,\n // even after this effect has been replaced.\n inertia?.timer?.stop();\n };\n }, [controller, JSON.stringify(options)]);\n};\n\nconst cancelDrag = (node) => node.on('.drag', null);\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { type GeoProjection, geoDistance } from 'd3';\nimport versor from 'versor';\n\nimport { type Vector } from '../hooks/context';\n\n/**\n * Duration scaled by great-circle distance between two geo positions.\n * Ensures long jumps animate longer than short ones while clamping to a\n * minimum base. `scale` controls how steeply duration grows with distance\n * (ms per radian of arc).\n */\nexport const flyDuration = (p1: [number, number], p2: [number, number], base: number, scale: number): number =>\n Math.max(base, geoDistance(p1, p2) * scale);\n\n/**\n * Per-frame tween that interpolates the projection's rotation between two\n * Euler triples along the shortest great-circle arc using versors. Mutates\n * the projection and pushes the normalised rotation through `setRotation`.\n */\nexport const createRotationTween = (\n projection: GeoProjection,\n setRotation: (rotation: Vector) => void,\n r1: Vector,\n r2: Vector,\n): ((t: number) => void) => {\n const iv = versor.interpolate(r1, r2);\n return (t: number) => {\n projection.rotate(iv(t));\n setRotation(projection.rotate() as Vector);\n };\n};\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 // `linear` (default) constrains rotation so that mouse Δx maps to lambda\n // (polar spin) and Δy maps to phi (tilt); gamma is held at 0.\n // `versor` lets the dragged point follow the cursor exactly, at the cost of\n // inducing some roll. In linear mode `lockTilt` keeps phi pinned but still\n // allows lambda from Δx.\n const linear = (options.mode ?? 'linear') === 'linear';\n const axis = restrictAxis(options.lockTilt ? [true, false, false] : [true, true, true]);\n const sharedHandlers = {\n projection,\n render: (rotation) => {\n projection.rotate(rotation);\n render && render();\n },\n axis,\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 // Complete params: (projection, render, startDrag, dragging, endDrag).\n const inertia = linear\n ? geoInertiaDragLinearHelper({\n ...sharedHandlers,\n sensitivity: options.sensitivity,\n getZoom: options.getZoom,\n })\n : geoInertiaDragHelper(sharedHandlers);\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\n/**\n * Linear pixel-to-Euler drag: Δx → lambda, Δy → phi, gamma fixed at 0.\n * Inertia spin-down reuses the same shared decay curve as the versor path.\n */\nconst DEFAULT_LINEAR_SENSITIVITY = 0.25;\n\nconst geoInertiaDragLinearHelper = (opt) => {\n const projection = opt.projection;\n const sensitivity = opt.sensitivity ?? DEFAULT_LINEAR_SENSITIVITY;\n // Scale degrees-per-pixel by 1/zoom so the drag feels consistent at any zoom\n // level (mirrors useWheel — a more zoomed-in globe needs smaller angular\n // rotation per pixel of cursor travel). Clamped to a floor so very small\n // zoom values don't blow up the gain.\n const gain = () => sensitivity / Math.max(opt.getZoom?.() ?? 1, 0.1);\n\n let r0; // Projection rotation as Euler angles at start of drag.\n let p0; // Pointer pixel position at start of drag.\n let kStart; // Gain captured at start of drag (held for the gesture + inertia).\n let rEnd; // Projection rotation at end of drag.\n let vEnd; // Pointer velocity (px/s) at end of drag.\n\n const inertia = inertiaHelper({\n axis: opt.axis,\n\n start: () => {\n r0 = projection.rotate();\n p0 = [inertia.position[0], inertia.position[1]];\n // Lock the gain at gesture start so a zoom change mid-gesture doesn't\n // teleport the globe; inertia continues at the same gain.\n kStart = gain();\n opt.start && opt.start();\n },\n\n move: () => {\n const dx = inertia.position[0] - p0[0];\n const dy = inertia.position[1] - p0[1];\n // Screen y grows downward; negate so dragging down rotates the globe to\n // match the cursor (matches the feel of the versor-based path).\n const r1 = [r0[0] + dx * kStart, r0[1] - dy * kStart, 0];\n const r2 = opt.axis(r0, r1);\n opt.render(r2);\n opt.move && opt.move();\n },\n\n end: () => {\n rEnd = projection.rotate();\n vEnd = [inertia.velocity[0], inertia.velocity[1]];\n opt.end && opt.end();\n },\n\n stop: opt.stop,\n\n finish: opt.finish,\n\n render: (t) => {\n // t goes 0→1 along the decay curve; at t=1 we've added ~1s of velocity.\n // dy sign flipped to match the move handler.\n const r1 = [rEnd[0] + vEnd[0] * kStart * t, rEnd[1] - vEnd[1] * kStart * t, 0];\n const r2 = opt.axis(rEnd, 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, geoBounds, geoCentroid, geoDistance, geoGraticule } from 'd3';\nimport { type Feature, type Geometry } from 'geojson';\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\n/**\n * Per-feature bounding circle used for view-frustum culling on an\n * orthographic globe. `centroid` is in lon/lat degrees and `radius` is the\n * angular distance (degrees) from the centroid to the farthest sampled\n * vertex of the feature.\n */\nexport type FeatureBounds = {\n geometry: Geometry;\n centroid: [number, number];\n radius: number;\n};\n\nexport type Layer = {\n styles: Styles;\n path: GeoPermissibleObjects;\n /**\n * If present, this layer is treated as a `GeometryCollection` whose\n * member geometries are filtered per-frame by `viewCenter` against each\n * member's `FeatureBounds`. `path` becomes the *unculled* fallback used\n * when no `viewCenter` is supplied (e.g. non-orthographic projections).\n */\n cullable?: FeatureBounds[];\n};\n\nconst RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Compute a spherical bounding circle for a GeoJSON feature. We sample the\n * geoBounds corners (cheap, sufficient for typical country shapes); for\n * features crossing the antimeridian d3.geoBounds returns west > east, which\n * geoDistance handles correctly when called on the actual centroid.\n */\nconst computeBounds = (geometry: Geometry): FeatureBounds => {\n const feat: Feature = { type: 'Feature', geometry, properties: {} };\n const centroid = geoCentroid(feat) as [number, number];\n const [[w, s], [e, n]] = geoBounds(feat);\n // Sample the four bbox corners; widest is the bounding radius.\n const corners: Array<[number, number]> = [\n [w, s],\n [w, n],\n [e, s],\n [e, n],\n ];\n let radius = 0;\n for (const corner of corners) {\n const d = geoDistance(centroid, corner) * RAD_TO_DEG;\n if (d > radius) {\n radius = d;\n }\n }\n return { geometry, centroid, radius };\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 (styles.land) {\n // Prefer the `countries` GeometryCollection over the merged `land`\n // multipolygon so each country can be culled independently. Visually\n // identical (countries collectively tile the land surface).\n if (topology.objects.countries) {\n const fc = feature(topology, topology.objects.countries) as any;\n const memberGeoms: Geometry[] = fc.features.map((f: Feature) => f.geometry);\n const bounds = memberGeoms.map(computeBounds);\n layers.push({\n styles: styles.land,\n path: { type: 'GeometryCollection', geometries: memberGeoms } as any,\n cullable: bounds,\n });\n } else if (topology.objects.land) {\n layers.push({\n styles: styles.land,\n path: feature(topology, topology.objects.land),\n });\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 // Lines first so points (drawn after) sit on top — the route nodes should\n // never be occluded by an arc that passes through them.\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 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\n return layers;\n};\n\n/**\n * Render layers created above.\n *\n * When `viewCenter` is supplied (orthographic globe), layers with a\n * `cullable` index are filtered to just the features whose bounding circle\n * intersects the visible hemisphere — keeping the d3-geo walk proportional\n * to what's actually on-screen.\n */\nexport const renderLayers = (\n generator: GeoPath,\n layers: Layer[] = [],\n scale: number,\n styles: StyleSet,\n viewCenter?: [number, number],\n) => {\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((layer) => {\n const { path, styles, cullable } = layer;\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 let renderPath = path;\n if (cullable && viewCenter) {\n const geometries: Geometry[] = [];\n for (let index = 0; index < cullable.length; index++) {\n const bounds = cullable[index];\n const angularDistance = geoDistance(viewCenter, bounds.centroid) * RAD_TO_DEG;\n if (angularDistance < 90 + bounds.radius) {\n geometries.push(bounds.geometry);\n }\n }\n renderPath = { type: 'GeometryCollection', geometries } as any;\n }\n\n context.beginPath();\n generator(renderPath);\n fill && context.fill();\n stroke && context.stroke();\n context.restore();\n });\n\n return context;\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { type ThemeMode } from '@dxos/react-ui';\n\nimport { type StyleSet } from './render';\n\n/**\n * Default style set for the Globe, theme-aware. Originated in plugin-map's\n * GlobeControl; lifted here so other plugins (plugin-trip, etc.) get the same\n * baseline without copying the palette.\n */\n// Point colour; lines pick up the same colour at reduced alpha so the route\n// reads as belonging to the same node set without competing with the nodes.\nconst POINT_COLOR = 'rgb(220, 38, 38)';\nconst LINE_COLOR = 'rgba(220, 38, 38, 0.5)';\n\nexport const globeStyles = (themeMode: ThemeMode): StyleSet =>\n themeMode === 'dark'\n ? {\n water: {\n fillStyle: '#191919',\n },\n land: {\n fillStyle: '#444',\n strokeStyle: '#222',\n },\n border: {\n strokeStyle: '#111',\n },\n graticule: {\n strokeStyle: '#111',\n },\n line: {\n lineWidth: 1.5,\n lineDash: [4, 16],\n strokeStyle: LINE_COLOR,\n },\n point: {\n radius: 0.2,\n fillStyle: POINT_COLOR,\n },\n }\n : {\n water: {\n fillStyle: '#C0DAE4',\n },\n land: {\n fillStyle: '#C2D8B4',\n strokeStyle: '#A6C291',\n },\n line: {\n lineWidth: 1.5,\n lineDash: [4, 16],\n strokeStyle: LINE_COLOR,\n },\n point: {\n radius: 0.2,\n fillStyle: POINT_COLOR,\n },\n };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type ControlProps } from '../components';\nimport { type GlobeController } from './context';\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 2026 DXOS.org\n//\n\nimport { useMemo } from 'react';\nimport { presimplify, quantile, simplify } from 'topojson-simplify';\nimport { type Topology } from 'topojson-specification';\n\n/**\n * Zoom → minWeight policy. The default thresholds were chosen empirically\n * against the 10m world-atlas dataset: each tier targets a percentile of\n * removable points so that the per-frame d3-geo path cost stays roughly\n * constant as the user zooms in.\n */\nexport type SimplifyTier = {\n /** Lower bound (inclusive) of the zoom range this tier applies to. */\n minZoom: number;\n /** Percentile in [0, 1] passed to `topojson.quantile`. 1 = keep no points; 0 = keep all. */\n percentile: number;\n};\n\nconst DEFAULT_TIERS: SimplifyTier[] = [\n { minZoom: 0, percentile: 0.95 },\n { minZoom: 2, percentile: 0.85 },\n { minZoom: 4, percentile: 0.6 },\n { minZoom: 7, percentile: 0.3 },\n { minZoom: 12, percentile: 0 },\n];\n\nconst pickTier = (zoom: number, tiers: SimplifyTier[]): SimplifyTier => {\n let match = tiers[0];\n for (const tier of tiers) {\n if (zoom >= tier.minZoom) {\n match = tier;\n }\n }\n return match;\n};\n\nexport type UseSimplifiedTopologyOptions = {\n /**\n * Zoom buckets that map a zoom value to a simplification percentile. The\n * hook picks the highest-`minZoom` tier whose bound is ≤ the current zoom,\n * so tiers may be listed in any order but ascending is conventional.\n */\n tiers?: SimplifyTier[];\n};\n\n/**\n * Returns a simplified copy of `topology` whose detail tracks the current\n * `zoom`. The source topology is annotated with point weights once via\n * `presimplify`; subsequent zoom changes reuse that work and only re-run\n * the cheap `simplify` pass against a tier-bucketed `minWeight`.\n *\n * Pass the highest-resolution source you have (typically `10m`) and let the\n * hook decimate at low zoom — that's the cheap end of the curve.\n */\nexport const useSimplifiedTopology = (\n topology: Topology | undefined,\n zoom: number,\n options: UseSimplifiedTopologyOptions = {},\n): Topology | undefined => {\n const { tiers = DEFAULT_TIERS } = options;\n\n // One-shot weight annotation per source topology.\n const presimplified = useMemo(() => (topology ? presimplify(topology) : undefined), [topology]);\n\n // Stable per-tier quantile lookup so identical zoom buckets do not retrigger.\n const tier = pickTier(zoom, tiers);\n\n return useMemo(() => {\n if (!presimplified) {\n return undefined;\n }\n if (tier.percentile <= 0) {\n return presimplified;\n }\n const minWeight = quantile(presimplified, tier.percentile);\n return simplify(presimplified, minWeight);\n }, [presimplified, tier]);\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 './context';\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 { useEffect, useState } from 'react';\nimport { type Topology } from 'topojson-specification';\n\nimport { log } from '@dxos/log';\n\nimport { type CountriesResolution, loadTopology } from '../data';\n\nexport type Level = CountriesResolution;\n\nexport type LevelTier = {\n /** Lower bound (inclusive) of the zoom range. */\n minZoom: number;\n /** Topology resolution to load when this tier is active. */\n level: CountriesResolution;\n};\n\n/** Default zoom buckets: 110m below zoom 3, 50m at zoom 3 and above. */\nconst DEFAULT_TIERS: LevelTier[] = [\n { minZoom: 0, level: '110m' },\n // TODO(burdon): Too slow.\n // { minZoom: 3, level: '50m' },\n // { minZoom: 6, level: '10m' },\n];\n\nconst pickTier = (zoom: number, tiers: LevelTier[]): LevelTier => {\n let match = tiers[0];\n for (const tier of tiers) {\n if (zoom >= tier.minZoom) {\n match = tier;\n }\n }\n\n return match;\n};\n\nexport type UseTopologyOptions = {\n /** Zoom buckets that map a zoom value to a resolution. Default: 110m / 50m at 0 / 3. */\n tiers?: LevelTier[];\n};\n\n// Previously-loaded topologies are kept in a module-level cache so re-crossing a tier boundary\n// doesn't re-fetch/re-parse the file.\nconst topologyCache = new Map<CountriesResolution, Topology>();\n\n/**\n * Loads TopoJSON country data.\n *\n * - With no arguments, loads the default `110m` resolution.\n * - With a `zoom`, loads the resolution matching the current zoom tier (progressive level-of-detail).\n * Each resolution is a separate dynamic `import()`, so unused detail levels are never fetched, and\n * while a heavier tier loads the previously-displayed topology stays on screen (no blank canvas).\n */\nexport const useTopology: {\n (): Topology | undefined;\n (zoom: number, options?: UseTopologyOptions): Topology | undefined;\n} = (zoom?: number, options: UseTopologyOptions = {}): Topology | undefined => {\n const { tiers = DEFAULT_TIERS } = options;\n const level: CountriesResolution = zoom === undefined ? '110m' : pickTier(zoom, tiers).level;\n\n const [topology, setTopology] = useState<Topology | undefined>(() => topologyCache.get(level));\n\n useEffect(() => {\n const cached = topologyCache.get(level);\n if (cached) {\n setTopology(cached);\n return;\n }\n\n let disposed = false;\n void loadTopology(level)\n .then((loaded) => {\n topologyCache.set(level, loaded);\n if (!disposed) {\n setTopology(loaded);\n }\n })\n .catch((err) => {\n // A chunk/network failure leaves the previously-displayed topology on screen; log rather\n // than surfacing an unhandled rejection.\n if (!disposed) {\n log.warn('failed to load topology', { level, err });\n }\n });\n\n return () => {\n disposed = true;\n };\n }, [level]);\n\n return topology;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { geoInterpolate, geoPath } from 'd3';\nimport { type Dispatch, type SetStateAction, useEffect, useState } from 'react';\n\nimport { type LatLngLiteral } from '../types';\nimport { type StyleSet, geoToPosition } from '../util';\nimport type { GlobeController } from './context';\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 by chaining `controller.flyTo` calls, rendering\n * an arc + cursor on the canvas per frame via the flyTo `onTick` hook.\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 // TODO(burdon): Redo controlled state.\n const [running, setRunning] = useState(options.running ?? false);\n useEffect(() => {\n if (!controller || !running) {\n return;\n }\n\n let cancelled = false;\n const t = setTimeout(async () => {\n const { canvas, projection } = controller;\n const context = canvas.getContext('2d', { alpha: false });\n const path = geoPath(projection, context).pointRadius(2);\n\n try {\n const tourPoints = [...points];\n if (options.loop) {\n tourPoints.push(tourPoints[0]);\n }\n\n let last: LatLngLiteral | undefined;\n for (const next of tourPoints) {\n if (cancelled) {\n break;\n }\n\n const p1 = last ? geoToPosition(last) : undefined;\n const p2 = geoToPosition(next);\n const ip = geoInterpolate(p1 ?? p2, p2);\n\n // Cursor + trailing arc render per frame. Must run before the\n // rotation tween advances the projection — flyTo registers\n // `onTick` before its rotation tween, preserving this ordering.\n const onTick = (t: number) => {\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 try {\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 } finally {\n context.restore();\n }\n };\n\n await controller.flyTo(next, {\n duration: options.duration ?? defaultDuration,\n tilt: options.tilt ?? 0,\n onTick,\n });\n last = next;\n }\n } catch {\n // Interrupted (e.g. external flyTo or tour stopped).\n } finally {\n if (!cancelled) {\n setRunning(false);\n }\n }\n });\n\n return () => {\n cancelled = true;\n clearTimeout(t);\n controller.cancelFlyTo();\n };\n }, [controller, running, JSON.stringify(options)]);\n\n return [running, setRunning];\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { useEffect } from 'react';\n\nimport { type GlobeController } from './context';\nimport { type Vector } from './context';\n\nexport type WheelOptions = {\n disabled?: boolean;\n /**\n * Degrees of rotation per pixel of wheel delta (non-zoom gestures).\n */\n sensitivity?: number;\n /**\n * Zoom factor per pixel of pinch / ctrl+scroll delta. Applied exponentially\n * so equal pinch-in / pinch-out deltas cancel exactly. Default 0.01.\n */\n zoomSensitivity?: number;\n onUpdate?: (controller: GlobeController) => void;\n};\n\nconst DEFAULT_SENSITIVITY = 0.25;\nconst DEFAULT_ZOOM_SENSITIVITY = 0.01;\n\n/**\n * Map mouse-wheel / trackpad gestures to globe motion:\n * - Scroll (or two-finger pan on a trackpad) rotates the globe:\n * deltaY → phi (tilt around screen-X), deltaX → lambda (polar spin).\n * - Pinch-to-zoom on a trackpad — and ctrl+scroll on a mouse — are\n * delivered as `wheel` events with `ctrlKey: true`. Those are routed\n * to `setZoom` instead so the gesture matches the user's intent.\n */\nexport const useWheel = (controller?: GlobeController | null, options: WheelOptions = {}) => {\n useEffect(() => {\n const canvas = controller?.canvas;\n if (!canvas || options.disabled) {\n return;\n }\n\n const sensitivity = options.sensitivity ?? DEFAULT_SENSITIVITY;\n const zoomSensitivity = options.zoomSensitivity ?? DEFAULT_ZOOM_SENSITIVITY;\n\n const handleWheel = (event: WheelEvent) => {\n event.preventDefault();\n if (event.ctrlKey) {\n // Pinch-to-zoom on trackpads, or ctrl+scroll on a mouse. The\n // browser synthesises ctrlKey on pinch even when ctrl is not held.\n // Read live zoom from controller.zoom (a getter on zoomRef.current)\n // and set the new value directly: useControlledState's functional\n // setter resolves against the prop, not the state, and passing a\n // function to controller.setZoom triggers the 200ms eased transition\n // intended for button clicks.\n const factor = Math.exp(-event.deltaY * zoomSensitivity);\n controller.setZoom(controller.zoom * factor);\n } else {\n // Read the live rotation off the projection (kept in sync by the\n // render effect). The React-state path can't be used here:\n // - `controller.rotation` is a snapshot captured by useImperativeHandle.\n // - `useControlledState`'s functional setter resolves `prev` against\n // the latest *prop*, not the latest state, so each event would\n // start from the initial rotation and just jitter around it.\n // Mutating the projection here matches how useDrag accumulates.\n // Both deltas are negated so the wheel feels like \"natural scroll\":\n // scrolling/swiping in a direction moves the globe content the same way.\n // Scale by 1/zoom so the gesture feels consistent at any zoom level\n // (a bigger on-screen globe needs smaller angular rotation per pixel).\n const [lambda, phi, gamma] = controller.projection.rotate() as Vector;\n const k = sensitivity / Math.max(controller.zoom, 0.1);\n const next: Vector = [lambda - event.deltaX * k, phi + event.deltaY * k, gamma];\n controller.projection.rotate(next);\n controller.setRotation(controller.projection.rotate() as Vector);\n }\n options.onUpdate?.(controller);\n };\n\n canvas.addEventListener('wheel', handleWheel, { passive: false });\n return () => {\n canvas.removeEventListener('wheel', handleWheel);\n };\n }, [controller, options.disabled, options.sensitivity, options.zoomSensitivity, options.onUpdate]);\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, point, latLngBounds } from 'leaflet';\nimport React, {\n type PropsWithChildren,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createRoot } from 'react-dom/client';\nimport {\n MapContainer,\n type MapContainerProps,\n Marker,\n Polyline,\n Popup,\n TileLayer,\n useMap,\n useMapEvents,\n} from 'react-leaflet';\n\nimport { type ThemedClassName, ThemeProvider, Tooltip } from '@dxos/react-ui';\nimport { composable, composableProps, defaultTx } from '@dxos/react-ui';\nimport { 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 /** Called by Map.Viewport to register/unregister the leaflet map with the controller owned by Map.Root. */\n registerMap: (map: L.Map | null) => void;\n};\n\nconst [MapContextProvider, useMapContext] = createContext<MapContextValue>('Map');\n\n//\n// Root — headless; owns the imperative MapController (exposed via ref) and the map registry.\n//\n\ntype MapRootProps = PropsWithChildren<Pick<MapContextValue, 'onChange'>>;\n\n/**\n * Context provider for the map. Must wrap Map.Viewport. The ref exposes a {@link MapController}.\n */\nconst MapRoot = forwardRef<MapController, MapRootProps>(({ children, onChange }, forwardedRef) => {\n const mapRef = useRef<L.Map | null>(null);\n const registerMap = useCallback((map: L.Map | null) => {\n mapRef.current = map;\n }, []);\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 // TODO(burdon): Use attention: const [attention, setAttention] = useState(false);\n const attention = false;\n return (\n <MapContextProvider attention={attention} onChange={onChange} registerMap={registerMap}>\n {children}\n </MapContextProvider>\n );\n});\n\nMapRoot.displayName = 'Map.Root';\n\n//\n// Viewport\n//\n\ntype MapViewportProps = ThemedClassName<Omit<MapContainerProps, 'children'> & PropsWithChildren>;\n\n/**\n * https://react-leaflet.js.org/docs/api-map\n */\nconst MAP_VIEWPORT_NAME = 'Map.Viewport';\n\n/**\n * Recalculates the leaflet map size when its container resizes (e.g. a companion\n * panel opening/closing). Without this, leaflet keeps its stale size and renders\n * blank/gray tiles in the newly-exposed area until the next pan/zoom. Coalesced\n * via rAF to avoid ResizeObserver feedback loops.\n */\nconst MapResize = () => {\n const map = useMap();\n useEffect(() => {\n const container = map.getContainer();\n let frame = 0;\n const observer = new ResizeObserver(() => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => map.invalidateSize());\n });\n observer.observe(container);\n return () => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n };\n }, [map]);\n\n return null;\n};\n\n/**\n * Enables pinch-to-zoom on trackpads / ctrl+wheel. Browsers deliver a trackpad pinch as a `wheel`\n * event with `ctrlKey` set; Leaflet only zooms those via `scrollWheelZoom`, which is intentionally\n * off here (so plain scrolling doesn't hijack the page). This handler zooms on the pinch gesture\n * only, leaving normal wheel scrolling untouched. (Touchscreen pinch is handled by Leaflet's\n * `touchZoom`.)\n */\n// Zoom levels per pixel of pinch (ctrl+wheel) delta.\nconst PINCH_ZOOM_SENSITIVITY = 0.03;\n\nconst MapPinchZoom = () => {\n const map = useMap();\n useEffect(() => {\n const container = map.getContainer();\n let frame = 0;\n let point: ReturnType<typeof L.point> | undefined;\n // Accumulate the target against the last requested value (not the live, mid-zoom `getZoom()`)\n // and apply once per animation frame without zoom animation — overlapping animated zooms are\n // what made this jittery. Reset between frames so the next batch re-reads the settled zoom.\n let target: number | undefined;\n\n const onWheel = (event: WheelEvent) => {\n if (!event.ctrlKey) {\n return;\n }\n event.preventDefault();\n const rect = container.getBoundingClientRect();\n point = L.point(event.clientX - rect.left, event.clientY - rect.top);\n target = (target ?? map.getZoom()) - event.deltaY * PINCH_ZOOM_SENSITIVITY;\n if (!frame) {\n frame = requestAnimationFrame(() => {\n frame = 0;\n if (target !== undefined && point) {\n map.setZoomAround(point, target, { animate: false });\n target = undefined;\n }\n });\n }\n };\n\n container.addEventListener('wheel', onWheel, { passive: false });\n return () => {\n container.removeEventListener('wheel', onWheel);\n cancelAnimationFrame(frame);\n };\n }, [map]);\n\n return null;\n};\n\n/**\n * Map.Viewport is the focusable Leaflet frame. It can be the target of a parent `<Panel.Content asChild>`\n * (Slot), so it reconciles an injected `className` via `composableProps`. Leaflet owns the underlying\n * container element, so the forwarded DOM ref can't be attached and is intentionally unused.\n */\nconst MapViewport = composable<HTMLDivElement, MapViewportProps>((props, _forwardedRef) => {\n const {\n scrollWheelZoom = true,\n doubleClickZoom = true,\n touchZoom = true,\n center,\n zoom,\n whenReady,\n children,\n ...rest\n } = props;\n const { attention, registerMap } = useMapContext(MAP_VIEWPORT_NAME);\n // Local copy of the leaflet map for this component's own effects; also registered with Map.Root.\n const [map, setMap] = useState<L.Map | null>(null);\n\n // Register/unregister the map with the controller owned by Map.Root.\n const setMapRef = useCallback(\n (next: L.Map | null) => {\n setMap(next);\n registerMap(next);\n },\n [registerMap],\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 {...composableProps(rest, {\n // Frame classes (formerly on Map.Root): focusable grid container.\n classNames: 'dx-container group relative grid dx-focus-ring-inset bg-base-surface!',\n })}\n attributionControl={false}\n zoomControl={false}\n scrollWheelZoom={scrollWheelZoom}\n doubleClickZoom={doubleClickZoom}\n touchZoom={touchZoom}\n // Allow fractional zoom so trackpad pinch (small ctrl+wheel deltas) isn't rounded away.\n zoomSnap={0}\n center={center ?? defaults.center}\n zoom={zoom ?? defaults.zoom}\n whenReady={whenReady}\n ref={setMapRef}\n >\n <MapResize />\n <MapPinchZoom />\n {children}\n </MapContainer>\n );\n});\n\nMapViewport.displayName = 'Map.Viewport';\n\n//\n// Tiles\n// https://react-leaflet.js.org/docs/api-components/#tilelayer\n//\n\nconst MAP_TILES_NAME = 'Map.Tiles';\n\n/** Default OpenStreetMap raster tile template. */\nexport const DEFAULT_TILE_URL = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';\n\ntype MapTilesProps = {\n /** Leaflet tile URL template (e.g. a MapTiler style endpoint with an API key). Defaults to OpenStreetMap. */\n url?: string;\n};\n\nconst MapTiles = ({ url = DEFAULT_TILE_URL }: 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={url}\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 /** Connecting lines (e.g. a route). Used here only to extend the viewport fit; drawn by `Map.Lines`. */\n lines?: MapLine[];\n selected?: string[];\n /** Invoked with the marker id when a marker is clicked. */\n onSelect?: (id: string) => void;\n};\n\nconst MapMarkers = ({ selected, markers, lines, onSelect }: MapMarkersProps) => {\n const map = useMap();\n\n // Fit the viewport around the markers and any connecting lines. When there is nothing to frame,\n // leave the current view alone so caller-provided center/zoom (or prior interaction) is preserved.\n useEffect(() => {\n const points: LatLngLiteral[] = [\n ...(markers?.map((marker) => marker.location) ?? []),\n ...(lines?.flatMap((line) => [line.source, line.target]) ?? []),\n ];\n if (points.length > 0) {\n const bounds = latLngBounds(points);\n const size = map.getSize();\n const padding = Math.max(48, Math.min(size.x, size.y) / 6);\n // `animate: false`: a deferred zoom animation can outlive the map (e.g. on unmount) and throw\n // a Leaflet `_leaflet_pos` error against a removed layer; fitting instantly avoids the race.\n map.fitBounds(bounds, { padding: point(padding, padding), animate: false });\n }\n }, [markers, lines, 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 eventHandlers={onSelect ? { click: () => onSelect(id) } : undefined}\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// Lines\n//\n\n/** A connecting line between two points (e.g. a route leg). `color` is any CSS/Leaflet stroke color. */\nexport type MapLine = { source: LatLngLiteral; target: LatLngLiteral; color?: string };\n\ntype MapLinesProps = {\n lines?: MapLine[];\n};\n\nconst MapLines = ({ lines }: MapLinesProps) => {\n if (!lines || lines.length === 0) {\n return null;\n }\n\n // Merge consecutive connected segments with the same color into a single Polyline so\n // Leaflet renders one continuous smooth path rather than N disconnected stub segments.\n const polylines: Array<{ positions: LatLngLiteral[]; color?: string }> = [];\n for (const { source, target, color } of lines) {\n const last = polylines[polylines.length - 1];\n const lastPos = last?.positions[last.positions.length - 1];\n if (last && last.color === color && lastPos?.lat === source.lat && lastPos?.lng === source.lng) {\n last.positions.push(target);\n } else {\n polylines.push({ positions: [source, target], color });\n }\n }\n\n return (\n <>\n {polylines.map(({ positions, color }, index) => (\n <Polyline key={index} positions={positions} pathOptions={{ color, weight: 4, opacity: 0.8 }} />\n ))}\n </>\n );\n};\n\nMapLines.displayName = 'Map.Lines';\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 const rootRef = useRef<ReturnType<typeof createRoot> | undefined>(undefined);\n\n // Mount the leaflet control (and its React root) once per map/position. Children are\n // rendered into the persistent root by the effect below, so updating them does NOT\n // tear down and re-add the control (which would flicker on every parent re-render).\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 const root = createRoot(container);\n rootRef.current = root;\n // Initial render — covers mount and any map/position remount; the effect below\n // handles subsequent children-only updates.\n root.render(\n <ThemeProvider tx={defaultTx}>\n <Tooltip.Provider>{children}</Tooltip.Provider>\n </ThemeProvider>,\n );\n return container;\n };\n\n control.addTo(map);\n return () => {\n control.remove();\n const root = rootRef.current;\n rootRef.current = undefined;\n // Defer unmount so it doesn't run synchronously during a React render/commit.\n queueMicrotask(() => root?.unmount());\n };\n }, [map, position]);\n\n // Re-render children into the persistent root whenever they change.\n useEffect(() => {\n rootRef.current?.render(\n <ThemeProvider tx={defaultTx}>\n <Tooltip.Provider>{children}</Tooltip.Provider>\n </ThemeProvider>,\n );\n }, [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 Viewport: MapViewport,\n Tiles: MapTiles,\n Markers: MapMarkers,\n Lines: MapLines,\n Zoom: MapZoom,\n Action: MapAction,\n};\n\nexport {\n type MapController,\n type MapRootProps,\n type MapViewportProps,\n type MapTilesProps,\n type MapMarkersProps,\n type MapLinesProps,\n type MapControlProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAEEA,aAAaC,aACbC,YACAC,YACAC,aACAC,iBACAC,WAAAA,UACAC,uBACAC,mBACAC,kBACK;AAEP,OAAOC,UAELC,YACAC,eAAAA,cACAC,aAAAA,YACAC,OACAC,qBACAC,WAAAA,UACAC,QACAC,YAAAA,iBACK;AACP,SAASC,yBAAyB;AAGlC,SAGEC,iBACAC,oBACAC,eACAC,uBACK;AACP,SAASC,YAAYC,uBAAuB;AAC5C,SAASC,UAAU;;;ACnCnB,SAA6CC,eAAeC,kBAAkB;AAE9E,SAASC,aAAa;AAoEf,IAAMC,eAAeH,8BAAgCI,MAAAA;AAErD,IAAMC,kBAAkB,MAAA;AAC7B,SAAOJ,WAAWE,YAAAA,KAAiBD,MAAM,IAAII,MAAM,sBAAA,CAAA;AACrD;;;AC3EA,SAASC,UAAAA,eAAc;AACvB,SAASC,iBAAiB;;;ACD1B,SAA6BC,mBAAmB;AAChD,OAAOC,YAAY;AAUZ,IAAMC,cAAc,CAACC,IAAsBC,IAAsBC,MAAcC,UACpFC,KAAKC,IAAIH,MAAML,YAAYG,IAAIC,EAAAA,IAAME,KAAAA;AAOhC,IAAMG,sBAAsB,CACjCC,YACAC,aACAC,IACAC,OAAAA;AAEA,QAAMC,KAAKb,OAAOc,YAAYH,IAAIC,EAAAA;AAClC,SAAO,CAACG,MAAAA;AACNN,eAAWO,OAAOH,GAAGE,CAAAA,CAAAA;AACrBL,gBAAYD,WAAWO,OAAM,CAAA;EAC/B;AACF;;;AC9BA,IAAMC,QAAQ;AAEP,IAAMC,QAAQ,CAAWC,OAAAA;AAC9B,QAAM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AU,MAAA;AACRwH,YAAQvI,SAASoJ,OACf,gBAAA1I,OAAA,cAAC2I,eAAAA;MAAcC,IAAIC;OACjB,gBAAA7I,OAAA,cAAC8I,QAAQC,UAAQ,MAAEjK,QAAAA,CAAAA,CAAAA;EAGzB,GAAG;IAACA;GAAS;AAEb,SAAO;AACT;AAIA,IAAMsK,UAAU,CAAC,EAAEC,UAAUlD,WAAW,cAAc,GAAG5D,MAAAA,MACvD,gBAAAvC,OAAA,cAAC4H,gBAAAA;EAAczB;EAAqB,GAAG5D;GACrC,gBAAAvC,OAAA,cAACsJ,cAAAA;EAAaD;;AAIlB,IAAME,YAAY,CAAC,EAAEF,UAAUlD,WAAW,eAAe,GAAG5D,MAAAA,MAC1D,gBAAAvC,OAAA,cAAC4H,gBAAAA;EAAczB;EAAqB,GAAG5D;GACrC,gBAAAvC,OAAA,cAACwJ,gBAAAA;EAAeH;;AAQb,IAAMI,OAAM;EACjBC,MAAM9K;EACN+K,UAAUtH;EACVuH,OAAO/F;EACPgG,SAASrF;EACTsF,OAAO9C;EACP+C,MAAMX;EACNY,QAAQT;AACV;",
|
|
6
|
+
"names": ["selection", "d3Selection", "easeLinear", "easeSinOut", "geoMercator", "geoOrthographic", "geoPath", "geoTransverseMercator", "interpolateNumber", "transition", "React", "forwardRef", "useCallback", "useEffect", "useId", "useImperativeHandle", "useMemo", "useRef", "useState", "useResizeDetector", "useComposedRefs", "useControlledState", "useDynamicRef", "useThemeContext", "composable", "composableProps", "mx", "createContext", "useContext", "raise", "GlobeContext", "undefined", "useGlobeContext", "Error", "select", "useEffect", "geoDistance", "versor", "flyDuration", "p1", "p2", "base", "scale", "Math", "max", "createRotationTween", "projection", "setRotation", "r1", "r2", "iv", "interpolate", "t", "rotate", "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", "linear", "mode", "lockTilt", "sharedHandlers", "rotation", "rotate", "start", "move", "end", "stop", "finish", "time", "hold", "inertia", "geoInertiaDragLinearHelper", "sensitivity", "getZoom", "geoInertiaDragHelper", "call", "on", "opt", "v0", "r0", "q0", "v10", "v11", "q10", "inertiaHelper", "cartesian", "invert", "position", "inv", "isNaN", "v1", "q1", "multiply", "delta", "r1", "r2", "velocity", "t", "DEFAULT_LINEAR_SENSITIVITY", "gain", "Math", "max", "p0", "kStart", "rEnd", "vEnd", "dx", "dy", "A", "limit", "B", "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", "geoBounds", "geoCentroid", "geoDistance", "geoGraticule", "feature", "mesh", "RAD_TO_DEG", "Math", "PI", "computeBounds", "geometry", "feat", "type", "properties", "centroid", "geoCentroid", "w", "s", "e", "n", "geoBounds", "corners", "radius", "corner", "d", "geoDistance", "createLayers", "topology", "features", "styles", "layers", "water", "push", "path", "graticule", "geoGraticule", "step", "land", "objects", "countries", "fc", "feature", "memberGeoms", "map", "f", "bounds", "geometries", "cullable", "border", "mesh", "a", "b", "dots", "points", "lines", "line", "source", "target", "geoLine", "point", "geoPoint", "renderLayers", "generator", "scale", "viewCenter", "context", "canvas", "width", "height", "reset", "background", "fillStyle", "fillRect", "clearRect", "forEach", "layer", "save", "fill", "stroke", "Object", "entries", "key", "value", "pointRadius", "renderPath", "index", "length", "angularDistance", "beginPath", "restore", "POINT_COLOR", "LINE_COLOR", "globeStyles", "themeMode", "water", "fillStyle", "land", "strokeStyle", "border", "graticule", "line", "lineWidth", "lineDash", "point", "radius", "useDrag", "controller", "options", "useEffect", "canvas", "disabled", "inertia", "geoInertiaDrag", "select", "setRotation", "projection", "rotate", "onUpdate", "type", "lockTilt", "mode", "sensitivity", "getZoom", "zoom", "time", "start", "finish", "cancelDrag", "timer", "stop", "JSON", "stringify", "node", "on", "useCallback", "ZOOM_FACTOR", "useGlobeZoomHandler", "controller", "event", "setZoom", "zoom", "useCallback", "useMapZoomHandler", "controller", "event", "setZoom", "scale", "useMemo", "presimplify", "quantile", "simplify", "DEFAULT_TIERS", "minZoom", "percentile", "pickTier", "zoom", "tiers", "match", "tier", "useSimplifiedTopology", "topology", "options", "presimplified", "undefined", "minWeight", "timer", "d3Timer", "useEffect", "useState", "useSpinner", "controller", "options", "running", "setRunning", "start", "delta", "t", "lastRotation", "projection", "rotate", "elapsed", "dt", "rotation", "setRotation", "stop", "undefined", "disabled", "useEffect", "useState", "log", "DEFAULT_TIERS", "pickTier", "tier", "tiers", "zoom", "match", "level", "undefined", "topology", "useState", "useEffect", "cached", "topologyCache", "setTopology", "disposed", "loaded", "err", "geoInterpolate", "geoPath", "useEffect", "useState", "defaultDuration", "useTour", "controller", "points", "options", "running", "setRunning", "useState", "useEffect", "cancelled", "t", "setTimeout", "canvas", "projection", "context", "getContext", "alpha", "path", "geoPath", "pointRadius", "tourPoints", "loop", "push", "last", "next", "p1", "geoToPosition", "undefined", "p2", "ip", "geoInterpolate", "onTick", "t1", "Math", "max", "min", "t2", "save", "beginPath", "strokeStyle", "styles", "arc", "lineWidth", "zoom", "setLineDash", "lineDash", "type", "coordinates", "stroke", "fillStyle", "cursor", "fill", "restore", "flyTo", "duration", "tilt", "clearTimeout", "cancelFlyTo", "JSON", "stringify", "useEffect", "DEFAULT_SENSITIVITY", "DEFAULT_ZOOM_SENSITIVITY", "useWheel", "controller", "options", "canvas", "disabled", "sensitivity", "zoomSensitivity", "handleWheel", "event", "preventDefault", "ctrlKey", "factor", "Math", "exp", "deltaY", "setZoom", "zoom", "lambda", "phi", "gamma", "projection", "rotate", "k", "max", "next", "deltaX", "setRotation", "onUpdate", "addEventListener", "passive", "removeEventListener", "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", "forwardRef", "children", "center", "centerProp", "zoom", "zoomProp", "translation", "translationProp", "rotation", "rotationProp", "forwardedRef", "size", "setSize", "useState", "width", "height", "setCenter", "useControlledState", "setZoom", "setTranslation", "setRotation", "controller", "setController", "registerController", "useCallback", "next", "useImperativeHandle", "React", "GlobeContext", "Provider", "value", "displayName", "GlobeViewport", "composable", "props", "useGlobeContext", "localRef", "useRef", "composedRef", "useComposedRefs", "useResizeDetector", "targetRef", "useEffect", "div", "composableProps", "classNames", "ref", "GlobeCanvas", "projection", "projectionProp", "topology", "features", "styles", "stylesProp", "themeMode", "useThemeContext", "useMemo", "zoomRef", "useDynamicRef", "canvas", "setCanvas", "canvasRef", "layers", "timer", "createLayers", "positionToRotation", "geoToPosition", "flyToSelection", "d3Selection", "flyToTransitionName", "useId", "interrupt", "zooming", "current", "state", "is", "interpolateNumber", "transition", "ease", "easeLinear", "easeSinOut", "duration", "tween", "t", "on", "flyTo", "target", "options", "tilt", "onTick", "p2", "r1", "rotate", "r2", "p1", "rotationTween", "createRotationTween", "iz", "undefined", "tx", "flyDuration", "end", "cancelFlyTo", "generator", "geoPath", "getContext", "scale", "Math", "min", "translate", "x", "y", "isOrthographic", "lambda", "phi", "viewCenter", "renderLayers", "className", "GlobeDebug", "position", "mx", "controlPositions", "pre", "JSON", "stringify", "GlobePanel", "CustomControl", "GlobeZoom", "onAction", "ZoomControls", "GlobeAction", "ActionControls", "Globe", "Root", "Viewport", "Canvas", "Zoom", "Action", "Debug", "Panel", "createContext", "L", "Control", "DomEvent", "DomUtil", "point", "latLngBounds", "React", "forwardRef", "useCallback", "useEffect", "useImperativeHandle", "useRef", "useState", "createRoot", "MapContainer", "Marker", "Polyline", "Popup", "TileLayer", "useMap", "useMapEvents", "ThemeProvider", "Tooltip", "composable", "composableProps", "defaultTx", "mx", "defaults", "center", "lat", "lng", "zoom", "MapContextProvider", "useMapContext", "createContext", "MapRoot", "forwardRef", "children", "onChange", "forwardedRef", "mapRef", "useRef", "registerMap", "useCallback", "map", "current", "useImperativeHandle", "getCenter", "undefined", "getZoom", "setCenter", "setView", "setZoom", "cb", "attention", "React", "displayName", "MAP_VIEWPORT_NAME", "MapResize", "useMap", "useEffect", "container", "getContainer", "frame", "observer", "ResizeObserver", "cancelAnimationFrame", "requestAnimationFrame", "invalidateSize", "observe", "disconnect", "PINCH_ZOOM_SENSITIVITY", "MapPinchZoom", "point", "target", "onWheel", "event", "ctrlKey", "preventDefault", "rect", "getBoundingClientRect", "L", "clientX", "left", "clientY", "top", "deltaY", "setZoomAround", "animate", "addEventListener", "passive", "removeEventListener", "MapViewport", "composable", "props", "_forwardedRef", "scrollWheelZoom", "doubleClickZoom", "touchZoom", "whenReady", "rest", "setMap", "useState", "setMapRef", "next", "enable", "disable", "MapContainer", "composableProps", "classNames", "attributionControl", "zoomControl", "zoomSnap", "ref", "MAP_TILES_NAME", "DEFAULT_TILE_URL", "MapTiles", "url", "useMapEvents", "moveend", "ev", "dataset", "TileLayer", "data-attention", "detectRetina", "className", "keepBuffer", "MapMarkers", "selected", "markers", "lines", "onSelect", "points", "marker", "location", "flatMap", "line", "source", "length", "bounds", "latLngBounds", "size", "getSize", "padding", "Math", "max", "min", "x", "y", "fitBounds", "id", "title", "Marker", "key", "position", "eventHandlers", "click", "icon", "Icon", "iconUrl", "iconRetinaUrl", "shadowUrl", "iconSize", "iconAnchor", "popupAnchor", "shadowSize", "Popup", "MapLines", "polylines", "color", "last", "lastPos", "positions", "push", "index", "Polyline", "pathOptions", "weight", "opacity", "CustomControl", "rootRef", "control", "Control", "onAdd", "DomUtil", "create", "mx", "controlPositions", "DomEvent", "disableClickPropagation", "disableScrollPropagation", "root", "createRoot", "render", "ThemeProvider", "tx", "defaultTx", "Tooltip", "Provider", "addTo", "remove", "queueMicrotask", "unmount", "MapZoom", "onAction", "ZoomControls", "MapAction", "ActionControls", "Map", "Root", "Viewport", "Tiles", "Markers", "Lines", "Zoom", "Action"]
|
|
7
7
|
}
|