superleap-code-editor 1.0.0
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/README.md +356 -0
- package/dist/components/codeEditorWrapper.d.ts +30 -0
- package/dist/components/codeEditorWrapper.d.ts.map +1 -0
- package/dist/components/editor/codeEditor.d.ts +12 -0
- package/dist/components/editor/codeEditor.d.ts.map +1 -0
- package/dist/components/layout/editorLayout.d.ts +11 -0
- package/dist/components/layout/editorLayout.d.ts.map +1 -0
- package/dist/components/layout/header.d.ts +9 -0
- package/dist/components/layout/header.d.ts.map +1 -0
- package/dist/components/layout/sidebar.d.ts +8 -0
- package/dist/components/layout/sidebar.d.ts.map +1 -0
- package/dist/components/panels/dataExplorer.d.ts +3 -0
- package/dist/components/panels/dataExplorer.d.ts.map +1 -0
- package/dist/components/panels/fileExplorer.d.ts +13 -0
- package/dist/components/panels/fileExplorer.d.ts.map +1 -0
- package/dist/components/panels/functionLibrary.d.ts +3 -0
- package/dist/components/panels/functionLibrary.d.ts.map +1 -0
- package/dist/components/panels/previewPanel.d.ts +7 -0
- package/dist/components/panels/previewPanel.d.ts.map +1 -0
- package/dist/components/panels/testRunner.d.ts +3 -0
- package/dist/components/panels/testRunner.d.ts.map +1 -0
- package/dist/components/panels/versionHistory.d.ts +3 -0
- package/dist/components/panels/versionHistory.d.ts.map +1 -0
- package/dist/examples/codeEditorExamples.d.ts +6 -0
- package/dist/examples/codeEditorExamples.d.ts.map +1 -0
- package/dist/hooks/useFileManager.d.ts +14 -0
- package/dist/hooks/useFileManager.d.ts.map +1 -0
- package/dist/index.cjs.js +22 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +847 -0
- package/dist/providers/fileProviders.d.ts +36 -0
- package/dist/providers/fileProviders.d.ts.map +1 -0
- package/dist/types/fileTypes.d.ts +48 -0
- package/dist/types/fileTypes.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CodeEditorConfig, FileNode, FileProvider } from "../types/fileTypes";
|
|
2
|
+
export declare class WorkflowFileProvider implements FileProvider {
|
|
3
|
+
private config;
|
|
4
|
+
private files;
|
|
5
|
+
constructor(config: CodeEditorConfig["workflowConfig"]);
|
|
6
|
+
getFiles(): Promise<FileNode[]>;
|
|
7
|
+
getFileContent(fileId: string): Promise<string>;
|
|
8
|
+
updateFileContent(fileId: string, content: string): Promise<void>;
|
|
9
|
+
getFileMetadata(fileId: string): Promise<FileNode["metadata"]>;
|
|
10
|
+
private loadFiles;
|
|
11
|
+
private findFileById;
|
|
12
|
+
}
|
|
13
|
+
export declare class FormFileProvider implements FileProvider {
|
|
14
|
+
private config;
|
|
15
|
+
private files;
|
|
16
|
+
constructor(config: CodeEditorConfig["formConfig"]);
|
|
17
|
+
getFiles(): Promise<FileNode[]>;
|
|
18
|
+
getFileContent(fileId: string): Promise<string>;
|
|
19
|
+
updateFileContent(fileId: string, content: string): Promise<void>;
|
|
20
|
+
getFileMetadata(fileId: string): Promise<FileNode["metadata"]>;
|
|
21
|
+
private initializeFiles;
|
|
22
|
+
private findFileById;
|
|
23
|
+
}
|
|
24
|
+
export declare class URLFileProvider implements FileProvider {
|
|
25
|
+
private config;
|
|
26
|
+
private files;
|
|
27
|
+
constructor(config: CodeEditorConfig["urlConfig"]);
|
|
28
|
+
getFiles(): Promise<FileNode[]>;
|
|
29
|
+
getFileContent(fileId: string): Promise<string>;
|
|
30
|
+
updateFileContent(fileId: string, content: string): Promise<void>;
|
|
31
|
+
getFileMetadata(fileId: string): Promise<FileNode["metadata"]>;
|
|
32
|
+
private initializeFiles;
|
|
33
|
+
private findFileById;
|
|
34
|
+
}
|
|
35
|
+
export declare function createFileProvider(config: CodeEditorConfig): FileProvider;
|
|
36
|
+
//# sourceMappingURL=fileProviders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileProviders.d.ts","s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M,EAAE,gBAAgB,CAAC,WAAW,CAAC;IAK3C,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAI/B,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkB/C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjE,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAKpE,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,YAAY;CAGrB;AAGD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY,CAUzE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface FileNode {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
type: "file" | "folder";
|
|
5
|
+
path: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
children?: FileNode[];
|
|
8
|
+
metadata?: {
|
|
9
|
+
size?: number;
|
|
10
|
+
lastModified?: Date;
|
|
11
|
+
language?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface FileProvider {
|
|
16
|
+
getFiles(): Promise<FileNode[]>;
|
|
17
|
+
getFileContent(fileId: string): Promise<string>;
|
|
18
|
+
updateFileContent(fileId: string, content: string): Promise<void>;
|
|
19
|
+
getFileMetadata(fileId: string): Promise<FileNode["metadata"]>;
|
|
20
|
+
}
|
|
21
|
+
export interface CodeEditorConfig {
|
|
22
|
+
workflowConfig?: {
|
|
23
|
+
functionId: string;
|
|
24
|
+
version: string;
|
|
25
|
+
versionList: string[];
|
|
26
|
+
fetchFunction: (functionId: string, version: string) => Promise<string>;
|
|
27
|
+
fetchVersionList: (functionId: string) => Promise<string[]>;
|
|
28
|
+
};
|
|
29
|
+
formConfig?: {
|
|
30
|
+
codeContent: string;
|
|
31
|
+
fileName?: string;
|
|
32
|
+
language?: string;
|
|
33
|
+
};
|
|
34
|
+
urlConfig?: {
|
|
35
|
+
fileUrls: Array<{
|
|
36
|
+
url: string;
|
|
37
|
+
name: string;
|
|
38
|
+
type: "js" | "css" | "html" | "json" | "ts" | "jsx" | "tsx";
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
settings?: {
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
autoSave?: boolean;
|
|
44
|
+
theme?: string;
|
|
45
|
+
fontSize?: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=fileTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTypes.d.ts","sourceRoot":"","sources":["../../src/types/fileTypes.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,IAAI,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAGD,MAAM,WAAW,YAAY;IAC3B,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;CAChE;AAGD,MAAM,WAAW,gBAAgB;IAE/B,cAAc,CAAC,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QACxE,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;KAC7D,CAAC;IAGF,UAAU,CAAC,EAAE;QACX,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IAGF,SAAS,CAAC,EAAE;QACV,QAAQ,EAAE,KAAK,CAAC;YACd,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;SAC7D,CAAC,CAAC;KACJ,CAAC;IAGF,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "superleap-code-editor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A flexible, reusable code editor component with multiple file handling modes",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.esm.js",
|
|
16
|
+
"require": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./styles": "./dist/style.css"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "vite",
|
|
22
|
+
"build": "npm run build:lib && npm run build:types",
|
|
23
|
+
"build:lib": "vite build --mode library",
|
|
24
|
+
"build:types": "tsc --project tsconfig.lib.json",
|
|
25
|
+
"build:demo": "vite build",
|
|
26
|
+
"lint": "eslint .",
|
|
27
|
+
"preview": "vite preview",
|
|
28
|
+
"clean": "rm -rf dist dist-demo",
|
|
29
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
30
|
+
"pack": "npm pack --dry-run"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"react",
|
|
34
|
+
"code-editor",
|
|
35
|
+
"monaco-editor",
|
|
36
|
+
"antd",
|
|
37
|
+
"typescript",
|
|
38
|
+
"file-explorer",
|
|
39
|
+
"workflow",
|
|
40
|
+
"form",
|
|
41
|
+
"url"
|
|
42
|
+
],
|
|
43
|
+
"author": "SuperLeap",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/superleap/code-editor.git"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/superleap/code-editor/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/superleap/code-editor#readme",
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": ">=18.0.0",
|
|
55
|
+
"react-dom": ">=18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@monaco-editor/react": "^4.7.0",
|
|
59
|
+
"@tabler/icons-react": "^3.34.1",
|
|
60
|
+
"antd": "^5.27.3"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@eslint/js": "^9.33.0",
|
|
64
|
+
"@types/react": "^19.1.10",
|
|
65
|
+
"@types/react-dom": "^19.1.7",
|
|
66
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
67
|
+
"eslint": "^9.33.0",
|
|
68
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
69
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
70
|
+
"globals": "^16.3.0",
|
|
71
|
+
"typescript": "~5.8.3",
|
|
72
|
+
"typescript-eslint": "^8.39.1",
|
|
73
|
+
"vite": "^7.1.2",
|
|
74
|
+
"vite-plugin-dts": "^4.3.0",
|
|
75
|
+
"vite-plugin-lib-inject-css": "^1.3.0",
|
|
76
|
+
"react": "^19.1.1",
|
|
77
|
+
"react-dom": "^19.1.1",
|
|
78
|
+
"tailwindcss": "^4.1.13",
|
|
79
|
+
"@tailwindcss/vite": "^4.1.13"
|
|
80
|
+
}
|
|
81
|
+
}
|