@bundle-stats/ui 4.1.1-alpha.3 → 4.1.1

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 (261) hide show
  1. package/lib/app/app.js +20 -85
  2. package/lib/app/app.stories.js +2 -20
  3. package/lib/app/header/header.js +2 -11
  4. package/lib/app/header/index.js +0 -2
  5. package/lib/app/index.js +0 -2
  6. package/lib/components/asset-info/asset-info.js +7 -25
  7. package/lib/components/asset-info/asset-info.stories.js +0 -5
  8. package/lib/components/asset-info/index.js +0 -2
  9. package/lib/components/browsertime-table/browsertime-table.js +1 -12
  10. package/lib/components/browsertime-table/browsertime-table.stories.js +1 -11
  11. package/lib/components/browsertime-table/index.js +0 -2
  12. package/lib/components/bundle-assets/bundle-assets.constants.js +0 -3
  13. package/lib/components/bundle-assets/bundle-assets.js +29 -86
  14. package/lib/components/bundle-assets/bundle-assets.stories.js +2 -23
  15. package/lib/components/bundle-assets/bundle-assets.utils.js +0 -26
  16. package/lib/components/bundle-assets/index.js +21 -49
  17. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +3 -33
  18. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.stories.js +0 -8
  19. package/lib/components/bundle-assets-totals-chart-bars/index.js +0 -2
  20. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +7 -29
  21. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +0 -10
  22. package/lib/components/bundle-assets-totals-table/index.js +0 -2
  23. package/lib/components/bundle-modules/bundle-modules.constants.js +0 -3
  24. package/lib/components/bundle-modules/bundle-modules.js +24 -77
  25. package/lib/components/bundle-modules/bundle-modules.stories.js +16 -30
  26. package/lib/components/bundle-modules/bundle-modules.utils.js +19 -54
  27. package/lib/components/bundle-modules/index.js +25 -56
  28. package/lib/components/bundle-packages/bundle-packages.constants.js +0 -3
  29. package/lib/components/bundle-packages/bundle-packages.js +33 -83
  30. package/lib/components/bundle-packages/bundle-packages.stories.js +2 -22
  31. package/lib/components/bundle-packages/bundle-packages.utils.js +0 -23
  32. package/lib/components/bundle-packages/index.js +23 -49
  33. package/lib/components/component-link.js +4 -17
  34. package/lib/components/delta/delta.js +3 -10
  35. package/lib/components/delta/delta.stories.js +0 -5
  36. package/lib/components/delta/index.js +0 -2
  37. package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js +3 -15
  38. package/lib/components/duplicate-packages-warning/duplicate-packages-warning.module.css +1 -0
  39. package/lib/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +0 -5
  40. package/lib/components/duplicate-packages-warning/index.js +0 -2
  41. package/lib/components/index.js +0 -22
  42. package/lib/components/job-header/index.js +0 -2
  43. package/lib/components/job-header/job-header.js +6 -22
  44. package/lib/components/job-header/job-header.stories.js +0 -5
  45. package/lib/components/job-meta/index.js +0 -2
  46. package/lib/components/job-meta/job-meta.js +4 -18
  47. package/lib/components/job-meta/job-meta.stories.js +0 -5
  48. package/lib/components/job-name/index.js +0 -2
  49. package/lib/components/job-name/job-name.js +4 -19
  50. package/lib/components/job-name/job-name.stories.js +0 -5
  51. package/lib/components/jobs-header/index.js +0 -2
  52. package/lib/components/jobs-header/jobs-header.js +1 -12
  53. package/lib/components/jobs-header/jobs-header.stories.js +0 -5
  54. package/lib/components/lighthouse-table/index.js +0 -2
  55. package/lib/components/lighthouse-table/lighthouse-table.js +1 -12
  56. package/lib/components/lighthouse-table/lighthouse-table.stories.js +0 -7
  57. package/lib/components/metric/index.js +0 -2
  58. package/lib/components/metric/metric.js +27 -45
  59. package/lib/components/metric/metric.stories.js +0 -6
  60. package/lib/components/metrics-table/index.js +0 -2
  61. package/lib/components/metrics-table/metrics-table.js +36 -75
  62. package/lib/components/metrics-table/metrics-table.stories.js +0 -5
  63. package/lib/components/metrics-table-options/index.js +0 -2
  64. package/lib/components/metrics-table-options/metrics-table-options.js +5 -19
  65. package/lib/components/metrics-table-options/metrics-table-options.stories.js +0 -5
  66. package/lib/components/metrics-table-search/index.js +0 -2
  67. package/lib/components/metrics-table-search/metrics-table-search.js +9 -28
  68. package/lib/components/metrics-table-search/metrics-table-search.stories.js +3 -19
  69. package/lib/components/metrics-table-title/index.js +0 -2
  70. package/lib/components/metrics-table-title/metrics-table-title.js +4 -16
  71. package/lib/components/module-info/index.js +0 -2
  72. package/lib/components/module-info/module-info.js +6 -22
  73. package/lib/components/module-info/module-info.stories.js +0 -5
  74. package/lib/components/summary/index.js +0 -2
  75. package/lib/components/summary/summary.js +9 -33
  76. package/lib/components/summary/summary.module.css +4 -1
  77. package/lib/components/summary/summary.stories.js +1 -15
  78. package/lib/components/summary-item/index.js +0 -2
  79. package/lib/components/summary-item/summary-item.js +14 -44
  80. package/lib/components/summary-item/summary-item.stories.js +0 -14
  81. package/lib/components/total-size-type-title/index.js +0 -2
  82. package/lib/components/total-size-type-title/total-size-type-title.js +0 -13
  83. package/lib/constants.js +0 -8
  84. package/lib/css/default.css +3 -1
  85. package/lib/css/variables.css +1 -1
  86. package/lib/hooks/rows-filter.js +3 -7
  87. package/lib/hooks/rows-sort.js +12 -25
  88. package/lib/hooks/search-params.js +21 -51
  89. package/lib/index.js +0 -10
  90. package/lib/layout/box/box.js +10 -39
  91. package/lib/layout/box/box.stories.js +0 -5
  92. package/lib/layout/box/index.js +0 -1
  93. package/lib/layout/flex-stack/flex-stack.js +4 -18
  94. package/lib/layout/flex-stack/flex-stack.stories.js +0 -6
  95. package/lib/layout/flex-stack/index.js +0 -2
  96. package/lib/layout/footer/footer.js +1 -16
  97. package/lib/layout/footer/footer.stories.js +0 -5
  98. package/lib/layout/footer/index.js +0 -1
  99. package/lib/layout/header/header.js +3 -13
  100. package/lib/layout/header/header.stories.js +0 -7
  101. package/lib/layout/header/index.js +0 -1
  102. package/lib/layout/index.js +0 -7
  103. package/lib/layout/separator.js +2 -14
  104. package/lib/layout/stack/index.js +0 -2
  105. package/lib/layout/stack/stack.js +4 -18
  106. package/lib/layout/stack/stack.stories.js +0 -6
  107. package/lib/layout/sub-header/index.js +0 -2
  108. package/lib/layout/sub-header/sub-header.js +6 -16
  109. package/lib/layout/sub-header/sub-header.stories.js +0 -6
  110. package/lib/prototypes/typography.stories.js +6 -15
  111. package/lib/query-state.js +5 -28
  112. package/lib/stories/index.js +0 -2
  113. package/lib/stories/wrapper.js +0 -9
  114. package/lib/ui/alert/alert.js +2 -10
  115. package/lib/ui/alert/alert.stories.js +0 -5
  116. package/lib/ui/alert/index.js +0 -2
  117. package/lib/ui/container/container.js +2 -15
  118. package/lib/ui/container/container.stories.js +0 -4
  119. package/lib/ui/container/index.js +0 -1
  120. package/lib/ui/dropdown/dropdown.js +5 -20
  121. package/lib/ui/dropdown/dropdown.stories.js +0 -5
  122. package/lib/ui/dropdown/index.js +0 -2
  123. package/lib/ui/empty-set/empty-set.js +3 -17
  124. package/lib/ui/empty-set/empty-set.stories.js +0 -5
  125. package/lib/ui/empty-set/index.js +0 -2
  126. package/lib/ui/file-name/file-name.js +2 -11
  127. package/lib/ui/file-name/file-name.stories.js +0 -4
  128. package/lib/ui/file-name/index.js +0 -1
  129. package/lib/ui/filters/filters.js +29 -73
  130. package/lib/ui/filters/filters.stories.js +7 -28
  131. package/lib/ui/filters/filters.utils.js +13 -42
  132. package/lib/ui/filters/index.js +8 -35
  133. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +18 -61
  134. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +0 -5
  135. package/lib/ui/horizontal-bar-chart/index.js +0 -2
  136. package/lib/ui/hover-card/hover-card.js +8 -28
  137. package/lib/ui/hover-card/hover-card.stories.js +0 -10
  138. package/lib/ui/hover-card/index.js +0 -2
  139. package/lib/ui/icon/icon.js +4 -17
  140. package/lib/ui/icon/icon.stories.js +0 -8
  141. package/lib/ui/icon/index.js +0 -2
  142. package/lib/ui/index.js +0 -19
  143. package/lib/ui/input/index.js +0 -2
  144. package/lib/ui/input/input.js +2 -14
  145. package/lib/ui/input/input.stories.js +0 -5
  146. package/lib/ui/loader/index.js +0 -2
  147. package/lib/ui/loader/loader.js +2 -15
  148. package/lib/ui/loader/loader.stories.js +0 -5
  149. package/lib/ui/logo/index.js +0 -1
  150. package/lib/ui/logo/logo.js +3 -28
  151. package/lib/ui/logo/logo.stories.js +1 -10
  152. package/lib/ui/panels/index.js +0 -1
  153. package/lib/ui/panels/panels.js +5 -23
  154. package/lib/ui/panels/panels.stories.js +0 -5
  155. package/lib/ui/skeleton/index.js +0 -2
  156. package/lib/ui/skeleton/skeleton.js +3 -15
  157. package/lib/ui/skeleton/skeleton.stories.js +0 -8
  158. package/lib/ui/sort-dropdown/index.js +0 -2
  159. package/lib/ui/sort-dropdown/sort-dropdown.js +18 -50
  160. package/lib/ui/sort-dropdown/sort-dropdown.stories.js +1 -5
  161. package/lib/ui/table/index.js +0 -2
  162. package/lib/ui/table/table.js +4 -13
  163. package/lib/ui/table/table.stories.js +4 -9
  164. package/lib/ui/tabs/index.js +0 -1
  165. package/lib/ui/tabs/tabs.js +5 -21
  166. package/lib/ui/tabs/tabs.module.css +6 -2
  167. package/lib/ui/tabs/tabs.stories.js +0 -5
  168. package/lib/ui/tag/index.js +0 -2
  169. package/lib/ui/tag/tag.js +8 -21
  170. package/lib/ui/tag/tag.stories.js +0 -6
  171. package/lib/ui/toolbar/index.js +0 -2
  172. package/lib/ui/toolbar/toolbar.js +2 -9
  173. package/lib/ui/toolbar/toolbar.stories.js +0 -5
  174. package/lib/ui/tooltip/index.js +0 -2
  175. package/lib/ui/tooltip/tooltip.js +8 -21
  176. package/lib/ui/tooltip/tooltip.stories.js +0 -7
  177. package/lib/utils.js +0 -18
  178. package/lib-esm/app/app.js +1 -18
  179. package/lib-esm/app/app.stories.js +3 -5
  180. package/lib-esm/app/header/header.js +1 -1
  181. package/lib-esm/components/asset-info/asset-info.js +0 -8
  182. package/lib-esm/components/browsertime-table/browsertime-table.js +0 -1
  183. package/lib-esm/components/browsertime-table/browsertime-table.stories.js +2 -1
  184. package/lib-esm/components/bundle-assets/bundle-assets.js +2 -14
  185. package/lib-esm/components/bundle-assets/bundle-assets.stories.js +0 -2
  186. package/lib-esm/components/bundle-assets/bundle-assets.utils.js +4 -11
  187. package/lib-esm/components/bundle-assets/index.js +0 -1
  188. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +0 -7
  189. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +1 -4
  190. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +0 -2
  191. package/lib-esm/components/bundle-modules/bundle-modules.js +4 -16
  192. package/lib-esm/components/bundle-modules/bundle-modules.stories.js +4 -2
  193. package/lib-esm/components/bundle-modules/bundle-modules.utils.js +15 -25
  194. package/lib-esm/components/bundle-modules/index.js +0 -6
  195. package/lib-esm/components/bundle-packages/bundle-packages.js +2 -11
  196. package/lib-esm/components/bundle-packages/bundle-packages.utils.js +4 -8
  197. package/lib-esm/components/bundle-packages/index.js +0 -1
  198. package/lib-esm/components/component-link.js +1 -2
  199. package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.module.css +1 -0
  200. package/lib-esm/components/job-header/job-header.js +1 -3
  201. package/lib-esm/components/job-meta/job-meta.js +0 -3
  202. package/lib-esm/components/job-name/job-name.js +0 -4
  203. package/lib-esm/components/jobs-header/jobs-header.js +0 -1
  204. package/lib-esm/components/lighthouse-table/lighthouse-table.js +0 -1
  205. package/lib-esm/components/metric/metric.js +2 -6
  206. package/lib-esm/components/metrics-table/metrics-table.js +14 -18
  207. package/lib-esm/components/metrics-table-options/metrics-table-options.js +0 -3
  208. package/lib-esm/components/metrics-table-search/metrics-table-search.js +4 -2
  209. package/lib-esm/components/metrics-table-search/metrics-table-search.stories.js +0 -2
  210. package/lib-esm/components/module-info/module-info.js +0 -4
  211. package/lib-esm/components/summary/summary.js +0 -2
  212. package/lib-esm/components/summary/summary.module.css +4 -1
  213. package/lib-esm/components/summary/summary.stories.js +0 -1
  214. package/lib-esm/components/summary-item/summary-item.js +0 -9
  215. package/lib-esm/constants.js +2 -1
  216. package/lib-esm/css/default.css +3 -1
  217. package/lib-esm/css/variables.css +1 -1
  218. package/lib-esm/hooks/rows-filter.js +0 -1
  219. package/lib-esm/hooks/search-params.js +9 -17
  220. package/lib-esm/layout/box/box.js +0 -6
  221. package/lib-esm/layout/flex-stack/flex-stack.js +0 -1
  222. package/lib-esm/layout/footer/footer.js +1 -4
  223. package/lib-esm/layout/header/header.js +0 -3
  224. package/lib-esm/layout/separator.js +1 -2
  225. package/lib-esm/layout/stack/stack.js +0 -1
  226. package/lib-esm/prototypes/typography.stories.js +4 -4
  227. package/lib-esm/query-state.js +2 -5
  228. package/lib-esm/stories/wrapper.js +0 -1
  229. package/lib-esm/ui/container/container.js +0 -2
  230. package/lib-esm/ui/dropdown/dropdown.js +0 -5
  231. package/lib-esm/ui/file-name/file-name.js +0 -2
  232. package/lib-esm/ui/filters/filters.js +4 -14
  233. package/lib-esm/ui/filters/filters.stories.js +5 -4
  234. package/lib-esm/ui/filters/filters.utils.js +9 -15
  235. package/lib-esm/ui/filters/index.js +4 -10
  236. package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +0 -12
  237. package/lib-esm/ui/hover-card/hover-card.js +2 -12
  238. package/lib-esm/ui/hover-card/hover-card.stories.js +0 -3
  239. package/lib-esm/ui/icon/icon.js +0 -1
  240. package/lib-esm/ui/icon/icon.stories.js +0 -2
  241. package/lib-esm/ui/input/input.js +0 -1
  242. package/lib-esm/ui/loader/loader.js +0 -2
  243. package/lib-esm/ui/logo/logo.js +0 -11
  244. package/lib-esm/ui/logo/logo.stories.js +1 -5
  245. package/lib-esm/ui/panels/panels.js +2 -5
  246. package/lib-esm/ui/skeleton/skeleton.js +0 -1
  247. package/lib-esm/ui/sort-dropdown/sort-dropdown.js +0 -8
  248. package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +1 -0
  249. package/lib-esm/ui/table/table.js +0 -2
  250. package/lib-esm/ui/tabs/tabs.js +0 -4
  251. package/lib-esm/ui/tabs/tabs.module.css +6 -2
  252. package/lib-esm/ui/tag/tag.js +0 -1
  253. package/lib-esm/ui/tooltip/tooltip.js +1 -2
  254. package/lib-esm/ui/tooltip/tooltip.stories.js +0 -2
  255. package/lib-esm/utils.js +2 -9
  256. package/package.json +15 -15
  257. package/src/components/duplicate-packages-warning/duplicate-packages-warning.module.css +1 -0
  258. package/src/components/summary/summary.module.css +4 -1
  259. package/src/css/default.css +3 -1
  260. package/src/css/variables.css +1 -1
  261. package/src/ui/tabs/tabs.module.css +6 -2
