@bundle-stats/ui 4.13.0-beta.9 → 4.13.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/app.js +4 -8
- package/lib/app/app.js.map +1 -1
- package/lib/app/app.module.css +2 -2
- package/lib/assets/icons.svg +70 -67
- package/lib/assets/icons.svg.js +14 -12
- package/lib/assets/icons.svg.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +44 -10
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +14 -12
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.i18n.js +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +38 -15
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.module.css +0 -5
- package/lib/components/bundle-packages/bundle-packages.js +43 -9
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.module.css +0 -5
- package/lib/components/delta/delta.js +1 -1
- package/lib/components/delta/delta.js.map +1 -1
- package/lib/components/delta/delta.module.css +10 -1
- package/lib/components/jobs-header/jobs-header.module.css +0 -4
- package/lib/components/metrics-display-selector/metrics-display-selector.js +41 -4
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.module.css +15 -7
- package/lib/components/metrics-treemap/index.js +4 -0
- package/lib/components/metrics-treemap/index.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.constants.js +3 -0
- package/lib/components/metrics-treemap/metrics-treemap.constants.js.map +1 -0
- package/lib/components/metrics-treemap/metrics-treemap.i18n.js +6 -0
- package/lib/components/metrics-treemap/metrics-treemap.i18n.js.map +1 -0
- package/lib/components/metrics-treemap/metrics-treemap.js +100 -62
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.module.css +139 -51
- package/lib/components/metrics-treemap/metrics-treemap.utils.js +109 -0
- package/lib/components/metrics-treemap/metrics-treemap.utils.js.map +1 -0
- package/lib/components/module-info/module-info.js +1 -2
- package/lib/components/module-info/module-info.js.map +1 -1
- package/lib/components/run-info/run-info.module.css +7 -7
- package/lib/css/variables.css +14 -13
- package/lib/hooks/metrics-display-type.js +45 -24
- package/lib/hooks/metrics-display-type.js.map +1 -1
- package/lib/hooks/search-params.js +1 -0
- package/lib/hooks/search-params.js.map +1 -1
- package/lib/layout/box/box.module.css +4 -2
- package/lib/layout/flex-stack/flex-stack.js +3 -4
- package/lib/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib/layout/flex-stack/flex-stack.module.css +19 -23
- package/lib/ui/button/button.js +5 -4
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/button/button.module.css +55 -53
- package/lib/ui/dropdown/dropdown.js +2 -2
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/filters/filters.js +2 -2
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +8 -1
- package/lib/ui/hover-card/hover-card.js +1 -1
- package/lib/ui/hover-card/hover-card.js.map +1 -1
- package/lib/ui/icon/icon.js +2 -1
- package/lib/ui/icon/icon.js.map +1 -1
- package/lib/ui/input-search/input-search.js +1 -1
- package/lib/ui/input-search/input-search.js.map +1 -1
- package/lib/ui/loader/loader.js +1 -1
- package/lib/ui/loader/loader.js.map +1 -1
- package/lib/ui/table/table.module.css +30 -0
- package/lib/ui/tag/tag.module.css +3 -3
- package/lib/ui/toolbar/toolbar.module.css +1 -3
- package/lib-esm/app/app.js +4 -8
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/app/app.module.css +2 -2
- package/lib-esm/assets/icons.svg +70 -67
- package/lib-esm/assets/icons.svg.js +14 -12
- package/lib-esm/assets/icons.svg.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +45 -11
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +15 -13
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.i18n.js +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +39 -16
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +0 -5
- package/lib-esm/components/bundle-packages/bundle-packages.js +44 -10
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +0 -5
- package/lib-esm/components/delta/delta.js +1 -1
- package/lib-esm/components/delta/delta.js.map +1 -1
- package/lib-esm/components/delta/delta.module.css +10 -1
- package/lib-esm/components/jobs-header/jobs-header.module.css +0 -4
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +41 -4
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +15 -7
- package/lib-esm/components/metrics-treemap/index.js +1 -0
- package/lib-esm/components/metrics-treemap/index.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js +2 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js.map +1 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.i18n.js +3 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.i18n.js.map +1 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.js +102 -63
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +139 -51
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js +105 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js.map +1 -0
- package/lib-esm/components/module-info/module-info.js +1 -2
- package/lib-esm/components/module-info/module-info.js.map +1 -1
- package/lib-esm/components/run-info/run-info.module.css +7 -7
- package/lib-esm/css/variables.css +14 -13
- package/lib-esm/hooks/metrics-display-type.js +46 -24
- package/lib-esm/hooks/metrics-display-type.js.map +1 -1
- package/lib-esm/hooks/search-params.js +1 -0
- package/lib-esm/hooks/search-params.js.map +1 -1
- package/lib-esm/layout/box/box.module.css +4 -2
- package/lib-esm/layout/flex-stack/flex-stack.js +3 -4
- package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib-esm/layout/flex-stack/flex-stack.module.css +19 -23
- package/lib-esm/ui/button/button.js +5 -4
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/button/button.module.css +55 -53
- package/lib-esm/ui/dropdown/dropdown.js +2 -2
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/filters/filters.js +2 -2
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +8 -1
- package/lib-esm/ui/hover-card/hover-card.js +1 -1
- package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
- package/lib-esm/ui/icon/icon.js +2 -1
- package/lib-esm/ui/icon/icon.js.map +1 -1
- package/lib-esm/ui/input-search/input-search.js +1 -1
- package/lib-esm/ui/input-search/input-search.js.map +1 -1
- package/lib-esm/ui/loader/loader.js +1 -1
- package/lib-esm/ui/loader/loader.js.map +1 -1
- package/lib-esm/ui/table/table.module.css +30 -0
- package/lib-esm/ui/tag/tag.module.css +3 -3
- package/lib-esm/ui/toolbar/toolbar.module.css +1 -3
- package/package.json +9 -9
- package/src/app/app.jsx +4 -12
- package/src/app/app.module.css +2 -2
- package/src/assets/icons/check.svg +4 -0
- package/src/assets/icons.svg +70 -67
- package/src/assets/icons.svg.jsx +12 -12
- package/src/components/bundle-assets/bundle-assets.jsx +82 -25
- package/src/components/bundle-assets/bundle-assets.module.css +0 -5
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +53 -46
- package/src/components/bundle-modules/bundle-modules.i18n.ts +1 -1
- package/src/components/bundle-modules/bundle-modules.module.css +0 -5
- package/src/components/bundle-modules/bundle-modules.tsx +116 -53
- package/src/components/bundle-packages/bundle-packages.jsx +77 -20
- package/src/components/bundle-packages/bundle-packages.module.css +0 -5
- package/src/components/delta/delta.jsx +1 -1
- package/src/components/delta/delta.module.css +10 -1
- package/src/components/jobs-header/jobs-header.module.css +0 -4
- package/src/components/metrics-display-selector/metrics-display-selector.module.css +15 -7
- package/src/components/metrics-display-selector/metrics-display-selector.stories.tsx +33 -0
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +83 -25
- package/src/components/metrics-treemap/__tests__/metrics-treemap.utils.ts +188 -0
- package/src/components/metrics-treemap/index.ts +1 -0
- package/src/components/metrics-treemap/metrics-treemap.constants.ts +52 -0
- package/src/components/metrics-treemap/metrics-treemap.i18n.ts +2 -0
- package/src/components/metrics-treemap/metrics-treemap.module.css +139 -51
- package/src/components/metrics-treemap/metrics-treemap.stories.tsx +44 -10
- package/src/components/metrics-treemap/metrics-treemap.tsx +329 -121
- package/src/components/metrics-treemap/metrics-treemap.utils.ts +162 -0
- package/src/components/module-info/module-info.tsx +1 -1
- package/src/components/run-info/run-info.module.css +7 -7
- package/src/css/variables.css +14 -13
- package/src/hooks/metrics-display-type.ts +79 -29
- package/src/hooks/search-params.js +1 -0
- package/src/layout/box/box.module.css +4 -2
- package/src/layout/flex-stack/flex-stack.module.css +19 -23
- package/src/layout/flex-stack/flex-stack.tsx +2 -8
- package/src/ui/button/button.module.css +55 -53
- package/src/ui/button/button.stories.tsx +16 -9
- package/src/ui/button/button.tsx +8 -7
- package/src/ui/dropdown/dropdown.tsx +2 -3
- package/src/ui/filters/filters.module.css +8 -1
- package/src/ui/filters/filters.tsx +2 -3
- package/src/ui/hover-card/hover-card.tsx +1 -1
- package/src/ui/icon/icon.tsx +2 -1
- package/src/ui/input-search/input-search.tsx +1 -0
- package/src/ui/loader/loader.jsx +1 -1
- package/src/ui/table/table.module.css +30 -0
- package/src/ui/tag/tag.module.css +3 -3
- package/src/ui/toolbar/toolbar.module.css +1 -3
- package/types/components/bundle-modules/bundle-modules.i18n.d.ts +1 -1
- package/types/components/delta/delta.d.ts +2 -2
- package/types/components/metrics-display-selector/metrics-display-selector.d.ts +3 -1
- package/types/components/metrics-treemap/index.d.ts +1 -0
- package/types/components/metrics-treemap/metrics-treemap.constants.d.ts +20 -0
- package/types/components/metrics-treemap/metrics-treemap.d.ts +7 -5
- package/types/components/metrics-treemap/metrics-treemap.i18n.d.ts +2 -0
- package/types/components/metrics-treemap/metrics-treemap.utils.d.ts +5 -0
- package/types/hooks/metrics-display-type.d.ts +8 -2
- package/types/ui/dropdown/dropdown.d.ts +0 -1
- package/types/ui/icon/icon.d.ts +4 -2
- package/types/ui/loader/loader.d.ts +2 -2
- package/lib/components/bundle-assets-totals/bundle-assets-totals.module.css +0 -7
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.module.css +0 -7
- package/src/components/bundle-assets-totals/bundle-assets-totals.module.css +0 -7
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { getTreemapNodesGroupedByPath } from '../metrics-treemap.utils';
|
|
2
|
+
|
|
3
|
+
describe('MetricsTreemap / getTreeNodesGroupedByPath', () => {
|
|
4
|
+
test('should group tree ndoes by path', () => {
|
|
5
|
+
const actual = getTreemapNodesGroupedByPath([
|
|
6
|
+
{
|
|
7
|
+
key: './src/app.jsx',
|
|
8
|
+
runs: [{ value: 300 }, { value: 500 }],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: './src/components/header.jsx',
|
|
12
|
+
runs: [{ value: 200 }, { value: 100 }],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
key: './src/components/footer.jsx',
|
|
16
|
+
runs: [{ value: 100 }, { value: 100 }],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: './src/ui/button.jsx',
|
|
20
|
+
runs: [{ value: 100 }, { value: 100 }],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: './src/ui/input.jsx',
|
|
24
|
+
runs: [{ value: 0 }, { value: 100 }],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: './node_modules/react/dist/react.production.js',
|
|
28
|
+
runs: [{ value: 100 }, { value: 100 }],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: 'favicon.ico',
|
|
32
|
+
runs: [{ value: 10 }, { value: 10 }],
|
|
33
|
+
},
|
|
34
|
+
] as any);
|
|
35
|
+
|
|
36
|
+
expect(actual).toStrictEqual({
|
|
37
|
+
id: '',
|
|
38
|
+
label: '(root)',
|
|
39
|
+
value: 0,
|
|
40
|
+
total: {
|
|
41
|
+
current: 810,
|
|
42
|
+
baseline: 1010,
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
{
|
|
46
|
+
id: '.',
|
|
47
|
+
label: '.',
|
|
48
|
+
value: 0,
|
|
49
|
+
total: {
|
|
50
|
+
current: 800,
|
|
51
|
+
baseline: 1000,
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
{
|
|
55
|
+
id: './src',
|
|
56
|
+
label: 'src',
|
|
57
|
+
value: 0,
|
|
58
|
+
total: {
|
|
59
|
+
current: 700,
|
|
60
|
+
baseline: 900,
|
|
61
|
+
},
|
|
62
|
+
children: [
|
|
63
|
+
{
|
|
64
|
+
id: './src/app.jsx',
|
|
65
|
+
label: 'app.jsx',
|
|
66
|
+
value: 500,
|
|
67
|
+
item: {
|
|
68
|
+
key: './src/app.jsx',
|
|
69
|
+
runs: [{ value: 300 }, { value: 500 }],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: './src/components',
|
|
74
|
+
label: 'components',
|
|
75
|
+
value: 0,
|
|
76
|
+
total: {
|
|
77
|
+
current: 300,
|
|
78
|
+
baseline: 200,
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
{
|
|
82
|
+
id: './src/components/header.jsx',
|
|
83
|
+
label: 'header.jsx',
|
|
84
|
+
value: 200,
|
|
85
|
+
item: {
|
|
86
|
+
key: './src/components/header.jsx',
|
|
87
|
+
runs: [{ value: 200 }, { value: 100 }],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: './src/components/footer.jsx',
|
|
92
|
+
label: 'footer.jsx',
|
|
93
|
+
value: 100,
|
|
94
|
+
item: {
|
|
95
|
+
key: './src/components/footer.jsx',
|
|
96
|
+
runs: [{ value: 100 }, { value: 100 }],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: './src/ui',
|
|
103
|
+
label: 'ui',
|
|
104
|
+
value: 0,
|
|
105
|
+
total: {
|
|
106
|
+
current: 100,
|
|
107
|
+
baseline: 200,
|
|
108
|
+
},
|
|
109
|
+
children: [
|
|
110
|
+
{
|
|
111
|
+
id: './src/ui/button.jsx',
|
|
112
|
+
label: 'button.jsx',
|
|
113
|
+
value: 100,
|
|
114
|
+
item: {
|
|
115
|
+
key: './src/ui/button.jsx',
|
|
116
|
+
runs: [{ value: 100 }, { value: 100 }],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: './src/ui/input.jsx',
|
|
121
|
+
label: 'input.jsx',
|
|
122
|
+
value: 100,
|
|
123
|
+
item: {
|
|
124
|
+
key: './src/ui/input.jsx',
|
|
125
|
+
runs: [{ value: 0 }, { value: 100 }],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: './node_modules',
|
|
134
|
+
label: 'node_modules',
|
|
135
|
+
value: 0,
|
|
136
|
+
total: {
|
|
137
|
+
current: 100,
|
|
138
|
+
baseline: 100,
|
|
139
|
+
},
|
|
140
|
+
children: [
|
|
141
|
+
{
|
|
142
|
+
id: './node_modules/react',
|
|
143
|
+
label: 'react',
|
|
144
|
+
value: 0,
|
|
145
|
+
total: {
|
|
146
|
+
current: 100,
|
|
147
|
+
baseline: 100,
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
{
|
|
151
|
+
id: './node_modules/react/dist',
|
|
152
|
+
label: 'dist',
|
|
153
|
+
value: 0,
|
|
154
|
+
total: {
|
|
155
|
+
current: 100,
|
|
156
|
+
baseline: 100,
|
|
157
|
+
},
|
|
158
|
+
children: [
|
|
159
|
+
{
|
|
160
|
+
id: './node_modules/react/dist/react.production.js',
|
|
161
|
+
label: 'react.production.js',
|
|
162
|
+
value: 100,
|
|
163
|
+
item: {
|
|
164
|
+
key: './node_modules/react/dist/react.production.js',
|
|
165
|
+
runs: [{ value: 100 }, { value: 100 }],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'favicon.ico',
|
|
178
|
+
label: 'favicon.ico',
|
|
179
|
+
value: 10,
|
|
180
|
+
item: {
|
|
181
|
+
key: 'favicon.ico',
|
|
182
|
+
runs: [{ value: 10 }, { value: 10 }],
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReportMetricRow } from '@bundle-stats/utils';
|
|
2
|
+
|
|
3
|
+
export interface TreeTotal {
|
|
4
|
+
current: number;
|
|
5
|
+
baseline: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface TreeLeaf {
|
|
9
|
+
/**
|
|
10
|
+
* Node id - file/directory path
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Node label - file/directory baseline
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* Node value - the max amount between item run values
|
|
19
|
+
*/
|
|
20
|
+
value: number;
|
|
21
|
+
/**
|
|
22
|
+
* Corresponding report metric item
|
|
23
|
+
*/
|
|
24
|
+
item: ReportMetricRow;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Tree {
|
|
28
|
+
/**
|
|
29
|
+
* Node id - file/directory path
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
/**
|
|
33
|
+
* Node label - file/directory baseline
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* Node value - 0 for groups
|
|
38
|
+
*/
|
|
39
|
+
value: number;
|
|
40
|
+
/**
|
|
41
|
+
* List of children nodes
|
|
42
|
+
*/
|
|
43
|
+
children: TreeNodeChildren;
|
|
44
|
+
/**
|
|
45
|
+
* children total values for nested
|
|
46
|
+
*/
|
|
47
|
+
total?: TreeTotal;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type TreeNode = Tree | TreeLeaf;
|
|
51
|
+
|
|
52
|
+
export type TreeNodeChildren = Array<TreeNode>;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
aspect-ratio: 16/9;
|
|
4
4
|
background: var(--color-background);
|
|
5
|
+
border-bottom-left-radius: inherit;
|
|
6
|
+
border-bottom-right-radius: inherit;
|
|
7
|
+
overflow: hidden;
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
.canvas {
|
|
@@ -10,34 +13,101 @@
|
|
|
10
13
|
top: 0;
|
|
11
14
|
width: 100%;
|
|
12
15
|
height: 100%;
|
|
13
|
-
fill: var(--color-text);
|
|
14
|
-
font-family: var(--font-family);
|
|
15
16
|
background: var(--color-background);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Tile group
|
|
21
|
+
*/
|
|
22
|
+
.tileGroup {
|
|
23
|
+
position: absolute;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.tileGroupTitle {
|
|
27
|
+
width: 100%;
|
|
28
|
+
padding: 4px 2px 4px var(--space-xxsmall);
|
|
29
|
+
color: var(--color-text);
|
|
30
|
+
font-family: var(--font-family-fixed);
|
|
31
|
+
font-size: 10px;
|
|
32
|
+
line-height: 16px;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tileGroupTitleTotal {
|
|
39
|
+
margin-left: var(--space-xxxsmall);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Tile group size variation */
|
|
43
|
+
.tileGroupSizeDefault {
|
|
44
|
+
transition: var(--ui-transition-in);
|
|
45
|
+
transition-property: left, top, width, height;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Tile group nested variation */
|
|
49
|
+
.nested .tileGroup {
|
|
50
|
+
background-color: rgba(27, 26, 33, 0.05);
|
|
51
|
+
outline: 1px solid rgba(255, 255, 255, 0.75);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nested .tileGroup:has(> .tileGroupTitle:hover),
|
|
55
|
+
.nested .tileGroup:has(> .tile:hover) {
|
|
56
|
+
background-color: rgba(27, 26, 33, 0.1);
|
|
57
|
+
outline: 1px solid rgba(255, 255, 255, 1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nested .tileGroup--NEGATIVE {
|
|
61
|
+
background-color: rgba(194, 31, 37, 0.05);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nested .tileGroup--NEGATIVE:has(> .tileGroupTitle:hover),
|
|
65
|
+
.nested .tileGroup--NEGATIVE:has(> .tile:hover) {
|
|
66
|
+
background-color: rgba(194, 31, 37, 0.1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.nested .tileGroup--POSITIVE {
|
|
70
|
+
background-color: rgba(42, 147, 39, 0.05);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.nested .tileGroup--POSITIVE:has(> .tileGroupTitle:hover),
|
|
74
|
+
.nested .tileGroup--POSITIVE:has(> .tile:hover) {
|
|
75
|
+
background-color: rgba(42, 147, 39, 0.1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* reset bacground color when having a not changed group */
|
|
79
|
+
.nested .tileGroup--POSITIVE > .tileGroup--NO_CHANGE,
|
|
80
|
+
.nested .tileGroup--NEGATIVE > .tileGroup--NO_CHANGE {
|
|
81
|
+
background-color: var(--color-background);
|
|
82
|
+
background-image: linear-gradient(rgba(27, 26, 33, 0.1), rgba(27, 26, 33, 0.1));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nested .tileGroup--POSITIVE > .tileGroup--NO_CHANGE:has(> .tileGroupTitle:hover),
|
|
86
|
+
.nested .tileGroup--POSITIVE > .tileGroup--NO_CHANGE:has(> .tile:hover),
|
|
87
|
+
.nested .tileGroup--NEGATIVE > .tileGroup--NO_CHANGE:has(> .tileGroupTitle:hover),
|
|
88
|
+
.nested .tileGroup--NEGATIVE > .tileGroup--NEGATIVE > .tileGroup--NO_CHANGE:has(> .tile:hover) {
|
|
89
|
+
background-color: var(--color-background);
|
|
90
|
+
background-image: linear-gradient(rgba(27, 26, 33, 0.1), rgba(27, 26, 33, 0.1));
|
|
22
91
|
}
|
|
23
92
|
|
|
24
93
|
/** Leaf wrapper button */
|
|
25
|
-
.
|
|
94
|
+
.tile {
|
|
26
95
|
position: absolute;
|
|
27
96
|
appearance: none;
|
|
28
97
|
border: 0;
|
|
29
98
|
border-radius: 0;
|
|
30
99
|
padding: 0;
|
|
31
|
-
background:
|
|
100
|
+
background: var(--color-background);
|
|
32
101
|
display: flex;
|
|
33
102
|
align-items: center;
|
|
34
103
|
font-family: var(--font-family-fixed);
|
|
35
104
|
font-size: var(--size-small);
|
|
36
105
|
line-height: var(--line-height-heading);
|
|
37
106
|
text-align: left;
|
|
107
|
+
transition: var(--ui-transition-out);
|
|
38
108
|
}
|
|
39
109
|
|
|
40
|
-
.
|
|
110
|
+
.tile::before {
|
|
41
111
|
content: "";
|
|
42
112
|
display: block;
|
|
43
113
|
position: absolute;
|
|
@@ -47,18 +117,9 @@
|
|
|
47
117
|
width: 100%;
|
|
48
118
|
height: 100%;
|
|
49
119
|
background-color: currentColor;
|
|
50
|
-
color: var(--color-background);
|
|
51
|
-
transition: var(--ui-transition-out);
|
|
52
|
-
transition-property: opacity;
|
|
53
|
-
opacity: 0.6;
|
|
54
120
|
}
|
|
55
121
|
|
|
56
|
-
.
|
|
57
|
-
transition: var(--ui-transition-in);
|
|
58
|
-
opacity: 0.4;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.leafContent {
|
|
122
|
+
.tileContent {
|
|
62
123
|
position: relative;
|
|
63
124
|
z-index: 1;
|
|
64
125
|
width: 100%;
|
|
@@ -71,12 +132,12 @@
|
|
|
71
132
|
line-height: var(--line-height-heading);
|
|
72
133
|
}
|
|
73
134
|
|
|
74
|
-
/** Align label to other elements on the first column
|
|
75
|
-
.
|
|
135
|
+
/** Align label to other elements on the first column cells */
|
|
136
|
+
.tileFirstCol .tileContent {
|
|
76
137
|
padding-left: var(--space-small);
|
|
77
138
|
}
|
|
78
139
|
|
|
79
|
-
.
|
|
140
|
+
.tileContentLabel {
|
|
80
141
|
flex: 0 1 auto;
|
|
81
142
|
width: 100%;
|
|
82
143
|
min-width: 0;
|
|
@@ -84,67 +145,95 @@
|
|
|
84
145
|
overflow: hidden;
|
|
85
146
|
}
|
|
86
147
|
|
|
87
|
-
.
|
|
148
|
+
.tileContentValue {
|
|
88
149
|
flex: 0 0 auto;
|
|
89
150
|
max-width: calc(100% + var(--space-xxsmall));
|
|
90
151
|
white-space: nowrap;
|
|
91
152
|
overflow: hidden;
|
|
92
153
|
}
|
|
93
154
|
|
|
94
|
-
.
|
|
155
|
+
.tileContentMetric {
|
|
95
156
|
font-weight: bold;
|
|
96
157
|
}
|
|
97
158
|
|
|
98
|
-
.
|
|
159
|
+
.tileContentDelta {
|
|
99
160
|
margin-left: var(--space-xxxsmall);
|
|
100
161
|
}
|
|
101
162
|
|
|
102
163
|
/** Tile size variation */
|
|
103
|
-
.
|
|
164
|
+
.tileSizeSmall .tileContent {
|
|
104
165
|
padding: var(--space-xxxsmall) var(--space-xxsmall);
|
|
105
166
|
gap: 0;
|
|
106
167
|
font-size: var(--size-xsmall);
|
|
107
168
|
}
|
|
108
169
|
|
|
109
|
-
.
|
|
170
|
+
.tileSizeSmall .tileContentLabel {
|
|
110
171
|
margin-top: 0;
|
|
111
172
|
}
|
|
112
173
|
|
|
174
|
+
.tileSizeDefault {
|
|
175
|
+
transition: var(--ui-transition-in);
|
|
176
|
+
transition-property: left top width height;
|
|
177
|
+
}
|
|
178
|
+
|
|
113
179
|
/** Tile diff variation */
|
|
114
|
-
.
|
|
115
|
-
|
|
180
|
+
.tile {
|
|
181
|
+
outline: 1px solid rgba(255, 255, 255, 1);
|
|
182
|
+
color: var(--color-text);
|
|
183
|
+
transition: var(--ui-transition-out);
|
|
116
184
|
}
|
|
117
185
|
|
|
118
|
-
.
|
|
119
|
-
color: var(--color-
|
|
186
|
+
.tile::before {
|
|
187
|
+
color: var(--color-highlight);
|
|
188
|
+
transition: var(--ui-transition-out);
|
|
189
|
+
transition-property: opacity;
|
|
190
|
+
opacity: 0.5;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.tile:hover::before {
|
|
194
|
+
transition: var(--ui-transition-in);
|
|
120
195
|
opacity: 0.4;
|
|
121
196
|
}
|
|
122
197
|
|
|
123
|
-
.
|
|
124
|
-
|
|
198
|
+
.tile-NO_CHANGE {
|
|
199
|
+
color: var(--color-text-ultra-light);
|
|
125
200
|
}
|
|
126
201
|
|
|
127
|
-
.
|
|
202
|
+
.tile-NO_CHANGE::before {
|
|
203
|
+
color: var(--color-gray-50);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.tile-HIGH_NEGATIVE::before {
|
|
128
207
|
color: var(--color-red-100);
|
|
129
208
|
}
|
|
130
209
|
|
|
131
|
-
.
|
|
210
|
+
.tile-NEGATIVE::before {
|
|
132
211
|
color: var(--color-red-50);
|
|
133
212
|
}
|
|
134
213
|
|
|
135
|
-
.
|
|
136
|
-
color: var(--color-red-
|
|
214
|
+
.tile-LOW_NEGATIVE::before {
|
|
215
|
+
color: var(--color-red-50);
|
|
216
|
+
opacity: 0.6;
|
|
137
217
|
}
|
|
138
218
|
|
|
139
|
-
.
|
|
140
|
-
|
|
219
|
+
.tile-LOW_NEGATIVE:hover::before {
|
|
220
|
+
opacity: 0.5;
|
|
141
221
|
}
|
|
142
222
|
|
|
143
|
-
.
|
|
223
|
+
.tile-LOW_POSITIVE::before {
|
|
144
224
|
color: var(--color-green-50);
|
|
225
|
+
opacity: 0.6;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.tile-LOW_POSITIVE:hover::before {
|
|
229
|
+
opacity: 0.5;
|
|
145
230
|
}
|
|
146
231
|
|
|
147
|
-
.
|
|
232
|
+
.tile-POSITIVE::before {
|
|
233
|
+
color: var(--color-green-50);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.tile-HIGH_POSITIVE::before {
|
|
148
237
|
color: var(--color-green-100);
|
|
149
238
|
}
|
|
150
239
|
|
|
@@ -166,7 +255,7 @@
|
|
|
166
255
|
}
|
|
167
256
|
|
|
168
257
|
/** tooltip */
|
|
169
|
-
.
|
|
258
|
+
.tileContentTooltipAnchor {
|
|
170
259
|
width: 100%;
|
|
171
260
|
height: 100%;
|
|
172
261
|
}
|
|
@@ -185,17 +274,16 @@
|
|
|
185
274
|
pointer-events: none;
|
|
186
275
|
}
|
|
187
276
|
|
|
188
|
-
|
|
189
|
-
div[role="presentation"]:has(.tooltip) {
|
|
190
|
-
pointer-events: none;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
.leafTooltipArrow svg {
|
|
277
|
+
.tileTooltipArrow svg {
|
|
195
278
|
display: block;
|
|
196
279
|
fill: var(--color-background) !important;
|
|
197
280
|
}
|
|
198
281
|
|
|
199
|
-
.
|
|
200
|
-
font-size: var(--size-
|
|
282
|
+
.tileTooltipContentTitle {
|
|
283
|
+
font-size: var(--size-small);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* prevent tooltip portal wrapper from capturing events */
|
|
287
|
+
div[role="presentation"]:has(.tooltip) {
|
|
288
|
+
pointer-events: none;
|
|
201
289
|
}
|
|
@@ -2,22 +2,56 @@ import React from 'react';
|
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
4
|
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import { createJobs } from '@bundle-stats/utils';
|
|
6
|
+
import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
/* eslint-disable import/no-relative-packages */
|
|
9
|
+
import baselineData from '../../../../../fixtures/webpack-stats.baseline.json';
|
|
10
|
+
import currentData from '../../../../../fixtures/webpack-stats.current.json';
|
|
7
11
|
import moduleItemsFixture from '../../../../../fixtures/module-items.json';
|
|
8
|
-
|
|
12
|
+
/* eslint-enable import/no-relative-packages */
|
|
13
|
+
import { MetricsTreemap, getTreemapNodes, getTreemapNodesGroupedByPath } from '.';
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
const meta: Meta<typeof MetricsTreemap> = {
|
|
11
16
|
title: 'Components/MetricsTreemap',
|
|
12
17
|
component: MetricsTreemap,
|
|
13
|
-
} as Meta;
|
|
14
|
-
|
|
15
|
-
export const Default: StoryObj = {
|
|
16
|
-
render: (props: React.ComponentProps<typeof MetricsTreemap>) => (
|
|
17
|
-
<MetricsTreemap style={{ maxWidth: 'var(--max-width)' }} {...props} />
|
|
18
|
-
),
|
|
19
18
|
args: {
|
|
20
|
-
items: moduleItemsFixture,
|
|
21
19
|
onItemClick: action('CLICK'),
|
|
22
20
|
},
|
|
23
21
|
};
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
const MULTIPLE_JOBS = createJobs([{ webpack: currentData }, { webpack: baselineData }]);
|
|
28
|
+
|
|
29
|
+
export const Assets: Story = {
|
|
30
|
+
render: (props) => <MetricsTreemap style={{ maxWidth: 'var(--max-width)' }} {...props} />,
|
|
31
|
+
args: {
|
|
32
|
+
treeNodes: getTreemapNodes(webpack.compareBySection.assets(MULTIPLE_JOBS)),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const AssetsNested: Story = {
|
|
37
|
+
render: (props) => <MetricsTreemap style={{ maxWidth: 'var(--max-width)' }} {...props} />,
|
|
38
|
+
args: {
|
|
39
|
+
treeNodes: getTreemapNodesGroupedByPath(webpack.compareBySection.assets(MULTIPLE_JOBS)),
|
|
40
|
+
nested: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Modules: Story = {
|
|
45
|
+
render: (props) => <MetricsTreemap style={{ maxWidth: 'var(--max-width)' }} {...props} />,
|
|
46
|
+
args: {
|
|
47
|
+
treeNodes: getTreemapNodes(moduleItemsFixture),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const ModulesNested: Story = {
|
|
52
|
+
render: (props) => <MetricsTreemap style={{ maxWidth: 'var(--max-width)' }} {...props} />,
|
|
53
|
+
args: {
|
|
54
|
+
treeNodes: getTreemapNodesGroupedByPath(moduleItemsFixture),
|
|
55
|
+
nested: true,
|
|
56
|
+
},
|
|
57
|
+
};
|