@rsdoctor/components 0.4.4 → 0.4.5
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
2
|
+
import { useContext, useEffect } from "react";
|
|
3
3
|
import { FloatButton, Layout as L } from "antd";
|
|
4
4
|
import { MAIN_BG, Size } from "../../constants";
|
|
5
5
|
import { Header } from "./header";
|
|
6
6
|
import { useLocale, useI18n } from "../../utils";
|
|
7
7
|
import { Progress } from "./progress";
|
|
8
|
+
import { ConfigContext } from "../../config";
|
|
8
9
|
const Layout = (props) => {
|
|
9
10
|
const locale = useLocale();
|
|
10
11
|
const { i18n } = useI18n();
|
|
@@ -14,13 +15,20 @@ const Layout = (props) => {
|
|
|
14
15
|
i18n.changeLanguage(locale);
|
|
15
16
|
}
|
|
16
17
|
}, [locale]);
|
|
18
|
+
const ctx = useContext(ConfigContext);
|
|
17
19
|
return /* @__PURE__ */ jsxs(L, { children: [
|
|
18
|
-
/* @__PURE__ */ jsx(Header, {}),
|
|
20
|
+
!ctx.embedded ? /* @__PURE__ */ jsx(Header, {}) : null,
|
|
19
21
|
/* @__PURE__ */ jsx(Progress, {}),
|
|
20
22
|
/* @__PURE__ */ jsxs(
|
|
21
23
|
L.Content,
|
|
22
24
|
{
|
|
23
|
-
style: {
|
|
25
|
+
style: {
|
|
26
|
+
height: "100%",
|
|
27
|
+
minHeight: "100vh",
|
|
28
|
+
padding: Size.BasePadding,
|
|
29
|
+
marginTop: !ctx.embedded ? Size.NavBarHeight : 0,
|
|
30
|
+
background: MAIN_BG
|
|
31
|
+
},
|
|
24
32
|
children: [
|
|
25
33
|
children,
|
|
26
34
|
/* @__PURE__ */ jsx(FloatButton.BackTop, {})
|
package/dist/config.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface Config {
|
|
|
13
13
|
setManifest(json: Manifest.RsdoctorManifest): void;
|
|
14
14
|
setPageState(state: PageState): void;
|
|
15
15
|
setViewMode(mode: Partial<Config['viewMode']>, saveStorage?: boolean): void;
|
|
16
|
+
embedded?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare const defaultConfig: Config;
|
|
18
19
|
export declare const ConfigContext: import("react").Context<Config>;
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getLocaleFromStorage,
|
|
4
|
+
getThemeFromStorage,
|
|
5
|
+
getViewModeFromStorage
|
|
6
|
+
} from "./utils/storage";
|
|
3
7
|
import { PageState } from "./constants";
|
|
4
8
|
const defaultConfig = {
|
|
5
9
|
locale: getLocaleFromStorage(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, ModuleGraph, Statement } from '@rsdoctor/graph';
|
|
2
2
|
import type { editor } from 'monaco-editor';
|
|
3
|
-
export declare function useFileStructures(modules: Module[], moduleGraph: ModuleGraph, searchInput: string, selectedModule: Module, onItemClick: (file: string) => void, cwd: string): import("
|
|
3
|
+
export declare function useFileStructures(modules: Module[], moduleGraph: ModuleGraph, searchInput: string, selectedModule: Module, onItemClick: (file: string) => void, cwd: string): import("../..").DataNode[];
|
|
4
4
|
export declare function getTreeFilesDefaultExpandedKeys(files: any[]): (string | number)[];
|
|
5
5
|
export declare function ellipsisPath(full: string): string;
|
|
6
6
|
export declare function getModulePositionString(statement: Statement, module: Module): string;
|
package/dist/utils/data/local.js
CHANGED
|
@@ -41,9 +41,10 @@ class LocalServerDataLoader extends BaseDataLoader {
|
|
|
41
41
|
async loadAPI(...args) {
|
|
42
42
|
const [api, body] = args;
|
|
43
43
|
const key = body ? `${api}_${JSON.stringify(body)}` : `${api}`;
|
|
44
|
+
const socketUrl = this.get("__SOCKET__URL__") ?? "";
|
|
44
45
|
return this.limit(key, async () => {
|
|
45
46
|
return new Promise((resolve) => {
|
|
46
|
-
getSocket().emit(
|
|
47
|
+
getSocket(socketUrl).emit(
|
|
47
48
|
api,
|
|
48
49
|
body,
|
|
49
50
|
(res) => {
|
package/dist/utils/socket.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Socket } from 'socket.io-client';
|
|
2
|
-
export declare function getSocket(): Socket;
|
|
2
|
+
export declare function getSocket(socketUrl?: string): Socket;
|
package/dist/utils/socket.js
CHANGED
|
@@ -6,14 +6,14 @@ function ensureSocket(socketUrl = defaultSocketUrl) {
|
|
|
6
6
|
if (!map.has(socketUrl)) {
|
|
7
7
|
const socket = io(socketUrl, {});
|
|
8
8
|
socket.on("connect", () => {
|
|
9
|
-
console.log(`
|
|
9
|
+
console.log(`Socket Connect ${socketUrl}`);
|
|
10
10
|
});
|
|
11
11
|
map.set(socketUrl, socket);
|
|
12
12
|
}
|
|
13
13
|
return map.get(socketUrl);
|
|
14
14
|
}
|
|
15
|
-
function getSocket() {
|
|
16
|
-
const socket = ensureSocket(defaultSocketUrl);
|
|
15
|
+
function getSocket(socketUrl) {
|
|
16
|
+
const socket = ensureSocket(socketUrl || defaultSocketUrl);
|
|
17
17
|
return socket;
|
|
18
18
|
}
|
|
19
19
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/components",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@types/lodash-es": "4.17.12",
|
|
50
50
|
"@types/node": "^16",
|
|
51
51
|
"@types/path-browserify": "1.0.3",
|
|
52
|
-
"@types/react": "^18.3.
|
|
52
|
+
"@types/react": "^18.3.8",
|
|
53
53
|
"@types/react-highlight-words": "^0.20.0",
|
|
54
54
|
"@types/url-parse": "1.4.11",
|
|
55
55
|
"ansi-to-react": "6.1.6",
|
|
56
56
|
"antd": "5.15.3",
|
|
57
|
-
"axios": "^1.7.
|
|
57
|
+
"axios": "^1.7.7",
|
|
58
58
|
"dayjs": "1.11.13",
|
|
59
59
|
"echarts": "^5.5.1",
|
|
60
60
|
"echarts-for-react": "^3.0.2",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"react-markdown": "^9.0.1",
|
|
73
73
|
"react-router-dom": "6.4.3",
|
|
74
74
|
"socket.io-client": "4.6.1",
|
|
75
|
-
"terser": "^5.
|
|
75
|
+
"terser": "^5.33.0",
|
|
76
76
|
"typescript": "^5.2.2",
|
|
77
77
|
"url-parse": "1.5.10",
|
|
78
|
-
"@rsdoctor/graph": "0.4.
|
|
79
|
-
"@rsdoctor/types": "0.4.
|
|
80
|
-
"@rsdoctor/utils": "0.4.
|
|
78
|
+
"@rsdoctor/graph": "0.4.5",
|
|
79
|
+
"@rsdoctor/types": "0.4.5",
|
|
80
|
+
"@rsdoctor/utils": "0.4.5"
|
|
81
81
|
},
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public",
|