@parca/profile 0.19.139 → 0.19.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +103 -73
  9. package/dist/MatchersInput/SuggestionItem.js +91 -12
  10. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  11. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  12. package/dist/MatchersInput/SuggestionsList.js +371 -157
  13. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  15. package/dist/MatchersInput/index.js +308 -115
  16. package/dist/MetricsCircle/index.js +39 -3
  17. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  18. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  19. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  20. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  21. package/dist/MetricsGraph/index.js +552 -203
  22. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  23. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  24. package/dist/MetricsSeries/index.js +70 -7
  25. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  26. package/dist/PreSelectedMatchers/index.js +249 -102
  27. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -49
  28. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  29. package/dist/ProfileExplorer/index.js +183 -32
  30. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  32. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  33. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  34. package/dist/ProfileFlameChart/index.js +266 -134
  35. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +287 -88
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  55. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  56. package/dist/ProfileFlameGraph/index.js +324 -148
  57. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  58. package/dist/ProfileMetricsGraph/index.js +518 -259
  59. package/dist/ProfileSelector/CompareButton.js +132 -12
  60. package/dist/ProfileSelector/MetricsGraphSection.js +234 -67
  61. package/dist/ProfileSelector/index.d.ts.map +1 -1
  62. package/dist/ProfileSelector/index.js +730 -142
  63. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  64. package/dist/ProfileSource.js +230 -163
  65. package/dist/ProfileTypeSelector/index.js +214 -125
  66. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  67. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +139 -33
  68. package/dist/ProfileView/components/ColorStackLegend.js +184 -55
  69. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  70. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  71. package/dist/ProfileView/components/DiffLegend.js +172 -29
  72. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  73. package/dist/ProfileView/components/InvertCallStack/index.js +99 -10
  74. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  75. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  76. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  77. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -120
  78. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  79. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  80. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  81. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  82. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +675 -195
  83. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  84. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +198 -157
  85. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  86. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  87. package/dist/ProfileView/components/ViewSelector/index.js +211 -91
  88. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  89. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  90. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  91. package/dist/ProfileView/context/DashboardContext.js +84 -28
  92. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  93. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  94. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  95. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  96. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +72 -29
  97. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +39 -13
  98. package/dist/ProfileView/hooks/useVisualizationState.js +262 -87
  99. package/dist/ProfileView/index.js +383 -45
  100. package/dist/ProfileView/types/visualization.js +1 -13
  101. package/dist/ProfileView/utils/colorUtils.js +8 -7
  102. package/dist/ProfileViewWithData.js +332 -237
  103. package/dist/QueryControls/index.js +418 -47
  104. package/dist/Sandwich/components/CalleesSection.js +54 -4
  105. package/dist/Sandwich/components/CallersSection.js +97 -27
  106. package/dist/Sandwich/components/TableSection.js +77 -4
  107. package/dist/Sandwich/index.js +125 -12
  108. package/dist/Sandwich/utils/processRowData.js +48 -39
  109. package/dist/SelectWithRefresh/index.js +102 -28
  110. package/dist/SimpleMatchers/Select.js +520 -187
  111. package/dist/SimpleMatchers/index.js +590 -288
  112. package/dist/SourceView/Highlighter.js +230 -70
  113. package/dist/SourceView/LineNo.js +72 -17
  114. package/dist/SourceView/index.js +177 -101
  115. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  116. package/dist/SourceView/lang-detector/index.js +28 -14
  117. package/dist/SourceView/useSelectedLineRange.js +97 -16
  118. package/dist/Table/ColorCell.js +42 -1
  119. package/dist/Table/ColumnsVisibility.js +114 -6
  120. package/dist/Table/MoreDropdown.js +121 -27
  121. package/dist/Table/TableContextMenu.js +150 -139
  122. package/dist/Table/TableContextMenuWrapper.js +59 -14
  123. package/dist/Table/hooks/useColorManagement.js +58 -16
  124. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  125. package/dist/Table/hooks/useTableConfiguration.js +331 -168
  126. package/dist/Table/index.js +222 -126
  127. package/dist/Table/utils/functions.js +169 -144
  128. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  129. package/dist/TimelineGuide/index.js +209 -16
  130. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  131. package/dist/TopTable/index.js +340 -122
  132. package/dist/contexts/LabelsQueryProvider.js +94 -32
  133. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  134. package/dist/contexts/utils.js +37 -15
  135. package/dist/hooks/useCompareModeMeta.js +157 -94
  136. package/dist/hooks/useLabels.js +295 -52
  137. package/dist/hooks/useQueryState.js +371 -330
  138. package/dist/index.js +21 -16
  139. package/dist/testdata/fg-diff.json +3750 -0
  140. package/dist/testdata/fg-simple.json +1879 -0
  141. package/dist/testdata/link_data.json +56 -0
  142. package/dist/testdata/tabular.json +30 -0
  143. package/dist/testdata/test_flamegraph.json +26846 -0
  144. package/dist/testdata/test_graph.json +53 -0
  145. package/dist/useDelayedLoader.js +32 -18
  146. package/dist/useGrpcQuery/index.js +71 -11
  147. package/dist/useHasProfileData.js +90 -12
  148. package/dist/useQuery.js +205 -64
  149. package/dist/useSumBy.d.ts.map +1 -1
  150. package/dist/useSumBy.js +294 -138
  151. package/dist/utils.js +62 -30
  152. package/package.json +9 -9
  153. package/src/GraphTooltipArrow/index.tsx +3 -0
  154. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  155. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  156. package/src/MatchersInput/index.tsx +1 -1
  157. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  158. package/src/PreSelectedMatchers/index.tsx +3 -0
  159. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  160. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  161. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  162. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  163. package/src/ProfileSelector/index.tsx +30 -7
  164. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  165. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  166. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  167. package/src/useDelayedLoader.ts +10 -10
  168. package/src/useSumBy.ts +12 -18
  169. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -541
  170. package/dist/hooks/useQueryState.test.js +0 -984
