@parca/profile 0.16.22 → 0.16.43

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 (39) hide show
  1. package/CHANGELOG.md +35 -48
  2. package/dist/Callgraph/Edge/index.d.ts +1 -0
  3. package/dist/Callgraph/Node/index.d.ts +2 -1
  4. package/dist/Callgraph/index.d.ts +1 -0
  5. package/dist/GraphTooltip/index.d.ts +1 -0
  6. package/dist/GraphTooltip/index.js +51 -15
  7. package/dist/IcicleGraph.d.ts +1 -0
  8. package/dist/IcicleGraph.js +23 -4
  9. package/dist/MatchersInput/index.d.ts +1 -0
  10. package/dist/MetricsCircle/index.d.ts +1 -0
  11. package/dist/MetricsGraph/index.d.ts +1 -0
  12. package/dist/MetricsGraph/index.js +5 -27
  13. package/dist/MetricsSeries/index.d.ts +1 -0
  14. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts +1 -0
  15. package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts +1 -0
  16. package/dist/ProfileExplorer/index.d.ts +1 -0
  17. package/dist/ProfileIcicleGraph.d.ts +1 -0
  18. package/dist/ProfileMetricsGraph/index.d.ts +1 -0
  19. package/dist/ProfileSelector/CompareButton.d.ts +1 -0
  20. package/dist/ProfileSelector/MergeButton.d.ts +1 -0
  21. package/dist/ProfileSelector/index.d.ts +1 -0
  22. package/dist/ProfileSource.d.ts +1 -0
  23. package/dist/ProfileTypeSelector/index.d.ts +1 -0
  24. package/dist/ProfileView.d.ts +1 -0
  25. package/dist/ProfileViewWithData.d.ts +1 -0
  26. package/dist/TopTable.d.ts +2 -1
  27. package/dist/components/DiffLegend.d.ts +1 -0
  28. package/dist/components/ProfileShareButton/ResultBox.d.ts +1 -0
  29. package/dist/components/ProfileShareButton/index.d.ts +1 -0
  30. package/dist/stories/ProfileTypeSelector.stories.d.ts +5 -0
  31. package/dist/stories/ProfileTypeSelector.stories.js +77 -0
  32. package/dist/stories/ProfileView.stories.d.ts +5 -0
  33. package/dist/stories/ProfileView.stories.js +22 -0
  34. package/dist/stories/mockdata/flamegraphData.json +7960 -0
  35. package/dist/styles.css +1 -1
  36. package/package.json +5 -4
  37. package/src/GraphTooltip/index.tsx +116 -21
  38. package/src/IcicleGraph.tsx +25 -5
  39. package/src/MetricsGraph/index.tsx +6 -31
