@parca/profile 0.16.184 → 0.16.186

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Callgraph/constants.js +2 -2
  3. package/dist/Callgraph/index.js +35 -45
  4. package/dist/Callgraph/mockData/index.js +28 -11
  5. package/dist/Callgraph/utils.js +51 -58
  6. package/dist/GraphTooltip/ExpandOnHoverValue.js +2 -14
  7. package/dist/GraphTooltip/index.d.ts +5 -5
  8. package/dist/GraphTooltip/index.js +96 -122
  9. package/dist/MatchersInput/SuggestionItem.js +5 -17
  10. package/dist/MatchersInput/SuggestionsList.js +29 -53
  11. package/dist/MatchersInput/index.js +58 -74
  12. package/dist/MetricsCircle/index.js +2 -16
  13. package/dist/MetricsGraph/MetricsTooltip/index.js +27 -53
  14. package/dist/MetricsGraph/index.js +79 -98
  15. package/dist/MetricsSeries/index.js +4 -19
  16. package/dist/ProfileExplorer/ProfileExplorerCompare.js +4 -16
  17. package/dist/ProfileExplorer/ProfileExplorerSingle.js +2 -14
  18. package/dist/ProfileExplorer/index.js +129 -88
  19. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.js +15 -31
  20. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.d.ts +4 -4
  21. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.js +38 -54
  22. package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts +2 -2
  23. package/dist/ProfileIcicleGraph/IcicleGraph/index.js +15 -31
  24. package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.js +22 -26
  25. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.js +8 -9
  26. package/dist/ProfileIcicleGraph/IcicleGraph/utils.js +18 -20
  27. package/dist/ProfileIcicleGraph/index.d.ts +2 -2
  28. package/dist/ProfileIcicleGraph/index.js +18 -30
  29. package/dist/ProfileMetricsGraph/index.js +36 -88
  30. package/dist/ProfileSelector/CompareButton.js +8 -20
  31. package/dist/ProfileSelector/index.js +69 -69
  32. package/dist/ProfileSource.js +56 -65
  33. package/dist/ProfileTypeSelector/index.js +14 -28
  34. package/dist/ProfileView/FilterByFunctionButton.js +6 -7
  35. package/dist/ProfileView/ViewSelector.js +18 -31
  36. package/dist/ProfileView/VisualizationPanel.js +4 -16
  37. package/dist/ProfileView/index.js +72 -152
  38. package/dist/ProfileViewWithData.js +50 -101
  39. package/dist/TopTable/index.js +55 -63
  40. package/dist/components/DiffLegend.js +16 -28
  41. package/dist/components/ProfileShareButton/ResultBox.js +7 -21
  42. package/dist/components/ProfileShareButton/index.js +31 -90
  43. package/dist/useDelayedLoader.js +7 -8
  44. package/dist/useGrpcQuery/index.js +6 -48
  45. package/dist/useQuery.js +14 -58
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/utils.js +16 -68
  48. package/package.json +6 -6
  49. package/src/Callgraph/index.tsx +3 -3
  50. package/src/Callgraph/utils.ts +1 -1
  51. package/src/GraphTooltip/index.tsx +17 -17
  52. package/src/MetricsGraph/index.tsx +3 -3
  53. package/src/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.tsx +9 -10
  54. package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +4 -8
  55. package/src/ProfileIcicleGraph/IcicleGraph/useNodeColor.ts +2 -2
  56. package/src/ProfileIcicleGraph/index.tsx +8 -8
  57. package/src/ProfileView/index.tsx +2 -2
  58. package/src/TopTable/index.tsx +3 -3
  59. package/src/utils.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.16.186 (2023-06-19)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.16.185](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.184...@parca/profile@0.16.185) (2023-06-15)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.16.184](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.183...@parca/profile@0.16.184) (2023-06-15)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -10,5 +10,5 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export var DEFAULT_NODE_HEIGHT = 20;
