@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,15 @@
1
- import { jsx as _jsx } 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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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; } }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
13
  // Copyright 2022 The Parca Authors
3
14
  // Licensed under the Apache License, Version 2.0 (the "License");
4
15
  // you may not use this file except in compliance with the License.
@@ -11,62 +22,81 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
22
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
23
  // See the License for the specific language governing permissions and
13
24
  // limitations under the License.
14
- import { useEffect, useState } from 'react';
25
+
26
+ /* eslint-disable react-hooks/refs */
27
+
28
+ import React, { useEffect, useState } from 'react';
15
29
  import { flip, offset, shift, useFloating } from '@floating-ui/react';
16
30
  import { pointer } from 'd3-selection';
17
- function createPositionedVirtualElement(contextElement, x = 0, y = 0) {
18
- const domRect = contextElement.getBoundingClientRect();
19
- return {
20
- getBoundingClientRect: () => ({
21
- width: 0,
22
- height: 0,
23
- top: domRect.y + y,
24
- left: domRect.x + x,
25
- right: domRect.x + x,
26
- bottom: domRect.y + y,
27
- x: domRect.x + x,
28
- y: domRect.y + y,
29
- toJSON: () => ({}),
30
- }),
31
- };
31
+ import { jsx as _jsx } from "react/jsx-runtime";
32
+ function createPositionedVirtualElement(contextElement) {
33
+ var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
34
+ var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
35
+ var domRect = contextElement.getBoundingClientRect();
36
+ return {
37
+ getBoundingClientRect: function getBoundingClientRect() {
38
+ return {
39
+ width: 0,
40
+ height: 0,
41
+ top: domRect.y + y,
42
+ left: domRect.x + x,
43
+ right: domRect.x + x,
44
+ bottom: domRect.y + y,
45
+ x: domRect.x + x,
46
+ y: domRect.y + y,
47
+ toJSON: function toJSON() {
48
+ return {};
49
+ }
50
+ };
51
+ }
52
+ };
32
53
  }
33
- const GraphTooltip = ({ children, contextElement }) => {
34
- const [isPositioned, setIsPositioned] = useState(false);
35
- const { refs, floatingStyles, update } = useFloating({
36
- placement: 'bottom-start',
37
- strategy: 'fixed',
38
- middleware: [
39
- offset({
40
- mainAxis: 30,
41
- crossAxis: 30,
42
- }),
43
- flip(),
44
- shift({
45
- padding: 20,
46
- }),
47
- ],
48
- whileElementsMounted: undefined,
49
- });
50
- useEffect(() => {
51
- if (contextElement === null)
52
- return;
53
- const onMouseMove = (e) => {
54
- const rel = pointer(e);
55
- const tooltipX = rel[0];
56
- const tooltipY = rel[1];
57
- const virtualElement = createPositionedVirtualElement(contextElement, tooltipX, tooltipY);
58
- refs.setReference(virtualElement);
59
- setIsPositioned(true);
60
- update();
61
- };
62
- contextElement.addEventListener('mousemove', onMouseMove);
63
- return () => {
64
- contextElement.removeEventListener('mousemove', onMouseMove);
65
- };
66
- }, [contextElement, update, refs]);
67
- return (_jsx("div", { ref: refs.setFloating, style: {
68
- ...floatingStyles,
69
- visibility: !isPositioned ? 'hidden' : 'visible',
70
- }, className: "z-50 w-max", children: children }));
54
+ var GraphTooltip = function GraphTooltip(_ref) {
55
+ 'use no memo';
56
+
57
+ var children = _ref.children,
58
+ contextElement = _ref.contextElement;
59
+ var _useState = useState(false),
60
+ _useState2 = _slicedToArray(_useState, 2),
61
+ isPositioned = _useState2[0],
62
+ setIsPositioned = _useState2[1];
63
+ var _useFloating = useFloating({
64
+ placement: 'bottom-start',
65
+ strategy: 'fixed',
66
+ middleware: [offset({
67
+ mainAxis: 30,
68
+ crossAxis: 30
69
+ }), flip(), shift({
70
+ padding: 20
71
+ })],
72
+ whileElementsMounted: undefined
73
+ }),
74
+ refs = _useFloating.refs,
75
+ floatingStyles = _useFloating.floatingStyles,
76
+ update = _useFloating.update;
77
+ useEffect(function () {
78
+ if (contextElement === null) return;
79
+ var onMouseMove = function onMouseMove(e) {
80
+ var rel = pointer(e);
81
+ var tooltipX = rel[0];
82
+ var tooltipY = rel[1];
83
+ var virtualElement = createPositionedVirtualElement(contextElement, tooltipX, tooltipY);
84
+ refs.setReference(virtualElement);
85
+ setIsPositioned(true);
86
+ update();
87
+ };
88
+ contextElement.addEventListener('mousemove', onMouseMove);
89
+ return function () {
90
+ contextElement.removeEventListener('mousemove', onMouseMove);
91
+ };
92
+ }, [contextElement, update, refs]);
93
+ return /*#__PURE__*/_jsx("div", {
94
+ ref: refs.setFloating,
95
+ style: _objectSpread(_objectSpread({}, floatingStyles), {}, {
96
+ visibility: !isPositioned ? 'hidden' : 'visible'
97
+ }),
98
+ className: "z-50 w-max",
99
+ children: children
100
+ });
71
101
  };
72
- export default GraphTooltip;
102
+ export default GraphTooltip;
@@ -10,42 +10,42 @@
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
+
13
14
  import { divide, valueFormatter } from '@parca/utilities';
14
- import { FIELD_CUMULATIVE, FIELD_DIFF, FIELD_FLAT, FIELD_LOCATION_ADDRESS, } from '../../ProfileFlameGraph/FlameGraphArrow';
15
+ import { FIELD_CUMULATIVE, FIELD_DIFF, FIELD_FLAT, FIELD_LOCATION_ADDRESS } from '../../ProfileFlameGraph/FlameGraphArrow';
15
16
  import { getTextForCumulative, nodeLabel } from '../../ProfileFlameGraph/FlameGraphArrow/utils';
16
- export const useGraphTooltip = ({ table, profileType, unit, compareAbsolute, total, totalUnfiltered, row, }) => {
17
- if (row === null || profileType === undefined) {
18
- return null;
19
- }
20
- const locationAddress = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row) ?? 0n;
21
- unit = unit ?? profileType.sampleUnit;
22
- const cumulative = table.getChild(FIELD_CUMULATIVE)?.get(row) !== null &&
23
- table.getChild(FIELD_CUMULATIVE)?.get(row) !== undefined
24
- ? BigInt(table.getChild(FIELD_CUMULATIVE)?.get(row))
25
- : 0n;
26
- const flat = table.getChild(FIELD_FLAT)?.get(row) !== null &&
27
- table.getChild(FIELD_FLAT)?.get(row) !== undefined
28
- ? BigInt(table.getChild(FIELD_FLAT)?.get(row))
29
- : 0n;
30
- const diff = table.getChild(FIELD_DIFF)?.get(row) !== null &&
31
- table.getChild(FIELD_DIFF)?.get(row) !== undefined
32
- ? BigInt(table.getChild(FIELD_DIFF)?.get(row))
33
- : 0n;
34
- let diffText = '';
35
- const prevValue = cumulative - diff;
36
- const diffRatio = diff !== 0n ? divide(diff, prevValue) : 0;
37
- const diffSign = diff > 0 ? '+' : '';
38
- const diffValueText = diffSign + valueFormatter(diff, unit, 1);
39
- const diffPercentageText = diffSign + (diffRatio * 100).toFixed(2) + '%';
40
- diffText = compareAbsolute ? `${diffValueText} (${diffPercentageText})` : diffPercentageText;
41
- const name = nodeLabel(table, row, false);
42
- return {
43
- name,
44
- locationAddress,
45
- cumulativeText: getTextForCumulative(cumulative, totalUnfiltered, total, unit ?? ''),
46
- flatText: getTextForCumulative(flat, totalUnfiltered, total, unit ?? ''),
47
- diffText,
48
- diff,
49
- row,
50
- };
51
- };
17
+ export var useGraphTooltip = function useGraphTooltip(_ref) {
18
+ var _table$getChild$get, _table$getChild, _table$getChild2, _table$getChild3, _table$getChild4, _table$getChild5, _table$getChild6, _table$getChild7, _table$getChild8, _table$getChild9, _table$getChild0;
19
+ var table = _ref.table,
20
+ profileType = _ref.profileType,
21
+ unit = _ref.unit,
22
+ compareAbsolute = _ref.compareAbsolute,
23
+ total = _ref.total,
24
+ totalUnfiltered = _ref.totalUnfiltered,
25
+ row = _ref.row;
26
+ if (row === null || profileType === undefined) {
27
+ return null;
28
+ }
29
+ var locationAddress = (_table$getChild$get = (_table$getChild = table.getChild(FIELD_LOCATION_ADDRESS)) === null || _table$getChild === void 0 ? void 0 : _table$getChild.get(row)) !== null && _table$getChild$get !== void 0 ? _table$getChild$get : 0n;
30
+ unit = unit !== null && unit !== void 0 ? unit : profileType.sampleUnit;
31
+ var cumulative = ((_table$getChild2 = table.getChild(FIELD_CUMULATIVE)) === null || _table$getChild2 === void 0 ? void 0 : _table$getChild2.get(row)) !== null && ((_table$getChild3 = table.getChild(FIELD_CUMULATIVE)) === null || _table$getChild3 === void 0 ? void 0 : _table$getChild3.get(row)) !== undefined ? BigInt((_table$getChild4 = table.getChild(FIELD_CUMULATIVE)) === null || _table$getChild4 === void 0 ? void 0 : _table$getChild4.get(row)) : 0n;
32
+ var flat = ((_table$getChild5 = table.getChild(FIELD_FLAT)) === null || _table$getChild5 === void 0 ? void 0 : _table$getChild5.get(row)) !== null && ((_table$getChild6 = table.getChild(FIELD_FLAT)) === null || _table$getChild6 === void 0 ? void 0 : _table$getChild6.get(row)) !== undefined ? BigInt((_table$getChild7 = table.getChild(FIELD_FLAT)) === null || _table$getChild7 === void 0 ? void 0 : _table$getChild7.get(row)) : 0n;
33
+ var diff = ((_table$getChild8 = table.getChild(FIELD_DIFF)) === null || _table$getChild8 === void 0 ? void 0 : _table$getChild8.get(row)) !== null && ((_table$getChild9 = table.getChild(FIELD_DIFF)) === null || _table$getChild9 === void 0 ? void 0 : _table$getChild9.get(row)) !== undefined ? BigInt((_table$getChild0 = table.getChild(FIELD_DIFF)) === null || _table$getChild0 === void 0 ? void 0 : _table$getChild0.get(row)) : 0n;
34
+ var diffText = '';
35
+ var prevValue = cumulative - diff;
36
+ var diffRatio = diff !== 0n ? divide(diff, prevValue) : 0;
37
+ var diffSign = diff > 0 ? '+' : '';
38
+ var diffValueText = diffSign + valueFormatter(diff, unit, 1);
39
+ var diffPercentageText = diffSign + (diffRatio * 100).toFixed(2) + '%';
40
+ diffText = compareAbsolute ? "".concat(diffValueText, " (").concat(diffPercentageText, ")") : diffPercentageText;
41
+ var name = nodeLabel(table, row, false);
42
+ return {
43
+ name: name,
44
+ locationAddress: locationAddress,
45
+ cumulativeText: getTextForCumulative(cumulative, totalUnfiltered, total, unit !== null && unit !== void 0 ? unit : ''),
46
+ flatText: getTextForCumulative(flat, totalUnfiltered, total, unit !== null && unit !== void 0 ? unit : ''),
47
+ diffText: diffText,
48
+ diff: diff,
49
+ row: row
50
+ };
51
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAwBxC,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,GAAI,gBAAc,KAAK,KAAG,wBAyF7D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAqBxC,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,GAAI,gBAAc,KAAK,KAAG,wBA8F7D,CAAC"}
@@ -1,3 +1,9 @@
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; }
1
7
  // Copyright 2022 The Parca Authors
2
8
  // Licensed under the Apache License, Version 2.0 (the "License");
3
9
  // you may not use this file except in compliance with the License.
@@ -10,79 +16,105 @@
10
16
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
17
  // See the License for the specific language governing permissions and
12
18
  // limitations under the License.
13
- import { useQueryState } from 'nuqs';
19
+
14
20
  import { QueryRequest_ReportType } from '@parca/client';
15
- import { useParcaContext } from '@parca/components';
16
- import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_START_LINE, FIELD_FUNCTION_SYSTEM_NAME, FIELD_INLINED, FIELD_LOCATION_ADDRESS, FIELD_LOCATION_LINE, FIELD_MAPPING_BUILD_ID, FIELD_MAPPING_FILE, FIELD_TIMESTAMP, } from '../../ProfileFlameGraph/FlameGraphArrow';
21
+ import { useParcaContext, useURLState } from '@parca/components';
22
+ import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_START_LINE, FIELD_FUNCTION_SYSTEM_NAME, FIELD_INLINED, FIELD_LOCATION_ADDRESS, FIELD_LOCATION_LINE, FIELD_MAPPING_BUILD_ID, FIELD_MAPPING_FILE, FIELD_TIMESTAMP } from '../../ProfileFlameGraph/FlameGraphArrow';
17
23
  import { arrowToString } from '../../ProfileFlameGraph/FlameGraphArrow/utils';
