@xyo-network/react-map 4.1.8 → 4.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Components/AnimatedHeatMap.d.ts +2 -2
- package/dist/browser/Components/AnimatedHeatMap.d.ts.map +1 -1
- package/dist/browser/Components/LayerAnimator.d.ts +2 -2
- package/dist/browser/Components/LayerAnimator.d.ts.map +1 -1
- package/dist/browser/Components/MapSettingsComponents/SettingsBox.d.ts.map +1 -1
- package/dist/browser/Contexts/HeatMapInitializer/Provider.d.ts +2 -2
- package/dist/browser/Contexts/HeatMapInitializer/Provider.d.ts.map +1 -1
- package/dist/browser/Contexts/MapBoxInstance/Provider.d.ts +2 -2
- package/dist/browser/Contexts/MapBoxInstance/Provider.d.ts.map +1 -1
- package/dist/browser/Contexts/MapSettings/Provider.d.ts +2 -2
- package/dist/browser/Contexts/MapSettings/Provider.d.ts.map +1 -1
- package/dist/browser/Contexts/MapboxAccessToken/Provider.d.ts +2 -2
- package/dist/browser/Contexts/MapboxAccessToken/Provider.d.ts.map +1 -1
- package/dist/browser/index.mjs +1 -1
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +13 -13
- package/src/Components/AnimatedHeatMap.tsx +2 -2
- package/src/Components/LayerAnimator.tsx +2 -2
- package/src/Components/MapSettingsComponents/SettingsBox.tsx +1 -1
- package/src/Contexts/HeatMapInitializer/Provider.tsx +2 -2
- package/src/Contexts/MapBoxInstance/Provider.tsx +2 -2
- package/src/Contexts/MapSettings/Provider.tsx +2 -2
- package/src/Contexts/MapboxAccessToken/Provider.tsx +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WithChildren } from '@xylabs/react-shared';
|
|
2
1
|
import type { Feature, Polygon } from 'geojson';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { AnimatedHeatMapColorProps } from '../Colors/index.ts';
|
|
5
5
|
import type { MapSetting } from '../Settings/index.ts';
|
|
@@ -10,5 +10,5 @@ export interface AnimatedHeatMapProps {
|
|
|
10
10
|
heatMapColorProps: AnimatedHeatMapColorProps;
|
|
11
11
|
staticFeatureSet: Feature<Polygon>[];
|
|
12
12
|
}
|
|
13
|
-
export declare const AnimatedHeatMap: React.FC<
|
|
13
|
+
export declare const AnimatedHeatMap: React.FC<PropsWithChildren<AnimatedHeatMapProps>>;
|
|
14
14
|
//# sourceMappingURL=AnimatedHeatMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedHeatMap.d.ts","sourceRoot":"","sources":["../../../src/Components/AnimatedHeatMap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AnimatedHeatMap.d.ts","sourceRoot":"","sources":["../../../src/Components/AnimatedHeatMap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAMnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAA;IACzC,kBAAkB,CAAC,EAAE,UAAU,CAAA;IAC/B,iBAAiB,EAAE,yBAAyB,CAAA;IAC5C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAA;CACrC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAqC7E,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WithChildren } from '@xylabs/react-shared';
|
|
2
1
|
import type { Map } from 'mapbox-gl';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { MapboxFlexBoxProps } from '../lib/index.ts';
|
|
5
5
|
export interface LayerAnimatorProps {
|
|
@@ -8,5 +8,5 @@ export interface LayerAnimatorProps {
|
|
|
8
8
|
layersInitialized: boolean;
|
|
9
9
|
map: Map | undefined;
|
|
10
10
|
}
|
|
11
|
-
export declare const LayerAnimator: React.FC<
|
|
11
|
+
export declare const LayerAnimator: React.FC<PropsWithChildren<LayerAnimatorProps>>;
|
|
12
12
|
//# sourceMappingURL=LayerAnimator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerAnimator.d.ts","sourceRoot":"","sources":["../../../src/Components/LayerAnimator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayerAnimator.d.ts","sourceRoot":"","sources":["../../../src/Components/LayerAnimator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAEN,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAA;IACpC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,GAAG,EAAE,GAAG,GAAG,SAAS,CAAA;CACrB;AAKD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAkGzE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsBox.d.ts","sourceRoot":"","sources":["../../../../src/Components/MapSettingsComponents/SettingsBox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsBox.d.ts","sourceRoot":"","sources":["../../../../src/Components/MapSettingsComponents/SettingsBox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoBxD,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WithChildren } from '@xylabs/react-shared';
|
|
2
1
|
import type { Feature, Polygon } from 'geojson';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { AnimatedHeatMapColorProps, HeatMapColorProps } from '../../Colors/index.ts';
|
|
5
5
|
import type { MapLayer } from '../../Layers/index.ts';
|
|
@@ -12,5 +12,5 @@ export interface MapInitializerProviderProps {
|
|
|
12
12
|
layers?: MapLayer[];
|
|
13
13
|
zoom?: number;
|
|
14
14
|
}
|
|
15
|
-
export declare const HeatMapInitializerProvider: React.FC<
|
|
15
|
+
export declare const HeatMapInitializerProvider: React.FC<PropsWithChildren<MapInitializerProviderProps>>;
|
|
16
16
|
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/HeatMapInitializer/Provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/HeatMapInitializer/Provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAA6B,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAOrD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAA;IAClC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,iBAAiB,GAAG,yBAAyB,CAAA;IAChE,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAoE/F,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare const MapBoxInstanceProvider: React.FC<
|
|
3
|
+
export declare const MapBoxInstanceProvider: React.FC<PropsWithChildren>;
|
|
4
4
|
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/MapBoxInstance/Provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/MapBoxInstance/Provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAEN,MAAM,OAAO,CAAA;AAId,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiB9D,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { MapSetting } from '../../Settings/index.ts';
|
|
4
4
|
export interface MapSettingsProviderProps {
|
|
@@ -7,5 +7,5 @@ export interface MapSettingsProviderProps {
|
|
|
7
7
|
requestLocation?: boolean;
|
|
8
8
|
zoom?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const MapSettingsProvider: React.FC<
|
|
10
|
+
export declare const MapSettingsProvider: React.FC<PropsWithChildren<MapSettingsProviderProps>>;
|
|
11
11
|
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/MapSettings/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/MapSettings/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAEN,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAKzD,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,UAAU,CAAA;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAwBrF,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface MapboxAccessTokenProviderProps {
|
|
4
4
|
defaultAccessToken?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const MapboxAccessTokenProvider: React.FC<
|
|
6
|
+
export declare const MapboxAccessTokenProvider: React.FC<PropsWithChildren<MapboxAccessTokenProviderProps>>;
|
|
7
7
|
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/MapboxAccessToken/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/Contexts/MapboxAccessToken/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAA4B,MAAM,OAAO,CAAA;AAIhD,MAAM,WAAW,8BAA8B;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,8BAA8B,CAAC,CAajG,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1219,8 +1219,8 @@ var MapSettingSwitch = /* @__PURE__ */ __name(({ developerMode, field, ...props
|
|
|
1219
1219
|
|
|
1220
1220
|
// src/Components/MapSettingsComponents/SettingsBox.tsx
|
|
1221
1221
|
import { Paper, Stack } from "@mui/material";
|
|
1222
|
+
import { useAppSettings } from "@xylabs/react-app-settings";
|
|
1222
1223
|
import { FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
|
|
1223
|
-
import { useAppSettings } from "@xyo-network/react-app-settings";
|
|
1224
1224
|
import React7 from "react";
|
|
1225
1225
|
var MapSettingsBox = /* @__PURE__ */ __name(({ developerMode, ...props }) => {
|
|
1226
1226
|
const { mapSettings } = useMapSettings();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Settings/DefaultMapSettings.ts","../../src/AnimatedHeatMapSettings.ts","../../src/Components/AnimatedHeatMap.tsx","../../src/Contexts/HeatMapInitializer/Provider.tsx","../../src/hooks/useDynamicMapResize.tsx","../../src/hooks/useDynamicPositioning.tsx","../../src/hooks/useFindHashes.tsx","../../src/hooks/useHeatMapColors.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/Contexts/MapboxAccessToken/Context.ts","../../src/Contexts/MapboxAccessToken/Provider.tsx","../../src/Contexts/MapboxAccessToken/use.ts","../../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/lib/MapStyle.ts","../../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","../../src/types/NetworkLocationAnswerBase.ts"],"sourcesContent":["import type { MapSetting } from './MapSetting.ts'\n\nexport const DefaultMapSettings: () => MapSetting = () => ({\n debugLayer: {\n devMode: true,\n field: 'debugLayer',\n hidden: true,\n label: 'Debug Layer',\n value: false,\n },\n debugLogging: {\n devMode: true,\n field: 'debugLogging',\n hidden: true,\n label: 'Debug Logging',\n value: false,\n },\n dynamicMapResize: {\n devMode: true,\n field: 'dynamicMapResize',\n hidden: true,\n label: 'Auto Map Resize',\n value: true,\n },\n enableControls: {\n devMode: true,\n field: 'enableControls',\n hidden: true,\n label: 'Map Controls',\n value: false,\n },\n fitToPoints: {\n devMode: true,\n field: 'fitToPoints',\n hidden: true,\n label: 'Fit To Points',\n value: false,\n },\n preferDark: {\n devMode: false,\n field: 'preferDark',\n hidden: true,\n label: 'Prefer dark',\n value: false,\n },\n scrollToZoom: {\n devMode: true,\n field: 'scrollToZoom',\n hidden: true,\n label: 'Scroll To Zoom',\n value: false,\n },\n})\n","import { DefaultMapSettings } from './Settings/index.ts'\n\nexport const AnimatedHeatMapSettings = DefaultMapSettings()\nconst {\n debugLayer, scrollToZoom, fitToPoints, preferDark,\n} = AnimatedHeatMapSettings\ndebugLayer.hidden = false\nscrollToZoom.value = true\nfitToPoints.value = false\npreferDark.value = true\n","import { darken, useTheme } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { WithChildren } from '@xylabs/react-shared'\nimport type { Feature, Polygon } from 'geojson'\nimport React, { useState } from 'react'\n\nimport type { AnimatedHeatMapColorProps } from '../Colors/index.ts'\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 type { MapSetting } from '../Settings/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<WithChildren<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.palette.primary.light\n\n const [layers] = useState<MapLayer[]>(() => [\n LocationHeatMapLayerBuilderAnimated(localStaticMapColor, 0, 'static'),\n LocationHeatMapLayerBuilderAnimated(lowUsageColor || localStaticMapColor, 0, 'animated'),\n LocationHeatMapLayerBuilderAnimated(highUsageColor || darken(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 { WithChildren } from '@xylabs/react-shared'\nimport type { Feature, Polygon } from 'geojson'\nimport React, { useEffect, useMemo } from 'react'\n\nimport type { AnimatedHeatMapColorProps, HeatMapColorProps } from '../../Colors/index.ts'\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<WithChildren<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.Provider value={value}>{children}</HeatMapInitializerContext.Provider>\n}\n","import type { Map } from 'mapbox-gl'\nimport type { MutableRefObject } from 'react'\nimport { useEffect, useMemo } from 'react'\n\n/**\n * Inspired by - https://bl.ocks.org/danswick/fc56f37c10d40be62e4feac5984250d2\n */\nexport const useDynamicMapResize = (\n mapContainerRef: MutableRefObject<HTMLDivElement | null>,\n mapCanvasRef: MutableRefObject<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 type { Hash } from '@xylabs/hex'\nimport type { ArchivistPreset } from '@xyo-network/react-network'\nimport { useNetwork } from '@xyo-network/react-network'\nimport { useMemo } from 'react'\n\nconst animatedAnswerHashesConst: Hash[] = [\n '79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',\n '531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',\n 'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',\n '29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e',\n 'cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c',\n '1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d',\n '1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9',\n '973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9',\n '463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',\n '15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',\n '32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',\n]\n\nconst staticAnswerHashConst: Hash = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5'\n\nexport const useFindHashes = () => {\n const { network } = useNetwork()\n const exploreMapHashes = (network?.nodes?.find(node => node.type === 'archivist') as ArchivistPreset)?.explorerMapHashes\n const animatedAnswerHashes = exploreMapHashes?.animatedAnswerHashes || animatedAnswerHashesConst\n const staticAnswerHash = exploreMapHashes?.staticAnswerHash || staticAnswerHashConst\n const foundHashes = useMemo(() => [staticAnswerHash, ...animatedAnswerHashes], [animatedAnswerHashes, staticAnswerHash])\n return foundHashes\n}\n","import { useTheme } from '@mui/material'\n\nimport type { AnimatedHeatMapColorProps, ColorGradientLegendProps } from '../Colors/index.ts'\n\nconst useHeatMapColors = () => {\n const theme = useTheme()\n const staticMapColor = '#FFFF75'\n const highUsageColor = '#FF0000'\n\n const heatMapColorProps: AnimatedHeatMapColorProps = {\n highUsageColor,\n lowUsageColor: '#FFB3B3',\n staticMapColor,\n }\n\n const legendProps: ColorGradientLegendProps = {\n endColor: highUsageColor,\n endLabel: 'High',\n heading: 'Network Usage',\n startColor: staticMapColor,\n startLabel: 'Low',\n textColor: theme.palette.common.white,\n }\n\n return { heatMapColorProps, legendProps }\n}\n\nexport { useHeatMapColors }\n","import { exists } from '@xylabs/exists'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Geometry } from 'geojson'\nimport { useMemo, useState } from 'react'\n\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types/index.ts'\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 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 {\n Map, MapEventOf, MapEventType,\n} from 'mapbox-gl'\nimport { GeolocateControl, NavigationControl } from 'mapbox-gl'\n\nimport type { MapSetting } from '../Settings/index.ts'\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 static geoLocateControl: GeolocateControl | undefined\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 static navControl: NavigationControl | undefined\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 { WithChildren } from '@xylabs/react-shared'\nimport type { Map } from 'mapbox-gl'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nexport const MapBoxInstanceProvider: React.FC<WithChildren> = ({ 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.Provider value={value}>{children}</MapBoxInstanceContext.Provider>\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 { useContext } from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nconst useMapBoxInstance = () => {\n const context = useContext(MapBoxInstanceContext)\n assertEx('map' in context, () => 'useMapBoxInstance must be used within a MapBoxInstanceContext')\n\n return context\n}\n\nexport { useMapBoxInstance }\n","import type { WithChildren } from '@xylabs/react-shared'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapSettings } from '../../MapBoxClasses/index.ts'\nimport type { MapSetting } from '../../Settings/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<WithChildren<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.Provider value={value}>{children}</MapSettingsContext.Provider>\n}\n","import { createContext } from 'react'\n\nimport type { MapSettingsState } from './State.ts'\n\nconst MapSettingsContext = createContext<MapSettingsState>({})\n\nexport { MapSettingsContext }\n","import { useContext } from 'react'\n\nimport { MapSettingsContext } from './Context.ts'\n\nconst useMapSettings = () => {\n const context = useContext(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 { useContext } from 'react'\n\nimport { HeatMapInitializerContext } from './Context.ts'\n\nconst useHeatMapInitializer = () => {\n const context = useContext(HeatMapInitializerContext)\n assertEx('heatMapInitialized' in context, () => 'useHeatMapInitializer must be used within a HeatMapInitializerContext')\n\n return context\n}\n\nexport { useHeatMapInitializer }\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport type { MapboxAccessTokenContextState } from './State.ts'\n\nexport const MapboxAccessTokenContext = createContextEx<MapboxAccessTokenContextState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport React, { useMemo, useState } from 'react'\n\nimport { MapboxAccessTokenContext } from './Context.ts'\n\nexport interface MapboxAccessTokenProviderProps {\n defaultAccessToken?: string\n}\n\nexport const MapboxAccessTokenProvider: React.FC<WithChildren<MapboxAccessTokenProviderProps>> = ({ defaultAccessToken, ...props }) => {\n const [accessToken, setAccessToken] = useState<string>()\n\n const value = useMemo(() => ({\n accessToken: accessToken ?? defaultAccessToken, provided: true, setAccessToken,\n }), [accessToken, defaultAccessToken, setAccessToken])\n\n return (\n <MapboxAccessTokenContext.Provider\n value={value}\n {...props}\n />\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { MapboxAccessTokenContext } from './Context.ts'\n\nexport const useMapboxAccessToken = (required = false) => {\n return useContextEx(MapboxAccessTokenContext, 'MapboxAccessToken', required)\n}\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 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'\nimport { MapStyle } from '../lib/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>(null)\n const mapCanvasRef = useRef<HTMLCanvasElement | null>(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')\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","export enum MapStyle {\n Dark = 'mapbox/dark-v10',\n Light = 'mapbox/light-v10',\n Outdoors = 'mapbox/outdoors-v11',\n Satellite = 'mapbox/satellite-v9',\n SatelliteStreets = 'mapbox/satellite-streets-v11',\n Streets = 'mapbox/streets-v11',\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport { useAppSettings } from '@xyo-network/react-app-settings'\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 { Feature, Polygon } from 'geojson'\nimport React from 'react'\n\nimport { AnimatedHeatMapSettings } from '../AnimatedHeatMapSettings.ts'\nimport {\n useFindHashes, useHeatMapColors, useQuadKeyPayloadsToFeatures,\n} from '../hooks/index.ts'\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types/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 React from 'react'\n\nimport type { ColorGradientLegendProps } from '../Colors/index.ts'\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 React from 'react'\n\nimport type { ColorGradientLegendProps } from '../../Colors/index.ts'\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 '../Settings/index.ts'\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 type { WithChildren } from '@xylabs/react-shared'\nimport { useInterval } from '@xylabs/react-shared'\nimport type { Map } from 'mapbox-gl'\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<WithChildren<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","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type {\n Feature, Point, Polygon,\n} from 'geojson'\n\nexport interface NetworkLocationAnswerBase<T> {\n result: T\n}\n\nexport const NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>\nexport const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)\n\nexport const NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,\n NetworkLocationHeatmapAnswerSchema\n>\nexport const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)\n\nexport const NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,\n NetworkLocationHeatmapQuadkeyAnswerSchema\n>\nexport const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(\n NetworkLocationHeatmapQuadkeyAnswerSchema,\n)\n"],"mappings":";;;;AAEO,IAAMA,qBAAuC,8BAAO;EACzDC,YAAY;IACVC,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAC,cAAc;IACZL,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAE,kBAAkB;IAChBN,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAG,gBAAgB;IACdP,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAI,aAAa;IACXR,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAK,YAAY;IACVT,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAM,cAAc;IACZV,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;AACF,IAlDoD;;;ACA7C,IAAMO,0BAA0BC,mBAAAA;AACvC,IAAM,EACJC,YAAYC,cAAcC,aAAaC,WAAU,IAC/CL;AACJE,WAAWI,S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AgBuB;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;;;AClBvE,SAASC,6BAA6B;AAS/B,IAAMC,8BAA8B;AAGpC,IAAMC,0BAA0BF,sBAAoDC,2BAAAA;AAEpF,IAAME,qCAAqC;AAM3C,IAAMC,iCAAiCJ,sBAA2DG,kCAAAA;AAElG,IAAME,4CAA4C;AAMlD,IAAMC,wCAAwCN,sBACnDK,yCAAAA;","names":["DefaultMapSettings","debugLayer","devMode","field","hidden","label","value","debugLogging","dynamicMapResize","enableControls","fitToPoints","preferDark","scrollToZoom","AnimatedHeatMapSettings","DefaultMapSettings","debugLayer","scrollToZoom","fitToPoints","preferDark","hidden","value","darken","useTheme","FlexCol","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","useNetwork","useMemo","animatedAnswerHashesConst","staticAnswerHashConst","useFindHashes","network","useNetwork","exploreMapHashes","nodes","find","node","type","explorerMapHashes","animatedAnswerHashes","staticAnswerHash","foundHashes","useMemo","useTheme","useHeatMapColors","theme","useTheme","staticMapColor","highUsageColor","heatMapColorProps","lowUsageColor","legendProps","endColor","endLabel","heading","startColor","startLabel","textColor","palette","common","white","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","Provider","assertEx","useContext","useMapBoxInstance","context","useContext","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","Provider","useContext","useMapSettings","context","useContext","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","Provider","assertEx","useContext","useHeatMapInitializer","context","useContext","HeatMapInitializerContext","assertEx","createContextEx","MapboxAccessTokenContext","React","useMemo","useState","MapboxAccessTokenProvider","defaultAccessToken","props","accessToken","setAccessToken","useState","value","useMemo","provided","React","MapboxAccessTokenContext","Provider","useContextEx","useMapboxAccessToken","required","useContextEx","MapboxAccessTokenContext","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","Map","React","useEffect","useRef","useState","MapStyle","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","FlexGrowRow","FlexRow","useAppSettings","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","palette","primary","light","layers","useState","LocationHeatMapLayerBuilderAnimated","darken","length","React","MapBoxInstanceProvider","MapSettingsProvider","debugLayerName","MapHeatConstants","LocationDebugLayerId","HeatMapInitializerProvider","features","featureSets","featureSetsLayers","slice","MapboxHeatFlexBox","FlexCol","minHeight","minWidth","busy","Alert","AlertTitle","FlexCol","useWeakArchivistFromNode","useWeakArchivistGet","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","HeatMapSettings","DefaultMapSettings","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","isPayloadOfSchemaType","NetworkLocationAnswerSchema","isNetworkLocationAnswer","NetworkLocationHeatmapAnswerSchema","isNetworkLocationHeatmapAnswer","NetworkLocationHeatmapQuadkeyAnswerSchema","isNetworkLocationHeatmapQuadkeyAnswer"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Settings/DefaultMapSettings.ts","../../src/AnimatedHeatMapSettings.ts","../../src/Components/AnimatedHeatMap.tsx","../../src/Contexts/HeatMapInitializer/Provider.tsx","../../src/hooks/useDynamicMapResize.tsx","../../src/hooks/useDynamicPositioning.tsx","../../src/hooks/useFindHashes.tsx","../../src/hooks/useHeatMapColors.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/Contexts/MapboxAccessToken/Context.ts","../../src/Contexts/MapboxAccessToken/Provider.tsx","../../src/Contexts/MapboxAccessToken/use.ts","../../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/lib/MapStyle.ts","../../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","../../src/types/NetworkLocationAnswerBase.ts"],"sourcesContent":["import type { MapSetting } from './MapSetting.ts'\n\nexport const DefaultMapSettings: () => MapSetting = () => ({\n debugLayer: {\n devMode: true,\n field: 'debugLayer',\n hidden: true,\n label: 'Debug Layer',\n value: false,\n },\n debugLogging: {\n devMode: true,\n field: 'debugLogging',\n hidden: true,\n label: 'Debug Logging',\n value: false,\n },\n dynamicMapResize: {\n devMode: true,\n field: 'dynamicMapResize',\n hidden: true,\n label: 'Auto Map Resize',\n value: true,\n },\n enableControls: {\n devMode: true,\n field: 'enableControls',\n hidden: true,\n label: 'Map Controls',\n value: false,\n },\n fitToPoints: {\n devMode: true,\n field: 'fitToPoints',\n hidden: true,\n label: 'Fit To Points',\n value: false,\n },\n preferDark: {\n devMode: false,\n field: 'preferDark',\n hidden: true,\n label: 'Prefer dark',\n value: false,\n },\n scrollToZoom: {\n devMode: true,\n field: 'scrollToZoom',\n hidden: true,\n label: 'Scroll To Zoom',\n value: false,\n },\n})\n","import { DefaultMapSettings } from './Settings/index.ts'\n\nexport const AnimatedHeatMapSettings = DefaultMapSettings()\nconst {\n debugLayer, scrollToZoom, fitToPoints, preferDark,\n} = AnimatedHeatMapSettings\ndebugLayer.hidden = false\nscrollToZoom.value = true\nfitToPoints.value = false\npreferDark.value = true\n","import { darken, useTheme } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { Feature, Polygon } from 'geojson'\nimport type { PropsWithChildren } from 'react'\nimport React, { useState } from 'react'\n\nimport type { AnimatedHeatMapColorProps } from '../Colors/index.ts'\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 type { MapSetting } from '../Settings/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.palette.primary.light\n\n const [layers] = useState<MapLayer[]>(() => [\n LocationHeatMapLayerBuilderAnimated(localStaticMapColor, 0, 'static'),\n LocationHeatMapLayerBuilderAnimated(lowUsageColor || localStaticMapColor, 0, 'animated'),\n LocationHeatMapLayerBuilderAnimated(highUsageColor || darken(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 { Feature, Polygon } from 'geojson'\nimport type { PropsWithChildren } from 'react'\nimport React, { useEffect, useMemo } from 'react'\n\nimport type { AnimatedHeatMapColorProps, HeatMapColorProps } from '../../Colors/index.ts'\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.Provider value={value}>{children}</HeatMapInitializerContext.Provider>\n}\n","import type { Map } from 'mapbox-gl'\nimport type { MutableRefObject } from 'react'\nimport { useEffect, useMemo } from 'react'\n\n/**\n * Inspired by - https://bl.ocks.org/danswick/fc56f37c10d40be62e4feac5984250d2\n */\nexport const useDynamicMapResize = (\n mapContainerRef: MutableRefObject<HTMLDivElement | null>,\n mapCanvasRef: MutableRefObject<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 type { Hash } from '@xylabs/hex'\nimport type { ArchivistPreset } from '@xyo-network/react-network'\nimport { useNetwork } from '@xyo-network/react-network'\nimport { useMemo } from 'react'\n\nconst animatedAnswerHashesConst: Hash[] = [\n '79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',\n '531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',\n 'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',\n '29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e',\n 'cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c',\n '1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d',\n '1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9',\n '973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9',\n '463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',\n '15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',\n '32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',\n]\n\nconst staticAnswerHashConst: Hash = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5'\n\nexport const useFindHashes = () => {\n const { network } = useNetwork()\n const exploreMapHashes = (network?.nodes?.find(node => node.type === 'archivist') as ArchivistPreset)?.explorerMapHashes\n const animatedAnswerHashes = exploreMapHashes?.animatedAnswerHashes || animatedAnswerHashesConst\n const staticAnswerHash = exploreMapHashes?.staticAnswerHash || staticAnswerHashConst\n const foundHashes = useMemo(() => [staticAnswerHash, ...animatedAnswerHashes], [animatedAnswerHashes, staticAnswerHash])\n return foundHashes\n}\n","import { useTheme } from '@mui/material'\n\nimport type { AnimatedHeatMapColorProps, ColorGradientLegendProps } from '../Colors/index.ts'\n\nconst useHeatMapColors = () => {\n const theme = useTheme()\n const staticMapColor = '#FFFF75'\n const highUsageColor = '#FF0000'\n\n const heatMapColorProps: AnimatedHeatMapColorProps = {\n highUsageColor,\n lowUsageColor: '#FFB3B3',\n staticMapColor,\n }\n\n const legendProps: ColorGradientLegendProps = {\n endColor: highUsageColor,\n endLabel: 'High',\n heading: 'Network Usage',\n startColor: staticMapColor,\n startLabel: 'Low',\n textColor: theme.palette.common.white,\n }\n\n return { heatMapColorProps, legendProps }\n}\n\nexport { useHeatMapColors }\n","import { exists } from '@xylabs/exists'\nimport { GeoJson } from '@xyo-network/sdk-geo'\nimport type { Feature, Geometry } from 'geojson'\nimport { useMemo, useState } from 'react'\n\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types/index.ts'\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 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 {\n Map, MapEventOf, MapEventType,\n} from 'mapbox-gl'\nimport { GeolocateControl, NavigationControl } from 'mapbox-gl'\n\nimport type { MapSetting } from '../Settings/index.ts'\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 static geoLocateControl: GeolocateControl | undefined\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 static navControl: NavigationControl | undefined\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.Provider value={value}>{children}</MapBoxInstanceContext.Provider>\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 { useContext } from 'react'\n\nimport { MapBoxInstanceContext } from './Context.ts'\n\nconst useMapBoxInstance = () => {\n const context = useContext(MapBoxInstanceContext)\n assertEx('map' in context, () => 'useMapBoxInstance must be used within a MapBoxInstanceContext')\n\n return context\n}\n\nexport { useMapBoxInstance }\n","import type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { MapSettings } from '../../MapBoxClasses/index.ts'\nimport type { MapSetting } from '../../Settings/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.Provider value={value}>{children}</MapSettingsContext.Provider>\n}\n","import { createContext } from 'react'\n\nimport type { MapSettingsState } from './State.ts'\n\nconst MapSettingsContext = createContext<MapSettingsState>({})\n\nexport { MapSettingsContext }\n","import { useContext } from 'react'\n\nimport { MapSettingsContext } from './Context.ts'\n\nconst useMapSettings = () => {\n const context = useContext(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 { useContext } from 'react'\n\nimport { HeatMapInitializerContext } from './Context.ts'\n\nconst useHeatMapInitializer = () => {\n const context = useContext(HeatMapInitializerContext)\n assertEx('heatMapInitialized' in context, () => 'useHeatMapInitializer must be used within a HeatMapInitializerContext')\n\n return context\n}\n\nexport { useHeatMapInitializer }\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport type { MapboxAccessTokenContextState } from './State.ts'\n\nexport const MapboxAccessTokenContext = createContextEx<MapboxAccessTokenContextState>()\n","import type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { MapboxAccessTokenContext } from './Context.ts'\n\nexport interface MapboxAccessTokenProviderProps {\n defaultAccessToken?: string\n}\n\nexport const MapboxAccessTokenProvider: React.FC<PropsWithChildren<MapboxAccessTokenProviderProps>> = ({ defaultAccessToken, ...props }) => {\n const [accessToken, setAccessToken] = useState<string>()\n\n const value = useMemo(() => ({\n accessToken: accessToken ?? defaultAccessToken, provided: true, setAccessToken,\n }), [accessToken, defaultAccessToken, setAccessToken])\n\n return (\n <MapboxAccessTokenContext.Provider\n value={value}\n {...props}\n />\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { MapboxAccessTokenContext } from './Context.ts'\n\nexport const useMapboxAccessToken = (required = false) => {\n return useContextEx(MapboxAccessTokenContext, 'MapboxAccessToken', required)\n}\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 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'\nimport { MapStyle } from '../lib/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>(null)\n const mapCanvasRef = useRef<HTMLCanvasElement | null>(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')\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","export enum MapStyle {\n Dark = 'mapbox/dark-v10',\n Light = 'mapbox/light-v10',\n Outdoors = 'mapbox/outdoors-v11',\n Satellite = 'mapbox/satellite-v9',\n SatelliteStreets = 'mapbox/satellite-streets-v11',\n Streets = 'mapbox/streets-v11',\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 { Feature, Polygon } from 'geojson'\nimport React from 'react'\n\nimport { AnimatedHeatMapSettings } from '../AnimatedHeatMapSettings.ts'\nimport {\n useFindHashes, useHeatMapColors, useQuadKeyPayloadsToFeatures,\n} from '../hooks/index.ts'\nimport type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types/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 React from 'react'\n\nimport type { ColorGradientLegendProps } from '../Colors/index.ts'\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 React from 'react'\n\nimport type { ColorGradientLegendProps } from '../../Colors/index.ts'\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 '../Settings/index.ts'\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","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type {\n Feature, Point, Polygon,\n} from 'geojson'\n\nexport interface NetworkLocationAnswerBase<T> {\n result: T\n}\n\nexport const NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>\nexport const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)\n\nexport const NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,\n NetworkLocationHeatmapAnswerSchema\n>\nexport const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)\n\nexport const NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,\n NetworkLocationHeatmapQuadkeyAnswerSchema\n>\nexport const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(\n NetworkLocationHeatmapQuadkeyAnswerSchema,\n)\n"],"mappings":";;;;AAEO,IAAMA,qBAAuC,8BAAO;EACzDC,YA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Layer","devMode","field","hidden","label","value","debugLogging","dynamicMapResize","enableControls","fitToPoints","preferDark","scrollToZoom","AnimatedHeatMapSettings","DefaultMapSettings","debugLayer","scrollToZoom","fitToPoints","preferDark","hidden","value","darken","useTheme","FlexCol","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","useNetwork","useMemo","animatedAnswerHashesConst","staticAnswerHashConst","useFindHashes","network","useNetwork","exploreMapHashes","nodes","find","node","type","explorerMapHashes","animatedAnswerHashes","staticAnswerHash","foundHashes","useMemo","useTheme","useHeatMapColors","theme","useTheme","staticMapColor","highUsageColor","heatMapColorProps","lowUsageColor","legendProps","endColor","endLabel","heading","startColor","startLabel","textColor","palette","common","white","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","Provider","assertEx","useContext","useMapBoxInstance","context","useContext","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","Provider","useContext","useMapSettings","context","useContext","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","Provider","assertEx","useContext","useHeatMapInitializer","context","useContext","HeatMapInitializerContext","assertEx","createContextEx","MapboxAccessTokenContext","React","useMemo","useState","MapboxAccessTokenProvider","defaultAccessToken","props","accessToken","setAccessToken","useState","value","useMemo","provided","React","MapboxAccessTokenContext","Provider","useContextEx","useMapboxAccessToken","required","useContextEx","MapboxAccessTokenContext","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","Map","React","useEffect","useRef","useState","MapStyle","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","palette","primary","light","layers","useState","LocationHeatMapLayerBuilderAnimated","darken","length","React","MapBoxInstanceProvider","MapSettingsProvider","debugLayerName","MapHeatConstants","LocationDebugLayerId","HeatMapInitializerProvider","features","featureSets","featureSetsLayers","slice","MapboxHeatFlexBox","FlexCol","minHeight","minWidth","busy","Alert","AlertTitle","FlexCol","useWeakArchivistFromNode","useWeakArchivistGet","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","HeatMapSettings","DefaultMapSettings","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","isPayloadOfSchemaType","NetworkLocationAnswerSchema","isNetworkLocationAnswer","NetworkLocationHeatmapAnswerSchema","isNetworkLocationHeatmapAnswer","NetworkLocationHeatmapQuadkeyAnswerSchema","isNetworkLocationHeatmapQuadkeyAnswer"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-map",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.9",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
"lint-pkg": "npmPkgJsonLint ."
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xylabs/assert": "^4.3.
|
|
47
|
-
"@xylabs/delay": "^4.3.
|
|
48
|
-
"@xylabs/exists": "^4.3.
|
|
49
|
-
"@xylabs/forget": "^4.3.
|
|
50
|
-
"@xylabs/hex": "^4.3.
|
|
51
|
-
"@xylabs/react-
|
|
52
|
-
"@xylabs/react-
|
|
53
|
-
"@
|
|
54
|
-
"@xyo-network/
|
|
55
|
-
"@xyo-network/react-archivist": "^4.1.
|
|
56
|
-
"@xyo-network/react-network": "^4.1.
|
|
57
|
-
"@xyo-network/react-shared": "^4.1.
|
|
46
|
+
"@xylabs/assert": "^4.3.3",
|
|
47
|
+
"@xylabs/delay": "^4.3.3",
|
|
48
|
+
"@xylabs/exists": "^4.3.3",
|
|
49
|
+
"@xylabs/forget": "^4.3.3",
|
|
50
|
+
"@xylabs/hex": "^4.3.3",
|
|
51
|
+
"@xylabs/react-app-settings": "^5.2.7",
|
|
52
|
+
"@xylabs/react-flexbox": "^5.2.7",
|
|
53
|
+
"@xylabs/react-shared": "^5.2.7",
|
|
54
|
+
"@xyo-network/payload-model": "^3.3.2",
|
|
55
|
+
"@xyo-network/react-archivist": "^4.1.9",
|
|
56
|
+
"@xyo-network/react-network": "^4.1.9",
|
|
57
|
+
"@xyo-network/react-shared": "^4.1.9",
|
|
58
58
|
"@xyo-network/sdk-geo": "^3.0.2",
|
|
59
59
|
"mapbox-gl": "^3.7.0"
|
|
60
60
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { darken, useTheme } from '@mui/material'
|
|
2
2
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import type { WithChildren } from '@xylabs/react-shared'
|
|
4
3
|
import type { Feature, Polygon } from 'geojson'
|
|
4
|
+
import type { PropsWithChildren } from 'react'
|
|
5
5
|
import React, { useState } from 'react'
|
|
6
6
|
|
|
7
7
|
import type { AnimatedHeatMapColorProps } from '../Colors/index.ts'
|
|
@@ -21,7 +21,7 @@ export interface AnimatedHeatMapProps {
|
|
|
21
21
|
staticFeatureSet: Feature<Polygon>[]
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const AnimatedHeatMap: React.FC<
|
|
24
|
+
export const AnimatedHeatMap: React.FC<PropsWithChildren<AnimatedHeatMapProps>> = ({
|
|
25
25
|
accessToken,
|
|
26
26
|
animatedFeatureSets,
|
|
27
27
|
defaultMapSettings,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
1
|
import { useInterval } from '@xylabs/react-shared'
|
|
3
2
|
import type { Map } from 'mapbox-gl'
|
|
3
|
+
import type { PropsWithChildren } from 'react'
|
|
4
4
|
import React, {
|
|
5
5
|
useCallback, useEffect, useMemo, useRef,
|
|
6
6
|
} from 'react'
|
|
@@ -18,7 +18,7 @@ export interface LayerAnimatorProps {
|
|
|
18
18
|
const timeIncrement = 2000
|
|
19
19
|
const animatedLayerCount = 3
|
|
20
20
|
|
|
21
|
-
export const LayerAnimator: React.FC<
|
|
21
|
+
export const LayerAnimator: React.FC<PropsWithChildren<LayerAnimatorProps>> = ({
|
|
22
22
|
animateLayers, children, layers, layersInitialized, map,
|
|
23
23
|
}) => {
|
|
24
24
|
const layerIndexQueue = useRef<number[]>([])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Paper, Stack } from '@mui/material'
|
|
2
|
+
import { useAppSettings } from '@xylabs/react-app-settings'
|
|
2
3
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
4
|
import { FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'
|
|
4
|
-
import { useAppSettings } from '@xyo-network/react-app-settings'
|
|
5
5
|
import React from 'react'
|
|
6
6
|
|
|
7
7
|
import { useMapSettings } from '../../Contexts/index.ts'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forget } from '@xylabs/forget'
|
|
2
|
-
import type { WithChildren } from '@xylabs/react-shared'
|
|
3
2
|
import type { Feature, Polygon } from 'geojson'
|
|
3
|
+
import type { PropsWithChildren } from 'react'
|
|
4
4
|
import React, { useEffect, useMemo } from 'react'
|
|
5
5
|
|
|
6
6
|
import type { AnimatedHeatMapColorProps, HeatMapColorProps } from '../../Colors/index.ts'
|
|
@@ -22,7 +22,7 @@ export interface MapInitializerProviderProps {
|
|
|
22
22
|
zoom?: number
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export const HeatMapInitializerProvider: React.FC<
|
|
25
|
+
export const HeatMapInitializerProvider: React.FC<PropsWithChildren<MapInitializerProviderProps>> = ({
|
|
26
26
|
children,
|
|
27
27
|
featureSets,
|
|
28
28
|
featureSetsLayers,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
1
|
import type { Map } from 'mapbox-gl'
|
|
2
|
+
import type { PropsWithChildren } from 'react'
|
|
3
3
|
import React, {
|
|
4
4
|
useEffect, useMemo, useState,
|
|
5
5
|
} from 'react'
|
|
6
6
|
|
|
7
7
|
import { MapBoxInstanceContext } from './Context.ts'
|
|
8
8
|
|
|
9
|
-
export const MapBoxInstanceProvider: React.FC<
|
|
9
|
+
export const MapBoxInstanceProvider: React.FC<PropsWithChildren> = ({ children }) => {
|
|
10
10
|
const [map, setMapBoxInstance] = useState<Map>()
|
|
11
11
|
const [mapInitialized, setMapInitialized] = useState(false)
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropsWithChildren } from 'react'
|
|
2
2
|
import React, {
|
|
3
3
|
useEffect, useMemo, useState,
|
|
4
4
|
} from 'react'
|
|
@@ -16,7 +16,7 @@ export interface MapSettingsProviderProps {
|
|
|
16
16
|
zoom?: number
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const MapSettingsProvider: React.FC<
|
|
19
|
+
export const MapSettingsProvider: React.FC<PropsWithChildren<MapSettingsProviderProps>> = ({
|
|
20
20
|
children,
|
|
21
21
|
debugLayerName,
|
|
22
22
|
defaultMapSettings,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropsWithChildren } from 'react'
|
|
2
2
|
import React, { useMemo, useState } from 'react'
|
|
3
3
|
|
|
4
4
|
import { MapboxAccessTokenContext } from './Context.ts'
|
|
@@ -7,7 +7,7 @@ export interface MapboxAccessTokenProviderProps {
|
|
|
7
7
|
defaultAccessToken?: string
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const MapboxAccessTokenProvider: React.FC<
|
|
10
|
+
export const MapboxAccessTokenProvider: React.FC<PropsWithChildren<MapboxAccessTokenProviderProps>> = ({ defaultAccessToken, ...props }) => {
|
|
11
11
|
const [accessToken, setAccessToken] = useState<string>()
|
|
12
12
|
|
|
13
13
|
const value = useMemo(() => ({
|