@@ -9,11 +9,12 @@ export const addRowSourceFlag = row => {
9
9
  const {
10
10
  key,
11
11
  runs
12
- } = row; // @NOTE Assign instead destructuring for perf reasons
13
- // eslint-disable-next-line no-param-reassign
14
-
15
- row.thirdParty = Boolean(key.match(MODULE_PATH_PACKAGES)); // eslint-disable-next-line no-param-reassign
12
+ } = row;
16
13
 
14
+ // @NOTE Assign instead destructuring for perf reasons
15
+ // eslint-disable-next-line no-param-reassign
16
+ row.thirdParty = Boolean(key.match(MODULE_PATH_PACKAGES));
17
+ // eslint-disable-next-line no-param-reassign
17
18
  row.duplicated = Boolean(runs.find(run => (run == null ? void 0 : run.duplicated) === true));
18
19
  return row;
19
20
  };
@@ -21,40 +22,35 @@ export const getCustomSort = sortBy => item => {
21
22
  if (sortBy === SORT_BY_NAME) {
22
23
  return item.key;
23
24
  }
24
-
25
25
  if (sortBy === SORT_BY_SIZE) {
26
26
  return _get(item, 'runs[0].value', 0);
27
27
  }
28
-
29
28
  if (sortBy === SORT_BY_DELTA) {
30
29
  return _get(item, 'runs[0].deltaPercentage', 0);
31
30
  }
32
-
33
31
  return [!item.changed, item.key];
34
32
  };
