Files
aigc-home/calliope-web/src/routes/library/library-v2.css
T
施工员2号andmultica-agent 433fd719f1 feat(HEL-884): locate canvas occupancy, accurate card handling, close the delete loop
- GET /api/library/media/usage: read-only occupancy report per file —
  every live canvas card with canvas title, project/session scope, and
  the real consequence of deleting that card (deletes_file / keep reason)
- _path_on_canvas joins canvas: orphan nodes (canvas row gone, FK-cascade
  dead metadata) no longer count as occupancy; they are reported as
  invalid references with totals instead of blocking deletion
- canvas deleteNode: keep_file=true release-only variant (card removed,
  file always preserved); artifact cards with a live pending/running job
  refuse deletion (409) so completion events cannot resurrect them
- library UI: occupancy modal on kept(on_canvas) with locate / delete
  card (accurate impact text) / release-only actions, per-path free-file
  delete closing the loop, invalid-reference note, offset paging for
  large counts, library selection persisted across canvas round-trips
- canvas UI: ?locate=<node> deep-link centers the card (computed
  viewport, no store.fitView — its nodes write-back looped the graph
  rebuild effect), gold ring highlight + dismiss, back-to-library chip
- i18n keys for all 7 languages; e2e runner + 32-check real-browser
  regression on isolated data

Co-authored-by: multica-agent <github@multica.ai>
2026-10-26 23:48:15 +08:00

795 lines
15 KiB
CSS

