@bundle-stats/ui 3.3.1-beta.8 → 3.3.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.
Files changed (62) hide show
  1. package/lib/app/app.js +8 -21
  2. package/lib/app/app.stories.js +1 -22
  3. package/lib/app/header/header.js +2 -1
  4. package/lib/assets/icons.svg +0 -8
  5. package/lib/components/bundle-assets/bundle-assets.js +2 -1
  6. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +7 -43
  7. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  8. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +1 -20
  9. package/lib/components/bundle-modules/bundle-modules.js +1 -1
  10. package/lib/components/index.js +0 -8
  11. package/lib/components/summary/summary.js +7 -12
  12. package/lib/components/summary/summary.module.css +1 -1
  13. package/lib/components/summary/summary.stories.js +0 -29
  14. package/lib/components/summary-item/summary-item.js +5 -22
  15. package/lib/components/summary-item/summary-item.module.css +0 -11
  16. package/lib/components/summary-item/summary-item.stories.js +53 -51
  17. package/lib/constants.js +4 -4
  18. package/lib/ui/alert/alert.js +3 -13
  19. package/lib/ui/icon/icon.js +0 -2
  20. package/lib-esm/app/app.js +8 -20
  21. package/lib-esm/app/app.stories.js +1 -22
  22. package/lib-esm/app/header/header.js +2 -1
  23. package/lib-esm/assets/icons.svg +0 -8
  24. package/lib-esm/components/bundle-assets/bundle-assets.js +2 -1
  25. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +7 -24
  26. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  27. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +0 -18
  28. package/lib-esm/components/bundle-modules/bundle-modules.js +1 -1
  29. package/lib-esm/components/index.js +0 -1
  30. package/lib-esm/components/summary/summary.js +7 -11
  31. package/lib-esm/components/summary/summary.module.css +1 -1
  32. package/lib-esm/components/summary/summary.stories.js +0 -27
  33. package/lib-esm/components/summary-item/summary-item.js +4 -20
  34. package/lib-esm/components/summary-item/summary-item.module.css +0 -11
  35. package/lib-esm/components/summary-item/summary-item.stories.js +38 -50
  36. package/lib-esm/constants.js +4 -4
  37. package/lib-esm/ui/alert/alert.js +3 -6
  38. package/lib-esm/ui/icon/icon.js +0 -2
  39. package/package.json +3 -3
  40. package/src/components/bundle-modules/bundle-modules.jsx +1 -1
  41. package/build-storybook.log +0 -4691
  42. package/lib/assets/icons/alert-circle.svg +0 -1
  43. package/lib/assets/icons/check-circle.svg +0 -1
  44. package/lib/components/budget-info/budget-info.js +0 -80
  45. package/lib/components/budget-info/budget-info.module.css +0 -40
  46. package/lib/components/budget-info/budget-info.stories.js +0 -44
  47. package/lib/components/budget-info/index.js +0 -18
  48. package/lib/components/budget-insights/budget-insights.js +0 -200
  49. package/lib/components/budget-insights/budget-insights.module.css +0 -53
  50. package/lib/components/budget-insights/budget-insights.stories.js +0 -104
  51. package/lib/components/budget-insights/index.js +0 -18
  52. package/lib-esm/assets/icons/alert-circle.svg +0 -1
  53. package/lib-esm/assets/icons/check-circle.svg +0 -1
  54. package/lib-esm/components/budget-info/budget-info.js +0 -58
  55. package/lib-esm/components/budget-info/budget-info.module.css +0 -40
  56. package/lib-esm/components/budget-info/budget-info.stories.js +0 -30
  57. package/lib-esm/components/budget-info/index.js +0 -1
  58. package/lib-esm/components/budget-insights/budget-insights.js +0 -148
  59. package/lib-esm/components/budget-insights/budget-insights.module.css +0 -53
  60. package/lib-esm/components/budget-insights/budget-insights.stories.js +0 -84
  61. package/lib-esm/components/budget-insights/index.js +0 -1
  62. package/storybook-static/favicon.ico +0 -0
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports.Standard = exports.SizeLarge = exports.ShowMetricDescription = exports.ShowDeltaFalse = exports.Loading = exports.BudgetSuccess = exports.BudgetError = void 0;
6
+ exports["default"] = exports.Standard = exports.SizeLarge = exports.ShowMetricDescription = exports.ShowDeltaFalse = exports.Loading = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -13,68 +13,70 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
13
13
 
