@xyo-network/react-map 4.1.20 → 4.2.1
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 +1 -2
- package/dist/browser/Components/AnimatedHeatMap.d.ts.map +1 -1
- package/dist/browser/Components/AnimatedHeatMapLoaded.d.ts.map +1 -1
- package/dist/browser/Components/HeatMapSettings.d.ts +1 -1
- package/dist/browser/Components/HeatMapSettings.d.ts.map +1 -1
- package/dist/browser/Components/Legend.d.ts +1 -1
- package/dist/browser/Components/Legend.d.ts.map +1 -1
- package/dist/browser/Components/Legends/ColorGradient.d.ts +1 -1
- package/dist/browser/Components/Legends/ColorGradient.d.ts.map +1 -1
- package/dist/browser/Components/MapBox.d.ts.map +1 -1
- package/dist/browser/Contexts/HeatMapInitializer/Provider.d.ts +1 -1
- package/dist/browser/Contexts/HeatMapInitializer/Provider.d.ts.map +1 -1
- package/dist/browser/Contexts/HeatMapInitializer/State.d.ts +1 -1
- package/dist/browser/Contexts/HeatMapInitializer/State.d.ts.map +1 -1
- package/dist/browser/Contexts/MapSettings/Provider.d.ts +1 -1
- package/dist/browser/Contexts/MapSettings/Provider.d.ts.map +1 -1
- package/dist/browser/Contexts/MapSettings/State.d.ts +1 -1
- package/dist/browser/Contexts/MapSettings/State.d.ts.map +1 -1
- package/dist/browser/Contexts/index.d.ts +0 -1
- package/dist/browser/Contexts/index.d.ts.map +1 -1
- package/dist/browser/MapBoxClasses/MapSettings.d.ts +1 -1
- package/dist/browser/MapBoxClasses/MapSettings.d.ts.map +1 -1
- package/dist/browser/hooks/index.d.ts +0 -3
- package/dist/browser/hooks/index.d.ts.map +1 -1
- package/dist/browser/index.d.ts +0 -5
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.mjs +85 -314
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/lib/index.d.ts +0 -1
- package/dist/browser/lib/index.d.ts.map +1 -1
- package/package.json +11 -15
- package/src/Components/AnimatedHeatMap.tsx +1 -2
- package/src/Components/AnimatedHeatMapLoaded.tsx +5 -5
- package/src/Components/HeatMapSettings.ts +1 -1
- package/src/Components/Legend.tsx +1 -1
- package/src/Components/Legends/ColorGradient.tsx +1 -2
- package/src/Components/MapBox.stories.tsx +3 -2
- package/src/Components/MapBox.tsx +1 -1
- package/src/Contexts/HeatMapInitializer/Provider.tsx +1 -1
- package/src/Contexts/HeatMapInitializer/State.ts +2 -1
- package/src/Contexts/MapSettings/Provider.tsx +1 -1
- package/src/Contexts/MapSettings/State.ts +1 -2
- package/src/Contexts/index.ts +0 -1
- package/src/MapBoxClasses/MapSettings.ts +1 -2
- package/src/hooks/index.ts +0 -3
- package/src/index.ts +0 -5
- package/src/lib/index.ts +0 -1
- package/dist/browser/AnimatedHeatMapSettings.d.ts +0 -2
- package/dist/browser/AnimatedHeatMapSettings.d.ts.map +0 -1
- package/dist/browser/Colors/MapColorProps.d.ts +0 -17
- package/dist/browser/Colors/MapColorProps.d.ts.map +0 -1
- package/dist/browser/Colors/index.d.ts +0 -2
- package/dist/browser/Colors/index.d.ts.map +0 -1
- package/dist/browser/Contexts/MapboxAccessToken/Context.d.ts +0 -3
- package/dist/browser/Contexts/MapboxAccessToken/Context.d.ts.map +0 -1
- package/dist/browser/Contexts/MapboxAccessToken/Provider.d.ts +0 -7
- package/dist/browser/Contexts/MapboxAccessToken/Provider.d.ts.map +0 -1
- package/dist/browser/Contexts/MapboxAccessToken/State.d.ts +0 -7
- package/dist/browser/Contexts/MapboxAccessToken/State.d.ts.map +0 -1
- package/dist/browser/Contexts/MapboxAccessToken/index.d.ts +0 -5
- package/dist/browser/Contexts/MapboxAccessToken/index.d.ts.map +0 -1
- package/dist/browser/Contexts/MapboxAccessToken/use.d.ts +0 -2
- package/dist/browser/Contexts/MapboxAccessToken/use.d.ts.map +0 -1
- package/dist/browser/Settings/DefaultMapSettings.d.ts +0 -3
- package/dist/browser/Settings/DefaultMapSettings.d.ts.map +0 -1
- package/dist/browser/Settings/MapSetting.d.ts +0 -16
- package/dist/browser/Settings/MapSetting.d.ts.map +0 -1
- package/dist/browser/Settings/index.d.ts +0 -3
- package/dist/browser/Settings/index.d.ts.map +0 -1
- package/dist/browser/hooks/useFindHashes.d.ts +0 -2
- package/dist/browser/hooks/useFindHashes.d.ts.map +0 -1
- package/dist/browser/hooks/useHeatMapColors.d.ts +0 -7
- package/dist/browser/hooks/useHeatMapColors.d.ts.map +0 -1
- package/dist/browser/hooks/useQuadKeyPayloadsToFeatures.d.ts +0 -9
- package/dist/browser/hooks/useQuadKeyPayloadsToFeatures.d.ts.map +0 -1
- package/dist/browser/lib/MapStyle.d.ts +0 -9
- package/dist/browser/lib/MapStyle.d.ts.map +0 -1
- package/dist/browser/types/NetworkLocationAnswerBase.d.ts +0 -37
- package/dist/browser/types/NetworkLocationAnswerBase.d.ts.map +0 -1
- package/dist/browser/types/index.d.ts +0 -2
- package/dist/browser/types/index.d.ts.map +0 -1
- package/src/AnimatedHeatMapSettings.ts +0 -10
- package/src/Colors/MapColorProps.ts +0 -19
- package/src/Colors/index.ts +0 -1
- package/src/Contexts/MapboxAccessToken/Context.ts +0 -5
- package/src/Contexts/MapboxAccessToken/Provider.tsx +0 -23
- package/src/Contexts/MapboxAccessToken/State.ts +0 -7
- package/src/Contexts/MapboxAccessToken/index.ts +0 -4
- package/src/Contexts/MapboxAccessToken/use.ts +0 -7
- package/src/Settings/DefaultMapSettings.ts +0 -53
- package/src/Settings/MapSetting.ts +0 -16
- package/src/Settings/index.ts +0 -2
- package/src/hooks/useFindHashes.tsx +0 -29
- package/src/hooks/useHeatMapColors.tsx +0 -28
- package/src/hooks/useQuadKeyPayloadsToFeatures.tsx +0 -55
- package/src/lib/MapStyle.ts +0 -8
- package/src/types/NetworkLocationAnswerBase.ts +0 -32
- package/src/types/index.ts +0 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -1,75 +1,14 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/Settings/DefaultMapSettings.ts
|
|
5
|
-
var DefaultMapSettings = /* @__PURE__ */ __name(() => ({
|
|
6
|
-
debugLayer: {
|
|
7
|
-
devMode: true,
|
|
8
|
-
field: "debugLayer",
|
|
9
|
-
hidden: true,
|
|
10
|
-
label: "Debug Layer",
|
|
11
|
-
value: false
|
|
12
|
-
},
|
|
13
|
-
debugLogging: {
|
|
14
|
-
devMode: true,
|
|
15
|
-
field: "debugLogging",
|
|
16
|
-
hidden: true,
|
|
17
|
-
label: "Debug Logging",
|
|
18
|
-
value: false
|
|
19
|
-
},
|
|
20
|
-
dynamicMapResize: {
|
|
21
|
-
devMode: true,
|
|
22
|
-
field: "dynamicMapResize",
|
|
23
|
-
hidden: true,
|
|
24
|
-
label: "Auto Map Resize",
|
|
25
|
-
value: true
|
|
26
|
-
},
|
|
27
|
-
enableControls: {
|
|
28
|
-
devMode: true,
|
|
29
|
-
field: "enableControls",
|
|
30
|
-
hidden: true,
|
|
31
|
-
label: "Map Controls",
|
|
32
|
-
value: false
|
|
33
|
-
},
|
|
34
|
-
fitToPoints: {
|
|
35
|
-
devMode: true,
|
|
36
|
-
field: "fitToPoints",
|
|
37
|
-
hidden: true,
|
|
38
|
-
label: "Fit To Points",
|
|
39
|
-
value: false
|
|
40
|
-
},
|
|
41
|
-
preferDark: {
|
|
42
|
-
devMode: false,
|
|
43
|
-
field: "preferDark",
|
|
44
|
-
hidden: true,
|
|
45
|
-
label: "Prefer dark",
|
|
46
|
-
value: false
|
|
47
|
-
},
|
|
48
|
-
scrollToZoom: {
|
|
49
|
-
devMode: true,
|
|
50
|
-
field: "scrollToZoom",
|
|
51
|
-
hidden: true,
|
|
52
|
-
label: "Scroll To Zoom",
|
|
53
|
-
value: false
|
|
54
|
-
}
|
|
55
|
-
}), "DefaultMapSettings");
|
|
56
|
-
|
|
57
|
-
// src/AnimatedHeatMapSettings.ts
|
|
58
|
-
var AnimatedHeatMapSettings = DefaultMapSettings();
|
|
59
|
-
var { debugLayer, scrollToZoom, fitToPoints, preferDark } = AnimatedHeatMapSettings;
|
|
60
|
-
debugLayer.hidden = false;
|
|
61
|
-
scrollToZoom.value = true;
|
|
62
|
-
fitToPoints.value = false;
|
|
63
|
-
preferDark.value = true;
|
|
64
|
-
|
|
65
4
|
// src/Components/AnimatedHeatMap.tsx
|
|
66
|
-
import { darken, useTheme
|
|
5
|
+
import { darken, useTheme } from "@mui/material";
|
|
67
6
|
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
68
|
-
import
|
|
7
|
+
import React8, { useState as useState4 } from "react";
|
|
69
8
|
|
|
70
9
|
// src/Contexts/HeatMapInitializer/Provider.tsx
|
|
71
10
|
import { forget as forget2 } from "@xylabs/forget";
|
|
72
|
-
import React3, { useEffect as useEffect4, useMemo as
|
|
11
|
+
import React3, { useEffect as useEffect4, useMemo as useMemo5 } from "react";
|
|
73
12
|
|
|
74
13
|
// src/hooks/useDynamicMapResize.tsx
|
|
75
14
|
import { useEffect, useMemo } from "react";
|
|
@@ -159,114 +98,9 @@ var useDynamicPositioning = /* @__PURE__ */ __name(() => {
|
|
|
159
98
|
};
|
|
160
99
|
}, "useDynamicPositioning");
|
|
161
100
|
|
|
162
|
-
// src/hooks/useFindHashes.tsx
|
|
163
|
-
import { useNetwork } from "@xyo-network/react-network";
|
|
164
|
-
import { useMemo as useMemo3 } from "react";
|
|
165
|
-
var animatedAnswerHashesConst = [
|
|
166
|
-
"79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5",
|
|
167
|
-
"531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898",
|
|
168
|
-
"c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb",
|
|
169
|
-
"29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e",
|
|
170
|
-
"cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c",
|
|
171
|
-
"1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d",
|
|
172
|
-
"1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9",
|
|
173
|
-
"973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9",
|
|
174
|
-
"463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95",
|
|
175
|
-
"15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555",
|
|
176
|
-
"32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,"
|
|
177
|
-
];
|
|
178
|
-
var staticAnswerHashConst = "c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5";
|
|
179
|
-
var useFindHashes = /* @__PURE__ */ __name(() => {
|
|
180
|
-
const { network } = useNetwork();
|
|
181
|
-
const exploreMapHashes = network?.nodes?.find((node) => node.type === "archivist")?.explorerMapHashes;
|
|
182
|
-
const animatedAnswerHashes = exploreMapHashes?.animatedAnswerHashes || animatedAnswerHashesConst;
|
|
183
|
-
const staticAnswerHash = exploreMapHashes?.staticAnswerHash || staticAnswerHashConst;
|
|
184
|
-
const foundHashes = useMemo3(() => [
|
|
185
|
-
staticAnswerHash,
|
|
186
|
-
...animatedAnswerHashes
|
|
187
|
-
], [
|
|
188
|
-
animatedAnswerHashes,
|
|
189
|
-
staticAnswerHash
|
|
190
|
-
]);
|
|
191
|
-
return foundHashes;
|
|
192
|
-
}, "useFindHashes");
|
|
193
|
-
|
|
194
|
-
// src/hooks/useHeatMapColors.tsx
|
|
195
|
-
import { useTheme } from "@mui/material";
|
|
196
|
-
var useHeatMapColors = /* @__PURE__ */ __name(() => {
|
|
197
|
-
const theme = useTheme();
|
|
198
|
-
const staticMapColor = "#FFFF75";
|
|
199
|
-
const highUsageColor = "#FF0000";
|
|
200
|
-
const heatMapColorProps = {
|
|
201
|
-
highUsageColor,
|
|
202
|
-
lowUsageColor: "#FFB3B3",
|
|
203
|
-
staticMapColor
|
|
204
|
-
};
|
|
205
|
-
const legendProps = {
|
|
206
|
-
endColor: highUsageColor,
|
|
207
|
-
endLabel: "High",
|
|
208
|
-
heading: "Network Usage",
|
|
209
|
-
startColor: staticMapColor,
|
|
210
|
-
startLabel: "Low",
|
|
211
|
-
textColor: theme.palette.common.white
|
|
212
|
-
};
|
|
213
|
-
return {
|
|
214
|
-
heatMapColorProps,
|
|
215
|
-
legendProps
|
|
216
|
-
};
|
|
217
|
-
}, "useHeatMapColors");
|
|
218
|
-
|
|
219
|
-
// src/hooks/useQuadKeyPayloadsToFeatures.tsx
|
|
220
|
-
import { exists } from "@xylabs/exists";
|
|
221
|
-
import { GeoJson } from "@xyo-network/sdk-geo";
|
|
222
|
-
import { useMemo as useMemo4, useState } from "react";
|
|
223
|
-
var quadKeyToFeature = /* @__PURE__ */ __name(({ density, quadkey }) => {
|
|
224
|
-
const polygonFeature = new GeoJson(quadkey).polygonFeature();
|
|
225
|
-
polygonFeature.properties = {
|
|
226
|
-
count: density,
|
|
227
|
-
density
|
|
228
|
-
};
|
|
229
|
-
return polygonFeature;
|
|
230
|
-
}, "quadKeyToFeature");
|
|
231
|
-
var setDensity = /* @__PURE__ */ __name((feature) => {
|
|
232
|
-
if (feature.properties) {
|
|
233
|
-
feature.properties.value = feature.properties.density / 5;
|
|
234
|
-
}
|
|
235
|
-
return feature;
|
|
236
|
-
}, "setDensity");
|
|
237
|
-
var useQuadKeyPayloadsToFeatures = /* @__PURE__ */ __name((payloads) => {
|
|
238
|
-
const [multipleFeatureSets, setMultipleFeatureSets] = useState([
|
|
239
|
-
[]
|
|
240
|
-
]);
|
|
241
|
-
const [features, setFeatures] = useState([]);
|
|
242
|
-
const [error, setError] = useState();
|
|
243
|
-
useMemo4(() => {
|
|
244
|
-
if (Array.isArray(payloads)) {
|
|
245
|
-
if (payloads?.filter(exists).length > 0) {
|
|
246
|
-
const mappedFeatures = payloads?.map((payload) => payload?.result.map(quadKeyToFeature));
|
|
247
|
-
setMultipleFeatureSets(mappedFeatures.map((features2) => features2?.map(setDensity) ?? []));
|
|
248
|
-
} else {
|
|
249
|
-
setError(new Error("Cannot find payloads for provided hashes"));
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (payloads && payloads.result) {
|
|
253
|
-
const singlePayload = payloads;
|
|
254
|
-
const mappedFeatures = singlePayload.result.map(quadKeyToFeature);
|
|
255
|
-
setFeatures(mappedFeatures.map(setDensity));
|
|
256
|
-
}
|
|
257
|
-
}, [
|
|
258
|
-
payloads
|
|
259
|
-
]);
|
|
260
|
-
return {
|
|
261
|
-
error,
|
|
262
|
-
features,
|
|
263
|
-
multipleFeatureSets
|
|
264
|
-
};
|
|
265
|
-
}, "useQuadKeyPayloadsToFeatures");
|
|
266
|
-
|
|
267
101
|
// src/MapBoxClasses/MapBase.ts
|
|
268
102
|
import { assertEx } from "@xylabs/assert";
|
|
269
|
-
import { GeoJson
|
|
103
|
+
import { GeoJson } from "@xyo-network/sdk-geo";
|
|
270
104
|
var MapBase = class {
|
|
271
105
|
static {
|
|
272
106
|
__name(this, "MapBase");
|
|
@@ -284,8 +118,8 @@ var MapBase = class {
|
|
|
284
118
|
}
|
|
285
119
|
initializeMapSource(layer) {
|
|
286
120
|
const getSource = /* @__PURE__ */ __name(() => {
|
|
287
|
-
const featuresCollection =
|
|
288
|
-
return
|
|
121
|
+
const featuresCollection = GeoJson.featureCollection(this._config.features);
|
|
122
|
+
return GeoJson.featuresSource(featuresCollection);
|
|
289
123
|
}, "getSource");
|
|
290
124
|
const existingSource = this._config.map.getSource(layer.source);
|
|
291
125
|
const source = getSource();
|
|
@@ -303,7 +137,7 @@ var MapBase = class {
|
|
|
303
137
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
304
138
|
import { delay } from "@xylabs/delay";
|
|
305
139
|
import { forget } from "@xylabs/forget";
|
|
306
|
-
import { GeoJson as
|
|
140
|
+
import { GeoJson as GeoJson2 } from "@xyo-network/sdk-geo";
|
|
307
141
|
import { LngLatBounds } from "mapbox-gl";
|
|
308
142
|
var MapHeat = class extends MapBase {
|
|
309
143
|
static {
|
|
@@ -341,8 +175,8 @@ var MapHeat = class extends MapBase {
|
|
|
341
175
|
let layerTick = 0;
|
|
342
176
|
let sourceTick = 0;
|
|
343
177
|
const sources = featureSet.map((feature) => {
|
|
344
|
-
const featuresCollection =
|
|
345
|
-
return
|
|
178
|
+
const featuresCollection = GeoJson2.featureCollection(feature);
|
|
179
|
+
return GeoJson2.featuresSource(featuresCollection);
|
|
346
180
|
});
|
|
347
181
|
this.updateLayer(map, layers[0], sources[0]);
|
|
348
182
|
this.updateLayer(map, layers[1], sources[1]);
|
|
@@ -448,8 +282,8 @@ var MapHeat = class extends MapBase {
|
|
|
448
282
|
// Build layers each with the same features
|
|
449
283
|
initializeHeatMapSource(layers) {
|
|
450
284
|
const getSource = /* @__PURE__ */ __name((_) => {
|
|
451
|
-
const featuresCollection =
|
|
452
|
-
return
|
|
285
|
+
const featuresCollection = GeoJson2.featureCollection(this.config.features);
|
|
286
|
+
return GeoJson2.featuresSource(featuresCollection);
|
|
453
287
|
}, "getSource");
|
|
454
288
|
for (const [index, layer] of layers.entries()) {
|
|
455
289
|
const existingSource = this.config.map.getSource(layer.source);
|
|
@@ -519,8 +353,8 @@ var MapSettings = class _MapSettings {
|
|
|
519
353
|
return this;
|
|
520
354
|
}
|
|
521
355
|
static toggleDebugLayer(value, map, layerName) {
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
356
|
+
const debugLayer2 = map.getLayer(layerName);
|
|
357
|
+
if (debugLayer2) {
|
|
524
358
|
if (value) {
|
|
525
359
|
map.setLayoutProperty(layerName, "visibility", "visible");
|
|
526
360
|
} else {
|
|
@@ -552,8 +386,8 @@ var MapSettings = class _MapSettings {
|
|
|
552
386
|
}
|
|
553
387
|
static updateSettings(config) {
|
|
554
388
|
const { settings, map, zoom, requestLocation, debugLayerName = "" } = config;
|
|
555
|
-
const { scrollToZoom:
|
|
556
|
-
_MapSettings.toggleControls(enableControls?.value, map, zoom, requestLocation).toggleScrollToZoom(
|
|
389
|
+
const { scrollToZoom: scrollToZoom2, enableControls, debugLayer: debugLayer2, debugLogging } = settings;
|
|
390
|
+
_MapSettings.toggleControls(enableControls?.value, map, zoom, requestLocation).toggleScrollToZoom(scrollToZoom2?.value, map).toggleDebugLayer(debugLayer2?.value, map, debugLayerName).toggleDebugLogging(debugLogging.value, map);
|
|
557
391
|
}
|
|
558
392
|
// Needs to be static so we ensure controls are only instantiated once
|
|
559
393
|
static addControls(map, zoom, requestLocation) {
|
|
@@ -591,7 +425,7 @@ var MapSettings = class _MapSettings {
|
|
|
591
425
|
};
|
|
592
426
|
|
|
593
427
|
// src/Contexts/MapBoxInstance/Provider.tsx
|
|
594
|
-
import React, { useEffect as useEffect2, useMemo as
|
|
428
|
+
import React, { useEffect as useEffect2, useMemo as useMemo3, useState } from "react";
|
|
595
429
|
|
|
596
430
|
// src/Contexts/MapBoxInstance/Context.ts
|
|
597
431
|
import { createContext } from "react";
|
|
@@ -599,9 +433,9 @@ var MapBoxInstanceContext = createContext({});
|
|
|
599
433
|
|
|
600
434
|
// src/Contexts/MapBoxInstance/Provider.tsx
|
|
601
435
|
var MapBoxInstanceProvider = /* @__PURE__ */ __name(({ children }) => {
|
|
602
|
-
const [map, setMapBoxInstance] =
|
|
603
|
-
const [mapInitialized, setMapInitialized] =
|
|
604
|
-
const value =
|
|
436
|
+
const [map, setMapBoxInstance] = useState();
|
|
437
|
+
const [mapInitialized, setMapInitialized] = useState(false);
|
|
438
|
+
const value = useMemo3(() => ({
|
|
605
439
|
map,
|
|
606
440
|
mapInitialized,
|
|
607
441
|
setMapBoxInstance
|
|
@@ -636,7 +470,7 @@ var useMapBoxInstance = /* @__PURE__ */ __name(() => {
|
|
|
636
470
|
}, "useMapBoxInstance");
|
|
637
471
|
|
|
638
472
|
// src/Contexts/MapSettings/Provider.tsx
|
|
639
|
-
import React2, { useEffect as useEffect3, useMemo as
|
|
473
|
+
import React2, { useEffect as useEffect3, useMemo as useMemo4, useState as useState2 } from "react";
|
|
640
474
|
|
|
641
475
|
// src/Contexts/MapSettings/Context.ts
|
|
642
476
|
import { createContext as createContext2 } from "react";
|
|
@@ -644,9 +478,9 @@ var MapSettingsContext = createContext2({});
|
|
|
644
478
|
|
|
645
479
|
// src/Contexts/MapSettings/Provider.tsx
|
|
646
480
|
var MapSettingsProvider = /* @__PURE__ */ __name(({ children, debugLayerName, defaultMapSettings, requestLocation, zoom = 1 }) => {
|
|
647
|
-
const [mapSettings, setMapSettings] =
|
|
481
|
+
const [mapSettings, setMapSettings] = useState2(defaultMapSettings || {});
|
|
648
482
|
const { map, mapInitialized } = useMapBoxInstance();
|
|
649
|
-
const value =
|
|
483
|
+
const value = useMemo4(() => ({
|
|
650
484
|
mapSettings,
|
|
651
485
|
setMapSettings
|
|
652
486
|
}), [
|
|
@@ -692,7 +526,7 @@ var HeatMapInitializerProvider = /* @__PURE__ */ __name(({ children, featureSets
|
|
|
692
526
|
const { options } = useDynamicPositioning();
|
|
693
527
|
const { mapSettings } = useMapSettings();
|
|
694
528
|
const { map, mapInitialized } = useMapBoxInstance();
|
|
695
|
-
const mapHeat =
|
|
529
|
+
const mapHeat = useMemo5(() => {
|
|
696
530
|
return map && features?.length ? new MapHeat({
|
|
697
531
|
features,
|
|
698
532
|
map,
|
|
@@ -703,7 +537,7 @@ var HeatMapInitializerProvider = /* @__PURE__ */ __name(({ children, featureSets
|
|
|
703
537
|
features,
|
|
704
538
|
zoom
|
|
705
539
|
]);
|
|
706
|
-
const value =
|
|
540
|
+
const value = useMemo5(() => ({
|
|
707
541
|
MapHeat: mapHeat,
|
|
708
542
|
heatMapColorProps
|
|
709
543
|
}), [
|
|
@@ -737,9 +571,9 @@ var HeatMapInitializerProvider = /* @__PURE__ */ __name(({ children, featureSets
|
|
|
737
571
|
]);
|
|
738
572
|
useEffect4(() => {
|
|
739
573
|
if (mapInitialized) {
|
|
740
|
-
const { fitToPoints:
|
|
574
|
+
const { fitToPoints: fitToPoints2 } = mapSettings || {};
|
|
741
575
|
if (map) {
|
|
742
|
-
if (
|
|
576
|
+
if (fitToPoints2?.value === true) {
|
|
743
577
|
MapHeat.initialMapPositioning({
|
|
744
578
|
padding: {
|
|
745
579
|
bottom: fitToPadding,
|
|
@@ -777,35 +611,6 @@ var useHeatMapInitializer = /* @__PURE__ */ __name(() => {
|
|
|
777
611
|
return context;
|
|
778
612
|
}, "useHeatMapInitializer");
|
|
779
613
|
|
|
780
|
-
// src/Contexts/MapboxAccessToken/Context.ts
|
|
781
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
782
|
-
var MapboxAccessTokenContext = createContextEx();
|
|
783
|
-
|
|
784
|
-
// src/Contexts/MapboxAccessToken/Provider.tsx
|
|
785
|
-
import React4, { useMemo as useMemo8, useState as useState4 } from "react";
|
|
786
|
-
var MapboxAccessTokenProvider = /* @__PURE__ */ __name(({ defaultAccessToken, ...props }) => {
|
|
787
|
-
const [accessToken, setAccessToken] = useState4();
|
|
788
|
-
const value = useMemo8(() => ({
|
|
789
|
-
accessToken: accessToken ?? defaultAccessToken,
|
|
790
|
-
provided: true,
|
|
791
|
-
setAccessToken
|
|
792
|
-
}), [
|
|
793
|
-
accessToken,
|
|
794
|
-
defaultAccessToken,
|
|
795
|
-
setAccessToken
|
|
796
|
-
]);
|
|
797
|
-
return /* @__PURE__ */ React4.createElement(MapboxAccessTokenContext.Provider, {
|
|
798
|
-
value,
|
|
799
|
-
...props
|
|
800
|
-
});
|
|
801
|
-
}, "MapboxAccessTokenProvider");
|
|
802
|
-
|
|
803
|
-
// src/Contexts/MapboxAccessToken/use.ts
|
|
804
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
805
|
-
var useMapboxAccessToken = /* @__PURE__ */ __name((required = false) => {
|
|
806
|
-
return useContextEx(MapboxAccessTokenContext, "MapboxAccessToken", required);
|
|
807
|
-
}, "useMapboxAccessToken");
|
|
808
|
-
|
|
809
614
|
// src/Layers/Configs/HeatMapFillLayerConfig.ts
|
|
810
615
|
var HeatMapFillLayerConfig = /* @__PURE__ */ __name((color) => ({
|
|
811
616
|
paint: {
|
|
@@ -1032,11 +837,11 @@ var LocationHeatMapLayerBuilder = /* @__PURE__ */ __name((color, alternateColor
|
|
|
1032
837
|
const debugLayerConfig = HeatMapSymbolLayerConfig(alternateColor);
|
|
1033
838
|
const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig);
|
|
1034
839
|
const lineLayer = new LineLayerBuilder(LocationLineLayerId, LocationLineLayerSource, lineLayerConfig);
|
|
1035
|
-
const
|
|
840
|
+
const debugLayer2 = new SymbolLayerBuilder(LocationDebugLayerId, LocationDebugLayerSource, debugLayerConfig);
|
|
1036
841
|
return [
|
|
1037
842
|
fillLayer,
|
|
1038
843
|
lineLayer,
|
|
1039
|
-
|
|
844
|
+
debugLayer2
|
|
1040
845
|
];
|
|
1041
846
|
}, "LocationHeatMapLayerBuilder");
|
|
1042
847
|
|
|
@@ -1109,27 +914,15 @@ var LocationPointsMapLayerBuilder = /* @__PURE__ */ __name((color, circleRadius
|
|
|
1109
914
|
|
|
1110
915
|
// src/Components/MapBoxHeat.tsx
|
|
1111
916
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
1112
|
-
import
|
|
917
|
+
import React7 from "react";
|
|
1113
918
|
|
|
1114
919
|
// src/Components/MapBox.tsx
|
|
1115
920
|
import "mapbox-gl/dist/mapbox-gl.css";
|
|
921
|
+
import { MapStyle } from "@xyo-network/react-map-model";
|
|
1116
922
|
import { Map } from "mapbox-gl";
|
|
1117
|
-
import
|
|
1118
|
-
|
|
1119
|
-
// src/lib/MapStyle.ts
|
|
1120
|
-
var MapStyle = /* @__PURE__ */ function(MapStyle2) {
|
|
1121
|
-
MapStyle2["Dark"] = "mapbox/dark-v10";
|
|
1122
|
-
MapStyle2["Light"] = "mapbox/light-v10";
|
|
1123
|
-
MapStyle2["Outdoors"] = "mapbox/outdoors-v11";
|
|
1124
|
-
MapStyle2["Satellite"] = "mapbox/satellite-v9";
|
|
1125
|
-
MapStyle2["SatelliteStreets"] = "mapbox/satellite-streets-v11";
|
|
1126
|
-
MapStyle2["Streets"] = "mapbox/streets-v11";
|
|
1127
|
-
return MapStyle2;
|
|
1128
|
-
}({});
|
|
1129
|
-
|
|
1130
|
-
// src/Components/MapBox.tsx
|
|
923
|
+
import React4, { useEffect as useEffect5, useRef, useState as useState3 } from "react";
|
|
1131
924
|
var MapBox = /* @__PURE__ */ __name(({ accessToken, darkMode = false, options, zoom = 2, ...props }) => {
|
|
1132
|
-
const [map, setMap] =
|
|
925
|
+
const [map, setMap] = useState3();
|
|
1133
926
|
const mapContainerRef = useRef(null);
|
|
1134
927
|
const mapCanvasRef = useRef(null);
|
|
1135
928
|
const { setMapBoxInstance, map: mapInstance } = useMapBoxInstance();
|
|
@@ -1175,7 +968,7 @@ var MapBox = /* @__PURE__ */ __name(({ accessToken, darkMode = false, options, z
|
|
|
1175
968
|
setMapBoxInstance,
|
|
1176
969
|
accessToken
|
|
1177
970
|
]);
|
|
1178
|
-
return /* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1179
972
|
ref: /* @__PURE__ */ __name((el) => mapContainerRef.current = el, "ref"),
|
|
1180
973
|
style: {
|
|
1181
974
|
bottom: 0,
|
|
@@ -1190,7 +983,7 @@ var MapBox = /* @__PURE__ */ __name(({ accessToken, darkMode = false, options, z
|
|
|
1190
983
|
|
|
1191
984
|
// src/Components/MapSettingsComponents/Setting.tsx
|
|
1192
985
|
import { FormControlLabel, Switch } from "@mui/material";
|
|
1193
|
-
import
|
|
986
|
+
import React5 from "react";
|
|
1194
987
|
var MapSettingSwitch = /* @__PURE__ */ __name(({ developerMode, field, ...props }) => {
|
|
1195
988
|
const { mapSettings, setMapSettings } = useMapSettings();
|
|
1196
989
|
const setting = mapSettings?.[field];
|
|
@@ -1207,9 +1000,9 @@ var MapSettingSwitch = /* @__PURE__ */ __name(({ developerMode, field, ...props
|
|
|
1207
1000
|
if (setting?.devMode && developerMode === false) {
|
|
1208
1001
|
return null;
|
|
1209
1002
|
}
|
|
1210
|
-
return setting?.hidden ? null : /* @__PURE__ */
|
|
1003
|
+
return setting?.hidden ? null : /* @__PURE__ */ React5.createElement(FormControlLabel, {
|
|
1211
1004
|
label: setting?.label,
|
|
1212
|
-
control: /* @__PURE__ */
|
|
1005
|
+
control: /* @__PURE__ */ React5.createElement(Switch, {
|
|
1213
1006
|
checked: setting?.value,
|
|
1214
1007
|
onChange: onLocalChange,
|
|
1215
1008
|
...props
|
|
@@ -1221,24 +1014,24 @@ var MapSettingSwitch = /* @__PURE__ */ __name(({ developerMode, field, ...props
|
|
|
1221
1014
|
import { Paper, Stack } from "@mui/material";
|
|
1222
1015
|
import { useAppSettings } from "@xylabs/react-app-settings";
|
|
1223
1016
|
import { FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
|
|
1224
|
-
import
|
|
1017
|
+
import React6 from "react";
|
|
1225
1018
|
var MapSettingsBox = /* @__PURE__ */ __name(({ developerMode, ...props }) => {
|
|
1226
1019
|
const { mapSettings } = useMapSettings();
|
|
1227
1020
|
const { developerMode: devModeFromContext } = useAppSettings();
|
|
1228
1021
|
const resolveDeveloperMode = developerMode ?? devModeFromContext;
|
|
1229
|
-
return mapSettings && resolveDeveloperMode ? /* @__PURE__ */
|
|
1022
|
+
return mapSettings && resolveDeveloperMode ? /* @__PURE__ */ React6.createElement(FlexGrowRow, {
|
|
1230
1023
|
bottom: 36,
|
|
1231
1024
|
left: 10,
|
|
1232
1025
|
position: "absolute",
|
|
1233
1026
|
...props
|
|
1234
|
-
}, /* @__PURE__ */
|
|
1027
|
+
}, /* @__PURE__ */ React6.createElement(FlexRow, {
|
|
1235
1028
|
paddingX: 2
|
|
1236
|
-
}, /* @__PURE__ */
|
|
1029
|
+
}, /* @__PURE__ */ React6.createElement(Paper, null, /* @__PURE__ */ React6.createElement(Stack, {
|
|
1237
1030
|
direction: "row",
|
|
1238
1031
|
spacing: 1,
|
|
1239
1032
|
marginX: 1
|
|
1240
1033
|
}, Object.keys(mapSettings).map((key, index) => {
|
|
1241
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ React6.createElement(MapSettingSwitch, {
|
|
1242
1035
|
key: index,
|
|
1243
1036
|
field: mapSettings[key].field,
|
|
1244
1037
|
developerMode
|
|
@@ -1248,29 +1041,29 @@ var MapSettingsBox = /* @__PURE__ */ __name(({ developerMode, ...props }) => {
|
|
|
1248
1041
|
|
|
1249
1042
|
// src/Components/MapBoxHeat.tsx
|
|
1250
1043
|
var MapboxHeatFlexBox = /* @__PURE__ */ __name(({ accessToken, children, mapBoxOptions, zoom, legend, developerMode, ...props }) => {
|
|
1251
|
-
return /* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ React7.createElement(FlexCol, props, /* @__PURE__ */ React7.createElement(MapBox, {
|
|
1252
1045
|
accessToken,
|
|
1253
1046
|
options: mapBoxOptions,
|
|
1254
1047
|
zoom
|
|
1255
|
-
}), /* @__PURE__ */
|
|
1048
|
+
}), /* @__PURE__ */ React7.createElement(MapSettingsBox, {
|
|
1256
1049
|
developerMode
|
|
1257
1050
|
}), legend, children);
|
|
1258
1051
|
}, "MapboxHeatFlexBox");
|
|
1259
1052
|
|
|
1260
1053
|
// src/Components/AnimatedHeatMap.tsx
|
|
1261
1054
|
var AnimatedHeatMap = /* @__PURE__ */ __name(({ accessToken, animatedFeatureSets, defaultMapSettings, heatMapColorProps, staticFeatureSet, ...props }) => {
|
|
1262
|
-
const theme =
|
|
1055
|
+
const theme = useTheme();
|
|
1263
1056
|
const { staticMapColor, lowUsageColor, highUsageColor } = heatMapColorProps || {};
|
|
1264
1057
|
const localStaticMapColor = staticMapColor ?? theme.palette.primary.light;
|
|
1265
|
-
const [layers] =
|
|
1058
|
+
const [layers] = useState4(() => [
|
|
1266
1059
|
LocationHeatMapLayerBuilderAnimated(localStaticMapColor, 0, "static"),
|
|
1267
1060
|
LocationHeatMapLayerBuilderAnimated(lowUsageColor || localStaticMapColor, 0, "animated"),
|
|
1268
1061
|
LocationHeatMapLayerBuilderAnimated(highUsageColor || darken(localStaticMapColor, 0.9), 1, "animated")
|
|
1269
1062
|
]);
|
|
1270
|
-
return animatedFeatureSets?.length ? /* @__PURE__ */
|
|
1063
|
+
return animatedFeatureSets?.length ? /* @__PURE__ */ React8.createElement(MapBoxInstanceProvider, null, /* @__PURE__ */ React8.createElement(MapSettingsProvider, {
|
|
1271
1064
|
defaultMapSettings,
|
|
1272
1065
|
debugLayerName: MapHeatConstants.LocationDebugLayerId
|
|
1273
|
-
}, /* @__PURE__ */
|
|
1066
|
+
}, /* @__PURE__ */ React8.createElement(HeatMapInitializerProvider, {
|
|
1274
1067
|
features: staticFeatureSet,
|
|
1275
1068
|
layers: [
|
|
1276
1069
|
layers[0]
|
|
@@ -1278,10 +1071,10 @@ var AnimatedHeatMap = /* @__PURE__ */ __name(({ accessToken, animatedFeatureSets
|
|
|
1278
1071
|
featureSets: animatedFeatureSets,
|
|
1279
1072
|
featureSetsLayers: layers.slice(1, 3),
|
|
1280
1073
|
heatMapColorProps
|
|
1281
|
-
}, /* @__PURE__ */
|
|
1074
|
+
}, /* @__PURE__ */ React8.createElement(MapboxHeatFlexBox, {
|
|
1282
1075
|
accessToken,
|
|
1283
1076
|
...props
|
|
1284
|
-
})))) : /* @__PURE__ */
|
|
1077
|
+
})))) : /* @__PURE__ */ React8.createElement(FlexCol2, {
|
|
1285
1078
|
minHeight: 160,
|
|
1286
1079
|
minWidth: 160,
|
|
1287
1080
|
busy: true
|
|
@@ -1292,42 +1085,43 @@ var AnimatedHeatMap = /* @__PURE__ */ __name(({ accessToken, animatedFeatureSets
|
|
|
1292
1085
|
import { Alert, AlertTitle } from "@mui/material";
|
|
1293
1086
|
import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
|
|
1294
1087
|
import { useWeakArchivistFromNode, useWeakArchivistGet } from "@xyo-network/react-archivist";
|
|
1295
|
-
import
|
|
1088
|
+
import { AnimatedHeatMapSettings, useFindHashes, useHeatMapColors, useQuadKeyPayloadsToFeatures } from "@xyo-network/react-map-model";
|
|
1089
|
+
import React11 from "react";
|
|
1296
1090
|
|
|
1297
1091
|
// src/Components/Legend.tsx
|
|
1298
|
-
import { useMediaQuery, useTheme as
|
|
1092
|
+
import { useMediaQuery, useTheme as useTheme3 } from "@mui/material";
|
|
1299
1093
|
import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
|
|
1300
|
-
import
|
|
1094
|
+
import React10 from "react";
|
|
1301
1095
|
|
|
1302
1096
|
// src/Components/Legends/ColorGradient.tsx
|
|
1303
|
-
import { Typography, useTheme as
|
|
1097
|
+
import { Typography, useTheme as useTheme2 } from "@mui/material";
|
|
1304
1098
|
import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
1305
|
-
import
|
|
1099
|
+
import React9 from "react";
|
|
1306
1100
|
var ColorGradientLegend = /* @__PURE__ */ __name(({ startColor, endColor, startLabel, endLabel, heading, textColor, ...props }) => {
|
|
1307
|
-
const theme =
|
|
1308
|
-
return /* @__PURE__ */
|
|
1101
|
+
const theme = useTheme2();
|
|
1102
|
+
return /* @__PURE__ */ React9.createElement(FlexCol3, props, /* @__PURE__ */ React9.createElement(Typography, {
|
|
1309
1103
|
mb: theme.spacing(0.25),
|
|
1310
1104
|
color: textColor,
|
|
1311
1105
|
variant: "caption",
|
|
1312
1106
|
textAlign: "center"
|
|
1313
|
-
}, heading), /* @__PURE__ */
|
|
1107
|
+
}, heading), /* @__PURE__ */ React9.createElement(FlexCol3, {
|
|
1314
1108
|
flexGrow: 1,
|
|
1315
1109
|
alignItems: "stretch",
|
|
1316
1110
|
paddingX: theme.spacing(1),
|
|
1317
1111
|
mb: theme.spacing(0.25)
|
|
1318
|
-
}, /* @__PURE__ */
|
|
1112
|
+
}, /* @__PURE__ */ React9.createElement(FlexCol3, {
|
|
1319
1113
|
height: theme.spacing(0.75),
|
|
1320
1114
|
border: `1px solid ${textColor}`,
|
|
1321
1115
|
sx: {
|
|
1322
1116
|
backgroundImage: `linear-gradient(to right, ${startColor},${endColor})`
|
|
1323
1117
|
}
|
|
1324
|
-
})), /* @__PURE__ */
|
|
1118
|
+
})), /* @__PURE__ */ React9.createElement(FlexRow2, {
|
|
1325
1119
|
flexGrow: 1,
|
|
1326
1120
|
justifyContent: "space-between"
|
|
1327
|
-
}, /* @__PURE__ */
|
|
1121
|
+
}, /* @__PURE__ */ React9.createElement(Typography, {
|
|
1328
1122
|
color: textColor,
|
|
1329
1123
|
variant: "caption"
|
|
1330
|
-
}, startLabel), /* @__PURE__ */
|
|
1124
|
+
}, startLabel), /* @__PURE__ */ React9.createElement(Typography, {
|
|
1331
1125
|
color: textColor,
|
|
1332
1126
|
variant: "caption"
|
|
1333
1127
|
}, endLabel)));
|
|
@@ -1336,13 +1130,13 @@ var ColorGradientLegend = /* @__PURE__ */ __name(({ startColor, endColor, startL
|
|
|
1336
1130
|
// src/Components/Legend.tsx
|
|
1337
1131
|
var AnimatedHeatMapLegend = /* @__PURE__ */ __name(({ ...legendProps }) => {
|
|
1338
1132
|
const { startColor, endColor, startLabel, endLabel, heading, textColor } = legendProps;
|
|
1339
|
-
const theme =
|
|
1133
|
+
const theme = useTheme3();
|
|
1340
1134
|
const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
|
|
1341
|
-
return /* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ React10.createElement(FlexCol4, {
|
|
1342
1136
|
position: "absolute",
|
|
1343
1137
|
bottom: 0,
|
|
1344
1138
|
right: 0
|
|
1345
|
-
}, /* @__PURE__ */
|
|
1139
|
+
}, /* @__PURE__ */ React10.createElement(ColorGradientLegend, {
|
|
1346
1140
|
startColor,
|
|
1347
1141
|
endColor,
|
|
1348
1142
|
startLabel,
|
|
@@ -1366,16 +1160,16 @@ var AnimatedHeatMapLoaded = /* @__PURE__ */ __name(({ accessToken, archivistName
|
|
|
1366
1160
|
const { heatMapColorProps, legendProps } = useHeatMapColors();
|
|
1367
1161
|
const MapBoxHeatProps = {
|
|
1368
1162
|
flexGrow: 1,
|
|
1369
|
-
legend: legendProps ? /* @__PURE__ */
|
|
1163
|
+
legend: legendProps ? /* @__PURE__ */ React11.createElement(AnimatedHeatMapLegend, legendProps) : null
|
|
1370
1164
|
};
|
|
1371
|
-
return /* @__PURE__ */
|
|
1165
|
+
return /* @__PURE__ */ React11.createElement(FlexCol5, {
|
|
1372
1166
|
alignItems: "stretch",
|
|
1373
1167
|
...props
|
|
1374
|
-
}, xyoError ? /* @__PURE__ */
|
|
1168
|
+
}, xyoError ? /* @__PURE__ */ React11.createElement(Alert, {
|
|
1375
1169
|
sx: {
|
|
1376
1170
|
mt: 2
|
|
1377
1171
|
}
|
|
1378
|
-
}, /* @__PURE__ */
|
|
1172
|
+
}, /* @__PURE__ */ React11.createElement(AlertTitle, null, "Error Loading Map"), xyoError.message ? `Error: ${xyoError.message}` : null, "You might try authenticating again.") : null, hashes === void 0 ? /* @__PURE__ */ React11.createElement(Alert, null, "Missing answer hash for heat map query") : /* @__PURE__ */ React11.createElement(AnimatedHeatMap, {
|
|
1379
1173
|
accessToken,
|
|
1380
1174
|
defaultMapSettings: AnimatedHeatMapSettings,
|
|
1381
1175
|
animatedFeatureSets: multipleFeatureSets.slice(1),
|
|
@@ -1386,20 +1180,21 @@ var AnimatedHeatMapLoaded = /* @__PURE__ */ __name(({ accessToken, archivistName
|
|
|
1386
1180
|
}, "AnimatedHeatMapLoaded");
|
|
1387
1181
|
|
|
1388
1182
|
// src/Components/HeatMapSettings.ts
|
|
1183
|
+
import { DefaultMapSettings } from "@xyo-network/react-map-model";
|
|
1389
1184
|
var HeatMapSettings = DefaultMapSettings();
|
|
1390
|
-
var { debugLayer
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1185
|
+
var { debugLayer, scrollToZoom, fitToPoints } = HeatMapSettings;
|
|
1186
|
+
debugLayer.hidden = false;
|
|
1187
|
+
scrollToZoom.value = true;
|
|
1188
|
+
fitToPoints.value = true;
|
|
1394
1189
|
|
|
1395
1190
|
// src/Components/LayerAnimator.tsx
|
|
1396
1191
|
import { useInterval } from "@xylabs/react-shared";
|
|
1397
|
-
import
|
|
1192
|
+
import React12, { useCallback, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef2 } from "react";
|
|
1398
1193
|
var timeIncrement = 2e3;
|
|
1399
1194
|
var animatedLayerCount = 3;
|
|
1400
1195
|
var LayerAnimator = /* @__PURE__ */ __name(({ animateLayers, children, layers, layersInitialized, map }) => {
|
|
1401
1196
|
const layerIndexQueue = useRef2([]);
|
|
1402
|
-
const fillLayers =
|
|
1197
|
+
const fillLayers = useMemo6(() => {
|
|
1403
1198
|
if (layers?.length && map && layersInitialized) {
|
|
1404
1199
|
return layers.filter((layer) => {
|
|
1405
1200
|
const fillLayer = layer.id.startsWith("location-fill");
|
|
@@ -1499,13 +1294,13 @@ var LayerAnimator = /* @__PURE__ */ __name(({ animateLayers, children, layers, l
|
|
|
1499
1294
|
queueLayerAnimation();
|
|
1500
1295
|
}
|
|
1501
1296
|
}, timeIncrement * animatedLayerCount);
|
|
1502
|
-
return /* @__PURE__ */
|
|
1297
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, children);
|
|
1503
1298
|
}, "LayerAnimator");
|
|
1504
1299
|
|
|
1505
1300
|
// src/Components/MapBoxPoints.tsx
|
|
1506
1301
|
import { Alert as Alert2 } from "@mui/material";
|
|
1507
1302
|
import { FlexCol as FlexCol6 } from "@xylabs/react-flexbox";
|
|
1508
|
-
import
|
|
1303
|
+
import React13, { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMemo7 } from "react";
|
|
1509
1304
|
var MapboxPointsFlexBox = /* @__PURE__ */ __name(({ accessToken, features, fitToPointsPadding = 20, layers, zoom, ...props }) => {
|
|
1510
1305
|
const { mapSettings } = useMapSettings();
|
|
1511
1306
|
const { map, mapInitialized } = useMapBoxInstance();
|
|
@@ -1517,7 +1312,7 @@ var MapboxPointsFlexBox = /* @__PURE__ */ __name(({ accessToken, features, fitTo
|
|
|
1517
1312
|
}
|
|
1518
1313
|
return {};
|
|
1519
1314
|
}, "customFitToBoundsOptions");
|
|
1520
|
-
const mapPoints =
|
|
1315
|
+
const mapPoints = useMemo7(() => {
|
|
1521
1316
|
return map && features?.length ? new MapPoints({
|
|
1522
1317
|
features,
|
|
1523
1318
|
map,
|
|
@@ -1538,8 +1333,8 @@ var MapboxPointsFlexBox = /* @__PURE__ */ __name(({ accessToken, features, fitTo
|
|
|
1538
1333
|
layers
|
|
1539
1334
|
]);
|
|
1540
1335
|
const updateMapSetup = useCallback2(() => {
|
|
1541
|
-
const { fitToPoints:
|
|
1542
|
-
if (mapPoints && map &&
|
|
1336
|
+
const { fitToPoints: fitToPoints2 } = mapSettings || {};
|
|
1337
|
+
if (mapPoints && map && fitToPoints2?.value === true) {
|
|
1543
1338
|
mapPoints.initialMapPositioning({
|
|
1544
1339
|
padding: {
|
|
1545
1340
|
bottom: fitToPointsPadding,
|
|
@@ -1584,34 +1379,23 @@ var MapboxPointsFlexBox = /* @__PURE__ */ __name(({ accessToken, features, fitTo
|
|
|
1584
1379
|
reInitializeMap,
|
|
1585
1380
|
updateMapSetup
|
|
1586
1381
|
]);
|
|
1587
|
-
return /* @__PURE__ */
|
|
1382
|
+
return /* @__PURE__ */ React13.createElement(FlexCol6, {
|
|
1588
1383
|
alignItems: "stretch",
|
|
1589
1384
|
id: "xyo-mapbox-wrap",
|
|
1590
1385
|
...props
|
|
1591
|
-
}, features ? /* @__PURE__ */
|
|
1386
|
+
}, features ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(MapBox, {
|
|
1592
1387
|
accessToken,
|
|
1593
1388
|
zoom
|
|
1594
|
-
}), /* @__PURE__ */
|
|
1389
|
+
}), /* @__PURE__ */ React13.createElement(MapSettingsBox, null)) : /* @__PURE__ */ React13.createElement(Alert2, {
|
|
1595
1390
|
severity: "error"
|
|
1596
1391
|
}, "No data to show"));
|
|
1597
1392
|
}, "MapboxPointsFlexBox");
|
|
1598
|
-
|
|
1599
|
-
// src/types/NetworkLocationAnswerBase.ts
|
|
1600
|
-
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
1601
|
-
var NetworkLocationAnswerSchema = "network.xyo.location.range.answer";
|
|
1602
|
-
var isNetworkLocationAnswer = isPayloadOfSchemaType(NetworkLocationAnswerSchema);
|
|
1603
|
-
var NetworkLocationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
|
|
1604
|
-
var isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType(NetworkLocationHeatmapAnswerSchema);
|
|
1605
|
-
var NetworkLocationHeatmapQuadkeyAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
|
|
1606
|
-
var isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType(NetworkLocationHeatmapQuadkeyAnswerSchema);
|
|
1607
1393
|
export {
|
|
1608
1394
|
AnimatedHeatMap,
|
|
1609
1395
|
AnimatedHeatMapLegend,
|
|
1610
1396
|
AnimatedHeatMapLoaded,
|
|
1611
|
-
AnimatedHeatMapSettings,
|
|
1612
1397
|
CircleLayerBuilder,
|
|
1613
1398
|
ColorGradientLegend,
|
|
1614
|
-
DefaultMapSettings,
|
|
1615
1399
|
FillLayerBuilder,
|
|
1616
1400
|
HeatMapFillLayerConfig,
|
|
1617
1401
|
HeatMapInitializerProvider,
|
|
@@ -1635,26 +1419,13 @@ export {
|
|
|
1635
1419
|
MapSettings,
|
|
1636
1420
|
MapSettingsBox,
|
|
1637
1421
|
MapSettingsProvider,
|
|
1638
|
-
MapStyle,
|
|
1639
|
-
MapboxAccessTokenContext,
|
|
1640
|
-
MapboxAccessTokenProvider,
|
|
1641
1422
|
MapboxHeatFlexBox,
|
|
1642
1423
|
MapboxPointsFlexBox,
|
|
1643
|
-
NetworkLocationAnswerSchema,
|
|
1644
|
-
NetworkLocationHeatmapAnswerSchema,
|
|
1645
|
-
NetworkLocationHeatmapQuadkeyAnswerSchema,
|
|
1646
1424
|
SymbolLayerBuilder,
|
|
1647
|
-
isNetworkLocationAnswer,
|
|
1648
|
-
isNetworkLocationHeatmapAnswer,
|
|
1649
|
-
isNetworkLocationHeatmapQuadkeyAnswer,
|
|
1650
1425
|
useDynamicMapResize,
|
|
1651
1426
|
useDynamicPositioning,
|
|
1652
|
-
useFindHashes,
|
|
1653
|
-
useHeatMapColors,
|
|
1654
1427
|
useHeatMapInitializer,
|
|
1655
1428
|
useMapBoxInstance,
|
|
1656
|
-
useMapSettings
|
|
1657
|
-
useMapboxAccessToken,
|
|
1658
|
-
useQuadKeyPayloadsToFeatures
|
|
1429
|
+
useMapSettings
|
|
1659
1430
|
};
|
|
1660
1431
|
//# sourceMappingURL=index.mjs.map
|