@xyo-network/react-map 5.3.8 → 5.3.10
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Components/AnimatedHeatMap.tsx","../../src/Contexts/HeatMapInitializer/Provider.tsx","../../src/hooks/useDynamicMapResize.tsx","../../src/hooks/useDynamicPositioning.tsx","../../src/hooks/useQuadKeyPayloadsToFeatures.tsx","../../src/MapBoxClasses/MapBase.ts","../../src/MapBoxClasses/MapHeat.ts","../../src/MapBoxClasses/MapPoints.ts","../../src/MapBoxClasses/MapSettings.ts","../../src/Contexts/MapBoxInstance/Provider.tsx","../../src/Contexts/MapBoxInstance/Context.ts","../../src/Contexts/MapBoxInstance/useMapBoxInstance.tsx","../../src/Contexts/MapSettings/Provider.tsx","../../src/Contexts/MapSettings/Context.ts","../../src/Contexts/MapSettings/useMapSettings.tsx","../../src/Contexts/HeatMapInitializer/Context.ts","../../src/Contexts/HeatMapInitializer/useHeatMapInitializer.tsx","../../src/Layers/Configs/HeatMapFillLayerConfig.ts","../../src/Layers/Configs/HeatMapLineLayerConfig.ts","../../src/Layers/Configs/HeatMapSymbolLayerConfig.ts","../../src/Layers/Configs/LocationPointLayerConfig.ts","../../src/Layers/FillLayer.ts","../../src/Layers/LineLayer.ts","../../src/Layers/SymbolLayer.ts","../../src/Layers/Builders/LocationHeatMapLayerBuilder.ts","../../src/Layers/Builders/LocationHeatMapLayerBuilderAnimated.ts","../../src/Layers/CircleLayer.ts","../../src/Layers/Builders/LocationPointsMapLayerBuilder.ts","../../src/Components/MapBoxHeat.tsx","../../src/Components/MapBox.tsx","../../src/Components/MapSettingsComponents/Setting.tsx","../../src/Components/MapSettingsComponents/SettingsBox.tsx","../../src/Components/AnimatedHeatMapLoaded.tsx","../../src/Components/Legend.tsx","../../src/Components/Legends/ColorGradient.tsx","../../src/Components/HeatMapSettings.ts","../../src/Components/LayerAnimator.tsx","../../src/Components/MapBoxPoints.tsx"],"sourcesContent":["import { useTheme } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { darkenCss } from '@xylabs/react-theme'\nimport type { AnimatedHeatMapColorProps, MapSetting } from '@xyo-network/react-map-model'\nimport type { Feature, Polygon } from 'geojson'\nimport type { PropsWithChildren } from 'react'\nimport React, { useState } from 'react'\n\nimport {\n HeatMapInitializerProvider, MapBoxInstanceProvider, MapSettingsProvider,\n} from '../Contexts/index.ts'\nimport type { MapLayer } from '../Layers/index.ts'\nimport { LocationHeatMapLayerBuilderAnimated, MapHeatConstants } from '../Layers/index.ts'\nimport { MapboxHeatFlexBox } from './MapBoxHeat.tsx'\n\nexport interface AnimatedHeatMapProps {\n accessToken: string\n animatedFeatureSets: Feature<Polygon>[][]\n defaultMapSettings?: MapSetting\n heatMapColorProps: AnimatedHeatMapColorProps\n staticFeatureSet: Feature<Polygon>[]\n}\n\nexport const AnimatedHeatMap: React.FC<PropsWithChildren<AnimatedHeatMapProps>> = ({\n accessToken,\n animatedFeatureSets,\n defaultMapSettings,\n heatMapColorProps,\n staticFeatureSet,\n ...props\n}) => {\n const theme = useTheme()\n const {\n staticMapColor, lowUsageColor, highUsageColor,\n } = heatMapColorProps || {}\n const localStaticMapColor = staticMapColor ?? theme.vars.palette.primary.light\n\n const [layers] = useState<MapLayer[]>(() => [\n LocationHeatMapLayerBuilderAnimated(localStaticMapColor, 0, 'static'),\n LocationHeatMapLayerBuilderAnimated(lowUsageColor || localStaticMapColor, 0, 'animated'),\n LocationHeatMapLayerBuilderAnimated(highUsageColor || darkenCss(localStaticMapColor, 0.9), 1, 'animated'),\n ])\n\n return animatedFeatureSets?.length\n ? (\n <MapBoxInstanceProvider>\n <MapSettingsProvider defaultMapSettings={defaultMapSettings} debugLayerName={MapHeatConstants.LocationDebugLayerId}>\n <HeatMapInitializerProvider\n features={staticFeatureSet}\n layers={[layers[0]]}\n featureSets={animatedFeatureSets}\n featureSetsLayers={layers.slice(1, 3)}\n heatMapColorProps={heatMapColorProps}\n >\n <MapboxHeatFlexBox accessToken={accessToken} {...props}></MapboxHeatFlexBox>\n </HeatMapInitializerProvider>\n </MapSettingsProvider>\n </MapBoxInstanceProvider>\n )\n : <FlexCol minHeight={160} minWidth={160} busy />\n}\n","import { forget } from '@xylabs/forget'\nimport type { AnimatedHeatMapColorProps, HeatMapColorProps } from '@xyo-network/react-map-model'\nimport type { Feature, Polygon } from 'geojson'\nimport type { PropsWithChildren } from 'react'\nimport React, { useEffect, useMemo } from 'react'\n\nimport { useDynamicPositioning } from '../../hooks/index.ts'\nimport type { MapLayer } from '../../Layers/index.ts'\nimport { MapHeat } from '../../MapBoxClasses/index.ts'\nimport { useMapBoxInstance } from '../MapBoxInstance/index.ts'\nimport { useMapSettings } from '../MapSettings/index.ts'\nimport { HeatMapInitializerContext } from './Context.ts'\nimport type { HeatMapInitializerState } from './State.ts'\n\nexport interface MapInitializerProviderProps {\n featureSets?: Feature<Polygon>[][]\n featureSetsLayers?: MapLayer[]\n features?: Feature<Polygon>[]\n fitToPadding?: number\n heatMapColorProps: HeatMapColorProps | AnimatedHeatMapColorProps\n layers?: MapLayer[]\n zoom?: number\n}\n\nexport const HeatMapInitializerProvider: React.FC<PropsWithChildren<MapInitializerProviderProps>> = ({\n children,\n featureSets,\n featureSetsLayers,\n features,\n fitToPadding,\n heatMapColorProps,\n layers,\n zoom,\n}) => {\n const { options } = useDynamicPositioning()\n const { mapSettings } = useMapSettings()\n const { map, mapInitialized } = useMapBoxInstance()\n\n const mapHeat = useMemo(() => {\n return (map && features?.length)\n ? new MapHeat({\n features, map, zoom,\n })\n : undefined\n }, [map, features, zoom])\n\n const value: HeatMapInitializerState = useMemo(() => ({\n MapHeat: mapHeat,\n heatMapColorProps,\n }), [mapHeat, heatMapColorProps])\n\n useEffect(() => {\n if (mapInitialized && featureSets?.length && featureSets[0].length > 0 && map && featureSetsLayers?.length) {\n const { lowUsageColor, highUsageColor } = heatMapColorProps as AnimatedHeatMapColorProps\n forget(MapHeat.initializeAnimatedHeatMapSource(featureSetsLayers, featureSets, map, lowUsageColor, highUsageColor))\n }\n\n return () => {\n MapHeat.animationStarted = false\n }\n }, [featureSets, featureSetsLayers, mapInitialized, map, heatMapColorProps])\n\n useEffect(() => {\n if (mapHeat && mapInitialized && features?.length && layers?.length) {\n mapHeat.initializeHeatMapSource(layers)\n }\n }, [mapHeat, features?.length, layers, mapInitialized])\n\n useEffect(() => {\n if (mapInitialized) {\n const { fitToPoints } = mapSettings || {}\n\n if (map) {\n if (fitToPoints?.value === true) {\n MapHeat.initialMapPositioning(\n {\n padding: {\n bottom: fitToPadding, left: fitToPadding, right: fitToPadding, top: fitToPadding,\n },\n },\n map,\n features,\n )\n } else if (options?.zoom && options.center) {\n map.setZoom(options.zoom)\n map.setCenter(options.center)\n }\n }\n }\n }, [mapHeat, map, mapSettings, fitToPadding, options, mapInitialized, features])\n\n return <HeatMapInitializerContext value={value}>{children}</HeatMapInitializerContext>\n}\n","import type { Map } from 'mapbox-gl'\nimport type { RefObject } from 'react'\nimport { useEffect, useMemo } from 'react'\n\n/**\n * Inspired by - https://bl.ocks.org/danswick/fc56f37c10d40be62e4feac5984250d2\n */\nexport const useDynamicMapResize = (\n mapContainerRef: RefObject<HTMLDivElement | null>,\n mapCanvasRef: RefObject<HTMLCanvasElement | null>,\n mapInstance?: Map,\n active = true,\n) => {\n const resizer = useMemo(\n () =>\n new ResizeObserver(() => {\n const width = mapContainerRef.current?.getBoundingClientRect().width\n if (width && mapCanvasRef.current) {\n mapCanvasRef.current.style.width = `${width}px`\n // setTimeout allows for the smoothest animation (vs requestAnimationFrame, debouce, etc)\n // likely because it lets mapbox resize once when the event loop is ready?\n setTimeout(() => mapInstance?.resize())\n }\n }),\n [mapCanvasRef, mapContainerRef, mapInstance],\n )\n\n const dependenciesReady = useMemo(() => {\n return !!(active && mapInstance && mapContainerRef?.current && mapCanvasRef.current)\n }, [active, mapCanvasRef, mapContainerRef, mapInstance])\n\n useEffect(() => {\n if (dependenciesReady) {\n if (mapContainerRef.current) {\n resizer.observe(mapContainerRef.current)\n }\n\n return () => {\n resizer.disconnect()\n }\n }\n }, [active, dependenciesReady, mapCanvasRef, mapContainerRef, mapInstance, resizer])\n}\n","import { useWindowSize } from '@xylabs/react-shared'\nimport type { MapOptions } from 'mapbox-gl'\nimport { useMemo } from 'react'\n\n/**\n * Zoom level for the map\n *\n * Note: Changing zoom will require changes to Lat/Lng Ranges\n */\nconst defaultZoom = 1.6\n\n/**\n * Range of aspect ratio values (width / height = aspect ratio) to scale against degrees\n * On lower aspect ratios, the width is larger than the height and vice-versa for higher\n */\nconst defaultAspectRatioRange = [0.5, 2]\n\n/**\n * Lat/Lng ranges, the first index is the minimum and the second is the maximum\n * Index 0 is for portrait screens and centers on the Eastern Hemisphere\n * Index 1 is for wider screens near the Prime Meridian and north of the Equator\n *\n * Note: Values are based off the zoom level\n */\nconst latRange = [0.912_164_420_526_366_4, 1.717_850_315_594_39]\nconst lngRange = [-81.474_201_485_195_9, 12.788_958_675_506_933]\n\n/**\n * Function to interpolate an aspect ratio value across a range of degrees and aspect ratios\n *\n * Inspired by - https://stackoverflow.com/questions/14224535/scaling-between-two-number-ranges\n *\n * @param aspectRatio aspect ratio to scale\n * @param degreeRange A latitude or longitude range (i.e. [minLat, maxLat])\n * @param aspectRatioRange A range of aspect ratios to scale against degreeRange parameter\n * @returns number\n */\nconst linearInterpolate = (aspectRatio: number, degreeRange: number[], aspectRatioRange?: number[]): number => {\n const [degreeMin, degreeMax] = degreeRange\n const [aspectRatioMin, aspectRatioMax] = aspectRatioRange || defaultAspectRatioRange\n\n const aspectRatioRangeSpan = aspectRatioMax - aspectRatioMin\n const degreeRangeSpan = degreeMax - degreeMin\n\n const percent = (aspectRatio - aspectRatioMin) / aspectRatioRangeSpan\n const scaledDegree = percent * degreeRangeSpan + degreeMin\n\n return scaledDegree\n}\n\nconst useDynamicPositioning = () => {\n const { width, height } = useWindowSize()\n\n const options = useMemo(() => {\n if (width && height) {\n const aspectRatio = width / height\n\n return {\n center: [linearInterpolate(aspectRatio, lngRange), linearInterpolate(aspectRatio, latRange)],\n zoom: defaultZoom,\n } as Partial<MapOptions>\n }\n }, [height, width])\n\n return { options }\n}\n\nexport { useDynamicPositioning }\n","import { exists } from '@xylabs/exists'\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '@xyo-network/react-map-model'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Geometry } from 'geojson'\nimport { useMemo, useState } from 'react'\n\nconst quadKeyToFeature = ({ density, quadkey }: { density: number; quadkey: string }) => {\n const polygonFeature = new GeoJson(quadkey).polygonFeature()\n polygonFeature.properties = {\n count: density,\n density,\n }\n return polygonFeature\n}\n\nconst setDensity = (feature: Feature) => {\n if (feature.properties) {\n feature.properties.value = feature.properties.density / 5\n }\n return feature\n}\n\nconst useQuadKeyPayloadsToFeatures = (payloads?: NetworkLocationHeatmapQuadkeyAnswerPayload[] | NetworkLocationHeatmapQuadkeyAnswerPayload) => {\n const [multipleFeatureSets, setMultipleFeatureSets] = useState<Feature<Geometry>[][]>([[]])\n const [features, setFeatures] = useState<Feature<Geometry>[]>([])\n const [error, setError] = useState<Error>()\n\n useMemo(() => {\n // Convert Multiple Payloads from Quadkey to GeoJson\n if (Array.isArray(payloads)) {\n if ((payloads)?.filter(exists).length > 0) {\n const mappedFeatures = payloads?.map(payload => payload?.result.map(quadKeyToFeature))\n\n setMultipleFeatureSets(mappedFeatures.map(features => features?.map(setDensity) ?? []))\n } else {\n setError(new Error('Cannot find payloads for provided hashes'))\n }\n }\n\n // Convert Single Payload from Quadkey to GeoJson\n if (payloads && (payloads as NetworkLocationHeatmapQuadkeyAnswerPayload).result) {\n const singlePayload = payloads as NetworkLocationHeatmapQuadkeyAnswerPayload\n const mappedFeatures = singlePayload.result.map(quadKeyToFeature)\n\n setFeatures(mappedFeatures.map(setDensity))\n }\n }, [payloads])\n\n return {\n error, features, multipleFeatureSets,\n }\n}\n\nexport { useQuadKeyPayloadsToFeatures }\n","import { assertEx } from '@xylabs/assert'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Geometry } from 'geojson'\nimport type { GeoJSONSource, Map } from 'mapbox-gl'\n\nimport type { MapLayer } from '../Layers/index.ts'\n\nexport interface MapBaseConfig<T extends Geometry> {\n features: Feature<T>[]\n map: Map\n requestLocation?: boolean\n zoom?: number\n}\n\nexport abstract class MapBase<T extends Geometry> {\n private _config: MapBaseConfig<T>\n\n constructor(config: MapBaseConfig<T>) {\n this._config = {\n requestLocation: true, zoom: 2, ...config,\n }\n }\n\n get isMapReady() {\n return !!this._config.map\n }\n\n initializeMapSource(layer: MapLayer) {\n const getSource = () => {\n const featuresCollection = GeoJson.featureCollection(this._config.features)\n return GeoJson.featuresSource(featuresCollection)\n }\n\n const existingSource = this._config.map.getSource(layer.source as string) as GeoJSONSource\n const source = getSource()\n if (existingSource) {\n existingSource.setData(assertEx(source.data as GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry>))\n } else {\n this._config.map.addSource(layer.source as string, source)\n }\n layer.update(this._config.map, true)\n\n return this\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { delay } from '@xylabs/delay'\nimport { forget } from '@xylabs/forget'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Polygon } from 'geojson'\nimport type {\n DataDrivenPropertyValueSpecification,\n GeoJSONSource, GeoJSONSourceSpecification, Map, MapOptions,\n} from 'mapbox-gl'\nimport { LngLatBounds } from 'mapbox-gl'\n\nimport type { MapLayer } from '../Layers/index.ts'\nimport type { MapBaseConfig } from './MapBase.ts'\nimport { MapBase } from './MapBase.ts'\n\nexport class MapHeat extends MapBase<Polygon> {\n // eslint-disable-next-line sonarjs/public-static-readonly\n static animationStarted = false\n\n config: MapBaseConfig<Polygon>\n constructor(config: MapBaseConfig<Polygon>) {\n super(config)\n this.config = config\n }\n\n static initialMapPositioning(options: MapOptions['fitBoundsOptions'], map: Map, features?: Feature<Polygon>[], initialBounds?: LngLatBounds) {\n if (!features) {\n return\n }\n\n let bounds: LngLatBounds\n\n if (initialBounds) {\n bounds = initialBounds\n } else {\n bounds = new LngLatBounds()\n\n // eslint-disable-next-line unicorn/no-array-for-each\n features.forEach((feature: Feature<Polygon>) => {\n for (const coordinates of feature.geometry.coordinates) {\n for (const position of coordinates) {\n bounds.extend(position as [number, number])\n }\n }\n })\n }\n\n map.setCenter(bounds.getCenter())\n map.fitBounds(bounds, options)\n return this\n }\n\n static async initializeAnimatedHeatMapSource(\n layers: MapLayer[],\n featureSet: Feature<Polygon>[][],\n map: Map,\n startColor?: string,\n endColor?: string,\n ) {\n this.animationStarted = true\n let layerTick = 0\n let sourceTick = 0\n\n const sources = featureSet.map((feature) => {\n const featuresCollection = GeoJson.featureCollection(feature)\n return GeoJson.featuresSource(featuresCollection)\n })\n this.updateLayer(map, layers[0], sources[0])\n this.updateLayer(map, layers[1], sources[1])\n\n for (const layer of layers) {\n map.setPaintProperty(layer.id, 'fill-opacity', 0)\n }\n\n const frameLength = 3000\n const initialPad = 0.5\n const factor = 10\n const steps = 30\n const stepLength = frameLength / steps\n const lowUsageColor = startColor ?? '#FFB3B3'\n const highUsageColor = endColor ?? '#FF0000'\n\n // Max density at i=0, min density at i=steps\n const dynamicFillColor = (factor: number, initialPad: number, i: number): DataDrivenPropertyValueSpecification<string> => {\n const sinFade = Math.sin(((i / steps) * Math.PI) / 2)\n const cosFade = Math.cos(((i / steps) * Math.PI) / 2)\n // we want the divisor to always be at least 1x the desired factor but will go up to\n // 2x factor to account for combinative effect of the overlay of two layers at once\n const divisor = factor + factor * sinFade\n const offset = initialPad * cosFade\n return [\n 'let',\n 'density',\n ['+', ['/', ['number', ['get', 'value']], divisor], offset],\n ['interpolate', ['linear'], ['var', 'density'], 0, lowUsageColor, 0.5, highUsageColor],\n ]\n }\n\n const fadedIn: boolean[] = layers.map(_ => false)\n\n const fadeIn = async (id: string, index: number) => {\n for (let i = steps; i >= 1; i--) {\n map.setPaintProperty(id, 'fill-color', dynamicFillColor(factor, initialPad, i * (180 / stepLength)))\n await delay(stepLength)\n }\n fadedIn[index] = true\n }\n\n const fadeOut = async (id: string, index: number) => {\n for (let i = 1; i <= steps; i++) {\n map.setPaintProperty(id, 'fill-color', dynamicFillColor(factor, initialPad, i * (180 / stepLength)))\n await delay(stepLength)\n }\n fadedIn[index] = false\n }\n\n let started = false\n const startAnimation = async () => {\n assertEx(!started, () => 'Animation Already Started')\n started = true\n while (this.animationStarted) {\n const upLayer = layerTick % layers.length\n const downLayer = (layerTick + 1) % layers.length\n\n const incomingSource = sourceTick % featureSet.length\n const outgoingSource = (sourceTick + 1) % featureSet.length\n\n // console.log('incoming / outgoing source', incomingSource, outgoingSource)\n\n // console.log(`animate: [${upLayer}, ${downLayer}]`)\n if (fadedIn[upLayer]) {\n this.updateLayer(map, layers[upLayer], sources[incomingSource])\n forget(fadeOut(layers[upLayer].id, upLayer))\n }\n if (!fadedIn[downLayer]) {\n this.updateLayer(map, layers[downLayer], sources[outgoingSource])\n forget(fadeIn(layers[downLayer].id, downLayer))\n }\n while ((fadedIn[upLayer] || !fadedIn[downLayer]) && this.animationStarted) {\n // console.log(`checking: [${fadedIn[upLayer]}, ${!fadedIn[downLayer]}]`)\n await delay(1000)\n }\n layerTick++\n sourceTick++\n\n // console.log(`this.layerTick: ${layerTick}`)\n // console.log(`this.sourceTick: ${sourceTick}`)\n }\n }\n\n await startAnimation()\n }\n\n private static updateLayer(map: Map, layer: MapLayer, source: GeoJSONSourceSpecification) {\n const existingSource = map.getSource(layer.source as string) as GeoJSONSource\n if (existingSource && source.data) {\n existingSource.setData(source.data as GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry>)\n } else if (source) {\n map.addSource(layer.source as string, source)\n }\n layer.update(map, true)\n }\n\n // Build layers each with the same features\n initializeHeatMapSource(layers: MapLayer[]) {\n const getSource = (_: number) => {\n const featuresCollection = GeoJson.featureCollection(this.config.features)\n return GeoJson.featuresSource(featuresCollection)\n }\n\n for (const [index, layer] of layers.entries()) {\n const existingSource = this.config.map.getSource(layer.source as string) as GeoJSONSource\n const source = getSource(index)\n if (existingSource) {\n existingSource.setData(assertEx(source.data) as GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry>)\n } else {\n this.config.map.addSource(layer.source as string, source)\n }\n layer.update(this.config.map, true)\n }\n\n return this\n }\n}\n","import type { Feature, Point } from 'geojson'\nimport type { MapOptions } from 'mapbox-gl'\nimport { LngLatBounds } from 'mapbox-gl'\n\nimport type { MapBaseConfig } from './MapBase.ts'\nimport { MapBase } from './MapBase.ts'\n\nexport interface MapPointsConfig extends MapBaseConfig<Point> {\n features: Feature<Point>[]\n}\n\nexport class MapPoints extends MapBase<Point> {\n private config: MapPointsConfig\n\n constructor(config: MapPointsConfig) {\n super(config)\n this.config = config\n }\n\n initialMapPositioning(options: MapOptions['fitBoundsOptions'], initialBounds?: LngLatBounds) {\n let bounds: LngLatBounds\n\n if (initialBounds) {\n bounds = initialBounds\n } else {\n bounds = new LngLatBounds()\n\n // eslint-disable-next-line unicorn/no-array-for-each\n this.config.features.forEach((feature: Feature<Point>) => {\n bounds.extend(feature.geometry.coordinates as [number, number])\n })\n }\n\n this.config.map.setCenter(bounds.getCenter())\n this.config.map.fitBounds(bounds, options)\n\n return this.config.map\n }\n}\n","import type { MapSetting } from '@xyo-network/react-map-model'\nimport type {\n Map, MapEventOf, MapEventType,\n} from 'mapbox-gl'\nimport { GeolocateControl, NavigationControl } from 'mapbox-gl'\n\nexport interface MapSettingsConfig {\n debugLayerName?: string\n map: Map\n requestLocation?: boolean\n settings: MapSetting\n zoom?: number\n}\n\n/**\n * Utility class to handle changes in settings\n *\n * Methods are pure functions dedicated to map manipulation\n */\nexport class MapSettings {\n // eslint-disable-next-line sonarjs/public-static-readonly\n static geoLocateControl: GeolocateControl | undefined\n // eslint-disable-next-line sonarjs/public-static-readonly\n static mapListeners = {\n logData: (ev?: MapEventOf<MapEventType>, map?: Map) => {\n const target = map || ev?.target\n if (target) {\n console.log('zoom', target.getZoom())\n console.log('center', target.getCenter())\n }\n },\n }\n\n // eslint-disable-next-line sonarjs/public-static-readonly\n static navControl: NavigationControl | undefined\n // eslint-disable-next-line sonarjs/public-static-readonly\n static requestLocation: boolean | undefined\n\n static toggleControls(value: boolean | undefined, map: Map, zoom?: number, requestLocation?: boolean) {\n if (value) {\n MapSettings.addControls(map, zoom, requestLocation)\n } else {\n MapSettings.removeControls(map)\n }\n\n return this\n }\n\n static toggleDebugLayer(value: boolean | undefined, map: Map, layerName: string) {\n const debugLayer = map.getLayer(layerName)\n if (debugLayer) {\n if (value) {\n map.setLayoutProperty(layerName, 'visibility', 'visible')\n } else {\n map.setLayoutProperty(layerName, 'visibility', 'none')\n }\n }\n\n return this\n }\n\n static toggleDebugLogging(value: boolean | undefined, map: Map) {\n const debugEvents: MapEventType[] = ['resize', 'zoomend', 'dragend']\n if (value) {\n // initial values\n this.mapListeners.logData(undefined, map)\n for (const event of debugEvents) map.on(event, this.mapListeners.logData)\n } else {\n for (const event of debugEvents) map.off(event, this.mapListeners.logData)\n }\n }\n\n static toggleScrollToZoom(value: boolean | undefined, map: Map) {\n if (value) {\n map.scrollZoom.enable()\n } else {\n map.scrollZoom.disable()\n }\n\n return this\n }\n\n static updateSettings(config: MapSettingsConfig) {\n const {\n settings, map, zoom, requestLocation, debugLayerName = '',\n } = config\n const {\n scrollToZoom, enableControls, debugLayer, debugLogging,\n } = settings\n\n MapSettings.toggleControls(enableControls?.value, map, zoom, requestLocation)\n .toggleScrollToZoom(scrollToZoom?.value, map)\n .toggleDebugLayer(debugLayer?.value, map, debugLayerName)\n .toggleDebugLogging(debugLogging.value, map)\n }\n\n // Needs to be static so we ensure controls are only instantiated once\n private static addControls(map: Map, zoom?: number, requestLocation?: boolean) {\n const geolocateControl = new GeolocateControl({\n fitBoundsOptions: { zoom: zoom || 2 },\n positionOptions: { enableHighAccuracy: true },\n trackUserLocation: true,\n })\n\n const navControl = new NavigationControl({ showCompass: false })\n\n this.geoLocateControl = this.geoLocateControl || geolocateControl\n this.navControl = this.navControl || navControl\n\n if (!map.hasControl(this.geoLocateControl) && requestLocation) {\n map.addControl(this.geoLocateControl)\n }\n\n if (!map.hasControl(this.navControl)) {\n map.addControl(this.navControl, 'top-left')\n }\n\n return this\n }\n\n private static removeControls(map: Map) {\n if (this.geoLocateControl && map.hasControl(this.geoLocateControl) && this.requestLocation) {\n map.removeControl(this.geoLocateControl)\n }\n\n if (this.navControl && map.hasControl(this.navControl)) {\n map.removeControl(this.navControl)\n }\n\n return this\n }\n}\n","import type { Map } from 'mapbox-gl'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nexport const MapBoxInstanceProvider: React.FC<PropsWithChildren> = ({ children }) => {\n const [map, setMapBoxInstance] = useState<Map>()\n const [mapInitialized, setMapInitialized] = useState(false)\n\n const value = useMemo(() => ({\n map, mapInitialized, setMapBoxInstance,\n }), [map, mapInitialized, setMapBoxInstance])\n\n useEffect(() => {\n if (!mapInitialized && map) {\n map?.on('load', () => {\n setMapInitialized(true)\n })\n }\n }, [map, mapInitialized, setMapInitialized])\n\n return <MapBoxInstanceContext value={value}>{children}</MapBoxInstanceContext>\n}\n","import { createContext } from 'react'\n\nimport type { MapBoxInstanceState } from './State.ts'\n\nconst MapBoxInstanceContext = createContext<MapBoxInstanceState>({})\n\nexport { MapBoxInstanceContext }\n","import { assertEx } from '@xylabs/assert'\nimport { use } from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nconst useMapBoxInstance = () => {\n const context = use(MapBoxInstanceContext)\n assertEx('map' in context, () => 'useMapBoxInstance must be used within a MapBoxInstanceContext')\n\n return context\n}\n\nexport { useMapBoxInstance }\n","import type { MapSetting } from '@xyo-network/react-map-model'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapSettings } from '../../MapBoxClasses/index.ts'\nimport { useMapBoxInstance } from '../MapBoxInstance/index.ts'\nimport { MapSettingsContext } from './Context.ts'\nimport type { MapSettingsState } from './State.ts'\n\nexport interface MapSettingsProviderProps {\n debugLayerName?: string\n defaultMapSettings?: MapSetting\n requestLocation?: boolean\n zoom?: number\n}\n\nexport const MapSettingsProvider: React.FC<PropsWithChildren<MapSettingsProviderProps>> = ({\n children,\n debugLayerName,\n defaultMapSettings,\n requestLocation,\n zoom = 1,\n}) => {\n const [mapSettings, setMapSettings] = useState<MapSetting>(defaultMapSettings || {})\n const { map, mapInitialized } = useMapBoxInstance()\n\n const value: MapSettingsState = useMemo(() => ({\n mapSettings,\n setMapSettings,\n }), [mapSettings, setMapSettings])\n\n useEffect(() => {\n if (mapSettings && map && mapInitialized) {\n MapSettings.updateSettings({\n debugLayerName, map, requestLocation, settings: mapSettings, zoom,\n })\n }\n }, [debugLayerName, map, mapInitialized, mapSettings, requestLocation, zoom])\n\n return <MapSettingsContext value={value}>{children}</MapSettingsContext>\n}\n","import { createContext } from 'react'\n\nimport type { MapSettingsState } from './State.ts'\n\nconst MapSettingsContext = createContext<MapSettingsState>({})\n\nexport { MapSettingsContext }\n","import { use } from 'react'\n\nimport { MapSettingsContext } from './Context.ts'\n\nconst useMapSettings = () => {\n const context = use(MapSettingsContext)\n\n return context\n}\n\nexport { useMapSettings }\n","import { createContext } from 'react'\n\nimport type { HeatMapInitializerState } from './State.ts'\n\nconst HeatMapInitializerContext = createContext<HeatMapInitializerState>({})\n\nexport { HeatMapInitializerContext }\n","import { assertEx } from '@xylabs/assert'\nimport { use } from 'react'\n\nimport { HeatMapInitializerContext } from './Context.ts'\n\nconst useHeatMapInitializer = () => {\n const context = use(HeatMapInitializerContext)\n assertEx('heatMapInitialized' in context, () => 'useHeatMapInitializer must be used within a HeatMapInitializerContext')\n\n return context\n}\n\nexport { useHeatMapInitializer }\n","import type { FillLayerSpecification } from 'mapbox-gl'\n\nexport const HeatMapFillLayerConfig: (color: string) => Partial<FillLayerSpecification> = color => ({\n paint: {\n 'fill-color': color,\n 'fill-opacity': [\n 'let',\n 'density',\n ['+', ['/', ['number', ['get', 'value']], 4], 0.125],\n ['interpolate', ['linear'], ['var', 'density'], 0.8, ['var', 'density'], 1, 0.85],\n ],\n },\n})\n","import type { LineLayerSpecification } from 'mapbox-gl'\n\nexport const HeatMapLineLayerConfig: (color: string) => Partial<LineLayerSpecification> = color => ({\n layout: {\n // Enable for debugging\n visibility: 'none',\n },\n paint: {\n 'line-color': color,\n 'line-opacity': ['let', 'density', 0, ['interpolate', ['linear'], ['var', 'density'], 0.8, ['var', 'density'], 1, 0.85]],\n 'line-width': 0.5,\n },\n})\n","import type { SymbolLayerSpecification } from 'mapbox-gl'\n\nexport const HeatMapSymbolLayerConfig: (color: string) => Partial<SymbolLayerSpecification> = color => ({\n layout: {\n 'text-anchor': 'center',\n 'text-field': [\n 'concat',\n 'value: ',\n ['to-string', ['+', ['/', ['number', ['get', 'value']], 2], 0.25]],\n '\\n',\n 'count: ',\n ['to-string', ['get', 'count']],\n ],\n 'text-size': 10,\n 'visibility': 'none',\n },\n paint: { 'text-color': color },\n})\n","import type { CircleLayerSpecification } from 'mapbox-gl'\n\nexport const LocationPointLayerConfig: (color: string, circleRadius: number, circleOpacity: number) => Partial<CircleLayerSpecification> = (\n color,\n circleRadius,\n circleOpacity,\n) => {\n return {\n paint: {\n 'circle-color': color,\n 'circle-opacity': circleOpacity,\n 'circle-radius': circleRadius,\n },\n }\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { FillLayerSpecification } from 'mapbox-gl'\n\nexport class FillLayerBuilder extends LayerBase<FillLayerSpecification> {\n FillLayerOptions: Partial<FillLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'fill' = 'fill' as const\n\n constructor(id: string, source: string, FillLayerOptions?: Partial<FillLayerSpecification>) {\n super(id, source)\n this.FillLayerOptions = FillLayerOptions || { id: this.id, source: this.source }\n }\n\n buildLayer(): FillLayerSpecification {\n return {\n ...this.FillLayerOptions,\n id: this.id,\n source: this.source,\n type: this.type,\n }\n }\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { LineLayerSpecification } from 'mapbox-gl'\n\nexport class LineLayerBuilder extends LayerBase<LineLayerSpecification> {\n LineLayerOptions: Partial<LineLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'line' = 'line' as const\n\n constructor(id: string, source: string, LineLayerOptions?: Partial<LineLayerSpecification>) {\n super(id, source)\n this.LineLayerOptions = LineLayerOptions || { id: this.id, source: this.source }\n }\n\n buildLayer(): LineLayerSpecification {\n return {\n ...this.LineLayerOptions,\n id: this.id,\n layout: {},\n source: this.source,\n type: this.type,\n }\n }\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { SymbolLayerSpecification } from 'mapbox-gl'\n\nexport class SymbolLayerBuilder extends LayerBase<SymbolLayerSpecification> {\n SymbolLayerOptions: Partial<SymbolLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'symbol' = 'symbol' as const\n\n constructor(id: string, source: string, SymbolLayerOptions?: Partial<SymbolLayerSpecification>) {\n super(id, source)\n this.SymbolLayerOptions = SymbolLayerOptions || { id: this.id, source: this.source }\n }\n\n buildLayer(): SymbolLayerSpecification {\n return {\n ...this.SymbolLayerOptions,\n id: this.id,\n source: this.source,\n type: this.type,\n }\n }\n}\n","import {\n HeatMapFillLayerConfig, HeatMapLineLayerConfig, HeatMapSymbolLayerConfig,\n} from '../Configs/index.ts'\nimport { FillLayerBuilder } from '../FillLayer.ts'\nimport { LineLayerBuilder } from '../LineLayer.ts'\nimport { SymbolLayerBuilder } from '../SymbolLayer.ts'\n\nexport const MapHeatConstants = {\n LocationDebugLayerId: 'location-debug-id',\n LocationDebugLayerSource: 'location-debug-source',\n LocationFillLayerId: 'location-fill-id',\n LocationFillLayerSource: 'location-fill-source',\n LocationLineLayerId: 'location-line-id',\n LocationLineLayerSource: 'location-line-source',\n}\n\nexport const LocationHeatMapLayerBuilder = (color: string, alternateColor = '#000') => {\n const {\n LocationFillLayerId,\n LocationFillLayerSource,\n LocationLineLayerId,\n LocationLineLayerSource,\n LocationDebugLayerId,\n LocationDebugLayerSource,\n } = MapHeatConstants\n\n const fillLayerConfig = HeatMapFillLayerConfig(color)\n const lineLayerConfig = HeatMapLineLayerConfig(color)\n const debugLayerConfig = HeatMapSymbolLayerConfig(alternateColor)\n\n const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig)\n const lineLayer = new LineLayerBuilder(LocationLineLayerId, LocationLineLayerSource, lineLayerConfig)\n const debugLayer = new SymbolLayerBuilder(LocationDebugLayerId, LocationDebugLayerSource, debugLayerConfig)\n\n return [fillLayer, lineLayer, debugLayer]\n}\n","import { HeatMapFillLayerConfig } from '../Configs/index.ts'\nimport { FillLayerBuilder } from '../FillLayer.ts'\n\nconst MapHeatConstants = (index: number, type: string) => ({\n LocationDebugLayerId: `location-${type}-debug-id-${index}`,\n LocationDebugLayerSource: `location-${type}-debug-source-${index}`,\n LocationFillLayerId: `location-${type}-fill-id-${index}`,\n LocationFillLayerSource: `location-${type}-fill-source-${index}`,\n LocationLineLayerId: `location-${type}-line-id-${index}`,\n LocationLineLayerSource: `location-${type}-line-source-${index}`,\n})\n\nexport const LocationHeatMapLayerBuilderAnimated = (color: string, index: number, type = '') => {\n const { LocationFillLayerId, LocationFillLayerSource } = MapHeatConstants(index, type)\n\n const fillLayerConfig = HeatMapFillLayerConfig(color)\n\n const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig)\n\n return fillLayer\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { CircleLayerSpecification } from 'mapbox-gl'\n\nexport class CircleLayerBuilder extends LayerBase<CircleLayerSpecification> {\n CircleLayerOptions: Partial<CircleLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'circle' = 'circle' as const\n\n constructor(id: string, source: string, CircleLayerOptions?: Partial<CircleLayerSpecification>) {\n super(id, source)\n this.CircleLayerOptions = CircleLayerOptions || {\n id: this.id, source: this.source, type: 'circle',\n }\n }\n\n buildLayer(): CircleLayerSpecification {\n return {\n filter: ['==', '$type', 'Point'],\n layout: {},\n paint: {\n 'circle-color': '#ff0000',\n 'circle-radius': 6,\n },\n type: this.type,\n ...this.CircleLayerOptions,\n id: this.id,\n source: this.source,\n }\n }\n}\n","import { CircleLayerBuilder } from '../CircleLayer.ts'\nimport { LocationPointLayerConfig } from '../Configs/index.ts'\n\nexport const MapPointsConstants = {\n LocationDotsLayerId: 'location-dots',\n LocationDotsLayerSource: 'location-dots-source',\n}\n\nexport const LocationPointsMapLayerBuilder = (color: string, circleRadius = 6, circleOpacity = 0.8) => {\n const { LocationDotsLayerId, LocationDotsLayerSource } = MapPointsConstants\n\n const dotLayerConfig = LocationPointLayerConfig(color, circleRadius, circleOpacity)\n\n const dotLayer = new CircleLayerBuilder(LocationDotsLayerId, LocationDotsLayerSource, dotLayerConfig)\n\n return [dotLayer]\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport type { MapboxFlexBoxProps } from '../lib/index.ts'\nimport { MapBox } from './MapBox.tsx'\nimport { MapSettingsBox } from './MapSettingsComponents/index.ts'\n\nexport const MapboxHeatFlexBox: React.FC<MapboxFlexBoxProps> = ({\n accessToken, children, mapBoxOptions, zoom, legend, developerMode, ...props\n}) => {\n return (\n <FlexCol {...props}>\n <MapBox accessToken={accessToken} options={mapBoxOptions} zoom={zoom} />\n <MapSettingsBox developerMode={developerMode} />\n {legend}\n {children}\n </FlexCol>\n )\n}\n","// eslint-disable-next-line import-x/no-internal-modules\nimport 'mapbox-gl/dist/mapbox-gl.css'\n\nimport { MapStyle } from '@xyo-network/react-map-model'\nimport type { MapOptions } from 'mapbox-gl'\nimport { Map } from 'mapbox-gl'\nimport React, {\n useEffect, useRef, useState,\n} from 'react'\n\nimport { useMapBoxInstance, useMapSettings } from '../Contexts/index.ts'\nimport { useDynamicMapResize } from '../hooks/index.ts'\n\nexport interface MapBoxProps {\n accessToken: string\n darkMode?: boolean\n options?: Partial<MapOptions>\n zoom?: number\n}\n\nexport const MapBox: React.FC<MapBoxProps> = ({\n accessToken, darkMode = false, options, zoom = 2, ...props\n}) => {\n const [map, setMap] = useState<Map>()\n const mapContainerRef = useRef<HTMLDivElement>(null)\n const mapCanvasRef = useRef<HTMLCanvasElement>(null)\n const { setMapBoxInstance, map: mapInstance } = useMapBoxInstance()\n const { mapSettings } = useMapSettings()\n\n const activeResize = mapSettings?.dynamicMapResize.value\n useDynamicMapResize(mapContainerRef, mapCanvasRef, mapInstance, activeResize)\n\n useEffect(() => {\n if (mapSettings?.preferDark?.value === true) {\n map?.setStyle(`mapbox://styles/${MapStyle.Dark}`)\n } else {\n map?.setStyle(`mapbox://styles/${darkMode ? MapStyle.Dark : MapStyle.Light}`)\n }\n }, [map, darkMode, mapSettings])\n\n useEffect(() => {\n const map = new Map({\n accessToken,\n center: [0, 0],\n container: mapContainerRef.current ?? '',\n style: `mapbox://styles/${MapStyle.Light}`,\n zoom,\n ...options,\n })\n\n // Allow external components to control the map\n setMapBoxInstance?.(map)\n // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setMap(map)\n\n // save the map canvas ref to help with resizing\n mapCanvasRef.current = document.querySelector('.mapboxgl-canvas') as HTMLCanvasElement | null\n\n console.log('Created Map')\n\n return () => {\n console.log('Removing Map')\n map.remove()\n }\n }, [mapContainerRef, setMap, options, zoom, setMapBoxInstance, accessToken])\n\n return (\n <div\n ref={(el) => { mapContainerRef.current = el }}\n style={{\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n ...props,\n }}\n />\n )\n}\n","import type { SwitchProps } from '@mui/material'\nimport { FormControlLabel, Switch } from '@mui/material'\nimport React from 'react'\n\nimport { useMapSettings } from '../../Contexts/index.ts'\n\nexport interface MapSettingSwitchProps extends SwitchProps {\n developerMode?: boolean\n field: string\n}\n\nexport const MapSettingSwitch: React.FC<MapSettingSwitchProps> = ({\n developerMode, field, ...props\n}) => {\n const { mapSettings, setMapSettings } = useMapSettings()\n const setting = mapSettings?.[field]\n\n const onLocalChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (setting) {\n setMapSettings?.((previous) => {\n previous[setting.field].value = event.target.checked\n return { ...previous }\n })\n }\n }\n\n if (setting?.devMode && developerMode === false) {\n return null\n }\n\n return setting?.hidden\n ? null\n : (\n <FormControlLabel label={setting?.label} control={<Switch checked={setting?.value} onChange={onLocalChange} {...props} />} />\n )\n}\n","import { Paper, Stack } from '@mui/material'\nimport { useAppSettings } from '@xylabs/react-app-settings'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { useMapSettings } from '../../Contexts/index.ts'\nimport { MapSettingSwitch } from './Setting.tsx'\n\nexport interface MapSettingsBoxProps extends FlexBoxProps {\n developerMode?: boolean\n}\n\nexport const MapSettingsBox: React.FC<MapSettingsBoxProps> = ({ developerMode, ...props }) => {\n const { mapSettings } = useMapSettings()\n const { developerMode: devModeFromContext } = useAppSettings()\n const resolveDeveloperMode = developerMode ?? devModeFromContext\n\n return mapSettings && resolveDeveloperMode\n ? (\n <FlexGrowRow bottom={36} left={10} position=\"absolute\" {...props}>\n <FlexRow paddingX={2}>\n <Paper>\n <Stack direction=\"row\" spacing={1} marginX={1}>\n {Object.keys(mapSettings).map((key, index) => {\n return <MapSettingSwitch key={index} field={mapSettings[key].field} developerMode={developerMode} />\n })}\n </Stack>\n </Paper>\n </FlexRow>\n </FlexGrowRow>\n )\n : null\n}\n","import { Alert, AlertTitle } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { useWeakArchivistFromNode, useWeakArchivistGet } from '@xyo-network/react-archivist'\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '@xyo-network/react-map-model'\nimport {\n AnimatedHeatMapSettings,\n useFindHashes, useHeatMapColors,\n} from '@xyo-network/react-map-model'\nimport type { Feature, Polygon } from 'geojson'\nimport React from 'react'\n\nimport { useQuadKeyPayloadsToFeatures } from '../hooks/index.ts'\nimport { AnimatedHeatMap } from './AnimatedHeatMap.tsx'\nimport { AnimatedHeatMapLegend } from './Legend.tsx'\n\nexport interface AnimatedHeatMapLoadedProps extends FlexBoxProps {\n accessToken: string\n archivistNameOrAddress: string\n}\n\nexport const AnimatedHeatMapLoaded: React.FC<AnimatedHeatMapLoadedProps> = ({\n accessToken, archivistNameOrAddress, ...props\n}) => {\n const hashes = useFindHashes()\n const [archivist] = useWeakArchivistFromNode(archivistNameOrAddress)\n const [payloads, xyoError] = useWeakArchivistGet<NetworkLocationHeatmapQuadkeyAnswerPayload>(archivist, hashes)\n const { multipleFeatureSets } = useQuadKeyPayloadsToFeatures(payloads)\n const { heatMapColorProps, legendProps } = useHeatMapColors()\n\n const MapBoxHeatProps = {\n flexGrow: 1,\n legend: legendProps ? <AnimatedHeatMapLegend {...legendProps} /> : null,\n }\n\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {xyoError\n ? (\n <Alert sx={{ mt: 2 }}>\n <AlertTitle>Error Loading Map</AlertTitle>\n {xyoError.message ? `Error: ${xyoError.message}` : null}\n You might try authenticating again.\n </Alert>\n )\n : null}\n {hashes === undefined\n ? <Alert>Missing answer hash for heat map query</Alert>\n : (\n <AnimatedHeatMap\n accessToken={accessToken}\n defaultMapSettings={AnimatedHeatMapSettings}\n animatedFeatureSets={multipleFeatureSets.slice(1) as Feature<Polygon>[][]}\n staticFeatureSet={multipleFeatureSets[0] as Feature<Polygon>[]}\n heatMapColorProps={heatMapColorProps}\n {...MapBoxHeatProps}\n />\n )}\n </FlexCol>\n )\n}\n","import { useMediaQuery, useTheme } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { ColorGradientLegendProps } from '@xyo-network/react-map-model'\nimport React from 'react'\n\nimport { ColorGradientLegend } from './Legends/index.ts'\n\nconst AnimatedHeatMapLegend: React.FC<ColorGradientLegendProps> = ({ ...legendProps }) => {\n const {\n startColor, endColor, startLabel, endLabel, heading, textColor,\n } = legendProps\n const theme = useTheme()\n const isSmall = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n <FlexCol position=\"absolute\" bottom={0} right={0}>\n <ColorGradientLegend\n startColor={startColor}\n endColor={endColor}\n startLabel={startLabel}\n endLabel={endLabel}\n heading={heading}\n textColor={textColor}\n {...{\n alignItems: 'stretch',\n marginBottom: theme.spacing(4),\n marginLeft: isSmall ? theme.spacing(3) : 0,\n marginRight: isSmall ? theme.spacing(2) : theme.spacing(3),\n width: isSmall ? '40vw' : theme.spacing(18),\n }}\n />\n </FlexCol>\n )\n}\n\nexport { AnimatedHeatMapLegend }\n","import { Typography, useTheme } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport type { ColorGradientLegendProps } from '@xyo-network/react-map-model'\nimport React from 'react'\n\nconst ColorGradientLegend: React.FC<ColorGradientLegendProps> = ({\n startColor, endColor, startLabel, endLabel, heading, textColor, ...props\n}) => {\n const theme = useTheme()\n\n return (\n <FlexCol {...props}>\n <Typography mb={theme.spacing(0.25)} color={textColor} variant=\"caption\" textAlign=\"center\">\n {heading}\n </Typography>\n <FlexCol flexGrow={1} alignItems=\"stretch\" paddingX={theme.spacing(1)} mb={theme.spacing(0.25)}>\n <FlexCol\n height={theme.spacing(0.75)}\n border={`1px solid ${textColor}`}\n sx={{ backgroundImage: `linear-gradient(to right, ${startColor},${endColor})` }}\n />\n </FlexCol>\n <FlexRow flexGrow={1} justifyContent=\"space-between\">\n <Typography color={textColor} variant=\"caption\">\n {startLabel}\n </Typography>\n <Typography color={textColor} variant=\"caption\">\n {endLabel}\n </Typography>\n </FlexRow>\n </FlexCol>\n )\n}\n\nexport { ColorGradientLegend }\n","import { DefaultMapSettings } from '@xyo-network/react-map-model'\n\nconst HeatMapSettings = DefaultMapSettings()\nconst {\n debugLayer, scrollToZoom, fitToPoints,\n} = HeatMapSettings\ndebugLayer.hidden = false\nscrollToZoom.value = true\nfitToPoints.value = true\n\nexport { HeatMapSettings }\n","import { useInterval } from '@xylabs/react-shared'\nimport type { Map } from 'mapbox-gl'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n useCallback, useEffect, useMemo, useRef,\n} from 'react'\n\nimport type { MapLayer } from '../Layers/index.ts'\nimport type { MapboxFlexBoxProps } from '../lib/index.ts'\n\nexport interface LayerAnimatorProps {\n animateLayers?: boolean\n layers: MapboxFlexBoxProps['layers']\n layersInitialized: boolean\n map: Map | undefined\n}\n\nconst timeIncrement = 2000\nconst animatedLayerCount = 3\n\nexport const LayerAnimator: React.FC<PropsWithChildren<LayerAnimatorProps>> = ({\n animateLayers, children, layers, layersInitialized, map,\n}) => {\n const layerIndexQueue = useRef<number[]>([])\n\n const fillLayers: MapLayer[] = useMemo(() => {\n if (layers?.length && map && layersInitialized) {\n return layers.filter((layer) => {\n const fillLayer = layer.id.startsWith('location-fill')\n if (fillLayer) {\n map.setPaintProperty(layer.id, 'fill-opacity-transition', { delay: 0, duration: 4000 })\n }\n return fillLayer\n })\n }\n return []\n }, [layers, layersInitialized, map])\n\n const incrementQueue = useCallback(\n (index: number) => {\n if (fillLayers[index]) {\n layerIndexQueue.current.push(index)\n } else {\n layerIndexQueue.current.push(0)\n }\n return layerIndexQueue.current.at(-1)\n },\n [fillLayers],\n )\n\n const lastQueuedIndex = useCallback(() => {\n const last = layerIndexQueue.current.at(-1)\n if (last === undefined) {\n incrementQueue(0)\n return 0\n } else {\n return last\n }\n }, [incrementQueue])\n\n const unshiftQueue = useCallback(() => {\n layerIndexQueue.current.shift()\n }, [])\n\n const getNextLayer = useCallback(() => {\n const nextLayer = fillLayers[lastQueuedIndex()]\n incrementQueue(lastQueuedIndex() + 1)\n return nextLayer\n }, [fillLayers, incrementQueue, lastQueuedIndex])\n\n const layerAnimateWorker = useCallback(\n (layer: MapLayer) => {\n if (layer) {\n map?.setPaintProperty(layer.id, 'fill-opacity', 0.85)\n setTimeout(() => {\n map?.setPaintProperty(layer.id, 'fill-opacity', 0)\n unshiftQueue()\n }, timeIncrement * 2)\n } else {\n console.warn('tried to queue an empty layer')\n }\n },\n [map, unshiftQueue],\n )\n\n //\n const queueLayerAnimation = useCallback(() => {\n const animatedLayers: MapLayer[] = []\n\n for (let i = 0; i < animatedLayerCount; i++) {\n animatedLayers.push(getNextLayer())\n }\n\n for (const [index, layer] of animatedLayers.entries()) {\n if (index === 0) {\n layerAnimateWorker(layer)\n } else {\n setTimeout(() => {\n layerAnimateWorker(layer)\n }, timeIncrement * index)\n }\n }\n }, [getNextLayer, layerAnimateWorker])\n\n // Run a single layer animation before the interval kicks in\n useEffect(() => {\n if (animateLayers && layersInitialized && map && fillLayers.length > 0) {\n queueLayerAnimation()\n }\n }, [animateLayers, fillLayers.length, layersInitialized, map, queueLayerAnimation])\n\n useInterval(() => {\n if (animateLayers && layersInitialized && map && fillLayers.length > 0) {\n queueLayerAnimation()\n }\n }, timeIncrement * animatedLayerCount)\n\n return <>{children}</>\n}\n","import { Alert } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { Feature, Point } from 'geojson'\nimport type { MapOptions } from 'mapbox-gl'\nimport React, {\n useCallback, useEffect, useMemo,\n} from 'react'\n\nimport { useMapBoxInstance, useMapSettings } from '../Contexts/index.ts'\nimport type { MapboxFlexBoxProps } from '../lib/index.ts'\nimport { MapPoints } from '../MapBoxClasses/index.ts'\nimport { MapBox } from './MapBox.tsx'\nimport { MapSettingsBox } from './MapSettingsComponents/index.ts'\n\nexport interface MapboxPointsFlexBoxProps extends MapboxFlexBoxProps {\n accessToken: string\n features?: Feature<Point>[]\n}\n\nexport const MapboxPointsFlexBox: React.FC<MapboxPointsFlexBoxProps> = ({\n accessToken,\n features,\n fitToPointsPadding = 20,\n layers,\n zoom,\n ...props\n}) => {\n const { mapSettings } = useMapSettings()\n const { map, mapInitialized } = useMapBoxInstance()\n\n /**\n * Needed because of a bug in mapbox taking undefined values for the config options of fitToBounds\n * see - https://github.com/mapbox/mapbox-gl-js/issues/10013\n */\n const customFitToBoundsOptions = (zoom?: number): MapOptions['fitBoundsOptions'] => {\n if (zoom !== undefined) {\n return { maxZoom: zoom }\n }\n return {}\n }\n\n const mapPoints = useMemo(() => {\n return (map && features?.length)\n ? new MapPoints({\n features, map, zoom,\n })\n : undefined\n }, [map, features, zoom])\n\n const updateFeatures = useCallback(() => {\n if (mapPoints?.isMapReady && features?.length && layers)\n for (const layer of layers) {\n mapPoints.initializeMapSource(layer)\n }\n }, [mapPoints, features, layers])\n\n const updateMapSetup = useCallback(() => {\n const { fitToPoints } = mapSettings || {}\n\n if (mapPoints && map && fitToPoints?.value === true) {\n mapPoints.initialMapPositioning({\n padding: {\n bottom: fitToPointsPadding, left: fitToPointsPadding, right: fitToPointsPadding, top: fitToPointsPadding,\n },\n ...customFitToBoundsOptions(zoom),\n })\n }\n }, [mapSettings, mapPoints, map, fitToPointsPadding, zoom])\n\n const reInitializeMap = useCallback(() => {\n mapPoints?.initialMapPositioning({\n padding: {\n bottom: fitToPointsPadding, left: fitToPointsPadding, right: fitToPointsPadding, top: fitToPointsPadding,\n },\n ...customFitToBoundsOptions(zoom),\n })\n updateFeatures()\n }, [mapPoints, fitToPointsPadding, updateFeatures, zoom])\n\n useEffect(() => {\n if (mapInitialized) {\n updateMapSetup()\n reInitializeMap()\n }\n }, [mapInitialized, reInitializeMap, updateMapSetup])\n\n return (\n <FlexCol alignItems=\"stretch\" id=\"xyo-mapbox-wrap\" {...props}>\n {features\n ? (\n <>\n <MapBox accessToken={accessToken} zoom={zoom} />\n <MapSettingsBox />\n </>\n )\n : <Alert severity=\"error\">No data to show</Alert>}\n </F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B,QAAA,cAACK,gBAAAA,IAAAA,CAAAA,IAGL,gBAAAL,QAAA,cAACM,QAAAA;IAAMC,UAAS;KAAQ,iBAAA,CAAA;AAGlC,GA/EuE;","names":["useTheme","FlexCol","darkenCss","React","useState","forget","React","useEffect","useMemo","useEffect","useMemo","useDynamicMapResize","mapContainerRef","mapCanvasRef","mapInstance","active","resizer","useMemo","ResizeObserver","width","current","getBoundingClientRect","style","setTimeout","resize","dependenciesReady","useEffect","observe","disconnect","useWindowSize","useMemo","defaultZoom","defaultAspectRatioRange","latRange","lngRange","linearInterpolate","aspectRatio","degreeRange","aspectRatioRange","degreeMin","degreeMax","aspectRatioMin","aspectRatioMax","aspectRatioRangeSpan","degreeRangeSpan","percent","scaledDegree","useDynamicPositioning","width","height","useWindowSize","options","useMemo","center","zoom","exists","GeoJson","useMemo","useState","quadKeyToFeature","density","quadkey","polygonFeature","GeoJson","properties","count","setDensity","feature","value","useQuadKeyPayloadsToFeatures","payloads","multipleFeatureSets","setMultipleFeatureSets","useState","features","setFeatures","error","setError","useMemo","Array","isArray","filter","exists","length","mappedFeatures","map","payload","result","Error","singlePayload","assertEx","GeoJson","MapBase","_config","constructor","config","requestLocation","zoom","isMapReady","map","initializeMapSource","layer","getSource","featuresCollection","GeoJson","featureCollection","features","featuresSource","existingSource","source","setData","assertEx","data","addSource","update","assertEx","delay","forget","GeoJson","LngLatBounds","MapHeat","MapBase","animationStarted","config","constructor","initialMapPositioning","options","map","features","initialBounds","bounds","LngLatBounds","forEach","feature","coordinates","geometry","position","extend","setCenter","getCenter","fitBounds","initializeAnimatedHeatMapSource","layers","featureSet","startColor","endColor","layerTick","sourceTick","sources","featuresCollection","GeoJson","featureCollection","featuresSource","updateLayer","layer","setPaintProperty","id","frameLength","initialPad","factor","steps","stepLength","lowUsageColor","highUsageColor","dynamicFillColor","i","sinFade","Math","sin","PI","cosFade","cos","divisor","offset","fadedIn","_","fadeIn","index","delay","fadeOut","started","startAnimation","assertEx","upLayer","length","downLayer","incomingSource","outgoingSource","forget","source","existingSource","getSource","data","setData","addSource","update","initializeHeatMapSource","entries","LngLatBounds","MapPoints","MapBase","config","constructor","initialMapPositioning","options","initialBounds","bounds","LngLatBounds","features","forEach","feature","extend","geometry","coordinates","map","setCenter","getCenter","fitBounds","GeolocateControl","NavigationControl","MapSettings","geoLocateControl","mapListeners","logData","ev","map","target","console","log","getZoom","getCenter","navControl","requestLocation","toggleControls","value","zoom","addControls","removeControls","toggleDebugLayer","layerName","debugLayer","getLayer","setLayoutProperty","toggleDebugLogging","debugEvents","undefined","event","on","off","toggleScrollToZoom","scrollZoom","enable","disable","updateSettings","config","settings","debugLayerName","scrollToZoom","enableControls","debugLogging","geolocateControl","GeolocateControl","fitBoundsOptions","positionOptions","enableHighAccuracy","trackUserLocation","NavigationControl","showCompass","hasControl","addControl","removeControl","React","useEffect","useMemo","useState","createContext","MapBoxInstanceContext","MapBoxInstanceProvider","children","map","setMapBoxInstance","useState","mapInitialized","setMapInitialized","value","useMemo","useEffect","on","MapBoxInstanceContext","assertEx","use","useMapBoxInstance","context","use","MapBoxInstanceContext","assertEx","React","useEffect","useMemo","useState","createContext","MapSettingsContext","MapSettingsProvider","children","debugLayerName","defaultMapSettings","requestLocation","zoom","mapSettings","setMapSettings","useState","map","mapInitialized","useMapBoxInstance","value","useMemo","useEffect","MapSettings","updateSettings","settings","React","MapSettingsContext","use","useMapSettings","context","use","MapSettingsContext","createContext","HeatMapInitializerContext","HeatMapInitializerProvider","children","featureSets","featureSetsLayers","features","fitToPadding","heatMapColorProps","layers","zoom","options","useDynamicPositioning","mapSettings","useMapSettings","map","mapInitialized","useMapBoxInstance","mapHeat","useMemo","length","MapHeat","undefined","value","useEffect","lowUsageColor","highUsageColor","forget","initializeAnimatedHeatMapSource","animationStarted","initializeHeatMapSource","fitToPoints","initialMapPositioning","padding","bottom","left","right","top","center","setZoom","setCenter","React","HeatMapInitializerContext","assertEx","use","useHeatMapInitializer","context","use","HeatMapInitializerContext","assertEx","HeatMapFillLayerConfig","color","paint","HeatMapLineLayerConfig","color","layout","visibility","paint","HeatMapSymbolLayerConfig","color","layout","paint","LocationPointLayerConfig","color","circleRadius","circleOpacity","paint","LayerBase","FillLayerBuilder","LayerBase","FillLayerOptions","type","constructor","id","source","buildLayer","LayerBase","LineLayerBuilder","LayerBase","LineLayerOptions","type","constructor","id","source","buildLayer","layout","LayerBase","SymbolLayerBuilder","LayerBase","SymbolLayerOptions","type","constructor","id","source","buildLayer","MapHeatConstants","LocationDebugLayerId","LocationDebugLayerSource","LocationFillLayerId","LocationFillLayerSource","LocationLineLayerId","LocationLineLayerSource","LocationHeatMapLayerBuilder","color","alternateColor","fillLayerConfig","HeatMapFillLayerConfig","lineLayerConfig","HeatMapLineLayerConfig","debugLayerConfig","HeatMapSymbolLayerConfig","fillLayer","FillLayerBuilder","lineLayer","LineLayerBuilder","debugLayer","SymbolLayerBuilder","MapHeatConstants","index","type","LocationDebugLayerId","LocationDebugLayerSource","LocationFillLayerId","LocationFillLayerSource","LocationLineLayerId","LocationLineLayerSource","LocationHeatMapLayerBuilderAnimated","color","fillLayerConfig","HeatMapFillLayerConfig","fillLayer","FillLayerBuilder","LayerBase","CircleLayerBuilder","LayerBase","CircleLayerOptions","type","constructor","id","source","buildLayer","filter","layout","paint","MapPointsConstants","LocationDotsLayerId","LocationDotsLayerSource","LocationPointsMapLayerBuilder","color","circleRadius","circleOpacity","dotLayerConfig","LocationPointLayerConfig","dotLayer","CircleLayerBuilder","FlexCol","React","MapStyle","Map","React","useEffect","useRef","useState","MapBox","accessToken","darkMode","options","zoom","props","map","setMap","useState","mapContainerRef","useRef","mapCanvasRef","setMapBoxInstance","mapInstance","useMapBoxInstance","mapSettings","useMapSettings","activeResize","dynamicMapResize","value","useDynamicMapResize","useEffect","preferDark","setStyle","MapStyle","Dark","Light","Map","center","container","current","style","document","querySelector","console","log","remove","React","div","ref","el","bottom","left","position","right","top","FormControlLabel","Switch","React","MapSettingSwitch","developerMode","field","props","mapSettings","setMapSettings","useMapSettings","setting","onLocalChange","event","previous","value","target","checked","devMode","hidden","React","FormControlLabel","label","control","Switch","onChange","Paper","Stack","useAppSettings","FlexGrowRow","FlexRow","React","MapSettingsBox","developerMode","props","mapSettings","useMapSettings","devModeFromContext","useAppSettings","resolveDeveloperMode","React","FlexGrowRow","bottom","left","position","FlexRow","paddingX","Paper","Stack","direction","spacing","marginX","Object","keys","map","key","index","MapSettingSwitch","field","MapboxHeatFlexBox","accessToken","children","mapBoxOptions","zoom","legend","developerMode","props","React","FlexCol","MapBox","options","MapSettingsBox","AnimatedHeatMap","accessToken","animatedFeatureSets","defaultMapSettings","heatMapColorProps","staticFeatureSet","props","theme","useTheme","staticMapColor","lowUsageColor","highUsageColor","localStaticMapColor","vars","palette","primary","light","layers","useState","LocationHeatMapLayerBuilderAnimated","darkenCss","length","React","MapBoxInstanceProvider","MapSettingsProvider","debugLayerName","MapHeatConstants","LocationDebugLayerId","HeatMapInitializerProvider","features","featureSets","featureSetsLayers","slice","MapboxHeatFlexBox","FlexCol","minHeight","minWidth","busy","Alert","AlertTitle","FlexCol","useWeakArchivistFromNode","useWeakArchivistGet","AnimatedHeatMapSettings","useFindHashes","useHeatMapColors","React","useMediaQuery","useTheme","FlexCol","React","Typography","useTheme","FlexCol","FlexRow","React","ColorGradientLegend","startColor","endColor","startLabel","endLabel","heading","textColor","props","theme","useTheme","React","FlexCol","Typography","mb","spacing","color","variant","textAlign","flexGrow","alignItems","paddingX","height","border","sx","backgroundImage","FlexRow","justifyContent","AnimatedHeatMapLegend","legendProps","startColor","endColor","startLabel","endLabel","heading","textColor","theme","useTheme","isSmall","useMediaQuery","breakpoints","down","React","FlexCol","position","bottom","right","ColorGradientLegend","alignItems","marginBottom","spacing","marginLeft","marginRight","width","AnimatedHeatMapLoaded","accessToken","archivistNameOrAddress","props","hashes","useFindHashes","archivist","useWeakArchivistFromNode","payloads","xyoError","useWeakArchivistGet","multipleFeatureSets","useQuadKeyPayloadsToFeatures","heatMapColorProps","legendProps","useHeatMapColors","MapBoxHeatProps","flexGrow","legend","React","AnimatedHeatMapLegend","FlexCol","alignItems","Alert","sx","mt","AlertTitle","message","undefined","AnimatedHeatMap","defaultMapSettings","AnimatedHeatMapSettings","animatedFeatureSets","slice","staticFeatureSet","DefaultMapSettings","HeatMapSettings","debugLayer","scrollToZoom","fitToPoints","hidden","value","useInterval","React","useCallback","useEffect","useMemo","useRef","timeIncrement","animatedLayerCount","LayerAnimator","animateLayers","children","layers","layersInitialized","map","layerIndexQueue","useRef","fillLayers","useMemo","length","filter","layer","fillLayer","id","startsWith","setPaintProperty","delay","duration","incrementQueue","useCallback","index","current","push","at","lastQueuedIndex","last","undefined","unshiftQueue","shift","getNextLayer","nextLayer","layerAnimateWorker","setTimeout","console","warn","queueLayerAnimation","animatedLayers","i","entries","useEffect","useInterval","React","Alert","FlexCol","React","useCallback","useEffect","useMemo","MapboxPointsFlexBox","accessToken","features","fitToPointsPadding","layers","zoom","props","mapSettings","useMapSettings","map","mapInitialized","useMapBoxInstance","customFitToBoundsOptions","undefined","maxZoom","mapPoints","useMemo","length","MapPoints","updateFeatures","useCallback","isMapReady","layer","initializeMapSource","updateMapSetup","fitToPoints","value","initialMapPositioning","padding","bottom","left","right","top","reInitializeMap","useEffect","React","FlexCol","alignItems","id","MapBox","MapSettingsBox","Alert","severity"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Components/AnimatedHeatMap.tsx","../../src/Contexts/HeatMapInitializer/Provider.tsx","../../src/hooks/useDynamicMapResize.tsx","../../src/hooks/useDynamicPositioning.tsx","../../src/hooks/useQuadKeyPayloadsToFeatures.tsx","../../src/MapBoxClasses/MapBase.ts","../../src/MapBoxClasses/MapHeat.ts","../../src/MapBoxClasses/MapPoints.ts","../../src/MapBoxClasses/MapSettings.ts","../../src/Contexts/MapBoxInstance/Provider.tsx","../../src/Contexts/MapBoxInstance/Context.ts","../../src/Contexts/MapBoxInstance/useMapBoxInstance.tsx","../../src/Contexts/MapSettings/Provider.tsx","../../src/Contexts/MapSettings/Context.ts","../../src/Contexts/MapSettings/useMapSettings.tsx","../../src/Contexts/HeatMapInitializer/Context.ts","../../src/Contexts/HeatMapInitializer/useHeatMapInitializer.tsx","../../src/Layers/Configs/HeatMapFillLayerConfig.ts","../../src/Layers/Configs/HeatMapLineLayerConfig.ts","../../src/Layers/Configs/HeatMapSymbolLayerConfig.ts","../../src/Layers/Configs/LocationPointLayerConfig.ts","../../src/Layers/FillLayer.ts","../../src/Layers/LineLayer.ts","../../src/Layers/SymbolLayer.ts","../../src/Layers/Builders/LocationHeatMapLayerBuilder.ts","../../src/Layers/Builders/LocationHeatMapLayerBuilderAnimated.ts","../../src/Layers/CircleLayer.ts","../../src/Layers/Builders/LocationPointsMapLayerBuilder.ts","../../src/Components/MapBoxHeat.tsx","../../src/Components/MapBox.tsx","../../src/Components/MapSettingsComponents/Setting.tsx","../../src/Components/MapSettingsComponents/SettingsBox.tsx","../../src/Components/AnimatedHeatMapLoaded.tsx","../../src/Components/Legend.tsx","../../src/Components/Legends/ColorGradient.tsx","../../src/Components/HeatMapSettings.ts","../../src/Components/LayerAnimator.tsx","../../src/Components/MapBoxPoints.tsx"],"sourcesContent":["import { useTheme } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { darkenCss } from '@xylabs/react-theme'\nimport type { AnimatedHeatMapColorProps, MapSetting } from '@xyo-network/react-map-model'\nimport type { Feature, Polygon } from 'geojson'\nimport type { PropsWithChildren } from 'react'\nimport React, { useState } from 'react'\n\nimport {\n HeatMapInitializerProvider, MapBoxInstanceProvider, MapSettingsProvider,\n} from '../Contexts/index.ts'\nimport type { MapLayer } from '../Layers/index.ts'\nimport { LocationHeatMapLayerBuilderAnimated, MapHeatConstants } from '../Layers/index.ts'\nimport { MapboxHeatFlexBox } from './MapBoxHeat.tsx'\n\nexport interface AnimatedHeatMapProps {\n accessToken: string\n animatedFeatureSets: Feature<Polygon>[][]\n defaultMapSettings?: MapSetting\n heatMapColorProps: AnimatedHeatMapColorProps\n staticFeatureSet: Feature<Polygon>[]\n}\n\nexport const AnimatedHeatMap: React.FC<PropsWithChildren<AnimatedHeatMapProps>> = ({\n accessToken,\n animatedFeatureSets,\n defaultMapSettings,\n heatMapColorProps,\n staticFeatureSet,\n ...props\n}) => {\n const theme = useTheme()\n const {\n staticMapColor, lowUsageColor, highUsageColor,\n } = heatMapColorProps || {}\n const localStaticMapColor = staticMapColor ?? theme.vars.palette.primary.light\n\n const [layers] = useState<MapLayer[]>(() => [\n LocationHeatMapLayerBuilderAnimated(localStaticMapColor, 0, 'static'),\n LocationHeatMapLayerBuilderAnimated(lowUsageColor || localStaticMapColor, 0, 'animated'),\n LocationHeatMapLayerBuilderAnimated(highUsageColor || darkenCss(localStaticMapColor, 0.9), 1, 'animated'),\n ])\n\n return animatedFeatureSets?.length\n ? (\n <MapBoxInstanceProvider>\n <MapSettingsProvider defaultMapSettings={defaultMapSettings} debugLayerName={MapHeatConstants.LocationDebugLayerId}>\n <HeatMapInitializerProvider\n features={staticFeatureSet}\n layers={[layers[0]]}\n featureSets={animatedFeatureSets}\n featureSetsLayers={layers.slice(1, 3)}\n heatMapColorProps={heatMapColorProps}\n >\n <MapboxHeatFlexBox accessToken={accessToken} {...props}></MapboxHeatFlexBox>\n </HeatMapInitializerProvider>\n </MapSettingsProvider>\n </MapBoxInstanceProvider>\n )\n : <FlexCol minHeight={160} minWidth={160} busy />\n}\n","import { forget } from '@xylabs/forget'\nimport type { AnimatedHeatMapColorProps, HeatMapColorProps } from '@xyo-network/react-map-model'\nimport type { Feature, Polygon } from 'geojson'\nimport type { PropsWithChildren } from 'react'\nimport React, { useEffect, useMemo } from 'react'\n\nimport { useDynamicPositioning } from '../../hooks/index.ts'\nimport type { MapLayer } from '../../Layers/index.ts'\nimport { MapHeat } from '../../MapBoxClasses/index.ts'\nimport { useMapBoxInstance } from '../MapBoxInstance/index.ts'\nimport { useMapSettings } from '../MapSettings/index.ts'\nimport { HeatMapInitializerContext } from './Context.ts'\nimport type { HeatMapInitializerState } from './State.ts'\n\nexport interface MapInitializerProviderProps {\n featureSets?: Feature<Polygon>[][]\n featureSetsLayers?: MapLayer[]\n features?: Feature<Polygon>[]\n fitToPadding?: number\n heatMapColorProps: HeatMapColorProps | AnimatedHeatMapColorProps\n layers?: MapLayer[]\n zoom?: number\n}\n\nexport const HeatMapInitializerProvider: React.FC<PropsWithChildren<MapInitializerProviderProps>> = ({\n children,\n featureSets,\n featureSetsLayers,\n features,\n fitToPadding,\n heatMapColorProps,\n layers,\n zoom,\n}) => {\n const { options } = useDynamicPositioning()\n const { mapSettings } = useMapSettings()\n const { map, mapInitialized } = useMapBoxInstance()\n\n const mapHeat = useMemo(() => {\n return (map && features?.length)\n ? new MapHeat({\n features, map, zoom,\n })\n : undefined\n }, [map, features, zoom])\n\n const value: HeatMapInitializerState = useMemo(() => ({\n MapHeat: mapHeat,\n heatMapColorProps,\n }), [mapHeat, heatMapColorProps])\n\n useEffect(() => {\n if (mapInitialized && featureSets?.length && featureSets[0].length > 0 && map && featureSetsLayers?.length) {\n const { lowUsageColor, highUsageColor } = heatMapColorProps as AnimatedHeatMapColorProps\n forget(MapHeat.initializeAnimatedHeatMapSource(featureSetsLayers, featureSets, map, lowUsageColor, highUsageColor))\n }\n\n return () => {\n MapHeat.animationStarted = false\n }\n }, [featureSets, featureSetsLayers, mapInitialized, map, heatMapColorProps])\n\n useEffect(() => {\n if (mapHeat && mapInitialized && features?.length && layers?.length) {\n mapHeat.initializeHeatMapSource(layers)\n }\n }, [mapHeat, features?.length, layers, mapInitialized])\n\n useEffect(() => {\n if (mapInitialized) {\n const { fitToPoints } = mapSettings || {}\n\n if (map) {\n if (fitToPoints?.value === true) {\n MapHeat.initialMapPositioning(\n {\n padding: {\n bottom: fitToPadding, left: fitToPadding, right: fitToPadding, top: fitToPadding,\n },\n },\n map,\n features,\n )\n } else if (options?.zoom && options.center) {\n map.setZoom(options.zoom)\n map.setCenter(options.center)\n }\n }\n }\n }, [mapHeat, map, mapSettings, fitToPadding, options, mapInitialized, features])\n\n return <HeatMapInitializerContext value={value}>{children}</HeatMapInitializerContext>\n}\n","import type { Map } from 'mapbox-gl'\nimport type { RefObject } from 'react'\nimport { useEffect, useMemo } from 'react'\n\n/**\n * Inspired by - https://bl.ocks.org/danswick/fc56f37c10d40be62e4feac5984250d2\n */\nexport const useDynamicMapResize = (\n mapContainerRef: RefObject<HTMLDivElement | null>,\n mapCanvasRef: RefObject<HTMLCanvasElement | null>,\n mapInstance?: Map,\n active = true,\n) => {\n const resizer = useMemo(\n () =>\n new ResizeObserver(() => {\n const width = mapContainerRef.current?.getBoundingClientRect().width\n if (width && mapCanvasRef.current) {\n mapCanvasRef.current.style.width = `${width}px`\n // setTimeout allows for the smoothest animation (vs requestAnimationFrame, debouce, etc)\n // likely because it lets mapbox resize once when the event loop is ready?\n setTimeout(() => mapInstance?.resize())\n }\n }),\n [mapCanvasRef, mapContainerRef, mapInstance],\n )\n\n const dependenciesReady = useMemo(() => {\n return !!(active && mapInstance && mapContainerRef?.current && mapCanvasRef.current)\n }, [active, mapCanvasRef, mapContainerRef, mapInstance])\n\n useEffect(() => {\n if (dependenciesReady) {\n if (mapContainerRef.current) {\n resizer.observe(mapContainerRef.current)\n }\n\n return () => {\n resizer.disconnect()\n }\n }\n }, [active, dependenciesReady, mapCanvasRef, mapContainerRef, mapInstance, resizer])\n}\n","import { useWindowSize } from '@xylabs/react-shared'\nimport type { MapOptions } from 'mapbox-gl'\nimport { useMemo } from 'react'\n\n/**\n * Zoom level for the map\n *\n * Note: Changing zoom will require changes to Lat/Lng Ranges\n */\nconst defaultZoom = 1.6\n\n/**\n * Range of aspect ratio values (width / height = aspect ratio) to scale against degrees\n * On lower aspect ratios, the width is larger than the height and vice-versa for higher\n */\nconst defaultAspectRatioRange = [0.5, 2]\n\n/**\n * Lat/Lng ranges, the first index is the minimum and the second is the maximum\n * Index 0 is for portrait screens and centers on the Eastern Hemisphere\n * Index 1 is for wider screens near the Prime Meridian and north of the Equator\n *\n * Note: Values are based off the zoom level\n */\nconst latRange = [0.912_164_420_526_366_4, 1.717_850_315_594_39]\nconst lngRange = [-81.474_201_485_195_9, 12.788_958_675_506_933]\n\n/**\n * Function to interpolate an aspect ratio value across a range of degrees and aspect ratios\n *\n * Inspired by - https://stackoverflow.com/questions/14224535/scaling-between-two-number-ranges\n *\n * @param aspectRatio aspect ratio to scale\n * @param degreeRange A latitude or longitude range (i.e. [minLat, maxLat])\n * @param aspectRatioRange A range of aspect ratios to scale against degreeRange parameter\n * @returns number\n */\nconst linearInterpolate = (aspectRatio: number, degreeRange: number[], aspectRatioRange?: number[]): number => {\n const [degreeMin, degreeMax] = degreeRange\n const [aspectRatioMin, aspectRatioMax] = aspectRatioRange || defaultAspectRatioRange\n\n const aspectRatioRangeSpan = aspectRatioMax - aspectRatioMin\n const degreeRangeSpan = degreeMax - degreeMin\n\n const percent = (aspectRatio - aspectRatioMin) / aspectRatioRangeSpan\n const scaledDegree = percent * degreeRangeSpan + degreeMin\n\n return scaledDegree\n}\n\nconst useDynamicPositioning = () => {\n const { width, height } = useWindowSize()\n\n const options = useMemo(() => {\n if (width && height) {\n const aspectRatio = width / height\n\n return {\n center: [linearInterpolate(aspectRatio, lngRange), linearInterpolate(aspectRatio, latRange)],\n zoom: defaultZoom,\n } as Partial<MapOptions>\n }\n }, [height, width])\n\n return { options }\n}\n\nexport { useDynamicPositioning }\n","import { exists } from '@xylabs/exists'\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '@xyo-network/react-map-model'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Geometry } from 'geojson'\nimport { useMemo, useState } from 'react'\n\nconst quadKeyToFeature = ({ density, quadkey }: { density: number; quadkey: string }) => {\n const polygonFeature = new GeoJson(quadkey).polygonFeature()\n polygonFeature.properties = {\n count: density,\n density,\n }\n return polygonFeature\n}\n\nconst setDensity = (feature: Feature) => {\n if (feature.properties) {\n feature.properties.value = feature.properties.density / 5\n }\n return feature\n}\n\nconst useQuadKeyPayloadsToFeatures = (payloads?: NetworkLocationHeatmapQuadkeyAnswerPayload[] | NetworkLocationHeatmapQuadkeyAnswerPayload) => {\n const [multipleFeatureSets, setMultipleFeatureSets] = useState<Feature<Geometry>[][]>([[]])\n const [features, setFeatures] = useState<Feature<Geometry>[]>([])\n const [error, setError] = useState<Error>()\n\n useMemo(() => {\n // Convert Multiple Payloads from Quadkey to GeoJson\n if (Array.isArray(payloads)) {\n if ((payloads)?.filter(exists).length > 0) {\n const mappedFeatures = payloads?.map(payload => payload?.result.map(quadKeyToFeature))\n\n setMultipleFeatureSets(mappedFeatures.map(features => features?.map(setDensity) ?? []))\n } else {\n setError(new Error('Cannot find payloads for provided hashes'))\n }\n }\n\n // Convert Single Payload from Quadkey to GeoJson\n if (payloads && (payloads as NetworkLocationHeatmapQuadkeyAnswerPayload).result) {\n const singlePayload = payloads as NetworkLocationHeatmapQuadkeyAnswerPayload\n const mappedFeatures = singlePayload.result.map(quadKeyToFeature)\n\n setFeatures(mappedFeatures.map(setDensity))\n }\n }, [payloads])\n\n return {\n error, features, multipleFeatureSets,\n }\n}\n\nexport { useQuadKeyPayloadsToFeatures }\n","import { assertEx } from '@xylabs/assert'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Geometry } from 'geojson'\nimport type { GeoJSONSource, Map } from 'mapbox-gl'\n\nimport type { MapLayer } from '../Layers/index.ts'\n\nexport interface MapBaseConfig<T extends Geometry> {\n features: Feature<T>[]\n map: Map\n requestLocation?: boolean\n zoom?: number\n}\n\nexport abstract class MapBase<T extends Geometry> {\n private _config: MapBaseConfig<T>\n\n constructor(config: MapBaseConfig<T>) {\n this._config = {\n requestLocation: true, zoom: 2, ...config,\n }\n }\n\n get isMapReady() {\n return !!this._config.map\n }\n\n initializeMapSource(layer: MapLayer) {\n const getSource = () => {\n const featuresCollection = GeoJson.featureCollection(this._config.features)\n return GeoJson.featuresSource(featuresCollection)\n }\n\n const existingSource = this._config.map.getSource(layer.source as string) as GeoJSONSource\n const source = getSource()\n if (existingSource) {\n existingSource.setData(assertEx(source.data as GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry>))\n } else {\n this._config.map.addSource(layer.source as string, source)\n }\n layer.update(this._config.map, true)\n\n return this\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { delay } from '@xylabs/delay'\nimport { forget } from '@xylabs/forget'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Polygon } from 'geojson'\nimport type {\n DataDrivenPropertyValueSpecification,\n GeoJSONSource, GeoJSONSourceSpecification, Map, MapOptions,\n} from 'mapbox-gl'\nimport { LngLatBounds } from 'mapbox-gl'\n\nimport type { MapLayer } from '../Layers/index.ts'\nimport type { MapBaseConfig } from './MapBase.ts'\nimport { MapBase } from './MapBase.ts'\n\nexport class MapHeat extends MapBase<Polygon> {\n // eslint-disable-next-line sonarjs/public-static-readonly\n static animationStarted = false\n\n config: MapBaseConfig<Polygon>\n constructor(config: MapBaseConfig<Polygon>) {\n super(config)\n this.config = config\n }\n\n static initialMapPositioning(options: MapOptions['fitBoundsOptions'], map: Map, features?: Feature<Polygon>[], initialBounds?: LngLatBounds) {\n if (!features) {\n return\n }\n\n let bounds: LngLatBounds\n\n if (initialBounds) {\n bounds = initialBounds\n } else {\n bounds = new LngLatBounds()\n\n // eslint-disable-next-line unicorn/no-array-for-each\n features.forEach((feature: Feature<Polygon>) => {\n for (const coordinates of feature.geometry.coordinates) {\n for (const position of coordinates) {\n bounds.extend(position as [number, number])\n }\n }\n })\n }\n\n map.setCenter(bounds.getCenter())\n map.fitBounds(bounds, options)\n return this\n }\n\n static async initializeAnimatedHeatMapSource(\n layers: MapLayer[],\n featureSet: Feature<Polygon>[][],\n map: Map,\n startColor?: string,\n endColor?: string,\n ) {\n this.animationStarted = true\n let layerTick = 0\n let sourceTick = 0\n\n const sources = featureSet.map((feature) => {\n const featuresCollection = GeoJson.featureCollection(feature)\n return GeoJson.featuresSource(featuresCollection)\n })\n this.updateLayer(map, layers[0], sources[0])\n this.updateLayer(map, layers[1], sources[1])\n\n for (const layer of layers) {\n map.setPaintProperty(layer.id, 'fill-opacity', 0)\n }\n\n const frameLength = 3000\n const initialPad = 0.5\n const factor = 10\n const steps = 30\n const stepLength = frameLength / steps\n const lowUsageColor = startColor ?? '#FFB3B3'\n const highUsageColor = endColor ?? '#FF0000'\n\n // Max density at i=0, min density at i=steps\n const dynamicFillColor = (factor: number, initialPad: number, i: number): DataDrivenPropertyValueSpecification<string> => {\n const sinFade = Math.sin(((i / steps) * Math.PI) / 2)\n const cosFade = Math.cos(((i / steps) * Math.PI) / 2)\n // we want the divisor to always be at least 1x the desired factor but will go up to\n // 2x factor to account for combinative effect of the overlay of two layers at once\n const divisor = factor + factor * sinFade\n const offset = initialPad * cosFade\n return [\n 'let',\n 'density',\n ['+', ['/', ['number', ['get', 'value']], divisor], offset],\n ['interpolate', ['linear'], ['var', 'density'], 0, lowUsageColor, 0.5, highUsageColor],\n ]\n }\n\n const fadedIn: boolean[] = layers.map(_ => false)\n\n const fadeIn = async (id: string, index: number) => {\n for (let i = steps; i >= 1; i--) {\n map.setPaintProperty(id, 'fill-color', dynamicFillColor(factor, initialPad, i * (180 / stepLength)))\n await delay(stepLength)\n }\n fadedIn[index] = true\n }\n\n const fadeOut = async (id: string, index: number) => {\n for (let i = 1; i <= steps; i++) {\n map.setPaintProperty(id, 'fill-color', dynamicFillColor(factor, initialPad, i * (180 / stepLength)))\n await delay(stepLength)\n }\n fadedIn[index] = false\n }\n\n let started = false\n const startAnimation = async () => {\n assertEx(!started, () => 'Animation Already Started')\n started = true\n while (this.animationStarted) {\n const upLayer = layerTick % layers.length\n const downLayer = (layerTick + 1) % layers.length\n\n const incomingSource = sourceTick % featureSet.length\n const outgoingSource = (sourceTick + 1) % featureSet.length\n\n // console.log('incoming / outgoing source', incomingSource, outgoingSource)\n\n // console.log(`animate: [${upLayer}, ${downLayer}]`)\n if (fadedIn[upLayer]) {\n this.updateLayer(map, layers[upLayer], sources[incomingSource])\n forget(fadeOut(layers[upLayer].id, upLayer))\n }\n if (!fadedIn[downLayer]) {\n this.updateLayer(map, layers[downLayer], sources[outgoingSource])\n forget(fadeIn(layers[downLayer].id, downLayer))\n }\n while ((fadedIn[upLayer] || !fadedIn[downLayer]) && this.animationStarted) {\n // console.log(`checking: [${fadedIn[upLayer]}, ${!fadedIn[downLayer]}]`)\n await delay(1000)\n }\n layerTick++\n sourceTick++\n\n // console.log(`this.layerTick: ${layerTick}`)\n // console.log(`this.sourceTick: ${sourceTick}`)\n }\n }\n\n await startAnimation()\n }\n\n private static updateLayer(map: Map, layer: MapLayer, source: GeoJSONSourceSpecification) {\n const existingSource = map.getSource(layer.source as string) as GeoJSONSource\n if (existingSource && source.data) {\n existingSource.setData(source.data as GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry>)\n } else if (source) {\n map.addSource(layer.source as string, source)\n }\n layer.update(map, true)\n }\n\n // Build layers each with the same features\n initializeHeatMapSource(layers: MapLayer[]) {\n const getSource = (_: number) => {\n const featuresCollection = GeoJson.featureCollection(this.config.features)\n return GeoJson.featuresSource(featuresCollection)\n }\n\n for (const [index, layer] of layers.entries()) {\n const existingSource = this.config.map.getSource(layer.source as string) as GeoJSONSource\n const source = getSource(index)\n if (existingSource) {\n existingSource.setData(assertEx(source.data) as GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry>)\n } else {\n this.config.map.addSource(layer.source as string, source)\n }\n layer.update(this.config.map, true)\n }\n\n return this\n }\n}\n","import type { Feature, Point } from 'geojson'\nimport type { MapOptions } from 'mapbox-gl'\nimport { LngLatBounds } from 'mapbox-gl'\n\nimport type { MapBaseConfig } from './MapBase.ts'\nimport { MapBase } from './MapBase.ts'\n\nexport interface MapPointsConfig extends MapBaseConfig<Point> {\n features: Feature<Point>[]\n}\n\nexport class MapPoints extends MapBase<Point> {\n private config: MapPointsConfig\n\n constructor(config: MapPointsConfig) {\n super(config)\n this.config = config\n }\n\n initialMapPositioning(options: MapOptions['fitBoundsOptions'], initialBounds?: LngLatBounds) {\n let bounds: LngLatBounds\n\n if (initialBounds) {\n bounds = initialBounds\n } else {\n bounds = new LngLatBounds()\n\n // eslint-disable-next-line unicorn/no-array-for-each\n this.config.features.forEach((feature: Feature<Point>) => {\n bounds.extend(feature.geometry.coordinates as [number, number])\n })\n }\n\n this.config.map.setCenter(bounds.getCenter())\n this.config.map.fitBounds(bounds, options)\n\n return this.config.map\n }\n}\n","import type { MapSetting } from '@xyo-network/react-map-model'\nimport type {\n Map, MapEventOf, MapEventType,\n} from 'mapbox-gl'\nimport { GeolocateControl, NavigationControl } from 'mapbox-gl'\n\nexport interface MapSettingsConfig {\n debugLayerName?: string\n map: Map\n requestLocation?: boolean\n settings: MapSetting\n zoom?: number\n}\n\n/**\n * Utility class to handle changes in settings\n *\n * Methods are pure functions dedicated to map manipulation\n */\nexport class MapSettings {\n // eslint-disable-next-line sonarjs/public-static-readonly\n static geoLocateControl: GeolocateControl | undefined\n // eslint-disable-next-line sonarjs/public-static-readonly\n static mapListeners = {\n logData: (ev?: MapEventOf<MapEventType>, map?: Map) => {\n const target = map || ev?.target\n if (target) {\n console.log('zoom', target.getZoom())\n console.log('center', target.getCenter())\n }\n },\n }\n\n // eslint-disable-next-line sonarjs/public-static-readonly\n static navControl: NavigationControl | undefined\n // eslint-disable-next-line sonarjs/public-static-readonly\n static requestLocation: boolean | undefined\n\n static toggleControls(value: boolean | undefined, map: Map, zoom?: number, requestLocation?: boolean) {\n if (value) {\n MapSettings.addControls(map, zoom, requestLocation)\n } else {\n MapSettings.removeControls(map)\n }\n\n return this\n }\n\n static toggleDebugLayer(value: boolean | undefined, map: Map, layerName: string) {\n const debugLayer = map.getLayer(layerName)\n if (debugLayer) {\n if (value) {\n map.setLayoutProperty(layerName, 'visibility', 'visible')\n } else {\n map.setLayoutProperty(layerName, 'visibility', 'none')\n }\n }\n\n return this\n }\n\n static toggleDebugLogging(value: boolean | undefined, map: Map) {\n const debugEvents: MapEventType[] = ['resize', 'zoomend', 'dragend']\n if (value) {\n // initial values\n this.mapListeners.logData(undefined, map)\n for (const event of debugEvents) map.on(event, this.mapListeners.logData)\n } else {\n for (const event of debugEvents) map.off(event, this.mapListeners.logData)\n }\n }\n\n static toggleScrollToZoom(value: boolean | undefined, map: Map) {\n if (value) {\n map.scrollZoom.enable()\n } else {\n map.scrollZoom.disable()\n }\n\n return this\n }\n\n static updateSettings(config: MapSettingsConfig) {\n const {\n settings, map, zoom, requestLocation, debugLayerName = '',\n } = config\n const {\n scrollToZoom, enableControls, debugLayer, debugLogging,\n } = settings\n\n MapSettings.toggleControls(enableControls?.value, map, zoom, requestLocation)\n .toggleScrollToZoom(scrollToZoom?.value, map)\n .toggleDebugLayer(debugLayer?.value, map, debugLayerName)\n .toggleDebugLogging(debugLogging.value, map)\n }\n\n // Needs to be static so we ensure controls are only instantiated once\n private static addControls(map: Map, zoom?: number, requestLocation?: boolean) {\n const geolocateControl = new GeolocateControl({\n fitBoundsOptions: { zoom: zoom || 2 },\n positionOptions: { enableHighAccuracy: true },\n trackUserLocation: true,\n })\n\n const navControl = new NavigationControl({ showCompass: false })\n\n this.geoLocateControl = this.geoLocateControl || geolocateControl\n this.navControl = this.navControl || navControl\n\n if (!map.hasControl(this.geoLocateControl) && requestLocation) {\n map.addControl(this.geoLocateControl)\n }\n\n if (!map.hasControl(this.navControl)) {\n map.addControl(this.navControl, 'top-left')\n }\n\n return this\n }\n\n private static removeControls(map: Map) {\n if (this.geoLocateControl && map.hasControl(this.geoLocateControl) && this.requestLocation) {\n map.removeControl(this.geoLocateControl)\n }\n\n if (this.navControl && map.hasControl(this.navControl)) {\n map.removeControl(this.navControl)\n }\n\n return this\n }\n}\n","import type { Map } from 'mapbox-gl'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nexport const MapBoxInstanceProvider: React.FC<PropsWithChildren> = ({ children }) => {\n const [map, setMapBoxInstance] = useState<Map>()\n const [mapInitialized, setMapInitialized] = useState(false)\n\n const value = useMemo(() => ({\n map, mapInitialized, setMapBoxInstance,\n }), [map, mapInitialized, setMapBoxInstance])\n\n useEffect(() => {\n if (!mapInitialized && map) {\n map?.on('load', () => {\n setMapInitialized(true)\n })\n }\n }, [map, mapInitialized, setMapInitialized])\n\n return <MapBoxInstanceContext value={value}>{children}</MapBoxInstanceContext>\n}\n","import { createContext } from 'react'\n\nimport type { MapBoxInstanceState } from './State.ts'\n\nconst MapBoxInstanceContext = createContext<MapBoxInstanceState>({})\n\nexport { MapBoxInstanceContext }\n","import { assertEx } from '@xylabs/assert'\nimport { use } from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nconst useMapBoxInstance = () => {\n const context = use(MapBoxInstanceContext)\n assertEx('map' in context, () => 'useMapBoxInstance must be used within a MapBoxInstanceContext')\n\n return context\n}\n\nexport { useMapBoxInstance }\n","import type { MapSetting } from '@xyo-network/react-map-model'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapSettings } from '../../MapBoxClasses/index.ts'\nimport { useMapBoxInstance } from '../MapBoxInstance/index.ts'\nimport { MapSettingsContext } from './Context.ts'\nimport type { MapSettingsState } from './State.ts'\n\nexport interface MapSettingsProviderProps {\n debugLayerName?: string\n defaultMapSettings?: MapSetting\n requestLocation?: boolean\n zoom?: number\n}\n\nexport const MapSettingsProvider: React.FC<PropsWithChildren<MapSettingsProviderProps>> = ({\n children,\n debugLayerName,\n defaultMapSettings,\n requestLocation,\n zoom = 1,\n}) => {\n const [mapSettings, setMapSettings] = useState<MapSetting>(defaultMapSettings || {})\n const { map, mapInitialized } = useMapBoxInstance()\n\n const value: MapSettingsState = useMemo(() => ({\n mapSettings,\n setMapSettings,\n }), [mapSettings, setMapSettings])\n\n useEffect(() => {\n if (mapSettings && map && mapInitialized) {\n MapSettings.updateSettings({\n debugLayerName, map, requestLocation, settings: mapSettings, zoom,\n })\n }\n }, [debugLayerName, map, mapInitialized, mapSettings, requestLocation, zoom])\n\n return <MapSettingsContext value={value}>{children}</MapSettingsContext>\n}\n","import { createContext } from 'react'\n\nimport type { MapSettingsState } from './State.ts'\n\nconst MapSettingsContext = createContext<MapSettingsState>({})\n\nexport { MapSettingsContext }\n","import { use } from 'react'\n\nimport { MapSettingsContext } from './Context.ts'\n\nconst useMapSettings = () => {\n const context = use(MapSettingsContext)\n\n return context\n}\n\nexport { useMapSettings }\n","import { createContext } from 'react'\n\nimport type { HeatMapInitializerState } from './State.ts'\n\nconst HeatMapInitializerContext = createContext<HeatMapInitializerState>({})\n\nexport { HeatMapInitializerContext }\n","import { assertEx } from '@xylabs/assert'\nimport { use } from 'react'\n\nimport { HeatMapInitializerContext } from './Context.ts'\n\nconst useHeatMapInitializer = () => {\n const context = use(HeatMapInitializerContext)\n assertEx('heatMapInitialized' in context, () => 'useHeatMapInitializer must be used within a HeatMapInitializerContext')\n\n return context\n}\n\nexport { useHeatMapInitializer }\n","import type { FillLayerSpecification } from 'mapbox-gl'\n\nexport const HeatMapFillLayerConfig: (color: string) => Partial<FillLayerSpecification> = color => ({\n paint: {\n 'fill-color': color,\n 'fill-opacity': [\n 'let',\n 'density',\n ['+', ['/', ['number', ['get', 'value']], 4], 0.125],\n ['interpolate', ['linear'], ['var', 'density'], 0.8, ['var', 'density'], 1, 0.85],\n ],\n },\n})\n","import type { LineLayerSpecification } from 'mapbox-gl'\n\nexport const HeatMapLineLayerConfig: (color: string) => Partial<LineLayerSpecification> = color => ({\n layout: {\n // Enable for debugging\n visibility: 'none',\n },\n paint: {\n 'line-color': color,\n 'line-opacity': ['let', 'density', 0, ['interpolate', ['linear'], ['var', 'density'], 0.8, ['var', 'density'], 1, 0.85]],\n 'line-width': 0.5,\n },\n})\n","import type { SymbolLayerSpecification } from 'mapbox-gl'\n\nexport const HeatMapSymbolLayerConfig: (color: string) => Partial<SymbolLayerSpecification> = color => ({\n layout: {\n 'text-anchor': 'center',\n 'text-field': [\n 'concat',\n 'value: ',\n ['to-string', ['+', ['/', ['number', ['get', 'value']], 2], 0.25]],\n '\\n',\n 'count: ',\n ['to-string', ['get', 'count']],\n ],\n 'text-size': 10,\n 'visibility': 'none',\n },\n paint: { 'text-color': color },\n})\n","import type { CircleLayerSpecification } from 'mapbox-gl'\n\nexport const LocationPointLayerConfig: (color: string, circleRadius: number, circleOpacity: number) => Partial<CircleLayerSpecification> = (\n color,\n circleRadius,\n circleOpacity,\n) => {\n return {\n paint: {\n 'circle-color': color,\n 'circle-opacity': circleOpacity,\n 'circle-radius': circleRadius,\n },\n }\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { FillLayerSpecification } from 'mapbox-gl'\n\nexport class FillLayerBuilder extends LayerBase<FillLayerSpecification> {\n FillLayerOptions: Partial<FillLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'fill' = 'fill' as const\n\n constructor(id: string, source: string, FillLayerOptions?: Partial<FillLayerSpecification>) {\n super(id, source)\n this.FillLayerOptions = FillLayerOptions || { id: this.id, source: this.source }\n }\n\n buildLayer(): FillLayerSpecification {\n return {\n ...this.FillLayerOptions,\n id: this.id,\n source: this.source,\n type: this.type,\n }\n }\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { LineLayerSpecification } from 'mapbox-gl'\n\nexport class LineLayerBuilder extends LayerBase<LineLayerSpecification> {\n LineLayerOptions: Partial<LineLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'line' = 'line' as const\n\n constructor(id: string, source: string, LineLayerOptions?: Partial<LineLayerSpecification>) {\n super(id, source)\n this.LineLayerOptions = LineLayerOptions || { id: this.id, source: this.source }\n }\n\n buildLayer(): LineLayerSpecification {\n return {\n ...this.LineLayerOptions,\n id: this.id,\n layout: {},\n source: this.source,\n type: this.type,\n }\n }\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { SymbolLayerSpecification } from 'mapbox-gl'\n\nexport class SymbolLayerBuilder extends LayerBase<SymbolLayerSpecification> {\n SymbolLayerOptions: Partial<SymbolLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'symbol' = 'symbol' as const\n\n constructor(id: string, source: string, SymbolLayerOptions?: Partial<SymbolLayerSpecification>) {\n super(id, source)\n this.SymbolLayerOptions = SymbolLayerOptions || { id: this.id, source: this.source }\n }\n\n buildLayer(): SymbolLayerSpecification {\n return {\n ...this.SymbolLayerOptions,\n id: this.id,\n source: this.source,\n type: this.type,\n }\n }\n}\n","import {\n HeatMapFillLayerConfig, HeatMapLineLayerConfig, HeatMapSymbolLayerConfig,\n} from '../Configs/index.ts'\nimport { FillLayerBuilder } from '../FillLayer.ts'\nimport { LineLayerBuilder } from '../LineLayer.ts'\nimport { SymbolLayerBuilder } from '../SymbolLayer.ts'\n\nexport const MapHeatConstants = {\n LocationDebugLayerId: 'location-debug-id',\n LocationDebugLayerSource: 'location-debug-source',\n LocationFillLayerId: 'location-fill-id',\n LocationFillLayerSource: 'location-fill-source',\n LocationLineLayerId: 'location-line-id',\n LocationLineLayerSource: 'location-line-source',\n}\n\nexport const LocationHeatMapLayerBuilder = (color: string, alternateColor = '#000') => {\n const {\n LocationFillLayerId,\n LocationFillLayerSource,\n LocationLineLayerId,\n LocationLineLayerSource,\n LocationDebugLayerId,\n LocationDebugLayerSource,\n } = MapHeatConstants\n\n const fillLayerConfig = HeatMapFillLayerConfig(color)\n const lineLayerConfig = HeatMapLineLayerConfig(color)\n const debugLayerConfig = HeatMapSymbolLayerConfig(alternateColor)\n\n const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig)\n const lineLayer = new LineLayerBuilder(LocationLineLayerId, LocationLineLayerSource, lineLayerConfig)\n const debugLayer = new SymbolLayerBuilder(LocationDebugLayerId, LocationDebugLayerSource, debugLayerConfig)\n\n return [fillLayer, lineLayer, debugLayer]\n}\n","import { HeatMapFillLayerConfig } from '../Configs/index.ts'\nimport { FillLayerBuilder } from '../FillLayer.ts'\n\nconst MapHeatConstants = (index: number, type: string) => ({\n LocationDebugLayerId: `location-${type}-debug-id-${index}`,\n LocationDebugLayerSource: `location-${type}-debug-source-${index}`,\n LocationFillLayerId: `location-${type}-fill-id-${index}`,\n LocationFillLayerSource: `location-${type}-fill-source-${index}`,\n LocationLineLayerId: `location-${type}-line-id-${index}`,\n LocationLineLayerSource: `location-${type}-line-source-${index}`,\n})\n\nexport const LocationHeatMapLayerBuilderAnimated = (color: string, index: number, type = '') => {\n const { LocationFillLayerId, LocationFillLayerSource } = MapHeatConstants(index, type)\n\n const fillLayerConfig = HeatMapFillLayerConfig(color)\n\n const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig)\n\n return fillLayer\n}\n","import { LayerBase } from '@xyo-network/sdk-geo'\nimport type { CircleLayerSpecification } from 'mapbox-gl'\n\nexport class CircleLayerBuilder extends LayerBase<CircleLayerSpecification> {\n CircleLayerOptions: Partial<CircleLayerSpecification>\n\n // ensures this class passes for `AnyLayer` type in MapBox\n type: 'circle' = 'circle' as const\n\n constructor(id: string, source: string, CircleLayerOptions?: Partial<CircleLayerSpecification>) {\n super(id, source)\n this.CircleLayerOptions = CircleLayerOptions || {\n id: this.id, source: this.source, type: 'circle',\n }\n }\n\n buildLayer(): CircleLayerSpecification {\n return {\n filter: ['==', '$type', 'Point'],\n layout: {},\n paint: {\n 'circle-color': '#ff0000',\n 'circle-radius': 6,\n },\n type: this.type,\n ...this.CircleLayerOptions,\n id: this.id,\n source: this.source,\n }\n }\n}\n","import { CircleLayerBuilder } from '../CircleLayer.ts'\nimport { LocationPointLayerConfig } from '../Configs/index.ts'\n\nexport const MapPointsConstants = {\n LocationDotsLayerId: 'location-dots',\n LocationDotsLayerSource: 'location-dots-source',\n}\n\nexport const LocationPointsMapLayerBuilder = (color: string, circleRadius = 6, circleOpacity = 0.8) => {\n const { LocationDotsLayerId, LocationDotsLayerSource } = MapPointsConstants\n\n const dotLayerConfig = LocationPointLayerConfig(color, circleRadius, circleOpacity)\n\n const dotLayer = new CircleLayerBuilder(LocationDotsLayerId, LocationDotsLayerSource, dotLayerConfig)\n\n return [dotLayer]\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport type { MapboxFlexBoxProps } from '../lib/index.ts'\nimport { MapBox } from './MapBox.tsx'\nimport { MapSettingsBox } from './MapSettingsComponents/index.ts'\n\nexport const MapboxHeatFlexBox: React.FC<MapboxFlexBoxProps> = ({\n accessToken, children, mapBoxOptions, zoom, legend, developerMode, ...props\n}) => {\n return (\n <FlexCol {...props}>\n <MapBox accessToken={accessToken} options={mapBoxOptions} zoom={zoom} />\n <MapSettingsBox developerMode={developerMode} />\n {legend}\n {children}\n </FlexCol>\n )\n}\n","// eslint-disable-next-line import-x/no-internal-modules\nimport 'mapbox-gl/dist/mapbox-gl.css'\n\nimport { MapStyle } from '@xyo-network/react-map-model'\nimport type { MapOptions } from 'mapbox-gl'\nimport { Map } from 'mapbox-gl'\nimport React, {\n useEffect, useRef, useState,\n} from 'react'\n\nimport { useMapBoxInstance, useMapSettings } from '../Contexts/index.ts'\nimport { useDynamicMapResize } from '../hooks/index.ts'\n\nexport interface MapBoxProps {\n accessToken: string\n darkMode?: boolean\n options?: Partial<MapOptions>\n zoom?: number\n}\n\nexport const MapBox: React.FC<MapBoxProps> = ({\n accessToken, darkMode = false, options, zoom = 2, ...props\n}) => {\n const [map, setMap] = useState<Map>()\n const mapContainerRef = useRef<HTMLDivElement>(null)\n const mapCanvasRef = useRef<HTMLCanvasElement>(null)\n const { setMapBoxInstance, map: mapInstance } = useMapBoxInstance()\n const { mapSettings } = useMapSettings()\n\n const activeResize = mapSettings?.dynamicMapResize.value\n useDynamicMapResize(mapContainerRef, mapCanvasRef, mapInstance, activeResize)\n\n useEffect(() => {\n if (mapSettings?.preferDark?.value === true) {\n map?.setStyle(`mapbox://styles/${MapStyle.Dark}`)\n } else {\n map?.setStyle(`mapbox://styles/${darkMode ? MapStyle.Dark : MapStyle.Light}`)\n }\n }, [map, darkMode, mapSettings])\n\n useEffect(() => {\n const map = new Map({\n accessToken,\n center: [0, 0],\n container: mapContainerRef.current ?? '',\n style: `mapbox://styles/${MapStyle.Light}`,\n zoom,\n ...options,\n })\n\n // Allow external components to control the map\n setMapBoxInstance?.(map)\n // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setMap(map)\n\n // save the map canvas ref to help with resizing\n mapCanvasRef.current = document.querySelector('.mapboxgl-canvas') as HTMLCanvasElement | null\n\n console.log('Created Map')\n\n return () => {\n console.log('Removing Map')\n map.remove()\n }\n }, [mapContainerRef, setMap, options, zoom, setMapBoxInstance, accessToken])\n\n return (\n <div\n ref={(el) => { mapContainerRef.current = el }}\n style={{\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n ...props,\n }}\n />\n )\n}\n","import type { SwitchProps } from '@mui/material'\nimport { FormControlLabel, Switch } from '@mui/material'\nimport React from 'react'\n\nimport { useMapSettings } from '../../Contexts/index.ts'\n\nexport interface MapSettingSwitchProps extends SwitchProps {\n developerMode?: boolean\n field: string\n}\n\nexport const MapSettingSwitch: React.FC<MapSettingSwitchProps> = ({\n developerMode, field, ...props\n}) => {\n const { mapSettings, setMapSettings } = useMapSettings()\n const setting = mapSettings?.[field]\n\n const onLocalChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (setting) {\n setMapSettings?.((previous) => {\n previous[setting.field].value = event.target.checked\n return { ...previous }\n })\n }\n }\n\n if (setting?.devMode && developerMode === false) {\n return null\n }\n\n return setting?.hidden\n ? null\n : (\n <FormControlLabel label={setting?.label} control={<Switch checked={setting?.value} onChange={onLocalChange} {...props} />} />\n )\n}\n","import { Paper, Stack } from '@mui/material'\nimport { useAppSettings } from '@xylabs/react-app-settings'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { useMapSettings } from '../../Contexts/index.ts'\nimport { MapSettingSwitch } from './Setting.tsx'\n\nexport interface MapSettingsBoxProps extends FlexBoxProps {\n developerMode?: boolean\n}\n\nexport const MapSettingsBox: React.FC<MapSettingsBoxProps> = ({ developerMode, ...props }) => {\n const { mapSettings } = useMapSettings()\n const { developerMode: devModeFromContext } = useAppSettings()\n const resolveDeveloperMode = developerMode ?? devModeFromContext\n\n return mapSettings && resolveDeveloperMode\n ? (\n <FlexGrowRow bottom={36} left={10} position=\"absolute\" {...props}>\n <FlexRow paddingX={2}>\n <Paper>\n <Stack direction=\"row\" spacing={1} marginX={1}>\n {Object.keys(mapSettings).map((key, index) => {\n return <MapSettingSwitch key={index} field={mapSettings[key].field} developerMode={developerMode} />\n })}\n </Stack>\n </Paper>\n </FlexRow>\n </FlexGrowRow>\n )\n : null\n}\n","import { Alert, AlertTitle } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { useWeakArchivistFromNode, useWeakArchivistGet } from '@xyo-network/react-archivist'\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '@xyo-network/react-map-model'\nimport {\n AnimatedHeatMapSettings,\n useFindHashes, useHeatMapColors,\n} from '@xyo-network/react-map-model'\nimport type { Feature, Polygon } from 'geojson'\nimport React from 'react'\n\nimport { useQuadKeyPayloadsToFeatures } from '../hooks/index.ts'\nimport { AnimatedHeatMap } from './AnimatedHeatMap.tsx'\nimport { AnimatedHeatMapLegend } from './Legend.tsx'\n\nexport interface AnimatedHeatMapLoadedProps extends FlexBoxProps {\n accessToken: string\n archivistNameOrAddress: string\n}\n\nexport const AnimatedHeatMapLoaded: React.FC<AnimatedHeatMapLoadedProps> = ({\n accessToken, archivistNameOrAddress, ...props\n}) => {\n const hashes = useFindHashes()\n const [archivist] = useWeakArchivistFromNode(archivistNameOrAddress)\n const [payloads, xyoError] = useWeakArchivistGet<NetworkLocationHeatmapQuadkeyAnswerPayload>(archivist, hashes)\n const { multipleFeatureSets } = useQuadKeyPayloadsToFeatures(payloads)\n const { heatMapColorProps, legendProps } = useHeatMapColors()\n\n const MapBoxHeatProps = {\n flexGrow: 1,\n legend: legendProps ? <AnimatedHeatMapLegend {...legendProps} /> : null,\n }\n\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {xyoError\n ? (\n <Alert sx={{ mt: 2 }}>\n <AlertTitle>Error Loading Map</AlertTitle>\n {xyoError.message ? `Error: ${xyoError.message}` : null}\n You might try authenticating again.\n </Alert>\n )\n : null}\n {hashes === undefined\n ? <Alert>Missing answer hash for heat map query</Alert>\n : (\n <AnimatedHeatMap\n accessToken={accessToken}\n defaultMapSettings={AnimatedHeatMapSettings}\n animatedFeatureSets={multipleFeatureSets.slice(1) as Feature<Polygon>[][]}\n staticFeatureSet={multipleFeatureSets[0] as Feature<Polygon>[]}\n heatMapColorProps={heatMapColorProps}\n {...MapBoxHeatProps}\n />\n )}\n </FlexCol>\n )\n}\n","import { useMediaQuery, useTheme } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { ColorGradientLegendProps } from '@xyo-network/react-map-model'\nimport React from 'react'\n\nimport { ColorGradientLegend } from './Legends/index.ts'\n\nconst AnimatedHeatMapLegend: React.FC<ColorGradientLegendProps> = ({ ...legendProps }) => {\n const {\n startColor, endColor, startLabel, endLabel, heading, textColor,\n } = legendProps\n const theme = useTheme()\n const isSmall = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n <FlexCol position=\"absolute\" bottom={0} right={0}>\n <ColorGradientLegend\n startColor={startColor}\n endColor={endColor}\n startLabel={startLabel}\n endLabel={endLabel}\n heading={heading}\n textColor={textColor}\n {...{\n alignItems: 'stretch',\n marginBottom: theme.spacing(4),\n marginLeft: isSmall ? theme.spacing(3) : 0,\n marginRight: isSmall ? theme.spacing(2) : theme.spacing(3),\n width: isSmall ? '40vw' : theme.spacing(18),\n }}\n />\n </FlexCol>\n )\n}\n\nexport { AnimatedHeatMapLegend }\n","import { Typography, useTheme } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport type { ColorGradientLegendProps } from '@xyo-network/react-map-model'\nimport React from 'react'\n\nconst ColorGradientLegend: React.FC<ColorGradientLegendProps> = ({\n startColor, endColor, startLabel, endLabel, heading, textColor, ...props\n}) => {\n const theme = useTheme()\n\n return (\n <FlexCol {...props}>\n <Typography mb={theme.spacing(0.25)} color={textColor} variant=\"caption\" textAlign=\"center\">\n {heading}\n </Typography>\n <FlexCol flexGrow={1} alignItems=\"stretch\" paddingX={theme.spacing(1)} mb={theme.spacing(0.25)}>\n <FlexCol\n height={theme.spacing(0.75)}\n border={`1px solid ${textColor}`}\n sx={{ backgroundImage: `linear-gradient(to right, ${startColor},${endColor})` }}\n />\n </FlexCol>\n <FlexRow flexGrow={1} justifyContent=\"space-between\">\n <Typography color={textColor} variant=\"caption\">\n {startLabel}\n </Typography>\n <Typography color={textColor} variant=\"caption\">\n {endLabel}\n </Typography>\n </FlexRow>\n </FlexCol>\n )\n}\n\nexport { ColorGradientLegend }\n","import { DefaultMapSettings } from '@xyo-network/react-map-model'\n\nconst HeatMapSettings = DefaultMapSettings()\nconst {\n debugLayer, scrollToZoom, fitToPoints,\n} = HeatMapSettings\ndebugLayer.hidden = false\nscrollToZoom.value = true\nfitToPoints.value = true\n\nexport { HeatMapSettings }\n","import { useInterval } from '@xylabs/react-shared'\nimport type { Map } from 'mapbox-gl'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n useCallback, useEffect, useMemo, useRef,\n} from 'react'\n\nimport type { MapLayer } from '../Layers/index.ts'\nimport type { MapboxFlexBoxProps } from '../lib/index.ts'\n\nexport interface LayerAnimatorProps {\n animateLayers?: boolean\n layers: MapboxFlexBoxProps['layers']\n layersInitialized: boolean\n map: Map | undefined\n}\n\nconst timeIncrement = 2000\nconst animatedLayerCount = 3\n\nexport const LayerAnimator: React.FC<PropsWithChildren<LayerAnimatorProps>> = ({\n animateLayers, children, layers, layersInitialized, map,\n}) => {\n const layerIndexQueue = useRef<number[]>([])\n\n const fillLayers: MapLayer[] = useMemo(() => {\n if (layers?.length && map && layersInitialized) {\n return layers.filter((layer) => {\n const fillLayer = layer.id.startsWith('location-fill')\n if (fillLayer) {\n map.setPaintProperty(layer.id, 'fill-opacity-transition', { delay: 0, duration: 4000 })\n }\n return fillLayer\n })\n }\n return []\n }, [layers, layersInitialized, map])\n\n const incrementQueue = useCallback(\n (index: number) => {\n if (fillLayers[index]) {\n layerIndexQueue.current.push(index)\n } else {\n layerIndexQueue.current.push(0)\n }\n return layerIndexQueue.current.at(-1)\n },\n [fillLayers],\n )\n\n const lastQueuedIndex = useCallback(() => {\n const last = layerIndexQueue.current.at(-1)\n if (last === undefined) {\n incrementQueue(0)\n return 0\n } else {\n return last\n }\n }, [incrementQueue])\n\n const unshiftQueue = useCallback(() => {\n layerIndexQueue.current.shift()\n }, [])\n\n const getNextLayer = useCallback(() => {\n const nextLayer = fillLayers[lastQueuedIndex()]\n incrementQueue(lastQueuedIndex() + 1)\n return nextLayer\n }, [fillLayers, incrementQueue, lastQueuedIndex])\n\n const layerAnimateWorker = useCallback(\n (layer: MapLayer) => {\n if (layer) {\n map?.setPaintProperty(layer.id, 'fill-opacity', 0.85)\n setTimeout(() => {\n map?.setPaintProperty(layer.id, 'fill-opacity', 0)\n unshiftQueue()\n }, timeIncrement * 2)\n } else {\n console.warn('tried to queue an empty layer')\n }\n },\n [map, unshiftQueue],\n )\n\n //\n const queueLayerAnimation = useCallback(() => {\n const animatedLayers: MapLayer[] = []\n\n for (let i = 0; i < animatedLayerCount; i++) {\n animatedLayers.push(getNextLayer())\n }\n\n for (const [index, layer] of animatedLayers.entries()) {\n if (index === 0) {\n layerAnimateWorker(layer)\n } else {\n setTimeout(() => {\n layerAnimateWorker(layer)\n }, timeIncrement * index)\n }\n }\n }, [getNextLayer, layerAnimateWorker])\n\n // Run a single layer animation before the interval kicks in\n useEffect(() => {\n if (animateLayers && layersInitialized && map && fillLayers.length > 0) {\n queueLayerAnimation()\n }\n }, [animateLayers, fillLayers.length, layersInitialized, map, queueLayerAnimation])\n\n useInterval(() => {\n if (animateLayers && layersInitialized && map && fillLayers.length > 0) {\n queueLayerAnimation()\n }\n }, timeIncrement * animatedLayerCount)\n\n return <>{children}</>\n}\n","import { Alert } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { Feature, Point } from 'geojson'\nimport type { MapOptions } from 'mapbox-gl'\nimport React, {\n useCallback, useEffect, useMemo,\n} from 'react'\n\nimport { useMapBoxInstance, useMapSettings } from '../Contexts/index.ts'\nimport type { MapboxFlexBoxProps } from '../lib/index.ts'\nimport { MapPoints } from '../MapBoxClasses/index.ts'\nimport { MapBox } from './MapBox.tsx'\nimport { MapSettingsBox } from './MapSettingsComponents/index.ts'\n\nexport interface MapboxPointsFlexBoxProps extends MapboxFlexBoxProps {\n accessToken: string\n features?: Feature<Point>[]\n}\n\nexport const MapboxPointsFlexBox: React.FC<MapboxPointsFlexBoxProps> = ({\n accessToken,\n features,\n fitToPointsPadding = 20,\n layers,\n zoom,\n ...props\n}) => {\n const { mapSettings } = useMapSettings()\n const { map, mapInitialized } = useMapBoxInstance()\n\n /**\n * Needed because of a bug in mapbox taking undefined values for the config options of fitToBounds\n * see - https://github.com/mapbox/mapbox-gl-js/issues/10013\n */\n const customFitToBoundsOptions = (zoom?: number): MapOptions['fitBoundsOptions'] => {\n if (zoom !== undefined) {\n return { maxZoom: zoom }\n }\n return {}\n }\n\n const mapPoints = useMemo(() => {\n return (map && features?.length)\n ? new MapPoints({\n features, map, zoom,\n })\n : undefined\n }, [map, features, zoom])\n\n const updateFeatures = useCallback(() => {\n if (mapPoints?.isMapReady && features?.length && layers)\n for (const layer of layers) {\n mapPoints.initializeMapSource(layer)\n }\n }, [mapPoints, features, layers])\n\n const updateMapSetup = useCallback(() => {\n const { fitToPoints } = mapSettings || {}\n\n if (mapPoints && map && fitToPoints?.value === true) {\n mapPoints.initialMapPositioning({\n padding: {\n bottom: fitToPointsPadding, left: fitToPointsPadding, right: fitToPointsPadding, top: fitToPointsPadding,\n },\n ...customFitToBoundsOptions(zoom),\n })\n }\n }, [mapSettings, mapPoints, map, fitToPointsPadding, zoom])\n\n const reInitializeMap = useCallback(() => {\n mapPoints?.initialMapPositioning({\n padding: {\n bottom: fitToPointsPadding, left: fitToPointsPadding, right: fitToPointsPadding, top: fitToPointsPadding,\n },\n ...customFitToBoundsOptions(zoom),\n })\n updateFeatures()\n }, [mapPoints, fitToPointsPadding, updateFeatures, zoom])\n\n useEffect(() => {\n if (mapInitialized) {\n updateMapSetup()\n reInitializeMap()\n }\n }, [mapInitialized, reInitializeMap, updateMapSetup])\n\n return (\n <FlexCol alignItems=\"stretch\" id=\"xyo-mapbox-wrap\" {...props}>\n {features\n ? (\n <>\n <MapBox accessToken={accessToken} zoom={zoom} />\n <MapSettingsBox />\n </>\n )\n : <Alert severity=\"error\">No data to show</Alert>}\n </FlexCol>\n )\n}\n"],"mappings":";;;;AAAA,SAASA,gBAAgB;AACzB,SAASC,WAAAA,gBAAe;AACxB,SAASC,iBAAiB;AAI1B,OAAOC,UAASC,YAAAA,iBAAgB;;;ACNhC,SAASC,UAAAA,eAAc;AAIvB,OAAOC,UAASC,aAAAA,YAAWC,WAAAA,gBAAe;;;ACF1C,SAASC,WAAWC,eAAe;AAK5B,IAAMC,sBAAsB,wBACjCC,iBACAC,cACAC,aACAC,SAAS,SAAI;AAEb,QAAMC,UAAUC,QACd,MACE,IAAIC,eAAe,MAAA;AACjB,UAAMC,QAAQP,gBAAgBQ,SAASC,sBAAAA,EAAwBF;AAC/D,QAAIA,SAASN,aAAaO,SAAS;AACjCP,mBAAaO,QAAQE,MAAMH,QAAQ,GAAGA,KAAAA;AAGtCI,iBAAW,MAAMT,aAAaU,OAAAA,CAAAA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ACA,GAAGS,yBAAyBP,IAAAA;MAC9B,CAAA;IACF;EACF,GAAG;IAACE;IAAaQ;IAAWN;IAAKN;IAAoBE;GAAK;AAE1D,QAAM4B,kBAAkBb,aAAY,MAAA;AAClCL,eAAWY,sBAAsB;MAC/BC,SAAS;QACPC,QAAQ1B;QAAoB2B,MAAM3B;QAAoB4B,OAAO5B;QAAoB6B,KAAK7B;MACxF;MACA,GAAGS,yBAAyBP,IAAAA;IAC9B,CAAA;AACAc,mBAAAA;EACF,GAAG;IAACJ;IAAWZ;IAAoBgB;IAAgBd;GAAK;AAExD6B,EAAAA,WAAU,MAAA;AACR,QAAIxB,gBAAgB;AAClBc,qBAAAA;AACAS,sBAAAA;IACF;EACF,GAAG;IAACvB;IAAgBuB;IAAiBT;GAAe;AAEpD,SACE,gBAAAW,QAAA,cAACC,UAAAA;IAAQC,YAAW;IAAUC,IAAG;IAAmB,GAAGhC;KACpDJ,WAEK,gBAAAiC,QAAA,cAAAA,QAAA,UAAA,MACE,gBAAAA,QAAA,cAACI,QAAAA;IAAOtC;IAA0BI;MAClC,gBAAA8B,QAAA,cAACK,gBAAAA,IAAAA,CAAAA,IAGL,gBAAAL,QAAA,cAACM,QAAAA;IAAMC,UAAS;KAAQ,iBAAA,CAAA;AAGlC,GA/EuE;","names":["useTheme","FlexCol","darkenCss","React","useState","forget","React","useEffect","useMemo","useEffect","useMemo","useDynamicMapResize","mapContainerRef","mapCanvasRef","mapInstance","active","resizer","useMemo","ResizeObserver","width","current","getBoundingClientRect","style","setTimeout","resize","dependenciesReady","useEffect","observe","disconnect","useWindowSize","useMemo","defaultZoom","defaultAspectRatioRange","latRange","lngRange","linearInterpolate","aspectRatio","degreeRange","aspectRatioRange","degreeMin","degreeMax","aspectRatioMin","aspectRatioMax","aspectRatioRangeSpan","degreeRangeSpan","percent","scaledDegree","useDynamicPositioning","width","height","useWindowSize","options","useMemo","center","zoom","exists","GeoJson","useMemo","useState","quadKeyToFeature","density","quadkey","polygonFeature","GeoJson","properties","count","setDensity","feature","value","useQuadKeyPayloadsToFeatures","payloads","multipleFeatureSets","setMultipleFeatureSets","useState","features","setFeatures","error","setError","useMemo","Array","isArray","filter","exists","length","mappedFeatures","map","payload","result","Error","singlePayload","assertEx","GeoJson","MapBase","_config","config","requestLocation","zoom","isMapReady","map","initializeMapSource","layer","getSource","featuresCollection","GeoJson","featureCollection","features","featuresSource","existingSource","source","setData","assertEx","data","addSource","update","assertEx","delay","forget","GeoJson","LngLatBounds","MapHeat","MapBase","animationStarted","config","initialMapPositioning","options","map","features","initialBounds","bounds","LngLatBounds","forEach","feature","coordinates","geometry","position","extend","setCenter","getCenter","fitBounds","initializeAnimatedHeatMapSource","layers","featureSet","startColor","endColor","layerTick","sourceTick","sources","featuresCollection","GeoJson","featureCollection","featuresSource","updateLayer","layer","setPaintProperty","id","frameLength","initialPad","factor","steps","stepLength","lowUsageColor","highUsageColor","dynamicFillColor","i","sinFade","Math","sin","PI","cosFade","cos","divisor","offset","fadedIn","_","fadeIn","index","delay","fadeOut","started","startAnimation","assertEx","upLayer","length","downLayer","incomingSource","outgoingSource","forget","source","existingSource","getSource","data","setData","addSource","update","initializeHeatMapSource","entries","LngLatBounds","MapPoints","MapBase","config","initialMapPositioning","options","initialBounds","bounds","LngLatBounds","features","forEach","feature","extend","geometry","coordinates","map","setCenter","getCenter","fitBounds","GeolocateControl","NavigationControl","MapSettings","geoLocateControl","mapListeners","logData","ev","map","target","console","log","getZoom","getCenter","navControl","requestLocation","toggleControls","value","zoom","addControls","removeControls","toggleDebugLayer","layerName","debugLayer","getLayer","setLayoutProperty","toggleDebugLogging","debugEvents","undefined","event","on","off","toggleScrollToZoom","scrollZoom","enable","disable","updateSettings","config","settings","debugLayerName","scrollToZoom","enableControls","debugLogging","geolocateControl","GeolocateControl","fitBoundsOptions","positionOptions","enableHighAccuracy","trackUserLocation","NavigationControl","showCompass","hasControl","addControl","removeControl","React","useEffect","useMemo","useState","createContext","MapBoxInstanceContext","MapBoxInstanceProvider","children","map","setMapBoxInstance","useState","mapInitialized","setMapInitialized","value","useMemo","useEffect","on","MapBoxInstanceContext","assertEx","use","useMapBoxInstance","context","use","MapBoxInstanceContext","assertEx","React","useEffect","useMemo","useState","createContext","MapSettingsContext","MapSettingsProvider","children","debugLayerName","defaultMapSettings","requestLocation","zoom","mapSettings","setMapSettings","useState","map","mapInitialized","useMapBoxInstance","value","useMemo","useEffect","MapSettings","updateSettings","settings","React","MapSettingsContext","use","useMapSettings","context","use","MapSettingsContext","createContext","HeatMapInitializerContext","HeatMapInitializerProvider","children","featureSets","featureSetsLayers","features","fitToPadding","heatMapColorProps","layers","zoom","options","useDynamicPositioning","mapSettings","useMapSettings","map","mapInitialized","useMapBoxInstance","mapHeat","useMemo","length","MapHeat","undefined","value","useEffect","lowUsageColor","highUsageColor","forget","initializeAnimatedHeatMapSource","animationStarted","initializeHeatMapSource","fitToPoints","initialMapPositioning","padding","bottom","left","right","top","center","setZoom","setCenter","React","HeatMapInitializerContext","assertEx","use","useHeatMapInitializer","context","use","HeatMapInitializerContext","assertEx","HeatMapFillLayerConfig","color","paint","HeatMapLineLayerConfig","color","layout","visibility","paint","HeatMapSymbolLayerConfig","color","layout","paint","LocationPointLayerConfig","color","circleRadius","circleOpacity","paint","LayerBase","FillLayerBuilder","LayerBase","FillLayerOptions","type","id","source","buildLayer","LayerBase","LineLayerBuilder","LayerBase","LineLayerOptions","type","id","source","buildLayer","layout","LayerBase","SymbolLayerBuilder","LayerBase","SymbolLayerOptions","type","id","source","buildLayer","MapHeatConstants","LocationDebugLayerId","LocationDebugLayerSource","LocationFillLayerId","LocationFillLayerSource","LocationLineLayerId","LocationLineLayerSource","LocationHeatMapLayerBuilder","color","alternateColor","fillLayerConfig","HeatMapFillLayerConfig","lineLayerConfig","HeatMapLineLayerConfig","debugLayerConfig","HeatMapSymbolLayerConfig","fillLayer","FillLayerBuilder","lineLayer","LineLayerBuilder","debugLayer","SymbolLayerBuilder","MapHeatConstants","index","type","LocationDebugLayerId","LocationDebugLayerSource","LocationFillLayerId","LocationFillLayerSource","LocationLineLayerId","LocationLineLayerSource","LocationHeatMapLayerBuilderAnimated","color","fillLayerConfig","HeatMapFillLayerConfig","fillLayer","FillLayerBuilder","LayerBase","CircleLayerBuilder","LayerBase","CircleLayerOptions","type","id","source","buildLayer","filter","layout","paint","MapPointsConstants","LocationDotsLayerId","LocationDotsLayerSource","LocationPointsMapLayerBuilder","color","circleRadius","circleOpacity","dotLayerConfig","LocationPointLayerConfig","dotLayer","CircleLayerBuilder","FlexCol","React","MapStyle","Map","React","useEffect","useRef","useState","MapBox","accessToken","darkMode","options","zoom","props","map","setMap","useState","mapContainerRef","useRef","mapCanvasRef","setMapBoxInstance","mapInstance","useMapBoxInstance","mapSettings","useMapSettings","activeResize","dynamicMapResize","value","useDynamicMapResize","useEffect","preferDark","setStyle","MapStyle","Dark","Light","Map","center","container","current","style","document","querySelector","console","log","remove","React","div","ref","el","bottom","left","position","right","top","FormControlLabel","Switch","React","MapSettingSwitch","developerMode","field","props","mapSettings","setMapSettings","useMapSettings","setting","onLocalChange","event","previous","value","target","checked","devMode","hidden","React","FormControlLabel","label","control","Switch","onChange","Paper","Stack","useAppSettings","FlexGrowRow","FlexRow","React","MapSettingsBox","developerMode","props","mapSettings","useMapSettings","devModeFromContext","useAppSettings","resolveDeveloperMode","React","FlexGrowRow","bottom","left","position","FlexRow","paddingX","Paper","Stack","direction","spacing","marginX","Object","keys","map","key","index","MapSettingSwitch","field","MapboxHeatFlexBox","accessToken","children","mapBoxOptions","zoom","legend","developerMode","props","React","FlexCol","MapBox","options","MapSettingsBox","AnimatedHeatMap","accessToken","animatedFeatureSets","defaultMapSettings","heatMapColorProps","staticFeatureSet","props","theme","useTheme","staticMapColor","lowUsageColor","highUsageColor","localStaticMapColor","vars","palette","primary","light","layers","useState","LocationHeatMapLayerBuilderAnimated","darkenCss","length","React","MapBoxInstanceProvider","MapSettingsProvider","debugLayerName","MapHeatConstants","LocationDebugLayerId","HeatMapInitializerProvider","features","featureSets","featureSetsLayers","slice","MapboxHeatFlexBox","FlexCol","minHeight","minWidth","busy","Alert","AlertTitle","FlexCol","useWeakArchivistFromNode","useWeakArchivistGet","AnimatedHeatMapSettings","useFindHashes","useHeatMapColors","React","useMediaQuery","useTheme","FlexCol","React","Typography","useTheme","FlexCol","FlexRow","React","ColorGradientLegend","startColor","endColor","startLabel","endLabel","heading","textColor","props","theme","useTheme","React","FlexCol","Typography","mb","spacing","color","variant","textAlign","flexGrow","alignItems","paddingX","height","border","sx","backgroundImage","FlexRow","justifyContent","AnimatedHeatMapLegend","legendProps","startColor","endColor","startLabel","endLabel","heading","textColor","theme","useTheme","isSmall","useMediaQuery","breakpoints","down","React","FlexCol","position","bottom","right","ColorGradientLegend","alignItems","marginBottom","spacing","marginLeft","marginRight","width","AnimatedHeatMapLoaded","accessToken","archivistNameOrAddress","props","hashes","useFindHashes","archivist","useWeakArchivistFromNode","payloads","xyoError","useWeakArchivistGet","multipleFeatureSets","useQuadKeyPayloadsToFeatures","heatMapColorProps","legendProps","useHeatMapColors","MapBoxHeatProps","flexGrow","legend","React","AnimatedHeatMapLegend","FlexCol","alignItems","Alert","sx","mt","AlertTitle","message","undefined","AnimatedHeatMap","defaultMapSettings","AnimatedHeatMapSettings","animatedFeatureSets","slice","staticFeatureSet","DefaultMapSettings","HeatMapSettings","debugLayer","scrollToZoom","fitToPoints","hidden","value","useInterval","React","useCallback","useEffect","useMemo","useRef","timeIncrement","animatedLayerCount","LayerAnimator","animateLayers","children","layers","layersInitialized","map","layerIndexQueue","useRef","fillLayers","useMemo","length","filter","layer","fillLayer","id","startsWith","setPaintProperty","delay","duration","incrementQueue","useCallback","index","current","push","at","lastQueuedIndex","last","undefined","unshiftQueue","shift","getNextLayer","nextLayer","layerAnimateWorker","setTimeout","console","warn","queueLayerAnimation","animatedLayers","i","entries","useEffect","useInterval","React","Alert","FlexCol","React","useCallback","useEffect","useMemo","MapboxPointsFlexBox","accessToken","features","fitToPointsPadding","layers","zoom","props","mapSettings","useMapSettings","map","mapInitialized","useMapBoxInstance","customFitToBoundsOptions","undefined","maxZoom","mapPoints","useMemo","length","MapPoints","updateFeatures","useCallback","isMapReady","layer","initializeMapSource","updateMapSetup","fitToPoints","value","initialMapPositioning","padding","bottom","left","right","top","reInitializeMap","useEffect","React","FlexCol","alignItems","id","MapBox","MapSettingsBox","Alert","severity"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-map",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.10",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"module": "dist/browser/index.mjs",
|
|
40
40
|
"types": "dist/types/index.d.ts",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@xylabs/assert": "^4.11.
|
|
43
|
-
"@xylabs/delay": "^4.11.
|
|
44
|
-
"@xylabs/exists": "^4.11.
|
|
45
|
-
"@xylabs/forget": "^4.11.
|
|
42
|
+
"@xylabs/assert": "^4.11.21",
|
|
43
|
+
"@xylabs/delay": "^4.11.21",
|
|
44
|
+
"@xylabs/exists": "^4.11.21",
|
|
45
|
+
"@xylabs/forget": "^4.11.21",
|
|
46
46
|
"@xylabs/react-app-settings": "^6.3.4",
|
|
47
47
|
"@xylabs/react-flexbox": "^6.3.4",
|
|
48
48
|
"@xylabs/react-shared": "^6.3.4",
|
|
49
49
|
"@xylabs/react-theme": "^6.3.4",
|
|
50
|
-
"@xyo-network/react-archivist": "^5.3.
|
|
51
|
-
"@xyo-network/react-map-model": "^5.3.
|
|
50
|
+
"@xyo-network/react-archivist": "^5.3.10",
|
|
51
|
+
"@xyo-network/react-map-model": "^5.3.10",
|
|
52
52
|
"@xyo-network/sdk-geo": "^3.0.3",
|
|
53
53
|
"geojson": "^0.5.0",
|
|
54
54
|
"mapbox-gl": "^3.12.0"
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"@mui/icons-material": "^7.1.1",
|
|
58
58
|
"@mui/material": "^7.1.1",
|
|
59
59
|
"@types/geojson": "7946.0.16",
|
|
60
|
-
"@types/react": "^19.1.
|
|
60
|
+
"@types/react": "^19.1.8",
|
|
61
61
|
"@xylabs/ts-scripts-yarn3": "^6.5.8",
|
|
62
62
|
"@xylabs/tsconfig-react": "^6.5.8",
|
|
63
63
|
"react": "^19.1.0",
|
|
64
64
|
"react-dom": "^19.1.0",
|
|
65
|
-
"storybook": "^9.0.
|
|
65
|
+
"storybook": "^9.0.10",
|
|
66
66
|
"typescript": "^5.8.3",
|
|
67
67
|
"vite": "^6.3.5"
|
|
68
68
|
},
|