@rsdoctor/components 1.3.13-beta.0 → 1.3.13

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.
@@ -2,19 +2,21 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import react, { memo, useCallback, useEffect, useMemo, useState } from "react";
3
3
  import core from "echarts-for-react/esm/core";
4
4
  import { TreemapChart } from "echarts/charts";
5
- import { TooltipComponent } from "echarts/components";
5
+ import { TitleComponent, TooltipComponent } from "echarts/components";
6
6
  import { CanvasRenderer } from "echarts/renderers";
7
- import { BUNDLE_ANALYZER_COLORS, COLOR_GROUPS } from "./constants.mjs";
8
7
  import { Checkbox, Input, Radio } from "antd";
9
8
  import { FullscreenExitOutlined, FullscreenOutlined, LeftOutlined, RightOutlined, SearchOutlined } from "@ant-design/icons";
10
9
  import { formatSize } from "../../utils/index.mjs";
11
10
  import { SDK } from "@rsdoctor/types";
12
11
  import { ServerAPIProvider } from "../Manifest/index.mjs";
12
+ import { ModuleAnalyzeComponent } from "../../pages/ModuleAnalyze/index.mjs";
13
13
  import treemap_module from "./treemap.module.mjs";
14
- import * as __WEBPACK_EXTERNAL_MODULE_echarts_core_d2845954__ from "echarts/core";
15
- __WEBPACK_EXTERNAL_MODULE_echarts_core_d2845954__.use([
14
+ import { TREE_COLORS } from "./constants.mjs";
15
+ import * as __rspack_external_echarts_core_d2845954 from "echarts/core";
16
+ __rspack_external_echarts_core_d2845954.use([
16
17
  TreemapChart,
17
18
  TooltipComponent,
19
+ TitleComponent,
18
20
  CanvasRenderer
19
21
  ]);
20
22
  function hashString(str) {
@@ -22,33 +24,56 @@ function hashString(str) {
22
24
  for(let i = 0; i < str.length; i++)hash = (hash << 5) + hash + str.charCodeAt(i);
23
25
  return hash >>> 0;
24
26
  }
27
+ function blendWithWhite(hex, ratio) {
28
+ const r = parseInt(hex.slice(1, 3), 16);
29
+ const g = parseInt(hex.slice(3, 5), 16);
30
+ const b = parseInt(hex.slice(5, 7), 16);
31
+ const blendedR = Math.round(r * ratio + 255 * (1 - ratio));
32
+ const blendedG = Math.round(g * ratio + 255 * (1 - ratio));
33
+ const blendedB = Math.round(b * ratio + 255 * (1 - ratio));
34
+ return `#${blendedR.toString(16).padStart(2, '0')}${blendedG.toString(16).padStart(2, '0')}${blendedB.toString(16).padStart(2, '0')}`;
35
+ }
36
+ function getLuminance(hex) {
37
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
38
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
39
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
40
+ const [rs, gs, bs] = [
41
+ r,
42
+ g,
43
+ b
44
+ ].map((val)=>val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4));
45
+ return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
46
+ }
47
+ function isDarkColor(hex) {
48
+ return getLuminance(hex) < 0.4;
49
+ }
25
50
  function getLevelOption() {
26
51
  return [
27
52
  {
28
53
  itemStyle: {
29
- gapWidth: 3,
30
- borderColor: '#eee'
31
- },
32
- upperLabel: {
33
- show: false
34
- }
35
- },
36
- {
37
- itemStyle: {
38
- borderWidth: 5,
54
+ borderWidth: 0,
39
55
  gapWidth: 2
40
56
  }
41
57
  },
42
58
  {
43
- colorSaturation: [
44
- 0.3,
45
- 0.9
46
- ],
47
59
  itemStyle: {
60
+ borderColorAlpha: [
61
+ 1,
62
+ 0.3
63
+ ],
48
64
  borderWidth: 5,
49
- gapWidth: 2,
50
- borderColorSaturation: 0.6,
51
- borderColor: '#eee'
65
+ gapWidth: 1
66
+ },
67
+ upperLabel: {
68
+ show: true,
69
+ color: '#ffffff',
70
+ fontSize: 14,
71
+ height: 30
72
+ },
73
+ emphasis: {
74
+ itemStyle: {
75
+ borderColor: '#ccc'
76
+ }
52
77
  }
53
78
  }
54
79
  ];
@@ -66,10 +91,9 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
66
91
  ]);
67
92
  useEffect(()=>{
68
93
  if (!treeData) return;
69
- function convert(node, colorGroup, level = 0) {
70
- const groupColors = BUNDLE_ANALYZER_COLORS[colorGroup];
71
- const _level = level;
72
- const children = node.children?.map((c)=>convert(c, colorGroup, _level + 1));
94
+ function convert(node, index = 0, level = 0, parentColor, siblingIndex = 0, siblingCount = 1) {
95
+ const baseColor = parentColor || TREE_COLORS[index % TREE_COLORS.length];
96
+ const children = node.children?.map((c, childIndex)=>convert(c, index, level + 1, baseColor, childIndex, node.children?.length || 0));
73
97
  let val = 0;
74
98
  if ('stat' === sizeType) val = node.sourceSize || 0;
75
99
  else if ('parsed' === sizeType) val = node.bundledSize || 0;
@@ -78,21 +102,43 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
78
102
  if (!val && node.value) val = node.value;
79
103
  const nodeId = node.path ? hashString(node.path) : hashString(node.name || '');
80
104
  const isHighlighted = highlightNodeId === nodeId;
81
- console.log(level % groupColors.length - 1, groupColors, colorGroup);
105
+ const baseColorRatio = 0 === level ? 1 : Math.max(0.2, 1 - 0.2 * level);
106
+ const baseBorderRatio = 0 === level ? 1 : Math.max(0.3, 1 - 0.25 * level);
107
+ const siblingGradientRange = 0.15;
108
+ const siblingRatio = siblingCount > 1 ? 1 - siblingIndex / (siblingCount - 1) * siblingGradientRange : 1;
109
+ const colorRatio = baseColorRatio * siblingRatio;
110
+ const borderRatio = baseBorderRatio * siblingRatio;
111
+ const nodeColor = isHighlighted ? '#fff5f5' : 0 === level ? blendWithWhite(baseColor, 0.8) : blendWithWhite(baseColor, colorRatio);
112
+ const nodeBorderColor = isHighlighted ? '#ff4d4f' : 0 === level ? baseColor : blendWithWhite(baseColor, borderRatio);
113
+ const isDark = isDarkColor(nodeColor);
114
+ const textColor = isDark ? '#ffffff' : '#000000';
115
+ const textBorderColor = isDark ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.1)';
82
116
  const result = {
83
117
  id: nodeId,
84
118
  name: node.name,
85
119
  value: val,
86
120
  path: node.path || node.name,
87
- sourceSize: node.sourceSize ?? ('stat' === sizeType ? val : 0),
88
- bundledSize: node.bundledSize ?? ('parsed' === sizeType ? val : 0),
89
- gzipSize: node.gzipSize ?? ('gzip' === sizeType ? val : 0),
121
+ sourceSize: node.sourceSize ?? ('stat' === sizeType ? val : void 0),
122
+ bundledSize: node.bundledSize ?? ('parsed' === sizeType ? val : void 0),
123
+ gzipSize: node.gzipSize ?? ('gzip' === sizeType ? val : void 0),
124
+ moduleId: node.id,
90
125
  itemStyle: {
91
126
  borderWidth: isHighlighted ? 4 : 1,
92
- gapWidth: 2,
93
- color: isHighlighted ? '#fff5f5' : groupColors[level % groupColors.length - 1],
94
- borderColor: isHighlighted ? '#ff4d4f' : groupColors[level % groupColors.length - 1],
95
- borderColorSaturation: isHighlighted ? 1 : 0.5
127
+ color: nodeColor,
128
+ borderColor: nodeBorderColor,
129
+ ...0 === level && {
130
+ gapWidth: 2
131
+ }
132
+ },
133
+ label: {
134
+ show: true,
135
+ color: textColor,
136
+ textBorderColor: textBorderColor,
137
+ textBorderWidth: 1
138
+ },
139
+ upperLabel: 0 === level ? void 0 : {
140
+ show: true,
141
+ color: textColor
96
142
  }
97
143
  };
98
144
  if (children && children.length > 0) result.children = children;
@@ -105,12 +151,10 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
105
151
  };
106
152
  return result;
107
153
  }
108
- const data = treeData.map((item, index)=>{
109
- const group = COLOR_GROUPS[index % COLOR_GROUPS.length];
110
- return convert(item, group, 1);
111
- }).filter((item)=>item.value > 0 || item.children && item.children.length > 0);
154
+ const data = treeData.map((item, index)=>convert(item, index, 0, void 0, index, treeData.length)).filter((item)=>('number' == typeof item.value ? item.value > 0 : false) || item.children && item.children.length > 0);
112
155
  chartDataRef.current = data;
113
156
  setOption({
157
+ color: TREE_COLORS,
114
158
  title: {
115
159
  text: 'Rsdoctor TreeMap',
116
160
  left: 'center',
@@ -132,7 +176,7 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
132
176
  confine: true,
133
177
  extraCssText: 'max-width: 450px; word-wrap: break-word;',
134
178
  position: function(pos, _params, _dom, _rect, size) {
135
- var obj = {
179
+ const obj = {
136
180
  top: pos[1] + 10
137
181
  };
138
182
  if (pos[0] < size.viewSize[0] / 2) obj.left = pos[0] + 10;
@@ -141,17 +185,16 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
141
185
  },
142
186
  formatter: function(info) {
143
187
  const node = info.data || {};
144
- const name = node.name;
145
- let path = node.path || name;
188
+ let path = 'string' == typeof node.path ? node.path : 'string' == typeof node.name ? node.name : String(node.name ?? '');
146
189
  if (rootPath && path) {
147
190
  const normalizedRoot = rootPath.replace(/\\/g, '/').replace(/\/$/, '');
148
191
  const normalizedPath = path.replace(/\\/g, '/');
149
192
  if (normalizedPath.startsWith(normalizedRoot + '/')) path = normalizedPath.slice(normalizedRoot.length + 1);
150
193
  else if (normalizedPath === normalizedRoot) path = '';
151
194
  }
152
- const sourceSize = node.sourceSize || node.value;
153
- const bundledSize = node.bundledSize;
154
- const gzipSize = node.gzipSize;
195
+ const sourceSize = 'number' == typeof node.sourceSize && node.sourceSize > 0 ? node.sourceSize : 'number' == typeof node.value && node.value > 0 && 'stat' === sizeType ? node.value : void 0;
196
+ const bundledSize = 'number' == typeof node.bundledSize && node.bundledSize > 0 ? node.bundledSize : void 0;
197
+ const gzipSize = 'number' == typeof node.gzipSize && node.gzipSize > 0 ? node.gzipSize : void 0;
155
198
  function makeRow(label, value, color) {
156
199
  return `<div class="${treemap_module["tooltip-row"]}">
157
200
  <span class="${treemap_module["tooltip-label"]}" style="color: ${color};">${label}</span>
@@ -159,12 +202,12 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
159
202
  </div>`;
160
203
  }
161
204
  const rows = [];
162
- if (void 0 !== sourceSize) rows.push(makeRow('Stat size', formatSize(sourceSize), '#52c41a'));
163
- if (void 0 !== bundledSize) rows.push(makeRow('Parsed size', formatSize(bundledSize), '#fadb14'));
164
- if (void 0 !== gzipSize) rows.push(makeRow('Gzipped size', formatSize(gzipSize), '#1677ff'));
205
+ if (void 0 !== sourceSize && sourceSize > 0) rows.push(makeRow('Stat size', formatSize(sourceSize), '#52c41a'));
206
+ if (void 0 !== bundledSize && bundledSize > 0) rows.push(makeRow('Parsed size', formatSize(bundledSize), '#d96420'));
207
+ if (void 0 !== gzipSize && gzipSize > 0) rows.push(makeRow('Gzipped size', formatSize(gzipSize), '#1677ff'));
165
208
  return `
166
209
  <div style="font-family: sans-serif; font-size: 12px; line-height: 1.5;">
167
- <div style="margin-bottom: 6px; max-width: 400px; word-wrap: break-word; overflow-wrap: break-word; word-break: break-all; white-space: normal; color: rgba(0, 0, 0, 0.8);">${__WEBPACK_EXTERNAL_MODULE_echarts_core_d2845954__.format.encodeHTML(path)}</div>
210
+ <div style="margin-bottom: 6px; max-width: 400px; word-wrap: break-word; overflow-wrap: break-word; word-break: break-all; white-space: normal; color: rgba(0, 0, 0, 0.8);">${__rspack_external_echarts_core_d2845954.format.encodeHTML(path)}</div>
168
211
  ${rows.join('')}
169
212
  </div>
170
213
  `;
@@ -177,11 +220,9 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
177
220
  show: true,
178
221
  formatter: '{b}',
179
222
  fontSize: 12,
180
- color: '#000',
181
223
  position: 'inside',
182
224
  fontWeight: 'normal',
183
- textBorderColor: '#fff',
184
- textBorderWidth: 2,
225
+ textBorderWidth: 1,
185
226
  padding: [
186
227
  4,
187
228
  8,
@@ -192,7 +233,6 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
192
233
  upperLabel: {
193
234
  show: true,
194
235
  height: 30,
195
- color: '#000',
196
236
  fontSize: 12,
197
237
  fontWeight: 'normal',
198
238
  padding: [
@@ -202,9 +242,6 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
202
242
  4
203
243
  ]
204
244
  },
205
- itemStyle: {
206
- borderColor: '#fff'
207
- },
208
245
  levels: getLevelOption(),
209
246
  data: data,
210
247
  breadcrumb: {
@@ -239,7 +276,11 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
239
276
  top: 40,
240
277
  bottom: 30,
241
278
  left: 0,
242
- right: 0
279
+ right: 0,
280
+ zoomLimit: {
281
+ min: 0.5,
282
+ max: 5
283
+ }
243
284
  }
244
285
  ]
245
286
  });
@@ -255,12 +296,13 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
255
296
  if (chartInstance) {
256
297
  const findNodeInfo = (data, targetId, path = [])=>{
257
298
  for (const item of data){
299
+ const itemName = 'string' == typeof item.name ? item.name : String(item.name ?? '');
258
300
  const currentPath = [
259
301
  ...path,
260
- item.name
302
+ itemName
261
303
  ];
262
304
  if (item.id === targetId) return {
263
- name: item.name,
305
+ name: itemName,
264
306
  path: currentPath
265
307
  };
266
308
  if (item.children) {
@@ -273,13 +315,16 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
273
315
  setTimeout(()=>{
274
316
  const nodeInfo = findNodeInfo(chartDataRef.current, centerNodeId);
275
317
  if (!nodeInfo) return;
318
+ const nodeName = nodeInfo.name;
276
319
  try {
277
320
  chartInstance.dispatchAction({
278
321
  type: 'highlight',
279
322
  seriesIndex: 0,
280
- name: nodeInfo.name
323
+ name: nodeName
281
324
  });
282
- } catch (e) {}
325
+ } catch (e) {
326
+ console.error('Failed to highlight node with name:', nodeName, e);
327
+ }
283
328
  const zoomStrategies = [
284
329
  ()=>chartInstance.dispatchAction({
285
330
  type: 'treemapZoomToNode',
@@ -289,7 +334,7 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
289
334
  ()=>chartInstance.dispatchAction({
290
335
  type: 'treemapZoomToNode',
291
336
  seriesIndex: 0,
292
- name: nodeInfo.name
337
+ name: nodeName
293
338
  }),
294
339
  ()=>chartInstance.dispatchAction({
295
340
  type: 'treemapZoomToNode',
@@ -316,21 +361,41 @@ const TreeMapInner = /*#__PURE__*/ memo(({ treeData, sizeType, style, onChartCli
316
361
  centerNodeId,
317
362
  option
318
363
  ]);
364
+ useEffect(()=>{
365
+ if (!chartRef.current || !option) return;
366
+ const chartInstance = chartRef.current.getEchartsInstance();
367
+ if (!chartInstance) return;
368
+ const handleDblClick = ()=>{
369
+ try {
370
+ chartInstance.dispatchAction({
371
+ type: 'treemapRootToNode',
372
+ seriesIndex: 0
373
+ });
374
+ } catch (e) {}
375
+ };
376
+ chartInstance.on('dblclick', handleDblClick);
377
+ return ()=>{
378
+ chartInstance.off('dblclick', handleDblClick);
379
+ };
380
+ }, [
381
+ option
382
+ ]);
319
383
  return option ? /*#__PURE__*/ jsx("div", {
320
384
  className: treemap_module["chart-container"],
321
385
  style: style,
322
386
  children: /*#__PURE__*/ jsx(core, {
323
387
  ref: chartRef,
324
388
  option: option,
325
- echarts: __WEBPACK_EXTERNAL_MODULE_echarts_core_d2845954__,
389
+ echarts: __rspack_external_echarts_core_d2845954,
326
390
  onEvents: {
327
391
  click: (params)=>{
328
392
  if (chartRef.current) {
329
393
  const instance = chartRef.current.getEchartsInstance();
330
- if (instance && params?.data?.id) instance.dispatchAction({
394
+ const data = params?.data;
395
+ if (instance && data?.id !== void 0) instance.dispatchAction({
331
396
  type: 'treemapZoomToNode',
332
397
  seriesIndex: 0,
333
- targetNodeId: String(params.data.id)
398
+ targetNodeId: String(data.id)
334
399
  });
335
400
  }
336
401
  onChartClick?.(params);
@@ -367,10 +432,46 @@ const AssetTreemapWithFilterInner = ({ treeData, onChartClick, bundledSize = tru
367
432
  const [isFullscreen, setIsFullscreen] = useState(false);
368
433
  const [highlightNodeId, setHighlightNodeId] = useState();
369
434
  const [centerNodeId, setCenterNodeId] = useState();
435
+ const [moduleId, setModuleId] = useState('');
436
+ const [showAnalyze, setShowAnalyze] = useState(false);
437
+ const [chunkSearchQuery, setChunkSearchQuery] = useState('');
370
438
  const chartRef = react.useRef(null);
371
439
  const containerRef = react.useRef(null);
440
+ const handleChartClick = useCallback((params)=>{
441
+ onChartClick?.(params);
442
+ const data = params.data;
443
+ const moduleId = data?.moduleId;
444
+ if (void 0 !== moduleId) {
445
+ setModuleId(moduleId);
446
+ setShowAnalyze(true);
447
+ }
448
+ }, [
449
+ onChartClick
450
+ ]);
372
451
  const enterFullscreen = useCallback(()=>{
373
- if (containerRef.current) containerRef.current.requestFullscreen().then(()=>setIsFullscreen(true)).catch((err)=>console.error('Failed to enter fullscreen:', err));
452
+ if (containerRef.current) {
453
+ const el = containerRef.current;
454
+ if (el.requestFullscreen) el.requestFullscreen().then(()=>setIsFullscreen(true)).catch((err)=>console.error('Failed to enter fullscreen:', err));
455
+ else if (el.webkitRequestFullscreen) try {
456
+ el.webkitRequestFullscreen();
457
+ setIsFullscreen(true);
458
+ } catch (err) {
459
+ console.error('Failed to enter fullscreen (webkit):', err);
460
+ }
461
+ else if (el.mozRequestFullScreen) try {
462
+ el.mozRequestFullScreen();
463
+ setIsFullscreen(true);
464
+ } catch (err) {
465
+ console.error('Failed to enter fullscreen (moz):', err);
466
+ }
467
+ else if (el.msRequestFullscreen) try {
468
+ el.msRequestFullscreen();
469
+ setIsFullscreen(true);
470
+ } catch (err) {
471
+ console.error('Failed to enter fullscreen (ms):', err);
472
+ }
473
+ else console.error('Fullscreen API is not supported in this browser.');
474
+ }
374
475
  }, []);
375
476
  const exitFullscreen = useCallback(()=>{
376
477
  document.exitFullscreen().then(()=>setIsFullscreen(false)).catch((err)=>console.error('Failed to exit fullscreen:', err));
@@ -392,6 +493,18 @@ const AssetTreemapWithFilterInner = ({ treeData, onChartClick, bundledSize = tru
392
493
  document.removeEventListener('fullscreenchange', handleFullscreenChange);
393
494
  };
394
495
  }, []);
496
+ const filteredTreeData = useMemo(()=>{
497
+ let filtered = treeData.filter((item)=>checkedAssets.includes(item.name));
498
+ if (chunkSearchQuery.trim()) {
499
+ const searchLower = chunkSearchQuery.toLowerCase();
500
+ filtered = filtered.filter((item)=>item.name.toLowerCase().includes(searchLower));
501
+ }
502
+ return filtered;
503
+ }, [
504
+ treeData,
505
+ checkedAssets,
506
+ chunkSearchQuery
507
+ ]);
395
508
  const searchResults = useMemo(()=>{
396
509
  if (!searchQuery.trim()) return [];
397
510
  const regex = new RegExp(searchQuery, 'i');
@@ -406,19 +519,12 @@ const AssetTreemapWithFilterInner = ({ treeData, onChartClick, bundledSize = tru
406
519
  }
407
520
  if (node.children) node.children.forEach(collectMatchingPaths);
408
521
  };
409
- treeData.forEach(collectMatchingPaths);
522
+ filteredTreeData.forEach(collectMatchingPaths);
410
523
  return results;
411
524
  }, [
412
- treeData,
525
+ filteredTreeData,
413
526
  searchQuery
414
527
  ]);
415
- const filteredTreeData = useMemo(()=>{
416
- let filtered = treeData.filter((item)=>checkedAssets.includes(item.name));
417
- return filtered;
418
- }, [
419
- treeData,
420
- checkedAssets
421
- ]);
422
528
  const handleSearchResultClick = useCallback((nodeId)=>{
423
529
  setHighlightNodeId(nodeId);
424
530
  setCenterNodeId(nodeId);
@@ -510,6 +616,60 @@ const AssetTreemapWithFilterInner = ({ treeData, onChartClick, bundledSize = tru
510
616
  })
511
617
  ]
512
618
  }),
619
+ /*#__PURE__*/ jsxs("div", {
620
+ children: [
621
+ /*#__PURE__*/ jsx("h4", {
622
+ children: "Show chunks"
623
+ }),
624
+ /*#__PURE__*/ jsx(Input, {
625
+ placeholder: "Search chunks",
626
+ value: chunkSearchQuery,
627
+ onChange: (e)=>setChunkSearchQuery(e.target.value),
628
+ suffix: /*#__PURE__*/ jsx(SearchOutlined, {
629
+ style: {
630
+ color: '#ccc'
631
+ }
632
+ }),
633
+ allowClear: true,
634
+ size: "small",
635
+ style: {
636
+ marginBottom: 8
637
+ }
638
+ }),
639
+ /*#__PURE__*/ jsx(Checkbox, {
640
+ indeterminate: checkedAssets.length > 0 && checkedAssets.length < assetNames.length,
641
+ checked: checkedAssets.length === assetNames.length,
642
+ onChange: (e)=>setCheckedAssets(e.target.checked ? assetNames : []),
643
+ className: treemap_module["all-none-checkbox"],
644
+ children: "All"
645
+ }),
646
+ /*#__PURE__*/ jsx("div", {
647
+ className: treemap_module["chunk-list"],
648
+ children: assetNames.filter((name)=>name.toLowerCase().includes(chunkSearchQuery.toLowerCase())).map((name)=>/*#__PURE__*/ jsxs("div", {
649
+ className: treemap_module["chunk-item"],
650
+ children: [
651
+ /*#__PURE__*/ jsx(Checkbox, {
652
+ checked: checkedAssets.includes(name),
653
+ onChange: (e)=>{
654
+ e.target.checked ? setCheckedAssets([
655
+ ...checkedAssets,
656
+ name
657
+ ]) : setCheckedAssets(checkedAssets.filter((a)=>a !== name));
658
+ },
659
+ children: /*#__PURE__*/ jsx("span", {
660
+ title: name,
661
+ children: name
662
+ })
663
+ }),
664
+ /*#__PURE__*/ jsx("span", {
665
+ className: treemap_module["size-tag"],
666
+ children: formatSize(getChunkSize(name, 'value'))
667
+ })
668
+ ]
669
+ }, name))
670
+ })
671
+ ]
672
+ }),
513
673
  /*#__PURE__*/ jsxs("div", {
514
674
  children: [
515
675
  /*#__PURE__*/ jsx("h4", {
@@ -566,65 +726,39 @@ const AssetTreemapWithFilterInner = ({ treeData, onChartClick, bundledSize = tru
566
726
  ]
567
727
  })
568
728
  ]
569
- }),
570
- /*#__PURE__*/ jsxs("div", {
571
- children: [
572
- /*#__PURE__*/ jsx("h4", {
573
- children: "Show chunks"
574
- }),
575
- /*#__PURE__*/ jsx(Checkbox, {
576
- indeterminate: checkedAssets.length > 0 && checkedAssets.length < assetNames.length,
577
- checked: checkedAssets.length === assetNames.length,
578
- onChange: (e)=>setCheckedAssets(e.target.checked ? assetNames : []),
579
- className: treemap_module["all-none-checkbox"],
580
- children: "All"
581
- }),
582
- /*#__PURE__*/ jsx("div", {
583
- className: treemap_module["chunk-list"],
584
- children: assetNames.map((name)=>/*#__PURE__*/ jsxs("div", {
585
- className: treemap_module["chunk-item"],
586
- children: [
587
- /*#__PURE__*/ jsx(Checkbox, {
588
- checked: checkedAssets.includes(name),
589
- onChange: (e)=>{
590
- e.target.checked ? setCheckedAssets([
591
- ...checkedAssets,
592
- name
593
- ]) : setCheckedAssets(checkedAssets.filter((a)=>a !== name));
594
- },
595
- children: /*#__PURE__*/ jsx("span", {
596
- title: name,
597
- children: name
598
- })
599
- }),
600
- /*#__PURE__*/ jsx("span", {
601
- className: treemap_module["size-tag"],
602
- children: formatSize(getChunkSize(name, 'value'))
603
- })
604
- ]
605
- }, name))
606
- })
607
- ]
608
729
  })
609
730
  ]
610
731
  })
611
732
  ]
612
733
  }),
613
- /*#__PURE__*/ jsx("div", {
734
+ /*#__PURE__*/ jsxs("div", {
614
735
  className: treemap_module["chart-wrapper"],
615
- children: /*#__PURE__*/ jsx(TreeMap, {
616
- ref: chartRef,
617
- treeData: filteredTreeData,
618
- sizeType: sizeType,
619
- onChartClick: onChartClick,
620
- highlightNodeId: highlightNodeId,
621
- centerNodeId: centerNodeId,
622
- rootPath: rootPath,
623
- style: {
624
- width: '100%',
625
- height: '100%'
626
- }
627
- })
736
+ children: [
737
+ /*#__PURE__*/ jsx(TreeMap, {
738
+ ref: chartRef,
739
+ treeData: filteredTreeData,
740
+ sizeType: sizeType,
741
+ onChartClick: handleChartClick,
742
+ highlightNodeId: highlightNodeId,
743
+ centerNodeId: centerNodeId,
744
+ rootPath: rootPath,
745
+ style: {
746
+ width: '100%',
747
+ height: '100%'
748
+ }
749
+ }),
750
+ moduleId ? /*#__PURE__*/ jsx(ServerAPIProvider, {
751
+ api: SDK.ServerAPI.API.GetAllModuleGraph,
752
+ body: {},
753
+ children: (modules)=>/*#__PURE__*/ jsx(ModuleAnalyzeComponent, {
754
+ cwd: rootPath,
755
+ moduleId: moduleId,
756
+ modules: modules,
757
+ show: showAnalyze,
758
+ setShow: setShowAnalyze
759
+ })
760
+ }) : null
761
+ ]
628
762
  })
629
763
  ]
630
764
  });