@xyo-network/react-map-model 6.1.4 → 7.0.0
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/hooks/useFindHashes.d.ts +2 -1
- package/dist/browser/hooks/useFindHashes.d.ts.map +1 -1
- package/dist/browser/index.d.ts +8 -122
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +15 -11
- package/src/global.d.ts +1 -1
- package/src/hooks/useFindHashes.tsx +3 -3
- package/typedoc.json +0 -5
- package/xy.config.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFindHashes.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFindHashes.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFindHashes.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFindHashes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAqBvC,eAAO,MAAM,aAAa,cAOzB,CAAA"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,122 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type MapSettingFields = 'debugLayer' | 'fitToPoints' | 'scrollToZoom' | 'enableControls' | 'debugLogging' | 'preferDark' | 'dynamicMapResize';
|
|
10
|
-
type MapSetting = {
|
|
11
|
-
[field in MapSettingFields | string]: {
|
|
12
|
-
/** Setting only available when application is in developerMode */
|
|
13
|
-
devMode?: boolean;
|
|
14
|
-
/** Machine-readable string to reference setting */
|
|
15
|
-
field: string;
|
|
16
|
-
/** Hide the setting from the UI */
|
|
17
|
-
hidden?: boolean;
|
|
18
|
-
/** Label in the UI */
|
|
19
|
-
label: string;
|
|
20
|
-
/** Initial toggle value for a setting */
|
|
21
|
-
value: boolean;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
declare const AnimatedHeatMapSettings: MapSetting;
|
|
26
|
-
|
|
27
|
-
interface HeatMapColorProps {
|
|
28
|
-
staticMapColor: string;
|
|
29
|
-
}
|
|
30
|
-
interface AnimatedHeatMapColorProps extends HeatMapColorProps {
|
|
31
|
-
highUsageColor: string;
|
|
32
|
-
lowUsageColor: string;
|
|
33
|
-
}
|
|
34
|
-
interface ColorGradientLegendProps {
|
|
35
|
-
endColor: string;
|
|
36
|
-
endLabel: string;
|
|
37
|
-
heading: string;
|
|
38
|
-
startColor: string;
|
|
39
|
-
startLabel: string;
|
|
40
|
-
textColor: string;
|
|
41
|
-
}
|
|
42
|
-
type LegendProps = ColorGradientLegendProps;
|
|
43
|
-
|
|
44
|
-
declare const MapboxAccessTokenContext: react.Context<({
|
|
45
|
-
accessToken?: string;
|
|
46
|
-
setAccessToken?: react.Dispatch<string>;
|
|
47
|
-
} & {
|
|
48
|
-
provided: true;
|
|
49
|
-
}) | (_xylabs_react_shared.FixedValues<_xylabs_react_shared.ProvidedContextExState<{
|
|
50
|
-
accessToken?: string;
|
|
51
|
-
setAccessToken?: react.Dispatch<string>;
|
|
52
|
-
}>, never> & {
|
|
53
|
-
provided: false;
|
|
54
|
-
}) | (_xylabs_react_shared.FixedValues<_xylabs_react_shared.NotProvidedContextExState<{
|
|
55
|
-
accessToken?: string;
|
|
56
|
-
setAccessToken?: react.Dispatch<string>;
|
|
57
|
-
}>, never> & {
|
|
58
|
-
provided: false;
|
|
59
|
-
})>;
|
|
60
|
-
|
|
61
|
-
interface MapboxAccessTokenProviderProps {
|
|
62
|
-
defaultAccessToken?: string;
|
|
63
|
-
}
|
|
64
|
-
declare const MapboxAccessTokenProvider: react__default.FC<PropsWithChildren<MapboxAccessTokenProviderProps>>;
|
|
65
|
-
|
|
66
|
-
type MapboxAccessTokenContextState = ContextExState<{
|
|
67
|
-
accessToken?: string;
|
|
68
|
-
setAccessToken?: Dispatch<string>;
|
|
69
|
-
}>;
|
|
70
|
-
|
|
71
|
-
declare const useMapboxAccessToken: (required?: boolean) => Omit<{
|
|
72
|
-
accessToken?: string;
|
|
73
|
-
setAccessToken?: react.Dispatch<string>;
|
|
74
|
-
} & {
|
|
75
|
-
provided: true;
|
|
76
|
-
}, "provided"> | Omit<_xylabs_react_shared.NotProvidedContextExState<MapboxAccessTokenContextState>, "provided">;
|
|
77
|
-
|
|
78
|
-
declare const useFindHashes: () => Lowercase<string>[];
|
|
79
|
-
|
|
80
|
-
declare const useHeatMapColors: () => {
|
|
81
|
-
heatMapColorProps: AnimatedHeatMapColorProps;
|
|
82
|
-
legendProps: ColorGradientLegendProps;
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=useHeatMapColors.d.ts.map
|
|
85
|
-
|
|
86
|
-
declare const MapStyle: Enum<{
|
|
87
|
-
Dark: "mapbox/dark-v10";
|
|
88
|
-
Light: "mapbox/light-v10";
|
|
89
|
-
Outdoors: "mapbox/outdoors-v11";
|
|
90
|
-
Satellite: "mapbox/satellite-v9";
|
|
91
|
-
SatelliteStreets: "mapbox/satellite-streets-v11";
|
|
92
|
-
Streets: "mapbox/streets-v11";
|
|
93
|
-
}>;
|
|
94
|
-
type MapStyle = EnumValue<typeof MapStyle>;
|
|
95
|
-
|
|
96
|
-
declare const DefaultMapSettings: () => MapSetting;
|
|
97
|
-
|
|
98
|
-
interface NetworkLocationAnswerBase<T> {
|
|
99
|
-
result: T;
|
|
100
|
-
}
|
|
101
|
-
declare const NetworkLocationAnswerSchema = "network.xyo.location.range.answer";
|
|
102
|
-
type NetworkLocationAnswerSchema = 'network.xyo.location.range.answer';
|
|
103
|
-
type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{
|
|
104
|
-
features: Feature<Point>[];
|
|
105
|
-
}>, NetworkLocationAnswerSchema>;
|
|
106
|
-
declare const isNetworkLocationAnswer: (x?: unknown | null) => x is NetworkLocationAnswerPayload;
|
|
107
|
-
declare const NetworkLocationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
|
|
108
|
-
type NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer';
|
|
109
|
-
type NetworkLocationHeatmapAnswerPayload = Payload<NetworkLocationAnswerBase<{
|
|
110
|
-
features: Feature<Polygon>[];
|
|
111
|
-
}>, NetworkLocationHeatmapAnswerSchema>;
|
|
112
|
-
declare const isNetworkLocationHeatmapAnswer: (x?: unknown | null) => x is NetworkLocationHeatmapAnswerPayload;
|
|
113
|
-
declare const NetworkLocationHeatmapQuadkeyAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
|
|
114
|
-
type NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer';
|
|
115
|
-
type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<NetworkLocationAnswerBase<{
|
|
116
|
-
density: number;
|
|
117
|
-
quadkey: string;
|
|
118
|
-
}[]>, NetworkLocationHeatmapQuadkeyAnswerSchema>;
|
|
119
|
-
declare const isNetworkLocationHeatmapQuadkeyAnswer: (x?: unknown | null) => x is NetworkLocationHeatmapQuadkeyAnswerPayload;
|
|
120
|
-
|
|
121
|
-
export { AnimatedHeatMapSettings, DefaultMapSettings, MapStyle, MapboxAccessTokenContext, MapboxAccessTokenProvider, NetworkLocationAnswerSchema, NetworkLocationHeatmapAnswerSchema, NetworkLocationHeatmapQuadkeyAnswerSchema, isNetworkLocationAnswer, isNetworkLocationHeatmapAnswer, isNetworkLocationHeatmapQuadkeyAnswer, useFindHashes, useHeatMapColors, useMapboxAccessToken };
|
|
122
|
-
export type { AnimatedHeatMapColorProps, ColorGradientLegendProps, HeatMapColorProps, LegendProps, MapSetting, MapSettingFields, MapboxAccessTokenContextState, MapboxAccessTokenProviderProps, NetworkLocationAnswerBase, NetworkLocationAnswerPayload, NetworkLocationHeatmapAnswerPayload, NetworkLocationHeatmapQuadkeyAnswerPayload };
|
|
1
|
+
export * from './AnimatedHeatMapSettings.ts';
|
|
2
|
+
export * from './colors/index.ts';
|
|
3
|
+
export * from './contexts/index.ts';
|
|
4
|
+
export * from './hooks/index.ts';
|
|
5
|
+
export * from './lib/index.ts';
|
|
6
|
+
export * from './settings/index.ts';
|
|
7
|
+
export * from './types/index.ts';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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/hex'\nimport type { ArchivistPreset } from '@xyo-network/react-network'\nimport { useNetwork } from '@xyo-network/react-network'\nimport { useMemo } from 'react'\n\nconst animatedAnswerHashesConst: Hash[] = [\n '79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',\n '531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',\n 'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',\n '29d3f8b882c61a82a1a1675782a27e797ea7196f45a23b4409680ab8b8d5f14e',\n 'cfd20f80ac073fd9518f4ef3f43d2a1f5e4e56e40c2677f38d6f6fecd05df60c',\n '1354fa73497519a39aed19fc99bdbae78a880a1eafb2f7898d607e07db36528d',\n '1043b0d25eacfc5013ae9dba780305a6fbf01a43543bd871d7c00537fca142a9',\n '973dfc5df142851ced258d52d0ac2784e814000ac22e35776f772256b0d4dde9',\n '463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',\n '15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',\n '32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',\n]\n\nconst staticAnswerHashConst: Hash = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5'\n\nexport const useFindHashes = () => {\n const { network } = useNetwork()\n const exploreMapHashes = (network?.nodes?.find(node => node.type === 'archivist') as ArchivistPreset)?.explorerMapHashes\n const animatedAnswerHashes = exploreMapHashes?.animatedAnswerHashes || animatedAnswerHashesConst\n const staticAnswerHash = exploreMapHashes?.staticAnswerHash || staticAnswerHashConst\n const foundHashes = useMemo(() => [staticAnswerHash, ...animatedAnswerHashes], [animatedAnswerHashes, staticAnswerHash])\n return foundHashes\n}\n","import { useTheme } from '@mui/material'\n\nimport type { AnimatedHeatMapColorProps, ColorGradientLegendProps } from '../colors/index.ts'\n\nconst useHeatMapColors = () => {\n const theme = useTheme()\n const staticMapColor = '#FFFF75'\n const highUsageColor = '#FF0000'\n\n const heatMapColorProps: AnimatedHeatMapColorProps = {\n highUsageColor,\n lowUsageColor: '#FFB3B3',\n staticMapColor,\n }\n\n const legendProps: ColorGradientLegendProps = {\n endColor: highUsageColor,\n endLabel: 'High',\n heading: 'Network Usage',\n startColor: staticMapColor,\n startLabel: 'Low',\n textColor: theme.vars.palette.common.white,\n }\n\n return { heatMapColorProps, legendProps }\n}\n\nexport { useHeatMapColors }\n","import type { EnumValue } from '@xylabs/enum'\nimport { Enum } from '@xylabs/enum'\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 { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type {\n Feature, Point, Polygon,\n} from 'geojson'\n\nexport interface NetworkLocationAnswerBase<T> {\n result: T\n}\n\nexport const NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>\nexport const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)\n\nexport const NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,\n NetworkLocationHeatmapAnswerSchema\n>\nexport const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)\n\nexport const NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,\n NetworkLocationHeatmapQuadkeyAnswerSchema\n>\nexport const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapQuadkeyAnswerPayload>(\n NetworkLocationHeatmapQuadkeyAnswerSchema,\n)\n"],"mappings":";;;;AAEO,IAAMA,qBAAuC,8BAAO;EACzDC,YAAY;IACVC,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,OAAO;EACT;EACAC,c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,IAAMC,4BAAoC;EACxC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF,IAAMC,wBAA8B;AAE7B,IAAMC,gBAAgB,6BAAA;AAC3B,QAAM,EAAEC,QAAO,IAAKC,WAAAA;AACpB,QAAMC,mBAAoBF,SAASG,OAAOC,KAAKC,CAAAA,SAAQA,KAAKC,SAAS,WAAA,GAAkCC;AACvG,QAAMC,uBAAuBN,kBAAkBM,wBAAwBX;AACvE,QAAMY,mBAAmBP,kBAAkBO,oBAAoBX;AAC/D,QAAMY,cAAcC,SAAQ,MAAM;IAACF;OAAqBD;KAAuB;IAACA;IAAsBC;GAAiB;AACvH,SAAOC;AACT,GAP6B;;;ACrB7B,SAASE,gBAAgB;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,6BAA6B;AAS/B,IAAMC,8BAA8B;AAGpC,IAAMC,0BAA0BF,sBAAoDC,2BAAAA;AAEpF,IAAME,qCAAqC;AAM3C,IAAMC,iCAAiCJ,sBAA2DG,kCAAAA;AAElG,IAAME,4CAA4C;AAMlD,IAAMC,wCAAwCN,sBACnDK,yCAAAA;","names":["DefaultMapSettings","debugLayer","devMode","field","hidden","label","value","debugLogging","dynamicMapResize","enableControls","fitToPoints","preferDark","scrollToZoom","AnimatedHeatMapSettings","DefaultMapSettings","debugLayer","scrollToZoom","fitToPoints","preferDark","hidden","value","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","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/hex'\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/enum'\nimport { Enum } from '@xylabs/enum'\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 { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type {\n Feature, Point, Polygon,\n} from 'geojson'\n\nexport interface NetworkLocationAnswerBase<T> {\n result: T\n}\n\nexport const NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerSchema = 'network.xyo.location.range.answer'\nexport type NetworkLocationAnswerPayload = Payload<NetworkLocationAnswerBase<{ features: Feature<Point>[] }>, NetworkLocationAnswerSchema>\nexport const isNetworkLocationAnswer = isPayloadOfSchemaType<NetworkLocationAnswerPayload>(NetworkLocationAnswerSchema)\n\nexport const NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport type NetworkLocationHeatmapAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ features: Feature<Polygon>[] }>,\n NetworkLocationHeatmapAnswerSchema\n>\nexport const isNetworkLocationHeatmapAnswer = isPayloadOfSchemaType<NetworkLocationHeatmapAnswerPayload>(NetworkLocationHeatmapAnswerSchema)\n\nexport const NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type NetworkLocationHeatmapQuadkeyAnswerPayload = Payload<\n NetworkLocationAnswerBase<{ density: number; quadkey: string }[]>,\n NetworkLocationHeatmapQuadkeyAnswerSchema\n>\nexport const isNetworkLocationHeatmapQuadkeyAnswer = isPayloadOfSchemaType<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,OAAO;EACT;AACF,IAlDoD;;;ACA7C,IAAMO,0BAA0BC,mBAAAA;AACvC,IAAM,EACJC,YAAYC,cAAcC,aAAaC,WAAU,IAC/CL;AACJE,WAAWI,SAAS;AACpBH,aAAaI,QAAQ;AACrBH,YAAYG,QAAQ;AACpBF,WAAWE,QAAQ;;;ACTnB,SAASC,uBAAuB;AAIzB,IAAMC,2BAA2BD,gBAAAA;;;ACHxC,OAAOE,SAASC,SAASC,gBAAgB;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vC;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,6BAA6B;AAS/B,IAAMC,8BAA8B;AAGpC,IAAMC,0BAA0BF,sBAAoDC,2BAAAA;AAEpF,IAAME,qCAAqC;AAM3C,IAAMC,iCAAiCJ,sBAA2DG,kCAAAA;AAElG,IAAME,4CAA4C;AAMlD,IAAMC,wCAAwCN,sBACnDK,yCAAAA;","names":["DefaultMapSettings","debugLayer","devMode","field","hidden","label","value","debugLogging","dynamicMapResize","enableControls","fitToPoints","preferDark","scrollToZoom","AnimatedHeatMapSettings","DefaultMapSettings","debugLayer","scrollToZoom","fitToPoints","preferDark","hidden","value","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","isPayloadOfSchemaType","NetworkLocationAnswerSchema","isNetworkLocationAnswer","NetworkLocationHeatmapAnswerSchema","isNetworkLocationHeatmapAnswer","NetworkLocationHeatmapQuadkeyAnswerSchema","isNetworkLocationHeatmapQuadkeyAnswer"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-map-model",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -38,23 +38,27 @@
|
|
|
38
38
|
},
|
|
39
39
|
"module": "dist/browser/index.mjs",
|
|
40
40
|
"types": "dist/browser/index.d.ts",
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"src"
|
|
44
|
+
],
|
|
41
45
|
"dependencies": {
|
|
42
|
-
"@xylabs/enum": "^
|
|
43
|
-
"@xylabs/react-shared": "^
|
|
44
|
-
"@xyo-network/payload-model": "^
|
|
45
|
-
"@xyo-network/react-network": "^
|
|
46
|
+
"@xylabs/enum": "^5.0.0",
|
|
47
|
+
"@xylabs/react-shared": "^7.0.0",
|
|
48
|
+
"@xyo-network/payload-model": "^5.0.0",
|
|
49
|
+
"@xyo-network/react-network": "^7.0.0",
|
|
46
50
|
"geojson": "^0.5.0"
|
|
47
51
|
},
|
|
48
52
|
"devDependencies": {
|
|
49
53
|
"@mui/icons-material": "^7.2.0",
|
|
50
54
|
"@mui/material": "^7.2.0",
|
|
51
55
|
"@types/geojson": "7946.0.16",
|
|
52
|
-
"@types/react": "^19.1.
|
|
53
|
-
"@xylabs/hex": "^
|
|
54
|
-
"@xylabs/ts-scripts-yarn3": "
|
|
55
|
-
"@xylabs/tsconfig-react": "
|
|
56
|
-
"react": "^19.1.
|
|
57
|
-
"react-dom": "^19.1.
|
|
56
|
+
"@types/react": "^19.1.9",
|
|
57
|
+
"@xylabs/hex": "^5.0.0",
|
|
58
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.2",
|
|
59
|
+
"@xylabs/tsconfig-react": "^7.0.2",
|
|
60
|
+
"react": "^19.1.1",
|
|
61
|
+
"react-dom": "^19.1.1",
|
|
58
62
|
"typescript": "^5.8.3"
|
|
59
63
|
},
|
|
60
64
|
"peerDependencies": {
|
package/src/global.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@mui/material/themeCssVarsAugmentation'
|
|
@@ -3,7 +3,7 @@ import type { ArchivistPreset } from '@xyo-network/react-network'
|
|
|
3
3
|
import { useNetwork } from '@xyo-network/react-network'
|
|
4
4
|
import { useMemo } from 'react'
|
|
5
5
|
|
|
6
|
-
const animatedAnswerHashesConst
|
|
6
|
+
const animatedAnswerHashesConst = [
|
|
7
7
|
'79af071f451fc7af10d009dc63236ef9a9b211732c1ee0c06f028fcecf2336c5',
|
|
8
8
|
'531bfba6d8dfefd3bcc888aca54cdbbd4574ed2b3ec551b230845a1f9a608898',
|
|
9
9
|
'c874412b4faa4947de81372fd1ba12fdd6f43f5e408622b7f357cb2bcb3f17cb',
|
|
@@ -15,9 +15,9 @@ const animatedAnswerHashesConst: Hash[] = [
|
|
|
15
15
|
'463808eb74d3d87e6563970e0301a493577f8cd1b501e6e0ffa5e027ad2cea95',
|
|
16
16
|
'15b21acea2e3fd9d1ace3768a72636ee7bdf67a6f8e0807bfa2273dea2207555',
|
|
17
17
|
'32d377bfe7ebe382598c54dd13f8af7510e0a1e2fd2e913311fdd58e517e5e2e,',
|
|
18
|
-
]
|
|
18
|
+
] as Hash[]
|
|
19
19
|
|
|
20
|
-
const staticAnswerHashConst
|
|
20
|
+
const staticAnswerHashConst = 'c7bbf61f61cfd4a1b2def160c28136fc1d100d39fbdb67b227a2c6e558d9d3a5' as Hash
|
|
21
21
|
|
|
22
22
|
export const useFindHashes = () => {
|
|
23
23
|
const { network } = useNetwork()
|
package/typedoc.json
DELETED