@xyo-network/react-map-model 7.5.8 → 7.5.11
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/index.mjs +31 -36
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/settings/MapSetting.d.ts +12 -14
- package/dist/browser/settings/MapSetting.d.ts.map +1 -1
- package/package.json +56 -26
- 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 -24
- 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/contexts/index.ts +0 -1
- package/src/global.d.ts +0 -1
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useFindHashes.tsx +0 -29
- package/src/hooks/useHeatMapColors.tsx +0 -28
- package/src/index.ts +0 -7
- package/src/lib/MapStyle.ts +0 -13
- package/src/lib/index.ts +0 -1
- package/src/settings/DefaultMapSettings.ts +0 -53
- package/src/settings/MapSetting.ts +0 -16
- package/src/settings/index.ts +0 -2
- package/src/types/NetworkLocationAnswerBase.ts +0 -32
- package/src/types/index.ts +0 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/settings/DefaultMapSettings.ts
|
|
5
|
-
var DefaultMapSettings =
|
|
2
|
+
var DefaultMapSettings = () => ({
|
|
6
3
|
debugLayer: {
|
|
7
4
|
devMode: true,
|
|
8
5
|
field: "debugLayer",
|
|
@@ -52,11 +49,16 @@ var DefaultMapSettings = /* @__PURE__ */ __name(() => ({
|
|
|
52
49
|
label: "Scroll To Zoom",
|
|
53
50
|
value: false
|
|
54
51
|
}
|
|
55
|
-
})
|
|
52
|
+
});
|
|
56
53
|
|
|
57
54
|
// src/AnimatedHeatMapSettings.ts
|
|
58
55
|
var AnimatedHeatMapSettings = DefaultMapSettings();
|
|
59
|
-
var {
|
|
56
|
+
var {
|
|
57
|
+
debugLayer,
|
|
58
|
+
scrollToZoom,
|
|
59
|
+
fitToPoints,
|
|
60
|
+
preferDark
|
|
61
|
+
} = AnimatedHeatMapSettings;
|
|
60
62
|
debugLayer.hidden = false;
|
|
61
63
|
scrollToZoom.value = true;
|
|
62
64
|
fitToPoints.value = false;
|
|
@@ -67,29 +69,29 @@ import { createContextEx } from "@xylabs/react-shared";
|
|
|
67
69
|
var MapboxAccessTokenContext = createContextEx();
|
|
68
70
|
|
|
69
71
|
// src/contexts/MapboxAccessToken/Provider.tsx
|
|
70
|
-
import
|
|
71
|
-
|
|
72
|
+
import { useMemo, useState } from "react";
|
|
73
|
+
import { jsx } from "react/jsx-runtime";
|
|
74
|
+
var MapboxAccessTokenProvider = ({ defaultAccessToken, ...props }) => {
|
|
72
75
|
const [accessToken, setAccessToken] = useState();
|
|
73
76
|
const value = useMemo(() => ({
|
|
74
77
|
accessToken: accessToken ?? defaultAccessToken,
|
|
75
78
|
provided: true,
|
|
76
79
|
setAccessToken
|
|
77
|
-
}), [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, "MapboxAccessTokenProvider");
|
|
80
|
+
}), [accessToken, defaultAccessToken, setAccessToken]);
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
82
|
+
MapboxAccessTokenContext,
|
|
83
|
+
{
|
|
84
|
+
value,
|
|
85
|
+
...props
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
};
|
|
87
89
|
|
|
88
90
|
// src/contexts/MapboxAccessToken/use.ts
|
|
89
91
|
import { useContextEx } from "@xylabs/react-shared";
|
|
90
|
-
var useMapboxAccessToken =
|
|
92
|
+
var useMapboxAccessToken = (required = false) => {
|
|
91
93
|
return useContextEx(MapboxAccessTokenContext, "MapboxAccessToken", required);
|
|
92
|
-
}
|
|
94
|
+
};
|
|
93
95
|
|
|
94
96
|
// src/hooks/useFindHashes.tsx
|
|
95
97
|
import { useNetwork } from "@xyo-network/react-network";
|
|
@@ -108,24 +110,18 @@ var animatedAnswerHashesConst = [
|
|
|
108
110
|
"32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,"
|
|
109
111
|
];
|
|
110
112
|
var staticAnswerHashConst = "c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5";
|
|
111
|
-
var useFindHashes =
|
|
113
|
+
var useFindHashes = () => {
|
|
112
114
|
const { network } = useNetwork();
|
|
113
115
|
const exploreMapHashes = network?.nodes?.find((node) => node.type === "archivist")?.explorerMapHashes;
|
|
114
116
|
const animatedAnswerHashes = exploreMapHashes?.animatedAnswerHashes || animatedAnswerHashesConst;
|
|
115
117
|
const staticAnswerHash = exploreMapHashes?.staticAnswerHash || staticAnswerHashConst;
|
|
116
|
-
const foundHashes = useMemo2(() => [
|
|
117
|
-
staticAnswerHash,
|
|
118
|
-
...animatedAnswerHashes
|
|
119
|
-
], [
|
|
120
|
-
animatedAnswerHashes,
|
|
121
|
-
staticAnswerHash
|
|
122
|
-
]);
|
|
118
|
+
const foundHashes = useMemo2(() => [staticAnswerHash, ...animatedAnswerHashes], [animatedAnswerHashes, staticAnswerHash]);
|
|
123
119
|
return foundHashes;
|
|
124
|
-
}
|
|
120
|
+
};
|
|
125
121
|
|
|
126
122
|
// src/hooks/useHeatMapColors.tsx
|
|
127
123
|
import { useTheme } from "@mui/material";
|
|
128
|
-
var useHeatMapColors =
|
|
124
|
+
var useHeatMapColors = () => {
|
|
129
125
|
const theme = useTheme();
|
|
130
126
|
const staticMapColor = "#FFFF75";
|
|
131
127
|
const highUsageColor = "#FF0000";
|
|
@@ -142,11 +138,8 @@ var useHeatMapColors = /* @__PURE__ */ __name(() => {
|
|
|
142
138
|
startLabel: "Low",
|
|
143
139
|
textColor: theme.vars.palette.common.white
|
|
144
140
|
};
|
|
145
|
-
return {
|
|
146
|
-
|
|
147
|
-
legendProps
|
|
148
|
-
};
|
|
149
|
-
}, "useHeatMapColors");
|
|
141
|
+
return { heatMapColorProps, legendProps };
|
|
142
|
+
};
|
|
150
143
|
|
|
151
144
|
// src/lib/MapStyle.ts
|
|
152
145
|
import { Enum } from "@xylabs/sdk-js";
|
|
@@ -166,7 +159,9 @@ var isNetworkLocationAnswer = isPayloadOfSchemaType(NetworkLocationAnswerSchema)
|
|
|
166
159
|
var NetworkLocationHeatmapAnswerSchema = asSchema("network.xyo.location.heatmap.answer", true);
|
|
167
160
|
var isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType(NetworkLocationHeatmapAnswerSchema);
|
|
168
161
|
var NetworkLocationHeatmapQuadkeyAnswerSchema = asSchema("network.xyo.location.heatmap.quadkey.answer", true);
|
|
169
|
-
var isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType(
|
|
162
|
+
var isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType(
|
|
163
|
+
NetworkLocationHeatmapQuadkeyAnswerSchema
|
|
164
|
+
);
|
|
170
165
|
export {
|
|
171
166
|
AnimatedHeatMapSettings,
|
|
172
167
|
DefaultMapSettings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/settings/DefaultMapSettings.ts","../../src/AnimatedHeatMapSettings.ts","../../src/contexts/MapboxAccessToken/Context.ts","../../src/contexts/MapboxAccessToken/Provider.tsx","../../src/contexts/MapboxAccessToken/use.ts","../../src/hooks/useFindHashes.tsx","../../src/hooks/useHeatMapColors.tsx","../../src/lib/MapStyle.ts","../../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 { createContextEx } from '@xylabs/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'\nimport type { MapboxAccessTokenContextState } from './State.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: MapboxAccessTokenContextState = useMemo(() => ({\n accessToken: accessToken ?? defaultAccessToken, provided: true, setAccessToken,\n }), [accessToken, defaultAccessToken, setAccessToken])\n\n return (\n <MapboxAccessTokenContext\n value={value}\n {...props}\n />\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { MapboxAccessTokenContext } from './Context.ts'\n\nexport const useMapboxAccessToken = (required = false) => {\n return useContextEx(MapboxAccessTokenContext, 'MapboxAccessToken', required)\n}\n","import type { Hash } from '@xylabs/sdk-js'\nimport type { ArchivistPreset } from '@xyo-network/react-network'\nimport { useNetwork } from '@xyo-network/react-network'\nimport { useMemo } from 'react'\n\nconst animatedAnswerHashesConst = [\n '79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',\n '531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',\n 'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',\n '29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e',\n 'cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c',\n '1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d',\n '1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9',\n '973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9',\n '463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',\n '15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',\n '32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',\n] as Hash[]\n\nconst staticAnswerHashConst = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5' as Hash\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.vars.palette.common.white,\n }\n\n return { heatMapColorProps, legendProps }\n}\n\nexport { useHeatMapColors }\n","import type { EnumValue } from '@xylabs/sdk-js'\nimport { Enum } from '@xylabs/sdk-js'\n\nexport const MapStyle = Enum({\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\nexport type MapStyle = EnumValue<typeof MapStyle>\n","import type { Payload } from '@xyo-network/payload-model'\nimport { asSchema, 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 = asSchema('network.xyo.location.range.answer', true)\nexport type NetworkLocationAnswerSchema = typeof NetworkLocationAnswerSchema\nexport type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>\nexport const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)\n\nexport const NetworkLocationHeatmapAnswerSchema = asSchema('network.xyo.location.heatmap.answer', true)\nexport type NetworkLocationHeatmapAnswerSchema = typeof NetworkLocationHeatmapAnswerSchema\nexport type NetworkLocationHeatmapAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,\n NetworkLocationHeatmapAnswerSchema\n>\nexport const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)\n\nexport const NetworkLocationHeatmapQuadkeyAnswerSchema = asSchema('network.xyo.location.heatmap.quadkey.answer', true)\nexport type NetworkLocationHeatmapQuadkeyAnswerSchema = typeof NetworkLocationHeatmapQuadkeyAnswerSchema\nexport type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,\n NetworkLocationHeatmapQuadkeyAnswerSchema\n>\nexport const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapQuadkeyAnswerPayload>(\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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BAAgB;AAIzB,IAAMC,mBAAmB,6BAAA;AACvB,QAAMC,QAAQC,SAAAA;AACd,QAAMC,iBAAiB;AACvB,QAAMC,iBAAiB;AAEvB,QAAMC,oBAA+C;IACnDD;IACAE,eAAe;IACfH;EACF;AAEA,QAAMI,cAAwC;IAC5CC,UAAUJ;IACVK,UAAU;IACVC,SAAS;IACTC,YAAYR;IACZS,YAAY;IACZC,WAAWZ,MAAMa,KAAKC,QAAQC,OAAOC;EACvC;AAEA,SAAO;IAAEZ;IAAmBE;EAAY;AAC1C,GArByB;;;ACHzB,SAASW,YAAY;AAEd,IAAMC,WAAWD,KAAK;EAC3BE,MAAM;EACNC,OAAO;EACPC,UAAU;EACVC,WAAW;EACXC,kBAAkB;EAClBC,SAAS;AACX,CAAA;;;ACTA,SAASC,UAAUC,6BAA6B;AASzC,IAAMC,8BAA8BF,SAAS,qCAAqC,IAAA;AAGlF,IAAMG,0BAA0BF,sBAAoDC,2BAAAA;AAEpF,IAAME,qCAAqCJ,SAAS,uCAAuC,IAAA;AAM3F,IAAMK,iCAAiCJ,sBAA2DG,kCAAAA;AAElG,IAAME,4CAA4CN,SAAS,+CAA+C,IAAA;AAM1G,IAAMO,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","createContextEx","MapboxAccessTokenContext","React","useMemo","useState","MapboxAccessTokenProvider","defaultAccessToken","props","accessToken","setAccessToken","useState","value","useMemo","provided","MapboxAccessTokenContext","useContextEx","useMapboxAccessToken","required","useContextEx","MapboxAccessTokenContext","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","vars","palette","common","white","Enum","MapStyle","Dark","Light","Outdoors","Satellite","SatelliteStreets","Streets","asSchema","isPayloadOfSchemaType","NetworkLocationAnswerSchema","isNetworkLocationAnswer","NetworkLocationHeatmapAnswerSchema","isNetworkLocationHeatmapAnswer","NetworkLocationHeatmapQuadkeyAnswerSchema","isNetworkLocationHeatmapQuadkeyAnswer"]}
|
|
1
|
+
{"version":3,"sources":["../../src/settings/DefaultMapSettings.ts","../../src/AnimatedHeatMapSettings.ts","../../src/contexts/MapboxAccessToken/Context.ts","../../src/contexts/MapboxAccessToken/Provider.tsx","../../src/contexts/MapboxAccessToken/use.ts","../../src/hooks/useFindHashes.tsx","../../src/hooks/useHeatMapColors.tsx","../../src/lib/MapStyle.ts","../../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 { createContextEx } from '@xylabs/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'\nimport type { MapboxAccessTokenContextState } from './State.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: MapboxAccessTokenContextState = useMemo(() => ({\n accessToken: accessToken ?? defaultAccessToken, provided: true, setAccessToken,\n }), [accessToken, defaultAccessToken, setAccessToken])\n\n return (\n <MapboxAccessTokenContext\n value={value}\n {...props}\n />\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { MapboxAccessTokenContext } from './Context.ts'\n\nexport const useMapboxAccessToken = (required = false) => {\n return useContextEx(MapboxAccessTokenContext, 'MapboxAccessToken', required)\n}\n","import type { Hash } from '@xylabs/sdk-js'\nimport type { ArchivistPreset } from '@xyo-network/react-network'\nimport { useNetwork } from '@xyo-network/react-network'\nimport { useMemo } from 'react'\n\nconst animatedAnswerHashesConst = [\n '79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',\n '531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',\n 'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',\n '29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e',\n 'cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c',\n '1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d',\n '1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9',\n '973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9',\n '463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',\n '15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',\n '32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',\n] as Hash[]\n\nconst staticAnswerHashConst = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5' as Hash\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.vars.palette.common.white,\n }\n\n return { heatMapColorProps, legendProps }\n}\n\nexport { useHeatMapColors }\n","import type { EnumValue } from '@xylabs/sdk-js'\nimport { Enum } from '@xylabs/sdk-js'\n\nexport const MapStyle = Enum({\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\nexport type MapStyle = EnumValue<typeof MapStyle>\n","import type { Payload } from '@xyo-network/payload-model'\nimport { asSchema, 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 = asSchema('network.xyo.location.range.answer', true)\nexport type NetworkLocationAnswerSchema = typeof NetworkLocationAnswerSchema\nexport type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>\nexport const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)\n\nexport const NetworkLocationHeatmapAnswerSchema = asSchema('network.xyo.location.heatmap.answer', true)\nexport type NetworkLocationHeatmapAnswerSchema = typeof NetworkLocationHeatmapAnswerSchema\nexport type NetworkLocationHeatmapAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,\n NetworkLocationHeatmapAnswerSchema\n>\nexport const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)\n\nexport const NetworkLocationHeatmapQuadkeyAnswerSchema = asSchema('network.xyo.location.heatmap.quadkey.answer', true)\nexport type NetworkLocationHeatmapQuadkeyAnswerSchema = typeof NetworkLocationHeatmapQuadkeyAnswerSchema\nexport type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,\n NetworkLocationHeatmapQuadkeyAnswerSchema\n>\nexport const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapQuadkeyAnswerPayload>(\n NetworkLocationHeat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AA,EACvC;AAEA,SAAO,EAAE,mBAAmB,YAAY;AAC1C;;;ACxBA,SAAS,YAAY;AAEd,IAAM,WAAW,KAAK;AAAA,EAC3B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,SAAS;AACX,CAAC;;;ACTD,SAAS,UAAU,6BAA6B;AASzC,IAAM,8BAA8B,SAAS,qCAAqC,IAAI;AAGtF,IAAM,0BAA0B,sBAAoD,2BAA2B;AAE/G,IAAM,qCAAqC,SAAS,uCAAuC,IAAI;AAM/F,IAAM,iCAAiC,sBAA2D,kCAAkC;AAEpI,IAAM,4CAA4C,SAAS,+CAA+C,IAAI;AAM9G,IAAM,wCAAwC;AAAA,EACnD;AACF;","names":["useMemo"]}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
export type MapSettingFields = 'debugLayer' | 'fitToPoints' | 'scrollToZoom' | 'enableControls' | 'debugLogging' | 'preferDark' | 'dynamicMapResize';
|
|
2
|
-
export type MapSetting = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
};
|
|
2
|
+
export type MapSetting = Record<MapSettingFields | string, {
|
|
3
|
+
/** Setting only available when application is in developerMode */
|
|
4
|
+
devMode?: boolean;
|
|
5
|
+
/** Machine-readable string to reference setting */
|
|
6
|
+
field: string;
|
|
7
|
+
/** Hide the setting from the UI */
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
/** Label in the UI */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Initial toggle value for a setting */
|
|
12
|
+
value: boolean;
|
|
13
|
+
}>;
|
|
16
14
|
//# sourceMappingURL=MapSetting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapSetting.d.ts","sourceRoot":"","sources":["../../../src/settings/MapSetting.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,kBAAkB,CAAA;AAEpJ,MAAM,MAAM,UAAU,GAAG
|
|
1
|
+
{"version":3,"file":"MapSetting.d.ts","sourceRoot":"","sources":["../../../src/settings/MapSetting.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,kBAAkB,CAAA;AAEpJ,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,GAAG,MAAM,EAAE;IACzD,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,KAAK,EAAE,OAAO,CAAA;CACf,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-map-model",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.11",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -36,44 +36,74 @@
|
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
|
-
"module": "dist/browser/index.mjs",
|
|
40
|
-
"types": "dist/browser/index.d.ts",
|
|
41
39
|
"files": [
|
|
42
40
|
"dist",
|
|
43
|
-
"
|
|
41
|
+
"README.md"
|
|
44
42
|
],
|
|
45
43
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@xylabs/sdk-js": "~5.0.90",
|
|
48
|
-
"@xyo-network/payload-model": "~5.3.17",
|
|
49
|
-
"@xyo-network/react-network": "7.5.8",
|
|
50
|
-
"geojson": "~0.5.0"
|
|
44
|
+
"@xyo-network/react-network": "~7.5.11"
|
|
51
45
|
},
|
|
52
46
|
"devDependencies": {
|
|
53
|
-
"@mui/
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
47
|
+
"@mui/material": "^7.3.10",
|
|
48
|
+
"@opentelemetry/api": "^1.9.1",
|
|
49
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
50
|
+
"@types/geojson": "~7946.0.16",
|
|
51
|
+
"@types/node": "~25.6.0",
|
|
56
52
|
"@types/react": "^19.2.14",
|
|
57
|
-
"@xylabs/
|
|
58
|
-
"@xylabs/
|
|
59
|
-
"@xylabs/
|
|
60
|
-
"@xylabs/
|
|
61
|
-
"@xylabs/
|
|
62
|
-
"@xylabs/
|
|
63
|
-
"
|
|
64
|
-
"
|
|
53
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
54
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
55
|
+
"@xylabs/react-select": "~7.1.20",
|
|
56
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
57
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
58
|
+
"@xylabs/threads": "~5.0.100",
|
|
59
|
+
"@xylabs/toolchain": "~7.11.9",
|
|
60
|
+
"@xylabs/tsconfig": "^7.11.9",
|
|
61
|
+
"@xylabs/tsconfig-dom": "^7.11.9",
|
|
62
|
+
"@xylabs/tsconfig-react": "~7.11.9",
|
|
63
|
+
"@xyo-network/network": "~5.5.1",
|
|
64
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
65
|
+
"async-mutex": "^0.5.0",
|
|
66
|
+
"axios": "^1.15.2",
|
|
67
|
+
"bn.js": "^5.2.3",
|
|
68
|
+
"buffer": "^6.0.3",
|
|
69
|
+
"chalk": "^5.6.2",
|
|
70
|
+
"debug": "~4.4.3",
|
|
71
|
+
"esbuild": "~0.28.0",
|
|
72
|
+
"eslint": "^10.2.1",
|
|
73
|
+
"ethers": "^6.16.0",
|
|
74
|
+
"geojson": "^0.5.0",
|
|
75
|
+
"hash-wasm": "~4.12.0",
|
|
76
|
+
"observable-fns": "~0.6.1",
|
|
77
|
+
"pako": "^2.1.0",
|
|
78
|
+
"react": "^19.2.5",
|
|
79
|
+
"react-dom": "^19.2.5",
|
|
80
|
+
"react-router-dom": "^7.14.2",
|
|
65
81
|
"typescript": "^5.9.3",
|
|
82
|
+
"wasm-feature-detect": "~1.8.0",
|
|
66
83
|
"zod": "^4.3.6"
|
|
67
84
|
},
|
|
68
85
|
"peerDependencies": {
|
|
69
|
-
"@mui/
|
|
70
|
-
"@
|
|
71
|
-
"react": "
|
|
72
|
-
"react-
|
|
73
|
-
"
|
|
86
|
+
"@mui/material": "^7.3.10",
|
|
87
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
88
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
89
|
+
"@xylabs/react-select": "~7.1.20",
|
|
90
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
91
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
92
|
+
"@xyo-network/network": "~5.5.1",
|
|
93
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
94
|
+
"async-mutex": "^0.5.0",
|
|
95
|
+
"bn.js": "^5.2.3",
|
|
96
|
+
"buffer": "^6.0.3",
|
|
97
|
+
"chalk": "^5.6.2",
|
|
98
|
+
"ethers": "^6.16.0",
|
|
99
|
+
"pako": "^2.1.0",
|
|
100
|
+
"react": "^19.2.5",
|
|
101
|
+
"react-dom": "^19.2.5",
|
|
102
|
+
"react-router-dom": "^7.14.2",
|
|
103
|
+
"zod": "^4.3.6"
|
|
74
104
|
},
|
|
75
105
|
"publishConfig": {
|
|
76
106
|
"access": "public"
|
|
77
107
|
},
|
|
78
108
|
"docs": "dist/docs.json"
|
|
79
|
-
}
|
|
109
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DefaultMapSettings } from './settings/index.ts'
|
|
2
|
-
|
|
3
|
-
export const AnimatedHeatMapSettings = DefaultMapSettings()
|
|
4
|
-
const {
|
|
5
|
-
debugLayer, scrollToZoom, fitToPoints, preferDark,
|
|
6
|
-
} = AnimatedHeatMapSettings
|
|
7
|
-
debugLayer.hidden = false
|
|
8
|
-
scrollToZoom.value = true
|
|
9
|
-
fitToPoints.value = false
|
|
10
|
-
preferDark.value = true
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface HeatMapColorProps {
|
|
2
|
-
staticMapColor: string
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export interface AnimatedHeatMapColorProps extends HeatMapColorProps {
|
|
6
|
-
highUsageColor: string
|
|
7
|
-
lowUsageColor: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ColorGradientLegendProps {
|
|
11
|
-
endColor: string
|
|
12
|
-
endLabel: string
|
|
13
|
-
heading: string
|
|
14
|
-
startColor: string
|
|
15
|
-
startLabel: string
|
|
16
|
-
textColor: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type LegendProps = ColorGradientLegendProps
|
package/src/colors/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MapColorProps.ts'
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import React, { useMemo, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import { MapboxAccessTokenContext } from './Context.ts'
|
|
5
|
-
import type { MapboxAccessTokenContextState } from './State.ts'
|
|
6
|
-
|
|
7
|
-
export interface MapboxAccessTokenProviderProps {
|
|
8
|
-
defaultAccessToken?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const MapboxAccessTokenProvider: React.FC<PropsWithChildren<MapboxAccessTokenProviderProps>> = ({ defaultAccessToken, ...props }) => {
|
|
12
|
-
const [accessToken, setAccessToken] = useState<string>()
|
|
13
|
-
|
|
14
|
-
const value: MapboxAccessTokenContextState = useMemo(() => ({
|
|
15
|
-
accessToken: accessToken ?? defaultAccessToken, provided: true, setAccessToken,
|
|
16
|
-
}), [accessToken, defaultAccessToken, setAccessToken])
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<MapboxAccessTokenContext
|
|
20
|
-
value={value}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
)
|
|
24
|
-
}
|
package/src/contexts/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MapboxAccessToken/index.ts'
|
package/src/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@mui/material/themeCssVarsAugmentation'
|
package/src/hooks/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ArchivistPreset } from '@xyo-network/react-network'
|
|
3
|
-
import { useNetwork } from '@xyo-network/react-network'
|
|
4
|
-
import { useMemo } from 'react'
|
|
5
|
-
|
|
6
|
-
const animatedAnswerHashesConst = [
|
|
7
|
-
'79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',
|
|
8
|
-
'531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',
|
|
9
|
-
'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',
|
|
10
|
-
'29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e',
|
|
11
|
-
'cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c',
|
|
12
|
-
'1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d',
|
|
13
|
-
'1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9',
|
|
14
|
-
'973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9',
|
|
15
|
-
'463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',
|
|
16
|
-
'15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',
|
|
17
|
-
'32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',
|
|
18
|
-
] as Hash[]
|
|
19
|
-
|
|
20
|
-
const staticAnswerHashConst = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5' as Hash
|
|
21
|
-
|
|
22
|
-
export const useFindHashes = () => {
|
|
23
|
-
const { network } = useNetwork()
|
|
24
|
-
const exploreMapHashes = (network?.nodes?.find(node => node.type === 'archivist') as ArchivistPreset)?.explorerMapHashes
|
|
25
|
-
const animatedAnswerHashes = exploreMapHashes?.animatedAnswerHashes || animatedAnswerHashesConst
|
|
26
|
-
const staticAnswerHash = exploreMapHashes?.staticAnswerHash || staticAnswerHashConst
|
|
27
|
-
const foundHashes = useMemo(() => [staticAnswerHash, ...animatedAnswerHashes], [animatedAnswerHashes, staticAnswerHash])
|
|
28
|
-
return foundHashes
|
|
29
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '@mui/material'
|
|
2
|
-
|
|
3
|
-
import type { AnimatedHeatMapColorProps, ColorGradientLegendProps } from '../colors/index.ts'
|
|
4
|
-
|
|
5
|
-
const useHeatMapColors = () => {
|
|
6
|
-
const theme = useTheme()
|
|
7
|
-
const staticMapColor = '#FFFF75'
|
|
8
|
-
const highUsageColor = '#FF0000'
|
|
9
|
-
|
|
10
|
-
const heatMapColorProps: AnimatedHeatMapColorProps = {
|
|
11
|
-
highUsageColor,
|
|
12
|
-
lowUsageColor: '#FFB3B3',
|
|
13
|
-
staticMapColor,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const legendProps: ColorGradientLegendProps = {
|
|
17
|
-
endColor: highUsageColor,
|
|
18
|
-
endLabel: 'High',
|
|
19
|
-
heading: 'Network Usage',
|
|
20
|
-
startColor: staticMapColor,
|
|
21
|
-
startLabel: 'Low',
|
|
22
|
-
textColor: theme.vars.palette.common.white,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return { heatMapColorProps, legendProps }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { useHeatMapColors }
|
package/src/index.ts
DELETED
package/src/lib/MapStyle.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EnumValue } from '@xylabs/sdk-js'
|
|
2
|
-
import { Enum } from '@xylabs/sdk-js'
|
|
3
|
-
|
|
4
|
-
export const MapStyle = Enum({
|
|
5
|
-
Dark: 'mapbox/dark-v10',
|
|
6
|
-
Light: 'mapbox/light-v10',
|
|
7
|
-
Outdoors: 'mapbox/outdoors-v11',
|
|
8
|
-
Satellite: 'mapbox/satellite-v9',
|
|
9
|
-
SatelliteStreets: 'mapbox/satellite-streets-v11',
|
|
10
|
-
Streets: 'mapbox/streets-v11',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
export type MapStyle = EnumValue<typeof MapStyle>
|
package/src/lib/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MapStyle.ts'
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { MapSetting } from './MapSetting.ts'
|
|
2
|
-
|
|
3
|
-
export const DefaultMapSettings: () => MapSetting = () => ({
|
|
4
|
-
debugLayer: {
|
|
5
|
-
devMode: true,
|
|
6
|
-
field: 'debugLayer',
|
|
7
|
-
hidden: true,
|
|
8
|
-
label: 'Debug Layer',
|
|
9
|
-
value: false,
|
|
10
|
-
},
|
|
11
|
-
debugLogging: {
|
|
12
|
-
devMode: true,
|
|
13
|
-
field: 'debugLogging',
|
|
14
|
-
hidden: true,
|
|
15
|
-
label: 'Debug Logging',
|
|
16
|
-
value: false,
|
|
17
|
-
},
|
|
18
|
-
dynamicMapResize: {
|
|
19
|
-
devMode: true,
|
|
20
|
-
field: 'dynamicMapResize',
|
|
21
|
-
hidden: true,
|
|
22
|
-
label: 'Auto Map Resize',
|
|
23
|
-
value: true,
|
|
24
|
-
},
|
|
25
|
-
enableControls: {
|
|
26
|
-
devMode: true,
|
|
27
|
-
field: 'enableControls',
|
|
28
|
-
hidden: true,
|
|
29
|
-
label: 'Map Controls',
|
|
30
|
-
value: false,
|
|
31
|
-
},
|
|
32
|
-
fitToPoints: {
|
|
33
|
-
devMode: true,
|
|
34
|
-
field: 'fitToPoints',
|
|
35
|
-
hidden: true,
|
|
36
|
-
label: 'Fit To Points',
|
|
37
|
-
value: false,
|
|
38
|
-
},
|
|
39
|
-
preferDark: {
|
|
40
|
-
devMode: false,
|
|
41
|
-
field: 'preferDark',
|
|
42
|
-
hidden: true,
|
|
43
|
-
label: 'Prefer dark',
|
|
44
|
-
value: false,
|
|
45
|
-
},
|
|
46
|
-
scrollToZoom: {
|
|
47
|
-
devMode: true,
|
|
48
|
-
field: 'scrollToZoom',
|
|
49
|
-
hidden: true,
|
|
50
|
-
label: 'Scroll To Zoom',
|
|
51
|
-
value: false,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export type MapSettingFields = 'debugLayer' | 'fitToPoints' | 'scrollToZoom' | 'enableControls' | 'debugLogging' | 'preferDark' | 'dynamicMapResize'
|
|
2
|
-
|
|
3
|
-
export type MapSetting = {
|
|
4
|
-
[field in MapSettingFields | string]: {
|
|
5
|
-
/** Setting only available when application is in developerMode */
|
|
6
|
-
devMode?: boolean
|
|
7
|
-
/** Machine-readable string to reference setting */
|
|
8
|
-
field: string
|
|
9
|
-
/** Hide the setting from the UI */
|
|
10
|
-
hidden?: boolean
|
|
11
|
-
/** Label in the UI */
|
|
12
|
-
label: string
|
|
13
|
-
/** Initial toggle value for a setting */
|
|
14
|
-
value: boolean
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/settings/index.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
2
|
-
import { asSchema, isPayloadOfSchemaType } from '@xyo-network/payload-model'
|
|
3
|
-
import type {
|
|
4
|
-
Feature, Point, Polygon,
|
|
5
|
-
} from 'geojson'
|
|
6
|
-
|
|
7
|
-
export interface NetworkLocationAnswerBase<T> {
|
|
8
|
-
result: T
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const NetworkLocationAnswerSchema = asSchema('network.xyo.location.range.answer', true)
|
|
12
|
-
export type NetworkLocationAnswerSchema = typeof NetworkLocationAnswerSchema
|
|
13
|
-
export type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>
|
|
14
|
-
export const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)
|
|
15
|
-
|
|
16
|
-
export const NetworkLocationHeatmapAnswerSchema = asSchema('network.xyo.location.heatmap.answer', true)
|
|
17
|
-
export type NetworkLocationHeatmapAnswerSchema = typeof NetworkLocationHeatmapAnswerSchema
|
|
18
|
-
export type NetworkLocationHeatmapAnswerPayload = Payload<
|
|
19
|
-
NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,
|
|
20
|
-
NetworkLocationHeatmapAnswerSchema
|
|
21
|
-
>
|
|
22
|
-
export const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)
|
|
23
|
-
|
|
24
|
-
export const NetworkLocationHeatmapQuadkeyAnswerSchema = asSchema('network.xyo.location.heatmap.quadkey.answer', true)
|
|
25
|
-
export type NetworkLocationHeatmapQuadkeyAnswerSchema = typeof NetworkLocationHeatmapQuadkeyAnswerSchema
|
|
26
|
-
export type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<
|
|
27
|
-
NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,
|
|
28
|
-
NetworkLocationHeatmapQuadkeyAnswerSchema
|
|
29
|
-
>
|
|
30
|
-
export const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapQuadkeyAnswerPayload>(
|
|
31
|
-
NetworkLocationHeatmapQuadkeyAnswerSchema,
|
|
32
|
-
)
|
package/src/types/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NetworkLocationAnswerBase.ts'
|