@parca/profile 0.19.139 → 0.19.142

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 (170) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +103 -73
  9. package/dist/MatchersInput/SuggestionItem.js +91 -12
  10. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  11. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  12. package/dist/MatchersInput/SuggestionsList.js +371 -157
  13. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  15. package/dist/MatchersInput/index.js +308 -115
  16. package/dist/MetricsCircle/index.js +39 -3
  17. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  18. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  19. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  20. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  21. package/dist/MetricsGraph/index.js +552 -203
  22. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  23. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  24. package/dist/MetricsSeries/index.js +70 -7
  25. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  26. package/dist/PreSelectedMatchers/index.js +249 -102
  27. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -49
  28. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  29. package/dist/ProfileExplorer/index.js +183 -32
  30. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  32. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  33. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  34. package/dist/ProfileFlameChart/index.js +266 -134
  35. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +287 -88
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  55. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  56. package/dist/ProfileFlameGraph/index.js +324 -148
  57. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  58. package/dist/ProfileMetricsGraph/index.js +518 -259
  59. package/dist/ProfileSelector/CompareButton.js +132 -12
  60. package/dist/ProfileSelector/MetricsGraphSection.js +234 -67
  61. package/dist/ProfileSelector/index.d.ts.map +1 -1
  62. package/dist/ProfileSelector/index.js +730 -142
  63. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  64. package/dist/ProfileSource.js +230 -163
  65. package/dist/ProfileTypeSelector/index.js +214 -125
  66. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  67. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +139 -33
  68. package/dist/ProfileView/components/ColorStackLegend.js +184 -55
  69. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  70. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  71. package/dist/ProfileView/components/DiffLegend.js +172 -29
  72. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  73. package/dist/ProfileView/components/InvertCallStack/index.js +99 -10
  74. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  75. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  76. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  77. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -120
  78. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  79. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  80. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  81. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  82. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +675 -195
  83. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  84. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +198 -157
  85. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  86. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  87. package/dist/ProfileView/components/ViewSelector/index.js +211 -91
  88. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  89. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  90. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  91. package/dist/ProfileView/context/DashboardContext.js +84 -28
  92. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  93. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  94. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  95. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  96. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +72 -29
  97. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +39 -13
  98. package/dist/ProfileView/hooks/useVisualizationState.js +262 -87
  99. package/dist/ProfileView/index.js +383 -45
  100. package/dist/ProfileView/types/visualization.js +1 -13
  101. package/dist/ProfileView/utils/colorUtils.js +8 -7
  102. package/dist/ProfileViewWithData.js +332 -237
  103. package/dist/QueryControls/index.js +418 -47
  104. package/dist/Sandwich/components/CalleesSection.js +54 -4
  105. package/dist/Sandwich/components/CallersSection.js +97 -27
  106. package/dist/Sandwich/components/TableSection.js +77 -4
  107. package/dist/Sandwich/index.js +125 -12
  108. package/dist/Sandwich/utils/processRowData.js +48 -39
  109. package/dist/SelectWithRefresh/index.js +102 -28
  110. package/dist/SimpleMatchers/Select.js +520 -187
  111. package/dist/SimpleMatchers/index.js +590 -288
  112. package/dist/SourceView/Highlighter.js +230 -70
  113. package/dist/SourceView/LineNo.js +72 -17
  114. package/dist/SourceView/index.js +177 -101
  115. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  116. package/dist/SourceView/lang-detector/index.js +28 -14
  117. package/dist/SourceView/useSelectedLineRange.js +97 -16
  118. package/dist/Table/ColorCell.js +42 -1
  119. package/dist/Table/ColumnsVisibility.js +114 -6
  120. package/dist/Table/MoreDropdown.js +121 -27
  121. package/dist/Table/TableContextMenu.js +150 -139
  122. package/dist/Table/TableContextMenuWrapper.js +59 -14
  123. package/dist/Table/hooks/useColorManagement.js +58 -16
  124. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  125. package/dist/Table/hooks/useTableConfiguration.js +331 -168
  126. package/dist/Table/index.js +222 -126
  127. package/dist/Table/utils/functions.js +169 -144
  128. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  129. package/dist/TimelineGuide/index.js +209 -16
  130. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  131. package/dist/TopTable/index.js +340 -122
  132. package/dist/contexts/LabelsQueryProvider.js +94 -32
  133. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  134. package/dist/contexts/utils.js +37 -15
  135. package/dist/hooks/useCompareModeMeta.js +157 -94
  136. package/dist/hooks/useLabels.js +295 -52
  137. package/dist/hooks/useQueryState.js +371 -330
  138. package/dist/index.js +21 -16
  139. package/dist/testdata/fg-diff.json +3750 -0
  140. package/dist/testdata/fg-simple.json +1879 -0
  141. package/dist/testdata/link_data.json +56 -0
  142. package/dist/testdata/tabular.json +30 -0
  143. package/dist/testdata/test_flamegraph.json +26846 -0
  144. package/dist/testdata/test_graph.json +53 -0
  145. package/dist/useDelayedLoader.js +32 -18
  146. package/dist/useGrpcQuery/index.js +71 -11
  147. package/dist/useHasProfileData.js +90 -12
  148. package/dist/useQuery.js +205 -64
  149. package/dist/useSumBy.d.ts.map +1 -1
  150. package/dist/useSumBy.js +294 -138
  151. package/dist/utils.js +62 -30
  152. package/package.json +9 -9
  153. package/src/GraphTooltipArrow/index.tsx +3 -0
  154. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  155. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  156. package/src/MatchersInput/index.tsx +1 -1
  157. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  158. package/src/PreSelectedMatchers/index.tsx +3 -0
  159. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  160. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  161. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  162. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  163. package/src/ProfileSelector/index.tsx +30 -7
  164. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  165. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  166. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  167. package/src/useDelayedLoader.ts +10 -10
  168. package/src/useSumBy.ts +12 -18
  169. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -541
  170. package/dist/hooks/useQueryState.test.js +0 -984