package/CHANGELOG.md CHANGED
@@ -3,137 +3,124 @@
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.22](https://github.com/parca-dev/parca/compare/ui-v0.16.20...ui-v0.16.22) (2022-09-27)
6
+ ## [0.16.43](https://github.com/parca-dev/parca/compare/ui-v0.16.42...ui-v0.16.43) (2022-10-13)
7
7
 
8
8
  **Note:** Version bump only for package @parca/profile
9
9
 
10
+ ## [0.16.42](https://github.com/parca-dev/parca/compare/ui-v0.16.41...ui-v0.16.42) (2022-10-13)
10
11
 
12
+ **Note:** Version bump only for package @parca/profile
11
13
 
14
+ ## [0.16.40](https://github.com/parca-dev/parca/compare/ui-v0.16.39...ui-v0.16.40) (2022-10-10)
12
15
 
16
+ **Note:** Version bump only for package @parca/profile
13
17
 
14
- ## [0.16.21](https://github.com/parca-dev/parca/compare/ui-v0.16.20...ui-v0.16.21) (2022-09-27)
18
+ ## [0.16.39](https://github.com/parca-dev/parca/compare/ui-v0.16.38...ui-v0.16.39) (2022-10-10)
15
19
 
16
20
  **Note:** Version bump only for package @parca/profile
17
21
 
22
+ ## [0.16.38](https://github.com/parca-dev/parca/compare/ui-v0.16.37...ui-v0.16.38) (2022-10-10)
18
23
 
24
+ ## [0.16.32](https://github.com/parca-dev/parca/compare/ui-v0.16.30...ui-v0.16.32) (2022-10-06)
19
25
 
26
+ ## [0.16.30](https://github.com/parca-dev/parca/compare/ui-v0.16.27...ui-v0.16.30) (2022-10-01)
20
27
 
21
-
22
- ## [0.16.20](https://github.com/parca-dev/parca/compare/ui-v0.16.19...ui-v0.16.20) (2022-09-27)
28
+ ## 0.16.27 (2022-09-29)
23
29
 
24
30
  **Note:** Version bump only for package @parca/profile
25
31
 
32
+ ## [0.16.32](https://github.com/parca-dev/parca/compare/ui-v0.16.31...ui-v0.16.32) (2022-10-06)
26
33
 
34
+ **Note:** Version bump only for package @parca/profile
27
35
 
28
-
29
-
30
- ## [0.16.19](https://github.com/parca-dev/parca/compare/ui-v0.16.18...ui-v0.16.19) (2022-09-26)
36
+ ## [0.16.28](https://github.com/parca-dev/parca/compare/ui-v0.16.27...ui-v0.16.28) (2022-09-30)
31
37
 
32
38
  **Note:** Version bump only for package @parca/profile
33
39
 
40
+ ## [0.16.24](https://github.com/parca-dev/parca/compare/ui-v0.16.23...ui-v0.16.24) (2022-09-27)
34
41
 
42
+ ## [0.16.20](https://github.com/parca-dev/parca/compare/ui-v0.16.19...ui-v0.16.20) (2022-09-27)
35
43
 
44
+ ## [0.16.19](https://github.com/parca-dev/parca/compare/ui-v0.16.18...ui-v0.16.19) (2022-09-26)
36
45
 
46
+ ## [0.16.18](https://github.com/parca-dev/parca/compare/ui-v0.16.17...ui-v0.16.18) (2022-09-26)
37
47
 
38
- ## [0.16.16](https://github.com/parca-dev/parca/compare/ui-v0.16.15...ui-v0.16.16) (2022-09-26)
48
+ ## [0.16.2](https://github.com/parca-dev/parca/compare/ui-v0.13.4...ui-v0.16.2) (2022-09-14)
49
+
50
+ ## [0.13.4](https://github.com/parca-dev/parca/compare/ui-v0.13.3...ui-v0.13.4) (2022-06-07)
39
51
 
40
52
  **Note:** Version bump only for package @parca/profile
41
53
 
54
+ ## [0.16.23](https://github.com/parca-dev/parca/compare/ui-v0.16.20...ui-v0.16.23) (2022-09-27)
42
55
 
56
+ **Note:** Version bump only for package @parca/profile
43
57
 
58
+ ## [0.16.22](https://github.com/parca-dev/parca/compare/ui-v0.16.20...ui-v0.16.22) (2022-09-27)
44
59
 
60
+ **Note:** Version bump only for package @parca/profile
45
61
 
46
- # [0.16.0](https://github.com/parca-dev/parca/compare/ui-v0.15.26...ui-v0.16.0) (2022-09-13)
62
+ ## [0.16.21](https://github.com/parca-dev/parca/compare/ui-v0.16.20...ui-v0.16.21) (2022-09-27)
47
63
 
48
64
  **Note:** Version bump only for package @parca/profile
49
65
 
66
+ ## [0.16.20](https://github.com/parca-dev/parca/compare/ui-v0.16.19...ui-v0.16.20) (2022-09-27)
50
67
 
68
+ **Note:** Version bump only for package @parca/profile
51
69
 
70
+ ## [0.16.19](https://github.com/parca-dev/parca/compare/ui-v0.16.18...ui-v0.16.19) (2022-09-26)
52
71
 
72
+ **Note:** Version bump only for package @parca/profile
53
73
 
54
- ## [0.15.25](https://github.com/parca-dev/parca/compare/ui-v0.15.24...ui-v0.15.25) (2022-09-13)
74
+ ## [0.16.16](https://github.com/parca-dev/parca/compare/ui-v0.16.15...ui-v0.16.16) (2022-09-26)
55
75
 
56
76
  **Note:** Version bump only for package @parca/profile
57
77
 
78
+ # [0.16.0](https://github.com/parca-dev/parca/compare/ui-v0.15.26...ui-v0.16.0) (2022-09-13)
58
79
 
80
+ **Note:** Version bump only for package @parca/profile
59
81
 
82
+ ## [0.15.25](https://github.com/parca-dev/parca/compare/ui-v0.15.24...ui-v0.15.25) (2022-09-13)
60
83
 
84
+ **Note:** Version bump only for package @parca/profile
61
85
 
62
86
  ## [0.15.24](https://github.com/parca-dev/parca/compare/ui-v0.15.23...ui-v0.15.24) (2022-09-13)
63
87
 
64
-
65
-
66
88
  ## [0.15.19](https://github.com/parca-dev/parca/compare/ui-v0.15.17...ui-v0.15.19) (2022-09-08)
67
89
 
68
-
69
-
70
90
  ## [0.15.17](https://github.com/parca-dev/parca/compare/ui-v0.15.10...ui-v0.15.17) (2022-09-07)
71
91
 
72
-
73
92
  ### Bug Fixes
74
93
 
75
- * **ui:** type all the things (string mode) ([e91ac9d](https://github.com/parca-dev/parca/commit/e91ac9deb8a200ed3c9a9c5d81ae71e13d49466e))
76
-
77
-
94
+ - **ui:** type all the things (string mode) ([e91ac9d](https://github.com/parca-dev/parca/commit/e91ac9deb8a200ed3c9a9c5d81ae71e13d49466e))
78
95
 
79
96
  ## 0.15.10 (2022-08-30)
80
97
 
81
-
82
-
83
-
84
-
85
98
  ## [0.15.19](https://github.com/parca-dev/parca/compare/ui-v0.15.18...ui-v0.15.19) (2022-09-08)
86
99
 
87
-
88
-
89
100
  ## [0.15.17](https://github.com/parca-dev/parca/compare/ui-v0.15.10...ui-v0.15.17) (2022-09-07)
90
101
 
91
-
92
-
93
102
  ## [0.15.10](https://github.com/parca-dev/parca/compare/ui-v0.15.8...ui-v0.15.10) (2022-08-30)
94
103
 
95
104
  **Note:** Version bump only for package @parca/profile
96
105
 
97
-
98
-
99
-
100
-
101
106
  ## [0.15.18](https://github.com/parca-dev/parca/compare/ui-v0.15.17...ui-v0.15.18) (2022-09-08)
102
107
 
103
-
104
-
105
108
  ## [0.15.10](https://github.com/parca-dev/parca/compare/ui-v0.15.8...ui-v0.15.10) (2022-08-30)
106
109
 
107
110
  **Note:** Version bump only for package @parca/profile
108
111
 
109
-
110
-
111
-
112
-
113
112
  ## [0.15.17](https://github.com/parca-dev/parca/compare/ui-v0.15.16...ui-v0.15.17) (2022-09-07)
114
113
 
115
-
116
-
117
114
  ## [0.15.11](https://github.com/parca-dev/parca/compare/ui-v0.15.10...ui-v0.15.11) (2022-09-01)
118
115
 
119
-
120
-
121
116
  ## [0.15.10](https://github.com/parca-dev/parca/compare/ui-v0.15.2...ui-v0.15.10) (2022-08-30)
122
117
 
123
-
124
-
125
118
  ## [0.15.2](https://github.com/parca-dev/parca/compare/ui-v0.15.1...ui-v0.15.2) (2022-08-25)
126
119
 
127
-
128
-
129
120
  ## 0.15.1 (2022-08-25)
130
121
 
131
122
  **Note:** Version bump only for package @parca/profile
132
123
 
133
-
134
-
135
-
136
-
137
124
  ## [0.15.11](https://github.com/parca-dev/parca/compare/ui-v0.15.10...ui-v0.15.11) (2022-09-01)
138
125
 
139
126
  **Note:** Version bump only for package @parca/profile
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface IEdge {
2
3
  source: number;
3
4
  target: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface INode {
2
3
  id: number;
3
4
  x: number;
@@ -15,5 +16,5 @@ interface Props {
15
16
  setHoveredNode: (node: INode | null) => void;
16
17
  nodeRadius: number;
17
18
  }
18
- declare const Node: ({ node, hoveredNode, setHoveredNode, nodeRadius, }: Props) => JSX.Element;
19
+ declare const Node: ({ node, hoveredNode, setHoveredNode, nodeRadius: defaultRadius, }: Props) => JSX.Element;
19
20
  export default Node;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Callgraph as CallgraphType } from '@parca/client';
2
3
  export interface Props {
3
4
  graph: CallgraphType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CallgraphNode, FlamegraphRootNode } from '@parca/client';
2
3
  interface GraphTooltipProps {
3
4
  x: number;
@@ -21,10 +21,24 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { getLastItem, valueFormatter } from '@parca/functions';
25
- import { hexifyAddress } from '../';
24
+ // Copyright 2022 The Parca Authors
25
+ // Licensed under the Apache License, Version 2.0 (the "License");
26
+ // you may not use this file except in compliance with the License.
27
+ // You may obtain a copy of the License at
28
+ //
29
+ // http://www.apache.org/licenses/LICENSE-2.0
30
+ //
31
+ // Unless required by applicable law or agreed to in writing, software
32
+ // distributed under the License is distributed on an "AS IS" BASIS,
33
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ // See the License for the specific language governing permissions and
35
+ // limitations under the License.
36
+ import { CopyToClipboard } from 'react-copy-to-clipboard';
26
37
  import { useState, useEffect } from 'react';
27
38
  import { usePopper } from 'react-popper';
39
+ import { getLastItem, valueFormatter } from '@parca/functions';
40
+ import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
41
+ import { hexifyAddress } from '../';
28
42
  var virtualElement = {
29
43
  getBoundingClientRect: function () {
30
44
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
@@ -55,21 +69,37 @@ function generateGetBoundingClientRect(contextElement, x, y) {
55
69
  };
56
70
  }
57
71
  var TooltipMetaInfo = function (_a) {
58
- var _b, _c, _d, _e, _f, _g, _h, _j;
59
- var hoveringNode = _a.hoveringNode;
72
+ var _b, _c, _d, _e;
73
+ var hoveringNode = _a.hoveringNode, onCopy = _a.onCopy;
60
74
  if (hoveringNode.meta === undefined)
61
75
  return _jsx(_Fragment, {});
76
+ var getTextForFile = function (hoveringNode) {
77
+ var _a, _b, _c, _d;
78
+ if (hoveringNode.meta === undefined)
79
+ return '<unknown>';
80
+ // @ts-expect-error
81
+ return "".concat(hoveringNode.meta.function.filename, " ").concat(((_a = hoveringNode.meta.line) === null || _a === void 0 ? void 0 : _a.line) !== undefined && ((_b = hoveringNode.meta.line) === null || _b === void 0 ? void 0 : _b.line) !== '0'
82
+ ? " +".concat(hoveringNode.meta.line.line.toString())
83
+ : "".concat(((_c = hoveringNode.meta.function) === null || _c === void 0 ? void 0 : _c.startLine) !== undefined &&
84
+ ((_d = hoveringNode.meta.function) === null || _d === void 0 ? void 0 : _d.startLine) !== '0'
85
+ ? " +".concat(hoveringNode.meta.function.startLine)
86
+ : ''));
87
+ };
62
88
  return (_jsxs(_Fragment, { children: [((_b = hoveringNode.meta.function) === null || _b === void 0 ? void 0 : _b.filename) !== undefined &&
63
- ((_c = hoveringNode.meta.function) === null || _c === void 0 ? void 0 : _c.filename) !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "File" })), _jsxs("td", __assign({ className: "w-4/5 break-all" }, { children: [hoveringNode.meta.function.filename, ((_d = hoveringNode.meta.line) === null || _d === void 0 ? void 0 : _d.line) !== undefined && ((_e = hoveringNode.meta.line) === null || _e === void 0 ? void 0 : _e.line) !== '0'
64
- ? " +".concat(hoveringNode.meta.line.line.toString())
65
- : "".concat(((_f = hoveringNode.meta.function) === null || _f === void 0 ? void 0 : _f.startLine) !== undefined &&
66
- ((_g = hoveringNode.meta.function) === null || _g === void 0 ? void 0 : _g.startLine) !== '0'
67
- ? " +".concat(hoveringNode.meta.function.startLine)
68
- : '')] }))] })), ((_h = hoveringNode.meta.location) === null || _h === void 0 ? void 0 : _h.address) !== undefined &&
69
- ((_j = hoveringNode.meta.location) === null || _j === void 0 ? void 0 : _j.address) !== '0' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Address" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: ' 0x' + hoveringNode.meta.location.address.toString() }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.file !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Binary" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: getLastItem(hoveringNode.meta.mapping.file) }))] }))] }));
89
+ ((_c = hoveringNode.meta.function) === null || _c === void 0 ? void 0 : _c.filename) !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "File" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: getTextForFile(hoveringNode) }, { children: _jsx("button", __assign({ className: "cursor-pointer text-left" }, { children: getTextForFile(hoveringNode) })) })) }))] })), ((_d = hoveringNode.meta.location) === null || _d === void 0 ? void 0 : _d.address) !== undefined &&
90
+ ((_e = hoveringNode.meta.location) === null || _e === void 0 ? void 0 : _e.address) !== '0' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Address" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: ' 0x' + hoveringNode.meta.location.address.toString() }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: ' 0x' + hoveringNode.meta.location.address.toString() })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.file !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Binary" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.file }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.file) })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.buildId !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Build Id" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.buildId }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.buildId) })) })) }))] }))] }));
70
91
  };
