@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,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.BundleAssetsTotalsChartBars = void 0;
|
|
30
|
-
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
32
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
33
|
-
const map_1 = __importDefault(require("lodash/map"));
|
|
34
|
-
const max_1 = __importDefault(require("lodash/max"));
|
|
35
|
-
const sum_1 = __importDefault(require("lodash/sum"));
|
|
36
|
-
const webpack = __importStar(require("@bundle-stats/utils/lib-esm/webpack"));
|
|
37
|
-
const utils_1 = require("@bundle-stats/utils");
|
|
38
|
-
const constants_1 = require("../../constants");
|
|
39
|
-
const horizontal_bar_chart_1 = require("../../ui/horizontal-bar-chart");
|
|
40
|
-
const component_link_1 = require("../component-link");
|
|
41
|
-
const utils_2 = require("../../utils");
|
|
42
|
-
const stack_1 = require("../../layout/stack");
|
|
43
|
-
const job_name_1 = require("../job-name");
|
|
44
|
-
const metric_run_info_1 = require("../metric-run-info");
|
|
45
|
-
const bundle_assets_totals_chart_bars_module_css_1 = __importDefault(require("./bundle-assets-totals-chart-bars.module.css"));
|
|
46
|
-
const getTooltip = (items, jobs, itemIndex, runIndex) => () => {
|
|
47
|
-
const metricId = items?.[itemIndex]?.key;
|
|
48
|
-
const current = items?.[itemIndex]?.runs?.[runIndex]?.value || 0;
|
|
49
|
-
const baseline = items?.[itemIndex]?.runs?.[runIndex + 1]?.value;
|
|
50
|
-
return (react_1.default.createElement(metric_run_info_1.MetricRunInfo, { className: bundle_assets_totals_chart_bars_module_css_1.default.itemTooltip, metricId: metricId, current: current, baseline: baseline, showMetridDescription: false, size: "large" }));
|
|
51
|
-
};
|
|
52
|
-
const BundleAssetsTotalsChartBars = ({ className, jobs, customComponentLink: CustomComponentLink, }) => {
|
|
53
|
-
const rootClassName = (0, classnames_1.default)(bundle_assets_totals_chart_bars_module_css_1.default.root, className);
|
|
54
|
-
const items = webpack.compareBySection.sizes(jobs);
|
|
55
|
-
const dataGraphs = [];
|
|
56
|
-
items.forEach(({ runs }) => {
|
|
57
|
-
runs.forEach((run, runIndex) => {
|
|
58
|
-
dataGraphs[runIndex] = [...(dataGraphs[runIndex] || []), run?.value || 0];
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
const maxValues = (0, max_1.default)((0, map_1.default)(dataGraphs, (values) => (0, sum_1.default)(values)));
|
|
62
|
-
const maxValue = (0, max_1.default)(maxValues);
|
|
63
|
-
const labels = items.map(({ key, label }) => {
|
|
64
|
-
const fileType = constants_1.ASSETS_SIZES_FILE_TYPE_MAP[key];
|
|
65
|
-
const componentData = (0, utils_1.getBundleAssetsFileTypeComponentLink)(fileType, label);
|
|
66
|
-
return (react_1.default.createElement(CustomComponentLink, { className: bundle_assets_totals_chart_bars_module_css_1.default.itemLink, ...componentData }, label));
|
|
67
|
-
});
|
|
68
|
-
const colors = (0, utils_2.getColors)((0, max_1.default)((0, map_1.default)(dataGraphs, (values) => values.length)));
|
|
69
|
-
return (react_1.default.createElement(stack_1.Stack, { className: rootClassName, space: "small" }, dataGraphs.map((data, runIndex) => {
|
|
70
|
-
const { internalBuildNumber } = jobs[runIndex];
|
|
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
|
-
return (react_1.default.createElement("div", { key: internalBuildNumber || runIndex, className: bundle_assets_totals_chart_bars_module_css_1.default.item },
|
|
78
|
-
react_1.default.createElement("h3", { className: bundle_assets_totals_chart_bars_module_css_1.default.itemTitle },
|
|
79
|
-
react_1.default.createElement(job_name_1.JobName, { internalBuildNumber: internalBuildNumber })),
|
|
80
|
-
react_1.default.createElement(horizontal_bar_chart_1.HorizontalBarChart, { className: bundle_assets_totals_chart_bars_module_css_1.default.itemChart, data: { labels, values }, maxValue: maxValue })));
|
|
81
|
-
})));
|
|
82
|
-
};
|
|
83
|
-
exports.BundleAssetsTotalsChartBars = BundleAssetsTotalsChartBars;
|
|
84
|
-
exports.BundleAssetsTotalsChartBars.defaultProps = {
|
|
85
|
-
className: '',
|
|
86
|
-
customComponentLink: component_link_1.ComponentLink,
|
|
87
|
-
};
|
|
88
|
-
exports.BundleAssetsTotalsChartBars.propTypes = {
|
|
89
|
-
className: prop_types_1.default.string,
|
|
90
|
-
jobs: prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
91
|
-
internalBuildNumber: prop_types_1.default.number,
|
|
92
|
-
})).isRequired,
|
|
93
|
-
customComponentLink: prop_types_1.default.elementType,
|
|
94
|
-
};
|
|
95
|
-
//# sourceMappingURL=bundle-assets-totals-chart-bars.js.map
|
package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-assets-totals-chart-bars.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAmC;AACnC,4DAA4B;AAC5B,qDAA6B;AAC7B,qDAA6B;AAC7B,qDAA6B;AAC7B,6EAA+D;AAC/D,+CAAkH;AAElH,+CAA6D;AAC7D,wEAAmE;AACnE,sDAAiD;AACjD,uCAAwC;AACxC,8CAA2C;AAC3C,0CAAsC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,CAAC,UAAU,CAAC;YACzB,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC;SAC9D,CAAC,CAAC,CAAC;QAEJ,OAAO,CACL,uCAAK,GAAG,EAAE,mBAAmB,IAAI,QAAQ,EAAE,SAAS,EAAE,oDAAG,CAAC,IAAI;YAC5D,sCAAI,SAAS,EAAE,oDAAG,CAAC,SAAS;gBAAE,8BAAC,kBAAO,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAAK;YACxF,8BAAC,yCAAkB,IACjB,SAAS,EAAE,oDAAG,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;AAvDW,QAAA,2BAA2B,+BAuDtC;AAEF,mCAA2B,CAAC,YAAY,GAAG;IACzC,SAAS,EAAE,EAAE;IACb,mBAAmB,EAAE,8BAAa;CACnC,CAAC;AAEF,mCAA2B,CAAC,SAAS,GAAG;IACtC,SAAS,EAAE,oBAAS,CAAC,MAAM;IAC3B,IAAI,EAAE,oBAAS,CAAC,OAAO,CACrB,oBAAS,CAAC,KAAK,CAAC;QACd,mBAAmB,EAAE,oBAAS,CAAC,MAAM;KACtC,CAAC,CACH,CAAC,UAAU;IACZ,mBAAmB,EAAE,oBAAS,CAAC,WAAW;CAC3C,CAAC"}
|
package/lib/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
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-chart-bars/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.BundleAssetsTotalsTable = void 0;
|
|
30
|
-
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
32
|
-
const utils_1 = require("@bundle-stats/utils");
|
|
33
|
-
const webpack = __importStar(require("@bundle-stats/utils/lib-esm/webpack"));
|
|
34
|
-
const constants_1 = require("../../constants");
|
|
35
|
-
const metrics_table_1 = require("../metrics-table");
|
|
36
|
-
const component_link_1 = require("../component-link");
|
|
37
|
-
const BundleAssetsTotalsTable = ({ className, jobs, customComponentLink: CustomComponentLink, ...restProps }) => {
|
|
38
|
-
const items = webpack.compareBySection.sizes(jobs);
|
|
39
|
-
const renderRowHeader = (item) => {
|
|
40
|
-
const fileType = constants_1.ASSETS_SIZES_FILE_TYPE_MAP[item.key];
|
|
41
|
-
const { section, title, params } = (0, utils_1.getBundleAssetsFileTypeComponentLink)(fileType, item.label);
|
|
42
|
-
return (react_1.default.createElement(CustomComponentLink, { section: section, title: title, params: params }, item.label));
|
|
43
|
-
};
|
|
44
|
-
return (react_1.default.createElement(metrics_table_1.MetricsTable, { className: className, runs: jobs, items: items, renderRowHeader: renderRowHeader, showHeaderSum: true, ...restProps }));
|
|
45
|
-
};
|
|
46
|
-
exports.BundleAssetsTotalsTable = BundleAssetsTotalsTable;
|
|
47
|
-
exports.BundleAssetsTotalsTable.defaultProps = {
|
|
48
|
-
className: '',
|
|
49
|
-
jobs: [],
|
|
50
|
-
customComponentLink: component_link_1.ComponentLink,
|
|
51
|
-
};
|
|
52
|
-
exports.BundleAssetsTotalsTable.propTypes = {
|
|
53
|
-
className: prop_types_1.default.string,
|
|
54
|
-
jobs: prop_types_1.default.array,
|
|
55
|
-
customComponentLink: prop_types_1.default.elementType,
|
|
56
|
-
};
|
|
57
|
-
//# 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,kDAA0B;AAC1B,4DAAmC;AACnC,+CAA2E;AAC3E,6EAA+D;AAE/D,+CAA6D;AAC7D,oDAAgD;AAChD,sDAAkD;AAE3C,MAAM,uBAAuB,GAAG,CAAC,EACtC,SAAS,EACT,IAAI,EACJ,mBAAmB,EAAE,mBAAmB,EACxC,GAAG,SAAS,EACb,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,EAAE;QAC/B,MAAM,QAAQ,GAAG,sCAA0B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAA,4CAAoC,EAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAE9F,OAAO,CACL,8BAAC,mBAAmB,IAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,IAChE,IAAI,CAAC,KAAK,CACS,CACvB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,4BAAY,IACX,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,aAAa,WACT,SAAS,GACb,CACH,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,uBAAuB,2BA6BlC;AAEF,+BAAuB,CAAC,YAAY,GAAG;IACrC,SAAS,EAAE,EAAE;IACb,IAAI,EAAE,EAAE;IACR,mBAAmB,EAAE,8BAAa;CACnC,CAAC;AAEF,+BAAuB,CAAC,SAAS,GAAG;IAElC,SAAS,EAAE,oBAAS,CAAC,MAAM;IAG3B,IAAI,EAAE,oBAAS,CAAC,KAAK;IAErB,mBAAmB,EAAE,oBAAS,CAAC,WAAW;CAC3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-table/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HorizontalBarChart = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
9
|
-
const round_1 = __importDefault(require("lodash/round"));
|
|
10
|
-
const sum_1 = __importDefault(require("lodash/sum"));
|
|
11
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
12
|
-
const utils_1 = require("../../utils");
|
|
13
|
-
const tooltip_1 = require("../tooltip");
|
|
14
|
-
const horizontal_bar_chart_module_css_1 = __importDefault(require("./horizontal-bar-chart.module.css"));
|
|
15
|
-
class HorizontalBarChartItem extends react_1.default.Component {
|
|
16
|
-
constructor(props) {
|
|
17
|
-
super(props);
|
|
18
|
-
this.textRef = react_1.default.createRef();
|
|
19
|
-
this.ref = react_1.default.createRef();
|
|
20
|
-
this.state = {
|
|
21
|
-
isTextOverflowing: true,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
componentDidMount() {
|
|
25
|
-
const wrapperWidth = this.ref?.current?.clientWidth || 0;
|
|
26
|
-
const textWidth = this.textRef?.current?.scrollWidth || 0;
|
|
27
|
-
if (wrapperWidth >= (textWidth + 2 * 4)) {
|
|
28
|
-
this.setState({ isTextOverflowing: false });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
render() {
|
|
32
|
-
const { color, label, getItemTooltip, width, } = this.props;
|
|
33
|
-
const { isTextOverflowing } = this.state;
|
|
34
|
-
const tooltipContent = getItemTooltip();
|
|
35
|
-
return (react_1.default.createElement("span", { className: (0, classnames_1.default)(horizontal_bar_chart_module_css_1.default.item, isTextOverflowing && horizontal_bar_chart_module_css_1.default.textOverflowed), style: {
|
|
36
|
-
width,
|
|
37
|
-
background: color,
|
|
38
|
-
}, ref: this.ref },
|
|
39
|
-
react_1.default.createElement(tooltip_1.Tooltip, { className: horizontal_bar_chart_module_css_1.default.itemContent, title: tooltipContent, darkMode: false },
|
|
40
|
-
react_1.default.createElement("span", { className: horizontal_bar_chart_module_css_1.default.itemLabel, ref: this.textRef }, label))));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
HorizontalBarChartItem.propTypes = {
|
|
44
|
-
width: prop_types_1.default.string.isRequired,
|
|
45
|
-
color: prop_types_1.default.string.isRequired,
|
|
46
|
-
label: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.element]).isRequired,
|
|
47
|
-
getItemTooltip: prop_types_1.default.func,
|
|
48
|
-
};
|
|
49
|
-
HorizontalBarChartItem.defaultProps = {
|
|
50
|
-
getItemTooltip: () => null,
|
|
51
|
-
};
|
|
52
|
-
const getTotalValues = (values) => (0, sum_1.default)(values.map((entry) => {
|
|
53
|
-
if (typeof entry === 'object') {
|
|
54
|
-
return entry.value;
|
|
55
|
-
}
|
|
56
|
-
return entry;
|
|
57
|
-
}));
|
|
58
|
-
const HorizontalBarChart = (props) => {
|
|
59
|
-
const { className, data, maxValue } = props;
|
|
60
|
-
const { labels, values } = data;
|
|
61
|
-
const defaultColors = (0, utils_1.getColors)(labels.length);
|
|
62
|
-
const total = maxValue || getTotalValues(values);
|
|
63
|
-
const entries = values.reduce((agg, entry, index) => {
|
|
64
|
-
const { value, color = defaultColors[index], label = labels[index], getItemTooltip, } = typeof entry === 'object' ? entry : { value: entry };
|
|
65
|
-
const width = `${(0, round_1.default)((value / total) * 100, 2)}%`;
|
|
66
|
-
return [
|
|
67
|
-
...agg,
|
|
68
|
-
{
|
|
69
|
-
value,
|
|
70
|
-
width,
|
|
71
|
-
color,
|
|
72
|
-
label,
|
|
73
|
-
getItemTooltip,
|
|
74
|
-
},
|
|
75
|
-
];
|
|
76
|
-
}, []);
|
|
77
|
-
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(horizontal_bar_chart_module_css_1.default.root, className) }, entries.map(({ color, getItemTooltip, label, width, }, index) => {
|
|
78
|
-
const key = index;
|
|
79
|
-
return (react_1.default.createElement(HorizontalBarChartItem, { key: key, width: width, color: color, label: label, getItemTooltip: getItemTooltip, className: horizontal_bar_chart_module_css_1.default.item }));
|
|
80
|
-
})));
|
|
81
|
-
};
|
|
82
|
-
exports.HorizontalBarChart = HorizontalBarChart;
|
|
83
|
-
exports.HorizontalBarChart.defaultProps = {
|
|
84
|
-
className: '',
|
|
85
|
-
maxValue: null,
|
|
86
|
-
};
|
|
87
|
-
exports.HorizontalBarChart.propTypes = {
|
|
88
|
-
className: prop_types_1.default.string,
|
|
89
|
-
data: prop_types_1.default.shape({
|
|
90
|
-
labels: prop_types_1.default.arrayOf(prop_types_1.default.string),
|
|
91
|
-
values: prop_types_1.default.arrayOf(prop_types_1.default.oneOfType([
|
|
92
|
-
prop_types_1.default.number,
|
|
93
|
-
prop_types_1.default.shape({
|
|
94
|
-
value: prop_types_1.default.number,
|
|
95
|
-
color: prop_types_1.default.string,
|
|
96
|
-
label: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.element]),
|
|
97
|
-
}),
|
|
98
|
-
])),
|
|
99
|
-
}).isRequired,
|
|
100
|
-
maxValue: prop_types_1.default.number,
|
|
101
|
-
};
|
|
102
|
-
//# 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,kDAA0B;AAC1B,4DAAmC;AACnC,yDAAiC;AACjC,qDAA6B;AAC7B,4DAA4B;AAE5B,uCAAwC;AACxC,wCAAqC;AACrC,wGAAoD;AAEpD,MAAM,sBAAuB,SAAQ,eAAK,CAAC,SAAS;IAClD,YAAY,KAAK;QACf,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,OAAO,GAAG,eAAK,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,eAAK,CAAC,SAAS,EAAE,CAAC;QAE7B,IAAI,CAAC,KAAK,GAAG;YACX,iBAAiB,EAAE,IAAI;SACxB,CAAC;IACJ,CAAC;IAED,iBAAiB;QACf,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,IAAI,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,IAAI,CAAC,CAAC;QAE1D,IAAI,YAAY,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;YACvC,IAAI,CAAC,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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"}
|
package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js
DELETED
|
@@ -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
|
package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-assets-totals-chart-bars.js","sourceRoot":"","sources":["../../../src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,KAAK,OAAO,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAElH,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,GAAG,MAAM,8CAA8C,CAAC;AAE/D,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,GAAG,EAAE;;IAC5D,MAAM,QAAQ,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,SAAS,CAAC,0CAAE,GAAG,CAAC;IACzC,MAAM,OAAO,GAAG,CAAA,MAAA,MAAA,MAAA,KAAK,aAAL,KA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AAI;YAC5D,4BAAI,SAAS,EAAE,GAAG,CAAC,SAAS;gBAAE,oBAAC,OAAO,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAAK;YACxF,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 +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,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,SAAS,EACT,IAAI,EACJ,mBAAmB,EAAE,mBAAmB,EACxC,GAAG,SAAS,EACb,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,EAAE;QAC/B,MAAM,QAAQ,GAAG,0BAA0B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,oCAAoC,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAE9F,OAAO,CACL,oBAAC,mBAAmB,IAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,IAChE,IAAI,CAAC,KAAK,CACS,CACvB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,YAAY,IACX,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,aAAa,WACT,SAAS,GACb,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG;IACrC,SAAS,EAAE,EAAE;IACb,IAAI,EAAE,EAAE;IACR,mBAAmB,EAAE,aAAa;CACnC,CAAC;AAEF,uBAAuB,CAAC,SAAS,GAAG;IAElC,SAAS,EAAE,SAAS,CAAC,MAAM;IAG3B,IAAI,EAAE,SAAS,CAAC,KAAK;IAErB,mBAAmB,EAAE,SAAS,CAAC,WAAW;CAC3C,CAAC"}
|
|
@@ -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
|