@cccsaurora/clue-ui 1.2.4-patch.275 → 1.2.5-dev.298
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-D6gYuFRR.js +5970 -0
- package/AnnotationDetails-Zx4pjBiN.js +175 -0
- package/AnnotationPreview-Dmz7taAU.js +188 -0
- package/ClueEnrichContext-CJEJxrgs.js +541 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_MapCache-WmuDdwuH.js +222 -0
- package/_Uint8Array-B7JqpgFX.js +128 -0
- package/_baseAssignValue-CGTuELqU.js +25 -0
- package/_baseClone-CkNrTyhm.js +283 -0
- package/_baseExtremum-kob8QXyt.js +18 -0
- package/_baseFlatten-jIR_sN_-.js +92 -0
- package/_baseGet-Bx3A4Qfp.js +108 -0
- package/_baseIsEqual-C5OTWzTk.js +208 -0
- package/_baseIteratee-avi7MX2o.js +126 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-BI9GIHMF.js +115 -0
- package/_commonjsHelpers-DWwsNxpa.js +8 -0
- package/_createAggregator-QD8MzKwe.js +63 -0
- package/_getPrototype-CU0j_POw.js +5 -0
- package/_getTag-Ckxxfr88.js +126 -0
- package/_isIterateeCall-Ds3sw2SF.js +17 -0
- package/_setToArray-CaPKQhcz.js +33 -0
- package/cloneDeep-DJrLSw8W.js +8 -0
- package/components/AnnotationBody.js +49 -35
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +7 -7
- package/components/AnnotationEntry.js +35 -35
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +110 -97
- package/components/EnrichedChip.js +130 -105
- package/components/EnrichedTypography.js +133 -107
- 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 +75 -59
- package/components/actions/ResultModal.js +4 -4
- package/components/actions/form/schemaAdapter.js +39 -23
- package/components/actions/formats/FileResult.js +86 -59
- package/components/actions/formats/index.js +21 -10
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +111 -91
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +261 -202
- 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 +408 -306
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/index.js +8678 -5770
- package/components/enrichment/EnrichPopover.js +54 -46
- package/components/fetchers/Fetcher.js +158 -119
- package/components/fetchers/PreviewModal.js +20 -17
- package/components/fetchers/StatusChip.js +21 -17
- 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 +43 -33
- package/countBy-c6S3dvSW.js +14 -0
- package/data/event.js +6 -4
- package/database/index.js +2 -2
- package/debounce-bV0h5FC5.js +92 -0
- package/get-DSsNkRQs.js +8 -0
- package/groupBy-xqz-n0Vd.js +14 -0
- package/hooks/ClueActionContext.d.ts +10 -2
- 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 +83 -56
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +12 -10
- package/hooks/selectors.js +7 -7
- package/hooks/useActionResult.d.ts +1 -0
- package/hooks/useActionResult.js +3 -3
- package/hooks/useAnnotations.js +47 -31
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +6 -4
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useFetcherResult.d.ts +1 -0
- package/hooks/useFetcherResult.js +33 -24
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +66 -37
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +85 -69
- package/icons/Context.js +77 -63
- package/icons/Opinion.js +76 -60
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-AMfoEg_6.js +696 -0
- package/index-B6C2a_Lg.js +1172 -0
- package/index-C12gPw2W.js +17698 -0
- package/index-DCKkHTvx.js +15750 -0
- package/index-JcKyZeoY.js +465 -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 +60 -60
- package/maxBy-IKHzFrCS.js +8 -0
- package/package.json +1 -1
- package/sortBy-DfSj8IoJ.js +96 -0
- package/sumBy-D-hb_NY-.js +8 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/types/RunningActionData.d.ts +1 -0
- package/types/WithActionData.d.ts +1 -0
- package/useClueTypeConfig-Z1LFp01b.js +3289 -0
- package/utils/chain.js +92 -65
- 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 -27
- package/utils/time.js +423 -423
- package/utils/utils.js +9 -9
- package/utils/window.js +21 -10
- package/utils-HmNPuoDB.js +199 -0
- package/ActionForm-CwsfB99X.js +0 -4458
- package/AnnotationDetails-Bw2JdtTL.js +0 -160
- package/AnnotationPreview-BO7rVnOP.js +0 -140
- package/ClueEnrichContext-KqRuuWNS.js +0 -418
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_MapCache-BiTi0iqu.js +0 -180
- package/_Uint8Array-BQNOM9Rr.js +0 -101
- package/_baseAssignValue-CNMLQZco.js +0 -20
- package/_baseClone-BnT-6pyM.js +0 -207
- package/_baseExtremum-Ca2EHgy2.js +0 -16
- package/_baseFlatten-Bfr_Molw.js +0 -72
- package/_baseGet-DSZygzyq.js +0 -79
- package/_baseIsEqual-VgvaAFZG.js +0 -147
- package/_baseIteratee-Dbfsw5z8.js +0 -95
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-BJcj69PL.js +0 -79
- package/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/_createAggregator-k3TuAnxT.js +0 -53
- package/_getPrototype-Cr1Mk7BC.js +0 -5
- package/_getTag-CK2Sffaq.js +0 -90
- package/_isIterateeCall-DkJP7Rbx.js +0 -13
- package/_setToArray-C7yMOeww.js +0 -29
- package/cloneDeep-CF8TtLHr.js +0 -8
- package/countBy-CdYegFSu.js +0 -8
- package/debounce-DryYcbJ4.js +0 -56
- package/get-CH7kz5Ix.js +0 -8
- package/groupBy-br8xmD2R.js +0 -8
- package/iconify-BBckr5AQ.js +0 -1263
- package/identity-ByMq8VxU.js +0 -6
- package/index-BHAe_V9n.js +0 -12768
- package/index-BK-zfYhR.js +0 -358
- package/index-CA5CUNZO.js +0 -975
- package/index-Dj5C04IX.js +0 -568
- package/index-p5_wX7q1.js +0 -11729
- 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/maxBy-Bc0dYHcO.js +0 -8
- package/sortBy-DY2JBf9n.js +0 -75
- package/sumBy-DuMASLPd.js +0 -8
- package/toFinite-BMy6GObD.js +0 -14
- package/toNumber-YVhnnJv4.js +0 -31
- package/useClueTypeConfig-Ct9Ygter.js +0 -2292
- package/utils-DmwSUrum.js +0 -129
|
@@ -1,41 +1,55 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { useTheme
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useMyLocalStorageItem
|
|
6
|
-
import { StorageKey
|
|
7
|
-
import { c as
|
|
8
|
-
import { g as
|
|
9
|
-
import { i as
|
|
10
|
-
import { b as
|
|
11
|
-
import { i as
|
|
12
|
-
import { i as
|
|
13
|
-
import { t as
|
|
14
|
-
import { b as
|
|
15
|
-
import { memo
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
function
|
|
21
|
-
return
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme, colors, Box } from "@mui/material";
|
|
3
|
+
import useComparator from "../../../../../hooks/useComparator.js";
|
|
4
|
+
import useMyHighlights from "../../../../../hooks/useMyHighlights.js";
|
|
5
|
+
import { useMyLocalStorageItem } from "../../../../../hooks/useMyLocalStorage.js";
|
|
6
|
+
import { StorageKey, BUNDLE_SEPARATOR } from "../../../../../utils/constants.js";
|
|
7
|
+
import { c as cloneDeep } from "../../../../../cloneDeep-DJrLSw8W.js";
|
|
8
|
+
import { g as get } from "../../../../../get-DSsNkRQs.js";
|
|
9
|
+
import { i as isNil } from "../../../../../isNil-CIubwp4T.js";
|
|
10
|
+
import { b as baseExtremum, a as baseGt } from "../../../../../_baseExtremum-kob8QXyt.js";
|
|
11
|
+
import { i as identity } from "../../../../../identity-CPGTqrE4.js";
|
|
12
|
+
import { i as isIterateeCall } from "../../../../../_isIterateeCall-Ds3sw2SF.js";
|
|
13
|
+
import { t as toFinite } from "../../../../../toFinite-Bc55msYj.js";
|
|
14
|
+
import { b as baseSum } from "../../../../../_baseSum-D0WC1dN0.js";
|
|
15
|
+
import { memo, useMemo } from "react";
|
|
16
|
+
import NodeCard from "../../elements/NodeCard.js";
|
|
17
|
+
import getIcon from "../icons/index.js";
|
|
18
|
+
import Leaf from "../Leaf.js";
|
|
19
|
+
import BundleLine from "./BundleLine.js";
|
|
20
|
+
function max(array) {
|
|
21
|
+
return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
var nativeCeil = Math.ceil, nativeMax = Math.max;
|
|
24
|
+
function baseRange(start, end, step, fromRight) {
|
|
25
|
+
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
|
|
26
|
+
while (length--) {
|
|
27
|
+
result[++index] = start;
|
|
28
|
+
start += step;
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
28
31
|
}
|
|
29
|
-
function
|
|
30
|
-
return function(
|
|
31
|
-
|
|
32
|
+
function createRange(fromRight) {
|
|
33
|
+
return function(start, end, step) {
|
|
34
|
+
if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
|
|
35
|
+
end = step = void 0;
|
|
36
|
+
}
|
|
37
|
+
start = toFinite(start);
|
|
38
|
+
if (end === void 0) {
|
|
39
|
+
end = start;
|
|
40
|
+
start = 0;
|
|
41
|
+
} else {
|
|
42
|
+
end = toFinite(end);
|
|
43
|
+
}
|
|
44
|
+
step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
|
|
45
|
+
return baseRange(start, end, step);
|
|
32
46
|
};
|
|
33
47
|
}
|
|
34
|
-
var
|
|
35
|
-
function
|
|
36
|
-
return
|
|
48
|
+
var range = createRange();
|
|
49
|
+
function sum(array) {
|
|
50
|
+
return array && array.length ? baseSum(array, identity) : 0;
|
|
37
51
|
}
|
|
38
|
-
const
|
|
52
|
+
const DEFAULT_OPTIONS = {
|
|
39
53
|
textColor: "white",
|
|
40
54
|
nodeColor: {
|
|
41
55
|
border: "grey",
|
|
@@ -50,335 +64,423 @@ const nt = {
|
|
|
50
64
|
linePaddingX: 10,
|
|
51
65
|
linePaddingY: 10,
|
|
52
66
|
lineWidth: 3,
|
|
53
|
-
enableEntryPadding:
|
|
54
|
-
truncateLabels:
|
|
55
|
-
enableTimestamps:
|
|
67
|
+
enableEntryPadding: true,
|
|
68
|
+
truncateLabels: true,
|
|
69
|
+
enableTimestamps: true,
|
|
56
70
|
iconOrientation: "vertical",
|
|
57
71
|
lineDirection: "horizontal",
|
|
58
72
|
rowStep: null,
|
|
59
73
|
// We'll make this dynamic
|
|
60
|
-
belowPrevious:
|
|
74
|
+
belowPrevious: false
|
|
61
75
|
};
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
var
|
|
65
|
-
const
|
|
76
|
+
DEFAULT_OPTIONS.rowStep = DEFAULT_OPTIONS.ySpacing * 2;
|
|
77
|
+
const Tree = ({ svgRef, graph, labelKeys, onNodeSelectionChanged, zoom, options = {} }) => {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const combinedOptions = useMemo(
|
|
66
80
|
() => {
|
|
67
|
-
var
|
|
81
|
+
var _a2, _b2;
|
|
68
82
|
return {
|
|
69
|
-
...
|
|
70
|
-
...
|
|
71
|
-
...((
|
|
83
|
+
...DEFAULT_OPTIONS,
|
|
84
|
+
...options,
|
|
85
|
+
...((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.config) ?? {}
|
|
72
86
|
};
|
|
73
87
|
},
|
|
74
|
-
[(
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
[(_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.config, options]
|
|
89
|
+
);
|
|
90
|
+
const {
|
|
91
|
+
xSpacing: baseXSpacing,
|
|
92
|
+
ySpacing: baseYSpacing,
|
|
93
|
+
linePaddingX: baseLinePaddingX,
|
|
94
|
+
linePaddingY: baseLinePaddingY
|
|
95
|
+
} = combinedOptions;
|
|
96
|
+
const { runComparators, runComparator } = useComparator();
|
|
97
|
+
const { onNodeHoveredChanged, onNodeClicked, nodeOpacities, highlightedPath, highlightedNodes, hoveredNode } = useMyHighlights(graph, (nodeIds) => onNodeSelectionChanged(nodeIds));
|
|
98
|
+
const theme = useTheme();
|
|
99
|
+
const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
|
|
100
|
+
const [showCardsSettings] = useMyLocalStorageItem(StorageKey.SHOW_CARDS, false);
|
|
101
|
+
const [cardCutoff] = useMyLocalStorageItem(StorageKey.CARD_CUTOFF, 2.5);
|
|
102
|
+
const showCards = useMemo(() => zoom.k > cardCutoff && showCardsSettings, [cardCutoff, showCardsSettings, zoom.k]);
|
|
103
|
+
const levels = useMemo(
|
|
104
|
+
() => graph.data.map(
|
|
105
|
+
(level, levelIndex) => level.map((node) => ({
|
|
106
|
+
...node,
|
|
107
|
+
parents: node == null ? void 0 : node.edges,
|
|
108
|
+
level: levelIndex
|
|
86
109
|
}))
|
|
87
110
|
),
|
|
88
|
-
[
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
111
|
+
[graph.data]
|
|
112
|
+
);
|
|
113
|
+
const flatNodes = useMemo(() => levels.flat(), [levels]);
|
|
114
|
+
const [xSpacing, linePaddingX, ySpacing, linePaddingY] = useMemo(() => {
|
|
115
|
+
const baseValues = [
|
|
116
|
+
[baseXSpacing, baseLinePaddingX],
|
|
117
|
+
[baseYSpacing, baseLinePaddingY]
|
|
93
118
|
];
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
119
|
+
if (zoom.k > 1 && showCardsSettings) {
|
|
120
|
+
return baseValues.flatMap(
|
|
121
|
+
(arr, index) => arr.map((_v) => _v * Math.pow(2.5 - index * 1.25, Math.min(zoom.k, 2.5) - 1))
|
|
122
|
+
);
|
|
123
|
+
} else {
|
|
124
|
+
return baseValues.flat();
|
|
125
|
+
}
|
|
126
|
+
}, [baseLinePaddingX, baseLinePaddingY, baseXSpacing, baseYSpacing, showCardsSettings, zoom.k]);
|
|
127
|
+
let portBounds;
|
|
128
|
+
if (!graph || !svgRef.current) {
|
|
129
|
+
portBounds = [
|
|
101
130
|
[0, 0],
|
|
102
131
|
[0, 0]
|
|
103
132
|
];
|
|
104
|
-
else {
|
|
105
|
-
const
|
|
106
|
-
|
|
133
|
+
} else {
|
|
134
|
+
const data = svgRef.current.getBoundingClientRect();
|
|
135
|
+
portBounds = [zoom.invert([0, 0]), zoom.invert([data.width, data.height])];
|
|
107
136
|
}
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
if (!
|
|
137
|
+
const bundles = useMemo(() => {
|
|
138
|
+
const bundlesDict = {};
|
|
139
|
+
flatNodes.forEach((node) => {
|
|
140
|
+
if (!node.parents) {
|
|
112
141
|
return;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
142
|
+
}
|
|
143
|
+
const bundleId = node.parents.join(BUNDLE_SEPARATOR);
|
|
144
|
+
if (bundlesDict[bundleId]) {
|
|
145
|
+
bundlesDict[bundleId].destinations.push(node);
|
|
146
|
+
} else {
|
|
147
|
+
bundlesDict[bundleId] = {
|
|
148
|
+
id: bundleId,
|
|
149
|
+
sources: node.parents.map((parent) => flatNodes.find((_node) => _node.id === parent)),
|
|
150
|
+
destinations: [node]
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return Object.values(bundlesDict);
|
|
155
|
+
}, [flatNodes]);
|
|
156
|
+
const layoutData = useMemo(() => {
|
|
121
157
|
const {
|
|
122
|
-
letterSize
|
|
123
|
-
letterWidth
|
|
124
|
-
enableEntryPadding
|
|
125
|
-
truncateLabels
|
|
126
|
-
rowStep
|
|
127
|
-
belowPrevious
|
|
128
|
-
} =
|
|
129
|
-
let
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
158
|
+
letterSize,
|
|
159
|
+
letterWidth,
|
|
160
|
+
enableEntryPadding,
|
|
161
|
+
truncateLabels,
|
|
162
|
+
rowStep,
|
|
163
|
+
belowPrevious
|
|
164
|
+
} = combinedOptions;
|
|
165
|
+
let currentX = 0;
|
|
166
|
+
let currentY = 0;
|
|
167
|
+
const nodeLocations = {};
|
|
168
|
+
const linesByLevel = {};
|
|
169
|
+
const paddingByLevel = {};
|
|
170
|
+
const inputs = {};
|
|
171
|
+
const outputs = {};
|
|
172
|
+
levels.forEach((level, levelIndex) => {
|
|
173
|
+
let longestLabel = 0;
|
|
174
|
+
level.forEach((node) => {
|
|
175
|
+
var _a2;
|
|
176
|
+
const validKeys = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node));
|
|
177
|
+
const labelKey = (_a2 = validKeys == null ? void 0 : validKeys.pop()) == null ? void 0 : _a2.label;
|
|
178
|
+
const labelRows = (labelKey == null ? void 0 : labelKey.split(",").map((key) => get(node, key)).filter((val) => !!val)) ?? [];
|
|
179
|
+
if (labelRows.length < 1) {
|
|
180
|
+
node.id.split("\n").forEach((line) => labelRows.push(line));
|
|
181
|
+
}
|
|
182
|
+
const labelHeight = labelRows.length * letterSize;
|
|
183
|
+
currentY += labelHeight;
|
|
184
|
+
nodeLocations[node.id] = [+currentX, +currentY, -linePaddingY];
|
|
185
|
+
currentY += ySpacing;
|
|
186
|
+
if (enableEntryPadding) {
|
|
187
|
+
longestLabel = Math.max(longestLabel, max((labelRows == null ? void 0 : labelRows.map((row) => row.toString().length)) ?? [node.id.length]));
|
|
188
|
+
}
|
|
146
189
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
190
|
+
currentX += xSpacing + (!truncateLabels ? longestLabel : Math.min(longestLabel, 44)) * letterWidth;
|
|
191
|
+
if (!belowPrevious) {
|
|
192
|
+
currentY = (levelIndex + 1) * rowStep;
|
|
193
|
+
} else {
|
|
194
|
+
currentY += rowStep;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
bundles.forEach((bundle) => {
|
|
198
|
+
bundle.sources.forEach((source) => {
|
|
199
|
+
if (!outputs[source.id]) {
|
|
200
|
+
outputs[source.id] = /* @__PURE__ */ new Set();
|
|
201
|
+
}
|
|
202
|
+
outputs[source.id].add(bundle.id);
|
|
151
203
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
204
|
+
bundle.destinations.forEach((dest) => {
|
|
205
|
+
if (isNil(linesByLevel[dest.level])) {
|
|
206
|
+
linesByLevel[dest.level] = /* @__PURE__ */ new Set();
|
|
207
|
+
}
|
|
208
|
+
if (!inputs[dest.id]) {
|
|
209
|
+
inputs[dest.id] = /* @__PURE__ */ new Set();
|
|
210
|
+
}
|
|
211
|
+
linesByLevel[dest.level].add(bundle.id);
|
|
212
|
+
inputs[dest.id].add(bundle.id);
|
|
159
213
|
});
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
214
|
+
});
|
|
215
|
+
Object.entries(linesByLevel).forEach(([level, lines]) => paddingByLevel[level] = lines.size);
|
|
216
|
+
levels.forEach((level, levelIndex) => {
|
|
217
|
+
const indexesSoFar = range(levelIndex + 1);
|
|
218
|
+
const paddingArray = indexesSoFar.map((_levelIndex) => paddingByLevel[_levelIndex] ?? 0);
|
|
219
|
+
const totalPadding = sum(paddingArray) * linePaddingX;
|
|
220
|
+
level.forEach((node) => {
|
|
221
|
+
nodeLocations[node.id][0] += totalPadding;
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
flatNodes.forEach((node) => {
|
|
225
|
+
var _a2, _b2, _c2;
|
|
226
|
+
let maxHeight = max([((_a2 = inputs[node.id]) == null ? void 0 : _a2.size) - 1, ((_b2 = outputs[node.id]) == null ? void 0 : _b2.size) - 1, 0]) * linePaddingY;
|
|
227
|
+
if ((_c2 = inputs[node.id]) == null ? void 0 : _c2.has(node.id)) {
|
|
228
|
+
maxHeight += linePaddingY;
|
|
229
|
+
}
|
|
230
|
+
nodeLocations[node.id][2] = maxHeight;
|
|
231
|
+
const levelIndex = levels[node.level].findIndex((_node) => _node.id === node.id);
|
|
232
|
+
levels[node.level].filter((__, index) => levelIndex < index).forEach((_node) => {
|
|
233
|
+
nodeLocations[_node.id][1] += maxHeight;
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
return {
|
|
237
|
+
nodeLocations,
|
|
238
|
+
linesByLevel,
|
|
239
|
+
paddingByLevel
|
|
164
240
|
};
|
|
165
241
|
}, [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
])
|
|
242
|
+
bundles,
|
|
243
|
+
combinedOptions,
|
|
244
|
+
flatNodes,
|
|
245
|
+
labelKeys,
|
|
246
|
+
levels,
|
|
247
|
+
linePaddingX,
|
|
248
|
+
linePaddingY,
|
|
249
|
+
runComparator,
|
|
250
|
+
xSpacing,
|
|
251
|
+
ySpacing
|
|
252
|
+
]);
|
|
253
|
+
const [timestamps, bundleElements, nodes] = useMemo(() => {
|
|
177
254
|
const {
|
|
178
|
-
textColor
|
|
179
|
-
letterSize
|
|
180
|
-
letterWidth
|
|
181
|
-
nodeRadius
|
|
182
|
-
nodeColor
|
|
183
|
-
maxArcRadius
|
|
184
|
-
lineWidth
|
|
185
|
-
truncateLabels
|
|
186
|
-
enableTimestamps
|
|
187
|
-
belowPrevious
|
|
188
|
-
iconOrientation
|
|
189
|
-
lineDirection
|
|
190
|
-
colorTheme
|
|
191
|
-
} =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
t.annotation && t.annotation.split(`
|
|
226
|
-
`).map((y, x) => {
|
|
227
|
-
var Q;
|
|
228
|
-
return /* @__PURE__ */ L(
|
|
255
|
+
textColor,
|
|
256
|
+
letterSize,
|
|
257
|
+
letterWidth,
|
|
258
|
+
nodeRadius,
|
|
259
|
+
nodeColor,
|
|
260
|
+
maxArcRadius,
|
|
261
|
+
lineWidth,
|
|
262
|
+
truncateLabels,
|
|
263
|
+
enableTimestamps,
|
|
264
|
+
belowPrevious,
|
|
265
|
+
iconOrientation,
|
|
266
|
+
lineDirection,
|
|
267
|
+
colorTheme
|
|
268
|
+
} = combinedOptions;
|
|
269
|
+
const { nodeLocations, linesByLevel, paddingByLevel } = layoutData;
|
|
270
|
+
const _nodes = [];
|
|
271
|
+
const _timestamps = [];
|
|
272
|
+
flatNodes.forEach((node) => {
|
|
273
|
+
var _a2, _b2, _c2, _d;
|
|
274
|
+
const [x, y, _height] = nodeLocations[node.id];
|
|
275
|
+
const labelKey = ((_a2 = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node)).pop()) == null ? void 0 : _a2.label) ?? "id";
|
|
276
|
+
let label = labelKey == null ? void 0 : labelKey.split(",").map((key) => {
|
|
277
|
+
let labelSection = get(node, key);
|
|
278
|
+
if (labelSection && truncateLabels && labelSection.length > 44) {
|
|
279
|
+
labelSection = labelSection.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
|
|
280
|
+
}
|
|
281
|
+
return labelSection;
|
|
282
|
+
}).filter((section) => !!section).join("\n");
|
|
283
|
+
if (!label) {
|
|
284
|
+
if (node.id.length > 44) {
|
|
285
|
+
label = node.id.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
|
|
286
|
+
} else {
|
|
287
|
+
label = node.id;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (belowPrevious && enableTimestamps && (node.timestamp || node.annotation)) {
|
|
291
|
+
_timestamps.push(
|
|
292
|
+
/* @__PURE__ */ jsxs(
|
|
293
|
+
"g",
|
|
294
|
+
{
|
|
295
|
+
style: {
|
|
296
|
+
cursor: "default",
|
|
297
|
+
fontFamily: '"Lucida Console", monospace',
|
|
298
|
+
fontSize: letterSize * 0.75 + "px"
|
|
299
|
+
},
|
|
300
|
+
children: [
|
|
301
|
+
/* @__PURE__ */ jsx(
|
|
229
302
|
"text",
|
|
230
303
|
{
|
|
231
|
-
x:
|
|
232
|
-
y:
|
|
233
|
-
fill:
|
|
304
|
+
x: portBounds[0][0] + xSpacing,
|
|
305
|
+
y: y + (_height + nodeRadius) / 2,
|
|
306
|
+
fill: theme.palette.getContrastText(theme.palette.background.paper),
|
|
234
307
|
style: {
|
|
235
|
-
fillOpacity:
|
|
236
|
-
transition:
|
|
237
|
-
duration:
|
|
308
|
+
fillOpacity: nodeOpacities(node.id) / 2,
|
|
309
|
+
transition: theme.transitions.create(["fill-opacity"], {
|
|
310
|
+
duration: theme.transitions.duration.short
|
|
238
311
|
})
|
|
239
312
|
},
|
|
240
|
-
children:
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
313
|
+
children: node.timestamp
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
node.annotation && node.annotation.split("\n").map((line, index) => {
|
|
317
|
+
var _a3;
|
|
318
|
+
return /* @__PURE__ */ jsx(
|
|
319
|
+
"text",
|
|
320
|
+
{
|
|
321
|
+
x: portBounds[0][0] + (((_a3 = node.timestamp) == null ? void 0 : _a3.length) ?? 0) * letterWidth,
|
|
322
|
+
y: y + (_height + nodeRadius) / 2 + index * letterSize,
|
|
323
|
+
fill: isDark ? colors.orange[300] : colors.blue[900],
|
|
324
|
+
style: {
|
|
325
|
+
fillOpacity: nodeOpacities(node.id),
|
|
326
|
+
transition: theme.transitions.create(["fill-opacity"], {
|
|
327
|
+
duration: theme.transitions.duration.short
|
|
328
|
+
})
|
|
329
|
+
},
|
|
330
|
+
children: line
|
|
331
|
+
},
|
|
332
|
+
line
|
|
333
|
+
);
|
|
334
|
+
})
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
node.id + "-timestamp"
|
|
338
|
+
)
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
if (!showCards) {
|
|
342
|
+
const style = runComparators(
|
|
343
|
+
(_c2 = (_b2 = graph.metadata.display) == null ? void 0 : _b2.styles) == null ? void 0 : _c2.filter((comparator) => comparator.type === "node"),
|
|
344
|
+
node
|
|
345
|
+
);
|
|
346
|
+
const nodeOpacity = nodeOpacities(node.id);
|
|
347
|
+
const icons = (_d = node.icons) == null ? void 0 : _d.map((icon) => [icon, getIcon(icon)]).filter(([__, icon]) => !!icon).map(([icon, Icon], index) => /* @__PURE__ */ jsx(
|
|
348
|
+
Icon,
|
|
255
349
|
{
|
|
256
|
-
x:
|
|
257
|
-
y:
|
|
258
|
-
size:
|
|
350
|
+
x: x - nodeRadius * 3 * (iconOrientation === "horizontal" ? index + 1 : 0),
|
|
351
|
+
y: y - nodeRadius * 3 * (iconOrientation === "vertical" ? index + 1 : 0),
|
|
352
|
+
size: letterSize * 1.5,
|
|
259
353
|
style: {
|
|
260
|
-
fillOpacity:
|
|
354
|
+
fillOpacity: nodeOpacity
|
|
261
355
|
},
|
|
262
356
|
circleStyle: {
|
|
263
|
-
fillOpacity:
|
|
357
|
+
fillOpacity: nodeOpacity
|
|
264
358
|
}
|
|
265
359
|
},
|
|
266
|
-
|
|
360
|
+
icon
|
|
267
361
|
));
|
|
268
|
-
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
|
|
362
|
+
_nodes.push(
|
|
363
|
+
/* @__PURE__ */ jsx(
|
|
364
|
+
Leaf,
|
|
271
365
|
{
|
|
272
|
-
alwaysShowText:
|
|
273
|
-
nodeId:
|
|
274
|
-
label
|
|
275
|
-
height:
|
|
276
|
-
x
|
|
277
|
-
y
|
|
278
|
-
style
|
|
279
|
-
nodeRadius
|
|
280
|
-
nodeColor
|
|
281
|
-
nodeOpacity
|
|
282
|
-
letterSize
|
|
283
|
-
letterWidth
|
|
284
|
-
textColor
|
|
285
|
-
selected:
|
|
286
|
-
onHoverChanged:
|
|
287
|
-
onClick:
|
|
288
|
-
children:
|
|
366
|
+
alwaysShowText: true,
|
|
367
|
+
nodeId: node.id,
|
|
368
|
+
label,
|
|
369
|
+
height: _height,
|
|
370
|
+
x,
|
|
371
|
+
y,
|
|
372
|
+
style,
|
|
373
|
+
nodeRadius,
|
|
374
|
+
nodeColor,
|
|
375
|
+
nodeOpacity,
|
|
376
|
+
letterSize,
|
|
377
|
+
letterWidth,
|
|
378
|
+
textColor,
|
|
379
|
+
selected: highlightedNodes.has(node.id),
|
|
380
|
+
onHoverChanged: onNodeHoveredChanged,
|
|
381
|
+
onClick: onNodeClicked,
|
|
382
|
+
children: icons
|
|
289
383
|
},
|
|
290
|
-
|
|
384
|
+
node.id
|
|
291
385
|
)
|
|
292
386
|
);
|
|
293
387
|
}
|
|
294
388
|
});
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
389
|
+
const readonlyNodeLocations = cloneDeep(nodeLocations);
|
|
390
|
+
const outputsByNode = {};
|
|
391
|
+
const inputsByNode = {};
|
|
392
|
+
const _bundleElements = bundles.map((bundle) => {
|
|
393
|
+
return /* @__PURE__ */ jsx(
|
|
394
|
+
BundleLine,
|
|
395
|
+
{
|
|
396
|
+
lineDirection,
|
|
397
|
+
linesByLevel,
|
|
398
|
+
paddingByLevel,
|
|
399
|
+
nodeLocations: readonlyNodeLocations,
|
|
400
|
+
outputsByNode,
|
|
401
|
+
inputsByNode,
|
|
402
|
+
bundle,
|
|
403
|
+
maxArcRadius,
|
|
404
|
+
lineWidth,
|
|
405
|
+
linePaddingX,
|
|
406
|
+
linePaddingY,
|
|
407
|
+
highlightedPath,
|
|
408
|
+
colorTheme
|
|
409
|
+
},
|
|
410
|
+
bundle.id
|
|
411
|
+
);
|
|
412
|
+
});
|
|
413
|
+
return [_timestamps, _bundleElements, _nodes];
|
|
315
414
|
}, [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
])
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
415
|
+
bundles,
|
|
416
|
+
combinedOptions,
|
|
417
|
+
(_c = graph.metadata.display) == null ? void 0 : _c.styles,
|
|
418
|
+
flatNodes,
|
|
419
|
+
highlightedNodes,
|
|
420
|
+
highlightedPath,
|
|
421
|
+
isDark,
|
|
422
|
+
labelKeys,
|
|
423
|
+
layoutData,
|
|
424
|
+
linePaddingX,
|
|
425
|
+
linePaddingY,
|
|
426
|
+
nodeOpacities,
|
|
427
|
+
onNodeClicked,
|
|
428
|
+
onNodeHoveredChanged,
|
|
429
|
+
portBounds,
|
|
430
|
+
runComparator,
|
|
431
|
+
runComparators,
|
|
432
|
+
showCards,
|
|
433
|
+
theme.palette,
|
|
434
|
+
theme.transitions,
|
|
435
|
+
xSpacing
|
|
436
|
+
]);
|
|
437
|
+
const cards = useMemo(() => {
|
|
438
|
+
const { nodeRadius, lineWidth } = combinedOptions;
|
|
439
|
+
const { nodeLocations } = layoutData;
|
|
440
|
+
return flatNodes.filter((node) => showCards || hoveredNode === node.id).map((node) => {
|
|
441
|
+
const [x, y] = nodeLocations[node.id];
|
|
442
|
+
return /* @__PURE__ */ jsx(
|
|
443
|
+
Box,
|
|
343
444
|
{
|
|
344
|
-
onMouseOver: () =>
|
|
345
|
-
onMouseLeave: () => setTimeout(() =>
|
|
445
|
+
onMouseOver: () => onNodeHoveredChanged(node.id, true),
|
|
446
|
+
onMouseLeave: () => setTimeout(() => onNodeHoveredChanged(node.id, false), 100),
|
|
346
447
|
sx: {
|
|
347
448
|
position: "absolute",
|
|
348
|
-
left:
|
|
349
|
-
top:
|
|
350
|
-
transform: `translateX(-${
|
|
351
|
-
backgroundColor:
|
|
449
|
+
left: zoom.k * x + zoom.x,
|
|
450
|
+
top: zoom.k * y + zoom.y,
|
|
451
|
+
transform: `translateX(-${nodeRadius * 2}px) translateY(${lineWidth}px)`,
|
|
452
|
+
backgroundColor: theme.palette.background.paper,
|
|
352
453
|
maxWidth: "450px",
|
|
353
454
|
maxHeight: "500px",
|
|
354
455
|
overflow: "auto"
|
|
355
456
|
},
|
|
356
|
-
children: /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ jsx(NodeCard, { node })
|
|
357
458
|
},
|
|
358
|
-
|
|
459
|
+
node.id
|
|
359
460
|
);
|
|
360
461
|
});
|
|
361
462
|
}, [
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
463
|
+
combinedOptions,
|
|
464
|
+
flatNodes,
|
|
465
|
+
hoveredNode,
|
|
466
|
+
layoutData,
|
|
467
|
+
onNodeHoveredChanged,
|
|
468
|
+
showCards,
|
|
469
|
+
theme.palette.background.paper,
|
|
470
|
+
zoom.k,
|
|
471
|
+
zoom.x,
|
|
472
|
+
zoom.y
|
|
372
473
|
]);
|
|
373
|
-
return /* @__PURE__ */
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
474
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
475
|
+
/* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsxs("g", { id: "view", children: [
|
|
476
|
+
timestamps,
|
|
477
|
+
bundleElements,
|
|
478
|
+
nodes
|
|
378
479
|
] }) }),
|
|
379
|
-
|
|
480
|
+
cards
|
|
380
481
|
] });
|
|
381
|
-
}
|
|
482
|
+
};
|
|
483
|
+
const Tree$1 = memo(Tree);
|
|
382
484
|
export {
|
|
383
|
-
|
|
485
|
+
Tree$1 as default
|
|
384
486
|
};
|