@rsdoctor/components 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/components/Alert/change.d.ts +2 -2
  2. package/dist/components/Alert/file-relation.d.ts +1 -1
  3. package/dist/components/Alert/index.d.ts +1 -1
  4. package/dist/components/Alert/link.d.ts +1 -1
  5. package/dist/components/Alert/package-relation.d.ts +9 -9
  6. package/dist/components/Alert/package-relation.js +188 -94
  7. package/dist/components/Alert/types.d.ts +15 -15
  8. package/dist/components/Alert/view.d.ts +1 -1
  9. package/dist/components/Alerts/bundle.d.ts +4 -4
  10. package/dist/components/Alerts/common.d.ts +8 -8
  11. package/dist/components/Alerts/common.js +46 -23
  12. package/dist/components/Alerts/compile.d.ts +4 -4
  13. package/dist/components/Alerts/index.d.ts +1 -1
  14. package/dist/components/Alerts/overlay.d.ts +12 -12
  15. package/dist/components/Badge/index.d.ts +13 -13
  16. package/dist/components/Card/diff.d.ts +11 -11
  17. package/dist/components/Card/index.d.ts +4 -4
  18. package/dist/components/Card/size.d.ts +16 -16
  19. package/dist/components/Card/statistic.d.ts +7 -7
  20. package/dist/components/Charts/TimelineCharts/index.d.ts +5 -5
  21. package/dist/components/Charts/TimelineCharts/index.js +31 -9
  22. package/dist/components/Charts/bootstrap.d.ts +1 -1
  23. package/dist/components/Charts/common.d.ts +4 -4
  24. package/dist/components/Charts/constants.d.ts +2 -0
  25. package/dist/components/Charts/constants.js +46 -0
  26. package/dist/components/Charts/done.d.ts +1 -1
  27. package/dist/components/Charts/index.d.ts +4 -4
  28. package/dist/components/Charts/loader.d.ts +1 -1
  29. package/dist/components/Charts/loader.js +55 -26
  30. package/dist/components/Charts/minify.d.ts +1 -1
  31. package/dist/components/Charts/types.d.ts +45 -45
  32. package/dist/components/Charts/utils.d.ts +5 -4
  33. package/dist/components/Charts/utils.js +32 -13
  34. package/dist/components/CodeViewer/config.d.ts +1 -1
  35. package/dist/components/CodeViewer/diff.d.ts +6 -6
  36. package/dist/components/CodeViewer/hightlight.d.ts +5 -5
  37. package/dist/components/CodeViewer/index.d.ts +1 -1
  38. package/dist/components/CodeViewer/viewer.d.ts +6 -6
  39. package/dist/components/Configuration/builder.d.ts +6 -6
  40. package/dist/components/Configuration/index.d.ts +1 -1
  41. package/dist/components/FileTree/index.d.ts +1 -1
  42. package/dist/components/Form/keyword.d.ts +10 -10
  43. package/dist/components/Keyword/index.d.ts +3 -3
  44. package/dist/components/Layout/builder-select.d.ts +1 -1
  45. package/dist/components/Layout/constants.d.ts +1 -1
  46. package/dist/components/Layout/header.d.ts +1 -1
  47. package/dist/components/Layout/index.d.ts +2 -2
  48. package/dist/components/Layout/menus.d.ts +4 -4
  49. package/dist/components/Layout/menus.js +42 -14
  50. package/dist/components/Layout/progress.d.ts +3 -3
  51. package/dist/components/Loader/Analysis/files.d.ts +5 -5
  52. package/dist/components/Loader/Analysis/index.d.ts +6 -6
  53. package/dist/components/Loader/executions.d.ts +5 -9
  54. package/dist/components/Manifest/api.d.ts +14 -21
  55. package/dist/components/Manifest/data.d.ts +1 -1
  56. package/dist/components/Manifest/index.d.ts +1 -1
  57. package/dist/components/Opener/code.d.ts +17 -25
  58. package/dist/components/Opener/index.d.ts +1 -1
  59. package/dist/components/Opener/vscode.d.ts +7 -12
  60. package/dist/components/Overall/NumberButton.d.ts +6 -12
  61. package/dist/components/Overall/bundle.d.ts +3 -3
  62. package/dist/components/Overall/compile.d.ts +2 -2
  63. package/dist/components/Overall/index.d.ts +1 -1
  64. package/dist/components/Overall/project.d.ts +5 -5
  65. package/dist/components/Plugins/webpack.d.ts +9 -9
  66. package/dist/components/Resolver/analysis.d.ts +7 -7
  67. package/dist/components/Select/index.d.ts +9 -9
  68. package/dist/components/Status/failed.d.ts +4 -4
  69. package/dist/components/Status/index.d.ts +1 -1
  70. package/dist/components/TextDrawer/duplicate.d.ts +7 -7
  71. package/dist/components/TextDrawer/index.d.ts +6 -6
  72. package/dist/components/Title/index.d.ts +11 -11
  73. package/dist/components/index.d.ts +1 -1
  74. package/dist/components/worker/ecmaversion/client.d.ts +4 -4
  75. package/dist/components/worker/ecmaversion/worker.d.ts +1 -1
  76. package/dist/components/worker/jsequal/client.d.ts +6 -6
  77. package/dist/components/worker/jsequal/worker.d.ts +1 -1
  78. package/dist/config.d.ts +13 -13
  79. package/dist/constants.d.ts +30 -30
  80. package/dist/index.d.ts +1 -1
  81. package/dist/pages/BundleSize/components/asset.d.ts +15 -15
  82. package/dist/pages/BundleSize/components/cards.d.ts +4 -4
  83. package/dist/pages/BundleSize/components/editor.d.ts +3 -3
  84. package/dist/pages/BundleSize/components/index.d.ts +7 -7
  85. package/dist/pages/BundleSize/config.d.ts +3 -3
  86. package/dist/pages/BundleSize/constants.d.ts +1 -1
  87. package/dist/pages/BundleSize/index.d.ts +1 -1
  88. package/dist/pages/ModuleAnalyze/chunks.d.ts +2 -2
  89. package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +9 -9
  90. package/dist/pages/ModuleAnalyze/constants.d.ts +2 -2
  91. package/dist/pages/ModuleAnalyze/dependncy.d.ts +4 -4
  92. package/dist/pages/ModuleAnalyze/fileTree.d.ts +6 -6
  93. package/dist/pages/ModuleAnalyze/index.d.ts +4 -4
  94. package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +16 -16
  95. package/dist/pages/ModuleAnalyze/utils/index.d.ts +1 -1
  96. package/dist/pages/ModuleResolve/constants.d.ts +1 -1
  97. package/dist/pages/ModuleResolve/index.d.ts +1 -1
  98. package/dist/pages/Overall/constants.d.ts +1 -1
  99. package/dist/pages/Overall/index.d.ts +4 -4
  100. package/dist/pages/Overall/index.js +19 -8
  101. package/dist/pages/Overall/responsiveGridList.d.ts +6 -0
  102. package/dist/pages/Overall/responsiveGridList.js +28 -0
  103. package/dist/pages/Resources/RuleIndex/constants.d.ts +1 -1
  104. package/dist/pages/Resources/RuleIndex/index.d.ts +1 -1
  105. package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +1 -1
  106. package/dist/pages/WebpackLoaders/Analysis/index.d.ts +1 -1
  107. package/dist/pages/WebpackLoaders/Overall/constants.d.ts +1 -1
  108. package/dist/pages/WebpackLoaders/Overall/index.d.ts +1 -1
  109. package/dist/pages/WebpackLoaders/constants.d.ts +1 -1
  110. package/dist/pages/WebpackPlugins/constants.d.ts +1 -1
  111. package/dist/pages/WebpackPlugins/index.d.ts +1 -1
  112. package/dist/pages/index.d.ts +1 -1
  113. package/dist/utils/data/base.d.ts +21 -21
  114. package/dist/utils/data/index.d.ts +2 -2
  115. package/dist/utils/data/local.d.ts +11 -11
  116. package/dist/utils/data/remote.d.ts +7 -7
  117. package/dist/utils/file.d.ts +15 -21
  118. package/dist/utils/hooks.d.ts +4 -4
  119. package/dist/utils/i18n/cn.d.ts +1 -1
  120. package/dist/utils/i18n/en.d.ts +28 -28
  121. package/dist/utils/i18n/index.d.ts +1 -1
  122. package/dist/utils/index.d.ts +1 -1
  123. package/dist/utils/loader.d.ts +1 -1
  124. package/dist/utils/locale.d.ts +1 -1
  125. package/dist/utils/manifest.d.ts +17 -17
  126. package/dist/utils/monaco.d.ts +4 -4
  127. package/dist/utils/request.d.ts +13 -13
  128. package/dist/utils/routes.d.ts +1 -1
  129. package/dist/utils/size.d.ts +1 -1
  130. package/dist/utils/socket.d.ts +1 -1
  131. package/dist/utils/storage.d.ts +1 -1
  132. package/dist/utils/string.d.ts +1 -1
  133. package/dist/utils/time.d.ts +1 -1
  134. package/dist/utils/url.d.ts +1 -1
  135. package/dist/utils/worker/index.d.ts +1 -1
  136. package/dist/utils/worker/master.d.ts +3 -3
  137. package/dist/utils/worker/types.d.ts +3 -3
  138. package/dist/utils/worker/utils.d.ts +4 -6
  139. package/dist/utils/worker/worker.d.ts +11 -11
  140. package/package.json +4 -6
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
2
  export declare enum BadgeType {
3
- Default = "default",
4
- Success = "success",
5
- Warn = "warn",
6
- Error = "error",
3
+ Default = "default",
4
+ Success = "success",
5
+ Warn = "warn",
6
+ Error = "error"
7
7
  }