92
+ var timeoutHandle = null;
71
93
  var GraphTooltipContent = function (_a) {
72
94
  var hoveringNode = _a.hoveringNode, unit = _a.unit, total = _a.total, isFixed = _a.isFixed;
95
+ var _b = useState(false), isCopied = _b[0], setIsCopied = _b[1];
96
+ var onCopy = function () {
97
+ setIsCopied(true);
98
+ if (timeoutHandle !== null) {
99
+ clearTimeout(timeoutHandle);
100
+ }
101
+ timeoutHandle = setTimeout(function () { return setIsCopied(false); }, 3000);
102
+ };
73
103
  var hoveringNodeCumulative = parseFloat(hoveringNode.cumulative);
74
104
  var diff = hoveringNode.diff === undefined ? 0 : parseFloat(hoveringNode.diff);
75
105
  var prevValue = hoveringNodeCumulative - diff;
@@ -78,10 +108,13 @@ var GraphTooltipContent = function (_a) {
78
108
  var diffValueText = diffSign + valueFormatter(diff, unit, 1);
79
109
  var diffPercentageText = diffSign + (diffRatio * 100).toFixed(2) + '%';
80
110
  var diffText = "".concat(diffValueText, " (").concat(diffPercentageText, ")");
81
- var metaRows = hoveringNode.meta === undefined ? _jsx(_Fragment, {}) : _jsx(TooltipMetaInfo, { hoveringNode: hoveringNode });
111
+ var metaRows = hoveringNode.meta === undefined ? (_jsx(_Fragment, {})) : (_jsx(TooltipMetaInfo, { onCopy: onCopy, hoveringNode: hoveringNode }));
112
+ var getTextForCumulative = function (hoveringNodeCumulative) {
113
+ return "".concat(valueFormatter(hoveringNodeCumulative, unit, 2), " (\n ").concat(((hoveringNodeCumulative * 100) / total).toFixed(2), "%)");
114
+ };
82
115
  return (_jsx("div", __assign({ className: "flex ".concat(isFixed ? 'w-full h-36' : '') }, { children: _jsx("div", __assign({ className: "m-auto w-full ".concat(isFixed ? 'w-full h-36' : '') }, { children: _jsx("div", __assign({ className: "border-gray-300 dark:border-gray-500 bg-gray-50 dark:bg-gray-900 rounded-lg p-3 shadow-lg opacity-90", style: { borderWidth: 1 } }, { children: _jsx("div", __assign({ className: "flex flex-row" }, { children: _jsxs("div", __assign({ className: "ml-2 mr-6" }, { children: [_jsx("span", __assign({ className: "font-semibold break-all" }, { children: hoveringNode.meta === undefined ? (_jsx("p", { children: "root" })) : (_jsx(_Fragment, { children: hoveringNode.meta.function !== undefined &&
83
- hoveringNode.meta.function.name !== '' ? (_jsx("p", { children: hoveringNode.meta.function.name })) : (_jsx(_Fragment, { children: hoveringNode.meta.location !== undefined &&
84
- parseInt(hoveringNode.meta.location.address, 10) !== 0 ? (_jsx("p", { children: hexifyAddress(hoveringNode.meta.location.address) })) : (_jsx("p", { children: "unknown" })) })) })) })), _jsx("span", __assign({ className: "text-gray-700 dark:text-gray-300 my-2" }, { children: _jsx("table", __assign({ className: "table-fixed" }, { children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Cumulative" })), _jsxs("td", __assign({ className: "w-4/5" }, { children: [valueFormatter(hoveringNodeCumulative, unit, 2), " (", ((hoveringNodeCumulative * 100) / total).toFixed(2), "%)"] }))] }), hoveringNode.diff !== undefined && diff !== 0 && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Diff" })), _jsx("td", __assign({ className: "w-4/5" }, { children: diffText }))] })), metaRows] }) })) }))] })) })) })) })) })));
116
+ hoveringNode.meta.function.name !== '' ? (_jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.function.name }, { children: _jsx("button", __assign({ className: "cursor-pointer text-left" }, { children: hoveringNode.meta.function.name })) }))) : (_jsx(_Fragment, { children: hoveringNode.meta.location !== undefined &&
117
+ parseInt(hoveringNode.meta.location.address, 10) !== 0 ? (_jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hexifyAddress(hoveringNode.meta.location.address) }, { children: _jsx("button", __assign({ className: "cursor-pointer text-left" }, { children: hexifyAddress(hoveringNode.meta.location.address) })) }))) : (_jsx("p", { children: "unknown" })) })) })) })), _jsx("span", __assign({ className: "text-gray-700 dark:text-gray-300 my-2" }, { children: _jsx("table", __assign({ className: "table-fixed" }, { children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Cumulative" })), _jsx("td", __assign({ className: "w-4/5" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: getTextForCumulative(hoveringNodeCumulative) }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getTextForCumulative(hoveringNodeCumulative) })) })) }))] }), hoveringNode.diff !== undefined && diff !== 0 && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Diff" })), _jsx("td", __assign({ className: "w-4/5" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: diffText }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: diffText })) })) }))] })), metaRows] }) })) })), _jsx("span", __assign({ className: "block text-gray-500 text-xs mt-2" }, { children: isCopied ? 'Copied!' : 'Hold shift and click on a value to copy.' }))] })) })) })) })) })));
85
118
  };
