@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,14 @@
1
- import { Fragment as _Fragment, 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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
+ 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."); }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _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; }
6
+ 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; } }
7
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
+ 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; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
+ 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); }
11
+ import { c as _c } from "react-compiler-runtime";
2
12
  // Copyright 2022 The Parca Authors
3
13
  // Licensed under the Apache License, Version 2.0 (the "License");
4
14
  // you may not use this file except in compliance with the License.
@@ -11,35 +21,236 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
11
21
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
22
  // See the License for the specific language governing permissions and
13
23
  // limitations under the License.
24
+
14
25
  import { Fragment, useState } from 'react';
15
26
  import { Listbox, Transition } from '@headlessui/react';
16
27
  import { Icon } from '@iconify/react';
17
28
  import cx from 'classnames';
18
29
  import { Button, useParcaContext } from '@parca/components';
30
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
31
  export function contructItemsFromArray(items) {
20
- return items.map(item => ({
21
- key: item.key,
22
- element: { active: _jsx(_Fragment, { children: item.label }), expanded: _jsx(_Fragment, { children: item.label }) },
23
- innerAction: item.innerAction,
24
- }));
32
+ return items.map(function (item) {
33
+ return {
34
+ key: item.key,
35
+ element: {
36
+ active: /*#__PURE__*/_jsx(_Fragment, {
37
+ children: item.label
38
+ }),
39
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
40
+ children: item.label
41
+ })
42
+ },
43
+ innerAction: item.innerAction
44
+ };
45
+ });
25
46
  }