8
8
  export declare const BadgeColorMap: {
9
- default: string;
10
- success: string;
11
- warn: string;
12
- error: string;
9
+ default: string;
10
+ success: string;
11
+ warn: string;
12
+ error: string;
13
13
  };
14
14
  interface BadgeProps {
15
- label: string | number | React.ReactNode;
16
- value: string | number | React.ReactNode;
17
- type?: BadgeType | `${BadgeType}`;
18
- tooltip?: true | string | React.ReactNode;
15
+ label: string | number | React.ReactNode;
16
+ value: string | number | React.ReactNode;
17
+ type?: BadgeType | `${BadgeType}`;
18
+ tooltip?: true | string | React.ReactNode;
19
19
  }
20
20
  export declare const Badge: React.FC<BadgeProps>;
21
- export {};
21
+ export {};
@@ -1,23 +1,23 @@
1
1
  import { Client } from '@rsdoctor/types';
2
2
  import React from 'react';
3
3
  export interface DiffCardProps extends Pick<DiffCardContentProps, 'formatter'> {
4
- titles: Array<string> | [string | React.ReactNode];
5
- datas: Array<DiffCardContentProps['data']>;
6
- showPercentInTitle?: boolean;
4
+ titles: Array<string> | [string | React.ReactNode];
5
+ datas: Array<DiffCardContentProps['data']>;
6
+ showPercentInTitle?: boolean;
7
7
  }
