@parca/profile 0.19.140 → 0.19.143

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 (182) hide show
  1. package/CHANGELOG.md +9 -1
  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 +94 -68
  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.d.ts.map +1 -1
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -45
  29. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  30. package/dist/ProfileExplorer/index.js +183 -32
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  33. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  34. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  35. package/dist/ProfileFlameChart/index.js +260 -126
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +283 -85
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  56. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  57. package/dist/ProfileFlameGraph/index.js +322 -147
  58. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  59. package/dist/ProfileMetricsGraph/index.js +515 -256
  60. package/dist/ProfileSelector/CompareButton.js +132 -12
  61. package/dist/ProfileSelector/MetricsGraphSection.js +228 -63
  62. package/dist/ProfileSelector/index.d.ts +1 -1
  63. package/dist/ProfileSelector/index.d.ts.map +1 -1
  64. package/dist/ProfileSelector/index.js +734 -142
  65. package/dist/ProfileSelector/useAutoQuerySelector.d.ts +1 -3
  66. package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
  67. package/dist/ProfileSelector/useAutoQuerySelector.js +280 -132
  68. package/dist/ProfileSource.js +230 -163
  69. package/dist/ProfileTypeSelector/index.js +214 -125
  70. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  71. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +137 -32
  72. package/dist/ProfileView/components/ColorStackLegend.js +182 -54
  73. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  74. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  75. package/dist/ProfileView/components/DiffLegend.js +172 -29
  76. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  77. package/dist/ProfileView/components/InvertCallStack/index.js +97 -9
  78. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  79. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  80. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  81. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +191 -118
  82. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  83. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  84. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  85. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  86. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +664 -192
  87. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  88. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +196 -155
  89. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  90. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  91. package/dist/ProfileView/components/ViewSelector/index.js +186 -82
  92. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  93. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  94. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  95. package/dist/ProfileView/context/DashboardContext.js +74 -26
  96. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  97. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  98. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  99. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  100. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  101. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +53 -17
  102. package/dist/ProfileView/hooks/useVisualizationState.js +229 -69
  103. package/dist/ProfileView/index.js +383 -45
  104. package/dist/ProfileView/types/visualization.js +1 -13
  105. package/dist/ProfileView/utils/colorUtils.js +8 -7
  106. package/dist/ProfileViewWithData.js +319 -225
  107. package/dist/QueryControls/index.js +418 -47
  108. package/dist/Sandwich/components/CalleesSection.js +54 -4
  109. package/dist/Sandwich/components/CallersSection.js +97 -27
  110. package/dist/Sandwich/components/TableSection.js +77 -4
  111. package/dist/Sandwich/index.js +125 -12
  112. package/dist/Sandwich/utils/processRowData.js +48 -39
  113. package/dist/SelectWithRefresh/index.js +102 -28
  114. package/dist/SimpleMatchers/Select.js +520 -187
  115. package/dist/SimpleMatchers/index.js +590 -288
  116. package/dist/SourceView/Highlighter.js +230 -70
  117. package/dist/SourceView/LineNo.js +72 -17
  118. package/dist/SourceView/index.js +177 -101
  119. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  120. package/dist/SourceView/lang-detector/index.js +28 -14
  121. package/dist/SourceView/useSelectedLineRange.js +72 -20
  122. package/dist/Table/ColorCell.js +42 -1
  123. package/dist/Table/ColumnsVisibility.js +114 -6
  124. package/dist/Table/MoreDropdown.js +107 -21
  125. package/dist/Table/TableContextMenu.js +144 -134
  126. package/dist/Table/TableContextMenuWrapper.js +59 -14
  127. package/dist/Table/hooks/useColorManagement.js +58 -16
  128. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  129. package/dist/Table/hooks/useTableConfiguration.js +323 -167
  130. package/dist/Table/index.js +217 -123
  131. package/dist/Table/utils/functions.js +169 -144
  132. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  133. package/dist/TimelineGuide/index.js +209 -16
  134. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  135. package/dist/TopTable/index.js +325 -121
  136. package/dist/contexts/LabelsQueryProvider.js +94 -32
  137. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  138. package/dist/contexts/utils.js +37 -15
  139. package/dist/hooks/urlParsers.js +27 -15
  140. package/dist/hooks/useColorBy.js +47 -10
  141. package/dist/hooks/useCompareModeMeta.js +112 -62
  142. package/dist/hooks/useDashboardItems.js +52 -11
  143. package/dist/hooks/useLabels.js +295 -52
  144. package/dist/hooks/useQueryState.d.ts +1 -1
  145. package/dist/hooks/useQueryState.d.ts.map +1 -1
  146. package/dist/hooks/useQueryState.js +375 -329
  147. package/dist/index.js +11 -6
  148. package/dist/testdata/fg-diff.json +3750 -0
  149. package/dist/testdata/fg-simple.json +1879 -0
  150. package/dist/testdata/link_data.json +56 -0
  151. package/dist/testdata/tabular.json +30 -0
  152. package/dist/testdata/test_flamegraph.json +26846 -0
  153. package/dist/testdata/test_graph.json +53 -0
  154. package/dist/useDelayedLoader.js +32 -18
  155. package/dist/useGrpcQuery/index.js +71 -11
  156. package/dist/useHasProfileData.js +90 -12
  157. package/dist/useQuery.js +205 -64
  158. package/dist/useSumBy.d.ts.map +1 -1
  159. package/dist/useSumBy.js +294 -138
  160. package/dist/utils.js +62 -30
  161. package/package.json +9 -9
  162. package/src/GraphTooltipArrow/index.tsx +3 -0
  163. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  164. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  165. package/src/MatchersInput/index.tsx +1 -1
  166. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  167. package/src/PreSelectedMatchers/index.tsx +3 -0
  168. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -2
  169. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  170. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  171. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  172. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  173. package/src/ProfileSelector/index.tsx +31 -9
  174. package/src/ProfileSelector/useAutoQuerySelector.ts +64 -42
  175. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  176. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  177. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  178. package/src/hooks/useQueryState.ts +18 -3
  179. package/src/useDelayedLoader.ts +10 -10
  180. package/src/useSumBy.ts +12 -18
  181. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  182. package/dist/hooks/useQueryState.test.js +0 -868
