@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,4 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ import { c as _c } from "react-compiler-runtime";
2
6
  // Copyright 2022 The Parca Authors
3
7
  // Licensed under the Apache License, Version 2.0 (the "License");
4
8
  // you may not use this file except in compliance with the License.
@@ -11,6 +15,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
15
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
16
  // See the License for the specific language governing permissions and
13
17
  // limitations under the License.
18
+
14
19
  /**
15
20
  * UnifiedLabelsProvider - UI Presentation Layer
16
21
  *
@@ -31,58 +36,118 @@ import { jsx as _jsx } from "react/jsx-runtime";
31
36
  *
32
37
  * Consumer Hook: useUnifiedLabels()
33
38
  */
39
+
34
40
  import { createContext, useContext } from 'react';
35
41
  import { transformLabelsForSelect } from '../SimpleMatchers';
36
42
  import { useLabelNameMappings } from './utils';
37
- const UnifiedLabelsContext = createContext(null);
38
- export function UnifiedLabelsProvider({ children, labelNames, isLabelNamesLoading, isLabelValuesLoading, refetchLabelValues, refetchLabelNames, currentLabelName, setCurrentLabelName, labelValues, suffix, }) {
39
- const labelNameFromMatchers = [];
40
- const labelNamesFromAPI = labelNames;
41
- const labelNameMappingsForMatchersInput = useLabelNameMappings(labelNamesFromAPI);
42
- const allLabelNames = new Set(labelNamesFromAPI);
43
- const nonMatchingLabels = labelNameFromMatchers.filter(label => !allLabelNames.has(label));
44
- const labelNameMappingsForSimpleMatchers = [];
45
- const labels = {
46
- type: 'cpu',
47
- labelNames: labelNamesFromAPI,
48
- isLoading: isLabelNamesLoading,
49
- };
43
+ import { jsx as _jsx } from "react/jsx-runtime";
44
+ var UnifiedLabelsContext = /*#__PURE__*/createContext(null);
45
+ export function UnifiedLabelsProvider(t0) {
46
+ var $ = _c(4);
47
+ var children = t0.children,
48
+ labelNames = t0.labelNames,
49
+ isLabelNamesLoading = t0.isLabelNamesLoading,
50
+ isLabelValuesLoading = t0.isLabelValuesLoading,
51
+ refetchLabelValues = t0.refetchLabelValues,
52
+ refetchLabelNames = t0.refetchLabelNames,
53
+ currentLabelName = t0.currentLabelName,
54
+ setCurrentLabelName = t0.setCurrentLabelName,
55
+ labelValues = t0.labelValues,
56
+ suffix = t0.suffix;
57
+ var labelNameFromMatchers = [];
58
+ var labelNamesFromAPI = labelNames;
59
+ var labelNameMappingsForMatchersInput = useLabelNameMappings(labelNamesFromAPI);
60
+ var allLabelNames = new Set(labelNamesFromAPI);
61
+ var nonMatchingLabels = labelNameFromMatchers.filter(function (label) {
62
+ return !allLabelNames.has(label);
63
+ });
64
+ var labelNameMappingsForSimpleMatchers = [];
65
+ var labels = {
66
+ type: "cpu",
67
+ labelNames: labelNamesFromAPI,
68
+ isLoading: isLabelNamesLoading
69
+ };
70
+ labelNameMappingsForSimpleMatchers.push({
71
+ type: labels.type,
72
+ values: transformLabelsForSelect(labels.labelNames)
73
+ });
74
+ if (nonMatchingLabels.length > 0) {
75
+ var uniqueNonMatchingLabels = Array.from(new Set(nonMatchingLabels));
50
76
  labelNameMappingsForSimpleMatchers.push({
51
- type: labels.type,
52
- values: transformLabelsForSelect(labels.labelNames),
77
+ type: "",
78
+ values: transformLabelsForSelect(uniqueNonMatchingLabels)
53
79
  });
54
- if (nonMatchingLabels.length > 0) {
55
- const uniqueNonMatchingLabels = Array.from(new Set(nonMatchingLabels));
56
- labelNameMappingsForSimpleMatchers.push({
57
- type: '',
58
- values: transformLabelsForSelect(uniqueNonMatchingLabels),
59
- });
60
- }
61
- const value = {
62
- labelNames: labelNamesFromAPI,
63
- labelNameMappingsForMatchersInput,
64
- isLabelNamesLoading,
65
- isLabelValuesLoading,
66
- currentLabelName,
67
- labelValues,
68
- setCurrentLabelName,
69
- shouldHandlePrefixes: false,
70
- refetchLabelValues: async () => {
71
- await refetchLabelValues();
72
- },
73
- refetchLabelNames: async () => {
74
- await refetchLabelNames();
75
- },
76
- labelNameFromMatchers,
77
- labelNameMappingsForSimpleMatchers,
78
- suffix,
79
- };
80
- return _jsx(UnifiedLabelsContext.Provider, { value: value, children: children });
80
+ }
81
+ var t1;
82
+ if ($[0] !== refetchLabelValues) {
83
+ t1 = /*#__PURE__*/function () {
84
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
85
+ return _regenerator().w(function (_context) {
86
+ while (1) switch (_context.n) {
87
+ case 0:
88
+ _context.n = 1;
89
+ return refetchLabelValues();
90
+ case 1:
91
+ return _context.a(2);
92
+ }
93
+ }, _callee);
94
+ }));
95
+ return function t1() {
96
+ return _ref.apply(this, arguments);
97
+ };
98
+ }();
99
+ $[0] = refetchLabelValues;
100
+ $[1] = t1;
101
+ } else {
102
+ t1 = $[1];
103
+ }
104
+ var t2;
105
+ if ($[2] !== refetchLabelNames) {
106
+ t2 = /*#__PURE__*/function () {
107
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
108
+ return _regenerator().w(function (_context2) {
109
+ while (1) switch (_context2.n) {
110
+ case 0:
111
+ _context2.n = 1;
112
+ return refetchLabelNames();
113
+ case 1:
114
+ return _context2.a(2);
115
+ }
116
+ }, _callee2);
117
+ }));
118
+ return function t2() {
119
+ return _ref2.apply(this, arguments);
120
+ };
121
+ }();
122
+ $[2] = refetchLabelNames;
123
+ $[3] = t2;
124
+ } else {
125
+ t2 = $[3];
126
+ }
127
+ var value = {
128
+ labelNames: labelNamesFromAPI,
129
+ labelNameMappingsForMatchersInput: labelNameMappingsForMatchersInput,
130
+ isLabelNamesLoading: isLabelNamesLoading,
131
+ isLabelValuesLoading: isLabelValuesLoading,
132
+ currentLabelName: currentLabelName,
133
+ labelValues: labelValues,
134
+ setCurrentLabelName: setCurrentLabelName,
135
+ shouldHandlePrefixes: false,
136
+ refetchLabelValues: t1,
137
+ refetchLabelNames: t2,
138
+ labelNameFromMatchers: labelNameFromMatchers,
139
+ labelNameMappingsForSimpleMatchers: labelNameMappingsForSimpleMatchers,
140
+ suffix: suffix
141
+ };
142
+ return /*#__PURE__*/_jsx(UnifiedLabelsContext.Provider, {
143
+ value: value,
144
+ children: children
145
+ });
81
146
  }
