Add bins feature: upload, de-perspective, gallery

- lib/storage.mjs: bin CRUD with bin: prefix
- lib/grid-image.mjs: compute_bin_size() capped at 1024px
- server.mjs: POST/GET/PUT/DELETE /api/bins routes; PUT /api/bins/:id/corners
  re-processes image via process_grid_image with rows=1 cols=1
- public/lib/api.mjs: bin API wrappers including upload_bin()
- public/index.html: Bins nav button
- public/templates.html: t-section-bins, t-bin-card, t-dialog-bin-editor
- public/app.mjs: render_bins(), open_bin_editor() using Grid_Setup,
  save/cancel wiring in init()
- public/style.css: bin gallery and card styles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 04:28:03 +00:00
parent f370b6d48d
commit 28b4590903
8 changed files with 510 additions and 11 deletions

View File

@@ -1085,12 +1085,52 @@ nav {
box-shadow: 0 0 0 3px rgba(91, 156, 246, 0.3);
}
.source-card-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.25rem;
}
.source-card-meta {
font-size: 0.75rem;
color: var(--text-faint);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
}
.source-card-uses {
display: flex;
gap: 0.2rem;
flex-shrink: 0;
}
.source-use-badge {
font-size: 0.65rem;
padding: 0.1rem 0.35rem;
border-radius: 3px;
text-transform: lowercase;
font-weight: 600;
letter-spacing: 0.02em;
cursor: pointer;
border: none;
transition: opacity 0.1s;
}
.source-use-badge.source-use-inactive {
opacity: 0.25;
}
.source-use-grid {
background: rgba(91, 156, 246, 0.18);
color: #5b9cf6;
}
.source-use-bin {
background: rgba(91, 246, 156, 0.18);
color: #5bf69c;
}
.source-card-delete {
@@ -1806,3 +1846,75 @@ nav {
.detail-file-link:hover {
text-decoration: underline;
}
/* ===== BINS ===== */
.bin-gallery {
display: flex;
flex-wrap: wrap;
gap: 1rem;
padding: 1rem 0;
}
.bin-card {
width: 220px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
overflow: hidden;
display: flex;
flex-direction: column;
}
.bin-card-img-wrap {
width: 100%;
aspect-ratio: 4 / 3;
background: #1a1a1a;
position: relative;
overflow: hidden;
}
.bin-card-img {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
.bin-card-unprocessed {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
color: var(--text-muted);
background: rgba(0,0,0,0.5);
}
.bin-card-img-wrap.has-image .bin-card-unprocessed {
display: none;
}
.bin-card-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.4rem 0.5rem;
gap: 0.5rem;
min-height: 2rem;
}
.bin-card-name {
font-size: 0.85rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
}
.bin-editor-canvas {
display: block;
border-radius: 4px;
max-width: 100%;
}