@bundle-stats/ui 4.12.1 → 4.13.0-beta.2
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.
- package/lib/app/app.js +3 -7
- package/lib/app/app.js.map +1 -1
- package/lib/assets/icons.svg +26 -20
- package/lib/assets/icons.svg.js +27 -23
- package/lib/assets/icons.svg.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +11 -3
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/index.js +3 -4
- package/lib/components/bundle-assets/index.js.map +1 -1
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +77 -0
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -0
- package/lib/components/bundle-assets-totals/bundle-assets-totals.module.css +7 -0
- package/lib/{ui/horizontal-bar-chart → components/bundle-assets-totals}/index.js +1 -1
- package/lib/components/bundle-assets-totals/index.js.map +1 -0
- package/lib/components/bundle-modules/bundle-modules.js +9 -2
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/index.js +3 -4
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +10 -2
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/index.js +3 -4
- package/lib/components/bundle-packages/index.js.map +1 -1
- package/lib/components/index.js +3 -5
- package/lib/components/index.js.map +1 -1
- package/lib/components/{bundle-assets-totals-table → metrics-display-selector}/index.js +1 -1
- package/lib/components/metrics-display-selector/index.js.map +1 -0
- package/lib/components/metrics-display-selector/metrics-display-selector.js +21 -0
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -0
- package/lib/components/metrics-display-selector/metrics-display-selector.module.css +10 -0
- package/lib/components/{bundle-assets-totals-chart-bars → metrics-treemap}/index.js +1 -1
- package/lib/components/metrics-treemap/index.js.map +1 -0
- package/lib/components/metrics-treemap/metrics-treemap.js +168 -0
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -0
- package/lib/components/metrics-treemap/metrics-treemap.module.css +184 -0
- package/lib/constants.js +6 -1
- package/lib/constants.js.map +1 -1
- package/lib/hooks/entry-info.js +12 -0
- package/lib/hooks/entry-info.js.map +1 -0
- package/lib/hooks/metrics-display-type.js +40 -0
- package/lib/hooks/metrics-display-type.js.map +1 -0
- package/lib/query-state.js +1 -1
- package/lib/query-state.js.map +1 -1
- package/lib/ui/button/button.module.css +1 -0
- package/lib/ui/icon/icon.js +2 -0
- package/lib/ui/icon/icon.js.map +1 -1
- package/lib/ui/index.js +1 -3
- package/lib/ui/index.js.map +1 -1
- package/lib-esm/app/app.js +3 -7
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/assets/icons.svg +26 -20
- package/lib-esm/assets/icons.svg.js +27 -23
- package/lib-esm/assets/icons.svg.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +11 -3
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/index.js +5 -6
- package/lib-esm/components/bundle-assets/index.js.map +1 -1
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +47 -0
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -0
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.module.css +7 -0
- package/lib-esm/components/bundle-assets-totals/index.js +2 -0
- package/lib-esm/components/bundle-assets-totals/index.js.map +1 -0
- package/lib-esm/components/bundle-modules/bundle-modules.js +9 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/index.js +3 -4
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +10 -2
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/index.js +5 -6
- package/lib-esm/components/bundle-packages/index.js.map +1 -1
- package/lib-esm/components/index.js +1 -2
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/index.js +2 -0
- package/lib-esm/components/metrics-display-selector/index.js.map +1 -0
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +14 -0
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -0
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +10 -0
- package/lib-esm/components/metrics-treemap/index.js +2 -0
- package/lib-esm/components/metrics-treemap/index.js.map +1 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.js +140 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +184 -0
- package/lib-esm/constants.js +5 -0
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/hooks/entry-info.js +8 -0
- package/lib-esm/hooks/entry-info.js.map +1 -0
- package/lib-esm/hooks/metrics-display-type.js +36 -0
- package/lib-esm/hooks/metrics-display-type.js.map +1 -0
- package/lib-esm/query-state.js +1 -1
- package/lib-esm/query-state.js.map +1 -1
- package/lib-esm/ui/button/button.module.css +1 -0
- package/lib-esm/ui/icon/icon.js +2 -0
- package/lib-esm/ui/icon/icon.js.map +1 -1
- package/lib-esm/ui/index.js +0 -1
- package/lib-esm/ui/index.js.map +1 -1
- package/package.json +7 -4
- package/src/app/app.jsx +4 -8
- package/src/assets/icons/table.svg +3 -0
- package/src/assets/icons/treemap.svg +4 -0
- package/src/assets/icons.svg +26 -20
- package/src/assets/icons.svg.jsx +91 -55
- package/src/components/bundle-assets/bundle-assets.jsx +25 -11
- package/src/components/bundle-assets/index.jsx +10 -5
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +94 -0
- package/src/components/bundle-assets-totals/bundle-assets-totals.module.css +7 -0
- package/src/components/bundle-assets-totals/index.js +1 -0
- package/src/components/bundle-modules/bundle-modules.tsx +26 -12
- package/src/components/bundle-modules/index.tsx +4 -3
- package/src/components/bundle-packages/bundle-packages.jsx +24 -10
- package/src/components/bundle-packages/index.jsx +10 -5
- package/src/components/index.js +1 -2
- package/src/components/metrics-display-selector/index.tsx +1 -0
- package/src/components/metrics-display-selector/metrics-display-selector.module.css +10 -0
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +47 -0
- package/src/components/metrics-treemap/index.ts +1 -0
- package/src/components/metrics-treemap/metrics-treemap.module.css +184 -0
- package/src/components/metrics-treemap/metrics-treemap.stories.tsx +23 -0
- package/src/components/metrics-treemap/metrics-treemap.tsx +308 -0
- package/src/{constants.js → constants.ts} +5 -0
- package/src/hooks/entry-info.ts +19 -0
- package/src/hooks/metrics-display-type.ts +56 -0
- package/src/query-state.tsx +1 -1
- package/src/types.d.ts +2 -0
- package/src/ui/button/button.module.css +1 -0
- package/src/ui/icon/icon.tsx +2 -0
- package/src/ui/index.js +0 -1
- package/types/components/bundle-assets/bundle-assets.d.ts +2 -1
- package/types/components/{bundle-assets-totals-table/bundle-assets-totals-table.d.ts → bundle-assets-totals/bundle-assets-totals.d.ts} +2 -2
- package/types/components/bundle-assets-totals/index.d.ts +1 -0
- package/types/components/bundle-modules/bundle-modules.d.ts +2 -1
- package/types/components/bundle-modules/index.d.ts +1 -1
- package/types/components/bundle-packages/bundle-packages.d.ts +1 -0
- package/types/components/index.d.ts +1 -2
- package/types/components/metrics-display-selector/index.d.ts +1 -0
- package/types/components/metrics-display-selector/metrics-display-selector.d.ts +9 -0
- package/types/components/metrics-treemap/index.d.ts +1 -0
- package/types/components/metrics-treemap/metrics-treemap.d.ts +9 -0
- package/types/constants.d.ts +19 -15
- package/types/hooks/entry-info.d.ts +8 -0
- package/types/hooks/metrics-display-type.d.ts +4 -0
- package/types/ui/icon/icon.d.ts +4 -0
- package/types/ui/index.d.ts +0 -1
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +0 -95
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +0 -1
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css +0 -42
- package/lib/components/bundle-assets-totals-chart-bars/index.js.map +0 -1
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +0 -57
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js.map +0 -1
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +0 -3
- package/lib/components/bundle-assets-totals-table/index.js.map +0 -1
- package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +0 -102
- package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js.map +0 -1
- package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.module.css +0 -42
- package/lib/ui/horizontal-bar-chart/index.js.map +0 -1
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +0 -66
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +0 -1
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css +0 -42
- package/lib-esm/components/bundle-assets-totals-chart-bars/index.js +0 -2
- package/lib-esm/components/bundle-assets-totals-chart-bars/index.js.map +0 -1
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +0 -27
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js.map +0 -1
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +0 -3
- package/lib-esm/components/bundle-assets-totals-table/index.js +0 -2
- package/lib-esm/components/bundle-assets-totals-table/index.js.map +0 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +0 -96
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js.map +0 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.module.css +0 -42
- package/lib-esm/ui/horizontal-bar-chart/index.js +0 -2
- package/lib-esm/ui/horizontal-bar-chart/index.js.map +0 -1
- package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +0 -106
- package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css +0 -42
- package/src/components/bundle-assets-totals-chart-bars/index.js +0 -1
- package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx +0 -55
- package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +0 -3
- package/src/components/bundle-assets-totals-table/index.js +0 -1
- package/src/ui/horizontal-bar-chart/horizontal-bar-chart.jsx +0 -156
- package/src/ui/horizontal-bar-chart/horizontal-bar-chart.module.css +0 -42
- package/src/ui/horizontal-bar-chart/index.js +0 -1
- package/types/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.d.ts +0 -22
- package/types/components/bundle-assets-totals-chart-bars/index.d.ts +0 -1
- package/types/components/bundle-assets-totals-table/index.d.ts +0 -1
- package/types/ui/horizontal-bar-chart/horizontal-bar-chart.d.ts +0 -23
- package/types/ui/horizontal-bar-chart/index.d.ts +0 -1
|
@@ -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,CAAC;AAC7B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,GAAG,MAAM,mCAAmC,CAAC;AAEpD,MAAM,sBAAuB,SAAQ,KAAK,CAAC,SAAS;IAClD,YAAY,KAAK;QACf,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,SAAS,EAAE,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,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 +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
|
-
};
|
package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.module.css
DELETED
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export * from './bundle-assets-totals-table';
|
|
@@ -1,156 +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
|
-
|
|
7
|
-
import { getColors } from '../../utils';
|
|
8
|
-
import { Tooltip } from '../tooltip';
|
|
9
|
-
import css from './horizontal-bar-chart.module.css';
|
|
10
|
-
|
|
11
|
-
class HorizontalBarChartItem extends React.Component {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super(props);
|
|
14
|
-
|
|
15
|
-
this.textRef = React.createRef();
|
|
16
|
-
this.ref = React.createRef();
|
|
17
|
-
|
|
18
|
-
this.state = {
|
|
19
|
-
isTextOverflowing: true,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
const wrapperWidth = this.ref?.current?.clientWidth || 0;
|
|
25
|
-
const textWidth = this.textRef?.current?.scrollWidth || 0;
|
|
26
|
-
|
|
27
|
-
if (wrapperWidth >= (textWidth + 2 * 4)) {
|
|
28
|
-
this.setState({ isTextOverflowing: false });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
const {
|
|
34
|
-
color, label, getItemTooltip, width,
|
|
35
|
-
} = this.props;
|
|
36
|
-
const { isTextOverflowing } = this.state;
|
|
37
|
-
const tooltipContent = getItemTooltip();
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<span
|
|
41
|
-
className={cx(css.item, isTextOverflowing && css.textOverflowed)}
|
|
42
|
-
style={{
|
|
43
|
-
width,
|
|
44
|
-
background: color,
|
|
45
|
-
}}
|
|
46
|
-
ref={this.ref}
|
|
47
|
-
>
|
|
48
|
-
<Tooltip
|
|
49
|
-
className={css.itemContent}
|
|
50
|
-
title={tooltipContent}
|
|
51
|
-
darkMode={false}
|
|
52
|
-
>
|
|
53
|
-
<span className={css.itemLabel} ref={this.textRef}>
|
|
54
|
-
{label}
|
|
55
|
-
</span>
|
|
56
|
-
</Tooltip>
|
|
57
|
-
</span>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
HorizontalBarChartItem.propTypes = {
|
|
63
|
-
width: PropTypes.string.isRequired,
|
|
64
|
-
color: PropTypes.string.isRequired,
|
|
65
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
66
|
-
getItemTooltip: PropTypes.func,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
HorizontalBarChartItem.defaultProps = {
|
|
70
|
-
getItemTooltip: () => null,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const getTotalValues = (values) => sum(values.map((entry) => {
|
|
74
|
-
if (typeof entry === 'object') {
|
|
75
|
-
return entry.value;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return entry;
|
|
79
|
-
}));
|
|
80
|
-
|
|
81
|
-
export const HorizontalBarChart = (props) => {
|
|
82
|
-
const { className, data, maxValue } = props;
|
|
83
|
-
const { labels, values } = data;
|
|
84
|
-
|
|
85
|
-
const defaultColors = getColors(labels.length);
|
|
86
|
-
const total = maxValue || getTotalValues(values);
|
|
87
|
-
|
|
88
|
-
const entries = values.reduce((agg, entry, index) => {
|
|
89
|
-
const {
|
|
90
|
-
value,
|
|
91
|
-
color = defaultColors[index],
|
|
92
|
-
label = labels[index],
|
|
93
|
-
getItemTooltip,
|
|
94
|
-
} = typeof entry === 'object' ? entry : { value: entry };
|
|
95
|
-
|
|
96
|
-
const width = `${round((value / total) * 100, 2)}%`;
|
|
97
|
-
|
|
98
|
-
return [
|
|
99
|
-
...agg,
|
|
100
|
-
{
|
|
101
|
-
value,
|
|
102
|
-
width,
|
|
103
|
-
color,
|
|
104
|
-
label,
|
|
105
|
-
getItemTooltip,
|
|
106
|
-
},
|
|
107
|
-
];
|
|
108
|
-
}, []);
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<div className={cx(css.root, className)}>
|
|
112
|
-
{entries.map(({
|
|
113
|
-
color, getItemTooltip, label, width,
|
|
114
|
-
}, index) => {
|
|
115
|
-
const key = index;
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<HorizontalBarChartItem
|
|
119
|
-
key={key}
|
|
120
|
-
width={width}
|
|
121
|
-
color={color}
|
|
122
|
-
label={label}
|
|
123
|
-
getItemTooltip={getItemTooltip}
|
|
124
|
-
className={css.item}
|
|
125
|
-
/>
|
|
126
|
-
);
|
|
127
|
-
})}
|
|
128
|
-
</div>
|
|
129
|
-
);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
HorizontalBarChart.defaultProps = {
|
|
133
|
-
className: '',
|
|
134
|
-
maxValue: null,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
HorizontalBarChart.propTypes = {
|
|
138
|
-
/** Adopted child class name */
|
|
139
|
-
className: PropTypes.string,
|
|
140
|
-
|
|
141
|
-
/** Data */
|
|
142
|
-
data: PropTypes.shape({
|
|
143
|
-
labels: PropTypes.arrayOf(PropTypes.string),
|
|
144
|
-
values: PropTypes.arrayOf(PropTypes.oneOfType([
|
|
145
|
-
PropTypes.number,
|
|
146
|
-
PropTypes.shape({
|
|
147
|
-
value: PropTypes.number,
|
|
148
|
-
color: PropTypes.string,
|
|
149
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
150
|
-
}),
|
|
151
|
-
])),
|
|
152
|
-
}).isRequired,
|
|
153
|
-
|
|
154
|
-
/** Mac value */
|
|
155
|
-
maxValue: PropTypes.number,
|
|
156
|
-
};
|
|
@@ -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
|
-
export * from './horizontal-bar-chart';
|
package/types/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function BundleAssetsTotalsChartBars({ className, jobs, customComponentLink: CustomComponentLink, }: {
|
|
2
|
-
className: any;
|
|
3
|
-
jobs: any;
|
|
4
|
-
customComponentLink: any;
|
|
5
|
-
}): React.JSX.Element;
|
|
6
|
-
export namespace BundleAssetsTotalsChartBars {
|
|
7
|
-
namespace defaultProps {
|
|
8
|
-
export let className: string;
|
|
9
|
-
export { ComponentLink as customComponentLink };
|
|
10
|
-
}
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
let className_1: PropTypes.Requireable<string>;
|
|
13
|
-
export { className_1 as className };
|
|
14
|
-
export let jobs: PropTypes.Validator<(PropTypes.InferProps<{
|
|
15
|
-
internalBuildNumber: PropTypes.Requireable<number>;
|
|
16
|
-
}> | null | undefined)[]>;
|
|
17
|
-
export let customComponentLink: PropTypes.Requireable<PropTypes.ReactComponentLike>;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
import React from 'react';
|
|
21
|
-
import { ComponentLink } from '../component-link';
|
|
22
|
-
import PropTypes from 'prop-types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./bundle-assets-totals-chart-bars";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./bundle-assets-totals-table";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function HorizontalBarChart(props: any): React.JSX.Element;
|
|
2
|
-
export namespace HorizontalBarChart {
|
|
3
|
-
namespace defaultProps {
|
|
4
|
-
let className: string;
|
|
5
|
-
let maxValue: null;
|
|
6
|
-
}
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
let className_1: PropTypes.Requireable<string>;
|
|
9
|
-
export { className_1 as className };
|
|
10
|
-
export let data: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
11
|
-
labels: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
12
|
-
values: PropTypes.Requireable<(NonNullable<number | PropTypes.InferProps<{
|
|
13
|
-
value: PropTypes.Requireable<number>;
|
|
14
|
-
color: PropTypes.Requireable<string>;
|
|
15
|
-
label: PropTypes.Requireable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>;
|
|
16
|
-
}> | null | undefined> | null | undefined)[]>;
|
|
17
|
-
}>>>;
|
|
18
|
-
let maxValue_1: PropTypes.Requireable<number>;
|
|
19
|
-
export { maxValue_1 as maxValue };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
import React from 'react';
|
|
23
|
-
import PropTypes from 'prop-types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./horizontal-bar-chart";
|