18
24
  import { useProfileViewContext } from '../../ProfileView/context/ProfileViewContext';
19
- import { stringParam } from '../../hooks/urlParsers';
20
- import { useDashboardItems } from '../../hooks/useDashboardItems';
21
25
  import { useQuery } from '../../useQuery';
22
- export const useGraphTooltipMetaInfo = ({ table, row }) => {
23
- const mappingFile = arrowToString(table.getChild(FIELD_MAPPING_FILE)?.get(row));
24
- const mappingBuildID = arrowToString(table.getChild(FIELD_MAPPING_BUILD_ID)?.get(row));
25
- const locationAddress = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row) ?? 0n;
26
- const inlined = table.getChild(FIELD_INLINED)?.get(row);
27
- const locationLine = table.getChild(FIELD_LOCATION_LINE)?.get(row) ?? 0n;
28
- const functionFilename = arrowToString(table.getChild(FIELD_FUNCTION_FILE_NAME)?.get(row)) ?? '';
29
- const functionSystemName = arrowToString(table.getChild(FIELD_FUNCTION_SYSTEM_NAME)?.get(row)) ?? '';
30
- const functionStartLine = table.getChild(FIELD_FUNCTION_START_LINE)?.get(row) ?? 0n;
31
- const lineNumber = locationLine !== 0n ? locationLine : functionStartLine !== 0n ? functionStartLine : undefined;
32
- const labelPrefix = 'labels.';
33
- const labelColumnNames = table.schema.fields.filter(field => field.name.startsWith(labelPrefix));
34
- const timestamp = table.getChild(FIELD_TIMESTAMP)?.get(row);
35
- const { queryServiceClient, enableSourcesView } = useParcaContext();
36
- const { profileSource } = useProfileViewContext();
37
- const { isLoading: sourceLoading, response: sourceResponse } = useQuery(queryServiceClient, profileSource, QueryRequest_ReportType.SOURCE, {
38
- skip: enableSourcesView === false ||
39
- profileSource === undefined ||
40
- // eslint-disable-next-line no-extra-boolean-cast
41
- !Boolean(mappingBuildID) ||
42
- // eslint-disable-next-line no-extra-boolean-cast
43
- !Boolean(functionFilename),
44
- sourceBuildID: mappingBuildID !== null ? mappingBuildID : undefined,
45
- sourceFilename: functionFilename,
46
- sourceOnly: true,
47
- });
48
- const isSourceAvailable = !sourceLoading && sourceResponse?.report != null;
49
- const getTextForFile = () => {
50
- if (functionFilename === '')
51
- return '<unknown>';
52
- return `${functionFilename} ${lineNumber !== undefined ? ` +${lineNumber.toString()}` : ''}`;
53
- };
54
- const file = getTextForFile();
55
- const labelPairs = labelColumnNames
56
- .map((field, i) => [
57
- labelColumnNames[i].name.slice(labelPrefix.length),
58
- arrowToString(table.getChild(field.name)?.get(row)) ?? '',
59
- ])
60
- .filter(value => value[1] !== '');
61
- const { dashboardItems, setDashboardItems } = useDashboardItems();
62
- const [_unusedBuildId, setSourceBuildId] = useQueryState('source_buildid', stringParam);
63
- const [_unusedFilename, setSourceFilename] = useQueryState('source_filename', stringParam);
64
- const [_unusedLine, setSourceLine] = useQueryState('source_line', stringParam);
65
- const openFile = () => {
66
- setDashboardItems([dashboardItems[0], 'source']);
67
- if (mappingBuildID != null) {
68
- void setSourceBuildId(mappingBuildID);
69
- }
70
- void setSourceFilename(functionFilename);
71
- if (lineNumber !== undefined) {
72
- void setSourceLine(lineNumber.toString());
73
- }
74
- };
75
- return {
76
- labelPairs,
77
- functionFilename,
78
- functionSystemName,
79
- file,
80
- openFile,
81
- isSourceAvailable,
82
- locationAddress,
83
- mappingBuildID,
84
- mappingFile,
85
- inlined,
86
- timestamp,
87
- };
88
- };
26
+ export var useGraphTooltipMetaInfo = function useGraphTooltipMetaInfo(_ref) {
27
+ var _table$getChild, _table$getChild2, _table$getChild$get, _table$getChild3, _table$getChild4, _table$getChild$get2, _table$getChild5, _arrowToString, _table$getChild6, _arrowToString2, _table$getChild7, _table$getChild$get3, _table$getChild8, _table$getChild9;
28
+ var table = _ref.table,
29
+ row = _ref.row;
30
+ var mappingFile = arrowToString((_table$getChild = table.getChild(FIELD_MAPPING_FILE)) === null || _table$getChild === void 0 ? void 0 : _table$getChild.get(row));
31
+ var mappingBuildID = arrowToString((_table$getChild2 = table.getChild(FIELD_MAPPING_BUILD_ID)) === null || _table$getChild2 === void 0 ? void 0 : _table$getChild2.get(row));
32
+ var locationAddress = (_table$getChild$get = (_table$getChild3 = table.getChild(FIELD_LOCATION_ADDRESS)) === null || _table$getChild3 === void 0 ? void 0 : _table$getChild3.get(row)) !== null && _table$getChild$get !== void 0 ? _table$getChild$get : 0n;
33
+ var inlined = (_table$getChild4 = table.getChild(FIELD_INLINED)) === null || _table$getChild4 === void 0 ? void 0 : _table$getChild4.get(row);
34
+ var locationLine = (_table$getChild$get2 = (_table$getChild5 = table.getChild(FIELD_LOCATION_LINE)) === null || _table$getChild5 === void 0 ? void 0 : _table$getChild5.get(row)) !== null && _table$getChild$get2 !== void 0 ? _table$getChild$get2 : 0n;
35
+ var functionFilename = (_arrowToString = arrowToString((_table$getChild6 = table.getChild(FIELD_FUNCTION_FILE_NAME)) === null || _table$getChild6 === void 0 ? void 0 : _table$getChild6.get(row))) !== null && _arrowToString !== void 0 ? _arrowToString : '';
36
+ var functionSystemName = (_arrowToString2 = arrowToString((_table$getChild7 = table.getChild(FIELD_FUNCTION_SYSTEM_NAME)) === null || _table$getChild7 === void 0 ? void 0 : _table$getChild7.get(row))) !== null && _arrowToString2 !== void 0 ? _arrowToString2 : '';
37
+ var functionStartLine = (_table$getChild$get3 = (_table$getChild8 = table.getChild(FIELD_FUNCTION_START_LINE)) === null || _table$getChild8 === void 0 ? void 0 : _table$getChild8.get(row)) !== null && _table$getChild$get3 !== void 0 ? _table$getChild$get3 : 0n;
38
+ var lineNumber = locationLine !== 0n ? locationLine : functionStartLine !== 0n ? functionStartLine : undefined;
39
+ var labelPrefix = 'labels.';
40
+ var labelColumnNames = table.schema.fields.filter(function (field) {
41
+ return field.name.startsWith(labelPrefix);
42
+ });
43
+ var timestamp = (_table$getChild9 = table.getChild(FIELD_TIMESTAMP)) === null || _table$getChild9 === void 0 ? void 0 : _table$getChild9.get(row);
44
+ var _useParcaContext = useParcaContext(),
45
+ queryServiceClient = _useParcaContext.queryServiceClient,
46
+ enableSourcesView = _useParcaContext.enableSourcesView;
47
+ var _useProfileViewContex = useProfileViewContext(),
48
+ profileSource = _useProfileViewContex.profileSource;
49
+ var _useQuery = useQuery(queryServiceClient, profileSource, QueryRequest_ReportType.SOURCE, {
50
+ skip: enableSourcesView === false || profileSource === undefined ||
51
+ // eslint-disable-next-line no-extra-boolean-cast
52
+ !Boolean(mappingBuildID) ||
53
+ // eslint-disable-next-line no-extra-boolean-cast
54
+ !Boolean(functionFilename),
55
+ sourceBuildID: mappingBuildID !== null ? mappingBuildID : undefined,
56
+ sourceFilename: functionFilename,
57
+ sourceOnly: true
58
+ }),
59
+ sourceLoading = _useQuery.isLoading,
60
+ sourceResponse = _useQuery.response;
61
+ var isSourceAvailable = !sourceLoading && (sourceResponse === null || sourceResponse === void 0 ? void 0 : sourceResponse.report) != null;
62
+ var getTextForFile = function getTextForFile() {
63
+ if (functionFilename === '') return '<unknown>';
64
+ return "".concat(functionFilename, " ").concat(lineNumber !== undefined ? " +".concat(lineNumber.toString()) : '');
65
+ };
66
+ var file = getTextForFile();
67
+ var labelPairs = labelColumnNames.map(function (field_0, i) {
68
+ var _arrowToString3, _table$getChild0;
69
+ return [labelColumnNames[i].name.slice(labelPrefix.length), (_arrowToString3 = arrowToString((_table$getChild0 = table.getChild(field_0.name)) === null || _table$getChild0 === void 0 ? void 0 : _table$getChild0.get(row))) !== null && _arrowToString3 !== void 0 ? _arrowToString3 : ''];
70
+ }).filter(function (value) {
71
+ return value[1] !== '';
72
+ });
73
+ var _useURLState = useURLState('dashboard_items', {
74
+ alwaysReturnArray: true
75
+ }),
76
+ _useURLState2 = _slicedToArray(_useURLState, 2),
77
+ dashboardItems = _useURLState2[0],
78
+ setDashboardItems = _useURLState2[1];
79
+
80
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
81
+ var _useURLState3 = useURLState('source_buildid'),
82
+ _useURLState4 = _slicedToArray(_useURLState3, 2),
83
+ unusedBuildId = _useURLState4[0],
84
+ setSourceBuildId = _useURLState4[1];
85
+
86
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
87
+ var _useURLState5 = useURLState('source_filename'),
88
+ _useURLState6 = _slicedToArray(_useURLState5, 2),
89
+ unusedFilename = _useURLState6[0],
90
+ setSourceFilename = _useURLState6[1];
91
+
92
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
+ var _useURLState7 = useURLState('source_line'),
94
+ _useURLState8 = _slicedToArray(_useURLState7, 2),
95
+ unusedLine = _useURLState8[0],
96
+ setSourceLine = _useURLState8[1];
97
+ var openFile = function openFile() {
98
+ setDashboardItems([dashboardItems[0], 'source']);
99
+ if (mappingBuildID != null) {
100
+ setSourceBuildId(mappingBuildID);
101
+ }
102
+ setSourceFilename(functionFilename);
103
+ if (lineNumber !== undefined) {
104
+ setSourceLine(lineNumber.toString());
105
+ }
106
+ };
107
+ return {
108
+ labelPairs: labelPairs,
109
+ functionFilename: functionFilename,
110
+ functionSystemName: functionSystemName,
111
+ file: file,
112
+ openFile: openFile,
113
+ isSourceAvailable: isSourceAvailable,
114
+ locationAddress: locationAddress,
115
+ mappingBuildID: mappingBuildID,
116
+ mappingFile: mappingFile,
117
+ inlined: inlined,
118
+ timestamp: timestamp
119
+ };
120
+ };
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react-compiler-runtime";
2
2
  // Copyright 2022 The Parca Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -11,17 +11,96 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