14
14
  var _default = {
15
15
  title: 'Components/SummaryItem',
16
- component: _summaryItem.SummaryItem,
17
- decorators: [function (Story) {
18
- return /*#__PURE__*/_react["default"].createElement("div", {
19
- style: {
20
- maxWidth: '320px'
21
- }
22
- }, /*#__PURE__*/_react["default"].createElement(Story, null));
23
- }],
24
- args: {
16
+ component: _summaryItem.SummaryItem
17
+ };
18
+ exports["default"] = _default;
19
+
20
+ var Standard = function Standard() {
21
+ return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, {
25
22
  loading: false,
26
- id: 'webpack.totalSizeByTypeALL',
23
+ id: "webpack.totalSizeByTypeALL",
27
24
  data: {
28
25
  current: 120 * 1000,
29
26
  baseline: 100 * 1000
30
27
  }
31
- }
28
+ });
32
29
  };
33
- exports["default"] = _default;
34
30
 
35
- var Template = function Template(args) {
36
- return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, args);
31
+ exports.Standard = Standard;
32
+
33
+ var SizeLarge = function SizeLarge() {
34
+ return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, {
35
+ size: "large",
36
+ loading: false,
37
+ id: "webpack.totalSizeByTypeALL",
38
+ data: {
39
+ current: 120 * 1000,
40
+ baseline: 100 * 1000
41
+ }
42
+ });
37
43
  };
38
44
 
39
- var Standard = Template.bind();
40
- exports.Standard = Standard;
41
- var SizeLarge = Template.bind();
42
45
  exports.SizeLarge = SizeLarge;
43
- SizeLarge.args = {
44
- size: 'large'
46
+
47
+ var ShowMetricDescription = function ShowMetricDescription() {
48
+ return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, {
49
+ loading: false,
50
+ id: "webpack.totalSizeByTypeALL",
51
+ data: {
52
+ current: 120 * 1000,
53
+ baseline: 100 * 1000
54
+ },
55
+ showMetricDescription: true
56
+ });
45
57
  };
46
- var ShowMetricDescription = Template.bind();
58
+
47
59
  exports.ShowMetricDescription = ShowMetricDescription;
48
- ShowMetricDescription.args = {
49
- showMetricDescription: true
60
+
61
+ var ShowDeltaFalse = function ShowDeltaFalse() {
62
+ return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, {
63
+ loading: false,
64
+ id: "webpack.totalSizeByTypeALL",
65
+ data: {
66
+ current: 120 * 1000,
67
+ baseline: 0
68
+ },
69
+ showDelta: false
70
+ });
50
71
  };
51
- var ShowDeltaFalse = Template.bind();
72
+
52
73
  exports.ShowDeltaFalse = ShowDeltaFalse;
53
- ShowDeltaFalse.args = {
54
- showDelta: false
55
- };
56
- var BudgetError = Template.bind();
57
- exports.BudgetError = BudgetError;
58
- BudgetError.args = {
59
- showMetricDescription: true,
60
- budget: {
61
- currentValue: 120 * 1000,
62
- budgetValue: 100 * 1000,
63
- failed: true
64
- }
65
- };
66
- var BudgetSuccess = Template.bind();
67
- exports.BudgetSuccess = BudgetSuccess;
68
- BudgetSuccess.args = {
69
- showMetricDescription: true,
70
- budget: {
71
- currentValue: 120 * 1000,
72
- budgetValue: 120 * 1024,
73
- failed: false
74
- }
74
+
75
+ var Loading = function Loading() {
76
+ return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, {
77
+ loading: true,
78
+ id: "webpack.totalSizeByTypeALL"
79
+ });
75
80
  };
76
- var Loading = Template.bind();
77
- exports.Loading = Loading;
78
- Loading.args = {
79
- loading: true
80
- };
81
+
82
+ exports.Loading = Loading;
package/lib/constants.js CHANGED
@@ -52,11 +52,11 @@ var ASSETS_SIZES_FILE_TYPE_MAP = _utils.FILE_TYPES.reduce(function (agg, fileTyp
52
52
  }, {});
53
53
 
54
54
  exports.ASSETS_SIZES_FILE_TYPE_MAP = ASSETS_SIZES_FILE_TYPE_MAP;
