@cccsaurora/clue-ui 1.0.2 → 1.1.0-dev.10
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/ActionForm-D4ryHO0M.js +436 -0
- package/AnnotationDetails-YAPoqw3R.js +175 -0
- package/AnnotationPreview-DiQDjt9s.js +188 -0
- package/ClueEnrichContext-DIn6g8tw.js +522 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_Map-kgDsDYxq.js +64 -0
- package/_MapCache-DabaaWfq.js +161 -0
- package/_Uint8Array-BlVVH1tp.js +129 -0
- package/_baseAssignValue-CNbcU6Nb.js +25 -0
- package/_baseClone-D3a8Pa4T.js +284 -0
- package/_baseExtremum-B1o1zHjR.js +33 -0
- package/_baseFlatten-D4huXoEI.js +92 -0
- package/_baseGet-BSK_nnoz.js +109 -0
- package/_baseIsEqual-B5xLoweL.js +238 -0
- package/_baseIteratee-p6Nj07-n.js +126 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-CpupKWcL.js +89 -0
- package/_commonjsHelpers-CUmg6egw.js +6 -0
- package/_createAggregator-BpVy5xMi.js +63 -0
- package/_getPrototype-D1LAdQKO.js +5 -0
- package/_getTag-D3ToyefI.js +126 -0
- package/cloneDeep-CjP5k9zW.js +8 -0
- package/components/AnnotationBody.js +49 -34
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +6 -6
- package/components/AnnotationEntry.js +50 -47
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +104 -92
- package/components/EnrichedChip.js +134 -109
- package/components/EnrichedTypography.js +136 -110
- package/components/ErrorBoundary.js +28 -24
- package/components/RetryFailedEnrichments.js +10 -9
- package/components/SourcePicker.js +57 -49
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +64 -50
- package/components/actions/ResultModal.js +37 -34
- package/components/actions/form/schemaAdapter.js +39 -20
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +92 -76
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +258 -200
- package/components/display/graph/visualizations/Leaf.js +88 -69
- package/components/display/graph/visualizations/cloud/index.js +98 -81
- package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
- package/components/display/graph/visualizations/icons/index.js +14 -13
- package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
- package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +407 -305
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/DynamicTabs.js +22 -17
- package/components/display/markdown/index.js +8527 -5670
- package/components/display/markdown/markdownPlugins/tabs.js +1 -1
- package/components/enrichment/EnrichPopover.js +55 -47
- package/components/fetchers/Fetcher.js +123 -95
- package/components/fetchers/PreviewModal.js +20 -17
- package/components/fetchers/StatusChip.js +22 -18
- package/components/group/Entry.js +13 -11
- package/components/group/Group.js +13 -10
- package/components/group/GroupControl.js +76 -65
- package/components/stats/QueryStatus.js +37 -28
- package/countBy-C69WslUA.js +14 -0
- package/data/event.js +6 -4
- package/database/index.js +2 -2
- package/debounce-bV0h5FC5.js +92 -0
- package/get-D3C3lEU3.js +8 -0
- package/groupBy-DC2oOuBN.js +14 -0
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +29 -23
- package/hooks/ClueConfigProvider.js +14 -12
- package/hooks/ClueDatabaseContext.js +19 -13
- package/hooks/ClueEnrichContext.js +8 -8
- package/hooks/ClueFetcherContext.js +74 -46
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +12 -10
- package/hooks/selectors.js +22 -11
- package/hooks/useAnnotations.js +45 -29
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +5 -5
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +63 -43
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +84 -68
- package/icons/Context.js +75 -61
- package/icons/Opinion.js +77 -65
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-BDVjGvMI.js +696 -0
- package/index-BHPT3qoB.js +1172 -0
- package/index-BMxyILVD.js +465 -0
- package/index-BbPn6-Mw.js +15750 -0
- package/index-Dz1kF2MU.js +17654 -0
- package/isEmpty-BQkZubqU.js +29 -0
- package/isNil-CIubwp4T.js +6 -0
- package/isObject-FTY-5JQX.js +7 -0
- package/isObjectLike-OAgjjZye.js +48 -0
- package/isSymbol-Xd2FsJyp.js +8 -0
- package/last-CUCl67Im.js +7 -0
- package/main.js +58 -58
- package/package.json +1 -1
- package/sortBy-B-UKp4GT.js +100 -0
- package/sumBy-MYkDPHZL.js +8 -0
- package/tabs-xGuUGsJd.js +254 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/useClueTypeConfig-CH-nGq6a.js +3184 -0
- package/utils/chain.js +91 -64
- package/utils/classificationParser.js +519 -256
- package/utils/constants.js +35 -10
- package/utils/graph.js +72 -45
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +131 -81
- package/utils/loggerUtil.js +5 -3
- package/utils/sessionStorage.js +41 -29
- package/utils/utils.js +9 -9
- package/utils/window.js +21 -10
- package/utils-Dr4wbKBZ.js +4182 -0
- package/ActionForm-BtTv0s4P.js +0 -340
- package/AnnotationDetails-D5tBIeEw.js +0 -160
- package/AnnotationPreview-CZr_CcZC.js +0 -140
- package/ClueEnrichContext-DH9lqjwH.js +0 -401
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_Map-DXNg_Z-q.js +0 -54
- package/_MapCache-Cu25RRDU.js +0 -129
- package/_Uint8Array-DlJCtTvG.js +0 -102
- package/_baseAssignValue-CUmzp727.js +0 -20
- package/_baseClone-BlMmRXeX.js +0 -208
- package/_baseExtremum-P_0akmCi.js +0 -27
- package/_baseFlatten-CN7vDNEQ.js +0 -72
- package/_baseGet-Dgf6_xCm.js +0 -80
- package/_baseIsEqual-Cpjtfb3Q.js +0 -173
- package/_baseIteratee-CP1bocOX.js +0 -95
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-tMFmk80M.js +0 -61
- package/_commonjsHelpers-C6fGbg64.js +0 -6
- package/_createAggregator-B4Cav8ZM.js +0 -53
- package/_getPrototype-CHAFQYL_.js +0 -5
- package/_getTag-BV_UoLYG.js +0 -90
- package/cloneDeep-BPVpFBzJ.js +0 -8
- package/countBy-DOutsa_w.js +0 -8
- package/debounce-DryYcbJ4.js +0 -56
- package/get-Bow1vKwx.js +0 -8
- package/groupBy-BheQYl6f.js +0 -8
- package/iconify-BBckr5AQ.js +0 -1263
- package/identity-ByMq8VxU.js +0 -6
- package/index-BUcHmehh.js +0 -975
- package/index-Bo-v5IAc.js +0 -12754
- package/index-CnaCBNrd.js +0 -358
- package/index-E7g8cRyW.js +0 -568
- package/index-p5_wX7q1.js +0 -11729
- package/isEmpty-g47Qir2A.js +0 -21
- package/isNil-CjWwlQS3.js +0 -6
- package/isObject-B53jY8Qg.js +0 -7
- package/isObjectLike-BatpeCIi.js +0 -29
- package/isSymbol-C3_SC0Qp.js +0 -8
- package/last-7CdUxN0r.js +0 -7
- package/sortBy-ITdmD17L.js +0 -79
- package/sumBy-DxJUU2E8.js +0 -8
- package/tabs-CgADNA57.js +0 -195
- package/toFinite-BMy6GObD.js +0 -14
- package/toNumber-YVhnnJv4.js +0 -31
- package/useClueTypeConfig-CneP98N_.js +0 -2260
- package/utils-CD0rFIFU.js +0 -2704
|
@@ -1,194 +1,252 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { useMemo
|
|
3
|
-
import { useTheme
|
|
4
|
-
import { p as
|
|
5
|
-
import { z as
|
|
6
|
-
import
|
|
7
|
-
import { useMyLocalStorageItem
|
|
8
|
-
import { StorageKey
|
|
9
|
-
import { g as
|
|
10
|
-
import { cssImportant
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
const
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState, useEffect, useCallback, createElement } from "react";
|
|
3
|
+
import { useTheme, lighten, darken, Stack, Card, Typography, alpha, Autocomplete, TextField, FormControl, InputLabel, Select, MenuItem, IconButton, Collapse } from "@mui/material";
|
|
4
|
+
import { p as parseEvent } from "../../../index-BMxyILVD.js";
|
|
5
|
+
import { z as zoom, i as identity, s as select, t as transform, p as pointer } from "../../../index-BbPn6-Mw.js";
|
|
6
|
+
import useComparator from "../../../hooks/useComparator.js";
|
|
7
|
+
import { useMyLocalStorageItem } from "../../../hooks/useMyLocalStorage.js";
|
|
8
|
+
import { StorageKey } from "../../../utils/constants.js";
|
|
9
|
+
import { g as get } from "../../../get-D3C3lEU3.js";
|
|
10
|
+
import { cssImportant } from "../../../utils/graph.js";
|
|
11
|
+
import Iconified from "../icons/Iconified.js";
|
|
12
|
+
import ExpandMoreButton from "./ExpandMoreButton.js";
|
|
13
|
+
import Cloud from "./visualizations/cloud/index.js";
|
|
14
|
+
import NodePanel from "./visualizations/panels/NodePanel.js";
|
|
15
|
+
import Tree from "./visualizations/tree/index.js";
|
|
16
|
+
const Graph = ({ graph, sx = {} }) => {
|
|
17
|
+
var _a, _b, _c, _d, _e;
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
|
|
20
|
+
const { runComparator } = useComparator();
|
|
21
|
+
const svgRef = useRef();
|
|
22
|
+
const pointRef = useRef();
|
|
23
|
+
const [showMousePos] = useMyLocalStorageItem(StorageKey.SHOW_MOUSE_POS, false);
|
|
24
|
+
const [showCoordinates] = useMyLocalStorageItem(StorageKey.SHOW_COORDINATES, false);
|
|
25
|
+
const [panelLocation] = useMyLocalStorageItem(StorageKey.PANEL_LOCATION, "vertical");
|
|
26
|
+
const [relativeMousePos, setRelativeMousePos] = useState(["0", "0"]);
|
|
27
|
+
const [absoluteMousePos, setAbsoluteMousePos] = useState(["0", "0"]);
|
|
28
|
+
const [showPanel, setShowPanel] = useState(false);
|
|
29
|
+
const nodeIds = useMemo(() => ((graph == null ? void 0 : graph.data) ?? []).flat(2).map((node) => node.id), [graph == null ? void 0 : graph.data]);
|
|
30
|
+
const zoom$1 = useMemo(() => zoom().scaleExtent([0.1, 6]), []);
|
|
31
|
+
const [currentZoom, setCurrentZoom] = useState(identity);
|
|
32
|
+
const [nodeId, setNodeId] = useState("");
|
|
33
|
+
const [selectedNodeIds, setSelectedNodeIds] = useState([]);
|
|
34
|
+
const [viz, setViz] = useState(
|
|
35
|
+
((_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.type) ?? "tree"
|
|
36
|
+
);
|
|
37
|
+
const [hasError, setHasError] = useState(false);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setShowPanel(selectedNodeIds.length > 0);
|
|
40
|
+
}, [selectedNodeIds]);
|
|
41
|
+
const labelKeys = useMemo(
|
|
25
42
|
() => {
|
|
26
|
-
var
|
|
27
|
-
return (
|
|
43
|
+
var _a2, _b2;
|
|
44
|
+
return (_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.displayField) == null ? void 0 : _b2.filter((entry) => (entry.zoom ?? Number.MAX_SAFE_INTEGER) > currentZoom.k);
|
|
28
45
|
},
|
|
29
|
-
[(
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
[(_c = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c.displayField, currentZoom.k]
|
|
47
|
+
);
|
|
48
|
+
const onNodeChange = useCallback((node) => {
|
|
49
|
+
setNodeId(node);
|
|
50
|
+
}, []);
|
|
51
|
+
const checkForNode = useCallback((_nodeId) => {
|
|
52
|
+
const selector = _nodeId === "view" ? _nodeId : `node-${_nodeId ?? "will\\%never\\$ever\\*exist"}`;
|
|
53
|
+
return select(`#${selector}`);
|
|
54
|
+
}, []);
|
|
55
|
+
const selectNode = useCallback(() => {
|
|
56
|
+
if (!nodeId) {
|
|
57
|
+
setHasError(true);
|
|
38
58
|
return;
|
|
39
59
|
}
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
60
|
+
const nodeToGet = checkForNode(nodeId.replace(/[^A-Za-z0-9]*/g, ""));
|
|
61
|
+
if (nodeToGet.empty()) {
|
|
62
|
+
setHasError(true);
|
|
43
63
|
return;
|
|
44
64
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
setHasError(false);
|
|
66
|
+
setSelectedNodeIds([nodeId]);
|
|
67
|
+
const clientRect = svgRef.current.getBoundingClientRect();
|
|
68
|
+
const svg = select(svgRef.current);
|
|
69
|
+
const box = nodeToGet.node().getBBox();
|
|
70
|
+
svg.transition().duration(500).call(
|
|
71
|
+
zoom$1.transform,
|
|
72
|
+
identity.translate(clientRect.width / 2, clientRect.height / 2).scale(4).translate(-box.x, -box.y)
|
|
50
73
|
);
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
}, [checkForNode, nodeId, zoom$1.transform]);
|
|
75
|
+
const onKeyPress = useCallback(
|
|
76
|
+
(event) => {
|
|
77
|
+
const parsedEvent = parseEvent(event);
|
|
78
|
+
if (parsedEvent.isCtrl && parsedEvent.isEnter) {
|
|
79
|
+
selectNode();
|
|
80
|
+
}
|
|
55
81
|
},
|
|
56
|
-
[
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
82
|
+
[selectNode]
|
|
83
|
+
);
|
|
84
|
+
const findNode = useCallback((id) => ((graph == null ? void 0 : graph.data) ?? []).flat().find((n) => n.id === id), [graph == null ? void 0 : graph.data]);
|
|
85
|
+
const resetZoom = useCallback(
|
|
86
|
+
(instant = false) => {
|
|
87
|
+
if (!graph) {
|
|
60
88
|
return;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
89
|
+
}
|
|
90
|
+
const box = select(svgRef.current).select("#view").node().getBBox();
|
|
91
|
+
const clientRect = svgRef.current.getBoundingClientRect();
|
|
92
|
+
const zoomLevel = Math.min(clientRect.width / (box.width + 25), (clientRect.height - 96) / box.height);
|
|
93
|
+
let selection = select(svgRef.current);
|
|
94
|
+
if (!instant) {
|
|
95
|
+
selection = selection.transition().duration(500);
|
|
96
|
+
}
|
|
97
|
+
selection.call(
|
|
98
|
+
zoom$1.transform,
|
|
99
|
+
identity.translate(clientRect.width / 2, (clientRect.height + 96) / 2).scale(zoomLevel).translate(-box.width / 2, -box.height / 2 - 10)
|
|
66
100
|
);
|
|
67
101
|
},
|
|
68
|
-
[
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
[zoom$1.transform, graph]
|
|
103
|
+
);
|
|
104
|
+
const onNodeSelectionChanged = useCallback((_nodeIds) => setSelectedNodeIds(_nodeIds), []);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!graph) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
pointRef.current = svgRef.current.createSVGPoint();
|
|
110
|
+
select(svgRef.current).call(
|
|
111
|
+
zoom$1.on("zoom", (event) => {
|
|
112
|
+
setCurrentZoom == null ? void 0 : setCurrentZoom(event.transform);
|
|
113
|
+
select(svgRef.current).select("#view").attr("transform", event.transform);
|
|
74
114
|
})
|
|
75
|
-
)
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
);
|
|
116
|
+
}, [setCurrentZoom, zoom$1, viz, graph]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (showMousePos) {
|
|
119
|
+
select(svgRef.current).on("mousemove", (event) => {
|
|
120
|
+
const _zoom = transform(select(svgRef.current).select("#view").node());
|
|
121
|
+
setAbsoluteMousePos(_zoom.invert(pointer(event)).map((n) => n.toFixed(0)));
|
|
122
|
+
setRelativeMousePos(pointer(event).map((n) => n.toFixed(0)));
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, [showMousePos, graph]);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
resetZoom();
|
|
128
|
+
}, [viz, graph == null ? void 0 : graph.data]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
var _a2, _b2, _c2, _d2;
|
|
131
|
+
if ((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.type) {
|
|
132
|
+
setViz((_d2 = (_c2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c2.visualization) == null ? void 0 : _d2.type);
|
|
133
|
+
}
|
|
134
|
+
}, [(_e = (_d = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _d.visualization) == null ? void 0 : _e.type]);
|
|
135
|
+
const treeOptions = useMemo(
|
|
88
136
|
() => ({
|
|
89
|
-
textColor:
|
|
90
|
-
backgroundColor:
|
|
137
|
+
textColor: theme.palette.text.primary,
|
|
138
|
+
backgroundColor: theme.palette.background.paper,
|
|
91
139
|
nodeColor: {
|
|
92
|
-
border: (
|
|
140
|
+
border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
|
|
93
141
|
center: "white"
|
|
94
142
|
}
|
|
95
143
|
}),
|
|
96
|
-
[
|
|
97
|
-
)
|
|
144
|
+
[isDark, theme.palette.background.paper, theme.palette.text.primary]
|
|
145
|
+
);
|
|
146
|
+
const cloudOptions = useMemo(
|
|
98
147
|
() => ({
|
|
99
|
-
textColor:
|
|
100
|
-
backgroundColor:
|
|
148
|
+
textColor: theme.palette.text.primary,
|
|
149
|
+
backgroundColor: theme.palette.background.paper,
|
|
101
150
|
nodeColor: {
|
|
102
|
-
border: (
|
|
151
|
+
border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
|
|
103
152
|
center: "white"
|
|
104
153
|
}
|
|
105
154
|
}),
|
|
106
|
-
[
|
|
107
|
-
)
|
|
155
|
+
[isDark, theme.palette.background.paper, theme.palette.text.primary]
|
|
156
|
+
);
|
|
157
|
+
const visualizations = useMemo(
|
|
108
158
|
() => ({
|
|
109
|
-
tree: () => /* @__PURE__ */
|
|
110
|
-
|
|
159
|
+
tree: () => /* @__PURE__ */ jsx(
|
|
160
|
+
Tree,
|
|
111
161
|
{
|
|
112
|
-
svgRef
|
|
113
|
-
graph
|
|
114
|
-
labelKeys
|
|
115
|
-
onNodeSelectionChanged
|
|
116
|
-
zoom:
|
|
117
|
-
options:
|
|
162
|
+
svgRef,
|
|
163
|
+
graph,
|
|
164
|
+
labelKeys,
|
|
165
|
+
onNodeSelectionChanged,
|
|
166
|
+
zoom: currentZoom,
|
|
167
|
+
options: treeOptions
|
|
118
168
|
}
|
|
119
169
|
),
|
|
120
|
-
cloud: () => /* @__PURE__ */
|
|
170
|
+
cloud: () => /* @__PURE__ */ jsx(Cloud, { svgRef, graph, options: cloudOptions })
|
|
121
171
|
}),
|
|
122
|
-
[
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
172
|
+
[cloudOptions, currentZoom, graph, labelKeys, onNodeSelectionChanged, treeOptions]
|
|
173
|
+
);
|
|
174
|
+
const suggestions = useMemo(() => {
|
|
175
|
+
return nodeIds.flatMap((id) => {
|
|
176
|
+
var _a2, _b2;
|
|
177
|
+
const node = (((_a2 = graph == null ? void 0 : graph.data) == null ? void 0 : _a2.flat()) ?? []).find((_node) => _node.id === id);
|
|
178
|
+
if (!node) {
|
|
179
|
+
return { id, value: id };
|
|
180
|
+
}
|
|
181
|
+
const key = ((_b2 = labelKeys == null ? void 0 : labelKeys.filter((comparator) => runComparator(comparator, node)).pop()) == null ? void 0 : _b2.label) ?? "id";
|
|
182
|
+
const value = key.split(",").map((_key) => {
|
|
183
|
+
var _a3;
|
|
184
|
+
return (_a3 = get(node, _key)) == null ? void 0 : _a3.toString();
|
|
185
|
+
}).filter((val) => !!val).map((_value) => ({ id, value: _value.trim() }));
|
|
186
|
+
return value;
|
|
187
|
+
});
|
|
188
|
+
}, [graph == null ? void 0 : graph.data, labelKeys, nodeIds, runComparator]);
|
|
189
|
+
return /* @__PURE__ */ jsxs(
|
|
190
|
+
Stack,
|
|
133
191
|
{
|
|
134
|
-
direction:
|
|
192
|
+
direction: panelLocation === "vertical" ? "row" : "column",
|
|
135
193
|
spacing: 1,
|
|
136
194
|
overflow: "hidden",
|
|
137
195
|
height: "100%",
|
|
138
196
|
width: "100%",
|
|
139
|
-
sx
|
|
197
|
+
sx,
|
|
140
198
|
children: [
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
|
|
199
|
+
/* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ jsxs(
|
|
200
|
+
Card,
|
|
143
201
|
{
|
|
144
202
|
variant: "outlined",
|
|
145
203
|
sx: {
|
|
146
204
|
flex: 1,
|
|
147
205
|
position: "relative",
|
|
148
|
-
maxHeight: `calc(100vh - 64px - ${
|
|
206
|
+
maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
|
|
149
207
|
"& #viz": {
|
|
150
|
-
maxHeight: `calc(100vh - 64px - ${
|
|
208
|
+
maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
|
|
151
209
|
width: "100%",
|
|
152
210
|
height: "100%",
|
|
153
|
-
backgroundColor:
|
|
211
|
+
backgroundColor: theme.palette.background.paper
|
|
154
212
|
},
|
|
155
213
|
"& .path": {
|
|
156
|
-
transition:
|
|
157
|
-
duration:
|
|
214
|
+
transition: theme.transitions.create(["opacity"], {
|
|
215
|
+
duration: theme.transitions.duration.short
|
|
158
216
|
})
|
|
159
217
|
},
|
|
160
218
|
"& .node": {
|
|
161
219
|
cursor: "pointer",
|
|
162
220
|
"& > path, & > text, & > polygon, & circle": {
|
|
163
|
-
transition:
|
|
164
|
-
duration:
|
|
221
|
+
transition: theme.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
|
|
222
|
+
duration: theme.transitions.duration.short
|
|
165
223
|
})
|
|
166
224
|
},
|
|
167
225
|
"&.hover > .center": {
|
|
168
|
-
stroke:
|
|
226
|
+
stroke: cssImportant(theme.palette.primary.main)
|
|
169
227
|
},
|
|
170
228
|
"&.hover > .border": {
|
|
171
|
-
stroke:
|
|
229
|
+
stroke: cssImportant(theme.palette.primary.dark)
|
|
172
230
|
},
|
|
173
231
|
"&.selected > .center": {
|
|
174
|
-
stroke:
|
|
232
|
+
stroke: cssImportant(theme.palette.success.main)
|
|
175
233
|
},
|
|
176
234
|
"&.selected > .border": {
|
|
177
|
-
stroke:
|
|
235
|
+
stroke: cssImportant(theme.palette.success.dark)
|
|
178
236
|
},
|
|
179
237
|
"&.selected.hover > .center": {
|
|
180
|
-
stroke:
|
|
238
|
+
stroke: cssImportant(theme.palette.primary.main)
|
|
181
239
|
},
|
|
182
240
|
"&.selected.hover > .border": {
|
|
183
|
-
stroke:
|
|
241
|
+
stroke: cssImportant(theme.palette.primary.dark)
|
|
184
242
|
}
|
|
185
243
|
}
|
|
186
244
|
},
|
|
187
245
|
children: [
|
|
188
|
-
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
|
|
246
|
+
graph ? visualizations[viz]() : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
247
|
+
/* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsx("g", { id: "view" }) }),
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
Typography,
|
|
192
250
|
{
|
|
193
251
|
variant: "h1",
|
|
194
252
|
color: "text.secondary",
|
|
@@ -203,19 +261,19 @@ const et = ({ graph: t, sx: re = {} }) => {
|
|
|
203
261
|
}
|
|
204
262
|
)
|
|
205
263
|
] }),
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
Stack,
|
|
208
266
|
{
|
|
209
267
|
direction: "column",
|
|
210
268
|
spacing: 1,
|
|
211
269
|
sx: {
|
|
212
270
|
position: "absolute",
|
|
213
|
-
top:
|
|
214
|
-
left:
|
|
215
|
-
right:
|
|
271
|
+
top: theme.spacing(1),
|
|
272
|
+
left: theme.spacing(1),
|
|
273
|
+
right: theme.spacing(1)
|
|
216
274
|
},
|
|
217
|
-
children: /* @__PURE__ */
|
|
218
|
-
|
|
275
|
+
children: /* @__PURE__ */ jsxs(
|
|
276
|
+
Stack,
|
|
219
277
|
{
|
|
220
278
|
direction: "row",
|
|
221
279
|
spacing: 1,
|
|
@@ -223,62 +281,62 @@ const et = ({ graph: t, sx: re = {} }) => {
|
|
|
223
281
|
"& > div:first-of-type": {
|
|
224
282
|
flex: 1,
|
|
225
283
|
maxWidth: "775px",
|
|
226
|
-
backgroundColor:
|
|
284
|
+
backgroundColor: alpha(theme.palette.background.paper, 0.8)
|
|
227
285
|
}
|
|
228
286
|
},
|
|
229
287
|
children: [
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
288
|
+
/* @__PURE__ */ jsx(
|
|
289
|
+
Autocomplete,
|
|
232
290
|
{
|
|
233
|
-
disablePortal:
|
|
234
|
-
onChange: (
|
|
235
|
-
onKeyDown:
|
|
236
|
-
options:
|
|
291
|
+
disablePortal: true,
|
|
292
|
+
onChange: (__, value) => onNodeChange(value.id),
|
|
293
|
+
onKeyDown: onKeyPress,
|
|
294
|
+
options: suggestions,
|
|
237
295
|
sx: { width: "400px" },
|
|
238
|
-
getOptionLabel: (
|
|
239
|
-
filterOptions: (
|
|
240
|
-
renderOption: (
|
|
241
|
-
renderInput: (
|
|
242
|
-
|
|
296
|
+
getOptionLabel: (option) => option.value,
|
|
297
|
+
filterOptions: (options, state) => options.filter((opt) => opt.value.toLowerCase().includes(state.inputValue)),
|
|
298
|
+
renderOption: (props, option) => /* @__PURE__ */ createElement("li", { ...props, key: option.id + option.value }, option.value),
|
|
299
|
+
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
300
|
+
TextField,
|
|
243
301
|
{
|
|
244
|
-
...
|
|
245
|
-
error:
|
|
302
|
+
...params,
|
|
303
|
+
error: hasError,
|
|
246
304
|
label: "Enter a node ID, and press [ctrl + enter] to select it. [ctrl + space] will open an autocomplete menu."
|
|
247
305
|
}
|
|
248
306
|
)
|
|
249
307
|
}
|
|
250
308
|
),
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
309
|
+
/* @__PURE__ */ jsxs(FormControl, { sx: { minWidth: "150px", backgroundColor: alpha(theme.palette.background.paper, 0.8) }, children: [
|
|
310
|
+
/* @__PURE__ */ jsx(InputLabel, { id: "viz-label", children: "Visualization" }),
|
|
311
|
+
/* @__PURE__ */ jsx(
|
|
312
|
+
Select,
|
|
255
313
|
{
|
|
256
314
|
label: "Visualization",
|
|
257
315
|
labelId: "viz-label",
|
|
258
|
-
value:
|
|
259
|
-
onChange: (
|
|
316
|
+
value: viz,
|
|
317
|
+
onChange: (event) => setViz(event.target.value),
|
|
260
318
|
sx: { textTransform: "capitalize" },
|
|
261
|
-
children: Object.keys(
|
|
319
|
+
children: Object.keys(visualizations).map((_viz) => /* @__PURE__ */ jsx(MenuItem, { value: _viz, sx: { textTransform: "capitalize" }, children: _viz }, _viz))
|
|
262
320
|
}
|
|
263
321
|
)
|
|
264
322
|
] }),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
|
|
323
|
+
/* @__PURE__ */ jsx(
|
|
324
|
+
ExpandMoreButton,
|
|
267
325
|
{
|
|
268
|
-
disabled:
|
|
269
|
-
expand:
|
|
270
|
-
onClick: () =>
|
|
271
|
-
"aria-expanded":
|
|
326
|
+
disabled: selectedNodeIds.length < 1,
|
|
327
|
+
expand: showPanel,
|
|
328
|
+
onClick: () => setShowPanel(!showPanel),
|
|
329
|
+
"aria-expanded": showPanel,
|
|
272
330
|
"aria-label": "show more",
|
|
273
331
|
size: "small",
|
|
274
332
|
sx: {
|
|
275
333
|
marginLeft: "auto !important",
|
|
276
334
|
alignSelf: "center"
|
|
277
335
|
},
|
|
278
|
-
children: /* @__PURE__ */
|
|
279
|
-
|
|
336
|
+
children: /* @__PURE__ */ jsx(
|
|
337
|
+
Iconified,
|
|
280
338
|
{
|
|
281
|
-
icon:
|
|
339
|
+
icon: panelLocation === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
|
|
282
340
|
fontSize: "medium"
|
|
283
341
|
}
|
|
284
342
|
)
|
|
@@ -289,61 +347,61 @@ const et = ({ graph: t, sx: re = {} }) => {
|
|
|
289
347
|
)
|
|
290
348
|
}
|
|
291
349
|
),
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
|
|
350
|
+
/* @__PURE__ */ jsx(
|
|
351
|
+
Card,
|
|
294
352
|
{
|
|
295
|
-
variant:
|
|
296
|
-
elevation:
|
|
353
|
+
variant: showCoordinates ? "elevation" : "outlined",
|
|
354
|
+
elevation: showCoordinates ? 4 : 0,
|
|
297
355
|
sx: {
|
|
298
356
|
position: "absolute",
|
|
299
|
-
bottom:
|
|
300
|
-
right:
|
|
357
|
+
bottom: theme.spacing(0.5),
|
|
358
|
+
right: theme.spacing(0.5),
|
|
301
359
|
px: 1,
|
|
302
360
|
py: 0.5,
|
|
303
361
|
border: "none !important"
|
|
304
362
|
},
|
|
305
|
-
children: /* @__PURE__ */
|
|
306
|
-
|
|
307
|
-
|
|
363
|
+
children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [
|
|
364
|
+
showCoordinates && /* @__PURE__ */ jsxs("span", { children: [
|
|
365
|
+
currentZoom.x.toFixed(0),
|
|
308
366
|
", ",
|
|
309
|
-
|
|
367
|
+
currentZoom.y.toFixed(0),
|
|
310
368
|
" (",
|
|
311
|
-
|
|
369
|
+
currentZoom.k.toFixed(2),
|
|
312
370
|
"x)"
|
|
313
371
|
] }),
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
|
|
372
|
+
/* @__PURE__ */ jsx(
|
|
373
|
+
IconButton,
|
|
316
374
|
{
|
|
317
|
-
size:
|
|
318
|
-
onClick: () =>
|
|
319
|
-
disabled:
|
|
320
|
-
children: /* @__PURE__ */
|
|
375
|
+
size: showCoordinates ? "small" : "medium",
|
|
376
|
+
onClick: () => resetZoom(),
|
|
377
|
+
disabled: currentZoom.k === identity.k && currentZoom.x === 0 && currentZoom.y === 0,
|
|
378
|
+
children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-refresh", fontSize: showCoordinates ? "small" : "medium" })
|
|
321
379
|
}
|
|
322
380
|
)
|
|
323
381
|
] })
|
|
324
382
|
}
|
|
325
383
|
),
|
|
326
|
-
|
|
327
|
-
|
|
384
|
+
showMousePos && /* @__PURE__ */ jsx(
|
|
385
|
+
Card,
|
|
328
386
|
{
|
|
329
387
|
variant: "elevation",
|
|
330
388
|
elevation: 4,
|
|
331
389
|
sx: {
|
|
332
390
|
position: "absolute",
|
|
333
|
-
bottom:
|
|
334
|
-
left:
|
|
391
|
+
bottom: theme.spacing(0.5),
|
|
392
|
+
left: theme.spacing(0.5),
|
|
335
393
|
px: 1,
|
|
336
394
|
py: 0.5
|
|
337
395
|
},
|
|
338
|
-
children: /* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
|
|
397
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
340
398
|
"(abs: ",
|
|
341
|
-
|
|
399
|
+
absoluteMousePos.join(", "),
|
|
342
400
|
")"
|
|
343
401
|
] }),
|
|
344
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
345
403
|
"(rel: ",
|
|
346
|
-
|
|
404
|
+
relativeMousePos.join(", "),
|
|
347
405
|
")"
|
|
348
406
|
] })
|
|
349
407
|
] }) })
|
|
@@ -352,21 +410,21 @@ const et = ({ graph: t, sx: re = {} }) => {
|
|
|
352
410
|
]
|
|
353
411
|
}
|
|
354
412
|
) }),
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
|
|
413
|
+
/* @__PURE__ */ jsx(
|
|
414
|
+
Collapse,
|
|
357
415
|
{
|
|
358
|
-
in:
|
|
359
|
-
orientation:
|
|
360
|
-
appear:
|
|
361
|
-
unmountOnExit:
|
|
362
|
-
children: /* @__PURE__ */
|
|
363
|
-
|
|
416
|
+
in: showPanel && selectedNodeIds.length > 0,
|
|
417
|
+
orientation: panelLocation === "vertical" ? "horizontal" : "vertical",
|
|
418
|
+
appear: true,
|
|
419
|
+
unmountOnExit: true,
|
|
420
|
+
children: /* @__PURE__ */ jsx(
|
|
421
|
+
Stack,
|
|
364
422
|
{
|
|
365
423
|
direction: "column",
|
|
366
424
|
spacing: 1,
|
|
367
|
-
sx:
|
|
425
|
+
sx: panelLocation === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
|
|
368
426
|
pb: 1,
|
|
369
|
-
children: /* @__PURE__ */
|
|
427
|
+
children: /* @__PURE__ */ jsx(NodePanel, { selectedNodeIds, findNode })
|
|
370
428
|
}
|
|
371
429
|
)
|
|
372
430
|
}
|
|
@@ -376,5 +434,5 @@ const et = ({ graph: t, sx: re = {} }) => {
|
|
|
376
434
|
);
|
|
377
435
|
};
|
|
378
436
|
export {
|
|
379
|
-
|
|
437
|
+
Graph as default
|
|
380
438
|
};
|