35
33
  export const getRowFilter = filters => row => {
36
34
  // Skip not changed rows
37
35
  if (filters[MODULE_FILTERS.CHANGED] && !row.changed) {
38
36
  return false;
39
- } // Skip not duplicated rows
40
-
37
+ }
41
38
 
39
+ // Skip not duplicated rows
42
40
  if (filters[MODULE_FILTERS.DUPLICATED] && !row.duplicated) {
43
41
  return false;
44
- } // Skip not matching source type
45
-
42
+ }
46
43
 
44
+ // Skip not matching source type
47
45
  if (!(filters[`${MODULE_SOURCE_TYPE}.${MODULE_FILTERS.FIRST_PARTY}`] && row.thirdParty === false || filters[`${MODULE_SOURCE_TYPE}.${MODULE_FILTERS.THIRD_PARTY}`] && row.thirdParty === true)) {
48
46
  return false;
49
- } // Skip not matching source file types
50
-
47
+ }
51
48
 
49
+ // Skip not matching source file types
52
50
  const fileType = getModuleSourceFileType(row.key);
53
-
54
51
  if (!filters[`${MODULE_FILE_TYPE}.${fileType}`]) {
55
52
  return false;
56
53
  }
57
-
58
54
  return true;
59
55
  };
60
56
  export const useModuleFilterByChunk = _ref => {
@@ -69,37 +65,31 @@ export const useModuleFilterByChunk = _ref => {
69
65
  if (_get(filters, `${MODULE_CHUNK}.${chunkId}`)) {
70
66
  return [...agg, chunkId];
71
67
  }
72
-
73
68
  return agg;
74
- }, []); // If all the filters are included, return jobs as they are
69
+ }, []);
75
70
 
