Initial commit

Photo-based book cataloger with AI identification.
Room → Cabinet → Shelf → Book hierarchy; FastAPI + SQLite backend;
vanilla JS SPA; OpenAI-compatible plugin system for boundary
detection, text recognition, and archive search.
This commit is contained in:
night
2026-03-09 14:11:11 +03:00
committed by Petr Polezhaev
commit 5d5f26c8ae
64 changed files with 8605 additions and 0 deletions

70
static/css/tree.css Normal file
View File

@@ -0,0 +1,70 @@
/*
* tree.css
* Styles for the sidebar tree: room/cabinet/shelf/book node rows,
* selection highlight, segment-hover highlight (synced with boundary canvas),
* drag handle, expand toggle, inline name spans, per-level action icon buttons,
* book thumbnail + metadata layout, status badges, AI suggestion rows,
* source badges (per archive/plugin), and the "+ Add Room" dashed button.
*/
/* ── Tree nodes ── */
.node{margin-bottom:2px}
.nrow{display:flex;align-items:center;gap:4px;padding:10px 8px;border-radius:7px;user-select:none}
.nrow-room {background:#1e3a5f;color:white;cursor:pointer}
.nrow-cabinet{background:#234e85;color:white;cursor:pointer}
@media(min-width:768px){
.nrow{padding:6px 7px}
}
.nrow-shelf {background:#f8fafc;border:1px solid #e2e8f0;cursor:pointer}
.nrow-book {background:white;cursor:pointer}
.nrow.sel {outline:2px solid #38bdf8;outline-offset:-2px}
.nrow.seg-hover{background:#fef9c3!important}
.nrow-room.seg-hover{background:#2d5b9e!important}
.nrow-cabinet.seg-hover{background:#2d5b9e!important}
.nchildren{padding-left:16px;margin-top:2px}
/* ── Drag handle ── */
.drag-h{color:#94a3b8;cursor:grab;font-size:.9rem;flex-shrink:0;padding:1px 2px;user-select:none;touch-action:none}
.nrow-room .drag-h,.nrow-cabinet .drag-h{color:rgba(255,255,255,.4)}
.drag-ghost{opacity:.4}
/* ── Toggle ── */
.tbtn{background:none;border:none;cursor:pointer;font-size:.75rem;padding:2px;flex-shrink:0;color:inherit;transition:transform .15s;line-height:1}
.tbtn.col{transform:rotate(-90deg)}
/* ── Name (editable) ── */
.nname{flex:1;min-width:0;font-size:.84rem;font-weight:500;outline:none;cursor:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:3px;padding:1px 3px}
.nname:focus{background:rgba(255,255,255,.18);white-space:normal;overflow:visible}
.nrow-shelf .nname,.nrow-book .nname{color:#334155;font-weight:400}
/* ── Action buttons ── */
.nacts{display:flex;align-items:center;gap:1px;flex-shrink:0}
.ibtn{background:none;border:none;cursor:pointer;font-size:1.1rem;padding:4px 6px;border-radius:4px;color:inherit;opacity:.8;line-height:1;flex-shrink:0;min-width:48px;min-height:48px;display:flex;align-items:center;justify-content:center}
.ibtn:active{background:rgba(0,0,0,.12)}
.ibtn:disabled{opacity:.3;cursor:default}
@media(min-width:768px){
.ibtn{min-width:24px;min-height:24px;font-size:.82rem;padding:2px 4px}
}
/* ── Book row (sidebar) ── */
.bthumb{width:22px;height:30px;object-fit:cover;border-radius:2px;flex-shrink:0}
.bthumb-ph{width:22px;height:30px;background:#e2e8f0;border-radius:2px;display:flex;align-items:center;justify-content:center;font-size:.65rem;color:#94a3b8;flex-shrink:0}
.binfo{flex:1;min-width:0}
.bttl{font-size:.8rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bsub{font-size:.7rem;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sbadge{display:inline-block;font-size:.6rem;font-weight:700;padding:1px 5px;border-radius:3px;flex-shrink:0;text-transform:uppercase;letter-spacing:.03em}
.s-unid{background:#e2e8f0;color:#64748b}.s-aiid{background:#fef3c7;color:#b45309}.s-appr{background:#dcfce7;color:#15803d}
.ai-sug{display:flex;align-items:center;gap:5px;background:#eff6ff;border:1px solid #bfdbfe;border-radius:5px;padding:3px 8px;margin-bottom:4px;font-size:.8rem}
.ai-sug em{flex:1;color:#1e40af;font-style:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}
.src-badge{display:inline-block;font-size:.58rem;font-weight:700;padding:1px 4px;border-radius:3px;text-transform:uppercase;letter-spacing:.03em;white-space:nowrap;flex-shrink:0}
.src-vlm,.src-vlm_spine,.src-vlm_shelves,.src-vlm_books{background:#ede9fe;color:#7c3aed}
.src-ai,.src-ai_search{background:#fef3c7;color:#b45309}
.src-openlibrary{background:#dbeafe;color:#1d4ed8}
.src-rsl{background:#dcfce7;color:#15803d}
.src-rusneb{background:#fce7f3;color:#be185d}
.src-alib,.src-alib_web,.src-alib_telegram{background:#fff7ed;color:#c2410c}
.src-nlr{background:#f1f5f9;color:#475569}.src-shpl{background:#f1f5f9;color:#475569}
/* ── Add-root button ── */
.add-root{display:block;width:100%;padding:9px;background:#f1f5f9;border:2px dashed #94a3b8;border-radius:7px;color:#64748b;font-size:.84rem;cursor:pointer;margin-top:8px;text-align:center}
.add-root:active{background:#e2e8f0}