@bundle-stats/ui 4.3.0-beta.3 → 4.3.0-rc.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.
- package/globals.d.ts +4 -0
- package/lib/app/app.js +21 -9
- package/lib/app/app.js.map +1 -1
- package/lib/assets/icons.svg +5 -0
- package/lib/assets/icons.svg.js +4 -0
- package/lib/assets/icons.svg.js.map +1 -1
- package/lib/components/asset-info/asset-info.js +43 -44
- package/lib/components/asset-info/asset-info.js.map +1 -1
- package/lib/components/asset-info/asset-info.module.css +18 -6
- package/lib/components/asset-info/index.js.map +1 -1
- package/lib/components/asset-not-predictive/asset-not-predictive.js +28 -0
- package/lib/components/asset-not-predictive/asset-not-predictive.js.map +1 -0
- package/lib/components/asset-not-predictive/asset-not-predictive.module.css +3 -0
- package/lib/components/asset-not-predictive/index.js +18 -0
- package/lib/components/asset-not-predictive/index.js.map +1 -0
- package/lib/components/bundle-assets/bundle-assets.js +17 -25
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.module.css +13 -20
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +7 -5
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +1 -2
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.module.css +5 -0
- package/lib/components/bundle-packages/bundle-packages.js +14 -45
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.module.css +4 -0
- package/lib/components/delta/delta.module.css +2 -1
- package/lib/components/entry-info/entry-info.js +46 -0
- package/lib/components/entry-info/entry-info.js.map +1 -0
- package/lib/components/entry-info/entry-info.module.css +33 -0
- package/lib/components/{summary-item → entry-info}/index.js +1 -1
- package/lib/components/entry-info/index.js.map +1 -0
- package/lib/components/index.js +7 -3
- package/lib/components/index.js.map +1 -1
- package/lib/components/insight-icon/index.js +18 -0
- package/lib/components/insight-icon/index.js.map +1 -0
- package/lib/components/insight-icon/insight-icon.js +25 -0
- package/lib/components/insight-icon/insight-icon.js.map +1 -0
- package/lib/components/insight-icon/insight-icon.module.css +24 -0
- package/lib/components/insights/insights.js +6 -39
- package/lib/components/insights/insights.js.map +1 -1
- package/lib/components/insights/insights.module.css +1 -19
- package/lib/components/metric/index.js.map +1 -1
- package/lib/components/metric/metric.js +7 -64
- package/lib/components/metric/metric.js.map +1 -1
- package/lib/components/metric/metric.module.css +3 -3
- package/lib/components/metric-run-info/index.js +18 -0
- package/lib/components/metric-run-info/index.js.map +1 -0
- package/lib/components/metric-run-info/metric-run-info.js +64 -0
- package/lib/components/metric-run-info/metric-run-info.js.map +1 -0
- package/lib/components/metric-run-info/metric-run-info.module.css +18 -0
- package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-search/metrics-table-search.module.css +0 -6
- package/lib/components/metrics-table-title/metrics-table-title.module.css +1 -0
- package/lib/components/module-info/index.js.map +1 -1
- package/lib/components/module-info/module-info.js +46 -47
- package/lib/components/module-info/module-info.js.map +1 -1
- package/lib/components/module-info/module-info.module.css +4 -6
- package/lib/components/package-info/index.js +18 -0
- package/lib/components/package-info/index.js.map +1 -0
- package/lib/components/package-info/package-info.js +71 -0
- package/lib/components/package-info/package-info.js.map +1 -0
- package/lib/components/package-info/package-info.module.css +13 -0
- package/lib/components/run-info/index.js +18 -0
- package/lib/components/run-info/index.js.map +1 -0
- package/lib/components/run-info/run-info.js +70 -0
- package/lib/components/run-info/run-info.js.map +1 -0
- package/{src/components/summary-item/summary-item.module.css → lib/components/run-info/run-info.module.css} +14 -19
- package/lib/components/summary/index.js.map +1 -1
- package/lib/components/summary/summary.js +10 -30
- package/lib/components/summary/summary.js.map +1 -1
- package/lib/components/summary/summary.module.css +17 -6
- package/lib/constants.js +1 -23
- package/lib/constants.js.map +1 -1
- package/lib/css/variables.css +17 -13
- package/lib/layout/box/box.js +3 -23
- package/lib/layout/box/box.js.map +1 -1
- package/lib/layout/box/box.module.css +11 -0
- package/lib/layout/box/index.js +15 -3
- package/lib/layout/box/index.js.map +1 -1
- package/lib/layout/flex-stack/flex-stack.js +3 -19
- package/lib/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib/layout/flex-stack/index.js.map +1 -1
- package/lib/layout/stack/index.js.map +1 -1
- package/lib/layout/stack/stack.js +3 -16
- package/lib/layout/stack/stack.js.map +1 -1
- package/lib/tokens.js +38 -0
- package/lib/tokens.js.map +1 -0
- package/lib/ui/alert/alert.js +2 -12
- package/lib/ui/alert/alert.js.map +1 -1
- package/lib/ui/alert/index.js.map +1 -1
- package/lib/ui/container/container.js +1 -10
- package/lib/ui/container/container.js.map +1 -1
- package/lib/ui/container/index.js +15 -3
- package/lib/ui/container/index.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +1 -2
- package/lib/ui/file-name/file-name.js +1 -1
- package/lib/ui/file-name/file-name.js.map +1 -1
- package/lib/ui/filters/filters.module.css +1 -5
- package/lib/ui/hover-card/hover-card.js +1 -1
- package/lib/ui/icon/icon.js +1 -0
- package/lib/ui/icon/icon.js.map +1 -1
- package/lib/ui/index.js +1 -3
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/input/input.module.css +3 -4
- package/lib/ui/table/index.js.map +1 -1
- package/lib/ui/table/table.js +3 -17
- package/lib/ui/table/table.js.map +1 -1
- package/lib/ui/tag/index.js.map +1 -1
- package/lib/ui/tag/tag.js +5 -29
- package/lib/ui/tag/tag.js.map +1 -1
- package/lib/ui/tag/tag.module.css +15 -1
- package/lib/ui/tooltip/index.js.map +1 -1
- package/lib/ui/tooltip/tooltip.js +3 -23
- package/lib/ui/tooltip/tooltip.js.map +1 -1
- package/lib/ui/tooltip/tooltip.module.css +4 -4
- package/lib-esm/app/app.js +22 -10
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/assets/icons.svg +5 -0
- package/lib-esm/assets/icons.svg.js +4 -0
- package/lib-esm/assets/icons.svg.js.map +1 -1
- package/lib-esm/components/asset-info/asset-info.js +22 -45
- package/lib-esm/components/asset-info/asset-info.js.map +1 -1
- package/lib-esm/components/asset-info/asset-info.module.css +18 -6
- package/lib-esm/components/asset-info/index.js.map +1 -1
- package/lib-esm/components/asset-not-predictive/asset-not-predictive.js +21 -0
- package/lib-esm/components/asset-not-predictive/asset-not-predictive.js.map +1 -0
- package/lib-esm/components/asset-not-predictive/asset-not-predictive.module.css +3 -0
- package/lib-esm/components/asset-not-predictive/index.js +2 -0
- package/lib-esm/components/asset-not-predictive/index.js.map +1 -0
- package/lib-esm/components/bundle-assets/bundle-assets.js +17 -25
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +13 -20
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +6 -6
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +1 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +5 -0
- package/lib-esm/components/bundle-packages/bundle-packages.js +15 -46
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +4 -0
- package/lib-esm/components/delta/delta.module.css +2 -1
- package/lib-esm/components/entry-info/entry-info.js +40 -0
- package/lib-esm/components/entry-info/entry-info.js.map +1 -0
- package/lib-esm/components/entry-info/entry-info.module.css +33 -0
- package/lib-esm/components/entry-info/index.js +2 -0
- package/lib-esm/components/entry-info/index.js.map +1 -0
- package/lib-esm/components/index.js +3 -1
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/insight-icon/index.js +2 -0
- package/lib-esm/components/insight-icon/index.js.map +1 -0
- package/lib-esm/components/insight-icon/insight-icon.js +18 -0
- package/lib-esm/components/insight-icon/insight-icon.js.map +1 -0
- package/lib-esm/components/insight-icon/insight-icon.module.css +24 -0
- package/lib-esm/components/insights/insights.js +7 -40
- package/lib-esm/components/insights/insights.js.map +1 -1
- package/lib-esm/components/insights/insights.module.css +1 -19
- package/lib-esm/components/metric/index.js.map +1 -1
- package/lib-esm/components/metric/metric.js +7 -41
- package/lib-esm/components/metric/metric.js.map +1 -1
- package/lib-esm/components/metric/metric.module.css +3 -3
- package/lib-esm/components/metric-run-info/index.js +2 -0
- package/lib-esm/components/metric-run-info/index.js.map +1 -0
- package/lib-esm/components/metric-run-info/metric-run-info.js +34 -0
- package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -0
- package/lib-esm/components/metric-run-info/metric-run-info.module.css +18 -0
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +0 -6
- package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +1 -0
- package/lib-esm/components/module-info/index.js.map +1 -1
- package/lib-esm/components/module-info/module-info.js +25 -48
- package/lib-esm/components/module-info/module-info.js.map +1 -1
- package/lib-esm/components/module-info/module-info.module.css +4 -6
- package/lib-esm/components/package-info/index.js +2 -0
- package/lib-esm/components/package-info/index.js.map +1 -0
- package/lib-esm/components/package-info/package-info.js +42 -0
- package/lib-esm/components/package-info/package-info.js.map +1 -0
- package/lib-esm/components/package-info/package-info.module.css +13 -0
- package/lib-esm/components/run-info/index.js +2 -0
- package/lib-esm/components/run-info/index.js.map +1 -0
- package/lib-esm/components/run-info/run-info.js +40 -0
- package/lib-esm/components/run-info/run-info.js.map +1 -0
- package/lib-esm/components/{summary-item/summary-item.module.css → run-info/run-info.module.css} +14 -19
- package/lib-esm/components/summary/index.js.map +1 -1
- package/lib-esm/components/summary/summary.js +9 -29
- package/lib-esm/components/summary/summary.js.map +1 -1
- package/lib-esm/components/summary/summary.module.css +17 -6
- package/lib-esm/constants.js +0 -22
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/css/variables.css +17 -13
- package/lib-esm/layout/box/box.js +3 -23
- package/lib-esm/layout/box/box.js.map +1 -1
- package/lib-esm/layout/box/box.module.css +11 -0
- package/lib-esm/layout/box/index.js +1 -1
- package/lib-esm/layout/box/index.js.map +1 -1
- package/lib-esm/layout/flex-stack/flex-stack.js +3 -19
- package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib-esm/layout/flex-stack/index.js.map +1 -1
- package/lib-esm/layout/stack/index.js.map +1 -1
- package/lib-esm/layout/stack/stack.js +3 -16
- package/lib-esm/layout/stack/stack.js.map +1 -1
- package/lib-esm/tokens.js +35 -0
- package/lib-esm/tokens.js.map +1 -0
- package/lib-esm/ui/alert/alert.js +2 -12
- package/lib-esm/ui/alert/alert.js.map +1 -1
- package/lib-esm/ui/alert/index.js.map +1 -1
- package/lib-esm/ui/container/container.js +1 -10
- package/lib-esm/ui/container/container.js.map +1 -1
- package/lib-esm/ui/container/index.js +1 -1
- package/lib-esm/ui/container/index.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +1 -2
- package/lib-esm/ui/file-name/file-name.js +1 -1
- package/lib-esm/ui/file-name/file-name.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +1 -5
- package/lib-esm/ui/hover-card/hover-card.js +1 -1
- package/lib-esm/ui/icon/icon.js +1 -0
- package/lib-esm/ui/icon/icon.js.map +1 -1
- package/lib-esm/ui/index.js +0 -1
- package/lib-esm/ui/index.js.map +1 -1
- package/lib-esm/ui/input/input.module.css +3 -4
- package/lib-esm/ui/table/index.js.map +1 -1
- package/lib-esm/ui/table/table.js +3 -17
- package/lib-esm/ui/table/table.js.map +1 -1
- package/lib-esm/ui/tag/index.js.map +1 -1
- package/lib-esm/ui/tag/tag.js +4 -28
- package/lib-esm/ui/tag/tag.js.map +1 -1
- package/lib-esm/ui/tag/tag.module.css +15 -1
- package/lib-esm/ui/tooltip/index.js.map +1 -1
- package/lib-esm/ui/tooltip/tooltip.js +3 -23
- package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
- package/lib-esm/ui/tooltip/tooltip.module.css +4 -4
- package/package.json +14 -18
- package/src/app/app.jsx +25 -10
- package/src/assets/icons/more-vertical.svg +5 -0
- package/src/assets/icons.svg +5 -0
- package/src/assets/icons.svg.jsx +14 -0
- package/src/components/asset-info/asset-info.module.css +18 -6
- package/src/components/asset-info/asset-info.stories.tsx +64 -0
- package/src/components/asset-info/asset-info.tsx +133 -0
- package/src/components/asset-not-predictive/asset-not-predictive.module.css +3 -0
- package/src/components/asset-not-predictive/asset-not-predictive.stories.tsx +23 -0
- package/src/components/asset-not-predictive/asset-not-predictive.tsx +44 -0
- package/src/components/asset-not-predictive/index.ts +1 -0
- package/src/components/bundle-assets/bundle-assets.jsx +43 -53
- package/src/components/bundle-assets/bundle-assets.module.css +13 -20
- package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +18 -15
- package/src/components/bundle-modules/bundle-modules.jsx +11 -9
- package/src/components/bundle-modules/bundle-modules.module.css +5 -0
- package/src/components/bundle-packages/bundle-packages.jsx +55 -118
- package/src/components/bundle-packages/bundle-packages.module.css +4 -0
- package/src/components/delta/delta.module.css +2 -1
- package/src/components/entry-info/entry-info.module.css +33 -0
- package/src/components/entry-info/entry-info.stories.tsx +67 -0
- package/src/components/entry-info/entry-info.tsx +107 -0
- package/src/components/entry-info/index.ts +1 -0
- package/src/components/index.js +3 -1
- package/src/components/insight-icon/index.ts +1 -0
- package/src/components/insight-icon/insight-icon.module.css +24 -0
- package/src/components/insight-icon/insight-icon.tsx +25 -0
- package/src/components/insights/insights.module.css +1 -19
- package/src/components/insights/insights.stories.tsx +26 -22
- package/src/components/insights/insights.tsx +8 -65
- package/src/components/metric/metric.module.css +3 -3
- package/src/components/metric/metric.stories.tsx +41 -0
- package/src/components/metric/metric.tsx +42 -0
- package/src/components/metric-run-info/index.ts +1 -0
- package/src/components/metric-run-info/metric-run-info.module.css +18 -0
- package/src/components/metric-run-info/metric-run-info.stories.tsx +34 -0
- package/src/components/metric-run-info/metric-run-info.tsx +85 -0
- package/src/components/metrics-table-options/metrics-table-options.jsx +1 -1
- package/src/components/metrics-table-search/metrics-table-search.module.css +0 -6
- package/src/components/metrics-table-title/metrics-table-title.module.css +1 -0
- package/src/components/module-info/module-info.module.css +4 -6
- package/src/components/module-info/module-info.stories.tsx +44 -0
- package/src/components/module-info/module-info.tsx +79 -0
- package/src/components/package-info/index.ts +1 -0
- package/src/components/package-info/package-info.module.css +13 -0
- package/src/components/package-info/package-info.stories.tsx +36 -0
- package/src/components/package-info/package-info.tsx +112 -0
- package/src/components/run-info/index.ts +1 -0
- package/{lib/components/summary-item/summary-item.module.css → src/components/run-info/run-info.module.css} +14 -19
- package/src/components/run-info/run-info.stories.tsx +49 -0
- package/src/components/run-info/run-info.tsx +108 -0
- package/src/components/summary/summary.module.css +17 -6
- package/src/components/summary/summary.stories.tsx +57 -0
- package/src/components/summary/summary.tsx +103 -0
- package/src/constants.js +0 -24
- package/src/css/variables.css +17 -13
- package/src/layout/box/box.module.css +11 -0
- package/src/layout/box/box.stories.tsx +49 -0
- package/src/layout/box/box.tsx +49 -0
- package/src/layout/box/index.ts +1 -0
- package/src/layout/flex-stack/flex-stack.stories.tsx +59 -0
- package/src/layout/flex-stack/flex-stack.tsx +43 -0
- package/src/layout/stack/stack.stories.tsx +53 -0
- package/src/layout/stack/stack.tsx +22 -0
- package/src/tokens.ts +37 -0
- package/src/ui/alert/alert.stories.tsx +39 -0
- package/src/ui/alert/alert.tsx +23 -0
- package/src/ui/container/container.stories.tsx +29 -0
- package/src/ui/container/container.tsx +18 -0
- package/src/ui/container/index.ts +1 -0
- package/src/ui/dropdown/dropdown.module.css +1 -2
- package/src/ui/file-name/file-name.jsx +1 -1
- package/src/ui/filters/filters.module.css +1 -5
- package/src/ui/hover-card/hover-card.jsx +1 -1
- package/src/ui/icon/icon.jsx +1 -0
- package/src/ui/index.js +0 -1
- package/src/ui/input/input.module.css +3 -4
- package/src/ui/table/table.stories.tsx +238 -0
- package/src/ui/table/table.tsx +38 -0
- package/src/ui/tag/tag.module.css +15 -1
- package/src/ui/tag/tag.stories.tsx +32 -0
- package/src/ui/tag/tag.tsx +28 -0
- package/src/ui/tooltip/tooltip.module.css +4 -4
- package/src/ui/tooltip/tooltip.stories.tsx +30 -0
- package/src/ui/tooltip/tooltip.tsx +56 -0
- package/types/app/header/header.d.ts +1 -1
- package/types/components/asset-info/asset-info.d.ts +18 -23
- package/types/components/asset-info/index.d.ts +1 -1
- package/types/components/asset-not-predictive/asset-not-predictive.d.ts +8 -0
- package/types/components/asset-not-predictive/index.d.ts +1 -0
- package/types/components/browsertime-table/browsertime-table.d.ts +1 -1
- package/types/components/bundle-assets/bundle-assets.d.ts +2 -2
- package/types/components/bundle-assets/index.d.ts +1 -1
- package/types/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.d.ts +2 -2
- package/types/components/bundle-assets-totals-table/bundle-assets-totals-table.d.ts +2 -2
- package/types/components/bundle-modules/bundle-modules.d.ts +2 -2
- package/types/components/bundle-modules/index.d.ts +1 -1
- package/types/components/bundle-packages/bundle-packages.d.ts +2 -2
- package/types/components/bundle-packages/index.d.ts +1 -1
- package/types/components/component-link.d.ts +1 -1
- package/types/components/delta/delta.d.ts +1 -1
- package/types/components/entry-info/entry-info.d.ts +18 -0
- package/types/components/entry-info/index.d.ts +1 -0
- package/types/components/index.d.ts +3 -1
- package/types/components/insight-icon/index.d.ts +1 -0
- package/types/components/insight-icon/insight-icon.d.ts +7 -0
- package/types/components/insights/insights.d.ts +2 -2
- package/types/components/job-header/job-header.d.ts +1 -1
- package/types/components/job-meta/job-meta.d.ts +1 -1
- package/types/components/job-name/job-name.d.ts +1 -1
- package/types/components/jobs-header/jobs-header.d.ts +1 -1
- package/types/components/lighthouse-table/lighthouse-table.d.ts +1 -1
- package/types/components/metric/index.d.ts +1 -1
- package/types/components/metric/metric.d.ts +6 -32
- package/types/components/metric-run-info/index.d.ts +1 -0
- package/types/components/metric-run-info/metric-run-info.d.ts +13 -0
- package/types/components/metrics-table/metrics-table.d.ts +1 -1
- package/types/components/metrics-table-options/metrics-table-options.d.ts +1 -1
- package/types/components/metrics-table-search/metrics-table-search.d.ts +1 -1
- package/types/components/metrics-table-title/metrics-table-title.d.ts +1 -1
- package/types/components/module-info/index.d.ts +1 -1
- package/types/components/module-info/module-info.d.ts +16 -34
- package/types/components/package-info/index.d.ts +1 -0
- package/types/components/package-info/package-info.d.ts +15 -0
- package/types/components/run-info/index.d.ts +1 -0
- package/types/components/run-info/run-info.d.ts +16 -0
- package/types/components/summary/index.d.ts +1 -1
- package/types/components/summary/summary.d.ts +25 -36
- package/types/components/total-size-type-title/total-size-type-title.d.ts +1 -1
- package/types/constants.d.ts +0 -11
- package/types/layout/box/box.d.ts +12 -25
- package/types/layout/box/index.d.ts +1 -1
- package/types/layout/flex-stack/flex-stack.d.ts +10 -33
- package/types/layout/flex-stack/index.d.ts +1 -1
- package/types/layout/footer/footer.d.ts +1 -1
- package/types/layout/separator.d.ts +2 -2
- package/types/layout/stack/index.d.ts +1 -1
- package/types/layout/stack/stack.d.ts +7 -20
- package/types/tokens.d.ts +23 -0
- package/types/ui/alert/alert.d.ts +7 -14
- package/types/ui/alert/index.d.ts +1 -1
- package/types/ui/container/container.d.ts +5 -17
- package/types/ui/container/index.d.ts +1 -1
- package/types/ui/dropdown/dropdown.d.ts +1 -1
- package/types/ui/empty-set/empty-set.d.ts +1 -1
- package/types/ui/file-name/file-name.d.ts +2 -2
- package/types/ui/filters/filters.d.ts +1 -1
- package/types/ui/filters/index.d.ts +1 -1
- package/types/ui/horizontal-bar-chart/horizontal-bar-chart.d.ts +1 -1
- package/types/ui/hover-card/hover-card.d.ts +1 -1
- package/types/ui/icon/icon.d.ts +2 -1
- package/types/ui/index.d.ts +0 -1
- package/types/ui/input/input.d.ts +1 -1
- package/types/ui/loader/loader.d.ts +1 -1
- package/types/ui/skeleton/skeleton.d.ts +1 -1
- package/types/ui/sort-dropdown/sort-dropdown.d.ts +1 -1
- package/types/ui/table/index.d.ts +1 -1
- package/types/ui/table/table.d.ts +14 -33
- package/types/ui/tabs/tabs.d.ts +1 -1
- package/types/ui/tag/index.d.ts +1 -1
- package/types/ui/tag/tag.d.ts +22 -33
- package/types/ui/toolbar/toolbar.d.ts +1 -1
- package/types/ui/tooltip/index.d.ts +1 -1
- package/types/ui/tooltip/tooltip.d.ts +10 -28
- package/lib/components/summary-item/index.js.map +0 -1
- package/lib/components/summary-item/summary-item.js +0 -97
- package/lib/components/summary-item/summary-item.js.map +0 -1
- package/lib/ui/panels/index.js +0 -6
- package/lib/ui/panels/index.js.map +0 -1
- package/lib/ui/panels/panels.js +0 -28
- package/lib/ui/panels/panels.js.map +0 -1
- package/lib/ui/panels/panels.module.css +0 -23
- package/lib-esm/components/summary-item/index.js +0 -2
- package/lib-esm/components/summary-item/index.js.map +0 -1
- package/lib-esm/components/summary-item/summary-item.js +0 -67
- package/lib-esm/components/summary-item/summary-item.js.map +0 -1
- package/lib-esm/ui/panels/index.js +0 -2
- package/lib-esm/ui/panels/index.js.map +0 -1
- package/lib-esm/ui/panels/panels.js +0 -21
- package/lib-esm/ui/panels/panels.js.map +0 -1
- package/lib-esm/ui/panels/panels.module.css +0 -23
- package/src/components/asset-info/asset-info.jsx +0 -96
- package/src/components/metric/metric.jsx +0 -63
- package/src/components/module-info/module-info.jsx +0 -93
- package/src/components/summary/summary.jsx +0 -73
- package/src/components/summary-item/index.js +0 -1
- package/src/components/summary-item/summary-item.jsx +0 -142
- package/src/layout/box/box.jsx +0 -67
- package/src/layout/box/index.js +0 -1
- package/src/layout/flex-stack/flex-stack.jsx +0 -49
- package/src/layout/stack/stack.jsx +0 -32
- package/src/ui/alert/alert.jsx +0 -27
- package/src/ui/container/container.jsx +0 -24
- package/src/ui/container/index.js +0 -1
- package/src/ui/panels/index.js +0 -1
- package/src/ui/panels/panels.jsx +0 -39
- package/src/ui/panels/panels.module.css +0 -23
- package/src/ui/table/table.jsx +0 -37
- package/src/ui/tag/tag.jsx +0 -49
- package/src/ui/tooltip/tooltip.jsx +0 -67
- package/tsconfig.esm.json +0 -13
- package/tsconfig.json +0 -7
- package/tsconfig.lib.json +0 -9
- package/types/components/summary-item/index.d.ts +0 -1
- package/types/components/summary-item/summary-item.d.ts +0 -40
- package/types/ui/panels/index.d.ts +0 -1
- package/types/ui/panels/panels.d.ts +0 -18
- /package/src/components/asset-info/{index.js → index.ts} +0 -0
- /package/src/components/metric/{index.js → index.ts} +0 -0
- /package/src/components/module-info/{index.js → index.ts} +0 -0
- /package/src/components/summary/{index.js → index.ts} +0 -0
- /package/src/layout/flex-stack/{index.js → index.ts} +0 -0
- /package/src/layout/stack/{index.js → index.ts} +0 -0
- /package/src/ui/alert/{index.js → index.ts} +0 -0
- /package/src/ui/table/{index.js → index.ts} +0 -0
- /package/src/ui/tag/{index.js → index.ts} +0 -0
- /package/src/ui/tooltip/{index.js → index.ts} +0 -0
|
@@ -14,18 +14,20 @@ const Template = (props: any) => <Insights {...props} />;
|
|
|
14
14
|
export const Default = Template.bind({});
|
|
15
15
|
|
|
16
16
|
Default.args = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
insights: {
|
|
18
|
+
duplicatePackages: {
|
|
19
|
+
type: 'error',
|
|
20
|
+
data: {
|
|
21
|
+
packages: { 'package-a': ['package-a', 'package-a~1'] },
|
|
22
|
+
text: 'Bundle introduced 1 and removed 2 duplicate packages',
|
|
23
|
+
},
|
|
22
24
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
newPackages: {
|
|
26
|
+
type: 'warning',
|
|
27
|
+
data: {
|
|
28
|
+
text: 'Bundle introduced 2 new packages: package-c, package-d',
|
|
29
|
+
packages: ['package-c', 'package-d'],
|
|
30
|
+
},
|
|
29
31
|
},
|
|
30
32
|
},
|
|
31
33
|
};
|
|
@@ -33,18 +35,20 @@ Default.args = {
|
|
|
33
35
|
export const Info = Template.bind({});
|
|
34
36
|
|
|
35
37
|
Info.args = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
insights: {
|
|
39
|
+
duplicatePackages: {
|
|
40
|
+
type: 'info',
|
|
41
|
+
data: {
|
|
42
|
+
packages: { 'package-a': ['package-a', 'package-a~1'] },
|
|
43
|
+
text: 'Bundle removed 1 duplicate packages',
|
|
44
|
+
},
|
|
41
45
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
newPackages: {
|
|
47
|
+
type: 'warning',
|
|
48
|
+
data: {
|
|
49
|
+
text: 'Bundle introduced 2 new packages: package-c, package-d',
|
|
50
|
+
packages: ['package-c', 'package-d'],
|
|
51
|
+
},
|
|
48
52
|
},
|
|
49
53
|
},
|
|
50
54
|
};
|
|
@@ -1,87 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
BUNDLE_PACKAGES_DUPLICATE,
|
|
5
|
-
BUNDLE_PACKAGES_COUNT,
|
|
6
|
-
InsightType,
|
|
7
|
-
JobInsight,
|
|
8
|
-
JobInsights as JobInsightsType,
|
|
9
|
-
} from '@bundle-stats/utils';
|
|
2
|
+
import { JobInsightsInfo, getInsightList } from '@bundle-stats/utils';
|
|
10
3
|
|
|
11
4
|
import { FlexStack } from '../../layout/flex-stack';
|
|
12
5
|
import { Stack } from '../../layout/stack';
|
|
13
|
-
import { Icon } from '../../ui/icon';
|
|
14
6
|
import { ComponentLink } from '../component-link';
|
|
15
|
-
|
|
7
|
+
import { InsightIcon } from '../insight-icon';
|
|
16
8
|
import css from './insights.module.css';
|
|
17
9
|
|
|
18
|
-
interface InsightEntry {
|
|
19
|
-
name: string;
|
|
20
|
-
insight: JobInsight;
|
|
21
|
-
link: any;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const normalizedInsights = ({
|
|
25
|
-
duplicatePackages,
|
|
26
|
-
newPackages,
|
|
27
|
-
}: Partial<JobInsightsType['webpack']>): Array<InsightEntry> => {
|
|
28
|
-
const insightsByLevel: Record<InsightType, Array<InsightEntry>> = {
|
|
29
|
-
[InsightType.ERROR]: [],
|
|
30
|
-
[InsightType.WARNING]: [],
|
|
31
|
-
[InsightType.INFO]: [],
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
if (duplicatePackages) {
|
|
35
|
-
insightsByLevel[duplicatePackages.type].push({
|
|
36
|
-
name: 'duplicatePackages',
|
|
37
|
-
insight: duplicatePackages,
|
|
38
|
-
link: BUNDLE_PACKAGES_DUPLICATE,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (newPackages) {
|
|
43
|
-
insightsByLevel[newPackages.type].push({
|
|
44
|
-
name: 'newPackages',
|
|
45
|
-
insight: newPackages,
|
|
46
|
-
link: BUNDLE_PACKAGES_COUNT,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return [
|
|
51
|
-
...(insightsByLevel[InsightType.ERROR] || []),
|
|
52
|
-
...(insightsByLevel[InsightType.WARNING] || []),
|
|
53
|
-
...(insightsByLevel[InsightType.INFO] || []),
|
|
54
|
-
];
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const InsightTypeIconMap = new Map([
|
|
58
|
-
[InsightType.ERROR, Icon.ICONS.ERROR],
|
|
59
|
-
[InsightType.WARNING, Icon.ICONS.WARNING],
|
|
60
|
-
[InsightType.INFO, Icon.ICONS.INFO],
|
|
61
|
-
]);
|
|
62
|
-
|
|
63
10
|
interface InsightsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
64
|
-
|
|
65
|
-
newPackages: any;
|
|
11
|
+
insights: JobInsightsInfo;
|
|
66
12
|
customComponentLink?: React.ElementType;
|
|
67
13
|
}
|
|
68
14
|
|
|
69
15
|
export const Insights = (props: InsightsProps) => {
|
|
70
16
|
const {
|
|
71
|
-
|
|
72
|
-
newPackages,
|
|
17
|
+
insights,
|
|
73
18
|
customComponentLink: CustomComponentLink = ComponentLink,
|
|
74
19
|
...restProps
|
|
75
20
|
} = props;
|
|
76
21
|
|
|
77
|
-
const
|
|
22
|
+
const insightList = getInsightList(insights);
|
|
78
23
|
|
|
79
24
|
return (
|
|
80
25
|
<Stack space="xxsmall" {...restProps}>
|
|
81
|
-
{
|
|
82
|
-
const glyph = InsightTypeIconMap.get(insight.type);
|
|
26
|
+
{insightList.map(({ name, insight, link }) => {
|
|
83
27
|
const { text } = insight.data as { text: string };
|
|
84
|
-
|
|
85
28
|
return (
|
|
86
29
|
<FlexStack
|
|
87
30
|
key={name}
|
|
@@ -89,9 +32,9 @@ export const Insights = (props: InsightsProps) => {
|
|
|
89
32
|
alignItems="center"
|
|
90
33
|
as={CustomComponentLink}
|
|
91
34
|
{...link}
|
|
92
|
-
className={
|
|
35
|
+
className={css.entry}
|
|
93
36
|
>
|
|
94
|
-
|
|
37
|
+
<InsightIcon type={insight.type} className={css.icon} />
|
|
95
38
|
<span>{text}</span>
|
|
96
39
|
</FlexStack>
|
|
97
40
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
|
|
2
|
+
font-family: var(--font-family-fixed);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.displayUnit {
|
|
6
6
|
font-size: var(--size-small);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.
|
|
9
|
+
.content {
|
|
10
10
|
font-size: var(--size-small);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
display: inline-block;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.inline .
|
|
17
|
+
.inline .content {
|
|
18
18
|
display: inline-block;
|
|
19
19
|
margin: 0 0 0 var(--space-xxxsmall);
|
|
20
20
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, Story } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { getWrapperDecorator } from '../../stories';
|
|
5
|
+
import { Delta } from '../delta';
|
|
6
|
+
import { Metric } from '.';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Metric',
|
|
10
|
+
component: Metric,
|
|
11
|
+
decorators: [getWrapperDecorator({ maxWidth: '200px' })],
|
|
12
|
+
} as Meta;
|
|
13
|
+
|
|
14
|
+
const Template: Story = (args) => <Metric {...args} />;
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
|
|
18
|
+
Default.args = {
|
|
19
|
+
value: '100',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const WithUnit = Template.bind({});
|
|
23
|
+
|
|
24
|
+
WithUnit.args = {
|
|
25
|
+
value: '100',
|
|
26
|
+
unit: 'KiB',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const WithDelta = Template.bind({});
|
|
30
|
+
|
|
31
|
+
WithDelta.args = {
|
|
32
|
+
...WithUnit.args,
|
|
33
|
+
children: <Delta displayValue="+10%" deltaType="POSITIVE" />,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Inline = Template.bind({});
|
|
37
|
+
|
|
38
|
+
Inline.args = {
|
|
39
|
+
...WithDelta.args,
|
|
40
|
+
inline: true,
|
|
41
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
import css from './metric.module.css';
|
|
5
|
+
|
|
6
|
+
export interface MetricProps {
|
|
7
|
+
/**
|
|
8
|
+
* Metric value
|
|
9
|
+
*/
|
|
10
|
+
value?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Metric value unit
|
|
13
|
+
*/
|
|
14
|
+
unit?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Inline variant - render children inline
|
|
17
|
+
*/
|
|
18
|
+
inline?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Metric = (props: MetricProps & React.ComponentProps<'div'>) => {
|
|
22
|
+
const {
|
|
23
|
+
className = '',
|
|
24
|
+
value = '0',
|
|
25
|
+
unit = '',
|
|
26
|
+
inline = false,
|
|
27
|
+
children = null,
|
|
28
|
+
...restProps
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const rootClassName = cx(className, css.root, inline && css.inline);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className={rootClassName} {...restProps}>
|
|
35
|
+
<div className={css.display}>
|
|
36
|
+
<span className={css.displayValue}>{value}</span>
|
|
37
|
+
{unit && <span className={css.displayUnit}>{unit}</span>}
|
|
38
|
+
</div>
|
|
39
|
+
{children && <div className={css.content}>{children}</div>}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './metric-run-info';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.readMoreLink {
|
|
2
|
+
appearance: none;
|
|
3
|
+
background: none;
|
|
4
|
+
margin: 0;
|
|
5
|
+
border: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
color: var(--color-primary);
|
|
8
|
+
text-decoration: underline;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.readMoreLink:hover,
|
|
13
|
+
.readMoreLink:active,
|
|
14
|
+
.readMoreLink:focus {
|
|
15
|
+
color: var(--color-primary-dark);
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Meta, Story } from '@storybook/react';
|
|
4
|
+
import { MetricRunInfo } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/MetricRunInfo',
|
|
8
|
+
component: MetricRunInfo,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const Template: Story = (args: any) => <MetricRunInfo {...args} />;
|
|
12
|
+
|
|
13
|
+
export const Default = Template.bind({});
|
|
14
|
+
|
|
15
|
+
Default.args = {
|
|
16
|
+
metricId: 'webpack.totalSizeByTypeALL',
|
|
17
|
+
current: 120 * 1024,
|
|
18
|
+
baseline: 100 * 1024,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const NoBaseline = Template.bind({});
|
|
22
|
+
|
|
23
|
+
NoBaseline.args = {
|
|
24
|
+
metricId: 'webpack.totalSizeByTypeALL',
|
|
25
|
+
current: 120 * 1024,
|
|
26
|
+
showBaseline: false,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const NoDelta = Template.bind({});
|
|
30
|
+
|
|
31
|
+
NoDelta.args = {
|
|
32
|
+
...Default.args,
|
|
33
|
+
showDelta: false,
|
|
34
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
|
|
3
|
+
|
|
4
|
+
import { Stack } from '../../layout/stack';
|
|
5
|
+
import { RunInfo, RunInfoProps } from '../run-info';
|
|
6
|
+
import css from './metric-run-info.module.css';
|
|
7
|
+
|
|
8
|
+
interface MetricInfoProps {
|
|
9
|
+
description: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const MetricHoverCard = ({ description, url }: MetricInfoProps) => {
|
|
14
|
+
// The component parent can be rendered inside a link, use button to avoid using nested links
|
|
15
|
+
const onClick = useCallback(() => {
|
|
16
|
+
if (url) {
|
|
17
|
+
window.open(url);
|
|
18
|
+
}
|
|
19
|
+
}, [url]);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Stack space="xxxsmall">
|
|
23
|
+
<p>{description}</p>
|
|
24
|
+
{url && (
|
|
25
|
+
<p>
|
|
26
|
+
<button type="button" onClick={onClick} className={css.readMoreLink}>
|
|
27
|
+
Read more
|
|
28
|
+
</button>
|
|
29
|
+
</p>
|
|
30
|
+
)}
|
|
31
|
+
</Stack>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface MetricRunInfoProps {
|
|
36
|
+
metricId: string;
|
|
37
|
+
current: number;
|
|
38
|
+
baseline?: number;
|
|
39
|
+
showDelta?: boolean;
|
|
40
|
+
showMetricDescription?: boolean;
|
|
41
|
+
showBaseline?: boolean;
|
|
42
|
+
size?: RunInfoProps['size'];
|
|
43
|
+
loading?: RunInfoProps['loading'];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const MetricRunInfo = (props: MetricRunInfoProps & React.ComponentProps<'div'>) => {
|
|
47
|
+
const {
|
|
48
|
+
metricId,
|
|
49
|
+
current,
|
|
50
|
+
baseline = 0,
|
|
51
|
+
showDelta = true,
|
|
52
|
+
showMetricDescription = true,
|
|
53
|
+
showBaseline = true,
|
|
54
|
+
...restProps
|
|
55
|
+
} = props;
|
|
56
|
+
|
|
57
|
+
const metric = getGlobalMetricType(metricId);
|
|
58
|
+
const metricRunInfo = getMetricRunInfo(metric, current, baseline || 0);
|
|
59
|
+
|
|
60
|
+
const titleHoverCard = useMemo(() => {
|
|
61
|
+
if (showMetricDescription) {
|
|
62
|
+
return <MetricHoverCard description={metric.description} url={metric.url} />;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return null;
|
|
66
|
+
}, [showMetricDescription, metric]);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<RunInfo
|
|
70
|
+
title={metric.label}
|
|
71
|
+
titleHoverCard={titleHoverCard}
|
|
72
|
+
enhance
|
|
73
|
+
current={metricRunInfo.displayValue}
|
|
74
|
+
showBaseline={showBaseline}
|
|
75
|
+
{...(showBaseline && {
|
|
76
|
+
baseline: metric.formatter(baseline),
|
|
77
|
+
})}
|
|
78
|
+
{...(showDelta && showBaseline && {
|
|
79
|
+
delta: metricRunInfo.displayDeltaPercentage,
|
|
80
|
+
deltaType: metricRunInfo.deltaType,
|
|
81
|
+
})}
|
|
82
|
+
{...restProps}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
@@ -8,7 +8,7 @@ export const MetricsTableOptions = (props) => {
|
|
|
8
8
|
const { className, handleViewAll, handleResetFilters, ...restProps } = props;
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
|
-
<Dropdown className={className} glyph="
|
|
11
|
+
<Dropdown className={className} glyph="more-vertical" {...restProps}>
|
|
12
12
|
{handleResetFilters && (
|
|
13
13
|
<Dropdown.Item onClick={handleResetFilters}>
|
|
14
14
|
{I18N.RESET_FILTERS}
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
.chunksItem {
|
|
10
10
|
overflow-wrap: break-word;
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
text-transform: none;
|
|
13
|
+
font-weight: normal;
|
|
14
|
+
font-size: 1em;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
.chunksItem + .chunksItem {
|
|
14
18
|
margin-left: var(--space-xxxsmall);
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
.fileName {
|
|
18
|
-
max-width: 100%;
|
|
19
|
-
padding: 2px;
|
|
20
|
-
background: var(--color-highlight-warning);
|
|
21
|
-
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { getWrapperDecorator } from '../../stories';
|
|
4
|
+
import { ModuleInfo } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/ModuleInfo',
|
|
8
|
+
component: ModuleInfo,
|
|
9
|
+
decorators: [getWrapperDecorator()],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = () => (
|
|
13
|
+
<ModuleInfo
|
|
14
|
+
item={{
|
|
15
|
+
label: './node_modules/lodash/fp/merge.js',
|
|
16
|
+
duplicated: true,
|
|
17
|
+
runs: [
|
|
18
|
+
{
|
|
19
|
+
name: './node_modules/lodash/fp/merge.js',
|
|
20
|
+
chunkIds: ['1', '2'],
|
|
21
|
+
value: 1024 * 4,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: './node_modules/lodash/fp/merge.js',
|
|
25
|
+
chunkIds: ['1', '2'],
|
|
26
|
+
value: 1024 * 3,
|
|
27
|
+
displayValue: '3KiB',
|
|
28
|
+
},
|
|
29
|
+
] as any,
|
|
30
|
+
}}
|
|
31
|
+
chunks={[
|
|
32
|
+
{
|
|
33
|
+
id: '1',
|
|
34
|
+
name: 'chunk-1',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: '2',
|
|
38
|
+
name: 'chunk-2',
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
chunkIds={['1', '2']}
|
|
42
|
+
labels={['Job #2', 'Job #1']}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
|
+
import noop from 'lodash/noop';
|
|
5
|
+
import { BUNDLE_MODULES_DUPLICATE, MetricRunInfo, getBundleModulesByChunk } from '@bundle-stats/utils';
|
|
6
|
+
import { Module, MetaChunk } from '@bundle-stats/utils/types/webpack';
|
|
7
|
+
|
|
8
|
+
import { Tag } from '../../ui/tag';
|
|
9
|
+
import { ComponentLink } from '../component-link';
|
|
10
|
+
import { EntryInfo } from '../entry-info';
|
|
11
|
+
import css from './module-info.module.css';
|
|
12
|
+
|
|
13
|
+
interface ModuleInfoProps {
|
|
14
|
+
item: {
|
|
15
|
+
label: string;
|
|
16
|
+
changed?: boolean;
|
|
17
|
+
duplicated?: boolean;
|
|
18
|
+
runs: Array<Module & MetricRunInfo>;
|
|
19
|
+
};
|
|
20
|
+
chunks?: Array<MetaChunk>;
|
|
21
|
+
chunkIds?: Array<string>;
|
|
22
|
+
labels: Array<string>;
|
|
23
|
+
customComponentLink?: React.ElementType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const ModuleInfo = (props: ModuleInfoProps & React.ComponentProps<'div'>) => {
|
|
27
|
+
const {
|
|
28
|
+
className = '',
|
|
29
|
+
item,
|
|
30
|
+
labels,
|
|
31
|
+
chunks = [],
|
|
32
|
+
chunkIds = [],
|
|
33
|
+
customComponentLink: CustomComponentLink = ComponentLink,
|
|
34
|
+
onClick = noop,
|
|
35
|
+
} = props;
|
|
36
|
+
|
|
37
|
+
const rootClassName = cx(css.root, className);
|
|
38
|
+
const currentRun = item.runs?.[0];
|
|
39
|
+
|
|
40
|
+
const tags = useMemo(() => {
|
|
41
|
+
if (!item.duplicated) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div>
|
|
47
|
+
<Tag as={CustomComponentLink} {...BUNDLE_MODULES_DUPLICATE} onClick={onClick} kind="danger">Duplicate</Tag>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}, [item]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<EntryInfo item={item} labels={labels} tags={tags} className={rootClassName}>
|
|
54
|
+
{!isEmpty(currentRun?.chunkIds) && (
|
|
55
|
+
<div className={css.chunks}>
|
|
56
|
+
<span className={css.chunksTitle}>Chunks:</span>
|
|
57
|
+
{currentRun.chunkIds.map((chunkId) => {
|
|
58
|
+
const chunk = chunks?.find(({ id }) => id === chunkId);
|
|
59
|
+
|
|
60
|
+
if (!chunk) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Tag
|
|
66
|
+
as={CustomComponentLink}
|
|
67
|
+
{...getBundleModulesByChunk(chunkIds, chunkId)}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
className={css.chunksItem}
|
|
70
|
+
>
|
|
71
|
+
{chunk.name}
|
|
72
|
+
</Tag>
|
|
73
|
+
);
|
|
74
|
+
})}
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</EntryInfo>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './package-info';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { getWrapperDecorator } from '../../stories';
|
|
4
|
+
import { PackageInfo } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/PackageInfo',
|
|
8
|
+
component: PackageInfo,
|
|
9
|
+
decorators: [getWrapperDecorator()],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const RUNS = [
|
|
13
|
+
{
|
|
14
|
+
name: 'lodash',
|
|
15
|
+
value: 279901,
|
|
16
|
+
path: '../node_modules/lodash',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'lodash',
|
|
20
|
+
value: 283712,
|
|
21
|
+
displayValue: '277.06KiB',
|
|
22
|
+
path: '../node_modules/lodash',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const Default = () => (
|
|
27
|
+
<PackageInfo
|
|
28
|
+
name="lodash~1"
|
|
29
|
+
item={{
|
|
30
|
+
label: 'lodash',
|
|
31
|
+
duplicate: true,
|
|
32
|
+
runs: RUNS as any,
|
|
33
|
+
}}
|
|
34
|
+
labels={['Job #2', 'Job #1']}
|
|
35
|
+
/>
|
|
36
|
+
);
|