online-compiler-widget 0.0.4 → 1.0.2

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.
Files changed (161) hide show
  1. package/dist/abap-CrvW7_qN.js +1398 -0
  2. package/dist/apex-BAOI8p1v.js +327 -0
  3. package/dist/assets/css.worker-Cb0JI69t.js +93 -0
  4. package/dist/assets/html.worker-BNFZMwEc.js +470 -0
  5. package/dist/assets/json.worker-BCybXpia.js +58 -0
  6. package/dist/assets/ts.worker-DAVh1bw1.js +67731 -0
  7. package/dist/azcli-BlCk_UqW.js +68 -0
  8. package/dist/bat-DPoEelVx.js +100 -0
  9. package/dist/bicep-Cp1F394l.js +102 -0
  10. package/dist/cameligo-CWqtSlQs.js +174 -0
  11. package/dist/clojure-CKBp32Gf.js +761 -0
  12. package/dist/coffee-CDo6vc-J.js +232 -0
  13. package/dist/cpp-DokufPgf.js +389 -0
  14. package/dist/csharp-BQi3szM0.js +326 -0
  15. package/dist/csp-BSGtCCZ-.js +53 -0
  16. package/dist/css-DEPFDJfb.js +187 -0
  17. package/dist/cssMode-nHrB9Mnr.js +141 -0
  18. package/dist/cypher-DAb1vOxS.js +263 -0
  19. package/dist/dart-C8p4jewR.js +281 -0
  20. package/dist/dockerfile-DP0iLFPN.js +130 -0
  21. package/dist/ecl-BDQHA6fi.js +456 -0
  22. package/dist/elixir-D4II6kDM.js +569 -0
  23. package/dist/flow9-StcnL-VB.js +142 -0
  24. package/dist/freemarker2-BoiXdkJM.js +982 -0
  25. package/dist/fsharp-DdUVp3EN.js +217 -0
  26. package/dist/go-D1-I258M.js +218 -0
  27. package/dist/graphql-DWkL3f8U.js +151 -0
  28. package/dist/handlebars-C7PJzkmo.js +412 -0
  29. package/dist/hcl-D_0MNifv.js +183 -0
  30. package/dist/html-D_xe_tUa.js +301 -0
  31. package/dist/htmlMode-Dk_luXu_.js +152 -0
  32. package/dist/index-Ds0EJmOd.js +129200 -0
  33. package/dist/index.js +14 -0
  34. package/dist/ini-C4I2-MT7.js +71 -0
  35. package/dist/java-OBvaP_SS.js +232 -0
  36. package/dist/javascript-CUK67ITD.js +70 -0
  37. package/dist/jsonMode-BIAYTpVF.js +569 -0
  38. package/dist/julia-BmDH8Kkf.js +511 -0
  39. package/dist/kotlin-Dhu5AGOD.js +252 -0
  40. package/dist/less-CzmjXREq.js +162 -0
  41. package/dist/lexon-CV2c4pN9.js +157 -0
  42. package/dist/liquid-Cgsk8EmK.js +233 -0
  43. package/dist/lspLanguageFeatures-HqO1l9Me.js +1458 -0
  44. package/dist/lua-CFY5U8qF.js +162 -0
  45. package/dist/m3-BL_AnZVh.js +210 -0
  46. package/dist/markdown-CWKQPXCv.js +229 -0
  47. package/dist/mdx-QboWmT4M.js +158 -0
  48. package/dist/mips-ButYmJ5E.js +198 -0
  49. package/dist/msdax-C3cnXqDh.js +375 -0
  50. package/dist/mysql-YlSHaf6G.js +878 -0
  51. package/dist/objective-c-Dwnlproe.js +183 -0
  52. package/dist/pascal-UzGbSWEN.js +251 -0
  53. package/dist/pascaligo-CslTgu68.js +164 -0
  54. package/dist/perl-oj6r_mgw.js +626 -0
  55. package/dist/pgsql-DSBO0Mev.js +851 -0
  56. package/dist/php-YzCD--7j.js +500 -0
  57. package/dist/pla-CmylB8vQ.js +137 -0
  58. package/dist/postiats-CLFW5gNY.js +907 -0
  59. package/dist/powerquery-CmOWUvlh.js +890 -0
  60. package/dist/powershell-fHQcmBLK.js +239 -0
  61. package/dist/protobuf-p5BArb-9.js +420 -0
  62. package/dist/pug-gVdUDvqf.js +402 -0
  63. package/dist/python-kIZaMFF7.js +294 -0
  64. package/dist/qsharp-DnrWSUlt.js +301 -0
  65. package/dist/r-Cv309K2z.js +243 -0
  66. package/dist/razor-ms2cCMGp.js +543 -0
  67. package/dist/redis-DTcS4wMj.js +302 -0
  68. package/dist/redshift-hLxZVESM.js +809 -0
  69. package/dist/restructuredtext-C898lK4f.js +174 -0
  70. package/dist/ruby-CgKtnJIQ.js +511 -0
  71. package/dist/rust-bj8oxVnh.js +343 -0
  72. package/dist/sb-DWynz26l.js +115 -0
  73. package/dist/scala-BL5z1UEd.js +370 -0
  74. package/dist/scheme-DUJsH6VU.js +108 -0
  75. package/dist/scss-CxjmhvaL.js +262 -0
  76. package/dist/shell-D14Zs1dF.js +221 -0
  77. package/dist/solidity-WyRm-BGK.js +1367 -0
  78. package/dist/sophia-CKk-_Oa5.js +199 -0
  79. package/dist/sparql-DHtmINMZ.js +201 -0
  80. package/dist/sql-Dqaj5JHC.js +853 -0
  81. package/dist/st-Bj2IIaop.js +416 -0
  82. package/dist/style.css +1 -0
  83. package/dist/swift-DwxP72iM.js +312 -0
  84. package/dist/systemverilog-D7wJfuql.js +576 -0
  85. package/dist/tcl-0ApMt-eC.js +232 -0
  86. package/dist/tsMode-BiXWAJYS.js +946 -0
  87. package/dist/twig-DxwbdmvQ.js +392 -0
  88. package/dist/typescript-ByMmjZ38.js +336 -0
  89. package/dist/typespec-Fd-JwSuS.js +117 -0
  90. package/dist/vb-CxuyYE1I.js +372 -0
  91. package/dist/wgsl-DoEGc31J.js +439 -0
  92. package/dist/xml-iOXTZgNN.js +88 -0
  93. package/dist/yaml-RRlyy-QW.js +199 -0
  94. package/package.json +41 -36
  95. package/FileStorage/obj/FileStorage.csproj.EntityFrameworkCore.targets +0 -28
  96. package/README.md +0 -1
  97. package/eslint.config.js +0 -26
  98. package/index.html +0 -13
  99. package/index.tsx +0 -3
  100. package/openapitools.json +0 -7
  101. package/pnpm-workspace.yaml +0 -2
  102. package/public/vite.svg +0 -1
  103. package/src/App.css +0 -49
  104. package/src/App.tsx +0 -84
  105. package/src/api/.openapi-generator/FILES +0 -25
  106. package/src/api/.openapi-generator/VERSION +0 -1
  107. package/src/api/.openapi-generator-ignore +0 -23
  108. package/src/api/api.ts +0 -1312
  109. package/src/api/base.ts +0 -62
  110. package/src/api/common.ts +0 -113
  111. package/src/api/configuration.ts +0 -121
  112. package/src/api/docs/CompilationError.md +0 -26
  113. package/src/api/docs/CompileRequest.md +0 -22
  114. package/src/api/docs/CompileResult.md +0 -28
  115. package/src/api/docs/CompilerApi.md +0 -263
  116. package/src/api/docs/CreateFileDto.md +0 -22
  117. package/src/api/docs/CreateProjectRequest.md +0 -20
  118. package/src/api/docs/FileApi.md +0 -274
  119. package/src/api/docs/ProcessStatus.md +0 -28
  120. package/src/api/docs/ProjectApi.md +0 -362
  121. package/src/api/docs/ProjectInfo.md +0 -24
  122. package/src/api/docs/ProjectStats.md +0 -28
  123. package/src/api/docs/RenameFileDto.md +0 -20
  124. package/src/api/docs/RenameProjectRequest.md +0 -20
  125. package/src/api/docs/RunRequest.md +0 -24
  126. package/src/api/docs/RunResult.md +0 -30
  127. package/src/api/docs/RunningProjectInfo.md +0 -26
  128. package/src/api/docs/UpdateFileDto.md +0 -20
  129. package/src/api/git_push.sh +0 -57
  130. package/src/api/index.ts +0 -18
  131. package/src/assets/Badge.svg +0 -17
  132. package/src/assets/closeIcon.svg +0 -20
  133. package/src/assets/documentIcon.svg +0 -11
  134. package/src/assets/history.svg +0 -11
  135. package/src/assets/output.svg +0 -12
  136. package/src/assets/plus.svg +0 -20
  137. package/src/assets/react.svg +0 -1
  138. package/src/assets/save-icon.svg +0 -11
  139. package/src/assets/shield.svg +0 -10
  140. package/src/assets/start.svg +0 -11
  141. package/src/assets/stop.svg +0 -11
  142. package/src/components/CompilerWidget.module.scss +0 -169
  143. package/src/components/CompilerWidget.tsx +0 -331
  144. package/src/components/FileExplorer.module.scss +0 -372
  145. package/src/components/FileExplorer.tsx +0 -285
  146. package/src/components/MonacoEditorWrapper.module.scss +0 -29
  147. package/src/components/MonacoEditorWrapper.tsx +0 -74
  148. package/src/components/OutputPanel.module.scss +0 -123
  149. package/src/components/OutputPanel.tsx +0 -53
  150. package/src/components/RunContainer.module.scss +0 -150
  151. package/src/components/RunContainer.tsx +0 -34
  152. package/src/hooks/useCompiler.ts +0 -228
  153. package/src/hooks/useInitialNodes.ts +0 -0
  154. package/src/index.css +0 -78
  155. package/src/main.tsx +0 -8
  156. package/src/types/EditorDocument.ts +0 -8
  157. package/swagger.json +0 -1020
  158. package/tsconfig.app.json +0 -29
  159. package/tsconfig.json +0 -7
  160. package/tsconfig.node.json +0 -26
  161. package/vite.config.ts +0 -8
