@rsdoctor/components 1.5.3-alpha.0 → 1.5.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.
- package/dist/common/svg/cursor.mjs +22 -0
- package/dist/common/svg/cursor.mjs.map +1 -0
- package/dist/common/svg/trae.mjs +21 -0
- package/dist/common/svg/trae.mjs.map +1 -0
- package/dist/common/svg/vscode.mjs +158 -0
- package/dist/common/svg/vscode.mjs.map +1 -0
- package/dist/components/Configuration/builder.d.ts +1 -1
- package/dist/components/Loader/Analysis/index.d.ts +1 -1
- package/dist/components/Opener/code.mjs +1 -1
- package/dist/components/Opener/code.mjs.map +1 -1
- package/dist/components/Opener/{vscode.d.ts → ide.d.ts} +2 -0
- package/dist/components/Opener/ide.mjs +62 -0
- package/dist/components/Opener/ide.mjs.map +1 -0
- package/dist/components/Opener/index.d.ts +1 -1
- package/dist/components/Opener/index.mjs +1 -1
- package/dist/components/base/CodeViewer/index.d.ts +1 -1
- package/dist/components/base/CodeViewer/index.mjs +9 -2
- package/dist/components/base/CodeViewer/index.mjs.map +1 -1
- package/dist/components/base/CodeViewer/interface.d.ts +5 -0
- package/dist/pages/ModuleAnalyze/fileTree.d.ts +2 -0
- package/dist/pages/ModuleAnalyze/fileTree.mjs +168 -33
- package/dist/pages/ModuleAnalyze/fileTree.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/index.mjs +87 -76
- package/dist/pages/ModuleAnalyze/index.mjs.map +1 -1
- package/package.json +8 -8
- package/dist/components/Opener/vscode.mjs +0 -33
- package/dist/components/Opener/vscode.mjs.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgCursor = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "1em",
|
|
6
|
+
height: "1em",
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
fillRule: "evenodd",
|
|
9
|
+
style: {
|
|
10
|
+
flex: "none",
|
|
11
|
+
lineHeight: 1
|
|
12
|
+
},
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
...props,
|
|
15
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
16
|
+
d: "M22.106 5.68 12.5.135a1 1 0 0 0-.998 0L1.893 5.68a.84.84 0 0 0-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a1 1 0 0 0 .998 0l9.608-5.547a.84.84 0 0 0 .42-.727V6.407a.84.84 0 0 0-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 0 0-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
const cursor = SvgCursor;
|
|
20
|
+
export { cursor as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=cursor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common/svg/cursor.mjs","sources":["../../../src/common/svg/cursor.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgCursor = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" fill=\"currentColor\" fillRule=\"evenodd\" style={{\n flex: \"none\",\n lineHeight: 1\n}} viewBox=\"0 0 24 24\" {...props}><path d=\"M22.106 5.68 12.5.135a1 1 0 0 0-.998 0L1.893 5.68a.84.84 0 0 0-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a1 1 0 0 0 .998 0l9.608-5.547a.84.84 0 0 0 .42-.727V6.407a.84.84 0 0 0-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 0 0-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514\" /></svg>;\nexport default SvgCursor;"],"names":["SvgCursor","props"],"mappings":";;AACA,MAAMA,YAAYC,CAAAA,QAAAA,WAAAA,GAAS,IAAC;QAAI,OAAM;QAA6B,OAAM;QAAM,QAAO;QAAM,MAAK;QAAe,UAAS;QAAU,OAAO;YACxI,MAAM;YACN,YAAY;QACd;QAAG,SAAQ;QAAa,GAAGA,KAAK;kBAAE,kBAAC;YAAK,GAAE;;;AAC1C,eAAeD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgTrae = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "1em",
|
|
6
|
+
height: "1em",
|
|
7
|
+
style: {
|
|
8
|
+
flex: "none",
|
|
9
|
+
lineHeight: 1
|
|
10
|
+
},
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
...props,
|
|
13
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
14
|
+
fill: "#32F08C",
|
|
15
|
+
d: "M24 20.541H3.428v-3.426H0V3.4h24v17.14zM3.428 17.115h17.144V6.827H3.428zm8.573-5.196-2.425 2.424-2.424-2.424 2.424-2.424zm6.857-.001-2.424 2.423-2.425-2.423 2.425-2.425z"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
const trae = SvgTrae;
|
|
19
|
+
export { trae as default };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=trae.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common/svg/trae.mjs","sources":["../../../src/common/svg/trae.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgTrae = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" style={{\n flex: \"none\",\n lineHeight: 1\n}} viewBox=\"0 0 24 24\" {...props}><path fill=\"#32F08C\" d=\"M24 20.541H3.428v-3.426H0V3.4h24v17.14zM3.428 17.115h17.144V6.827H3.428zm8.573-5.196-2.425 2.424-2.424-2.424 2.424-2.424zm6.857-.001-2.424 2.423-2.425-2.423 2.425-2.425z\" /></svg>;\nexport default SvgTrae;"],"names":["SvgTrae","props"],"mappings":";;AACA,MAAMA,UAAUC,CAAAA,QAAAA,WAAAA,GAAS,IAAC;QAAI,OAAM;QAA6B,OAAM;QAAM,QAAO;QAAM,OAAO;YAC/F,MAAM;YACN,YAAY;QACd;QAAG,SAAQ;QAAa,GAAGA,KAAK;kBAAE,kBAAC;YAAK,MAAK;YAAU,GAAE;;;AACzD,aAAeD"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgVscode = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: 100,
|
|
6
|
+
height: 100,
|
|
7
|
+
fill: "none",
|
|
8
|
+
viewBox: "0 0 100 100",
|
|
9
|
+
...props,
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx("mask", {
|
|
12
|
+
id: "vscode_svg__a",
|
|
13
|
+
width: 100,
|
|
14
|
+
height: 100,
|
|
15
|
+
x: 0,
|
|
16
|
+
y: 0,
|
|
17
|
+
"mask-type": "alpha",
|
|
18
|
+
maskUnits: "userSpaceOnUse",
|
|
19
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
20
|
+
fill: "#fff",
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
d: "M70.912 99.317a6.22 6.22 0 0 0 4.96-.19l20.589-9.907A6.25 6.25 0 0 0 100 83.587V16.413a6.25 6.25 0 0 0-3.54-5.632L75.874.874a6.23 6.23 0 0 0-7.104 1.21L29.355 38.04 12.187 25.01a4.16 4.16 0 0 0-5.318.236l-5.506 5.009a4.17 4.17 0 0 0-.004 6.162L16.247 50 1.36 63.583a4.17 4.17 0 0 0 .004 6.162l5.506 5.01a4.16 4.16 0 0 0 5.318.236l17.168-13.032L68.77 97.917a6.2 6.2 0 0 0 2.143 1.4M75.015 27.3 45.11 50l29.906 22.701z",
|
|
23
|
+
clipRule: "evenodd"
|
|
24
|
+
})
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ jsxs("g", {
|
|
27
|
+
mask: "url(#vscode_svg__a)",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ jsx("path", {
|
|
30
|
+
fill: "#0065A9",
|
|
31
|
+
d: "M96.461 10.796 75.857.876a6.23 6.23 0 0 0-7.107 1.207l-67.451 61.5a4.167 4.167 0 0 0 .004 6.162l5.51 5.009a4.17 4.17 0 0 0 5.32.236l81.228-61.62c2.725-2.067 6.639-.124 6.639 3.297v-.24a6.25 6.25 0 0 0-3.539-5.63"
|
|
32
|
+
}),
|
|
33
|
+
/*#__PURE__*/ jsx("g", {
|
|
34
|
+
filter: "url(#vscode_svg__b)",
|
|
35
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
36
|
+
fill: "#007ACC",
|
|
37
|
+
d: "m96.461 89.204-20.604 9.92a6.23 6.23 0 0 1-7.107-1.207l-67.451-61.5a4.167 4.167 0 0 1 .004-6.162l5.51-5.009a4.17 4.17 0 0 1 5.32-.236l81.228 61.62c2.725 2.067 6.639.124 6.639-3.297v.24a6.25 6.25 0 0 1-3.539 5.63"
|
|
38
|
+
})
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ jsx("g", {
|
|
41
|
+
filter: "url(#vscode_svg__c)",
|
|
42
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
43
|
+
fill: "#1F9CF0",
|
|
44
|
+
d: "M75.858 99.126a6.23 6.23 0 0 1-7.108-1.21c2.306 2.307 6.25.674 6.25-2.588V4.672c0-3.262-3.944-4.895-6.25-2.589a6.23 6.23 0 0 1 7.108-1.21l20.6 9.908A6.25 6.25 0 0 1 100 16.413v67.174a6.25 6.25 0 0 1-3.541 5.633z"
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ jsx("path", {
|
|
48
|
+
fill: "url(#vscode_svg__d)",
|
|
49
|
+
fillRule: "evenodd",
|
|
50
|
+
d: "M70.851 99.317a6.22 6.22 0 0 0 4.96-.19L96.4 89.22a6.25 6.25 0 0 0 3.54-5.633V16.413a6.25 6.25 0 0 0-3.54-5.632L75.812.874a6.23 6.23 0 0 0-7.104 1.21L29.294 38.04 12.126 25.01a4.16 4.16 0 0 0-5.317.236l-5.507 5.009a4.17 4.17 0 0 0-.004 6.162L16.186 50 1.298 63.583a4.17 4.17 0 0 0 .004 6.162l5.507 5.009a4.16 4.16 0 0 0 5.317.236L29.294 61.96l39.414 35.958a6.2 6.2 0 0 0 2.143 1.4M74.954 27.3 45.048 50l29.906 22.701z",
|
|
51
|
+
clipRule: "evenodd",
|
|
52
|
+
opacity: 0.25,
|
|
53
|
+
style: {
|
|
54
|
+
mixBlendMode: "overlay"
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ jsxs("defs", {
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ jsxs("filter", {
|
|
62
|
+
id: "vscode_svg__b",
|
|
63
|
+
width: 116.727,
|
|
64
|
+
height: 92.246,
|
|
65
|
+
x: -8.394,
|
|
66
|
+
y: 15.829,
|
|
67
|
+
colorInterpolationFilters: "sRGB",
|
|
68
|
+
filterUnits: "userSpaceOnUse",
|
|
69
|
+
children: [
|
|
70
|
+
/*#__PURE__*/ jsx("feFlood", {
|
|
71
|
+
floodOpacity: 0,
|
|
72
|
+
result: "BackgroundImageFix"
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsx("feColorMatrix", {
|
|
75
|
+
in: "SourceAlpha",
|
|
76
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ jsx("feOffset", {}),
|
|
79
|
+
/*#__PURE__*/ jsx("feGaussianBlur", {
|
|
80
|
+
stdDeviation: 4.167
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ jsx("feColorMatrix", {
|
|
83
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ jsx("feBlend", {
|
|
86
|
+
in2: "BackgroundImageFix",
|
|
87
|
+
mode: "overlay",
|
|
88
|
+
result: "effect1_dropShadow"
|
|
89
|
+
}),
|
|
90
|
+
/*#__PURE__*/ jsx("feBlend", {
|
|
91
|
+
in: "SourceGraphic",
|
|
92
|
+
in2: "effect1_dropShadow",
|
|
93
|
+
result: "shape"
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ jsxs("filter", {
|
|
98
|
+
id: "vscode_svg__c",
|
|
99
|
+
width: 47.917,
|
|
100
|
+
height: 116.151,
|
|
101
|
+
x: 60.417,
|
|
102
|
+
y: -8.076,
|
|
103
|
+
colorInterpolationFilters: "sRGB",
|
|
104
|
+
filterUnits: "userSpaceOnUse",
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ jsx("feFlood", {
|
|
107
|
+
floodOpacity: 0,
|
|
108
|
+
result: "BackgroundImageFix"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsx("feColorMatrix", {
|
|
111
|
+
in: "SourceAlpha",
|
|
112
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ jsx("feOffset", {}),
|
|
115
|
+
/*#__PURE__*/ jsx("feGaussianBlur", {
|
|
116
|
+
stdDeviation: 4.167
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ jsx("feColorMatrix", {
|
|
119
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ jsx("feBlend", {
|
|
122
|
+
in2: "BackgroundImageFix",
|
|
123
|
+
mode: "overlay",
|
|
124
|
+
result: "effect1_dropShadow"
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ jsx("feBlend", {
|
|
127
|
+
in: "SourceGraphic",
|
|
128
|
+
in2: "effect1_dropShadow",
|
|
129
|
+
result: "shape"
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}),
|
|
133
|
+
/*#__PURE__*/ jsxs("linearGradient", {
|
|
134
|
+
id: "vscode_svg__d",
|
|
135
|
+
x1: 49.939,
|
|
136
|
+
x2: 49.939,
|
|
137
|
+
y1: 0.258,
|
|
138
|
+
y2: 99.742,
|
|
139
|
+
gradientUnits: "userSpaceOnUse",
|
|
140
|
+
children: [
|
|
141
|
+
/*#__PURE__*/ jsx("stop", {
|
|
142
|
+
stopColor: "#fff"
|
|
143
|
+
}),
|
|
144
|
+
/*#__PURE__*/ jsx("stop", {
|
|
145
|
+
offset: 1,
|
|
146
|
+
stopColor: "#fff",
|
|
147
|
+
stopOpacity: 0
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
const vscode = SvgVscode;
|
|
156
|
+
export { vscode as default };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=vscode.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common/svg/vscode.mjs","sources":["../../../src/common/svg/vscode.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgVscode = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={100} height={100} fill=\"none\" viewBox=\"0 0 100 100\" {...props}><mask id=\"vscode_svg__a\" width={100} height={100} x={0} y={0} mask-type=\"alpha\" maskUnits=\"userSpaceOnUse\"><path fill=\"#fff\" fillRule=\"evenodd\" d=\"M70.912 99.317a6.22 6.22 0 0 0 4.96-.19l20.589-9.907A6.25 6.25 0 0 0 100 83.587V16.413a6.25 6.25 0 0 0-3.54-5.632L75.874.874a6.23 6.23 0 0 0-7.104 1.21L29.355 38.04 12.187 25.01a4.16 4.16 0 0 0-5.318.236l-5.506 5.009a4.17 4.17 0 0 0-.004 6.162L16.247 50 1.36 63.583a4.17 4.17 0 0 0 .004 6.162l5.506 5.01a4.16 4.16 0 0 0 5.318.236l17.168-13.032L68.77 97.917a6.2 6.2 0 0 0 2.143 1.4M75.015 27.3 45.11 50l29.906 22.701z\" clipRule=\"evenodd\" /></mask><g mask=\"url(#vscode_svg__a)\"><path fill=\"#0065A9\" d=\"M96.461 10.796 75.857.876a6.23 6.23 0 0 0-7.107 1.207l-67.451 61.5a4.167 4.167 0 0 0 .004 6.162l5.51 5.009a4.17 4.17 0 0 0 5.32.236l81.228-61.62c2.725-2.067 6.639-.124 6.639 3.297v-.24a6.25 6.25 0 0 0-3.539-5.63\" /><g filter=\"url(#vscode_svg__b)\"><path fill=\"#007ACC\" d=\"m96.461 89.204-20.604 9.92a6.23 6.23 0 0 1-7.107-1.207l-67.451-61.5a4.167 4.167 0 0 1 .004-6.162l5.51-5.009a4.17 4.17 0 0 1 5.32-.236l81.228 61.62c2.725 2.067 6.639.124 6.639-3.297v.24a6.25 6.25 0 0 1-3.539 5.63\" /></g><g filter=\"url(#vscode_svg__c)\"><path fill=\"#1F9CF0\" d=\"M75.858 99.126a6.23 6.23 0 0 1-7.108-1.21c2.306 2.307 6.25.674 6.25-2.588V4.672c0-3.262-3.944-4.895-6.25-2.589a6.23 6.23 0 0 1 7.108-1.21l20.6 9.908A6.25 6.25 0 0 1 100 16.413v67.174a6.25 6.25 0 0 1-3.541 5.633z\" /></g><path fill=\"url(#vscode_svg__d)\" fillRule=\"evenodd\" d=\"M70.851 99.317a6.22 6.22 0 0 0 4.96-.19L96.4 89.22a6.25 6.25 0 0 0 3.54-5.633V16.413a6.25 6.25 0 0 0-3.54-5.632L75.812.874a6.23 6.23 0 0 0-7.104 1.21L29.294 38.04 12.126 25.01a4.16 4.16 0 0 0-5.317.236l-5.507 5.009a4.17 4.17 0 0 0-.004 6.162L16.186 50 1.298 63.583a4.17 4.17 0 0 0 .004 6.162l5.507 5.009a4.16 4.16 0 0 0 5.317.236L29.294 61.96l39.414 35.958a6.2 6.2 0 0 0 2.143 1.4M74.954 27.3 45.048 50l29.906 22.701z\" clipRule=\"evenodd\" opacity={0.25} style={{\n mixBlendMode: \"overlay\"\n }} /></g><defs><filter id=\"vscode_svg__b\" width={116.727} height={92.246} x={-8.394} y={15.829} colorInterpolationFilters=\"sRGB\" filterUnits=\"userSpaceOnUse\"><feFlood floodOpacity={0} result=\"BackgroundImageFix\" /><feColorMatrix in=\"SourceAlpha\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\" /><feOffset /><feGaussianBlur stdDeviation={4.167} /><feColorMatrix values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0\" /><feBlend in2=\"BackgroundImageFix\" mode=\"overlay\" result=\"effect1_dropShadow\" /><feBlend in=\"SourceGraphic\" in2=\"effect1_dropShadow\" result=\"shape\" /></filter><filter id=\"vscode_svg__c\" width={47.917} height={116.151} x={60.417} y={-8.076} colorInterpolationFilters=\"sRGB\" filterUnits=\"userSpaceOnUse\"><feFlood floodOpacity={0} result=\"BackgroundImageFix\" /><feColorMatrix in=\"SourceAlpha\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\" /><feOffset /><feGaussianBlur stdDeviation={4.167} /><feColorMatrix values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0\" /><feBlend in2=\"BackgroundImageFix\" mode=\"overlay\" result=\"effect1_dropShadow\" /><feBlend in=\"SourceGraphic\" in2=\"effect1_dropShadow\" result=\"shape\" /></filter><linearGradient id=\"vscode_svg__d\" x1={49.939} x2={49.939} y1={0.258} y2={99.742} gradientUnits=\"userSpaceOnUse\"><stop stopColor=\"#fff\" /><stop offset={1} stopColor=\"#fff\" stopOpacity={0} /></linearGradient></defs></svg>;\nexport default SvgVscode;"],"names":["SvgVscode","props"],"mappings":";;AACA,MAAMA,YAAYC,CAAAA,QAAAA,WAAAA,GAAS,KAAC;QAAI,OAAM;QAA6B,OAAO;QAAK,QAAQ;QAAK,MAAK;QAAO,SAAQ;QAAe,GAAGA,KAAK;;0BAAE,IAAC;gBAAK,IAAG;gBAAgB,OAAO;gBAAK,QAAQ;gBAAK,GAAG;gBAAG,GAAG;gBAAG,aAAU;gBAAQ,WAAU;0BAAiB,kBAAC;oBAAK,MAAK;oBAAO,UAAS;oBAAU,GAAE;oBAAma,UAAS;;;0BAAmB,KAAC;gBAAE,MAAK;;kCAAsB,IAAC;wBAAK,MAAK;wBAAU,GAAE;;kCAAwN,IAAC;wBAAE,QAAO;kCAAsB,kBAAC;4BAAK,MAAK;4BAAU,GAAE;;;kCAA4N,IAAC;wBAAE,QAAO;kCAAsB,kBAAC;4BAAK,MAAK;4BAAU,GAAE;;;kCAA4N,IAAC;wBAAK,MAAK;wBAAsB,UAAS;wBAAU,GAAE;wBAAoa,UAAS;wBAAU,SAAS;wBAAM,OAAO;4BAC1gE,cAAc;wBAChB;;;;0BAAS,KAAC;;kCAAK,KAAC;wBAAO,IAAG;wBAAgB,OAAO;wBAAS,QAAQ;wBAAQ,GAAG;wBAAQ,GAAG;wBAAQ,2BAA0B;wBAAO,aAAY;;0CAAiB,IAAC;gCAAQ,cAAc;gCAAG,QAAO;;0CAAuB,IAAC;gCAAc,IAAG;gCAAc,QAAO;;0CAA8C,IAAC;0CAAW,IAAC;gCAAe,cAAc;;0CAAS,IAAC;gCAAc,QAAO;;0CAA+C,IAAC;gCAAQ,KAAI;gCAAqB,MAAK;gCAAU,QAAO;;0CAAuB,IAAC;gCAAQ,IAAG;gCAAgB,KAAI;gCAAqB,QAAO;;;;kCAAmB,KAAC;wBAAO,IAAG;wBAAgB,OAAO;wBAAQ,QAAQ;wBAAS,GAAG;wBAAQ,GAAG;wBAAQ,2BAA0B;wBAAO,aAAY;;0CAAiB,IAAC;gCAAQ,cAAc;gCAAG,QAAO;;0CAAuB,IAAC;gCAAc,IAAG;gCAAc,QAAO;;0CAA8C,IAAC;0CAAW,IAAC;gCAAe,cAAc;;0CAAS,IAAC;gCAAc,QAAO;;0CAA+C,IAAC;gCAAQ,KAAI;gCAAqB,MAAK;gCAAU,QAAO;;0CAAuB,IAAC;gCAAQ,IAAG;gCAAgB,KAAI;gCAAqB,QAAO;;;;kCAAmB,KAAC;wBAAe,IAAG;wBAAgB,IAAI;wBAAQ,IAAI;wBAAQ,IAAI;wBAAO,IAAI;wBAAQ,eAAc;;0CAAiB,IAAC;gCAAK,WAAU;;0CAAS,IAAC;gCAAK,QAAQ;gCAAG,WAAU;gCAAO,aAAa;;;;;;;;AAChzC,eAAeD"}
|
|
@@ -7,7 +7,7 @@ interface WebpackConfigurationViewerBaseProps {
|
|
|
7
7
|
export declare const WebpackConfigurationViewerBase: React.FC<WebpackConfigurationViewerBaseProps>;
|
|
8
8
|
export declare const WebpackConfigurationViewer: React.FC<Omit<WebpackConfigurationViewerBaseProps, "configs"> & Partial<{
|
|
9
9
|
body: {
|
|
10
|
-
key: import("
|
|
10
|
+
key: import("node_modules/@rsdoctor/types/dist/manifest").RsdoctorManifestMappingKeys;
|
|
11
11
|
};
|
|
12
12
|
}>>;
|
|
13
13
|
export {};
|
|
@@ -6,6 +6,6 @@ export declare const LoaderAnalysis: React.FC<Omit<{
|
|
|
6
6
|
cwd: string;
|
|
7
7
|
}, "cwd"> & Partial<{
|
|
8
8
|
body: {
|
|
9
|
-
key: import("
|
|
9
|
+
key: import("node_modules/@rsdoctor/types/dist/manifest").RsdoctorManifestMappingKeys;
|
|
10
10
|
};
|
|
11
11
|
}>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Typography } from "antd";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { VSCode, openVSCode } from "./
|
|
4
|
+
import { VSCode, openVSCode } from "./ide.mjs";
|
|
5
5
|
import { getShortPath } from "../../utils/index.mjs";
|
|
6
6
|
function parseUrl(url) {
|
|
7
7
|
const strs = url.split(' ');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/Opener/code.mjs","sources":["../../../src/components/Opener/code.tsx"],"sourcesContent":["import { PropsWithChildren } from 'react';\nimport { Typography } from 'antd';\nimport path from 'path';\nimport { VSCode, openVSCode } from './
|
|
1
|
+
{"version":3,"file":"components/Opener/code.mjs","sources":["../../../src/components/Opener/code.tsx"],"sourcesContent":["import { PropsWithChildren } from 'react';\nimport { Typography } from 'antd';\nimport path from 'path';\nimport { VSCode, openVSCode } from './ide';\nimport { getShortPath } from 'src/utils';\n\ninterface CodeOpenerProps {\n windowId?: number;\n /**\n * @example /foo/src/pages/home/index.ts + 100 modules\n * @example /foo/src/pages/b/index.ts\n */\n url: string;\n /**\n * @example 1:0-10\n * @example 1:1\n */\n loc?: string;\n cwd: string;\n label?: string;\n disabled?: boolean;\n code?: boolean;\n}\n\nfunction parseUrl(url: string) {\n const strs = url.split(' ');\n let res = '';\n if (strs.length === 1) {\n [res] = strs;\n } else {\n [res] = strs.filter((e) => path.isAbsolute(e) || e.startsWith('./'));\n }\n\n return res || url;\n}\n\nfunction parseLoc(loc?: string) {\n if (!loc) return { line: 1, column: 1 };\n\n const [line, col = ''] = loc.split(':');\n const [start = 1, end] = col.split('-');\n\n return {\n line,\n columnStart: start,\n columnEnd: end || start,\n };\n}\n\nconst defaultWindowId = +Date.now().toString().slice(-4) + 1000;\n\nexport const CodeOpener = ({\n cwd,\n url,\n loc,\n windowId = defaultWindowId,\n label,\n disabled,\n code = false,\n}: PropsWithChildren<CodeOpenerProps>): JSX.Element | null => {\n const file = path.resolve(cwd, parseUrl(url));\n\n const { line, columnStart } = parseLoc(loc);\n\n return (\n <span style={{ wordBreak: 'break-all' }}>\n <Typography.Text\n copyable={{\n text: file,\n }}\n >\n <Typography.Text\n code={code}\n onClick={() => {\n if (disabled) return;\n openVSCode({ file, line, column: columnStart, windowId });\n }}\n style={{ cursor: disabled ? 'revert' : 'pointer' }}\n >\n {label || getShortPath(url)}\n {loc ? `:${loc}` : ''}\n </Typography.Text>\n </Typography.Text>\n {process.env.NODE_ENV === 'development' ? (\n <VSCode\n file={file}\n line={line}\n column={columnStart}\n windowId={windowId}\n style={{ marginLeft: 3 }}\n />\n ) : (\n <div style={{ display: 'inline-block' }} />\n )}\n {/* TODO implement open cloud ide or codebase by git url + branch + relative filepath in production */}\n </span>\n );\n};\n"],"names":["parseUrl","url","strs","res","e","path","parseLoc","loc","line","col","start","end","defaultWindowId","Date","CodeOpener","cwd","windowId","label","disabled","code","file","columnStart","Typography","openVSCode","getShortPath","process","VSCode"],"mappings":";;;;;AAwBA,SAASA,SAASC,GAAW;IAC3B,MAAMC,OAAOD,IAAI,KAAK,CAAC;IACvB,IAAIE,MAAM;IACV,IAAID,AAAgB,MAAhBA,KAAK,MAAM,EACb,CAACC,IAAI,GAAGD;SAER,CAACC,IAAI,GAAGD,KAAK,MAAM,CAAC,CAACE,IAAMC,KAAK,UAAU,CAACD,MAAMA,EAAE,UAAU,CAAC;IAGhE,OAAOD,OAAOF;AAChB;AAEA,SAASK,SAASC,GAAY;IAC5B,IAAI,CAACA,KAAK,OAAO;QAAE,MAAM;QAAG,QAAQ;IAAE;IAEtC,MAAM,CAACC,MAAMC,MAAM,EAAE,CAAC,GAAGF,IAAI,KAAK,CAAC;IACnC,MAAM,CAACG,QAAQ,CAAC,EAAEC,IAAI,GAAGF,IAAI,KAAK,CAAC;IAEnC,OAAO;QACLD;QACA,aAAaE;QACb,WAAWC,OAAOD;IACpB;AACF;AAEA,MAAME,kBAAkB,CAACC,KAAK,GAAG,GAAG,QAAQ,GAAG,KAAK,CAAC,MAAM;AAEpD,MAAMC,aAAa,CAAC,EACzBC,GAAG,EACHd,GAAG,EACHM,GAAG,EACHS,WAAWJ,eAAe,EAC1BK,KAAK,EACLC,QAAQ,EACRC,OAAO,KAAK,EACuB;IACnC,MAAMC,OAAOf,KAAK,OAAO,CAACU,KAAKf,SAASC;IAExC,MAAM,EAAEO,IAAI,EAAEa,WAAW,EAAE,GAAGf,SAASC;IAEvC,OAAO,WAAP,GACE,KAAC;QAAK,OAAO;YAAE,WAAW;QAAY;;0BACpC,IAACe,WAAW,IAAI;gBACd,UAAU;oBACR,MAAMF;gBACR;0BAEA,mBAACE,WAAW,IAAI;oBACd,MAAMH;oBACN,SAAS;wBACP,IAAID,UAAU;wBACdK,WAAW;4BAAEH;4BAAMZ;4BAAM,QAAQa;4BAAaL;wBAAS;oBACzD;oBACA,OAAO;wBAAE,QAAQE,WAAW,WAAW;oBAAU;;wBAEhDD,SAASO,aAAavB;wBACtBM,MAAM,CAAC,CAAC,EAAEA,KAAK,GAAG;;;;YAGG,kBAAzBkB,QAAQ,GAAG,CAAC,QAAQ,GAAqB,WAAhB,GACxB,IAACC,QAAMA;gBACL,MAAMN;gBACN,MAAMZ;gBACN,QAAQa;gBACR,UAAUL;gBACV,OAAO;oBAAE,YAAY;gBAAE;+BAGzB,IAAC;gBAAI,OAAO;oBAAE,SAAS;gBAAe;;;;AAK9C"}
|
|
@@ -7,5 +7,7 @@ interface VSCodeProps {
|
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
8
|
}
|
|
9
9
|
export declare function openVSCode({ file, line, column, windowId, }: VSCodeProps): void;
|
|
10
|
+
export declare function openCursor({ file, line, column, }: Pick<VSCodeProps, 'file' | 'line' | 'column'>): void;
|
|
11
|
+
export declare function openTrae({ file, line, column, }: Pick<VSCodeProps, 'file' | 'line' | 'column'>): void;
|
|
10
12
|
export declare const VSCode: (props: VSCodeProps) => JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Lodash } from "@rsdoctor/utils/common";
|
|
3
|
+
import "react";
|
|
4
|
+
import vscode from "../../common/svg/vscode.mjs";
|
|
5
|
+
const OPEN_IN_EDITOR_PATH = '/__open-in-editor';
|
|
6
|
+
async function openInEditor(file, line, column, editor, urlSchemeFallback) {
|
|
7
|
+
const fileSpec = `${file}:${line}:${column}`;
|
|
8
|
+
try {
|
|
9
|
+
const base = "u" > typeof window && window.location?.origin ? window.location.origin : '';
|
|
10
|
+
const url = `${base}${OPEN_IN_EDITOR_PATH}?file=${encodeURIComponent(fileSpec)}&editor=${editor}`;
|
|
11
|
+
const res = await fetch(url, {
|
|
12
|
+
method: 'GET'
|
|
13
|
+
});
|
|
14
|
+
if (!res.ok) urlSchemeFallback();
|
|
15
|
+
} catch {
|
|
16
|
+
urlSchemeFallback();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function openVSCode({ file, line = 1, column = 1, windowId }) {
|
|
20
|
+
const query = {
|
|
21
|
+
windowId
|
|
22
|
+
};
|
|
23
|
+
const queryString = Object.keys(query).map((k)=>{
|
|
24
|
+
const v = query[k];
|
|
25
|
+
if (Lodash.isNil(v) || '' === v) return null;
|
|
26
|
+
return `${k}=${v}`;
|
|
27
|
+
}).filter(Boolean).join('&');
|
|
28
|
+
const fallback = ()=>{
|
|
29
|
+
let url = `vscode://file/${file}:${line}:${column}`;
|
|
30
|
+
if (queryString) url += `?${queryString}`;
|
|
31
|
+
window.open(url);
|
|
32
|
+
};
|
|
33
|
+
openInEditor(file, line, column, 'code', fallback);
|
|
34
|
+
}
|
|
35
|
+
function openCursor({ file, line = 1, column = 1 }) {
|
|
36
|
+
const fallback = ()=>{
|
|
37
|
+
window.open(`cursor://file/${file}:${line}:${column}`);
|
|
38
|
+
};
|
|
39
|
+
openInEditor(file, line, column, 'cursor', fallback);
|
|
40
|
+
}
|
|
41
|
+
function openTrae({ file, line = 1, column = 1 }) {
|
|
42
|
+
const fallback = ()=>{
|
|
43
|
+
window.open(`trae://file/${file}:${line}:${column}`);
|
|
44
|
+
};
|
|
45
|
+
openInEditor(file, line, column, 'trae', fallback);
|
|
46
|
+
}
|
|
47
|
+
const VSCode = (props)=>/*#__PURE__*/ jsx(vscode, {
|
|
48
|
+
onClick: ()=>{
|
|
49
|
+
openVSCode(props);
|
|
50
|
+
},
|
|
51
|
+
style: {
|
|
52
|
+
width: 14,
|
|
53
|
+
cursor: 'pointer',
|
|
54
|
+
verticalAlign: 'middle',
|
|
55
|
+
display: 'inline',
|
|
56
|
+
transform: 'translateY(-1.5px)',
|
|
57
|
+
...props.style
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export { VSCode, openCursor, openTrae, openVSCode };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=ide.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components/Opener/ide.mjs","sources":["../../../src/components/Opener/ide.tsx"],"sourcesContent":["import { Lodash } from '@rsdoctor/utils/common';\nimport React from 'react';\nimport VSCodeIcon from '../../common/svg/vscode.svg';\n\ninterface VSCodeProps {\n file: string;\n line?: number | string;\n column?: number | string;\n windowId?: number;\n style?: React.CSSProperties;\n}\n\nconst OPEN_IN_EDITOR_PATH = '/__open-in-editor';\n\ntype EditorKind = 'code' | 'cursor' | 'trae';\n\nasync function openInEditor(\n file: string,\n line: number | string,\n column: number | string,\n editor: EditorKind,\n urlSchemeFallback: () => void,\n) {\n const fileSpec = `${file}:${line}:${column}`;\n try {\n const base =\n typeof window !== 'undefined' && window.location?.origin\n ? window.location.origin\n : '';\n const url = `${base}${OPEN_IN_EDITOR_PATH}?file=${encodeURIComponent(fileSpec)}&editor=${editor}`;\n const res = await fetch(url, { method: 'GET' });\n if (!res.ok) {\n urlSchemeFallback();\n }\n } catch {\n urlSchemeFallback();\n }\n}\n\nexport function openVSCode({\n file,\n line = 1,\n column = 1,\n windowId,\n}: VSCodeProps) {\n const query: Record<string, unknown> = { windowId };\n const queryString = Object.keys(query)\n .map((k) => {\n const v = query[k];\n if (Lodash.isNil(v) || v === '') return null;\n return `${k}=${v}`;\n })\n .filter(Boolean)\n .join('&');\n\n const fallback = () => {\n let url = `vscode://file/${file}:${line}:${column}`;\n if (queryString) url += `?${queryString}`;\n window.open(url);\n };\n\n openInEditor(file, line, column, 'code', fallback);\n}\n\nexport function openCursor({\n file,\n line = 1,\n column = 1,\n}: Pick<VSCodeProps, 'file' | 'line' | 'column'>) {\n const fallback = () => {\n window.open(`cursor://file/${file}:${line}:${column}`);\n };\n openInEditor(file, line, column, 'cursor', fallback);\n}\n\nexport function openTrae({\n file,\n line = 1,\n column = 1,\n}: Pick<VSCodeProps, 'file' | 'line' | 'column'>) {\n const fallback = () => {\n window.open(`trae://file/${file}:${line}:${column}`);\n };\n\n openInEditor(file, line, column, 'trae', fallback);\n}\n\nexport const VSCode = (props: VSCodeProps): JSX.Element => {\n return (\n <VSCodeIcon\n onClick={() => {\n openVSCode(props);\n }}\n style={{\n width: 14,\n cursor: 'pointer',\n verticalAlign: 'middle',\n display: 'inline',\n transform: 'translateY(-1.5px)',\n ...props.style,\n }}\n />\n );\n};\n"],"names":["OPEN_IN_EDITOR_PATH","openInEditor","file","line","column","editor","urlSchemeFallback","fileSpec","base","window","url","encodeURIComponent","res","fetch","openVSCode","windowId","query","queryString","Object","k","v","Lodash","Boolean","fallback","openCursor","openTrae","VSCode","props","VSCodeIcon"],"mappings":";;;;AAYA,MAAMA,sBAAsB;AAI5B,eAAeC,aACbC,IAAY,EACZC,IAAqB,EACrBC,MAAuB,EACvBC,MAAkB,EAClBC,iBAA6B;IAE7B,MAAMC,WAAW,GAAGL,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,QAAQ;IAC5C,IAAI;QACF,MAAMI,OACJ,AAAkB,MAAlB,OAAOC,UAA0BA,OAAO,QAAQ,EAAE,SAC9CA,OAAO,QAAQ,CAAC,MAAM,GACtB;QACN,MAAMC,MAAM,GAAGF,OAAOR,oBAAoB,MAAM,EAAEW,mBAAmBJ,UAAU,QAAQ,EAAEF,QAAQ;QACjG,MAAMO,MAAM,MAAMC,MAAMH,KAAK;YAAE,QAAQ;QAAM;QAC7C,IAAI,CAACE,IAAI,EAAE,EACTN;IAEJ,EAAE,OAAM;QACNA;IACF;AACF;AAEO,SAASQ,WAAW,EACzBZ,IAAI,EACJC,OAAO,CAAC,EACRC,SAAS,CAAC,EACVW,QAAQ,EACI;IACZ,MAAMC,QAAiC;QAAED;IAAS;IAClD,MAAME,cAAcC,OAAO,IAAI,CAACF,OAC7B,GAAG,CAAC,CAACG;QACJ,MAAMC,IAAIJ,KAAK,CAACG,EAAE;QAClB,IAAIE,OAAO,KAAK,CAACD,MAAMA,AAAM,OAANA,GAAU,OAAO;QACxC,OAAO,GAAGD,EAAE,CAAC,EAAEC,GAAG;IACpB,GACC,MAAM,CAACE,SACP,IAAI,CAAC;IAER,MAAMC,WAAW;QACf,IAAIb,MAAM,CAAC,cAAc,EAAER,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,QAAQ;QACnD,IAAIa,aAAaP,OAAO,CAAC,CAAC,EAAEO,aAAa;QACzCR,OAAO,IAAI,CAACC;IACd;IAEAT,aAAaC,MAAMC,MAAMC,QAAQ,QAAQmB;AAC3C;AAEO,SAASC,WAAW,EACzBtB,IAAI,EACJC,OAAO,CAAC,EACRC,SAAS,CAAC,EACoC;IAC9C,MAAMmB,WAAW;QACfd,OAAO,IAAI,CAAC,CAAC,cAAc,EAAEP,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,QAAQ;IACvD;IACAH,aAAaC,MAAMC,MAAMC,QAAQ,UAAUmB;AAC7C;AAEO,SAASE,SAAS,EACvBvB,IAAI,EACJC,OAAO,CAAC,EACRC,SAAS,CAAC,EACoC;IAC9C,MAAMmB,WAAW;QACfd,OAAO,IAAI,CAAC,CAAC,YAAY,EAAEP,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,QAAQ;IACrD;IAEAH,aAAaC,MAAMC,MAAMC,QAAQ,QAAQmB;AAC3C;AAEO,MAAMG,SAAS,CAACC,QACd,WAAP,GACE,IAACC,QAAUA;QACT,SAAS;YACPd,WAAWa;QACb;QACA,OAAO;YACL,OAAO;YACP,QAAQ;YACR,eAAe;YACf,SAAS;YACT,WAAW;YACX,GAAGA,MAAM,KAAK;QAChB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './code.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './ide.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./code.mjs";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./ide.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeViewerProps } from './interface.js';
|
|
2
|
-
export declare function CodeViewer({ className, style, code, lang, filePath, defaultLine, ranges, isEmbed, headerVisible, isLightTheme, }: CodeViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CodeViewer({ className, style, code, lang, filePath, defaultLine, ranges, isEmbed, headerVisible, isLightTheme, formatOnMount, }: CodeViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export type { CodeViewerProps } from './interface.js';
|
|
4
4
|
export { useCodeDrawer } from './useCodeDrawer.js';
|
|
5
5
|
export { defineMonacoOptions } from './utils.js';
|
|
@@ -7,7 +7,7 @@ import { Checkbox } from "antd";
|
|
|
7
7
|
import index_module from "./index.module.mjs";
|
|
8
8
|
import { Lodash } from "@rsdoctor/utils/common";
|
|
9
9
|
import { useCodeDrawer } from "./useCodeDrawer.mjs";
|
|
10
|
-
function CodeViewer({ className, style, code = '', lang, filePath = '', defaultLine, ranges, isEmbed = false, headerVisible = true, isLightTheme = true }) {
|
|
10
|
+
function CodeViewer({ className, style, code = '', lang, filePath = '', defaultLine, ranges, isEmbed = false, headerVisible = true, isLightTheme = true, formatOnMount = false }) {
|
|
11
11
|
const editor = useRef();
|
|
12
12
|
const monaco = useRef();
|
|
13
13
|
const language = useMemo(()=>lang || getFilePathFormat(filePath) || 'plaintext', [
|
|
@@ -27,7 +27,14 @@ function CodeViewer({ className, style, code = '', lang, filePath = '', defaultL
|
|
|
27
27
|
if (Lodash.isNumber(defaultLine)) setTimeout(()=>{
|
|
28
28
|
editorInstance.revealLine(defaultLine);
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
if (formatOnMount) setTimeout(()=>{
|
|
31
|
+
editorInstance.getAction('editor.action.formatDocument')?.run();
|
|
32
|
+
}, 0);
|
|
33
|
+
}, [
|
|
34
|
+
ranges,
|
|
35
|
+
defaultLine,
|
|
36
|
+
formatOnMount
|
|
37
|
+
]);
|
|
31
38
|
const theme = isLightTheme ? 'vs-light' : 'vs-dark';
|
|
32
39
|
useEffect(()=>()=>{
|
|
33
40
|
editor.current?.setModel(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/base/CodeViewer/index.mjs","sources":["../../../../src/components/base/CodeViewer/index.tsx"],"sourcesContent":["import { Editor, Monaco, OnMount } from '@monaco-editor/react';\nimport clsx from 'clsx';\nimport { editor } from 'monaco-editor';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { CodeViewerProps } from './interface';\nimport {\n defineMonacoOptions,\n editorShowRange,\n getFileName,\n getFilePathFormat,\n} from './utils';\n\nimport { Checkbox } from 'antd';\nimport styles from './index.module.scss';\nimport { Lodash } from '@rsdoctor/utils/common';\n\nexport function CodeViewer({\n className,\n style,\n code = '',\n lang,\n filePath = '',\n defaultLine,\n ranges,\n isEmbed = false,\n headerVisible = true,\n isLightTheme = true,\n}: CodeViewerProps) {\n const editor = useRef<editor.IStandaloneCodeEditor>();\n const monaco = useRef<Monaco>();\n const language = useMemo(\n () => lang || getFilePathFormat(filePath) || 'plaintext',\n [lang, filePath],\n );\n const [isWordWrap, setIsWordWrap] = useState(true);\n const options = useMemo(\n () => defineMonacoOptions({ wordWrap: isWordWrap ? 'on' : 'off' }),\n [isWordWrap],\n );\n const onEditorMount = useCallback<OnMount>((editorInstance, monacoVal) => {\n
|
|
1
|
+
{"version":3,"file":"components/base/CodeViewer/index.mjs","sources":["../../../../src/components/base/CodeViewer/index.tsx"],"sourcesContent":["import { Editor, Monaco, OnMount } from '@monaco-editor/react';\nimport clsx from 'clsx';\nimport { editor } from 'monaco-editor';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { CodeViewerProps } from './interface';\nimport {\n defineMonacoOptions,\n editorShowRange,\n getFileName,\n getFilePathFormat,\n} from './utils';\n\nimport { Checkbox } from 'antd';\nimport styles from './index.module.scss';\nimport { Lodash } from '@rsdoctor/utils/common';\n\nexport function CodeViewer({\n className,\n style,\n code = '',\n lang,\n filePath = '',\n defaultLine,\n ranges,\n isEmbed = false,\n headerVisible = true,\n isLightTheme = true,\n formatOnMount = false,\n}: CodeViewerProps) {\n const editor = useRef<editor.IStandaloneCodeEditor>();\n const monaco = useRef<Monaco>();\n const language = useMemo(\n () => lang || getFilePathFormat(filePath) || 'plaintext',\n [lang, filePath],\n );\n const [isWordWrap, setIsWordWrap] = useState(true);\n const options = useMemo(\n () => defineMonacoOptions({ wordWrap: isWordWrap ? 'on' : 'off' }),\n [isWordWrap],\n );\n const onEditorMount = useCallback<OnMount>(\n (editorInstance, monacoVal) => {\n editor.current = editorInstance;\n monaco.current = monacoVal;\n\n editorShowRange(editorInstance, monacoVal, ranges);\n if (Lodash.isNumber(defaultLine)) {\n setTimeout(() => {\n editorInstance.revealLine(defaultLine);\n });\n }\n\n if (formatOnMount) {\n // Use Monaco's built-in formatter to format the whole document\n setTimeout(() => {\n editorInstance.getAction('editor.action.formatDocument')?.run();\n }, 0);\n }\n },\n [ranges, defaultLine, formatOnMount],\n );\n\n const theme = isLightTheme ? 'vs-light' : 'vs-dark';\n\n useEffect(\n () => () => {\n editor.current?.setModel(null);\n },\n [],\n );\n\n return (\n <div\n className={clsx(\n 'monaco-component',\n 'code-viewer',\n styles['code-viewer'],\n isEmbed && styles['embed'],\n className,\n )}\n style={style}\n >\n {headerVisible && Boolean(filePath) && (\n <div className={styles['header']}>\n <div>{getFileName(filePath)}</div>\n <div style={{ flex: 1 }} />\n <div>\n <Checkbox\n className={styles['text']}\n title=\"side-by-side\"\n checked={isWordWrap}\n onChange={(evt) => {\n setIsWordWrap(evt.target.checked);\n }}\n >\n word-wrap\n </Checkbox>\n </div>\n </div>\n )}\n <div className={clsx(styles['content'], 'editor-wrap')}>\n <Editor\n theme={theme}\n language={language}\n value={code}\n options={options}\n onMount={onEditorMount}\n />\n </div>\n </div>\n );\n}\n\nexport type { CodeViewerProps } from './interface';\nexport { useCodeDrawer } from './useCodeDrawer';\nexport { defineMonacoOptions } from './utils';\n"],"names":["CodeViewer","className","style","code","lang","filePath","defaultLine","ranges","isEmbed","headerVisible","isLightTheme","formatOnMount","editor","useRef","monaco","language","useMemo","getFilePathFormat","isWordWrap","setIsWordWrap","useState","options","defineMonacoOptions","onEditorMount","useCallback","editorInstance","monacoVal","editorShowRange","Lodash","setTimeout","theme","useEffect","clsx","styles","Boolean","getFileName","Checkbox","evt","Editor"],"mappings":";;;;;;;;;AAgBO,SAASA,WAAW,EACzBC,SAAS,EACTC,KAAK,EACLC,OAAO,EAAE,EACTC,IAAI,EACJC,WAAW,EAAE,EACbC,WAAW,EACXC,MAAM,EACNC,UAAU,KAAK,EACfC,gBAAgB,IAAI,EACpBC,eAAe,IAAI,EACnBC,gBAAgB,KAAK,EACL;IAChB,MAAMC,SAASC;IACf,MAAMC,SAASD;IACf,MAAME,WAAWC,QACf,IAAMZ,QAAQa,kBAAkBZ,aAAa,aAC7C;QAACD;QAAMC;KAAS;IAElB,MAAM,CAACa,YAAYC,cAAc,GAAGC,SAAS;IAC7C,MAAMC,UAAUL,QACd,IAAMM,oBAAoB;YAAE,UAAUJ,aAAa,OAAO;QAAM,IAChE;QAACA;KAAW;IAEd,MAAMK,gBAAgBC,YACpB,CAACC,gBAAgBC;QACfd,OAAO,OAAO,GAAGa;QACjBX,OAAO,OAAO,GAAGY;QAEjBC,gBAAgBF,gBAAgBC,WAAWnB;QAC3C,IAAIqB,OAAO,QAAQ,CAACtB,cAClBuB,WAAW;YACTJ,eAAe,UAAU,CAACnB;QAC5B;QAGF,IAAIK,eAEFkB,WAAW;YACTJ,eAAe,SAAS,CAAC,iCAAiC;QAC5D,GAAG;IAEP,GACA;QAAClB;QAAQD;QAAaK;KAAc;IAGtC,MAAMmB,QAAQpB,eAAe,aAAa;IAE1CqB,UACE,IAAM;YACJnB,OAAO,OAAO,EAAE,SAAS;QAC3B,GACA,EAAE;IAGJ,OAAO,WAAP,GACE,KAAC;QACC,WAAWoB,KACT,oBACA,eACAC,YAAAA,CAAAA,cAAqB,EACrBzB,WAAWyB,aAAAA,KAAe,EAC1BhC;QAEF,OAAOC;;YAENO,iBAAiByB,QAAQ7B,aAAa,WAAbA,GACxB,KAAC;gBAAI,WAAW4B,aAAAA,MAAgB;;kCAC9B,IAAC;kCAAKE,YAAY9B;;kCAClB,IAAC;wBAAI,OAAO;4BAAE,MAAM;wBAAE;;kCACtB,IAAC;kCACC,kBAAC+B,UAAQA;4BACP,WAAWH,aAAAA,IAAc;4BACzB,OAAM;4BACN,SAASf;4BACT,UAAU,CAACmB;gCACTlB,cAAckB,IAAI,MAAM,CAAC,OAAO;4BAClC;sCACD;;;;;0BAMP,IAAC;gBAAI,WAAWL,KAAKC,aAAAA,OAAiB,EAAE;0BACtC,kBAACK,QAAMA;oBACL,OAAOR;oBACP,UAAUf;oBACV,OAAOZ;oBACP,SAASkB;oBACT,SAASE;;;;;AAKnB"}
|
|
@@ -2,6 +2,8 @@ import { SDK } from '@rsdoctor/types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const BailoutReasonCard: React.FC<{
|
|
4
4
|
reasons?: string[];
|
|
5
|
+
sideEffectCodes?: SDK.SideEffectCodeData[];
|
|
6
|
+
modulePath?: string;
|
|
5
7
|
}>;
|
|
6
8
|
export declare const ModuleFilesTree: React.FC<{
|
|
7
9
|
modules: SDK.ModuleData[];
|