@@ -1,4 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
4
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
11
  // Copyright 2022 The Parca Authors
3
12
  // Licensed under the Apache License, Version 2.0 (the "License");
4
13
  // you may not use this file except in compliance with the License.
@@ -11,6 +20,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
20
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
21
  // See the License for the specific language governing permissions and
13
22
  // limitations under the License.
23
+
14
24
  import { Icon } from '@iconify/react';
15
25
  import cx from 'classnames';
16
26
  import { Item, Menu, Submenu } from 'react-contexify';
@@ -19,143 +29,144 @@ import { useParcaContext, useURLState, useURLStateBatch } from '@parca/component
19
29
  import { valueFormatter } from '@parca/utilities';
20
30
  import { getTextForCumulative } from '../ProfileFlameGraph/FlameGraphArrow/utils';
21
31
  import { truncateString } from '../utils';
22
- const TableContextMenu = ({ menuId, row, unit, total, totalUnfiltered, columnVisibility, }) => {
23
- const [_, setSandwichFunctionName] = useURLState('sandwich_function_name');
24
- const [dashboardItems, setDashboardItems] = useURLState('dashboard_items', {
25
- alwaysReturnArray: true,
26
- });
27
- const { enableSandwichView, isDarkMode } = useParcaContext();
28
- const batchUpdates = useURLStateBatch();
29
- const onSandwichViewSelect = () => {
30
- if (row?.name != null && row.name.length > 0) {
31
- // Batch updates to combine setSandwichFunctionName + setDashboardItems into single URL navigation
32
- batchUpdates(() => {
33
- setSandwichFunctionName(row.name.trim());
34
- if (!dashboardItems.includes('sandwich')) {
35
- setDashboardItems([...dashboardItems, 'sandwich']);
36
- }
37
- });
32
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
33
+ var TableContextMenu = function TableContextMenu(_ref) {
34
+ var _row$name, _row$functionSystemNa, _row$functionFileName, _row$mappingFile;
35
+ var menuId = _ref.menuId,
36
+ row = _ref.row,
37
+ unit = _ref.unit,
38
+ total = _ref.total,
39
+ totalUnfiltered = _ref.totalUnfiltered,
40
+ columnVisibility = _ref.columnVisibility;
41
+ var _useURLState = useURLState('sandwich_function_name'),
42
+ _useURLState2 = _slicedToArray(_useURLState, 2),
43
+ _ = _useURLState2[0],
44
+ setSandwichFunctionName = _useURLState2[1];
45
+ var _useURLState3 = useURLState('dashboard_items', {
46
+ alwaysReturnArray: true
47
+ }),
48
+ _useURLState4 = _slicedToArray(_useURLState3, 2),
49
+ dashboardItems = _useURLState4[0],
50
+ setDashboardItems = _useURLState4[1];
51
+ var _useParcaContext = useParcaContext(),
52
+ enableSandwichView = _useParcaContext.enableSandwichView,
53
+ isDarkMode = _useParcaContext.isDarkMode;
54
+ var batchUpdates = useURLStateBatch();
55
+ var onSandwichViewSelect = function onSandwichViewSelect() {
56
+ if ((row === null || row === void 0 ? void 0 : row.name) != null && row.name.length > 0) {
57
+ // Batch updates to combine setSandwichFunctionName + setDashboardItems into single URL navigation
58
+ batchUpdates(function () {
59
+ setSandwichFunctionName(row.name.trim());
60
+ if (!dashboardItems.includes('sandwich')) {
61
+ setDashboardItems([].concat(_toConsumableArray(dashboardItems), ['sandwich']));
38
62
  }
39
- };
40
- const handleCopyItem = (text) => {
41
- void navigator.clipboard.writeText(text);
42
- };
43
- const isColumnVisible = (columnName) => {
44
- return columnVisibility?.[columnName] ?? true;
45
- };
46
- const valuesToCopy = row !== null
47
- ? [
48
- ...(isColumnVisible('flat')
49
- ? [
50
- {
51
- id: 'Flat',
52
- value: total !== null &&
53
- total !== undefined &&
54
- totalUnfiltered !== null &&
55
- totalUnfiltered !== undefined
56
- ? getTextForCumulative(row.flat, total, totalUnfiltered, unit ?? '')
57
- : valueFormatter(row.flat, unit ?? '', 1),
58
- },
59
- ]
60
- : []),
61
- ...(isColumnVisible('flatPercentage')
62
- ? [
63
- {
64
- id: 'Flat (%)',
65
- value: total !== null &&
66
- total !== undefined &&
67
- totalUnfiltered !== null &&
68
- totalUnfiltered !== undefined
69
- ? getTextForCumulative(row.flat, total, totalUnfiltered, unit ?? '')
70
- : valueFormatter(row.flat, unit ?? '', 1),
71
- },
72
- ]
73
- : []),
74
- ...(isColumnVisible('flatDiff')
75
- ? [
76
- {
77
- id: 'Flat Diff',
78
- value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit ?? '', 1) : '',
79
- },
80
- ]
81
- : []),
82
- ...(isColumnVisible('flatDiffPercentage')
83
- ? [
84
- {
85
- id: 'Flat Diff (%)',
86
- value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit ?? '', 1) : '',
87
- },
88
- ]
89
- : []),
90
- ...(isColumnVisible('cumulative')
91
- ? [
92
- {
93
- id: 'Cumulative',
94
- value: total !== null &&
95
- total !== undefined &&
96
- totalUnfiltered !== null &&
97
- totalUnfiltered !== undefined
98
- ? getTextForCumulative(row.cumulative, total, totalUnfiltered, unit ?? '')
99
- : valueFormatter(row.cumulative, unit ?? '', 1),
100
- },
101
- ]
102
- : []),
103
- ...(isColumnVisible('cumulativePercentage')
104
- ? [
105
- {
106
- id: 'Cumulative (%)',
107
- value: total !== null &&
108
- total !== undefined &&
109
- totalUnfiltered !== null &&
110
- totalUnfiltered !== undefined
111
- ? getTextForCumulative(row.cumulative, total, totalUnfiltered, unit ?? '')
112
- : valueFormatter(row.cumulative, unit ?? '', 1),
113
- },
114
- ]
115
- : []),
116
- ...(isColumnVisible('cumulativeDiff')
117
- ? [
118
- {
119
- id: 'Cumulative Diff',
120
- value: row.cumulativeDiff !== 0n
121
- ? valueFormatter(row.cumulativeDiff, unit ?? '', 1)
122
- : '',
123
- },
124
- ]
125
- : []),
126
- ...(isColumnVisible('cumulativeDiffPercentage')
127
- ? [
128
- {
129
- id: 'Cumulative Diff (%)',
130
- value: row.cumulativeDiff !== 0n
131
- ? valueFormatter(row.cumulativeDiff, unit ?? '', 1)
132
- : '',
133
- },
134
- ]
135
- : []),
136
- ...(isColumnVisible('name')
137
- ? [
138
- {
139
- id: 'Name',
140
- value: row.name ?? '',
141
- },
142
- ]
143
- : []),
144
- ...(isColumnVisible('functionSystemName')
145
- ? [{ id: 'Function System Name', value: row.functionSystemName ?? '' }]
146
- : []),
147
- ...(isColumnVisible('functionFileName')
148
- ? [{ id: 'Function File Name', value: row.functionFileName ?? '' }]
149
- : []),
150
- ...(isColumnVisible('mappingFile')
151
- ? [{ id: 'Mapping File', value: row.mappingFile ?? '' }]
152
- : []),
153
- ].flat()
154
- : [];
155
- const nonEmptyValuesToCopy = valuesToCopy.filter(({ value }) => value !== '');
156
- const isMenuDisabled = row === null || enableSandwichView !== true;
157
- return (_jsxs(Menu, { id: menuId, theme: isDarkMode ? 'dark' : '', className: cx(dashboardItems.includes('sandwich') ? 'min-w-[350px] w-[350px]' : 'min-w-[260px] w-[260px]'), children: [_jsx(Item, { id: "sandwich-view", onClick: onSandwichViewSelect, disabled: isMenuDisabled, children: _jsxs("div", { className: "flex w-full items-center gap-2", children: [_jsx(Icon, { icon: "tdesign:sandwich-filled" }), _jsxs("div", { className: "relative", children: [dashboardItems.includes('sandwich')
158
- ? 'Focus sandwich on this frame.'
159
- : 'Show in sandwich', _jsx("span", { className: "absolute top-[-2px] text-xs lowercase text-red-500", children: "\u00A0alpha" })] })] }) }), _jsx(Submenu, { label: _jsxs("div", { className: "flex w-full items-center gap-2", children: [_jsx(Icon, { icon: "ph:copy" }), _jsx("div", { children: "Copy" })] }), disabled: row === null, children: _jsx("div", { className: "max-h-[300px] overflow-scroll", children: nonEmptyValuesToCopy.map(({ id, value }) => (_jsx(Item, { id: id, onClick: () => handleCopyItem(value), className: "dark:bg-gray-800", children: _jsxs("div", { className: "flex flex-col dark:text-gray-300 hover:dark:text-gray-100", children: [_jsx("div", { className: "text-sm", children: id }), _jsx("div", { className: "text-xs", children: truncateString(value, 30) })] }) }, id))) }) })] }));
63
+ });
64
+ }
65
+ };
66
+ var handleCopyItem = function handleCopyItem(text) {
67
+ void navigator.clipboard.writeText(text);
68
+ };
69
+ var isColumnVisible = function isColumnVisible(columnName) {
70
+ var _columnVisibility$col;
71
+ return (_columnVisibility$col = columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility[columnName]) !== null && _columnVisibility$col !== void 0 ? _columnVisibility$col : true;
72
+ };
73
+ var valuesToCopy = row !== null ? [].concat(_toConsumableArray(isColumnVisible('flat') ? [{
74
+ id: 'Flat',
75
+ value: total !== null && total !== undefined && totalUnfiltered !== null && totalUnfiltered !== undefined ? getTextForCumulative(row.flat, total, totalUnfiltered, unit !== null && unit !== void 0 ? unit : '') : valueFormatter(row.flat, unit !== null && unit !== void 0 ? unit : '', 1)
76
+ }] : []), _toConsumableArray(isColumnVisible('flatPercentage') ? [{
77
+ id: 'Flat (%)',
78
+ value: total !== null && total !== undefined && totalUnfiltered !== null && totalUnfiltered !== undefined ? getTextForCumulative(row.flat, total, totalUnfiltered, unit !== null && unit !== void 0 ? unit : '') : valueFormatter(row.flat, unit !== null && unit !== void 0 ? unit : '', 1)
79
+ }] : []), _toConsumableArray(isColumnVisible('flatDiff') ? [{
80
+ id: 'Flat Diff',
81
+ value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
82
+ }] : []), _toConsumableArray(isColumnVisible('flatDiffPercentage') ? [{
83
+ id: 'Flat Diff (%)',
84
+ value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
85
+ }] : []), _toConsumableArray(isColumnVisible('cumulative') ? [{
86
+ id: 'Cumulative',
87
+ value: total !== null && total !== undefined && totalUnfiltered !== null && totalUnfiltered !== undefined ? getTextForCumulative(row.cumulative, total, totalUnfiltered, unit !== null && unit !== void 0 ? unit : '') : valueFormatter(row.cumulative, unit !== null && unit !== void 0 ? unit : '', 1)
88
+ }] : []), _toConsumableArray(isColumnVisible('cumulativePercentage') ? [{
89
+ id: 'Cumulative (%)',
90
+ value: total !== null && total !== undefined && totalUnfiltered !== null && totalUnfiltered !== undefined ? getTextForCumulative(row.cumulative, total, totalUnfiltered, unit !== null && unit !== void 0 ? unit : '') : valueFormatter(row.cumulative, unit !== null && unit !== void 0 ? unit : '', 1)
91
+ }] : []), _toConsumableArray(isColumnVisible('cumulativeDiff') ? [{
92
+ id: 'Cumulative Diff',
93
+ value: row.cumulativeDiff !== 0n ? valueFormatter(row.cumulativeDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
94
+ }] : []), _toConsumableArray(isColumnVisible('cumulativeDiffPercentage') ? [{
95
+ id: 'Cumulative Diff (%)',
96
+ value: row.cumulativeDiff !== 0n ? valueFormatter(row.cumulativeDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
97
+ }] : []), _toConsumableArray(isColumnVisible('name') ? [{
98
+ id: 'Name',
99
+ value: (_row$name = row.name) !== null && _row$name !== void 0 ? _row$name : ''
100
+ }] : []), _toConsumableArray(isColumnVisible('functionSystemName') ? [{
101
+ id: 'Function System Name',
102
+ value: (_row$functionSystemNa = row.functionSystemName) !== null && _row$functionSystemNa !== void 0 ? _row$functionSystemNa : ''
103
+ }] : []), _toConsumableArray(isColumnVisible('functionFileName') ? [{
104
+ id: 'Function File Name',
105
+ value: (_row$functionFileName = row.functionFileName) !== null && _row$functionFileName !== void 0 ? _row$functionFileName : ''
106
+ }] : []), _toConsumableArray(isColumnVisible('mappingFile') ? [{
107
+ id: 'Mapping File',
108
+ value: (_row$mappingFile = row.mappingFile) !== null && _row$mappingFile !== void 0 ? _row$mappingFile : ''
109
+ }] : [])).flat() : [];
110
+ var nonEmptyValuesToCopy = valuesToCopy.filter(function (_ref2) {
111
+ var value = _ref2.value;
112
+ return value !== '';
113
+ });
114
+ var isMenuDisabled = row === null || enableSandwichView !== true;
115
+ return /*#__PURE__*/_jsxs(Menu, {
116
+ id: menuId,
117
+ theme: isDarkMode ? 'dark' : '',
118
+ className: cx(dashboardItems.includes('sandwich') ? 'min-w-[350px] w-[350px]' : 'min-w-[260px] w-[260px]'),
119
+ children: [/*#__PURE__*/_jsx(Item, {
120
+ id: "sandwich-view",
121
+ onClick: onSandwichViewSelect,
122
+ disabled: isMenuDisabled,
123
+ children: /*#__PURE__*/_jsxs("div", {
124
+ className: "flex w-full items-center gap-2",
125
+ children: [/*#__PURE__*/_jsx(Icon, {
126
+ icon: "tdesign:sandwich-filled"
127
+ }), /*#__PURE__*/_jsxs("div", {
128
+ className: "relative",
129
+ children: [dashboardItems.includes('sandwich') ? 'Focus sandwich on this frame.' : 'Show in sandwich', /*#__PURE__*/_jsx("span", {
130
+ className: "absolute top-[-2px] text-xs lowercase text-red-500",
131
+ children: "\xA0alpha"
132
+ })]
133
+ })]
134
+ })
135
+ }), /*#__PURE__*/_jsx(Submenu, {
136
+ label: /*#__PURE__*/_jsxs("div", {
137
+ className: "flex w-full items-center gap-2",
138
+ children: [/*#__PURE__*/_jsx(Icon, {
139
+ icon: "ph:copy"
140
+ }), /*#__PURE__*/_jsx("div", {
141
+ children: "Copy"
142
+ })]
143
+ }),
144
+ disabled: row === null,
145
+ children: /*#__PURE__*/_jsx("div", {
146
+ className: "max-h-[300px] overflow-scroll",
147
+ children: nonEmptyValuesToCopy.map(function (_ref3) {
148
+ var id = _ref3.id,
149
+ value_0 = _ref3.value;
150
+ return /*#__PURE__*/_jsx(Item, {
151
+ id: id,
152
+ onClick: function onClick() {
153
+ return handleCopyItem(value_0);
154
+ },
155
+ className: "dark:bg-gray-800",
156
+ children: /*#__PURE__*/_jsxs("div", {
157
+ className: "flex flex-col dark:text-gray-300 hover:dark:text-gray-100",
158
+ children: [/*#__PURE__*/_jsx("div", {
159
+ className: "text-sm",
160
+ children: id
161
+ }), /*#__PURE__*/_jsx("div", {
162
+ className: "text-xs",
163
+ children: truncateString(value_0, 30)
164
+ })]
165
+ })
166
+ }, id);
167
+ })
168
+ })
169
+ })]
170
+ });
160
171
  };
161
- export default TableContextMenu;
172
+ export default TableContextMenu;
@@ -1,4 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { c as _c } from "react-compiler-runtime";
2
8
  // Copyright 2022 The Parca Authors
3
9
  // Licensed under the Apache License, Version 2.0 (the "License");
4
10
  // you may not use this file except in compliance with the License.
@@ -11,20 +17,59 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
18
  // See the License for the specific language governing permissions and
13
19
  // limitations under the License.
20
+
14
21
  import { forwardRef, useImperativeHandle, useState } from 'react';
15
22
  import TableContextMenu from './TableContextMenu';
16
- const TableContextMenuWrapper = forwardRef(({ menuId, unit, total, totalUnfiltered, columnVisibility }, ref) => {
17
- const [row, setRow] = useState(null);
18
- useImperativeHandle(ref, () => ({
19
- setRow: (newRow, callback) => {
20
- setRow(newRow);
21
- // Execute callback after state update using requestAnimationFrame
22
- if (callback != null) {
23
- requestAnimationFrame(callback);
24
- }
25
- },
26
- }));
27
- return (_jsx(TableContextMenu, { menuId: menuId, row: row, unit: unit, total: total, totalUnfiltered: totalUnfiltered, columnVisibility: columnVisibility }));
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ var TableContextMenuWrapper = /*#__PURE__*/forwardRef(function (t0, ref) {
25
+ var $ = _c(8);
26
+ var menuId = t0.menuId,
27
+ unit = t0.unit,
28
+ total = t0.total,
29
+ totalUnfiltered = t0.totalUnfiltered,
30
+ columnVisibility = t0.columnVisibility;
31
+ var _useState = useState(null),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ row = _useState2[0],
34
+ _setRow = _useState2[1];
35
+ var t1;
36
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
37
+ t1 = function t1() {
38
+ return {
39
+ setRow: function setRow(newRow, callback) {
40
+ _setRow(newRow);
41
+ if (callback != null) {
42
+ requestAnimationFrame(callback);
43
+ }
44
+ }
45
+ };
46
+ };
47
+ $[0] = t1;
48
+ } else {
49
+ t1 = $[0];
50
+ }
51
+ useImperativeHandle(ref, t1);
52
+ var t2;
53
+ if ($[1] !== columnVisibility || $[2] !== menuId || $[3] !== row || $[4] !== total || $[5] !== totalUnfiltered || $[6] !== unit) {
54
+ t2 = /*#__PURE__*/_jsx(TableContextMenu, {
55
+ menuId: menuId,
56
+ row: row,
57
+ unit: unit,
58
+ total: total,
59
+ totalUnfiltered: totalUnfiltered,
60
+ columnVisibility: columnVisibility
61
+ });
62
+ $[1] = columnVisibility;
63
+ $[2] = menuId;
64
+ $[3] = row;
65
+ $[4] = total;
66
+ $[5] = totalUnfiltered;
67
+ $[6] = unit;
68
+ $[7] = t2;
69
+ } else {
70
+ t2 = $[7];
71
+ }
72
+ return t2;
28
73
  });
29
74
  TableContextMenuWrapper.displayName = 'TableContextMenuWrapper';
30
- export default TableContextMenuWrapper;
75
+ export default TableContextMenuWrapper;
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  // Copyright 2022 The Parca Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,23 +11,64 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
14
+
13
15
  import { useMemo } from 'react';
14
16
  import { getFilenameColors, getMappingColors } from '../../ProfileFlameGraph/FlameGraphArrow';
15
- export function useColorManagement({ isDarkMode, currentColorProfile, mappingsList, filenamesList, colorBy, }) {
16
- const filenameColors = useMemo(() => {
17
- return getFilenameColors(filenamesList, isDarkMode, currentColorProfile);
18
- }, [isDarkMode, filenamesList, currentColorProfile]);
19
- const mappingColors = useMemo(() => {
20
- return getMappingColors(mappingsList, isDarkMode, currentColorProfile);
21
- }, [isDarkMode, mappingsList, currentColorProfile]);
22
- const colorByList = {
23
- filename: filenameColors,
24
- binary: mappingColors,
17
+ export function useColorManagement(t0) {
18
+ var $ = _c(14);
19
+ var isDarkMode = t0.isDarkMode,
20
+ currentColorProfile = t0.currentColorProfile,
21
+ mappingsList = t0.mappingsList,
22
+ filenamesList = t0.filenamesList,
23
+ colorBy = t0.colorBy;
24
+ var t1;
25
+ if ($[0] !== currentColorProfile || $[1] !== filenamesList || $[2] !== isDarkMode) {
26
+ t1 = getFilenameColors(filenamesList, isDarkMode, currentColorProfile);
27
+ $[0] = currentColorProfile;
28
+ $[1] = filenamesList;
29
+ $[2] = isDarkMode;
30
+ $[3] = t1;
31
+ } else {
32
+ t1 = $[3];
33
+ }
34
+ var filenameColors = t1;
35
+ var t2;
36
+ if ($[4] !== currentColorProfile || $[5] !== isDarkMode || $[6] !== mappingsList) {
37
+ t2 = getMappingColors(mappingsList, isDarkMode, currentColorProfile);
38
+ $[4] = currentColorProfile;
39
+ $[5] = isDarkMode;
40
+ $[6] = mappingsList;
41
+ $[7] = t2;
42
+ } else {
43
+ t2 = $[7];
44
+ }
45
+ var mappingColors = t2;
46
+ var t3;
47
+ if ($[8] !== filenameColors || $[9] !== mappingColors) {
48
+ t3 = {
49
+ filename: filenameColors,
50
+ binary: mappingColors
25
51
  };
26
- const colorByValue = colorBy === undefined || colorBy === '' ? 'binary' : colorBy;
27
- const colorByColors = colorByList[colorByValue];
28
- return {
29
- colorByColors,
30
- colorByValue,
52
+ $[8] = filenameColors;
53
+ $[9] = mappingColors;
54
+ $[10] = t3;
55
+ } else {
56
+ t3 = $[10];
57
+ }
58
+ var colorByList = t3;
59
+ var colorByValue = colorBy === undefined || colorBy === "" ? "binary" : colorBy;
60
+ var colorByColors = colorByList[colorByValue];
61
+ var t4;
62
+ if ($[11] !== colorByColors || $[12] !== colorByValue) {
63
+ t4 = {
64
+ colorByColors: colorByColors,
65
+ colorByValue: colorByValue
31
66
  };
32
- }
67
+ $[11] = colorByColors;
68
+ $[12] = colorByValue;
69
+ $[13] = t4;
70
+ } else {
71
+ t4 = $[13];
72
+ }
73
+ return t4;
74
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"useTableConfiguration.d.ts","sourceRoot":"","sources":["../../../src/Table/hooks/useTableConfiguration.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAqB,KAAK,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAKxE,OAAO,EAAC,KAAK,GAAG,EAAC,MAAM,IAAI,CAAC;AAE5B,OAAO,EAA2B,KAAK,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE7E,UAAU,0BAA0B;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,kBAAkB;IAC1B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,cAAc,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAC,CAAC,CAAC;IACnD,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;CAC/C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,IAAS,EACT,KAAK,EACL,QAAQ,EACR,WAAW,GACZ,EAAE,0BAA0B,GAAG,kBAAkB,CA+KjD"}
1
+ {"version":3,"file":"useTableConfiguration.d.ts","sourceRoot":"","sources":["../../../src/Table/hooks/useTableConfiguration.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAqB,KAAK,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAKxE,OAAO,EAAC,KAAK,GAAG,EAAC,MAAM,IAAI,CAAC;AAE5B,OAAO,EAA2B,KAAK,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE7E,UAAU,0BAA0B;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,kBAAkB;IAC1B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,cAAc,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAC,CAAC,CAAC;IACnD,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;CAC/C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,IAAS,EACT,KAAK,EACL,QAAQ,EACR,WAAW,GACZ,EAAE,0BAA0B,GAAG,kBAAkB,CAyKjD"}