86
119
  var GraphTooltip = function (_a) {
87
120
  var x = _a.x, y = _a.y, unit = _a.unit, total = _a.total, hoveringNode = _a.hoveringNode, contextElement = _a.contextElement, _b = _a.isFixed, isFixed = _b === void 0 ? false : _b, _c = _a.virtualContextElement, virtualContextElement = _c === void 0 ? true : _c;
@@ -106,12 +139,15 @@ var GraphTooltip = function (_a) {
106
139
  ],
107
140
  }), styles = _e.styles, attributes = _e.attributes, popperProps = __rest(_e, ["styles", "attributes"]);
108
141
  var update = popperProps.update;
142
+ var isShiftDown = useIsShiftDown();
109
143
  useEffect(function () {
110
144
  if (contextElement != null) {
145
+ if (isShiftDown)
146
+ return;
111
147
  virtualElement.getBoundingClientRect = generateGetBoundingClientRect(contextElement, x, y);
112
148
  void (update === null || update === void 0 ? void 0 : update());
113
149
  }
114
- }, [x, y, contextElement, update]);
150
+ }, [x, y, contextElement, update, isShiftDown]);
115
151
  if (hoveringNode === undefined || hoveringNode == null)
116
152
  return _jsx(_Fragment, {});
117
153
  return isFixed ? (_jsx(GraphTooltipContent, { hoveringNode: hoveringNode, unit: unit, total: total, isFixed: isFixed })) : (_jsx("div", __assign({ ref: setPopperElement, style: styles.popper }, attributes.popper, { children: _jsx(GraphTooltipContent, { hoveringNode: hoveringNode, unit: unit, total: total, isFixed: isFixed }) })));
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Flamegraph, FlamegraphNode, FlamegraphRootNode } from '@parca/client';
2
3
  interface IcicleGraphProps {
3
4
  graph: Flamegraph;
@@ -29,6 +29,7 @@ import { scaleLinear } from 'd3-scale';
29
29
  import GraphTooltip from './GraphTooltip';
30
30
  import { getLastItem, diffColor, isSearchMatch } from '@parca/functions';
31
31
  import { useAppSelector, selectDarkMode, selectSearchNodeString } from '@parca/store';
32
+ import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
32
33
  import { hexifyAddress } from './utils';
33
34
  var RowHeight = 26;
34
35
  var icicleRectStyles = {
@@ -70,6 +71,7 @@ export function nodeLabel(node) {
70
71
  export function IcicleGraphNodes(_a) {
71
72
  var data = _a.data, x = _a.x, y = _a.y, xScale = _a.xScale, total = _a.total, totalWidth = _a.totalWidth, level = _a.level, setHoveringNode = _a.setHoveringNode, path = _a.path, setCurPath = _a.setCurPath, curPath = _a.curPath;
72
73
  var isDarkMode = useAppSelector(selectDarkMode);
74
+ var isShiftDown = useIsShiftDown();
73
75
  var nodes = curPath.length === 0 ? data : data.filter(function (d) { return d != null && curPath[0] === nodeLabel(d); });
74
76
  var nextLevel = level + 1;
75
77
  return (_jsx("g", __assign({ transform: "translate(".concat(x, ", ").concat(y, ")") }, { children: nodes.map(function (d, i) {
@@ -94,8 +96,16 @@ export function IcicleGraphNodes(_a) {
94
96
  var newXScale = nextCurPath.length === 0 && curPath.length === 1
95
97
  ? scaleLinear().domain([0, cumulative]).range([0, totalWidth])
96
98
  : xScale;
97
- var onMouseEnter = function () { return setHoveringNode(d); };
98
- var onMouseLeave = function () { return setHoveringNode(undefined); };
99
+ var onMouseEnter = function () {
100
+ if (isShiftDown)
101
+ return;
102
+ setHoveringNode(d);
103
+ };
104
+ var onMouseLeave = function () {
105
+ if (isShiftDown)
106
+ return;
107
+ setHoveringNode(undefined);
108
+ };
99
109
  return (_jsxs(React.Fragment, { children: [_jsx(IcicleRect, { x: xStart, y: 0, width: width, height: RowHeight, name: name, color: color, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, curPath: curPath }, "rect-".concat(key)), data !== undefined && data.length > 0 && (_jsx(IcicleGraphNodes, { data: d.children, x: xStart, y: RowHeight, xScale: newXScale, total: total, totalWidth: totalWidth, level: nextLevel, setHoveringNode: setHoveringNode, path: nextPath, curPath: nextCurPath, setCurPath: setCurPath }, "node-".concat(key)))] }, "node-".concat(key)));
100
110
  }) })));
101
111
  }
@@ -103,12 +113,21 @@ var MemoizedIcicleGraphNodes = React.memo(IcicleGraphNodes);
103
113
  export function IcicleGraphRootNode(_a) {
104
114
  var node = _a.node, xScale = _a.xScale, total = _a.total, totalWidth = _a.totalWidth, setHoveringNode = _a.setHoveringNode, setCurPath = _a.setCurPath, curPath = _a.curPath;
105
115
  var isDarkMode = useAppSelector(selectDarkMode);
116
+ var isShiftDown = useIsShiftDown();
106
117
  var cumulative = parseFloat(node.cumulative);
107
118
  var diff = parseFloat(node.diff);
108
119
  var color = diffColor(diff, cumulative, isDarkMode);
109
120
  var onClick = function () { return setCurPath([]); };
110
- var onMouseEnter = function () { return setHoveringNode(node); };
111
- var onMouseLeave = function () { return setHoveringNode(undefined); };
121
+ var onMouseEnter = function () {
122
+ if (isShiftDown)
123
+ return;
124
+ setHoveringNode(node);
125
+ };
126
+ var onMouseLeave = function () {
127
+ if (isShiftDown)
128
+ return;
129
+ setHoveringNode(undefined);
130
+ };
112
131
  var path = [];
113
132
  return (_jsxs("g", __assign({ transform: 'translate(0, 0)' }, { children: [_jsx(IcicleRect, { x: 0, y: 0, width: totalWidth, height: RowHeight, name: 'root', color: color, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, curPath: curPath }), _jsx(MemoizedIcicleGraphNodes, { data: node.children, x: 0, y: RowHeight, xScale: xScale, total: total, totalWidth: totalWidth, level: 0, setHoveringNode: setHoveringNode, path: path, curPath: curPath, setCurPath: setCurPath })] })));
114
133
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Query } from '@parca/parser';
2
3
  import { LabelsResponse, QueryServiceClient, ValuesResponse } from '@parca/client';
3
4
  interface MatchersInputProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface MetricsCircleProps {
2
3
  cx: number;
3
4
  cy: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SingleProfileSelection } from '..';
2
3
  import { MetricsSeries as MetricsSeriesPb, Label } from '@parca/client';
3
4
  import { DateTimeRange } from '@parca/components';
@@ -35,8 +35,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
35
35
  // limitations under the License.
36
36
  import { useEffect, useRef, useState } from 'react';
37
37
  import * as d3 from 'd3';
38
- import MetricsSeries from '../MetricsSeries';
39
- import MetricsCircle from '../MetricsCircle';
40
38
  import { pointer } from 'd3-selection';
41
39
  import { formatForTimespan } from '@parca/functions/time';
42
40
  import { timeFormat } from '..';
@@ -46,6 +44,9 @@ import { usePopper } from 'react-popper';
46
44
  import { valueFormatter, formatDate } from '@parca/functions';
47
45
  import { DateTimeRange } from '@parca/components';
48
46
  import { useContainerDimensions } from '@parca/dynamicsize';
47
+ import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
48
+ import MetricsSeries from '../MetricsSeries';
49
+ import MetricsCircle from '../MetricsCircle';
49
50
  var MetricsGraph = function (_a) {
50
51
  var data = _a.data, from = _a.from, to = _a.to, profile = _a.profile, onSampleClick = _a.onSampleClick, onLabelClick = _a.onLabelClick, setTimeRange = _a.setTimeRange, sampleUnit = _a.sampleUnit;
51
52
  var _b = useContainerDimensions(), ref = _b.ref, dimensions = _b.dimensions;
@@ -133,30 +134,8 @@ export var RawMetricsGraph = function (_a) {
133
134
  var _c = useState(false), hovering = _c[0], setHovering = _c[1];
134
135
  var _d = useState(-1), relPos = _d[0], setRelPos = _d[1];
135
136
  var _e = useState([0, 0]), pos = _e[0], setPos = _e[1];
136
- var _f = useState(false), freezeTooltip = _f[0], setFreezeTooltip = _f[1];
137
137
  var metricPointRef = useRef(null);
138
- useEffect(function () {
139
- var handleShiftDown = function (event) {
140
- if (event.keyCode === 16) {
141
- setFreezeTooltip(true);
142
- }
143
- };
144
- window.addEventListener('keydown', handleShiftDown);
145
- return function () {
146
- window.removeEventListener('keydown', handleShiftDown);
147
- };
148
- }, []);
149
- useEffect(function () {
150
- var handleShiftUp = function (event) {
151
- if (event.keyCode === 16) {
152
- setFreezeTooltip(false);
153
- }
154
- };
155
- window.addEventListener('keyup', handleShiftUp);
156
- return function () {
157
- window.removeEventListener('keyup', handleShiftUp);
158
- };
159
- }, []);
138
+ var isShiftDown = useIsShiftDown();
160
139
  var time = parseFloat(profile === null || profile === void 0 ? void 0 : profile.HistoryParams().time);
161
140
  if (width === undefined || width == null) {
162
141
  width = 0;
@@ -283,7 +262,7 @@ export var RawMetricsGraph = function (_a) {
283
262
  var xCoordinateWithoutMargin = xCoordinate - margin;
284
263
  var yCoordinate = rel[1];
285
264
  var yCoordinateWithoutMargin = yCoordinate - margin;
286
- if (!freezeTooltip) {
265
+ if (!isShiftDown) {
287
266
  throttledSetPos([xCoordinateWithoutMargin, yCoordinateWithoutMargin]);
288
267
  }
289
268
  };
@@ -336,7 +315,6 @@ export var RawMetricsGraph = function (_a) {
336
315
  var selected = findSelectedProfile();
337
316
  return (_jsxs(_Fragment, { children: [highlighted != null && hovering && !dragging && pos[0] !== 0 && pos[1] !== 0 && (_jsx("div", __assign({ onMouseMove: onMouseMove, onMouseEnter: function () { return setHovering(true); }, onMouseLeave: function () { return setHovering(false); } }, { children: _jsx(MetricsTooltip, { x: pos[0] + margin, y: pos[1] + margin, highlighted: highlighted, onLabelClick: onLabelClick, contextElement: graph.current, sampleUnit: sampleUnit }) }))), _jsx("div", __assign({ ref: graph, onMouseEnter: function () {
338
317
  setHovering(true);
339
- setFreezeTooltip(false);
340
318
  }, onMouseLeave: function () { return setHovering(false); } }, { children: _jsxs("svg", __assign({ width: "".concat(width, "px"), height: "".concat(height + margin, "px"), onMouseDown: onMouseDown, onMouseUp: onMouseUp, onMouseMove: onMouseMove }, { children: [_jsx("g", __assign({ transform: "translate(".concat(margin, ", 0)") }, { children: dragging && (_jsx("g", __assign({ className: "zoom-time-rect" }, { children: _jsx("rect", { className: "bar", x: pos[0] - relPos < 0 ? pos[0] : relPos, y: 0, height: height, width: Math.abs(pos[0] - relPos), fill: 'rgba(0, 0, 0, 0.125)' }) }))) })), _jsxs("g", __assign({ transform: "translate(".concat(margin, ", ").concat(margin, ")") }, { children: [_jsx("g", __assign({ className: "lines fill-transparent" }, { children: series.map(function (s, i) { return (_jsx("g", __assign({ className: "line" }, { children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
341
319
  ? lineStrokeHover
342
320
  : lineStroke, xScale: xScale, yScale: yScale }) }), i)); }) })), hovering && highlighted != null && (_jsx("g", __assign({ className: "circle-group", ref: metricPointRef, style: { fill: color(highlighted.seriesIndex.toString()) } }, { children: _jsx(MetricsCircle, { cx: highlighted.x, cy: highlighted.y }) }))), selected != null && (_jsx("g", __assign({ className: "circle-group", style: (selected === null || selected === void 0 ? void 0 : selected.seriesIndex) != null
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import * as d3 from 'd3';
2
3
  interface MetricsSeriesProps {
3
4
  data: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProfileSelection } from '..';
2
3
  import { QueryServiceClient } from '@parca/client';
3
4
  import { NavigateFunction } from '.';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  import { ProfileSelection } from '..';
3
4
  import { NavigateFunction } from '../ProfileExplorer';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  export declare type NavigateFunction = (path: string, queryParams: any) => void;
3
4
  interface ProfileExplorerProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Flamegraph } from '@parca/client';
2
3
  interface ProfileIcicleGraphProps {
3
4
  width?: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProfileSelection } from '..';
2
3
  import { QueryServiceClient, QueryRangeResponse } from '@parca/client';
3
4
  import { RpcError } from '@protobuf-ts/runtime-rpc';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const CompareButton: ({ disabled, onClick, }: {
2
3
  disabled: boolean;
3
4
  onClick: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const MergeButton: ({ disabled, onClick, }: {
2
3
  disabled: boolean;
3
4
  onClick: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient, ProfileTypesResponse } from '@parca/client';
2
3
  import { RpcError } from '@protobuf-ts/runtime-rpc';
3
4
  import { ProfileSelection } from '..';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProfileType } from '@parca/parser';
2
3
  import { Label, QueryRequest, ProfileDiffSelection } from '@parca/client';
3
4
  export interface ProfileSource {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProfileTypesResponse } from '@parca/client';
2
3
  import { RpcError } from '@protobuf-ts/runtime-rpc';
3
4
  interface WellKnownProfile {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient, Flamegraph, Top, Callgraph } from '@parca/client';
2
3
  import { ProfileSource } from './ProfileSource';
3
4
  import './ProfileView.styles.css';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  import { ProfileSource } from './ProfileSource';
3
4
  declare type NavigateFunction = (path: string, queryParams: any) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TopNodeMeta, Top } from '@parca/client';
2
3
  import './TopTable.styles.css';
3
4
  interface TopTableProps {
@@ -5,5 +6,5 @@ interface TopTableProps {
5
6
  sampleUnit: string;
6
7
  }
7
8
  export declare const RowLabel: (meta: TopNodeMeta | undefined) => string;
8
- export declare const TopTable: ({ data, sampleUnit }: TopTableProps) => JSX.Element;
9
+ export declare const TopTable: ({ data: top, sampleUnit }: TopTableProps) => JSX.Element;
9
10
  export default TopTable;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const DiffLegend: () => JSX.Element;
2
3
  export default DiffLegend;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  value: string;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryRequest, QueryServiceClient } from '@parca/client';
2
3
  interface Props {
3
4
  queryRequest: QueryRequest;
@@ -0,0 +1,5 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import ProfileTypeSelector from '../ProfileTypeSelector';
3
+ declare const _default: ComponentMeta<({ profileTypesData, loading, error, selectedKey, onSelection, flexibleKnownProfilesDetection, }: import("../ProfileTypeSelector").Props) => JSX.Element>;
4
+ export default _default;
5
+ export declare const Primary: ComponentStory<typeof ProfileTypeSelector>;