添加图形化界面撤销、复制、粘贴、删除等功能

This commit is contained in:
ljz committed 2026-07-15 15:03:27 +08:00
1 parent 3217048a9d
commit c52266ba11
4 files changed
+1582 -125

No files matched your search

+10
View File
@@ -9,6 +9,7 @@
"version": "0.1.0",
"dependencies": {
"@xyflow/react": "^12.11.2",
"lucide-react": "^1.24.0",
"react": "^19.2.7",
"react-dom": "^19.2.7"
},
@@ -1287,6 +1288,15 @@
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lucide-react": {
"version": "1.24.0",
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.24.0.tgz",
"integrity": "sha512-YT6mBD8lGKkg4nM39enlm94/sfJIiW0YKUT60fBy4YK8tai31ylg1VhGNWxkpSKHo9UagfnZqwIff3HTDQwXeA==",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/nanoid": {
"version": "3.3.15",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",
+1
View File
@@ -10,6 +10,7 @@
},
"dependencies": {
"@xyflow/react": "^12.11.2",
"lucide-react": "^1.24.0",
"react": "^19.2.7",
"react-dom": "^19.2.7"
},
+1252 -122
View File
File diff suppressed because it is too large. Load diff
+319 -3
View File
@@ -20,13 +20,14 @@ body,
button,
input,
select,
textarea {
font: inherit;
}
.app-shell {
display: grid;
grid-template-rows: 72px minmax(0, 1fr);
grid-template-rows: auto 42px minmax(0, 1fr);
width: 100%;
height: 100%;
}
@@ -36,7 +37,8 @@ textarea {
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 0 14px;
min-height: 72px;
padding: 8px 14px;
border-bottom: 1px solid #cfd8e3;
background: #ffffff;
}
@@ -60,6 +62,24 @@ textarea {
gap: 8px;
}
.save-indicator {
min-width: 112px;
color: #64748b;
font-size: 11px;
text-align: center;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.primary-button,
.secondary-button {
height: 32px;
@@ -104,6 +124,106 @@ textarea {
color: #1f2933;
}
.editor-toolbar {
position: relative;
z-index: 20;
display: flex;
align-items: center;
gap: 7px;
min-width: 0;
padding: 5px 12px;
overflow: visible;
border-bottom: 1px solid #cfd8e3;
background: #f5f7f9;
}
.toolbar-group {
display: flex;
align-items: center;
gap: 3px;
}
.toolbar-separator {
width: 1px;
height: 22px;
background: #cbd3dd;
}
.toolbar-item {
position: relative;
display: inline-flex;
}
.toolbar-item::after {
position: absolute;
top: calc(100% + 7px);
left: 50%;
z-index: 50;
padding: 5px 7px;
border: 1px solid #aeb8c5;
border-radius: 4px;
color: #ffffff;
background: #263442;
box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
content: attr(data-tooltip);
font-size: 11px;
font-weight: 500;
letter-spacing: 0;
line-height: 1;
opacity: 0;
pointer-events: none;
transform: translate(-50%, -2px);
transition: opacity 120ms ease, transform 120ms ease;
white-space: nowrap;
}
.toolbar-item:hover::after,
.toolbar-item:focus-within::after {
opacity: 1;
transform: translate(-50%, 0);
}
.editor-tool-button {
display: grid;
place-items: center;
width: 30px;
height: 30px;
padding: 0;
border: 1px solid transparent;
border-radius: 4px;
color: #344252;
background: transparent;
cursor: pointer;
}
.editor-tool-button:hover:not(:disabled) {
border-color: #bcc7d4;
color: #17212b;
background: #ffffff;
}
.editor-tool-button:focus-visible {
outline: 2px solid #1d6fb8;
outline-offset: 1px;
}
.editor-tool-button:disabled {
color: #9ba6b2;
cursor: not-allowed;
opacity: 0.62;
}
.editor-tool-button.active {
border-color: #1d6fb8;
color: #155a94;
background: #dceefa;
box-shadow: inset 0 0 0 1px rgba(29, 111, 184, 0.08);
}
.editor-tool-button.accent:not(.active) {
color: #26724a;
}
.workbench {
display: grid;
grid-template-columns: 230px minmax(0, 1fr) 330px;
@@ -191,6 +311,70 @@ textarea {
background: #f8fafc;
}
.component-drag-preview {
position: fixed;
top: -1000px;
left: -1000px;
z-index: -1;
display: grid;
grid-template-rows: 30px 12px;
place-items: center;
width: 72px;
height: 58px;
padding: 5px 6px 4px;
border: 1px solid #7c8998;
border-radius: 5px;
color: #1f2933;
background: #ffffff;
box-shadow: 0 2px 5px rgba(15, 23, 42, 0.16);
pointer-events: none;
}
.component-drag-preview .palette-icon {
width: 28px;
height: 28px;
border-width: 1.5px;
}
.component-drag-preview .icon-pipe {
width: 34px;
height: 10px;
}
.component-drag-preview .icon-orifice {
width: 22px;
height: 22px;
}
.component-drag-preview .icon-tee {
width: 30px;
height: 28px;
}
.component-drag-preview .icon-tee::before {
top: 10px;
width: 30px;
height: 8px;
border-width: 1.5px;
}
.component-drag-preview .icon-tee::after {
left: 10px;
width: 8px;
height: 28px;
border-width: 1.5px;
}
.component-drag-preview-label {
max-width: 60px;
overflow: hidden;
font-size: 9px;
font-weight: 650;
line-height: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.icon-cylinder {
border-radius: 13px;
background: #dbeafe;
@@ -241,11 +425,44 @@ textarea {
}
.flow-canvas {
position: relative;
min-width: 0;
min-height: 0;
background: #f8fafc;
}
.recovery-banner button {
min-width: 48px;
height: 28px;
padding: 0 8px;
border: 1px solid #c2ccda;
border-radius: 4px;
color: #263442;
background: #ffffff;
cursor: pointer;
}
.recovery-banner {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 9px;
border: 1px solid #d5a52e;
border-radius: 6px;
color: #713f12;
background: #fffbeb;
box-shadow: 0 2px 8px rgba(120, 53, 15, 0.12);
font-size: 12px;
font-weight: 650;
}
.recovery-banner button {
min-width: 42px;
border-color: #d5a52e;
color: #713f12;
background: #ffffff;
}
.flow-canvas .react-flow__pane,
.flow-canvas .react-flow__pane.selection,
.flow-canvas .react-flow__node.selectable,
@@ -279,6 +496,16 @@ textarea {
box-shadow: 0 0 0 3px rgba(29, 111, 184, 0.15);
}
.react-flow__node.validation-error .sim-node {
border-color: #c63b32;
box-shadow: 0 0 0 3px rgba(198, 59, 50, 0.14);
}
.react-flow__node.validation-warning .sim-node {
border-color: #c08a16;
box-shadow: 0 0 0 3px rgba(192, 138, 22, 0.14);
}
.node-symbol {
height: 28px;
}
@@ -378,13 +605,40 @@ textarea {
font-weight: 400;
}
.field input {
.field input,
.field select {
width: 100%;
height: 34px;
padding: 0 9px;
border: 1px solid #c2ccda;
border-radius: 6px;
color: #1f2933;
background: #ffffff;
}
.field select {
padding: 0 7px;
}
.parameter-control {
display: grid;
grid-template-columns: minmax(0, 1fr) 76px;
gap: 6px;
}
.parameter-control.unitless {
grid-template-columns: minmax(0, 1fr);
}
.field.invalid input,
.field.invalid select {
border-color: #c63b32;
}
.field-error {
color: #b42318;
font-size: 11px;
font-weight: 500;
}
.node-id {
@@ -400,6 +654,68 @@ textarea {
font-size: 13px;
}
.validation-section {
padding: 10px 12px;
border-bottom: 1px solid #e3e8ef;
background: #fffdf9;
}
.validation-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 8px;
font-size: 12px;
}
.validation-heading span {
color: #9a6700;
font-size: 11px;
font-weight: 500;
}
.validation-list {
display: grid;
gap: 6px;
}
.validation-item {
display: grid;
grid-template-columns: 36px minmax(0, 1fr);
gap: 7px;
align-items: start;
width: 100%;
padding: 7px;
border: 1px solid #e5c0bd;
border-radius: 5px;
color: #7a271a;
text-align: left;
background: #fff7f6;
cursor: pointer;
}
.validation-item.warning {
border-color: #ead59a;
color: #713f12;
background: #fffbeb;
}
.validation-item:disabled {
cursor: default;
}
.validation-item span {
font-size: 10px;
font-weight: 700;
}
.validation-item strong {
overflow-wrap: anywhere;
font-size: 11px;
line-height: 1.45;
}
.xml-output {
width: calc(100% - 24px);
min-height: 220px;