perf: 优化并重构工作流幕布UI表现

This commit is contained in:
2026-03-05 21:40:05 +08:00
parent 03c5f2cd2e
commit 265bb79ba3
12 changed files with 1384 additions and 273 deletions

View File

@@ -1,4 +1,3 @@
.svelte-flow__nodes {
.svelte-flow__node {
@@ -84,6 +83,25 @@
}
}
.tf-flow-line-path {
stroke: var(--xy-edge-stroke);
stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));
}
.tf-flow-line-path--animated {
stroke-dasharray: 8 6;
animation: tf-edge-flow 1.2s linear infinite;
}
@keyframes tf-edge-flow {
from {
stroke-dashoffset: 0;
}
to {
stroke-dashoffset: -14;
}
}
.tf-node-wrapper {
border-radius: 5px;
@@ -99,62 +117,240 @@
display: none;
}
.tf-toolbar {
.tf-bottom-dock {
z-index: 200;
position: absolute;
top: 10px;
left: 10px;
left: 50%;
bottom: var(--tf-toolbar-bottom, 20px);
transform: translateX(-50%);
display: flex;
gap: 5px;
transition: transform 0.5s ease, opacity 0.5s ease;
transform: translateX(calc(-100% + 20px)); /* 完全移出视口 */
align-items: center;
gap: 8px;
}
&.show {
transform: translateX(0);
// 单行统一工具栏
.tf-unified-bar {
display: inline-flex;
align-items: center;
height: 40px;
border: 1px solid var(--tf-border-color);
border-radius: 10px;
background: var(--tf-bg-surface);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
padding: 0 4px;
gap: 2px;
> * {
flex-shrink: 0;
}
}
// 分割线
.tf-bar-divider {
width: 1px;
height: 20px;
background: var(--tf-border-color);
margin: 0 4px;
flex-shrink: 0;
}
// 图标按钮
.tf-bar-btn {
all: unset;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 7px;
color: var(--tf-text-secondary);
cursor: pointer;
transition: background 0.15s, color 0.15s;
flex-shrink: 0;
svg {
width: 17px;
height: 17px;
fill: currentColor;
pointer-events: none;
}
&-container {
background: var(--tf-bg-surface);
&:hover {
background: var(--tf-bg-hover);
color: var(--tf-text-primary);
}
&.tf-bar-btn-active {
color: var(--tf-primary-color);
background: var(--tf-bg-hover);
}
}
.tf-bar-run-btn {
all: unset;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 32px;
padding: 0 14px;
border-radius: 8px;
background: #13b33f;
color: #fff;
font-size: 14px;
font-weight: 600;
line-height: 1;
cursor: pointer;
flex-shrink: 0;
transition: filter 0.15s;
svg {
width: 14px;
height: 14px;
fill: currentColor;
pointer-events: none;
}
&:hover {
filter: brightness(0.95);
}
}
.tf-bar-add-btn {
all: unset;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 32px;
padding: 0 12px;
border-radius: 8px;
background: #e9edff;
color: var(--tf-primary-color);
font-size: 13px;
font-weight: 600;
line-height: 1;
cursor: pointer;
transition: filter 0.15s, background 0.15s;
&:hover {
filter: brightness(0.98);
background: #dde5ff;
}
}
// 百分比缩放选择器单元
.tf-zoom-select-wrap {
position: relative;
display: inline-flex;
align-items: center;
padding: 0 6px 0 8px;
gap: 4px;
height: 32px;
border-radius: 7px;
cursor: pointer;
transition: background 0.15s;
&:hover {
background: var(--tf-bg-hover);
}
.tf-zoom-icon {
width: 14px;
height: 14px;
fill: var(--tf-text-secondary);
pointer-events: none;
flex-shrink: 0;
}
.tf-zoom-select {
appearance: none;
-webkit-appearance: none;
border: none;
background: transparent;
font-size: 13px;
font-weight: 500;
color: var(--tf-text-primary);
cursor: pointer;
outline: none;
padding: 0;
min-width: 48px;
text-align: center;
line-height: 1;
}
.tf-zoom-chevron {
width: 14px;
height: 14px;
fill: var(--tf-text-secondary);
pointer-events: none;
flex-shrink: 0;
}
}
.tf-zoom-select-simple {
appearance: none;
-webkit-appearance: none;
border: none;
outline: none;
background: transparent;
height: 32px;
min-width: 64px;
padding: 0 8px;
border-radius: 7px;
font-size: 13px;
font-weight: 500;
line-height: 1;
color: var(--tf-text-primary);
cursor: pointer;
text-align: center;
&:hover {
background: var(--tf-bg-hover);
}
}
.tf-toolbar {
position: relative;
display: inline-flex;
align-items: center;
&-panel {
width: min(520px, calc(100vw - 40px));
max-height: min(390px, calc(100vh - 220px));
border: 1px solid var(--tf-border-color);
border-radius: 5px;
border-radius: 12px;
background: var(--tf-bg-surface);
box-shadow: var(--tf-shadow-soft);
padding: 10px;
width: fit-content;
padding: 8px;
display: flex;
flex-direction: column;
gap: 10px;
position: absolute;
left: 50%;
bottom: calc(100% + 8px);
transform: translateX(-50%);
z-index: 260;
overflow: hidden;
}
&-header {
display: flex;
}
&-trigger {
border: none;
}
&-body {
display: flex;
margin-top: 20px;
&-trigger-icon {
display: inline-flex;
align-items: center;
justify-content: center;
.tf-toolbar-container-base, .tf-toolbar-container-tools {
display: flex;
flex-direction: column;
gap: 4px;
flex-grow: 1;
.tf-btn {
border: none;
width: 100%;
justify-content: flex-start;
height: 40px;
gap: 10px;
cursor: grabbing;
border-radius: 5px;
svg {
width: 20px;
height: 20px;
fill: var(--tf-primary-color);
}
&:hover {
background: var(--tf-bg-hover);
}
}
}
svg {
width: 16px;
height: 16px;
fill: currentColor;
}
}
}