@xyo-network/react-map 3.0.1 → 3.0.3
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/AnimatedHeatMapSettings.d.ts +2 -0
- package/dist/browser/AnimatedHeatMapSettings.d.ts.map +1 -0
- package/dist/browser/Colors/MapColorProps.d.ts +17 -0
- package/dist/browser/Colors/MapColorProps.d.ts.map +1 -0
- package/dist/browser/Colors/index.d.ts +2 -0
- package/dist/browser/Colors/index.d.ts.map +1 -0
- package/dist/browser/Components/AnimatedHeatMap.d.ts +14 -0
- package/dist/browser/Components/AnimatedHeatMap.d.ts.map +1 -0
- package/dist/browser/Components/AnimatedHeatMapLoaded.d.ts +8 -0
- package/dist/browser/Components/AnimatedHeatMapLoaded.d.ts.map +1 -0
- package/dist/browser/Components/FeaturesToLayersMap.d.ts +7 -0
- package/dist/browser/Components/FeaturesToLayersMap.d.ts.map +1 -0
- package/dist/browser/Components/HeatMapSettings.d.ts +3 -0
- package/dist/browser/Components/HeatMapSettings.d.ts.map +1 -0
- package/dist/browser/Components/LayerAnimator.d.ts +12 -0
- package/dist/browser/Components/LayerAnimator.d.ts.map +1 -0
- package/dist/browser/Components/Legend.d.ts +5 -0
- package/dist/browser/Components/Legend.d.ts.map +1 -0
- package/dist/browser/Components/Legends/ColorGradient.d.ts +5 -0
- package/dist/browser/Components/Legends/ColorGradient.d.ts.map +1 -0
- package/dist/browser/Components/Legends/index.d.ts +2 -0
- package/dist/browser/Components/Legends/index.d.ts.map +1 -0
- package/dist/browser/Components/MapBox.d.ts +11 -0
- package/dist/browser/Components/MapBox.d.ts.map +1 -0
- package/dist/browser/Components/MapBoxHeat.d.ts +4 -0
- package/dist/browser/Components/MapBoxHeat.d.ts.map +1 -0
- package/dist/browser/Components/MapBoxPoints.d.ts +9 -0
- package/dist/browser/Components/MapBoxPoints.d.ts.map +1 -0
- package/dist/browser/Components/MapSettingsComponents/Setting.d.ts +8 -0
- package/dist/browser/Components/MapSettingsComponents/Setting.d.ts.map +1 -0
- package/dist/browser/Components/MapSettingsComponents/SettingsBox.d.ts +7 -0
- package/dist/browser/Components/MapSettingsComponents/SettingsBox.d.ts.map +1 -0
- package/dist/browser/Components/MapSettingsComponents/index.d.ts +3 -0
- package/dist/browser/Components/MapSettingsComponents/index.d.ts.map +1 -0
- package/dist/browser/Components/index.d.ts +12 -0
- package/dist/browser/Components/index.d.ts.map +1 -0
- package/dist/browser/Contexts/HeatMapInitializer/Context.d.ts +4 -0
- package/dist/browser/Contexts/HeatMapInitializer/Context.d.ts.map +1 -0
- package/dist/browser/Contexts/HeatMapInitializer/Provider.d.ts +16 -0
- package/dist/browser/Contexts/HeatMapInitializer/Provider.d.ts.map +1 -0
- package/dist/browser/Contexts/HeatMapInitializer/State.d.ts +7 -0
- package/dist/browser/Contexts/HeatMapInitializer/State.d.ts.map +1 -0
- package/dist/browser/Contexts/HeatMapInitializer/index.d.ts +4 -0
- package/dist/browser/Contexts/HeatMapInitializer/index.d.ts.map +1 -0
- package/dist/browser/Contexts/HeatMapInitializer/useHeatMapInitializer.d.ts +3 -0
- package/dist/browser/Contexts/HeatMapInitializer/useHeatMapInitializer.d.ts.map +1 -0
- package/dist/browser/Contexts/MapBoxInstance/Context.d.ts +4 -0
- package/dist/browser/Contexts/MapBoxInstance/Context.d.ts.map +1 -0
- package/dist/browser/Contexts/MapBoxInstance/Provider.d.ts +4 -0
- package/dist/browser/Contexts/MapBoxInstance/Provider.d.ts.map +1 -0
- package/dist/browser/Contexts/MapBoxInstance/State.d.ts +8 -0
- package/dist/browser/Contexts/MapBoxInstance/State.d.ts.map +1 -0
- package/dist/browser/Contexts/MapBoxInstance/index.d.ts +4 -0
- package/dist/browser/Contexts/MapBoxInstance/index.d.ts.map +1 -0
- package/dist/browser/Contexts/MapBoxInstance/useMapBoxInstance.d.ts +3 -0
- package/dist/browser/Contexts/MapBoxInstance/useMapBoxInstance.d.ts.map +1 -0
- package/dist/browser/Contexts/MapSettings/Context.d.ts +4 -0
- package/dist/browser/Contexts/MapSettings/Context.d.ts.map +1 -0
- package/dist/browser/Contexts/MapSettings/Provider.d.ts +11 -0
- package/dist/browser/Contexts/MapSettings/Provider.d.ts.map +1 -0
- package/dist/browser/Contexts/MapSettings/State.d.ts +7 -0
- package/dist/browser/Contexts/MapSettings/State.d.ts.map +1 -0
- package/dist/browser/Contexts/MapSettings/index.d.ts +4 -0
- package/dist/browser/Contexts/MapSettings/index.d.ts.map +1 -0
- package/dist/browser/Contexts/MapSettings/useMapSettings.d.ts +3 -0
- package/dist/browser/Contexts/MapSettings/useMapSettings.d.ts.map +1 -0
- package/dist/browser/Contexts/MapboxAccessToken/Context.d.ts +3 -0
- package/dist/browser/Contexts/MapboxAccessToken/Context.d.ts.map +1 -0
- package/dist/browser/Contexts/MapboxAccessToken/Provider.d.ts +7 -0
- package/dist/browser/Contexts/MapboxAccessToken/Provider.d.ts.map +1 -0
- package/dist/browser/Contexts/MapboxAccessToken/State.d.ts +7 -0
- package/dist/browser/Contexts/MapboxAccessToken/State.d.ts.map +1 -0
- package/dist/browser/Contexts/MapboxAccessToken/index.d.ts +5 -0
- package/dist/browser/Contexts/MapboxAccessToken/index.d.ts.map +1 -0
- package/dist/browser/Contexts/MapboxAccessToken/use.d.ts +2 -0
- package/dist/browser/Contexts/MapboxAccessToken/use.d.ts.map +1 -0
- package/dist/browser/Contexts/index.d.ts +5 -0
- package/dist/browser/Contexts/index.d.ts.map +1 -0
- package/dist/browser/Layers/Builders/LocationHeatMapLayerBuilder.d.ts +13 -0
- package/dist/browser/Layers/Builders/LocationHeatMapLayerBuilder.d.ts.map +1 -0
- package/dist/browser/Layers/Builders/LocationHeatMapLayerBuilderAnimated.d.ts +3 -0
- package/dist/browser/Layers/Builders/LocationHeatMapLayerBuilderAnimated.d.ts.map +1 -0
- package/dist/browser/Layers/Builders/LocationPointsMapLayerBuilder.d.ts +7 -0
- package/dist/browser/Layers/Builders/LocationPointsMapLayerBuilder.d.ts.map +1 -0
- package/dist/browser/Layers/Builders/index.d.ts +4 -0
- package/dist/browser/Layers/Builders/index.d.ts.map +1 -0
- package/dist/browser/Layers/CircleLayer.d.ts +9 -0
- package/dist/browser/Layers/CircleLayer.d.ts.map +1 -0
- package/dist/browser/Layers/Configs/HeatMapFillLayerConfig.d.ts +3 -0
- package/dist/browser/Layers/Configs/HeatMapFillLayerConfig.d.ts.map +1 -0
- package/dist/browser/Layers/Configs/HeatMapLineLayerConfig.d.ts +3 -0
- package/dist/browser/Layers/Configs/HeatMapLineLayerConfig.d.ts.map +1 -0
- package/dist/browser/Layers/Configs/HeatMapSymbolLayerConfig.d.ts +3 -0
- package/dist/browser/Layers/Configs/HeatMapSymbolLayerConfig.d.ts.map +1 -0
- package/dist/browser/Layers/Configs/LocationPointLayerConfig.d.ts +3 -0
- package/dist/browser/Layers/Configs/LocationPointLayerConfig.d.ts.map +1 -0
- package/dist/browser/Layers/Configs/index.d.ts +5 -0
- package/dist/browser/Layers/Configs/index.d.ts.map +1 -0
- package/dist/browser/Layers/FillLayer.d.ts +9 -0
- package/dist/browser/Layers/FillLayer.d.ts.map +1 -0
- package/dist/browser/Layers/LineLayer.d.ts +9 -0
- package/dist/browser/Layers/LineLayer.d.ts.map +1 -0
- package/dist/browser/Layers/MapLayer.d.ts +6 -0
- package/dist/browser/Layers/MapLayer.d.ts.map +1 -0
- package/dist/browser/Layers/SymbolLayer.d.ts +9 -0
- package/dist/browser/Layers/SymbolLayer.d.ts.map +1 -0
- package/dist/browser/Layers/index.d.ts +8 -0
- package/dist/browser/Layers/index.d.ts.map +1 -0
- package/dist/browser/MapBoxClasses/MapBase.d.ts +16 -0
- package/dist/browser/MapBoxClasses/MapBase.d.ts.map +1 -0
- package/dist/browser/MapBoxClasses/MapHeat.d.ts +16 -0
- package/dist/browser/MapBoxClasses/MapHeat.d.ts.map +1 -0
- package/dist/browser/MapBoxClasses/MapPoints.d.ts +14 -0
- package/dist/browser/MapBoxClasses/MapPoints.d.ts.map +1 -0
- package/dist/browser/MapBoxClasses/MapSettings.d.ts +26 -0
- package/dist/browser/MapBoxClasses/MapSettings.d.ts.map +1 -0
- package/dist/browser/MapBoxClasses/index.d.ts +5 -0
- package/dist/browser/MapBoxClasses/index.d.ts.map +1 -0
- package/dist/browser/Settings/DefaultMapSettings.d.ts +3 -0
- package/dist/browser/Settings/DefaultMapSettings.d.ts.map +1 -0
- package/dist/browser/Settings/MapSetting.d.ts +11 -0
- package/dist/browser/Settings/MapSetting.d.ts.map +1 -0
- package/dist/browser/Settings/index.d.ts +3 -0
- package/dist/browser/Settings/index.d.ts.map +1 -0
- package/dist/browser/hooks/index.d.ts +6 -0
- package/dist/browser/hooks/index.d.ts.map +1 -0
- package/dist/browser/hooks/useDynamicMapResize.d.ts +4 -0
- package/dist/browser/hooks/useDynamicMapResize.d.ts.map +1 -0
- package/dist/browser/hooks/useDynamicPositioning.d.ts +6 -0
- package/dist/browser/hooks/useDynamicPositioning.d.ts.map +1 -0
- package/dist/browser/hooks/useFindHashes.d.ts +2 -0
- package/dist/browser/hooks/useFindHashes.d.ts.map +1 -0
- package/dist/browser/hooks/useHeatMapColors.d.ts +7 -0
- package/dist/browser/hooks/useHeatMapColors.d.ts.map +1 -0
- package/dist/browser/hooks/useQuadKeyPayloadsToFeatures.d.ts +9 -0
- package/dist/browser/hooks/useQuadKeyPayloadsToFeatures.d.ts.map +1 -0
- package/dist/browser/index.d.ts +11 -356
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs +12 -7
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/lib/MapBoxBaseProps.d.ts +19 -0
- package/dist/browser/lib/MapBoxBaseProps.d.ts.map +1 -0
- package/dist/browser/lib/MapStyle.d.ts +9 -0
- package/dist/browser/lib/MapStyle.d.ts.map +1 -0
- package/dist/browser/lib/index.d.ts +3 -0
- package/dist/browser/lib/index.d.ts.map +1 -0
- package/dist/browser/types/NetworkLocationAnswerBase.d.ts +37 -0
- package/dist/browser/types/NetworkLocationAnswerBase.d.ts.map +1 -0
- package/dist/browser/types/index.d.ts +2 -0
- package/dist/browser/types/index.d.ts.map +1 -0
- package/package.json +62 -56
- package/src/AnimatedHeatMapSettings.ts +3 -1
- package/src/Components/AnimatedHeatMap.tsx +13 -8
- package/src/Components/AnimatedHeatMapLoaded.tsx +10 -5
- package/src/Components/FeaturesToLayersMap.ts +2 -2
- package/src/Components/HeatMapSettings.ts +3 -1
- package/src/Components/LayerAnimator.tsx +11 -6
- package/src/Components/Legend.tsx +4 -2
- package/src/Components/Legends/ColorGradient.tsx +4 -2
- package/src/Components/MapBox.stories.tsx +15 -12
- package/src/Components/MapBox.tsx +8 -3
- package/src/Components/MapBoxHeat.tsx +4 -2
- package/src/Components/MapBoxPoints.tsx +16 -10
- package/src/Components/MapSettingsComponents/Setting.tsx +5 -2
- package/src/Components/MapSettingsComponents/SettingsBox.tsx +2 -1
- package/src/Contexts/HeatMapInitializer/Context.ts +1 -1
- package/src/Contexts/HeatMapInitializer/Provider.tsx +16 -8
- package/src/Contexts/HeatMapInitializer/State.ts +2 -2
- package/src/Contexts/MapBoxInstance/Context.ts +1 -1
- package/src/Contexts/MapBoxInstance/Provider.tsx +8 -4
- package/src/Contexts/MapBoxInstance/State.ts +2 -2
- package/src/Contexts/MapSettings/Context.ts +1 -1
- package/src/Contexts/MapSettings/Provider.tsx +9 -5
- package/src/Contexts/MapSettings/State.ts +2 -2
- package/src/Contexts/MapboxAccessToken/Context.ts +1 -1
- package/src/Contexts/MapboxAccessToken/Provider.tsx +12 -4
- package/src/Contexts/MapboxAccessToken/State.ts +2 -2
- package/src/Layers/Builders/LocationHeatMapLayerBuilder.ts +3 -1
- package/src/Layers/CircleLayer.ts +4 -2
- package/src/Layers/Configs/HeatMapFillLayerConfig.ts +1 -1
- package/src/Layers/Configs/HeatMapLineLayerConfig.ts +1 -1
- package/src/Layers/Configs/HeatMapSymbolLayerConfig.ts +2 -4
- package/src/Layers/Configs/LocationPointLayerConfig.ts +1 -1
- package/src/Layers/FillLayer.ts +1 -1
- package/src/Layers/LineLayer.ts +1 -1
- package/src/Layers/MapLayer.ts +2 -2
- package/src/Layers/SymbolLayer.ts +1 -1
- package/src/MapBoxClasses/MapBase.ts +6 -4
- package/src/MapBoxClasses/MapHeat.ts +9 -5
- package/src/MapBoxClasses/MapPoints.ts +5 -3
- package/src/MapBoxClasses/MapSettings.ts +14 -13
- package/src/Settings/DefaultMapSettings.ts +1 -1
- package/src/hooks/useDynamicMapResize.tsx +5 -2
- package/src/hooks/useDynamicPositioning.tsx +1 -1
- package/src/hooks/useFindHashes.tsx +3 -2
- package/src/hooks/useHeatMapColors.tsx +1 -1
- package/src/hooks/useQuadKeyPayloadsToFeatures.tsx +5 -3
- package/src/lib/MapBoxBaseProps.ts +5 -5
- package/src/types/NetworkLocationAnswerBase.ts +5 -2
- package/xy.config.ts +2 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { WithChildren } from '@xylabs/react-shared'
|
|
2
|
-
import { Map } from 'mapbox-gl'
|
|
3
|
-
import React, {
|
|
1
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
|
+
import type { Map } from 'mapbox-gl'
|
|
3
|
+
import React, {
|
|
4
|
+
useEffect, useMemo, useState,
|
|
5
|
+
} from 'react'
|
|
4
6
|
|
|
5
7
|
import { MapBoxInstanceContext } from './Context.ts'
|
|
6
8
|
|
|
@@ -8,7 +10,9 @@ export const MapBoxInstanceProvider: React.FC<WithChildren> = ({ children }) =>
|
|
|
8
10
|
const [map, setMapBoxInstance] = useState<Map>()
|
|
9
11
|
const [mapInitialized, setMapInitialized] = useState(false)
|
|
10
12
|
|
|
11
|
-
const value = useMemo(() => ({
|
|
13
|
+
const value = useMemo(() => ({
|
|
14
|
+
map, mapInitialized, setMapBoxInstance,
|
|
15
|
+
}), [map, mapInitialized, setMapBoxInstance])
|
|
12
16
|
|
|
13
17
|
useEffect(() => {
|
|
14
18
|
if (!mapInitialized && map) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { WithChildren } from '@xylabs/react-shared'
|
|
2
|
-
import React, {
|
|
1
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
|
+
import React, {
|
|
3
|
+
useEffect, useMemo, useState,
|
|
4
|
+
} from 'react'
|
|
3
5
|
|
|
4
6
|
import { MapSettings } from '../../MapBoxClasses/index.ts'
|
|
5
|
-
import { MapSetting } from '../../Settings/index.ts'
|
|
7
|
+
import type { MapSetting } from '../../Settings/index.ts'
|
|
6
8
|
import { useMapBoxInstance } from '../MapBoxInstance/index.ts'
|
|
7
9
|
import { MapSettingsContext } from './Context.ts'
|
|
8
|
-
import { MapSettingsState } from './State.ts'
|
|
10
|
+
import type { MapSettingsState } from './State.ts'
|
|
9
11
|
|
|
10
12
|
export interface MapSettingsProviderProps {
|
|
11
13
|
debugLayerName?: string
|
|
@@ -31,7 +33,9 @@ export const MapSettingsProvider: React.FC<WithChildren<MapSettingsProviderProps
|
|
|
31
33
|
|
|
32
34
|
useEffect(() => {
|
|
33
35
|
if (mapSettings && map && mapInitialized) {
|
|
34
|
-
MapSettings.updateSettings({
|
|
36
|
+
MapSettings.updateSettings({
|
|
37
|
+
debugLayerName, map, requestLocation, settings: mapSettings, zoom,
|
|
38
|
+
})
|
|
35
39
|
}
|
|
36
40
|
}, [debugLayerName, map, mapInitialized, mapSettings, requestLocation, zoom])
|
|
37
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContextEx } from '@xyo-network/react-shared'
|
|
2
2
|
|
|
3
|
-
import { MapboxAccessTokenContextState } from './State.ts'
|
|
3
|
+
import type { MapboxAccessTokenContextState } from './State.ts'
|
|
4
4
|
|
|
5
5
|
export const MapboxAccessTokenContext = createContextEx<MapboxAccessTokenContextState>()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WithChildren } from '@xylabs/react-shared'
|
|
2
|
-
import React, { useState } from 'react'
|
|
1
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
|
+
import React, { useMemo, useState } from 'react'
|
|
3
3
|
|
|
4
4
|
import { MapboxAccessTokenContext } from './Context.ts'
|
|
5
5
|
|
|
@@ -10,6 +10,14 @@ export interface MapboxAccessTokenProviderProps {
|
|
|
10
10
|
export const MapboxAccessTokenProvider: React.FC<WithChildren<MapboxAccessTokenProviderProps>> = ({ defaultAccessToken, ...props }) => {
|
|
11
11
|
const [accessToken, setAccessToken] = useState<string>()
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const value = useMemo(() => ({
|
|
14
|
+
accessToken: accessToken ?? defaultAccessToken, provided: true, setAccessToken,
|
|
15
|
+
}), [accessToken, defaultAccessToken, setAccessToken])
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<MapboxAccessTokenContext.Provider
|
|
19
|
+
value={value}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
15
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContextExState } from '@xyo-network/react-shared'
|
|
2
|
-
import { Dispatch } from 'react'
|
|
1
|
+
import type { ContextExState } from '@xyo-network/react-shared'
|
|
2
|
+
import type { Dispatch } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface MapboxAccessTokenContextState extends ContextExState {
|
|
5
5
|
accessToken?: string
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
HeatMapFillLayerConfig, HeatMapLineLayerConfig, HeatMapSymbolLayerConfig,
|
|
3
|
+
} from '../Configs/index.ts'
|
|
2
4
|
import { FillLayerBuilder } from '../FillLayer.ts'
|
|
3
5
|
import { LineLayerBuilder } from '../LineLayer.ts'
|
|
4
6
|
import { SymbolLayerBuilder } from '../SymbolLayer.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayerBase } from '@xyo-network/sdk-geo'
|
|
2
|
-
import { CircleLayerSpecification } from 'mapbox-gl'
|
|
2
|
+
import type { CircleLayerSpecification } from 'mapbox-gl'
|
|
3
3
|
|
|
4
4
|
export class CircleLayerBuilder extends LayerBase<CircleLayerSpecification> {
|
|
5
5
|
CircleLayerOptions: Partial<CircleLayerSpecification>
|
|
@@ -9,7 +9,9 @@ export class CircleLayerBuilder extends LayerBase<CircleLayerSpecification> {
|
|
|
9
9
|
|
|
10
10
|
constructor(id: string, source: string, CircleLayerOptions?: Partial<CircleLayerSpecification>) {
|
|
11
11
|
super(id, source)
|
|
12
|
-
this.CircleLayerOptions = CircleLayerOptions || {
|
|
12
|
+
this.CircleLayerOptions = CircleLayerOptions || {
|
|
13
|
+
id: this.id, source: this.source, type: 'circle',
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
buildLayer(): CircleLayerSpecification {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SymbolLayerSpecification } from 'mapbox-gl'
|
|
1
|
+
import type { SymbolLayerSpecification } from 'mapbox-gl'
|
|
2
2
|
|
|
3
3
|
export const HeatMapSymbolLayerConfig: (color: string) => Partial<SymbolLayerSpecification> = color => ({
|
|
4
4
|
layout: {
|
|
@@ -14,7 +14,5 @@ export const HeatMapSymbolLayerConfig: (color: string) => Partial<SymbolLayerSpe
|
|
|
14
14
|
'text-size': 10,
|
|
15
15
|
'visibility': 'none',
|
|
16
16
|
},
|
|
17
|
-
paint: {
|
|
18
|
-
'text-color': color,
|
|
19
|
-
},
|
|
17
|
+
paint: { 'text-color': color },
|
|
20
18
|
})
|
package/src/Layers/FillLayer.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayerBase } from '@xyo-network/sdk-geo'
|
|
2
|
-
import { FillLayerSpecification } from 'mapbox-gl'
|
|
2
|
+
import type { FillLayerSpecification } from 'mapbox-gl'
|
|
3
3
|
|
|
4
4
|
export class FillLayerBuilder extends LayerBase<FillLayerSpecification> {
|
|
5
5
|
FillLayerOptions: Partial<FillLayerSpecification>
|
package/src/Layers/LineLayer.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayerBase } from '@xyo-network/sdk-geo'
|
|
2
|
-
import { LineLayerSpecification } from 'mapbox-gl'
|
|
2
|
+
import type { LineLayerSpecification } from 'mapbox-gl'
|
|
3
3
|
|
|
4
4
|
export class LineLayerBuilder extends LayerBase<LineLayerSpecification> {
|
|
5
5
|
LineLayerOptions: Partial<LineLayerSpecification>
|
package/src/Layers/MapLayer.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LayerBase } from '@xyo-network/sdk-geo'
|
|
2
|
-
import { Layer, LayerSpecification } from 'mapbox-gl'
|
|
1
|
+
import type { LayerBase } from '@xyo-network/sdk-geo'
|
|
2
|
+
import type { Layer, LayerSpecification } from 'mapbox-gl'
|
|
3
3
|
|
|
4
4
|
export interface MapLayer extends Layer {
|
|
5
5
|
update: LayerBase<LayerSpecification>['update']
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayerBase } from '@xyo-network/sdk-geo'
|
|
2
|
-
import { SymbolLayerSpecification } from 'mapbox-gl'
|
|
2
|
+
import type { SymbolLayerSpecification } from 'mapbox-gl'
|
|
3
3
|
|
|
4
4
|
export class SymbolLayerBuilder extends LayerBase<SymbolLayerSpecification> {
|
|
5
5
|
SymbolLayerOptions: Partial<SymbolLayerSpecification>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { GeoJson } from '@xyo-network/sdk-geo'
|
|
3
|
-
import { Feature, Geometry } from 'geojson'
|
|
4
|
-
import { GeoJSONSource, Map } from 'mapbox-gl'
|
|
3
|
+
import type { Feature, Geometry } from 'geojson'
|
|
4
|
+
import type { GeoJSONSource, Map } from 'mapbox-gl'
|
|
5
5
|
|
|
6
|
-
import { MapLayer } from '../Layers/index.ts'
|
|
6
|
+
import type { MapLayer } from '../Layers/index.ts'
|
|
7
7
|
|
|
8
8
|
export interface MapBaseConfig<T extends Geometry> {
|
|
9
9
|
features: Feature<T>[]
|
|
@@ -16,7 +16,9 @@ export abstract class MapBase<T extends Geometry> {
|
|
|
16
16
|
private _config: MapBaseConfig<T>
|
|
17
17
|
|
|
18
18
|
constructor(config: MapBaseConfig<T>) {
|
|
19
|
-
this._config = {
|
|
19
|
+
this._config = {
|
|
20
|
+
requestLocation: true, zoom: 2, ...config,
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
get isMapReady() {
|
|
@@ -2,11 +2,15 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import { delay } from '@xylabs/delay'
|
|
3
3
|
import { forget } from '@xylabs/forget'
|
|
4
4
|
import { GeoJson } from '@xyo-network/sdk-geo'
|
|
5
|
-
import { Feature, Polygon } from 'geojson'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
5
|
+
import type { Feature, Polygon } from 'geojson'
|
|
6
|
+
import type {
|
|
7
|
+
GeoJSONSource, GeoJSONSourceSpecification, Map, MapOptions,
|
|
8
|
+
} from 'mapbox-gl'
|
|
9
|
+
import { LngLatBounds } from 'mapbox-gl'
|
|
10
|
+
|
|
11
|
+
import type { MapLayer } from '../Layers/index.ts'
|
|
12
|
+
import type { MapBaseConfig } from './MapBase.ts'
|
|
13
|
+
import { MapBase } from './MapBase.ts'
|
|
10
14
|
|
|
11
15
|
export class MapHeat extends MapBase<Polygon> {
|
|
12
16
|
static animationStarted = false
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Feature, Point } from 'geojson'
|
|
2
|
-
import {
|
|
1
|
+
import type { Feature, Point } from 'geojson'
|
|
2
|
+
import type { MapOptions } from 'mapbox-gl'
|
|
3
|
+
import { LngLatBounds } from 'mapbox-gl'
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import type { MapBaseConfig } from './MapBase.ts'
|
|
6
|
+
import { MapBase } from './MapBase.ts'
|
|
5
7
|
|
|
6
8
|
export interface MapPointsConfig extends MapBaseConfig<Point> {
|
|
7
9
|
features: Feature<Point>[]
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
Map, MapEventOf, MapEventType,
|
|
3
|
+
} from 'mapbox-gl'
|
|
4
|
+
import { GeolocateControl, NavigationControl } from 'mapbox-gl'
|
|
2
5
|
|
|
3
|
-
import { MapSetting } from '../Settings/index.ts'
|
|
6
|
+
import type { MapSetting } from '../Settings/index.ts'
|
|
4
7
|
|
|
5
8
|
export interface MapSettingsConfig {
|
|
6
9
|
debugLayerName?: string
|
|
@@ -75,8 +78,12 @@ export class MapSettings {
|
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
static updateSettings(config: MapSettingsConfig) {
|
|
78
|
-
const {
|
|
79
|
-
|
|
81
|
+
const {
|
|
82
|
+
settings, map, zoom, requestLocation, debugLayerName = '',
|
|
83
|
+
} = config
|
|
84
|
+
const {
|
|
85
|
+
scrollToZoom, enableControls, debugLayer, debugLogging,
|
|
86
|
+
} = settings
|
|
80
87
|
|
|
81
88
|
MapSettings.toggleControls(enableControls?.value, map, zoom, requestLocation)
|
|
82
89
|
.toggleScrollToZoom(scrollToZoom?.value, map)
|
|
@@ -87,18 +94,12 @@ export class MapSettings {
|
|
|
87
94
|
// Needs to be static so we ensure controls are only instantiated once
|
|
88
95
|
private static addControls(map: Map, zoom?: number, requestLocation?: boolean) {
|
|
89
96
|
const geolocateControl = new GeolocateControl({
|
|
90
|
-
fitBoundsOptions: {
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
positionOptions: {
|
|
94
|
-
enableHighAccuracy: true,
|
|
95
|
-
},
|
|
97
|
+
fitBoundsOptions: { zoom: zoom || 2 },
|
|
98
|
+
positionOptions: { enableHighAccuracy: true },
|
|
96
99
|
trackUserLocation: true,
|
|
97
100
|
})
|
|
98
101
|
|
|
99
|
-
const navControl = new NavigationControl({
|
|
100
|
-
showCompass: false,
|
|
101
|
-
})
|
|
102
|
+
const navControl = new NavigationControl({ showCompass: false })
|
|
102
103
|
|
|
103
104
|
this.geoLocateControl = this.geoLocateControl || geolocateControl
|
|
104
105
|
this.navControl = this.navControl || navControl
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Map } from 'mapbox-gl'
|
|
2
|
-
import { MutableRefObject
|
|
1
|
+
import type { Map } from 'mapbox-gl'
|
|
2
|
+
import type { MutableRefObject } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
useEffect, useMemo, useState,
|
|
5
|
+
} from 'react'
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Inspired by - https://bl.ocks.org/danswick/fc56f37c10d40be62e4feac5984250d2
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Hash } from '@xylabs/hex'
|
|
2
|
-
import { ArchivistPreset
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { ArchivistPreset } from '@xyo-network/react-network'
|
|
3
|
+
import { useNetwork } from '@xyo-network/react-network'
|
|
3
4
|
import { useMemo } from 'react'
|
|
4
5
|
|
|
5
6
|
const animatedAnswerHashesConst: Hash[] = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTheme } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
import { AnimatedHeatMapColorProps, ColorGradientLegendProps } from '../Colors/index.ts'
|
|
3
|
+
import type { AnimatedHeatMapColorProps, ColorGradientLegendProps } from '../Colors/index.ts'
|
|
4
4
|
|
|
5
5
|
const useHeatMapColors = () => {
|
|
6
6
|
const theme = useTheme()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { exists } from '@xylabs/exists'
|
|
2
2
|
import { GeoJson } from '@xyo-network/sdk-geo'
|
|
3
|
-
import { Feature, Geometry } from 'geojson'
|
|
3
|
+
import type { Feature, Geometry } from 'geojson'
|
|
4
4
|
import { useEffect, useState } from 'react'
|
|
5
5
|
|
|
6
|
-
import { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types/index.ts'
|
|
6
|
+
import type { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types/index.ts'
|
|
7
7
|
|
|
8
8
|
const quadKeyToFeature = ({ density, quadkey }: { density: number; quadkey: string }) => {
|
|
9
9
|
const polygonFeature = new GeoJson(quadkey).polygonFeature()
|
|
@@ -47,7 +47,9 @@ const useQuadKeyPayloadsToFeatures = (payloads?: NetworkLocationHeatmapQuadkeyAn
|
|
|
47
47
|
}
|
|
48
48
|
}, [payloads])
|
|
49
49
|
|
|
50
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
error, features, multipleFeatureSets,
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export { useQuadKeyPayloadsToFeatures }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
2
|
-
import { Feature } from 'geojson'
|
|
3
|
-
import { MapOptions } from 'mapbox-gl'
|
|
4
|
-
import { ReactNode } from 'react'
|
|
1
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
2
|
+
import type { Feature } from 'geojson'
|
|
3
|
+
import type { MapOptions } from 'mapbox-gl'
|
|
4
|
+
import type { ReactNode } from 'react'
|
|
5
5
|
|
|
6
|
-
import { MapLayer } from '../Layers/index.ts'
|
|
6
|
+
import type { MapLayer } from '../Layers/index.ts'
|
|
7
7
|
|
|
8
8
|
export interface MapboxFlexBoxProps extends FlexBoxProps {
|
|
9
9
|
accessToken: string
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
2
|
+
import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
|
|
3
|
+
import type {
|
|
4
|
+
Feature, Point, Polygon,
|
|
5
|
+
} from 'geojson'
|
|
3
6
|
|
|
4
7
|
export interface NetworkLocationAnswerBase<T> {
|
|
5
8
|
result: T
|
package/xy.config.ts
CHANGED