early version of OCR viewer now integrated

This commit is contained in:
nathan
2026-05-13 10:03:38 -04:00
parent 77323821cb
commit c663627594
17 changed files with 5734 additions and 1517 deletions

513
p44-ocr-viewer.css Normal file
View File

@@ -0,0 +1,513 @@
/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #1a1a2e;
--surface: #16213e;
--surface2: #0f3460;
--gold: #c8a84b;
--gold-dim: #8a6f2e;
--text: #ddd4bb;
--text-dim: #7a7260;
--highlight: #ffe066;
--border: #2e2e4e;
--toolbar-h: 52px;
--footer-h: 34px;
}
html, body {
height: 100%;
background: var(--bg);
color: var(--text);
font-family: 'Georgia', 'Times New Roman', serif;
font-size: 14px;
overflow: hidden;
}
/* ── App shell ────────────────────────────────────────────────── */
#app {
display: grid;
grid-template-rows: var(--toolbar-h) auto 1fr var(--footer-h);
height: 100vh;
}
/* ── Override dropdown ────────────────────────────────────────── */
#override-wrap {
position: relative;
flex-shrink: 0;
}
#override-menu {
display: none;
position: absolute;
top: calc(100% + 4px);
left: 0;
z-index: 500;
background: var(--surface);
border: 1px solid var(--gold-dim);
border-radius: 4px;
min-width: 160px;
padding: 4px 0;
box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
#override-menu.open { display: block; }
.override-item {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 14px;
font-family: 'Georgia', serif;
font-size: 11px;
color: var(--text-dim);
cursor: pointer;
white-space: nowrap;
letter-spacing: 0.03em;
transition: background 0.1s, color 0.1s;
}
.override-item:hover { background: var(--surface2); color: var(--gold); }
.override-item input[type="file"] { display: none; }
/* ── Toolbar ──────────────────────────────────────────────────── */
#toolbar {
display: flex;
align-items: center;
gap: 8px;
padding: 0 12px;
background: var(--surface);
border-bottom: 2px solid var(--gold-dim);
overflow: visible; /* must be visible so the Override dropdown can escape the toolbar */
flex-wrap: nowrap;
position: relative;
z-index: 100; /* sit above pass2-banner and panel headers */
}
#toolbar h1 {
font-size: 13px;
font-weight: normal;
letter-spacing: 0.1em;
color: var(--gold);
white-space: nowrap;
flex-shrink: 0;
}
.divider { width: 1px; height: 26px; background: var(--border); flex-shrink: 0; margin: 0 2px; }
.toolbar-group {
display: flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
}
.toolbar-group .lbl {
font-size: 9px;
color: var(--text-dim);
letter-spacing: 0.06em;
white-space: nowrap;
}
.file-btn {
display: inline-block;
padding: 3px 8px;
background: var(--surface2);
border: 1px solid var(--gold-dim);
border-radius: 3px;
color: var(--text);
font-size: 10px;
cursor: pointer;
letter-spacing: 0.03em;
transition: border-color 0.15s, background 0.15s;
white-space: nowrap;
}
.file-btn:hover { border-color: var(--gold); background: #1a2a50; }
.file-btn input[type="file"] { display: none; }
.tb-btn {
padding: 3px 9px;
background: transparent;
border: 1px solid var(--gold-dim);
border-radius: 3px;
color: var(--text-dim);
font-size: 10px;
font-family: inherit;
letter-spacing: 0.05em;
cursor: pointer;
transition: border-color 0.15s, color 0.15s, background 0.15s;
white-space: nowrap;
flex-shrink: 0;
}
.tb-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(200,168,75,0.08); }
a.tb-btn { text-decoration: none; display: inline-flex; align-items: center; }
#scale-select {
background: var(--surface2);
border: 1px solid var(--gold-dim);
border-radius: 3px;
color: var(--text);
font-size: 10px;
font-family: inherit;
padding: 2px 4px;
cursor: pointer;
}
/* ── Main panels ──────────────────────────────────────────────── */
#panels {
display: grid;
grid-template-columns: 1fr 1fr;
overflow: hidden;
}
.panel {
display: flex;
flex-direction: column;
overflow: hidden;
border-right: 1px solid var(--border);
}
.panel:last-child { border-right: none; }
.panel-header {
padding: 5px 10px;
font-size: 9px;
letter-spacing: 0.12em;
color: var(--gold-dim);
text-transform: uppercase;
background: var(--surface);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
display: flex;
align-items: center;
gap: 8px;
}
.panel-header .ph-title { flex: 1; }
/* page navigation */
.page-nav { display: flex; align-items: center; gap: 4px; }
.page-nav button {
background: var(--surface2); border: 1px solid var(--gold-dim);
border-radius: 2px; color: var(--text); font-size: 10px;
padding: 1px 6px; cursor: pointer; line-height: 1.5;
}
.page-nav button:hover { border-color: var(--gold); color: var(--gold); }
.page-nav button:disabled { opacity: 0.3; cursor: default; }
.page-nav input[type="number"] {
width: 42px; text-align: center;
background: var(--surface2); border: 1px solid var(--gold-dim);
border-radius: 2px; color: var(--text); font-size: 9px; padding: 2px 3px;
}
#page-label { font-size: 9px; color: var(--text-dim); white-space: nowrap; }
.panel-body {
flex: 1;
overflow: auto;
position: relative;
}
/* ── Left panel: PDF canvas + overlay ────────────────────────── */
#image-panel-body {
position: relative;
scrollbar-gutter: stable; /* reserve scrollbar space always — prevents layout shift on zoom */
}
#pdf-container {
position: relative;
display: block; /* block instead of inline-block — fills full panel width cleanly */
width: 100%;
min-height: 100%; /* always occupies the full panel height so nothing else renders below */
}
#pdf-canvas {
display: block;
user-select: none;
background: #e8e0cc;
}
#overlay {
position: absolute;
top: 0; left: 0;
pointer-events: none;
}
/* noinspection CssUnusedSymbol */
.word-box {
position: absolute;
border: 1px solid transparent;
border-radius: 1px;
cursor: crosshair;
pointer-events: all;
transition: background 0.07s, border-color 0.07s;
}
/* noinspection CssUnusedSymbol */
.word-box:hover,
/* noinspection CssUnusedSymbol */
.word-box.highlight {
background: rgba(255, 224, 102, 0.38);
border-color: var(--highlight);
}
.panel-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
gap: 12px;
color: var(--text-dim);
font-size: 13px;
font-style: italic;
padding: 40px;
text-align: center;
}
.panel-placeholder em {
color: var(--gold-dim);
font-size: 11px;
font-style: normal;
letter-spacing: 0.04em;
}
.spinner {
width: 22px; height: 22px;
border: 2px solid var(--surface2);
border-top-color: var(--gold);
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ── Footer ───────────────────────────────────────────────────── */
#footer {
display: flex;
align-items: center;
padding: 0 12px;
gap: 10px;
background: var(--surface);
border-top: 1px solid var(--border);
font-size: 10px;
color: var(--text-dim);
}
#status-msg { flex: 1; font-style: italic; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* ── Scrollbars ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }
/* ── Active toggle button state (sync-scroll, edit mode) ─────── */
.tb-btn.active { border-color: var(--gold); color: var(--gold); }
/* ── Flag buttons ─────────────────────────────────────────────── */
.flag-btn { font-size: 9px; padding: 2px 7px; }
.flag-btn.active { border-color: var(--gold); color: var(--gold); }
/* ── Footer extras ────────────────────────────────────────────── */
#flags-summary { color: var(--gold-dim); letter-spacing: 0.04em; white-space: nowrap; font-size: 10px; }
#kbd-hint { color: var(--text-dim); font-size: 9px; white-space: nowrap; opacity: 0.7; }
/* ── Zoom indicator in left panel header ─────────────────────────── */
#zoom-label {
font-size: 9px; color: var(--gold-dim); letter-spacing: 0.06em;
white-space: nowrap; min-width: 34px; text-align: right;
}
#btn-zoom-reset {
padding: 1px 6px; font-size: 9px; font-family: inherit;
background: transparent; border: 1px solid var(--gold-dim);
border-radius: 2px; color: var(--text-dim); cursor: pointer;
letter-spacing: 0.04em; white-space: nowrap;
transition: border-color 0.12s, color 0.12s;
}
#btn-zoom-reset:hover { border-color: var(--gold); color: var(--gold); }
/* ── Role switcher ────────────────────────────────────────────────── */
#role-select {
background: var(--surface2);
border: 1px solid var(--gold-dim);
border-radius: 3px;
color: var(--text);
font-size: 10px;
font-family: inherit;
padding: 2px 4px;
cursor: pointer;
}
/* ── Pass 2 review banner ─────────────────────────────────────────── */
#pass2-banner {
display: none;
align-items: center;
padding: 0 14px;
background: #2e2010;
border-bottom: 1px solid #c08020;
font-size: 11px;
color: #e8b848;
letter-spacing: 0.04em;
height: 26px;
overflow: hidden;
white-space: nowrap;
flex-shrink: 0;
}
/* ── Pass 2 revert bar ────────────────────────────────────────── */
#pass2-revert-bar {
display: none;
align-items: center;
gap: 8px;
padding: 6px 16px;
background: var(--surface);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
#pass2-revert-bar .rv-label {
font-size: 10px;
color: var(--text-dim);
letter-spacing: 0.04em;
flex: 1;
}
#pass2-revert-bar .rv-btn {
font-size: 10px;
font-family: 'Georgia', serif;
padding: 3px 10px;
border-radius: 3px;
border: 1px solid var(--border);
background: transparent;
color: var(--text-dim);
cursor: pointer;
letter-spacing: 0.04em;
transition: border-color 0.15s, color 0.15s;
}
#pass2-revert-bar .rv-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
#pass2-revert-bar .rv-btn.danger { border-color: var(--red, #d05050); color: var(--red, #d05050); }
#pass2-revert-bar .rv-btn.danger:hover { border-color: var(--red, #d05050); color: var(--text); }
/* ── Pass 2 change summary panel ─────────────────────────────── */
#pass2-change-summary {
display: none;
padding: 10px 20px;
background: var(--surface2);
border-bottom: 1px solid var(--gold-dim);
flex-shrink: 0;
font-size: 11px;
}
#pass2-change-summary .cs-title {
font-size: 10px;
color: var(--gold-dim);
letter-spacing: 0.08em;
text-transform: uppercase;
margin-bottom: 6px;
}
#pass2-change-summary .cs-list {
color: var(--text-dim);
line-height: 1.8;
max-height: 100px;
overflow-y: auto;
margin-bottom: 8px;
font-family: Georgia, serif;
}
#pass2-change-summary .cs-changed { color: #e8a838; }
#pass2-change-summary .cs-added { color: #4caf70; }
#pass2-change-summary .cs-deleted { color: #d05050; }
#pass2-change-summary .cs-actions { display: flex; gap: 8px; }
.cs-revert-btn {
font-size: 10px;
font-family: Georgia, serif;
padding: 3px 10px;
border-radius: 3px;
border: 1px solid var(--border);
background: transparent;
color: var(--text-dim);
cursor: pointer;
letter-spacing: 0.04em;
}
.cs-revert-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
.cs-revert-btn.danger { border-color: #d05050; color: #d05050; }
.cs-revert-btn.danger:hover { border-color: #e07070; color: #e07070; }
/* ── Plain-text edit surface ──────────────────────────────────── */
#text-panel-body {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
overflow: hidden;
}
#editor-wrap {
display: flex;
flex-direction: row;
flex: 1;
min-height: 0;
overflow: hidden;
}
#line-numbers {
width: 48px;
flex-shrink: 0;
background: transparent;
border-right: 1px solid var(--border);
color: var(--gold-dim);
font-family: 'Courier New', monospace;
font-size: 11px;
line-height: 1.75;
padding: 0 8px 0 12px;
text-align: right;
overflow: hidden;
user-select: none;
white-space: pre;
box-sizing: border-box;
margin-right: 12px;
}
#text-editor {
display: block; /* always block — visibility via #editor-wrap */
flex: 1;
min-width: 0;
min-height: 0;
width: 100%;
height: 100%;
background: var(--surface2);
color: var(--text);
font-family: 'Georgia', 'Times New Roman', serif;
font-size: 12.5px;
line-height: 1.75;
padding: 0 16px 0 0;
border: none;
border-radius: 0;
resize: none;
outline: none;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
}
/* ── Done-page read-only banner (Pass 1) ─────────────────────── */
#done-banner {
display: none;
align-items: center;
gap: 8px;
padding: 7px 16px;
background: #0f2a0f;
border-bottom: 1px solid #2e6e2e;
font-size: 10px;
color: #5cb85c;
letter-spacing: 0.05em;
flex-shrink: 0;
}
/* ── Problem flag indicator on page nav input ─────────────────── */
#page-input.problem { border-color: #c08020; }
/* ── OCR overlay panel (replaces raster in left panel) ───────── */
#ocr-overlay-panel {
display: none;
position: absolute;
inset: 0;
overflow-y: auto;
background: var(--surface);
padding: 20px 24px;
font-size: 13px;
line-height: 1.8;
color: var(--text);
font-family: 'Georgia', 'Times New Roman', serif;
white-space: pre-wrap;
word-break: break-word;
z-index: 10;
}