8
8
  export interface DiffCardContentProps {
9
- data: Client.RsdoctorClientAssetsDiffItem;
10
- formatter?(v: number, target: 'baseline' | 'current'): number | string | React.ReactNode;
9
+ data: Client.RsdoctorClientAssetsDiffItem;
10
+ formatter?(v: number, target: 'baseline' | 'current'): number | string | React.ReactNode;
11
11
  }
12
12
  export interface PercentProps {
13
- percent: number;
14
- state: Client.RsdoctorClientDiffState;
15
- fontSize?: React.CSSProperties['fontSize'];
13
+ percent: number;
14
+ state: Client.RsdoctorClientDiffState;
15
+ fontSize?: React.CSSProperties['fontSize'];
16
16
  }
17
17
  export declare const SizePercent: React.FC<{
18
- baseline: number;
19
- current: number;
18
+ baseline: number;
19
+ current: number;
20
20
  } & Omit<PercentProps, 'percent' | 'state'>>;
21
21
  export declare const Percent: React.FC<PercentProps>;
22
22
  export declare const DiffCardContent: React.FC<DiffCardContentProps>;
23
- export declare const DiffCard: React.FC<DiffCardProps>;
23
+ export declare const DiffCard: React.FC<DiffCardProps>;
@@ -1,8 +1,8 @@
1
1
  import { CardProps as CProps } from 'antd';
