siyuan/app/src/assets/scss/pdf/_pdf.scss

969 lines
18 KiB
SCSS

/* Copyright 2014 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@import "pdf_viewer";
.pdf {
&__toolbar {
position: relative;
left: 0;
right: 0;
cursor: default;
}
&__outer {
user-select: text;
overflow: hidden;
width: 100%;
height: 100%;
position: relative;
}
&__util {
&--hide .pdf__util__hide {
display: none;
}
.b3-menu__item:hover {
background-color: var(--b3-list-hover);
}
}
&__rect {
cursor: pointer;
&--hl > div {
transition: opacity 1500ms linear;
animation-duration: 1s;
animation-fill-mode: both;
animation-name: fadeIn;
}
& > div {
box-sizing: border-box;
position: absolute;
&:first-child {
border-bottom-left-radius: 3px;
border-top-left-radius: 3px;
}
&:last-child {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
}
}
&__resize {
position: fixed;
border: 2px solid var(--b3-pdf-background1);
box-sizing: border-box;
border-radius: 4px;
}
}
.annotationLayer section:not(.linkAnnotation) {
display: none;
}
.pdfViewer.enablePermissions .textLayer span {
user-select: none !important;
cursor: not-allowed;
}
#viewerContainer.pdfPresentationMode:fullscreen {
top: 0;
border-top: 2px solid rgba(0, 0, 0, 0);
background-color: var(--b3-theme-background);
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
user-select: none;
}
.pdfPresentationMode:fullscreen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:fullscreen .textLayer span {
cursor: none;
}
.pdfPresentationMode.pdfPresentationModeControls > *,
.pdfPresentationMode.pdfPresentationModeControls .textLayer span {
cursor: default;
}
#sidebarContainer {
position: absolute;
top: 32px;
bottom: 0;
width: var(--b3-pdf-sidebar-width);
visibility: hidden;
z-index: 1;
transition-duration: 200ms;
transition-timing-function: ease;
transition-property: left;
left: calc(0px - var(--b3-pdf-sidebar-width));
background-color: var(--b3-theme-surface);
}
#outerContainer.sidebarResizing #sidebarContainer {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
transition-duration: 0s;
/* Prevent e.g. the thumbnails being selected when the sidebar is resized. */
user-select: none;
}
#outerContainer.sidebarMoving #sidebarContainer,
#outerContainer.sidebarOpen #sidebarContainer {
visibility: visible;
}
#outerContainer.sidebarOpen #sidebarContainer {
left: 0;
}
#mainContainer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
min-width: 320px;
}
#sidebarContent {
top: 32px;
bottom: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
width: 100%;
left: 0;
}
#viewerContainer {
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
top: 32px;
right: 0;
bottom: 0;
left: 0;
outline: none;
}
#viewerContainer:not(.pdfPresentationMode) {
transition-duration: 200ms;
transition-timing-function: ease;
}
#outerContainer.sidebarResizing #viewerContainer {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
transition-duration: 0s;
}
#outerContainer.sidebarOpen
#viewerContainer:not(.pdfPresentationMode) {
transition-property: left;
left: var(--b3-pdf-sidebar-width);
}
#toolbarSidebar,
#toolbarViewer {
width: 100%;
height: 32px;
display: flex;
padding-left: 8px;
box-sizing: border-box;
}
#toolbarViewer #numPages {
line-height: 32px;
padding-left: 4px;
}
#sidebarResizer {
position: absolute;
top: 0;
bottom: 0;
width: 0;
z-index: 200;
cursor: ew-resize;
right: -6px;
}
#loadingBar {
position: absolute;
height: 4px;
background-color: var(--b3-theme-on-background);
border-bottom: 1px solid var(--b3-theme-surface-lighter);
transition-duration: 200ms;
transition-timing-function: ease;
}
#loadingBar {
transition-property: left;
left: 0;
right: var(--b3-pdf-offset);
}
#outerContainer.sidebarOpen #loadingBar {
left: var(--b3-pdf-sidebar-width);
}
#outerContainer.sidebarResizing #loadingBar {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
transition-duration: 0s;
}
#loadingBar .progress {
position: absolute;
top: 0;
left: 0;
width: 0%;
height: 100%;
background-color: var(--b3-theme-primary-light);
overflow: hidden;
transition: width 200ms;
}
@keyframes progressIndeterminate {
0% {
left: -142px;
}
100% {
left: 0;
}
}
#loadingBar .progress.indeterminate {
background-color: var(--b3-theme-on-surface);
transition: none;
}
#loadingBar .progress.indeterminate .glimmer {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: calc(100% + 150px);
background: repeating-linear-gradient(
135deg,
var(--b3-theme-primary-lighter) 0,
var(--b3-theme-on-surface) 5px,
var(--b3-theme-on-surface) 45px,
var(--b3-theme-primary-light) 55px,
var(--b3-theme-primary-light) 95px,
var(--b3-theme-primary-lighter) 100px
);
animation: progressIndeterminate 1s linear infinite;
}
.findbar {
left: 64px;
position: absolute;
top: 36px;
padding: 4px 8px;
display: flex;
align-items: center;
flex-wrap: wrap;
#findInput {
width: 120px;
}
#findInput[data-status="notFound"] {
background-color: var(--b3-theme-error);
}
}
.secondaryToolbar {
right: 4px;
position: absolute;
top: 36px;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
#secondaryToolbarButtonContainer {
max-width: 220px;
max-height: 400px;
}
#secondaryToolbarButtonContainer.hiddenScrollModeButtons > .scrollModeButtons,
#secondaryToolbarButtonContainer.hiddenSpreadModeButtons > .spreadModeButtons {
display: none !important;
}
#findMsg {
color: var(--b3-theme-error);
}
#findMsg:empty {
display: none;
}
.toolbarButton {
border: none;
background: none;
cursor: pointer;
padding: 0 4px;
line-height: 32px;
user-select: none;
width: 20px;
box-sizing: border-box;
height: 32px;
margin-right: 8px;
color: var(--b3-theme-on-surface);
overflow: initial;
&:hover,
&:focus {
color: var(--b3-theme-on-background);
}
& > svg {
height: 12px;
width: 12px;
}
&[disabled] {
color: var(--b3-theme-surface-lighter);
}
}
.toolbarButton.toggled,
.secondaryToolbarButton.toggled {
color: var(--b3-theme-primary);
}
.secondaryToolbarButton {
&:hover {
background-color: var(--b3-list-hover);
}
&[disabled] {
opacity: 0.38;
cursor: not-allowed;
}
}
.dropdownToolbarButton select {
min-width: 124px;
height: 24px;
margin: 4px 8px 0 0;
line-height: 24px;
padding: 0 8px;
}
#customScaleOption {
display: none;
}
#pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, 0.5) solid;
}
.bookmark[href="#"] {
opacity: 0.5;
pointer-events: none;
}
.toolbarField[type="checkbox"] {
opacity: 0;
position: absolute !important;
margin: 10px 0 3px 7px;
}
.toolbarField.pageNumber {
min-width: 16px;
text-align: right;
width: 48px;
padding: 1px 8px;
margin: 4px 0;
}
.toolbarField.pageNumber::-webkit-inner-spin-button,
.toolbarField.pageNumber::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.toolbarField.pageNumber.visiblePageIsLoading {
background-image: var(--loading-icon);
background-repeat: no-repeat;
background-position: 3px;
}
#thumbnailView,
#outlineView,
#attachmentsView,
#layersView {
width: calc(100% - 16px);
top: 0;
bottom: 0;
padding: 8px;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
}
#thumbnailView > a:active,
#thumbnailView > a:focus {
outline: 0;
}
#thumbnailView .thumbnail {
margin-bottom: 8px;
}
.thumbnailImage {
border: 1px solid rgba(0, 0, 0, 0);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
opacity: 0.8;
z-index: 99;
background-color: rgba(255, 255, 255, 1);
background-clip: content-box;
}
.thumbnailSelectionRing {
border-radius: 2px;
padding: 7px;
margin: 0 auto;
box-shadow: 0 0 1px 1px var(--b3-theme-surface-lighter);
}
a:focus > .thumbnail > .thumbnailSelectionRing > .thumbnailImage,
.thumbnail:hover > .thumbnailSelectionRing > .thumbnailImage {
opacity: 0.9;
}
a:focus > .thumbnail > .thumbnailSelectionRing,
.thumbnail:hover > .thumbnailSelectionRing {
background-color: var(--b3-list-hover);
background-clip: padding-box;
color: rgba(255, 255, 255, 0.9);
}
.thumbnail.selected > .thumbnailSelectionRing > .thumbnailImage {
opacity: 1;
}
.thumbnail.selected > .thumbnailSelectionRing {
background-color: var(--b3-list-hover);
background-clip: padding-box;
color: rgba(255, 255, 255, 1);
}
.treeWithDeepNesting > .treeItem,
.treeItem > .treeItems {
margin-left: 20px;
}
.treeItem > a {
text-decoration: none;
display: inline-block;
min-width: 95%;
height: auto;
margin-bottom: 1px;
border-radius: 2px;
line-height: 15px;
user-select: none;
white-space: normal;
cursor: pointer;
padding: 4px 0 4px 4px;
color: var(--b3-theme-on-background);
}
#layersView .treeItem > a > * {
cursor: pointer;
}
#layersView .treeItem > a > label {
padding-left: 4px;
}
.treeItem {
position: relative;
.treeItemToggler {
transition: var(--b3-transition);
height: 24px;
width: 24px;
cursor: pointer;
text-align: center;
color: var(--b3-theme-on-surface);
position: absolute;
left: -19px;
top: 2px;
svg {
height: 20px;
width: 8px;
}
&.treeItemsHidden {
& ~ .treeItems {
display: none;
}
transform: rotate(-90deg);
left: -17px;
top: 0;
}
&:hover {
color: var(--b3-theme-on-background);
}
}
}
.treeItem.selected > a {
background-color: var(--b3-theme-surface-lighter);
}
.treeItemToggler:hover + a,
.treeItemToggler:hover ~ .treeItems,
.treeItem:not(.selected) > a:hover {
background-color: var(--b3-list-hover);
}
#errorWrapper {
background: none repeat scroll 0 0 var(--b3-theme-on-background);
color: var(--main-color);
left: 0;
position: absolute;
right: 0;
z-index: 1000;
padding: 3px 6px;
}
#errorMessageLeft {
float: left;
}
#errorMessageRight {
float: right;
}
#errorMoreInfo {
background-color: var(--b3-theme-surface);
color: var(--b3-theme-on-surface);
border: 1px solid var(--b3-theme-surface-lighter);
padding: 3px;
margin: 3px;
width: 98%;
}
.overlayButton {
width: auto;
margin: 3px 4px 2px !important;
padding: 2px 11px;
color: var(--b3-theme-on-background);
background-color: var(--b3-theme-background);
border: 0 none !important;
}
#overlayContainer {
display: table;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
z-index: 40000;
}
#overlayContainer > * {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
#overlayContainer > .container {
position: absolute;
top: 10%;
left: 10%;
height: 80%;
width: 80%;
}
#overlayContainer > .container > .dialog {
padding: 16px;
position: inherit;
overflow: auto;
width: 100%;
box-sizing: border-box;
}
.dialog > .row {
display: table-row;
}
.dialog > .row > * {
display: table-cell;
}
.dialog .toolbarField {
margin: 5px 0;
}
.dialog .separator {
display: block;
margin: 4px 0;
height: 1px;
width: 100%;
background-color: var(--b3-theme-surface-lighter);
}
.dialog .buttonRow {
text-align: center;
vertical-align: middle;
}
.dialog :link {
color: rgba(255, 255, 255, 1);
}
#passwordOverlay > .dialog {
text-align: center;
}
#passwordOverlay .toolbarField {
width: 200px;
}
#documentPropertiesOverlay > .dialog {
text-align: left;
}
#documentPropertiesOverlay .row > * {
min-width: 100px;
}
#documentPropertiesOverlay .row > * {
text-align: left;
}
#documentPropertiesOverlay .row > span {
width: 125px;
word-wrap: break-word;
}
#documentPropertiesOverlay .row > p {
max-width: 225px;
word-wrap: break-word;
}
#documentPropertiesOverlay .buttonRow {
margin-top: 10px;
}
.clearBoth {
clear: both;
}
.fileInput {
background: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
margin-top: 5px;
visibility: hidden;
position: fixed;
right: 0;
top: 0;
}
#PDFBug {
background: none repeat scroll 0 0 rgba(255, 255, 255, 1);
border: 1px solid rgba(102, 102, 102, 1);
position: fixed;
top: 32px;
right: 0;
bottom: 0;
font-size: 10px;
padding: 0;
width: 300px;
}
#PDFBug .controls {
background: rgba(238, 238, 238, 1);
border-bottom: 1px solid rgba(102, 102, 102, 1);
padding: 3px;
}
#PDFBug .panels {
bottom: 0;
left: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
right: 0;
top: 27px;
}
#PDFBug .panels > div {
padding: 5px;
}
#PDFBug button.active {
font-weight: bold;
}
.debuggerShowText {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
color: rgba(0, 0, 255, 1);
}
.debuggerHideText:hover {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
}
#PDFBug .stats {
font-family: courier;
font-size: 10px;
white-space: pre;
}
#PDFBug .stats .title {
font-weight: bold;
}
#PDFBug table {
font-size: 10px;
}
#PDFBug table.showText {
border-collapse: collapse;
text-align: center;
}
#PDFBug table.showText,
#PDFBug table.showText tr,
#PDFBug table.showText td {
border: 1px solid black;
padding: 1px;
}
#PDFBug table.showText td.advance {
color: grey;
}
#viewer.textLayer-visible .textLayer {
opacity: 1;
}
#viewer.textLayer-visible .canvasWrapper {
background-color: rgba(128, 255, 128, 1);
}
#viewer.textLayer-visible .canvasWrapper canvas {
mix-blend-mode: screen;
}
#viewer.textLayer-visible .textLayer span {
background-color: rgba(255, 255, 0, 0.1);
color: rgba(0, 0, 0, 1);
border: solid 1px rgba(255, 0, 0, 0.5);
box-sizing: border-box;
}
#viewer.textLayer-hover .textLayer span:hover {
background-color: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
}
#viewer.textLayer-shadow .textLayer span {
background-color: rgba(255, 255, 255, 0.6);
color: rgba(0, 0, 0, 1);
}
.rect-to-annotation {
cursor: crosshair !important;
user-select: none;
*:not(input):not(textarea):not(button):not(select):not(:link) {
cursor: inherit !important;
user-select: auto;
}
}
.grab-to-pan-grab {
//cursor: url("images/grab.cur"), move !important;
cursor: grab !important;
}
.grab-to-pan-grab *:not(input):not(textarea):not(button):not(select):not(:link) {
cursor: inherit !important;
}
.grab-to-pan-grab:active,
.grab-to-pan-grabbing {
//cursor: url("images/grabbing.cur"), move !important;
cursor: grabbing !important;
position: fixed;
background: rgba(0, 0, 0, 0);
display: block;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 50000; /* should be higher than anything else in PDF.js! */
}
@page {
margin: 0;
}
#printContainer {
display: none;
}
@media print {
/* Rules for browsers that don't support mozPrintCallback. */
#sidebarContainer,
#secondaryToolbar,
.toolbar,
#loadingBox,
#errorWrapper,
.textLayer,
.canvasWrapper {
display: none;
}
#viewerContainer {
overflow: visible;
}
#mainContainer,
#viewerContainer,
.page,
.page canvas {
position: static;
padding: 0;
margin: 0;
}
.page {
float: left;
display: none;
border: none;
box-shadow: none;
background-clip: content-box;
background-color: rgba(255, 255, 255, 1);
}
.page[data-loaded] {
display: block;
}
.fileInput {
display: none;
}
#printContainer {
height: 100%;
}
/* wrapper around (scaled) print canvas elements */
#printContainer > .printedPage {
page-break-after: always;
page-break-inside: avoid;
/* The wrapper always cover the whole page. */
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#printContainer > .xfaPrintedPage .xfaPage {
position: absolute;
}
#printContainer > .xfaPrintedPage {
page-break-after: always;
page-break-inside: avoid;
width: 100%;
height: 100%;
position: relative;
}
#printContainer > .printedPage canvas,
#printContainer > .printedPage img {
/* The intrinsic canvas / image size will make sure that we fit the page. */
max-width: 100%;
max-height: 100%;
display: block;
}
}
.visibleLargeView,
.visibleMediumView,
.visibleSmallView {
display: none;
}
@media all and (max-width: 840px) {
#outerContainer.sidebarOpen #viewerContainer {
left: 0 !important;
}
#outerContainer .hiddenLargeView,
#outerContainer .hiddenMediumView {
display: inherit;
}
#outerContainer .visibleLargeView,
#outerContainer .visibleMediumView {
display: none;
}
}
@media all and (max-width: 770px) {
#outerContainer .hiddenLargeView {
display: none;
}
#outerContainer .visibleLargeView {
display: inherit;
}
}
@media all and (max-width: 700px) {
#outerContainer .hiddenMediumView {
display: none;
}
#outerContainer .visibleMediumView {
display: inherit;
}
}
@media all and (max-width: 640px) {
.hiddenSmallView,
.hiddenSmallView * {
display: none;
}
.visibleSmallView {
display: inherit;
}
}
@media all and (max-width: 535px) {
#scaleSelectContainer {
display: none;
}
}