@parca/profile 0.19.140 → 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 (253) hide show
  1. package/CHANGELOG.md +5 -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.d.ts.map +1 -1
  9. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
  10. package/dist/MatchersInput/SuggestionItem.js +91 -12
  11. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  12. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  13. package/dist/MatchersInput/SuggestionsList.js +371 -157
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  15. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  16. package/dist/MatchersInput/index.js +308 -115
  17. package/dist/MetricsCircle/index.js +39 -3
  18. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  19. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  20. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  21. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  22. package/dist/MetricsGraph/index.js +552 -203
  23. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  24. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  25. package/dist/MetricsSeries/index.js +70 -7
  26. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  27. package/dist/PreSelectedMatchers/index.js +249 -102
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  29. package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
  30. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  31. package/dist/ProfileExplorer/index.js +183 -32
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  33. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  34. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
  35. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
  36. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  37. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  38. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  39. package/dist/ProfileFlameChart/index.js +267 -129
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  56. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  57. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  58. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  59. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  60. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  61. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  62. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  63. package/dist/ProfileFlameGraph/index.js +324 -150
  64. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  65. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  66. package/dist/ProfileMetricsGraph/index.js +519 -258
  67. package/dist/ProfileSelector/CompareButton.js +132 -12
  68. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  69. package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
  70. package/dist/ProfileSelector/index.d.ts.map +1 -1
  71. package/dist/ProfileSelector/index.js +727 -141
  72. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  73. package/dist/ProfileSource.js +230 -163
  74. package/dist/ProfileTypeSelector/index.js +214 -125
  75. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  76. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
  77. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
  78. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
  79. package/dist/ProfileView/components/ColorStackLegend.js +185 -55
  80. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  81. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  82. package/dist/ProfileView/components/DiffLegend.js +172 -29
  83. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  84. package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
  85. package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
  86. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  87. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  88. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  89. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
  90. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  91. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
  92. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  93. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  94. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  95. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  96. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
  97. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  98. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
  99. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
  100. package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
  101. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  102. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  103. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  104. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  105. package/dist/ProfileView/components/ViewSelector/index.js +212 -86
  106. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  107. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  108. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  109. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
  110. package/dist/ProfileView/context/DashboardContext.js +85 -29
  111. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  112. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  113. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  114. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
  115. package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
  116. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
  117. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  118. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
  119. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
  120. package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
  121. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  122. package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
  123. package/dist/ProfileView/index.js +383 -45
  124. package/dist/ProfileView/types/visualization.js +1 -13
  125. package/dist/ProfileView/utils/colorUtils.js +8 -7
  126. package/dist/ProfileViewWithData.d.ts.map +1 -1
  127. package/dist/ProfileViewWithData.js +332 -228
  128. package/dist/QueryControls/index.js +418 -47
  129. package/dist/Sandwich/components/CalleesSection.js +54 -4
  130. package/dist/Sandwich/components/CallersSection.js +97 -27
  131. package/dist/Sandwich/components/TableSection.js +77 -4
  132. package/dist/Sandwich/index.d.ts.map +1 -1
  133. package/dist/Sandwich/index.js +126 -14
  134. package/dist/Sandwich/utils/processRowData.js +48 -39
  135. package/dist/SelectWithRefresh/index.js +102 -28
  136. package/dist/SimpleMatchers/Select.js +520 -187
  137. package/dist/SimpleMatchers/index.js +590 -288
  138. package/dist/SourceView/Highlighter.js +230 -70
  139. package/dist/SourceView/LineNo.js +72 -17
  140. package/dist/SourceView/index.d.ts.map +1 -1
  141. package/dist/SourceView/index.js +178 -104
  142. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  143. package/dist/SourceView/lang-detector/index.js +28 -14
  144. package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
  145. package/dist/SourceView/useSelectedLineRange.js +99 -23
  146. package/dist/Table/ColorCell.js +42 -1
  147. package/dist/Table/ColumnsVisibility.js +114 -6
  148. package/dist/Table/MoreDropdown.d.ts.map +1 -1
  149. package/dist/Table/MoreDropdown.js +122 -25
  150. package/dist/Table/TableContextMenu.d.ts.map +1 -1
  151. package/dist/Table/TableContextMenu.js +151 -137
  152. package/dist/Table/TableContextMenuWrapper.js +59 -14
  153. package/dist/Table/hooks/useColorManagement.js +58 -16
  154. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  155. package/dist/Table/hooks/useTableConfiguration.js +333 -169
  156. package/dist/Table/index.d.ts.map +1 -1
  157. package/dist/Table/index.js +222 -128
  158. package/dist/Table/utils/functions.js +169 -144
  159. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  160. package/dist/TimelineGuide/index.js +209 -16
  161. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  162. package/dist/TopTable/index.d.ts.map +1 -1
  163. package/dist/TopTable/index.js +342 -123
  164. package/dist/contexts/LabelsQueryProvider.js +94 -32
  165. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  166. package/dist/contexts/utils.js +37 -15
  167. package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
  168. package/dist/hooks/useCompareModeMeta.js +158 -64
  169. package/dist/hooks/useLabels.js +295 -52
  170. package/dist/hooks/useQueryState.d.ts +3 -3
  171. package/dist/hooks/useQueryState.d.ts.map +1 -1
  172. package/dist/hooks/useQueryState.js +373 -332
  173. package/dist/index.d.ts +2 -3
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +22 -8
  176. package/dist/testdata/fg-diff.json +3750 -0
  177. package/dist/testdata/fg-simple.json +1879 -0
  178. package/dist/testdata/link_data.json +56 -0
  179. package/dist/testdata/tabular.json +30 -0
  180. package/dist/testdata/test_flamegraph.json +26846 -0
  181. package/dist/testdata/test_graph.json +53 -0
  182. package/dist/useDelayedLoader.js +32 -18
  183. package/dist/useGrpcQuery/index.js +71 -11
  184. package/dist/useHasProfileData.js +90 -12
  185. package/dist/useQuery.js +205 -64
  186. package/dist/useSumBy.d.ts +1 -1
  187. package/dist/useSumBy.d.ts.map +1 -1
  188. package/dist/useSumBy.js +294 -138
  189. package/dist/utils.js +62 -30
  190. package/package.json +9 -10
  191. package/src/GraphTooltipArrow/index.tsx +3 -0
  192. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
  193. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  194. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  195. package/src/MatchersInput/index.tsx +1 -1
  196. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  197. package/src/PreSelectedMatchers/index.tsx +3 -0
  198. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
  199. package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
  200. package/src/ProfileFlameChart/index.tsx +28 -21
  201. package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
  202. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
  203. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  204. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  205. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  206. package/src/ProfileFlameGraph/index.tsx +9 -6
  207. package/src/ProfileMetricsGraph/index.tsx +8 -6
  208. package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
  209. package/src/ProfileSelector/index.tsx +61 -39
  210. package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
  211. package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
  212. package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
  213. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
  214. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
  215. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
  216. package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
  217. package/src/ProfileView/components/Toolbars/index.tsx +3 -3
  218. package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
  219. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  220. package/src/ProfileView/context/DashboardContext.tsx +6 -6
  221. package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
  222. package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
  223. package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
  224. package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
  225. package/src/ProfileViewWithData.tsx +35 -29
  226. package/src/Sandwich/index.tsx +3 -4
  227. package/src/SourceView/index.tsx +2 -4
  228. package/src/SourceView/useSelectedLineRange.ts +19 -34
  229. package/src/Table/MoreDropdown.tsx +11 -9
  230. package/src/Table/TableContextMenu.tsx +13 -10
  231. package/src/Table/hooks/useTableConfiguration.tsx +11 -16
  232. package/src/Table/index.tsx +21 -12
  233. package/src/TopTable/index.tsx +4 -3
  234. package/src/hooks/useCompareModeMeta.ts +91 -61
  235. package/src/hooks/useQueryState.test.tsx +345 -275
  236. package/src/hooks/useQueryState.ts +118 -136
  237. package/src/index.tsx +15 -16
  238. package/src/useDelayedLoader.ts +10 -10
  239. package/src/useSumBy.ts +15 -21
  240. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  241. package/dist/hooks/urlParsers.d.ts +0 -18
  242. package/dist/hooks/urlParsers.d.ts.map +0 -1
  243. package/dist/hooks/urlParsers.js +0 -32
  244. package/dist/hooks/useColorBy.d.ts +0 -5
  245. package/dist/hooks/useColorBy.d.ts.map +0 -1
  246. package/dist/hooks/useColorBy.js +0 -26
  247. package/dist/hooks/useDashboardItems.d.ts +0 -5
  248. package/dist/hooks/useDashboardItems.d.ts.map +0 -1
  249. package/dist/hooks/useDashboardItems.js +0 -27
  250. package/dist/hooks/useQueryState.test.js +0 -868
  251. package/src/hooks/urlParsers.ts +0 -38
  252. package/src/hooks/useColorBy.ts +0 -42
  253. package/src/hooks/useDashboardItems.ts +0 -46
