@perses-dev/flame-chart-plugin 0.2.0

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 (198) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/__mf/css/async/325.f56729ca.css +1 -0
  4. package/__mf/css/async/341.f56729ca.css +1 -0
  5. package/__mf/css/async/908.f56729ca.css +1 -0
  6. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  7. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  8. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  9. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  10. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  11. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  12. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  13. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  18. package/__mf/js/FlameChart.96aae761.js +5 -0
  19. package/__mf/js/async/109.f7e97e30.js +73 -0
  20. package/__mf/js/async/109.f7e97e30.js.LICENSE.txt +35 -0
  21. package/__mf/js/async/173.40a64c5c.js +2 -0
  22. package/__mf/js/async/173.40a64c5c.js.LICENSE.txt +19 -0
  23. package/__mf/js/async/214.f491540e.js +1 -0
  24. package/__mf/js/async/224.511d05b6.js +1 -0
  25. package/__mf/js/async/238.5fdc556e.js +1 -0
  26. package/__mf/js/async/29.8b55315e.js +1 -0
  27. package/__mf/js/async/292.643bbcde.js +1 -0
  28. package/__mf/js/async/32.a46fc45f.js +110 -0
  29. package/__mf/js/async/32.a46fc45f.js.LICENSE.txt +49 -0
  30. package/__mf/js/async/325.80031d25.js +1 -0
  31. package/__mf/js/async/362.c587718a.js +1 -0
  32. package/__mf/js/async/409.fd2d437e.js +1 -0
  33. package/__mf/js/async/464.bb266d9b.js +7 -0
  34. package/__mf/js/async/464.bb266d9b.js.LICENSE.txt +21 -0
  35. package/__mf/js/async/488.807096d6.js +1 -0
  36. package/__mf/js/async/600.fdf527b8.js +38 -0
  37. package/__mf/js/async/651.9eb6f201.js +1 -0
  38. package/__mf/js/async/69.a1079bc1.js +2 -0
  39. package/__mf/js/async/69.a1079bc1.js.LICENSE.txt +24 -0
  40. package/__mf/js/async/694.15848123.js +1 -0
  41. package/__mf/js/async/738.0b2ab393.js +1 -0
  42. package/__mf/js/async/740.65aa69e2.js +1 -0
  43. package/__mf/js/async/75.3435fe3f.js +1 -0
  44. package/__mf/js/async/770.bc6ab5a3.js +1 -0
  45. package/__mf/js/async/863.8b7bdf43.js +2 -0
  46. package/__mf/js/async/863.8b7bdf43.js.LICENSE.txt +9 -0
  47. package/__mf/js/async/908.0672909d.js +1 -0
  48. package/__mf/js/async/960.d56a397e.js +2 -0
  49. package/__mf/js/async/960.d56a397e.js.LICENSE.txt +8 -0
  50. package/__mf/js/async/964.86d91e52.js +2 -0
  51. package/__mf/js/async/964.86d91e52.js.LICENSE.txt +9 -0
  52. package/__mf/js/async/981.4de2d5c8.js +2 -0
  53. package/__mf/js/async/981.4de2d5c8.js.LICENSE.txt +8 -0
  54. package/__mf/js/async/__federation_expose_FlameChart.aaa6df30.js +17 -0
  55. package/__mf/js/async/lib-router.00804bbc.js +2 -0
  56. package/__mf/js/async/lib-router.00804bbc.js.LICENSE.txt +32 -0
  57. package/__mf/js/main.4931a266.js +5 -0
  58. package/lib/FlameChart.d.ts +8 -0
  59. package/lib/FlameChart.d.ts.map +1 -0
  60. package/lib/FlameChart.js +32 -0
  61. package/lib/FlameChart.js.map +1 -0
  62. package/lib/bootstrap.d.ts +2 -0
  63. package/lib/bootstrap.d.ts.map +1 -0
  64. package/lib/bootstrap.js +19 -0
  65. package/lib/bootstrap.js.map +1 -0
  66. package/lib/cjs/FlameChart.js +38 -0
  67. package/lib/cjs/bootstrap.js +26 -0
  68. package/lib/cjs/components/CustomBreadcrumb.js +96 -0
  69. package/lib/cjs/components/FlameChart.js +341 -0
  70. package/lib/cjs/components/FlameChartOptionsEditorSettings.js +87 -0
  71. package/lib/cjs/components/FlameChartPanel.js +147 -0
  72. package/lib/cjs/components/PaletteSelector.js +49 -0
  73. package/lib/cjs/components/SearchBar.js +59 -0
  74. package/lib/cjs/components/SeriesChart.js +189 -0
  75. package/lib/cjs/components/Settings.js +202 -0
  76. package/lib/cjs/components/SwitchSelector.js +37 -0
  77. package/lib/cjs/components/TableChart.js +143 -0
  78. package/lib/cjs/components/index.js +39 -0
  79. package/lib/cjs/env.d.js +14 -0
  80. package/lib/cjs/flame-chart-model.js +31 -0
  81. package/lib/cjs/getPluginModule.js +39 -0
  82. package/lib/cjs/index-federation.js +55 -0
  83. package/lib/cjs/index.js +37 -0
  84. package/lib/cjs/setup-tests.js +19 -0
  85. package/lib/cjs/utils/data-model.js +18 -0
  86. package/lib/cjs/utils/data-transform.js +152 -0
  87. package/lib/cjs/utils/format.js +87 -0
  88. package/lib/cjs/utils/palette-gen.js +68 -0
  89. package/lib/cjs/utils/palette.js +62 -0
  90. package/lib/cjs/utils/series-tooltip.js +51 -0
  91. package/lib/cjs/utils/tooltip.js +76 -0
  92. package/lib/cjs/utils/ui-text.js +30 -0
  93. package/lib/cjs/utils/utils.js +108 -0
  94. package/lib/components/CustomBreadcrumb.d.ts +9 -0
  95. package/lib/components/CustomBreadcrumb.d.ts.map +1 -0
  96. package/lib/components/CustomBreadcrumb.js +83 -0
  97. package/lib/components/CustomBreadcrumb.js.map +1 -0
  98. package/lib/components/FlameChart.d.ts +13 -0
  99. package/lib/components/FlameChart.d.ts.map +1 -0
  100. package/lib/components/FlameChart.js +328 -0
  101. package/lib/components/FlameChart.js.map +1 -0
  102. package/lib/components/FlameChartOptionsEditorSettings.d.ts +4 -0
  103. package/lib/components/FlameChartOptionsEditorSettings.d.ts.map +1 -0
  104. package/lib/components/FlameChartOptionsEditorSettings.js +79 -0
  105. package/lib/components/FlameChartOptionsEditorSettings.js.map +1 -0
  106. package/lib/components/FlameChartPanel.d.ts +7 -0
  107. package/lib/components/FlameChartPanel.d.ts.map +1 -0
  108. package/lib/components/FlameChartPanel.js +139 -0
  109. package/lib/components/FlameChartPanel.js.map +1 -0
  110. package/lib/components/PaletteSelector.d.ts +8 -0
  111. package/lib/components/PaletteSelector.d.ts.map +1 -0
  112. package/lib/components/PaletteSelector.js +41 -0
  113. package/lib/components/PaletteSelector.js.map +1 -0
  114. package/lib/components/SearchBar.d.ts +7 -0
  115. package/lib/components/SearchBar.d.ts.map +1 -0
  116. package/lib/components/SearchBar.js +46 -0
  117. package/lib/components/SearchBar.js.map +1 -0
  118. package/lib/components/SeriesChart.d.ts +9 -0
  119. package/lib/components/SeriesChart.d.ts.map +1 -0
  120. package/lib/components/SeriesChart.js +181 -0
  121. package/lib/components/SeriesChart.js.map +1 -0
  122. package/lib/components/Settings.d.ts +11 -0
  123. package/lib/components/Settings.d.ts.map +1 -0
  124. package/lib/components/Settings.js +189 -0
  125. package/lib/components/Settings.js.map +1 -0
  126. package/lib/components/SwitchSelector.d.ts +8 -0
  127. package/lib/components/SwitchSelector.d.ts.map +1 -0
  128. package/lib/components/SwitchSelector.js +29 -0
  129. package/lib/components/SwitchSelector.js.map +1 -0
  130. package/lib/components/TableChart.d.ts +12 -0
  131. package/lib/components/TableChart.d.ts.map +1 -0
  132. package/lib/components/TableChart.js +135 -0
  133. package/lib/components/TableChart.js.map +1 -0
  134. package/lib/components/index.d.ts +11 -0
  135. package/lib/components/index.d.ts.map +1 -0
  136. package/lib/components/index.js +24 -0
  137. package/lib/components/index.js.map +1 -0
  138. package/lib/env.d.js +15 -0
  139. package/lib/env.d.js.map +1 -0
  140. package/lib/flame-chart-model.d.ts +18 -0
  141. package/lib/flame-chart-model.d.ts.map +1 -0
  142. package/lib/flame-chart-model.js +23 -0
  143. package/lib/flame-chart-model.js.map +1 -0
  144. package/lib/getPluginModule.d.ts +6 -0
  145. package/lib/getPluginModule.d.ts.map +1 -0
  146. package/lib/getPluginModule.js +28 -0
  147. package/lib/getPluginModule.js.map +1 -0
  148. package/lib/index-federation.d.ts +1 -0
  149. package/lib/index-federation.d.ts.map +1 -0
  150. package/lib/index-federation.js +15 -0
  151. package/lib/index-federation.js.map +1 -0
  152. package/lib/index.d.ts +3 -0
  153. package/lib/index.d.ts.map +1 -0
  154. package/lib/index.js +16 -0
  155. package/lib/index.js.map +1 -0
  156. package/lib/setup-tests.d.ts +2 -0
  157. package/lib/setup-tests.d.ts.map +1 -0
  158. package/lib/setup-tests.js +17 -0
  159. package/lib/setup-tests.js.map +1 -0
  160. package/lib/utils/data-model.d.ts +37 -0
  161. package/lib/utils/data-model.d.ts.map +1 -0
  162. package/lib/utils/data-model.js +19 -0
  163. package/lib/utils/data-model.js.map +1 -0
  164. package/lib/utils/data-transform.d.ts +19 -0
  165. package/lib/utils/data-transform.d.ts.map +1 -0
  166. package/lib/utils/data-transform.js +138 -0
  167. package/lib/utils/data-transform.js.map +1 -0
  168. package/lib/utils/format.d.ts +3 -0
  169. package/lib/utils/format.d.ts.map +1 -0
  170. package/lib/utils/format.js +71 -0
  171. package/lib/utils/format.js.map +1 -0
  172. package/lib/utils/palette-gen.d.ts +14 -0
  173. package/lib/utils/palette-gen.d.ts.map +1 -0
  174. package/lib/utils/palette-gen.js +56 -0
  175. package/lib/utils/palette-gen.js.map +1 -0
  176. package/lib/utils/palette.d.ts +5 -0
  177. package/lib/utils/palette.d.ts.map +1 -0
  178. package/lib/utils/palette.js +51 -0
  179. package/lib/utils/palette.js.map +1 -0
  180. package/lib/utils/series-tooltip.d.ts +3 -0
  181. package/lib/utils/series-tooltip.d.ts.map +1 -0
  182. package/lib/utils/series-tooltip.js +43 -0
  183. package/lib/utils/series-tooltip.js.map +1 -0
  184. package/lib/utils/tooltip.d.ts +6 -0
  185. package/lib/utils/tooltip.d.ts.map +1 -0
  186. package/lib/utils/tooltip.js +29 -0
  187. package/lib/utils/tooltip.js.map +1 -0
  188. package/lib/utils/ui-text.d.ts +9 -0
  189. package/lib/utils/ui-text.d.ts.map +1 -0
  190. package/lib/utils/ui-text.js +22 -0
  191. package/lib/utils/ui-text.js.map +1 -0
  192. package/lib/utils/utils.d.ts +36 -0
  193. package/lib/utils/utils.d.ts.map +1 -0
  194. package/lib/utils/utils.js +92 -0
  195. package/lib/utils/utils.js.map +1 -0
  196. package/mf-manifest.json +274 -0
  197. package/mf-stats.json +322 -0
  198. package/package.json +64 -0
