415 lines
9.4 KiB
TypeScript
415 lines
9.4 KiB
TypeScript
import { css, cssManager } from '@design.estate/dees-element';
|
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
|
|
export const viewerStyles = [
|
|
themeDefaultStyles,
|
|
cssManager.defaultStyles,
|
|
css`
|
|
:host {
|
|
display: block;
|
|
width: 100%;
|
|
height: 600px;
|
|
position: relative;
|
|
font-family: 'Geist Sans', sans-serif;
|
|
contain: layout style;
|
|
}
|
|
|
|
dees-tile {
|
|
height: 100%;
|
|
}
|
|
|
|
.viewer-container::before,
|
|
.viewer-container::after {
|
|
content: '';
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
height: 8px;
|
|
z-index: 5;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.viewer-container::before {
|
|
top: 0;
|
|
background: linear-gradient(
|
|
to bottom,
|
|
${cssManager.bdTheme('hsl(0 0% 0% / 0.08)', 'hsl(0 0% 0% / 0.4)')},
|
|
${cssManager.bdTheme('hsl(0 0% 0% / 0.03)', 'hsl(0 0% 0% / 0.12)')},
|
|
transparent
|
|
);
|
|
}
|
|
|
|
.viewer-container::after {
|
|
bottom: 0;
|
|
background: linear-gradient(
|
|
to top,
|
|
${cssManager.bdTheme('hsl(0 0% 0% / 0.08)', 'hsl(0 0% 0% / 0.4)')},
|
|
${cssManager.bdTheme('hsl(0 0% 0% / 0.03)', 'hsl(0 0% 0% / 0.12)')},
|
|
transparent
|
|
);
|
|
}
|
|
|
|
.toolbar {
|
|
height: 40px;
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 12px;
|
|
gap: 12px;
|
|
}
|
|
|
|
.toolbar-group {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
|
|
.toolbar-group--end {
|
|
margin-left: auto;
|
|
}
|
|
|
|
.toolbar-button {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 6px;
|
|
background: transparent;
|
|
border: none;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: background 0.15s ease;
|
|
color: ${cssManager.bdTheme('hsl(215 16% 45%)', 'hsl(215 16% 75%)')};
|
|
}
|
|
|
|
.toolbar-button:hover:not(:disabled) {
|
|
background: ${cssManager.bdTheme('hsl(214 31% 92%)', 'hsl(217 25% 22%)')};
|
|
}
|
|
|
|
.toolbar-button:disabled {
|
|
opacity: 0.4;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.toolbar-button dees-icon {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.page-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 0 8px;
|
|
font-size: 14px;
|
|
color: ${cssManager.bdTheme('hsl(215 16% 45%)', 'hsl(215 16% 75%)')};
|
|
}
|
|
|
|
.page-input {
|
|
width: 48px;
|
|
height: 28px;
|
|
border-radius: 4px;
|
|
border: 1px solid ${cssManager.bdTheme('hsl(214 31% 86%)', 'hsl(217 25% 28%)')};
|
|
background: ${cssManager.bdTheme('hsl(0 0% 100%)', 'hsl(215 20% 12%)')};
|
|
color: ${cssManager.bdTheme('hsl(222 47% 11%)', 'hsl(210 20% 96%)')};
|
|
text-align: center;
|
|
font-size: 14px;
|
|
font-family: inherit;
|
|
outline: none;
|
|
}
|
|
|
|
.page-input:focus {
|
|
border-color: ${cssManager.bdTheme('hsl(217 91% 60%)', 'hsl(213 93% 68%)')};
|
|
}
|
|
|
|
.page-separator {
|
|
color: ${cssManager.bdTheme('hsl(215 16% 60%)', 'hsl(215 16% 50%)')};
|
|
}
|
|
|
|
.zoom-level {
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
min-width: 48px;
|
|
text-align: center;
|
|
}
|
|
|
|
.viewer-container {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.sidebar {
|
|
width: 200px;
|
|
background: transparent;
|
|
border-right: 1px solid ${cssManager.bdTheme('hsl(214 31% 91%)', 'hsl(217 25% 22%)')};
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
order: 0;
|
|
}
|
|
|
|
.sidebar-right .sidebar {
|
|
border-right: none;
|
|
border-left: 1px solid ${cssManager.bdTheme('hsl(214 31% 91%)', 'hsl(217 25% 22%)')};
|
|
order: 1;
|
|
}
|
|
|
|
.sidebar-header {
|
|
height: 40px;
|
|
padding: 0 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
border-bottom: 1px solid ${cssManager.bdTheme('hsl(214 31% 91%)', 'hsl(217 25% 22%)')};
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: ${cssManager.bdTheme('hsl(215 16% 45%)', 'hsl(215 16% 75%)')};
|
|
}
|
|
|
|
.sidebar-close {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 4px;
|
|
background: transparent;
|
|
border: none;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: ${cssManager.bdTheme('hsl(215 16% 45%)', 'hsl(215 16% 75%)')};
|
|
transition: background 0.15s ease;
|
|
}
|
|
|
|
.sidebar-close:hover {
|
|
background: ${cssManager.bdTheme('hsl(214 31% 92%)', 'hsl(217 25% 22%)')};
|
|
}
|
|
|
|
.sidebar-close dees-icon {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.sidebar-content {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding: 12px;
|
|
display: block;
|
|
overscroll-behavior: contain;
|
|
min-height: 0;
|
|
}
|
|
|
|
.thumbnail {
|
|
position: relative;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
cursor: pointer;
|
|
border: 2px solid transparent;
|
|
transition: border-color 0.15s ease;
|
|
background: ${cssManager.bdTheme('hsl(0 0% 95%)', 'hsl(215 20% 18%)')};
|
|
display: block;
|
|
width: 100%;
|
|
margin-bottom: 12px;
|
|
/* Default A4 aspect ratio (297mm / 210mm ≈ 1.414) */
|
|
min-height: calc(176px * 1.414);
|
|
}
|
|
|
|
.thumbnail:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.thumbnail:hover {
|
|
border-color: ${cssManager.bdTheme('hsl(214 31% 86%)', 'hsl(217 25% 35%)')};
|
|
}
|
|
|
|
.thumbnail.active {
|
|
border-color: ${cssManager.bdTheme('hsl(217 91% 60%)', 'hsl(213 93% 68%)')};
|
|
}
|
|
|
|
.thumbnail-canvas {
|
|
display: block;
|
|
width: 100%;
|
|
height: auto;
|
|
image-rendering: -webkit-optimize-contrast;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
.thumbnail-number {
|
|
position: absolute;
|
|
bottom: 4px;
|
|
right: 4px;
|
|
background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(0, 0, 0, 0.8)')};
|
|
color: white;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
padding: 2px 6px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.viewer-main {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding: 20px;
|
|
scroll-behavior: smooth;
|
|
overscroll-behavior: contain;
|
|
min-height: 0;
|
|
position: relative;
|
|
}
|
|
|
|
.loading-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100%;
|
|
gap: 16px;
|
|
color: ${cssManager.bdTheme('hsl(215 16% 45%)', 'hsl(215 16% 75%)')};
|
|
}
|
|
|
|
.loading-spinner {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 50%;
|
|
border: 3px solid ${cssManager.bdTheme('hsl(214 31% 86%)', 'hsl(217 25% 28%)')};
|
|
border-top-color: ${cssManager.bdTheme('hsl(217 91% 60%)', 'hsl(213 93% 68%)')};
|
|
animation: spin 0.8s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
.loading-text {
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.pages-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 20px;
|
|
}
|
|
|
|
.page-wrapper {
|
|
display: flex;
|
|
justify-content: center;
|
|
width: 100%;
|
|
}
|
|
|
|
.canvas-container {
|
|
background: white;
|
|
box-shadow: 0 2px 12px ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(0, 0, 0, 0.3)')};
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
display: inline-block;
|
|
position: relative;
|
|
}
|
|
|
|
.page-canvas {
|
|
display: block;
|
|
image-rendering: -webkit-optimize-contrast;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
/* Text layer for selection */
|
|
.text-layer {
|
|
position: absolute;
|
|
inset: 0;
|
|
overflow: visible;
|
|
line-height: 1;
|
|
text-size-adjust: none;
|
|
forced-color-adjust: none;
|
|
transform-origin: 0 0;
|
|
z-index: 1;
|
|
user-select: text;
|
|
-webkit-user-select: text;
|
|
}
|
|
|
|
.text-layer span,
|
|
.text-layer br {
|
|
color: transparent;
|
|
position: absolute;
|
|
white-space: pre;
|
|
cursor: text;
|
|
transform-origin: 0% 0%;
|
|
user-select: text;
|
|
-webkit-user-select: text;
|
|
}
|
|
|
|
.text-layer ::selection {
|
|
background: rgba(0, 100, 200, 0.3);
|
|
}
|
|
|
|
.text-layer br::selection {
|
|
background: transparent;
|
|
}
|
|
|
|
.text-layer .endOfContent {
|
|
display: block;
|
|
position: absolute;
|
|
inset: 100% 0 0;
|
|
z-index: 0;
|
|
cursor: default;
|
|
user-select: none;
|
|
}
|
|
|
|
.text-layer.selecting .endOfContent {
|
|
top: 0;
|
|
}
|
|
|
|
.pdf-viewer.with-sidebar .viewer-main {
|
|
margin-left: 0;
|
|
}
|
|
|
|
.pdf-footer {
|
|
height: 28px;
|
|
padding: 0 16px;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 11px;
|
|
color: var(--dees-color-text-muted);
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
}
|
|
|
|
.pdf-footer-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
}
|
|
|
|
.pdf-footer-left .pdf-footer-item + .pdf-footer-item {
|
|
padding-left: 12px;
|
|
border-left: 1px solid var(--dees-color-border-default);
|
|
}
|
|
|
|
.pdf-footer-center {
|
|
position: absolute;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
font-weight: 500;
|
|
transition: margin-left 0.15s ease;
|
|
}
|
|
|
|
.pdf-footer-right {
|
|
margin-left: auto;
|
|
}
|
|
|
|
.pdf-footer-item {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.pdf-footer-filename {
|
|
font-family: 'Intel One Mono', 'Geist Mono', monospace;
|
|
opacity: 0.7;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
`,
|
|
]; |