2
2
  import React, { CSSProperties } from 'react';
3
3
  export interface CardProps extends CProps {
4
- collapsable?: boolean;
5
- dividerStyle?: CSSProperties;
6
- defaultCollapsed?: boolean;
4
+ collapsable?: boolean;
5
+ dividerStyle?: CSSProperties;
6
+ defaultCollapsed?: boolean;
7
7
  }
8
- export declare const Card: React.FC<CardProps>;
8
+ export declare const Card: React.FC<CardProps>;
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
2
  export interface SizeCardProps {
3
- files: {
4
- path: string;
5
- size: number;
6
- }[];
7
- /**
8
- * total size for origin files
9
- */
10
- total: number;
11
- /**
12
- * @default false
13
- */
14
- showProgress?: boolean;
15
- tagBgColor: string;
3
+ files: {
4
+ path: string;
5
+ size: number;
6
+ }[];
7
+ /**
8
+ * total size for origin files
9
+ */
10
+ total: number;
11
+ /**
12
+ * @default false
13
+ */
14
+ showProgress?: boolean;
15
+ tagBgColor: string;
16
16
  }
17
17
  export interface bgColorType {
18
- bgColor: string;
19
- tagBgColor: string;
18
+ bgColor: string;
19
+ tagBgColor: string;
20
20
  }
21
- export declare const SizeCard: React.FC<SizeCardProps>;
21
+ export declare const SizeCard: React.FC<SizeCardProps>;
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { StatisticProps } from 'antd';
3
3
  import './statistic.sass';
4
4
  export interface StatisticCardProps {
5
- title: string | React.ReactNode;
6
- value: string | React.ReactNode;
7
- statisticProps?: StatisticProps;
8
- boxProps?: {
9
- style?: React.CSSProperties;
10
- };
5
+ title: string | React.ReactNode;
6
+ value: string | React.ReactNode;
7
+ statisticProps?: StatisticProps;
8
+ boxProps?: {
9
+ style?: React.CSSProperties;
10
+ };
11
11
  }
12
- export declare const StatisticCard: React.FC<StatisticCardProps>;
12
+ export declare const StatisticCard: React.FC<StatisticCardProps>;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { DurationMetric, ITraceEventData } from '../types';
3
3
  export declare const TimelineCom: React.FC<{
4
- loaderData?: DurationMetric[];
5
- pluginsData?: ITraceEventData[];
6
- formatterFn: Function;
7
- chartType?: string;
8
- }>;
4
+ loaderData?: DurationMetric[];
5
+ pluginsData?: ITraceEventData[];
6
+ formatterFn: Function;
7
+ chartType?: string;
8
+ }>;
@@ -4,7 +4,7 @@ import ReactECharts from "echarts-for-react";
4
4
  import * as echarts from "echarts/core";
5
5
  import dayjs from "dayjs";
6
6
  import { groupBy } from "lodash-es";