55
- var METRICS_WEBPACK_GENERAL = ['totalSizeByTypeALL', 'totalInitialSizeJS', 'totalInitialSizeCSS', 'cacheInvalidation'];
55
+ var METRICS_WEBPACK_GENERAL = ['webpack.totalSizeByTypeALL', 'webpack.totalInitialSizeJS', 'webpack.totalInitialSizeCSS', 'webpack.cacheInvalidation'];
56
56
  exports.METRICS_WEBPACK_GENERAL = METRICS_WEBPACK_GENERAL;
57
- var METRICS_WEBPACK_ASSETS = ['assetCount', 'chunkCount'];
57
+ var METRICS_WEBPACK_ASSETS = ['webpack.assetCount', 'webpack.chunkCount'];
58
58
  exports.METRICS_WEBPACK_ASSETS = METRICS_WEBPACK_ASSETS;
59
- var METRICS_WEBPACK_MODULES = ['moduleCount', 'duplicateModulesCount', 'duplicateCode'];
59
+ var METRICS_WEBPACK_MODULES = ['webpack.moduleCount', 'webpack.duplicateModulesCount', 'webpack.duplicateCode'];
60
60
  exports.METRICS_WEBPACK_MODULES = METRICS_WEBPACK_MODULES;
61
- var METRICS_WEBPACK_PACKAGES = ['packageCount', 'duplicatePackagesCount'];
61
+ var METRICS_WEBPACK_PACKAGES = ['webpack.packageCount', 'webpack.duplicatePackagesCount'];
62
62
  exports.METRICS_WEBPACK_PACKAGES = METRICS_WEBPACK_PACKAGES;
@@ -15,27 +15,17 @@ var _box = require("../../layout/box");
15
15
 
16
16
  var _alertModule = _interopRequireDefault(require("./alert.module.css"));
17
17
 
18
- var _excluded = ["className", "kind", "children"];
19
-
20
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
19
 
22
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
-
24
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
-
26
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
-
28
20
  var Alert = function Alert(props) {
29
21
  var className = props.className,
30
22
  kind = props.kind,
31
- children = props.children,
32
- restProps = _objectWithoutProperties(props, _excluded);
33
-
34
- return /*#__PURE__*/_react["default"].createElement(_box.Box, _extends({
23
+ children = props.children;
24
+ return /*#__PURE__*/_react["default"].createElement(_box.Box, {
35
25
  padding: ['xsmall', 'small'],
36
26
  outline: true,
37
27
  className: (0, _classnames["default"])(_alertModule["default"].root, className, _alertModule["default"][kind])
38
- }, restProps), children);
28
+ }, children);
39
29
  };
40
30
 
41
31
  exports.Alert = Alert;
@@ -24,13 +24,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
24
24
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
25
 
