online-compiler-widget 0.0.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.
- package/FileStorage/obj/FileStorage.csproj.EntityFrameworkCore.targets +28 -0
- package/README.md +1 -0
- package/eslint.config.js +26 -0
- package/index.html +13 -0
- package/openapitools.json +7 -0
- package/package.json +36 -0
- package/pnpm-workspace.yaml +2 -0
- package/public/vite.svg +1 -0
- package/src/App.css +49 -0
- package/src/App.tsx +84 -0
- package/src/api/.openapi-generator/FILES +25 -0
- package/src/api/.openapi-generator/VERSION +1 -0
- package/src/api/.openapi-generator-ignore +23 -0
- package/src/api/api.ts +1312 -0
- package/src/api/base.ts +62 -0
- package/src/api/common.ts +113 -0
- package/src/api/configuration.ts +121 -0
- package/src/api/docs/CompilationError.md +26 -0
- package/src/api/docs/CompileRequest.md +22 -0
- package/src/api/docs/CompileResult.md +28 -0
- package/src/api/docs/CompilerApi.md +263 -0
- package/src/api/docs/CreateFileDto.md +22 -0
- package/src/api/docs/CreateProjectRequest.md +20 -0
- package/src/api/docs/FileApi.md +274 -0
- package/src/api/docs/ProcessStatus.md +28 -0
- package/src/api/docs/ProjectApi.md +362 -0
- package/src/api/docs/ProjectInfo.md +24 -0
- package/src/api/docs/ProjectStats.md +28 -0
- package/src/api/docs/RenameFileDto.md +20 -0
- package/src/api/docs/RenameProjectRequest.md +20 -0
- package/src/api/docs/RunRequest.md +24 -0
- package/src/api/docs/RunResult.md +30 -0
- package/src/api/docs/RunningProjectInfo.md +26 -0
- package/src/api/docs/UpdateFileDto.md +20 -0
- package/src/api/git_push.sh +57 -0
- package/src/api/index.ts +18 -0
- package/src/assets/Badge.svg +17 -0
- package/src/assets/closeIcon.svg +20 -0
- package/src/assets/documentIcon.svg +11 -0
- package/src/assets/history.svg +11 -0
- package/src/assets/output.svg +12 -0
- package/src/assets/plus.svg +20 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/save-icon.svg +11 -0
- package/src/assets/shield.svg +10 -0
- package/src/assets/start.svg +11 -0
- package/src/assets/stop.svg +11 -0
- package/src/components/CompilerWidget.module.scss +169 -0
- package/src/components/CompilerWidget.tsx +279 -0
- package/src/components/FileExplorer.module.scss +372 -0
- package/src/components/FileExplorer.tsx +285 -0
- package/src/components/MonacoEditorWrapper.module.scss +29 -0
- package/src/components/MonacoEditorWrapper.tsx +74 -0
- package/src/components/OutputPanel.module.scss +123 -0
- package/src/components/OutputPanel.tsx +53 -0
- package/src/components/RunContainer.module.scss +150 -0
- package/src/components/RunContainer.tsx +34 -0
- package/src/hooks/useCompiler.ts +228 -0
- package/src/hooks/useInitialNodes.ts +0 -0
- package/src/index.css +78 -0
- package/src/main.tsx +7 -0
- package/src/types/EditorDocument.ts +8 -0
- package/swagger.json +1020 -0
- package/tsconfig.app.json +29 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +8 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<Target Name="GetEFProjectMetadata">
|
|
4
|
+
<MSBuild Condition=" '$(TargetFramework)' == '' "
|
|
5
|
+
Projects="$(MSBuildProjectFile)"
|
|
6
|
+
Targets="GetEFProjectMetadata"
|
|
7
|
+
Properties="TargetFramework=$(TargetFrameworks.Split(';')[0]);EFProjectMetadataFile=$(EFProjectMetadataFile)" />
|
|
8
|
+
<ItemGroup Condition=" '$(TargetFramework)' != '' ">
|
|
9
|
+
<EFProjectMetadata Include="AssemblyName: $(AssemblyName)" />
|
|
10
|
+
<EFProjectMetadata Include="Language: $(Language)" />
|
|
11
|
+
<EFProjectMetadata Include="OutputPath: $(OutputPath)" />
|
|
12
|
+
<EFProjectMetadata Include="Platform: $(Platform)" />
|
|
13
|
+
<EFProjectMetadata Include="PlatformTarget: $(PlatformTarget)" />
|
|
14
|
+
<EFProjectMetadata Include="ProjectAssetsFile: $(ProjectAssetsFile)" />
|
|
15
|
+
<EFProjectMetadata Include="ProjectDir: $(ProjectDir)" />
|
|
16
|
+
<EFProjectMetadata Include="RootNamespace: $(RootNamespace)" />
|
|
17
|
+
<EFProjectMetadata Include="RuntimeFrameworkVersion: $(RuntimeFrameworkVersion)" />
|
|
18
|
+
<EFProjectMetadata Include="TargetFileName: $(TargetFileName)" />
|
|
19
|
+
<EFProjectMetadata Include="TargetFrameworkMoniker: $(TargetFrameworkMoniker)" />
|
|
20
|
+
<EFProjectMetadata Include="Nullable: $(Nullable)" />
|
|
21
|
+
<EFProjectMetadata Include="TargetFramework: $(TargetFramework)" />
|
|
22
|
+
<EFProjectMetadata Include="TargetPlatformIdentifier: $(TargetPlatformIdentifier)" />
|
|
23
|
+
</ItemGroup>
|
|
24
|
+
<WriteLinesToFile Condition=" '$(TargetFramework)' != '' "
|
|
25
|
+
File="$(EFProjectMetadataFile)"
|
|
26
|
+
Lines="@(EFProjectMetadata)" />
|
|
27
|
+
</Target>
|
|
28
|
+
</Project>
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Online compiler widget
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
import {defineConfig, globalIgnores} from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat.recommended,
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
indent: [4, 2]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
])
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>compilerwidgetclient</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "online-compiler-widget",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "tsc -b && vite build",
|
|
8
|
+
"lint": "eslint .",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@monaco-editor/react": "^4.7.0",
|
|
13
|
+
"@xyflow/react": "^12.10.0",
|
|
14
|
+
"monaco-editor": "^0.55.1",
|
|
15
|
+
"react": "^19.2.0",
|
|
16
|
+
"react-dom": "^19.2.0",
|
|
17
|
+
"uuid": "^13.0.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@eslint/js": "^9.39.1",
|
|
21
|
+
"@openapitools/openapi-generator-cli": "^2.25.2",
|
|
22
|
+
"@types/node": "^24.10.0",
|
|
23
|
+
"@types/react": "^19.2.7",
|
|
24
|
+
"@types/react-dom": "^19.2.3",
|
|
25
|
+
"@vitejs/plugin-react": "^5.1.0",
|
|
26
|
+
"eslint": "^9.39.1",
|
|
27
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
28
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
29
|
+
"globals": "^16.5.0",
|
|
30
|
+
"sass": "^1.94.2",
|
|
31
|
+
"typescript": "~5.9.3",
|
|
32
|
+
"typescript-eslint": "^8.46.3",
|
|
33
|
+
"vite": "^7.2.2",
|
|
34
|
+
"vite-plugin-svgr": "^4.5.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/public/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/src/App.css
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#root {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#app {
|
|
9
|
+
width: 100vw;
|
|
10
|
+
height: 100vh;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.logo {
|
|
14
|
+
height: 6em;
|
|
15
|
+
padding: 1.5em;
|
|
16
|
+
will-change: filter;
|
|
17
|
+
transition: filter 300ms;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.logo:hover {
|
|
21
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.logo.react:hover {
|
|
25
|
+
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes logo-spin {
|
|
29
|
+
from {
|
|
30
|
+
transform: rotate(0deg);
|
|
31
|
+
}
|
|
32
|
+
to {
|
|
33
|
+
transform: rotate(360deg);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
38
|
+
a:nth-of-type(2) .logo {
|
|
39
|
+
animation: logo-spin infinite 20s linear;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.card {
|
|
44
|
+
padding: 2em;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.read-the-docs {
|
|
48
|
+
color: #888;
|
|
49
|
+
}
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useState, useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ReactFlow,
|
|
4
|
+
Controls,
|
|
5
|
+
Background,
|
|
6
|
+
BackgroundVariant,
|
|
7
|
+
applyNodeChanges,
|
|
8
|
+
applyEdgeChanges
|
|
9
|
+
} from "@xyflow/react";
|
|
10
|
+
import type { Node, Edge, NodeTypes } from "@xyflow/react"; // <— тут правильно
|
|
11
|
+
import "@xyflow/react/dist/style.css";
|
|
12
|
+
import CompilerWidget from "./components/CompilerWidget";
|
|
13
|
+
import { CompilerApi, FileApi, ProjectApi } from "./api";
|
|
14
|
+
|
|
15
|
+
const initialNodes: Node[] = [
|
|
16
|
+
{
|
|
17
|
+
id: "1",
|
|
18
|
+
type: "compiler",
|
|
19
|
+
position: { x: 100, y: 100 },
|
|
20
|
+
dragHandle: ".drag-handle__custom",
|
|
21
|
+
data: {
|
|
22
|
+
initialFiles: {
|
|
23
|
+
"ConsoleApp.csproj":
|
|
24
|
+
'<Project Sdk="Microsoft.NET.Sdk">\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net8.0</TargetFramework>\n </PropertyGroup>\n</Project>',
|
|
25
|
+
"Program.cs":
|
|
26
|
+
'using System;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine("Hello from compiled C#!");\n Console.WriteLine($"Current time: {DateTime.Now}");\n }\n }\n}'
|
|
27
|
+
},
|
|
28
|
+
language: "csharp"
|
|
29
|
+
},
|
|
30
|
+
style: {
|
|
31
|
+
width: 700,
|
|
32
|
+
height: 400
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const initialEdges: Edge[] = [];
|
|
38
|
+
|
|
39
|
+
export default function App() {
|
|
40
|
+
const fileApi = new FileApi();
|
|
41
|
+
const projectApi = new ProjectApi();
|
|
42
|
+
const compilerApi = new CompilerApi();
|
|
43
|
+
|
|
44
|
+
const [nodes, setNodes] = useState<Node[]>(initialNodes);
|
|
45
|
+
const [edges, setEdges] = useState<Edge[]>(initialEdges);
|
|
46
|
+
|
|
47
|
+
const setNodeHeight = (id: string, height: number) => {
|
|
48
|
+
setNodes(nds =>
|
|
49
|
+
nds.map(n =>
|
|
50
|
+
n.id === id ? { ...n, style: { ...n.style, height } } : n
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// типизация через NodeTypes
|
|
56
|
+
const nodeTypes: NodeTypes = useMemo(
|
|
57
|
+
() => ({
|
|
58
|
+
compiler: (props) => <CompilerWidget {...props} setNodeHeight={setNodeHeight} />
|
|
59
|
+
}),
|
|
60
|
+
[]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
65
|
+
<ReactFlow
|
|
66
|
+
nodes={nodes}
|
|
67
|
+
edges={edges}
|
|
68
|
+
nodeTypes={nodeTypes}
|
|
69
|
+
onNodesChange={(changes) =>
|
|
70
|
+
setNodes((nds) => applyNodeChanges(changes, nds))
|
|
71
|
+
}
|
|
72
|
+
onEdgesChange={(changes) =>
|
|
73
|
+
setEdges((eds) => applyEdgeChanges(changes, eds))
|
|
74
|
+
}
|
|
75
|
+
fitView
|
|
76
|
+
minZoom={0.2}
|
|
77
|
+
maxZoom={4}
|
|
78
|
+
>
|
|
79
|
+
<Background variant={BackgroundVariant.Dots} />
|
|
80
|
+
<Controls />
|
|
81
|
+
</ReactFlow>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.npmignore
|
|
3
|
+
api.ts
|
|
4
|
+
base.ts
|
|
5
|
+
common.ts
|
|
6
|
+
configuration.ts
|
|
7
|
+
docs/CompilationError.md
|
|
8
|
+
docs/CompileRequest.md
|
|
9
|
+
docs/CompileResult.md
|
|
10
|
+
docs/CompilerApi.md
|
|
11
|
+
docs/CreateFileDto.md
|
|
12
|
+
docs/CreateProjectRequest.md
|
|
13
|
+
docs/FileApi.md
|
|
14
|
+
docs/ProcessStatus.md
|
|
15
|
+
docs/ProjectApi.md
|
|
16
|
+
docs/ProjectInfo.md
|
|
17
|
+
docs/ProjectStats.md
|
|
18
|
+
docs/RenameFileDto.md
|
|
19
|
+
docs/RenameProjectRequest.md
|
|
20
|
+
docs/RunRequest.md
|
|
21
|
+
docs/RunResult.md
|
|
22
|
+
docs/RunningProjectInfo.md
|
|
23
|
+
docs/UpdateFileDto.md
|
|
24
|
+
git_push.sh
|
|
25
|
+
index.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7.17.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# OpenAPI Generator Ignore
|
|
2
|
+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
|
+
|
|
4
|
+
# Use this file to prevent files from being overwritten by the generator.
|
|
5
|
+
# The patterns follow closely to .gitignore or .dockerignore.
|
|
6
|
+
|
|
7
|
+
# As an example, the C# client generator defines ApiClient.cs.
|
|
8
|
+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
9
|
+
#ApiClient.cs
|
|
10
|
+
|
|
11
|
+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
12
|
+
#foo/*/qux
|
|
13
|
+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
14
|
+
|
|
15
|
+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
16
|
+
#foo/**/qux
|
|
17
|
+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
18
|
+
|
|
19
|
+
# You can also negate patterns with an exclamation (!).
|
|
20
|
+
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
21
|
+
#docs/*.md
|
|
22
|
+
# Then explicitly reverse the ignore rule for a single file:
|
|
23
|
+
#!docs/README.md
|