@rsdoctor/components 0.0.2-beta.0 → 0.0.2-beta.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.
@@ -72,7 +72,7 @@ const CodeChangeAlert = ({ data, cwd }) => {
72
72
  /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title })
73
73
  ] }),
74
74
  description: Description,
75
- type: isFixed ? "success" : level === "warn" ? "warning" : level,
75
+ type: isFixed ? "success" : level === "warn" ? "info" : level,
76
76
  action: /* @__PURE__ */ jsxs(Space, { children: [
77
77
  /* @__PURE__ */ jsx(
78
78
  TextDrawer,
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Alert } from "antd";
3
3
  const FileRelationAlert = ({ data }) => {
4
4
  const { description = "", level } = data;
5
- return /* @__PURE__ */ jsx(Alert, { type: level === "warn" ? "warning" : level, description });
5
+ return /* @__PURE__ */ jsx(Alert, { type: level === "warn" ? "info" : level, description });
6
6
  };
7
7
  export {
8
8
  FileRelationAlert
@@ -27,3 +27,6 @@
27
27
  width: 100%;
28
28
  height: 100%;
29
29
  }
30
+ .ant-alert-warning {
31
+ border: none;
32
+ }
@@ -14,7 +14,7 @@ const LinkRuleAlert = ({ data }) => {
14
14
  /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title })
15
15
  ] }),
16
16
  description: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: description } }),