71
+ // If all the filters are included, return jobs as they are
76
72
  if (includedChunkIds.length === chunkIds.length) {
77
73
  return jobs;
78
74
  }
79
-
80
75
  const jobsWithFilteredData = jobs.map(job => {
81
76
  var _job$metrics, _job$metrics$webpack;
82
-
83
77
  const modules = job == null ? void 0 : (_job$metrics = job.metrics) == null ? void 0 : (_job$metrics$webpack = _job$metrics.webpack) == null ? void 0 : _job$metrics$webpack.modules;
84
-
85
78
  if (!modules) {
86
79
  return job;
87
80
  }
88
-
89
81
  const filteredModules = Object.entries(modules).reduce((agg, _ref2) => {
90
82
  let [moduleId, moduleEntry] = _ref2;
91
-
92
83
  const match = _intersection(moduleEntry.chunkIds, includedChunkIds);
93
-
94
84
  if (match.length > 0) {
95
85
  agg[moduleId] = moduleEntry; // eslint-disable-line no-param-reassign
96
86
  }
97
87
 
98
88
  return agg;
99
- }, {}); // Copy job data into a new object to prevent mutations of the original data
89
+ }, {});
100
90
 
91
+ // Copy job data into a new object to prevent mutations of the original data
101
92
  const newJob = _merge({}, job);
