@bundle-stats/ui 4.12.0-beta.4 → 4.13.0-beta.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 (174) hide show
  1. package/lib/app/app.js +3 -7
  2. package/lib/app/app.js.map +1 -1
  3. package/lib/assets/icons.svg +26 -20
  4. package/lib/assets/icons.svg.js +27 -23
  5. package/lib/assets/icons.svg.js.map +1 -1
  6. package/lib/components/bundle-assets/bundle-assets.js +11 -3
  7. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  8. package/lib/components/bundle-assets/index.js +3 -4
  9. package/lib/components/bundle-assets/index.js.map +1 -1
  10. package/lib/components/bundle-assets-totals/bundle-assets-totals.js +77 -0
  11. package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -0
  12. package/lib/components/bundle-assets-totals/bundle-assets-totals.module.css +7 -0
  13. package/lib/{ui/horizontal-bar-chart → components/bundle-assets-totals}/index.js +1 -1
  14. package/lib/components/bundle-assets-totals/index.js.map +1 -0
  15. package/lib/components/bundle-modules/bundle-modules.js +9 -2
  16. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  17. package/lib/components/bundle-modules/index.js +3 -4
  18. package/lib/components/bundle-modules/index.js.map +1 -1
  19. package/lib/components/bundle-packages/bundle-packages.js +10 -2
  20. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  21. package/lib/components/bundle-packages/index.js +3 -4
  22. package/lib/components/bundle-packages/index.js.map +1 -1
  23. package/lib/components/index.js +3 -5
  24. package/lib/components/index.js.map +1 -1
  25. package/lib/components/{bundle-assets-totals-table → metrics-display-selector}/index.js +1 -1
  26. package/lib/components/metrics-display-selector/index.js.map +1 -0
  27. package/lib/components/metrics-display-selector/metrics-display-selector.js +27 -0
  28. package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -0
  29. package/lib/components/metrics-display-selector/metrics-display-selector.module.css +10 -0
  30. package/lib/components/{bundle-assets-totals-chart-bars → metrics-treemap}/index.js +1 -1
  31. package/lib/components/metrics-treemap/index.js.map +1 -0
  32. package/lib/components/metrics-treemap/metrics-treemap.js +148 -0
  33. package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -0
  34. package/lib/components/metrics-treemap/metrics-treemap.module.css +168 -0
  35. package/lib/constants.js +6 -1
  36. package/lib/constants.js.map +1 -1
  37. package/lib/hooks/metrics-display-type.js +40 -0
  38. package/lib/hooks/metrics-display-type.js.map +1 -0
  39. package/lib/hooks/show-entry.js +13 -0
  40. package/lib/hooks/show-entry.js.map +1 -0
  41. package/lib/ui/icon/icon.js +2 -0
  42. package/lib/ui/icon/icon.js.map +1 -1
  43. package/lib/ui/index.js +1 -3
  44. package/lib/ui/index.js.map +1 -1
  45. package/lib-esm/app/app.js +3 -7
  46. package/lib-esm/app/app.js.map +1 -1
  47. package/lib-esm/assets/icons.svg +26 -20
  48. package/lib-esm/assets/icons.svg.js +27 -23
  49. package/lib-esm/assets/icons.svg.js.map +1 -1
  50. package/lib-esm/components/bundle-assets/bundle-assets.js +11 -3
  51. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  52. package/lib-esm/components/bundle-assets/index.js +4 -5
  53. package/lib-esm/components/bundle-assets/index.js.map +1 -1
  54. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +47 -0
  55. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -0
  56. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.module.css +7 -0
  57. package/lib-esm/components/bundle-assets-totals/index.js +2 -0
  58. package/lib-esm/components/bundle-assets-totals/index.js.map +1 -0
  59. package/lib-esm/components/bundle-modules/bundle-modules.js +9 -2
  60. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  61. package/lib-esm/components/bundle-modules/index.js +3 -4
  62. package/lib-esm/components/bundle-modules/index.js.map +1 -1
  63. package/lib-esm/components/bundle-packages/bundle-packages.js +10 -2
  64. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  65. package/lib-esm/components/bundle-packages/index.js +4 -5
  66. package/lib-esm/components/bundle-packages/index.js.map +1 -1
  67. package/lib-esm/components/index.js +1 -2
  68. package/lib-esm/components/index.js.map +1 -1
  69. package/lib-esm/components/metrics-display-selector/index.js +2 -0
  70. package/lib-esm/components/metrics-display-selector/index.js.map +1 -0
  71. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +20 -0
  72. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -0
  73. package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +10 -0
  74. package/lib-esm/components/metrics-treemap/index.js +2 -0
  75. package/lib-esm/components/metrics-treemap/index.js.map +1 -0
  76. package/lib-esm/components/metrics-treemap/metrics-treemap.js +119 -0
  77. package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -0
  78. package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +168 -0
  79. package/lib-esm/constants.js +5 -0
  80. package/lib-esm/constants.js.map +1 -1
  81. package/lib-esm/hooks/metrics-display-type.js +36 -0
  82. package/lib-esm/hooks/metrics-display-type.js.map +1 -0
  83. package/lib-esm/hooks/show-entry.js +9 -0
  84. package/lib-esm/hooks/show-entry.js.map +1 -0
  85. package/lib-esm/ui/icon/icon.js +2 -0
  86. package/lib-esm/ui/icon/icon.js.map +1 -1
  87. package/lib-esm/ui/index.js +0 -1
  88. package/lib-esm/ui/index.js.map +1 -1
  89. package/package.json +11 -6
  90. package/src/app/app.jsx +4 -8
  91. package/src/assets/icons/table.svg +3 -0
  92. package/src/assets/icons/treemap.svg +4 -0
  93. package/src/assets/icons.svg +26 -20
  94. package/src/assets/icons.svg.jsx +91 -55
  95. package/src/components/bundle-assets/bundle-assets.jsx +25 -11
  96. package/src/components/bundle-assets/index.jsx +4 -4
  97. package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +94 -0
  98. package/src/components/bundle-assets-totals/bundle-assets-totals.module.css +7 -0
  99. package/src/components/bundle-assets-totals/index.js +1 -0
  100. package/src/components/bundle-modules/bundle-modules.tsx +26 -12
  101. package/src/components/bundle-modules/index.tsx +4 -3
  102. package/src/components/bundle-packages/bundle-packages.jsx +24 -10
  103. package/src/components/bundle-packages/index.jsx +4 -4
  104. package/src/components/index.js +1 -2
  105. package/src/components/metrics-display-selector/index.tsx +1 -0
  106. package/src/components/metrics-display-selector/metrics-display-selector.module.css +10 -0
  107. package/src/components/metrics-display-selector/metrics-display-selector.tsx +51 -0
  108. package/src/components/metrics-treemap/index.ts +1 -0
  109. package/src/components/metrics-treemap/metrics-treemap.module.css +168 -0
  110. package/src/components/metrics-treemap/metrics-treemap.stories.tsx +23 -0
  111. package/src/components/metrics-treemap/metrics-treemap.tsx +271 -0
  112. package/src/{constants.js → constants.ts} +5 -0
  113. package/src/hooks/metrics-display-type.ts +56 -0
  114. package/src/hooks/show-entry.ts +17 -0
  115. package/src/types.d.ts +2 -0
  116. package/src/ui/icon/icon.tsx +2 -0
  117. package/src/ui/index.js +0 -1
  118. package/types/components/bundle-assets/bundle-assets.d.ts +2 -1
  119. package/types/components/{bundle-assets-totals-table/bundle-assets-totals-table.d.ts → bundle-assets-totals/bundle-assets-totals.d.ts} +2 -2
  120. package/types/components/bundle-assets-totals/index.d.ts +1 -0
  121. package/types/components/bundle-modules/bundle-modules.d.ts +2 -1
  122. package/types/components/bundle-modules/index.d.ts +1 -1
  123. package/types/components/bundle-packages/bundle-packages.d.ts +1 -0
  124. package/types/components/index.d.ts +1 -2
  125. package/types/components/metrics-display-selector/index.d.ts +1 -0
  126. package/types/components/metrics-display-selector/metrics-display-selector.d.ts +9 -0
  127. package/types/components/metrics-treemap/index.d.ts +1 -0
  128. package/types/components/metrics-treemap/metrics-treemap.d.ts +9 -0
  129. package/types/constants.d.ts +19 -15
  130. package/types/hooks/metrics-display-type.d.ts +4 -0
  131. package/types/hooks/show-entry.d.ts +10 -0
  132. package/types/ui/icon/icon.d.ts +4 -0
  133. package/types/ui/index.d.ts +0 -1
  134. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +0 -95
  135. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +0 -1
  136. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css +0 -42
  137. package/lib/components/bundle-assets-totals-chart-bars/index.js.map +0 -1
  138. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +0 -57
  139. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js.map +0 -1
  140. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +0 -3
  141. package/lib/components/bundle-assets-totals-table/index.js.map +0 -1
  142. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +0 -102
  143. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js.map +0 -1
  144. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.module.css +0 -42
  145. package/lib/ui/horizontal-bar-chart/index.js.map +0 -1
  146. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +0 -66
  147. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +0 -1
  148. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css +0 -42
  149. package/lib-esm/components/bundle-assets-totals-chart-bars/index.js +0 -2
  150. package/lib-esm/components/bundle-assets-totals-chart-bars/index.js.map +0 -1
  151. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +0 -27
  152. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js.map +0 -1
  153. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +0 -3
  154. package/lib-esm/components/bundle-assets-totals-table/index.js +0 -2
  155. package/lib-esm/components/bundle-assets-totals-table/index.js.map +0 -1
  156. package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +0 -96
  157. package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js.map +0 -1
  158. package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.module.css +0 -42
  159. package/lib-esm/ui/horizontal-bar-chart/index.js +0 -2
  160. package/lib-esm/ui/horizontal-bar-chart/index.js.map +0 -1
  161. package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +0 -106
  162. package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css +0 -42
  163. package/src/components/bundle-assets-totals-chart-bars/index.js +0 -1
  164. package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx +0 -55
  165. package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +0 -3
  166. package/src/components/bundle-assets-totals-table/index.js +0 -1
  167. package/src/ui/horizontal-bar-chart/horizontal-bar-chart.jsx +0 -156
  168. package/src/ui/horizontal-bar-chart/horizontal-bar-chart.module.css +0 -42
  169. package/src/ui/horizontal-bar-chart/index.js +0 -1
  170. package/types/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.d.ts +0 -22
  171. package/types/components/bundle-assets-totals-chart-bars/index.d.ts +0 -1
  172. package/types/components/bundle-assets-totals-table/index.d.ts +0 -1
  173. package/types/ui/horizontal-bar-chart/horizontal-bar-chart.d.ts +0 -23
  174. package/types/ui/horizontal-bar-chart/index.d.ts +0 -1