26
26
  var ICONS = {
27
- ALERT_CIRCLE: 'alert-circle',
28
27
  ARROW: 'arrow',
29
28
  ARROW_RIGHT_CIRLCE: 'arrow-right-circle',
30
29
  CANCEL: 'cancel',
31
30
  CLOSE: 'close',
32
31
  CLOCK: 'clock',
33
- CHECK_CIRCLE: 'check-circle',
34
32
  COMMIT: 'commit',
35
33
  FILTER: 'filter',
36
34
  HELP: 'help',
@@ -8,7 +8,6 @@ import { METRICS_WEBPACK_ASSETS, METRICS_WEBPACK_GENERAL, METRICS_WEBPACK_MODULE
8
8
  import { Box } from '../layout/box';
9
9
  import { Container } from '../ui/container';
10
10
  import { DuplicatePackagesWarning } from '../components/duplicate-packages-warning';
11
- import { BudgetInsights } from '../components/budget-insights';
12
11
  import { Summary } from '../components/summary';
13
12
  import { BundleAssets } from '../components/bundle-assets';
14
13
  import { BundleAssetsTotalsChartBars } from '../components/bundle-assets-totals-chart-bars';
@@ -54,6 +53,7 @@ const Layout = _ref => {
54
53
 
55
54
  Layout.propTypes = {
56
55
  jobs: PropTypes.arrayOf(PropTypes.object),
56
+ // eslint-disable-line react/forbid-prop-types
57
57
  version: PropTypes.string
58
58
  };
59
59
  Layout.defaultProps = {
@@ -78,12 +78,11 @@ const JobsProvider = _ref2 => {
78
78
  };
79
79
 
80
80
  JobsProvider.propTypes = {
81
- jobs: PropTypes.arrayOf(PropTypes.object).isRequired
81
+ jobs: PropTypes.arrayOf(PropTypes.object).isRequired // eslint-disable-line react/forbid-prop-types
82
+
82
83
  };
83
84
 
84
85
  const OverviewContent = () => {
85
- var _jobs$0$insights, _jobs$0$insights$webp;
86
-
87
86
  const {
88
87
  jobs
89
88
  } = useContext(JobsContext);
@@ -93,15 +92,10 @@ const OverviewContent = () => {
93
92
  const duplicatePackagesInsights = Boolean(duplicatePackagesCount.current || duplicatePackagesCount.baseline);
94
93
  return /*#__PURE__*/React.createElement(Stack, {
95
94
  space: "medium"
96
- }, duplicatePackagesInsights && /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Stack, {
97
- space: "small"
98
- }, /*#__PURE__*/React.createElement(DuplicatePackagesWarning, {
95
+ }, duplicatePackagesInsights && /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(DuplicatePackagesWarning, {
99
96
  duplicatePackagesCount: duplicatePackagesCount,
100
97
  showDelta: jobs.length > 1
101
- }), /*#__PURE__*/React.createElement(BudgetInsights, {
102
- source: "webpack",
103
- budgets: (_jobs$0$insights = jobs[0].insights) == null ? void 0 : (_jobs$0$insights$webp = _jobs$0$insights.webpack) == null ? void 0 : _jobs$0$insights$webp.budgets
104
- }))), /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Stack, {
98
+ })), /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Stack, {
105
99
  space: "small"
106
100
  }, /*#__PURE__*/React.createElement(TotalSizeTypeTitle, null), /*#__PURE__*/React.createElement(BundleAssetsTotalsChartBars, {
107
101
  jobs: jobs
@@ -112,7 +106,7 @@ const OverviewContent = () => {
112
106
  };
113
107
 
114
108
  const AssetsContent = () => {
115
- var _jobs$, _jobs$0$insights2, _jobs$0$insights2$web;
109
+ var _jobs$;
116
110
 
117
111
  const [bundleStatsState, bundleStatsSetState] = useComponentQueryState(COMPONENT.BUNDLE_ASSETS);
118
112
  const {
@@ -123,7 +117,6 @@ const AssetsContent = () => {
123
117
  }, /*#__PURE__*/React.createElement(Summary, {
124
118
  keys: METRICS_WEBPACK_ASSETS,
125
119
  data: jobs == null ? void 0 : (_jobs$ = jobs[0]) == null ? void 0 : _jobs$.summary,
126
- budgets: (_jobs$0$insights2 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights2$web = _jobs$0$insights2.webpack) == null ? void 0 : _jobs$0$insights2$web.budgets,
127
120
  showSummaryItemDelta: (jobs == null ? void 0 : jobs.length) !== 1
128
121
  }), /*#__PURE__*/React.createElement(Box, {
129
122
  outline: true
@@ -134,7 +127,7 @@ const AssetsContent = () => {
134
127
  };
135
128
 
136
129
  const ModulesContent = () => {
137
- var _jobs$2, _jobs$0$insights3, _jobs$0$insights3$web;
130
+ var _jobs$2;
138
131
 
139
132
  const [bundleModulesState, bundleModulesSetState] = useComponentQueryState(COMPONENT.BUNDLE_MODULES);
140
133
  const {
@@ -145,7 +138,6 @@ const ModulesContent = () => {
145
138
  }, /*#__PURE__*/React.createElement(Summary, {
146
139
  keys: METRICS_WEBPACK_MODULES,
147
140
  data: jobs == null ? void 0 : (_jobs$2 = jobs[0]) == null ? void 0 : _jobs$2.summary,
148
- budgets: (_jobs$0$insights3 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights3$web = _jobs$0$insights3.webpack) == null ? void 0 : _jobs$0$insights3$web.budgets,
149
141
  showSummaryItemDelta: (jobs == null ? void 0 : jobs.length) !== 1
150
142
  }), /*#__PURE__*/React.createElement(Box, {
151
143
  outline: true
@@ -156,7 +148,7 @@ const ModulesContent = () => {
156
148
  };
157
149
 
158
150
  const PackagesContent = () => {
159
- var _jobs$3, _jobs$0$insights4, _jobs$0$insights4$web;
151
+ var _jobs$3;
160
152
 
161
153
  const [bundlePackagesState, bundlePackagesSetState] = useComponentQueryState(COMPONENT.BUNDLE_PACKAGES);
162
154
  const {
@@ -167,7 +159,6 @@ const PackagesContent = () => {
167
159
  }, /*#__PURE__*/React.createElement(Summary, {
168
160
  keys: METRICS_WEBPACK_PACKAGES,
169
161
  data: jobs == null ? void 0 : (_jobs$3 = jobs[0]) == null ? void 0 : _jobs$3.summary,
170
- budgets: (_jobs$0$insights4 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights4$web = _jobs$0$insights4.webpack) == null ? void 0 : _jobs$0$insights4$web.budgets,
171
162
  showSummaryItemDelta: (jobs == null ? void 0 : jobs.length) !== 1
172
163
  }), /*#__PURE__*/React.createElement(Box, {
173
164
  outline: true
@@ -179,8 +170,6 @@ const PackagesContent = () => {
179
170
  };
180
171
 
181
172
  const AppComponent = _ref3 => {
182
- var _jobs$0$insights5, _jobs$0$insights5$web;
183
-
184
173
  let {
185
174
  version,
186
175
  jobs
@@ -205,7 +194,6 @@ const AppComponent = _ref3 => {
205
194
  size: "large",
206
195
  keys: METRICS_WEBPACK_GENERAL,
207
196
  data: jobs[0].summary,
208
- budgets: (_jobs$0$insights5 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights5$web = _jobs$0$insights5.webpack) == null ? void 0 : _jobs$0$insights5$web.budgets,
209
197
  showSummaryItemDelta: jobs.length !== 1
210
198
  })), /*#__PURE__*/React.createElement(Container, {
211
199
  className: css.tabsContainer
@@ -28,28 +28,7 @@ const JOBS = createJobs([CURRENT_SOURCE, BASELINE_SOURCE], {
28
28
  webpack: {
29
29
  budgets: [{
30
30
  metric: 'totalSizeByTypeALL',
31
- value: 2 * 1024 * 1024
32
- }, {
33
- metric: 'totalInitialSizeJS',
34
- value: 512 * 1024
35
- }, {
36
- metric: 'totalInitialSizeCSS',
37
- value: 50 * 1024
38
- }, {
39
- metric: 'chunkCount',
40
- value: 50
41
- }, {
42
- metric: 'moduleCount',
43
- value: 2000
44
- }, {
45
- metric: 'duplicatePackagesCount',
46
- value: 5
47
- }, {
48
- metric: 'sizes.totalSizeByTypeJS',
49
- value: 2 * 1024 * 1024
50
- }, {
51
- metric: 'sizes.totalSizeByTypeCSS',
52
- value: 20 * 1024
31
+ value: 1024 * 1024
53
32
  }]
54
33
  }
55
34
  });
@@ -21,7 +21,8 @@ export const Header = _ref => {
21
21
  };
22
22
  Header.propTypes = {
23
23
  className: PropTypes.string,
24
- jobs: PropTypes.arrayOf(PropTypes.object)
24
+ jobs: PropTypes.arrayOf(PropTypes.object) // eslint-disable-line react/forbid-prop-types
25
+
25
26
  };
26
27
  Header.defaultProps = {
27
28
  className: '',
@@ -1,8 +1,4 @@
1
1
  <svg width="16" height="16">
2
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle" viewBox="0 0 24 24" id="alert-circle" xmlns="http://www.w3.org/2000/svg">
3
- <circle cx="12" cy="12" r="10"/>
4
- <path d="M12 8v4M12 16h.01"/>
5
- </symbol>
6
2
  <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-down" id="arrow" xmlns="http://www.w3.org/2000/svg">
7
3
  <path d="M12 5v14M19 12l-7 7-7-7"/>
8
4
  </symbol>
@@ -14,10 +10,6 @@
14
10
  <circle cx="12" cy="12" r="10"/>
15
11
  <path d="M15 9l-6 6M9 9l6 6"/>
16
12
  </symbol>
17
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle" viewBox="0 0 24 24" id="check-circle" xmlns="http://www.w3.org/2000/svg">
18
- <path d="M22 11.08V12a10 10 0 11-5.93-9.14"/>
19
- <path d="M22 4L12 14.01l-3-3"/>
20
- </symbol>
21
13
  <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock" id="clock" xmlns="http://www.w3.org/2000/svg">
22
14
  <circle cx="12" cy="12" r="10"/>
23
15
  <path d="M12 6v6l4 2"/>
@@ -145,7 +145,8 @@ RowHeader.propTypes = {
145
145
  isChunk: PropTypes.bool,
146
146
  isInitial: PropTypes.bool,
147
147
  isEntry: PropTypes.bool,
148
- runs: PropTypes.arrayOf(PropTypes.object)
148
+ runs: PropTypes.arrayOf(PropTypes.object) // eslint-disable-line react/forbid-prop-types
149
+
149
150
  }).isRequired,
150
151
  chunks: PropTypes.arrayOf(PropTypes.shape({
151
152
  id: PropTypes.string,
@@ -1,52 +1,35 @@
1
- import _get from "lodash/get";
2
-
3
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
2
 
5
- import React, { useCallback, useMemo } from 'react';
3
+ import React from 'react';
6
4
  import PropTypes from 'prop-types';
7
5
  import { getBundleAssetsFileTypeComponentLink } from '@bundle-stats/utils';
8
6
  import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
9
7
  import { ASSETS_SIZES_FILE_TYPE_MAP } from '../../constants';
10
- import { FlexStack } from '../../layout/flex-stack';
11
8
  import { MetricsTable } from '../metrics-table';
12
9
  import { ComponentLink } from '../component-link';
13
- import { BudgetInfo } from '../budget-info';
14
- import css from './bundle-assets-totals-table.module.css';
15
10
  export const BundleAssetsTotalsTable = _ref => {
16
- var _jobs$0$insights, _jobs$0$insights$webp;
17
-
18
11
  let {
19
12
  className,
20
13
  jobs,
21
14
  customComponentLink: CustomComponentLink,
22
15
  ...restProps
23
16
  } = _ref;
24
- const items = useMemo(() => webpack.compareBySection.sizes(jobs), [jobs]);
25
- const budgets = (_jobs$0$insights = jobs[0].insights) == null ? void 0 : (_jobs$0$insights$webp = _jobs$0$insights.webpack) == null ? void 0 : _jobs$0$insights$webp.budgets;
26
- const renderRowHeader = useCallback(item => {
17
+ const items = webpack.compareBySection.sizes(jobs);
18
+
19
+ const renderRowHeader = item => {
27
20
  const fileType = ASSETS_SIZES_FILE_TYPE_MAP[item.key];
28
21
  const {
29
22
  section,
30
23
  title,
31
24
  params
32
25
  } = getBundleAssetsFileTypeComponentLink(fileType, item.label);
33
- const [_, ...metricSlugs] = item.key.split('.');
34
- const metricKey = metricSlugs.join('.');
35
-
36
- const budget = _get(budgets, metricKey);
37
-
38
26
  return /*#__PURE__*/React.createElement(CustomComponentLink, {
39
27
  section: section,
40
28
  title: title,
41
29
  params: params
42
- }, /*#__PURE__*/React.createElement(FlexStack, {
43
- space: "xxsmall",
44
- className: css.itemTitleText
45
- }, /*#__PURE__*/React.createElement("span", null, item.label), budget && /*#__PURE__*/React.createElement(BudgetInfo, {
46
- metricId: item.key,
47
- budgetInsight: budget
48
- })));
49
- }, [CustomComponentLink]);
30
+ }, item.label);
31
+ };
32
+
50
33
  return /*#__PURE__*/React.createElement(MetricsTable, _extends({
51
34
  className: className,
52
35
  runs: jobs,
@@ -1,3 +1,3 @@
1
- .itemTitleText {
2
- align-items: center;
1
+ .title {
2
+ color: var(--color-text-light);
3
3
  }
@@ -31,22 +31,4 @@ EmptyBaseline.args = {
31
31
  jobs: createJobs([{
32
32
  webpack: currentStats
33
33
  }, null])
34
- };
35
- export const WithBudgets = Template.bind();
36
- WithBudgets.args = {
37
- jobs: createJobs([{
38
- webpack: currentStats
39
- }, {
40
- webpack: baselineStats
41
- }], {
42
- webpack: {
43
- budgets: [{
44
- metric: 'sizes.totalSizeByTypeJS',
45
- value: 2 * 1024 * 1024
46
- }, {
47
- metric: 'sizes.totalSizeByTypeCSS',
48
- value: 20 * 1024
49
- }]
50
- }
51
- })
52
34
  };
@@ -121,7 +121,7 @@ export const BundleModules = _ref2 => {
121
121
  disabled: jobs.length <= 1
122
122
  },
123
123
  [MODULE_FILTERS.DUPLICATED]: {
124
- label: 'Duplicated',
124
+ label: 'Duplicate',
125
125
  defaultValue: filters[MODULE_FILTERS.DUPLICATED],
126
126
  disabled: jobs.length <= 1
127
127
  },
@@ -4,7 +4,6 @@ export { BundleAssetsTotalsTable } from './bundle-assets-totals-table';
4
4
  export { BundleAssetsTotalsChartBars } from './bundle-assets-totals-chart-bars';
5
5
  export { BundlePackages } from './bundle-packages';
6
6
  export { BundleModules } from './bundle-modules';
7
- export { BudgetInsights } from './budget-insights';
8
7
  export { ComponentLink } from './component-link';
9
8
  export { DuplicatePackagesWarning } from './duplicate-packages-warning';
10
9
  export { Delta } from './delta';
@@ -13,16 +13,12 @@ import { FlexStack } from '../../layout/flex-stack';
13
13
  import { ComponentLink } from '../component-link';
14
14
  import { SummaryItem } from '../summary-item';
15
15
  import css from './summary.module.css';
16
-
17
- const getSourceMetricId = fullMetricId => fullMetricId.split('.').slice(1).join('.');
18
-
19
16
  export const Summary = _ref => {
20
17
  let {
21
18
  className,
22
19
  size,
23
20
  keys,
24
21
  data,
25
- budgets,
26
22
  loading,
27
23
  showSummaryItemDelta,
28
24
  summaryItemLink: SummaryItemCustomLink
@@ -34,7 +30,7 @@ export const Summary = _ref => {
34
30
  className: css.items
35
31
  }, Array.from(METRIC_COMPONENT_LINKS).filter(_ref2 => {
36
32
  let [metricId] = _ref2;
37
- return keys.includes(getSourceMetricId(metricId));
33
+ return keys.includes(metricId);
38
34
  }).map(_ref3 => {
39
35
  let [metricId, metricOptions] = _ref3;
40
36
  return /*#__PURE__*/React.createElement("div", {
@@ -44,7 +40,6 @@ export const Summary = _ref => {
44
40
  size: size,
45
41
  id: metricId,
46
42
  data: _get(data, metricId),
47
- budget: _get(budgets, getSourceMetricId(metricId)),
48
43
  loading: loading,
49
44
  showMetricDescription: true,
50
45
  showDelta: showSummaryItemDelta && metricOptions.showDelta !== false
@@ -59,7 +54,6 @@ export const Summary = _ref => {
59
54
  Summary.defaultProps = {
60
55
  className: '',
61
56
  data: null,
62
- budgets: null,
63
57
  loading: false,
64
58
  size: '',
65
59
  keys: METRICS_WEBPACK_GENERAL,
@@ -70,10 +64,12 @@ Summary.propTypes = {
70
64
  className: PropTypes.string,
71
65
  size: PropTypes.string,
72
66
  keys: PropTypes.arrayOf(PropTypes.string),
73
- data: PropTypes.object,
74
- // eslint-disable-line react/forbid-prop-types
75
- budgets: PropTypes.object,
76
- // eslint-disable-line react/forbid-prop-types
67
+ data: PropTypes.shape({
68
+ [PropTypes.string]: PropTypes.shape({
69
+ baseline: PropTypes.number,
70
+ current: PropTypes.number
71
+ })
72
+ }),
77
73
  loading: PropTypes.bool,
78
74
  showSummaryItemDelta: PropTypes.bool,
79
75
  summaryItemLink: PropTypes.elementType
@@ -4,7 +4,7 @@
4
4
  }
5
5
 
6
6
  .item {
7
- padding: var(--space-small);
7
+ padding: var(--space-small) var(--space-xxlarge) var(--space-small) var(--space-small);
8
8
  flex: 1 0 25%; /* force equal sizes */
9
9
  position: relative;
10
10
  z-index: 1;
@@ -21,33 +21,6 @@ stories.addDecorator(getWrapperDecorator());
21
21
  stories.add('default', () => /*#__PURE__*/React.createElement(Summary, {
22
22
  data: MULTIPLE_JOBS[0].summary
23
23
  }));
24
- stories.add('budgets', () => /*#__PURE__*/React.createElement(Summary, {
25
- data: MULTIPLE_JOBS[0].summary,
26
- budgets: {
27
- webpack: {
28
- totalSizeByTypeALL: {
29
- currentValue: MULTIPLE_JOBS[0].summary.webpack.totalSizeByTypeALL.current,
30
- budgetValue: 1024 * 1024,
31
- failed: false
32
- },
33
- totalInitialSizeJS: {
34
- currentValue: MULTIPLE_JOBS[0].summary.webpack.totalInitialSizeJS.current,
35
- budgetValue: 512 * 1024,
36
- failed: true
37
- },
38
- totalInitialSizeCSS: {
39
- currentValue: MULTIPLE_JOBS[0].summary.webpack.totalInitialSizeCSS.current,
40
- budgetValue: 50 * 1024,
41
- failed: false
42
- },
43
- chunkCount: {
44
- currentValue: MULTIPLE_JOBS[0].summary.webpack.chunkCount.current,
45
- budgetValue: 50,
46
- failed: false
47
- }
48
- }
49
- }
50
- }));
51
24
  stories.add('custom keys', () => /*#__PURE__*/React.createElement(Summary, {
52
25
  keys: METRICS_WEBPACK_ASSETS,
53
26
  data: MULTIPLE_JOBS[0].summary
@@ -11,7 +11,6 @@ import { Stack } from '../../layout/stack';
11
11
  import { FlexStack } from '../../layout/flex-stack';
12
12
  import { Metric } from '../metric';
13
13
  import { Delta } from '../delta';
14
- import { BudgetInfo } from '../budget-info';
15
14
  import css from './summary-item.module.css';
16
15
 
17
16
  const MetricInfo = _ref => {
@@ -44,7 +43,6 @@ export const SummaryItem = _ref2 => {
44
43
  loading,
45
44
  showDelta,
46
45
  showMetricDescription,
47
- budget,
48
46
  ...props
49
47
  } = _ref2;
50
48
  const {
@@ -66,18 +64,12 @@ export const SummaryItem = _ref2 => {
66
64
  as: "h3",
67
65
  space: "xxxsmall",
68
66
  className: css.title
69
- }, /*#__PURE__*/React.createElement("span", {
70
- className: css.titleLabel
71
- }, metric.label), showMetricDescriptionTooltip && /*#__PURE__*/React.createElement(HoverCard, {
67
+ }, /*#__PURE__*/React.createElement("span", null, metric.label), showMetricDescriptionTooltip && /*#__PURE__*/React.createElement(HoverCard, {
72
68
  className: css.icon,
73
69
  label: /*#__PURE__*/React.createElement(Icon, {
74
70
  glyph: "help"
75
71
  })
76
- }, /*#__PURE__*/React.createElement(MetricInfo, metric)), budget && /*#__PURE__*/React.createElement(BudgetInfo, {
77
- className: css.budgetInfo,
78
- metricId: id,
79
- budgetInsight: budget
80
- })), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
72
+ }, /*#__PURE__*/React.createElement(MetricInfo, metric))), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
81
73
  className: css.currentMetric,
82
74
  value: current,
83
75
  formatter: metric.formatter,
@@ -104,8 +96,7 @@ SummaryItem.defaultProps = {
104
96
  size: 'medium',
105
97
  loading: false,
106
98
  showMetricDescription: false,
107
- showDelta: true,
108
- budget: undefined
99
+ showDelta: true
109
100
  };
110
101
  SummaryItem.propTypes = {
111
102
  /** Adopted child class name */
@@ -131,12 +122,5 @@ SummaryItem.propTypes = {
131
122
  showMetricDescription: PropTypes.bool,
132
123
 
133
124
  /** Show delta */
134
- showDelta: PropTypes.bool,
135
-
136
- /** Budget insight data */
137
- budget: PropTypes.shape({
138
- currentBalue: PropTypes.number,
139
- budgetValue: PropTypes.number,
140
- failed: PropTypes.bool
141
- })
125
+ showDelta: PropTypes.bool
142
126
  };