@@ -1,4 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ 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); }
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
+ 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."); }
10
+ 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; } }
11
+ 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; }
12
+ 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; } }
13
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
14
  // Copyright 2022 The Parca Authors
3
15
  // Licensed under the Apache License, Version 2.0 (the "License");
4
16
  // you may not use this file except in compliance with the License.
@@ -11,7 +23,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
23
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
24
  // See the License for the specific language governing permissions and
13
25
  // limitations under the License.
14
- import { memo, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState, } from 'react';
26
+
27
+ import React, { memo, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react';
15
28
  import { tableFromIPC } from '@uwdata/flechette';
16
29
  import { useContextMenu } from 'react-contexify';
17
30
  import { FlameGraphSkeleton, SandwichFlameGraphSkeleton, useParcaContext } from '@parca/components';
@@ -31,194 +44,398 @@ import { useBatchedRendering } from './useBatchedRendering';
31
44
  import { useScrollViewport } from './useScrollViewport';
32
45
  import { useVisibleNodes } from './useVisibleNodes';
33
46
  import { useZoom } from './useZoom';
34
- import { boundsFromProfileSource, extractFeature, extractFilenameFeature, getCurrentPathFrameData, getMaxDepth, isCurrentPathFrameMatch, } from './utils';
35
- export const FIELD_LABELS_ONLY = 'labels_only';
36
- export const FIELD_MAPPING_FILE = 'mapping_file';
37
- export const FIELD_MAPPING_BUILD_ID = 'mapping_build_id';
38
- export const FIELD_LOCATION_ADDRESS = 'location_address';
39
- export const FIELD_LOCATION_LINE = 'location_line';
40
- export const FIELD_INLINED = 'inlined';
41
- export const FIELD_TIMESTAMP = 'timestamp';
42
- export const FIELD_DURATION = 'duration';
43
- export const FIELD_GROUPBY_METADATA = 'groupby_metadata';
44
- export const FIELD_FUNCTION_NAME = 'function_name';
45
- export const FIELD_FUNCTION_SYSTEM_NAME = 'function_system_name';
46
- export const FIELD_FUNCTION_FILE_NAME = 'function_file_name';
47
- export const FIELD_FUNCTION_START_LINE = 'function_startline';
48
- export const FIELD_CHILDREN = 'children';
49
- export const FIELD_LABELS = 'labels';
50
- export const FIELD_CUMULATIVE = 'cumulative';
51
- export const FIELD_FLAT = 'flat';
52
- export const FIELD_DIFF = 'diff';
53
- export const FIELD_PARENT = 'parent';
54
- export const FIELD_DEPTH = 'depth';
55
- export const FIELD_VALUE_OFFSET = 'value_offset';
56
- export const getMappingColors = (mappingsList, isDarkMode, currentColorProfile) => {
57
- const mappingFeatures = mappingsList.map(mapping => extractFeature(mapping));
58
- const colors = {};
59
- Object.entries(mappingFeatures).forEach(([_, feature]) => {
60
- colors[feature.name] = getColorForFeature(feature.name, isDarkMode, currentColorProfile.colors);
61
- });
62
- return colors;
47
+ import { boundsFromProfileSource, extractFeature, extractFilenameFeature, getCurrentPathFrameData, getMaxDepth, isCurrentPathFrameMatch } from './utils';
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ export var FIELD_LABELS_ONLY = 'labels_only';
50
+ export var FIELD_MAPPING_FILE = 'mapping_file';
51
+ export var FIELD_MAPPING_BUILD_ID = 'mapping_build_id';
52
+ export var FIELD_LOCATION_ADDRESS = 'location_address';
53
+ export var FIELD_LOCATION_LINE = 'location_line';
54
+ export var FIELD_INLINED = 'inlined';
55
+ export var FIELD_TIMESTAMP = 'timestamp';
56
+ export var FIELD_DURATION = 'duration';
57
+ export var FIELD_GROUPBY_METADATA = 'groupby_metadata';
58
+ export var FIELD_FUNCTION_NAME = 'function_name';
59
+ export var FIELD_FUNCTION_SYSTEM_NAME = 'function_system_name';
60
+ export var FIELD_FUNCTION_FILE_NAME = 'function_file_name';
61
+ export var FIELD_FUNCTION_START_LINE = 'function_startline';
62
+ export var FIELD_CHILDREN = 'children';
63
+ export var FIELD_LABELS = 'labels';
64
+ export var FIELD_CUMULATIVE = 'cumulative';
65
+ export var FIELD_FLAT = 'flat';
66
+ export var FIELD_DIFF = 'diff';
67
+ export var FIELD_PARENT = 'parent';
68
+ export var FIELD_DEPTH = 'depth';
69
+ export var FIELD_VALUE_OFFSET = 'value_offset';
70
+ export var getMappingColors = function getMappingColors(mappingsList, isDarkMode, currentColorProfile) {
71
+ var mappingFeatures = mappingsList.map(function (mapping) {
72
+ return extractFeature(mapping);
73
+ });
74
+ var colors = {};
75
+ Object.entries(mappingFeatures).forEach(function (_ref) {
76
+ var _ref2 = _slicedToArray(_ref, 2),
77
+ _ = _ref2[0],
78
+ feature = _ref2[1];
79
+ colors[feature.name] = getColorForFeature(feature.name, isDarkMode, currentColorProfile.colors);
80
+ });
81
+ return colors;
82
+ };
83
+ export var getFilenameColors = function getFilenameColors(filenamesList, isDarkMode, currentColorProfile) {
84
+ var filenameFeatures = filenamesList.map(function (filename) {
85
+ return extractFilenameFeature(filename);
86
+ });
87
+ var colors = {};
88
+ Object.entries(filenameFeatures).forEach(function (_ref3) {
89
+ var _ref4 = _slicedToArray(_ref3, 2),
90
+ _ = _ref4[0],
91
+ feature = _ref4[1];
92
+ colors[feature.name] = getColorForFeature(feature.name, isDarkMode, currentColorProfile.colors);
93
+ });
94
+ return colors;
63
95
  };
64
- export const getFilenameColors = (filenamesList, isDarkMode, currentColorProfile) => {
65
- const filenameFeatures = filenamesList.map(filename => extractFilenameFeature(filename));
66
- const colors = {};
67
- Object.entries(filenameFeatures).forEach(([_, feature]) => {
68
- colors[feature.name] = getColorForFeature(feature.name, isDarkMode, currentColorProfile.colors);
96
+ var noop = function noop() {};
97
+ export var FlameGraphArrow = /*#__PURE__*/memo(function FlameGraphArrow(_ref5) {
98
+ var _table$getChild2;
99
+ var arrow = _ref5.arrow,
100
+ total = _ref5.total,
101
+ filtered = _ref5.filtered,
102
+ width = _ref5.width,
103
+ setCurPath = _ref5.setCurPath,
104
+ curPath = _ref5.curPath,
105
+ profileType = _ref5.profileType,
106
+ profileSource = _ref5.profileSource,
107
+ compareAbsolute = _ref5.compareAbsolute,
108
+ _ref5$isFlameChart = _ref5.isFlameChart,
109
+ isFlameChart = _ref5$isFlameChart === void 0 ? false : _ref5$isFlameChart,
110
+ _ref5$isRenderedAsFla = _ref5.isRenderedAsFlamegraph,
111
+ isRenderedAsFlamegraph = _ref5$isRenderedAsFla === void 0 ? false : _ref5$isRenderedAsFla,
112
+ _ref5$isInSandwichVie = _ref5.isInSandwichView,
113
+ isInSandwichView = _ref5$isInSandwichVie === void 0 ? false : _ref5$isInSandwichVie,
114
+ isHalfScreen = _ref5.isHalfScreen,
115
+ _ref5$tooltipId = _ref5.tooltipId,
116
+ tooltipId = _ref5$tooltipId === void 0 ? 'default' : _ref5$tooltipId,
117
+ maxFrameCount = _ref5.maxFrameCount,
118
+ _ref5$isExpanded = _ref5.isExpanded,
119
+ isExpanded = _ref5$isExpanded === void 0 ? false : _ref5$isExpanded,
120
+ mappingsListFromMetadata = _ref5.mappingsListFromMetadata,
121
+ filenamesListFromMetadata = _ref5.filenamesListFromMetadata,
122
+ colorBy = _ref5.colorBy,
123
+ zoomControlsRef = _ref5.zoomControlsRef;
124
+ var _useUserPreference = useUserPreference(USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS.key),
125
+ _useUserPreference2 = _slicedToArray(_useUserPreference, 1),
126
+ highlightSimilarStacksPreference = _useUserPreference2[0];
127
+ var _useState = useState(undefined),
128
+ _useState2 = _slicedToArray(_useState, 2),
129
+ hoveringRow = _useState2[0],
130
+ setHoveringRow = _useState2[1];
131
+ var _useUserPreference3 = useUserPreference(USER_PREFERENCES.GRAPH_METAINFO_DOCKED.key),
132
+ _useUserPreference4 = _slicedToArray(_useUserPreference3, 1),
133
+ dockedMetainfo = _useUserPreference4[0];
134
+ var _useParcaContext = useParcaContext(),
135
+ perf = _useParcaContext.perf,
136
+ isDarkMode = _useParcaContext.isDarkMode;
137
+ var table = useMemo(function () {
138
+ var result = tableFromIPC(alignedUint8Array(arrow.record), {
139
+ useBigInt: true
69
140
  });
141
+ if ((perf === null || perf === void 0 ? void 0 : perf.setMeasurement) != null) {
142
+ perf.setMeasurement('flamegraph.node_count', result.numRows);
143
+ }
144
+ return result;
145
+ }, [arrow, perf]);
146
+ var svg = useRef(null);
147
+ var containerRef = useRef(null);
148
+ var renderStartTime = useRef(0);
149
+ var hasInitialRenderCompleted = useRef(false);
150
+ var _useState3 = useState(null),
151
+ _useState4 = _slicedToArray(_useState3, 2),
152
+ svgElement = _useState4[0],
153
+ setSvgElement = _useState4[1];
154
+ var _useProfileFilters = useProfileFilters(),
155
+ excludeBinary = _useProfileFilters.excludeBinary;
156
+ var _useProfileViewContex = useProfileViewContext(),
157
+ compareMode = _useProfileViewContex.compareMode;
158
+ var currentColorProfile = useCurrentColorProfile();
159
+ var colorForSimilarNodes = currentColorProfile.colorForSimilarNodes;
160
+ var colorByValue = colorBy === undefined || colorBy === '' ? 'binary' : colorBy;
161
+ var filenameColors = useMemo(function () {
162
+ var colors = getFilenameColors(filenamesListFromMetadata, isDarkMode, currentColorProfile);
70
163
  return colors;
71
- };
72
- const noop = () => { };
73
- export const FlameGraphArrow = memo(function FlameGraphArrow({ arrow, total, filtered, width, setCurPath, curPath, profileType, profileSource, compareAbsolute, isFlameChart = false, isRenderedAsFlamegraph = false, isInSandwichView = false, isHalfScreen, tooltipId = 'default', maxFrameCount, isExpanded = false, mappingsListFromMetadata, filenamesListFromMetadata, colorBy, zoomControlsRef, }) {
74
- const [highlightSimilarStacksPreference] = useUserPreference(USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS.key);
75
- const [hoveringRow, setHoveringRow] = useState(undefined);
76
- const [dockedMetainfo] = useUserPreference(USER_PREFERENCES.GRAPH_METAINFO_DOCKED.key);
77
- const { perf, isDarkMode } = useParcaContext();
78
- const table = useMemo(() => {
79
- const result = tableFromIPC(alignedUint8Array(arrow.record), { useBigInt: true });
80
- if (perf?.setMeasurement != null) {
81
- perf.setMeasurement('flamegraph.node_count', result.numRows);
82
- }
83
- return result;
84
- }, [arrow, perf]);
85
- const svg = useRef(null);
86
- const containerRef = useRef(null);
87
- const renderStartTime = useRef(0);
88
- const hasInitialRenderCompleted = useRef(false);
89
- const [svgElement, setSvgElement] = useState(null);
90
- const { excludeBinary } = useProfileFilters();
91
- const { compareMode } = useProfileViewContext();
92
- const currentColorProfile = useCurrentColorProfile();
93
- const colorForSimilarNodes = currentColorProfile.colorForSimilarNodes;
94
- const colorByValue = colorBy === undefined || colorBy === '' ? 'binary' : colorBy;
95
- const filenameColors = useMemo(() => {
96
- const colors = getFilenameColors(filenamesListFromMetadata, isDarkMode, currentColorProfile);
97
- return colors;
98
- }, [isDarkMode, filenamesListFromMetadata, currentColorProfile]);
99
- const mappingColors = useMemo(() => {
100
- const colors = getMappingColors(mappingsListFromMetadata, isDarkMode, currentColorProfile);
101
- return colors;
102
- }, [isDarkMode, mappingsListFromMetadata, currentColorProfile]);
103
- const colorByList = {
104
- filename: filenameColors,
105
- binary: mappingColors,
106
- };
107
- const colorByColors = colorByList[colorByValue];
108
- const MENU_ID = 'flame-graph-context-menu';
109
- const contextMenuRef = useRef(null);
110
- const { show, hideAll } = useContextMenu({
111
- id: MENU_ID,
164
+ }, [isDarkMode, filenamesListFromMetadata, currentColorProfile]);
165
+ var mappingColors = useMemo(function () {
166
+ var colors_0 = getMappingColors(mappingsListFromMetadata, isDarkMode, currentColorProfile);
167
+ return colors_0;
168
+ }, [isDarkMode, mappingsListFromMetadata, currentColorProfile]);
169
+ var colorByList = {
170
+ filename: filenameColors,
171
+ binary: mappingColors
172
+ };
173
+ var colorByColors = colorByList[colorByValue];
174
+ var MENU_ID = 'flame-graph-context-menu';
175
+ var contextMenuRef = useRef(null);
176
+ var _useContextMenu = useContextMenu({
177
+ id: MENU_ID
178
+ }),
179
+ show = _useContextMenu.show,
180
+ hideAll = _useContextMenu.hideAll;
181
+ var displayMenu = useCallback(function (e, row) {
182
+ var _contextMenuRef$curre;
183
+ e.preventDefault();
184
+ // Race condition fix: Use callback to ensure context menu shows only after
185
+ // row state has been updated and propagated through the hook chain.
186
+ // This prevents empty function names on first click.
187
+ (_contextMenuRef$curre = contextMenuRef.current) === null || _contextMenuRef$curre === void 0 || _contextMenuRef$curre.setRow(row, function () {
188
+ show({
189
+ event: e
190
+ });
112
191
  });
113
- const displayMenu = useCallback((e, row) => {
114
- e.preventDefault();
115
- // Race condition fix: Use callback to ensure context menu shows only after
116
- // row state has been updated and propagated through the hook chain.
117
- // This prevents empty function names on first click.
118
- contextMenuRef.current?.setRow(row, () => {
119
- show({
120
- event: e,
121
- });
122
- });
123
- }, [show]);
124
- const hideBinary = (binaryToRemove) => {
125
- // Add a new frame filter to hide this binary using the new ProfileFilters system
126
- excludeBinary(binaryToRemove);
127
- };
128
- const handleRowClick = useCallback((row) => {
129
- if (isFlameChart) {
130
- // In flame charts, we don't want to expand the node, so we return early.
131
- return;
132
- }
133
- // Walk down the stack starting at row until we reach the root (row 0).
134
- const path = [];
135
- let currentRow = row;
136
- while (currentRow > 0) {
137
- const frame = getCurrentPathFrameData(table, currentRow);
138
- path.push(frame);
139
- currentRow = table.getChild(FIELD_PARENT)?.get(currentRow) ?? 0;
140
- }
141
- // Reverse the path so that the root is first.
142
- path.reverse();
143
- setCurPath(path);
144
- }, [table, setCurPath, isFlameChart]);
145
- const depthColumn = table.getChild(FIELD_DEPTH);
146
- const maxDepth = getMaxDepth(depthColumn);
147
- const rootCumulative = table.getChild(FIELD_CUMULATIVE)?.get(0);
148
- const isEmptySandwichView = isInSandwichView && table.numRows > 0 && (rootCumulative === null || rootCumulative === 0n);
149
- // Apply frame limit if maxFrameCount is provided and not expanded
150
- const effectiveDepth = maxFrameCount !== undefined && !isExpanded ? Math.min(maxDepth, maxFrameCount) : maxDepth;
151
- // Use deferred value to prevent UI blocking when expanding frames
152
- const deferredEffectiveDepth = useDeferredValue(effectiveDepth);
153
- const totalHeight = isInSandwichView
154
- ? deferredEffectiveDepth * RowHeight
155
- : (deferredEffectiveDepth + 1) * RowHeight;
156
- // Get the viewport of the container, this is used to determine which rows are visible.
157
- const viewport = useScrollViewport(containerRef);
158
- const isZoomEnabled = isFlameChart;
159
- const { zoomLevel, zoomIn, zoomOut, resetZoom, zoomToPosition, setZoomWithScroll, scrollLeftRef } = useZoom(isZoomEnabled ? containerRef : { current: null });
160
- const zoomedWidth = isZoomEnabled ? Math.round((width ?? 1) * zoomLevel) : width ?? 0;
161
- // Reset zoom when the data changes (e.g. new query, different time range)
162
- useEffect(() => {
163
- resetZoom();
164
- }, [table, resetZoom]);
165
- // To find the selected row, we must walk the current path and look at which
166
- // children of the current frame matches the path element exactly. Until the
167
- // end, the row we find at the end is our selected row.
168
- let currentRow = 0;
169
- for (const frame of curPath) {
170
- let childRows = Array.from(table.getChild(FIELD_CHILDREN)?.get(currentRow) ?? []);
192
+ }, [show]);
193
+ var hideBinary = function hideBinary(binaryToRemove) {
194
+ // Add a new frame filter to hide this binary using the new ProfileFilters system
195
+ excludeBinary(binaryToRemove);
196
+ };
197
+ var handleRowClick = useCallback(function (row_0) {
198
+ if (isFlameChart) {
199
+ // In flame charts, we don't want to expand the node, so we return early.
200
+ return;
201
+ }
202
+ // Walk down the stack starting at row until we reach the root (row 0).
203
+ var path = [];
204
+ var currentRow = row_0;
205
+ while (currentRow > 0) {
206
+ var _table$getChild$get, _table$getChild;
207
+ var frame = getCurrentPathFrameData(table, currentRow);
208
+ path.push(frame);
209
+ currentRow = (_table$getChild$get = (_table$getChild = table.getChild(FIELD_PARENT)) === null || _table$getChild === void 0 ? void 0 : _table$getChild.get(currentRow)) !== null && _table$getChild$get !== void 0 ? _table$getChild$get : 0;
210
+ }
211
+
212
+ // Reverse the path so that the root is first.
213
+ path.reverse();
214
+ setCurPath(path);
215
+ }, [table, setCurPath, isFlameChart]);
216
+ var depthColumn = table.getChild(FIELD_DEPTH);
217
+ var maxDepth = getMaxDepth(depthColumn);
218
+ var rootCumulative = (_table$getChild2 = table.getChild(FIELD_CUMULATIVE)) === null || _table$getChild2 === void 0 ? void 0 : _table$getChild2.get(0);
219
+ var isEmptySandwichView = isInSandwichView && table.numRows > 0 && (rootCumulative === null || rootCumulative === 0n);
220
+
221
+ // Apply frame limit if maxFrameCount is provided and not expanded
222
+ var effectiveDepth = maxFrameCount !== undefined && !isExpanded ? Math.min(maxDepth, maxFrameCount) : maxDepth;
223
+
224
+ // Use deferred value to prevent UI blocking when expanding frames
225
+ var deferredEffectiveDepth = useDeferredValue(effectiveDepth);
226
+ var totalHeight = isInSandwichView ? deferredEffectiveDepth * RowHeight : (deferredEffectiveDepth + 1) * RowHeight;
227
+
228
+ // Get the viewport of the container, this is used to determine which rows are visible.
229
+ var viewport = useScrollViewport(containerRef);
230
+ var isZoomEnabled = isFlameChart;
231
+ var _useZoom = useZoom(isZoomEnabled ? containerRef : {
232
+ current: null
233
+ }),
234
+ zoomLevel = _useZoom.zoomLevel,
235
+ zoomIn = _useZoom.zoomIn,
236
+ zoomOut = _useZoom.zoomOut,
237
+ resetZoom = _useZoom.resetZoom,
238
+ zoomToPosition = _useZoom.zoomToPosition,
239
+ setZoomWithScroll = _useZoom.setZoomWithScroll,
240
+ scrollLeftRef = _useZoom.scrollLeftRef;
241
+ var zoomedWidth = isZoomEnabled ? Math.round((width !== null && width !== void 0 ? width : 1) * zoomLevel) : width !== null && width !== void 0 ? width : 0;
242
+
243
+ // Reset zoom when the data changes (e.g. new query, different time range)
244
+ useEffect(function () {
245
+ resetZoom();
246
+ }, [table, resetZoom]);
247
+
248
+ // To find the selected row, we must walk the current path and look at which
249
+ // children of the current frame matches the path element exactly. Until the
250
+ // end, the row we find at the end is our selected row.
251
+ var currentRow_0 = 0;
252
+ var _iterator = _createForOfIteratorHelper(curPath),
253
+ _step;
254
+ try {
255
+ var _loop = function _loop() {
256
+ var _table$getChild$get2, _table$getChild3;
257
+ var frame_0 = _step.value;
258
+ var childRows = Array.from((_table$getChild$get2 = (_table$getChild3 = table.getChild(FIELD_CHILDREN)) === null || _table$getChild3 === void 0 ? void 0 : _table$getChild3.get(currentRow_0)) !== null && _table$getChild$get2 !== void 0 ? _table$getChild$get2 : []);
171
259
  if (childRows.length === 0) {
172
- // If there are no children, we can stop here.
173
- break;
260
+ // If there are no children, we can stop here.
261
+ return 0; // break
174
262
  }
175
- childRows = childRows.filter(c => isCurrentPathFrameMatch(table, c, frame));
263
+ childRows = childRows.filter(function (c) {
264
+ return isCurrentPathFrameMatch(table, c, frame_0);
265
+ });
176
266
  if (childRows.length === 0) {
177
- // If there are no children that match the current path frame, we can stop here.
178
- break;
267
+ // If there are no children that match the current path frame, we can stop here.
268
+ return 0; // break
179
269
  }
180
270
  if (childRows.length > 1) {
181
- // If there are multiple children that match the current path frame, we can stop here.
182
- // This is a case where the path is ambiguous and we cannot determine a single row.
183
- break;
271
+ // If there are multiple children that match the current path frame, we can stop here.
272
+ // This is a case where the path is ambiguous and we cannot determine a single row.
273
+ return 0; // break
184
274
  }
185
275
  // If there is exactly one child that matches the current path frame, we can continue.
186
- currentRow = childRows[0];
276
+ currentRow_0 = childRows[0];
277
+ },
278
+ _ret;
279
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
280
+ _ret = _loop();
281
+ if (_ret === 0) break;
187
282
  }
188
- const selectedRow = currentRow;
189
- const visibleNodes = useVisibleNodes({
190
- table,
191
- viewport,
192
- total,
193
- width: zoomedWidth,
194
- selectedRow,
195
- effectiveDepth: deferredEffectiveDepth,
196
- });
197
- // Add nodes in incremental batches to avoid blocking the UI
198
- const { items: batchedNodes, isComplete: isBatchingComplete } = useBatchedRendering(visibleNodes, {
199
- batchSize: 500,
200
- });
201
- if (isBatchingComplete) {
202
- hasInitialRenderCompleted.current = true;
203
- }
204
- // Show skeleton only during initial load, not during scroll updates
205
- const showSkeleton = !hasInitialRenderCompleted.current && batchedNodes.length !== visibleNodes.length;
206
- useEffect(() => {
207
- if (perf?.markInteraction != null) {
208
- renderStartTime.current = performance.now();
209
- }
210
- }, [table, width, curPath, perf]);
211
- useEffect(() => {
212
- setSvgElement(svg.current);
213
- }, [tooltipId]);
214
- if (isEmptySandwichView) {
215
- return _jsx("div", { className: "mx-auto text-center", children: "No matching samples found" });
283
+ } catch (err) {
284
+ _iterator.e(err);
285
+ } finally {
286
+ _iterator.f();
287
+ }
288
+ var selectedRow = currentRow_0;
289
+ var visibleNodes = useVisibleNodes({
290
+ table: table,
291
+ viewport: viewport,
292
+ total: total,
293
+ width: zoomedWidth,
294
+ selectedRow: selectedRow,
295
+ effectiveDepth: deferredEffectiveDepth
296
+ });
297
+
298
+ // Add nodes in incremental batches to avoid blocking the UI
299
+ var _useBatchedRendering = useBatchedRendering(visibleNodes, {
300
+ batchSize: 500
301
+ }),
302
+ batchedNodes = _useBatchedRendering.items,
303
+ isBatchingComplete = _useBatchedRendering.isComplete;
304
+ if (isBatchingComplete) {
305
+ hasInitialRenderCompleted.current = true;
306
+ }
307
+
308
+ // Show skeleton only during initial load, not during scroll updates
309
+ var showSkeleton = !hasInitialRenderCompleted.current && batchedNodes.length !== visibleNodes.length;
310
+ useEffect(function () {
311
+ if ((perf === null || perf === void 0 ? void 0 : perf.markInteraction) != null) {
312
+ renderStartTime.current = performance.now();
216
313
  }
217
- return (_jsx(TooltipProvider, { table: table, total: total, totalUnfiltered: total + filtered, profileType: profileType, unit: arrow.unit, compareAbsolute: compareAbsolute, tooltipId: tooltipId, children: _jsxs("div", { className: "relative", children: [isZoomEnabled && (_jsx(ZoomControls, { zoomLevel: zoomLevel, zoomIn: zoomIn, zoomOut: zoomOut, resetZoom: resetZoom, portalRef: zoomControlsRef })), _jsx(ContextMenuWrapper, { ref: contextMenuRef, menuId: MENU_ID, table: table, total: total, totalUnfiltered: total + filtered, compareAbsolute: compareAbsolute, resetPath: () => setCurPath([]), hideMenu: hideAll, hideBinary: hideBinary, unit: arrow.unit, profileType: profileType, isInSandwichView: isInSandwichView }), _jsx(MemoizedTooltip, { contextElement: svgElement, dockedMetainfo: dockedMetainfo }), showSkeleton && (_jsx("div", { className: "absolute inset-0 z-10", children: isRenderedAsFlamegraph ? (_jsx(SandwichFlameGraphSkeleton, { isHalfScreen: isHalfScreen, isDarkMode: isDarkMode })) : (_jsx(FlameGraphSkeleton, { isHalfScreen: isHalfScreen, isDarkMode: isDarkMode })) })), isZoomEnabled && (_jsx(MiniMap, { containerRef: containerRef, table: table, width: width ?? 0, zoomedWidth: zoomedWidth, totalHeight: totalHeight, maxDepth: deferredEffectiveDepth, colorByColors: colorByColors, colorBy: colorByValue, profileSource: profileSource, isDarkMode: isDarkMode, scrollLeft: viewport.scrollLeft, scrollLeftRef: scrollLeftRef, onZoomToPosition: zoomToPosition, onSetZoomWithScroll: setZoomWithScroll })), _jsx("div", { ref: containerRef, className: `${isZoomEnabled ? '[scrollbar-width:none] [&::-webkit-scrollbar]:hidden' : ''} will-change-transform webkit-overflow-scrolling-touch contain ${!isZoomEnabled ? 'overflow-auto' : ''}`, style: {
218
- width: width ?? '100%',
219
- ...(isZoomEnabled ? { overflowX: 'scroll', overflowY: 'auto' } : {}),
220
- contain: 'layout style paint',
221
- visibility: !showSkeleton ? 'visible' : 'hidden',
222
- }, children: _jsxs("div", { children: [isFlameChart && (_jsx(TimelineGuide, { bounds: boundsFromProfileSource(profileSource), width: zoomedWidth, height: totalHeight, margin: 0, ticks: 12, timeUnit: "nanoseconds" })), _jsx("svg", { className: "relative font-robotoMono", width: zoomedWidth, height: totalHeight, preserveAspectRatio: "xMinYMid", ref: svg, children: batchedNodes.map(row => (_jsx(FlameNode, { table: table, row: row, colors: colorByColors, colorBy: colorByValue, totalWidth: zoomedWidth, height: RowHeight, darkMode: isDarkMode, compareMode: compareMode, colorForSimilarNodes: colorForSimilarNodes, selectedRow: selectedRow, onClick: () => handleRowClick(row), onContextMenu: displayMenu, hoveringRow: highlightSimilarStacksPreference ? hoveringRow : undefined, setHoveringRow: highlightSimilarStacksPreference ? setHoveringRow : noop, isFlameChart: isFlameChart, profileSource: profileSource, isRenderedAsFlamegraph: isRenderedAsFlamegraph, isInSandwichView: isInSandwichView, maxDepth: maxDepth, effectiveDepth: deferredEffectiveDepth, tooltipId: tooltipId }, row))) })] }) })] }) }));
314
+ }, [table, width, curPath, perf]);
315
+ useEffect(function () {
316
+ setSvgElement(svg.current);
317
+ }, [tooltipId]);
318
+ if (isEmptySandwichView) {
319
+ return /*#__PURE__*/_jsx("div", {
320
+ className: "mx-auto text-center",
321
+ children: "No matching samples found"
322
+ });
323
+ }
324
+ return /*#__PURE__*/_jsx(TooltipProvider, {
325
+ table: table,
326
+ total: total,
327
+ totalUnfiltered: total + filtered,
328
+ profileType: profileType,
329
+ unit: arrow.unit,
330
+ compareAbsolute: compareAbsolute,
331
+ tooltipId: tooltipId,
332
+ children: /*#__PURE__*/_jsxs("div", {
333
+ className: "relative",
334
+ children: [isZoomEnabled && /*#__PURE__*/_jsx(ZoomControls, {
335
+ zoomLevel: zoomLevel,
336
+ zoomIn: zoomIn,
337
+ zoomOut: zoomOut,
338
+ resetZoom: resetZoom,
339
+ portalRef: zoomControlsRef
340
+ }), /*#__PURE__*/_jsx(ContextMenuWrapper, {
341
+ ref: contextMenuRef,
342
+ menuId: MENU_ID,
343
+ table: table,
344
+ total: total,
345
+ totalUnfiltered: total + filtered,
346
+ compareAbsolute: compareAbsolute,
347
+ resetPath: function resetPath() {
348
+ return setCurPath([]);
349
+ },
350
+ hideMenu: hideAll,
351
+ hideBinary: hideBinary,
352
+ unit: arrow.unit,
353
+ profileType: profileType,
354
+ isInSandwichView: isInSandwichView
355
+ }), /*#__PURE__*/_jsx(MemoizedTooltip, {
356
+ contextElement: svgElement,
357
+ dockedMetainfo: dockedMetainfo
358
+ }), showSkeleton && /*#__PURE__*/_jsx("div", {
359
+ className: "absolute inset-0 z-10",
360
+ children: isRenderedAsFlamegraph ? /*#__PURE__*/_jsx(SandwichFlameGraphSkeleton, {
361
+ isHalfScreen: isHalfScreen,
362
+ isDarkMode: isDarkMode
363
+ }) : /*#__PURE__*/_jsx(FlameGraphSkeleton, {
364
+ isHalfScreen: isHalfScreen,
365
+ isDarkMode: isDarkMode
366
+ })
367
+ }), isZoomEnabled && /*#__PURE__*/_jsx(MiniMap, {
368
+ containerRef: containerRef,
369
+ table: table,
370
+ width: width !== null && width !== void 0 ? width : 0,
371
+ zoomedWidth: zoomedWidth,
372
+ totalHeight: totalHeight,
373
+ maxDepth: deferredEffectiveDepth,
374
+ colorByColors: colorByColors,
375
+ colorBy: colorByValue,
376
+ profileSource: profileSource,
377
+ isDarkMode: isDarkMode,
378
+ scrollLeft: viewport.scrollLeft,
379
+ scrollLeftRef: scrollLeftRef,
380
+ onZoomToPosition: zoomToPosition,
381
+ onSetZoomWithScroll: setZoomWithScroll
382
+ }), /*#__PURE__*/_jsx("div", {
383
+ ref: containerRef,
384
+ className: "".concat(isZoomEnabled ? '[scrollbar-width:none] [&::-webkit-scrollbar]:hidden' : '', " will-change-transform webkit-overflow-scrolling-touch contain ").concat(!isZoomEnabled ? 'overflow-auto' : ''),
385
+ style: _objectSpread(_objectSpread({
386
+ width: width !== null && width !== void 0 ? width : '100%'
387
+ }, isZoomEnabled ? {
388
+ overflowX: 'scroll',
389
+ overflowY: 'auto'
390
+ } : {}), {}, {
391
+ contain: 'layout style paint',
392
+ visibility: !showSkeleton ? 'visible' : 'hidden'
393
+ }),
394
+ children: /*#__PURE__*/_jsxs("div", {
395
+ children: [isFlameChart && /*#__PURE__*/_jsx(TimelineGuide, {
396
+ bounds: boundsFromProfileSource(profileSource),
397
+ width: zoomedWidth,
398
+ height: totalHeight,
399
+ margin: 0,
400
+ ticks: 12,
401
+ timeUnit: "nanoseconds"
402
+ }), /*#__PURE__*/_jsx("svg", {
403
+ className: "relative font-robotoMono",
404
+ width: zoomedWidth,
405
+ height: totalHeight,
406
+ preserveAspectRatio: "xMinYMid",
407
+ ref: svg,
408
+ children: batchedNodes.map(function (row_1) {
409
+ return /*#__PURE__*/_jsx(FlameNode, {
410
+ table: table,
411
+ row: row_1,
412
+ colors: colorByColors,
413
+ colorBy: colorByValue,
414
+ totalWidth: zoomedWidth,
415
+ height: RowHeight,
416
+ darkMode: isDarkMode,
417
+ compareMode: compareMode,
418
+ colorForSimilarNodes: colorForSimilarNodes,
419
+ selectedRow: selectedRow,
420
+ onClick: function onClick() {
421
+ return handleRowClick(row_1);
422
+ },
423
+ onContextMenu: displayMenu,
424
+ hoveringRow: highlightSimilarStacksPreference ? hoveringRow : undefined,
425
+ setHoveringRow: highlightSimilarStacksPreference ? setHoveringRow : noop,
426
+ isFlameChart: isFlameChart,
427
+ profileSource: profileSource,
428
+ isRenderedAsFlamegraph: isRenderedAsFlamegraph,
429
+ isInSandwichView: isInSandwichView,
430
+ maxDepth: maxDepth,
431
+ effectiveDepth: deferredEffectiveDepth,
432
+ tooltipId: tooltipId
433
+ }, row_1);
434
+ })
435
+ })]
436
+ })
437
+ })]
438
+ })
439
+ });
223
440
  });
224
- export default FlameGraphArrow;
441
+ export default FlameGraphArrow;
@@ -1 +1 @@
1
- {"version":3,"file":"useBatchedRendering.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts"],"names":[],"mappings":"AAeA,UAAU,0BAA0B;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,yBAAyB,CAAC,CAAC;IACnC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;CACrB;AAGD,eAAO,MAAM,mBAAmB,GAAI,CAAC,EACnC,OAAO,CAAC,EAAE,EACV,UAAS,0BAA+B,KACvC,yBAAyB,CAAC,CAAC,CAqD7B,CAAC"}
1
+ {"version":3,"file":"useBatchedRendering.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts"],"names":[],"mappings":"AAiBA,UAAU,0BAA0B;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,yBAAyB,CAAC,CAAC;IACnC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;CACrB;AAGD,eAAO,MAAM,mBAAmB,GAAI,CAAC,EACnC,OAAO,CAAC,EAAE,EACV,UAAS,0BAA+B,KACvC,yBAAyB,CAAC,CAAC,CAsD7B,CAAC"}