@@ -1,3 +1,6 @@
1
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
2
+ 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; } }
3
+ 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; }
1
4
  // Copyright 2022 The Parca Authors
2
5
  // Licensed under the Apache License, Version 2.0 (the "License");
3
6
  // you may not use this file except in compliance with the License.
@@ -10,20 +13,31 @@
10
13
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
14
  // See the License for the specific language governing permissions and
12
15
  // limitations under the License.
16
+
13
17
  import * as hljsLangs from 'react-syntax-highlighter/dist/cjs/languages/hljs';
14
18
  import _extLangMap from './ext-to-lang.json';
15
- const extLangMap = _extLangMap;
16
- export const langaugeFromFile = (file) => {
17
- const extension = file.split('.').pop() ?? '';
18
- if (extLangMap[extension] == null) {
19
- return 'text';
20
- }
21
- const langs = extLangMap[extension];
22
- for (const lang of langs) {
23
- // eslint-disable-next-line import/namespace
24
- if (hljsLangs[lang] != null) {
25
- return lang;
26
- }
27
- }
19
+ var extLangMap = _extLangMap;
20
+ export var langaugeFromFile = function langaugeFromFile(file) {
21
+ var _file$split$pop;
22
+ var extension = (_file$split$pop = file.split('.').pop()) !== null && _file$split$pop !== void 0 ? _file$split$pop : '';
23
+ if (extLangMap[extension] == null) {
28
24
  return 'text';
29
- };
25
+ }
26
+ var langs = extLangMap[extension];
27
+ var _iterator = _createForOfIteratorHelper(langs),
28
+ _step;
29
+ try {
30
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
31
+ var lang = _step.value;
32
+ // eslint-disable-next-line import/namespace
33
+ if (hljsLangs[lang] != null) {
34
+ return lang;
35
+ }
36
+ }
37
+ } catch (err) {
38
+ _iterator.e(err);
39
+ } finally {
40
+ _iterator.f();
41
+ }
42
+ return 'text';
43
+ };
@@ -1,3 +1,10 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { c as _c } from "react-compiler-runtime";
1
8
  // Copyright 2022 The Parca Authors
