@bundle-stats/ui 3.2.0-beta.1 → 3.2.1-beta.3
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/.babelrc.js +3 -3
- package/CHANGELOG.md +20 -4
- package/lib/assets/icons/arrow.svg +1 -0
- package/lib/assets/icons/cancel.svg +1 -0
- package/lib/assets/icons/clock.svg +1 -0
- package/lib/assets/icons/close.svg +1 -0
- package/lib/assets/icons/commit.svg +1 -0
- package/lib/assets/icons/filter.svg +1 -0
- package/lib/assets/icons/help.svg +1 -0
- package/lib/assets/icons/menu.svg +1 -0
- package/lib/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib/assets/icons/warning.svg +1 -0
- package/lib/assets/icons.svg +1 -0
- package/lib/components/bundle-assets/bundle-assets.js +3 -3
- package/lib/components/bundle-assets/bundle-assets.stories.js +19 -7
- package/lib/components/bundle-assets/bundle-assets.utils.js +95 -28
- package/lib/components/bundle-assets/index.js +115 -4
- package/lib/components/bundle-modules/bundle-modules.js +3 -3
- package/lib/components/bundle-modules/bundle-modules.utils.js +152 -0
- package/lib/components/bundle-modules/index.js +135 -4
- package/lib/components/bundle-packages/bundle-packages.js +3 -3
- package/lib/components/bundle-packages/{bundle-packages.container.js → bundle-packages.utils.js} +8 -42
- package/lib/components/bundle-packages/index.js +111 -3
- package/lib/components/metrics-table/metrics-table.js +3 -7
- package/lib/components/metrics-table-search/metrics-table-search.js +2 -1
- package/lib/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib/hooks/rows-filter.js +28 -0
- package/lib/hooks/rows-sort.js +54 -0
- package/lib/{hocs/with-search.js → hooks/search-params.js} +15 -64
- package/lib/ui/icon/icon.js +4 -191
- package/lib/ui/sort-dropdown/sort-dropdown.js +12 -13
- package/lib/ui/sort-dropdown/sort-dropdown.stories.js +2 -2
- package/lib/utils.js +6 -3
- package/lib-esm/app/app.js +60 -70
- package/lib-esm/app/app.stories.js +50 -71
- package/lib-esm/app/header/header.js +5 -3
- package/lib-esm/assets/icons/arrow.svg +1 -0
- package/lib-esm/assets/icons/cancel.svg +1 -0
- package/lib-esm/assets/icons/clock.svg +1 -0
- package/lib-esm/assets/icons/close.svg +1 -0
- package/lib-esm/assets/icons/commit.svg +1 -0
- package/lib-esm/assets/icons/filter.svg +1 -0
- package/lib-esm/assets/icons/help.svg +1 -0
- package/lib-esm/assets/icons/menu.svg +1 -0
- package/lib-esm/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib-esm/assets/icons/warning.svg +1 -0
- package/lib-esm/assets/icons.svg +1 -0
- package/lib-esm/components/asset-info/asset-info.js +21 -17
- package/lib-esm/components/asset-info/asset-info.stories.js +29 -33
- package/lib-esm/components/browsertime-table/browsertime-table.js +6 -4
- package/lib-esm/components/browsertime-table/browsertime-table.stories.js +9 -13
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js +17 -15
- package/lib-esm/components/bundle-assets/bundle-assets.js +107 -97
- package/lib-esm/components/bundle-assets/bundle-assets.stories.js +58 -63
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +65 -21
- package/lib-esm/components/bundle-assets/index.js +89 -2
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +49 -51
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.stories.js +9 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +14 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +13 -19
- package/lib-esm/components/bundle-modules/bundle-modules.constants.js +17 -15
- package/lib-esm/components/bundle-modules/bundle-modules.js +112 -110
- package/lib-esm/components/bundle-modules/bundle-modules.stories.js +46 -58
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +98 -0
- package/lib-esm/components/bundle-modules/index.js +114 -3
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js +17 -15
- package/lib-esm/components/bundle-packages/bundle-packages.js +71 -69
- package/lib-esm/components/bundle-packages/bundle-packages.stories.js +34 -46
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js +44 -0
- package/lib-esm/components/bundle-packages/index.js +87 -2
- package/lib-esm/components/component-link.js +10 -13
- package/lib-esm/components/delta/delta.js +8 -6
- package/lib-esm/components/delta/delta.stories.js +26 -38
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +11 -9
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +20 -26
- package/lib-esm/components/job-header/job-header.js +14 -11
- package/lib-esm/components/job-header/job-header.stories.js +12 -18
- package/lib-esm/components/job-meta/job-meta.js +15 -18
- package/lib-esm/components/job-meta/job-meta.stories.js +10 -12
- package/lib-esm/components/job-name/job-name.js +9 -12
- package/lib-esm/components/job-name/job-name.stories.js +15 -23
- package/lib-esm/components/jobs-header/jobs-header.js +12 -12
- package/lib-esm/components/jobs-header/jobs-header.stories.js +80 -86
- package/lib-esm/components/lighthouse-table/lighthouse-table.js +6 -4
- package/lib-esm/components/lighthouse-table/lighthouse-table.stories.js +10 -14
- package/lib-esm/components/metric/metric.js +15 -19
- package/lib-esm/components/metric/metric.stories.js +36 -58
- package/lib-esm/components/metrics-table/metrics-table.js +128 -139
- package/lib-esm/components/metrics-table/metrics-table.stories.js +27 -35
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +16 -19
- package/lib-esm/components/metrics-table-options/metrics-table-options.stories.js +6 -12
- package/lib-esm/components/metrics-table-search/metrics-table-search.js +17 -18
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib-esm/components/metrics-table-search/metrics-table-search.stories.js +4 -9
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +9 -7
- package/lib-esm/components/module-info/module-info.js +15 -13
- package/lib-esm/components/module-info/module-info.stories.js +20 -22
- package/lib-esm/components/summary/summary.js +25 -27
- package/lib-esm/components/summary/summary.stories.js +31 -46
- package/lib-esm/components/summary-item/summary-item.js +27 -28
- package/lib-esm/components/summary-item/summary-item.stories.js +40 -50
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +4 -2
- package/lib-esm/constants.js +25 -30
- package/lib-esm/hooks/rows-filter.js +20 -0
- package/lib-esm/hooks/rows-sort.js +22 -0
- package/lib-esm/hooks/search-params.js +170 -0
- package/lib-esm/layout/box/box.js +12 -19
- package/lib-esm/layout/box/box.stories.js +34 -46
- package/lib-esm/layout/flex-stack/flex-stack.js +9 -12
- package/lib-esm/layout/flex-stack/flex-stack.stories.js +39 -49
- package/lib-esm/layout/footer/footer.js +11 -11
- package/lib-esm/layout/footer/footer.stories.js +7 -11
- package/lib-esm/layout/header/header.js +10 -14
- package/lib-esm/layout/header/header.stories.js +50 -44
- package/lib-esm/layout/stack/stack.js +8 -6
- package/lib-esm/layout/stack/stack.stories.js +39 -49
- package/lib-esm/layout/sub-header/sub-header.js +14 -12
- package/lib-esm/layout/sub-header/sub-header.stories.js +57 -69
- package/lib-esm/prototypes/typography.stories.js +49 -58
- package/lib-esm/query-state.js +13 -16
- package/lib-esm/stories/wrapper.js +6 -12
- package/lib-esm/ui/alert/alert.js +6 -4
- package/lib-esm/ui/alert/alert.stories.js +14 -24
- package/lib-esm/ui/container/container.js +6 -9
- package/lib-esm/ui/container/container.stories.js +15 -17
- package/lib-esm/ui/dropdown/dropdown.js +13 -11
- package/lib-esm/ui/dropdown/dropdown.stories.js +22 -26
- package/lib-esm/ui/empty-set/empty-set.js +12 -12
- package/lib-esm/ui/empty-set/empty-set.stories.js +11 -19
- package/lib-esm/ui/file-name/file-name.js +6 -4
- package/lib-esm/ui/file-name/file-name.stories.js +12 -16
- package/lib-esm/ui/filters/filters.container.js +57 -76
- package/lib-esm/ui/filters/filters.js +71 -77
- package/lib-esm/ui/filters/filters.stories.js +82 -100
- package/lib-esm/ui/filters/filters.utils.js +26 -24
- package/lib-esm/ui/filters/index.js +1 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +68 -78
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +67 -77
- package/lib-esm/ui/icon/icon.js +13 -202
- package/lib-esm/ui/icon/icon.stories.js +16 -24
- package/lib-esm/ui/input/input.js +7 -10
- package/lib-esm/ui/input/input.stories.js +8 -12
- package/lib-esm/ui/loader/loader.js +6 -9
- package/lib-esm/ui/loader/loader.stories.js +5 -9
- package/lib-esm/ui/logo/logo.constants.js +6 -6
- package/lib-esm/ui/logo/logo.js +15 -15
- package/lib-esm/ui/logo/logo.stories.js +14 -22
- package/lib-esm/ui/panels/panels.js +13 -23
- package/lib-esm/ui/panels/panels.stories.js +14 -16
- package/lib-esm/ui/popover/popover.js +11 -9
- package/lib-esm/ui/popover/popover.stories.js +7 -11
- package/lib-esm/ui/skeleton/skeleton.js +6 -9
- package/lib-esm/ui/skeleton/skeleton.stories.js +2 -4
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +38 -38
- package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +14 -16
- package/lib-esm/ui/table/table.js +26 -31
- package/lib-esm/ui/table/table.stories.js +84 -102
- package/lib-esm/ui/tabs/tabs.js +13 -21
- package/lib-esm/ui/tabs/tabs.stories.js +4 -6
- package/lib-esm/ui/toolbar/toolbar.js +7 -5
- package/lib-esm/ui/toolbar/toolbar.stories.js +14 -16
- package/lib-esm/ui/tooltip/tooltip.js +13 -16
- package/lib-esm/ui/tooltip/tooltip.stories.js +8 -12
- package/lib-esm/utils.js +20 -24
- package/package.json +25 -33
- package/src/assets/icons/arrow.svg +1 -0
- package/src/assets/icons/cancel.svg +1 -0
- package/src/assets/icons/clock.svg +1 -0
- package/src/assets/icons/close.svg +1 -0
- package/src/assets/icons/commit.svg +1 -0
- package/src/assets/icons/filter.svg +1 -0
- package/src/assets/icons/help.svg +1 -0
- package/src/assets/icons/menu.svg +1 -0
- package/src/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/src/assets/icons/warning.svg +1 -0
- package/src/assets/icons.svg +1 -0
- package/src/components/bundle-assets/bundle-assets.jsx +3 -3
- package/src/components/bundle-assets/bundle-assets.utils.js +96 -17
- package/src/components/bundle-assets/index.jsx +89 -0
- package/src/components/bundle-modules/bundle-modules.jsx +3 -3
- package/src/components/bundle-modules/bundle-modules.utils.js +101 -0
- package/src/components/bundle-modules/index.jsx +107 -0
- package/src/components/bundle-packages/bundle-packages.jsx +3 -3
- package/src/components/bundle-packages/bundle-packages.utils.js +47 -0
- package/src/components/bundle-packages/index.jsx +84 -0
- package/src/components/metrics-table/metrics-table.jsx +2 -7
- package/src/components/metrics-table-search/metrics-table-search.jsx +1 -0
- package/src/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/src/hooks/rows-filter.js +16 -0
- package/src/hooks/rows-sort.js +24 -0
- package/src/hooks/search-params.js +153 -0
- package/src/ui/icon/icon.jsx +7 -42
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -11
- package/src/utils.jsx +5 -3
- package/lib/components/bundle-assets/bundle-assets.container.js +0 -140
- package/lib/components/bundle-modules/bundle-modules.container.js +0 -222
- package/lib/hocs/with-custom-sort.js +0 -75
- package/lib/hocs/with-filtered-items.js +0 -54
- package/lib/ui/icon/assets/arrow.svg +0 -4
- package/lib/ui/icon/assets/branch.svg +0 -3
- package/lib/ui/icon/assets/cancel.svg +0 -4
- package/lib/ui/icon/assets/clock.svg +0 -3
- package/lib/ui/icon/assets/close.svg +0 -4
- package/lib/ui/icon/assets/commit.svg +0 -3
- package/lib/ui/icon/assets/filter.svg +0 -4
- package/lib/ui/icon/assets/help.svg +0 -4
- package/lib/ui/icon/assets/job.svg +0 -3
- package/lib/ui/icon/assets/menu.svg +0 -4
- package/lib/ui/icon/assets/package.svg +0 -3
- package/lib/ui/icon/assets/pull-request.svg +0 -3
- package/lib/ui/icon/assets/repository.svg +0 -3
- package/lib/ui/icon/assets/warning.svg +0 -4
- package/lib-esm/components/bundle-assets/bundle-assets.container.js +0 -119
- package/lib-esm/components/bundle-modules/bundle-modules.container.js +0 -175
- package/lib-esm/components/bundle-packages/bundle-packages.container.js +0 -91
- package/lib-esm/hocs/with-custom-sort.js +0 -43
- package/lib-esm/hocs/with-filtered-items.js +0 -35
- package/lib-esm/hocs/with-search.js +0 -214
- package/lib-esm/ui/icon/assets/arrow.svg +0 -4
- package/lib-esm/ui/icon/assets/branch.svg +0 -3
- package/lib-esm/ui/icon/assets/cancel.svg +0 -4
- package/lib-esm/ui/icon/assets/clock.svg +0 -3
- package/lib-esm/ui/icon/assets/close.svg +0 -4
- package/lib-esm/ui/icon/assets/commit.svg +0 -3
- package/lib-esm/ui/icon/assets/filter.svg +0 -4
- package/lib-esm/ui/icon/assets/help.svg +0 -4
- package/lib-esm/ui/icon/assets/job.svg +0 -3
- package/lib-esm/ui/icon/assets/menu.svg +0 -4
- package/lib-esm/ui/icon/assets/package.svg +0 -3
- package/lib-esm/ui/icon/assets/pull-request.svg +0 -3
- package/lib-esm/ui/icon/assets/repository.svg +0 -3
- package/lib-esm/ui/icon/assets/warning.svg +0 -4
- package/src/components/bundle-assets/bundle-assets.container.js +0 -146
- package/src/components/bundle-assets/index.js +0 -4
- package/src/components/bundle-modules/bundle-modules.container.js +0 -158
- package/src/components/bundle-modules/index.js +0 -4
- package/src/components/bundle-packages/bundle-packages.container.js +0 -93
- package/src/components/bundle-packages/index.js +0 -4
- package/src/hocs/with-custom-sort.jsx +0 -35
- package/src/hocs/with-filtered-items.jsx +0 -34
- package/src/hocs/with-search.jsx +0 -184
- package/src/ui/icon/assets/arrow.svg +0 -4
- package/src/ui/icon/assets/branch.svg +0 -3
- package/src/ui/icon/assets/cancel.svg +0 -4
- package/src/ui/icon/assets/clock.svg +0 -3
- package/src/ui/icon/assets/close.svg +0 -4
- package/src/ui/icon/assets/commit.svg +0 -3
- package/src/ui/icon/assets/filter.svg +0 -4
- package/src/ui/icon/assets/help.svg +0 -4
- package/src/ui/icon/assets/job.svg +0 -3
- package/src/ui/icon/assets/menu.svg +0 -4
- package/src/ui/icon/assets/package.svg +0 -3
- package/src/ui/icon/assets/pull-request.svg +0 -3
- package/src/ui/icon/assets/repository.svg +0 -3
- package/src/ui/icon/assets/warning.svg +0 -4
|
@@ -2,26 +2,24 @@ import React from 'react';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { getWrapperDecorator } from '../../stories';
|
|
4
4
|
import { ModuleInfo } from '.';
|
|
5
|
-
|
|
5
|
+
const stories = storiesOf('Components/ModuleInfo', module);
|
|
6
6
|
stories.addDecorator(getWrapperDecorator());
|
|
7
|
-
stories.add('default',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
});
|
|
7
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(ModuleInfo, {
|
|
8
|
+
item: {
|
|
9
|
+
runs: [{
|
|
10
|
+
key: './node_modules/lodash/fp/_baseConvert.js',
|
|
11
|
+
name: './node_modules/lodash/fp/_baseConvert.js',
|
|
12
|
+
chunkIds: ['2']
|
|
13
|
+
}, {
|
|
14
|
+
key: './node_modules/lodash/fp/_baseConvert.js',
|
|
15
|
+
name: './node_modules/lodash/fp/_baseConvert.js',
|
|
16
|
+
chunkIds: ['2']
|
|
17
|
+
}]
|
|
18
|
+
},
|
|
19
|
+
chunks: [{
|
|
20
|
+
id: '2',
|
|
21
|
+
name: 'vendors'
|
|
22
|
+
}],
|
|
23
|
+
chunkIds: ['1', '2'],
|
|
24
|
+
labels: ['Job #2', 'Job #1']
|
|
25
|
+
}));
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
2
|
|
|
3
|
-
var _PropTypes$shape;
|
|
4
|
-
|
|
5
|
-
var _excluded = ["className"];
|
|
6
|
-
|
|
7
3
|
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); }
|
|
8
4
|
|
|
9
|
-
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; }
|
|
10
|
-
|
|
11
5
|
import React from 'react';
|
|
12
6
|
import PropTypes from 'prop-types';
|
|
13
7
|
import cx from 'classnames';
|
|
@@ -18,30 +12,32 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
18
12
|
import { ComponentLink } from '../component-link';
|
|
19
13
|
import { SummaryItem } from '../summary-item';
|
|
20
14
|
import css from './summary.module.css';
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
export const Summary = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
size,
|
|
19
|
+
keys,
|
|
20
|
+
data,
|
|
21
|
+
loading,
|
|
22
|
+
showSummaryItemDelta,
|
|
23
|
+
summaryItemLink: SummaryItemCustomLink
|
|
24
|
+
} = _ref;
|
|
29
25
|
return /*#__PURE__*/React.createElement(Box, {
|
|
30
26
|
outline: true,
|
|
31
27
|
className: cx(css.root, className)
|
|
32
28
|
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
33
29
|
className: css.items
|
|
34
|
-
}, Array.from(METRIC_COMPONENT_LINKS).filter(
|
|
35
|
-
|
|
30
|
+
}, Array.from(METRIC_COMPONENT_LINKS).filter(_ref2 => {
|
|
31
|
+
let [metricId] = _ref2;
|
|
36
32
|
return keys.includes(metricId);
|
|
37
|
-
}).map(
|
|
38
|
-
|
|
39
|
-
metricOptions = _ref3[1];
|
|
33
|
+
}).map(_ref3 => {
|
|
34
|
+
let [metricId, metricOptions] = _ref3;
|
|
40
35
|
return /*#__PURE__*/React.createElement(SummaryItem, {
|
|
41
|
-
as:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
as: _ref4 => {
|
|
37
|
+
let {
|
|
38
|
+
className: itemClassName,
|
|
39
|
+
...itemProps
|
|
40
|
+
} = _ref4;
|
|
45
41
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
46
42
|
padding: ['xsmall', 'small'],
|
|
47
43
|
className: cx(itemClassName, css.summaryItemLink)
|
|
@@ -73,10 +69,12 @@ Summary.propTypes = {
|
|
|
73
69
|
className: PropTypes.string,
|
|
74
70
|
size: PropTypes.string,
|
|
75
71
|
keys: PropTypes.arrayOf(PropTypes.string),
|
|
76
|
-
data: PropTypes.shape(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
data: PropTypes.shape({
|
|
73
|
+
[PropTypes.string]: PropTypes.shape({
|
|
74
|
+
baseline: PropTypes.number,
|
|
75
|
+
current: PropTypes.number
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
80
78
|
loading: PropTypes.bool,
|
|
81
79
|
showSummaryItemDelta: PropTypes.bool,
|
|
82
80
|
summaryItemLink: PropTypes.elementType
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
var _excluded = ["keyProps"];
|
|
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
|
-
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; }
|
|
6
|
-
|
|
7
3
|
import React from 'react';
|
|
8
4
|
import { storiesOf } from '@storybook/react';
|
|
9
5
|
import { createJobs } from '@bundle-stats/utils';
|
|
@@ -12,52 +8,41 @@ import currentData from '../../../__mocks__/webpack-stats.current.json';
|
|
|
12
8
|
import { METRICS_WEBPACK_ASSETS } from '../../constants';
|
|
13
9
|
import { getWrapperDecorator } from '../../stories';
|
|
14
10
|
import { Summary } from '.';
|
|
15
|
-
|
|
11
|
+
const MULTIPLE_JOBS = createJobs([{
|
|
16
12
|
webpack: currentData
|
|
17
13
|
}, {
|
|
18
14
|
webpack: baselineData
|
|
19
15
|
}]);
|
|
20
|
-
|
|
16
|
+
const SINGLE_JOB = createJobs([{
|
|
21
17
|
webpack: currentData
|
|
22
18
|
}]);
|
|
23
|
-
|
|
19
|
+
const stories = storiesOf('Components/Summary', module);
|
|
24
20
|
stories.addDecorator(getWrapperDecorator());
|
|
25
|
-
stories.add('default',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return /*#__PURE__*/React.createElement("button", _extends({
|
|
55
|
-
type: "button"
|
|
56
|
-
}, props, {
|
|
57
|
-
onClick: function onClick() {
|
|
58
|
-
return alert(JSON.stringify(keyProps));
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
21
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(Summary, {
|
|
22
|
+
data: MULTIPLE_JOBS[0].summary
|
|
23
|
+
}));
|
|
24
|
+
stories.add('custom keys', () => /*#__PURE__*/React.createElement(Summary, {
|
|
25
|
+
keys: METRICS_WEBPACK_ASSETS,
|
|
26
|
+
data: MULTIPLE_JOBS[0].summary
|
|
27
|
+
}));
|
|
28
|
+
stories.add('loading', () => /*#__PURE__*/React.createElement(Summary, {
|
|
29
|
+
loading: true
|
|
30
|
+
}));
|
|
31
|
+
stories.add('single run', () => /*#__PURE__*/React.createElement(Summary, {
|
|
32
|
+
data: SINGLE_JOB[0].summary,
|
|
33
|
+
showSummaryItemDelta: false
|
|
34
|
+
}));
|
|
35
|
+
stories.add('with link', () => /*#__PURE__*/React.createElement(Summary, {
|
|
36
|
+
data: MULTIPLE_JOBS[0].summary,
|
|
37
|
+
summaryItemLink: _ref => {
|
|
38
|
+
let {
|
|
39
|
+
keyProps,
|
|
40
|
+
...props
|
|
41
|
+
} = _ref;
|
|
42
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
43
|
+
type: "button"
|
|
44
|
+
}, props, {
|
|
45
|
+
onClick: () => alert(JSON.stringify(keyProps))
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
var _excluded = ["className", "as", "size", "id", "data", "loading", "showDelta", "showMetricDescription"];
|
|
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
|
-
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; }
|
|
6
|
-
|
|
7
3
|
import React from 'react';
|
|
8
4
|
import PropTypes from 'prop-types';
|
|
9
5
|
import cx from 'classnames';
|
|
@@ -16,12 +12,14 @@ import { Metric } from '../metric';
|
|
|
16
12
|
import { Delta } from '../delta';
|
|
17
13
|
import css from './summary-item.module.css';
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const MetricInfo = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
description,
|
|
18
|
+
url
|
|
19
|
+
} = _ref;
|
|
22
20
|
|
|
23
21
|
// Workaround cases where the parent is a link
|
|
24
|
-
|
|
22
|
+
const readMoreOnClick = () => {
|
|
25
23
|
window.open(url);
|
|
26
24
|
};
|
|
27
25
|
|
|
@@ -41,28 +39,29 @@ MetricInfo.propTypes = {
|
|
|
41
39
|
MetricInfo.defaultProps = {
|
|
42
40
|
url: ''
|
|
43
41
|
};
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
export const SummaryItem = _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
className,
|
|
45
|
+
as: Component,
|
|
46
|
+
size,
|
|
47
|
+
id,
|
|
48
|
+
data,
|
|
49
|
+
loading,
|
|
50
|
+
showDelta,
|
|
51
|
+
showMetricDescription,
|
|
52
|
+
...props
|
|
53
|
+
} = _ref2;
|
|
54
|
+
const {
|
|
55
|
+
baseline,
|
|
56
|
+
current
|
|
57
|
+
} = data || {
|
|
56
58
|
baseline: 0,
|
|
57
59
|
current: 0
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var runInfo = getMetricRunInfo(metric, current, baseline);
|
|
64
|
-
var showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
65
|
-
var rootClassName = cx(css.root, className, css[size], showMetricDescription && css.showMetricDescription, showMetricDescriptionTooltip && css.showMetricDescription, showDelta && css.showDelta);
|
|
60
|
+
};
|
|
61
|
+
const metric = getGlobalMetricType(id);
|
|
62
|
+
const runInfo = getMetricRunInfo(metric, current, baseline);
|
|
63
|
+
const showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
64
|
+
const rootClassName = cx(css.root, className, css[size], showMetricDescription && css.showMetricDescription, showMetricDescriptionTooltip && css.showMetricDescription, showDelta && css.showDelta);
|
|
66
65
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
67
66
|
space: "xxsmall",
|
|
68
67
|
as: Component,
|
|
@@ -2,56 +2,46 @@ import React from 'react';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { getWrapperDecorator } from '../../stories';
|
|
4
4
|
import { SummaryItem } from './summary-item';
|
|
5
|
-
|
|
5
|
+
const stories = storiesOf('Components/SummaryItem', module);
|
|
6
6
|
stories.addDecorator(getWrapperDecorator({
|
|
7
7
|
maxWidth: '320px'
|
|
8
8
|
}));
|
|
9
|
-
stories.add('default',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
showDelta: false
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
stories.add('loading', function () {
|
|
53
|
-
return /*#__PURE__*/React.createElement(SummaryItem, {
|
|
54
|
-
loading: true,
|
|
55
|
-
id: "webpack.totalSizeByTypeALL"
|
|
56
|
-
});
|
|
57
|
-
});
|
|
9
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
10
|
+
loading: false,
|
|
11
|
+
id: "webpack.totalSizeByTypeALL",
|
|
12
|
+
data: {
|
|
13
|
+
current: 120 * 1000,
|
|
14
|
+
baseline: 100 * 1000
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
stories.add('size large', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
18
|
+
size: "large",
|
|
19
|
+
loading: false,
|
|
20
|
+
id: "webpack.totalSizeByTypeALL",
|
|
21
|
+
data: {
|
|
22
|
+
current: 120 * 1000,
|
|
23
|
+
baseline: 100 * 1000
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
stories.add('showMetricDescription', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
27
|
+
loading: false,
|
|
28
|
+
id: "webpack.totalSizeByTypeALL",
|
|
29
|
+
data: {
|
|
30
|
+
current: 120 * 1000,
|
|
31
|
+
baseline: 100 * 1000
|
|
32
|
+
},
|
|
33
|
+
showMetricDescription: true
|
|
34
|
+
}));
|
|
35
|
+
stories.add('showDelta false', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
36
|
+
loading: false,
|
|
37
|
+
id: "webpack.totalSizeByTypeALL",
|
|
38
|
+
data: {
|
|
39
|
+
current: 120 * 1000,
|
|
40
|
+
baseline: 0
|
|
41
|
+
},
|
|
42
|
+
showDelta: false
|
|
43
|
+
}));
|
|
44
|
+
stories.add('loading', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
45
|
+
loading: true,
|
|
46
|
+
id: "webpack.totalSizeByTypeALL"
|
|
47
|
+
}));
|
|
@@ -7,8 +7,10 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
7
7
|
import { Stack } from '../../layout/stack';
|
|
8
8
|
import { Popover } from '../../ui/popover';
|
|
9
9
|
import css from './total-size-type-title.module.css';
|
|
10
|
-
export
|
|
11
|
-
|
|
10
|
+
export const TotalSizeTypeTitle = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
className
|
|
13
|
+
} = _ref;
|
|
12
14
|
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
13
15
|
space: "xxxsmall",
|
|
14
16
|
className: cx(css.title, className)
|
package/lib-esm/constants.js
CHANGED
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
var _SECTION_URLS;
|
|
2
|
-
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
1
|
import { FILE_TYPES, SECTIONS } from '@bundle-stats/utils';
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
2
|
+
export const NO_SPACE = 'no-space';
|
|
3
|
+
export const SPACE_XXXSMALL = 'xxxsmall';
|
|
4
|
+
export const SPACE_XXSMALL = 'xxsmall';
|
|
5
|
+
export const SPACE_XSMALL = 'xsmall';
|
|
6
|
+
export const SPACE_SMALL = 'small';
|
|
7
|
+
export const SPACE_MEDIUM = 'medium';
|
|
8
|
+
export const SPACE_LARGE = 'large';
|
|
9
|
+
export const SPACE_XLARGE = 'xlarge';
|
|
10
|
+
export const SPACE_XXLARGE = 'xxlarge';
|
|
11
|
+
export const SPACE_XXXLARGE = 'xxxlarge';
|
|
12
|
+
export const SPACES = [NO_SPACE, SPACE_XXXSMALL, SPACE_XXSMALL, SPACE_XSMALL, SPACE_SMALL, SPACE_MEDIUM, SPACE_LARGE, SPACE_XLARGE, SPACE_XXLARGE, SPACE_XXXLARGE];
|
|
13
|
+
export const URLS = {
|
|
22
14
|
OVERVIEW: '/',
|
|
23
15
|
ASSETS: '/assets',
|
|
24
16
|
MODULES: '/modules',
|
|
25
17
|
PACKAGES: '/packages'
|
|
26
18
|
};
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export
|
|
19
|
+
export const SECTION_URLS = {
|
|
20
|
+
[SECTIONS.TOTALS]: URLS.OVERVIEW,
|
|
21
|
+
[SECTIONS.ASSETS]: URLS.ASSETS,
|
|
22
|
+
[SECTIONS.MODULES]: URLS.MODULES,
|
|
23
|
+
[SECTIONS.PACKAGES]: URLS.PACKAGES
|
|
24
|
+
};
|
|
25
|
+
export const ASSETS_SIZES_FILE_TYPE_MAP = FILE_TYPES.reduce((agg, fileType) => ({ ...agg,
|
|
26
|
+
[`webpack.sizes.totalSizeByType${fileType}`]: fileType
|
|
27
|
+
}), {});
|
|
28
|
+
export const METRICS_WEBPACK_GENERAL = ['webpack.totalSizeByTypeALL', 'webpack.totalInitialSizeJS', 'webpack.totalInitialSizeCSS', 'webpack.cacheInvalidation'];
|
|
29
|
+
export const METRICS_WEBPACK_ASSETS = ['webpack.assetCount', 'webpack.chunkCount'];
|
|
30
|
+
export const METRICS_WEBPACK_MODULES = ['webpack.moduleCount'];
|
|
31
|
+
export const METRICS_WEBPACK_PACKAGES = ['webpack.packageCount', 'webpack.duplicatePackagesCount'];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
export const useRowsFilter = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
rows,
|
|
5
|
+
searchPattern,
|
|
6
|
+
filters,
|
|
7
|
+
getRowFilter
|
|
8
|
+
} = _ref;
|
|
9
|
+
const filteredRows = useMemo(() => {
|
|
10
|
+
const filterRow = getRowFilter(filters);
|
|
11
|
+
return rows.filter(row => {
|
|
12
|
+
if (searchPattern && !searchPattern.test(row == null ? void 0 : row.key)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return filterRow(row);
|
|
17
|
+
});
|
|
18
|
+
}, [rows, searchPattern, filters, getRowFilter]);
|
|
19
|
+
return filteredRows;
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _orderBy from "lodash/orderBy";
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
export const useRowsSort = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
rows,
|
|
6
|
+
sortFields,
|
|
7
|
+
sortBy = 'size',
|
|
8
|
+
sortDirection = 'desc',
|
|
9
|
+
getCustomSort
|
|
10
|
+
} = _ref;
|
|
11
|
+
const [sort, updateSort] = useState({
|
|
12
|
+
field: sortBy,
|
|
13
|
+
direction: sortDirection
|
|
14
|
+
});
|
|
15
|
+
const orderedRows = useMemo(() => _orderBy(rows, getCustomSort(sort.field), sort.direction), [rows, sort]);
|
|
16
|
+
return {
|
|
17
|
+
sortFields,
|
|
18
|
+
sort,
|
|
19
|
+
updateSort,
|
|
20
|
+
items: orderedRows
|
|
21
|
+
};
|
|
22
|
+
};
|