@@ -0,0 +1,68 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ getColorByPackageName: function() {
25
+ return getColorByPackageName;
26
+ },
27
+ getColorByValue: function() {
28
+ return getColorByValue;
29
+ },
30
+ getSpanColor: function() {
31
+ return getSpanColor;
32
+ }
33
+ });
34
+ const _palette = require("./palette");
35
+ const LESS_THAN_ONE_COLOR = '#dee2e6'; // use this color when the value is less than 1
36
+ const MORE_THAN_HUNDRED_COLOR = '#ffbdbd'; // use this color when the value is more than 100
37
+ const NOT_FOUND_COLOR = '#393d47';
38
+ // Palette of color to display the flame chart by value
39
+ const valueColorPalette = [
40
+ '#fff85b',
41
+ '#ffde4c',
42
+ '#ffc252',
43
+ '#ff8c00',
44
+ '#f08c00',
45
+ '#e67762',
46
+ '#ff8c00',
47
+ '#ff6f00',
48
+ '#ff7070',
49
+ '#ff3300',
50
+ '#ff004c'
51
+ ];
52
+ function getSpanColor(palette, functionName, value) {
53
+ if (palette === 'package-name') {
54
+ return getColorByPackageName(functionName, value);
55
+ }
56
+ return getColorByValue(value);
57
+ }
58
+ function getColorByValue(value) {
59
+ if (value < 1) return LESS_THAN_ONE_COLOR;
60
+ if (value > 100) return MORE_THAN_HUNDRED_COLOR;
61
+ return valueColorPalette[Math.floor(value / (valueColorPalette.length - 1))] || NOT_FOUND_COLOR;
62
+ }
63
+ function getColorByPackageName(functionName, value) {
64
+ // get package name from the function name.
65
+ // It is the substring between the last '/' and the first '.' or the end of the string
66
+ const packageName = functionName.split('/').pop()?.split('.')[0] || functionName;
67
+ return value < 1 ? LESS_THAN_ONE_COLOR : (0, _palette.getConsistentColor)(packageName, false);
68
+ }
@@ -0,0 +1,62 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "getConsistentColor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return getConsistentColor;
21
+ }
22
+ });
23
+ const _colorhash = /*#__PURE__*/ _interop_require_default(require("color-hash"));
24
+ function _interop_require_default(obj) {
25
+ return obj && obj.__esModule ? obj : {
26
+ default: obj
27
+ };
28
+ }
29
+ // Valid hue values are 0 to 360 and can be adjusted to control the generated colors.
30
+ // More info: https://github.com/zenozeng/color-hash#custom-hue
31
+ // Picked min of 20 and max of 360 to exclude common threshold colors (red).
32
+ // Items with "error" in them will always be generated as red.
33
+ const ERROR_HUE_CUTOFF = 20;
34
+ const colorGenerator = new _colorhash.default({
35
+ hue: {
36
+ min: ERROR_HUE_CUTOFF,
37
+ max: 360
38
+ }
39
+ });
40
+ const redColorGenerator = new _colorhash.default({
41
+ hue: {
42
+ min: 0,
43
+ max: ERROR_HUE_CUTOFF
44
+ }
45
+ });
46
+ function computeConsistentColor(name, error) {
47
+ const [hue, saturation, lightness] = error ? redColorGenerator.hsl(name) : colorGenerator.hsl(name);
48
+ const saturationPercent = `${(saturation * 100).toFixed(0)}%`;
49
+ const lightnessPercent = `${(lightness * 100).toFixed(0)}%`;
50
+ return `hsla(${hue.toFixed(2)},${saturationPercent},${lightnessPercent},0.9)`;
51
+ }
52
+ // To check whether a color has already been generated for a given string.
53
+ const colorLookup = {};
54
+ function getConsistentColor(name, error) {
55
+ const key = `${name}_____${error}`;
56
+ let value = colorLookup[key];
57
+ if (!value) {
58
+ value = computeConsistentColor(name, error);
59
+ colorLookup[key] = value;
60
+ }
61
+ return value;
62
+ }
@@ -0,0 +1,51 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "getSeriesTooltip", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return getSeriesTooltip;
21
+ }
22
+ });
23
+ const _format = require("./format");
24
+ function getSeriesTooltip(data, unit, name, color, divColor) {
25
+ const date = new Date(data.value[0]);
26
+ const formattedDate = date.toLocaleDateString('en-US', {
27
+ month: 'short',
28
+ day: '2-digit',
29
+ year: 'numeric'
30
+ });
31
+ const formattedTime = date.toLocaleString('en-US', {
32
+ hour: '2-digit',
33
+ minute: '2-digit',
34
+ second: '2-digit',
35
+ hour12: false
36
+ });
37
+ return `
38
+ <div>
39
+ <div>
40
+ ${formattedDate} - <b>${formattedTime}</b>
41
+ </div>
42
+ <hr style="border: none; border-top: 1px solid ${divColor}" />
43
+ <div style="display: flex; align-items: center">
44
+ <div style="margin-right: 8px; display: inline-block; width: 11px; height: 11px; border-radius: 2px; background-color: ${color}"></div>
45
+ <div style="width: 100%; display: flex; justify-content: space-between" >
46
+ <span style="margin-right: 8px">${name}</span> <b>${(0, _format.formatItemValue)(unit, data.value[1])}</b>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ `;
51
+ }
@@ -0,0 +1,76 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "generateTooltip", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return generateTooltip;
21
+ }
22
+ });
23
+ const _echarts = /*#__PURE__*/ _interop_require_wildcard(require("echarts"));
24
+ const _format = require("./format");
25
+ function _getRequireWildcardCache(nodeInterop) {
26
+ if (typeof WeakMap !== "function") return null;
27
+ var cacheBabelInterop = new WeakMap();
28
+ var cacheNodeInterop = new WeakMap();
29
+ return (_getRequireWildcardCache = function(nodeInterop) {
30
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
31
+ })(nodeInterop);
32
+ }
33
+ function _interop_require_wildcard(obj, nodeInterop) {
34
+ if (!nodeInterop && obj && obj.__esModule) {
35
+ return obj;
36
+ }
37
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
38
+ return {
39
+ default: obj
40
+ };
41
+ }
42
+ var cache = _getRequireWildcardCache(nodeInterop);
43
+ if (cache && cache.has(obj)) {
44
+ return cache.get(obj);
45
+ }
46
+ var newObj = {
47
+ __proto__: null
48
+ };
49
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
50
+ for(var key in obj){
51
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
52
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
53
+ if (desc && (desc.get || desc.set)) {
54
+ Object.defineProperty(newObj, key, desc);
55
+ } else {
56
+ newObj[key] = obj[key];
57
+ }
58
+ }
59
+ }
60
+ newObj.default = obj;
61
+ if (cache) {
62
+ cache.set(obj, newObj);
63
+ }
64
+ return newObj;
65
+ }
66
+ function generateTooltip(params, unit) {
67
+ const totalPercentage = Number(params.value[4]);
68
+ const selfPercentage = Number(params.value[5]);
69
+ const functionName = params.value[6];
70
+ const total = Number(params.value[8]);
71
+ const self = Number(params.value[7]);
72
+ return `${functionName}<br/><br/>
73
+ Total: ${(0, _format.formatItemValue)(unit, total)} (${totalPercentage.toFixed(2)}%)<br/>
74
+ Self: ${(0, _format.formatItemValue)(unit, self)} (${selfPercentage.toFixed(2)}%)<br/>
75
+ Samples: ${_echarts.format.addCommas(total)}`;
76
+ }
@@ -0,0 +1,30 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "TOOLTIP_TEXT", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return TOOLTIP_TEXT;
21
+ }
22
+ });
23
+ const TOOLTIP_TEXT = {
24
+ resetFlameGraph: 'Reset graph',
25
+ changeColorSheme: 'Change color sheme',
26
+ exportData: 'Export profile data',
27
+ showTable: 'Only show table',
28
+ showFlameGraph: 'Only show flame graph',
29
+ showBoth: 'Show both the table and flame graph'
30
+ };
@@ -0,0 +1,108 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ resetSettings: function() {
25
+ return resetSettings;
26
+ },
27
+ usePaletteState: function() {
28
+ return usePaletteState;
29
+ },
30
+ useShowFlameGraphState: function() {
31
+ return useShowFlameGraphState;
32
+ },
33
+ useShowSeriesState: function() {
34
+ return useShowSeriesState;
35
+ },
36
+ useShowSettingsState: function() {
37
+ return useShowSettingsState;
38
+ },
39
+ useShowTableState: function() {
40
+ return useShowTableState;
41
+ }
42
+ });
43
+ const _immer = require("immer");
44
+ function usePaletteState(props) {
45
+ const { onChange, value } = props;
46
+ const handlePaletteChange = (newPalette)=>{
47
+ onChange((0, _immer.produce)(value, (draft)=>{
48
+ draft.palette = newPalette;
49
+ }));
50
+ };
51
+ return {
52
+ handlePaletteChange
53
+ };
54
+ }
55
+ function useShowSettingsState(props) {
56
+ const { onChange, value } = props;
57
+ const handleShowSettingsChange = (newValue)=>{
58
+ onChange((0, _immer.produce)(value, (draft)=>{
59
+ draft.showSettings = newValue;
60
+ }));
61
+ };
62
+ return {
63
+ handleShowSettingsChange
64
+ };
65
+ }
66
+ function useShowSeriesState(props) {
67
+ const { onChange, value } = props;
68
+ const handleShowSeriesChange = (newValue)=>{
69
+ onChange((0, _immer.produce)(value, (draft)=>{
70
+ draft.showSeries = newValue;
71
+ }));
72
+ };
73
+ return {
74
+ handleShowSeriesChange
75
+ };
76
+ }
77
+ function useShowTableState(props) {
78
+ const { onChange, value } = props;
79
+ const handleShowTableChange = (newValue)=>{
80
+ onChange((0, _immer.produce)(value, (draft)=>{
81
+ draft.showTable = newValue;
82
+ }));
83
+ };
84
+ return {
85
+ handleShowTableChange
86
+ };
87
+ }
88
+ function useShowFlameGraphState(props) {
89
+ const { onChange, value } = props;
90
+ const handleShowFlameGraphChange = (newValue)=>{
91
+ onChange((0, _immer.produce)(value, (draft)=>{
92
+ draft.showFlameGraph = newValue;
93
+ }));
94
+ };
95
+ return {
96
+ handleShowFlameGraphChange
97
+ };
98
+ }
99
+ function resetSettings(props) {
100
+ const { onChange, value } = props;
101
+ onChange((0, _immer.produce)(value, (draft)=>{
102
+ draft.palette = 'package-name';
103
+ draft.showSettings = true;
104
+ draft.showSeries = false;
105
+ draft.showTable = true;
106
+ draft.showFlameGraph = true;
107
+ }));
108
+ }
@@ -0,0 +1,9 @@
1
+ import { ReactElement } from 'react';
2
+ export interface CustomBreadcrumbProps {
3
+ totalValue: string;
4
+ totalSample: number;
5
+ otherItemSample: number | undefined;
6
+ onSelectedIdChange: (newId: number) => void;
7
+ }
8
+ export declare function CustomBreadcrumb(props: CustomBreadcrumbProps): ReactElement;
9
+ //# sourceMappingURL=CustomBreadcrumb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/CustomBreadcrumb.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AASrC,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAmBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAgC3E"}
@@ -0,0 +1,83 @@
1
+ // Copyright 2025 The Perses 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.
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Stack, Breadcrumbs } from '@mui/material';
15
+ import ChevronRightIcon from 'mdi-material-ui/ChevronRight';
16
+ import EyeIcon from 'mdi-material-ui/EyeOutline';
17
+ import CloseIcon from 'mdi-material-ui/Close';
18
+ import Chip from '@mui/material/Chip';
19
+ import { emphasize, styled } from '@mui/material/styles';
20
+ import { formatValue } from '@perses-dev/core';
21
+ const StyledBreadcrumb = styled(Chip)(({ theme })=>{
22
+ const backgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[800];
23
+ return {
24
+ backgroundColor,
25
+ height: theme.spacing(3),
26
+ color: theme.palette.text.primary,
27
+ fontWeight: theme.typography.fontWeightRegular,
28
+ '&:hover, &:focus': {
29
+ backgroundColor: emphasize(backgroundColor, 0.06)
30
+ },
31
+ '&:active': {
32
+ boxShadow: theme.shadows[1],
33
+ backgroundColor: emphasize(backgroundColor, 0.12)
34
+ }
35
+ };
36
+ });
37
+ export function CustomBreadcrumb(props) {
38
+ const { totalValue, totalSample, otherItemSample, onSelectedIdChange } = props;
39
+ const handleClick = (event)=>{
40
+ event.preventDefault();
41
+ onSelectedIdChange(0);
42
+ };
43
+ const splitedValue = totalValue.split('(');
44
+ const totalValueText = splitedValue[splitedValue.length - 1]?.slice(0, -1);
45
+ const totalLabel = formatValue(totalSample, {
46
+ unit: 'decimal',
47
+ decimalPlaces: 2,
48
+ shortValues: true
49
+ }) + ' samples';
50
+ return /*#__PURE__*/ _jsx(Stack, {
51
+ direction: "row",
52
+ spacing: 1,
53
+ minHeight: 40,
54
+ alignItems: "center",
55
+ children: /*#__PURE__*/ _jsxs(Breadcrumbs, {
56
+ separator: /*#__PURE__*/ _jsx(ChevronRightIcon, {
57
+ fontSize: "small"
58
+ }),
59
+ "aria-label": "breadcrumb",
60
+ sx: {
61
+ justifyContent: 'center'
62
+ },
63
+ children: [
64
+ /*#__PURE__*/ _jsx(StyledBreadcrumb, {
65
+ label: totalValueText + ' | ' + totalLabel
66
+ }),
67
+ otherItemSample !== undefined && /*#__PURE__*/ _jsx(StyledBreadcrumb, {
68
+ label: (otherItemSample / totalSample * 100).toFixed(2) + '% of total',
69
+ icon: /*#__PURE__*/ _jsx(EyeIcon, {
70
+ fontSize: "small",
71
+ color: "secondary"
72
+ }),
73
+ deleteIcon: /*#__PURE__*/ _jsx(CloseIcon, {
74
+ fontSize: "small"
75
+ }),
76
+ onDelete: handleClick
77
+ })
78
+ ]
79
+ })
80
+ });
81
+ }
82
+
83
+ //# sourceMappingURL=CustomBreadcrumb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/CustomBreadcrumb.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement } from 'react';\nimport { Stack, Breadcrumbs } from '@mui/material';\nimport ChevronRightIcon from 'mdi-material-ui/ChevronRight';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport Chip from '@mui/material/Chip';\nimport { emphasize, styled } from '@mui/material/styles';\nimport { formatValue } from '@perses-dev/core';\n\nexport interface CustomBreadcrumbProps {\n totalValue: string;\n totalSample: number;\n otherItemSample: number | undefined;\n onSelectedIdChange: (newId: number) => void;\n}\n\nconst StyledBreadcrumb = styled(Chip)(({ theme }) => {\n const backgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[800];\n return {\n backgroundColor,\n height: theme.spacing(3),\n color: theme.palette.text.primary,\n fontWeight: theme.typography.fontWeightRegular,\n '&:hover, &:focus': {\n backgroundColor: emphasize(backgroundColor, 0.06),\n },\n '&:active': {\n boxShadow: theme.shadows[1],\n backgroundColor: emphasize(backgroundColor, 0.12),\n },\n };\n});\n\nexport function CustomBreadcrumb(props: CustomBreadcrumbProps): ReactElement {\n const { totalValue, totalSample, otherItemSample, onSelectedIdChange } = props;\n\n const handleClick = (event: React.MouseEvent<Element, MouseEvent>) => {\n event.preventDefault();\n onSelectedIdChange(0);\n };\n\n const splitedValue = totalValue.split('(');\n const totalValueText = splitedValue[splitedValue.length - 1]?.slice(0, -1);\n\n const totalLabel = formatValue(totalSample, { unit: 'decimal', decimalPlaces: 2, shortValues: true }) + ' samples';\n\n return (\n <Stack direction=\"row\" spacing={1} minHeight={40} alignItems=\"center\">\n <Breadcrumbs\n separator={<ChevronRightIcon fontSize=\"small\" />}\n aria-label=\"breadcrumb\"\n sx={{ justifyContent: 'center' }}\n >\n <StyledBreadcrumb label={totalValueText + ' | ' + totalLabel} />\n {otherItemSample !== undefined && (\n <StyledBreadcrumb\n label={((otherItemSample / totalSample) * 100).toFixed(2) + '% of total'}\n icon={<EyeIcon fontSize=\"small\" color=\"secondary\" />}\n deleteIcon={<CloseIcon fontSize=\"small\" />}\n onDelete={handleClick}\n />\n )}\n </Breadcrumbs>\n </Stack>\n );\n}\n"],"names":["Stack","Breadcrumbs","ChevronRightIcon","EyeIcon","CloseIcon","Chip","emphasize","styled","formatValue","StyledBreadcrumb","theme","backgroundColor","palette","mode","grey","height","spacing","color","text","primary","fontWeight","typography","fontWeightRegular","boxShadow","shadows","CustomBreadcrumb","props","totalValue","totalSample","otherItemSample","onSelectedIdChange","handleClick","event","preventDefault","splitedValue","split","totalValueText","length","slice","totalLabel","unit","decimalPlaces","shortValues","direction","minHeight","alignItems","separator","fontSize","aria-label","sx","justifyContent","label","undefined","toFixed","icon","deleteIcon","onDelete"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,OAAOC,sBAAsB,+BAA+B;AAC5D,OAAOC,aAAa,6BAA6B;AACjD,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,UAAU,qBAAqB;AACtC,SAASC,SAAS,EAAEC,MAAM,QAAQ,uBAAuB;AACzD,SAASC,WAAW,QAAQ,mBAAmB;AAS/C,MAAMC,mBAAmBF,OAAOF,MAAM,CAAC,EAAEK,KAAK,EAAE;IAC9C,MAAMC,kBAAkBD,MAAME,OAAO,CAACC,IAAI,KAAK,UAAUH,MAAME,OAAO,CAACE,IAAI,CAAC,IAAI,GAAGJ,MAAME,OAAO,CAACE,IAAI,CAAC,IAAI;IAC1G,OAAO;QACLH;QACAI,QAAQL,MAAMM,OAAO,CAAC;QACtBC,OAAOP,MAAME,OAAO,CAACM,IAAI,CAACC,OAAO;QACjCC,YAAYV,MAAMW,UAAU,CAACC,iBAAiB;QAC9C,oBAAoB;YAClBX,iBAAiBL,UAAUK,iBAAiB;QAC9C;QACA,YAAY;YACVY,WAAWb,MAAMc,OAAO,CAAC,EAAE;YAC3Bb,iBAAiBL,UAAUK,iBAAiB;QAC9C;IACF;AACF;AAEA,OAAO,SAASc,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,UAAU,EAAEC,WAAW,EAAEC,eAAe,EAAEC,kBAAkB,EAAE,GAAGJ;IAEzE,MAAMK,cAAc,CAACC;QACnBA,MAAMC,cAAc;QACpBH,mBAAmB;IACrB;IAEA,MAAMI,eAAeP,WAAWQ,KAAK,CAAC;IACtC,MAAMC,iBAAiBF,YAAY,CAACA,aAAaG,MAAM,GAAG,EAAE,EAAEC,MAAM,GAAG,CAAC;IAExE,MAAMC,aAAa/B,YAAYoB,aAAa;QAAEY,MAAM;QAAWC,eAAe;QAAGC,aAAa;IAAK,KAAK;IAExG,qBACE,KAAC1C;QAAM2C,WAAU;QAAM3B,SAAS;QAAG4B,WAAW;QAAIC,YAAW;kBAC3D,cAAA,MAAC5C;YACC6C,yBAAW,KAAC5C;gBAAiB6C,UAAS;;YACtCC,cAAW;YACXC,IAAI;gBAAEC,gBAAgB;YAAS;;8BAE/B,KAACzC;oBAAiB0C,OAAOf,iBAAiB,UAAUG;;gBACnDV,oBAAoBuB,2BACnB,KAAC3C;oBACC0C,OAAO,AAAC,CAAA,AAACtB,kBAAkBD,cAAe,GAAE,EAAGyB,OAAO,CAAC,KAAK;oBAC5DC,oBAAM,KAACnD;wBAAQ4C,UAAS;wBAAQ9B,OAAM;;oBACtCsC,0BAAY,KAACnD;wBAAU2C,UAAS;;oBAChCS,UAAUzB;;;;;AAMtB"}
@@ -0,0 +1,13 @@
1
+ import { ReactElement } from 'react';
2
+ import { ProfileData } from '@perses-dev/core';
3
+ export interface FlameChartProps {
4
+ width: number;
5
+ height: number;
6
+ data: ProfileData;
7
+ palette: 'package-name' | 'value';
8
+ selectedId: number;
9
+ searchValue: string;
10
+ onSelectedIdChange: (newId: number) => void;
11
+ }
12
+ export declare function FlameChart(props: FlameChartProps): ReactElement;
13
+ //# sourceMappingURL=FlameChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlameChart.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChart.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,EAAiC,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAkB/C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAqP/D"}