2
9
  // Licensed under the Apache License, Version 2.0 (the "License");
3
10
  // you may not use this file except in compliance with the License.
@@ -10,23 +17,97 @@
10
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
18
  // See the License for the specific language governing permissions and
12
19
  // limitations under the License.
20
+
13
21
  import { useMemo } from 'react';
14
22
  import { useURLState } from '@parca/components';
15
- const useLineRange = () => {
16
- const [sourceLine, setSourceLine] = useURLState('source_line');
17
- const [startLine, endLine] = useMemo(() => {
18
- if (sourceLine == null) {
19
- return [-1, -1];
20
- }
21
- const [start, end] = sourceLine.split('-');
22
- if (end === undefined) {
23
- return [parseInt(start, 10), parseInt(start, 10)];
24
- }
25
- return [parseInt(start, 10), parseInt(end, 10)];
26
- }, [sourceLine]);
27
- const setLineRange = (start, end) => {
28
- setSourceLine(`${start}-${end}`);
23
+ var useLineRange = function useLineRange() {
24
+ var $ = _c(15);
25
+ var _useURLState = useURLState("source_line"),
26
+ _useURLState2 = _slicedToArray(_useURLState, 2),
27
+ sourceLine = _useURLState2[0],
28
+ setSourceLine = _useURLState2[1];
29
+ var t0;
30
+ bb0: {
31
+ if (sourceLine == null) {
32
+ var _t;
33
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
34
+ _t = [-1, -1];
35
+ $[0] = _t;
36
+ } else {
37
+ _t = $[0];
38
+ }
39
+ t0 = _t;
40
+ break bb0;
41
+ }
42
+ var _t2;
43
+ if ($[1] !== sourceLine) {
44
+ _t2 = sourceLine.split("-");
45
+ $[1] = sourceLine;
46
+ $[2] = _t2;
47
+ } else {
48
+ _t2 = $[2];
49
+ }
50
+ var _t3 = _t2,
51
+ _t4 = _slicedToArray(_t3, 2),
52
+ start = _t4[0],
53
+ end = _t4[1];
54
+ if (end === undefined) {
55
+ var _t5 = parseInt(start, 10);
56
+ var _t6 = parseInt(start, 10);
57
+ var _t7;
58
+ if ($[3] !== _t5 || $[4] !== _t6) {
59
+ _t7 = [_t5, _t6];
60
+ $[3] = _t5;
61
+ $[4] = _t6;
62
+ $[5] = _t7;
63
+ } else {
64
+ _t7 = $[5];
65
+ }
66
+ t0 = _t7;
67
+ break bb0;
68
+ }
69
+ var _t8 = parseInt(start, 10);
70
+ var t3 = parseInt(end, 10);
71
+ var t4;
72
+ if ($[6] !== _t8 || $[7] !== t3) {
73
+ t4 = [_t8, t3];
74
+ $[6] = _t8;
75
+ $[7] = t3;
76
+ $[8] = t4;
77
+ } else {
78
+ t4 = $[8];
79
+ }
80
+ t0 = t4;
81
+ }
82
+ var _t9 = t0,
83
+ _t0 = _slicedToArray(_t9, 2),
84
+ startLine = _t0[0],
85
+ endLine = _t0[1];
86
+ var t1;
87
+ if ($[9] !== setSourceLine) {
88
+ t1 = function t1(start_0, end_0) {
89
+ setSourceLine("".concat(start_0, "-").concat(end_0));
29
90
  };
30
- return { startLine, endLine, setLineRange };
91
+ $[9] = setSourceLine;
92
+ $[10] = t1;
93
+ } else {
94
+ t1 = $[10];
95
+ }
96
+ var setLineRange = t1;
97
+ var t2;
98
+ if ($[11] !== endLine || $[12] !== setLineRange || $[13] !== startLine) {
99
+ t2 = {
100
+ startLine: startLine,
101
+ endLine: endLine,
102
+ setLineRange: setLineRange
103
+ };
104
+ $[11] = endLine;
105
+ $[12] = setLineRange;
106
+ $[13] = startLine;
107
+ $[14] = t2;
108
+ } else {
109
+ t2 = $[14];
110
+ }
111
+ return t2;
31
112
  };
32
- export default useLineRange;
113
+ export default useLineRange;
@@ -1,2 +1,43 @@
1
+ import { c as _c } from "react-compiler-runtime"; // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export const ColorCell = ({ color, mappingFile }) => (_jsx("div", { className: "w-4 h-4 rounded-[4px]", style: { backgroundColor: color }, "data-tooltip-id": "table-color-tooltip", "data-tooltip-content": mappingFile }));
14
+ export var ColorCell = function ColorCell(t0) {
15
+ var $ = _c(5);
16
+ var color = t0.color,
17
+ mappingFile = t0.mappingFile;
18
+ var t1;
19
+ if ($[0] !== color) {
20
+ t1 = {
21
+ backgroundColor: color
22
+ };
23
+ $[0] = color;
24
+ $[1] = t1;
25
+ } else {
26
+ t1 = $[1];
27
+ }
28
+ var t2;
29
+ if ($[2] !== mappingFile || $[3] !== t1) {
30
+ t2 = /*#__PURE__*/_jsx("div", {
31
+ className: "w-4 h-4 rounded-[4px]",
32
+ style: t1,
33
+ "data-tooltip-id": "table-color-tooltip",
34
+ "data-tooltip-content": mappingFile
35
+ });
36
+ $[2] = mappingFile;
37
+ $[3] = t1;
38
+ $[4] = t2;
39
+ } else {
40
+ t2 = $[4];
41
+ }
42
+ return t2;
43
+ };
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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,12 +11,120 @@ import { jsx as _jsx, jsxs as _jsxs } 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 { Fragment } from 'react';
15
16
  import { Menu, Transition } from '@headlessui/react';
16
17
  import { Icon } from '@iconify/react';
17
- const ColumnsVisibility = ({ columns, visibility, setVisibility, }) => {
18
- return (_jsx("div", { children: _jsxs(Menu, { as: "div", className: "relative text-left", children: [_jsx("div", { children: _jsxs(Menu.Button, { className: "relative w-full cursor-default rounded-md border bg-white py-2 pl-3 pr-10 text-left text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900 sm:text-sm", children: [_jsx("span", { className: "block overflow-x-hidden text-ellipsis", children: "Multiple" }), _jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 ml-3 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }) }), _jsx(Transition, { as: Fragment, leave: "transition ease-in duration-100", leaveFrom: "opacity-100", leaveTo: "opacity-0", children: _jsx(Menu.Items, { className: "absolute left-0 z-10 mt-1 min-w-[400px] 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: _jsx("div", { className: "p-4", children: _jsx("fieldset", { children: _jsx("div", { className: "space-y-5", children: columns.map(col => (_jsxs("div", { className: "relative flex items-start", children: [_jsx("div", { className: "flex h-6 items-center", children: _jsx("input", { id: col.id, name: col.id, type: "checkbox", className: "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600", checked: visibility[col.id ?? ''] ?? false, onChange: () => {
19
- setVisibility(col.id ?? '', !visibility[col.id ?? '']);
20
- } }) }), _jsx("div", { className: "ml-3 text-sm leading-6", children: _jsx("label", { htmlFor: col.id, className: "font-medium text-gray-900 dark:text-gray-200", children: col.header }) })] }, col.id))) }) }) }) }) })] }) }));
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ var ColumnsVisibility = function ColumnsVisibility(t0) {
20
+ var $ = _c(11);
21
+ var columns = t0.columns,
22
+ visibility = t0.visibility,
23
+ setVisibility = t0.setVisibility;
24
+ var t1;
25
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
26
+ t1 = /*#__PURE__*/_jsx("span", {
27
+ className: "block overflow-x-hidden text-ellipsis",
28
+ children: "Multiple"
29
+ });
30
+ $[0] = t1;
31
+ } else {
32
+ t1 = $[0];
33
+ }
34
+ var t2;
35
+ if ($[1] === Symbol["for"]("react.memo_cache_sentinel")) {
36
+ t2 = /*#__PURE__*/_jsx("div", {
37
+ children: /*#__PURE__*/_jsxs(Menu.Button, {
38
+ className: "relative w-full cursor-default rounded-md border bg-white py-2 pl-3 pr-10 text-left text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900 sm:text-sm",
39
+ children: [t1, /*#__PURE__*/_jsx("span", {
40
+ className: "pointer-events-none absolute inset-y-0 right-0 ml-3 flex items-center pr-2 text-gray-400",
41
+ children: /*#__PURE__*/_jsx(Icon, {
42
+ icon: "heroicons:chevron-down-20-solid",
43
+ "aria-hidden": "true"
44
+ })
45
+ })]
46
+ })
47
+ });
48
+ $[1] = t2;
49
+ } else {
50
+ t2 = $[1];
51
+ }
52
+ var t3;
53
+ if ($[2] !== columns || $[3] !== setVisibility || $[4] !== visibility) {
54
+ var _t;
55
+ if ($[6] !== setVisibility || $[7] !== visibility) {
56
+ _t = function _t(col) {
57
+ var _visibility, _col$id;
58
+ return /*#__PURE__*/_jsxs("div", {
59
+ className: "relative flex items-start",
60
+ children: [/*#__PURE__*/_jsx("div", {
61
+ className: "flex h-6 items-center",
62
+ children: /*#__PURE__*/_jsx("input", {
63
+ id: col.id,
64
+ name: col.id,
65
+ type: "checkbox",
66
+ className: "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600",
67
+ checked: (_visibility = visibility[(_col$id = col.id) !== null && _col$id !== void 0 ? _col$id : ""]) !== null && _visibility !== void 0 ? _visibility : false,
68
+ onChange: function onChange() {
69
+ var _col$id2, _col$id3;
70
+ setVisibility((_col$id2 = col.id) !== null && _col$id2 !== void 0 ? _col$id2 : "", !visibility[(_col$id3 = col.id) !== null && _col$id3 !== void 0 ? _col$id3 : ""]);
71
+ }
72
+ })
73
+ }), /*#__PURE__*/_jsx("div", {
74
+ className: "ml-3 text-sm leading-6",
75
+ children: /*#__PURE__*/_jsx("label", {
76
+ htmlFor: col.id,
77
+ className: "font-medium text-gray-900 dark:text-gray-200",
78
+ children: col.header
79
+ })
80
+ })]
81
+ }, col.id);
82
+ };
83
+ $[6] = setVisibility;
84
+ $[7] = visibility;
85
+ $[8] = _t;
86
+ } else {
87
+ _t = $[8];
88
+ }
89
+ t3 = columns.map(_t);
90
+ $[2] = columns;
91
+ $[3] = setVisibility;
92
+ $[4] = visibility;
93
+ $[5] = t3;
94
+ } else {
95
+ t3 = $[5];
96
+ }
97
+ var t4;
98
+ if ($[9] !== t3) {
99
+ t4 = /*#__PURE__*/_jsx("div", {
100
+ children: /*#__PURE__*/_jsxs(Menu, {
101
+ as: "div",
102
+ className: "relative text-left",
103
+ children: [t2, /*#__PURE__*/_jsx(Transition, {
104
+ as: Fragment,
105
+ leave: "transition ease-in duration-100",
106
+ leaveFrom: "opacity-100",
107
+ leaveTo: "opacity-0",
108
+ children: /*#__PURE__*/_jsx(Menu.Items, {
109
+ className: "absolute left-0 z-10 mt-1 min-w-[400px] 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",
110
+ children: /*#__PURE__*/_jsx("div", {
111
+ className: "p-4",
112
+ children: /*#__PURE__*/_jsx("fieldset", {
113
+ children: /*#__PURE__*/_jsx("div", {
114
+ className: "space-y-5",
115
+ children: t3
116
+ })
117
+ })
118
+ })
119
+ })
120
+ })]
121
+ })
122
+ });
123
+ $[9] = t3;
124
+ $[10] = t4;
125
+ } else {
126
+ t4 = $[10];
127
+ }
128
+ return t4;
21
129
  };