102
-
103
93
  newJob.metrics.webpack.modules = filteredModules;
104
94
  return newJob;
105
95
  });
@@ -1,8 +1,6 @@
1
1
  import _map from "lodash/map";
2
2
  import _uniqBy from "lodash/uniqBy";
3
-
4
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
5
-
6
4
  import React, { useMemo } from 'react';
7
5
  import PropTypes from 'prop-types';
8
6
  import { MODULE_FILTERS, getModuleChunkFilters, getModuleSourceTypeFilters, getModuleFileTypeFilters } from '@bundle-stats/utils';
@@ -23,10 +21,8 @@ export const BundleModules = props => {
23
21
  direction,
24
22
  ...restProps
25
23
  } = props;
26
-
27
24
  const chunks = _uniqBy(jobs.map(job => {
28
25
  var _job$meta, _job$meta$webpack;
29
-
30
26
  return (job == null ? void 0 : (_job$meta = job.meta) == null ? void 0 : (_job$meta$webpack = _job$meta.webpack) == null ? void 0 : _job$meta$webpack.chunks) || [];
31
27
  }).flat(), _ref => {
32
28
  let {
@@ -34,9 +30,7 @@ export const BundleModules = props => {
34
30
  } = _ref;
35
31
  return id;
36
32
  });
37
-
38
33
  const chunkIds = _map(chunks, 'id');
39
-
40
34
  const {
41
35
  defaultFilters,
42
36
  allEntriesFilters
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React, { useCallback, useMemo, useState } from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import cx from 'classnames';
@@ -21,7 +20,6 @@ import { MetricsTableSearch } from '../metrics-table-search';
21
20
  import { MetricsTableOptions } from '../metrics-table-options';
22
21
  import { MetricsTableTitle } from '../metrics-table-title';
23
22
  import css from './bundle-packages.module.css';
24
-
25
23
  const getDropdownFilters = _ref => {
26
24
  let {
27
25
  compareMode,
@@ -39,7 +37,6 @@ const getDropdownFilters = _ref => {
39
37
  }
40
38
  };
41
39
  };
42
-
43
40
  const PackagePopoverContent = _ref2 => {
44
41
  let {
45
42
  name,
@@ -84,7 +81,6 @@ const PackagePopoverContent = _ref2 => {
84
81
  className: css.packageHoverCardActions
85
82
  }, duplicate && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CustomComponentLink, getBundlePackagesByNameComponentLink(normalizedName), "View all duplicate instances")), /*#__PURE__*/React.createElement(CustomComponentLink, getBundleModulesBySearch(normalizedPackagePath), "Search modules by package path")));
86
83
  };