@@ -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 { useQueryState } from 'nuqs';
@@ -22,137 +32,137 @@ import { getTextForCumulative } from '../ProfileFlameGraph/FlameGraphArrow/utils
22
32
  import { stringParam } from '../hooks/urlParsers';
23
33
  import { useDashboardItems } from '../hooks/useDashboardItems';
24
34
  import { truncateString } from '../utils';
25
- const TableContextMenu = ({ menuId, row, unit, total, totalUnfiltered, columnVisibility, }) => {
26
- const [_, setSandwichFunctionName] = useQueryState('sandwich_function_name', stringParam);
27
- const { dashboardItems, setDashboardItems } = useDashboardItems();
28
- const { enableSandwichView, isDarkMode } = useParcaContext();
29
- const onSandwichViewSelect = () => {
30
- if (row?.name != null && row.name.length > 0) {
31
- void setSandwichFunctionName(row.name.trim());
32
- if (!dashboardItems.includes('sandwich')) {
33
- setDashboardItems([...dashboardItems, 'sandwich']);
34
- }
35
- }
36
- };
37
- const handleCopyItem = (text) => {
38
- void navigator.clipboard.writeText(text);
39
- };
40
- const isColumnVisible = (columnName) => {
41
- return columnVisibility?.[columnName] ?? true;
42
- };
43
- const valuesToCopy = row !== null
44
- ? [
45
- ...(isColumnVisible('flat')
46
- ? [
47
- {
48
- id: 'Flat',
49
- value: total !== null &&
50
- total !== undefined &&
51
- totalUnfiltered !== null &&
52
- totalUnfiltered !== undefined
53
- ? getTextForCumulative(row.flat, total, totalUnfiltered, unit ?? '')
54
- : valueFormatter(row.flat, unit ?? '', 1),
55
- },
56
- ]
57
- : []),
58
- ...(isColumnVisible('flatPercentage')
59
- ? [
60
- {
61
- id: 'Flat (%)',
62
- value: total !== null &&
63
- total !== undefined &&
64
- totalUnfiltered !== null &&
65
- totalUnfiltered !== undefined
66
- ? getTextForCumulative(row.flat, total, totalUnfiltered, unit ?? '')
67
- : valueFormatter(row.flat, unit ?? '', 1),
68
- },
69
- ]
70
- : []),
71
- ...(isColumnVisible('flatDiff')
72
- ? [
73
- {
74
- id: 'Flat Diff',
75
- value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit ?? '', 1) : '',
76
- },
77
- ]
78
- : []),
79
- ...(isColumnVisible('flatDiffPercentage')
80
- ? [
81
- {
82
- id: 'Flat Diff (%)',
83
- value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit ?? '', 1) : '',
84
- },
85
- ]
86
- : []),
87
- ...(isColumnVisible('cumulative')
88
- ? [
89
- {
90
- id: 'Cumulative',
91
- value: total !== null &&
92
- total !== undefined &&
93
- totalUnfiltered !== null &&
94
- totalUnfiltered !== undefined
95
- ? getTextForCumulative(row.cumulative, total, totalUnfiltered, unit ?? '')
96
- : valueFormatter(row.cumulative, unit ?? '', 1),
97
- },
98
- ]
99
- : []),
100
- ...(isColumnVisible('cumulativePercentage')
101
- ? [
102
- {
103
- id: 'Cumulative (%)',
104
- value: total !== null &&
105
- total !== undefined &&
106
- totalUnfiltered !== null &&
107
- totalUnfiltered !== undefined
108
- ? getTextForCumulative(row.cumulative, total, totalUnfiltered, unit ?? '')
109
- : valueFormatter(row.cumulative, unit ?? '', 1),
110
- },
111
- ]
112
- : []),
113
- ...(isColumnVisible('cumulativeDiff')
114
- ? [
115
- {
116
- id: 'Cumulative Diff',
117
- value: row.cumulativeDiff !== 0n
118
- ? valueFormatter(row.cumulativeDiff, unit ?? '', 1)
119
- : '',
120
- },
121
- ]
122
- : []),
123
- ...(isColumnVisible('cumulativeDiffPercentage')
124
- ? [
125
- {
126
- id: 'Cumulative Diff (%)',
127
- value: row.cumulativeDiff !== 0n
128
- ? valueFormatter(row.cumulativeDiff, unit ?? '', 1)
129
- : '',
130
- },
131
- ]
132
- : []),
133
- ...(isColumnVisible('name')
134
- ? [
135
- {
136
- id: 'Name',
137
- value: row.name ?? '',
138
- },
139
- ]
140
- : []),
141
- ...(isColumnVisible('functionSystemName')
142
- ? [{ id: 'Function System Name', value: row.functionSystemName ?? '' }]
143
- : []),
144
- ...(isColumnVisible('functionFileName')
145
- ? [{ id: 'Function File Name', value: row.functionFileName ?? '' }]
146
- : []),
147
- ...(isColumnVisible('mappingFile')
148
- ? [{ id: 'Mapping File', value: row.mappingFile ?? '' }]
149
- : []),
150
- ].flat()
151
- : [];
152
- const nonEmptyValuesToCopy = valuesToCopy.filter(({ value }) => value !== '');
153
- const isMenuDisabled = row === null || enableSandwichView !== true;
154
- 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')
155
- ? 'Focus sandwich on this frame.'
156
- : '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))) }) })] }));
35
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
36
+ var TableContextMenu = function TableContextMenu(_ref) {
37
+ var _row$name, _row$functionSystemNa, _row$functionFileName, _row$mappingFile;
38
+ var menuId = _ref.menuId,
39
+ row = _ref.row,
40
+ unit = _ref.unit,
41
+ total = _ref.total,
42
+ totalUnfiltered = _ref.totalUnfiltered,
43
+ columnVisibility = _ref.columnVisibility;
44
+ var _useQueryState = useQueryState('sandwich_function_name', stringParam),
45
+ _useQueryState2 = _slicedToArray(_useQueryState, 2),
46
+ _ = _useQueryState2[0],
47
+ setSandwichFunctionName = _useQueryState2[1];
48
+ var _useDashboardItems = useDashboardItems(),
49
+ dashboardItems = _useDashboardItems.dashboardItems,
50
+ setDashboardItems = _useDashboardItems.setDashboardItems;
51
+ var _useParcaContext = useParcaContext(),
52
+ enableSandwichView = _useParcaContext.enableSandwichView,
53
+ isDarkMode = _useParcaContext.isDarkMode;
54
+ var onSandwichViewSelect = function onSandwichViewSelect() {
55
+ if ((row === null || row === void 0 ? void 0 : row.name) != null && row.name.length > 0) {
56
+ void setSandwichFunctionName(row.name.trim());
57
+ if (!dashboardItems.includes('sandwich')) {
58
+ setDashboardItems([].concat(_toConsumableArray(dashboardItems), ['sandwich']));
59
+ }
60
+ }
61
+ };
62
+ var handleCopyItem = function handleCopyItem(text) {
63
+ void navigator.clipboard.writeText(text);
64
+ };
65
+ var isColumnVisible = function isColumnVisible(columnName) {
66
+ var _columnVisibility$col;
67
+ return (_columnVisibility$col = columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility[columnName]) !== null && _columnVisibility$col !== void 0 ? _columnVisibility$col : true;
68
+ };
69
+ var valuesToCopy = row !== null ? [].concat(_toConsumableArray(isColumnVisible('flat') ? [{
70
+ id: 'Flat',
71
+ 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)
72
+ }] : []), _toConsumableArray(isColumnVisible('flatPercentage') ? [{
73
+ id: 'Flat (%)',
74
+ 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)
75
+ }] : []), _toConsumableArray(isColumnVisible('flatDiff') ? [{
76
+ id: 'Flat Diff',
77
+ value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
78
+ }] : []), _toConsumableArray(isColumnVisible('flatDiffPercentage') ? [{
79
+ id: 'Flat Diff (%)',
80
+ value: row.flatDiff !== 0n ? valueFormatter(row.flatDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
81
+ }] : []), _toConsumableArray(isColumnVisible('cumulative') ? [{
82
+ id: 'Cumulative',
83
+ 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)
84
+ }] : []), _toConsumableArray(isColumnVisible('cumulativePercentage') ? [{
85
+ id: 'Cumulative (%)',
86
+ 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)
87
+ }] : []), _toConsumableArray(isColumnVisible('cumulativeDiff') ? [{
88
+ id: 'Cumulative Diff',
89
+ value: row.cumulativeDiff !== 0n ? valueFormatter(row.cumulativeDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
90
+ }] : []), _toConsumableArray(isColumnVisible('cumulativeDiffPercentage') ? [{
91
+ id: 'Cumulative Diff (%)',
92
+ value: row.cumulativeDiff !== 0n ? valueFormatter(row.cumulativeDiff, unit !== null && unit !== void 0 ? unit : '', 1) : ''
93
+ }] : []), _toConsumableArray(isColumnVisible('name') ? [{
94
+ id: 'Name',
95
+ value: (_row$name = row.name) !== null && _row$name !== void 0 ? _row$name : ''
96
+ }] : []), _toConsumableArray(isColumnVisible('functionSystemName') ? [{
97
+ id: 'Function System Name',
98
+ value: (_row$functionSystemNa = row.functionSystemName) !== null && _row$functionSystemNa !== void 0 ? _row$functionSystemNa : ''
99
+ }] : []), _toConsumableArray(isColumnVisible('functionFileName') ? [{
100
+ id: 'Function File Name',
101
+ value: (_row$functionFileName = row.functionFileName) !== null && _row$functionFileName !== void 0 ? _row$functionFileName : ''
102
+ }] : []), _toConsumableArray(isColumnVisible('mappingFile') ? [{
103
+ id: 'Mapping File',
104
+ value: (_row$mappingFile = row.mappingFile) !== null && _row$mappingFile !== void 0 ? _row$mappingFile : ''
105
+ }] : [])).flat() : [];
106
+ var nonEmptyValuesToCopy = valuesToCopy.filter(function (_ref2) {
107
+ var value = _ref2.value;
108
+ return value !== '';
109
+ });
110
+ var isMenuDisabled = row === null || enableSandwichView !== true;
111
+ return /*#__PURE__*/_jsxs(Menu, {
112
+ id: menuId,
113
+ theme: isDarkMode ? 'dark' : '',
114
+ className: cx(dashboardItems.includes('sandwich') ? 'min-w-[350px] w-[350px]' : 'min-w-[260px] w-[260px]'),
115
+ children: [/*#__PURE__*/_jsx(Item, {
116
+ id: "sandwich-view",
117
+ onClick: onSandwichViewSelect,
118
+ disabled: isMenuDisabled,
119
+ children: /*#__PURE__*/_jsxs("div", {
120
+ className: "flex w-full items-center gap-2",
121
+ children: [/*#__PURE__*/_jsx(Icon, {
122
+ icon: "tdesign:sandwich-filled"
123
+ }), /*#__PURE__*/_jsxs("div", {
124
+ className: "relative",
125
+ children: [dashboardItems.includes('sandwich') ? 'Focus sandwich on this frame.' : 'Show in sandwich', /*#__PURE__*/_jsx("span", {
126
+ className: "absolute top-[-2px] text-xs lowercase text-red-500",
127
+ children: "\xA0alpha"
128
+ })]
129
+ })]
130
+ })
131
+ }), /*#__PURE__*/_jsx(Submenu, {
132
+ label: /*#__PURE__*/_jsxs("div", {
133
+ className: "flex w-full items-center gap-2",
134
+ children: [/*#__PURE__*/_jsx(Icon, {
135
+ icon: "ph:copy"
136
+ }), /*#__PURE__*/_jsx("div", {
137
+ children: "Copy"
138
+ })]
139
+ }),
140
+ disabled: row === null,
141
+ children: /*#__PURE__*/_jsx("div", {
142
+ className: "max-h-[300px] overflow-scroll",
143
+ children: nonEmptyValuesToCopy.map(function (_ref3) {
144
+ var id = _ref3.id,
145
+ value_0 = _ref3.value;
146
+ return /*#__PURE__*/_jsx(Item, {
147
+ id: id,
148
+ onClick: function onClick() {
149
+ return handleCopyItem(value_0);
150
+ },
151
+ className: "dark:bg-gray-800",
152
+ children: /*#__PURE__*/_jsxs("div", {
153
+ className: "flex flex-col dark:text-gray-300 hover:dark:text-gray-100",
154
+ children: [/*#__PURE__*/_jsx("div", {
155
+ className: "text-sm",
156
+ children: id
157
+ }), /*#__PURE__*/_jsx("div", {
158
+ className: "text-xs",
159
+ children: truncateString(value_0, 30)
160
+ })]
161
+ })
162
+ }, id);
163
+ })
164
+ })
165
+ })]
166
+ });
157
167
  };
158
- export default TableContextMenu;
168
+ 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;AAG5B,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,CA6KjD"}
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;AAG5B,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,CAuKjD"}