14
- export var GRAPH_MARGIN = 15;
13
+ export const DEFAULT_NODE_HEIGHT = 20;
14
+ export const GRAPH_MARGIN = 15;
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
2
  // Copyright 2022 The Parca Authors
14
3
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,19 +20,18 @@ import { Button, useKeyDown, useURLState } from '@parca/components';
31
20
  import { selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector } from '@parca/store';
32
21
  import { getNewSpanColor } from '@parca/utilities';
33
22
  import GraphTooltip from '../GraphTooltip';
34
- var Callgraph = function (_a) {
35
- var data = _a.data, svgString = _a.svgString, sampleUnit = _a.sampleUnit, width = _a.width;
36
- var originalView = {
23
+ const Callgraph = ({ data, svgString, sampleUnit, width }) => {
24
+ const originalView = {
37
25
  scale: 1,
38
26
  translation: { x: 0, y: 0 },
39
27
  };
40
- var _b = useState(originalView), view = _b[0], setView = _b[1];
41
- var containerRef = useRef(null);
42
- var svgRef = useRef(null);
43
- var svgWrapper = useRef(null);
44
- var _c = useState(false), svgWrapperLoaded = _c[0], setSvgWrapperLoaded = _c[1];
45
- var dispatch = useAppDispatch();
46
- var isShiftDown = useKeyDown().isShiftDown;
28
+ const [view, setView] = useState(originalView);
29
+ const containerRef = useRef(null);
30
+ const svgRef = useRef(null);
31
+ const svgWrapper = useRef(null);
32
+ const [svgWrapperLoaded, setSvgWrapperLoaded] = useState(false);
33
+ const dispatch = useAppDispatch();
34
+ const { isShiftDown } = useKeyDown();
47
35
  // TODO: implement highlighting nodes on user search
48
36
  // const currentSearchString = (selectQueryParam('search_string') as string) ?? '';
49
37
  // const isSearchEmpty = currentSearchString === undefined || currentSearchString === '';
@@ -51,41 +39,43 @@ var Callgraph = function (_a) {
51
39
  // ? true
52
40
  // : isSearchMatch(currentSearchString, sourceNode.functionName) &&
53
41
  // isSearchMatch(currentSearchString, targetNode.functionName);
54
- var rawDashboardItems = useURLState({ param: 'dashboard_items' })[0];
55
- var dashboardItems = rawDashboardItems !== undefined ? rawDashboardItems : ['icicle'];
56
- var isDarkMode = useAppSelector(selectDarkMode);
57
- var maxColor = getNewSpanColor(isDarkMode);
58
- var minColor = d3.scaleLinear([isDarkMode ? 'black' : 'white', maxColor])(0.3);
59
- var colorRange = [minColor, maxColor];
60
- var cumulatives = data.edges.map(function (edge) { return parseInt(edge.cumulative); });
61
- var cumulativesRange = d3.extent(cumulatives);
62
- var colorScale = d3
42
+ const [rawDashboardItems] = useURLState({ param: 'dashboard_items' });
43
+ const dashboardItems = rawDashboardItems !== undefined ? rawDashboardItems : ['icicle'];
44
+ const isDarkMode = useAppSelector(selectDarkMode);
45
+ const maxColor = getNewSpanColor(isDarkMode);
46
+ const minColor = d3.scaleLinear([isDarkMode ? 'black' : 'white', maxColor])(0.3);
47
+ const colorRange = [minColor, maxColor];
48
+ const cumulatives = data.edges.map((edge) => edge.cumulative.toString());
49
+ const cumulativesRange = d3.extent(cumulatives);
50
+ const colorScale = d3
63
51
  .scaleSequentialLog(d3.interpolateBlues)
64
52
  .domain([Number(cumulativesRange[0]), Number(cumulativesRange[1])])
65
53
  .range(colorRange);
66
- useEffect(function () {
54
+ useEffect(() => {
67
55
  setSvgWrapperLoaded(true);
68
56
  }, []);
69
- useEffect(function () {
57
+ useEffect(() => {
70
58
  if (svgWrapperLoaded && svgRef.current !== null) {
71
- var addInteraction = function () {
72
- var svg = d3.select(svgRef.current);
73
- var nodes = svg.selectAll('.node');
59
+ const addInteraction = () => {
60
+ const svg = d3.select(svgRef.current);
61
+ const nodes = svg.selectAll('.node');
74
62
  nodes.each(function () {
75
- var _this = this;
76
- var nodeData = data.nodes.find(function (n) {
77
- return n.id === _this.id;
63
+ const nodeData = data.nodes.find((n) => {
64
+ return n.id === this.id;
78
65
  });
79
- var defaultColor = colorScale(Number(nodeData === null || nodeData === void 0 ? void 0 : nodeData.cumulative));
80
- var node = d3.select(this);
81
- var path = node.select('path');
66
+ const defaultColor = colorScale(Number(nodeData?.cumulative));
67
+ const node = d3.select(this);
68
+ const path = node.select('path');
82
69
  node
83
70
  .style('cursor', 'pointer')
84
71
  .on('mouseenter', function () {
85
72
  if (isShiftDown)
86
73
  return;
87
74
  d3.select(this).select('path').style('fill', 'white');
88
- var hoveringNode = __assign(__assign({}, nodeData), { meta: __assign(__assign({}, nodeData === null || nodeData === void 0 ? void 0 : nodeData.meta), { lineIndex: 0, locationIndex: 0 }) });
75
+ const hoveringNode = {
76
+ ...nodeData,
77
+ meta: { ...nodeData?.meta, lineIndex: 0, locationIndex: 0 },
78
+ };
89
79
  // @ts-expect-error
90
80
  dispatch(setHoveringNode(hoveringNode));
91
81
  })
@@ -104,10 +94,10 @@ var Callgraph = function (_a) {
104
94
  }, [svgWrapper.current, svgWrapperLoaded]);
105
95
  if (data.nodes.length < 1)
106
96
  return _jsx(_Fragment, { children: "Profile has no samples" });
107
- var resetView = function () { return setView(originalView); };
108
- var isResetViewButtonEnabled = view.scale !== originalView.scale ||
97
+ const resetView = () => setView(originalView);
98
+ const isResetViewButtonEnabled = view.scale !== originalView.scale ||
109
99
  view.translation.x !== originalView.translation.x ||
110
100
  view.translation.y !== originalView.translation.y;
111
- return (_jsxs("div", __assign({ className: "relative w-full" }, { children: [_jsxs("div", __assign({ ref: containerRef, className: "w-full overflow-hidden" }, { children: [_jsx(MapInteractionCSS, __assign({ showControls: true, minScale: 1, maxScale: 5, value: view, onChange: function (value) { return setView(value); } }, { children: _jsx(SVG, { ref: svgWrapper, src: svgString, width: width, height: "auto", title: "Callgraph", innerRef: svgRef }) })), svgRef.current !== null && (_jsx(GraphTooltip, { type: "callgraph", unit: sampleUnit, total: parseInt(data.cumulative), totalUnfiltered: parseInt(data.cumulative), contextElement: containerRef.current }))] })), _jsx("div", __assign({ className: cx(dashboardItems.length > 1 ? 'left-[25px]' : 'left-0', 'absolute top-[-46px] w-auto') }, { children: _jsx(Button, __assign({ variant: "neutral", onClick: resetView, className: "z-50", disabled: !isResetViewButtonEnabled }, { children: "Reset View" })) }))] })));
101
+ return (_jsxs("div", { className: "relative w-full", children: [_jsxs("div", { ref: containerRef, className: "w-full overflow-hidden", children: [_jsx(MapInteractionCSS, { showControls: true, minScale: 1, maxScale: 5, value: view, onChange: (value) => setView(value), children: _jsx(SVG, { ref: svgWrapper, src: svgString, width: width, height: "auto", title: "Callgraph", innerRef: svgRef }) }), svgRef.current !== null && (_jsx(GraphTooltip, { type: "callgraph", unit: sampleUnit, total: data.cumulative, totalUnfiltered: data.cumulative, contextElement: containerRef.current }))] }), _jsx("div", { className: cx(dashboardItems.length > 1 ? 'left-[25px]' : 'left-0', 'absolute top-[-46px] w-auto'), children: _jsx(Button, { variant: "neutral", onClick: resetView, className: "z-50", disabled: !isResetViewButtonEnabled, children: "Reset View" }) })] }));
112
102
  };
113
103
  export default Callgraph;
@@ -10,8 +10,15 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export var dotGraph = "{\n n1 [Label = \"n1\"];\n n2 [Label = \"n2\"];\n n3 [Label = \"n3\"];\n n1 -- n2;\n n1 -- n3;\n n2 -- n2;\n}";
14
- export var jsonGraph = {
13
+ export const dotGraph = `{
14
+ n1 [Label = "n1"];
15
+ n2 [Label = "n2"];
16
+ n3 [Label = "n3"];
17
+ n1 -- n2;
18
+ n1 -- n3;
19
+ n2 -- n2;
20
+ }`;
21
+ export const jsonGraph = {
15
22
  total: '4358676',
16
23
  unit: 'count',
17
24
  nodes: [
@@ -98,8 +105,18 @@ export var jsonGraph = {
98
105
  ],
99
106
  };
100
107
  // just a string, doesn't need to be on separate lines
101
- export var graphvizDot = "\ndigraph {\n N1 [id=\"node1\"]\n N2 [id=\"node2\"]\n N3 [id=\"node3\"]\n N4 [id=\"node4\"]\n N1 -> N2 [id=\"e1\" label=\"e1 fdskjao fdjksaol\"]\n N2 -> N3 [id=\"e2\" label=\"e2\"]\n N3 -> N4 [id=\"e3\" label=\"e3\"]\n N3 -> N1 [id=\"e4\" label=\"e4\"]\n }";
102
- export var jsonGraphWithGraphvizPositions = {
108
+ export const graphvizDot = `
109
+ digraph {
110
+ N1 [id="node1"]
111
+ N2 [id="node2"]
112
+ N3 [id="node3"]
113
+ N4 [id="node4"]
114
+ N1 -> N2 [id="e1" label="e1 fdskjao fdjksaol"]
115
+ N2 -> N3 [id="e2" label="e2"]
116
+ N3 -> N4 [id="e3" label="e3"]
117
+ N3 -> N1 [id="e4" label="e4"]
118
+ }`;
119
+ export const jsonGraphWithGraphvizPositions = {
103
120
  name: '%27',
104
121
  directed: true,
105
122
  strict: false,
@@ -426,8 +443,8 @@ export var jsonGraphWithGraphvizPositions = {
426
443
  },
427
444
  ],
428
445
  };
429
- export var nodeWithMetaData = function (id, name) { return ({
430
- id: id,
446
+ export const nodeWithMetaData = (id, name) => ({
447
+ id,
431
448
  cumulative: Math.floor(Math.random() * 10),
432
449
  meta: {
433
450
  location: {
@@ -449,7 +466,7 @@ export var nodeWithMetaData = function (id, name) { return ({
449
466
  '14': 76,
450
467
  '15': 130,
451
468
  },
452
- address: "".concat(Math.floor(Math.random() * 10)).concat(Math.floor(Math.random() * 10)).concat(Math.floor(Math.random() * 10)),
469
+ address: `${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}`,
453
470
  mappingId: {
454
471
  '0': 72,
455
472
  '1': 191,
@@ -519,9 +536,9 @@ export var nodeWithMetaData = function (id, name) { return ({
519
536
  '15': 177,
520
537
  },
521
538
  startLine: '0',
522
- name: name,
539
+ name,
523
540
  systemName: 'runtime.gopark',
524
- filename: "/opt/homebrew/Cellar/go/1.18.2/libexec/src/runtime/proc.go/".concat(name),
541
+ filename: `/opt/homebrew/Cellar/go/1.18.2/libexec/src/runtime/proc.go/${name}`,
525
542
  },
526
543
  line: {
527
544
  functionId: {
@@ -545,8 +562,8 @@ export var nodeWithMetaData = function (id, name) { return ({
545
562
  line: '361',
546
563
  },
547
564
  },
548
- }); };
549
- export var jsonGraphWithMetaData = {
565
+ });
566
+ export const jsonGraphWithMetaData = {
550
567
  total: '4358676',
551
568
  nodes: [
552
569
  nodeWithMetaData('root', 'root node'),
@@ -10,23 +10,13 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
- if (ar || !(i in from)) {
16
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
- ar[i] = from[i];
18
- }
19
- }
20
- return to.concat(ar || Array.prototype.slice.call(from));
21
- };
22
13
  import * as d3 from 'd3';
23
14
  import { withAlphaHex } from 'with-alpha-hex';
24
- export var pixelsToInches = function (pixels) { return pixels / 96; };
25
- export var getCurvePoints = function (_a) {
26
- var pos = _a.pos, _b = _a.xScale, xScale = _b === void 0 ? function (n) { return n; } : _b, _c = _a.yScale, yScale = _c === void 0 ? function (n) { return n; } : _c, _d = _a.source, source = _d === void 0 ? [] : _d, _e = _a.target, target = _e === void 0 ? [] : _e, _f = _a.offset, offset = _f === void 0 ? 0 : _f, _g = _a.isSelfLoop, isSelfLoop = _g === void 0 ? false : _g;
15
+ export const pixelsToInches = (pixels) => pixels / 96;
16
+ export const getCurvePoints = ({ pos, xScale = n => n, yScale = n => n, source = [], target = [], offset = 0, isSelfLoop = false, }) => {
27
17
  if (isSelfLoop) {
28
- var sourceX = source[0], sourceY = source[1];
29
- var targetX = target[0], targetY = target[1];
18
+ const [sourceX, sourceY] = source;
19
+ const [targetX, targetY] = target;
30
20
  return [
31
21
  sourceX,
32
22
  sourceY + offset,
@@ -39,66 +29,69 @@ export var getCurvePoints = function (_a) {
39
29
  ];
40
30
  }
41
31
  // graphviz pos format is in format 'endpoint,startpoint,triple(cp1,cp2,end),...triple...'
42
- var scalePoint = function (point) { return [xScale(point[0]), yScale(point[1])]; };
43
- var strAsNumArray = function (string) {
44
- return string
45
- .replace('e,', '')
46
- .split(',')
47
- .map(function (str) { return Number(str); });
48
- };
49
- var getLastPointWithOffset = function (target, last, offset) {
50
- var targetX = target[0], targetY = target[1];
51
- var lastX = last[0], lastY = last[1];
52
- var diffX = targetX - lastX;
53
- var diffY = targetY - lastY;
54
- var diffZ = Math.hypot(diffX, diffY);
55
- var offsetX = (diffX * offset) / diffZ;
56
- var offsetY = (diffY * offset) / diffZ;
32
+ const scalePoint = (point) => [xScale(point[0]), yScale(point[1])];
33
+ const strAsNumArray = (string) => string
34
+ .replace('e,', '')
35
+ .split(',')
36
+ .map(str => Number(str));
37
+ const getLastPointWithOffset = (target, last, offset) => {
38
+ const [targetX, targetY] = target;
39
+ const [lastX, lastY] = last;
40
+ const diffX = targetX - lastX;
41
+ const diffY = targetY - lastY;
42
+ const diffZ = Math.hypot(diffX, diffY);
43
+ const offsetX = (diffX * offset) / diffZ;
44
+ const offsetY = (diffY * offset) / diffZ;
57
45
  return [targetX - offsetX, targetY - offsetY];
58
46
  };
59
- var points = pos.split(' ').map(function (str) { return strAsNumArray(str); });
60
- var scaledPoints = points.map(function (point) { return scalePoint(point); });
61
- var lastPointIndex = scaledPoints.length - 1;
62
- var lastPointWithOffset = getLastPointWithOffset(target, scaledPoints[lastPointIndex], offset);
63
- return __spreadArray(__spreadArray([source], scaledPoints.slice(2, points.length - 1), true), [lastPointWithOffset], false).flat();
64
- };
65
- var objectAsDotAttributes = function (obj) {
66
- return Object.entries(obj)
67
- .map(function (entry) { return "".concat(entry[0], "=\"").concat(entry[1], "\""); })
68
- .join(' ');
47
+ const points = pos.split(' ').map(str => strAsNumArray(str));
48
+ const scaledPoints = points.map(point => scalePoint(point));
49
+ const lastPointIndex = scaledPoints.length - 1;
50
+ const lastPointWithOffset = getLastPointWithOffset(target, scaledPoints[lastPointIndex], offset);
51
+ return [source, ...scaledPoints.slice(2, points.length - 1), lastPointWithOffset].flat();
69
52
  };
70
- export var jsonToDot = function (_a) {
71
- var graph = _a.graph, colorRange = _a.colorRange;
72
- var nodes = graph.nodes, edges = graph.edges;
73
- var cumulatives = edges.map(function (edge) { return Number(edge.cumulative); });
74
- var cumulativesRange = d3.extent(cumulatives);
75
- var colorScale = d3
53
+ const objectAsDotAttributes = (obj) => Object.entries(obj)
54
+ .map(entry => `${entry[0]}="${entry[1]}"`)
55
+ .join(' ');
56
+ export const jsonToDot = ({ graph, colorRange, }) => {
57
+ const { nodes, edges } = graph;
58
+ const cumulatives = edges.map((edge) => Number(edge.cumulative));
59
+ const cumulativesRange = d3.extent(cumulatives);
60
+ const colorScale = d3
76
61
  .scaleSequentialLog(d3.interpolateBlues)
77
62
  .domain(cumulativesRange)
78
63
  .range(colorRange);
79
- var colorOpacityScale = d3.scaleLinear().domain(cumulativesRange).range([0.5, 1]);
80
- var nodesAsStrings = nodes.map(function (node) {
81
- var _a, _b, _c, _d, _e;
82
- var rgbColor = colorScale(Number(node.cumulative));
83
- var hexColor = (_b = (_a = d3.color(rgbColor)) === null || _a === void 0 ? void 0 : _a.formatHex()) !== null && _b !== void 0 ? _b : 'red';
84
- var dataAttributes = {
85
- label: (_e = (_d = (_c = node.meta) === null || _c === void 0 ? void 0 : _c.function) === null || _d === void 0 ? void 0 : _d.name.substring(0, 12)) !== null && _e !== void 0 ? _e : '',
64
+ const colorOpacityScale = d3.scaleLinear().domain(cumulativesRange).range([0.5, 1]);
65
+ const nodesAsStrings = nodes.map((node) => {
66
+ const rgbColor = colorScale(Number(node.cumulative));
67
+ const hexColor = d3.color(rgbColor)?.formatHex() ?? 'red';
68
+ const dataAttributes = {
69
+ label: node.meta?.function?.name.substring(0, 12) ?? '',
86
70
  root: (node.id === 'root').toString(),
87
71
  fillcolor: hexColor,
88
72
  className: 'node',
89
73
  id: node.id,
90
74
  };
91
- return "\"".concat(node.id, "\" [").concat(objectAsDotAttributes(dataAttributes), "]");
75
+ return `"${node.id}" [${objectAsDotAttributes(dataAttributes)}]`;
92
76
  });
93
- var edgesAsStrings = edges.map(function (edge) {
94
- var dataAttributes = {
95
- cumulative: edge.cumulative,
77
+ const edgesAsStrings = edges.map((edge) => {
78
+ const dataAttributes = {
79
+ cumulative: Number(edge.cumulative),
96
80
  color: withAlphaHex(colorRange[1], colorOpacityScale(Number(edge.cumulative))),
97
81
  className: 'edge',
98
82
  // boxHeight: DEFAULT_NODE_HEIGHT,
99
83
  };
100
- return "\"".concat(edge.source, "\" -> \"").concat(edge.target, "\" [").concat(objectAsDotAttributes(dataAttributes), "]");
84
+ return `"${edge.source}" -> "${edge.target}" [${objectAsDotAttributes(dataAttributes)}]`;
101
85
  });
102
- var graphAsDot = "digraph \"callgraph\" {\n rankdir=\"TB\"\n overlap=\"prism\"\n ratio=\"1,3\"\n margin=15\n edge [margin=0]\n node [shape=box style=\"rounded,filled\"]\n ".concat(nodesAsStrings.join(' '), "\n ").concat(edgesAsStrings.join(' '), "\n }");
86
+ const graphAsDot = `digraph "callgraph" {
87
+ rankdir="TB"
88
+ overlap="prism"
89
+ ratio="1,3"
90
+ margin=15
91
+ edge [margin=0]
92
+ node [shape=box style="rounded,filled"]
93
+ ${nodesAsStrings.join(' ')}
94
+ ${edgesAsStrings.join(' ')}
95
+ }`;
103
96
  return graphAsDot;
104
97
  };
@@ -1,16 +1,4 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- export var ExpandOnHover = function (_a) {
14
- var value = _a.value, displayValue = _a.displayValue;
15
- return (_jsxs("div", __assign({ className: "group relative w-full" }, { children: [_jsx("div", __assign({ className: "w-full overflow-hidden text-ellipsis whitespace-nowrap" }, { children: displayValue !== null && displayValue !== void 0 ? displayValue : value })), _jsx("div", __assign({ className: "absolute -inset-2 hidden h-fit max-w-[500px] whitespace-normal break-all rounded bg-gray-50 p-2 shadow-[0_0_10px_2px_rgba(0,0,0,0.3)] group-hover:flex dark:bg-gray-900" }, { children: value }))] })));
2
+ export const ExpandOnHover = ({ value, displayValue }) => {
3
+ return (_jsxs("div", { className: "group relative w-full", children: [_jsx("div", { className: "w-full overflow-hidden text-ellipsis whitespace-nowrap", children: displayValue ?? value }), _jsx("div", { className: "absolute -inset-2 hidden h-fit max-w-[500px] whitespace-normal break-all rounded bg-gray-50 p-2 shadow-[0_0_10px_2px_rgba(0,0,0,0.3)] group-hover:flex dark:bg-gray-900", children: value })] }));
16
4
  };
@@ -5,15 +5,15 @@ interface ExtendedCallgraphNodeMeta extends CallgraphNodeMeta {
5
5
  locationIndex: number;
6
6
  }
7
7
  interface HoveringNode extends FlamegraphRootNode, FlamegraphNode, CallgraphNode {
8
- diff: string;
8
+ diff: bigint;
9
9
  meta?: FlamegraphNodeMeta | ExtendedCallgraphNodeMeta;
10
10
  }
11
11
  interface GraphTooltipProps {
12
12
  x?: number;
13
13
  y?: number;
14
14
  unit: string;
15
- total: number;
16
- totalUnfiltered: number;
15
+ total: bigint;
16
+ totalUnfiltered: bigint;
17
17
  hoveringNode?: HoveringNode;
18
18
  contextElement: Element | null;
19
19
  isFixed?: boolean;
@@ -27,8 +27,8 @@ interface GraphTooltipProps {
27
27
  export declare const GraphTooltipContent: ({ hoveringNode, unit, total, totalUnfiltered, isFixed, strings, mappings, locations, functions, type, }: {
28
28
  hoveringNode: HoveringNode;
29
29
  unit: string;
30
- total: number;
31
- totalUnfiltered: number;
30
+ total: bigint;
31
+ totalUnfiltered: bigint;
32
32
  isFixed: boolean;
33
33
  strings?: string[] | undefined;
34
34
  mappings?: Mapping[] | undefined;