17
- type: level === "warn" ? "warning" : level,
17
+ type: level === "warn" ? "info" : level,
18
18
  action: /* @__PURE__ */ jsxs(Button, { type: "link", onClick: navigate, size: "small", children: [
19
19
  "More",
20
20
  /* @__PURE__ */ jsx(InfoCircleOutlined, {})
@@ -24,7 +24,7 @@ import { Space, Alert, Button, Typography, Divider, Tabs, Row, Col, Timeline, Ca
24
24
  import { sumBy } from "lodash-es";
25
25
  import { Rule, SDK } from "@rsdoctor/types";
26
26
  import { ExpandAltOutlined, InfoCircleOutlined } from "@ant-design/icons";
27
- import { useRuleIndexNavigate, formatSize, useI18n } from "../../utils";
27
+ import { useRuleIndexNavigate, formatSize, useI18n, useWindowWidth } from "../../utils";
28
28
  import { TextDrawer } from "../TextDrawer";
29
29
  import { Title } from "../Title";
30
30
  import { Size, Color } from "../../constants";
@@ -92,6 +92,7 @@ const PackageRelationAlert = ({
92
92
  const navigate = useRuleIndexNavigate(code, data.link);
93
93
  const totalSize = sumBy(packages, (e) => e.targetSize.sourceSize);
94
94
  const totalSizeStr = formatSize(totalSize);
95
+ const windowWith = useWindowWidth();
95
96
  const { name } = packages.find((e) => !!e.target.name).target;
96
97
  const versions = packages.map((item) => item.target.version);
97
98
  return /* @__PURE__ */ jsx(
@@ -154,16 +155,16 @@ const PackageRelationAlert = ({
154
155
  /* @__PURE__ */ jsx(
155
156
  Typography.Paragraph,
156
157
  {
157
- style: { marginBottom: 0 },
158
+ style: { marginBottom: 0, width: windowWith > 1500 ? "50vw" : windowWith > 1200 ? "40vw" : "30vw" },
158
159
  copyable: { text: el.root },
159
- ellipsis: { rows: 2, expandable: true, symbol: /* @__PURE__ */ jsx(ExpandAltOutlined, {}), tooltip: el.root },
160
+ ellipsis: { rows: 1, expandable: true, symbol: /* @__PURE__ */ jsx(ExpandAltOutlined, {}), tooltip: el.root },
160
161
  code: true,
161
162
  children: el.root
162
163
  }
163
164
  )
164
165
  ] }, el.version);
165
166
  }) }),
166
- type: level === "warn" ? "warning" : level,
167
+ type: level === "warn" ? "info" : level,
167
168
  action: /* @__PURE__ */ jsxs(React.Fragment, { children: [
168
169
  packages && packages.length > 0 ? /* @__PURE__ */ jsx(TextDrawer, { text: "Show Relations", buttonProps: { size: "small" }, drawerProps: { title: data.title }, children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", className: "alert-space", children: [
169
170
  /* @__PURE__ */ jsxs(Space, { style: { marginBottom: Size.BasePadding / 2 }, children: [
@@ -42,7 +42,7 @@ const CodeViewAlert = ({ data, cwd }) => {
42
42
  /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title })
43
43
  ] }),
44
44
  description: Description,
45
- type: level === "warn" ? "warning" : level,
45
+ type: level === "warn" ? "info" : level,
46
46
  action: /* @__PURE__ */ jsxs(Space, { children: [
47
47
  /* @__PURE__ */ jsx(TextDrawer, { text: "Show Source Code", buttonProps: { size: "small" }, children: /* @__PURE__ */ jsx(CodeViewDrawerContent, { data, cwd }) }),
48
48
  /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6,6 +6,7 @@ import { CommonAlertsContainer } from "./common";
6
6
  import { withServerAPI } from "../Manifest";
7
7
  import { ViewMode } from "../../constants";
8
8
  import { PackageRelationReasonsWithServer } from "../Alert/package-relation";
9
+ import { ConfigProvider } from "antd";
9
10
  const BundleAlertsBase = ({ filter, project }) => {
10
11
  const { errors, root: cwd } = project;
11
12
  const bundleAlerts = useBundleAlertsByErrors(errors);
@@ -22,17 +23,30 @@ const BundleAlertsBase = ({ filter, project }) => {
22
23
  }
23
24
  }, []);
24
25
  return /* @__PURE__ */ jsx(
25
- CommonAlertsContainer,
26
+ ConfigProvider,
26
27
  {
27
- title: "Bundle Alerts",
28
- dataSource,
29
- extraData: {
30
- cwd,
31
- getPackageRelationContentComponent: (res) => /* @__PURE__ */ jsx(PackageRelationReasonsWithServer, { body: { id: res.data.id, target: res.package.target }, cwd })
28
+ theme: {
29
+ components: {
30
+ Alert: {
31
+ colorInfoBg: "#e6f4ff57",
32
+ colorInfoBorder: "none"
33
+ }
34
+ }
32
35
  },
33
- viewMode: viewMode.bundleAlerts,
34
- setViewMode: setBundleAlertsViewMode,
35
- cwd
36
+ children: /* @__PURE__ */ jsx(
37
+ CommonAlertsContainer,
38
+ {
39
+ title: "Bundle Alerts",
40
+ dataSource,
41
+ extraData: {
42
+ cwd,
43
+ getPackageRelationContentComponent: (res) => /* @__PURE__ */ jsx(PackageRelationReasonsWithServer, { body: { id: res.data.id, target: res.package.target }, cwd })
44
+ },
45
+ viewMode: viewMode.bundleAlerts,
46
+ setViewMode: setBundleAlertsViewMode,
47
+ cwd
48
+ }
49
+ )
36
50
  }
37
51
  );
38
52
  };
@@ -19,7 +19,6 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { jsx, jsxs } from "react/jsx-runtime";
21
21
  import { Tooltip } from "antd";
22
- import { Color } from "../../constants";
23
22
  var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
24
23
  BadgeType2["Default"] = "default";
25
24
  BadgeType2["Success"] = "success";
@@ -28,10 +27,10 @@ var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
28
27
  return BadgeType2;
29
28
  })(BadgeType || {});
30
29
  const BadgeColorMap = {
31
- ["default" /* Default */]: "linear-gradient(to bottom, #1182c2, #0273b4)",
32
- ["success" /* Success */]: "linear-gradient(to bottom, #4dc71f, #3fb911)",
33
- ["warn" /* Warn */]: "linear-gradient(to bottom, #d9b32f, #c9a319)",
34
- ["error" /* Error */]: `linear-gradient(to bottom, #da644e, ${Color.Red})`
30
+ ["default" /* Default */]: "linear-gradient(to bottom, #3ea2ff 0%, #0072db 100%)",
31
+ ["success" /* Success */]: "linear-gradient(to bottom, #6cf42a 0%, #52C41A 100%)",
32
+ ["warn" /* Warn */]: "linear-gradient(to bottom, #ffc100 0%, #f59025 100%)",
33
+ ["error" /* Error */]: `linear-gradient(to bottom, rgb(250 127 22), #FF4D4F 100%)`
35
34
  };
36
35
  const Badge = ({ label, value, type = "default", tooltip }) => {
37
36
  const height = 22;
@@ -72,7 +71,7 @@ const Badge = ({ label, value, type = "default", tooltip }) => {
72
71
  style: __spreadProps(__spreadValues({}, commonStyle), {
73
72
  borderTopLeftRadius: borderRadius,
74
73
  borderBottomLeftRadius: borderRadius,
75
- background: "linear-gradient(to bottom, #5d5d5d, #4f4f4f)"
74
+ background: "linear-gradient(to bottom, #525252a3 0%, #1F1F1F 100%)"
76
75
  }),
77
76
  children: label
78
77
  }
@@ -12,6 +12,7 @@ const LoaderExecutionsChart = ({ loaders, cwd }) => {
12
12
  const { isDark } = useTheme();
13
13
  const ref = useRef(null);
14
14
  const groupByLoader = useMemo(() => groupBy(loaders, (e) => e.loader), [loaders]);
15
+ console.log("Loader Data:", groupByLoader);
15
16
  const formatterForLoader = useCallback((raw) => {
16
17
  const { name, data: data2 } = raw;
17
18
  const loaderName = name.replace(" total", "");
@@ -23,15 +24,6 @@ const LoaderExecutionsChart = ({ loaders, cwd }) => {
23
24
  const data = useMemo(() => {
24
25
  return Object.keys(groupByLoader).map((loaderName) => {
25
26
  const list = groupByLoader[loaderName] || [];
26
- if (list.length === 1) {
27
- const { startAt, endAt } = list[0];
28
- return {
29
- p: loaderName,
30
- n: loaderName,
31
- s: startAt,
32
- e: endAt
33
- };
34
- }
35
27
  const { start, end } = findLoaderTotalTiming(list);
36
28
  return {
37
29
  p: loaderName,
@@ -51,6 +43,7 @@ const LoaderExecutionsChart = ({ loaders, cwd }) => {
51
43
  };
52
44
  });
53
45
  }, [groupByLoader]);
46
+ console.log("Loader Transformed Data:", data);
54
47
  if (!data.length)
55
48
  return /* @__PURE__ */ jsx(Empty, {});
56
49
  return /* @__PURE__ */ jsx(
@@ -15,15 +15,18 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  import { jsx, jsxs } from "react/jsx-runtime";
18
- import { Space } from "antd";
18
+ import { Space, theme } from "antd";
19
19
  import { FileOutlined, FolderOpenOutlined, FolderOutlined, RightOutlined } from "@ant-design/icons";
20
20
  import Tree from "rc-tree";
21
21
  import { Size } from "../../constants";
22
22
  import "./index.css";
23
23
  import { useTheme } from "../../utils";
24
+ const { useToken } = theme;
24
25
  const FileTree = (props) => {
25
26
  const { isDark } = useTheme();
26
- const color = isDark ? "#fff" : "#000";
27
+ const { token } = useToken();
28
+ const color = isDark ? token.colorWhite : token.colorPrimaryText;
29
+ const style = { fontSize: token.fontSize };
27
30
  return /* @__PURE__ */ jsx(
28
31
  Tree,
29
32
  __spreadValues({
@@ -35,11 +38,12 @@ const FileTree = (props) => {
35
38
  /* @__PURE__ */ jsx(
36
39
  RightOutlined,
37
40
  {
41
+ twoToneColor: color,
38
42
  className: `file-tree-switcher-arrow ${expanded ? "file-tree-switcher-arrow-expand" : ""}`,
39
- style: { fontSize: 10, color }
43
+ style
40
44
  }
41
45
  ),
42
- expanded ? /* @__PURE__ */ jsx(FolderOpenOutlined, { style: { fontSize: 14, color } }) : /* @__PURE__ */ jsx(FolderOutlined, { style: { fontSize: 14, color } })
46
+ expanded ? /* @__PURE__ */ jsx(FolderOpenOutlined, { twoToneColor: color, style }) : /* @__PURE__ */ jsx(FolderOutlined, { twoToneColor: color, style })
43
47
  ] });
44
48
  }
45
49
  return /* @__PURE__ */ jsx(FileOutlined, { style: { marginLeft: Size.BasePadding - 6, color } });
@@ -9,7 +9,7 @@ import {
9
9
  import { OverlayAlertsWithButton } from "../Alerts";
10
10
  import { BuilderSelect } from "./builder-select";
11
11
  import { Menus } from "./menus";
12
- import icon from "../../assets/icon.7509d763.svg";
12
+ import icon from "../../assets/rsdoctor.508e522f.png";
13
13
  import "./header.css";
14
14
  const Header = () => {
15
15
  const { i18n } = useI18n();
@@ -44,7 +44,7 @@ const Header = () => {
44
44
  children: /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "middle", style: { height: Size.NavBarHeight }, wrap: false, children: [
45
45
  /* @__PURE__ */ jsx(Col, { style: { height: Size.NavBarHeight, lineHeight: `${Size.NavBarHeight + 2}px` }, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", height: "100%" }, children: [
46
46
  /* @__PURE__ */ jsx("img", { style: { height: 30 }, src: icon, className: "web-doctor-logo", alt: "logo" }),
47
- /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit", fontSize: 18, marginLeft: 4 }, children: "Rsdoctor" }),
47
+ /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit", fontSize: 18, marginLeft: 4, marginTop: 8 }, children: "Rsdoctor" }),
48
48
  /* @__PURE__ */ jsx(BuilderSelect, {})
49
49
  ] }) }),
50
50
  /* @__PURE__ */ jsx(Col, { flex: 1, children: /* @__PURE__ */ jsxs(
@@ -32,7 +32,7 @@ export declare enum Size {
32
32
  NavBarHeight = 54,
33
33
  }
34
34
  export declare enum Color {
35
- Red = "rgb(207, 19, 34)",
35
+ Red = "#e17055",
36
36
  Green = "#52c41a",
37
37
  Yellow = "#faad14",
38
38
  Blue = "#1677ff",
package/dist/constants.js CHANGED
@@ -39,7 +39,7 @@ var Size = /* @__PURE__ */ ((Size2) => {
39
39
  return Size2;
40
40
  })(Size || {});
41
41
  var Color = /* @__PURE__ */ ((Color2) => {
42
- Color2["Red"] = "rgb(207, 19, 34)";
42
+ Color2["Red"] = "#e17055";
43
43
  Color2["Green"] = "#52c41a";
44
44
  Color2["Yellow"] = "#faad14";
45
45
  Color2["Blue"] = "#1677ff";
@@ -62,27 +62,36 @@
62
62
  .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) {
63
63
  border-left: 1px solid #eee;
64
64
  }
65
- .file-tree-com-titles-box .file-tree-com-titles {
65
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles {
66
66
  display: flex;
67
67
  flex-direction: column;
68
68
  }
69
- .file-tree-com-titles-box .file-tree-com-titles .file-tree-com-node-title {
69
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title {
70
70
  display: flex;
71
71
  cursor: pointer;
72
72
  }
73
- .file-tree-com-titles-box .file-tree-com-titles .file-tree-com-node-title img {
73
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img {
74
74
  cursor: pointer;
75
75
  }
76
- .file-tree-com-titles-box .file-tree-com-titles .file-tree-com-node-title img-tag {
76
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img-tag {
77
77
  cursor: pointer;
78
78
  }
79
- .file-tree-com-titles-box .file-tree-com-titles .file-tree-com-node-title-selected {
79
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-selected {
80
80
  background-color: yellow;
81
81
  }
82
- .file-tree-com-titles-box .file-tree-com-titles .file-tree-com-node-title-tag {
82
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-tag {
83
83
  margin-inline-end: 0;
84
84
  }
85
- .file-tree-com-node-title-code .file-tree-com-titles-box .file-tree-com-titles-tag {
85
+ .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-code-tag {
86
86
  cursor: pointer;
87
87
  padding: 0 2px;
88
88
  }
89
+ .rc-tree-indent {
90
+ display: inline-block;
91
+ height: 0;
92
+ vertical-align: bottom;
93
+ }
94
+ .rc-tree-indent-unit {
95
+ display: inline-block;
96
+ width: 14px;
97
+ }
@@ -27,4 +27,5 @@ export declare function useCompileAlertsByErrors(errors: Manifest.DoctorManifest
27
27
  export declare function useBundleAlertsByErrors(errors: Manifest.DoctorManifestData['errors']): Rule.RuleStoreDataItem[];
28
28
  export declare function useDuplicatePackagesByErrors(errors: Manifest.DoctorManifestData['errors']): Rule.PackageRelationDiffRuleStoreData[];
29
29
  export declare function useWebpackConfigurationByConfigs(configs?: SDK.ConfigData): SDK.WebpackConfigData | null | undefined;
30
- export declare function useDetectIfCloudIdeEnv(): boolean;
30
+ export declare function useDetectIfCloudIdeEnv(): boolean;
31
+ export declare function useWindowWidth(): number;
@@ -52,7 +52,7 @@ var __async = (__this, __arguments, generator) => {
52
52
  import { Algorithm } from "@rsdoctor/utils/common";
53
53
  import { Client, Rule } from "@rsdoctor/types";
54
54
  import { uniqBy, isArray, defaults } from "lodash-es";
55
- import { useState } from "react";
55
+ import { useEffect, useState } from "react";
56
56
  import { useTranslation } from "react-i18next";
57
57
  import { useNavigate, useLocation } from "react-router-dom";
58
58
  import parse from "url-parse";
@@ -230,6 +230,17 @@ function useDetectIfCloudIdeEnv() {
230
230
  }
231
231
  return false;
232
232
  }
233
+ function useWindowWidth() {
234
+ const [windowWidth, setWindowWidth] = useState(window.innerWidth);
235
+ useEffect(() => {
236
+ const handleResize = () => setWindowWidth(window.innerWidth);
237
+ window.addEventListener("resize", handleResize);
238
+ return () => {
239
+ window.removeEventListener("resize", handleResize);
240
+ };
241
+ }, []);
242
+ return windowWidth;
243
+ }
233
244
  export {
234
245
  useBundleAlertsByErrors,
235
246
  useBundleAlertsByManifest,
@@ -252,5 +263,6 @@ export {
252
263
  useUniqModules,
253
264
  useUniqModulesByManifest,
254
265
  useUrlQuery,
255
- useWebpackConfigurationByConfigs
266
+ useWebpackConfigurationByConfigs,
267
+ useWindowWidth
256
268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/components",
3
- "version": "0.0.2-beta.0",
3
+ "version": "0.0.2-beta.1",
4
4
  "main": "./dist/index.js",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -70,9 +70,9 @@
70
70
  "terser": "^5.26.0",
71
71
  "typescript": "^5.2.2",
72
72
  "url-parse": "1.5.10",
73
- "@rsdoctor/graph": "0.0.2-beta.0",
74
- "@rsdoctor/types": "0.0.2-beta.0",
75
- "@rsdoctor/utils": "0.0.2-beta.0"
73
+ "@rsdoctor/types": "0.0.2-beta.1",
74
+ "@rsdoctor/graph": "0.0.2-beta.1",
75
+ "@rsdoctor/utils": "0.0.2-beta.1"
76
76
  },
77
77
  "publishConfig": {
78
78
  "access": "public",
@@ -1,21 +0,0 @@
1
- <svg width="106.000000" height="113.000000" viewBox="0 0 106 113" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
- <rect id="画板 934" width="106.000000" height="113.000000" fill="#FFFFFF" fill-opacity="0.035"/>
3
- <g clip-path="url(#clip111_45)">
4
- <rect id="矩形 2176" x="22.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#0F0D0D"/>
5
- <rect id="矩形 2176" x="22.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#736C6C"/>
6
- <rect id="矩形 2176" x="22.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" stroke="#000000" stroke-linejoin="bevel"/>
7
- <rect id="矩形 2176" x="49.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#0F0D0D"/>
8
- <rect id="矩形 2176" x="49.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#736C6C"/>
9
- <rect id="矩形 2176" x="49.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" stroke="#000000" stroke-linejoin="bevel"/>
10
- <path id="矢量 943" d="M24.0938 15.8218C24.0938 15.8218 14 11.3477 14 23.2773C14 35.207 26.1123 70 26.1123 70L41 70" stroke="#000000" stroke-width="5.000000"/>
11
- <path id="矢量 943" d="M53.9062 15.8218C53.9062 15.8218 64 11.3477 64 23.2773C64 35.207 51.8877 70 51.8877 70L37 70" stroke="#000000" stroke-width="5.000000"/>
12
- <path id="矢量 945" d="M40 83.0723C40 94.0781 48.9219 103 59.9277 103L70 103C81.0459 103 90 94.0459 90 83L90 48" stroke="#000000" stroke-width="5.000000"/>
13
- <ellipse id="椭圆 54" cx="90.000000" cy="41.500000" rx="11.000000" ry="8.500000" fill="#5092FF"/>
14
- <path id="矢量 946" d="M27 72C31.9609 80.7266 34.5361 81.2817 39.4443 80.9219C44.7744 81.2124 47.4326 79.7798 51 72" stroke="#000000" stroke-width="5.000000"/>
15
- </g>
16
- <defs>
17
- <clipPath id="clip111_45">
18
- <rect id="画板 934" width="106.000000" height="113.000000" fill="white"/>
19
- </clipPath>
20
- </defs>
21
- </svg>