26
- const Dropdown = ({ items, selectedKey, onSelection, placeholder, width, className = '', loading, primary = false, disabled = false, icon, id, optionsClassName = '', }) => {
27
- const selection = items.find(v => v.key === selectedKey) ?? {
28
- key: selectedKey,
29
- element: { active: _jsx(_Fragment, { children: selectedKey }), expanded: _jsx(_Fragment, { children: selectedKey }) },
47
+ var Dropdown = function Dropdown(t0) {
48
+ var $ = _c(20);
49
+ var items = t0.items,
50
+ selectedKey = t0.selectedKey,
51
+ onSelection = t0.onSelection,
52
+ placeholder = t0.placeholder,
53
+ width = t0.width,
54
+ t1 = t0.className,
55
+ loading = t0.loading,
56
+ t2 = t0.primary,
57
+ t3 = t0.disabled,
58
+ icon = t0.icon,
59
+ id = t0.id,
60
+ t4 = t0.optionsClassName;
61
+ var className = t1 === undefined ? "" : t1;
62
+ var primary = t2 === undefined ? false : t2;
63
+ var disabled = t3 === undefined ? false : t3;
64
+ var optionsClassName = t4 === undefined ? "" : t4;
65
+ var t5;
66
+ if ($[0] !== items || $[1] !== selectedKey) {
67
+ var _items$find;
68
+ t5 = (_items$find = items.find(function (v) {
69
+ return v.key === selectedKey;
70
+ })) !== null && _items$find !== void 0 ? _items$find : {
71
+ key: selectedKey,
72
+ element: {
73
+ active: /*#__PURE__*/_jsx(_Fragment, {
74
+ children: selectedKey
75
+ }),
76
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
77
+ children: selectedKey
78
+ })
79
+ }
30
80
  };
31
- const { loader } = useParcaContext();
32
- const styles = 'relative border rounded-md shadow-sm px-4 py-2 text-left cursor-default focus:outline-none focus:ring-1 items-center focus:ring-indigo-500 focus:border-indigo-500 text-sm flex gap-2 flex items-center justify-between';
33
- const defaultStyles = 'bg-white dark:bg-gray-900 dark:border-gray-600';
34
- const primaryStyles = 'text-gray-100 dark:gray-900 bg-indigo-600 border-indigo-500 font-medium py-2 px-4';
35
- return (_jsx(Listbox, { value: selectedKey, onChange: onSelection, children: ({ open }) => (_jsxs("div", { className: "relative", children: [_jsx("div", { id: id, children: _jsxs(Listbox.Button, { className: cx(styles, width !== undefined ? `w-${width}` : 'w-full', disabled ? 'cursor-not-allowed opacity-50 pointer-events-none' : '', primary ? primaryStyles : defaultStyles, { [className]: className.length > 0 }), children: [_jsx("div", { className: cx(icon != null ? '' : 'block overflow-x-hidden text-ellipsis'), children: selection?.key !== '' ? selection.element.active : placeholder }), _jsx("div", { className: cx(icon != null ? '' : 'pointer-events-none text-gray-400'), children: icon ?? _jsx(Icon, { icon: "heroicons:chevron-up-down-20-solid", "aria-hidden": "true" }) })] }) }), _jsx(Transition, { show: open, as: Fragment, leave: "transition ease-in duration-100", leaveFrom: "opacity-100", leaveTo: "opacity-0", children: _jsx(Listbox.Options, { className: cx(optionsClassName, 'absolute w-[246px] right-0 z-50 mt-1 max-h-[50vh] overflow-auto rounded-md bg-gray-50 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:border-gray-600 dark:bg-gray-900 dark:ring-white dark:ring-opacity-20 sm:text-sm'), children: loading === true ? (_jsx("div", { className: "w-[270px]", children: loader })) : (items.length > 0 &&
36
- items.map(option => _jsx(DropdownOption, { option: option }, option.key))) }) })] })) }));
81
+ $[0] = items;
82
+ $[1] = selectedKey;
83
+ $[2] = t5;
84
+ } else {
85
+ t5 = $[2];
86
+ }
87
+ var selection = t5;
88
+ var _useParcaContext = useParcaContext(),
89
+ loader = _useParcaContext.loader;
90
+ var t6;
91
+ if ($[3] !== className || $[4] !== disabled || $[5] !== icon || $[6] !== id || $[7] !== items || $[8] !== loader || $[9] !== loading || $[10] !== optionsClassName || $[11] !== placeholder || $[12] !== primary || $[13] !== selection || $[14] !== width) {
92
+ t6 = function t6(t7) {
93
+ var open = t7.open;
94
+ return /*#__PURE__*/_jsxs("div", {
95
+ className: "relative",
96
+ children: [/*#__PURE__*/_jsx("div", {
97
+ id: id,
98
+ children: /*#__PURE__*/_jsxs(Listbox.Button, {
99
+ className: cx("relative border rounded-md shadow-sm px-4 py-2 text-left cursor-default focus:outline-none focus:ring-1 items-center focus:ring-indigo-500 focus:border-indigo-500 text-sm flex gap-2 flex items-center justify-between", width !== undefined ? "w-".concat(width) : "w-full", disabled ? "cursor-not-allowed opacity-50 pointer-events-none" : "", primary ? "text-gray-100 dark:gray-900 bg-indigo-600 border-indigo-500 font-medium py-2 px-4" : "bg-white dark:bg-gray-900 dark:border-gray-600", _defineProperty({}, className, className.length > 0)),
100
+ children: [/*#__PURE__*/_jsx("div", {
101
+ className: cx(icon != null ? "" : "block overflow-x-hidden text-ellipsis"),
102
+ children: (selection === null || selection === void 0 ? void 0 : selection.key) !== "" ? selection.element.active : placeholder
103
+ }), /*#__PURE__*/_jsx("div", {
104
+ className: cx(icon != null ? "" : "pointer-events-none text-gray-400"),
105
+ children: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/_jsx(Icon, {
106
+ icon: "heroicons:chevron-up-down-20-solid",
107
+ "aria-hidden": "true"
108
+ })
109
+ })]
110
+ })
111
+ }), /*#__PURE__*/_jsx(Transition, {
112
+ show: open,
113
+ as: Fragment,
114
+ leave: "transition ease-in duration-100",
115
+ leaveFrom: "opacity-100",
116
+ leaveTo: "opacity-0",
117
+ children: /*#__PURE__*/_jsx(Listbox.Options, {
118
+ className: cx(optionsClassName, "absolute w-[246px] right-0 z-50 mt-1 max-h-[50vh] overflow-auto rounded-md bg-gray-50 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:border-gray-600 dark:bg-gray-900 dark:ring-white dark:ring-opacity-20 sm:text-sm"),
119
+ children: loading === true ? /*#__PURE__*/_jsx("div", {
120
+ className: "w-[270px]",
121
+ children: loader
122
+ }) : items.length > 0 && items.map(_temp)
123
+ })
124
+ })]
125
+ });
126
+ };
127
+ $[3] = className;
128
+ $[4] = disabled;
129
+ $[5] = icon;
130
+ $[6] = id;
131
+ $[7] = items;
132
+ $[8] = loader;
133
+ $[9] = loading;
134
+ $[10] = optionsClassName;
135
+ $[11] = placeholder;
136
+ $[12] = primary;
137
+ $[13] = selection;
138
+ $[14] = width;
139
+ $[15] = t6;
140
+ } else {
141
+ t6 = $[15];
142
+ }
143
+ var t7;
144
+ if ($[16] !== onSelection || $[17] !== selectedKey || $[18] !== t6) {
145
+ t7 = /*#__PURE__*/_jsx(Listbox, {
146
+ value: selectedKey,
147
+ onChange: onSelection,
148
+ children: t6
149
+ });
150
+ $[16] = onSelection;
151
+ $[17] = selectedKey;
152
+ $[18] = t6;
153
+ $[19] = t7;
154
+ } else {
155
+ t7 = $[19];
156
+ }
157
+ return t7;
37
158
  };