@@ -1,331 +0,0 @@
1
- // src/components/CompilerWidget.tsx
2
- import React, { memo, useState, useEffect, useRef, useLayoutEffect } from 'react';
3
- import { Handle, Position, NodeResizer, useReactFlow } from '@xyflow/react';
4
- import { FileExplorer } from './FileExplorer';
5
- import { MonacoEditorWrapper } from './MonacoEditorWrapper';
6
- import { OutputPanel } from './OutputPanel';
7
- import cls from './CompilerWidget.module.scss';
8
- import { useCompiler } from '../hooks/useCompiler';
9
-
10
- import type { EditorDocument } from '../types/EditorDocument';
11
- import { RunContainer } from "./RunContainer.tsx";
12
-
13
- const ShieldIcon = () => (
14
- <svg viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg">
15
- <g clip-path="url(#clip0_167_86)">
16
- <path d="M6.86666 4.46333C6.86666 6.18 5.66499 7.03833 4.23672 7.53616C4.16193 7.56151 4.08069 7.56029 4.00669 7.53273C2.57499 7.03833 1.37332 6.18 1.37332 4.46333V2.06C1.37332 1.96894 1.40949 1.88161 1.47388 1.81722C1.53827 1.75284 1.6256 1.71666 1.71665 1.71666C2.40332 1.71666 3.26165 1.30466 3.85906 0.782796C3.93179 0.720652 4.02432 0.686508 4.11999 0.686508C4.21566 0.686508 4.30819 0.720652 4.38092 0.782796C4.98176 1.3081 5.83666 1.71666 6.52332 1.71666C6.61438 1.71666 6.70171 1.75284 6.7661 1.81722C6.83048 1.88161 6.86666 1.96894 6.86666 2.06V4.46333Z" stroke="#0A0A0A" stroke-width="0.686667" stroke-linecap="round" stroke-linejoin="round" />
17
- </g>
18
- <defs>
19
- <clipPath id="clip0_167_86">
20
- <rect width="8.24" height="8.24" fill="white" />
21
- </clipPath>
22
- </defs>
23
- </svg>
24
- );
25
-
26
- const BadgeIcon = () => (
27
- <svg viewBox="0 0 30 11" fill="none" xmlns="http://www.w3.org/2000/svg">
28
- <mask id="path-1-inside-1_167_88" fill="white">
29
- <path d="M0 4.12C0 1.84459 1.84459 0 4.12 0H25.8788C28.1542 0 29.9988 1.84459 29.9988 4.12V6.18C29.9988 8.45541 28.1542 10.3 25.8788 10.3H4.11999C1.84458 10.3 0 8.45541 0 6.18V4.12Z" />
30
- </mask>
31
- <path d="M0 4.12C0 1.84459 1.84459 0 4.12 0H25.8788C28.1542 0 29.9988 1.84459 29.9988 4.12V6.18C29.9988 8.45541 28.1542 10.3 25.8788 10.3H4.11999C1.84458 10.3 0 8.45541 0 6.18V4.12Z" fill="#DCFCE7" />
32
- <path d="M4.12 0V0.343333H25.8788V0V-0.343333H4.12V0ZM29.9988 4.12H29.6554V6.18H29.9988H30.3421V4.12H29.9988ZM25.8788 10.3V9.95667H4.11999V10.3V10.6433H25.8788V10.3ZM0 6.18H0.343333V4.12H0H-0.343333V6.18H0ZM4.11999 10.3V9.95667C2.0342 9.95667 0.343333 8.2658 0.343333 6.18H0H-0.343333C-0.343333 8.64503 1.65496 10.6433 4.11999 10.6433V10.3ZM29.9988 6.18H29.6554C29.6554 8.26579 27.9645 9.95667 25.8788 9.95667V10.3V10.6433C28.3438 10.6433 30.3421 8.64503 30.3421 6.18H29.9988ZM25.8788 0V0.343333C27.9646 0.343333 29.6554 2.0342 29.6554 4.12H29.9988H30.3421C30.3421 1.65497 28.3438 -0.343333 25.8788 -0.343333V0ZM4.12 0V-0.343333C1.65497 -0.343333 -0.343333 1.65497 -0.343333 4.12H0H0.343333C0.343333 2.03421 2.0342 0.343333 4.12 0.343333V0Z" fill="black" fill-opacity="0.1" mask="url(#path-1-inside-1_167_88)" />
33
- <g clip-path="url(#clip0_167_88)">
34
- <path d="M8.58329 2.06H6.17995C5.99784 2.06 5.82318 2.13234 5.69441 2.26112C5.56563 2.38989 5.49329 2.56455 5.49329 2.74666V7.55333C5.49329 7.73545 5.56563 7.9101 5.69441 8.03888C5.82318 8.16765 5.99784 8.24 6.17995 8.24H10.9866C11.1687 8.24 11.3434 8.16765 11.4722 8.03888C11.6009 7.9101 11.6733 7.73545 11.6733 7.55333V5.15" stroke="#008236" stroke-width="0.686667" stroke-linecap="round" stroke-linejoin="round" />
35
- <path d="M10.772 1.93126C10.9086 1.79467 11.0939 1.71794 11.287 1.71794C11.4802 1.71794 11.6655 1.79467 11.802 1.93126C11.9386 2.06785 12.0154 2.2531 12.0154 2.44626C12.0154 2.63942 11.9386 2.82467 11.802 2.96126L8.70758 6.05607C8.62606 6.13752 8.52534 6.19715 8.41472 6.22945L7.42832 6.51785C7.39878 6.52647 7.36746 6.52698 7.33765 6.51935C7.30784 6.51171 7.28063 6.4962 7.25887 6.47444C7.23711 6.45268 7.2216 6.42547 7.21396 6.39566C7.20632 6.36584 7.20684 6.33453 7.21545 6.30499L7.50385 5.31859C7.53631 5.20805 7.59605 5.10746 7.67758 5.02607L10.772 1.93126Z" stroke="#008236" stroke-width="0.686667" stroke-linecap="round" stroke-linejoin="round" />
36
- </g>
37
- <path d="M15.2522 6.515V2.09123H18.4508V2.61327H15.8376V3.96816H18.2848V4.48719H15.8376V5.99296H18.5534V6.515H15.2522ZM21.3718 6.515V6.11064C21.1686 6.4285 20.8699 6.58742 20.4756 6.58742C20.2201 6.58742 19.9847 6.51701 19.7695 6.37619C19.5562 6.23537 19.3903 6.03923 19.2716 5.78776C19.1549 5.53429 19.0965 5.24359 19.0965 4.91568C19.0965 4.59582 19.1499 4.30613 19.2565 4.04662C19.3631 3.7851 19.523 3.58493 19.7363 3.44612C19.9495 3.30731 20.1879 3.23791 20.4514 3.23791C20.6446 3.23791 20.8166 3.27915 20.9674 3.36163C21.1183 3.4421 21.241 3.54771 21.3356 3.67848V2.09123H21.8757V6.515H21.3718ZM19.6548 4.91568C19.6548 5.32607 19.7413 5.63286 19.9143 5.83604C20.0873 6.03923 20.2915 6.14082 20.5269 6.14082C20.7643 6.14082 20.9654 6.04426 21.1304 5.85113C21.2974 5.656 21.3809 5.35927 21.3809 4.96095C21.3809 4.52239 21.2964 4.20052 21.1274 3.99532C20.9584 3.79013 20.7502 3.68753 20.5027 3.68753C20.2613 3.68753 20.0592 3.7861 19.8962 3.98325C19.7353 4.1804 19.6548 4.49121 19.6548 4.91568ZM22.7357 2.71587V2.09123H23.2789V2.71587H22.7357ZM22.7357 6.515V3.31033H23.2789V6.515H22.7357ZM25.2947 6.02917L25.3731 6.50896C25.2202 6.54115 25.0834 6.55725 24.9627 6.55725C24.7656 6.55725 24.6127 6.52606 24.504 6.4637C24.3954 6.40134 24.319 6.31986 24.2747 6.21928C24.2305 6.11668 24.2083 5.90243 24.2083 5.57653V3.73279H23.81V3.31033H24.2083V2.51671L24.7485 2.19081V3.31033H25.2947V3.73279H24.7485V5.60671C24.7485 5.76161 24.7575 5.86119 24.7756 5.90545C24.7957 5.94971 24.8269 5.98491 24.8692 6.01106C24.9134 6.03722 24.9758 6.05029 25.0563 6.05029C25.1166 6.05029 25.1961 6.04325 25.2947 6.02917Z" fill="#008236" />
38
- <defs>
39
- <clipPath id="clip0_167_88">
40
- <rect width="8.24" height="8.24" fill="white" transform="translate(4.46329 1.03001)" />
41
- </clipPath>
42
- </defs>
43
- </svg>
44
- );
45
-
46
- const CloseIcon = () => (
47
- <svg
48
- viewBox="0 0 9 9"
49
- fill="none"
50
- xmlns="http://www.w3.org/2000/svg"
51
- >
52
- <path
53
- d="M6.18 2.05998L2.06 6.17998"
54
- stroke="#0A0A0A"
55
- stroke-width="0.686667"
56
- stroke-linecap="round"
57
- stroke-linejoin="round"
58
- />
59
- <path
60
- d="M2.06 2.05998L6.18 6.17998"
61
- stroke="#0A0A0A"
62
- stroke-width="0.686667"
63
- stroke-linecap="round"
64
- stroke-linejoin="round"
65
- />
66
- </svg>
67
- );
68
-
69
- interface GetInfoModel {
70
- "widgetId": number,
71
- "userId": number,
72
- "role": string,
73
- "config": string, // json
74
- "board": {
75
- "id": number,
76
- "name": string,
77
- "parentId": number
78
- }
79
- }
80
-
81
- interface ConfigModel {
82
- // ... то, как мы будем общаться с потребителем
83
- }
84
-
85
- interface CompilerWidgetProps {
86
- id: string;
87
- data?: {
88
- initialFiles?: Record<string, string>;
89
- language?: 'csharp' | 'js';
90
- };
91
- setNodeHeight?: (id: string, height: number) => void;
92
- getInfo?: (info: GetInfoModel) => void;
93
- }
94
-
95
- const CompilerWidget: React.FC<CompilerWidgetProps> = ({ id, data, setNodeHeight }) => {
96
- const {
97
- documents,
98
- selectedDocument,
99
- selectedId,
100
- setSelectedId,
101
- setDocumentContent,
102
- addDocument,
103
- deleteDocument,
104
- updateDocument,
105
- output,
106
- history,
107
- run,
108
- stop,
109
- saveAll
110
- } = useCompiler(
111
- data?.initialFiles || {
112
- 'Program.cs': '// Write your code here\nConsole.WriteLine("Hello, World!");',
113
- }
114
- );
115
-
116
- // useReactFlow мы оставляем, но НЕ полагаемся на updateNodeDimensions — вызываем опционально
117
- const rf = useReactFlow();
118
- const maybeUpdateNodeDimensions = (nodeId: string) => {
119
- if (rf && typeof (rf as any).updateNodeDimensions === 'function') {
120
- try {
121
- (rf as any).updateNodeDimensions(nodeId);
122
- } catch {
123
- // игнорируем ошибки — основной механизм через setNodeHeight
124
- }
125
- }
126
- };
127
-
128
- const currentDocument: EditorDocument | null = selectedDocument ?? (documents[0] ?? null);
129
- const currentCode = currentDocument?.content ?? '';
130
- const currentLanguage =
131
- currentDocument?.language ??
132
- (data?.language === 'js' ? 'javascript' : 'csharp');
133
-
134
- // panel widths
135
- const [leftWidth, setLeftWidth] = useState(180);
136
- const [rightWidth, setRightWidth] = useState(220);
137
-
138
- const [collapsed, setCollapsed] = useState(false);
139
-
140
- const handleCodeChange = (newCode: string) => {
141
- if (currentDocument) {
142
- setDocumentContent(currentDocument.id, newCode);
143
- }
144
- };
145
-
146
- // Обработчик переименования файла
147
- const handleRename = (id: string, newName: string) => {
148
- const doc = documents.find(d => d.id === id);
149
- if (!doc || newName === doc.name) return;
150
-
151
- updateDocument(id, {
152
- name: newName
153
- });
154
- };
155
-
156
- const containerRef = useRef<HTMLDivElement | null>(null);
157
- const resizeObserverRef = useRef<ResizeObserver | null>(null);
158
-
159
- // Синхронизировать высоту ноды при изменении контейнера
160
- useLayoutEffect(() => {
161
- if (!containerRef.current || !setNodeHeight) return;
162
-
163
- // initial set
164
- const rect = containerRef.current.getBoundingClientRect();
165
- const initialHeight = collapsed ? 42 : Math.round(rect.height);
166
- setNodeHeight(id, initialHeight);
167
- maybeUpdateNodeDimensions(id);
168
-
169
- // Создаём ResizeObserver, если доступен
170
- const ro = new ResizeObserver((entries) => {
171
- for (const entry of entries) {
172
- if (entry.target === containerRef.current) {
173
- const h = collapsed ? 42 : Math.round(entry.contentRect.height);
174
- setNodeHeight(id, h);
175
- // опционально форсируем перерисовку XYFlow (если API доступен)
176
- maybeUpdateNodeDimensions(id);
177
- }
178
- }
179
- });
180
-
181
- resizeObserverRef.current = ro;
182
- ro.observe(containerRef.current);
183
-
184
- return () => {
185
- ro.disconnect();
186
- resizeObserverRef.current = null;
187
- };
188
- // eslint-disable-next-line react-hooks/exhaustive-deps
189
- }, [id, setNodeHeight, collapsed]);
190
-
191
- useEffect(() => {
192
- // при смене collapsed форсируем одноразовый пересчёт (на случай, если ResizeObserver не сработал моментально)
193
- if (!containerRef.current || !setNodeHeight) return;
194
- const h = collapsed ? 42 : Math.round(containerRef.current.getBoundingClientRect().height);
195
- setNodeHeight(id, h);
196
- maybeUpdateNodeDimensions(id);
197
- // eslint-disable-next-line react-hooks/exhaustive-deps
198
- }, [collapsed]);
199
-
200
- const toggleCollapsed = () => setCollapsed(prev => !prev);
201
-
202
- // Manual panel resizing: убираем прямые вызовы updateNodeDimensions, теперь ResizeObserver всё подхватит
203
- const startResizing = (
204
- e: React.MouseEvent,
205
- setter: (v: number) => void,
206
- startWidth: number,
207
- direction: "left" | "right",
208
- min = 120,
209
- max = 1000
210
- ) => {
211
- e.preventDefault();
212
- e.stopPropagation();
213
-
214
- const startX = e.clientX;
215
-
216
- const onMove = (ev: MouseEvent) => {
217
- const dx = ev.clientX - startX;
218
- const newWidth = direction === "left" ? startWidth + dx : startWidth - dx;
219
- setter(Math.min(Math.max(newWidth, min), max));
220
- // НЕ вызываем updateNodeDimensions здесь — ResizeObserver увидит изменение размеров DOM и обновит ноду
221
- };
222
-
223
- const onUp = () => {
224
- window.removeEventListener('mousemove', onMove);
225
- window.removeEventListener('mouseup', onUp);
226
- };
227
-
228
- window.addEventListener('mousemove', onMove);
229
- window.addEventListener('mouseup', onUp);
230
- };
231
-
232
- return (
233
- <div
234
- ref={containerRef}
235
- className={`${cls.widget} ${collapsed ? cls.collapsed : ''}`}
236
- >
237
- <Handle type="target" position={Position.Top} />
238
-
239
- {/* GLOBAL NodeResizer (xyflow) — виден только если не collapsed */}
240
- {!collapsed && (
241
- <NodeResizer
242
- minWidth={600}
243
- minHeight={300}
244
- // Некоторые версии NodeResizer поддержуют onResize/onResizeEnd, некоторые — нет.
245
- // Мы полагаемся на ResizeObserver для синхронизации высоты, так что не обязаны использовать коллбэки.
246
- />
247
- )}
248
-
249
- {/* HEADER */}
250
- <div className="drag-handle__custom">
251
- <div className={cls.header}>
252
- <h4>Code Block</h4>
253
-
254
- <div className={cls.shieldContainer}>
255
- <ShieldIcon className={cls.shield} />
256
- <BadgeIcon className={cls.badge} />
257
- </div>
258
-
259
- <button className={cls.closeButton} onClick={toggleCollapsed}>
260
- {collapsed ? (
261
- <svg width="16" height="16" viewBox="0 0 16 16">
262
- <path d="M4 8h8M8 4v8" stroke="currentColor" strokeWidth="2" />
263
- </svg>
264
- ) : (
265
- <CloseIcon className={cls.close} />
266
- )}
267
- </button>
268
- </div>
269
- </div>
270
-
271
- {/* BODY */}
272
- {!collapsed && (
273
- <div className={cls.body}>
274
- {/* LEFT PANEL */}
275
- <div className={cls.panel} style={{ width: leftWidth }}>
276
- <FileExplorer
277
- documents={documents}
278
- selectedId={selectedId}
279
- onSelect={setSelectedId}
280
- onAdd={addDocument}
281
- onRename={handleRename} // Используем inline-редактирование
282
- onDelete={deleteDocument}
283
- />
284
-
285
- <div
286
- className={cls.resizer}
287
- onMouseDown={(e) =>
288
- startResizing(e, setLeftWidth, leftWidth, "left")
289
- }
290
- />
291
- </div>
292
-
293
- {/* CENTER */}
294
- <div className={cls.centerPanel}>
295
- {currentDocument ? (
296
- <div className={cls.editCont}>
297
- <MonacoEditorWrapper
298
- code={currentCode}
299
- language={currentLanguage}
300
- onChange={handleCodeChange}
301
- theme="vs-light"
302
- />
303
- <RunContainer run={run} stop={stop} save={saveAll} />
304
- </div>
305
- ) : (
306
- <div style={{ padding: 16, color: '#666' }}>
307
- Нет открытого документа
308
- </div>
309
- )}
310
- </div>
311
-
312
- {/* RIGHT */}
313
- <div className={cls.panel} style={{ width: rightWidth }}>
314
- <OutputPanel output={output} history={history} />
315
-
316
- <div
317
- className={cls.resizer}
318
- onMouseDown={(e) =>
319
- startResizing(e, setRightWidth, rightWidth, "right")
320
- }
321
- />
322
- </div>
323
- </div>
324
- )}
325
-
326
- <Handle type="source" position={Position.Bottom} />
327
- </div>
328
- );
329
- };
330
-
331
- export default memo(CompilerWidget);
@@ -1,372 +0,0 @@
1
- $file-bg: #f5f5f5;
2
- $file-border: #ddd;
3
- $file-selected: #d0eaff;
4
-
5
- .fileExplorer {
6
- width: auto;
7
- background: #F8FAFC;
8
- border-right: 1px solid $file-border;
9
- display: flex;
10
- flex-direction: column;
11
- height: 100%;
12
- width: auto;
13
-
14
- .header {
15
- padding: 6px 7px;
16
- display: flex;
17
- justify-content: start;
18
- align-items: center;
19
- background: #F1F5F9;
20
- border-bottom: 1px solid #E2E8F0;
21
- min-height: 21px;
22
-
23
- span {
24
- font-family: Arial;
25
- font-weight: 400;
26
- font-size: 6.18px;
27
- margin-right: 1.7px;
28
- align-items: center;
29
- }
30
-
31
- .documentIcon{
32
- height: 12px;
33
- margin-right: 1.5px;
34
-
35
- svg {
36
- height: 100%;
37
- width: auto;
38
- display: block;
39
- }
40
- }
41
-
42
- button {
43
- all: unset;
44
- cursor: pointer;
45
- display: inline-flex;
46
- align-items: center;
47
- justify-content: center;
48
- padding: 0;
49
- margin: 0;
50
- outline: none;
51
- }
52
-
53
- .addButton {
54
- height: auto;
55
- margin-left: auto;
56
- .plusIcon {
57
- height: 13px;
58
- }
59
-
60
- &:hover {
61
- opacity: 0.8;
62
- }
63
- }
64
- }
65
-
66
- .fileList {
67
- list-style: none;
68
- margin: 0;
69
- padding: 0;
70
- overflow-y: auto;
71
- flex-grow: 1;
72
- padding: 4.12px;
73
-
74
- .fileItem {
75
- padding: 3.74px 4.12px;
76
- cursor: pointer;
77
- display: flex;
78
- align-items: center;
79
- gap: 4.12px;
80
- transition: background 0.1s;
81
- position: relative;
82
- border-radius: 2px;
83
-
84
- &:hover {
85
- background: #e9e9e9;
86
- }
87
-
88
- &.selected {
89
- background: #DBEAFE;
90
- }
91
-
92
- &.modified {
93
- .modifiedDot {
94
- display: inline-block;
95
- }
96
- }
97
-
98
- .fileIcon {
99
- font-size: 7px;
100
- margin-right: 3px;
101
- flex-shrink: 0;
102
- }
103
-
104
- .nameContainer {
105
- display: flex;
106
- align-items: center;
107
- gap: 4px;
108
- flex: 1;
109
- min-width: 0;
110
- }
111
-
112
- .itemText {
113
- font-size: 7px;
114
- font-family: sans-serif;
115
- color: #1C398E;
116
- align-items: center;
117
- white-space: nowrap;
118
- overflow: hidden;
119
- text-overflow: ellipsis;
120
- flex: 1;
121
- line-height: 14px;
122
- padding: 0;
123
- margin: 0;
124
- }
125
-
126
- .modifiedDot {
127
- display: none;
128
- color: #ff6b6b;
129
- font-size: 12px;
130
- flex-shrink: 0;
131
- animation: pulse 2s infinite;
132
-
133
- &:hover {
134
- color: #ff5252;
135
- }
136
- }
137
-
138
- .editContainer {
139
- flex: 1;
140
- min-width: 0;
141
- }
142
- }
143
- }
144
- }
145
-
146
- @keyframes pulse {
147
- 0% {
148
- opacity: 1;
149
- }
150
- 50% {
151
- opacity: 0.5;
152
- }
153
- 100% {
154
- opacity: 1;
155
- }
156
- }
157
-
158
- .moreBtn {
159
- margin-left: auto;
160
- background: none;
161
- border: none;
162
- font-size: 12px;
163
- padding: 2px 6px;
164
- cursor: pointer;
165
- opacity: 0.6;
166
- outline: none;
167
- border-radius: 3px;
168
- flex-shrink: 0;
169
-
170
- &:hover {
171
- opacity: 1;
172
- background: rgba(0, 0, 0, 0.05);
173
- }
174
- }
175
-
176
- .clickZone {
177
- display: flex;
178
- align-items: center;
179
- flex-grow: 1;
180
- gap: 4px;
181
- min-width: 0;
182
- padding: 0;
183
- margin: 0;
184
- }
185
-
186
- .contextMenu {
187
- position: absolute;
188
- right: 4px;
189
- top: 28px;
190
- background: #F1F5F9;
191
- border: 1px solid #444;
192
- border-radius: 4px;
193
- padding: 4px 0;
194
- min-width: 140px;
195
- z-index: 100;
196
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
197
- }
198
-
199
- .menuItem {
200
- padding: 6px 10px;
201
- cursor: pointer;
202
- white-space: nowrap;
203
- font-size: 14px;
204
-
205
- &:hover {
206
- background: #DBEAFE;
207
- }
208
- }
209
-
210
- // СТИЛИ ДЛЯ INPUT ПРИ РЕДАКТИРОВАНИИ
211
- .editInput {
212
- flex: 1;
213
- min-width: 0;
214
- background: #ffffff;
215
- border: 1px solid #0078d4;
216
- border-radius: 2px;
217
- padding: 0 2px;
218
- margin: 0;
219
- font-size: 7px;
220
- font-family: sans-serif;
221
- color: #1C398E;
222
- outline: none;
223
- height: 14px;
224
- line-height: 12px;
225
- box-sizing: border-box;
226
- width: 100%;
227
- max-width: 100%;
228
-
229
- &:focus {
230
- border-color: #0078d4;
231
- box-shadow: 0 0 0 1px rgba(0, 120, 212, 0.3);
232
- }
233
- }
234
-
235
- // Состояние редактирования - скрываем кнопку меню
236
- .fileItem:has(.editInput) {
237
- .moreBtn {
238
- display: none;
239
- }
240
-
241
- &:hover {
242
- background: transparent;
243
- }
244
-
245
- .clickZone {
246
- cursor: default;
247
- }
248
- }
249
-
250
- // СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА
251
- .modalOverlay {
252
- position: fixed;
253
- top: 0;
254
- left: 0;
255
- right: 0;
256
- bottom: 0;
257
- background: rgba(0, 0, 0, 0.5);
258
- display: flex;
259
- align-items: center;
260
- justify-content: center;
261
- z-index: 1000;
262
- }
263
-
264
- .modalContent {
265
- background: white;
266
- padding: 24px;
267
- border-radius: 8px;
268
- min-width: 320px;
269
- max-width: 400px;
270
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
271
-
272
- h3 {
273
- margin: 0 0 20px 0;
274
- font-size: 16px;
275
- font-weight: 600;
276
- color: #333;
277
- text-align: center;
278
- }
279
- }
280
-
281
- .formGroup {
282
- margin-bottom: 16px;
283
-
284
- label {
285
- display: block;
286
- margin-bottom: 6px;
287
- font-size: 13px;
288
- font-weight: 500;
289
- color: #555;
290
- }
291
-
292
- input {
293
- width: 100%;
294
- padding: 10px 12px;
295
- border: 1px solid #ddd;
296
- border-radius: 4px;
297
- font-size: 14px;
298
- box-sizing: border-box;
299
- transition: border-color 0.2s, box-shadow 0.2s;
300
-
301
- &:focus {
302
- outline: none;
303
- border-color: #0078d4;
304
- box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
305
- }
306
-
307
- &.error {
308
- border-color: #d32f2f;
309
-
310
- &:focus {
311
- border-color: #d32f2f;
312
- box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.1);
313
- }
314
- }
315
- }
316
-
317
- .helpText {
318
- font-size: 12px;
319
- color: #666;
320
- margin-top: 4px;
321
- margin-bottom: 8px;
322
- }
323
-
324
- .errorMessage {
325
- color: #d32f2f;
326
- font-size: 12px;
327
- margin-top: 4px;
328
- font-weight: 500;
329
- }
330
- }
331
-
332
- .modalActions {
333
- display: flex;
334
- justify-content: flex-end;
335
- gap: 12px;
336
- margin-top: 24px;
337
-
338
- button {
339
- padding: 10px 20px;
340
- border: none;
341
- border-radius: 4px;
342
- cursor: pointer;
343
- font-size: 14px;
344
- font-weight: 500;
345
- transition: all 0.2s;
346
- min-width: 80px;
347
-
348
- &.cancelBtn {
349
- background: #f5f5f5;
350
- color: #333;
351
-
352
- &:hover {
353
- background: #e9e9e9;
354
- }
355
- }
356
-
357
- &.confirmBtn {
358
- background: #0078d4;
359
- color: white;
360
-
361
- &:hover:not(:disabled) {
362
- background: #106ebe;
363
- }
364
-
365
- &:disabled {
366
- background: #ccc;
367
- cursor: not-allowed;
368
- opacity: 0.6;
369
- }
370
- }
371
- }
372
- }