22
- export default ColumnsVisibility;
130
+ export default ColumnsVisibility;
@@ -1,4 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
4
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
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,37 +21,121 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { Menu } from '@headlessui/react';
15
26
  import { Icon } from '@iconify/react';
16
27
  import { useParcaContext, useURLState, useURLStateBatch } from '@parca/components';
17
- const MoreDropdown = ({ functionName }) => {
18
- const [_, setSandwichFunctionName] = useURLState('sandwich_function_name');
19
- const [dashboardItems, setDashboardItems] = useURLState('dashboard_items', {
20
- alwaysReturnArray: true,
21
- });
22
- const { enableSandwichView } = useParcaContext();
23
- const batchUpdates = useURLStateBatch();
24
- const onSandwichViewSelect = () => {
25
- // Batch updates to combine setSandwichFunctionName + setDashboardItems into single URL navigation
26
- batchUpdates(() => {
27
- setSandwichFunctionName(functionName.trim());
28
- setDashboardItems([...dashboardItems, 'sandwich']);
29
- });
28
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
29
+ var MoreDropdown = function MoreDropdown(t0) {
30
+ var $ = _c(14);
31
+ var functionName = t0.functionName;
32
+ var _useURLState = useURLState("sandwich_function_name"),
33
+ _useURLState2 = _slicedToArray(_useURLState, 2),
34
+ setSandwichFunctionName = _useURLState2[1];
35
+ var t1;
36
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
37
+ t1 = {
38
+ alwaysReturnArray: true
30
39
  };
31
- const menuItems = [];
40
+ $[0] = t1;
41
+ } else {
42
+ t1 = $[0];
43
+ }
44
+ var _useURLState3 = useURLState("dashboard_items", t1),
45
+ _useURLState4 = _slicedToArray(_useURLState3, 2),
46
+ dashboardItems = _useURLState4[0],
47
+ setDashboardItems = _useURLState4[1];
48
+ var _useParcaContext = useParcaContext(),
49
+ enableSandwichView = _useParcaContext.enableSandwichView;
50
+ var batchUpdates = useURLStateBatch();
51
+ var t2;
52
+ if ($[1] !== batchUpdates || $[2] !== dashboardItems || $[3] !== functionName || $[4] !== setDashboardItems || $[5] !== setSandwichFunctionName) {
53
+ t2 = function t2() {
54
+ batchUpdates(function () {
55
+ setSandwichFunctionName(functionName.trim());
56
+ setDashboardItems([].concat(_toConsumableArray(dashboardItems), ["sandwich"]));
57
+ });
58
+ };
59
+ $[1] = batchUpdates;
60
+ $[2] = dashboardItems;
61
+ $[3] = functionName;
62
+ $[4] = setDashboardItems;
63
+ $[5] = setSandwichFunctionName;
64
+ $[6] = t2;
65
+ } else {
66
+ t2 = $[6];
67
+ }
68
+ var onSandwichViewSelect = t2;
69
+ var menuItems;
70
+ if ($[7] !== enableSandwichView || $[8] !== onSandwichViewSelect) {
71
+ menuItems = [];
32
72
  if (enableSandwichView === true) {
33
- menuItems.push({
34
- label: 'Show in Sandwich view',
35
- action: () => onSandwichViewSelect(),
36
- });
37
- }
38
- if (menuItems.length === 0) {
39
- return null;
73
+ var _t;
74
+ if ($[10] !== onSandwichViewSelect) {
75
+ _t = {
76
+ label: "Show in Sandwich view",
77
+ action: function action() {
78
+ return onSandwichViewSelect();
79
+ }
80
+ };
81
+ $[10] = onSandwichViewSelect;
82
+ $[11] = _t;
83
+ } else {
84
+ _t = $[11];
85
+ }
86
+ menuItems.push(_t);
40
87
  }
41
- return (_jsx("div", { className: "relative", children: _jsx(Menu, { children: ({ open, close }) => (_jsxs(_Fragment, { children: [_jsx(Menu.Button, { onClick: () => {
42
- if (open) {
43
- close();
44
- }
45
- }, className: "inline-flex font-sans dark:bg-gray-900 dark:border-gray-600 justify-center w-full text-sm font-normal text-gray-600 dark:text-gray-200 bg-white rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75", children: _jsx(Icon, { icon: "mdi:dots-horizontal" }) }), open && (_jsxs(Menu.Items, { className: "font-sans absolute z-30 left-0 w-56 mt-2 py-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600", children: [_jsx("span", { className: "text-xs text-gray-400 capitalize px-4 py-3", children: "actions" }), menuItems.map(item => (_jsx(Menu.Button, { className: "group mb-px flex w-full items-center rounded-md px-4 py-2 text-sm text-gray-900 dark:text-white hover:bg-indigo-500 hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500", onClick: item.action, children: item.label }, item.label)))] }))] })) }) }));
88
+ $[7] = enableSandwichView;
89
+ $[8] = onSandwichViewSelect;
90
+ $[9] = menuItems;
91
+ } else {
92
+ menuItems = $[9];
93
+ }
94
+ if (menuItems.length === 0) {
95
+ return null;
96
+ }
97
+ var t3;
98
+ if ($[12] !== menuItems) {
99
+ t3 = /*#__PURE__*/_jsx("div", {
100
+ className: "relative",
101
+ children: /*#__PURE__*/_jsx(Menu, {
102
+ children: function children(t4) {
103
+ var open = t4.open,
104
+ close = t4.close;
105
+ return /*#__PURE__*/_jsxs(_Fragment, {
106
+ children: [/*#__PURE__*/_jsx(Menu.Button, {
107
+ onClick: function onClick() {
108
+ if (open) {
109
+ close();
110
+ }
111
+ },
112
+ className: "inline-flex font-sans dark:bg-gray-900 dark:border-gray-600 justify-center w-full text-sm font-normal text-gray-600 dark:text-gray-200 bg-white rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75",
113
+ children: /*#__PURE__*/_jsx(Icon, {
114
+ icon: "mdi:dots-horizontal"
115
+ })
116
+ }), open && /*#__PURE__*/_jsxs(Menu.Items, {
117
+ className: "font-sans absolute z-30 left-0 w-56 mt-2 py-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600",
118
+ children: [/*#__PURE__*/_jsx("span", {
119
+ className: "text-xs text-gray-400 capitalize px-4 py-3",
120
+ children: "actions"
121
+ }), menuItems.map(_temp)]
122
+ })]
123
+ });
124
+ }
125
+ })
126
+ });
127
+ $[12] = menuItems;
128
+ $[13] = t3;
129
+ } else {
130
+ t3 = $[13];
131
+ }
132
+ return t3;
46
133
  };
47
134
  export default MoreDropdown;
135
+ function _temp(item) {
136
+ return /*#__PURE__*/_jsx(Menu.Button, {
137
+ className: "group mb-px flex w-full items-center rounded-md px-4 py-2 text-sm text-gray-900 dark:text-white hover:bg-indigo-500 hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",
138
+ onClick: item.action,
139
+ children: item.label
140
+ }, item.label);
141
+ }