+
14
15
  import { useEffect, useRef } from 'react';
15
16
  import cx from 'classnames';
16
- const SuggestionItem = ({ isHighlighted, onHighlight, onApplySuggestion, onResetHighlight, value, }) => {
17
- const ref = useRef(null);
18
- useEffect(() => {
19
- if (isHighlighted && ref.current != null) {
20
- ref.current.scrollIntoView({ block: 'nearest' });
21
- }
22
- }, [isHighlighted]);
23
- return (_jsx("div", { className: cx('relative cursor-default select-none py-2 pl-3 pr-9', {
24
- 'bg-indigo-600 text-white': isHighlighted,
25
- }), onMouseOver: () => onHighlight(), onClick: () => onApplySuggestion(), onMouseOut: () => onResetHighlight(), ref: ref, children: value }));
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ var SuggestionItem = function SuggestionItem(t0) {
19
+ var $ = _c(17);
20
+ var isHighlighted = t0.isHighlighted,
21
+ onHighlight = t0.onHighlight,
22
+ onApplySuggestion = t0.onApplySuggestion,
23
+ onResetHighlight = t0.onResetHighlight,
24
+ value = t0.value;
25
+ var ref = useRef(null);
26
+ var t1;
27
+ var t2;
28
+ if ($[0] !== isHighlighted) {
29
+ t1 = function t1() {
30
+ if (isHighlighted && ref.current != null) {
31
+ ref.current.scrollIntoView({
32
+ block: "nearest"
33
+ });
34
+ }
35
+ };
36
+ t2 = [isHighlighted];
37
+ $[0] = isHighlighted;
38
+ $[1] = t1;
39
+ $[2] = t2;
40
+ } else {
41
+ t1 = $[1];
42
+ t2 = $[2];
43
+ }
44
+ useEffect(t1, t2);
45
+ var t3;
46
+ if ($[3] !== isHighlighted) {
47
+ t3 = cx("relative cursor-default select-none py-2 pl-3 pr-9", {
48
+ "bg-indigo-600 text-white": isHighlighted
49
+ });
50
+ $[3] = isHighlighted;
51
+ $[4] = t3;
52
+ } else {
53
+ t3 = $[4];
54
+ }
55
+ var t4;
56
+ if ($[5] !== onHighlight) {
57
+ t4 = function t4() {
58
+ return onHighlight();
59
+ };
60
+ $[5] = onHighlight;
61
+ $[6] = t4;
62
+ } else {
63
+ t4 = $[6];
64
+ }
65
+ var t5;
66
+ if ($[7] !== onApplySuggestion) {
67
+ t5 = function t5() {
68
+ return onApplySuggestion();
69
+ };
70
+ $[7] = onApplySuggestion;
71
+ $[8] = t5;
72
+ } else {
73
+ t5 = $[8];
74
+ }
75
+ var t6;
76
+ if ($[9] !== onResetHighlight) {
77
+ t6 = function t6() {
78
+ return onResetHighlight();
79
+ };
80
+ $[9] = onResetHighlight;
81
+ $[10] = t6;
82
+ } else {
83
+ t6 = $[10];
84
+ }
85
+ var t7;
86
+ if ($[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6 || $[15] !== value) {
87
+ t7 = /*#__PURE__*/_jsx("div", {
88
+ className: t3,
89
+ onMouseOver: t4,
90
+ onClick: t5,
91
+ onMouseOut: t6,
92
+ ref: ref,
93
+ children: value
94
+ });
95
+ $[11] = t3;
96
+ $[12] = t4;
97
+ $[13] = t5;
98
+ $[14] = t6;
99
+ $[15] = value;
100
+ $[16] = t7;
101
+ } else {
102
+ t7 = $[16];
103
+ }
104
+ return t7;
26
105
  };
27
- export default SuggestionItem;
106
+ export default SuggestionItem;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export declare class Suggestion {
2
3
  type: string;
3
4
  typeahead: string;
@@ -13,7 +14,7 @@ export declare class Suggestions {
13
14
  interface Props {
14
15
  suggestions: Suggestions;
15
16
  applySuggestion: (suggestion: Suggestion) => void;
16
- inputRef: HTMLTextAreaElement | null;
17
+ inputRef: React.RefObject<HTMLTextAreaElement | null>;
17
18
  runQuery: () => void;
18
19
  focusedInput: boolean;
19
20
  isLabelNamesLoading: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionsList.d.ts","sourceRoot":"","sources":["../../src/MatchersInput/SuggestionsList.tsx"],"names":[],"mappings":"AAuBA,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;gBAEF,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAK3D;AAED,qBAAa,WAAW;IACtB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;;CAO3B;AAED,UAAU,KAAK;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAaD,QAAA,MAAM,eAAe,GAAI,yKAWtB,KAAK,KAAG,GAAG,CAAC,OAwUd,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"SuggestionsList.d.ts","sourceRoot":"","sources":["../../src/MatchersInput/SuggestionsList.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAUxE,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;gBAEF,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAK3D;AAED,qBAAa,WAAW;IACtB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;;CAO3B;AAED,UAAU,KAAK;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACtD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAaD,QAAA,MAAM,eAAe,GAAI,yKAWtB,KAAK,KAAG,GAAG,CAAC,OAyUd,CAAC;AAEF,eAAe,eAAe,CAAC"}