87
-
88
84
  PackagePopoverContent.propTypes = {
89
85
  name: PropTypes.string.isRequired,
90
86
  path: PropTypes.string,
@@ -95,7 +91,6 @@ PackagePopoverContent.propTypes = {
95
91
  PackagePopoverContent.defaultProps = {
96
92
  path: ''
97
93
  };
98
-
99
94
  const PackageName = _ref3 => {
100
95
  let {
101
96
  packageName,
@@ -114,14 +109,12 @@ const PackageName = _ref3 => {
114
109
  }), /*#__PURE__*/React.createElement("span", {
115
110
  className: css.packageNameLabel
116
111
  }, packageName)), [packageName, showDuplicateFlag, row]);
117
-
118
112
  if (!showHoverCard) {
119
113
  return /*#__PURE__*/React.createElement("span", {
120
114
  className: css.packageName,
121
115
  onMouseEnter: handleOnMouseEnter
122
116
  }, label);
123
117
  }
124
-
125
118
  return /*#__PURE__*/React.createElement(HoverCard, {
126
119
  className: css.packageName,
127
120
  label: /*#__PURE__*/React.createElement("span", {
@@ -135,7 +128,6 @@ const PackageName = _ref3 => {
135
128
  CustomComponentLink: CustomComponentLink
136
129
  }));
137
130
  };
138
-
139
131
  PackageName.propTypes = {
140
132
  packageName: PropTypes.string.isRequired,
141
133
  path: PropTypes.string.isRequired,
@@ -149,7 +141,6 @@ PackageName.propTypes = {
149
141
  }).isRequired,
150
142
  CustomComponentLink: PropTypes.elementType.isRequired
151
143
  };
152
-
153
144
  const RowHeader = _ref4 => {
154
145
  let {
155
146
  row,
@@ -163,14 +154,14 @@ const RowHeader = _ref4 => {
163
154
  className: css.packageNames
164
155
  }, packageNames.map((packageName, index) => /*#__PURE__*/React.createElement(PackageName, {
165
156
  packageName: packageName,
166
- path: path // Render duplicate flag only for the last entry
157
+ path: path
158
+ // Render duplicate flag only for the last entry
167
159
  ,
168
160
  showDuplicateFlag: index === packageNames.length - 1,
169
161
  row: row,
170
162
  CustomComponentLink: CustomComponentLink
171
163
  })));
172
164
  };
173
-
174
165
  RowHeader.propTypes = {
175
166
  row: PropTypes.shape({
176
167
  label: PropTypes.string,
@@ -2,12 +2,12 @@ import _uniq from "lodash/uniq";
2
2
  import _flatten from "lodash/flatten";
3
3
  import _get from "lodash/get";
4
4
  import { PACKAGE_FILTERS } from '@bundle-stats/utils';
5
- import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-packages.constants'; // Get a list of duplicate packages across jobs
5
+ import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-packages.constants';
6
6
 
7
+ // Get a list of duplicate packages across jobs
7
8
  export const getDuplicatePackages = jobs => {
8
9
  const jobsDuplicatePackages = jobs.map(job => {
9
10
  var _job$insights, _job$insights$webpack, _job$insights$webpack2;
10
-
11
11
  const insightsData = (job == null ? void 0 : (_job$insights = job.insights) == null ? void 0 : (_job$insights$webpack = _job$insights.webpack) == null ? void 0 : (_job$insights$webpack2 = _job$insights$webpack.duplicatePackages) == null ? void 0 : _job$insights$webpack2.data) || {};
12
12
  return Object.values(insightsData).flat();
13
13
  });
@@ -17,28 +17,24 @@ export const getRowFilter = filters => item => {
17
17
  if (filters[PACKAGE_FILTERS.CHANGED] && !item.changed) {
18
18
  return false;
19
19
  }
20
-
21
20
  if (filters[PACKAGE_FILTERS.DUPLICATE] && !item.duplicate) {
22
21
  return false;
23
22
  }
24
-
25
23
  return true;
26
24
  };
27
25
  export const getCustomSort = sortId => item => {
28
26
  if (sortId === SORT_BY_NAME) {
29
27
  return item.key;
30
28
  }
31
-
32
29
  if (sortId === SORT_BY_DELTA) {
33
30
  return _get(item, 'runs[0].deltaPercentage', 0);
34
31
  }
35
-
36
32
  if (sortId === SORT_BY_SIZE) {
37
33
  return _get(item, 'runs[0].value', 0);
38
34
  }
39
-
40
35
  return [!item.changed, item.key];
41
36
  };
42
- export const getAddRowDuplicateFlag = duplicateJobs => row => ({ ...row,
37
+ export const getAddRowDuplicateFlag = duplicateJobs => row => ({
38
+ ...row,
43
39
  duplicate: duplicateJobs.includes(row.key)
44
40
  });
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React, { useMemo } from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import { PACKAGE_FILTERS } from '@bundle-stats/utils';
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import { Link } from 'react-router-dom';
@@ -26,8 +25,8 @@ ComponentLink.propTypes = {
26
25
  section: PropTypes.string.isRequired,
27
26
  title: PropTypes.string,
28
27
  params: PropTypes.object // eslint-disable-line react/forbid-prop-types
29
-
30
28
  };
29
+
31
30
  ComponentLink.defaultProps = {
32
31
  title: '',
33
32
  params: {}
@@ -18,4 +18,5 @@
18
18
  padding: 1px 2px;
19
19
  vertical-align: super;
20
20
  font-size: 9px;
21
+ line-height: 1;
21
22
  }
@@ -16,12 +16,10 @@ export const JobHeader = props => {
16
16
  job,
17
17
  children
18
18
  } = props;
19
-
20
19
  const {
21
20
  builtAt,
22
21
  hash
23
22
  } = _get(job, `meta.${SOURCE_PATH_WEBPACK_STATS}`, {});
24
-
25
23
  const rootClassName = cx(css.root, className);
26
24
  return /*#__PURE__*/React.createElement(Stack, {
27
25
  className: rootClassName,
@@ -64,8 +62,8 @@ JobHeader.propTypes = {
64
62
  builtAt: PropTypes.string
65
63
  }),
66
64
  summary: PropTypes.object // eslint-disable-line react/forbid-prop-types
67
-
68
65
  }),
66
+
69
67
  children: PropTypes.element
70
68
  };
71
69
  JobHeader.defaultProps = {
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import cx from 'classnames';
@@ -31,13 +30,11 @@ export const JobMeta = props => {
31
30
  JobMeta.propTypes = {
32
31
  /** Adopted child class name */
33
32
  className: PropTypes.string,
34
-
35
33
  /** Contrnt */
36
34
  meta: PropTypes.arrayOf(PropTypes.shape({
37
35
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
38
36
  content: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.element]))
39
37
  })).isRequired,
40
-
41
38
  /** Render component */
42
39
  as: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
43
40
  };
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import { Tooltip } from '../../ui/tooltip';
@@ -27,13 +26,10 @@ JobName.defaultProps = {
27
26
  JobName.propTypes = {
28
27
  /** Rendered component */
29
28
  as: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
30
-
31
29
  /** Tooltip title */
32
30
  title: PropTypes.string,
33
-
34
31
  /** Job internal build number */
35
32
  internalBuildNumber: PropTypes.number,
36
-
37
33
  /** Render function */
38
34
  children: PropTypes.node
39
35
  };
@@ -24,7 +24,6 @@ export const JobsHeader = props => {
24
24
  JobsHeader.propTypes = {
25
25
  /** Adopted child classname */
26
26
  className: PropTypes.string,
27
-
28
27
  /** Jobs data */
29
28
  jobs: PropTypes.arrayOf(PropTypes.shape({
30
29
  internalBuildNumber: PropTypes.number
@@ -21,5 +21,4 @@ LighthouseTable.defaultProps = {
21
21
  LighthouseTable.propTypes = {
22
22
  className: PropTypes.string,
23
23
  jobs: PropTypes.array // eslint-disable-line react/forbid-prop-types
24
-
25
24
  };
@@ -1,8 +1,9 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
- import css from './metric.module.css'; // Separate value and unit
4
+ import css from './metric.module.css';
5
5
 
6
+ // Separate value and unit
6
7
  const EXTRACT_VALUE_UNIT_PATTERN = /([\d|.|,| ]*)(\w*|%)$/;
7
8
  export const Metric = _ref => {
8
9
  let {
@@ -18,27 +19,22 @@ export const Metric = _ref => {
18
19
  displayUnit
19
20
  } = useMemo(() => {
20
21
  const formattedValue = formatter == null ? void 0 : formatter(value);
21
-
22
22
  if (!formattedValue) {
23
23
  return {
24
24
  displayValue: value
25
25
  };
26
26
  }
27
-
28
27
  if (!enhanced) {
29
28
  return {
30
29
  displayValue: formattedValue
31
30
  };
32
31
  }
33
-
34
32
  const matches = formattedValue.match(EXTRACT_VALUE_UNIT_PATTERN);
35
-
36
33
  if (!matches) {
37
34
  return {
38
35
  displayValue: value
39
36
  };
40
37
  }
41
-
42
38
  return {
43
39
  displayUnit: matches[2],
44
40
  displayValue: matches[1]
@@ -1,9 +1,7 @@
1
1
  import _sum from "lodash/sum";
2
2
  import _isEmpty from "lodash/isEmpty";
3
3
  import _get from "lodash/get";
4
-
5
4
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
6
-
7
5
  import React, { useMemo } from 'react';
8
6
  import PropTypes from 'prop-types';
9
7
  import cx from 'classnames';
@@ -14,13 +12,10 @@ import { Delta } from '../delta';
14
12
  import { JobName } from '../job-name';
15
13
  import styles from './metrics-table.module.css';
16
14
  const METRIC_TYPE_DATA = getGlobalMetricType(null, METRIC_TYPE_FILE_SIZE);
17
-
18
15
  const getRowsRunTotal = (rows, runIndex) => _sum(rows.map(row => _get(row, `runs[${runIndex}].value`, 0)));
19
-
20
16
  const getHeaderLabelCells = rows => (run, runIndex, runs) => {
21
17
  const isBaseline = runIndex === runs.length - 1;
22
18
  const className = cx(styles.value, isBaseline ? styles.baseline : styles.current);
23
-
24
19
  if (!run) {
25
20
  return [{
26
21
  children: '-',
@@ -30,7 +25,6 @@ const getHeaderLabelCells = rows => (run, runIndex, runs) => {
30
25
  className: styles.delta
31
26
  }] : [])];
32
27
  }
33
-
34
28
  const {
35
29
  label,
36
30
  internalBuildNumber
@@ -40,31 +34,34 @@ const getHeaderLabelCells = rows => (run, runIndex, runs) => {
40
34
  internalBuildNumber: internalBuildNumber,
41
35
  className: styles.jobName
42
36
  }, label);
43
- return [// Value column
37
+ return [
38
+ // Value column
44
39
  {
45
40
  children: jobName,
46
41
  className
47
- }, // Delta column
42
+ },
43
+ // Delta column
48
44
  ...(!isBaseline ? [{
49
45
  children: ' ',
50
46
  className: cx(styles.delta)
51
47
  }] : [])];
52
48
  };
53
-
54
49
  const getHeaderTotalCells = rows => (run, runIndex, runs) => {
55
50
  const isBaseline = runIndex === runs.length - 1;
56
51
  const className = cx(styles.value, isBaseline ? styles.baseline : styles.current);
57
52
  const currentRunTotal = getRowsRunTotal(rows, runIndex);
58
53
  const baselineRunTotal = !isBaseline && getRowsRunTotal(rows, runIndex + 1);
59
54
  const infoTotal = getMetricRunInfo(METRIC_TYPE_DATA, currentRunTotal, baselineRunTotal);
60
- return [// Value column
55
+ return [
56
+ // Value column
61
57
  {
62
58
  children: /*#__PURE__*/React.createElement(Metric, {
63
59
  className: styles.tableHeaderRunMetric,
64
60
  value: infoTotal.displayValue
65
61
  }),
66
62
  className
67
- }, // Delta column
63
+ },
64
+ // Delta column
68
65
  ...(!isBaseline ? [{
69
66
  children: /*#__PURE__*/React.createElement(Delta, {
70
67
  displayValue: infoTotal.displayDeltaPercentage,
@@ -73,21 +70,21 @@ const getHeaderTotalCells = rows => (run, runIndex, runs) => {
73
70
  className: styles.delta
74
71
  }] : [])];
75
72
  };
76
-
77
73
  const getHeaderRows = (runs, items, showHeaderSum, title) => [{
78
74
  className: styles.headerRowColumns,
79
- cells: [// Metric name column - one empty strying to render the column
75
+ cells: [
76
+ // Metric name column - one empty strying to render the column
80
77
  {
81
78
  children: title || ' ',
82
79
  className: styles.metricName,
83
80
  rowSpan: showHeaderSum ? 2 : 1
84
- }, // Runs
81
+ },
82
+ // Runs
85
83
  ...runs.map(getHeaderLabelCells(items)).flat()]
86
84
  }, ...(showHeaderSum ? [{
87
85
  className: styles.headerRowTotals,
88
86
  cells: runs.map(getHeaderTotalCells(items)).flat()
89
87
  }] : [])];
90
-
91
88
  const MetricsTableRow = _ref => {
92
89
  let {
93
90
  item,
@@ -99,8 +96,9 @@ const MetricsTableRow = _ref => {
99
96
  className: styles.metricName
100
97
  }, renderRowHeader(item)), item.runs.map((run, index) => {
101
98
  const isBaseline = index === item.runs.length - 1;
102
- const valueClassName = cx(styles.value, !isBaseline && styles.current); // Empty cells if no value
99
+ const valueClassName = cx(styles.value, !isBaseline && styles.current);
103
100
 
101
+ // Empty cells if no value
104
102
  if (!run || typeof run.value === 'undefined') {
105
103
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table.Td, {
106
104
  className: valueClassName
@@ -108,7 +106,6 @@ const MetricsTableRow = _ref => {
108
106
  className: styles.delta
109
107
  }));
110
108
  }
111
-
112
109
  const {
113
110
  displayValue,
114
111
  deltaPercentage,
@@ -127,7 +124,6 @@ const MetricsTableRow = _ref => {
127
124
  })));
128
125
  }));
129
126
  };
130
-
131
127
  MetricsTableRow.propTypes = {
132
128
  item: PropTypes.shape({
133
129
  changed: PropTypes.bool,
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import I18N from '../../i18n';
@@ -20,12 +19,10 @@ export const MetricsTableOptions = props => {
20
19
  menu,
21
20
  menuItemClassName
22
21
  } = _ref;
23
-
24
22
  const getButtonOnClick = handler => () => {
25
23
  handler();
26
24
  menu.toggle();
27
25
  };
28
-
29
26
  return /*#__PURE__*/React.createElement(React.Fragment, null, handleResetFilters && /*#__PURE__*/React.createElement(MenuItem, _extends({}, menu, {
30
27
  className: menuItemClassName,
31
28
  onClick: getButtonOnClick(handleResetFilters)
@@ -13,16 +13,18 @@ export const MetricsTableSearch = props => {
13
13
  updateSearch
14
14
  } = props;
15
15
  const rootClassname = cx(css.root, className);
16
- const [value, setValue] = useState(search); // Update local state when initial value has changed
16
+ const [value, setValue] = useState(search);
17
17
 
18
+ // Update local state when initial value has changed
18
19
  useEffect(() => {
19
20
  setValue(search);
20
21
  }, [search]);
21
22
  const debouncedUpdateSearch = useCallback(_debounce(updateSearch, 500), []);
22
23
  const handleChangeValue = useCallback(event => {
23
24
  const newValue = event.target.value;
24
- setValue(newValue); // Update parent state when the local value has changed
25
+ setValue(newValue);
25
26
 
27
+ // Update parent state when the local value has changed
26
28
  if (newValue !== search) {
27
29
  debouncedUpdateSearch(newValue);
28
30
  }
@@ -4,7 +4,6 @@ import { getWrapperDecorator } from '../../stories';
4
4
  import { MetricsTableSearch } from '.';
5
5
  const stories = storiesOf('Components/MetricsTableSearch', module);
6
6
  stories.addDecorator(getWrapperDecorator());
7
-
8
7
  const MetricsTableWithState = () => {
9
8
  const [search, updateSearch] = useState('');
10
9
  return /*#__PURE__*/React.createElement(MetricsTableSearch, {
@@ -13,5 +12,4 @@ const MetricsTableWithState = () => {
13
12
  updateSearch: updateSearch
14
13
  });
15
14
  };
16
-
17
15
  stories.add('default', () => /*#__PURE__*/React.createElement(MetricsTableWithState, null));
@@ -1,9 +1,7 @@
1
1
  import _noop from "lodash/noop";
2
2
  import _find from "lodash/find";
3
3
  import _isEmpty from "lodash/isEmpty";
4
-
5
4
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
6
-
7
5
  import React from 'react';
8
6
  import PropTypes from 'prop-types';
9
7
  import { getBundleModulesByChunk } from '@bundle-stats/utils';
@@ -38,11 +36,9 @@ export const ModuleInfo = props => {
38
36
  const chunk = _find(chunks, {
39
37
  id: chunkId
40
38
  });
41
-
42
39
  if (!chunk) {
43
40
  return null;
44
41
  }
45
-
46
42
  return /*#__PURE__*/React.createElement(CustomComponentLink, _extends({}, getBundleModulesByChunk(chunkIds, chunkId), {
47
43
  onClick: onClick,
48
44
  className: css.chunksItem
@@ -1,7 +1,5 @@
1
1
  import _get from "lodash/get";
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
3
  import React from 'react';
6
4
  import PropTypes from 'prop-types';
7
5
  import cx from 'classnames';
@@ -9,6 +9,9 @@
9
9
  text-decoration: none;
10
10
  }
11
11
 
12
- .item:hover {
12
+ .item:hover,
13
+ .item:active,
14
+ .item:focus {
13
15
  border-color: var(--color-outline-dark);
16
+ outline: none;
14
17
  }
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
-
3
2
  import React from 'react';
4
3
  import { storiesOf } from '@storybook/react';
5
4
  import { createJobs } from '@bundle-stats/utils';