@@ -1,42 +0,0 @@
1
- .root {
2
- background: var(--color-highlight);
3
- display: flex;
4
- align-items: stretch;
5
- justify-content: flex-start;
6
- width: 100%;
7
- overflow: hidden;
8
- }
9
-
10
- .item {
11
- flex: 0 1 auto;
12
- background: var(--color-text);
13
- display: inline-flex;
14
- min-width: var(--space-xxxsmall);
15
- min-height: var(--space-medium);
16
- }
17
-
18
- .itemContent {
19
- display: flex;
20
- width: 100%;
21
- height: 100%;
22
- padding: var(--space-xxsmall);
23
- align-items: center;
24
- justify-content: center;
25
-
26
- color: var(--color-background);
27
- font-weight: bold;
28
- text-overflow: ellipsis;
29
- text-align: center;
30
- }
31
-
32
- .itemLabel {
33
- position: absolute;
34
- left: 50%;
35
- top: 50%;
36
- transform: translate(-50%, -50%);
37
- visibility: visible;
38
- }
39
-
40
- .textOverflowed .itemLabel {
41
- visibility: hidden;
42
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/horizontal-bar-chart/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import map from 'lodash/map';
5
- import max from 'lodash/max';
6
- import sum from 'lodash/sum';
7
- import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
8
- import { getBundleAssetsFileTypeComponentLink, getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
9
- import { ASSETS_SIZES_FILE_TYPE_MAP } from '../../constants';
10
- import { HorizontalBarChart } from '../../ui/horizontal-bar-chart';
11
- import { ComponentLink } from '../component-link';
12
- import { getColors } from '../../utils';
13
- import { Stack } from '../../layout/stack';
14
- import { JobName } from '../job-name';
15
- import { MetricRunInfo } from '../metric-run-info';
16
- import css from './bundle-assets-totals-chart-bars.module.css';
17
- const getTooltip = (items, jobs, itemIndex, runIndex) => () => {
18
- var _a, _b, _c, _d, _e, _f, _g;
19
- const metricId = (_a = items === null || items === void 0 ? void 0 : items[itemIndex]) === null || _a === void 0 ? void 0 : _a.key;
20
- const current = ((_d = (_c = (_b = items === null || items === void 0 ? void 0 : items[itemIndex]) === null || _b === void 0 ? void 0 : _b.runs) === null || _c === void 0 ? void 0 : _c[runIndex]) === null || _d === void 0 ? void 0 : _d.value) || 0;
21
- const baseline = (_g = (_f = (_e = items === null || items === void 0 ? void 0 : items[itemIndex]) === null || _e === void 0 ? void 0 : _e.runs) === null || _f === void 0 ? void 0 : _f[runIndex + 1]) === null || _g === void 0 ? void 0 : _g.value;
22
- return (React.createElement(MetricRunInfo, { className: css.itemTooltip, metricId: metricId, current: current, baseline: baseline, showMetridDescription: false, size: "large" }));
23
- };
24
- export const BundleAssetsTotalsChartBars = ({ className, jobs, customComponentLink: CustomComponentLink, }) => {
25
- const rootClassName = cx(css.root, className);
26
- const items = webpack.compareBySection.sizes(jobs);
27
- const dataGraphs = [];
28
- items.forEach(({ runs }) => {
29
- runs.forEach((run, runIndex) => {
30
- dataGraphs[runIndex] = [...(dataGraphs[runIndex] || []), (run === null || run === void 0 ? void 0 : run.value) || 0];
31
- });
32
- });
33
- const maxValues = max(map(dataGraphs, (values) => sum(values)));
34
- const maxValue = max(maxValues);
35
- const labels = items.map(({ key, label }) => {
36
- const fileType = ASSETS_SIZES_FILE_TYPE_MAP[key];
37
- const componentData = getBundleAssetsFileTypeComponentLink(fileType, label);
38
- return (React.createElement(CustomComponentLink, { className: css.itemLink, ...componentData }, label));
39
- });
40
- const colors = getColors(max(map(dataGraphs, (values) => values.length)));
41
- return (React.createElement(Stack, { className: rootClassName, space: "small" }, dataGraphs.map((data, runIndex) => {
42
- const { internalBuildNumber } = jobs[runIndex];
43
- const values = data.map((value, valueIndex) => ({
44
- value,
45
- color: colors[valueIndex],
46
- label: labels[valueIndex],
47
- getItemTooltip: getTooltip(items, jobs, valueIndex, runIndex),
48
- }));
49
- return (React.createElement("div", { key: internalBuildNumber || runIndex, className: css.item },
50
- React.createElement("h3", { className: css.itemTitle },
51
- React.createElement(JobName, { internalBuildNumber: internalBuildNumber })),
52
- React.createElement(HorizontalBarChart, { className: css.itemChart, data: { labels, values }, maxValue: maxValue })));
53
- })));
54
- };
55
- BundleAssetsTotalsChartBars.defaultProps = {
56
- className: '',
57
- customComponentLink: ComponentLink,
58
- };
59
- BundleAssetsTotalsChartBars.propTypes = {
60
- className: PropTypes.string,
61
- jobs: PropTypes.arrayOf(PropTypes.shape({
62
- internalBuildNumber: PropTypes.number,
63
- })).isRequired,
64
- customComponentLink: PropTypes.elementType,
65
- };
66
- //# sourceMappingURL=bundle-assets-totals-chart-bars.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":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xF,oBAAC,kBAAkB,IACjB,SAAS,EAAE,GAAG,CAAC,SAAS,EACxB,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EACxB,QAAQ,EAAE,QAAQ,GAClB,CACE,CACP,CAAC;IACJ,CAAC,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,2BAA2B,CAAC,YAAY,GAAG;IACzC,SAAS,EAAE,EAAE;IACb,mBAAmB,EAAE,aAAa;CACnC,CAAC;AAEF,2BAA2B,CAAC,SAAS,GAAG;IACtC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,IAAI,EAAE,SAAS,CAAC,OAAO,CACrB,SAAS,CAAC,KAAK,CAAC;QACd,mBAAmB,EAAE,SAAS,CAAC,MAAM;KACtC,CAAC,CACH,CAAC,UAAU;IACZ,mBAAmB,EAAE,SAAS,CAAC,WAAW;CAC3C,CAAC"}
@@ -1,42 +0,0 @@
1
- .item {
2
- position: relative;
3
- }
4
-
5
- .itemTitle {
6
- position: absolute;
7
- right: 0;
8
- bottom: 100%;
9
- margin: 0 0 2px;
10
-
11
- color: var(--color-text-light);
12
- font-size: var(--size-xsmall);
13
- font-weight: bold;
14
- line-height: 1.1;
15
- text-transform: uppercase;
16
- }
17
-
18
- .item:hover .itemTitle {
19
- color: var(--color-text);
20
- }
21
-
22
- .itemChart {
23
- height: var(--space-large);
24
- }
25
-
26
- .itemTooltip {
27
- padding: var(--space-xxsmall) var(--space-xxxsmall);
28
- min-width: 240px;
29
- text-align: left;
30
- font-size: var(--size-medium);
31
- line-height: var(--line-height);
32
- }
33
-
34
- .itemLink {
35
- color: inherit;
36
- text-decoration: none;
37
- }
38
-
39
- .itemLink:hover {
40
- color: inherit;
41
- text-decoration: underline;
42
- }
@@ -1,2 +0,0 @@
1
- export * from './bundle-assets-totals-chart-bars';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-chart-bars/index.js"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getBundleAssetsFileTypeComponentLink } from '@bundle-stats/utils';
4
- import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
5
- import { ASSETS_SIZES_FILE_TYPE_MAP } from '../../constants';
6
- import { MetricsTable } from '../metrics-table';
7
- import { ComponentLink } from '../component-link';
8
- export const BundleAssetsTotalsTable = ({ className, jobs, customComponentLink: CustomComponentLink, ...restProps }) => {
9
- const items = webpack.compareBySection.sizes(jobs);
10
- const renderRowHeader = (item) => {
11
- const fileType = ASSETS_SIZES_FILE_TYPE_MAP[item.key];
12
- const { section, title, params } = getBundleAssetsFileTypeComponentLink(fileType, item.label);
13
- return (React.createElement(CustomComponentLink, { section: section, title: title, params: params }, item.label));
14
- };
15
- return (React.createElement(MetricsTable, { className: className, runs: jobs, items: items, renderRowHeader: renderRowHeader, showHeaderSum: true, ...restProps }));
16
- };
17
- BundleAssetsTotalsTable.defaultProps = {
18
- className: '',
19
- jobs: [],
20
- customComponentLink: ComponentLink,
21
- };
22
- BundleAssetsTotalsTable.propTypes = {
23
- className: PropTypes.string,
24
- jobs: PropTypes.array,
25
- customComponentLink: PropTypes.elementType,
26
- };
27
- //# sourceMappingURL=bundle-assets-totals-table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle-assets-totals-table.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,oCAAoC,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,OAAO,MAAM,qCAAqC,CAAC;AAE/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,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
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-table/index.js"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import round from 'lodash/round';
4
- import sum from 'lodash/sum';
5
- import cx from 'classnames';
6
- import { getColors } from '../../utils';
7
- import { Tooltip } from '../tooltip';
8
- import css from './horizontal-bar-chart.module.css';
9
- class HorizontalBarChartItem extends React.Component {
10
- constructor(props) {
11
- super(props);
12
- this.textRef = React.createRef();
13
- this.ref = React.createRef();
14
- this.state = {
15
- isTextOverflowing: true,
16
- };
17
- }
18
- componentDidMount() {
19
- var _a, _b, _c, _d;
20
- const wrapperWidth = ((_b = (_a = this.ref) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.clientWidth) || 0;
21
- const textWidth = ((_d = (_c = this.textRef) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.scrollWidth) || 0;
22
- if (wrapperWidth >= (textWidth + 2 * 4)) {
23
- this.setState({ isTextOverflowing: false });
24
- }
25
- }
26
- render() {
27
- const { color, label, getItemTooltip, width, } = this.props;
28
- const { isTextOverflowing } = this.state;
29
- const tooltipContent = getItemTooltip();
30
- return (React.createElement("span", { className: cx(css.item, isTextOverflowing && css.textOverflowed), style: {
31
- width,
32
- background: color,
33
- }, ref: this.ref },
34
- React.createElement(Tooltip, { className: css.itemContent, title: tooltipContent, darkMode: false },
35
- React.createElement("span", { className: css.itemLabel, ref: this.textRef }, label))));
36
- }
37
- }
38
- HorizontalBarChartItem.propTypes = {
39
- width: PropTypes.string.isRequired,
40
- color: PropTypes.string.isRequired,
41
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
42
- getItemTooltip: PropTypes.func,
43
- };
44
- HorizontalBarChartItem.defaultProps = {
45
- getItemTooltip: () => null,
46
- };
47
- const getTotalValues = (values) => sum(values.map((entry) => {
48
- if (typeof entry === 'object') {
49
- return entry.value;
50
- }
51
- return entry;
52
- }));
53
- export const HorizontalBarChart = (props) => {
54
- const { className, data, maxValue } = props;
55
- const { labels, values } = data;
56
- const defaultColors = getColors(labels.length);
57
- const total = maxValue || getTotalValues(values);
58
- const entries = values.reduce((agg, entry, index) => {
59
- const { value, color = defaultColors[index], label = labels[index], getItemTooltip, } = typeof entry === 'object' ? entry : { value: entry };
60
- const width = `${round((value / total) * 100, 2)}%`;
61
- return [
62
- ...agg,
63
- {
64
- value,
65
- width,
66
- color,
67
- label,
68
- getItemTooltip,
69
- },
70
- ];
71
- }, []);
72
- return (React.createElement("div", { className: cx(css.root, className) }, entries.map(({ color, getItemTooltip, label, width, }, index) => {
73
- const key = index;
74
- return (React.createElement(HorizontalBarChartItem, { key: key, width: width, color: color, label: label, getItemTooltip: getItemTooltip, className: css.item }));
75
- })));
76
- };
77
- HorizontalBarChart.defaultProps = {
78
- className: '',
79
- maxValue: null,
80
- };
81
- HorizontalBarChart.propTypes = {
82
- className: PropTypes.string,
83
- data: PropTypes.shape({
84
- labels: PropTypes.arrayOf(PropTypes.string),
85
- values: PropTypes.arrayOf(PropTypes.oneOfType([
86
- PropTypes.number,
87
- PropTypes.shape({
88
- value: PropTypes.number,
89
- color: PropTypes.string,
90
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
91
- }),
92
- ])),
93
- }).isRequired,
94
- maxValue: PropTypes.number,
95
- };
96
- //# sourceMappingURL=horizontal-bar-chart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"horizontal-bar-chart.js","sourceRoot":"","sources":["../../../src/ui/horizontal-bar-chart/horizontal-bar-chart.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,GAAG,MAAM,YAAY,C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,GAAG;IAE7B,SAAS,EAAE,SAAS,CAAC,MAAM;IAG3B,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC;QACpB,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;QAC3C,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;YAC5C,SAAS,CAAC,MAAM;YAChB,SAAS,CAAC,KAAK,CAAC;gBACd,KAAK,EAAE,SAAS,CAAC,MAAM;gBACvB,KAAK,EAAE,SAAS,CAAC,MAAM;gBACvB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;aAClE,CAAC;SACH,CAAC,CAAC;KACJ,CAAC,CAAC,UAAU;IAGb,QAAQ,EAAE,SAAS,CAAC,MAAM;CAC3B,CAAC"}
@@ -1,42 +0,0 @@
1
- .root {
2
- background: var(--color-highlight);
3
- display: flex;
4
- align-items: stretch;
5
- justify-content: flex-start;
6
- width: 100%;
7
- overflow: hidden;
8
- }
9
-
10
- .item {
11
- flex: 0 1 auto;
12
- background: var(--color-text);
13
- display: inline-flex;
14
- min-width: var(--space-xxxsmall);
15
- min-height: var(--space-medium);
16
- }
17
-
18
- .itemContent {
19
- display: flex;
20
- width: 100%;
21
- height: 100%;
22
- padding: var(--space-xxsmall);
23
- align-items: center;
24
- justify-content: center;
25
-
26
- color: var(--color-background);
27
- font-weight: bold;
28
- text-overflow: ellipsis;
29
- text-align: center;
30
- }
31
-
32
- .itemLabel {
33
- position: absolute;
34
- left: 50%;
35
- top: 50%;
36
- transform: translate(-50%, -50%);
37
- visibility: visible;
38
- }
39
-
40
- .textOverflowed .itemLabel {
41
- visibility: hidden;
42
- }
@@ -1,2 +0,0 @@
1
- export * from './horizontal-bar-chart';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/horizontal-bar-chart/index.js"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -1,106 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import map from 'lodash/map';
5
- import max from 'lodash/max';
6
- import sum from 'lodash/sum';
7
- import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
8
- import { getBundleAssetsFileTypeComponentLink, getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
9
-
10
- import { ASSETS_SIZES_FILE_TYPE_MAP } from '../../constants';
11
- import { HorizontalBarChart } from '../../ui/horizontal-bar-chart';
12
- import { ComponentLink } from '../component-link'
13
- import { getColors } from '../../utils';
14
- import { Stack } from '../../layout/stack';
15
- import { JobName } from '../job-name';
16
- import { MetricRunInfo } from '../metric-run-info';
17
- import css from './bundle-assets-totals-chart-bars.module.css';
18
-
19
- const getTooltip = (items, jobs, itemIndex, runIndex) => () => {
20
- const metricId = items?.[itemIndex]?.key;
21
- const current = items?.[itemIndex]?.runs?.[runIndex]?.value || 0;
22
- const baseline = items?.[itemIndex]?.runs?.[runIndex + 1]?.value;
23
-
24
- return (
25
- <MetricRunInfo
26
- className={css.itemTooltip}
27
- metricId={metricId}
28
- current={current}
29
- baseline={baseline}
30
- showMetridDescription={false}
31
- size="large"
32
- />
33
- );
34
- };
35
-
36
- export const BundleAssetsTotalsChartBars = ({
37
- className,
38
- jobs,
39
- customComponentLink: CustomComponentLink,
40
- }) => {
41
- const rootClassName = cx(css.root, className);
42
- const items = webpack.compareBySection.sizes(jobs);
43
-
44
- const dataGraphs = [];
45
-
46
- items.forEach(({ runs }) => {
47
- runs.forEach((run, runIndex) => {
48
- dataGraphs[runIndex] = [...(dataGraphs[runIndex] || []), run?.value || 0];
49
- });
50
- });
51
-
52
- const maxValues = max(map(dataGraphs, (values) => sum(values)));
53
- const maxValue = max(maxValues);
54
-
55
- const labels = items.map(({ key, label }) => {
56
- const fileType = ASSETS_SIZES_FILE_TYPE_MAP[key];
57
- const componentData = getBundleAssetsFileTypeComponentLink(fileType, label);
58
- return (
59
- <CustomComponentLink className={css.itemLink} {...componentData}>
60
- {label}
61
- </CustomComponentLink>
62
- );
63
- });
64
- const colors = getColors(max(map(dataGraphs, (values) => values.length)));
65
-
66
- return (
67
- <Stack className={rootClassName} space="small">
68
- {dataGraphs.map((data, runIndex) => {
69
- const { internalBuildNumber } = jobs[runIndex];
70
-
71
- const values = data.map((value, valueIndex) => ({
72
- value,
73
- color: colors[valueIndex],
74
- label: labels[valueIndex],
75
- getItemTooltip: getTooltip(items, jobs, valueIndex, runIndex),
76
- }));
77
-
78
- return (
79
- <div key={internalBuildNumber || runIndex} className={css.item}>
80
- <h3 className={css.itemTitle}><JobName internalBuildNumber={internalBuildNumber} /></h3>
81
- <HorizontalBarChart
82
- className={css.itemChart}
83
- data={{ labels, values }}
84
- maxValue={maxValue}
85
- />
86
- </div>
87
- );
88
- })}
89
- </Stack>
90
- );
91
- };
92
-
93
- BundleAssetsTotalsChartBars.defaultProps = {
94
- className: '',
95
- customComponentLink: ComponentLink,
96
- };
97
-
98
- BundleAssetsTotalsChartBars.propTypes = {
99
- className: PropTypes.string,
100
- jobs: PropTypes.arrayOf(
101
- PropTypes.shape({
102
- internalBuildNumber: PropTypes.number,
103
- }),
104
- ).isRequired,
105
- customComponentLink: PropTypes.elementType,
106
- };
@@ -1,42 +0,0 @@
1
- .item {
2
- position: relative;
3
- }
4
-
5
- .itemTitle {
6
- position: absolute;
7
- right: 0;
8
- bottom: 100%;
9
- margin: 0 0 2px;
10
-
11
- color: var(--color-text-light);
12
- font-size: var(--size-xsmall);
13
- font-weight: bold;
14
- line-height: 1.1;
15
- text-transform: uppercase;
16
- }
17
-
18
- .item:hover .itemTitle {
19
- color: var(--color-text);
20
- }
21
-
22
- .itemChart {
23
- height: var(--space-large);
24
- }
25
-
26
- .itemTooltip {
27
- padding: var(--space-xxsmall) var(--space-xxxsmall);
28
- min-width: 240px;
29
- text-align: left;
30
- font-size: var(--size-medium);
31
- line-height: var(--line-height);
32
- }
33
-
34
- .itemLink {
35
- color: inherit;
36
- text-decoration: none;
37
- }
38
-
39
- .itemLink:hover {
40
- color: inherit;
41
- text-decoration: underline;
42
- }
@@ -1 +0,0 @@
1
- export * from './bundle-assets-totals-chart-bars';
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getBundleAssetsFileTypeComponentLink } from '@bundle-stats/utils';
4
- import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
5
-
6
- import { ASSETS_SIZES_FILE_TYPE_MAP } from '../../constants';
7
- import { MetricsTable } from '../metrics-table';
8
- import { ComponentLink } from '../component-link';
9
-
10
- export const BundleAssetsTotalsTable = ({
11
- className,
12
- jobs,
13
- customComponentLink: CustomComponentLink,
14
- ...restProps
15
- }) => {
16
- const items = webpack.compareBySection.sizes(jobs);
17
-
18
- const renderRowHeader = (item) => {
19
- const fileType = ASSETS_SIZES_FILE_TYPE_MAP[item.key];
20
- const { section, title, params } = getBundleAssetsFileTypeComponentLink(fileType, item.label);
21
-
22
- return (
23
- <CustomComponentLink section={section} title={title} params={params}>
24
- {item.label}
25
- </CustomComponentLink>
26
- );
27
- };
28
-
29
- return (
30
- <MetricsTable
31
- className={className}
32
- runs={jobs}
33
- items={items}
34
- renderRowHeader={renderRowHeader}
35
- showHeaderSum
36
- {...restProps}
37
- />
38
- );
39
- };
40
-
41
- BundleAssetsTotalsTable.defaultProps = {
42
- className: '',
43
- jobs: [],
44
- customComponentLink: ComponentLink,
45
- };
46
-
47
- BundleAssetsTotalsTable.propTypes = {
48
- /** Addopted child class name */
49
- className: PropTypes.string,
50
-
51
- /** Jobs data */
52
- jobs: PropTypes.array, // eslint-disable-line react/forbid-prop-types
53
-
54
- customComponentLink: PropTypes.elementType,
55
- };
@@ -1,3 +0,0 @@
1
- .title {
2
- color: var(--color-text-light);
3
- }
@@ -1 +0,0 @@
1
- export * from './bundle-assets-totals-table';