.lib2,
.lib2 * {
box-sizing: border-box;
}
.lib2 {
--viewfinder-position-duration: var(--t-base);
flex: 1;
display: grid;
grid-template-columns: var(--lib-filter) minmax(0, 1fr) var(--lib-detail);
min-height: 0;
--scene: var(--gold);
--button-secondary-border: var(--line-2);
}
.lib2 .mg-filter svg {
color: var(--tx-3);
}
.lib2 .mg-filter.on svg {
color: var(--gold);
}
.lib-main {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
position: relative;
}
.lib-tools {
display: flex;
align-items: center;
padding: 10px 14px;
border-bottom: 1px solid var(--line);
flex: none;
gap: 8px;
}
.lib-tools select {
height: 30px;
border-radius: var(--r-sm);
background: var(--well);
border: 1px solid var(--line-2);
color: var(--tx-1);
padding: 0 26px 0 10px;
font-size: 12px;
appearance: none;
background-image:
linear-gradient(45deg, transparent 50%, var(--tx-3) 50%),
linear-gradient(135deg, var(--tx-3) 50%, transparent 50%);
background-position:
calc(100% - 13px) 13px,
calc(100% - 9px) 13px;
background-size: 4px 4px;
background-repeat: no-repeat;
}
.lib-chips {
display: flex;
gap: 6px;
align-items: center;
padding: 8px 14px 0;
flex-wrap: wrap;
flex: none;
}
.lib-chips:empty {
display: none;
}
.fchip {
height: 22px;
padding: 0 4px 0 8px;
border-radius: 999px;
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 11px;
color: var(--tx-1);
background: color-mix(in srgb, var(--gold) 12%, var(--bg-2));
border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
}
.fchip button {
width: 16px;
height: 16px;
border-radius: 50%;
display: grid;
place-items: center;
color: var(--tx-2);
}
.fchip button:hover {
background: rgb(var(--ink) / 0.1);
}
.lib-body {
flex: 1;
overflow: auto;
padding: 12px 14px 16px;
min-height: 0;
}
.lib-body.has-sel {
padding-bottom: calc(var(--selbar-h) + 28px);
}
.dgrp {
margin-bottom: 14px;
}
.dgrp-h {
display: flex;
align-items: center;
gap: 8px;
height: 28px;
font-size: 12px;
color: var(--tx-2);
position: sticky;
top: -12px;
z-index: 2;
background: linear-gradient(var(--bg-0) 70%, transparent);
margin: 0 -2px;
padding: 0 2px;
}
[data-theme="bluehour"] .dgrp-h {
background: linear-gradient(#0d1438 70%, transparent);
}
.dgrp-h b {
font-weight: 600;
color: var(--tx-1);
}
.dgrp-h .n {
font: 500 11px var(--mono);
color: var(--tx-3);
}
.dgrp-h .selg {
margin-left: auto;
font-size: 11px;
color: var(--tx-3);
opacity: 0;
}
.dgrp:hover .dgrp-h .selg {
opacity: 1;
}
.lgrid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--lib-tile-min), 1fr));
gap: 10px;
}
.lgrid.dense {
--lib-tile-min: 128px;
gap: 8px;
}
.lt {
position: relative;
border-radius: 10px;
background: var(--bg-2);
border: 1px solid var(--line);
cursor: pointer;
display: flex;
flex-direction: column;
min-width: 0;
transition: border-color var(--t-fast);
}
.lt:hover {
border-color: var(--line-3);
}
.lt.on {
border-color: color-mix(in srgb, var(--gold) 70%, transparent);
}
.lt.picked {
border-color: color-mix(in srgb, var(--gold) 55%, transparent);
background: color-mix(in srgb, var(--gold) 7%, var(--bg-2));
}
.lt .mat {
position: relative;
aspect-ratio: var(--lib-tile-ratio);
border-radius: 9px 9px 0 0;
overflow: hidden;
background:
repeating-conic-gradient(rgb(var(--ink) / 0.03) 0 25%, transparent 0 50%) 0
0/14px 14px,
var(--bg-0);
display: grid;
place-items: center;
width: 100%;
border: 0;
padding: 0;
cursor: pointer;
color: inherit;
}
.lgrid.fill .lt .mat img {
width: 100%;
height: 100%;
object-fit: cover;
}
.lt .mat img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
display: block;
}
.lt .ck {
position: absolute;
left: 6px;
top: 6px;
width: 20px;
height: 20px;
border-radius: 5px;
border: 1.5px solid rgba(255, 255, 255, 0.75);
background: rgba(0, 0, 0, 0.35);
display: grid;
place-items: center;
color: transparent;
opacity: 0;
transition:
opacity var(--t-fast),
background var(--t-fast);
z-index: 2;
cursor: pointer;
}
.lt:hover .ck,
.lib-main.selecting .lt .ck,
.lt.picked .ck {
opacity: 1;
}
.lt.picked .ck {
background: var(--gold);
border-color: var(--gold);
color: var(--tx-inv);
}
.lt .kind {
position: absolute;
right: 6px;
bottom: 6px;
display: flex;
align-items: center;
gap: 3px;
height: 18px;
padding: 0 5px;
border-radius: 4px;
font: 500 10.5px var(--mono);
color: #fff;
background: rgba(0, 0, 0, 0.62);
}
.lt .ratio {
position: absolute;
left: 6px;
bottom: 6px;
font: 500 10px var(--mono);
color: #fff;
background: rgba(0, 0, 0, 0.5);
padding: 1px 4px;
border-radius: 3px;
opacity: 0;
transition: opacity var(--t-fast);
}
.lt:hover .ratio {
opacity: 1;
}
.lt .playglyph {
position: absolute;
width: 34px;
height: 34px;
border-radius: 50%;
display: grid;
place-items: center;
background: rgba(10, 12, 18, 0.55);
border: 1px solid rgba(255, 255, 255, 0.35);
color: #fff;
}
.lt .bd {
padding: 7px 9px 8px;
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.lt .bd b {
font-size: 12px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.lt .bd .m {
display: flex;
gap: 6px;
font: 500 10.5px var(--mono);
color: var(--tx-3);
white-space: nowrap;
overflow: hidden;
}
.lt .bd .m .pj {
font-family: var(--font);
overflow: hidden;
text-overflow: ellipsis;
}
.lgrid.dense .lt .bd {
display: none;
}
.lt.broken .mat {
background: repeating-linear-gradient(
135deg,
var(--fail-a) 0 8px,
var(--fail-b) 8px 16px
);
}
.lt.broken .mat span {
font-size: 11px;
color: var(--warn);
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
}
.lt.broken .mat em {
font-style: normal;
font-size: 10.5px;
color: var(--tx-3);
}
.selbar {
position: absolute;
left: 50%;
bottom: 14px;
transform: translate(-50%, 12px);
opacity: 0;
pointer-events: none;
height: var(--selbar-h);
display: flex;
align-items: center;
padding: 0 8px 0 14px;
border-radius: 14px;
background: color-mix(in srgb, var(--bg-3) 96%, transparent);
border: 1px solid var(--line-2);
box-shadow:
var(--sh-2),
0 18px 40px rgba(0, 0, 0, 0.35);
backdrop-filter: blur(12px);
transition:
opacity var(--t-base) var(--ease-out),
transform var(--t-base) var(--ease-out);
z-index: 5;
white-space: nowrap;
max-width: calc(100% - 16px);
box-sizing: border-box;
gap: 4px;
}
.selbar.on {
opacity: 1;
transform: translate(-50%, 0);
pointer-events: auto;
}
.selbar b {
font-size: 13px;
}
.selbar .sep {
width: 1px;
height: 22px;
background: var(--line-2);
margin: 0 4px;
}
.lib-detail {
border-left: 1px solid var(--line);
background: var(--bg-1);
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
overflow: hidden;
box-sizing: border-box;
}
[data-theme="bluehour"] .lib-detail {
background: color-mix(in srgb, var(--bg-1) 78%, transparent);
}
.ld-h {
display: flex;
align-items: center;
gap: 8px;
height: 44px;
padding: 0 10px 0 14px;
border-bottom: 1px solid var(--line);
flex: none;
}
.ld-h b {
font-size: 13px;
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ld-b {
flex: 1;
overflow: auto;
padding: 12px 14px;
display: flex;
flex-direction: column;
gap: 12px;
min-height: 0;
}
.ld-pv {
position: relative;
border-radius: 10px;
overflow: hidden;
display: grid;
place-items: center;
aspect-ratio: 4/3;
flex: none;
background: var(--well);
}
.ld-pv img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
.ld-name {
font-size: 13px;
font-weight: 600;
word-break: break-all;
line-height: 1.4;
}
.kv {
display: grid;
grid-template-columns: 64px 1fr;
gap: 7px 10px;
font-size: 12px;
align-items: baseline;
}
.kv dt {
color: var(--tx-3);
}
.kv dd {
color: var(--tx-1);
min-width: 0;
word-break: break-all;
}
.kv dd.mono {
font: 500 11.5px var(--mono);
}
.kv .path {
display: flex;
gap: 6px;
align-items: flex-start;
}
.kv .path span {
font: 500 11px var(--mono);
color: var(--tx-2);
word-break: break-all;
line-height: 1.45;
}
.ld-f {
flex: none;
padding: 10px 14px;
border-top: 1px solid var(--line);
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.ld-f .wide {
grid-column: 1/-1;
}
.ld-empty {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
color: var(--tx-3);
font-size: 12px;
text-align: center;
padding: 20px;
}
.lib-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
height: 100%;
min-height: 320px;
color: var(--tx-3);
text-align: center;
font-size: 12.5px;
}
.lib-empty b {
font-size: 15px;
color: var(--tx-1);
}
.scope-note {
display: flex;
gap: 8px;
margin: 14px 8px 8px;
padding: 10px;
border-radius: 10px;
border: 1px dashed var(--line-2);
font-size: 11.5px;
line-height: 1.55;
color: var(--tx-3);
}
.scope-note > svg {
margin-top: 2px;
color: var(--gold);
}
.scope-note b {
display: block;
color: var(--tx-2);
font-weight: 600;
margin-bottom: 2px;
}
.lib-search {
display: flex;
align-items: center;
gap: 8px;
height: 30px;
width: 240px;
min-width: 90px;
padding: 0 10px;
border-radius: var(--r-sm);
border: 1px solid var(--line-2);
background: var(--well);
color: var(--tx-3);
}
.lib-search input {
flex: 1;
min-width: 0;
width: 100%;
border: 0;
background: none;
outline: 0;
color: var(--tx-1);
font-size: 13px;
}
.lib-search:focus-within {
border-color: color-mix(in srgb, var(--scene) 70%, transparent);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--scene) 16%, transparent);
}
.lib-tools select {
flex: none;
}
.lib-segment {
display: flex;
flex: none;
gap: 2px;
padding: 3px;
border-radius: var(--lib-segment-radius, 9px);
border: 1px solid var(--line);
background: var(--well);
}
.lib-segment button {
border: 0;
background: none;
font-family: inherit;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
height: 28px;
padding: 0 10px;
border-radius: var(--lib-option-radius, 7px);
font-size: 12.5px;
color: var(--tx-2);
white-space: nowrap;
transition:
background var(--t-base) var(--ease-out),
color var(--t-base) var(--ease-out);
}
.lib-segment button:hover {
color: var(--tx-1);
}
.lib-segment button.on {
background: var(--lib-option-bg, var(--bg-3));
color: var(--tx-1);
box-shadow: var(--lib-option-shadow, var(--sh-1));
}
.lib-segment button.on svg {
color: var(--scene);
}
[data-theme="day"] .lib2 {
--lib-option-bg: #ffffff;
--lib-option-shadow:
0 1px 2px rgba(60, 44, 20, 0.14), 0 0 0 1px rgb(var(--ink) / 0.06);
}
[data-theme="day"] .lib-search {
border-color: var(--line-3);
}
[data-theme="grade"] .lib2 {
--lib-segment-radius: 4px;
--lib-option-radius: 4px;
}
.lt .mat img,
.lt .mat video {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: contain;
}
.lgrid.fill .lt .mat video {
object-fit: cover;
}
.ld-pv img,
.ld-pv video {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: contain;
}
.lt .ck.checked {
opacity: 1;
background: var(--gold);
color: var(--tx-inv);
border-color: var(--gold);
}
.selbar small {
font-size: 11px;
color: var(--tx-2);
}
.ld-f .a-btn {
min-width: 0;
}
.delete-preview {
display: flex;
gap: 8px;
overflow: auto;
}
.delete-preview > div {
width: 80px;
flex: none;
font-size: 11px;
overflow-wrap: anywhere;
}
.delete-preview img,
.delete-preview video {
width: 80px;
height: 60px;
object-fit: contain;
}
/* ── Canvas occupancy report (HEL-884) ───────────────────────────── */
.usage-file {
display: flex;
flex-direction: column;
gap: 10px;
padding: 10px 0;
}
.usage-file + .usage-file {
border-top: 1px solid var(--line-2);
}
.usage-head {
display: flex;
align-items: center;
gap: 10px;
}
.usage-head img,
.usage-head video {
width: 56px;
height: 42px;
border-radius: var(--r-sm);
object-fit: cover;
flex: none;
}
.usage-title {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.usage-title b {
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.usage-title span {
font-size: 11.5px;
color: var(--tx-3);
}
.usage-empty {
font-size: 12px;
color: var(--tx-2);
}
.usage-error {
color: var(--err);
}
.usage-free {
display: flex;
align-items: center;
gap: 12px;
justify-content: space-between;
padding: 10px 12px;
border: 1px solid color-mix(in srgb, var(--ok) 32%, transparent);
border-radius: var(--r-md);
background: color-mix(in srgb, var(--ok) 8%, transparent);
}
.usage-free p {
font-size: 12.5px;
margin: 0;
color: var(--tx-1);
}
.usage-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.usage-card {
display: flex;
align-items: center;
gap: 10px;
justify-content: space-between;
padding: 9px 11px;
border: 1px solid var(--line-2);
border-radius: var(--r-md);
}
.u-info {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.u-info b {
font-size: 12.5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.u-where {
font-size: 11.5px;
color: var(--tx-2);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.u-effect {
font-size: 11px;
color: var(--tx-3);
}
.u-effect.u-warn {
color: var(--warn, var(--gold));
}
.u-effect.u-danger {
color: var(--err);
}
.u-actions {
display: flex;
gap: 6px;
flex: none;
}
.usage-more {
border: 0;
background: none;
color: var(--tx-2);
font-size: 12px;
cursor: pointer;
padding: 4px 0;
text-decoration: underline;
text-underline-offset: 3px;
}
.usage-more:hover {
color: var(--tx-1);
}
.usage-invalid {
font-size: 11.5px;
color: var(--tx-3);
margin: 0;
}
.usage-confirm {
margin-top: 12px;
padding: 12px;
border: 1px solid color-mix(in srgb, var(--err) 30%, transparent);
border-radius: var(--r-md);
background: color-mix(in srgb, var(--err) 6%, transparent);
}
.usage-confirm p {
margin: 0 0 10px;
font-size: 12.5px;
line-height: 1.55;
color: var(--tx-1);
}
.usage-confirm-actions {
display: flex;
gap: 8px;
justify-content: flex-end;
}
html[data-motion="full"] .selbar.on {
animation: library-selection var(--t-base) var(--ease-out);
}
@keyframes library-selection {
from {
opacity: 0;
transform: translate(-50%, 12px);
}
to {
opacity: 1;
transform: translate(-50%, 0);
}
}