diff --git a/prototypes/hel-648-fusion/app.css b/prototypes/hel-648-fusion/app.css new file mode 100644 index 00000000..34ff5fa1 --- /dev/null +++ b/prototypes/hel-648-fusion/app.css @@ -0,0 +1,758 @@ +/* HEL-648 融合原型 · 流水台结构 + 放映厅配色。色值与动效参数以 HEL-647 融合规范为准; + 设计 Token 统一在 :root,组件只引用变量 */ +:root { + /* 蓝黑四阶:页面底 → 面板/卡片 → 浮起/选中 → 最浮/进度条底 */ + --bg: #07090e; + --bg-2: #0c0f16; + --bg-3: #121724; + --bg-4: #1a2133; + --line: #1b2233; + --line-2: #2a3450; + --text: #f4f6fa; + --text-2: #aab2c5; + --text-3: #6d7690; + --page-glow: radial-gradient(1200px 500px at 70% -10%, rgba(38, 52, 92, 0.25), transparent 60%); + --float-bg: linear-gradient(180deg, #10152a, var(--bg-2)); + --composer-bg: linear-gradient(180deg, #0e1220, var(--bg-2)); + --composer-focus: 0 0 0 1px rgba(242, 199, 132, 0.12), 0 8px 28px rgba(0, 0, 0, 0.4); + --rail-bg: rgba(7, 9, 14, 0.6); + + /* 放映金:只给关键动作与选中 */ + --accent: #f2c784; + --accent-ink: #23170a; + --accent-soft: rgba(242, 199, 132, 0.13); + --accent-hi: #f7d9a2; + --accent-lo: #ecaf63; + --accent-glow: rgba(236, 175, 99, 0.28); + --accent-grad: linear-gradient(180deg, var(--accent-hi), var(--accent-lo)); + --accent-grad-hover: linear-gradient(180deg, #fbe3b6, #f0b968); + --accent-wash: linear-gradient(180deg, rgba(242, 199, 132, 0.05), transparent 40%); + --accent-line: rgba(242, 199, 132, 0.55); + --accent-ring: 0 0 0 1px rgba(242, 199, 132, 0.7), 0 0 22px var(--accent-glow); + --btn-glow: 0 2px 14px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35); + --btn-glow-hover: 0 4px 18px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4); + --sel-shadow: 0 0 0 1px rgba(242, 199, 132, 0.15), 0 6px 24px rgba(0, 0, 0, 0.35); + + /* 信号色:青=进行中/在线、绿=完成、红=失败、琥珀=待确认/缺失 */ + --run: #54dfd2; + --run-soft: rgba(84, 223, 210, 0.13); + --run-grad: linear-gradient(90deg, #3bbfb4, var(--run)); + --ok: #49cb90; + --ok-soft: rgba(73, 203, 144, 0.13); + --err: #f0645a; + --err-soft: rgba(240, 100, 90, 0.13); + --err-line: rgba(240, 100, 90, 0.6); + --warn: #f0b45c; + --warn-soft: rgba(240, 180, 92, 0.13); + + /* 放映厅专属符号:胶片齿孔、放映光晕 */ + --sprocket: radial-gradient(circle 2px, var(--line-2) 98%, transparent); + --stage-bg: radial-gradient(60% 45% at 50% 38%, rgba(242, 199, 132, 0.07), transparent 70%), radial-gradient(80% 70% at 50% 50%, #0d1220, #05070c); + + /* 叠在媒体上的遮罩 */ + --media-scrim: rgba(7, 9, 14, 0.65); + --overlay: rgba(3, 5, 9, 0.6); + --on-media: #fff; + --on-media-line: rgba(255, 255, 255, 0.05); + + --r-sm: 6px; + --r-md: 10px; + --r-lg: 14px; + --shadow-float: 0 14px 44px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--line-2); + + --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; + --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, monospace; + + /* 动效参数:HEL-647 动效参数总表 */ + --ease-out: cubic-bezier(0.23, 1, 0.32, 1); + --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); + --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); + --ease-spring: cubic-bezier(0.34, 1.45, 0.44, 1); + --d-press: 120ms; + --d-state: 150ms; + --d-pop: 180ms; + --d-leave: 200ms; + --d-enter: 220ms; + --d-drawer: 280ms; + --d-flash: 900ms; + --d-progress: 400ms; + --press-scale: 0.97; +} + +/* 减少动态:位移/缩放全部取消,只留 ≤120ms 透明度 */ +:root[data-reduce="1"] { + --d-press: 0ms; + --d-state: 120ms; + --d-pop: 120ms; + --d-leave: 120ms; + --d-enter: 120ms; + --d-drawer: 120ms; + --d-flash: 0ms; + --d-progress: 0ms; + --press-scale: 1; + --ease-spring: ease; +} + +* { box-sizing: border-box; } +html, body { height: 100%; margin: 0; } +body { + background: var(--page-glow), var(--bg); + color: var(--text); + font: 13px/1.55 var(--font); + -webkit-font-smoothing: antialiased; + overflow: hidden; +} +button, input, textarea, select { font: inherit; color: inherit; } +button { cursor: pointer; background: none; border: 0; padding: 0; } +:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); } +.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; } +.muted { color: var(--text-3); } +.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } + +/* ---------- 壳层 ---------- */ +.app { display: grid; grid-template-columns: 60px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; } +.rail { + position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; + padding: 12px 0; border-right: 1px solid var(--line); background: var(--rail-bg); +} +.rail .logo { + width: 34px; height: 34px; border-radius: 9px; margin-bottom: 14px; + display: grid; place-items: center; font-weight: 700; font-size: 16px; + background: linear-gradient(160deg, var(--accent-hi), var(--accent-lo)); color: var(--accent-ink); + box-shadow: 0 2px 12px var(--accent-glow); +} +.rail .spacer { flex: 1; } +.rail-btn { + position: relative; width: 44px; height: 44px; border-radius: var(--r-md); + display: grid; place-items: center; color: var(--text-3); + transition: color var(--d-state) ease, background-color var(--d-state) ease, transform var(--d-press) var(--ease-out); +} +.rail-btn:active { transform: scale(var(--press-scale)); } +.rail-btn svg { width: 20px; height: 20px; } +.rail-btn[aria-current="page"] { color: var(--text); background: var(--bg-3); } +.rail-ind { + position: absolute; left: 0; top: 0; width: 3px; height: 20px; border-radius: 0 3px 3px 0; + background: var(--accent-grad); box-shadow: 0 0 8px var(--accent-glow); pointer-events: none; opacity: 0; + transform: translateY(var(--y, 0)); + transition: transform var(--d-pop) var(--ease-out), opacity var(--d-state) ease; +} +.rail-ind.on { opacity: 1; } +:root[data-reduce="1"] .rail-ind { transition: opacity var(--d-state) ease; } +.rail-btn .tip { + position: absolute; left: 52px; white-space: nowrap; pointer-events: none; + background: var(--bg-4); color: var(--text); padding: 4px 8px; border-radius: var(--r-sm); + font-size: 12px; opacity: 0; transform: translateX(-4px); + transition: opacity var(--d-pop) var(--ease-out), transform var(--d-pop) var(--ease-out); + z-index: 30; +} +@media (hover: hover) and (pointer: fine) { + .rail-btn:hover { color: var(--text); background: var(--bg-2); } + .rail-btn:hover .tip { opacity: 1; transform: none; transition-delay: 350ms; } +} + +.main { display: grid; grid-template-rows: 52px minmax(0, 1fr); min-width: 0; } +.topbar { + display: flex; align-items: center; gap: 10px; padding: 0 16px; + border-bottom: 1px solid var(--line); background: var(--bg-2); +} +.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; } +.crumb h1 { font-size: 15px; font-weight: 600; margin: 0; white-space: nowrap; } +.capsule { + display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; + border: 1px solid var(--line-2); border-radius: 999px; color: var(--text-2); white-space: nowrap; + background: var(--bg-3); + transition: border-color var(--d-state) ease, color var(--d-state) ease, transform var(--d-press) var(--ease-out); +} +.capsule:active { transform: scale(var(--press-scale)); } +.capsule .dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--run); box-shadow: 0 0 6px var(--run-soft); transition: background-color var(--d-state) ease; } +.capsule .dot.run { background: var(--run); } +.capsule .dot.err { background: var(--err); } +/* 任务数变化:胶囊轻弹一次 + 状态灯扩散一圈,只播一次 */ +.capsule.bump { animation: bump 320ms var(--ease-out); } +.capsule.bump .dot::after { + content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid currentColor; + color: inherit; animation: ping 700ms var(--ease-out) forwards; +} +.capsule.bump .dot.run::after { color: var(--run); } +@keyframes bump { 40% { transform: scale(1.06); } } +@keyframes ping { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } } +:root[data-reduce="1"] .capsule.bump, :root[data-reduce="1"] .capsule.bump .dot::after { animation: none; } +@media (hover: hover) and (pointer: fine) { + .capsule:hover { border-color: var(--text-3); color: var(--text); } +} +.topbar .grow { flex: 1; } +.kbd { + font: 11px var(--mono); color: var(--text-3); border: 1px solid var(--line-2); + border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; line-height: 16px; +} +.search-btn { min-width: 240px; justify-content: space-between; } + +/* 通用按钮 */ +.btn { + display: inline-flex; align-items: center; justify-content: center; gap: 6px; + height: 32px; padding: 0 12px; border-radius: var(--r-md); + border: 1px solid var(--line-2); color: var(--text); background: var(--bg-3); + transition: transform var(--d-press) var(--ease-out), background-color var(--d-state) ease, border-color var(--d-state) ease, box-shadow var(--d-state) ease, color var(--d-state) ease, opacity var(--d-state) ease; + white-space: nowrap; +} +.btn svg { width: 15px; height: 15px; } +.btn:active:not(:disabled) { transform: scale(var(--press-scale)); } +.btn:disabled { opacity: 0.45; cursor: not-allowed; } +.btn.primary { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; font-weight: 600; box-shadow: var(--btn-glow); } +.btn.primary:disabled { box-shadow: none; } +.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); } +.btn.danger { color: var(--err); } +.btn.danger-solid { background: var(--err); border-color: transparent; color: var(--on-media); font-weight: 600; } +.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-sm); } +@media (hover: hover) and (pointer: fine) { + .btn:hover:not(:disabled) { border-color: var(--text-3); } + .btn.primary:hover:not(:disabled) { background: var(--accent-grad-hover); box-shadow: var(--btn-glow-hover); } + .btn.danger-solid:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--err-line), 0 0 18px var(--err-soft); } + .btn.ghost:hover:not(:disabled) { background: var(--bg-4); color: var(--text); } + .btn.ghost.danger:hover:not(:disabled) { background: var(--err-soft); color: var(--err); } +} + +.tag { + display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; + border-radius: 999px; font-size: 11px; color: var(--text-2); background: var(--bg-4); + white-space: nowrap; + transition: color var(--d-state) ease, background-color var(--d-state) ease; +} +.tag.swap { animation: tag-swap var(--d-enter) var(--ease-out); } +@keyframes tag-swap { from { opacity: 0.2; transform: translateY(3px); } } +:root[data-reduce="1"] .tag.swap { animation: fade-in var(--d-state) ease; } +@keyframes fade-in { from { opacity: 0; } } +.tag.accent { color: var(--accent); background: var(--accent-soft); } +.tag.ok { color: var(--ok); background: var(--ok-soft); } +.tag.run { color: var(--run); background: var(--run-soft); } +.tag.err { color: var(--err); background: var(--err-soft); } +.tag.warn { color: var(--warn); background: var(--warn-soft); } + +/* ---------- 视图切换 ---------- */ +.view { display: none; min-height: 0; } +.view.on { display: grid; animation: fade-in var(--d-enter) var(--ease-out); } +.page.on { animation: view-in var(--d-enter) var(--ease-out); } +@keyframes view-in { from { opacity: 0; transform: translateY(6px); } } +:root[data-reduce="1"] .page.on { animation: fade-in var(--d-state) ease; } + +/* ---------- 生成台 ---------- */ +.desk { + grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: minmax(0, 1fr); min-height: 0; + transition: grid-template-columns var(--d-drawer) var(--ease-drawer); +} +.desk.insp-off { grid-template-columns: minmax(0, 1fr) 0px; } +:root[data-reduce="1"] .desk { transition: none; } +.desk-center { display: flex; flex-direction: column; min-height: 0; min-width: 0; } +.context-bar { + display: none; align-items: center; gap: 10px; margin: 10px 20px 0; padding: 8px 12px; + border-radius: var(--r-md); background: var(--run-soft); color: var(--text); font-size: 12px; +} +.context-bar.on { display: flex; } +.context-bar b { color: var(--run); font-weight: 600; } +.filters { display: flex; align-items: center; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line); } + +/* 分段控件:选中底块在选项间滑动 */ +.seg { position: relative; display: inline-flex; padding: 2px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line); } +.seg-pill { + position: absolute; top: 2px; bottom: 2px; left: 0; width: var(--w, 0); border-radius: 8px; + background: var(--bg-4); box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; + transform: translateX(var(--x, 0)); + transition: transform var(--d-pop) var(--ease-out), width var(--d-pop) var(--ease-out); +} +.seg-pill.instant, :root[data-reduce="1"] .seg-pill { transition: none; } +.seg button { + position: relative; height: 26px; padding: 0 10px; border-radius: 8px; color: var(--text-3); + transition: color var(--d-state) ease; +} +.seg button[aria-pressed="true"] { color: var(--text); } +.filters .count { margin-left: auto; color: var(--text-3); font-size: 12px; } +.insp-open { display: none; } +.desk.insp-off .insp-open { display: inline-flex; } + +.feed { position: relative; flex: 1; overflow-y: auto; padding: 16px 20px 8px; scroll-behavior: smooth; } +:root[data-reduce="1"] .feed { scroll-behavior: auto; } +.feed-day { color: var(--text-3); font-size: 12px; margin: 10px 0 8px; display: flex; align-items: center; gap: 8px; } +.feed-day::after { content: ""; flex: 1; height: 1px; background: var(--line); } + +/* 选中框:金色描边从上一条记录滑到新选中的记录(app.js slideMark) */ +.sel-mark { + position: absolute; inset: -1px; z-index: 3; border: 1px solid var(--accent-line); border-radius: inherit; + pointer-events: none; display: none; +} +.take.selected > .sel-mark { display: block; } + +.take { + position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; + padding: 12px 14px; margin-bottom: 8px; border-radius: var(--r-lg); + border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; + transition: border-color var(--d-state) ease, background-color var(--d-state) ease, opacity var(--d-enter) var(--ease-out), transform var(--d-enter) var(--ease-out); +} +.take.new { animation: take-in var(--d-enter) var(--ease-out); } +@keyframes take-in { from { opacity: 0; transform: translateY(8px); } } +:root[data-reduce="1"] .take.new { animation: fade-in var(--d-state) ease; } +.take.selected { background: var(--accent-wash), var(--bg-3); border-color: transparent; box-shadow: var(--sel-shadow); } +.take.leaving { opacity: 0; transform: translateX(-10px); pointer-events: none; transition-duration: var(--d-leave); transition-timing-function: var(--ease-drawer); } +:root[data-reduce="1"] .take.leaving { transform: none; } +.take.done-flash { animation: done-flash var(--d-flash) var(--ease-out); } +@keyframes done-flash { from { box-shadow: var(--accent-ring); } } +.take.shake { animation: shake 320ms var(--ease-out); } +@keyframes shake { 20% { transform: translateX(-4px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } } +:root[data-reduce="1"] .take.shake, :root[data-reduce="1"] .take.done-flash { animation: none; } +@media (hover: hover) and (pointer: fine) { + .take:hover:not(.selected) { border-color: var(--line-2); background: var(--bg-3); } +} +.take-head { display: flex; align-items: center; gap: 8px; min-width: 0; } +.take-head .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.take-head .meta { color: var(--text-3); font-size: 12px; white-space: nowrap; } +.take-prompt { + grid-column: 1; color: var(--text-2); font-size: 12.5px; + display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; +} +.take-inputs { display: flex; gap: 4px; align-items: center; } +.take-inputs .mini { width: 26px; height: 26px; border-radius: 5px; background-size: cover; background-position: center; border: 1px solid var(--line-2); } +.take-inputs .more { font-size: 11px; color: var(--text-3); padding-left: 2px; } +.take-out { grid-column: 2; grid-row: 1 / span 3; align-self: start; } +.thumb { + position: relative; width: 150px; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; + background: var(--bg-4) center / cover no-repeat; box-shadow: inset 0 0 0 1px var(--on-media-line); +} +.thumb.portrait { width: 96px; aspect-ratio: 3 / 4; } +.thumb.fresh { animation: thumb-in 320ms var(--ease-out); } +@keyframes thumb-in { from { opacity: 0; transform: scale(0.96); } } +:root[data-reduce="1"] .thumb.fresh { animation: fade-in var(--d-state) ease; } +.thumb .badge { + position: absolute; right: 6px; bottom: 6px; font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; + background: var(--media-scrim); color: var(--on-media); +} +.thumb .play { + position: absolute; left: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; + display: grid; place-items: center; background: var(--media-scrim); +} +.thumb .play svg { width: 10px; height: 10px; fill: var(--on-media); } +.thumb.missing, .thumb.pending { + display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--text-3); + border: 1px dashed var(--line-2); background: var(--bg-2); padding: 6px; +} +.thumb.pending { border-style: solid; overflow: hidden; color: var(--run); } +.thumb.pending::after { + content: ""; position: absolute; inset: 0; + background: linear-gradient(100deg, transparent 30%, var(--run-soft) 50%, transparent 70%); + animation: sheen 1.4s linear infinite; +} +@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } } +:root[data-reduce="1"] .thumb.pending::after { animation: none; } + +.take-state { grid-column: 1; display: flex; align-items: center; gap: 8px; font-size: 12px; min-height: 22px; } +.take-state .txt { color: var(--text-2); } +.take-state .err-txt { color: var(--err); } +.bar { position: relative; flex: 0 0 140px; height: 4px; border-radius: 4px; background: var(--bg-4); overflow: hidden; } +.bar i { + position: absolute; inset: 0; background: var(--run-grad); box-shadow: 0 0 8px var(--run-soft); transform-origin: left; + transform: scaleX(var(--p, 0)); transition: transform var(--d-progress) linear; +} +.take-actions { display: flex; gap: 4px; margin-left: auto; opacity: 0; transition: opacity var(--d-state) ease; } +.take:focus-within .take-actions, .take.selected .take-actions { opacity: 1; } +@media (hover: hover) and (pointer: fine) { .take:hover .take-actions { opacity: 1; } } +@media (hover: none) { .take-actions { opacity: 1; } } +/* 高度展开/收起:0fr ↔ 1fr,可中途反向 */ +.collapse { + display: grid; grid-template-rows: 0fr; opacity: 0; + transition: grid-template-rows var(--d-enter) var(--ease-out), opacity var(--d-state) ease; +} +.collapse.open { grid-template-rows: 1fr; opacity: 1; } +.collapse > .collapse-in { overflow: hidden; min-height: 0; } +:root[data-reduce="1"] .collapse { transition: opacity var(--d-state) ease; } +.take > .collapse { grid-column: 1 / -1; margin-top: -10px; } +.err-detail { margin: 10px 0 0; padding: 8px 10px 8px 26px; border-radius: var(--r-md); background: var(--err-soft); color: var(--text-2); font-size: 12px; } +.err-detail li { margin: 2px 0; } + +/* ---------- 输入台 ---------- */ +.composer-wrap { position: relative; padding: 12px 20px 16px; } +/* 胶片齿孔:只出现在记录流与输入台之间 */ +.composer-wrap::before { + content: ""; position: absolute; left: 24px; right: 24px; top: 3px; height: 6px; + background-image: var(--sprocket); background-size: 18px 6px; background-repeat: repeat-x; background-position: center; + opacity: 0.55; +} +.composer { + border: 1px solid var(--line-2); border-radius: 16px; background: var(--composer-bg); + transition: border-color var(--d-state) ease, box-shadow var(--d-state) ease; +} +.composer:focus-within { border-color: var(--accent-line); box-shadow: var(--composer-focus); } +.composer.drag { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); } +.slots { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 0; overflow: hidden; } +.slots:empty { padding-top: 0; } +.slot-group.enter { animation: view-in var(--d-enter) var(--ease-out); } +:root[data-reduce="1"] .slot-group.enter { animation: fade-in var(--d-state) ease; } +.slot-group { display: flex; flex-direction: column; gap: 6px; } +.slot-label { font-size: 11.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; } +.slot-label .req { color: var(--warn); } +.slot-row { display: flex; gap: 6px; flex-wrap: wrap; } +.tile { + position: relative; width: 58px; height: 58px; border-radius: var(--r-md); + background: var(--bg-3) center / cover no-repeat; border: 1px solid var(--line-2); + display: grid; place-items: center; color: var(--text-3); + transition: border-color var(--d-state) ease, background-color var(--d-state) ease, color var(--d-state) ease, transform var(--d-press) var(--ease-out), opacity var(--d-state) ease; +} +.tile.enter { animation: tile-in var(--d-enter) var(--ease-spring); } +@keyframes tile-in { from { opacity: 0; transform: scale(0.86); } } +:root[data-reduce="1"] .tile.enter { animation: fade-in var(--d-state) ease; } +.tile.out { opacity: 0; transform: scale(0.86); pointer-events: none; } +:root[data-reduce="1"] .tile.out { transform: none; } +.tile.add { border-style: dashed; } +.tile.add svg { width: 18px; height: 18px; } +.tile.add:active { transform: scale(var(--press-scale)); } +.tile.drag { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent); } +.tile.bad { border-color: var(--err); } +.tile.need { border-color: var(--warn); animation: shake 320ms var(--ease-out); } +:root[data-reduce="1"] .tile.need { animation: none; } +/* 上传:真实进度环 → 成功勾 + 一次金色光晕 */ +.tile .ring { + position: absolute; inset: 0; border-radius: inherit; background: var(--media-scrim); + display: grid; place-items: center; transition: opacity var(--d-state) ease; +} +.tile .ring i { + width: 26px; height: 26px; border-radius: 50%; + background: conic-gradient(var(--accent) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, 0.16) 0); + -webkit-mask: radial-gradient(circle, transparent 9.5px, #000 10.5px); + mask: radial-gradient(circle, transparent 9.5px, #000 10.5px); +} +.tile .ring.done { opacity: 0; } +.tile.flash { animation: tile-flash var(--d-flash) var(--ease-out); } +@keyframes tile-flash { from { box-shadow: var(--accent-ring); border-color: var(--accent); } } +:root[data-reduce="1"] .tile.flash { animation: none; } +.tile .ok-badge { + position: absolute; right: 3px; bottom: 3px; width: 16px; height: 16px; border-radius: 50%; + display: grid; place-items: center; background: var(--ok); color: var(--bg); + animation: pop-in var(--d-enter) var(--ease-spring); transition: opacity var(--d-state) ease; +} +.tile .ok-badge svg { width: 10px; height: 10px; } +.tile .ok-badge.gone { opacity: 0; } +@keyframes pop-in { from { opacity: 0; transform: scale(0.4); } } +:root[data-reduce="1"] .tile .ok-badge { animation: fade-in var(--d-state) ease; } +.tile .x { + position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; + background: var(--bg-4); border: 1px solid var(--line-2); display: grid; place-items: center; opacity: 0; + transition: opacity var(--d-state) ease; +} +.tile .x svg { width: 9px; height: 9px; } +.tile:focus-within .x { opacity: 1; } +@media (hover: hover) and (pointer: fine) { .tile:hover .x { opacity: 1; } .tile.add:hover { border-color: var(--text-3); color: var(--text); } } +@media (hover: none) { .tile .x { opacity: 1; } } +.tile .idx { position: absolute; left: 3px; top: 2px; font: 10px var(--mono); color: var(--on-media); text-shadow: 0 1px 2px #000; } +.slot-hint { font-size: 11px; color: var(--text-3); } +.slot-hint.err { color: var(--err); } +.slot-label .cnt { transition: color var(--d-state) ease; } +.slot-label .cnt.tick { color: var(--accent); } + +.prompt { + display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent; + padding: 12px 14px 6px; min-height: 52px; max-height: 180px; line-height: 1.6; +} +.prompt::placeholder { color: var(--text-3); } +.composer-foot { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px 8px; flex-wrap: wrap; } +.chip { + display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; + background: var(--bg-3); color: var(--text-2); font-size: 12px; white-space: nowrap; max-width: 280px; + transition: background-color var(--d-state) ease, color var(--d-state) ease, transform var(--d-press) var(--ease-out); +} +.chip:active { transform: scale(var(--press-scale)); } +.chip .lbl { overflow: hidden; text-overflow: ellipsis; } +.chip svg { width: 14px; height: 14px; flex: none; } +.chip.wf { color: var(--text); background: var(--bg-4); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line-2); } +.chip.wf.flash { animation: chip-flash 700ms var(--ease-out); } +@keyframes chip-flash { from { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); } } +:root[data-reduce="1"] .chip.wf.flash { animation: none; } +.chip.warn { color: var(--warn); } +.chip.err { color: var(--err); } +.chip.changed { color: var(--accent); } +@media (hover: hover) and (pointer: fine) { .chip:hover { background: var(--bg-4); color: var(--text); } } +.submit-group { margin-left: auto; display: flex; align-items: center; gap: 10px; } +.why { font-size: 12px; color: var(--warn); white-space: nowrap; text-decoration: underline dotted; text-underline-offset: 3px; } +.why.err { color: var(--err); } +/* 生成按钮:按下即缩,提交后文字换成「已提交」约 0.9 秒,期间仍可再次提交 */ +.gen-btn { height: 34px; padding: 0 18px; border-radius: 999px; display: inline-grid; min-width: 84px; } +.gen-btn > span { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: opacity var(--d-state) ease, transform var(--d-pop) var(--ease-out); } +.gen-btn > span svg { width: 13px; height: 13px; } +.gen-btn .l-sent { opacity: 0; transform: translateY(8px); } +.gen-btn.sent .l-idle { opacity: 0; transform: translateY(-8px); } +.gen-btn.sent .l-sent { opacity: 1; transform: none; } +:root[data-reduce="1"] .gen-btn > span { transform: none !important; } + +/* ---------- 右侧检视区 ---------- */ +.inspector { + border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-end; + min-height: 0; min-width: 0; overflow: hidden; background: var(--bg); + transition: opacity var(--d-drawer) ease; +} +.inspector > * { width: 420px; max-width: 100%; flex: none; } +.inspector > .insp-body { flex: 1; } +.desk.insp-off .inspector { opacity: 0; pointer-events: none; } +.insp-tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; } +.insp-body { overflow-y: auto; padding: 14px; } +.insp-body.slide-l { animation: slide-l var(--d-pop) var(--ease-out); } +.insp-body.slide-r { animation: slide-r var(--d-pop) var(--ease-out); } +@keyframes slide-l { from { opacity: 0; transform: translateX(-10px); } } +@keyframes slide-r { from { opacity: 0; transform: translateX(10px); } } +:root[data-reduce="1"] .insp-body.slide-l, :root[data-reduce="1"] .insp-body.slide-r { animation: fade-in var(--d-state) ease; } +.stage { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--stage-bg); aspect-ratio: 16 / 9; box-shadow: 0 0 0 1px var(--line); transition: box-shadow var(--d-state) ease; } +.stage.playing { box-shadow: 0 0 0 1px var(--accent-line); } +.stage-badge { + position: absolute; left: 10px; top: 10px; z-index: 4; display: inline-flex; align-items: center; gap: 6px; + height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11px; color: var(--accent); + background: var(--media-scrim); box-shadow: inset 0 0 0 1px var(--accent-line); pointer-events: none; + opacity: 0; transition: opacity var(--d-state) ease; +} +.stage.playing .stage-badge { opacity: 1; } +.stage-badge .eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; } +.stage-badge .eq i { width: 2px; background: currentColor; border-radius: 1px; animation: eq 900ms ease-in-out infinite; } +.stage-badge .eq i:nth-child(2) { animation-delay: -300ms; } +.stage-badge .eq i:nth-child(3) { animation-delay: -600ms; } +@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } } +:root[data-reduce="1"] .stage-badge .eq i { animation: none; height: 7px; } +.stage-progress { position: absolute; left: 16px; right: 16px; bottom: 16px; height: 3px; border-radius: 3px; background: var(--bg-4); overflow: hidden; } +.stage-progress i { position: absolute; inset: 0; background: var(--run-grad); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--d-progress) linear; } +.stage.portrait { aspect-ratio: 3 / 4; max-height: 480px; margin: 0 auto; } +.stage > img, .stage > video, .stage > .stage-empty { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity var(--d-state) ease; } +.stage .fade-out { opacity: 0; } +.stage-empty { display: grid; place-items: center; color: var(--text-3); font-size: 12px; background: var(--bg-2); } +.stage-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 12px 0; font-size: 12px; color: var(--text-3); } +.stage-meta b { color: var(--text-2); font-weight: 500; } +.stage-actions { display: flex; flex-wrap: wrap; gap: 6px; } +.section-title { font-size: 12px; color: var(--text-3); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; } +.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; font-size: 12px; } +.kv dt { color: var(--text-3); } +.kv dd { margin: 0; color: var(--text-2); word-break: break-all; } + +/* 参数表单(按工作流 JSON 生成) */ +.field { display: grid; gap: 6px; margin-bottom: 12px; } +.field label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); } +.field label .orig { color: var(--text-3); font-family: var(--mono); font-size: 11px; } +.input { + height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-3); + padding: 0 10px; outline: 0; width: 100%; + transition: border-color var(--d-state) ease; +} +.input:focus { border-color: var(--text-3); } +.input.changed { border-color: var(--accent-line); } +textarea.input { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; } +.fold { border-top: 1px solid var(--line); margin-top: 6px; } +.fold-head { + width: 100%; padding: 10px 0; display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; text-align: left; + transition: color var(--d-state) ease; +} +.fold-head svg { width: 12px; height: 12px; transition: transform var(--d-pop) var(--ease-out); } +.fold-head[aria-expanded="true"] svg { transform: rotate(90deg); } +@media (hover: hover) and (pointer: fine) { .fold-head:hover { color: var(--text); } } +.fold .collapse-in > :first-child { margin-top: 2px; } +.note { font-size: 12px; color: var(--text-3); padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-3); margin-bottom: 12px; } +.note.warn { color: var(--warn); background: var(--warn-soft); } +.note.err { color: var(--err); background: var(--err-soft); } +.note ul { margin: 6px 0 0; padding-left: 18px; } + +/* ---------- 浮层:工作流面板 ---------- */ +.pop { + position: fixed; z-index: 50; width: 520px; max-height: min(560px, 70vh); display: flex; flex-direction: column; + border-radius: var(--r-lg); background: var(--float-bg); box-shadow: var(--shadow-float); + opacity: 0; transform: scale(0.96); pointer-events: none; transform-origin: var(--origin, bottom left); + transition: opacity var(--d-pop) var(--ease-out), transform var(--d-pop) var(--ease-out); +} +.pop.on { opacity: 1; transform: none; pointer-events: auto; } +.pop.instant { transition: none; } +:root[data-reduce="1"] .pop { transform: none; } +.pop-search { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); } +.pop-search input { flex: 1; background: transparent; border: 0; outline: 0; font-size: 14px; } +.pop-list { overflow-y: auto; padding: 6px; } +.pop-group { font-size: 11px; color: var(--text-3); padding: 10px 10px 4px; display: flex; gap: 6px; } +.wf-row { + display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; + padding: 8px 10px; border-radius: var(--r-md); +} +.wf-row[aria-selected="true"] { background: var(--bg-4); } +.wf-row .n .cur { color: var(--accent); } +.wf-row .n { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.wf-row .s { grid-column: 1; display: flex; gap: 4px; flex-wrap: wrap; } +.wf-row .r { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 11px; text-align: right; } +.wf-row.off .n { color: var(--text-3); } +.pop-foot { border-top: 1px solid var(--line); padding: 8px; display: flex; gap: 6px; align-items: center; } +.pop-foot .hint { margin-left: auto; font-size: 11px; color: var(--text-3); display: flex; gap: 6px; align-items: center; } + +.menu { width: 260px; } +.menu .pop-list button { display: flex; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); gap: 8px; align-items: center; transition: background-color var(--d-state) ease; } +.menu .pop-list button:hover, .menu .pop-list button[aria-selected="true"] { background: var(--bg-4); } +.menu .pop-list button[aria-selected="true"] { color: var(--accent); } + +/* 删除确认:只用于删工作流/删项目这类不可逆的大操作;屏幕居中,从中心 scale(.96)→1 */ +.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); } +.confirm { z-index: 62; width: 400px; padding: 16px 16px 14px; gap: 10px; border: 1px solid var(--err-line); } +.confirm h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; } +.confirm h3::before { content: "!"; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--err); background: var(--err-soft); } +.confirm p { margin: 0; color: var(--text-2); font-size: 12px; } +.confirm .row-actions { justify-content: flex-end; } + +/* ---------- 抽屉:导入工作流 ---------- */ +.scrim { position: fixed; inset: 0; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity var(--d-drawer) ease; z-index: 60; } +.scrim.on { opacity: 1; pointer-events: auto; } +.drawer { + position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw; z-index: 61; + background: var(--float-bg); border-left: 1px solid var(--line-2); display: flex; flex-direction: column; + transform: translateX(100%); transition: transform var(--d-drawer) var(--ease-drawer); +} +.drawer.on { transform: none; } +:root[data-reduce="1"] .drawer { transform: none; opacity: 0; pointer-events: none; transition: opacity var(--d-drawer) ease; } +:root[data-reduce="1"] .drawer.on { opacity: 1; pointer-events: auto; } +.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); } +.drawer-head h2 { font-size: 15px; margin: 0; flex: 1; } +.drawer-body { flex: 1; overflow-y: auto; padding: 16px; } +.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); } +.drop { + border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 10px; + transition: border-color var(--d-state) ease, background-color var(--d-state) ease; +} +.drop.drag { border-color: var(--accent); background: var(--accent-soft); } +.drop textarea { width: 100%; min-height: 110px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; font: 12px/1.5 var(--mono); color: var(--text-2); resize: vertical; outline: 0; } +.checks { display: grid; gap: 8px; margin-top: 14px; } +.check { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); } +.check .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-4); color: var(--text-3); font-size: 11px; transition: background-color var(--d-state) ease, color var(--d-state) ease; } +.check.ok .ic { background: var(--ok-soft); color: var(--ok); } +.check.bad .ic { background: var(--err-soft); color: var(--err); } +.check.run .ic { background: var(--run-soft); color: var(--run); } +.check .t { font-weight: 500; } +.check .d { grid-column: 2; color: var(--text-3); font-size: 12px; } +.check .d ul { margin: 4px 0 0; padding-left: 16px; } +.slot-map { display: grid; gap: 6px; margin-top: 8px; } +.slot-map div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 6px 8px; border-radius: var(--r-sm); background: var(--bg-3); } +.usage-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } +.usage-pick button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 12px; } +.usage-pick button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); } + +/* ---------- Toast ---------- */ +.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 80; display: grid; gap: 8px; pointer-events: none; max-width: 400px; } +.toast { + display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: var(--r-md); + background: var(--float-bg); box-shadow: var(--shadow-float); pointer-events: auto; min-width: 280px; + transition: opacity var(--d-enter) var(--ease-drawer), transform var(--d-enter) var(--ease-drawer); +} +@starting-style { .toast { opacity: 0; transform: translateY(100%); } } +.toast.out { opacity: 0; transform: translateY(100%); } +:root[data-reduce="1"] .toast, :root[data-reduce="1"] .toast.out { transform: none; } +.toast .grow { flex: 1; } +.toast .ic { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); } +.toast .ic svg { width: 10px; height: 10px; } +.toast .ic.err { background: var(--err-soft); color: var(--err); } +.toast button { color: var(--accent); font-weight: 600; } + +/* ---------- 任务托盘 ---------- */ +.tray { width: 340px; } +.tray-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-md); width: 100%; text-align: left; } +.tray-row:hover { background: var(--bg-3); } +.tray-row .t { width: 36px; height: 36px; border-radius: 6px; background: var(--bg-4) center / cover; } +.tray-row .n { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.tray-row .m { font-size: 11px; color: var(--text-3); } + +/* ---------- 项目 / 创作流程 ---------- */ +.page { overflow-y: auto; padding: 24px 28px 40px; align-content: start; gap: 18px; } +.hero { + display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 16px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; +} +.hero .cover { aspect-ratio: 16 / 9; border-radius: var(--r-md); background: var(--bg-4) center / cover; box-shadow: inset 0 0 0 1px var(--on-media-line); } +.hero h2 { margin: 2px 0 6px; font-size: 20px; } +.hero p { margin: 0 0 12px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } +.track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 0 14px; } +.track button { text-align: left; padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-3); font-size: 12px; color: var(--text-2); transition: background-color var(--d-state) ease; } +.track button .k { display: block; font-size: 11px; color: var(--text-3); } +.track button.done .k { color: var(--ok); } +.track button.cur { background: var(--accent-wash), var(--bg-4); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent-lo); } +.track button.cur .k { color: var(--accent); } +.track button[aria-current="step"] { outline: 1px solid var(--text-3); } +.proj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; } +.proj { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); text-align: left; transition: border-color var(--d-state) ease, background-color var(--d-state) ease, transform var(--d-press) var(--ease-out); } +.proj:active { transform: scale(var(--press-scale)); } +@media (hover: hover) and (pointer: fine) { .proj:hover { border-color: var(--line-2); background: var(--bg-3); } } +.proj .pips { display: flex; gap: 3px; } +.proj .pips i { flex: 1; height: 3px; border-radius: 3px; background: var(--bg-4); } +.proj .pips i.d { background: var(--ok); } +.proj .pips i.c { background: var(--accent); } +.row-actions { display: flex; gap: 8px; flex-wrap: wrap; } +.shot { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); align-items: start; } +.shot .no { font: 600 13px var(--mono); color: var(--accent-lo); } +.shot .p { color: var(--text-2); font-size: 12.5px; } +.shot .en { margin-top: 6px; font: 11.5px/1.5 var(--mono); color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } +.placeholder { place-items: center; text-align: center; color: var(--text-3); padding: 40px; } +.placeholder h2 { color: var(--text); font-size: 16px; } + +/* 原型标记 */ +.proto-flag { font-size: 11px; color: var(--text-3); border: 1px dashed var(--line-2); padding: 2px 8px; border-radius: 999px; white-space: nowrap; } +.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; } +.switch input { accent-color: var(--accent-lo); } + +/* 底部标签栏(窄屏) */ +.tabbar { display: none; } +.mobile-only { display: none; } + +/* ---------- 中屏:检视区改为右侧浮层 ---------- */ +@media (max-width: 1180px) { + .desk, .desk.insp-off { grid-template-columns: minmax(0, 1fr); } + .desk.insp-off .inspector { opacity: 1; pointer-events: auto; } + .desk.insp-off .insp-open, .insp-toggle { display: none; } + .inspector { + position: fixed; top: 52px; right: 0; bottom: 0; width: 400px; z-index: 40; box-shadow: var(--shadow-float); + transform: translateX(100%); transition: transform var(--d-drawer) var(--ease-drawer); + } + .inspector.on { transform: none; } + :root[data-reduce="1"] .inspector { transform: none; opacity: 0; pointer-events: none; transition: opacity var(--d-drawer) ease; } + :root[data-reduce="1"] .inspector.on { opacity: 1; pointer-events: auto; } + .insp-close { display: inline-flex !important; } + .search-btn { min-width: 0; } + .search-btn .lbl { display: none; } +} + +/* ---------- 窄屏:底部标签栏 + 输入台底部抽屉 ---------- */ +@media (max-width: 760px) { + .app { grid-template-columns: 1fr; } + .rail { display: none; } + .main { grid-template-rows: 48px minmax(0, 1fr) 56px; } + .topbar { padding: 0 12px; gap: 8px; } + .topbar .hide-sm { display: none; } + .mobile-only { display: inline-flex; } + .tabbar { + display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--bg-2); + } + .tabbar button { display: grid; place-items: center; gap: 2px; font-size: 11px; color: var(--text-3); padding-top: 6px; } + .tabbar button svg { width: 20px; height: 20px; } + .tabbar button[aria-current="page"] { color: var(--accent); } + .filters { padding: 8px 12px; overflow-x: auto; } + .filters .count { display: none; } + .feed { padding: 12px 12px 4px; } + .take { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; } + .take-head { flex-wrap: wrap; row-gap: 2px; } + .take-out { grid-row: 1 / span 2; } + .take-state { grid-column: 1 / -1; flex-wrap: wrap; } + .take-state .txt, .take-state .err-txt { white-space: nowrap; } + .take-actions { margin-left: auto; } + .toasts { left: 12px; right: 12px; bottom: 124px; max-width: none; } + .thumb { width: 108px; } + .thumb.portrait { width: 72px; } + .bar { flex-basis: 80px; } + .composer-wrap { padding: 6px 10px 10px; } + .composer:not(.expanded) .slots, .composer:not(.expanded) .opt-chip { display: none; } + .composer:not(.expanded) .prompt { min-height: 40px; max-height: 40px; padding: 10px 12px 2px; white-space: nowrap; overflow: hidden; } + .composer.expanded { position: fixed; left: 0; right: 0; bottom: 56px; z-index: 45; border-radius: 16px 16px 0 0; border-bottom: 0; box-shadow: var(--shadow-float); } + .chip { max-width: 170px; } + .inspector { top: 0; width: 100vw; bottom: 0; z-index: 70; } + .pop { left: 0 !important; right: 0; top: auto !important; bottom: 0 !important; width: 100vw; border-radius: 16px 16px 0 0; max-height: 78vh; --origin: bottom center; } + .drawer { width: 100vw; } + .page { padding: 16px 12px 24px; } + .hero { grid-template-columns: 1fr; } + .track { grid-template-columns: repeat(5, minmax(64px, 1fr)); overflow-x: auto; } + .shot { grid-template-columns: 30px 1fr; } + .shot .btn { grid-column: 2; justify-self: start; } +} + +/* 滚动条 */ +::-webkit-scrollbar { width: 10px; height: 10px; } +::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 6px; border: 2px solid var(--bg); } +::-webkit-scrollbar-thumb:hover { background: var(--line-2); } +:root[data-reduce="1"] .composer-wrap::before { opacity: 0.3; } + +/* 系统「减少动态效果」由 app.js 同步为 :root[data-reduce="1"],所有降级规则只写一处 */ diff --git a/prototypes/hel-648-fusion/app.js b/prototypes/hel-648-fusion/app.js new file mode 100644 index 00000000..8c2bbe24 --- /dev/null +++ b/prototypes/hel-648-fusion/app.js @@ -0,0 +1,1531 @@ +/* HEL-648 融合原型:HEL-646 流水台交互 + HEL-645 放映厅配色。纯前端模拟,数据取自测试站 192.168.200.15:8080 的真实工作流与任务记录。 */ +(() => { + 'use strict'; + + const $ = (s, r = document) => r.querySelector(s); + const $$ = (s, r = document) => Array.from(r.querySelectorAll(s)); + const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); + const root = document.documentElement; + const reduceQuery = matchMedia('(prefers-reduced-motion: reduce)'); + const reduced = () => root.dataset.reduce === '1'; + const icon = (id) => ``; + const EASE_OUT = 'cubic-bezier(0.23, 1, 0.32, 1)'; + + // 重新触发一次性动画类(连续触发时从头播放,不排队) + function replay(el, cls, ms) { + if (!el) return; + el.classList.remove(cls); + void el.offsetWidth; + el.classList.add(cls); + clearTimeout(el['_t_' + cls]); + if (ms) el['_t_' + cls] = setTimeout(() => el.classList.remove(cls), ms); + } + + // 分段控件的滑块:移到当前选中项 + function paintSeg(seg, instant) { + if (!seg) return; + let pill = seg.querySelector('.seg-pill'); + if (!pill) { pill = document.createElement('span'); pill.className = 'seg-pill'; seg.prepend(pill); instant = true; } + const b = seg.querySelector('button[aria-pressed="true"]'); + if (!b || !b.offsetWidth) return; + pill.classList.toggle('instant', !!instant); + pill.style.setProperty('--x', b.offsetLeft + 'px'); + pill.style.setProperty('--w', b.offsetWidth + 'px'); + if (instant) { void pill.offsetWidth; pill.classList.remove('instant'); } + } + + // 侧栏当前页指示条:在图标之间滑动 + function paintRail(instant) { + const ind = $('.rail-ind'); + const b = $('.rail [aria-current="page"]'); + if (!ind) return; + if (!b || !b.offsetHeight) { ind.classList.remove('on'); return; } + if (instant) ind.style.transition = 'none'; + ind.style.setProperty('--y', b.offsetTop + (b.offsetHeight - 20) / 2 + 'px'); + ind.classList.add('on'); + if (instant) { void ind.offsetWidth; ind.style.transition = ''; } + } + + const USAGE = { + text2image: '文生图', image2image: '图生图', text2video: '文生视频', image2video: '图生视频', ref2video: '参考图生视频', + }; + const USAGE_ORDER = ['text2image', 'image2image', 'text2video', 'image2video', 'ref2video']; + const CONNS = [ + { id: 'local', name: '本机 ComfyUI-4080', url: 'http://192.168.200.12:8188', ok: true, ms: 22 }, + { id: 'hy', name: '恒源云', url: 'http://127.0.0.1:6008', ok: false, err: '连接被拒绝:目标端口没有服务在监听' }, + ]; + + const H3_PARAMS = [ + { key: 'aspect', label: '画面比例', kind: 'select', orig: '16:9', options: ['16:9', '9:16', '1:1', '4:3', '21:9'], common: true }, + { key: 'duration', label: '时长(秒)', kind: 'select', orig: '10', options: ['3', '5', '8', '10'], common: true, unit: '秒' }, + { key: 'seed', label: '随机种子', kind: 'seed', orig: '42', common: true }, + { key: 'megapixels', label: '总像素(百万)', kind: 'number', orig: '0.7', step: 0.1 }, + { key: 'steps', label: '采样步数', kind: 'number', orig: '4' }, + { key: 'denoise', label: '降噪强度', kind: 'number', orig: '1', step: 0.05 }, + ]; + const QWEN_T2I = [ + { key: 'aspect', label: '画面比例', kind: 'select', orig: '1:1', options: ['1:1', '3:4', '4:3', '16:9', '9:16'], common: true }, + { key: 'seed', label: '随机种子', kind: 'seed', orig: '593103825222985', common: true }, + { key: 'negative', label: '反向提示词', kind: 'textarea', orig: '' }, + { key: 'megapixels', label: '总像素(百万)', kind: 'number', orig: '1', step: 0.1 }, + { key: 'batch', label: '批次数量', kind: 'number', orig: '1' }, + { key: 'steps', label: '采样步数', kind: 'number', orig: '25' }, + { key: 'cfg', label: 'CFG', kind: 'number', orig: '1', step: 0.1 }, + { key: 'denoise', label: '降噪强度', kind: 'number', orig: '1', step: 0.05 }, + ]; + + const workflows = [ + { id: 13, name: 'H3 参考生视频·参考图(05 用户提供)', usage: 'ref2video', kind: 'video', conn: 'local', status: 'ok', statusText: '可用 · 近 3 次成功', + slots: [{ key: 'ref', label: '参考图', type: 'list', min: 1, max: 9 }], params: H3_PARAMS, + note: 'MiniMax H3 Ref2VA 官方限额:参考图最多 9 张;本工作流 JSON 只连了参考图,不显示参考视频 / 音频入口。', + defaultPrompt: '' }, + { id: 12, name: 'H3 图生视频·首帧(04 用户提供)', usage: 'image2video', kind: 'video', conn: 'local', status: 'ok', statusText: '可用 · 近 2 次成功', + slots: [{ key: 'first', label: '首帧图', type: 'single' }], params: H3_PARAMS, note: '首帧决定画面外观,提示词描述运动。' }, + { id: 11, name: 'Qwen Image 2.1 图片编辑(用户提供)', usage: 'image2image', kind: 'image', conn: 'local', status: 'error', statusText: '不可用 · 文件不完整', + slots: [{ key: 'image', label: '输入图', type: 'single' }], + params: [ + { key: 'resolution', label: '输出分辨率', kind: 'number', orig: '1024', common: true }, + { key: 'seed', label: '随机种子', kind: 'seed', orig: '278835418249884', common: true }, + { key: 'negative', label: '反向提示词', kind: 'textarea', orig: '模糊,低质量,文字乱码,变形' }, + { key: 'steps', label: '采样步数', kind: 'number', orig: '25' }, + { key: 'cfg', label: 'CFG', kind: 'number', orig: '1', step: 0.1 }, + { key: 'denoise', label: '降噪强度', kind: 'number', orig: '1', step: 0.05 }, + ], + errors: [ + '节点 1「Unet Loader (GGUF)」缺少节点类型(class_type),导出时 ComfyUI 未加载该自定义节点', + '节点 9「Patch Sage Attention KJ」缺少节点类型(class_type),导出时 ComfyUI 未加载该自定义节点', + '节点 6「K采样器」(KSampler)没有连接模型(model),模型加载链路在导出时丢失', + ] }, + { id: 10, name: 'qwen2.1', usage: 'text2image', kind: 'image', conn: 'local', status: 'ok', statusText: '可用 · 09-29 19:26 试运行通过', slots: [], params: QWEN_T2I }, + { id: 7, name: 'qwen-image-2.1', usage: 'text2image', kind: 'image', conn: null, status: 'idle', statusText: '未试运行 · 跟随默认连接', slots: [], params: QWEN_T2I }, + { id: 6, name: 'minimaxh3-文生图加速版', usage: 'text2video', kind: 'video', conn: null, status: 'idle', statusText: '未试运行 · 名称含“文生图”,实际判定为文生视频', slots: [], params: H3_PARAMS }, + { id: 5, name: 'MiniMax H3 文生视频(审核示例)', usage: 'text2video', kind: 'video', conn: null, status: 'idle', statusText: '未试运行', + slots: [], params: [ + { key: 'duration', label: 'Seconds', kind: 'select', orig: '10', options: ['5', '10'], common: true, unit: '秒' }, + { key: 'fps', label: 'fps', kind: 'number', orig: '24' }, + ] }, + { id: 4, name: 'Krea2 文生图(审核示例)', usage: 'text2image', kind: 'image', conn: null, status: 'warn', statusText: '上次失败 · 连接上缺 3 个模型', slots: [], params: [] }, + ]; + + const A = 'assets/'; + const G = [ + 'linear-gradient(135deg,#6a5cff,#ff7ac6)', 'linear-gradient(135deg,#ff9a3c,#ffd36e)', 'linear-gradient(135deg,#1f8f7a,#9be15d)', + 'linear-gradient(135deg,#2336a8,#5bc0ff)', 'linear-gradient(135deg,#8a2be2,#4b0082)', 'linear-gradient(135deg,#f25f5c,#247ba0)', + ]; + let seq = 100; + const takes = [ + { id: 16, wf: 6, scope: 'standalone', day: '昨天', time: '09-28 23:33', prompt: 'integrated_multimodal_description: a red paper lantern drifting slowly upward through light evening snow over a quiet canal, rippling water reflections', + inputs: [], params: { aspect: '16:9', duration: '3', seed: '42' }, status: 'done', elapsed: '2 分 10 秒', + out: { poster: A + 'v-t2v-16.jpg', src: A + 'v-t2v-16.mp4', w: 736, h: 416, dur: '0:02' } }, + { id: 21, wf: 6, scope: 'standalone', day: '昨天', time: '09-28 23:43', prompt: '(沿用工作流原值)地铁站台十镜头参考提示词', + inputs: [], params: { aspect: '16:9', duration: '5', seed: '42' }, status: 'done', elapsed: '2 分 42 秒', + out: { poster: A + 'v-t2v-21.jpg', src: A + 'v-t2v-21.mp4', w: 736, h: 416, dur: '0:05' } }, + { id: 31, wf: 4, scope: 'p1', source: '《雨夜便利店》创作流程', day: '今天', time: '09-29 08:48', prompt: 'Cinematic extreme wide static shot. Outside the modern 24-hour convenience store at night, heavy rain falls like a curtain…', + inputs: [], params: {}, status: 'failed', + error: { title: 'ComfyUI 拒绝执行:连接上缺 3 个模型文件', items: [ + '节点 149(CLIPLoader):ComfyUI 上没有「qwen3vl_4b_fp8_scaled.safetensors」', + '节点 148(UNETLoader):ComfyUI 上没有「Krea-2-Turbo.safetensors」', + '节点 152(LoraLoaderModelOnly):ComfyUI 上没有「krea2/Krea2-realism-V2.safetensors」', + ], raw: 'HTTP 400 · prompt_outputs_failed_validation' } }, + { id: 35, wf: 12, scope: 'standalone', day: '今天', time: '09-29 10:41', prompt: '镜头缓缓推进,画面中渐变色彩的微光流动', + inputs: [{ bg: G[3], name: 'test-a.png' }], params: { aspect: '16:9', duration: '3', seed: '42' }, status: 'done', elapsed: '49 秒', + out: { poster: A + 'v-i2v-35.jpg', src: A + 'v-i2v-35.mp4', w: 1152, h: 640, dur: '0:03' } }, + { id: 40, wf: 10, scope: 'standalone', day: '今天', time: '09-29 16:41', prompt: '一只戴墨镜的橘猫坐在电影院前排, 电影放映的光束打在毛上, 胶片感', + inputs: [], params: { aspect: '1:1', seed: '593103825222985' }, status: 'missing', elapsed: '14 秒', + out: { name: 'Qwen_image_2.1_00003.png', w: 1024, h: 1024 } }, + { id: 43, wf: 10, scope: 'standalone', day: '今天', time: '09-29 19:59', prompt: 'Greyscale fashion editorial portrait of an avant-garde woman tilted upwards in profile, captured with striking high-contrast chiaroscuro lighting. She wears oversized, thick-rimmed circular black sunglasses…', + inputs: [], params: { aspect: '3:4', seed: '593103825222985' }, status: 'done', elapsed: '13 秒', + out: { poster: A + 'i-t2i-43.jpg', src: A + 'i-t2i-43.jpg', w: 888, h: 1184, image: true } }, + { id: 44, wf: 13, scope: 'standalone', day: '今天', time: '09-29 20:00', prompt: '让图片中的人物动起来', + inputs: [{ bg: `url(${A}i-t2i-43.jpg)`, name: 'Qwen_image_2.1_00005.png' }], params: { aspect: '16:9', duration: '5', seed: '42', megapixels: '0.4' }, status: 'done', elapsed: '44 秒', + out: { poster: A + 'v-ref2v-44.jpg', src: A + 'v-ref2v-44.mp4', w: 864, h: 480, dur: '0:05' } }, + ]; + + const RESULT_FOR = { + ref2video: { poster: A + 'v-ref2v-44.jpg', src: A + 'v-ref2v-44.mp4', w: 864, h: 480, dur: '0:05' }, + image2video: { poster: A + 'v-i2v-35.jpg', src: A + 'v-i2v-35.mp4', w: 1152, h: 640, dur: '0:03' }, + text2video: { poster: A + 'v-t2v-16.jpg', src: A + 'v-t2v-16.mp4', w: 736, h: 416, dur: '0:02' }, + text2image: { poster: A + 'i-t2i-43.jpg', src: A + 'i-t2i-43.jpg', w: 888, h: 1184, image: true }, + image2image: { poster: A + 'i-t2i-43.jpg', src: A + 'i-t2i-43.jpg', w: 888, h: 1184, image: true }, + }; + + const state = { + wfId: 13, + connId: 'local', + slots: {}, + params: {}, + filter: 'all', + scope: 'all', + selected: 44, + context: null, + view: 'desk', + advOpen: false, + }; + + const wfById = (id) => workflows.find((w) => w.id === id); + const curWf = () => wfById(state.wfId); + const connById = (id) => CONNS.find((c) => c.id === id); + + /* ---------------- Toast ---------------- */ + function toast(text, opts = {}) { + const el = document.createElement('div'); + el.className = 'toast'; + const ic = opts.icon ? `${icon(opts.icon === 'err' ? 'x' : 'check')}` : ''; + el.innerHTML = `${ic}${text}${opts.action ? `` : ''}`; + $('#toasts').appendChild(el); + let done = false; + const close = () => { + if (done) return; + done = true; + el.classList.add('out'); + setTimeout(() => el.remove(), reduced() ? 130 : 240); + }; + if (opts.action) el.querySelector('button').addEventListener('click', () => { opts.onAction?.(); close(); }); + setTimeout(() => { opts.onTimeout?.(); close(); }, opts.duration || 3200); + return close; + } + + /* ---------------- 浮层管理 ---------------- */ + const layers = []; + function openLayer(el, { anchor, instant, origin, onClose, trigger, center } = {}) { + closeLayer(el, true); + el.classList.toggle('instant', !!instant || false); + if (anchor && innerWidth > 760) { + const r = anchor.getBoundingClientRect(); + const w = el.offsetWidth || 520; + if (origin?.startsWith('bottom') && r.top - el.offsetHeight - 16 < 0) origin = origin.replace('bottom', 'top'); + let left = Math.min(r.left, innerWidth - w - 12); + if (origin?.endsWith('right')) left = Math.max(12, r.right - w); + el.style.left = left + 'px'; + if (origin && origin.startsWith('top')) { el.style.top = r.bottom + 8 + 'px'; el.style.bottom = 'auto'; } + else { el.style.top = 'auto'; el.style.bottom = innerHeight - r.top + 8 + 'px'; } + el.style.setProperty('--origin', origin || 'bottom left'); + } else if (innerWidth > 760) { + el.style.left = `calc(50% - ${(el.offsetWidth || 520) / 2}px)`; + el.style.top = center ? `${Math.max(24, (innerHeight - el.offsetHeight) / 2)}px` : '12vh'; + el.style.bottom = 'auto'; + el.style.setProperty('--origin', center ? 'center' : 'top center'); + } + el.classList.add('on'); + layers.push({ el, onClose, trigger: trigger || document.activeElement }); + } + function closeLayer(el, silent) { + const i = layers.findIndex((l) => l.el === el); + if (i < 0) return; + const [l] = layers.splice(i, 1); + el.classList.remove('on'); + l.onClose?.(); + if (!silent && l.trigger && document.contains(l.trigger)) l.trigger.focus({ preventScroll: true }); + } + function closeTop() { + const l = layers[layers.length - 1]; + if (l) { closeLayer(l.el); return true; } + return false; + } + document.addEventListener('pointerdown', (e) => { + for (const l of [...layers]) { + if (l.el.classList.contains('drawer')) continue; + if (l.el.id === 'inspector' && e.target.closest('#feed, .pop, .toast')) continue; + if (!l.el.contains(e.target) && !(l.trigger && l.trigger.contains?.(e.target))) closeLayer(l.el, true); + } + }); + + /* ---------------- 工作流选择面板 ---------------- */ + let wfActive = 0; + let wfRows = []; + let wfFromCmd = false; + function renderWfList() { + const q = $('#wf-search').value.trim().toLowerCase(); + const match = (w) => !q || w.name.toLowerCase().includes(q) || USAGE[w.usage].includes(q) || slotSummary(w).includes(q); + let html = ''; + wfRows = []; + for (const u of USAGE_ORDER) { + const list = workflows.filter((w) => !w.deleted && w.usage === u && match(w)); + if (!list.length) continue; + html += `
${USAGE[u]} ${list.length}
`; + for (const w of list) { + const idx = wfRows.length; + wfRows.push({ type: 'wf', id: w.id }); + const conn = w.conn ? connById(w.conn).name : '跟随默认连接'; + const statusCls = w.status === 'ok' ? 'ok' : w.status === 'error' ? 'err' : w.status === 'warn' ? 'warn' : ''; + html += ``; + } + } + if (wfFromCmd) { + const jumps = [ + { label: '跳转 · 雨夜便利店 / 镜头脚本(待确认)', go: () => nav('flow') }, + { label: '跳转 · 项目总览', go: () => nav('projects') }, + ].filter((j) => !q || j.label.includes(q)); + if (jumps.length) { + html += '
跳转
'; + for (const j of jumps) { + const idx = wfRows.length; + wfRows.push({ type: 'jump', go: j.go }); + html += ``; + } + } + } + if (!wfRows.length) html = `
没有匹配“${esc(q)}”的工作流。可以。
`; + $('#wf-list').innerHTML = html; + wfActive = Math.max(0, Math.min(wfActive, wfRows.length - 1)); + paintWfActive(); + } + function paintWfActive() { + $$('#wf-list .wf-row').forEach((b) => b.setAttribute('aria-selected', String(+b.dataset.i === wfActive))); + $(`#wf-list .wf-row[data-i="${wfActive}"]`)?.scrollIntoView({ block: 'nearest' }); + } + function pickWfRow(i) { + const row = wfRows[i]; + if (!row) return; + closeLayer($('#wf-pop')); + if (row.type === 'jump') { row.go(); return; } + selectWorkflow(row.id); + } + function openWfPop(fromCmd) { + wfFromCmd = !!fromCmd; + $('#wf-search').value = ''; + renderWfList(); + wfActive = Math.max(0, wfRows.findIndex((r) => r.id === state.wfId)); + paintWfActive(); + openLayer($('#wf-pop'), fromCmd ? { instant: true, trigger: document.activeElement } : { anchor: $('#wf-chip'), origin: 'bottom left', trigger: $('#wf-chip') }); + setTimeout(() => $('#wf-search').focus(), 0); + } + $('#wf-chip').addEventListener('click', () => ($('#wf-pop').classList.contains('on') ? closeLayer($('#wf-pop')) : openWfPop(false))); + $('#wf-search').addEventListener('input', () => { wfActive = 0; renderWfList(); }); + $('#wf-search').addEventListener('keydown', (e) => { + if (e.key === 'ArrowDown') { wfActive = Math.min(wfRows.length - 1, wfActive + 1); paintWfActive(); e.preventDefault(); } + else if (e.key === 'ArrowUp') { wfActive = Math.max(0, wfActive - 1); paintWfActive(); e.preventDefault(); } + else if (e.key === 'Enter') { pickWfRow(wfActive); e.preventDefault(); } + }); + $('#wf-list').addEventListener('click', (e) => { + const b = e.target.closest('.wf-row'); + if (b) pickWfRow(+b.dataset.i); + if (e.target.closest('[data-act="import"]')) { closeLayer($('#wf-pop'), true); openImport(); } + }); + $('#wf-list').addEventListener('pointermove', (e) => { + const b = e.target.closest('.wf-row'); + if (b && +b.dataset.i !== wfActive) { wfActive = +b.dataset.i; paintWfActive(); } + }); + $('#import-open').addEventListener('click', () => { closeLayer($('#wf-pop'), true); openImport(); }); + + function slotSummary(w) { + if (!w.slots.length) return '仅提示词'; + return w.slots.map((s) => (s.type === 'list' ? `${s.label} ${s.min}–${s.max} 张` : `${s.label} ×1`)).join(' · '); + } + + function selectWorkflow(id, { keepPrompt = true } = {}) { + const prev = curWf(); + const w = wfById(id); + state.wfId = id; + // 已上传的图片跨工作流保留(按新槽位上限截断);参数回到新工作流原值 + const nextSlots = {}; + for (const s of w.slots) { + const carry = state.slots[s.key] || (prev.slots[0] ? state.slots[prev.slots[0].key] : null) || []; + nextSlots[s.key] = carry.slice(0, s.type === 'list' ? s.max : 1); + } + state.slots = nextSlots; + state.params = {}; + if (!keepPrompt) $('#prompt').value = w.defaultPrompt || ''; + if (w.conn) state.connId = w.conn; + const changed = prev.id !== id; + animateHeight($('#slots'), () => renderComposer({ enter: changed })); + renderParams(); + if (changed) { + replay($('#wf-chip'), 'flash', 700); + toast(`已切换到「${esc(w.name)}」· ${esc(slotSummary(w))}`, { duration: 2000 }); + } + } + + // 容器高度随内容变化平滑过渡;进行中再次变化时从当前高度接着走 + function animateHeight(el, mutate) { + const from = el.offsetHeight; + el.getAnimations().forEach((a) => a.cancel()); + mutate(); + const to = el.offsetHeight; + if (reduced() || Math.abs(from - to) < 2) return; + el.animate([{ height: from + 'px' }, { height: to + 'px' }], { duration: 220, easing: EASE_OUT }); + } + + /* ---------------- 输入台 ---------------- */ + function renderComposer({ enter } = {}) { + const w = curWf(); + $('#wf-chip-label').textContent = w.name; + $('#wf-chip').classList.toggle('err', w.status === 'error'); + renderSlots({ enter }); + renderCommonChips(); + validate(); + } + + let uidSeq = 0; + const tileBg = (bg) => (bg.startsWith('url') || bg.startsWith('linear') ? bg : `url(${bg})`); + function renderSlots({ enter } = {}) { + const w = curWf(); + const box = $('#slots'); + box.innerHTML = w.slots.map((s) => { + const items = state.slots[s.key] || []; + const max = s.type === 'list' ? s.max : 1; + const tiles = items.map((it, i) => { + it.uid = it.uid || ++uidSeq; + const cls = it.fresh ? 'enter' : ''; + it.fresh = false; + return ` +
+ ${s.type === 'list' ? `${i + 1}` : ''} + ${it.uploading ? `` : ''} + +
`; + }).join(''); + const add = items.length < max ? `` : ''; + const done = items.filter((it) => !it.uploading).length; + const hint = s.type === 'list' ? `${s.min}–${s.max} 张 · 已选 ${done}/${max}${items.length >= max ? ' · 已达上限' : ''}` : `必填 · 已选 ${done}/1`; + return `
+
${esc(s.label)}*${hint} + ${takes.some((t) => t.status === 'done' && t.out?.image) ? `` : ''} +
+
${tiles}${add}
+
+
`; + }).join(''); + } + + let pendingSlot = null; + $('#slots').addEventListener('click', (e) => { + const add = e.target.closest('[data-add]'); + const rm = e.target.closest('[data-remove]'); + const fr = e.target.closest('[data-from-results]'); + if (add) { pendingSlot = add.dataset.add; $('#file-input').multiple = curWf().slots.find((s) => s.key === pendingSlot).type === 'list'; $('#file-input').click(); } + if (rm) { + const [k, i] = rm.dataset.remove.split(':'); + const it = state.slots[k][+i]; + const tile = rm.closest('.tile'); + if (it.uploading) { it.uploading = false; slotHint(k, `已取消上传「${it.name}」`); } + tile.classList.add('out'); + setTimeout(() => { + const at = state.slots[k].indexOf(it); + if (at >= 0) state.slots[k].splice(at, 1); + animateHeight($('#slots'), () => renderSlots()); + validate(); + }, reduced() ? 120 : 150); + } + if (fr) openFromResults(fr); + }); + + const tileEl = (it) => $(`#slots .tile[data-uid="${it.uid}"]`); + // 模拟真实上传进度(正式版用 XHR upload.onprogress),× 可随时取消 + function simulateUpload(key, it) { + const dur = 650 + Math.random() * 650; + const t0 = performance.now(); + const step = (now) => { + if (!it.uploading) return; + it.progress = Math.min(1, (now - t0) / dur); + tileEl(it)?.querySelector('.ring i')?.style.setProperty('--p', it.progress); + if (it.progress < 1) requestAnimationFrame(step); + else finishUpload(key, it); + }; + requestAnimationFrame(step); + } + function finishUpload(key, it) { + it.uploading = false; + const el = tileEl(it); + if (el) { + const ring = el.querySelector('.ring'); + ring?.classList.add('done'); + setTimeout(() => ring?.remove(), 200); + el.querySelector('.x').setAttribute('aria-label', `移除 ${it.name}`); + replay(el, 'flash', 900); + const badge = document.createElement('span'); + badge.className = 'ok-badge'; + badge.innerHTML = icon('check'); + el.appendChild(badge); + setTimeout(() => badge.classList.add('gone'), 1100); + setTimeout(() => badge.remove(), 1300); + } + refreshCount(key); + validate(); + } + function refreshCount(key) { + const slot = curWf().slots.find((s) => s.key === key); + const items = state.slots[key] || []; + const done = items.filter((x) => !x.uploading).length; + const cnt = $(`[data-cnt="${key}"]`); + if (!cnt) return; + cnt.textContent = `已选 ${done}/${slot?.type === 'list' ? slot.max : 1}`; + replay(cnt, 'tick', 700); + } + $('#file-input').addEventListener('change', (e) => { addFiles(pendingSlot, e.target.files); e.target.value = ''; }); + + function slotHint(key, text, isErr) { + const el = $(`[data-hint="${key}"]`); + if (!el) return; + el.textContent = text; + el.classList.toggle('err', !!isErr); + clearTimeout(el._t); + el._t = setTimeout(() => { el.textContent = ''; }, 2600); + } + + function addFiles(key, files) { + const w = curWf(); + const slot = w.slots.find((s) => s.key === key) || w.slots[0]; + if (!slot) { toast('当前工作流没有图片输入槽,不能添加图片。换一个图生图 / 图生视频 / 参考图生视频工作流再试。'); return; } + key = slot.key; + const max = slot.type === 'list' ? slot.max : 1; + state.slots[key] = state.slots[key] || []; + let rejected = 0; let overflow = 0; + const started = []; + for (const f of Array.from(files)) { + if (!/^image\/(png|jpeg|webp)$/.test(f.type)) { rejected++; continue; } + if (f.size > 20 * 1024 * 1024) { rejected++; continue; } + if (slot.type === 'single') { state.slots[key].forEach((x) => { x.uploading = false; }); state.slots[key] = []; } + if (state.slots[key].length >= max) { overflow++; continue; } + const it = { bg: `url(${URL.createObjectURL(f)})`, name: f.name, uploading: true, progress: 0, fresh: true }; + state.slots[key].push(it); + started.push(it); + } + animateHeight($('#slots'), () => renderSlots()); + validate(); + started.forEach((it) => simulateUpload(key, it)); + if (rejected) slotHint(key, `有 ${rejected} 个文件未添加:仅支持 PNG / JPG / WebP,单张不超过 20MB`, true); + else if (overflow) slotHint(key, `已达上限 ${max} 张,多出的 ${overflow} 张未添加`, true); + } + + function openFromResults(anchor) { + const key = anchor.dataset.fromResults; + const imgs = takes.filter((t) => t.status === 'done' && t.out?.image); + $('#menu-list').innerHTML = imgs.map((t) => ``).join(''); + openLayer($('#menu-pop'), { anchor, origin: 'bottom left', trigger: anchor }); + $('#menu-list').onclick = (e) => { + const b = e.target.closest('[data-pick]'); + if (!b) return; + const t = takes.find((x) => x.id === +b.dataset.pick); + pushInput(key, { bg: `url(${t.out.poster})`, name: `结果 #${t.id}` }); + closeLayer($('#menu-pop')); + }; + } + function pushInput(key, it) { + const slot = curWf().slots.find((s) => s.key === key); + if (!slot) return false; + state.slots[key] = state.slots[key] || []; + if (slot.type === 'single') state.slots[key] = []; + if (state.slots[key].length >= slot.max) { slotHint(key, `已达上限 ${slot.max} 张`, true); return false; } + it.fresh = true; + state.slots[key].push(it); + animateHeight($('#slots'), () => renderSlots()); + validate(); + replay(tileEl(it), 'flash', 900); + return true; + } + + // 拖入:整个输入台都是投放区,落在哪个槽就进哪个槽 + const composer = $('#composer'); + const clearDrag = () => { composer.classList.remove('drag'); $$('#slots .tile.drag').forEach((t) => t.classList.remove('drag')); }; + composer.addEventListener('dragover', (e) => { + if (!curWf().slots.length) return; + e.preventDefault(); + composer.classList.add('drag'); + const tile = e.target.closest('.tile.add') || $('#slots .tile.add'); + $$('#slots .tile.add').forEach((t) => t.classList.toggle('drag', t === tile)); + }); + composer.addEventListener('dragleave', (e) => { if (!composer.contains(e.relatedTarget)) clearDrag(); }); + composer.addEventListener('drop', (e) => { + e.preventDefault(); + const tile = e.target.closest('[data-add],[data-slot]'); + clearDrag(); + addFiles(tile ? tile.dataset.add || tile.dataset.slot : curWf().slots[0]?.key, e.dataTransfer.files); + }); + + function paramValue(p) { return state.params[p.key] ?? p.orig; } + function changedCount() { return curWf().params.filter((p) => state.params[p.key] !== undefined && state.params[p.key] !== p.orig).length; } + + function renderCommonChips() { + const w = curWf(); + const conn = connById(state.connId); + const chips = w.params.filter((p) => p.common).map((p) => { + const v = paramValue(p); + const changed = state.params[p.key] !== undefined && v !== p.orig; + if (p.kind === 'seed') return ``; + return ``; + }); + chips.unshift(``); + $('#common-chips').innerHTML = chips.join(''); + const n = changedCount(); + $('#params-chip-label').textContent = n ? `参数 · 已改 ${n} 项` : '全部参数'; + $('#params-chip').classList.toggle('changed', n > 0); + } + + $('#common-chips').addEventListener('click', (e) => { + const b = e.target.closest('[data-chip]'); + if (!b) return; + const key = b.dataset.chip; + if (key === 'conn') { + $('#menu-list').innerHTML = CONNS.map((c) => ``).join(''); + openLayer($('#menu-pop'), { anchor: b, origin: 'bottom left', trigger: b }); + $('#menu-list').onclick = (ev) => { + const x = ev.target.closest('[data-conn]'); + if (!x) return; + state.connId = x.dataset.conn; + closeLayer($('#menu-pop')); + renderCommonChips(); validate(); + }; + return; + } + const p = curWf().params.find((q) => q.key === key); + if (p.kind === 'seed') { state.params.seed = String(Math.floor(Math.random() * 1e9)); renderCommonChips(); renderParams(); return; } + $('#menu-list').innerHTML = p.options.map((o) => ``).join(''); + openLayer($('#menu-pop'), { anchor: b, origin: 'bottom left', trigger: b }); + $('#menu-list').onclick = (ev) => { + const x = ev.target.closest('[data-opt]'); + if (!x) return; + state.params[key] = x.dataset.opt; + closeLayer($('#menu-pop')); + renderCommonChips(); renderParams(); + }; + }); + + function validate() { + const w = curWf(); + const why = $('#why'); + const conn = connById(state.connId); + let msg = ''; let err = false; let act = null; + const missing = w.slots.filter((s) => (state.slots[s.key] || []).length < (s.type === 'list' ? s.min : 1)); + const uploading = w.slots.some((s) => (state.slots[s.key] || []).some((it) => it.uploading)); + if (w.status === 'error') { msg = '工作流不可用 · 查看原因'; err = true; act = () => showParamsTab(); } + else if (!conn.ok) { msg = `「${conn.name}」连不上 · 换连接`; err = true; act = () => $('[data-chip="conn"]')?.click(); } + else if (missing.length) { msg = `还缺:${missing.map((s) => s.label).join('、')}`; act = () => flashSlot(missing[0].key); } + else if (uploading) { msg = '素材上传中…'; } + else if (!$('#prompt').value.trim()) { msg = '还缺:提示词'; act = () => $('#prompt').focus(); } + why.hidden = !msg; + why.textContent = msg; + why.classList.toggle('err', err); + why.onclick = act; + $('#gen-btn').disabled = !!msg; + } + function flashSlot(key) { + const t = $(`[data-add="${key}"]`) || $(`[data-slot="${key}"]`); + if (!t) return; + t.classList.add('need'); + t.focus(); + setTimeout(() => t.classList.remove('need'), 1200); + if (innerWidth <= 760) composer.classList.add('expanded'); + } + $('#prompt').addEventListener('input', () => { + const el = $('#prompt'); + el.style.height = 'auto'; + el.style.height = Math.min(el.scrollHeight, 180) + 'px'; + validate(); + }); + $('#prompt').addEventListener('focus', () => { if (innerWidth <= 760) composer.classList.add('expanded'); }); + document.addEventListener('pointerdown', (e) => { + if (innerWidth <= 760 && composer.classList.contains('expanded') && !composer.contains(e.target) && !e.target.closest('.pop')) composer.classList.remove('expanded'); + }); + + /* ---------------- 提交与进度 ---------------- */ + function submit() { + if ($('#gen-btn').disabled) { $('#why').click(); return; } + const w = curWf(); + const conn = connById(state.connId); + const inputs = w.slots.flatMap((s) => (state.slots[s.key] || []).map((it) => ({ bg: it.bg, name: it.name }))); + const params = {}; + for (const p of w.params) params[p.key] = paramValue(p); + const t = { + id: ++seq, wf: w.id, scope: state.context ? 'p1' : 'standalone', source: state.context ? '《雨夜便利店》镜头 S1' : null, + day: '今天', time: nowStr(), prompt: $('#prompt').value.trim(), inputs, params, status: 'queued', progress: 0, phase: '提交中', isNew: true, demo: true, + conn: conn.name, + }; + takes.push(t); + state.selected = t.id; + if (state.filter === 'failed' || (state.filter !== 'all' && state.filter !== w.kind)) setFilter('all'); + renderFeed({ scrollToEnd: true }); + renderPreview(true); + updateTray(); + composer.classList.remove('expanded'); + const gb = $('#gen-btn'); + gb.classList.add('sent'); + clearTimeout(gb._sent); + gb._sent = setTimeout(() => gb.classList.remove('sent'), 900); + toast(`已加入队列 · ${esc(conn.name)}`, { icon: 'ok', duration: 2400 }); + runSim(t); + } + function nowStr() { + const d = new Date(); + const p = (n) => String(n).padStart(2, '0'); + return `09-29 ${p(d.getHours())}:${p(d.getMinutes())}`; + } + function runSim(t) { + const w = wfById(t.wf); + const steps = w.kind === 'video' + ? [[t.inputs.length ? '上传素材' : '提交到 ComfyUI', 0.05], ['排队中 · 第 1 位', 0.08], ['采样 1/4', 0.25], ['采样 2/4', 0.42], ['采样 3/4', 0.6], ['采样 4/4', 0.76], ['解码视频', 0.9], ['保存结果', 0.97]] + : [['提交到 ComfyUI', 0.05], ['排队中 · 第 1 位', 0.1], ['采样 8/25', 0.35], ['采样 17/25', 0.65], ['采样 25/25', 0.88], ['保存结果', 0.97]]; + let i = 0; + const started = Date.now(); + const tick = () => { + if (!takes.includes(t)) return; + if (w.status === 'warn' && i === 1) { + // Krea2 在测试站 09-29 08:48 的真实报错:连接上缺 3 个模型,ComfyUI 校验阶段直接拒绝 + t.status = 'failed'; + t.error = { ...takes.find((x) => x.id === 31).error, replay: true }; + t.open = false; + patchTake(t, 'failed'); + updateTray(); + if (state.selected === t.id) renderPreview(true); + return; + } + if (i < steps.length) { + const [phase, p] = steps[i++]; + t.status = i <= 2 ? 'queued' : 'running'; + t.phase = phase; t.progress = p; + t.elapsedMs = Date.now() - started; + patchTake(t); + if (state.selected === t.id) patchPreviewProgress(t); + setTimeout(tick, 650 + Math.random() * 300); + } else { + t.status = 'done'; + t.justDone = true; + t.progress = 1; + t.out = { ...RESULT_FOR[w.usage] }; + t.elapsed = `${Math.round((Date.now() - started) / 1000)} 秒(演示加速)`; + patchTake(t, 'done'); + updateTray(); + if (state.selected === t.id) renderPreview(true, { autoplay: true }); + if (!isTakeVisible(t)) toast(`「${esc(w.name)}」已完成`, { icon: 'ok', action: '查看', onAction: () => selectTake(t.id, { scroll: true }) }); + } + updateTray(); + }; + setTimeout(tick, 250); + } + function isTakeVisible(t) { + const el = $(`.take[data-id="${t.id}"]`); + if (!el || state.view !== 'desk') return false; + const r = el.getBoundingClientRect(); const f = $('#feed').getBoundingClientRect(); + return r.bottom > f.top && r.top < f.bottom; + } + $('#gen-btn').addEventListener('click', submit); + + /* ---------------- 记录流 ---------------- */ + function visibleTakes() { + return takes.filter((t) => { + if (state.scope !== 'all' && t.scope !== state.scope) return false; + const w = wfById(t.wf); + if (state.filter === 'image') return w.kind === 'image'; + if (state.filter === 'video') return w.kind === 'video'; + if (state.filter === 'failed') return t.status === 'failed' || t.status === 'missing'; + return true; + }); + } + function takeHTML(t) { + const w = wfById(t.wf); + const sel = t.id === state.selected; + const src = t.source || (w.kind === 'video' ? '独立生视频' : '独立生图'); + const inputs = t.inputs.length + ? `
${t.inputs.slice(0, 4).map((i) => ``).join('')}${t.inputs.length > 4 ? `+${t.inputs.length - 4}` : ''}
` : ''; + let out = ''; + const portrait = t.out && t.out.h > t.out.w; + if (t.status === 'done') { + out = `
${t.out.image ? '' : `${icon('play')}${t.out.dur}`}
`; + } else if (t.status === 'missing') { + out = '
结果文件已不在
服务器上
'; + } else if (t.status === 'failed') { + out = '
未生成
'; + } else { + out = `
${esc(t.phase)}
`; + } + let st = ''; + if (t.status === 'done') st = `完成用时 ${esc(t.elapsed)}`; + else if (t.status === 'queued' || t.status === 'running') st = `${t.status === 'queued' ? '排队' : '生成中'}${esc(t.phase)} · ${Math.round(t.progress * 100)}%`; + else if (t.status === 'failed') st = `失败${esc(t.error.title)}`; + else if (t.status === 'missing') st = '文件缺失记录还在,产物已被清理或移动'; + const gone = !!w.deleted; + const actions = t.status === 'done' + ? `${gone ? '' : ''}` + : t.status === 'failed' ? `${gone ? '' : ''}` + : t.status === 'missing' ? `${gone ? '' : ''}` : ''; + const errList = t.status === 'failed' + ? `
` + : ''; + return `
+ +
${esc(w.name)}${USAGE[w.usage]}${gone ? '工作流已删除' : ''}${esc(src)} · ${esc(t.time.slice(6))}
+
${esc(t.prompt || '(使用工作流原提示词)')}
+ ${inputs ? `
${inputs}
` : ''} +
${st}
${actions}
+
${out}
+ ${errList} +
`; + } + function renderFeed({ scrollToEnd } = {}) { + const list = visibleTakes(); + let html = ''; let day = ''; + for (const t of list) { + if (t.day !== day) { day = t.day; html += `
${day}
`; } + html += takeHTML(t); + } + if (!list.length) html = `
${state.filter === 'failed' ? '没有失败或缺失的记录。' : '这里还没有记录。选好工作流、写下提示词,按 Ctrl + Enter 生成。'}
`; + const feed = $('#feed'); + feed.innerHTML = html; + takes.forEach((t) => { t.isNew = false; }); + const running = takes.filter((t) => t.status === 'queued' || t.status === 'running').length; + $('#feed-count').textContent = `${list.length} 条记录${running ? ` · ${running} 个进行中` : ''}`; + if (scrollToEnd) requestAnimationFrame(() => { feed.scrollTop = feed.scrollHeight; }); + } + // 进行中:原地更新进度与状态字;完成/失败:整条替换并播一次对应反馈 + function patchTake(t, outcome) { + const el = $(`.take[data-id="${t.id}"]`); + if (!el) return; + if (!outcome && el.querySelector('.bar')) { + el.querySelector('.bar i').style.setProperty('--p', t.progress); + el.querySelector('.take-state .txt').textContent = `${t.phase} · ${Math.round(t.progress * 100)}%`; + const tag = el.querySelector('.take-state .tag'); + const label = t.status === 'queued' ? '排队' : '生成中'; + if (tag.textContent !== label) { tag.textContent = label; replay(tag, 'swap', 260); } + el.querySelector('.thumb.pending').textContent = t.phase; + return; + } + const tmp = document.createElement('div'); + tmp.innerHTML = takeHTML(t); + t.justDone = false; + const next = tmp.firstElementChild; + el.replaceWith(next); + next.querySelector('.take-state .tag')?.classList.add('swap'); + if (outcome === 'done') replay(next, 'done-flash', 900); + if (outcome === 'failed') { + replay(next, 'shake', 340); + setTimeout(() => setTakeOpen(t, true), reduced() ? 0 : 160); + } + const running = takes.filter((x) => x.status === 'queued' || x.status === 'running').length; + $('#feed-count').textContent = `${visibleTakes().length} 条记录${running ? ` · ${running} 个进行中` : ''}`; + } + function setTakeOpen(t, open) { + t.open = open; + const el = $(`.take[data-id="${t.id}"]`); + if (!el) return; + el.classList.toggle('open', open); + el.querySelector('.collapse')?.classList.toggle('open', open); + const b = el.querySelector('[data-act="detail"]'); + if (b) { b.textContent = open ? '收起' : '详情'; b.setAttribute('aria-expanded', String(open)); } + } + + $('#feed').addEventListener('click', (e) => { + const el = e.target.closest('.take'); + if (!el) return; + const t = takes.find((x) => x.id === +el.dataset.id); + const act = e.target.closest('[data-act]')?.dataset.act; + if (act === 'detail') { setTakeOpen(t, !t.open); return; } + if (act === 'retry') { retry(t); return; } + if (act === 'delete') { removeTake(t); return; } + if (act === 'reuse') { reuse(t); return; } + if (act === 'download') { toast(`原型不连后端:正式版直接下载 ${t.out.image ? '图片' : 'MP4'} 原文件`); return; } + if (act === 'cancel') { + collapseOut(el, () => { takes.splice(takes.indexOf(t), 1); renderFeed(); renderPreview(false); updateTray(); }); + toast('已取消该任务,ComfyUI 队列中的对应任务同步中断', { icon: 'ok' }); + return; + } + selectTake(t.id, { fromPointer: true }); + }); + + // 选中框从旧位置滑到新记录;中途再点会从当前位置继续 + function slideMark(fromRect, toEl) { + const mark = toEl?.querySelector('.sel-mark'); + if (!mark || !fromRect || reduced()) return; + const to = toEl.getBoundingClientRect(); + if (Math.abs(fromRect.top - to.top) < 1 && Math.abs(fromRect.height - to.height) < 1) return; + mark.animate([ + { top: `${fromRect.top - to.top - 1}px`, bottom: `${to.bottom - fromRect.bottom - 1}px` }, + { top: '-1px', bottom: '-1px' }, + ], { duration: 220, easing: EASE_OUT }); + } + const markRect = () => $(`.take.selected .sel-mark`)?.getBoundingClientRect(); + + function selectTake(id, { fromPointer, scroll } = {}) { + if (!takes.some((t) => t.id === id)) return; + if (state.view !== 'desk') nav('desk'); + const prev = state.selected; + const from = fromPointer ? markRect() : null; + state.selected = id; + $$('.take').forEach((el) => { const on = +el.dataset.id === id; el.classList.toggle('selected', on); el.setAttribute('aria-selected', String(on)); }); + const el = $(`.take[data-id="${id}"]`); + if (prev !== id) slideMark(from, el); + if (el && (scroll || !fromPointer)) el.scrollIntoView({ block: 'nearest', behavior: reduced() || !scroll ? 'auto' : 'smooth' }); + if (prev !== id) renderPreview(!!fromPointer, { autoplay: !!fromPointer }); + showPreviewTab(); + if (fromPointer) setInspector(true); + if (innerWidth <= 1180 && fromPointer) openInspector(); + } + + // 记录离场:先淡出左移,再收起高度让下方记录自然补位 + function collapseOut(el, done) { + if (!el) { done(); return; } + el.classList.add('leaving'); + if (reduced()) { setTimeout(done, 120); return; } + setTimeout(() => { + const h = el.offsetHeight; + el.style.overflow = 'hidden'; + el.animate([ + { height: h + 'px', marginBottom: '8px', paddingTop: '12px', paddingBottom: '12px' }, + { height: '0px', marginBottom: '0px', paddingTop: '0px', paddingBottom: '0px' }, + ], { duration: 200, easing: EASE_OUT, fill: 'forwards' }).onfinish = done; + }, 150); + } + + // 删工作流是不可逆的大操作:居中确认弹层 + 遮罩(单条记录删除不弹窗,见 removeTake) + let pendingWf = null; + function askDeleteWorkflow(w, trigger) { + const running = takes.filter((t) => t.wf === w.id && (t.status === 'queued' || t.status === 'running')).length; + const used = takes.filter((t) => t.wf === w.id).length; + $('#confirm-title').textContent = `删除工作流「${w.name}」?`; + $('#confirm-desc').innerHTML = running + ? `该工作流还有 ${running} 个排队或执行中的任务,请先等任务完成或取消任务,再删除该工作流。` + : `它的导入检查与试运行记录会一并清除,此操作不可恢复。${used ? `用它生成的 ${used} 条记录与结果文件保留,标为「工作流已删除」。` : ''}`; + $('#confirm-ok').disabled = !!running; + pendingWf = running ? null : w; + $('#scrim').classList.add('on'); + openLayer($('#confirm-pop'), { center: true, trigger, onClose: () => { if (!$('#drawer').classList.contains('on')) $('#scrim').classList.remove('on'); } }); + setTimeout(() => (running ? $('#confirm-cancel') : $('#confirm-ok')).focus({ preventScroll: true }), 0); + } + $('#confirm-cancel').addEventListener('click', () => { pendingWf = null; closeLayer($('#confirm-pop')); }); + $('#confirm-ok').addEventListener('click', () => { + const w = pendingWf; + pendingWf = null; + closeLayer($('#confirm-pop')); + if (!w) return; + w.deleted = true; + if (state.wfId === w.id) selectWorkflow((workflows.find((x) => !x.deleted && x.status === 'ok' && x.kind === w.kind) || workflows.find((x) => !x.deleted)).id); + renderFeed(); + renderPreview(false); + toast(`已删除工作流「${esc(w.name)}」`, { icon: 'ok', duration: 2600 }); + }); + + function moveSelection(delta) { + const list = visibleTakes(); + if (!list.length) return; + let i = list.findIndex((t) => t.id === state.selected); + i = i < 0 ? list.length - 1 : Math.max(0, Math.min(list.length - 1, i + delta)); + selectTake(list[i].id, { fromPointer: false }); + } + + // 单条记录:立即收起 + 5 秒撤销;Toast 结束才真正调用删除接口 + function removeTake(t) { + const el = $(`.take[data-id="${t.id}"]`); + const w = wfById(t.wf); + const idx = takes.indexOf(t); + const vis = visibleTakes(); + const vi = vis.indexOf(t); + const neighbor = vis[vi + 1] || vis[vi - 1]; + const wasSelected = state.selected === t.id; + const from = wasSelected ? markRect() : null; + const keepFeed = () => { const keep = $('#feed').scrollTop; renderFeed(); $('#feed').scrollTop = keep; }; + let undone = false; + collapseOut(el, () => { + if (undone) return; + takes.splice(takes.indexOf(t), 1); + if (wasSelected) state.selected = neighbor ? neighbor.id : null; + keepFeed(); + if (wasSelected) { slideMark(from, $(`.take[data-id="${state.selected}"]`)); renderPreview(true); } + updateTray(); + }); + toast(`已删除「${esc(w.name)}」这条记录${t.status === 'done' ? '及其结果文件' : ''}`, { + action: '撤销', duration: 5000, + onAction: () => { + undone = true; + if (!takes.includes(t)) takes.splice(Math.min(idx, takes.length), 0, t); + t.isNew = true; + const prevMark = markRect(); + state.selected = t.id; + keepFeed(); + const back = $(`.take[data-id="${t.id}"]`); + slideMark(prevMark, back); + back?.scrollIntoView({ block: 'nearest', behavior: reduced() ? 'auto' : 'smooth' }); + renderPreview(true); + updateTray(); + }, + }); + } + function retry(t) { + const w = wfById(t.wf); + if (w.status === 'warn') { + toast('连接上仍缺 3 个模型文件,重试会再次被 ComfyUI 拒绝。先到「ComfyUI 连接」安装后点「重新检查」。', { action: '去连接页', onAction: () => nav('connections'), duration: 5200 }); + return; + } + reuse(t); submit(); + } + function reuse(t) { + const w = wfById(t.wf); + if (w.id !== state.wfId) selectWorkflow(w.id); + $('#prompt').value = t.prompt; + state.params = { ...t.params }; + for (const s of w.slots) state.slots[s.key] = t.inputs.slice(0, s.type === 'list' ? s.max : 1).map((i) => ({ ...i })); + renderComposer(); renderParams(); + $('#prompt').dispatchEvent(new Event('input')); + $('#prompt').focus(); + toast('已把这条记录的工作流、素材与参数放回输入台,可改完再生成'); + } + + /* ---------------- 检视区 ---------------- */ + function patchPreviewProgress(t) { + const box = $('#insp-preview'); + const p = box.querySelector('.stage-progress i'); + if (!p) { renderPreview(false); return; } + p.style.setProperty('--p', t.progress); + box.querySelector('[data-phase]').textContent = `${t.phase} · ${Math.round(t.progress * 100)}%`; + } + + function renderPreview(crossfade, { autoplay } = {}) { + const box = $('#insp-preview'); + const t = takes.find((x) => x.id === state.selected); + if (!t) { box.innerHTML = '
选择左侧一条记录查看结果
'; return; } + const w = wfById(t.wf); + const portrait = t.out && t.out.h > t.out.w; + const oldStage = box.querySelector('.stage'); + let media; + if (t.status === 'done') { + media = t.out.image ? `` : ` + 播放中`; + } + else if (t.status === 'missing') media = `
结果文件「${esc(t.out.name)}」已不在服务器上
可用相同参数重做,或移除这条记录
`; + else if (t.status === 'failed') media = `
${esc(t.error.title)}
`; + else media = `
${esc(t.phase)} · ${Math.round(t.progress * 100)}%
完成后自动显示在这里
`; + const meta = [ + t.out && t.status === 'done' ? `${t.out.w}×${t.out.h}` : '', + t.params.seed ? `种子 ${esc(t.params.seed)}` : '', + t.params.duration ? `时长 ${esc(t.params.duration)} 秒` : '', + t.elapsed ? `用时 ${esc(t.elapsed)}` : '', + `${esc(t.conn || '本机 ComfyUI-4080')}`, + t.demo && t.status === 'done' ? '演示产物 · 取自测试站历史结果,非本次真实生成' : '', + ].join(''); + const canSend = t.status === 'done' && t.out.image; + const gone = !!w.deleted; + const actions = t.status === 'done' + ? `${gone ? '' : ''}${canSend ? '' : ''}` + : t.status === 'failed' ? `${gone ? '' : ''}` + : t.status === 'missing' ? `${gone ? '' : ''}` : ''; + const html = ` +
${media}
+
${meta}
+
${actions}
+
输入
+ ${t.inputs.length ? `
${t.inputs.map((i) => ``).join('')}
` : ''} +
${esc(t.prompt || '(使用工作流原提示词)')}
+
工作流
+
名称
${esc(w.name)}${gone ? ' · 工作流已删除' : ''}
用途
${USAGE[w.usage]}
来源
${esc(t.source || (w.kind === 'video' ? '独立生视频' : '独立生图'))} · ${esc(t.time)}
+ ${Object.entries(t.params).filter(([k]) => !['seed', 'duration'].includes(k)).map(([k, v]) => `
${esc((w.params.find((p) => p.key === k) || { label: k }).label)}
${esc(v)}
`).join('')}
`; + const oldMedia = crossfade && oldStage && !reduced() ? Array.from(oldStage.children).filter((c) => !c.classList.contains('stage-badge')).map((c) => c.cloneNode(true)) : null; + box.innerHTML = html; + const newStage = box.querySelector('.stage'); + // 点选切换:旧画面叠在上层 150ms 淡出,新画面已在下层就位;键盘切换不做动画 + if (oldMedia && newStage.className === oldStage.className) { + const wrap = document.createElement('div'); + wrap.style.cssText = 'position:absolute;inset:0;z-index:3;pointer-events:none;background:#000'; + oldMedia.forEach((c) => { + if (c.tagName === 'VIDEO') c.removeAttribute('controls'); + c.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;object-fit:contain'; + wrap.appendChild(c); + }); + newStage.appendChild(wrap); + wrap.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 150, easing: 'ease', fill: 'forwards' }).onfinish = () => wrap.remove(); + } else if (crossfade && !reduced()) { + newStage.animate([{ opacity: 0.2 }, { opacity: 1 }], { duration: 150, easing: 'ease' }); + } + const v = newStage.querySelector('video'); + if (v) { + v.addEventListener('play', () => newStage.classList.add('playing')); + v.addEventListener('pause', () => newStage.classList.remove('playing')); + if (autoplay) { v.muted = true; v.play().catch(() => {}); } + } + } + $('#insp-preview').addEventListener('click', (e) => { + const b = e.target.closest('[data-p]'); + if (!b) return; + const t = takes.find((x) => x.id === state.selected); + const act = b.dataset.p; + if (act === 'reuse') reuse(t); + if (act === 'retry') retry(t); + if (act === 'delete') removeTake(t); + if (act === 'download') toast(`原型不连后端:正式版直接下载 ${t.out.image ? '图片' : 'MP4'} 原文件`); + if (act === 'send') { + const slot = curWf().slots[0]; + if (!slot) { toast('当前工作流没有图片输入槽。切到图生视频或参考图生视频工作流后再送入。', { action: '选工作流', onAction: () => openWfPop(false) }); return; } + if (pushInput(slot.key, { bg: `url(${t.out.poster})`, name: `结果 #${t.id}` })) toast(`已送入「${slot.label}」`, { icon: 'ok' }); + } + if (innerWidth <= 1180 && ['reuse', 'send', 'retry'].includes(act)) closeInspector(); + }); + + // 结果在左、参数在右:切换时内容从对应方向滑入 + function showTab(tab) { + const was = $('#insp-params').hidden ? 'preview' : 'params'; + $$('.insp-tabs [data-tab]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.tab === tab))); + paintSeg($('.insp-tabs .seg')); + $('#insp-preview').hidden = tab !== 'preview'; + $('#insp-params').hidden = tab !== 'params'; + $('#insp-hint').textContent = tab === 'preview' ? '↑ ↓ 切换 · 空格播放' : '按工作流 JSON 生成'; + if (was !== tab) replay(tab === 'preview' ? $('#insp-preview') : $('#insp-params'), tab === 'preview' ? 'slide-l' : 'slide-r', 240); + } + const showPreviewTab = () => showTab('preview'); + function showParamsTab() { + showTab('params'); + setInspector(true); + if (innerWidth <= 1180) openInspector(); + } + $('.insp-tabs').addEventListener('click', (e) => { + const b = e.target.closest('[data-tab]'); + if (b) (b.dataset.tab === 'preview' ? showPreviewTab : showParamsTab)(); + }); + $('#params-chip').addEventListener('click', () => { + const onParams = !$('#insp-params').hidden && !$('#view-desk').classList.contains('insp-off'); + if (onParams && innerWidth > 1180) showPreviewTab(); else showParamsTab(); + }); + + // 桌面宽度下检视区可收起,把空间让给记录流 + function setInspector(open) { + const desk = $('#view-desk'); + if (desk.classList.contains('insp-off') === !open) return; + desk.classList.toggle('insp-off', !open); + $('#insp-toggle').setAttribute('aria-expanded', String(open)); + if (open) requestAnimationFrame(() => paintSeg($('.insp-tabs .seg'), true)); + } + $('#insp-toggle').addEventListener('click', () => setInspector(false)); + $('#insp-open').addEventListener('click', () => setInspector(true)); + function openInspector() { if (innerWidth <= 1180 && !$('#inspector').classList.contains('on')) { $('#inspector').classList.add('on'); layers.push({ el: $('#inspector'), onClose: () => $('#inspector').classList.remove('on') }); } } + function closeInspector() { closeLayer($('#inspector'), true); $('#inspector').classList.remove('on'); } + $('#insp-close').addEventListener('click', closeInspector); + + function renderParams() { + const w = curWf(); + const conn = w.conn ? connById(w.conn).name : `跟随默认连接(本次用 ${connById(state.connId).name})`; + const field = (p) => { + const v = paramValue(p); + const changed = state.params[p.key] !== undefined && v !== p.orig; + let input; + if (p.kind === 'select') input = ``; + else if (p.kind === 'textarea') input = ``; + else input = ``; + return `
${input}
`; + }; + const common = w.params.filter((p) => p.common); + const adv = w.params.filter((p) => !p.common); + $('#insp-params').innerHTML = ` +
${esc(w.name)}
+
${USAGE[w.usage]}${esc(slotSummary(w))}${esc(conn)}
+ ${w.errors ? `
该工作流文件不完整,ComfyUI 无法执行,已禁止生成
请在已安装对应自定义节点的 ComfyUI 中重新导出 API 格式 JSON,再替换导入。
` : ''} + ${w.note ? `
${esc(w.note)}
` : ''} + ${w.status === 'warn' ? '
上次运行时连接上缺 3 个模型文件;装好后在「ComfyUI 连接」点「重新检查」。
' : ''} + ${w.params.length ? '' : '
此工作流只暴露提示词,没有其他可调参数。
'} + ${common.map(field).join('')} + ${adv.length ? `
${adv.map(field).join('')}
` : ''} + ${changedCount() ? '' : ''} +
`; + } + $('#insp-params').addEventListener('input', (e) => { + const f = e.target.closest('[data-f]'); + if (!f) return; + state.params[f.dataset.f] = f.value; + f.classList.toggle('changed', f.value !== curWf().params.find((p) => p.key === f.dataset.f).orig); + renderCommonChips(); + }); + $('#insp-params').addEventListener('change', () => renderParams()); + $('#insp-params').addEventListener('click', (e) => { + const fold = e.target.closest('[data-fold]'); + if (fold) { + state.advOpen = !state.advOpen; + fold.setAttribute('aria-expanded', String(state.advOpen)); + fold.nextElementSibling.classList.toggle('open', state.advOpen); + } + if (e.target.closest('[data-reset]')) { state.params = {}; renderParams(); renderCommonChips(); } + if (e.target.closest('[data-reimport]')) openImport('B'); + const del = e.target.closest('[data-del-wf]'); + if (del) askDeleteWorkflow(curWf(), del); + }); + + /* ---------------- 筛选 / 范围 ---------------- */ + function setFilter(f) { + state.filter = f; + $$('.filters [data-filter]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.filter === f))); + paintSeg($('.filters .seg')); + renderFeed({ scrollToEnd: true }); + } + $('.filters').addEventListener('click', (e) => { const b = e.target.closest('[data-filter]'); if (b) setFilter(b.dataset.filter); }); + const SCOPES = [['all', '全部来源'], ['standalone', '独立创作'], ['p1', '雨夜便利店']]; + $('#scope-btn').addEventListener('click', () => { + $('#menu-list').innerHTML = SCOPES.map(([k, l]) => ``).join(''); + openLayer($('#menu-pop'), { anchor: $('#scope-btn'), origin: 'top left', trigger: $('#scope-btn') }); + $('#menu-list').onclick = (e) => { + const b = e.target.closest('[data-scope]'); + if (!b) return; + setScope(b.dataset.scope); + closeLayer($('#menu-pop')); + }; + }); + function setScope(s) { + state.scope = s; + $('#scope-label').textContent = SCOPES.find(([k]) => k === s)[1]; + renderFeed({ scrollToEnd: true }); + } + + /* ---------------- 任务托盘 ---------------- */ + let lastRunning = 0; + function updateTray() { + const running = takes.filter((t) => t.status === 'queued' || t.status === 'running'); + if (running.length !== lastRunning) { replay($('#tray-btn'), 'bump', 720); lastRunning = running.length; } + $('#tray-dot').className = 'dot' + (running.length ? ' run' : ''); + $('#tray-label').textContent = running.length ? `${running.length} 个生成中` : '队列空闲'; + if ($('#tray-pop').classList.contains('on')) renderTray(); + } + function renderTray() { + const list = [...takes].reverse().slice(0, 6); + $('#tray-list').innerHTML = `
最近任务 · 点一下跳到对应记录
` + list.map((t) => { + const w = wfById(t.wf); + const st = t.status === 'done' ? '完成' : t.status === 'failed' ? '失败' : t.status === 'missing' ? '缺文件' : `${Math.round(t.progress * 100)}%`; + return ``; + }).join(''); + } + $('#tray-btn').addEventListener('click', () => { + if ($('#tray-pop').classList.contains('on')) { closeLayer($('#tray-pop')); return; } + renderTray(); + openLayer($('#tray-pop'), { anchor: $('#tray-btn'), origin: 'top right', trigger: $('#tray-btn') }); + }); + $('#tray-list').addEventListener('click', (e) => { + const b = e.target.closest('[data-go]'); + if (!b) return; + closeLayer($('#tray-pop'), true); + const t = takes.find((x) => x.id === +b.dataset.go); + if (!visibleTakes().includes(t)) { setFilter('all'); setScope('all'); } + selectTake(t.id, { scroll: true }); + }); + $('#conn-btn').addEventListener('click', () => nav('connections')); + + /* ---------------- 导入工作流抽屉 ---------------- */ + const SAMPLE_A = { + '1': { inputs: { value: 'Describe the motion from the first frame.' }, class_type: 'PrimitiveStringMultiline', _meta: { title: '正向提示词' } }, + '115': { inputs: { aspect_ratio: '16:9 (Widescreen)', megapixels: 0.7, multiple: 32 }, class_type: 'ResolutionSelector', _meta: { title: '分辨率' } }, + '124': { inputs: { steps: 4, denoise: 1, cfg: 1 }, class_type: 'KSampler', _meta: { title: 'K采样器' } }, + '129': { inputs: { noise_seed: 42 }, class_type: 'RandomNoise', _meta: { title: '随机种子' } }, + '133': { inputs: { value: 10 }, class_type: 'PrimitiveInt', _meta: { title: '时长(秒)' } }, + '901': { inputs: { image: 'first_frame.png' }, class_type: 'LoadImage', _meta: { title: '首帧 First Frame' } }, + '92': { inputs: { filename_prefix: 'h3_i2v', format: 'mp4' }, class_type: 'SaveVideo', _meta: { title: '保存视频' } }, + }; + const SAMPLE_B = { + '1': { inputs: { UNKNOWN: 'qwen-image-2.1-Q4_K_M.gguf' }, _meta: { title: 'Unet Loader (GGUF)' } }, + '2': { inputs: { clip_name: 'qwen3vl_8b_int8_convrot.safetensors', type: 'qwen_image' }, class_type: 'CLIPLoader', _meta: { title: '加载CLIP' } }, + '4': { inputs: { prompt: '参考角色五官,重新生成图片:高细节皮肤质感' }, class_type: 'TextEncodeQwenImageEdit', _meta: { title: '文本编码' } }, + '5': { inputs: { image: 'input.png' }, class_type: 'LoadImage', _meta: { title: '输入图' } }, + '6': { inputs: { seed: 278835418249884, steps: 25, cfg: 1, denoise: 1 }, class_type: 'KSampler', _meta: { title: 'K采样器' } }, + '8': { inputs: { filename_prefix: 'qwen_edit' }, class_type: 'SaveImage', _meta: { title: '保存图像' } }, + '9': { inputs: { sage_attention: 'auto' }, _meta: { title: 'Patch Sage Attention KJ' } }, + }; + + const imp = { name: '', conn: 'local', text: '', result: null, usage: null, test: 'none', trigger: null }; + + function openImport(sample) { + imp.name = ''; imp.text = ''; imp.result = null; imp.usage = null; imp.test = 'none'; + imp.trigger = document.activeElement; + renderImport(); + $('#scrim').classList.add('on'); + $('#drawer').classList.add('on'); + layers.push({ el: $('#drawer'), onClose: closeImportVisual, trigger: imp.trigger }); + if (sample) loadSample(sample); + setTimeout(() => $('#imp-name')?.focus(), 30); + } + function closeImportVisual() { $('#scrim').classList.remove('on'); $('#drawer').classList.remove('on'); } + $('#drawer-close').addEventListener('click', () => closeLayer($('#drawer'))); + $('#scrim').addEventListener('click', () => { if (!$('#confirm-pop').classList.contains('on')) closeLayer($('#drawer')); }); + $('#confirm-pop').addEventListener('keydown', (e) => { + if (e.key !== 'Tab') return; + const f = [...$('#confirm-pop').querySelectorAll('button:not(:disabled)')]; + const i = f.indexOf(document.activeElement); + e.preventDefault(); + f[(i + (e.shiftKey ? f.length - 1 : 1)) % f.length].focus(); + }); + + function loadSample(k) { + imp.text = JSON.stringify(k === 'A' ? SAMPLE_A : SAMPLE_B, null, 2); + imp.name = k === 'A' ? 'H3 图生视频·首帧(重新导出)' : 'Qwen Image 2.1 图片编辑(重新导出)'; + renderImport(); + analyze(); + } + + function renderImport() { + const r = imp.result; + $('#drawer-body').innerHTML = ` +
+
+
+
+
+ 把 ComfyUI「导出 (API)」得到的 JSON 拖到这里、粘贴,或选择文件 + +
+ +
+ 没有文件?试试: + + +
+
+
${r ? checksHTML(r) : ''}
`; + const canSave = r && r.ok && imp.usage; + $('#drawer-foot').innerHTML = ` + 原型内判定为前端简化版;正式版沿用后端 /api/workflows/analyze + ${r && !r.ok ? '' : ''} + `; + } + + function checksHTML(r) { + const c = (cls, ic, t, d) => `
${ic}${t}
${d}
`; + let html = ''; + html += r.errors.length + ? c('bad', '!', `第 1 步 · 文件结构:发现 ${r.errors.length} 个问题`, `请在已安装对应自定义节点的 ComfyUI 中重新导出 API 格式 JSON。`) + : c('ok', '✓', `第 1 步 · 文件结构正常`, `${r.nodeCount} 个节点 · API 格式`); + if (r.errors.length) return html + c('', '–', '第 2 步 · 用途与输入槽', '文件结构有问题,暂不判定') + c('', '–', '第 3 步 · 对照连接上的节点与模型', '跳过'); + const lowConf = r.confidence === 'low'; + html += c(lowConf ? 'run' : 'ok', lowConf ? '?' : '✓', lowConf ? '第 2 步 · 用途不确定,请确认' : `第 2 步 · 判定为「${USAGE[r.usage]}」`, + `${lowConf ? '检测到视频输出和图片输入,但无法确定图片是首帧还是参考图:' : '可手动更正:'} +
${USAGE_ORDER.map((u) => ``).join('')}
+
${r.slotsView.map((s) => `
${esc(s.label)}${esc(s.node)}
`).join('')} + ${r.outputs.map((o) => `
输出 · ${o.kind === 'video' ? '视频' : '图片'}${esc(o.node)}
`).join('')}
`); + const conn = connById(imp.conn); + if (!conn.ok) html += c('bad', '!', '第 3 步 · 连不上所选连接', `${esc(conn.name)}:${esc(conn.err)}。可以先保存,连接恢复后再「重新检查」。`); + else if (r.sample === 'A') html += c('ok', '✓', '第 3 步 · 连接上的节点与模型齐全', `${esc(conn.name)} · 自定义节点 7/7 已安装 · 模型文件已找到`); + else html += c('', 'i', '第 3 步 · 对照连接上的节点与模型', '原型未连接后端,正式版会查询该 ComfyUI 的 /object_info 并用中文列出缺失项'); + const testCls = imp.test === 'running' ? 'run' : imp.test === 'ok' ? 'ok' : ''; + const testTxt = imp.test === 'running' ? '试运行中 · 采样 2/4…' : imp.test === 'ok' ? '试运行通过 · 产出 1 个视频,可下载且类型正确' : '可选:真实提交一次,只有拿到可下载的正确类型产物才算通过'; + html += c(testCls, imp.test === 'ok' ? '✓' : '4', '第 4 步 · 试运行(可选)', `${testTxt}${imp.test === 'none' && conn.ok ? '
' : ''}`); + return html; + } + + function analyze() { + const text = imp.text.trim(); + if (!text) { imp.result = null; renderImport(); return; } + let json; + try { json = JSON.parse(text); } catch (e) { + imp.result = { ok: false, errors: [`不是合法的 JSON:${e.message}`] }; renderImport(); return; + } + if (Array.isArray(json.nodes) && json.links) { + imp.result = { ok: false, errors: ['这是 ComfyUI 界面格式(含 nodes / links),不是 API 格式。请在 ComfyUI 菜单里用「导出 (API)」重新导出。'] }; renderImport(); return; + } + const entries = Object.entries(json).filter(([, v]) => v && typeof v === 'object'); + const errors = []; + for (const [id, n] of entries) if (!n.class_type) errors.push(`节点 ${id}「${n._meta?.title || '未命名'}」缺少节点类型(class_type),导出时 ComfyUI 未加载该自定义节点`); + const outputs = []; const images = []; let prompt = null; const params = []; + for (const [id, n] of entries) { + const ct = n.class_type || ''; const title = n._meta?.title || ct; + if (/SaveVideo|VHS_VideoCombine|SaveWEBM|SaveAnimated|CreateVideo/i.test(ct)) outputs.push({ kind: 'video', node: `${id} · ${ct}` }); + else if (/SaveImage|PreviewImage/i.test(ct)) outputs.push({ kind: 'image', node: `${id} · ${ct}` }); + if (/^LoadImage/i.test(ct)) images.push({ id, title, role: /ref|参考/i.test(title) ? 'ref' : /first|start|首帧/i.test(title) ? 'first' : 'image' }); + if (!prompt && (/PrimitiveString|CLIPTextEncode|TextEncode/i.test(ct) || typeof n.inputs?.prompt === 'string')) prompt = { id, title }; + for (const k of Object.keys(n.inputs || {})) if (/^(seed|noise_seed|steps|cfg|denoise|aspect_ratio|megapixels|width|height|length|duration)$/.test(k)) params.push(k); + } + const hasVideo = outputs.some((o) => o.kind === 'video'); + if (!outputs.length && !errors.length) errors.push('没有找到输出节点(SaveImage / SaveVideo 等)。若使用了自定义输出节点,保存后需要手动指定输出。'); + let usage; let confidence = 'high'; + if (hasVideo) { + if (images.some((i) => i.role === 'ref')) usage = 'ref2video'; + else if (images.some((i) => i.role === 'first')) usage = 'image2video'; + else if (images.length) { usage = 'image2video'; confidence = 'low'; } + else usage = 'text2video'; + } else usage = images.length ? 'image2image' : 'text2image'; + const slotsView = []; + if (prompt) slotsView.push({ label: '提示词', node: `${prompt.id} · ${prompt.title}` }); + for (const i of images) slotsView.push({ label: i.role === 'ref' ? '参考图' : i.role === 'first' ? '首帧图' : '输入图', node: `${i.id} · ${i.title}` }); + if (params.length) slotsView.push({ label: `参数 ${new Set(params).size} 项`, node: [...new Set(params)].join(' / ') }); + imp.result = { ok: !errors.length, errors, nodeCount: entries.length, outputs, images, usage, confidence, slotsView, sample: text === JSON.stringify(SAMPLE_A, null, 2) ? 'A' : null }; + imp.usage = confidence === 'low' ? null : usage; + renderImportProgressively(); + } + function renderImportProgressively() { + renderImport(); + if (reduced()) return; + const items = $$('#imp-checks .check'); + items.forEach((el, i) => { el.style.opacity = '0'; el.style.transform = 'translateY(4px)'; el.style.transition = `opacity 200ms var(--ease-out) ${i * 60}ms, transform 200ms var(--ease-out) ${i * 60}ms`; }); + requestAnimationFrame(() => requestAnimationFrame(() => items.forEach((el) => { el.style.opacity = ''; el.style.transform = ''; }))); + } + + $('#drawer').addEventListener('input', (e) => { + if (e.target.id === 'imp-name') imp.name = e.target.value; + if (e.target.id === 'imp-text') { imp.text = e.target.value; clearTimeout(imp._t); imp._t = setTimeout(() => { const pos = e.target.selectionStart; analyze(); const ta = $('#imp-text'); ta.focus(); ta.setSelectionRange(pos, pos); }, 500); } + }); + $('#drawer').addEventListener('change', (e) => { if (e.target.id === 'imp-conn') { imp.conn = e.target.value; imp.test = 'none'; renderImport(); } }); + $('#drawer').addEventListener('click', (e) => { + const s = e.target.closest('[data-sample]'); + if (s) loadSample(s.dataset.sample); + if (e.target.closest('#imp-file')) $('#json-input').click(); + const u = e.target.closest('[data-usage]'); + if (u) { imp.usage = u.dataset.usage; renderImport(); } + const a = e.target.closest('[data-imp]')?.dataset.imp; + if (a === 'test') { + imp.test = 'running'; renderImport(); + setTimeout(() => { imp.test = 'ok'; renderImport(); }, 1800); + } + if (a === 'save' || a === 'save-bad') saveImport(a === 'save-bad'); + }); + $('#drawer').addEventListener('dragover', (e) => { if (e.target.closest('#imp-drop')) { e.preventDefault(); $('#imp-drop').classList.add('drag'); } }); + $('#drawer').addEventListener('dragleave', (e) => { if (!e.relatedTarget || !$('#imp-drop').contains(e.relatedTarget)) $('#imp-drop')?.classList.remove('drag'); }); + $('#drawer').addEventListener('drop', (e) => { + if (!e.target.closest('#imp-drop')) return; + e.preventDefault(); + const f = e.dataTransfer.files[0]; + if (f) readJsonFile(f); + }); + $('#json-input').addEventListener('change', (e) => { if (e.target.files[0]) readJsonFile(e.target.files[0]); e.target.value = ''; }); + function readJsonFile(f) { + f.text().then((t) => { imp.text = t; if (!imp.name) imp.name = f.name.replace(/\.json$/i, ''); renderImport(); analyze(); }); + } + + function saveImport(bad) { + const r = imp.result; + const name = imp.name.trim() || '未命名工作流'; + const usage = imp.usage || r.usage || 'text2image'; + const kind = usage.includes('video') ? 'video' : 'image'; + const slots = []; + if (usage === 'ref2video') slots.push({ key: 'ref', label: '参考图', type: 'list', min: 1, max: 9 }); + if (usage === 'image2video') slots.push({ key: 'first', label: '首帧图', type: 'single' }); + if (usage === 'image2image') slots.push({ key: 'image', label: '输入图', type: 'single' }); + const w = { + id: ++seq, name, usage, kind, conn: imp.conn, status: bad ? 'error' : imp.test === 'ok' ? 'ok' : 'idle', + statusText: bad ? '不可用 · 文件不完整' : imp.test === 'ok' ? '可用 · 刚刚试运行通过' : '未试运行', + slots, params: kind === 'video' ? H3_PARAMS : QWEN_T2I.slice(0, 2).concat(QWEN_T2I.slice(5)), errors: bad ? r.errors : null, + note: usage === 'ref2video' ? 'MiniMax H3 Ref2VA 官方限额:参考图最多 9 张。' : null, + }; + workflows.push(w); + closeLayer($('#drawer'), true); + closeImportVisual(); + selectWorkflow(w.id); + toast(bad ? `已保存「${esc(name)}」,标记为不可用,生成按钮保持禁用` : `已导入并选中「${esc(name)}」· 输入台已按 JSON 显示:${esc(slotSummary(w))}`, { duration: 4200, icon: bad ? 'err' : 'ok' }); + } + + /* ---------------- 页面切换 ---------------- */ + const TITLES = { desk: '生成台', projects: '项目', flow: '雨夜便利店 · 创作流程', tasks: '生成台', agents: '智能体', connections: 'ComfyUI 连接', settings: '模型与设置', more: '更多' }; + function nav(v) { + if (v === 'tasks') { v = 'desk'; setScope('all'); toast('任务页并入生成台:「全部来源」即全部任务,右上角托盘随时看进度', { duration: 2800 }); } + state.view = v; + $$('.view').forEach((el) => el.classList.remove('on')); + const id = { desk: 'view-desk', projects: 'view-projects', flow: 'view-flow' }[v] || 'view-other'; + $('#' + id).classList.add('on'); + $$('[data-nav]').forEach((b) => b.toggleAttribute('aria-current', false)); + $$(`[data-nav="${v}"]`).forEach((b) => b.setAttribute('aria-current', 'page')); + $('#page-title').textContent = TITLES[v] || ''; + $('#scope-btn').style.display = v === 'desk' ? '' : 'none'; + paintRail(); + if (v === 'desk') { paintSeg($('.filters .seg'), true); paintSeg($('.insp-tabs .seg'), true); } + if (v === 'projects') renderProjects(); + if (v === 'flow') renderFlow(); + if (id === 'view-other') renderOther(v); + if (v === 'desk') renderFeed({ scrollToEnd: false }); + } + $$('[data-nav]').forEach((b) => b.addEventListener('click', () => nav(b.dataset.nav))); + + const STAGES = [['剧本创作', 'done'], ['视觉设计', 'done'], ['分镜设计', 'done'], ['素材资产', 'done'], ['镜头脚本', 'cur']]; + const trackHTML = (cur) => `
${STAGES.map(([n, s], i) => ``).join('')}
`; + + function renderProjects() { + $('#view-projects').innerHTML = ` +

继续上次

+
+
+
暂无生成画面 · 场景 0 · 素材 0
+
镜头脚本 · 待确认

雨夜便利店

+

时长约 3 分钟(180 秒)· 现代深夜都市 · 24 小时便利店(内)、店外雨夜。刚下班的白领与浑身湿透的男人在暴雨夜的便利店相遇。

+ ${trackHTML(4)} +
+
+
+

全部项目 · 2

+
+ + +
`; + } + $('#view-projects').addEventListener('click', (e) => { + if (e.target.closest('[data-go-flow]')) nav('flow'); + else if (e.target.closest('[data-go-desk]')) { nav('desk'); setScope('p1'); } + else if (e.target.closest('[data-stage]')) nav('flow'); + else if (e.target.closest('[data-todo]')) toast('本原型只演示高频生成链路;该入口沿用现有功能'); + }); + + const SHOTS = [ + ['S1', '4s', '第一场店外暴雨,固定远景,暴雨如帘砸在便利店玻璃门,霓虹在积水里碎成冷蓝光,店内暖黄光从门缝透出。音效:暴雨声。', 'Cinematic extreme wide static shot. Outside the modern 24-hour convenience store at night, heavy rain falls like a curtain against the glass doors, neon signs smear into cold blue puddles, warm yellow interior light glows through the door seam…'], + ['S2', '4s', '女人推开玻璃门,湿透的黑大衣滴水,头发贴在脸上。店外冷雨与店内暖光在她身上交界。音效:门铃叮。', 'Cinematic full tracking shot. The 28-year-old woman with black long straight hair plastered to her face, soaked black coat dripping, pushes open the glass door into warm yellow interior light…'], + ['S3', '5s', '男人站在饮料柜前没动,隔着货架看她。冷柜白光打在侧脸,雨声压低。', 'Medium close-up, static. A 32-year-old man in a soaked grey hoodie stands still by the drinks fridge, cold white fridge light on his profile, rain muffled…'], + ]; + function renderFlow() { + $('#view-flow').innerHTML = ` + ${trackHTML(4)} +
当前是未确认草稿:确认后才会交给下一阶段的智能体使用。
+ ${SHOTS.map(([no, d, zh, en]) => `
${no}
${d}
${zh}
${en}
`).join('')}`; + } + $('#view-flow').addEventListener('click', (e) => { + const s = e.target.closest('[data-shot]'); + if (s) { + const shot = SHOTS.find((x) => x[0] === s.dataset.shot); + state.context = shot[0]; + $('#context-bar').classList.add('on'); + $('#context-bar b').textContent = `《雨夜便利店》· 镜头 ${shot[0]}`; + nav('desk'); + setScope('p1'); + selectWorkflow(6); + $('#prompt').value = shot[3]; + $('#prompt').dispatchEvent(new Event('input')); + state.params.duration = shot[1].replace('s', '') === '4' ? '5' : shot[1].replace('s', ''); + renderCommonChips(); renderParams(); + $('#prompt').focus(); + return; + } + if (e.target.closest('[data-stage]')) toast('阶段切换沿用现有五段工作台,本原型不展开'); + if (e.target.closest('[data-todo]')) toast('本原型只演示高频生成链路;该操作沿用现有功能'); + }); + $('#ctx-back').addEventListener('click', () => { state.context = null; $('#context-bar').classList.remove('on'); nav('flow'); }); + + function renderOther(v) { + const desc = { + agents: '五个智能体改为左列表 + 右侧对话;对话里生成的提示词可一键「送到生成台」,直接落到输入台,不再复制粘贴。', + connections: '连接卡与工作流库沿用本原型的状态标签与抽屉:导入就是左侧演示的那个抽屉,四步检查逐条出现;失败项给中文原因与下一步。', + settings: '模型设置与系统设置合并成一个带分组导航的设置页;密钥掩码不回显,连通性测试结果用同一套状态标签。', + more: '窄屏「更多」收纳:全部任务、智能体、ComfyUI 连接、模型与设置。', + }[v] || ''; + $('#view-other').innerHTML = `

${TITLES[v]}

${desc}

本原型聚焦「选择/导入工作流 → 按 JSON 填输入 → 提交 → 切换结果」这条高频链路,该页不做可点演示。

`; + $('#view-other [data-nav-desk]').onclick = () => nav('desk'); + } + + /* ---------------- 键盘 ---------------- */ + const inField = (el) => el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT' || el.isContentEditable); + document.addEventListener('keydown', (e) => { + const mod = e.metaKey || e.ctrlKey; + if (mod && e.key.toLowerCase() === 'k') { e.preventDefault(); if ($('#wf-pop').classList.contains('on')) closeLayer($('#wf-pop')); else openWfPop(true); return; } + if (e.key === 'Escape') { if (closeTop()) { e.preventDefault(); return; } if (composer.classList.contains('expanded')) composer.classList.remove('expanded'); return; } + if (mod && e.key === 'Enter' && state.view === 'desk') { e.preventDefault(); submit(); return; } + if (inField(e.target) || state.view !== 'desk' || layers.some((l) => l.el.id !== 'inspector')) return; + if (e.key === '/') { e.preventDefault(); $('#prompt').focus(); } + else if (e.key === 'ArrowDown' || e.key === 'j') { e.preventDefault(); moveSelection(1); } + else if (e.key === 'ArrowUp' || e.key === 'k') { e.preventDefault(); moveSelection(-1); } + else if (e.key === ' ') { + const v = $('#insp-preview video'); + if (v && !e.target.closest('button')) { e.preventDefault(); v.paused ? v.play() : v.pause(); } + } else if (e.key === ']') { + e.preventDefault(); + setInspector($('#view-desk').classList.contains('insp-off')); + } else if ((e.key === 'Delete' || e.key === 'Backspace') && state.selected) { + const t = takes.find((x) => x.id === state.selected); + if (t && t.status !== 'queued' && t.status !== 'running') { e.preventDefault(); removeTake(t); } + } + }); + $('#cmd-btn').addEventListener('click', () => openWfPop(true)); + + /* ---------------- 减少动态 ---------------- */ + const setReduce = (on) => { root.dataset.reduce = on ? '1' : '0'; $('#reduce-toggle').checked = on; }; + setReduce(reduceQuery.matches); + reduceQuery.addEventListener('change', (e) => setReduce(e.matches)); + $('#reduce-toggle').addEventListener('change', (e) => setReduce(e.target.checked)); + + /* ---------------- 启动 ---------------- */ + const params = new URLSearchParams(location.search); + if (params.get('reduce') === '1') setReduce(true); + renderComposer(); + renderParams(); + renderFeed({ scrollToEnd: true }); + renderPreview(false); + updateTray(); + $$('.seg').forEach((seg) => paintSeg(seg, true)); + paintRail(true); + addEventListener('resize', () => { $$('.seg').forEach((seg) => paintSeg(seg, true)); paintRail(true); }); + if (params.get('view')) nav(params.get('view')); +})(); diff --git a/prototypes/hel-648-fusion/assets/i-t2i-43.jpg b/prototypes/hel-648-fusion/assets/i-t2i-43.jpg new file mode 100644 index 00000000..35b8c603 Binary files /dev/null and b/prototypes/hel-648-fusion/assets/i-t2i-43.jpg differ diff --git a/prototypes/hel-648-fusion/assets/v-i2v-35.jpg b/prototypes/hel-648-fusion/assets/v-i2v-35.jpg new file mode 100644 index 00000000..55033306 Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-i2v-35.jpg differ diff --git a/prototypes/hel-648-fusion/assets/v-i2v-35.mp4 b/prototypes/hel-648-fusion/assets/v-i2v-35.mp4 new file mode 100644 index 00000000..5f73c079 Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-i2v-35.mp4 differ diff --git a/prototypes/hel-648-fusion/assets/v-ref2v-44.jpg b/prototypes/hel-648-fusion/assets/v-ref2v-44.jpg new file mode 100644 index 00000000..a42d605a Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-ref2v-44.jpg differ diff --git a/prototypes/hel-648-fusion/assets/v-ref2v-44.mp4 b/prototypes/hel-648-fusion/assets/v-ref2v-44.mp4 new file mode 100644 index 00000000..1d87ea0b Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-ref2v-44.mp4 differ diff --git a/prototypes/hel-648-fusion/assets/v-t2v-16.jpg b/prototypes/hel-648-fusion/assets/v-t2v-16.jpg new file mode 100644 index 00000000..2ecce504 Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-t2v-16.jpg differ diff --git a/prototypes/hel-648-fusion/assets/v-t2v-16.mp4 b/prototypes/hel-648-fusion/assets/v-t2v-16.mp4 new file mode 100644 index 00000000..38db6f43 Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-t2v-16.mp4 differ diff --git a/prototypes/hel-648-fusion/assets/v-t2v-21.jpg b/prototypes/hel-648-fusion/assets/v-t2v-21.jpg new file mode 100644 index 00000000..50483a75 Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-t2v-21.jpg differ diff --git a/prototypes/hel-648-fusion/assets/v-t2v-21.mp4 b/prototypes/hel-648-fusion/assets/v-t2v-21.mp4 new file mode 100644 index 00000000..25e44f2c Binary files /dev/null and b/prototypes/hel-648-fusion/assets/v-t2v-21.mp4 differ diff --git a/prototypes/hel-648-fusion/index.html b/prototypes/hel-648-fusion/index.html new file mode 100644 index 00000000..da175430 --- /dev/null +++ b/prototypes/hel-648-fusion/index.html @@ -0,0 +1,170 @@ + + + + + +影工坊 · 融合原型:流水台交互 × 放映厅配色(HEL-648,隔离原型) + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+

生成台

+ +
+
+ 隔离原型 · 不连后端 + + + + +
+ + +
+
+
+ + 来自 《雨夜便利店》· 镜头 S1,生成结果会回填到该镜头 +
+
+
+ + + + +
+ + +
+
+
+
+
+ +
+ + + +
+ + +
+
+
+
+
+ + +
+ + +
+ +
+ +
+ + +
+
+ + + + + + + +
+

删除这个工作流?

+

+
+ + +
+
+ + + + +
+ + + + +
+ + + + diff --git a/prototypes/hel-648-fusion/shots/00-配色对比-流水台原色vs融合.png b/prototypes/hel-648-fusion/shots/00-配色对比-流水台原色vs融合.png new file mode 100644 index 00000000..0815e3eb Binary files /dev/null and b/prototypes/hel-648-fusion/shots/00-配色对比-流水台原色vs融合.png differ diff --git a/prototypes/hel-648-fusion/shots/01-项目总览.png b/prototypes/hel-648-fusion/shots/01-项目总览.png new file mode 100644 index 00000000..3de94669 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/01-项目总览.png differ diff --git a/prototypes/hel-648-fusion/shots/02-生成台-点选结果即播.png b/prototypes/hel-648-fusion/shots/02-生成台-点选结果即播.png new file mode 100644 index 00000000..28d22bbb Binary files /dev/null and b/prototypes/hel-648-fusion/shots/02-生成台-点选结果即播.png differ diff --git a/prototypes/hel-648-fusion/shots/03-上传中-进度环.png b/prototypes/hel-648-fusion/shots/03-上传中-进度环.png new file mode 100644 index 00000000..cf9e65b7 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/03-上传中-进度环.png differ diff --git a/prototypes/hel-648-fusion/shots/04-提交后-生成中进度.png b/prototypes/hel-648-fusion/shots/04-提交后-生成中进度.png new file mode 100644 index 00000000..f770018c Binary files /dev/null and b/prototypes/hel-648-fusion/shots/04-提交后-生成中进度.png differ diff --git a/prototypes/hel-648-fusion/shots/05-参数面板-高级参数展开.png b/prototypes/hel-648-fusion/shots/05-参数面板-高级参数展开.png new file mode 100644 index 00000000..0b40db30 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/05-参数面板-高级参数展开.png differ diff --git a/prototypes/hel-648-fusion/shots/06-生成完成-金色光晕.png b/prototypes/hel-648-fusion/shots/06-生成完成-金色光晕.png new file mode 100644 index 00000000..93de4a84 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/06-生成完成-金色光晕.png differ diff --git a/prototypes/hel-648-fusion/shots/07-检视区收起.png b/prototypes/hel-648-fusion/shots/07-检视区收起.png new file mode 100644 index 00000000..04c94875 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/07-检视区收起.png differ diff --git a/prototypes/hel-648-fusion/shots/08-失败-就地展开原因.png b/prototypes/hel-648-fusion/shots/08-失败-就地展开原因.png new file mode 100644 index 00000000..6c13d9a8 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/08-失败-就地展开原因.png differ diff --git a/prototypes/hel-648-fusion/shots/09-删除记录-5秒撤销.png b/prototypes/hel-648-fusion/shots/09-删除记录-5秒撤销.png new file mode 100644 index 00000000..322b4de6 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/09-删除记录-5秒撤销.png differ diff --git a/prototypes/hel-648-fusion/shots/09b-删除工作流-居中确认.png b/prototypes/hel-648-fusion/shots/09b-删除工作流-居中确认.png new file mode 100644 index 00000000..95adb7b1 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/09b-删除工作流-居中确认.png differ diff --git a/prototypes/hel-648-fusion/shots/10-窄屏390-记录流-输入台-检视区.png b/prototypes/hel-648-fusion/shots/10-窄屏390-记录流-输入台-检视区.png new file mode 100644 index 00000000..b44dfc40 Binary files /dev/null and b/prototypes/hel-648-fusion/shots/10-窄屏390-记录流-输入台-检视区.png differ