82
147
  export function useUnifiedLabels() {
83
- const context = useContext(UnifiedLabelsContext);
84
- if (context === null) {
85
- throw new Error('useUnifiedLabels must be used within a UnifiedLabelsProvider');
86
- }
87
- return context;
88
- }
148
+ var context = useContext(UnifiedLabelsContext);
149
+ if (context === null) {
150
+ throw new Error("useUnifiedLabels must be used within a UnifiedLabelsProvider");
151
+ }
152
+ return context;
153
+ }
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  // Copyright 2022 The Parca Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,22 +11,43 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
14
+
13
15
  import { useMemo } from 'react';
14
- export const transformLabelName = (labelName) => {
15
- return labelName.replace(/^(attributes\.|attributes_resource\.)/, '');
16
+ export var transformLabelName = function transformLabelName(labelName) {
17
+ return labelName.replace(/^(attributes\.|attributes_resource\.)/, '');
16
18
  };
17
- export const useLabelNameMappings = (labelNames) => {
18
- return useMemo(() => {
19
- return labelNames.map(name => ({
20
- displayName: transformLabelName(name),
21
- fullName: name,
22
- }));
23
- }, [labelNames]);
19
+ export var useLabelNameMappings = function useLabelNameMappings(labelNames) {
20
+ var $ = _c(2);
21
+ var t0;
22
+ if ($[0] !== labelNames) {
23
+ t0 = labelNames.map(_temp);
24
+ $[0] = labelNames;
25
+ $[1] = t0;
26
+ } else {
27
+ t0 = $[1];
28
+ }
29
+ return t0;
24
30
  };
25
- export const useExtractedLabelNames = (response, error) => {
26
- return useMemo(() => {
27
- return (error === undefined || error == null) && response !== undefined && response != null
28
- ? response.labelNames?.filter(e => e !== '__name__') ?? []
29
- : [];
30
- }, [response, error]);
31
+ export var useExtractedLabelNames = function useExtractedLabelNames(response, error) {
32
+ var $ = _c(3);
33
+ var t0;
34
+ if ($[0] !== error || $[1] !== response) {
35
+ var _response$labelNames$, _response$labelNames;
36
+ t0 = (error === undefined || error == null) && response !== undefined && response != null ? (_response$labelNames$ = (_response$labelNames = response.labelNames) === null || _response$labelNames === void 0 ? void 0 : _response$labelNames.filter(_temp2)) !== null && _response$labelNames$ !== void 0 ? _response$labelNames$ : [] : [];
37
+ $[0] = error;
38
+ $[1] = response;
39
+ $[2] = t0;
40
+ } else {
41
+ t0 = $[2];
42
+ }
43
+ return t0;
31
44
  };
45
+ function _temp(name) {
46
+ return {
47
+ displayName: transformLabelName(name),
48
+ fullName: name
49
+ };
50
+ }
51
+ function _temp2(e) {
52
+ return e !== "__name__";
53
+ }
@@ -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,104 +17,160 @@
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 { useCallback } from 'react';
14
22
  import { useURLState, useURLStateBatch } from '@parca/components';
23
+
15
24
  /**
16
25
  * Hook to manage compare mode state and operations
17
26
  * Returns compare mode flags and a function to close compare mode
18
27
  */
19
- export const useCompareModeMeta = () => {
20
- const batchUpdates = useURLStateBatch();
21
- // Side A URL state (only setters needed)
22
- const [, setExpressionA] = useURLState('expression_a');
23
- const [, setFromA] = useURLState('from_a');
24
- const [, setToA] = useURLState('to_a');
25
- const [, setTimeSelectionA] = useURLState('time_selection_a');
26
- const [, setSumByA] = useURLState('sum_by_a');
27
- const [, setMergeFromA] = useURLState('merge_from_a');
28
- const [, setMergeToA] = useURLState('merge_to_a');
29
- const [, setSelectionA] = useURLState('selection_a');
30
- // Side B URL state
31
- const [expressionB, setExpressionB] = useURLState('expression_b');
32
- const [fromB, setFromB] = useURLState('from_b');
33
- const [toB, setToB] = useURLState('to_b');
34
- const [timeSelectionB, setTimeSelectionB] = useURLState('time_selection_b');
35
- const [sumByB, setSumByB] = useURLState('sum_by_b');
36
- const [mergeFromB, setMergeFromB] = useURLState('merge_from_b');
37
- const [mergeToB, setMergeToB] = useURLState('merge_to_b');
38
- const [selectionB, setSelectionB] = useURLState('selection_b');
39
- // Compare mode flags (expose values for routing decisions)
40
- const [compareA, setCompareA] = useURLState('compare_a');
41
- const [compareB, setCompareB] = useURLState('compare_b');
42
- const [compareAbsolute, setCompareAbsolute] = useURLState('compare_absolute');
43
- const closeCompareMode = useCallback((side) => {
44
- batchUpdates(() => {
45
- // If closing side A, swap A and B params first (keep B's data as the single view)
46
- if (side === 'A') {
47
- // Copy B to A
48
- setExpressionA(expressionB);
49
- setFromA(fromB);
50
- setToA(toB);
51
- setTimeSelectionA(timeSelectionB);
52
- setSumByA(sumByB);
53
- setMergeFromA(mergeFromB);
54
- setMergeToA(mergeToB);
55
- setSelectionA(selectionB);
56
- }
57
- // Clear all B params
58
- setExpressionB(undefined);
59
- setFromB(undefined);
60
- setToB(undefined);
61
- setTimeSelectionB(undefined);
62
- setSumByB(undefined);
63
- setMergeFromB(undefined);
64
- setMergeToB(undefined);
65
- setSelectionB(undefined);
66
- // Clear compare mode flags
67
- setCompareA(undefined);
68
- setCompareB(undefined);
69
- setCompareAbsolute(undefined);
70
- });
71
- }, [
72
- batchUpdates,
73
- // Side A setters
74
- setExpressionA,
75
- setFromA,
76
- setToA,
77
- setTimeSelectionA,
78
- setSumByA,
79
- setMergeFromA,
80
- setMergeToA,
81
- setSelectionA,
82
- // Side B values (for swapping)
83
- expressionB,
84
- fromB,
85
- toB,
86
- timeSelectionB,
87
- sumByB,
88
- mergeFromB,
89
- mergeToB,
90
- selectionB,
91
- // Side B setters
92
- setExpressionB,
93
- setFromB,
94
- setToB,
95
- setTimeSelectionB,
96
- setSumByB,
97
- setMergeFromB,
98
- setMergeToB,
99
- setSelectionB,
100
- // Compare flags
101
- setCompareA,
102
- setCompareB,
103
- setCompareAbsolute,
104
- ]);
105
- // Derive isCompareMode from flags
106
- const isCompareMode = compareA === 'true' || compareB === 'true';
107
- const isCompareAbsolute = compareAbsolute === 'true';
108
- return {
109
- isCompareMode,
110
- isCompareAbsolute,
111
- closeCompareMode,
28
+ export var useCompareModeMeta = function useCompareModeMeta() {
29
+ var $ = _c(33);
30
+ var batchUpdates = useURLStateBatch();
31
+ var _useURLState = useURLState("expression_a"),
32
+ _useURLState2 = _slicedToArray(_useURLState, 2),
33
+ setExpressionA = _useURLState2[1];
34
+ var _useURLState3 = useURLState("from_a"),
35
+ _useURLState4 = _slicedToArray(_useURLState3, 2),
36
+ setFromA = _useURLState4[1];
37
+ var _useURLState5 = useURLState("to_a"),
38
+ _useURLState6 = _slicedToArray(_useURLState5, 2),
39
+ setToA = _useURLState6[1];
40
+ var _useURLState7 = useURLState("time_selection_a"),
41
+ _useURLState8 = _slicedToArray(_useURLState7, 2),
42
+ setTimeSelectionA = _useURLState8[1];
43
+ var _useURLState9 = useURLState("sum_by_a"),
44
+ _useURLState0 = _slicedToArray(_useURLState9, 2),
45
+ setSumByA = _useURLState0[1];
46
+ var _useURLState1 = useURLState("merge_from_a"),
47
+ _useURLState10 = _slicedToArray(_useURLState1, 2),
48
+ setMergeFromA = _useURLState10[1];
49
+ var _useURLState11 = useURLState("merge_to_a"),
50
+ _useURLState12 = _slicedToArray(_useURLState11, 2),
51
+ setMergeToA = _useURLState12[1];
52
+ var _useURLState13 = useURLState("selection_a"),
53
+ _useURLState14 = _slicedToArray(_useURLState13, 2),
54
+ setSelectionA = _useURLState14[1];
55
+ var _useURLState15 = useURLState("expression_b"),
56
+ _useURLState16 = _slicedToArray(_useURLState15, 2),
57
+ expressionB = _useURLState16[0],
58
+ setExpressionB = _useURLState16[1];
59
+ var _useURLState17 = useURLState("from_b"),
60
+ _useURLState18 = _slicedToArray(_useURLState17, 2),
61
+ fromB = _useURLState18[0],
62
+ setFromB = _useURLState18[1];
63
+ var _useURLState19 = useURLState("to_b"),
64
+ _useURLState20 = _slicedToArray(_useURLState19, 2),
65
+ toB = _useURLState20[0],
66
+ setToB = _useURLState20[1];
67
+ var _useURLState21 = useURLState("time_selection_b"),
68
+ _useURLState22 = _slicedToArray(_useURLState21, 2),
69
+ timeSelectionB = _useURLState22[0],
70
+ setTimeSelectionB = _useURLState22[1];
71
+ var _useURLState23 = useURLState("sum_by_b"),
72
+ _useURLState24 = _slicedToArray(_useURLState23, 2),
73
+ sumByB = _useURLState24[0],
74
+ setSumByB = _useURLState24[1];
75
+ var _useURLState25 = useURLState("merge_from_b"),
76
+ _useURLState26 = _slicedToArray(_useURLState25, 2),
77
+ mergeFromB = _useURLState26[0],
78
+ setMergeFromB = _useURLState26[1];
79
+ var _useURLState27 = useURLState("merge_to_b"),
80
+ _useURLState28 = _slicedToArray(_useURLState27, 2),
81
+ mergeToB = _useURLState28[0],
82
+ setMergeToB = _useURLState28[1];
83
+ var _useURLState29 = useURLState("selection_b"),
84
+ _useURLState30 = _slicedToArray(_useURLState29, 2),
85
+ selectionB = _useURLState30[0],
86
+ setSelectionB = _useURLState30[1];
87
+ var _useURLState31 = useURLState("compare_a"),
88
+ _useURLState32 = _slicedToArray(_useURLState31, 2),
89
+ compareA = _useURLState32[0],
90
+ setCompareA = _useURLState32[1];
91
+ var _useURLState33 = useURLState("compare_b"),
92
+ _useURLState34 = _slicedToArray(_useURLState33, 2),
93
+ compareB = _useURLState34[0],
94
+ setCompareB = _useURLState34[1];
95
+ var _useURLState35 = useURLState("compare_absolute"),
96
+ _useURLState36 = _slicedToArray(_useURLState35, 2),
97
+ compareAbsolute = _useURLState36[0],
98
+ setCompareAbsolute = _useURLState36[1];
99
+ var t0;
100
+ if ($[0] !== batchUpdates || $[1] !== expressionB || $[2] !== fromB || $[3] !== mergeFromB || $[4] !== mergeToB || $[5] !== selectionB || $[6] !== setCompareA || $[7] !== setCompareAbsolute || $[8] !== setCompareB || $[9] !== setExpressionA || $[10] !== setExpressionB || $[11] !== setFromA || $[12] !== setFromB || $[13] !== setMergeFromA || $[14] !== setMergeFromB || $[15] !== setMergeToA || $[16] !== setMergeToB || $[17] !== setSelectionA || $[18] !== setSelectionB || $[19] !== setSumByA || $[20] !== setSumByB || $[21] !== setTimeSelectionA || $[22] !== setTimeSelectionB || $[23] !== setToA || $[24] !== setToB || $[25] !== sumByB || $[26] !== timeSelectionB || $[27] !== toB) {
101
+ t0 = function t0(side) {
102
+ batchUpdates(function () {
103
+ if (side === "A") {
104
+ setExpressionA(expressionB);
105
+ setFromA(fromB);
106
+ setToA(toB);
107
+ setTimeSelectionA(timeSelectionB);
108
+ setSumByA(sumByB);
109
+ setMergeFromA(mergeFromB);
110
+ setMergeToA(mergeToB);
111
+ setSelectionA(selectionB);
112
+ }
113
+ setExpressionB(undefined);
114
+ setFromB(undefined);
115
+ setToB(undefined);
116
+ setTimeSelectionB(undefined);
117
+ setSumByB(undefined);
118
+ setMergeFromB(undefined);
119
+ setMergeToB(undefined);
120
+ setSelectionB(undefined);
121
+ setCompareA(undefined);
122
+ setCompareB(undefined);
123
+ setCompareAbsolute(undefined);
124
+ });
112
125
  };
113
- };
126
+ $[0] = batchUpdates;
127
+ $[1] = expressionB;
128
+ $[2] = fromB;
129
+ $[3] = mergeFromB;
130
+ $[4] = mergeToB;
131
+ $[5] = selectionB;
132
+ $[6] = setCompareA;
133
+ $[7] = setCompareAbsolute;
134
+ $[8] = setCompareB;
135
+ $[9] = setExpressionA;
136
+ $[10] = setExpressionB;
137
+ $[11] = setFromA;
138
+ $[12] = setFromB;
139
+ $[13] = setMergeFromA;
140
+ $[14] = setMergeFromB;
141
+ $[15] = setMergeToA;
142
+ $[16] = setMergeToB;
143
+ $[17] = setSelectionA;
144
+ $[18] = setSelectionB;
145
+ $[19] = setSumByA;
146
+ $[20] = setSumByB;
147
+ $[21] = setTimeSelectionA;
148
+ $[22] = setTimeSelectionB;
149
+ $[23] = setToA;
150
+ $[24] = setToB;
151
+ $[25] = sumByB;
152
+ $[26] = timeSelectionB;
153
+ $[27] = toB;
154
+ $[28] = t0;
155
+ } else {
156
+ t0 = $[28];
157
+ }
158
+ var closeCompareMode = t0;
159
+ var isCompareMode = compareA === "true" || compareB === "true";
160
+ var isCompareAbsolute = compareAbsolute === "true";
161
+ var t1;
162
+ if ($[29] !== closeCompareMode || $[30] !== isCompareAbsolute || $[31] !== isCompareMode) {
163
+ t1 = {
164
+ isCompareMode: isCompareMode,
165
+ isCompareAbsolute: isCompareAbsolute,
166
+ closeCompareMode: closeCompareMode
167
+ };
168
+ $[29] = closeCompareMode;
169
+ $[30] = isCompareAbsolute;
170
+ $[31] = isCompareMode;
171
+ $[32] = t1;
172
+ } else {
173
+ t1 = $[32];
174
+ }
175
+ return t1;
176
+ };