feat: initial project setup
This commit is contained in:
+401
@@ -0,0 +1,401 @@
|
||||
/* =========================================================================
|
||||
BiRefNet WebUI · 深色主题
|
||||
设计约束:字号层级 4 档 · 字体 2 种(系统 UI + 等宽)· 色彩角色 4 个
|
||||
(accent / ok / warn / danger)· 单焦点(开始抠图)
|
||||
========================================================================= */
|
||||
:root {
|
||||
--bg: #0d0f13;
|
||||
--surface: #141821;
|
||||
--surface-2: #1a1f2a;
|
||||
--surface-3: #202634;
|
||||
--border: #252b38;
|
||||
--border-soft: #1e2430;
|
||||
--text: #e9edf5;
|
||||
--text-dim: #95a0b3;
|
||||
--text-faint: #6b7688;
|
||||
|
||||
--accent: #4f8cff;
|
||||
--accent-hover: #6ba0ff;
|
||||
--accent-soft: rgba(79, 140, 255, 0.14);
|
||||
--ok: #35c98a;
|
||||
--warn: #f0b429;
|
||||
--danger: #f2555a;
|
||||
|
||||
--font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
|
||||
--mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
|
||||
|
||||
--radius: 12px;
|
||||
--radius-sm: 8px;
|
||||
--shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: var(--font);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body { display: flex; flex-direction: column; overflow: hidden; }
|
||||
|
||||
h1, h2, h3 { margin: 0; font-weight: 600; }
|
||||
button, input, select { font: inherit; color: inherit; }
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }
|
||||
::-webkit-scrollbar-thumb { background: #2b3242; border-radius: 8px; border: 2px solid var(--bg); }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
|
||||
/* ------------------------------- 顶栏 ------------------------------- */
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
padding: 14px 22px;
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.brand { display: flex; align-items: center; gap: 12px; }
|
||||
.brand .logo { display: grid; place-items: center; }
|
||||
.brand h1 { font-size: 28px; letter-spacing: -0.5px; line-height: 1.1; }
|
||||
.brand h1 em { font-style: normal; font-weight: 300; color: var(--text-dim); }
|
||||
|
||||
.meta { display: flex; gap: 26px; margin: 0; margin-left: auto; }
|
||||
.meta > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
.meta dt { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
|
||||
.meta dd { margin: 0; font-size: 13px; color: var(--text); font-family: var(--mono); }
|
||||
.meta dd.path { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
|
||||
.topbar-actions { display: flex; gap: 8px; }
|
||||
|
||||
/* ------------------------------- 主体 ------------------------------- */
|
||||
.layout { flex: 1 1 auto; display: grid; grid-template-columns: 348px 1fr; min-height: 0; }
|
||||
|
||||
.sidebar {
|
||||
background: var(--surface);
|
||||
border-right: 1px solid var(--border);
|
||||
overflow-y: auto;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.block {
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: var(--radius);
|
||||
padding: 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
|
||||
.block-head h2 { font-size: 13px; letter-spacing: 0.02em; color: var(--text); }
|
||||
.hint { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
|
||||
|
||||
/* 表单 */
|
||||
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
|
||||
.field > span { font-size: 12px; color: var(--text-dim); }
|
||||
.field-row { display: flex; gap: 10px; }
|
||||
select, input[type="number"], input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 7px 9px;
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
font-family: var(--mono);
|
||||
font-size: 12.5px;
|
||||
transition: border-color .15s, box-shadow .15s;
|
||||
}
|
||||
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
|
||||
input[type="color"] {
|
||||
width: 100%; height: 34px; padding: 3px; background: var(--bg);
|
||||
border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
|
||||
}
|
||||
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
|
||||
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
|
||||
.hidden { display: none !important; }
|
||||
|
||||
.swatches { display: flex; align-items: center; gap: 6px; }
|
||||
.swatches button {
|
||||
width: 30px; height: 34px; border-radius: var(--radius-sm); cursor: pointer;
|
||||
background: var(--c); border: 1px solid var(--border);
|
||||
}
|
||||
.swatches button:hover { border-color: var(--accent); }
|
||||
|
||||
/* 上传区 */
|
||||
.dropzone {
|
||||
border: 1.5px dashed var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: linear-gradient(180deg, rgba(79, 140, 255, 0.04), transparent);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: border-color .15s, background .15s;
|
||||
}
|
||||
.dropzone.compact { padding: 18px 12px; }
|
||||
.dropzone:hover, .dropzone:focus-visible, .dropzone.over {
|
||||
border-color: var(--accent); background: var(--accent-soft); outline: none;
|
||||
}
|
||||
.dropzone p { margin: 0; font-size: 13px; }
|
||||
.dropzone .sub { margin-top: 4px; font-size: 11.5px; color: var(--text-faint); }
|
||||
kbd {
|
||||
font-family: var(--mono); font-size: 11px; padding: 1px 5px;
|
||||
border: 1px solid var(--border); border-radius: 4px; background: var(--bg);
|
||||
}
|
||||
|
||||
/* 待处理槽(单张) */
|
||||
.thumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
||||
.thumbs:empty { display: none; }
|
||||
.pending-item {
|
||||
display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 10px;
|
||||
padding: 8px; background: var(--bg);
|
||||
border: 1px solid var(--accent); border-radius: var(--radius-sm);
|
||||
box-shadow: 0 0 0 3px var(--accent-soft);
|
||||
}
|
||||
.thumb-wrap {
|
||||
width: 76px; height: 76px; border-radius: 8px; overflow: hidden;
|
||||
background-color: #0a0c10;
|
||||
background-image:
|
||||
linear-gradient(45deg, #171b23 25%, transparent 25%),
|
||||
linear-gradient(-45deg, #171b23 25%, transparent 25%),
|
||||
linear-gradient(45deg, transparent 75%, #171b23 75%),
|
||||
linear-gradient(-45deg, transparent 75%, #171b23 75%);
|
||||
background-size: 14px 14px;
|
||||
background-position: 0 0, 0 7px, 7px -7px, -7px 0;
|
||||
}
|
||||
.thumb-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
|
||||
.pending-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
|
||||
.pending-meta .tname { font-size: 12.5px; color: var(--text); word-break: break-all; }
|
||||
.pending-meta .tsize { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
|
||||
.thumbs .tremove {
|
||||
border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
|
||||
font-size: 17px; line-height: 1; padding: 3px 8px; border-radius: 6px;
|
||||
}
|
||||
.thumbs .tremove:hover { color: var(--danger); background: rgba(242, 85, 90, .12); }
|
||||
.pending-note { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--accent); }
|
||||
.pending-note:empty { display: none; }
|
||||
|
||||
/* 按钮 */
|
||||
.btn {
|
||||
border: 1px solid var(--border);
|
||||
background: var(--surface-3);
|
||||
color: var(--text);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 9px 14px;
|
||||
cursor: pointer;
|
||||
transition: background .15s, border-color .15s, transform .05s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.btn:hover:not(:disabled) { border-color: var(--accent); }
|
||||
.btn:active:not(:disabled) { transform: translateY(1px); }
|
||||
.btn:disabled { opacity: .42; cursor: not-allowed; }
|
||||
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
|
||||
.btn.ghost { background: transparent; }
|
||||
.btn.primary {
|
||||
background: var(--accent); border-color: var(--accent); color: #fff;
|
||||
font-weight: 600; font-size: 15px; padding: 12px 16px;
|
||||
}
|
||||
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
|
||||
.btn.link { background: none; border: 0; color: var(--accent); padding: 0; font-size: 12.5px; }
|
||||
|
||||
.actions { gap: 12px; }
|
||||
.progress { display: flex; flex-direction: column; gap: 6px; }
|
||||
.bar { height: 6px; border-radius: 99px; background: var(--bg); overflow: hidden; }
|
||||
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
|
||||
.progress-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-dim); }
|
||||
.error-text { margin: 0; font-size: 12.5px; color: var(--danger); word-break: break-all; }
|
||||
|
||||
/* 批量处理说明 */
|
||||
.batch-note { margin: 0; font-size: 11px; line-height: 1.65; color: var(--text-faint); }
|
||||
.field-tip { margin: -2px 0 0; font-size: 11px; line-height: 1.6; color: var(--text-faint); }
|
||||
.batch-note strong { color: var(--text-dim); font-weight: 500; }
|
||||
.batch-note code {
|
||||
font-family: var(--mono); font-size: 10.5px; color: var(--text-dim);
|
||||
background: var(--bg); border: 1px solid var(--border-soft); border-radius: 4px; padding: 0 4px;
|
||||
}
|
||||
|
||||
/* ------------------------------- 结果区 ------------------------------- */
|
||||
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
|
||||
.stage-head {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 14px 22px; border-bottom: 1px solid var(--border); gap: 16px;
|
||||
}
|
||||
.stage-head h2 { font-size: 15px; }
|
||||
.stage-head .count { font-family: var(--mono); color: var(--text-dim); font-weight: 400; }
|
||||
.stage-tools { display: flex; align-items: center; gap: 10px; }
|
||||
.stage-tip {
|
||||
flex: 0 0 auto; margin: 0; padding: 7px 22px; font-size: 11.5px; color: var(--text-faint);
|
||||
border-bottom: 1px solid var(--border-soft); background: rgba(79, 140, 255, .04);
|
||||
}
|
||||
|
||||
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }.segmented button {
|
||||
border: 0; background: transparent; color: var(--text-dim);
|
||||
padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
|
||||
}
|
||||
.segmented button.active { background: var(--accent-soft); color: var(--accent); }
|
||||
|
||||
/* 批量任务报告(结果区顶部,仅在跑过 / 存在批量任务时出现) */
|
||||
.batch-report {
|
||||
flex: 0 0 auto; margin: 14px 22px 0; padding: 12px 14px;
|
||||
background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
|
||||
display: flex; flex-direction: column; gap: 8px; max-height: 40vh;
|
||||
}
|
||||
.batch-report[hidden] { display: none; }
|
||||
.batch-report-head { display: flex; align-items: center; gap: 10px; }
|
||||
.batch-report-head h3 { font-size: 13px; display: flex; align-items: center; gap: 8px; }
|
||||
.batch-report-path {
|
||||
flex: 1; min-width: 0; font-family: var(--mono); font-size: 11px; color: var(--text-faint);
|
||||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
}
|
||||
.batch-report-sum { margin: 0; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
|
||||
.batch-rows {
|
||||
list-style: none; margin: 0; padding: 0; overflow-y: auto;
|
||||
display: flex; flex-direction: column; gap: 4px;
|
||||
}
|
||||
.batch-rows:empty { display: none; }
|
||||
.batch-row {
|
||||
display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1.4fr) auto auto;
|
||||
align-items: center; gap: 10px; padding: 5px 9px;
|
||||
background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
|
||||
font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
|
||||
}
|
||||
.batch-row .bi { text-align: right; color: var(--text-faint); }
|
||||
.batch-row .bs,
|
||||
.batch-row .bo { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.batch-row .bo { color: var(--text); }
|
||||
.batch-row .bo::before { content: "→ "; color: var(--text-faint); }
|
||||
.batch-row .bo:empty::before { content: ""; }
|
||||
.batch-row .bt { color: var(--text-faint); font-size: 11px; }
|
||||
.batch-row.running { border-color: rgba(79, 140, 255, .4); background: var(--accent-soft); }
|
||||
.batch-row.failed { border-color: rgba(242, 85, 90, .35); }
|
||||
.batch-row.canceled { opacity: .55; }
|
||||
|
||||
.grid {
|
||||
flex: 1 1 auto; overflow-y: auto; padding: 18px 22px 28px;
|
||||
display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--surface); border: 1px solid var(--border-soft);
|
||||
border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
|
||||
transition: border-color .15s, box-shadow .15s;
|
||||
}
|
||||
.card-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
|
||||
.card-head .name {
|
||||
flex: 1; min-width: 0; text-align: left; cursor: pointer;
|
||||
border: 0; background: transparent; color: var(--text);
|
||||
padding: 3px 6px; margin-left: -6px; border-radius: 6px;
|
||||
font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
transition: color .15s, background .15s;
|
||||
}
|
||||
.card-head .name:hover {
|
||||
color: var(--accent); background: var(--accent-soft);
|
||||
text-decoration: underline; text-underline-offset: 3px;
|
||||
}
|
||||
.card-head .name:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
|
||||
.card-del {
|
||||
flex: 0 0 auto; border: 0; background: transparent; color: var(--text-faint);
|
||||
cursor: pointer; font-size: 17px; line-height: 1; padding: 2px 8px; border-radius: 6px;
|
||||
transition: color .15s, background .15s;
|
||||
}
|
||||
.card-del:hover { color: var(--danger); background: rgba(242, 85, 90, .12); }
|
||||
|
||||
/* 处理这条记录时用的参数:始终可见(便于对照历史),过长省略,完整 JSON 在 title 里 */
|
||||
.card-params {
|
||||
margin: 0; padding: 6px 12px;
|
||||
font-family: var(--mono); font-size: 11px; color: var(--text-faint);
|
||||
background: var(--surface-2); border-bottom: 1px solid var(--border-soft);
|
||||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
}
|
||||
.card-params::before { content: "参数 "; color: var(--text-dim); }
|
||||
.card-params:empty { display: none; }
|
||||
|
||||
/* 选中态:主题色一圈描边 + 头部同色底 */
|
||||
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
|
||||
.card.selected .card-head { background: var(--accent-soft); border-bottom-color: rgba(79, 140, 255, .35); }
|
||||
.badge {
|
||||
font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 99px;
|
||||
background: var(--surface-3); color: var(--text-dim); border: 1px solid var(--border);
|
||||
}
|
||||
.badge.ok { color: var(--ok); border-color: rgba(53, 201, 138, .35); background: rgba(53, 201, 138, .1); }
|
||||
.badge.warn { color: var(--warn); border-color: rgba(240, 180, 41, .35); background: rgba(240, 180, 41, .1); }
|
||||
.badge.err { color: var(--danger); border-color: rgba(242, 85, 90, .35); background: rgba(242, 85, 90, .1); }
|
||||
|
||||
/* 对比视图 */
|
||||
.compare {
|
||||
position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
|
||||
background-color: #0a0c10;
|
||||
background-image:
|
||||
linear-gradient(45deg, #171b23 25%, transparent 25%),
|
||||
linear-gradient(-45deg, #171b23 25%, transparent 25%),
|
||||
linear-gradient(45deg, transparent 75%, #171b23 75%),
|
||||
linear-gradient(-45deg, transparent 75%, #171b23 75%);
|
||||
background-size: 18px 18px;
|
||||
background-position: 0 0, 0 9px, 9px -9px, -9px 0;
|
||||
}
|
||||
.compare img {
|
||||
position: absolute; inset: 0; width: 100%; height: 100%;
|
||||
object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none;
|
||||
}
|
||||
.compare .after { clip-path: inset(0 calc(100% - var(--p, 50%)) 0 0); }
|
||||
.compare .divider {
|
||||
position: absolute; top: 0; bottom: 0; left: var(--p, 50%); width: 2px;
|
||||
background: var(--accent); box-shadow: 0 0 12px rgba(79, 140, 255, .55); pointer-events: none;
|
||||
}
|
||||
.compare .divider::after {
|
||||
content: ""; position: absolute; top: 50%; left: 50%; width: 26px; height: 26px;
|
||||
transform: translate(-50%, -50%); border-radius: 50%;
|
||||
background: var(--accent); border: 3px solid var(--surface);
|
||||
}
|
||||
.compare input[type="range"] {
|
||||
position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
|
||||
opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none;
|
||||
}
|
||||
.compare .tag {
|
||||
position: absolute; bottom: 8px; font-family: var(--mono); font-size: 11px;
|
||||
padding: 2px 7px; border-radius: 6px; background: rgba(8, 10, 14, .72); color: var(--text);
|
||||
border: 1px solid var(--border); pointer-events: none;
|
||||
}
|
||||
.compare .tag.left { left: 8px; }
|
||||
.compare .tag.right { right: 8px; color: var(--accent); }
|
||||
|
||||
.card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.card-stats { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
|
||||
.card-stats b { color: var(--text-dim); font-weight: 500; }
|
||||
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.card-note { margin: 0; font-size: 11.5px; color: var(--warn); }
|
||||
.card-error { font-size: 12px; color: var(--danger); word-break: break-all; }
|
||||
|
||||
/* 卡片状态 */
|
||||
.card.running .card-body, .card.pending .card-body { display: none; }
|
||||
.card .status {
|
||||
padding: 26px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px;
|
||||
color: var(--text-dim); font-size: 12.5px;
|
||||
}
|
||||
.spinner {
|
||||
width: 22px; height: 22px; border-radius: 50%;
|
||||
border: 2px solid var(--border); border-top-color: var(--accent);
|
||||
animation: spin .8s linear infinite;
|
||||
}
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
.card.done .status, .card.failed .status, .card.canceled .status { display: none; }
|
||||
|
||||
.empty-state {
|
||||
flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
|
||||
gap: 12px; text-align: center; padding: 40px; color: var(--text-dim);
|
||||
}
|
||||
.empty-state h3 { font-size: 28px; font-weight: 600; color: var(--text); letter-spacing: -0.4px; }
|
||||
.empty-state p { margin: 0; max-width: 460px; font-size: 13px; line-height: 1.7; }
|
||||
.empty-state.hidden { display: none; }
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.layout { grid-template-columns: 1fr; }
|
||||
.sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
|
||||
.meta { display: none; }
|
||||
}
|
||||
Reference in New Issue
Block a user