@dynatrace/strato-geo 3.6.0 → 3.7.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/esm/map/MapView.js +42 -34
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleCircleLayer.js +2 -0
- package/esm/map/components/BubbleLayer/BubbleCircleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayer.js +4 -1
- package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js +5 -5
- package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +5 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +3 -1
- package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +6 -5
- package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js +1 -1
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +3 -0
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +7 -9
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +20 -18
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayer.js +4 -1
- package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayerTooltip.js.map +2 -2
- package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js +5 -5
- package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js.map +2 -2
- package/esm/map/components/MapContent.js +22 -12
- package/esm/map/components/MapContent.js.map +2 -2
- package/esm/map/contexts/geo-data-lookup.context.js +8 -0
- package/esm/map/contexts/geo-data-lookup.context.js.map +7 -0
- package/esm/map/hooks/use-active-interaction.js +59 -43
- package/esm/map/hooks/use-active-interaction.js.map +2 -2
- package/esm/map/hooks/use-attach-image-from-icon.js +4 -2
- package/esm/map/hooks/use-attach-image-from-icon.js.map +2 -2
- package/esm/map/hooks/use-hover-interaction.js +59 -41
- package/esm/map/hooks/use-hover-interaction.js.map +2 -2
- package/esm/map/hooks/use-layer-before-id.js +24 -0
- package/esm/map/hooks/use-layer-before-id.js.map +7 -0
- package/esm/map/hooks/use-map-runtime-error.js +93 -0
- package/esm/map/hooks/use-map-runtime-error.js.map +7 -0
- package/esm/map/hooks/use-overlay-events.js +11 -2
- package/esm/map/hooks/use-overlay-events.js.map +2 -2
- package/esm/map/hooks/use-webgl-context-error.js +2 -1
- package/esm/map/hooks/use-webgl-context-error.js.map +2 -2
- package/esm/map/index.js.map +1 -1
- package/esm/map/slots/Tooltip.js.map +2 -2
- package/esm/map/utils/attach-image-from-shape.js +4 -2
- package/esm/map/utils/attach-image-from-shape.js.map +2 -2
- package/esm/map/utils/extract-layers-data.js +24 -15
- package/esm/map/utils/extract-layers-data.js.map +2 -2
- package/esm/map/utils/is-browser-firefox.js +7 -0
- package/esm/map/utils/is-browser-firefox.js.map +7 -0
- package/esm/map/utils/parse-tooltip-data.js +22 -7
- package/esm/map/utils/parse-tooltip-data.js.map +2 -2
- package/map/MapView.js +42 -34
- package/map/components/BubbleLayer/BubbleCircleLayer.d.ts +2 -1
- package/map/components/BubbleLayer/BubbleCircleLayer.js +2 -0
- package/map/components/BubbleLayer/BubbleLayer.js +4 -1
- package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.d.ts +3 -1
- package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js +5 -5
- package/map/components/ChoroplethLayer/ChoroplethLayer.js +5 -2
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.d.ts +1 -0
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +3 -1
- package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.d.ts +3 -1
- package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +6 -5
- package/map/components/ConnectionLayer/ConnectionLayer.js +1 -1
- package/map/components/ConnectionLayer/ConnectionLayerLine.js +3 -0
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +7 -9
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.d.ts +3 -1
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +20 -18
- package/map/components/DotLayer/DotLayer.js +4 -1
- package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.d.ts +3 -1
- package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js +5 -5
- package/map/components/MapContent.js +21 -12
- package/map/contexts/geo-data-lookup.context.d.ts +9 -0
- package/map/{components/ConnectionLayer/utils/restore-null-props.js → contexts/geo-data-lookup.context.js} +8 -9
- package/map/hooks/use-active-interaction.d.ts +8 -1
- package/map/hooks/use-active-interaction.js +58 -42
- package/map/hooks/use-attach-image-from-icon.js +4 -2
- package/map/hooks/use-hover-interaction.d.ts +6 -2
- package/map/hooks/use-hover-interaction.js +52 -39
- package/map/hooks/use-layer-before-id.d.ts +13 -0
- package/map/hooks/{use-map-mouse-move.js → use-layer-before-id.js} +20 -15
- package/map/hooks/use-map-runtime-error.d.ts +34 -0
- package/map/hooks/use-map-runtime-error.js +112 -0
- package/map/hooks/use-overlay-events.js +11 -2
- package/map/hooks/use-webgl-context-error.js +2 -1
- package/map/slots/Tooltip.d.ts +2 -0
- package/map/types/connection-layer.d.ts +1 -8
- package/map/types/tooltip.d.ts +1 -0
- package/map/utils/attach-image-from-shape.js +4 -2
- package/map/utils/extract-layers-data.d.ts +2 -0
- package/map/utils/extract-layers-data.js +24 -15
- package/map/utils/is-browser-firefox.d.ts +5 -0
- package/map/utils/is-browser-firefox.js +26 -0
- package/map/utils/parse-tooltip-data.d.ts +11 -3
- package/map/utils/parse-tooltip-data.js +22 -7
- package/package.json +2 -2
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js +0 -9
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js.map +0 -7
- package/esm/map/hooks/use-map-mouse-move.js +0 -19
- package/esm/map/hooks/use-map-mouse-move.js.map +0 -7
- package/map/components/ConnectionLayer/utils/restore-null-props.d.ts +0 -2
- package/map/hooks/use-map-mouse-move.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayerLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport type { PropsWithChildren } from 'react';\n\nimport { _useBehavioralTrackingProps as useBehavioralTrackingProps } from '@dynatrace/strato-components/core';\n\nimport {\n DEFAULT_LINE_CAP,\n DEFAULT_LINE_DASH_ARRAY,\n DEFAULT_LINE_JOIN,\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n} from '../../constants.js';\nimport type {\n Connection,\n InternalConnectionLayerProps,\n} from '../../types/connection-layer.js';\n\ninterface ConnectionLayerLineProps<T extends Connection>\n extends Required<Pick<InternalConnectionLayerProps<T>, 'layerId'>> {\n geoJsonData: GeoJSON.FeatureCollection;\n sourceId: string;\n line: 'dashed' | 'solid' | undefined;\n}\n\nexport const ConnectionLayerLine = <T extends Connection>(\n props: PropsWithChildren<ConnectionLayerLineProps<T>>,\n) => {\n const { geoJsonData, layerId, sourceId, line, children, ...restProps } =\n props;\n const [behavioralTrackingProps] = useBehavioralTrackingProps(restProps);\n\n return (\n <Source id={sourceId} type=\"geojson\" data={geoJsonData} promoteId=\"id\">\n <Layer\n type=\"line\"\n id={layerId}\n layout={{\n 'line-cap': DEFAULT_LINE_CAP,\n 'line-join': DEFAULT_LINE_JOIN,\n }}\n paint={{\n 'line-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__lineHoveredColor'],\n ['get', '__lineColor'],\n ],\n 'line-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n 'line-width': ['get', '__lineWidth'],\n ...(line && line === 'dashed'\n ? { 'line-dasharray': DEFAULT_LINE_DASH_ARRAY }\n : null),\n }}\n {...behavioralTrackingProps}\n />\n {children}\n </Source>\n );\n};\n\nConnectionLayerLine['displayName'] = 'ConnectionLayerLine';\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport type { PropsWithChildren } from 'react';\n\nimport { _useBehavioralTrackingProps as useBehavioralTrackingProps } from '@dynatrace/strato-components/core';\n\nimport {\n DEFAULT_LINE_CAP,\n DEFAULT_LINE_DASH_ARRAY,\n DEFAULT_LINE_JOIN,\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n} from '../../constants.js';\nimport { useLayerBeforeId } from '../../hooks/use-layer-before-id.js';\nimport type {\n Connection,\n InternalConnectionLayerProps,\n} from '../../types/connection-layer.js';\n\ninterface ConnectionLayerLineProps<T extends Connection>\n extends Required<Pick<InternalConnectionLayerProps<T>, 'layerId'>> {\n geoJsonData: GeoJSON.FeatureCollection;\n sourceId: string;\n line: 'dashed' | 'solid' | undefined;\n}\n\nexport const ConnectionLayerLine = <T extends Connection>(\n props: PropsWithChildren<ConnectionLayerLineProps<T>>,\n) => {\n const { geoJsonData, layerId, sourceId, line, children, ...restProps } =\n props;\n const [behavioralTrackingProps] = useBehavioralTrackingProps(restProps);\n\n // Keep stack order aligned with JSX order even when this layer mounts after\n // siblings (e.g. async-gated `{apiData && <ChoroplethLayer>}`).\n const beforeId = useLayerBeforeId(layerId);\n\n return (\n <Source id={sourceId} type=\"geojson\" data={geoJsonData} promoteId=\"id\">\n <Layer\n type=\"line\"\n id={layerId}\n beforeId={beforeId}\n layout={{\n 'line-cap': DEFAULT_LINE_CAP,\n 'line-join': DEFAULT_LINE_JOIN,\n }}\n paint={{\n 'line-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__lineHoveredColor'],\n ['get', '__lineColor'],\n ],\n 'line-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n 'line-width': ['get', '__lineWidth'],\n ...(line && line === 'dashed'\n ? { 'line-dasharray': DEFAULT_LINE_DASH_ARRAY }\n : null),\n }}\n {...behavioralTrackingProps}\n />\n {children}\n </Source>\n );\n};\n\nConnectionLayerLine['displayName'] = 'ConnectionLayerLine';\n"],
|
|
5
|
+
"mappings": "AAqCI,SACE,KADF;AArCJ,SAAS,OAAO,cAAc;AAG9B,SAAS,+BAA+B,kCAAkC;AAE1E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AAa1B,MAAM,sBAAsB,CACjC,UACG;AACH,QAAM,EAAE,aAAa,SAAS,UAAU,MAAM,UAAU,GAAG,UAAU,IACnE;AACF,QAAM,CAAC,uBAAuB,IAAI,2BAA2B,SAAS;AAItE,QAAM,WAAW,iBAAiB,OAAO;AAEzC,SACE,qBAAC,UAAO,IAAI,UAAU,MAAK,WAAU,MAAM,aAAa,WAAU,MAChE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,IAAI;AAAA,QACJ;AAAA,QACA,QAAQ;AAAA,UACN,YAAY;AAAA,UACZ,aAAa;AAAA,QACf;AAAA,QACA,OAAO;AAAA,UACL,cAAc;AAAA,YACZ;AAAA,YACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,YAC7C,CAAC,OAAO,oBAAoB;AAAA,YAC5B,CAAC,OAAO,aAAa;AAAA,UACvB;AAAA,UACA,gBAAgB;AAAA,YACd;AAAA,YACA,CAAC,WAAW,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,YAClD;AAAA,YACA;AAAA,UACF;AAAA,UACA,cAAc,CAAC,OAAO,aAAa;AAAA,UACnC,GAAI,QAAQ,SAAS,WACjB,EAAE,kBAAkB,wBAAwB,IAC5C;AAAA,QACN;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,IACC;AAAA,KACH;AAEJ;AAEA,oBAAoB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { _OverlayTooltip as OverlayTooltip } from "@dynatrace/strato-components/charts";
|
|
3
|
-
import { restoreNullProps } from "./utils/restore-null-props.js";
|
|
4
3
|
import { useGeoLayerTooltip } from "../../hooks/use-geo-layer-tooltip.js";
|
|
5
4
|
import { isDefaultTooltipHandler } from "../../utils/tooltip-type-guards.js";
|
|
6
5
|
const ConnectionLayerTooltip = (props) => {
|
|
7
6
|
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
8
|
-
const {
|
|
9
|
-
data: rawData,
|
|
10
|
-
inBounds,
|
|
11
|
-
position
|
|
12
|
-
} = useGeoLayerTooltip("geoConnection");
|
|
13
|
-
const data = restoreNullProps(rawData);
|
|
7
|
+
const { data, inBounds, position } = useGeoLayerTooltip("geoConnection");
|
|
14
8
|
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
15
9
|
return null;
|
|
16
10
|
}
|
|
17
11
|
if (!data || !data[0]) {
|
|
18
12
|
return null;
|
|
19
13
|
}
|
|
20
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
__lineColor: color,
|
|
16
|
+
__lineWidth: thickness,
|
|
17
|
+
data: customData
|
|
18
|
+
} = data[0];
|
|
21
19
|
const connectionData = {
|
|
22
20
|
color,
|
|
23
21
|
thickness,
|
|
24
|
-
data:
|
|
22
|
+
data: customData
|
|
25
23
|
};
|
|
26
24
|
const template = tooltipTemplate(connectionData);
|
|
27
25
|
if (!template) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport { useGeoLayerTooltip } from '../../hooks/use-geo-layer-tooltip.js';\nimport type { Connection } from '../../types/connection-layer.js';\nimport type {\n ConnectionLayerTooltipData,\n ConnectionLayerTooltipHandler,\n} from '../../types/tooltip.js';\nimport { isDefaultTooltipHandler } from '../../utils/tooltip-type-guards.js';\n\ninterface ConnectionTooltipPayload {\n id: string;\n __lineColor: string;\n __lineHoveredColor: string;\n __lineWidth: number;\n curve?: string;\n data: Connection;\n}\n\nexport interface ConnectionLayerTooltipProps {\n tooltipTemplate?: ConnectionLayerTooltipHandler;\n hidden?: boolean;\n symbolAlignment?: 'left' | 'right';\n}\n\nexport const ConnectionLayerTooltip = (props: ConnectionLayerTooltipProps) => {\n const { tooltipTemplate, hidden, symbolAlignment } = props;\n\n const { data, inBounds, position } =\n useGeoLayerTooltip<ConnectionTooltipPayload>('geoConnection');\n\n if (hidden || !tooltipTemplate || !inBounds || !position) {\n return null;\n }\n\n if (!data || !data[0]) {\n return null;\n }\n\n const {\n __lineColor: color,\n __lineWidth: thickness,\n data: customData,\n } = data[0];\n const connectionData: ConnectionLayerTooltipData<Connection> = {\n color,\n thickness,\n data: customData,\n };\n\n const template = tooltipTemplate(connectionData);\n\n if (!template) {\n return null;\n }\n\n if (isDefaultTooltipHandler(tooltipTemplate)) {\n return template;\n }\n\n return (\n <OverlayTooltip\n legacyTemplate={template}\n symbolAlignment={symbolAlignment}\n />\n );\n};\n\nConnectionLayerTooltip['displayName'] = 'ConnectionLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AA6DI;AA7DJ,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,0BAA0B;AAMnC,SAAS,+BAA+B;AAiBjC,MAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM,EAAE,iBAAiB,QAAQ,gBAAgB,IAAI;AAErD,QAAM,EAAE,MAAM,UAAU,SAAS,IAC/B,mBAA6C,eAAe;AAE9D,MAAI,UAAU,CAAC,mBAAmB,CAAC,YAAY,CAAC,UAAU;AACxD,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,QAAM;AAAA,IACJ,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,EACR,IAAI,KAAK,CAAC;AACV,QAAM,iBAAyD;AAAA,IAC7D;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AAEA,QAAM,WAAW,gBAAgB,cAAc;AAE/C,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI,wBAAwB,eAAe,GAAG;AAC5C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,gBAAgB;AAAA,MAChB;AAAA;AAAA,EACF;AAEJ;AAEA,uBAAuB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,14 +13,11 @@ const getLineThickness = (thickness) => {
|
|
|
13
13
|
}
|
|
14
14
|
return thickness;
|
|
15
15
|
};
|
|
16
|
-
const
|
|
17
|
-
const getFeatureProperties = (thickness, curve) => (properties, id) => {
|
|
16
|
+
const getRenderingProperties = (thickness, id, curve) => {
|
|
18
17
|
const lineThickness = getLineThickness(thickness);
|
|
19
18
|
return {
|
|
20
|
-
...properties,
|
|
21
19
|
id,
|
|
22
20
|
__lineWidth: lineThickness,
|
|
23
|
-
__nullValues: getKeysWithNullValues(properties),
|
|
24
21
|
curve
|
|
25
22
|
};
|
|
26
23
|
};
|
|
@@ -31,35 +28,40 @@ const getLineFeature = (path, featureProperties) => {
|
|
|
31
28
|
}
|
|
32
29
|
return getStraightLineFeature(path, featureProperties);
|
|
33
30
|
};
|
|
31
|
+
const getConnectionColor = (connection, color) => {
|
|
32
|
+
const parsedColor = defineColor(color, connection);
|
|
33
|
+
const canvasColor = getCanvasColor(parsedColor);
|
|
34
|
+
const hoveredColor = calculateHoveredColor(canvasColor);
|
|
35
|
+
return {
|
|
36
|
+
__lineColor: canvasColor,
|
|
37
|
+
__lineHoveredColor: hoveredColor
|
|
38
|
+
};
|
|
39
|
+
};
|
|
34
40
|
const getFeatures = (data, thickness, color, curve) => {
|
|
35
|
-
const getProperties = getFeatureProperties(thickness, curve);
|
|
36
41
|
const features = [];
|
|
37
42
|
data.forEach((feature, index) => {
|
|
38
43
|
if (feature.path.length >= 2) {
|
|
39
|
-
const
|
|
44
|
+
const renderingProps = getRenderingProperties(
|
|
45
|
+
thickness,
|
|
46
|
+
`connection-${index}`,
|
|
47
|
+
curve
|
|
48
|
+
);
|
|
40
49
|
const featureProperties = {
|
|
41
|
-
...
|
|
50
|
+
...renderingProps,
|
|
51
|
+
__dataIndex: index,
|
|
42
52
|
...getConnectionColor(feature, color)
|
|
43
53
|
};
|
|
44
|
-
features.push(getLineFeature(path, featureProperties));
|
|
54
|
+
features.push(getLineFeature(feature.path, featureProperties));
|
|
45
55
|
}
|
|
46
56
|
});
|
|
47
57
|
return features;
|
|
48
58
|
};
|
|
49
|
-
const getConnectionColor = (connection, color) => {
|
|
50
|
-
const parsedColor = defineColor(color, connection);
|
|
51
|
-
const canvasColor = getCanvasColor(parsedColor);
|
|
52
|
-
const hoveredColor = calculateHoveredColor(canvasColor);
|
|
53
|
-
return {
|
|
54
|
-
__lineColor: canvasColor,
|
|
55
|
-
__lineHoveredColor: hoveredColor
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
59
|
const parseConnectionDataToGeoJSON = (data, thickness, color, curve) => {
|
|
59
|
-
|
|
60
|
+
const geoJson = {
|
|
60
61
|
type: "FeatureCollection",
|
|
61
62
|
features: getFeatures(data, thickness, color, curve)
|
|
62
63
|
};
|
|
64
|
+
return { geoJson };
|
|
63
65
|
};
|
|
64
66
|
export {
|
|
65
67
|
parseConnectionDataToGeoJSON
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.ts"],
|
|
4
|
-
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components/charts';\n\nimport { getArcLineFeature } from './get-arc-line-feature.js';\nimport { getStraightLineFeature } from './get-straight-line-feature.js';\nimport { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from '../../../constants.js';\nimport type {\n Connection,\n CurvedLine,\n FeatureProperties,\n} from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nconst getLineThickness = (thickness: number): number => {\n if (thickness < MIN_LINE_THICKNESS) {\n return MIN_LINE_THICKNESS;\n }\n\n if (thickness > MAX_LINE_THICKNESS) {\n return MAX_LINE_THICKNESS;\n }\n\n return thickness;\n};\n\nconst
|
|
5
|
-
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,oBAAoB,0BAA0B;AAOvD,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,mBAAmB,CAAC,cAA8B;AACtD,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,MAAM,
|
|
4
|
+
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components/charts';\n\nimport { getArcLineFeature } from './get-arc-line-feature.js';\nimport { getStraightLineFeature } from './get-straight-line-feature.js';\nimport { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from '../../../constants.js';\nimport type {\n Connection,\n CurvedLine,\n FeatureProperties,\n} from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nconst getLineThickness = (thickness: number): number => {\n if (thickness < MIN_LINE_THICKNESS) {\n return MIN_LINE_THICKNESS;\n }\n\n if (thickness > MAX_LINE_THICKNESS) {\n return MAX_LINE_THICKNESS;\n }\n\n return thickness;\n};\n\nconst getRenderingProperties = (\n thickness: number,\n id: string,\n curve?: CurvedLine,\n): Omit<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const lineThickness = getLineThickness(thickness);\n\n return {\n id,\n __lineWidth: lineThickness,\n curve,\n };\n};\n\nconst getLineFeature = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature => {\n const isCurve = featureProperties.curve === 'smooth';\n\n if (isCurve) {\n return getArcLineFeature(path, featureProperties);\n }\n\n return getStraightLineFeature(path, featureProperties);\n};\n\nconst getConnectionColor = <T extends Connection>(\n connection: T,\n color: string | ((connection: T) => string),\n): Pick<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const parsedColor = defineColor(color, connection);\n\n const canvasColor = getCanvasColor(parsedColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n return {\n __lineColor: canvasColor,\n __lineHoveredColor: hoveredColor,\n };\n};\n\nconst getFeatures = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.Feature[] => {\n const features: GeoJSON.Feature[] = [];\n data.forEach((feature, index) => {\n if (feature.path.length >= 2) {\n const renderingProps = getRenderingProperties(\n thickness,\n `connection-${index}`,\n curve,\n );\n\n const featureProperties: FeatureProperties = {\n ...renderingProps,\n __dataIndex: index,\n ...getConnectionColor(feature, color),\n };\n\n features.push(getLineFeature(feature.path, featureProperties));\n }\n });\n return features;\n};\n\nexport const parseConnectionDataToGeoJSON = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): { geoJson: GeoJSON.FeatureCollection } => {\n const geoJson: GeoJSON.FeatureCollection = {\n type: 'FeatureCollection',\n features: getFeatures(data, thickness, color, curve),\n };\n\n return { geoJson };\n};\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,oBAAoB,0BAA0B;AAOvD,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,mBAAmB,CAAC,cAA8B;AACtD,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,MAAM,yBAAyB,CAC7B,WACA,IACA,UACkE;AAClE,QAAM,gBAAgB,iBAAiB,SAAS;AAEhD,SAAO;AAAA,IACL;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF;AACF;AAEA,MAAM,iBAAiB,CACrB,MACA,sBACoB;AACpB,QAAM,UAAU,kBAAkB,UAAU;AAE5C,MAAI,SAAS;AACX,WAAO,kBAAkB,MAAM,iBAAiB;AAAA,EAClD;AAEA,SAAO,uBAAuB,MAAM,iBAAiB;AACvD;AAEA,MAAM,qBAAqB,CACzB,YACA,UACkE;AAClE,QAAM,cAAc,YAAY,OAAO,UAAU;AAEjD,QAAM,cAAc,eAAe,WAAW;AAC9C,QAAM,eAAe,sBAAsB,WAAW;AAEtD,SAAO;AAAA,IACL,aAAa;AAAA,IACb,oBAAoB;AAAA,EACtB;AACF;AAEA,MAAM,cAAc,CAClB,MACA,WACA,OACA,UACsB;AACtB,QAAM,WAA8B,CAAC;AACrC,OAAK,QAAQ,CAAC,SAAS,UAAU;AAC/B,QAAI,QAAQ,KAAK,UAAU,GAAG;AAC5B,YAAM,iBAAiB;AAAA,QACrB;AAAA,QACA,cAAc,KAAK;AAAA,QACnB;AAAA,MACF;AAEA,YAAM,oBAAuC;AAAA,QAC3C,GAAG;AAAA,QACH,aAAa;AAAA,QACb,GAAG,mBAAmB,SAAS,KAAK;AAAA,MACtC;AAEA,eAAS,KAAK,eAAe,QAAQ,MAAM,iBAAiB,CAAC;AAAA,IAC/D;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEO,MAAM,+BAA+B,CAC1C,MACA,WACA,OACA,UAC2C;AAC3C,QAAM,UAAqC;AAAA,IACzC,MAAM;AAAA,IACN,UAAU,YAAY,MAAM,WAAW,OAAO,KAAK;AAAA,EACrD;AAEA,SAAO,EAAE,QAAQ;AACnB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
SHAPE_OPACITY_DIMMED,
|
|
15
15
|
SHAPE_OPACITY_DEFAULT
|
|
16
16
|
} from "../../constants.js";
|
|
17
|
+
import { useLayerBeforeId } from "../../hooks/use-layer-before-id.js";
|
|
17
18
|
import { useLayerColoringStrategy } from "../../hooks/use-layer-coloring-strategy.js";
|
|
18
19
|
import { useLegendInteractionHighlighting } from "../../hooks/use-legend-interaction-highlighting.js";
|
|
19
20
|
import { useLegendInteractionVisibility } from "../../hooks/use-legend-interaction-visibility.js";
|
|
@@ -61,7 +62,8 @@ const DotLayer = (props) => {
|
|
|
61
62
|
const sourceId = `source-${layerId}`;
|
|
62
63
|
useLegendInteractionHighlighting(props, sourceId);
|
|
63
64
|
useLegendInteractionVisibility(props, layerId);
|
|
64
|
-
const
|
|
65
|
+
const beforeId = useLayerBeforeId(layerId);
|
|
66
|
+
const { geoJson: dataGeoJson } = parseDotDataToGeoJSON(
|
|
65
67
|
data,
|
|
66
68
|
shapeColor,
|
|
67
69
|
bearing,
|
|
@@ -74,6 +76,7 @@ const DotLayer = (props) => {
|
|
|
74
76
|
{
|
|
75
77
|
type: "symbol",
|
|
76
78
|
id: layerId,
|
|
79
|
+
beforeId,
|
|
77
80
|
layout: {
|
|
78
81
|
"icon-image": symbolName,
|
|
79
82
|
"icon-size": DEFAULT_ICON_SIZE_RATIO,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/DotLayer/DotLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport { type PropsWithChildren } from 'react';\n\nimport { _useBehavioralTrackingProps as useBehavioralTrackingProps } from '@dynatrace/strato-components/core';\n\nimport { BackgroundLayer } from './BackgroundLayer.js';\nimport { BackgroundSymbolLayer } from './BackgroundSymbolLayer.js';\nimport { DotLayerTooltip } from './DotLayerTooltip.js';\nimport { parseDotDataToGeoJSON } from './utils/parse-dot-data-to-geo-json.js';\nimport {\n DEFAULT_ICON_COLOR,\n DEFAULT_ICON_SIZE_RATIO,\n DEFAULT_SHAPE_COLOR,\n DEFAULT_SYMBOL_SIZE,\n FALLBACK_SYMBOL_SIZE,\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n} from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useLoadSymbolIntoMap } from '../../hooks/use-load-symbol-into-map.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { DotLayerTooltip as DotLayerTooltipSlot } from '../../slots/DotLayerTooltip.js';\nimport type { InternalDotLayerProps } from '../../types/dot-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isDotTooltipTemplate } from '../../utils/tooltip-type-guards.js';\nimport { TooltipWrapper } from '../TooltipWrapper.js';\n\n/**\n * DotLayer Component\n */\nexport const DotLayer = <T extends Location>(\n props: PropsWithChildren<InternalDotLayerProps<T>>,\n) => {\n const [behavioralTrackingProps] = useBehavioralTrackingProps(props);\n\n const {\n data,\n layerId,\n bearing = 0,\n children,\n shape = 'pin',\n background = false,\n shapeSize = DEFAULT_SYMBOL_SIZE,\n } = props;\n\n const calculatedShapeSize = shapeSize > 0 ? shapeSize : FALLBACK_SYMBOL_SIZE;\n\n const { symbolName, symbolType } = useLoadSymbolIntoMap(\n shape,\n layerId,\n calculatedShapeSize,\n );\n\n const bgLayerId = `${layerId}-background`;\n\n const { symbolName: bgName } = useLoadSymbolIntoMap(\n 'circle',\n bgLayerId,\n calculatedShapeSize,\n );\n\n const defaultSymbolColor =\n symbolType === 'shape' ? DEFAULT_SHAPE_COLOR : DEFAULT_ICON_COLOR;\n\n const colorParser = useLayerColoringStrategy();\n const shapeColor = useResolveLocationColor(\n defaultSymbolColor,\n props,\n colorParser,\n );\n\n const {\n handler: tooltipTemplate,\n hidden: tooltipHidden,\n symbolAlignment,\n } = useTooltipTemplate(children, DotLayerTooltipSlot, { extractProps: true });\n\n const sourceId = `source-${layerId}`;\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n const dataGeoJson = parseDotDataToGeoJSON(\n data,\n shapeColor,\n bearing,\n background,\n );\n\n const iconAnchor = shape === 'pin' ? 'bottom' : 'center';\n\n return (\n <Source id={sourceId} type=\"geojson\" data={dataGeoJson} generateId>\n <Layer\n type=\"symbol\"\n id={layerId}\n layout={{\n 'icon-image': symbolName,\n 'icon-size': DEFAULT_ICON_SIZE_RATIO,\n 'icon-rotate': ['get', '__bearing'],\n // https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-ignore-placement\n 'icon-ignore-placement': true,\n 'icon-anchor': iconAnchor,\n }}\n paint={{\n 'icon-color': ['get', '__color'],\n 'icon-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n }}\n {...behavioralTrackingProps}\n />\n {shape !== 'pin' ? (\n <BackgroundLayer\n background={Boolean(background)}\n beforeId={layerId}\n source={sourceId}\n radius={calculatedShapeSize / 2}\n iconAnchor={iconAnchor}\n />\n ) : (\n <BackgroundSymbolLayer\n background={Boolean(background)}\n beforeId={layerId}\n source={sourceId}\n radius={calculatedShapeSize / 2}\n iconAnchor={iconAnchor}\n symbolName={bgName}\n layerId={bgLayerId}\n shape={shape}\n />\n )}\n <TooltipWrapper layerId={layerId}>\n <DotLayerTooltip\n tooltipTemplate={\n isDotTooltipTemplate(tooltipTemplate) ? tooltipTemplate : undefined\n }\n hidden={tooltipHidden}\n symbolAlignment={symbolAlignment}\n />\n </TooltipWrapper>\n </Source>\n );\n};\n\nDotLayer['displayName'] = 'DotLayer';\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport { type PropsWithChildren } from 'react';\n\nimport { _useBehavioralTrackingProps as useBehavioralTrackingProps } from '@dynatrace/strato-components/core';\n\nimport { BackgroundLayer } from './BackgroundLayer.js';\nimport { BackgroundSymbolLayer } from './BackgroundSymbolLayer.js';\nimport { DotLayerTooltip } from './DotLayerTooltip.js';\nimport { parseDotDataToGeoJSON } from './utils/parse-dot-data-to-geo-json.js';\nimport {\n DEFAULT_ICON_COLOR,\n DEFAULT_ICON_SIZE_RATIO,\n DEFAULT_SHAPE_COLOR,\n DEFAULT_SYMBOL_SIZE,\n FALLBACK_SYMBOL_SIZE,\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n} from '../../constants.js';\nimport { useLayerBeforeId } from '../../hooks/use-layer-before-id.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useLoadSymbolIntoMap } from '../../hooks/use-load-symbol-into-map.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { DotLayerTooltip as DotLayerTooltipSlot } from '../../slots/DotLayerTooltip.js';\nimport type { InternalDotLayerProps } from '../../types/dot-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isDotTooltipTemplate } from '../../utils/tooltip-type-guards.js';\nimport { TooltipWrapper } from '../TooltipWrapper.js';\n\n/**\n * DotLayer Component\n */\nexport const DotLayer = <T extends Location>(\n props: PropsWithChildren<InternalDotLayerProps<T>>,\n) => {\n const [behavioralTrackingProps] = useBehavioralTrackingProps(props);\n\n const {\n data,\n layerId,\n bearing = 0,\n children,\n shape = 'pin',\n background = false,\n shapeSize = DEFAULT_SYMBOL_SIZE,\n } = props;\n\n const calculatedShapeSize = shapeSize > 0 ? shapeSize : FALLBACK_SYMBOL_SIZE;\n\n const { symbolName, symbolType } = useLoadSymbolIntoMap(\n shape,\n layerId,\n calculatedShapeSize,\n );\n\n const bgLayerId = `${layerId}-background`;\n\n const { symbolName: bgName } = useLoadSymbolIntoMap(\n 'circle',\n bgLayerId,\n calculatedShapeSize,\n );\n\n const defaultSymbolColor =\n symbolType === 'shape' ? DEFAULT_SHAPE_COLOR : DEFAULT_ICON_COLOR;\n\n const colorParser = useLayerColoringStrategy();\n const shapeColor = useResolveLocationColor(\n defaultSymbolColor,\n props,\n colorParser,\n );\n\n const {\n handler: tooltipTemplate,\n hidden: tooltipHidden,\n symbolAlignment,\n } = useTooltipTemplate(children, DotLayerTooltipSlot, { extractProps: true });\n\n const sourceId = `source-${layerId}`;\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n const beforeId = useLayerBeforeId(layerId);\n\n const { geoJson: dataGeoJson } = parseDotDataToGeoJSON(\n data,\n shapeColor,\n bearing,\n background,\n );\n\n const iconAnchor = shape === 'pin' ? 'bottom' : 'center';\n\n return (\n <Source id={sourceId} type=\"geojson\" data={dataGeoJson} generateId>\n <Layer\n type=\"symbol\"\n id={layerId}\n beforeId={beforeId}\n layout={{\n 'icon-image': symbolName,\n 'icon-size': DEFAULT_ICON_SIZE_RATIO,\n 'icon-rotate': ['get', '__bearing'],\n // https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-ignore-placement\n 'icon-ignore-placement': true,\n 'icon-anchor': iconAnchor,\n }}\n paint={{\n 'icon-color': ['get', '__color'],\n 'icon-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n }}\n {...behavioralTrackingProps}\n />\n {shape !== 'pin' ? (\n <BackgroundLayer\n background={Boolean(background)}\n beforeId={layerId}\n source={sourceId}\n radius={calculatedShapeSize / 2}\n iconAnchor={iconAnchor}\n />\n ) : (\n <BackgroundSymbolLayer\n background={Boolean(background)}\n beforeId={layerId}\n source={sourceId}\n radius={calculatedShapeSize / 2}\n iconAnchor={iconAnchor}\n symbolName={bgName}\n layerId={bgLayerId}\n shape={shape}\n />\n )}\n <TooltipWrapper layerId={layerId}>\n <DotLayerTooltip\n tooltipTemplate={\n isDotTooltipTemplate(tooltipTemplate) ? tooltipTemplate : undefined\n }\n hidden={tooltipHidden}\n symbolAlignment={symbolAlignment}\n />\n </TooltipWrapper>\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AAA;AAAA,IACF,GACF;AAAA,KACF;AAEJ;AAEA,SAAS,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/DotLayer/DotLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport { useGeoLayerTooltip } from '../../hooks/use-geo-layer-tooltip.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n DotLayerTooltipData,\n DotLayerTooltipHandler,\n} from '../../types/tooltip.js';\nimport { isDefaultTooltipHandler } from '../../utils/tooltip-type-guards.js';\n\ninterface DotTooltipStatePayload {\n __color: string;\n __hoveredColor: string;\n __bearing: number;\n data: Location;\n}\n\nexport interface DotLayerTooltipProps {\n tooltipTemplate?: DotLayerTooltipHandler;\n hidden?: boolean;\n symbolAlignment?: 'left' | 'right';\n}\n\nexport const DotLayerTooltip = (props: DotLayerTooltipProps) => {\n const { tooltipTemplate, hidden, symbolAlignment } = props;\n\n const { data, inBounds, position } =\n useGeoLayerTooltip<DotTooltipStatePayload>('geoDot');\n\n if (hidden || !tooltipTemplate || !inBounds || !position) {\n return null;\n }\n\n if (!data || !data[0]) {\n return null;\n }\n\n const { __color: color, __bearing: bearing, data: customData } = data[0];\n const dotData: DotLayerTooltipData = {\n color,\n bearing,\n data: customData,\n };\n\n const template = tooltipTemplate(dotData);\n\n if (!template) {\n return null;\n }\n\n if (isDefaultTooltipHandler(tooltipTemplate)) {\n return template;\n }\n\n return (\n <OverlayTooltip\n legacyTemplate={template}\n symbolAlignment={symbolAlignment}\n />\n );\n};\n\nDotLayerTooltip['displayName'] = 'DotLayerTooltip';\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport { useGeoLayerTooltip } from '../../hooks/use-geo-layer-tooltip.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n DotLayerTooltipData,\n DotLayerTooltipHandler,\n} from '../../types/tooltip.js';\nimport { isDefaultTooltipHandler } from '../../utils/tooltip-type-guards.js';\n\ninterface DotTooltipStatePayload {\n __color: string;\n __hoveredColor: string;\n __bearing: number;\n __backgroundColor: string;\n __hoveredBackgroundColor: string;\n data: Location;\n}\n\nexport interface DotLayerTooltipProps {\n tooltipTemplate?: DotLayerTooltipHandler;\n hidden?: boolean;\n symbolAlignment?: 'left' | 'right';\n}\n\nexport const DotLayerTooltip = (props: DotLayerTooltipProps) => {\n const { tooltipTemplate, hidden, symbolAlignment } = props;\n\n const { data, inBounds, position } =\n useGeoLayerTooltip<DotTooltipStatePayload>('geoDot');\n\n if (hidden || !tooltipTemplate || !inBounds || !position) {\n return null;\n }\n\n if (!data || !data[0]) {\n return null;\n }\n\n const { __color: color, __bearing: bearing, data: customData } = data[0];\n const dotData: DotLayerTooltipData = {\n color,\n bearing,\n data: customData,\n };\n\n const template = tooltipTemplate(dotData);\n\n if (!template) {\n return null;\n }\n\n if (isDefaultTooltipHandler(tooltipTemplate)) {\n return template;\n }\n\n return (\n <OverlayTooltip\n legacyTemplate={template}\n symbolAlignment={symbolAlignment}\n />\n );\n};\n\nDotLayerTooltip['displayName'] = 'DotLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AAyDI;AAzDJ,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,0BAA0B;AAMnC,SAAS,+BAA+B;AAiBjC,MAAM,kBAAkB,CAAC,UAAgC;AAC9D,QAAM,EAAE,iBAAiB,QAAQ,gBAAgB,IAAI;AAErD,QAAM,EAAE,MAAM,UAAU,SAAS,IAC/B,mBAA2C,QAAQ;AAErD,MAAI,UAAU,CAAC,mBAAmB,CAAC,YAAY,CAAC,UAAU;AACxD,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,SAAS,OAAO,WAAW,SAAS,MAAM,WAAW,IAAI,KAAK,CAAC;AACvE,QAAM,UAA+B;AAAA,IACnC;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AAEA,QAAM,WAAW,gBAAgB,OAAO;AAExC,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI,wBAAwB,eAAe,GAAG;AAC5C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,gBAAgB;AAAA,MAChB;AAAA;AAAA,EACF;AAEJ;AAEA,gBAAgB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,18 +4,17 @@ import { resolveIconBackground } from "./resolve-icon-background.js";
|
|
|
4
4
|
import { calculateHoveredColor } from "../../../utils/calculate-hovered-color.js";
|
|
5
5
|
import { defineColor } from "../../../utils/define-color.js";
|
|
6
6
|
const parseDotDataToGeoJSON = (data, color, bearing, backgroundColor) => {
|
|
7
|
-
|
|
7
|
+
const geoJson = {
|
|
8
8
|
type: "FeatureCollection",
|
|
9
|
-
features: data.map((feature) => {
|
|
10
|
-
const { longitude, latitude
|
|
9
|
+
features: data.map((feature, index) => {
|
|
10
|
+
const { longitude, latitude } = feature;
|
|
11
11
|
const canvasColor = getCanvasColor(defineColor(color, feature));
|
|
12
12
|
const hoveredColor = calculateHoveredColor(canvasColor);
|
|
13
13
|
const { parsedBackgroundColor, parsedHoveredBackgroundColor } = resolveIconBackground(feature, backgroundColor);
|
|
14
14
|
return {
|
|
15
15
|
type: "Feature",
|
|
16
16
|
properties: {
|
|
17
|
-
|
|
18
|
-
...properties,
|
|
17
|
+
__dataIndex: index,
|
|
19
18
|
__color: canvasColor,
|
|
20
19
|
__hoveredColor: hoveredColor,
|
|
21
20
|
__backgroundColor: parsedBackgroundColor,
|
|
@@ -26,6 +25,7 @@ const parseDotDataToGeoJSON = (data, color, bearing, backgroundColor) => {
|
|
|
26
25
|
};
|
|
27
26
|
})
|
|
28
27
|
};
|
|
28
|
+
return { geoJson };
|
|
29
29
|
};
|
|
30
30
|
export {
|
|
31
31
|
parseDotDataToGeoJSON
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/DotLayer/utils/parse-dot-data-to-geo-json.ts"],
|
|
4
|
-
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components/charts';\n\nimport { defineBearing } from './define-bearing.js';\nimport { resolveIconBackground } from './resolve-icon-background.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nexport const parseDotDataToGeoJSON = <T extends Location>(\n data: T[],\n color: string | ((item: T) => string),\n bearing: number | ((item: T) => number),\n backgroundColor: boolean | string | ((item: T) => string),\n): GeoJSON.FeatureCollection => {\n
|
|
5
|
-
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAErB,MAAM,wBAAwB,CACnC,MACA,OACA,SACA,
|
|
4
|
+
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components/charts';\n\nimport { defineBearing } from './define-bearing.js';\nimport { resolveIconBackground } from './resolve-icon-background.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nexport const parseDotDataToGeoJSON = <T extends Location>(\n data: T[],\n color: string | ((item: T) => string),\n bearing: number | ((item: T) => number),\n backgroundColor: boolean | string | ((item: T) => string),\n): { geoJson: GeoJSON.FeatureCollection } => {\n const geoJson: GeoJSON.FeatureCollection = {\n type: 'FeatureCollection',\n features: data.map((feature, index) => {\n const { longitude, latitude } = feature;\n const canvasColor = getCanvasColor(defineColor(color, feature));\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n const { parsedBackgroundColor, parsedHoveredBackgroundColor } =\n resolveIconBackground(feature, backgroundColor);\n\n return {\n type: 'Feature',\n properties: {\n __dataIndex: index,\n __color: canvasColor,\n __hoveredColor: hoveredColor,\n __backgroundColor: parsedBackgroundColor,\n __hoveredBackgroundColor: parsedHoveredBackgroundColor,\n __bearing: defineBearing(bearing, feature),\n },\n geometry: { type: 'Point', coordinates: [longitude, latitude] },\n };\n }),\n };\n\n return { geoJson };\n};\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAErB,MAAM,wBAAwB,CACnC,MACA,OACA,SACA,oBAC2C;AAC3C,QAAM,UAAqC;AAAA,IACzC,MAAM;AAAA,IACN,UAAU,KAAK,IAAI,CAAC,SAAS,UAAU;AACrC,YAAM,EAAE,WAAW,SAAS,IAAI;AAChC,YAAM,cAAc,eAAe,YAAY,OAAO,OAAO,CAAC;AAC9D,YAAM,eAAe,sBAAsB,WAAW;AAEtD,YAAM,EAAE,uBAAuB,6BAA6B,IAC1D,sBAAsB,SAAS,eAAe;AAEhD,aAAO;AAAA,QACL,MAAM;AAAA,QACN,YAAY;AAAA,UACV,aAAa;AAAA,UACb,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,mBAAmB;AAAA,UACnB,0BAA0B;AAAA,UAC1B,WAAW,cAAc,SAAS,OAAO;AAAA,QAC3C;AAAA,QACA,UAAU,EAAE,MAAM,SAAS,aAAa,CAAC,WAAW,QAAQ,EAAE;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ;AACnB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { isUndefined } from "lodash-es";
|
|
8
8
|
import {
|
|
9
9
|
forwardRef,
|
|
10
|
+
useCallback,
|
|
10
11
|
useContext,
|
|
11
12
|
useRef,
|
|
12
13
|
useState
|
|
@@ -35,9 +36,9 @@ import { useMapBaseLayerFeatures } from "../hooks/use-map-base-layer-features.js
|
|
|
35
36
|
import { useMapConfig } from "../hooks/use-map-config.js";
|
|
36
37
|
import { useMapLoading } from "../hooks/use-map-loading.js";
|
|
37
38
|
import { useMapPerformance } from "../hooks/use-map-performance.js";
|
|
39
|
+
import { useMapRuntimeError } from "../hooks/use-map-runtime-error.js";
|
|
38
40
|
import { useOverlayEvents } from "../hooks/use-overlay-events.js";
|
|
39
41
|
import { useTooltipEventListeners } from "../hooks/use-tooltip-event-listeners.js";
|
|
40
|
-
import { useWebGLContextError } from "../hooks/use-webgl-context-error.js";
|
|
41
42
|
import { defaultStyle } from "../map-styles/default-style.js";
|
|
42
43
|
import { MapViewImperativeHandler } from "../providers/imperative-handler.provider.js";
|
|
43
44
|
import { getColorFromToken } from "../utils/get-color-from-token.js";
|
|
@@ -90,21 +91,23 @@ const MapSource = () => {
|
|
|
90
91
|
};
|
|
91
92
|
const MapInteractions = ({
|
|
92
93
|
children,
|
|
93
|
-
onContextLostError
|
|
94
|
+
onContextLostError,
|
|
95
|
+
interactiveLayerIds
|
|
94
96
|
}) => {
|
|
95
|
-
const [
|
|
96
|
-
|
|
97
|
-
useActiveInteraction();
|
|
98
|
-
useWebGLContextError(() => {
|
|
97
|
+
const [runtimeError, setRuntimeError] = useState(null);
|
|
98
|
+
const onRuntimeError = useCallback(() => {
|
|
99
99
|
onContextLostError?.();
|
|
100
|
-
|
|
100
|
+
setRuntimeError(
|
|
101
101
|
new Error(
|
|
102
|
-
"
|
|
102
|
+
"The map encountered repeated rendering errors and could not recover. Please reload the page."
|
|
103
103
|
)
|
|
104
104
|
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
}, [onContextLostError]);
|
|
106
|
+
useHoverInteraction(interactiveLayerIds);
|
|
107
|
+
useActiveInteraction(interactiveLayerIds);
|
|
108
|
+
useMapRuntimeError({ onError: onRuntimeError });
|
|
109
|
+
if (runtimeError) {
|
|
110
|
+
throw runtimeError;
|
|
108
111
|
}
|
|
109
112
|
return children;
|
|
110
113
|
};
|
|
@@ -231,7 +234,14 @@ const MapContent = forwardRef((props, forwardedRef) => {
|
|
|
231
234
|
children: [
|
|
232
235
|
/* @__PURE__ */ jsx(MapSource, {}),
|
|
233
236
|
loading ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
234
|
-
/* @__PURE__ */ jsx(
|
|
237
|
+
/* @__PURE__ */ jsx(
|
|
238
|
+
MapInteractions,
|
|
239
|
+
{
|
|
240
|
+
onContextLostError,
|
|
241
|
+
interactiveLayerIds: layerIds,
|
|
242
|
+
children
|
|
243
|
+
}
|
|
244
|
+
),
|
|
235
245
|
shouldRenderToolbar ? /* @__PURE__ */ jsx(MapToolbar, {}) : null
|
|
236
246
|
] })
|
|
237
247
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/components/MapContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Layer,\n type LayerProps,\n Map,\n Source,\n type ViewStateChangeEvent,\n} from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\nimport type
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import {\n Layer,\n type LayerProps,\n Map,\n Source,\n type ViewStateChangeEvent,\n} from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\nimport { type MapLayerMouseEvent } from 'maplibre-gl';\nimport {\n forwardRef,\n type PropsWithChildren,\n useCallback,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport { _useGraphSize as useGraphSize } from '@dynatrace/strato-components/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components/core';\n\nimport {\n BASE_LAYER_FILL_ID,\n BASE_LAYER_LINE_ID,\n COUNTRY_BORDER_WIDTH,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n DEFAULT_COUNTRIES_FILL_COLOR,\n MAX_LATITUDE,\n MAX_LONGITUDE,\n MIN_LATITUDE,\n MIN_LONGITUDE,\n REGION_BORDER_WIDTH,\n} from '../constants.js';\nimport { useMapZoomState, useSetStateZoom } from '../store/store.js';\nimport { MapToolbar } from './toolbar/MapToolbar.js';\nimport { LayerIdsContext } from '../contexts/layer-ids.context.js';\nimport { MapDataBoundingBoxContext } from '../contexts/map-data-bounding-box.context.js';\nimport { useActiveInteraction } from '../hooks/use-active-interaction.js';\nimport { useHoverInteraction } from '../hooks/use-hover-interaction.js';\nimport { useMapBaseLayerFeatures } from '../hooks/use-map-base-layer-features.js';\nimport { useMapConfig } from '../hooks/use-map-config.js';\nimport { useMapLoading } from '../hooks/use-map-loading.js';\nimport { useMapPerformance } from '../hooks/use-map-performance.js';\nimport { useMapRuntimeError } from '../hooks/use-map-runtime-error.js';\nimport { useOverlayEvents } from '../hooks/use-overlay-events.js';\nimport { useTooltipEventListeners } from '../hooks/use-tooltip-event-listeners.js';\nimport { defaultStyle } from '../map-styles/default-style.js';\nimport { MapViewImperativeHandler } from '../providers/imperative-handler.provider.js';\nimport type {\n MapViewProps,\n MapViewRef,\n ViewStateRequired,\n} from '../types/map-view.js';\nimport { getColorFromToken } from '../utils/get-color-from-token.js';\nimport { getDataLayersBoundingBox } from '../utils/get-data-layers-bounding-box.js';\nimport { toMapBoxInitialViewState } from '../utils/to-mapbox-initial-view-state.js';\nimport { useSetMapInitialConfiguration } from '../utils/use-set-map-initial-configuration.js';\nimport { generateNewZoomState } from './toolbar/utils/zoom-state-utils.js';\n\nconst lineLayer: LayerProps = {\n id: BASE_LAYER_LINE_ID,\n type: 'line',\n};\n\nconst fillLayer: LayerProps = {\n id: BASE_LAYER_FILL_ID,\n type: 'fill',\n};\n\nconst MapSource = () => {\n const baseLayerFeatures = useMapBaseLayerFeatures();\n return (\n baseLayerFeatures && (\n <Source id=\"data\" type=\"geojson\" data={baseLayerFeatures}>\n <Layer\n {...fillLayer}\n paint={{\n 'fill-color': getColorFromToken(DEFAULT_COUNTRIES_FILL_COLOR),\n }}\n />\n <Layer\n {...lineLayer}\n type=\"line\"\n filter={[\n 'any',\n ['==', 'region_type', 'COUNTRY'],\n ['==', 'region_type', 'REGION'],\n ]}\n paint={{\n 'line-color': getColorFromToken(DEFAULT_BOUNDARIES_BORDER_COLOR),\n 'line-width': [\n 'case',\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n </Source>\n )\n );\n};\n\nconst MapInteractions = ({\n children,\n onContextLostError,\n interactiveLayerIds,\n}: PropsWithChildren<{\n onContextLostError?: () => void;\n interactiveLayerIds: string[];\n}>) => {\n const [runtimeError, setRuntimeError] = useState<Error | null>(null);\n\n const onRuntimeError = useCallback(() => {\n onContextLostError?.();\n setRuntimeError(\n new Error(\n 'The map encountered repeated rendering errors and could not recover. Please reload the page.',\n ),\n );\n }, [onContextLostError]);\n\n useHoverInteraction(interactiveLayerIds);\n useActiveInteraction(interactiveLayerIds);\n useMapRuntimeError({ onError: onRuntimeError });\n\n if (runtimeError) {\n throw runtimeError;\n }\n\n return children;\n};\ntype MapContentProps = MapViewProps & {\n onMapLoad: () => void;\n};\n\nexport const MapContent = forwardRef<\n MapViewRef,\n PropsWithChildren<MapContentProps>\n>((props, forwardedRef) => {\n const {\n initialViewState: initialViewStateProp,\n children,\n style,\n mapStyle = defaultStyle,\n onViewStateChange,\n onMapLoad,\n onContextLostError,\n ...remaining\n } = props;\n\n const loading = useMapLoading();\n const setZoomState = useSetStateZoom();\n const [savedInitialViewState, setSavedInitialViewState] = useState<\n ViewStateRequired | undefined\n >();\n\n const mapContainerRef = useRef<HTMLDivElement>(null);\n\n const mergedRefs = useMergeRefs<MapViewRef | HTMLDivElement>([\n mapContainerRef,\n forwardedRef,\n ]);\n\n const baseFeatureCollection = useMapBaseLayerFeatures();\n\n const dataLayersBBox = getDataLayersBoundingBox(\n children,\n baseFeatureCollection?.features,\n );\n\n useTooltipEventListeners();\n\n const { toolbar: toolbarConfig, interactions: interactionsConfig } =\n useMapConfig();\n const layerIds = useContext(LayerIdsContext);\n\n const shouldRenderToolbar =\n (!isUndefined(toolbarConfig) && !toolbarConfig.hidden) ||\n !isUndefined(interactionsConfig);\n\n const { height: graphHeight, width: graphWidth } = useGraphSize();\n\n const {\n handleMouseEnter,\n handleMouseMove,\n handleMouseLeave,\n handleMouseClick,\n handleZoom,\n handleDrag,\n } = useOverlayEvents();\n\n const initialViewState = initialViewStateProp ?? dataLayersBBox;\n\n const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);\n const calculatedInitialViewState = toMapBoxInitialViewState(initialViewState);\n\n const { zoomToFitInProgress } = useMapZoomState();\n\n const handleZoomEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n const handleDragEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n const isZoomEnabled = toolbarConfig?.zoom?.enabled !== false;\n\n return (\n <div\n data-testid=\"map-container\"\n ref={mergedRefs}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Map\n style={{\n width: graphWidth,\n height: `${graphHeight}px`,\n ...style,\n }}\n onMove={(evt) => {\n onViewStateChange?.(evt.viewState);\n }}\n initialViewState={calculatedInitialViewState}\n mapStyle={mapStyle}\n dragRotate={false}\n fadeDuration={0}\n renderWorldCopies={false}\n interactiveLayerIds={layerIds}\n maxBounds={[\n [MIN_LONGITUDE, MIN_LATITUDE],\n [MAX_LONGITUDE, MAX_LATITUDE],\n ]}\n onMouseMove={(e) => handleMouseMove(e as MapLayerMouseEvent)}\n onClick={(e) => handleMouseClick(e as MapLayerMouseEvent)}\n onZoom={handleZoom}\n onZoomEnd={handleZoomEnd}\n onDrag={handleDrag}\n onDragEnd={handleDragEnd}\n boxZoom={isZoomEnabled}\n keyboard={isZoomEnabled}\n scrollZoom={isZoomEnabled}\n doubleClickZoom={isZoomEnabled}\n attributionControl={false}\n onRender={() => onRenderHandler && onRenderHandler()}\n onLoad={(e) => {\n onMapLoad();\n onLoadHandler && onLoadHandler();\n\n const initialCenter = e.target.getCenter();\n\n setSavedInitialViewState({\n latitude: initialCenter.lat,\n longitude: initialCenter.lng,\n zoom: e.target.getZoom(),\n });\n }}\n ref={useSetMapInitialConfiguration()}\n interactive\n {...remaining}\n >\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapViewImperativeHandler\n forwardedRef={forwardedRef}\n containerRef={mapContainerRef}\n >\n <MapSource />\n {loading ? null : (\n <>\n <MapInteractions\n onContextLostError={onContextLostError}\n interactiveLayerIds={layerIds}\n >\n {children}\n </MapInteractions>\n {shouldRenderToolbar ? <MapToolbar /> : null}\n </>\n )}\n </MapViewImperativeHandler>\n </MapDataBoundingBoxContext.Provider>\n </Map>\n </div>\n );\n});\n\n(MapContent as typeof MapContent & { displayName: string }).displayName =\n 'MapContent';\n"],
|
|
5
|
+
"mappings": "AAyEM,SAqNQ,UApNN,KADF;AAzEN;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,mBAAmB;AAE5B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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oB;AAAA,UACpB,UAAU,MAAM,mBAAmB,gBAAgB;AAAA,UACnD,QAAQ,CAAC,MAAM;AACb,sBAAU;AACV,6BAAiB,cAAc;AAE/B,kBAAM,gBAAgB,EAAE,OAAO,UAAU;AAEzC,qCAAyB;AAAA,cACvB,UAAU,cAAc;AAAA,cACxB,WAAW,cAAc;AAAA,cACzB,MAAM,EAAE,OAAO,QAAQ;AAAA,YACzB,CAAC;AAAA,UACH;AAAA,UACA,KAAK,8BAA8B;AAAA,UACnC,aAAW;AAAA,UACV,GAAG;AAAA,UAEJ,8BAAC,0BAA0B,UAA1B,EAAmC,OAAO,gBACzC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,cAAc;AAAA,cAEd;AAAA,oCAAC,aAAU;AAAA,gBACV,UAAU,OACT,iCACE;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACC;AAAA,sBACA,qBAAqB;AAAA,sBAEpB;AAAA;AAAA,kBACH;AAAA,kBACC,sBAAsB,oBAAC,cAAW,IAAK;AAAA,mBAC1C;AAAA;AAAA;AAAA,UAEJ,GACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAEA,WAA2D,cAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/map/contexts/geo-data-lookup.context.ts"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\n\n/**\n * @internal\n */\nexport type GeoDataLookup = Map<number, unknown>;\n\n/**\n * @internal\n */\nexport type GeoDataLookupRegistry = Map<string, GeoDataLookup>;\n\nexport const GeoDataLookupContext = createContext<GeoDataLookupRegistry>(\n new Map(),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAYvB,MAAM,uBAAuB;AAAA,EAClC,oBAAI,IAAI;AACV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|