@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,3 +1,15 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3
+ 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."); }
4
+ 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; } }
5
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
6
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
7
+ 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; }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
13
  // Copyright 2022 The Parca Authors
2
14
  // Licensed under the Apache License, Version 2.0 (the "License");
3
15
  // you may not use this file except in compliance with the License.
@@ -10,172 +22,185 @@
10
22
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
23
  // See the License for the specific language governing permissions and
12
24
  // limitations under the License.
25
+
13
26
  import { getLastItem } from '@parca/utilities';
14
27
  import { hexifyAddress } from '../../utils';
15
- export const addPlusSign = (num) => {
16
- if (num.charAt(0) === '0' || num.charAt(0) === '-') {
17
- return num;
18
- }
19
- return `+${num}`;
28
+ export var addPlusSign = function addPlusSign(num) {
29
+ if (num.charAt(0) === '0' || num.charAt(0) === '-') {
30
+ return num;
31
+ }
32
+ return "+".concat(num);
20
33
  };
21
- export const getRowColor = (colorByColors, mappingFileColumn, row, functionFileNameColumn, colorBy) => {
22
- if (mappingFileColumn === null) {
23
- console.error('mapping_file column not found');
24
- return '';
25
- }
26
- const mappingFile = mappingFileColumn?.get(row) ?? null;
27
- const functionFileName = functionFileNameColumn?.get(row) ?? null;
28
- let mapping = '';
29
- let filename = '';
30
- if (mappingFile != null) {
31
- mapping = `${getLastItem(mappingFile) ?? ''}`;
32
- }
33
- if (functionFileName != null) {
34
- filename = `${getLastItem(functionFileName) ?? ''}`;
35
- }
36
- if (colorBy === 'filename') {
37
- return colorByColors[filename === '' ? 'Everything else' : filename];
38
- }
39
- return colorByColors[mapping];
34
+ export var getRowColor = function getRowColor(colorByColors, mappingFileColumn, row, functionFileNameColumn, colorBy) {
35
+ var _mappingFileColumn$ge, _functionFileNameColu;
36
+ if (mappingFileColumn === null) {
37
+ console.error('mapping_file column not found');
38
+ return '';
39
+ }
40
+ var mappingFile = (_mappingFileColumn$ge = mappingFileColumn === null || mappingFileColumn === void 0 ? void 0 : mappingFileColumn.get(row)) !== null && _mappingFileColumn$ge !== void 0 ? _mappingFileColumn$ge : null;
41
+ var functionFileName = (_functionFileNameColu = functionFileNameColumn === null || functionFileNameColumn === void 0 ? void 0 : functionFileNameColumn.get(row)) !== null && _functionFileNameColu !== void 0 ? _functionFileNameColu : null;
42
+ var mapping = '';
43
+ var filename = '';
44
+ if (mappingFile != null) {
45
+ var _getLastItem;
46
+ mapping = "".concat((_getLastItem = getLastItem(mappingFile)) !== null && _getLastItem !== void 0 ? _getLastItem : '');
47
+ }
48
+ if (functionFileName != null) {
49
+ var _getLastItem2;
50
+ filename = "".concat((_getLastItem2 = getLastItem(functionFileName)) !== null && _getLastItem2 !== void 0 ? _getLastItem2 : '');
51
+ }
52
+ if (colorBy === 'filename') {
53
+ return colorByColors[filename === '' ? 'Everything else' : filename];
54
+ }
55
+ return colorByColors[mapping];
40
56
  };
41
- export const RowName = (mappingFileColumn, locationAddressColumn, functionNameColumn, row) => {
42
- if (mappingFileColumn === null) {
43
- console.error('mapping_file column not found');
44
- return '';
45
- }
46
- const mappingFile = mappingFileColumn?.get(row);
47
- let mapping = '';
48
- // Show the last item in the mapping file only if there are more than 1 mappings
49
- if (mappingFile != null && mappingFileColumn.data.length > 1) {
50
- mapping = `[${getLastItem(mappingFile) ?? ''}]`;
51
- }
52
- const functionName = functionNameColumn?.get(row) ?? '';
53
- if (functionName !== null && functionName !== '') {
54
- return `${mapping} ${functionName}`;
55
- }
56
- const address = locationAddressColumn?.get(row) ?? 0n;
57
- return hexifyAddress(address);
57
+ export var RowName = function RowName(mappingFileColumn, locationAddressColumn, functionNameColumn, row) {
58
+ var _functionNameColumn$g, _locationAddressColum;
59
+ if (mappingFileColumn === null) {
60
+ console.error('mapping_file column not found');
61
+ return '';
62
+ }
63
+ var mappingFile = mappingFileColumn === null || mappingFileColumn === void 0 ? void 0 : mappingFileColumn.get(row);
64
+ var mapping = '';
65
+ // Show the last item in the mapping file only if there are more than 1 mappings
66
+ if (mappingFile != null && mappingFileColumn.data.length > 1) {
67
+ var _getLastItem3;
68
+ mapping = "[".concat((_getLastItem3 = getLastItem(mappingFile)) !== null && _getLastItem3 !== void 0 ? _getLastItem3 : '', "]");
69
+ }
70
+ var functionName = (_functionNameColumn$g = functionNameColumn === null || functionNameColumn === void 0 ? void 0 : functionNameColumn.get(row)) !== null && _functionNameColumn$g !== void 0 ? _functionNameColumn$g : '';
71
+ if (functionName !== null && functionName !== '') {
72
+ return "".concat(mapping, " ").concat(functionName);
73
+ }
74
+ var address = (_locationAddressColum = locationAddressColumn === null || locationAddressColumn === void 0 ? void 0 : locationAddressColumn.get(row)) !== null && _locationAddressColum !== void 0 ? _locationAddressColum : 0n;
75
+ return hexifyAddress(address);
58
76
  };
59
- export const getRowsCount = (rows) => {
60
- if (rows.length < 6) {
61
- return 6;
62
- }
63
- return rows.length;
77
+ export var getRowsCount = function getRowsCount(rows) {
78
+ if (rows.length < 6) {
79
+ return 6;
80
+ }
81
+ return rows.length;
64
82
  };
65
83
  export function getScrollTargetIndex(rows, parentRow, newRow) {
66
- const parentIndex = rows.indexOf(parentRow);
67
- const newRowIndex = rows.indexOf(newRow);
68
- let targetIndex = newRowIndex;
69
- if (parentIndex > newRowIndex) {
70
- // Adjusting the number of subs rows to scroll to the main row after expansion.
71
- targetIndex -= getRowsCount(newRow.subRows);
72
- }
73
- if (parentIndex < newRowIndex) {
74
- // If the parent row is above the new row, we need to adjust the number of subrows of the parent.
75
- targetIndex += getRowsCount(parentRow.subRows);
76
- }
77
- if (targetIndex < 0) {
78
- targetIndex = 0;
79
- }
80
- return targetIndex;
84
+ var parentIndex = rows.indexOf(parentRow);
85
+ var newRowIndex = rows.indexOf(newRow);
86
+ var targetIndex = newRowIndex;
87
+ if (parentIndex > newRowIndex) {
88
+ // Adjusting the number of subs rows to scroll to the main row after expansion.
89
+ targetIndex -= getRowsCount(newRow.subRows);
90
+ }
91
+ if (parentIndex < newRowIndex) {
92
+ // If the parent row is above the new row, we need to adjust the number of subrows of the parent.
93
+ targetIndex += getRowsCount(parentRow.subRows);
94
+ }
95
+ if (targetIndex < 0) {
96
+ targetIndex = 0;
97
+ }
98
+ return targetIndex;
81
99
  }
82
100
  export function isSubRow(row) {
83
- return row.isTopSubRow === true || row.isBottomSubRow === true;
101
+ return row.isTopSubRow === true || row.isBottomSubRow === true;
84
102
  }
85
103
  export function isLastSubRow(row, rows) {
86
- const index = rows.indexOf(row);
87
- const nextRow = rows[index + 1];
88
- return nextRow == null || (!isSubRow(nextRow.original) && !nextRow.getIsExpanded());
104
+ var index = rows.indexOf(row);
105
+ var nextRow = rows[index + 1];
106
+ return nextRow == null || !isSubRow(nextRow.original) && !nextRow.getIsExpanded();
89
107
  }
90
108
  export function isFirstSubRow(row, rows) {
91
- const index = rows.indexOf(row);
92
- const prevRow = rows[index - 1];
93
- return prevRow == null || (!isSubRow(prevRow.original) && !prevRow.getIsExpanded());
109
+ var index = rows.indexOf(row);
110
+ var prevRow = rows[index - 1];
111
+ return prevRow == null || !isSubRow(prevRow.original) && !prevRow.getIsExpanded();
94
112
  }
95
- export const rowBgClassNames = (isExpanded, isSubRow) => {
96
- return {
97
- relative: true,
98
- 'bg-indigo-100 dark:bg-gray-600': isSubRow,
99
- 'bg-indigo-50 dark:bg-gray-700': isExpanded,
100
- };
113
+ export var rowBgClassNames = function rowBgClassNames(isExpanded, isSubRow) {
114
+ return {
115
+ relative: true,
116
+ 'bg-indigo-100 dark:bg-gray-600': isSubRow,
117
+ 'bg-indigo-50 dark:bg-gray-700': isExpanded
118
+ };
101
119
  };
102
- export const ROW_HEIGHT = 29;
103
- export const sizeToHeightStyle = (size) => {
104
- return {
105
- height: `${size * ROW_HEIGHT}px`,
106
- };
120
+ export var ROW_HEIGHT = 29;
121
+ export var sizeToHeightStyle = function sizeToHeightStyle(size) {
122
+ return {
123
+ height: "".concat(size * ROW_HEIGHT, "px")
124
+ };
107
125
  };
108
- export const sizeToWidthStyle = (size) => {
109
- return {
110
- width: `${size * ROW_HEIGHT}px`,
111
- };
126
+ export var sizeToWidthStyle = function sizeToWidthStyle(size) {
127
+ return {
128
+ width: "".concat(size * ROW_HEIGHT, "px")
129
+ };
112
130
  };
113
- export const sizeToBottomStyle = (size) => {
114
- return {
115
- bottom: `-${size * ROW_HEIGHT}px`,
116
- };
131
+ export var sizeToBottomStyle = function sizeToBottomStyle(size) {
132
+ return {
133
+ bottom: "-".concat(size * ROW_HEIGHT, "px")
134
+ };
117
135
  };
118
- export const getCallerRows = (callers) => {
119
- if (callers.length === 0) {
120
- return [{ size: 3, message: 'No callers.', isTopSubRow: true }];
121
- }
122
- const rows = callers.map(row => {
123
- return { ...row, isTopSubRow: true };
136
+ export var getCallerRows = function getCallerRows(callers) {
137
+ if (callers.length === 0) {
138
+ return [{
139
+ size: 3,
140
+ message: 'No callers.',
141
+ isTopSubRow: true
142
+ }];
143
+ }
144
+ var rows = callers.map(function (row) {
145
+ return _objectSpread(_objectSpread({}, row), {}, {
146
+ isTopSubRow: true
124
147
  });
125
- if (rows.length >= 3) {
126
- return rows;
127
- }
128
- return [...rows, { size: 3 - rows.length, message: '', isTopSubRow: true }];
148
+ });
149
+ if (rows.length >= 3) {
150
+ return rows;
151
+ }
152
+ return [].concat(_toConsumableArray(rows), [{
153
+ size: 3 - rows.length,
154
+ message: '',
155
+ isTopSubRow: true
156
+ }]);
129
157
  };
130
- export const getCalleeRows = (callees) => {
131
- if (callees.length === 0) {
132
- return [{ size: 3, message: 'No callees.', isBottomSubRow: true }];
133
- }
134
- const rows = callees.map(row => {
135
- return { ...row, isBottomSubRow: true };
158
+ export var getCalleeRows = function getCalleeRows(callees) {
159
+ if (callees.length === 0) {
160
+ return [{
161
+ size: 3,
162
+ message: 'No callees.',
163
+ isBottomSubRow: true
164
+ }];
165
+ }
166
+ var rows = callees.map(function (row) {
167
+ return _objectSpread(_objectSpread({}, row), {}, {
168
+ isBottomSubRow: true
136
169
  });
137
- if (rows.length >= 3) {
138
- return rows;
139
- }
140
- return [{ size: 3 - rows.length, message: '', isBottomSubRow: true }, ...rows];
170
+ });
171
+ if (rows.length >= 3) {
172
+ return rows;
173
+ }
174
+ return [{
175
+ size: 3 - rows.length,
176
+ message: '',
177
+ isBottomSubRow: true
178
+ }].concat(_toConsumableArray(rows));
141
179
  };
142
- export const getPercentageString = (value, total) => {
143
- if (total === 0n) {
144
- return '0%';
145
- }
146
- const percentage = (Number(value) / Number(total)) * 100;
147
- return `${percentage.toFixed(2)}%`;
180
+ export var getPercentageString = function getPercentageString(value, total) {
181
+ if (total === 0n) {
182
+ return '0%';
183
+ }
184
+ var percentage = Number(value) / Number(total) * 100;
185
+ return "".concat(percentage.toFixed(2), "%");
148
186
  };
149
- export const getRatioString = (value, total, filtered) => {
150
- if (filtered === 0n) {
151
- return ` ${getPercentageString(value, total)}`;
152
- }
153
- return `${getPercentageString(value, total)} / ${getPercentageString(value, filtered)}`;
187
+ export var getRatioString = function getRatioString(value, total, filtered) {
188
+ if (filtered === 0n) {
189
+ return " ".concat(getPercentageString(value, total));
190
+ }
191
+ return "".concat(getPercentageString(value, total), " / ").concat(getPercentageString(value, filtered));
154
192
  };
155
- export const possibleColumns = [
156
- 'flat',
157
- 'flatPercentage',
158
- 'flatDiff',
159
- 'flatDiffPercentage',
160
- 'cumulative',
161
- 'cumulativePercentage',
162
- 'cumulativeDiff',
163
- 'cumulativeDiffPercentage',
164
- 'name',
165
- 'functionSystemName',
166
- 'functionFileName',
167
- 'mappingFile',
168
- ];
169
- export const percentageString = (value, total) => {
170
- if (total === 0n) {
171
- return '0%';
172
- }
173
- const percentage = (Number(value) / Number(total)) * 100;
174
- return `${percentage.toFixed(2)}%`;
175
- };
176
- export const ratioString = (value, total, filtered) => {
177
- if (filtered === 0n) {
178
- return ` ${percentageString(value, total)}`;
179
- }
180
- return `${percentageString(value, total)} / ${percentageString(value, filtered)}`;
193
+ export var possibleColumns = ['flat', 'flatPercentage', 'flatDiff', 'flatDiffPercentage', 'cumulative', 'cumulativePercentage', 'cumulativeDiff', 'cumulativeDiffPercentage', 'name', 'functionSystemName', 'functionFileName', 'mappingFile'];
194
+ export var percentageString = function percentageString(value, total) {
195
+ if (total === 0n) {
196
+ return '0%';
197
+ }
198
+ var percentage = Number(value) / Number(total) * 100;
199
+ return "".concat(percentage.toFixed(2), "%");
181
200
  };
201
+ export var ratioString = function ratioString(value, total, filtered) {
202
+ if (filtered === 0n) {
203
+ return " ".concat(percentageString(value, total));
204
+ }
205
+ return "".concat(percentageString(value, total), " / ").concat(percentageString(value, filtered));
206
+ };
@@ -10,59 +10,76 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { getMemoOptions, memo, } from '@tanstack/table-core';
13
+
14
+ import { getMemoOptions, memo } from '@tanstack/table-core';
14
15
  export function getTopAndBottomExpandedRowModel() {
15
- return table => memo(() => [
16
- table.getState().expanded,
17
- table.getPreExpandedRowModel(),
18
- table.options.paginateExpandedRows,
19
- ], (expanded, rowModel, paginateExpandedRows) => {
20
- if (rowModel.rows.length === 0 ||
21
- (expanded !== true && Object.keys(expanded ?? {}).length === 0)) {
22
- return rowModel;
23
- }
24
- if (paginateExpandedRows !== true) {
25
- // Only expand rows at this point if they are being paginated
26
- return rowModel;
27
- }
28
- return expandRows(rowModel);
16
+ return function (table) {
17
+ return memo(function () {
18
+ return [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows];
19
+ }, function (expanded, rowModel, paginateExpandedRows) {
20
+ if (rowModel.rows.length === 0 || expanded !== true && Object.keys(expanded !== null && expanded !== void 0 ? expanded : {}).length === 0) {
21
+ return rowModel;
22
+ }
23
+ if (paginateExpandedRows !== true) {
24
+ // Only expand rows at this point if they are being paginated
25
+ return rowModel;
26
+ }
27
+ return expandRows(rowModel);
29
28
  }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel'));
29
+ };
30
30
  }
31
31
  export function expandRows(rowModel) {
32
- const expandedRows = [];
33
- const handleRow = (row) => {
34
- if (!row.getIsExpanded()) {
35
- expandedRows.push(row);
36
- return;
37
- }
38
- // @ts-expect-error
39
- const topSubRows = (row.subRows ?? []).filter(subRow => subRow.original?.isTopSubRow);
40
- if (topSubRows.length > 0) {
41
- // Needs to be split into dummy and non-dummy rows to ensure that the dummy rows are rendered at the top.
42
- // @ts-expect-error
43
- const dummyRows = topSubRows.filter(subRow => 'size' in subRow.original);
44
- // @ts-expect-error
45
- const nonDummyRows = topSubRows.filter(subRow => !('size' in subRow.original));
46
- dummyRows.forEach(handleRow);
47
- nonDummyRows.forEach(handleRow);
48
- }
49
- expandedRows.push(row);
50
- // @ts-expect-error
51
- const bottomSubRows = (row.subRows ?? []).filter(subRow => subRow.original?.isBottomSubRow);
52
- if (bottomSubRows.length > 0) {
53
- // Needs to be split into dummy and non-dummy rows to ensure that the dummy rows are rendered at the bottom.
54
- // @ts-expect-error
55
- const dummyRows = bottomSubRows.filter(subRow => 'size' in subRow.original);
56
- // @ts-expect-error
57
- const nonDummyRows = bottomSubRows.filter(subRow => !('size' in subRow.original));
58
- nonDummyRows.forEach(handleRow);
59
- dummyRows.forEach(handleRow);
60
- }
61
- };
62
- rowModel.rows.forEach(handleRow);
63
- return {
64
- rows: expandedRows,
65
- flatRows: rowModel.flatRows,
66
- rowsById: rowModel.rowsById,
67
- };
68
- }
32
+ var expandedRows = [];
33
+ var _handleRow = function handleRow(row) {
34
+ var _row$subRows, _row$subRows2;
35
+ if (!row.getIsExpanded()) {
36
+ expandedRows.push(row);
37
+ return;
38
+ }
39
+
40
+ // @ts-expect-error
41
+ var topSubRows = ((_row$subRows = row.subRows) !== null && _row$subRows !== void 0 ? _row$subRows : []).filter(function (subRow) {
42
+ var _subRow$original;
43
+ return (_subRow$original = subRow.original) === null || _subRow$original === void 0 ? void 0 : _subRow$original.isTopSubRow;
44
+ });
45
+ if (topSubRows.length > 0) {
46
+ // Needs to be split into dummy and non-dummy rows to ensure that the dummy rows are rendered at the top.
47
+ // @ts-expect-error
48
+ var dummyRows = topSubRows.filter(function (subRow) {
49
+ return 'size' in subRow.original;
50
+ });
51
+ // @ts-expect-error
52
+ var nonDummyRows = topSubRows.filter(function (subRow) {
53
+ return !('size' in subRow.original);
54
+ });
55
+ dummyRows.forEach(_handleRow);
56
+ nonDummyRows.forEach(_handleRow);
57
+ }
58
+ expandedRows.push(row);
59
+
60
+ // @ts-expect-error
61
+ var bottomSubRows = ((_row$subRows2 = row.subRows) !== null && _row$subRows2 !== void 0 ? _row$subRows2 : []).filter(function (subRow) {
62
+ var _subRow$original2;
63
+ return (_subRow$original2 = subRow.original) === null || _subRow$original2 === void 0 ? void 0 : _subRow$original2.isBottomSubRow;
64
+ });
65
+ if (bottomSubRows.length > 0) {
66
+ // Needs to be split into dummy and non-dummy rows to ensure that the dummy rows are rendered at the bottom.
67
+ // @ts-expect-error
68
+ var _dummyRows = bottomSubRows.filter(function (subRow) {
69
+ return 'size' in subRow.original;
70
+ });
71
+ // @ts-expect-error
72
+ var _nonDummyRows = bottomSubRows.filter(function (subRow) {
73
+ return !('size' in subRow.original);
74
+ });
75
+ _nonDummyRows.forEach(_handleRow);
76
+ _dummyRows.forEach(_handleRow);
77
+ }
78
+ };
79
+ rowModel.rows.forEach(_handleRow);
80
+ return {
81
+ rows: expandedRows,
82
+ flatRows: rowModel.flatRows,
83
+ rowsById: rowModel.rowsById
84
+ };
85
+ }