38
- const DropdownOption = ({ option }) => {
39
- const [isMouseOver, setIsMouseOver] = useState(false);
40
- return (_jsx(Listbox.Option, { id: option.id ?? `h-select-option-${option.key}`, disabled: option.disabled ?? false, className: ({ active }) => cx(active && 'bg-indigo-600 text-white', 'relative flex cursor-default select-none py-2 px-3'), value: option.key, children: ({ selected, active, disabled }) => (_jsxs("div", { className: "relative flex items-center w-full justify-between", onMouseEnter: () => setIsMouseOver(true), onMouseLeave: () => setIsMouseOver(false), children: [isMouseOver && disabled && option.disabledText != null ? (_jsxs("div", { className: "absolute top-[-60px] text-gray-500 dark:text-gray-400 text-xs bg-white dark:bg-black border rounded p-2 z-100 w-52 text-center", onMouseEnter: () => setIsMouseOver(false), children: [option.disabledText, _jsx("div", { className: "absolute left-1/2 -translate-x-1/2 top-full h-0 w-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent" })] })) : null, _jsx("div", { className: "flex items-center", children: _jsx("span", { className: cx(selected ? 'font-semibold' : 'font-normal', disabled && 'opacity-50'), children: option.element.expanded }) }), option.innerAction !== undefined && (_jsxs(Button, { variant: "neutral", className: "p-[6px]", onClick: e => {
41
- e.stopPropagation();
42
- option.innerAction?.onClick();
43
- }, disabled: option.innerAction?.isDisabled, children: [option.innerAction.text, option.innerAction.text === 'Add Panel' && (_jsx(Icon, { icon: "ic:baseline-plus", className: "w-[14px] h-[14px] ml-2" }))] })), selected ? (_jsx("span", { className: cx(active ? 'text-white' : 'text-indigo-600', 'absolute inset-y-0 right-0 flex items-center pr-4'), children: _jsx(Icon, { icon: "heroicons:check-20-solid", "aria-hidden": "true" }) })) : null] })) }, option.key));
159
+ var DropdownOption = function DropdownOption(t0) {
160
+ var _option$id, _option$disabled;
161
+ var $ = _c(10);
162
+ var option = t0.option;
163
+ var _useState = useState(false),
164
+ _useState2 = _slicedToArray(_useState, 2),
165
+ isMouseOver = _useState2[0],
166
+ setIsMouseOver = _useState2[1];
167
+ var t1 = (_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : "h-select-option-".concat(option.key);
168
+ var t2 = (_option$disabled = option.disabled) !== null && _option$disabled !== void 0 ? _option$disabled : false;
169
+ var t3;
170
+ if ($[0] !== isMouseOver || $[1] !== option.disabledText || $[2] !== option.element.expanded || $[3] !== option.innerAction) {
171
+ t3 = function t3(t4) {
172
+ var _option$innerAction2;
173
+ var selected = t4.selected,
174
+ active_0 = t4.active,
175
+ disabled = t4.disabled;
176
+ return /*#__PURE__*/_jsxs("div", {
177
+ className: "relative flex items-center w-full justify-between",
178
+ onMouseEnter: function onMouseEnter() {
179
+ return setIsMouseOver(true);
180
+ },
181
+ onMouseLeave: function onMouseLeave() {
182
+ return setIsMouseOver(false);
183
+ },
184
+ children: [isMouseOver && disabled && option.disabledText != null ? /*#__PURE__*/_jsxs("div", {
185
+ className: "absolute top-[-60px] text-gray-500 dark:text-gray-400 text-xs bg-white dark:bg-black border rounded p-2 z-100 w-52 text-center",
186
+ onMouseEnter: function onMouseEnter() {
187
+ return setIsMouseOver(false);
188
+ },
189
+ children: [option.disabledText, /*#__PURE__*/_jsx("div", {
190
+ className: "absolute left-1/2 -translate-x-1/2 top-full h-0 w-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent"
191
+ })]
192
+ }) : null, /*#__PURE__*/_jsx("div", {
193
+ className: "flex items-center",
194
+ children: /*#__PURE__*/_jsx("span", {
195
+ className: cx(selected ? "font-semibold" : "font-normal", disabled && "opacity-50"),
196
+ children: option.element.expanded
197
+ })
198
+ }), option.innerAction !== undefined && /*#__PURE__*/_jsxs(Button, {
199
+ variant: "neutral",
200
+ className: "p-[6px]",
201
+ onClick: function onClick(e) {
202
+ var _option$innerAction;
203
+ e.stopPropagation();
204
+ (_option$innerAction = option.innerAction) === null || _option$innerAction === void 0 || _option$innerAction.onClick();
205
+ },
206
+ disabled: (_option$innerAction2 = option.innerAction) === null || _option$innerAction2 === void 0 ? void 0 : _option$innerAction2.isDisabled,
207
+ children: [option.innerAction.text, option.innerAction.text === "Add Panel" && /*#__PURE__*/_jsx(Icon, {
208
+ icon: "ic:baseline-plus",
209
+ className: "w-[14px] h-[14px] ml-2"
210
+ })]
211
+ }), selected ? /*#__PURE__*/_jsx("span", {
212
+ className: cx(active_0 ? "text-white" : "text-indigo-600", "absolute inset-y-0 right-0 flex items-center pr-4"),
213
+ children: /*#__PURE__*/_jsx(Icon, {
214
+ icon: "heroicons:check-20-solid",
215
+ "aria-hidden": "true"
216
+ })
217
+ }) : null]
218
+ });
219
+ };
220
+ $[0] = isMouseOver;
221
+ $[1] = option.disabledText;
222
+ $[2] = option.element.expanded;
223
+ $[3] = option.innerAction;
224
+ $[4] = t3;
225
+ } else {
226
+ t3 = $[4];
227
+ }
228
+ var t4;
229
+ if ($[5] !== option.key || $[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
230
+ t4 = /*#__PURE__*/_jsx(Listbox.Option, {
231
+ id: t1,
232
+ disabled: t2,
233
+ className: _temp2,
234
+ value: option.key,
235
+ children: t3
236
+ }, option.key);
237
+ $[5] = option.key;
238
+ $[6] = t1;
239
+ $[7] = t2;
240
+ $[8] = t3;
241
+ $[9] = t4;
242
+ } else {
243
+ t4 = $[9];
244
+ }
245
+ return t4;
44
246
  };
45
247
  export default Dropdown;
248
+ function _temp(option) {
249
+ return /*#__PURE__*/_jsx(DropdownOption, {
250
+ option: option
251
+ }, option.key);
252
+ }
253
+ function _temp2(t0) {
254
+ var active = t0.active;
255
+ return cx(active && "bg-indigo-600 text-white", "relative flex cursor-default select-none py-2 px-3");
256
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/ViewSelector/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAKrD,UAAU,KAAK;IACb,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,YAAY,GAAI,mBAAiB,KAAK,KAAG,GAAG,CAAC,OAoJlD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/ViewSelector/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAGrD,UAAU,KAAK;IACb,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,YAAY,GAAI,mBAAiB,KAAK,KAAG,GAAG,CAAC,OA+JlD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,95 +1,221 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useQueryState } from 'nuqs';
3
- import { useParcaContext } from '@parca/components';
4
- import { stringParam } from '../../../hooks/urlParsers';
5
- import { useDashboardItems } from '../../../hooks/useDashboardItems';
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
4
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import { c as _c } from "react-compiler-runtime"; // Copyright 2022 The Parca Authors
12
+ // Licensed under the Apache License, Version 2.0 (the "License");
13
+ // you may not use this file except in compliance with the License.
14
+ // You may obtain a copy of the License at
15
+ //
16
+ // http://www.apache.org/licenses/LICENSE-2.0
17
+ //
18
+ // Unless required by applicable law or agreed to in writing, software
19
+ // distributed under the License is distributed on an "AS IS" BASIS,
20
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ // See the License for the specific language governing permissions and
22
+ // limitations under the License.
23
+ import { useParcaContext, useURLState, useURLStateBatch } from '@parca/components';
6
24
  import Dropdown from './Dropdown';
7
- const ViewSelector = ({ profileSource }) => {
8
- const { dashboardItems, setDashboardItems } = useDashboardItems();
9
- const [, setSandwichFunctionName] = useQueryState('sandwich_function_name', stringParam);
10
- const { enableSourcesView, enableSandwichView } = useParcaContext();
11
- const allItems = [
12
- {
13
- key: 'flamegraph',
14
- label: 'Flame Graph',
15
- canBeSelected: !dashboardItems.includes('flamegraph'),
16
- },
17
- { key: 'table', label: 'Table', canBeSelected: !dashboardItems.includes('table') },
18
- {
19
- key: 'flamechart',
20
- label: (_jsxs("span", { className: "relative", children: ["Flame Chart", _jsx("span", { className: "absolute top-[-2px] text-xs lowercase text-red-500", children: "\u00A0alpha" })] })),
21
- canBeSelected: !dashboardItems.includes('flamechart') && profileSource?.ProfileType().delta === true,
22
- disabledText: !dashboardItems.includes('flamechart') && profileSource?.ProfileType().delta !== true
23
- ? 'Flamechart is not available for non-delta profiles'
24
- : undefined,
25
- },
26
- ];
25
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
26
+ var ViewSelector = function ViewSelector(t0) {
27
+ var $ = _c(21);
28
+ var profileSource = t0.profileSource;
29
+ var t1;
30
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
31
+ t1 = {
32
+ alwaysReturnArray: true
33
+ };
34
+ $[0] = t1;
35
+ } else {
36
+ t1 = $[0];
37
+ }
38
+ var _useURLState = useURLState("dashboard_items", t1),
39
+ _useURLState2 = _slicedToArray(_useURLState, 2),
40
+ t2 = _useURLState2[0],
41
+ setDashboardItems = _useURLState2[1];
42
+ var t3;
43
+ if ($[1] !== t2) {
44
+ t3 = t2 === undefined ? ["flamegraph"] : t2;
45
+ $[1] = t2;
46
+ $[2] = t3;
47
+ } else {
48
+ t3 = $[2];
49
+ }
50
+ var dashboardItems = t3;
51
+ var _useURLState3 = useURLState("sandwich_function_name"),
52
+ _useURLState4 = _slicedToArray(_useURLState3, 2),
53
+ setSandwichFunctionName = _useURLState4[1];
54
+ var _useParcaContext = useParcaContext(),
55
+ enableSourcesView = _useParcaContext.enableSourcesView,
56
+ enableSandwichView = _useParcaContext.enableSandwichView;
57
+ var batchUpdates = useURLStateBatch();
58
+ var t4;
59
+ if ($[3] !== dashboardItems) {
60
+ t4 = dashboardItems.includes("flamegraph");
61
+ $[3] = dashboardItems;
62
+ $[4] = t4;
63
+ } else {
64
+ t4 = $[4];
65
+ }
66
+ var t5 = !t4;
67
+ var t6;
68
+ if ($[5] !== batchUpdates || $[6] !== dashboardItems || $[7] !== enableSandwichView || $[8] !== enableSourcesView || $[9] !== profileSource || $[10] !== setDashboardItems || $[11] !== setSandwichFunctionName || $[12] !== t5) {
69
+ var allItems = [{
70
+ key: "flamegraph",
71
+ label: "Flame Graph",
72
+ canBeSelected: t5
73
+ }, {
74
+ key: "table",
75
+ label: "Table",
76
+ canBeSelected: !dashboardItems.includes("table")
77
+ }, {
78
+ key: "flamechart",
79
+ label: /*#__PURE__*/_jsxs("span", {
80
+ className: "relative",
81
+ children: ["Flame Chart", /*#__PURE__*/_jsx("span", {
82
+ className: "absolute top-[-2px] text-xs lowercase text-red-500",
83
+ children: "\xA0alpha"
84
+ })]
85
+ }),
86
+ canBeSelected: !dashboardItems.includes("flamechart") && (profileSource === null || profileSource === void 0 ? void 0 : profileSource.ProfileType().delta) === true,
87
+ disabledText: !dashboardItems.includes("flamechart") && (profileSource === null || profileSource === void 0 ? void 0 : profileSource.ProfileType().delta) !== true ? "Flamechart is not available for non-delta profiles" : undefined
88
+ }];
27
89
  if (enableSandwichView === true) {
28
- allItems.push({
29
- key: 'sandwich',
30
- label: (_jsxs("span", { className: "relative", children: ["Sandwich", _jsx("span", { className: "absolute top-[-2px] text-xs lowercase text-red-500", children: "\u00A0alpha" })] })),
31
- canBeSelected: !dashboardItems.includes('sandwich'),
32
- });
90
+ allItems.push({
91
+ key: "sandwich",
92
+ label: /*#__PURE__*/_jsxs("span", {
93
+ className: "relative",
94
+ children: ["Sandwich", /*#__PURE__*/_jsx("span", {
95
+ className: "absolute top-[-2px] text-xs lowercase text-red-500",
96
+ children: "\xA0alpha"
97
+ })]
98
+ }),
99
+ canBeSelected: !dashboardItems.includes("sandwich")
100
+ });
33
101
  }
34
102
  if (enableSourcesView === true) {
35
- allItems.push({ key: 'source', label: 'Source', canBeSelected: false });
103
+ allItems.push({
104
+ key: "source",
105
+ label: "Source",
106
+ canBeSelected: false
107
+ });
36
108
  }
37
- const getOption = ({ label, supportingText, }) => {
38
- const title = (_jsx("span", { className: "capitalize whitespace-nowrap", children: typeof label === 'string' ? label.replaceAll('-', ' ') : label }));
39
- return {
40
- active: title,
41
- expanded: (_jsxs(_Fragment, { children: [title, supportingText !== null && _jsx("span", { className: "text-xs", children: supportingText })] })),
42
- };
43
- };
44
- const getInnerActionForItem = (item) => {
45
- if (dashboardItems.length === 1 && item.key === dashboardItems[0])
46
- return undefined;
47
- // If we already have 2 panels and this item isn't selected, don't show any action
48
- if (dashboardItems.length >= 2 && !dashboardItems.includes(item.key))
49
- return undefined;
50
- return {
51
- text: !item.canBeSelected && item.key === 'source'
52
- ? 'Add Panel'
53
- : item.canBeSelected
54
- ? 'Add Panel'
55
- : dashboardItems.includes(item.key)
56
- ? 'Close Panel'
57
- : 'Add Panel',
58
- onClick: () => {
59
- if (item.canBeSelected) {
60
- setDashboardItems([...dashboardItems, item.key]);
61
- }
62
- else {
63
- const newDashboardItems = dashboardItems.filter(v => v !== item.key);
64
- setDashboardItems(newDashboardItems);
65
- if (item.key === 'sandwich') {
66
- void setSandwichFunctionName(null);
67
- }
68
- }
69
- },
70
- isDisabled: dashboardItems.length === 1 && dashboardItems.includes('sandwich'),
71
- };
109
+ var getOption = _temp;
110
+ var getInnerActionForItem = function getInnerActionForItem(item) {
111
+ if (dashboardItems.length === 1 && item.key === dashboardItems[0]) {
112
+ return;
113
+ }
114
+ if (dashboardItems.length >= 2 && !dashboardItems.includes(item.key)) {
115
+ return;
116
+ }
117
+ return {
118
+ text: !item.canBeSelected && item.key === "source" ? "Add Panel" : item.canBeSelected ? "Add Panel" : dashboardItems.includes(item.key) ? "Close Panel" : "Add Panel",
119
+ onClick: function onClick() {
120
+ if (item.canBeSelected) {
121
+ setDashboardItems([].concat(_toConsumableArray(dashboardItems), [item.key]));
122
+ } else {
123
+ var newDashboardItems = dashboardItems.filter(function (v) {
124
+ return v !== item.key;
125
+ });
126
+ if (item.key === "sandwich") {
127
+ batchUpdates(function () {
128
+ setDashboardItems(newDashboardItems);
129
+ setSandwichFunctionName(undefined);
130
+ });
131
+ } else {
132
+ setDashboardItems(newDashboardItems);
133
+ }
134
+ }
135
+ },
136
+ isDisabled: dashboardItems.length === 1 && dashboardItems.includes("sandwich")
137
+ };
72
138
  };
73
- const items = allItems.map(item => ({
74
- key: item.key,
75
- disabled: !item.canBeSelected,
76
- disabledText: item.disabledText,
77
- element: getOption(item),
78
- innerAction: getInnerActionForItem(item),
79
- }));
80
- const onSelection = (value) => {
81
- const isOnlyChart = dashboardItems.length === 1;
82
- if (isOnlyChart && value === 'sandwich') {
83
- setDashboardItems([...dashboardItems, value]);
84
- return;
85
- }
86
- if (isOnlyChart) {
87
- setDashboardItems([value]);
88
- return;
89
- }
90
- const newDashboardItems = [dashboardItems[0], value];
91
- setDashboardItems(newDashboardItems);
139
+ t6 = allItems.map(function (item_0) {
140
+ return {
141
+ key: item_0.key,
142
+ disabled: !item_0.canBeSelected,
143
+ disabledText: item_0.disabledText,
144
+ element: getOption(item_0),
145
+ innerAction: getInnerActionForItem(item_0)
146
+ };
147
+ });
148
+ $[5] = batchUpdates;
149
+ $[6] = dashboardItems;
150
+ $[7] = enableSandwichView;
151
+ $[8] = enableSourcesView;
152
+ $[9] = profileSource;
153
+ $[10] = setDashboardItems;
154
+ $[11] = setSandwichFunctionName;
155
+ $[12] = t5;
156
+ $[13] = t6;
157
+ } else {
158
+ t6 = $[13];
159
+ }
160
+ var items = t6;
161
+ var t7;
162
+ if ($[14] !== dashboardItems || $[15] !== setDashboardItems) {
163
+ t7 = function t7(value) {
164
+ var isOnlyChart = dashboardItems.length === 1;
165
+ if (isOnlyChart && value === "sandwich") {
166
+ setDashboardItems([].concat(_toConsumableArray(dashboardItems), [value]));
167
+ return;
168
+ }
169
+ if (isOnlyChart) {
170
+ setDashboardItems([value]);
171
+ return;
172
+ }
173
+ var newDashboardItems_0 = [dashboardItems[0], value];
174
+ setDashboardItems(newDashboardItems_0);
92
175
  };
93
- return (_jsx(Dropdown, { className: "h-view-selector", items: items, selectedKey: dashboardItems.length >= 2 ? 'Multiple' : dashboardItems[0], onSelection: onSelection, placeholder: 'Select view type...', id: "h-view-selector", optionsClassName: "min-w-[260px]" }));
176
+ $[14] = dashboardItems;
177
+ $[15] = setDashboardItems;
178
+ $[16] = t7;
179
+ } else {
180
+ t7 = $[16];
181
+ }
182
+ var onSelection = t7;
183
+ var t8 = dashboardItems.length >= 2 ? "Multiple" : dashboardItems[0];
184
+ var t9;
185
+ if ($[17] !== items || $[18] !== onSelection || $[19] !== t8) {
186
+ t9 = /*#__PURE__*/_jsx(Dropdown, {
187
+ className: "h-view-selector",
188
+ items: items,
189
+ selectedKey: t8,
190
+ onSelection: onSelection,
191
+ placeholder: "Select view type...",
192
+ id: "h-view-selector",
193
+ optionsClassName: "min-w-[260px]"
194
+ });
195
+ $[17] = items;
196
+ $[18] = onSelection;
197
+ $[19] = t8;
198
+ $[20] = t9;
199
+ } else {
200
+ t9 = $[20];
201
+ }
202
+ return t9;
94
203
  };
95
204
  export default ViewSelector;
205
+ function _temp(t0) {
206
+ var label = t0.label,
207
+ supportingText = t0.supportingText;
208
+ var title = /*#__PURE__*/_jsx("span", {
209
+ className: "capitalize whitespace-nowrap",
210
+ children: typeof label === "string" ? label.replaceAll("-", " ") : label
211
+ });
212
+ return {
213
+ active: title,
214
+ expanded: /*#__PURE__*/_jsxs(_Fragment, {
215
+ children: [title, supportingText !== null && /*#__PURE__*/_jsx("span", {
216
+ className: "text-xs",
217
+ children: supportingText
218
+ })]
219
+ })
220
+ };
221
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/VisualizationContainer/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAGzB,OAAO,KAAK,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAGnF,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAG5D,UAAU,2BAA2B;IACnC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,aAAa,EAAE,iBAAiB,CAAC;IACjC,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAC,IAAI,EAAE,iBAAiB,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAC,KAAK,GAAG,CAAC,OAAO,CAAC;IACjG,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE;QACb,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAsClE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/VisualizationContainer/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAGzB,OAAO,KAAK,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAGnF,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAG5D,UAAU,2BAA2B;IACnC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,aAAa,EAAE,iBAAiB,CAAC;IACjC,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAC,IAAI,EAAE,iBAAiB,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAC,KAAK,GAAG,CAAC,OAAO,CAAC;IACjG,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE;QACb,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAuClE,CAAC"}