7
- import randomColor from "randomcolor";
7
+ import { LITTLE_PALETTE_COLORS, PALETTE_COLORS } from "../constants";
8
8
  const LINE_HEIGHT = 60;
9
9
  const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "normal" }) => {
10
10
  const data = [];
@@ -21,10 +21,15 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
21
21
  loaderData.forEach(function(_loaderData, _i) {
22
22
  data.push({
23
23
  name: _loaderData.n + " total",
24
- value: [_categories.indexOf(_loaderData.n + " total"), _loaderData.s, _loaderData.e, _loaderData.e - _loaderData.s],
24
+ value: [
25
+ _categories.indexOf(_loaderData.n + " total"),
26
+ _loaderData.s,
27
+ _loaderData.e,
28
+ _loaderData.e - _loaderData.s
29
+ ],
25
30
  itemStyle: {
26
31
  normal: {
27
- color: randomColor()
32
+ color: LITTLE_PALETTE_COLORS[_i % 8]
28
33
  }
29
34
  }
30
35
  });
@@ -33,10 +38,15 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
33
38
  for (let l = 0; l < _loaderData?.c?.length; l++) {
34
39
  data.push({
35
40
  name: _loaderData.n,
36
- value: [_categories.indexOf(_loaderData.n), _loaderData.c[l].s, _loaderData.c[l].e, _loaderData.c[l].e - _loaderData.c[l].s],
41
+ value: [
42
+ _categories.indexOf(_loaderData.n),
43
+ _loaderData.c[l].s,
44
+ _loaderData.c[l].e,
45
+ _loaderData.c[l].e - _loaderData.c[l].s
46
+ ],
37
47
  itemStyle: {
38
48
  normal: {
39
- color: randomColor()
49
+ color: PALETTE_COLORS[(l + _i) % 30]
40
50
  }
41
51
  },
42
52
  ext: _loaderData.c[l].ext
@@ -56,13 +66,18 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
56
66
  return;
57
67
  const _pluginsData = groupBy(pluginsData, (e) => e.pid);
58
68
  Object.keys(_pluginsData).reverse().forEach(function(key, i) {
59
- _pluginsData[key].forEach((_plugin) => {
69
+ _pluginsData[key].forEach((_plugin, _i) => {
60
70
  data.push({
61
71
  name: String(_plugin.pid),
62
- value: [i, _plugin.args.s, _plugin.args.e, _plugin.args.e - _plugin.args.s],
72
+ value: [
73
+ i,
74
+ _plugin.args.s,
75
+ _plugin.args.e,
76
+ _plugin.args.e - _plugin.args.s
77
+ ],
63
78
  itemStyle: {
64
79
  normal: {
65
- color: randomColor()
80
+ color: PALETTE_COLORS[(_i + i) % 30]
66
81
  }
67
82
  },
68
83
  ext: _plugin
@@ -183,7 +198,14 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
183
198
  };
184
199
  setOptinsData(option);
185
200
  }, [loaderData, pluginsData]);
186
- return /* @__PURE__ */ jsx(ReactECharts, { option: optionsData, echarts, style: { width: "100%", minHeight: "400px" } });
201
+ return /* @__PURE__ */ jsx(
202
+ ReactECharts,
203
+ {
204
+ option: optionsData,
205
+ echarts,
206
+ style: { width: "100%", minHeight: "400px" }
207
+ }
208
+ );
187
209
  });
188
210
  export {
189
211
  TimelineCom
@@ -2,4 +2,4 @@ import React from 'react';
2
2
  import './loader.scss';
3
3
  import './tooltips.scss';
4
4
  import { CommonChartProps } from './common';
5
- export declare const BootstrapChartContainer: React.FC<CommonChartProps>;
5
+ export declare const BootstrapChartContainer: React.FC<CommonChartProps>;
@@ -4,10 +4,10 @@ import './loader.scss';
4
4
  import './tooltips.scss';
5
5
  import { Metric } from './types';
6
6
  export interface CommonChartProps {
7
- summary: SDK.SummaryData;
7
+ summary: SDK.SummaryData;
8
8
  }
9
9
  export declare const CommonExecutionsChart: React.FC<{
10
- plugins: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
11
- defaultDatas?: Metric[];
10
+ plugins: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
11
+ defaultDatas?: Metric[];
12
12
  }>;
13
- export declare const CommonExecutionEmptyTips: React.FC;
13
+ export declare const CommonExecutionEmptyTips: React.FC;
@@ -0,0 +1,2 @@
1
+ export declare const LITTLE_PALETTE_COLORS: string[];
2
+ export declare const PALETTE_COLORS: string[];
@@ -0,0 +1,46 @@
1
+ const LITTLE_PALETTE_COLORS = [
2
+ "#a8071a",
3
+ "#ad6800",
4
+ "#237804",
5
+ "#006d75",
6
+ "#ad8b00",
7
+ "#ad4e00",
8
+ "#5b8c00",
9
+ "#003eb3"
10
+ ];
11
+ const PALETTE_COLORS = [
12
+ "#4096ff",
13
+ "#69b1ff",
14
+ "#9e1068",
15
+ "#722ed1",
16
+ "#bae0ff",
17
+ "#d3adf7",
18
+ "#597ef7",
19
+ "#ffadd2",
20
+ "#c41d7f",
21
+ "#391085",
22
+ "#ffa940",
23
+ "#5c060b",
24
+ "#a81414",
25
+ "#ff7875",
26
+ "#ffd591",
27
+ "#ffe58f",
28
+ "#d3f261",
29
+ "#d4b106",
30
+ "#7cb305",
31
+ "#f4ffb8",
32
+ "#fa8c16",
33
+ "#0958d9",
34
+ "#fff3f0",
35
+ "#82090d",
36
+ "#ffbfb3",
37
+ "#f44336",
38
+ "#ff998a",
39
+ "#ff7161",
40
+ "#ffe2db",
41
+ "#cf2923"
42
+ ];
43
+ export {
44
+ LITTLE_PALETTE_COLORS,
45
+ PALETTE_COLORS
46
+ };
@@ -2,4 +2,4 @@ import React from 'react';
2
2
  import { CommonChartProps } from './common';
3
3
  import './loader.scss';
4
4
  import './tooltips.scss';
5
- export declare const DoneChartContainer: React.FC<CommonChartProps>;
5
+ export declare const DoneChartContainer: React.FC<CommonChartProps>;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { SDK } from '@rsdoctor/types';
3
3
  export declare const LoaderChartBase: React.FC<{
4
- project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
4
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
5
5
  }>;
6
6
  export declare const LoaderChart: React.FC<Omit<{
7
- project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
7
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
8
8
  }, "project"> & Partial<{
9
- body?: any;
10
- }>>;
9
+ body?: any;
10
+ }>>;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import './loader.scss';
3
3
  import { ChartProps } from './types';
4
- export declare const LoaderExecutionsChart: React.FC<ChartProps>;
4
+ export declare const LoaderExecutionsChart: React.FC<ChartProps>;
@@ -1,5 +1,11 @@
1
1
  import { Fragment, jsx } from "react/jsx-runtime";
2
- import { useCallback, useMemo, useRef, useEffect, useState } from "react";
2
+ import {
3
+ useCallback,
4
+ useMemo,
5
+ useRef,
6
+ useEffect,
7
+ useState
8
+ } from "react";
3
9
  import { groupBy } from "lodash-es";
4
10
  import { Empty } from "antd";
5
11
  import "./loader.css";
@@ -7,12 +13,23 @@ import { useTheme } from "../../utils/manifest";
7
13
  import { findLoaderTotalTiming } from "../../utils/loader";
8
14
  import { beautifyPath } from "../../utils/file";
9
15
  import { TimelineCom } from "./TimelineCharts";
10
- import { renderTotalLoadersTooltip, getTooltipHtmlForLoader } from "./utils";
11
- const LoaderExecutionsChart = ({ loaders, cwd }) => {
16
+ import {
17
+ renderTotalLoadersTooltip,
18
+ getTooltipHtmlForLoader,
19
+ useDebounceHook
20
+ } from "./utils";
21
+ const LoaderExecutionsChart = ({
22
+ loaders,
23
+ cwd
24
+ }) => {
12
25
  const { isDark } = useTheme();
13
26
  const ref = useRef(null);
14
27
  const [data, setData] = useState([]);
15
- const groupByLoader = useMemo(() => groupBy(loaders, (e) => e.loader), [loaders]);
28
+ const durationMetricData = useDebounceHook(data, 200);
29
+ const groupByLoader = useMemo(
30
+ () => groupBy(loaders, (e) => e.loader),
31
+ [loaders]
32
+ );
16
33
  const formatterForLoader = useCallback((raw) => {
17
34
  const { name, data: data2 } = raw;
18
35
  const loaderName = name.replace(" total", "");
@@ -22,35 +39,47 @@ const LoaderExecutionsChart = ({ loaders, cwd }) => {
22
39
  return renderTotalLoadersTooltip(loaderName, loaders, cwd);
23
40
  }, []);
24
41
  useEffect(() => {
25
- const _data = Object.keys(groupByLoader).map((loaderName) => {
26
- const list = groupByLoader[loaderName] || [];
27
- const { start, end } = findLoaderTotalTiming(list);
28
- return {
29
- p: loaderName,
30
- n: loaderName,
31
- s: start,
32
- e: end,
33
- c: list.map((e) => {
34
- return {
35
- p: loaderName,
36
- // n: loaderName,
37
- n: beautifyPath(e.resource, cwd),
38
- s: e.startAt,
39
- e: e.endAt,
40
- ext: e
41
- };
42
- })
43
- };
44
- });
42
+ const _data = Object.keys(groupByLoader).map(
43
+ (loaderName) => {
44
+ const list = groupByLoader[loaderName] || [];
45
+ const { start, end } = findLoaderTotalTiming(list);
46
+ return {
47
+ p: loaderName,
48
+ n: loaderName,
49
+ s: start,
50
+ e: end,
51
+ c: list.map((e) => {
52
+ return {
53
+ p: loaderName,
54
+ // n: loaderName,
55
+ n: beautifyPath(e.resource, cwd),
56
+ s: e.startAt,
57
+ e: e.endAt,
58
+ ext: e
59
+ };
60
+ })
61
+ };
62
+ }
63
+ );
45
64
  setData(_data);
46
65
  }, [groupByLoader]);
47
66
  return /* @__PURE__ */ jsx(Fragment, { children: data?.length ? /* @__PURE__ */ jsx(
48
67
  "div",
49
68
  {
50
- className: ["loader-chart-container", isDark ? "loader-chart-container_dark" : ""].join(" ").trim(),
69
+ className: [
70
+ "loader-chart-container",
71
+ isDark ? "loader-chart-container_dark" : ""
72
+ ].join(" ").trim(),
51
73
  ref,
52
74
  style: { width: "100%", height: "600px" },
53
- children: /* @__PURE__ */ jsx(TimelineCom, { loaderData: data, formatterFn: formatterForLoader, chartType: "loader" })
75
+ children: /* @__PURE__ */ jsx(
76
+ TimelineCom,
77
+ {
78
+ loaderData: durationMetricData,
79
+ formatterFn: formatterForLoader,
80
+ chartType: "loader"
81
+ }
82
+ )
54
83
  }
55
84
  ) : /* @__PURE__ */ jsx(Empty, {}) });
56
85
  };
@@ -2,4 +2,4 @@ import React from 'react';
2
2
  import { CommonChartProps } from './common';
3
3
  import './loader.scss';
4
4
  import './tooltips.scss';
5
- export declare const MinifyChartContainer: React.FC<CommonChartProps>;
5
+ export declare const MinifyChartContainer: React.FC<CommonChartProps>;
@@ -1,61 +1,61 @@
1
1
  import { SDK } from "@rsdoctor/types";
2
2
  export interface ChartProps {
3
- loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>;
4
- cwd: string;
3
+ loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>;
4
+ cwd: string;
5
5
  }
6
6
  export interface CommonMetricPart<T extends string = string> {
7
- _n?: boolean;
8
- _c?: string;
9
- p: string;
10
- n: T;
11
- ext?: unknown;
7
+ _n?: boolean;
8
+ _c?: string;
9
+ p: string;
10
+ n: T;
11
+ ext?: unknown;
12
12
  }
13
13
  export declare type Metric = DurationMetric;
14
14
  export interface DurationMetric extends CommonMetricPart {
15
- _r?: [start: string, end: string];
16
- s: number;
17
- e: number;
18
- c?: DurationMetric[];
15
+ _r?: [start: string, end: string];
16
+ s: number;
17
+ e: number;
18
+ c?: DurationMetric[];
19
19
  }
20
20
  export declare enum ETraceEventPhase {
21
- BEGIN = "B",
22
- END = "E",
23
- COMPLETE = "X",
24
- INSTANT = "I",
25
- MARK = "R",
21
+ BEGIN = "B",
22
+ END = "E",
23
+ COMPLETE = "X",
24
+ INSTANT = "I",
25
+ MARK = "R"
26
26
  }
27
27
  type MicroSeconds = number;
28
28
  type ProcessID = number | string;
29
29
  type ArgsType = {
30
- p: string;
31
- n: string;
32
- s: number;
33
- e: number;
30
+ p: string;
31
+ n: string;
32
+ s: number;
33
+ e: number;
34
34
  };
35
35
  export interface ITraceEventData {
36
- /**
37
- *Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section.
38
- */
39
- args: ArgsType;
40
- /**
41
- * The name of the event, as displayed in Chart.
42
- */
43
- name: string;
44
- /**
45
- * The event type. This is a single character which changes depending on the type of event being output.
46
- */
47
- ph: ETraceEventPhase;
48
- /**
49
- * The process ID for the process that output this event.
50
- */
51
- pid: ProcessID;
52
- /**
53
- * The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity.
54
- */
55
- ts: MicroSeconds;
56
- /**
57
- * specify the tracing clock duration of complete events in microseconds.
58
- */
59
- dur?: MicroSeconds;
36
+ /**
37
+ *Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section.
38
+ */
39
+ args: ArgsType;
40
+ /**
41
+ * The name of the event, as displayed in Chart.
42
+ */
43
+ name: string;
44
+ /**
45
+ * The event type. This is a single character which changes depending on the type of event being output.
46
+ */
47
+ ph: ETraceEventPhase;
48
+ /**
49
+ * The process ID for the process that output this event.
50
+ */
51
+ pid: ProcessID;
52
+ /**
53
+ * The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity.
54
+ */
55
+ ts: MicroSeconds;
56
+ /**
57
+ * specify the tracing clock duration of complete events in microseconds.
58
+ */
59
+ dur?: MicroSeconds;
60
60
  }
61
- export {};
61
+ export {};
@@ -6,7 +6,8 @@ export declare function renderTotalLoadersTooltip(loaderName: string, loaders: S
6
6
  export declare function transformDurationMetric(rawData: DurationMetric[]): ITraceEventData[];
7
7
  export declare function processTrans(rawData: DurationMetric[]): ITraceEventData[];
8
8
  export declare function formatterForPlugins(raw: {
9
- data: {
10
- ext: ITraceEventData;
11
- };
12
- }): string;
9
+ data: {
10
+ ext: ITraceEventData;
11
+ };
12
+ }): string;
13
+ export declare function useDebounceHook(value: DurationMetric[], delay: number): DurationMetric[] | undefined;