notenerdofficial_doc-preview/styles.css
Ambursley 2ab386c60e Add Excel (.xlsx) support with sheet-tabs navigation
Excel workbooks have no natural "page" concept, so sheet navigation is
built on LibreOffice's PDF export, which includes a bookmark/outline
entry per sheet by default (verified end-to-end with a real 2-sheet
workbook via convertToPdf + pdfjs-dist's getOutline/getDestination/
getPageIndex). The viewer reads that outline to show a bottom tab bar
mirroring Excel's own sheet-tab convention, and the page indicator now
shows which sheet is active. Falls back gracefully to a plain page
list if a given export has no outline.
2026-07-20 01:50:32 -04:00

293 lines
6.3 KiB
CSS

.doc-preview-path-input {
width: 22rem;
}
.doc-preview-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.doc-preview-header {
flex-shrink: 0;
padding: 0.3rem 0.75rem;
font-size: var(--font-ui-smaller);
color: var(--text-muted);
border-bottom: 1px solid var(--background-modifier-border);
display: flex;
justify-content: flex-end;
text-align: right;
}
.doc-preview-header-status.is-error {
color: var(--text-error);
}
.doc-preview-body {
flex: 1 1 auto;
min-height: 0;
display: flex;
position: relative;
}
.doc-preview-frame {
width: 100%;
height: 100%;
border: none;
}
.doc-preview-status {
margin: auto;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
color: var(--text-muted);
}
.doc-preview-status-text {
font-size: var(--font-ui-medium);
}
.doc-preview-error {
color: var(--text-error);
max-width: 28rem;
text-align: center;
}
.doc-preview-spinner {
width: 2rem;
height: 2rem;
border-radius: 50%;
border: 3px solid var(--background-modifier-border);
border-top-color: var(--interactive-accent);
animation: doc-preview-spin 0.8s linear infinite;
}
@keyframes doc-preview-spin {
to {
transform: rotate(360deg);
}
}
/* ── Custom PDF viewer ─────────────────────────────────────────────── */
.pdfviewer-root {
display: flex;
width: 100%;
height: 100%;
overflow: hidden;
}
.pdfviewer-thumbrail {
width: 0;
overflow-y: auto;
overflow-x: hidden;
flex-shrink: 0;
background: var(--background-secondary);
border-right: 1px solid var(--background-modifier-border);
transition: width 0.15s ease;
}
.pdfviewer-thumbrail.is-visible {
width: 140px;
}
.pdfviewer-thumb {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
padding: 0.5rem;
cursor: pointer;
border-radius: 4px;
}
.pdfviewer-thumb:hover {
background: var(--background-modifier-hover);
}
.pdfviewer-thumb.is-active .pdfviewer-thumb-canvas {
outline: 2px solid var(--interactive-accent);
}
.pdfviewer-thumb-canvas {
max-width: 100%;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
background: #fff;
}
.pdfviewer-thumb-label {
font-size: var(--font-ui-smaller);
color: var(--text-muted);
}
.pdfviewer-main {
display: flex;
flex-direction: column;
flex: 1 1 auto;
min-width: 0;
}
.pdfviewer-toolbar {
display: flex;
align-items: center;
gap: 0.15rem;
padding: 0.25rem 0.5rem;
border-bottom: 1px solid var(--background-modifier-border);
flex-shrink: 0;
}
.pdfviewer-toolbar-spacer {
flex: 1 1 auto;
}
.pdfviewer-zoom-label {
font-size: var(--font-ui-smaller);
color: var(--text-muted);
width: 3rem;
text-align: center;
user-select: none;
}
/* Doesn't scroll — exists purely so the page indicator has a positioning
ancestor that stays fixed regardless of how much canvas-wrap scrolls
internally (zoom/pan). See the constructor comment for why. */
.pdfviewer-canvas-outer {
position: relative;
flex: 1 1 auto;
display: flex;
min-height: 0;
}
.pdfviewer-canvas-wrap {
flex: 1 1 auto;
overflow: auto;
display: flex;
/* safe center (not plain center): when zoomed content overflows past the
centering point, plain center can make that overflow unreachable by
scrolling in some browser engines — safe falls back to start-alignment
for the overflowing portion instead, so panning can always reach it. */
align-items: safe center;
justify-content: safe center;
background: var(--background-secondary);
outline: none;
}
.pdfviewer-canvas-wrap.is-pan-ready {
cursor: grab;
}
.pdfviewer-canvas-wrap.is-panning {
cursor: grabbing;
}
.pdfviewer-page {
position: relative;
display: inline-block;
line-height: 0;
}
.pdfviewer-canvas {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
background: #fff;
display: block;
}
/* Adapted from pdfjs-dist's own web/pdf_viewer.css — invisible, precisely
positioned text overlaid on the canvas so the rendered page is selectable
and copyable even though what's visibly drawn is just pixels. */
.pdfviewer-text-layer {
position: absolute;
inset: 0;
overflow: clip;
opacity: 1;
line-height: 1;
text-size-adjust: none;
forced-color-adjust: none;
transform-origin: 0 0;
/* Obsidian's own app-wide CSS sets user-select: none on view chrome by
default (standard Electron-app pattern to avoid accidental UI text
selection) — that inherits into our view unless explicitly overridden
here. cursor: text below still shows without this, since cursor styling
and selection are independent properties, which is exactly the "cursor
changes but nothing highlights" symptom this fixes. */
-webkit-user-select: text;
user-select: text;
}
.pdfviewer-text-layer :is(span, br) {
color: transparent;
position: absolute;
white-space: pre;
cursor: text;
transform-origin: 0% 0%;
-webkit-user-select: text;
user-select: text;
}
.pdfviewer-text-layer ::selection {
background: rgba(0, 100, 255, 0.3);
}
.pdfviewer-text-layer .endOfContent {
display: block;
position: absolute;
inset: 100% 0 0;
cursor: default;
user-select: none;
}
.pdfviewer-page-indicator {
position: absolute;
bottom: 1rem;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 0.2rem 0.75rem;
border-radius: 999px;
font-size: var(--font-ui-smaller);
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}
.pdfviewer-page-indicator.is-visible {
opacity: 1;
}
/* Excel-style sheet tabs — Excel's own bottom-tab-strip convention. Hidden
by default; only shown when the loaded PDF actually has an outline. */
.pdfviewer-sheet-tabs {
display: none;
flex-shrink: 0;
gap: 0.25rem;
padding: 0.35rem 0.5rem;
border-top: 1px solid var(--background-modifier-border);
overflow-x: auto;
}
.pdfviewer-sheet-tabs.is-visible {
display: flex;
}
.pdfviewer-sheet-tab {
padding: 0.25rem 0.75rem;
border-radius: 4px;
font-size: var(--font-ui-smaller);
color: var(--text-muted);
cursor: pointer;
white-space: nowrap;
flex-shrink: 0;
}
.pdfviewer-sheet-tab:hover {
background: var(--background-modifier-hover);
}
.pdfviewer-sheet-tab.is-active {
background: var(--interactive-accent);
color: var(--text-on-accent);
}