feat(reader): add document mode to the PDF viewer, overhaul PDF viewer, add different modes to CBX viewer (#306)
* feat(reader): add document mode to the PDF viewer, overhaul PDF viewer, add different modes to CBX viewer * feat(reader): improve reader settings with brightness, emulate book mode, and click-to-paginate options * feat(reader): add long strip scroll mode and update related settings
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
nodeLinker: node-modules
|
||||
nmMode: hardlinks-local
|
||||
enableGlobalCache: false
|
||||
cacheFolder: .yarn/cache
|
||||
+17
-1
@@ -47,6 +47,16 @@
|
||||
"glob": "**/*",
|
||||
"input": "libs/foliate-js",
|
||||
"output": "/assets/foliate/"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "node_modules/@embedpdf/pdfium/dist/",
|
||||
"output": "/assets/pdfium/"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "node_modules/@embedpdf/snippet/dist/",
|
||||
"output": "/assets/embedpdf/"
|
||||
}
|
||||
],
|
||||
"styles": [
|
||||
@@ -98,6 +108,12 @@
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular/build:dev-server",
|
||||
"options": {
|
||||
"headers": {
|
||||
"Cross-Origin-Opener-Policy": "same-origin",
|
||||
"Cross-Origin-Embedder-Policy": "credentialless"
|
||||
}
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "grimmory:build:production"
|
||||
@@ -135,4 +151,4 @@
|
||||
],
|
||||
"analytics": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@
|
||||
"@angular/platform-browser-dynamic": "^21.2.6",
|
||||
"@angular/router": "^21.2.6",
|
||||
"@angular/service-worker": "^21.2.6",
|
||||
"@embedpdf/pdfium": "^2.11.1",
|
||||
"@embedpdf/snippet": "^2.11.1",
|
||||
"@iharbeck/ngx-virtual-scroller": "^20.0.0",
|
||||
"@jsverse/transloco": "^8.2.1",
|
||||
"@primeuix/themes": "^2.0.3",
|
||||
|
||||
+7
-10
@@ -73,6 +73,13 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
||||
|
||||
readonly filterLabelKeys = FILTER_LABEL_KEYS;
|
||||
|
||||
private readonly userSettingsEffect = effect(() => {
|
||||
const user = this.userService.currentUser();
|
||||
if (!user) return;
|
||||
this._visibleFilters = user.userSettings.visibleFilters ?? [...DEFAULT_VISIBLE_FILTERS];
|
||||
this.updateVisibleFilterTypes();
|
||||
});
|
||||
|
||||
getFilterLabel(type: FilterType): string {
|
||||
const key = this.filterLabelKeys[type];
|
||||
return key ? this.t.translate(key) : type;
|
||||
@@ -99,7 +106,6 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
||||
ngOnInit(): void {
|
||||
this.updateVisibleFilterTypes();
|
||||
this.updateExpandedPanels();
|
||||
this.subscribeToUserSettings();
|
||||
this.subscribeToReset();
|
||||
}
|
||||
|
||||
@@ -164,15 +170,6 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
||||
return String(value ?? '');
|
||||
}
|
||||
|
||||
private subscribeToUserSettings(): void {
|
||||
effect(() => {
|
||||
const user = this.userService.currentUser();
|
||||
if (!user) return;
|
||||
this._visibleFilters = user.userSettings.visibleFilters ?? [...DEFAULT_VISIBLE_FILTERS];
|
||||
this.updateVisibleFilterTypes();
|
||||
});
|
||||
}
|
||||
|
||||
private updateVisibleFilterTypes(): void {
|
||||
this.visibleFilterTypes = this._visibleFilters.filter(
|
||||
vf => this.filterTypes.includes(vf as FilterType)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Shelf} from './shelf.model';
|
||||
import {CbxBackgroundColor, CbxFitMode, CbxPageSpread, CbxPageViewMode, CbxScrollMode, NewPdfReaderSetting} from '../../settings/user-management/user.service';
|
||||
import {CbxBackgroundColor, CbxFitMode, CbxPageSpread, CbxPageSplitOption, CbxPageViewMode, CbxScrollMode, NewPdfReaderSetting} from '../../settings/user-management/user.service';
|
||||
import {BookReview} from '../components/book-reviews/book-review-service';
|
||||
import {ZoomType} from 'ngx-extended-pdf-viewer';
|
||||
|
||||
@@ -305,6 +305,7 @@ export interface MetadataUpdateWrapper {
|
||||
export interface PdfViewerSetting {
|
||||
zoom: ZoomType;
|
||||
spread: 'off' | 'even' | 'odd';
|
||||
isDarkTheme?: boolean;
|
||||
}
|
||||
|
||||
export interface EpubViewerSetting {
|
||||
@@ -339,6 +340,11 @@ export interface CbxViewerSetting {
|
||||
fitMode: CbxFitMode;
|
||||
scrollMode?: CbxScrollMode;
|
||||
backgroundColor?: CbxBackgroundColor;
|
||||
pageSplitOption?: CbxPageSplitOption;
|
||||
brightness?: number;
|
||||
emulateBook?: boolean;
|
||||
clickToPaginate?: boolean;
|
||||
autoCloseMenu?: boolean;
|
||||
}
|
||||
|
||||
export interface BookSetting {
|
||||
|
||||
@@ -1,133 +1,154 @@
|
||||
<div class="comic-reader-container" tabindex="0"
|
||||
[class.rtl-reading]="readingDirection === CbxReadingDirection.RTL"
|
||||
[class.fullscreen-mode]="isFullscreen"
|
||||
[class.slideshow-active]="isSlideshowActive">
|
||||
<app-cbx-header [isCurrentPageBookmarked]="isCurrentPageBookmarked" [currentPageHasNotes]="currentPageHasNotes"></app-cbx-header>
|
||||
<div class="comic-reader-container" tabindex="0" [class.rtl-reading]="readingDirection === CbxReadingDirection.RTL"
|
||||
[class.fullscreen-mode]="isFullscreen" [class.slideshow-active]="isSlideshowActive">
|
||||
<app-cbx-header [isCurrentPageBookmarked]="isCurrentPageBookmarked"
|
||||
[currentPageHasNotes]="currentPageHasNotes"></app-cbx-header>
|
||||
|
||||
<app-cbx-sidebar></app-cbx-sidebar>
|
||||
|
||||
@if (showQuickSettings) {
|
||||
<app-cbx-quick-settings></app-cbx-quick-settings>
|
||||
<app-cbx-quick-settings></app-cbx-quick-settings>
|
||||
}
|
||||
|
||||
@if (isCurrentPageBookmarked) {
|
||||
<div class="bookmark-indicator">
|
||||
<svg width="48" height="64" viewBox="0 0 48 64">
|
||||
<polygon points="0,0 48,0 48,64 24,48 0,64" fill="red"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="bookmark-indicator">
|
||||
<svg width="48" height="64" viewBox="0 0 48 64">
|
||||
<polygon points="0,0 48,0 48,64 24,48 0,64" fill="red" />
|
||||
</svg>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (showNoteDialog) {
|
||||
<app-cbx-note-dialog
|
||||
[data]="noteDialogData"
|
||||
(saved)="onNoteSave($event)"
|
||||
(cancelled)="onNoteCancel()"
|
||||
></app-cbx-note-dialog>
|
||||
<app-cbx-note-dialog [data]="noteDialogData" (saved)="onNoteSave($event)"
|
||||
(cancelled)="onNoteCancel()"></app-cbx-note-dialog>
|
||||
}
|
||||
|
||||
@if (showShortcutsHelp) {
|
||||
<app-cbx-shortcuts-help
|
||||
(closed)="onShortcutsHelpClose()"
|
||||
></app-cbx-shortcuts-help>
|
||||
<app-cbx-shortcuts-help (closed)="onShortcutsHelpClose()"></app-cbx-shortcuts-help>
|
||||
}
|
||||
|
||||
@if (isSlideshowActive) {
|
||||
<div class="slideshow-progress" [class.above-footer]="isFooterVisible" [style.animation-duration.ms]="slideshowInterval"></div>
|
||||
<div class="slideshow-progress" [class.above-footer]="isFooterVisible"
|
||||
[style.animation-duration.ms]="slideshowInterval"></div>
|
||||
}
|
||||
|
||||
<div #magnifierLens class="magnifier-lens"></div>
|
||||
|
||||
<div class="image-container"
|
||||
[class.magnifier-active]="isMagnifierActive"
|
||||
<div class="image-container" [class.magnifier-active]="isMagnifierActive"
|
||||
[class.two-page-view]="isTwoPageView && scrollMode === CbxScrollMode.PAGINATED"
|
||||
[class.infinite-scroll]="scrollMode === CbxScrollMode.INFINITE"
|
||||
[class.long-strip]="scrollMode === CbxScrollMode.LONG_STRIP"
|
||||
[class.fit-actual-size]="fitMode === CbxFitMode.ACTUAL_SIZE"
|
||||
[class.fit-page]="fitMode === CbxFitMode.FIT_PAGE"
|
||||
[class.fit-width]="fitMode === CbxFitMode.FIT_WIDTH"
|
||||
[class.fit-height]="fitMode === CbxFitMode.FIT_HEIGHT"
|
||||
[class.fit-auto]="fitMode === CbxFitMode.AUTO"
|
||||
[class.bg-black]="backgroundColor === CbxBackgroundColor.BLACK"
|
||||
[class.fit-actual-size]="fitMode === CbxFitMode.ACTUAL_SIZE" [class.fit-page]="fitMode === CbxFitMode.FIT_PAGE"
|
||||
[class.fit-width]="fitMode === CbxFitMode.FIT_WIDTH" [class.fit-height]="fitMode === CbxFitMode.FIT_HEIGHT"
|
||||
[class.fit-auto]="fitMode === CbxFitMode.AUTO" [class.bg-black]="backgroundColor === CbxBackgroundColor.BLACK"
|
||||
[class.bg-gray]="backgroundColor === CbxBackgroundColor.GRAY"
|
||||
[class.bg-white]="backgroundColor === CbxBackgroundColor.WHITE"
|
||||
(scroll)="onScroll($event)">
|
||||
[class.bg-white]="backgroundColor === CbxBackgroundColor.WHITE" [class.emulate-book]="emulateBook && isTwoPageView"
|
||||
[style.filter]="brightness < 100 ? 'brightness(' + brightness + '%)' : null" (scroll)="onScroll($event)">
|
||||
@if (!isLoading) {
|
||||
@if (pages.length > 0) {
|
||||
@if (scrollMode === CbxScrollMode.PAGINATED) {
|
||||
<div
|
||||
class="pages-wrapper"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
(click)="onImageClick()"
|
||||
(keydown.enter)="onImageClick()"
|
||||
(dblclick)="onImageDoubleClick()">
|
||||
@if (isPageTransitioning && previousImageUrls.length > 0) {
|
||||
<div class="previous-page-layer">
|
||||
@for (url of previousImageUrls; track url) {
|
||||
<img [src]="url" alt="Previous Page" class="page-image previous-image"/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="current-page-layer" [class.fade-in]="isPageTransitioning && imagesLoaded">
|
||||
@for (url of currentImageUrls; track url; let i = $index) {
|
||||
<img [src]="url" alt="Page Image" class="page-image" (load)="onPageImageLoad($event, currentPage + i)"/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (isAtLastPage && nextBookInSeries) {
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<div class="infinite-scroll-wrapper" [class.long-strip-wrapper]="scrollMode === CbxScrollMode.LONG_STRIP">
|
||||
@for (pageIdx of infiniteScrollPages; track pageIdx; let i = $index) {
|
||||
<img
|
||||
[src]="getPageImageUrl(pageIdx)"
|
||||
alt="Page {{ pageIdx + 1 }}"
|
||||
class="page-image"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
(click)="onImageClick()"
|
||||
(keydown.enter)="onImageClick()"
|
||||
(dblclick)="onImageDoubleClick()"
|
||||
(load)="onPageImageLoad($event, pageIdx)"/>
|
||||
}
|
||||
@if (isLoadingMore) {
|
||||
<div class="loading-more">
|
||||
<p-progressSpinner class="small-spinner"></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
@if (infiniteScrollPages.length > 0 && infiniteScrollPages[infiniteScrollPages.length - 1] >= pages.length - 1 && nextBookInSeries) {
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (pages.length > 0) {
|
||||
@if (scrollMode === CbxScrollMode.PAGINATED) {
|
||||
<div class="pages-wrapper" role="button" tabindex="0" (click)="onImageClick()" (keydown.enter)="onImageClick()"
|
||||
(dblclick)="onImageDoubleClick()">
|
||||
@if (isPageTransitioning && previousImageUrls.length > 0) {
|
||||
<div class="previous-page-layer">
|
||||
@for (url of previousImageUrls; track url) {
|
||||
<img [src]="url" alt="Previous Page" class="page-image previous-image" />
|
||||
}
|
||||
} @else {
|
||||
<div class="no-pages">
|
||||
<p>{{ 'readerCbx.reader.noPagesAvailable' | transloco }}</p>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<div class="loader-overlay">
|
||||
<div class="loader-content">
|
||||
<div class="spinner"></div>
|
||||
<p class="loader-text">{{ 'readerCbx.reader.loadingBook' | transloco }}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="current-page-layer" [class.fade-in]="isPageTransitioning && imagesLoaded">
|
||||
@if (shouldUseCanvasRenderer()) {
|
||||
<app-canvas-renderer [imageUrl]="currentImageUrls[0]" [splitState]="canvasSplitState"
|
||||
[splitOption]="pageSplitOption">
|
||||
</app-canvas-renderer>
|
||||
} @else {
|
||||
@for (url of currentImageUrls; track url; let i = $index) {
|
||||
<img [src]="url" alt="Page Image" class="page-image" (load)="onPageImageLoad($event, currentPage + i)" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (isAtLastPage && nextBookInSeries) {
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
} @else if (scrollMode === CbxScrollMode.LONG_STRIP) {
|
||||
<div class="long-strip-wrapper" role="button" tabindex="0" (click)="onImageClick()"
|
||||
(keydown.enter)="onImageClick()">
|
||||
@for (item of longStripImages; track item.page) {
|
||||
<img [src]="item.src" alt="Page {{ item.page + 1 }}" class="long-strip-image" [attr.data-page]="item.page"
|
||||
(load)="onLongStripImageLoad($event, item.page)" />
|
||||
}
|
||||
@if (longStripImages.length > 0 && longStripImages[longStripImages.length - 1].page >= pages.length - 1 &&
|
||||
nextBookInSeries) {
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="infinite-scroll-wrapper">
|
||||
@for (pageIdx of infiniteScrollPages; track pageIdx; let i = $index) {
|
||||
<img [src]="getPageImageUrl(pageIdx)" alt="Page {{ pageIdx + 1 }}" class="page-image" role="button" tabindex="0"
|
||||
(click)="onImageClick()" (keydown.enter)="onImageClick()" (dblclick)="onImageDoubleClick()"
|
||||
(load)="onPageImageLoad($event, pageIdx)" />
|
||||
}
|
||||
@if (isLoadingMore) {
|
||||
<div class="loading-more">
|
||||
<p-progressSpinner class="small-spinner"></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
@if (infiniteScrollPages.length > 0 && infiniteScrollPages[infiniteScrollPages.length - 1] >= pages.length - 1 &&
|
||||
nextBookInSeries) {
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (clickToPaginate) {
|
||||
<div class="click-overlay visible" [class.rtl-overlay]="readingDirection === CbxReadingDirection.RTL"
|
||||
[class.magnifier-disabled]="isMagnifierActive">
|
||||
<div class="click-zone click-zone-prev" role="button" tabindex="0" (click)="onClickZonePrev($event)"
|
||||
(keydown.enter)="onClickZonePrev($event)">
|
||||
<span class="zone-arrow">◀</span>
|
||||
</div>
|
||||
<div class="click-zone click-zone-menu" role="button" tabindex="0" (click)="onClickZoneMenu($event)"
|
||||
(keydown.enter)="onClickZoneMenu($event)">
|
||||
</div>
|
||||
<div class="click-zone click-zone-next" role="button" tabindex="0" (click)="onClickZoneNext($event)"
|
||||
(keydown.enter)="onClickZoneNext($event)">
|
||||
<span class="zone-arrow">▶</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<div class="no-pages">
|
||||
<p>{{ 'readerCbx.reader.noPagesAvailable' | transloco }}</p>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<div class="loader-overlay">
|
||||
<div class="loader-content">
|
||||
<div class="spinner"></div>
|
||||
<p class="loader-text">{{ 'readerCbx.reader.loadingBook' | transloco }}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<app-cbx-footer></app-cbx-footer>
|
||||
</div>
|
||||
</div>
|
||||
@@ -19,6 +19,7 @@
|
||||
// RTL reading mode - reverse page order in two-page view
|
||||
&.rtl-reading {
|
||||
.two-page-view {
|
||||
|
||||
.pages-wrapper,
|
||||
.previous-page-layer,
|
||||
.current-page-layer {
|
||||
@@ -45,8 +46,13 @@
|
||||
}
|
||||
|
||||
@keyframes slideshow-fill {
|
||||
from { width: 0; }
|
||||
to { width: 100%; }
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.magnifier-lens {
|
||||
@@ -184,6 +190,7 @@
|
||||
}
|
||||
|
||||
&.fit-width {
|
||||
|
||||
.pages-wrapper,
|
||||
.previous-page-layer,
|
||||
.current-page-layer {
|
||||
@@ -201,6 +208,7 @@
|
||||
}
|
||||
|
||||
&.two-page-view {
|
||||
|
||||
.pages-wrapper,
|
||||
.previous-page-layer,
|
||||
.current-page-layer {
|
||||
@@ -217,6 +225,7 @@
|
||||
}
|
||||
|
||||
&.fit-height {
|
||||
|
||||
.pages-wrapper,
|
||||
.previous-page-layer,
|
||||
.current-page-layer {
|
||||
@@ -401,70 +410,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Long Strip / Webtoon mode - no gaps between pages
|
||||
// Long-strip (webtoon) mode — gapless vertical strip, always fit-width
|
||||
&.long-strip {
|
||||
overflow: hidden auto;
|
||||
align-items: flex-start;
|
||||
touch-action: pan-y;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior: contain;
|
||||
|
||||
.long-strip-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
|
||||
// No gap, no padding — gapless vertical strip
|
||||
}
|
||||
|
||||
.page-image {
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
transition: none;
|
||||
.long-strip-image {
|
||||
display: block;
|
||||
|
||||
&:hover {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.fit-width .page-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
&.fit-height .page-image {
|
||||
width: auto;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
&.fit-actual-size {
|
||||
overflow-x: auto;
|
||||
|
||||
.long-strip-wrapper {
|
||||
width: max-content;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.page-image {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&.fit-page .page-image,
|
||||
&.fit-auto .page-image {
|
||||
max-width: 100%;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.loading-more {
|
||||
padding: 2rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
// Hardware acceleration (Kavita pattern)
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +522,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 768px) {
|
||||
@media (width <=768px) {
|
||||
.comic-reader-container {
|
||||
.slideshow-progress.above-footer {
|
||||
bottom: 48px;
|
||||
@@ -568,8 +540,13 @@
|
||||
min-width: 240px;
|
||||
padding: 1.5rem 2rem;
|
||||
|
||||
.action-icon { font-size: 2rem; }
|
||||
.action-text { font-size: 1rem; }
|
||||
.action-icon {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.action-text {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.book-title {
|
||||
font-size: 0.85rem;
|
||||
@@ -618,3 +595,90 @@
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
// Click-to-paginate overlay
|
||||
.click-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 5;
|
||||
display: flex;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
|
||||
&.visible {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.click-zone {
|
||||
pointer-events: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.click-zone-prev {
|
||||
width: 40%;
|
||||
background: rgb(255 255 255 / 3%);
|
||||
}
|
||||
|
||||
.click-zone-menu {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.click-zone-next {
|
||||
width: 40%;
|
||||
background: rgb(255 255 255 / 3%);
|
||||
}
|
||||
|
||||
.zone-arrow {
|
||||
font-size: 2rem;
|
||||
color: rgb(255 255 255 / 30%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
&.visible .zone-arrow {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
// RTL: swap prev/next zones visually
|
||||
&.rtl-overlay {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
// Disable pointer events when magnifier is active so elementFromPoint can reach images
|
||||
&.magnifier-disabled {
|
||||
pointer-events: none;
|
||||
|
||||
.click-zone {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Emulate book mode spine shadow in two-page view
|
||||
.image-container.emulate-book {
|
||||
|
||||
.pages-wrapper,
|
||||
.current-page-layer {
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
width: 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
box-shadow:
|
||||
-4px 0 12px rgb(0 0 0 / 40%),
|
||||
4px 0 12px rgb(0 0 0 / 40%),
|
||||
-2px 0 6px rgb(0 0 0 / 20%),
|
||||
2px 0 6px rgb(0 0 0 / 20%);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,188 @@
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {Observable, of, tap} from 'rxjs';
|
||||
import {API_CONFIG} from '../../../../core/config/api-config';
|
||||
import {AuthService} from '../../../../shared/service/auth.service';
|
||||
import {CbxPageDimension} from '../models/cbx-page-dimension.model';
|
||||
|
||||
export type DoublePairs = Record<number, number>;
|
||||
|
||||
export interface WebtoonDetectionResult {
|
||||
isWebtoon: boolean;
|
||||
score: number;
|
||||
}
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class CbxPageDimensionService {
|
||||
|
||||
private readonly baseUrl = `${API_CONFIG.BASE_URL}/api/v1/cbx`;
|
||||
private http = inject(HttpClient);
|
||||
private authService = inject(AuthService);
|
||||
|
||||
private dimensionCache = new Map<string, CbxPageDimension[]>();
|
||||
|
||||
private getToken(): string | null {
|
||||
return this.authService.getInternalAccessToken();
|
||||
}
|
||||
|
||||
private appendToken(url: string): string {
|
||||
const token = this.getToken();
|
||||
return token ? `${url}${url.includes('?') ? '&' : '?'}token=${token}` : url;
|
||||
}
|
||||
|
||||
getPageDimensions(bookId: number, bookType?: string): Observable<CbxPageDimension[]> {
|
||||
const cacheKey = `${bookId}-${bookType ?? 'default'}`;
|
||||
const cached = this.dimensionCache.get(cacheKey);
|
||||
if (cached) {
|
||||
return of(cached);
|
||||
}
|
||||
let url = `${this.baseUrl}/${bookId}/page-dimensions`;
|
||||
if (bookType) {
|
||||
url += `?bookType=${bookType}`;
|
||||
}
|
||||
return this.http.get<CbxPageDimension[]>(this.appendToken(url)).pipe(
|
||||
tap(dims => this.dimensionCache.set(cacheKey, dims))
|
||||
);
|
||||
}
|
||||
|
||||
clearCache(bookId?: number): void {
|
||||
if (bookId !== undefined) {
|
||||
for (const key of this.dimensionCache.keys()) {
|
||||
if (key.startsWith(`${bookId}-`)) {
|
||||
this.dimensionCache.delete(key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dimensionCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute double-page pair map from dimensions.
|
||||
* Cover (page index 0) is always solo. Wide pages are always solo.
|
||||
* Returns a map of pageIndex → paired pageIndex for the right-hand page.
|
||||
*/
|
||||
computeDoublePairs(dimensions: CbxPageDimension[]): DoublePairs {
|
||||
const pairs: DoublePairs = {};
|
||||
let i = 1; // Skip cover (index 0), it's always solo
|
||||
while (i < dimensions.length) {
|
||||
const current = dimensions[i];
|
||||
const next = i + 1 < dimensions.length ? dimensions[i + 1] : null;
|
||||
|
||||
if (current.wide) {
|
||||
// Wide page is always solo
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (next && !next.wide) {
|
||||
// Pair these two non-wide pages
|
||||
pairs[i] = i + 1;
|
||||
i += 2;
|
||||
} else {
|
||||
// Next is wide or doesn't exist — current is solo
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if the content is webtoon-style (long vertical strips).
|
||||
*
|
||||
* Scoring per page:
|
||||
* - Aspect ratio (h/w) ≥ 2.2: +1.0 (strong webtoon indicator)
|
||||
* - Aspect ratio 1.8–2.2: +0.5
|
||||
* - Aspect ratio 1.5–1.8: +0.2
|
||||
* - Aspect ratio < 1.2: −0.5 (penalize square/landscape)
|
||||
* - Width ≤ 750px: +0.2
|
||||
* - Height > 2000px: +0.5 (or > 1500px: +0.3)
|
||||
* - Area > 1,500,000 px²: +0.3
|
||||
*
|
||||
* Final decision: avgScore ≥ 0.7 AND one of:
|
||||
* - 40%+ pages have ratio ≥ 2.2
|
||||
* - Average ratio ≥ 2.0
|
||||
* - Width variation < 15% AND average ratio > 1.8
|
||||
*/
|
||||
detectWebtoon(dimensions: CbxPageDimension[]): WebtoonDetectionResult {
|
||||
if (dimensions.length < 3) {
|
||||
return {isWebtoon: false, score: 0};
|
||||
}
|
||||
|
||||
let totalScore = 0;
|
||||
let highRatioCount = 0;
|
||||
let totalRatio = 0;
|
||||
const widths: number[] = [];
|
||||
|
||||
for (const dim of dimensions) {
|
||||
if (dim.width === 0 || dim.height === 0) continue;
|
||||
|
||||
const ratio = dim.height / dim.width;
|
||||
totalRatio += ratio;
|
||||
widths.push(dim.width);
|
||||
|
||||
let pageScore = 0;
|
||||
|
||||
// Aspect ratio scoring
|
||||
if (ratio >= 2.2) {
|
||||
pageScore += 1.0;
|
||||
highRatioCount++;
|
||||
} else if (ratio >= 1.8) {
|
||||
pageScore += 0.5;
|
||||
} else if (ratio >= 1.5) {
|
||||
pageScore += 0.2;
|
||||
} else if (ratio < 1.2) {
|
||||
pageScore -= 0.5;
|
||||
}
|
||||
|
||||
// Narrow width bonus
|
||||
if (dim.width <= 750) {
|
||||
pageScore += 0.2;
|
||||
}
|
||||
|
||||
// Tall page bonus
|
||||
if (dim.height > 2000) {
|
||||
pageScore += 0.5;
|
||||
} else if (dim.height > 1500) {
|
||||
pageScore += 0.3;
|
||||
}
|
||||
|
||||
// Large area bonus
|
||||
if (dim.width * dim.height > 1_500_000) {
|
||||
pageScore += 0.3;
|
||||
}
|
||||
|
||||
totalScore += pageScore;
|
||||
}
|
||||
|
||||
const validCount = widths.length;
|
||||
if (validCount < 3) {
|
||||
return {isWebtoon: false, score: 0};
|
||||
}
|
||||
|
||||
const avgScore = totalScore / validCount;
|
||||
const avgRatio = totalRatio / validCount;
|
||||
const avgWidth = widths.reduce((a, b) => a + b, 0) / validCount;
|
||||
const widthStdDev = Math.sqrt(
|
||||
widths.reduce((sum, w) => sum + Math.pow(w - avgWidth, 2), 0) / validCount
|
||||
);
|
||||
const widthVariation = avgWidth > 0 ? widthStdDev / avgWidth : 1;
|
||||
|
||||
// Reject traditional comics with small, square-ish pages
|
||||
const avgHeight = dimensions
|
||||
.filter(d => d.height > 0)
|
||||
.reduce((sum, d) => sum + d.height, 0) / validCount;
|
||||
if (avgHeight < 1200 && avgRatio < 1.7 && avgWidth < 700) {
|
||||
return {isWebtoon: false, score: avgScore};
|
||||
}
|
||||
|
||||
const highRatioPercent = highRatioCount / validCount;
|
||||
const isWebtoon = avgScore >= 0.7 && (
|
||||
highRatioPercent >= 0.4 ||
|
||||
avgRatio >= 2.0 ||
|
||||
(widthVariation < 0.15 && avgRatio > 1.8)
|
||||
);
|
||||
|
||||
return {isWebtoon, score: avgScore};
|
||||
}
|
||||
}
|
||||
+99
-63
@@ -1,5 +1,7 @@
|
||||
<div class="quick-settings-overlay" role="button" tabindex="0" (click)="onOverlayClick()" (keydown.enter)="onOverlayClick()">
|
||||
<div class="quick-settings-panel" tabindex="0" (click)="$event.stopPropagation()" (keydown.enter)="$event.stopPropagation()">
|
||||
<div class="quick-settings-overlay" role="button" tabindex="0" (click)="onOverlayClick()"
|
||||
(keydown.enter)="onOverlayClick()">
|
||||
<div class="quick-settings-panel" tabindex="0" (click)="$event.stopPropagation()"
|
||||
(keydown.enter)="$event.stopPropagation()">
|
||||
<div class="pointer"></div>
|
||||
<div class="panel-body">
|
||||
<!-- Fit Mode -->
|
||||
@@ -8,13 +10,10 @@
|
||||
<div class="control-right">
|
||||
<div class="button-group">
|
||||
@for (option of fitModeOptions; track option.value) {
|
||||
<button
|
||||
class="option-btn"
|
||||
[class.active]="state().fitMode === option.value"
|
||||
(click)="onFitModeSelect(option.value)"
|
||||
[title]="option.label">
|
||||
<app-reader-icon [name]="option.icon" [size]="16" />
|
||||
</button>
|
||||
<button class="option-btn" [class.active]="state().fitMode === option.value"
|
||||
(click)="onFitModeSelect(option.value)" [title]="option.label">
|
||||
<app-reader-icon [name]="option.icon" [size]="16" />
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,13 +25,10 @@
|
||||
<div class="control-right">
|
||||
<div class="button-group text-btns">
|
||||
@for (option of scrollModeOptions; track option.value) {
|
||||
<button
|
||||
class="option-btn text-btn"
|
||||
[class.active]="state().scrollMode === option.value"
|
||||
(click)="onScrollModeSelect(option.value)"
|
||||
[title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
<button class="option-btn text-btn" [class.active]="state().scrollMode === option.value"
|
||||
(click)="onScrollModeSelect(option.value)" [title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,36 +36,42 @@
|
||||
|
||||
<!-- Page View (only in paginated mode) -->
|
||||
@if (isPaginated && !isPhonePortrait) {
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.pageView' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ isTwoPageView ? ('readerCbx.quickSettings.twoPage' | transloco) : ('readerCbx.quickSettings.single' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="isTwoPageView" (click)="onPageViewToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.pageView' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ isTwoPageView ? ('readerCbx.quickSettings.twoPage' | transloco) :
|
||||
('readerCbx.quickSettings.single' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="isTwoPageView" (click)="onPageViewToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Page Spread (only in two-page mode) -->
|
||||
@if (isPaginated && isTwoPageView) {
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.pageSpread' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state().pageSpread === CbxPageSpread.ODD ? ('readerCbx.quickSettings.oddFirst' | transloco) : ('readerCbx.quickSettings.evenFirst' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="state().pageSpread === CbxPageSpread.EVEN" (click)="onPageSpreadToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.pageSpread' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state().pageSpread === CbxPageSpread.ODD ? ('readerCbx.quickSettings.oddFirst' |
|
||||
transloco) : ('readerCbx.quickSettings.evenFirst' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="state().pageSpread === CbxPageSpread.EVEN"
|
||||
(click)="onPageSpreadToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Reading Direction -->
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.readingDirection' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state().readingDirection === CbxReadingDirection.LTR ? ('readerCbx.quickSettings.leftToRight' | transloco) : ('readerCbx.quickSettings.rightToLeft' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="state().readingDirection === CbxReadingDirection.RTL" (click)="onReadingDirectionToggle()">
|
||||
<span class="mode-label">{{ state().readingDirection === CbxReadingDirection.LTR ?
|
||||
('readerCbx.quickSettings.leftToRight' | transloco) : ('readerCbx.quickSettings.rightToLeft' | transloco)
|
||||
}}</span>
|
||||
<button class="switch" [class.active]="state().readingDirection === CbxReadingDirection.RTL"
|
||||
(click)="onReadingDirectionToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -81,13 +83,10 @@
|
||||
<div class="control-right">
|
||||
<div class="button-group text-btns">
|
||||
@for (option of slideshowIntervalOptions; track option.value) {
|
||||
<button
|
||||
class="option-btn text-btn small"
|
||||
[class.active]="state().slideshowInterval === option.value"
|
||||
(click)="onSlideshowIntervalSelect(option.value)"
|
||||
[title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
<button class="option-btn text-btn small" [class.active]="state().slideshowInterval === option.value"
|
||||
(click)="onSlideshowIntervalSelect(option.value)" [title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -99,13 +98,10 @@
|
||||
<div class="control-right">
|
||||
<div class="button-group">
|
||||
@for (option of backgroundOptions; track option.value) {
|
||||
<button
|
||||
class="option-btn color-btn"
|
||||
[class.active]="state().backgroundColor === option.value"
|
||||
(click)="onBackgroundSelect(option.value)"
|
||||
[title]="option.label">
|
||||
<span class="color-swatch" [style.background]="option.color"></span>
|
||||
</button>
|
||||
<button class="option-btn color-btn" [class.active]="state().backgroundColor === option.value"
|
||||
(click)="onBackgroundSelect(option.value)" [title]="option.label">
|
||||
<span class="color-swatch" [style.background]="option.color"></span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -117,13 +113,10 @@
|
||||
<div class="control-right">
|
||||
<div class="button-group text-btns">
|
||||
@for (option of magnifierLensSizeOptions; track option.value) {
|
||||
<button
|
||||
class="option-btn text-btn small"
|
||||
[class.active]="state().magnifierLensSize === option.value"
|
||||
(click)="onMagnifierLensSizeSelect(option.value)"
|
||||
[title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
<button class="option-btn text-btn small" [class.active]="state().magnifierLensSize === option.value"
|
||||
(click)="onMagnifierLensSizeSelect(option.value)" [title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,17 +128,60 @@
|
||||
<div class="control-right">
|
||||
<div class="button-group text-btns">
|
||||
@for (option of magnifierZoomOptions; track option.value) {
|
||||
<button
|
||||
class="option-btn text-btn small"
|
||||
[class.active]="state().magnifierZoom === option.value"
|
||||
(click)="onMagnifierZoomSelect(option.value)"
|
||||
[title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
<button class="option-btn text-btn small" [class.active]="state().magnifierZoom === option.value"
|
||||
(click)="onMagnifierZoomSelect(option.value)" [title]="option.label">
|
||||
{{ option.label }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Brightness -->
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.brightness' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<input type="range" min="10" max="100" step="5" [value]="state().brightness"
|
||||
(input)="onBrightnessChange($event)" class="brightness-slider" />
|
||||
<span class="brightness-value">{{ state().brightness }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Emulate Book -->
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.emulateBook' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state().emulateBook ? ('common.on' | transloco) : ('common.off' | transloco)
|
||||
}}</span>
|
||||
<button class="switch" [class.active]="state().emulateBook" (click)="onEmulateBookToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Click to Paginate -->
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.clickToPaginate' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state().clickToPaginate ? ('common.on' | transloco) : ('common.off' | transloco)
|
||||
}}</span>
|
||||
<button class="switch" [class.active]="state().clickToPaginate" (click)="onClickToPaginateToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Auto Close Menu -->
|
||||
<div class="control">
|
||||
<span>{{ 'readerCbx.quickSettings.autoCloseMenu' | transloco }}</span>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state().autoCloseMenu ? ('common.on' | transloco) : ('common.off' | transloco)
|
||||
}}</span>
|
||||
<button class="switch" [class.active]="state().autoCloseMenu" (click)="onAutoCloseMenuToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+52
-39
@@ -1,6 +1,6 @@
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslocoService, TranslocoPipe } from '@jsverse/transloco';
|
||||
import {
|
||||
CbxFitMode,
|
||||
CbxScrollMode,
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
CbxMagnifierZoom,
|
||||
CbxMagnifierLensSize
|
||||
} from '../../../../settings/user-management/user.service';
|
||||
import {ReaderIconComponent, ReaderIconName} from '../../../ebook-reader/shared/icon.component';
|
||||
import {CbxQuickSettingsService} from './cbx-quick-settings.service';
|
||||
import { ReaderIconComponent, ReaderIconName } from '../../../ebook-reader/shared/icon.component';
|
||||
import { CbxQuickSettingsService } from './cbx-quick-settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cbx-quick-settings',
|
||||
@@ -38,52 +38,52 @@ export class CbxQuickSettingsComponent {
|
||||
protected readonly CbxMagnifierZoom = CbxMagnifierZoom;
|
||||
protected readonly CbxMagnifierLensSize = CbxMagnifierLensSize;
|
||||
|
||||
get fitModeOptions(): {value: CbxFitMode, label: string, icon: ReaderIconName}[] {
|
||||
get fitModeOptions(): { value: CbxFitMode, label: string, icon: ReaderIconName }[] {
|
||||
return [
|
||||
{value: CbxFitMode.FIT_PAGE, label: this.t.translate('readerCbx.quickSettings.fitPage'), icon: 'fit-page'},
|
||||
{value: CbxFitMode.FIT_WIDTH, label: this.t.translate('readerCbx.quickSettings.fitWidth'), icon: 'fit-width'},
|
||||
{value: CbxFitMode.FIT_HEIGHT, label: this.t.translate('readerCbx.quickSettings.fitHeight'), icon: 'fit-height'},
|
||||
{value: CbxFitMode.ACTUAL_SIZE, label: this.t.translate('readerCbx.quickSettings.actualSize'), icon: 'actual-size'},
|
||||
{value: CbxFitMode.AUTO, label: this.t.translate('readerCbx.quickSettings.automatic'), icon: 'auto-fit'}
|
||||
{ value: CbxFitMode.FIT_PAGE, label: this.t.translate('readerCbx.quickSettings.fitPage'), icon: 'fit-page' },
|
||||
{ value: CbxFitMode.FIT_WIDTH, label: this.t.translate('readerCbx.quickSettings.fitWidth'), icon: 'fit-width' },
|
||||
{ value: CbxFitMode.FIT_HEIGHT, label: this.t.translate('readerCbx.quickSettings.fitHeight'), icon: 'fit-height' },
|
||||
{ value: CbxFitMode.ACTUAL_SIZE, label: this.t.translate('readerCbx.quickSettings.actualSize'), icon: 'actual-size' },
|
||||
{ value: CbxFitMode.AUTO, label: this.t.translate('readerCbx.quickSettings.automatic'), icon: 'auto-fit' }
|
||||
];
|
||||
}
|
||||
|
||||
get scrollModeOptions(): {value: CbxScrollMode, label: string}[] {
|
||||
get scrollModeOptions(): { value: CbxScrollMode, label: string }[] {
|
||||
return [
|
||||
{value: CbxScrollMode.PAGINATED, label: this.t.translate('readerCbx.quickSettings.paginated')},
|
||||
{value: CbxScrollMode.INFINITE, label: this.t.translate('readerCbx.quickSettings.infinite')},
|
||||
{value: CbxScrollMode.LONG_STRIP, label: this.t.translate('readerCbx.quickSettings.longStrip')}
|
||||
{ value: CbxScrollMode.PAGINATED, label: this.t.translate('readerCbx.quickSettings.paginated') },
|
||||
{ value: CbxScrollMode.INFINITE, label: this.t.translate('readerCbx.quickSettings.infinite') }
|
||||
// { value: CbxScrollMode.LONG_STRIP, label: this.t.translate('readerCbx.quickSettings.longStrip') }
|
||||
];
|
||||
}
|
||||
|
||||
slideshowIntervalOptions: {value: CbxSlideshowInterval, label: string}[] = [
|
||||
{value: CbxSlideshowInterval.THREE_SECONDS, label: '3s'},
|
||||
{value: CbxSlideshowInterval.FIVE_SECONDS, label: '5s'},
|
||||
{value: CbxSlideshowInterval.TEN_SECONDS, label: '10s'},
|
||||
{value: CbxSlideshowInterval.FIFTEEN_SECONDS, label: '15s'},
|
||||
{value: CbxSlideshowInterval.THIRTY_SECONDS, label: '30s'}
|
||||
slideshowIntervalOptions: { value: CbxSlideshowInterval, label: string }[] = [
|
||||
{ value: CbxSlideshowInterval.THREE_SECONDS, label: '3s' },
|
||||
{ value: CbxSlideshowInterval.FIVE_SECONDS, label: '5s' },
|
||||
{ value: CbxSlideshowInterval.TEN_SECONDS, label: '10s' },
|
||||
{ value: CbxSlideshowInterval.FIFTEEN_SECONDS, label: '15s' },
|
||||
{ value: CbxSlideshowInterval.THIRTY_SECONDS, label: '30s' }
|
||||
];
|
||||
|
||||
magnifierZoomOptions: {value: CbxMagnifierZoom, label: string}[] = [
|
||||
{value: CbxMagnifierZoom.ZOOM_1_5X, label: '1.5×'},
|
||||
{value: CbxMagnifierZoom.ZOOM_2X, label: '2×'},
|
||||
{value: CbxMagnifierZoom.ZOOM_2_5X, label: '2.5×'},
|
||||
{value: CbxMagnifierZoom.ZOOM_3X, label: '3×'},
|
||||
{value: CbxMagnifierZoom.ZOOM_4X, label: '4×'}
|
||||
magnifierZoomOptions: { value: CbxMagnifierZoom, label: string }[] = [
|
||||
{ value: CbxMagnifierZoom.ZOOM_1_5X, label: '1.5×' },
|
||||
{ value: CbxMagnifierZoom.ZOOM_2X, label: '2×' },
|
||||
{ value: CbxMagnifierZoom.ZOOM_2_5X, label: '2.5×' },
|
||||
{ value: CbxMagnifierZoom.ZOOM_3X, label: '3×' },
|
||||
{ value: CbxMagnifierZoom.ZOOM_4X, label: '4×' }
|
||||
];
|
||||
|
||||
magnifierLensSizeOptions: {value: CbxMagnifierLensSize, label: string}[] = [
|
||||
{value: CbxMagnifierLensSize.SMALL, label: 'S'},
|
||||
{value: CbxMagnifierLensSize.MEDIUM, label: 'M'},
|
||||
{value: CbxMagnifierLensSize.LARGE, label: 'L'},
|
||||
{value: CbxMagnifierLensSize.EXTRA_LARGE, label: 'XL'}
|
||||
magnifierLensSizeOptions: { value: CbxMagnifierLensSize, label: string }[] = [
|
||||
{ value: CbxMagnifierLensSize.SMALL, label: 'S' },
|
||||
{ value: CbxMagnifierLensSize.MEDIUM, label: 'M' },
|
||||
{ value: CbxMagnifierLensSize.LARGE, label: 'L' },
|
||||
{ value: CbxMagnifierLensSize.EXTRA_LARGE, label: 'XL' }
|
||||
];
|
||||
|
||||
get backgroundOptions() {
|
||||
return [
|
||||
{value: CbxBackgroundColor.BLACK, label: this.t.translate('readerCbx.quickSettings.black'), color: '#000000'},
|
||||
{value: CbxBackgroundColor.GRAY, label: this.t.translate('readerCbx.quickSettings.gray'), color: '#808080'},
|
||||
{value: CbxBackgroundColor.WHITE, label: this.t.translate('readerCbx.quickSettings.white'), color: '#ffffff'}
|
||||
{ value: CbxBackgroundColor.BLACK, label: this.t.translate('readerCbx.quickSettings.black'), color: '#000000' },
|
||||
{ value: CbxBackgroundColor.GRAY, label: this.t.translate('readerCbx.quickSettings.gray'), color: '#808080' },
|
||||
{ value: CbxBackgroundColor.WHITE, label: this.t.translate('readerCbx.quickSettings.white'), color: '#ffffff' }
|
||||
];
|
||||
}
|
||||
|
||||
@@ -95,10 +95,6 @@ export class CbxQuickSettingsComponent {
|
||||
return this.state().scrollMode === CbxScrollMode.PAGINATED;
|
||||
}
|
||||
|
||||
get isLongStrip(): boolean {
|
||||
return this.state().scrollMode === CbxScrollMode.LONG_STRIP;
|
||||
}
|
||||
|
||||
get isPhonePortrait(): boolean {
|
||||
return window.innerWidth < 768 && window.innerHeight > window.innerWidth;
|
||||
}
|
||||
@@ -156,6 +152,23 @@ export class CbxQuickSettingsComponent {
|
||||
this.quickSettingsService.emitMagnifierLensSizeChange(size);
|
||||
}
|
||||
|
||||
onBrightnessChange(event: Event): void {
|
||||
const value = +(event.target as HTMLInputElement).value;
|
||||
this.quickSettingsService.emitBrightnessChange(value);
|
||||
}
|
||||
|
||||
onEmulateBookToggle(): void {
|
||||
this.quickSettingsService.emitEmulateBookChange(!this.state().emulateBook);
|
||||
}
|
||||
|
||||
onClickToPaginateToggle(): void {
|
||||
this.quickSettingsService.emitClickToPaginateChange(!this.state().clickToPaginate);
|
||||
}
|
||||
|
||||
onAutoCloseMenuToggle(): void {
|
||||
this.quickSettingsService.emitAutoCloseMenuChange(!this.state().autoCloseMenu);
|
||||
}
|
||||
|
||||
onOverlayClick(): void {
|
||||
this.quickSettingsService.close();
|
||||
}
|
||||
|
||||
+18
-6
@@ -1,4 +1,4 @@
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
CbxBackgroundColor,
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
CbxScrollMode,
|
||||
CbxSlideshowInterval,
|
||||
} from '../../../../settings/user-management/user.service';
|
||||
import {CbxQuickSettingsService} from './cbx-quick-settings.service';
|
||||
import { CbxQuickSettingsService } from './cbx-quick-settings.service';
|
||||
|
||||
describe('CbxQuickSettingsService', () => {
|
||||
it('tracks visibility and settings state and resets cleanly', () => {
|
||||
@@ -27,6 +27,10 @@ describe('CbxQuickSettingsService', () => {
|
||||
service.setSlideshowInterval(CbxSlideshowInterval.TEN_SECONDS);
|
||||
service.setMagnifierZoom(CbxMagnifierZoom.ZOOM_4X);
|
||||
service.setMagnifierLensSize(CbxMagnifierLensSize.EXTRA_LARGE);
|
||||
service.setBrightness(50);
|
||||
service.setEmulateBook(true);
|
||||
service.setClickToPaginate(true);
|
||||
service.setAutoCloseMenu(true);
|
||||
|
||||
expect(service.visible()).toBe(true);
|
||||
expect(service.state()).toEqual({
|
||||
@@ -38,7 +42,11 @@ describe('CbxQuickSettingsService', () => {
|
||||
readingDirection: CbxReadingDirection.RTL,
|
||||
slideshowInterval: CbxSlideshowInterval.TEN_SECONDS,
|
||||
magnifierZoom: CbxMagnifierZoom.ZOOM_4X,
|
||||
magnifierLensSize: CbxMagnifierLensSize.EXTRA_LARGE
|
||||
magnifierLensSize: CbxMagnifierLensSize.EXTRA_LARGE,
|
||||
brightness: 50,
|
||||
emulateBook: true,
|
||||
clickToPaginate: true,
|
||||
autoCloseMenu: true
|
||||
});
|
||||
|
||||
service.close();
|
||||
@@ -55,7 +63,11 @@ describe('CbxQuickSettingsService', () => {
|
||||
readingDirection: CbxReadingDirection.LTR,
|
||||
slideshowInterval: CbxSlideshowInterval.FIVE_SECONDS,
|
||||
magnifierZoom: CbxMagnifierZoom.ZOOM_3X,
|
||||
magnifierLensSize: CbxMagnifierLensSize.MEDIUM
|
||||
magnifierLensSize: CbxMagnifierLensSize.MEDIUM,
|
||||
brightness: 100,
|
||||
emulateBook: false,
|
||||
clickToPaginate: false,
|
||||
autoCloseMenu: false
|
||||
});
|
||||
});
|
||||
|
||||
@@ -82,7 +94,7 @@ describe('CbxQuickSettingsService', () => {
|
||||
service.magnifierLensSizeChange$.subscribe(value => lensSizeEvents.push(value));
|
||||
|
||||
service.emitFitModeChange(CbxFitMode.ACTUAL_SIZE);
|
||||
service.emitScrollModeChange(CbxScrollMode.LONG_STRIP);
|
||||
service.emitScrollModeChange(CbxScrollMode.INFINITE);
|
||||
service.emitPageViewModeChange(CbxPageViewMode.TWO_PAGE);
|
||||
service.emitPageSpreadChange(CbxPageSpread.EVEN);
|
||||
service.emitBackgroundColorChange(CbxBackgroundColor.WHITE);
|
||||
@@ -92,7 +104,7 @@ describe('CbxQuickSettingsService', () => {
|
||||
service.emitMagnifierLensSizeChange(CbxMagnifierLensSize.LARGE);
|
||||
|
||||
expect(fitModeEvents).toEqual([CbxFitMode.ACTUAL_SIZE]);
|
||||
expect(scrollModeEvents).toEqual([CbxScrollMode.LONG_STRIP]);
|
||||
expect(scrollModeEvents).toEqual([CbxScrollMode.INFINITE]);
|
||||
expect(pageViewEvents).toEqual([CbxPageViewMode.TWO_PAGE]);
|
||||
expect(pageSpreadEvents).toEqual([CbxPageSpread.EVEN]);
|
||||
expect(backgroundEvents).toEqual([CbxBackgroundColor.WHITE]);
|
||||
|
||||
+53
-1
@@ -12,6 +12,10 @@ export interface CbxQuickSettingsState {
|
||||
slideshowInterval: CbxSlideshowInterval;
|
||||
magnifierZoom: CbxMagnifierZoom;
|
||||
magnifierLensSize: CbxMagnifierLensSize;
|
||||
brightness: number;
|
||||
emulateBook: boolean;
|
||||
clickToPaginate: boolean;
|
||||
autoCloseMenu: boolean;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@@ -25,7 +29,11 @@ export class CbxQuickSettingsService {
|
||||
readingDirection: CbxReadingDirection.LTR,
|
||||
slideshowInterval: CbxSlideshowInterval.FIVE_SECONDS,
|
||||
magnifierZoom: CbxMagnifierZoom.ZOOM_3X,
|
||||
magnifierLensSize: CbxMagnifierLensSize.MEDIUM
|
||||
magnifierLensSize: CbxMagnifierLensSize.MEDIUM,
|
||||
brightness: 100,
|
||||
emulateBook: false,
|
||||
clickToPaginate: false,
|
||||
autoCloseMenu: false
|
||||
};
|
||||
|
||||
private readonly _state = signal<CbxQuickSettingsState>(this.defaultState);
|
||||
@@ -61,6 +69,18 @@ export class CbxQuickSettingsService {
|
||||
private _magnifierLensSizeChange = new Subject<CbxMagnifierLensSize>();
|
||||
magnifierLensSizeChange$ = this._magnifierLensSizeChange.asObservable();
|
||||
|
||||
private _brightnessChange = new Subject<number>();
|
||||
brightnessChange$ = this._brightnessChange.asObservable();
|
||||
|
||||
private _emulateBookChange = new Subject<boolean>();
|
||||
emulateBookChange$ = this._emulateBookChange.asObservable();
|
||||
|
||||
private _clickToPaginateChange = new Subject<boolean>();
|
||||
clickToPaginateChange$ = this._clickToPaginateChange.asObservable();
|
||||
|
||||
private _autoCloseMenuChange = new Subject<boolean>();
|
||||
autoCloseMenuChange$ = this._autoCloseMenuChange.asObservable();
|
||||
|
||||
show(): void {
|
||||
this._visible.set(true);
|
||||
}
|
||||
@@ -109,6 +129,22 @@ export class CbxQuickSettingsService {
|
||||
this.updateState({magnifierLensSize: size});
|
||||
}
|
||||
|
||||
setBrightness(value: number): void {
|
||||
this.updateState({brightness: value});
|
||||
}
|
||||
|
||||
setEmulateBook(value: boolean): void {
|
||||
this.updateState({emulateBook: value});
|
||||
}
|
||||
|
||||
setClickToPaginate(value: boolean): void {
|
||||
this.updateState({clickToPaginate: value});
|
||||
}
|
||||
|
||||
setAutoCloseMenu(value: boolean): void {
|
||||
this.updateState({autoCloseMenu: value});
|
||||
}
|
||||
|
||||
// Actions emitted from component
|
||||
emitFitModeChange(mode: CbxFitMode): void {
|
||||
this._fitModeChange.next(mode);
|
||||
@@ -146,6 +182,22 @@ export class CbxQuickSettingsService {
|
||||
this._magnifierLensSizeChange.next(size);
|
||||
}
|
||||
|
||||
emitBrightnessChange(value: number): void {
|
||||
this._brightnessChange.next(value);
|
||||
}
|
||||
|
||||
emitEmulateBookChange(value: boolean): void {
|
||||
this._emulateBookChange.next(value);
|
||||
}
|
||||
|
||||
emitClickToPaginateChange(value: boolean): void {
|
||||
this._clickToPaginateChange.next(value);
|
||||
}
|
||||
|
||||
emitAutoCloseMenuChange(value: boolean): void {
|
||||
this._autoCloseMenuChange.next(value);
|
||||
}
|
||||
|
||||
reset(): void {
|
||||
this._state.set(this.defaultState);
|
||||
this._visible.set(false);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface CbxPageDimension {
|
||||
pageNumber: number;
|
||||
width: number;
|
||||
height: number;
|
||||
wide: boolean;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
import {Component, Input, OnChanges, SimpleChanges, ViewChild, ElementRef, AfterViewInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {CbxPageSplitOption} from '../../../settings/user-management/user.service';
|
||||
|
||||
export type CanvasSplitState = 'NO_SPLIT' | 'LEFT_PART' | 'RIGHT_PART';
|
||||
|
||||
/**
|
||||
* Renders a wide page image on a <canvas>, optionally showing only
|
||||
* the left or right half depending on the split state.
|
||||
*
|
||||
* Browser canvas limits respected:
|
||||
* Safari: 4096×4096 Others: 16384×16384
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-canvas-renderer',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
template: `
|
||||
<canvas
|
||||
#canvas
|
||||
class="canvas-page"
|
||||
[class.canvas-hidden]="!imageLoaded"
|
||||
[style.max-width.%]="100"
|
||||
[style.max-height.%]="100">
|
||||
</canvas>
|
||||
`,
|
||||
styles: [`
|
||||
:host {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.canvas-page {
|
||||
object-fit: contain;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
.canvas-hidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
`]
|
||||
})
|
||||
export class CanvasRendererComponent implements OnChanges, AfterViewInit {
|
||||
@Input() imageUrl = '';
|
||||
@Input() splitState: CanvasSplitState = 'NO_SPLIT';
|
||||
@Input() splitOption: CbxPageSplitOption = CbxPageSplitOption.NO_SPLIT;
|
||||
|
||||
@ViewChild('canvas', {static: true}) canvasRef!: ElementRef<HTMLCanvasElement>;
|
||||
|
||||
imageLoaded = false;
|
||||
private currentImage: HTMLImageElement | null = null;
|
||||
|
||||
private static readonly MAX_CANVAS_SAFARI = 4096;
|
||||
private static readonly MAX_CANVAS_OTHER = 16384;
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
if (this.imageUrl) {
|
||||
this.loadAndDraw();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['imageUrl'] || changes['splitState'] || changes['splitOption']) {
|
||||
if (changes['imageUrl'] && this.currentImage?.src !== this.imageUrl) {
|
||||
this.loadAndDraw();
|
||||
} else if (this.currentImage) {
|
||||
this.drawImage(this.currentImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private loadAndDraw(): void {
|
||||
if (!this.imageUrl) return;
|
||||
|
||||
this.imageLoaded = false;
|
||||
const img = new Image();
|
||||
img.crossOrigin = 'anonymous';
|
||||
img.onload = () => {
|
||||
this.currentImage = img;
|
||||
this.drawImage(img);
|
||||
this.imageLoaded = true;
|
||||
};
|
||||
img.src = this.imageUrl;
|
||||
}
|
||||
|
||||
private drawImage(img: HTMLImageElement): void {
|
||||
const canvas = this.canvasRef?.nativeElement;
|
||||
if (!canvas) return;
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) return;
|
||||
|
||||
const maxDim = this.getMaxCanvasSize();
|
||||
const srcW = img.naturalWidth;
|
||||
const srcH = img.naturalHeight;
|
||||
|
||||
if (this.splitState === 'NO_SPLIT' || this.splitOption === CbxPageSplitOption.NO_SPLIT) {
|
||||
// Draw full image
|
||||
const w = Math.min(srcW, maxDim);
|
||||
const h = Math.min(srcH, maxDim);
|
||||
canvas.width = w;
|
||||
canvas.height = h;
|
||||
ctx.drawImage(img, 0, 0, srcW, srcH, 0, 0, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
// Split: draw only left or right half
|
||||
const halfW = Math.floor(srcW / 2);
|
||||
const outW = Math.min(halfW, maxDim);
|
||||
const outH = Math.min(srcH, maxDim);
|
||||
canvas.width = outW;
|
||||
canvas.height = outH;
|
||||
|
||||
const isLeftToRight = this.splitOption === CbxPageSplitOption.SPLIT_LEFT_TO_RIGHT
|
||||
|| this.splitOption === CbxPageSplitOption.FIT_SPLIT;
|
||||
const showLeft = isLeftToRight
|
||||
? this.splitState === 'LEFT_PART'
|
||||
: this.splitState === 'RIGHT_PART';
|
||||
|
||||
const srcX = showLeft ? 0 : halfW;
|
||||
ctx.drawImage(img, srcX, 0, halfW, srcH, 0, 0, outW, outH);
|
||||
}
|
||||
|
||||
private getMaxCanvasSize(): number {
|
||||
const ua = navigator.userAgent;
|
||||
if (/Safari/.test(ua) && !/Chrome/.test(ua)) {
|
||||
return CanvasRendererComponent.MAX_CANVAS_SAFARI;
|
||||
}
|
||||
return CanvasRendererComponent.MAX_CANVAS_OTHER;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,8 @@ export type ViewEvent =
|
||||
| { type: 'go-last-section' }
|
||||
| { type: 'toggle-toc' }
|
||||
| { type: 'toggle-search' }
|
||||
| { type: 'toggle-notes' };
|
||||
| { type: 'toggle-notes' }
|
||||
| { type: 'toggle-immersive' };
|
||||
|
||||
interface ViewCallbacks {
|
||||
prev: () => void;
|
||||
@@ -218,6 +219,9 @@ export class ReaderEventService {
|
||||
} else if (k === 'n' || k === 'N') {
|
||||
this.eventSubject.next({type: 'toggle-notes'});
|
||||
event.preventDefault();
|
||||
} else if (k === 'i' || k === 'I') {
|
||||
this.eventSubject.next({type: 'toggle-immersive'});
|
||||
event.preventDefault();
|
||||
} else if (k === '?') {
|
||||
this.eventSubject.next({type: 'toggle-shortcuts-help'});
|
||||
event.preventDefault();
|
||||
|
||||
@@ -53,6 +53,7 @@ export class EbookShortcutsHelpComponent {
|
||||
title: this.t.translate('readerEbook.shortcutsHelp.display'),
|
||||
shortcuts: [
|
||||
{keys: ['F'], description: this.t.translate('readerEbook.shortcutsHelp.toggleFullscreen')},
|
||||
{keys: ['I'], description: this.t.translate('readerEbook.shortcutsHelp.toggleImmersive')},
|
||||
{keys: ['Escape'], description: this.t.translate('readerEbook.shortcutsHelp.exitFullscreenCloseDialogs')}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<div
|
||||
class="reader"
|
||||
[class.immersive]="immersiveMode"
|
||||
[style.background-color]="readerState().theme.bg ?? ''">
|
||||
|
||||
<div class="header-trigger-zone"
|
||||
[class.inactive]="headerVisible"
|
||||
[class.inactive]="headerVisible || immersiveMode"
|
||||
(mouseenter)="onHeaderTriggerZoneEnter()"></div>
|
||||
<div class="footer-trigger-zone"
|
||||
[class.inactive]="forceNavbarVisible"
|
||||
[class.inactive]="forceNavbarVisible || immersiveMode"
|
||||
(mouseenter)="onFooterTriggerZoneEnter()"></div>
|
||||
|
||||
@if (isLoading) {
|
||||
|
||||
@@ -148,3 +148,14 @@ foliate-view::part(foot) {
|
||||
min-height: 32px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.reader.immersive {
|
||||
::ng-deep foliate-view::part(head),
|
||||
::ng-deep foliate-view::part(foot) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.bookmark-indicator {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import {NoteDialogResult, ReaderNoteDialogComponent} from './dialogs/note-dialog
|
||||
import {EbookShortcutsHelpComponent} from './dialogs/shortcuts-help.component';
|
||||
import {TranslocoPipe} from '@jsverse/transloco';
|
||||
import {RelocateProgressData} from './state/progress.service';
|
||||
import {WakeLockService} from '../../../shared/service/wake-lock.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ebook-reader',
|
||||
@@ -83,6 +84,7 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
private selectionService = inject(ReaderSelectionService);
|
||||
private headerService = inject(ReaderHeaderService);
|
||||
private noteService = inject(ReaderNoteService);
|
||||
private wakeLockService = inject(WakeLockService);
|
||||
|
||||
public sidebarService = inject(ReaderSidebarService);
|
||||
public leftSidebarService = inject(ReaderLeftSidebarService);
|
||||
@@ -108,6 +110,8 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
sectionFractions: number[] = [];
|
||||
isFullscreen = false;
|
||||
showShortcutsHelp = false;
|
||||
immersiveMode = false;
|
||||
private immersiveAutoHideTimer?: ReturnType<typeof setTimeout>;
|
||||
|
||||
readonly readerState = this.stateService.state;
|
||||
readonly selectionState = this.selectionService.state;
|
||||
@@ -161,6 +165,9 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(() => this.showShortcutsHelp = true);
|
||||
|
||||
// Enable wake lock after a short delay
|
||||
setTimeout(() => this.wakeLockService.enable(), 1000);
|
||||
|
||||
this.isLoading = true;
|
||||
this.initializeFoliate().pipe(
|
||||
switchMap(() => this.epubCustomFontService.loadAndCacheFonts()),
|
||||
@@ -180,6 +187,7 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.wakeLockService.disable();
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
this.viewManager.destroy();
|
||||
@@ -193,6 +201,9 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
this.noteService.reset();
|
||||
this.epubCustomFontService.cleanup();
|
||||
|
||||
if (this.immersiveAutoHideTimer) {
|
||||
clearTimeout(this.immersiveAutoHideTimer);
|
||||
}
|
||||
if (this._fileUrl) {
|
||||
URL.revokeObjectURL(this._fileUrl);
|
||||
this._fileUrl = null;
|
||||
@@ -315,7 +326,11 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
}, 500);
|
||||
break;
|
||||
case 'middle-single-tap':
|
||||
this.toggleHeaderNavbarPinned();
|
||||
if (this.immersiveMode) {
|
||||
this.immersiveTemporaryShow();
|
||||
} else {
|
||||
this.toggleHeaderNavbarPinned();
|
||||
}
|
||||
break;
|
||||
case 'text-selected':
|
||||
this.selectionService.handleTextSelected(event.detail, event.popupPosition);
|
||||
@@ -326,6 +341,9 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
case 'toggle-shortcuts-help':
|
||||
this.showShortcutsHelp = !this.showShortcutsHelp;
|
||||
break;
|
||||
case 'toggle-immersive':
|
||||
this.toggleImmersiveMode();
|
||||
break;
|
||||
case 'go-first-section':
|
||||
this.viewManager.goToSection(0).subscribe();
|
||||
break;
|
||||
@@ -442,6 +460,24 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
this.visibilityManager.handleFooterZoneEnter();
|
||||
}
|
||||
|
||||
toggleImmersiveMode(): void {
|
||||
this.immersiveMode = !this.immersiveMode;
|
||||
if (this.immersiveMode) {
|
||||
this.visibilityManager.setImmersive(true);
|
||||
} else {
|
||||
this.visibilityManager.setImmersive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private immersiveTemporaryShow(): void {
|
||||
if (!this.immersiveMode) return;
|
||||
this.visibilityManager.temporaryShow();
|
||||
if (this.immersiveAutoHideTimer) clearTimeout(this.immersiveAutoHideTimer);
|
||||
this.immersiveAutoHideTimer = setTimeout(() => {
|
||||
this.visibilityManager.hideTemporary();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
handleSelectionAction(action: TextSelectionAction): void {
|
||||
if (action.type === 'note') {
|
||||
this.noteService.openNewNoteDialog();
|
||||
|
||||
@@ -5,6 +5,7 @@ export interface HeaderFooterVisibilityState {
|
||||
|
||||
export class ReaderHeaderFooterVisibilityManager {
|
||||
private isPinned = false;
|
||||
private isImmersive = false;
|
||||
private mouseY: number;
|
||||
|
||||
private readonly HEADER_HEIGHT = 20;
|
||||
@@ -31,11 +32,13 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
|
||||
handleMouseMove(mouseY: number): void {
|
||||
this.mouseY = mouseY;
|
||||
this.updateVisibility();
|
||||
if (!this.isImmersive) {
|
||||
this.updateVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
handleMouseLeave(): void {
|
||||
if (!this.isPinned) {
|
||||
if (!this.isPinned && !this.isImmersive) {
|
||||
this.setHeaderVisible(false);
|
||||
this.setFooterVisible(false);
|
||||
this.notifyStateChange();
|
||||
@@ -43,14 +46,14 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
}
|
||||
|
||||
handleHeaderZoneEnter(): void {
|
||||
if (!this.isPinned) {
|
||||
if (!this.isPinned && !this.isImmersive) {
|
||||
this.setHeaderVisible(true);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
handleFooterZoneEnter(): void {
|
||||
if (!this.isPinned) {
|
||||
if (!this.isPinned && !this.isImmersive) {
|
||||
this.setFooterVisible(true);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
@@ -61,6 +64,37 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
this.updateVisibility();
|
||||
}
|
||||
|
||||
unpinIfPinned(): void {
|
||||
if (this.isPinned) {
|
||||
this.isPinned = false;
|
||||
this.updateVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
setImmersive(immersive: boolean): void {
|
||||
this.isImmersive = immersive;
|
||||
if (immersive) {
|
||||
this.isPinned = false;
|
||||
this.setHeaderVisible(false);
|
||||
this.setFooterVisible(false);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
temporaryShow(): void {
|
||||
this.setHeaderVisible(true);
|
||||
this.setFooterVisible(true);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
|
||||
hideTemporary(): void {
|
||||
if (this.isImmersive) {
|
||||
this.setHeaderVisible(false);
|
||||
this.setFooterVisible(false);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
getVisibilityState(): HeaderFooterVisibilityState {
|
||||
return {
|
||||
headerVisible: this.headerVisible,
|
||||
|
||||
@@ -1,79 +1,152 @@
|
||||
@if (isLoading) {
|
||||
<div class="loading-container">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
<div class="loading-container">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!isLoading) {
|
||||
<ngx-extended-pdf-viewer
|
||||
[src]="bookData"
|
||||
[authorization]="authorization"
|
||||
[textLayer]="true"
|
||||
[showHandToolButton]="true"
|
||||
[height]="'auto'"
|
||||
[theme]="isDarkTheme ? 'dark' : 'light'"
|
||||
[page]="page"
|
||||
[rotation]="rotation"
|
||||
[zoom]="zoom"
|
||||
[spread]="spread"
|
||||
[enablePrint]="canPrint"
|
||||
[customToolbar]="additionalButtons"
|
||||
(pagesLoaded)="onPdfPagesLoaded($event)"
|
||||
(pageChange)="onPageChange($event)"
|
||||
(zoomChange)="onZoomChange($event)"
|
||||
(spreadChange)="onSpreadChange($event)"
|
||||
(annotationEditorEvent)="onAnnotationEditorEvent()">
|
||||
</ngx-extended-pdf-viewer>
|
||||
<div class="pdf-reader-container" [class.dark]="isDarkTheme">
|
||||
|
||||
<ng-template #additionalButtons>
|
||||
<div id="toolbarViewer">
|
||||
<div id="toolbarViewerLeft">
|
||||
<!-- Footer trigger zone -->
|
||||
<div class="footer-trigger-zone" [class.inactive]="footerVisible" (mouseenter)="onFooterTriggerZoneEnter()"></div>
|
||||
|
||||
@if (viewerMode === 'book') {
|
||||
<!-- Header trigger zone -->
|
||||
<div class="header-trigger-zone" [class.inactive]="headerVisible" (mouseenter)="onHeaderTriggerZoneEnter()"></div>
|
||||
}
|
||||
|
||||
@if (viewerMode === 'document') {
|
||||
<button class="embed-close-btn icon-btn close-btn" [title]="'readerPdf.toolbar.closePdfReader' | transloco"
|
||||
(click)="closeReader()">
|
||||
<app-reader-icon name="close" [size]="20" />
|
||||
</button>
|
||||
<div id="embedpdf-viewer"></div>
|
||||
}
|
||||
|
||||
<!-- Book PDF Viewer -->
|
||||
@if (viewerMode === 'book') {
|
||||
<ngx-extended-pdf-viewer [src]="bookData" [authorization]="authorization" [textLayer]="true"
|
||||
[showHandToolButton]="true" [height]="'100%'" [theme]="isDarkTheme ? 'dark' : 'light'" [page]="page"
|
||||
[rotation]="rotation" [zoom]="zoom" [spread]="spread" [enablePrint]="canPrint" [customToolbar]="pdfToolbar"
|
||||
(pagesLoaded)="onPdfPagesLoaded($event)" (pageChange)="onPageChange($event)" (zoomChange)="onZoomChange($event)"
|
||||
(spreadChange)="onSpreadChange($event)" (annotationEditorEvent)="onAnnotationEditorEvent()">
|
||||
</ngx-extended-pdf-viewer>
|
||||
}
|
||||
|
||||
|
||||
<ng-template #pdfToolbar>
|
||||
<div id="toolbarViewer" class="pdf-header-toolbar" [class.chrome-hidden]="!headerVisible">
|
||||
<div class="header-left">
|
||||
<pdf-toggle-sidebar></pdf-toggle-sidebar>
|
||||
<pdf-find-button></pdf-find-button>
|
||||
<pdf-paging-area></pdf-paging-area>
|
||||
</div>
|
||||
<pdf-zoom-toolbar></pdf-zoom-toolbar>
|
||||
<div id="toolbarViewerRight" [class.pdf-dark]="isDarkTheme">
|
||||
<pdf-hand-tool></pdf-hand-tool>
|
||||
<pdf-select-tool></pdf-select-tool>
|
||||
<pdf-rotate-page></pdf-rotate-page>
|
||||
@if (canPrint) {
|
||||
<pdf-print></pdf-print>
|
||||
}
|
||||
<pdf-no-spread></pdf-no-spread>
|
||||
<pdf-even-spread></pdf-even-spread>
|
||||
<pdf-odd-spread></pdf-odd-spread>
|
||||
<pdf-infinite-scroll></pdf-infinite-scroll>
|
||||
<pdf-horizontal-scroll></pdf-horizontal-scroll>
|
||||
<pdf-vertical-scroll-mode></pdf-vertical-scroll-mode>
|
||||
<pdf-wrapped-scroll-mode></pdf-wrapped-scroll-mode>
|
||||
<pdf-single-page-mode></pdf-single-page-mode>
|
||||
<pdf-book-mode></pdf-book-mode>
|
||||
<div class="verticalToolbarSeparator hiddenSmallView"></div>
|
||||
<pdf-toggle-secondary-toolbar></pdf-toggle-secondary-toolbar>
|
||||
<div class="verticalToolbarSeparator"></div>
|
||||
<span class="book-title">{{ bookTitle }}</span>
|
||||
<div class="header-right">
|
||||
<pdf-highlight-editor></pdf-highlight-editor>
|
||||
<pdf-text-editor></pdf-text-editor>
|
||||
<pdf-draw-editor></pdf-draw-editor>
|
||||
<div class="verticalToolbarSeparator"></div>
|
||||
<button class="toolbar-btn" [title]="isDarkTheme ? ('readerPdf.toolbar.switchToLightMode' | transloco) : ('readerPdf.toolbar.switchToDarkMode' | transloco)" (click)="isDarkTheme = !isDarkTheme">
|
||||
<div class="separator"></div>
|
||||
<pdf-zoom-toolbar></pdf-zoom-toolbar>
|
||||
<div class="separator"></div>
|
||||
<button class="icon-btn"
|
||||
[title]="isDarkTheme ? ('readerPdf.toolbar.switchToLightMode' | transloco) : ('readerPdf.toolbar.switchToDarkMode' | transloco)"
|
||||
(click)="toggleDarkTheme()">
|
||||
@if (isDarkTheme) {
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="4" />
|
||||
<path d="M12 2v2" />
|
||||
<path d="M12 20v2" />
|
||||
<path d="m4.93 4.93 1.41 1.41" />
|
||||
<path d="m17.66 17.66 1.41 1.41" />
|
||||
<path d="M2 12h2" />
|
||||
<path d="M20 12h2" />
|
||||
<path d="m6.34 17.66-1.41 1.41" />
|
||||
<path d="m19.07 4.93-1.41 1.41" />
|
||||
</svg>
|
||||
} @else {
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />
|
||||
</svg>
|
||||
}
|
||||
</button>
|
||||
<button id="closePdfReaderButton" class="close-reader-btn" [title]="'readerPdf.toolbar.closePdfReader' | transloco" (click)="closeReader()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
||||
</svg>
|
||||
<button class="icon-btn" (click)="toggleFullscreen()"
|
||||
[title]="isFullscreen ? ('readerPdf.toolbar.exitFullscreen' | transloco) : ('readerPdf.toolbar.fullscreen' | transloco)">
|
||||
@if (isFullscreen) {
|
||||
<app-reader-icon name="fullscreen-exit" [size]="18" />
|
||||
} @else {
|
||||
<app-reader-icon name="fullscreen" [size]="18" />
|
||||
}
|
||||
</button>
|
||||
<div class="separator"></div>
|
||||
<pdf-toggle-secondary-toolbar></pdf-toggle-secondary-toolbar>
|
||||
<button class="icon-btn close-btn" [title]="'readerPdf.toolbar.closePdfReader' | transloco"
|
||||
(click)="closeReader()">
|
||||
<app-reader-icon name="close" [size]="20" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
}
|
||||
|
||||
<!-- Footer (shared across both viewer modes) -->
|
||||
<div class="pdf-footer" [class.visible]="footerVisible">
|
||||
<div class="page-nav-left">
|
||||
<button class="nav-btn" (click)="goToFirstPage()" [disabled]="page <= 1"
|
||||
[title]="'readerPdf.footer.firstPage' | transloco">
|
||||
<app-reader-icon name="chevron-first" [size]="16" />
|
||||
</button>
|
||||
<button class="nav-btn" (click)="goToPreviousPage()" [disabled]="page <= 1"
|
||||
[title]="'readerPdf.footer.previousPage' | transloco">
|
||||
<app-reader-icon name="chevron-left" [size]="16" />
|
||||
</button>
|
||||
<div class="page-info">
|
||||
<span class="current">{{ page }}</span>
|
||||
<span class="total"> {{ 'readerPdf.footer.of' | transloco }} {{ totalPages }}</span>
|
||||
</div>
|
||||
<button class="nav-btn" (click)="goToNextPage()" [disabled]="page >= totalPages"
|
||||
[title]="'readerPdf.footer.nextPage' | transloco">
|
||||
<app-reader-icon name="chevron-right" [size]="16" />
|
||||
</button>
|
||||
<button class="nav-btn" (click)="goToLastPage()" [disabled]="page >= totalPages"
|
||||
[title]="'readerPdf.footer.lastPage' | transloco">
|
||||
<app-reader-icon name="chevron-last" [size]="16" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="page-controls">
|
||||
<div class="slider-wrapper">
|
||||
<input type="range" class="page-slider" [min]="1" [max]="totalPages" [value]="page"
|
||||
(input)="onSliderChange($event)" list="pdf-page-ticks" [title]="'readerPdf.footer.pageSlider' | transloco" />
|
||||
<datalist id="pdf-page-ticks">
|
||||
@for (tick of sliderTicks; track tick) {
|
||||
<option [value]="tick"></option>
|
||||
}
|
||||
</datalist>
|
||||
</div>
|
||||
|
||||
<div class="goto-page">
|
||||
<input type="number" [(ngModel)]="goToPageInput" [min]="1" [max]="totalPages"
|
||||
[placeholder]="'readerPdf.footer.pagePlaceholder' | transloco" class="page-input"
|
||||
(keyup.enter)="onGoToPage()" />
|
||||
<button class="go-btn" (click)="onGoToPage()"
|
||||
[disabled]="goToPageInput === null || goToPageInput < 1 || goToPageInput > totalPages">
|
||||
{{ 'readerPdf.footer.go' | transloco }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer-spacer"></div>
|
||||
|
||||
<div class="viewer-mode-toggle">
|
||||
<button class="toggle-btn toggle-book" [class.active]="viewerMode === 'book'" (click)="setViewerMode('book')">
|
||||
<i class="pi pi-book"></i><span>Book Viewer</span>
|
||||
</button>
|
||||
<button class="toggle-btn toggle-doc" [class.active]="viewerMode === 'document'" (click)="setViewerMode('document')">
|
||||
<i class="pi pi-file"></i><span>Doc Viewer</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,46 +1,878 @@
|
||||
@use 'sass:color';
|
||||
|
||||
/* stylelint-disable selector-id-pattern, selector-class-pattern -- targets ngx-extended-pdf-viewer / pdf.js internals */
|
||||
|
||||
// Design tokens matching CBX/E-Book readers
|
||||
$header-height: 38px;
|
||||
$footer-height: 52px;
|
||||
$gradient-bg: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%);
|
||||
$border-color: #404040;
|
||||
$text-primary: rgb(255 255 255 / 95%);
|
||||
$text-secondary: rgb(255 255 255 / 60%);
|
||||
$active-color: #4a90e2;
|
||||
$hover-bg: rgb(255 255 255 / 12%);
|
||||
$transition-fast: 150ms ease;
|
||||
|
||||
// --- Loading ---
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
height: 100dvh;
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
::ng-deep .toolbar-btn,
|
||||
::ng-deep .close-reader-btn {
|
||||
// --- Reader container ---
|
||||
|
||||
.pdf-reader-container {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #1a1a1a;
|
||||
z-index: 900;
|
||||
}
|
||||
|
||||
// --- Trigger zones ---
|
||||
|
||||
.header-trigger-zone,
|
||||
.footer-trigger-zone {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
.header-trigger-zone {
|
||||
top: 0;
|
||||
height: 20px;
|
||||
|
||||
&.inactive {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-trigger-zone {
|
||||
bottom: 0;
|
||||
height: 30px;
|
||||
|
||||
&.inactive {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Header ---
|
||||
// Child element styles for .pdf-header-toolbar (positioning is in ::ng-deep #toolbarViewer)
|
||||
|
||||
.pdf-header-toolbar {
|
||||
.header-left,
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
z-index: 1;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
// Style zoom toolbar within header
|
||||
::ng-deep {
|
||||
pdf-zoom-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.zoom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
#scaleSelect {
|
||||
background: rgb(255 255 255 / 8%) !important;
|
||||
color: #fff !important;
|
||||
border: 1px solid rgb(255 255 255 / 15%) !important;
|
||||
border-radius: 4px !important;
|
||||
padding: 2px 4px !important;
|
||||
font-size: 12px !important;
|
||||
cursor: pointer;
|
||||
height: 26px !important;
|
||||
max-width: 85px;
|
||||
appearance: none;
|
||||
|
||||
option {
|
||||
background: #2d2d2d;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.book-title {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 40%;
|
||||
padding: 0 12px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: inherit;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.separator {
|
||||
width: 1px;
|
||||
height: 18px;
|
||||
background: rgb(255 255 255 / 15%);
|
||||
margin: 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Icon buttons ---
|
||||
|
||||
.icon-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
padding: 7px;
|
||||
border-radius: 6px;
|
||||
transition: background $transition-fast;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: #2a2a2a;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg;
|
||||
}
|
||||
|
||||
&.close-btn:hover {
|
||||
background: rgb(239 68 68 / 20%);
|
||||
color: #ef4444;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Override pdf.js component button styles ---
|
||||
|
||||
::ng-deep .pdf-btn-wrap {
|
||||
button {
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
color: #fff !important;
|
||||
cursor: pointer;
|
||||
width: 30px !important;
|
||||
height: 30px !important;
|
||||
padding: 0 !important;
|
||||
border-radius: 6px !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
transition: background $transition-fast !important;
|
||||
margin: 0 !important;
|
||||
box-shadow: none !important;
|
||||
opacity: 1 !important;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg !important;
|
||||
}
|
||||
|
||||
&.toggled,
|
||||
&[aria-pressed="true"] {
|
||||
color: $active-color !important;
|
||||
background: rgb(74 144 226 / 15%) !important;
|
||||
}
|
||||
|
||||
span {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
&::before {
|
||||
color: inherit !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Footer ---
|
||||
|
||||
.pdf-footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: $footer-height;
|
||||
padding: 0 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
z-index: 1002;
|
||||
background: $gradient-bg;
|
||||
border-top: 1px solid $border-color;
|
||||
box-shadow: 0 -2px 8px rgb(0 0 0 / 30%);
|
||||
color: $text-primary;
|
||||
transform: translateY(100%);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: transform 0.25s ease-out, opacity 0.25s ease-out;
|
||||
|
||||
&.visible {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.page-nav-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.nav-btn {
|
||||
background: rgb(51 51 51 / 90%);
|
||||
border: 1px solid #555;
|
||||
color: $text-primary;
|
||||
padding: 6px 10px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
margin-left: 4px;
|
||||
margin-right: 2px;
|
||||
transition: background-color 0.2s ease, color 0.2s ease;
|
||||
transition: all $transition-fast;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&:hover {
|
||||
background: rgb(0 0 0 / 10%);
|
||||
&:hover:not(:disabled) {
|
||||
background: #4a4a4a;
|
||||
border-color: #666;
|
||||
}
|
||||
|
||||
svg {
|
||||
flex-shrink: 0;
|
||||
&:disabled {
|
||||
background: #2a2a2a;
|
||||
color: #666;
|
||||
cursor: not-allowed;
|
||||
border-color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
::ng-deep .pdf-dark .toolbar-btn,
|
||||
::ng-deep .pdf-dark .close-reader-btn {
|
||||
color: #e8e8e8;
|
||||
.page-info {
|
||||
padding: 4px 12px;
|
||||
background: rgb(255 255 255 / 10%);
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
min-width: 90px;
|
||||
text-align: center;
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 15%);
|
||||
.current {
|
||||
color: $active-color;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.total {
|
||||
color: $text-secondary;
|
||||
}
|
||||
}
|
||||
|
||||
::ng-deep .close-reader-btn:hover {
|
||||
color: #ff6b6b;
|
||||
.page-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.footer-spacer {
|
||||
flex: 0 0 auto;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.slider-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.page-slider {
|
||||
width: 100%;
|
||||
border-radius: 3px;
|
||||
outline: none;
|
||||
appearance: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
|
||||
&::-webkit-slider-runnable-track {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: rgb(255 255 255 / 12%);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&::-moz-range-track {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: rgb(255 255 255 / 12%);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: $active-color;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 6px rgb(0 0 0 / 30%);
|
||||
transition: transform $transition-fast;
|
||||
margin-top: calc((6px - 18px) / 2);
|
||||
}
|
||||
|
||||
&::-moz-range-thumb {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: $active-color;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
box-shadow: 0 2px 6px rgb(0 0 0 / 30%);
|
||||
transition: transform $transition-fast;
|
||||
}
|
||||
}
|
||||
|
||||
datalist {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
height: 10px;
|
||||
|
||||
option {
|
||||
width: 0;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 2px;
|
||||
height: 10px;
|
||||
background: rgb(255 255 255 / 50%);
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.viewer-mode-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.toggle-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
white-space: nowrap;
|
||||
gap: 6px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--surface-border);
|
||||
background: var(--surface-card);
|
||||
color: var(--text-color-secondary);
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
height: 30px;
|
||||
|
||||
&:hover {
|
||||
color: var(--text-color);
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: var(--primary-color);
|
||||
color: var(--primary-color-text);
|
||||
border-color: var(--primary-color);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&.toggle-book {
|
||||
border-top-left-radius: 6px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
&.toggle-doc {
|
||||
border-top-right-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.embed-pdf-warning {
|
||||
position: absolute;
|
||||
bottom: 80px;
|
||||
left: 24px;
|
||||
z-index: 1001;
|
||||
background-color: var(--surface-card);
|
||||
color: var(--text-color-secondary);
|
||||
border: 1px solid var(--surface-border);
|
||||
padding: 8px 16px;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 500;
|
||||
font-size: 0.85rem;
|
||||
box-shadow: 0 4px 6px rgb(0 0 0 / 10%);
|
||||
pointer-events: none;
|
||||
|
||||
i {
|
||||
font-size: 1rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
.embed-close-btn {
|
||||
position: fixed;
|
||||
top: 4px;
|
||||
right: 12px;
|
||||
z-index: 1010;
|
||||
color: $text-primary;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
#embedpdf-viewer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.goto-page {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
background: rgb(51 51 51 / 90%);
|
||||
border-radius: 4px;
|
||||
padding: 2px;
|
||||
border: 1px solid #555;
|
||||
|
||||
.page-input {
|
||||
width: 55px;
|
||||
padding: 4px 6px;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
background: #404040;
|
||||
color: $text-primary;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
background: #4a4a4a;
|
||||
}
|
||||
|
||||
&::placeholder {
|
||||
color: rgb(255 255 255 / 30%);
|
||||
}
|
||||
}
|
||||
|
||||
.go-btn {
|
||||
padding: 4px 8px;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
background: $active-color;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-transform: uppercase;
|
||||
transition: background $transition-fast;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: color.adjust($active-color, $lightness: -10%);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Override pdf.js viewer inner styles ---
|
||||
|
||||
::ng-deep {
|
||||
// Make pdf viewer fill container
|
||||
ngx-extended-pdf-viewer {
|
||||
flex: 1;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
|
||||
#mainContainer {
|
||||
background: #1a1a1a !important;
|
||||
}
|
||||
|
||||
// Override pdf.js defaults on #toolbarViewer - our custom fixed header
|
||||
#toolbarViewer {
|
||||
position: fixed !important;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
height: $header-height !important;
|
||||
min-height: 0 !important;
|
||||
box-sizing: border-box !important;
|
||||
padding: 0 16px !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: space-between !important;
|
||||
z-index: 1002 !important;
|
||||
background: $gradient-bg !important;
|
||||
border-bottom: 1px solid $border-color !important;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 30%) !important;
|
||||
color: #fff !important;
|
||||
opacity: 1 !important;
|
||||
pointer-events: auto !important;
|
||||
transform: translateY(0) !important;
|
||||
transition: opacity 0.25s ease-out, transform 0.25s ease-out !important;
|
||||
|
||||
&.chrome-hidden {
|
||||
opacity: 0 !important;
|
||||
pointer-events: none !important;
|
||||
transform: translateY(-100%) !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Style the annotation editor params toolbars (color picker, thickness, etc.)
|
||||
.editorParamsToolbar {
|
||||
position: fixed !important;
|
||||
top: $header-height !important;
|
||||
right: 8px !important;
|
||||
left: auto !important;
|
||||
z-index: 1003 !important;
|
||||
background: #2d2d2d !important;
|
||||
border: 1px solid $border-color !important;
|
||||
border-radius: 0 0 8px 8px !important;
|
||||
box-shadow: 0 4px 12px rgb(0 0 0 / 40%) !important;
|
||||
padding: 8px 12px !important;
|
||||
color: #fff !important;
|
||||
min-width: 180px !important;
|
||||
|
||||
.editorParamsToolbarContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.editorParamsLabel {
|
||||
color: $text-secondary !important;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
.editorParamsSetter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.editorParamsSlider {
|
||||
flex: 1;
|
||||
accent-color: $active-color;
|
||||
}
|
||||
|
||||
.editorParamsColor {
|
||||
border: 1px solid #555 !important;
|
||||
border-radius: 4px !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
// Highlight color picker dots
|
||||
.colorPicker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
button {
|
||||
width: 24px !important;
|
||||
height: 24px !important;
|
||||
min-width: 24px !important;
|
||||
border-radius: 50% !important;
|
||||
border: 2px solid transparent !important;
|
||||
padding: 0 !important;
|
||||
cursor: pointer !important;
|
||||
|
||||
&[aria-selected="true"],
|
||||
&.selected {
|
||||
border-color: #fff !important;
|
||||
box-shadow: 0 0 4px rgb(255 255 255 / 40%) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle button for "show all highlights"
|
||||
.toggle-button {
|
||||
background: #555 !important;
|
||||
border: none !important;
|
||||
border-radius: 12px !important;
|
||||
width: 36px !important;
|
||||
height: 20px !important;
|
||||
cursor: pointer !important;
|
||||
position: relative !important;
|
||||
|
||||
&[aria-pressed="true"] {
|
||||
background: $active-color !important;
|
||||
}
|
||||
}
|
||||
|
||||
.thicknessPicker {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.toggler {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 1px;
|
||||
background: $border-color;
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
// Generic button styling inside params toolbars
|
||||
button.secondaryToolbarButton,
|
||||
button.toolbarButton {
|
||||
background: none !important;
|
||||
color: #fff !important;
|
||||
border: none !important;
|
||||
border-radius: 6px !important;
|
||||
padding: 6px 10px !important;
|
||||
cursor: pointer !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 6px !important;
|
||||
width: 100% !important;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg !important;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Injected close button wrapper
|
||||
.custom-close-btn-wrapper {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
margin-bottom: 6px;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 10%);
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
// Injected close button
|
||||
.custom-close-btn {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
width: 34px !important;
|
||||
height: 34px !important;
|
||||
padding: 0 !important;
|
||||
background: transparent !important;
|
||||
border: none !important;
|
||||
border-radius: 4px !important;
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgb(239 68 68 / 20%) !important;
|
||||
color: #ef4444 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Style the secondary toolbar dropdown
|
||||
#secondaryToolbar {
|
||||
top: $header-height !important;
|
||||
background: #2d2d2d !important;
|
||||
border: 1px solid $border-color !important;
|
||||
border-radius: 0 0 8px 8px !important;
|
||||
box-shadow: 0 4px 16px rgb(0 0 0 / 40%) !important;
|
||||
padding: 4px !important;
|
||||
|
||||
button {
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
color: #fff !important;
|
||||
border-radius: 6px !important;
|
||||
padding: 8px 12px !important;
|
||||
font-size: 13px !important;
|
||||
width: 100% !important;
|
||||
text-align: left !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 8px !important;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg !important;
|
||||
}
|
||||
|
||||
&[aria-pressed="true"],
|
||||
&.toggled {
|
||||
color: $active-color !important;
|
||||
background: rgb(74 144 226 / 15%) !important;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Style the find bar
|
||||
#findbar {
|
||||
background: #2d2d2d !important;
|
||||
border: 1px solid $border-color !important;
|
||||
border-radius: 0 0 8px 8px !important;
|
||||
box-shadow: 0 4px 12px rgb(0 0 0 / 30%) !important;
|
||||
padding: 8px !important;
|
||||
top: 0 !important;
|
||||
|
||||
input {
|
||||
background: #404040 !important;
|
||||
color: #fff !important;
|
||||
border: 1px solid #555 !important;
|
||||
border-radius: 4px !important;
|
||||
padding: 4px 8px !important;
|
||||
}
|
||||
|
||||
button {
|
||||
background: none !important;
|
||||
color: #fff !important;
|
||||
border: none !important;
|
||||
border-radius: 4px !important;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg !important;
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
color: $text-secondary !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Style the sidebar
|
||||
#sidebarContainer {
|
||||
background: #1f1f1f !important;
|
||||
border-right: 1px solid $border-color !important;
|
||||
|
||||
#toolbarSidebar {
|
||||
background: #2d2d2d !important;
|
||||
border-bottom: 1px solid $border-color !important;
|
||||
|
||||
button {
|
||||
color: #fff !important;
|
||||
|
||||
&.toggled {
|
||||
color: $active-color !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#sidebarContent {
|
||||
background: #1f1f1f !important;
|
||||
}
|
||||
|
||||
.treeItem {
|
||||
color: #fff !important;
|
||||
|
||||
>a {
|
||||
color: #fff !important;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the default toolbar container chrome completely - our custom toolbar is positioned fixed
|
||||
#toolbarContainer {
|
||||
position: absolute !important;
|
||||
height: 0 !important;
|
||||
min-height: 0 !important;
|
||||
max-height: 0 !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Responsive ---
|
||||
|
||||
@media (width <= 768px) {
|
||||
.pdf-footer {
|
||||
height: auto;
|
||||
padding: 8px 12px;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.page-controls {
|
||||
order: -1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.goto-page {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.zoom-controls {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
::ng-deep pdf-zoom-toolbar {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.book-title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,40 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {NgxExtendedPdfViewerModule, NgxExtendedPdfViewerService, pdfDefaultOptions, ZoomType} from 'ngx-extended-pdf-viewer';
|
||||
import {PageTitleService} from "../../../shared/service/page-title.service";
|
||||
import {BookService} from '../../book/service/book.service';
|
||||
import {forkJoin, from, Subject, Subscription} from 'rxjs';
|
||||
import {debounceTime, map, switchMap} from 'rxjs/operators';
|
||||
import {BookSetting} from '../../book/model/book.model';
|
||||
import {UserService} from '../../settings/user-management/user.service';
|
||||
import {AuthService} from '../../../shared/service/auth.service';
|
||||
import {API_CONFIG} from '../../../core/config/api-config';
|
||||
import {PdfAnnotationService} from '../../../shared/service/pdf-annotation.service';
|
||||
import { Component, HostListener, inject, OnDestroy, OnInit, AfterViewInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { NgxExtendedPdfViewerModule, NgxExtendedPdfViewerService, pdfDefaultOptions, ZoomType } from 'ngx-extended-pdf-viewer';
|
||||
import { PageTitleService } from "../../../shared/service/page-title.service";
|
||||
import { BookService } from '../../book/service/book.service';
|
||||
import { forkJoin, from, Subject, Subscription } from 'rxjs';
|
||||
import { debounceTime, map, switchMap } from 'rxjs/operators';
|
||||
import { BookSetting } from '../../book/model/book.model';
|
||||
import { UserService } from '../../settings/user-management/user.service';
|
||||
import { AuthService } from '../../../shared/service/auth.service';
|
||||
import { API_CONFIG } from '../../../core/config/api-config';
|
||||
import { PdfAnnotationService } from '../../../shared/service/pdf-annotation.service';
|
||||
import { ReaderIconComponent } from '../../readers/ebook-reader/shared/icon.component';
|
||||
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {ReadingSessionService} from '../../../shared/service/reading-session.service';
|
||||
import {Location} from '@angular/common';
|
||||
import { ProgressSpinner } from 'primeng/progressspinner';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { TranslocoService, TranslocoPipe } from '@jsverse/transloco';
|
||||
import { ReadingSessionService } from '../../../shared/service/reading-session.service';
|
||||
import { WakeLockService } from '../../../shared/service/wake-lock.service';
|
||||
import { Location } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
interface SerializedPdfAnnotation extends Record<string, unknown> {
|
||||
id?: unknown;
|
||||
}
|
||||
type EmbedPdfMessage =
|
||||
| { type: 'ready' }
|
||||
| { type: 'documentOpened'; pageCount?: number }
|
||||
| { type: 'documentError'; error: string }
|
||||
| { type: 'saved'; buffer?: ArrayBuffer }
|
||||
| { type: 'saveError'; error: string };
|
||||
|
||||
@Component({
|
||||
selector: 'app-pdf-reader',
|
||||
standalone: true,
|
||||
imports: [NgxExtendedPdfViewerModule, ProgressSpinner, TranslocoPipe],
|
||||
imports: [NgxExtendedPdfViewerModule, ProgressSpinner, TranslocoPipe, ReaderIconComponent, FormsModule],
|
||||
templateUrl: './pdf-reader.component.html',
|
||||
styleUrl: './pdf-reader.component.scss',
|
||||
})
|
||||
export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
export class PdfReaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
constructor() {
|
||||
pdfDefaultOptions.rangeChunkSize = 512 * 1024;
|
||||
pdfDefaultOptions.disableAutoFetch = true;
|
||||
@@ -49,6 +55,32 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
bookData!: string;
|
||||
bookId!: number;
|
||||
bookFileId?: number;
|
||||
bookTitle = '';
|
||||
isFullscreen = false;
|
||||
viewerMode: 'book' | 'document' = 'book';
|
||||
private embedPdfIframe: HTMLIFrameElement | null = null;
|
||||
private embedPdfMessageHandler?: (e: MessageEvent) => void;
|
||||
private embedPdfSaveResolve?: (buffer: ArrayBuffer | null) => void;
|
||||
private embedPdfSaveTimer?: ReturnType<typeof setTimeout>;
|
||||
private embedPdfInitTime = 0;
|
||||
|
||||
// Auto-hide chrome
|
||||
headerVisible = true;
|
||||
footerVisible = true;
|
||||
private chromeAutoHideTimer?: ReturnType<typeof setTimeout>;
|
||||
private readonly CHROME_HIDE_DELAY = 3000;
|
||||
|
||||
// Footer page navigation
|
||||
goToPageInput: number | null = null;
|
||||
get sliderTicks(): number[] {
|
||||
if (this.totalPages <= 1) return [];
|
||||
const step = Math.max(1, Math.floor(this.totalPages / 10));
|
||||
const ticks: number[] = [];
|
||||
for (let i = 1; i <= this.totalPages; i += step) ticks.push(i);
|
||||
if (ticks[ticks.length - 1] !== this.totalPages) ticks.push(this.totalPages);
|
||||
return ticks;
|
||||
}
|
||||
|
||||
private altBookType?: string;
|
||||
private appSettingsSubscription!: Subscription;
|
||||
private annotationSaveSubject = new Subject<void>();
|
||||
@@ -66,8 +98,14 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
private pdfViewerService = inject(NgxExtendedPdfViewerService);
|
||||
private pdfAnnotationService = inject(PdfAnnotationService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private wakeLockService = inject(WakeLockService);
|
||||
private annotationToolbarObserver?: MutationObserver;
|
||||
|
||||
ngOnInit(): void {
|
||||
setTimeout(() => this.wakeLockService.enable(), 1000);
|
||||
this.startChromeAutoHide();
|
||||
document.addEventListener('fullscreenchange', this.onFullscreenChange);
|
||||
|
||||
this.annotationSaveSubscription = this.annotationSaveSubject
|
||||
.pipe(debounceTime(1500))
|
||||
.subscribe(() => this.persistAnnotations());
|
||||
@@ -90,39 +128,266 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
return forkJoin([
|
||||
this.bookService.getBookSetting(this.bookId, this.bookFileId!),
|
||||
this.userService.getMyself()
|
||||
]).pipe(map(([bookSetting, myself]) => ({book, bookSetting, myself})));
|
||||
]).pipe(map(([bookSetting, myself]) => ({ book, bookSetting, myself })));
|
||||
})
|
||||
);
|
||||
})
|
||||
).subscribe({
|
||||
next: ({book, bookSetting, myself}) => {
|
||||
const pdfMeta = book;
|
||||
const pdfPrefs = bookSetting;
|
||||
next: ({ book, bookSetting, myself }) => {
|
||||
const pdfMeta = book;
|
||||
const pdfPrefs = bookSetting;
|
||||
|
||||
this.pageTitle.setBookPageTitle(pdfMeta);
|
||||
this.pageTitle.setBookPageTitle(pdfMeta);
|
||||
this.bookTitle = pdfMeta.metadata?.title || '';
|
||||
|
||||
const globalOrIndividual = myself.userSettings.perBookSetting.pdf;
|
||||
if (globalOrIndividual === 'Global') {
|
||||
this.zoom = myself.userSettings.pdfReaderSetting.pageZoom || 'page-fit';
|
||||
this.spread = myself.userSettings.pdfReaderSetting.pageSpread || 'odd';
|
||||
} else {
|
||||
this.zoom = pdfPrefs.pdfSettings?.zoom || myself.userSettings.pdfReaderSetting.pageZoom || 'page-fit';
|
||||
this.spread = pdfPrefs.pdfSettings?.spread || myself.userSettings.pdfReaderSetting.pageSpread || 'odd';
|
||||
}
|
||||
this.canPrint = myself.permissions.canDownload || myself.permissions.admin;
|
||||
this.page = pdfMeta.pdfProgress?.page || 1;
|
||||
this.bookData = this.altBookType
|
||||
? `${API_CONFIG.BASE_URL}/api/v1/books/${this.bookId}/content?bookType=${this.altBookType}`
|
||||
: `${API_CONFIG.BASE_URL}/api/v1/books/${this.bookId}/content`;
|
||||
const token = this.authService.getInternalAccessToken();
|
||||
this.authorization = token ? `Bearer ${token}` : '';
|
||||
this.isLoading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({severity: 'error', summary: this.t.translate('common.error'), detail: this.t.translate('readerPdf.toast.failedToLoadBook')});
|
||||
this.isLoading = false;
|
||||
const globalOrIndividual = myself.userSettings.perBookSetting.pdf;
|
||||
if (globalOrIndividual === 'Global') {
|
||||
this.zoom = myself.userSettings.pdfReaderSetting.pageZoom || 'page-fit';
|
||||
this.spread = myself.userSettings.pdfReaderSetting.pageSpread || 'off';
|
||||
} else {
|
||||
this.zoom = pdfPrefs.pdfSettings?.zoom || myself.userSettings.pdfReaderSetting.pageZoom || 'page-fit';
|
||||
this.spread = pdfPrefs.pdfSettings?.spread || myself.userSettings.pdfReaderSetting.pageSpread || 'off';
|
||||
this.isDarkTheme = pdfPrefs.pdfSettings?.isDarkTheme ?? true;
|
||||
}
|
||||
this.canPrint = myself.permissions.canDownload || myself.permissions.admin;
|
||||
this.page = pdfMeta.pdfProgress?.page || 1;
|
||||
this.bookData = this.altBookType
|
||||
? `${API_CONFIG.BASE_URL}/api/v1/books/${this.bookId}/content?bookType=${this.altBookType}`
|
||||
: `${API_CONFIG.BASE_URL}/api/v1/books/${this.bookId}/content`;
|
||||
const token = this.authService.getInternalAccessToken();
|
||||
this.authorization = token ? `Bearer ${token}` : '';
|
||||
this.isLoading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({ severity: 'error', summary: this.t.translate('common.error'), detail: this.t.translate('readerPdf.toast.failedToLoadBook') });
|
||||
this.isLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.setupAnnotationToolbarCloseObserver();
|
||||
}
|
||||
|
||||
private setupAnnotationToolbarCloseObserver(): void {
|
||||
this.annotationToolbarObserver = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((node) => {
|
||||
if (node instanceof HTMLElement) {
|
||||
if (node.classList.contains('editorParamsToolbar')) {
|
||||
this.injectCloseButton(node);
|
||||
}
|
||||
const toolbars = node.querySelectorAll?.('.editorParamsToolbar');
|
||||
toolbars?.forEach(t => this.injectCloseButton(t as HTMLElement));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.annotationToolbarObserver.observe(document.body, { childList: true, subtree: true });
|
||||
|
||||
// Also check immediately in case they are already in the DOM
|
||||
setTimeout(() => {
|
||||
document.querySelectorAll('.editorParamsToolbar').forEach(t => this.injectCloseButton(t as HTMLElement));
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private injectCloseButton(toolbar: HTMLElement): void {
|
||||
if (toolbar.querySelector('.custom-close-btn-wrapper') || toolbar.querySelector('.custom-close-btn')) return;
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.className = 'custom-close-btn-wrapper';
|
||||
|
||||
const btn = document.createElement('button');
|
||||
btn.className = 'custom-close-btn icon-btn';
|
||||
btn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`;
|
||||
|
||||
// Attempt to translate, fallback to 'Close'
|
||||
try {
|
||||
btn.title = this.t.translate('common.close') || 'Close';
|
||||
} catch {
|
||||
btn.title = 'Close';
|
||||
}
|
||||
|
||||
btn.onclick = () => {
|
||||
// Dispatching ESC doesn't always work natively for pdf.js.
|
||||
// The most reliable way to close it is to click the tool that is currently active.
|
||||
const activeBtn = document.querySelector(`
|
||||
#editorHighlight.toggled,
|
||||
#editorFreeText.toggled,
|
||||
#editorInk.toggled,
|
||||
#editorStamp.toggled,
|
||||
.header-right button.toggled,
|
||||
.header-right button[aria-pressed="true"]
|
||||
`) as HTMLElement;
|
||||
|
||||
if (activeBtn) {
|
||||
activeBtn.click();
|
||||
} else {
|
||||
// Fallback: dispatch a custom event or switch to hand tool if the button isn't found
|
||||
const editorNone = document.querySelector('#editorNone') as HTMLElement;
|
||||
if (editorNone) {
|
||||
editorNone.click();
|
||||
} else {
|
||||
// Last resort: click outside
|
||||
document.body.click();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.appendChild(btn);
|
||||
toolbar.prepend(wrapper);
|
||||
}
|
||||
|
||||
async setViewerMode(mode: 'book' | 'document') {
|
||||
if (mode !== 'document' && this.embedPdfIframe) {
|
||||
await this.saveEmbedPdfDocument();
|
||||
await this.destroyEmbedPdf();
|
||||
}
|
||||
this.viewerMode = mode;
|
||||
if (mode === 'document') {
|
||||
// Pause the body-wide MutationObserver it causes massive lag when EmbedPDF mutates the DOM
|
||||
this.annotationToolbarObserver?.disconnect();
|
||||
setTimeout(() => this.initEmbedPdf(), 100);
|
||||
} else {
|
||||
// Re-enable it for book mode
|
||||
this.setupAnnotationToolbarCloseObserver();
|
||||
}
|
||||
}
|
||||
|
||||
private async initEmbedPdf() {
|
||||
if (this.embedPdfIframe) return;
|
||||
|
||||
const t0 = performance.now();
|
||||
this.embedPdfInitTime = t0;
|
||||
|
||||
try {
|
||||
const headers: Record<string, string> = {};
|
||||
if (this.authorization) {
|
||||
headers['Authorization'] = this.authorization;
|
||||
}
|
||||
|
||||
const response = await fetch(this.bookData, { headers, credentials: 'include' });
|
||||
if (!response.ok) throw new Error(`PDF fetch failed: ${response.status}`);
|
||||
|
||||
const pdfBuffer = await response.arrayBuffer();
|
||||
const targetEl = document.getElementById('embedpdf-viewer');
|
||||
if (!targetEl) throw new Error('#embedpdf-viewer not found');
|
||||
|
||||
// Create iframe — EmbedPDF + its WASM memory live entirely inside the iframe.
|
||||
// Destroying the iframe releases all WASM linear memory, solving the leak.
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.src = '/assets/embedpdf-frame.html';
|
||||
iframe.style.cssText = 'width:100%;height:100%;border:none;';
|
||||
iframe.setAttribute('allow', 'fullscreen');
|
||||
|
||||
// Listen for messages from the iframe
|
||||
this.embedPdfMessageHandler = (e: MessageEvent) => {
|
||||
if (e.origin !== location.origin) return;
|
||||
if (e.source !== iframe.contentWindow) return;
|
||||
this.handleEmbedPdfMessage(e.data);
|
||||
};
|
||||
window.addEventListener('message', this.embedPdfMessageHandler);
|
||||
|
||||
// Wait for iframe to load before sending PDF data
|
||||
await new Promise<void>((resolve) => {
|
||||
iframe.onload = () => resolve();
|
||||
targetEl.appendChild(iframe);
|
||||
});
|
||||
|
||||
this.embedPdfIframe = iframe;
|
||||
|
||||
// Transfer the PDF buffer to the iframe (zero-copy via Transferable)
|
||||
iframe.contentWindow!.postMessage({
|
||||
type: 'init',
|
||||
buffer: pdfBuffer,
|
||||
wasmUrl: '/assets/pdfium/pdfium.wasm',
|
||||
theme: this.isDarkTheme ? 'dark' : 'light'
|
||||
}, location.origin, [pdfBuffer]);
|
||||
|
||||
} catch (err) {
|
||||
console.error('[EmbedPDF] FATAL:', err);
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: this.t.translate('common.error'),
|
||||
detail: 'Failed to load Document Viewer. Check browser console for details.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Handle postMessage events from the EmbedPDF iframe */
|
||||
private handleEmbedPdfMessage(msg: EmbedPdfMessage): void {
|
||||
switch (msg.type) {
|
||||
case 'ready':
|
||||
break;
|
||||
case 'documentOpened':
|
||||
break;
|
||||
case 'documentError':
|
||||
console.error('[EmbedPDF] Document error:', msg.error);
|
||||
break;
|
||||
case 'saved':
|
||||
this.embedPdfSaveResolve?.(msg.buffer ?? null);
|
||||
this.embedPdfSaveResolve = undefined;
|
||||
break;
|
||||
case 'saveError':
|
||||
console.error('[EmbedPDF] Save error:', msg.error);
|
||||
this.embedPdfSaveResolve?.(null);
|
||||
this.embedPdfSaveResolve = undefined;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async saveEmbedPdfDocument(): Promise<void> {
|
||||
if (!this.embedPdfIframe?.contentWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Request save from iframe and wait for response
|
||||
const buffer: ArrayBuffer | null = await new Promise((resolve) => {
|
||||
this.embedPdfSaveResolve = resolve;
|
||||
this.embedPdfIframe!.contentWindow!.postMessage({ type: 'save' }, location.origin);
|
||||
// Timeout after 30 seconds
|
||||
const timer = setTimeout(() => {
|
||||
if (this.embedPdfSaveResolve === resolve) {
|
||||
resolve(null);
|
||||
this.embedPdfSaveResolve = undefined;
|
||||
}
|
||||
}, 30000);
|
||||
// Store timer so we can clear it on success
|
||||
this.embedPdfSaveTimer = timer;
|
||||
});
|
||||
|
||||
if (this.embedPdfSaveTimer) {
|
||||
clearTimeout(this.embedPdfSaveTimer);
|
||||
this.embedPdfSaveTimer = undefined;
|
||||
}
|
||||
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const headers: Record<string, string> = { 'Content-Type': 'application/pdf' };
|
||||
if (this.authorization) {
|
||||
headers['Authorization'] = this.authorization;
|
||||
}
|
||||
|
||||
const url = this.altBookType
|
||||
? `${API_CONFIG.BASE_URL}/api/v1/books/${this.bookId}/content?bookType=${this.altBookType}`
|
||||
: `${API_CONFIG.BASE_URL}/api/v1/books/${this.bookId}/content`;
|
||||
|
||||
const uploadResponse = await fetch(url, {
|
||||
method: 'PUT',
|
||||
headers,
|
||||
credentials: 'include',
|
||||
body: buffer
|
||||
});
|
||||
if (!uploadResponse.ok) {
|
||||
console.error('[EmbedPDF] Upload failed:', uploadResponse.status);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[EmbedPDF] Failed to save document:', err);
|
||||
}
|
||||
}
|
||||
|
||||
onPageChange(page: number): void {
|
||||
@@ -148,11 +413,24 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
toggleDarkTheme(): void {
|
||||
this.isDarkTheme = !this.isDarkTheme;
|
||||
this.updateViewerSetting();
|
||||
// Sync EmbedPDF theme if active
|
||||
if (this.embedPdfIframe?.contentWindow) {
|
||||
this.embedPdfIframe.contentWindow.postMessage(
|
||||
{ type: 'setTheme', theme: this.isDarkTheme ? 'dark' : 'light' },
|
||||
location.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private updateViewerSetting(): void {
|
||||
const bookSetting: BookSetting = {
|
||||
pdfSettings: {
|
||||
spread: this.spread,
|
||||
zoom: this.zoom,
|
||||
isDarkTheme: this.isDarkTheme,
|
||||
}
|
||||
}
|
||||
this.bookService.updateViewerSetting(bookSetting, this.bookId).subscribe();
|
||||
@@ -168,7 +446,8 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
const percentage = this.totalPages > 0 ? Math.round((this.page / this.totalPages) * 1000) / 10 : 0;
|
||||
this.readingSessionService.startSession(this.bookId, "PDF", this.page.toString(), percentage);
|
||||
this.readingSessionService.updateProgress(this.page.toString(), percentage);
|
||||
this.loadAnnotations();
|
||||
// Delay annotation loading to ensure annotation editor layers are initialized
|
||||
setTimeout(() => this.loadAnnotations(), 800);
|
||||
}
|
||||
|
||||
onAnnotationEditorEvent(): void {
|
||||
@@ -178,6 +457,9 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.wakeLockService.disable();
|
||||
if (this.chromeAutoHideTimer) clearTimeout(this.chromeAutoHideTimer);
|
||||
if (this.annotationToolbarObserver) this.annotationToolbarObserver.disconnect();
|
||||
if (this.readingSessionService.isSessionActive()) {
|
||||
const percentage = this.totalPages > 0 ? Math.round((this.page / this.totalPages) * 1000) / 10 : 0;
|
||||
this.readingSessionService.endSession(this.page.toString(), percentage);
|
||||
@@ -185,14 +467,117 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.annotationSaveSubscription?.unsubscribe();
|
||||
this.persistAnnotations();
|
||||
this.destroyEmbedPdf();
|
||||
|
||||
if (this.appSettingsSubscription) {
|
||||
this.appSettingsSubscription.unsubscribe();
|
||||
}
|
||||
this.updateProgress();
|
||||
document.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
||||
}
|
||||
|
||||
closeReader = (): void => {
|
||||
// --- Chrome auto-hide ---
|
||||
|
||||
@HostListener('document:mousemove')
|
||||
onMouseMove(): void {
|
||||
this.showChrome();
|
||||
this.startChromeAutoHide();
|
||||
}
|
||||
|
||||
showChrome(): void {
|
||||
this.headerVisible = true;
|
||||
this.footerVisible = true;
|
||||
}
|
||||
|
||||
hideChrome(): void {
|
||||
this.headerVisible = false;
|
||||
this.footerVisible = false;
|
||||
}
|
||||
|
||||
private startChromeAutoHide(): void {
|
||||
if (this.chromeAutoHideTimer) clearTimeout(this.chromeAutoHideTimer);
|
||||
this.chromeAutoHideTimer = setTimeout(() => this.hideChrome(), this.CHROME_HIDE_DELAY);
|
||||
}
|
||||
|
||||
onHeaderTriggerZoneEnter(): void {
|
||||
this.headerVisible = true;
|
||||
this.startChromeAutoHide();
|
||||
}
|
||||
|
||||
onFooterTriggerZoneEnter(): void {
|
||||
this.footerVisible = true;
|
||||
this.startChromeAutoHide();
|
||||
}
|
||||
|
||||
// --- Fullscreen ---
|
||||
|
||||
toggleFullscreen(): void {
|
||||
if (!document.fullscreenElement) {
|
||||
document.documentElement.requestFullscreen?.();
|
||||
} else {
|
||||
document.exitFullscreen?.();
|
||||
}
|
||||
}
|
||||
|
||||
private onFullscreenChange = (): void => {
|
||||
this.isFullscreen = !!document.fullscreenElement;
|
||||
};
|
||||
|
||||
// --- Footer page navigation ---
|
||||
|
||||
goToFirstPage(): void {
|
||||
this.page = 1;
|
||||
this.onPageChange(1);
|
||||
}
|
||||
|
||||
goToPreviousPage(): void {
|
||||
if (this.page > 1) {
|
||||
const p = this.page - 1;
|
||||
this.page = p;
|
||||
this.onPageChange(p);
|
||||
}
|
||||
}
|
||||
|
||||
goToNextPage(): void {
|
||||
if (this.page < this.totalPages) {
|
||||
const p = this.page + 1;
|
||||
this.page = p;
|
||||
this.onPageChange(p);
|
||||
}
|
||||
}
|
||||
|
||||
goToLastPage(): void {
|
||||
this.page = this.totalPages;
|
||||
this.onPageChange(this.totalPages);
|
||||
}
|
||||
|
||||
onSliderChange(event: Event): void {
|
||||
const value = +(event.target as HTMLInputElement).value;
|
||||
this.page = value;
|
||||
this.onPageChange(value);
|
||||
}
|
||||
|
||||
onGoToPage(): void {
|
||||
if (this.goToPageInput && this.goToPageInput >= 1 && this.goToPageInput <= this.totalPages) {
|
||||
this.page = this.goToPageInput;
|
||||
this.onPageChange(this.goToPageInput);
|
||||
this.goToPageInput = null;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Rotation ---
|
||||
|
||||
rotateClockwise(): void {
|
||||
this.rotation = ((this.rotation + 90) % 360) as 0 | 90 | 180 | 270;
|
||||
}
|
||||
|
||||
closeReader = async (): Promise<void> => {
|
||||
if (this.embedPdfIframe) {
|
||||
await this.saveEmbedPdfDocument();
|
||||
await this.destroyEmbedPdf();
|
||||
} else {
|
||||
this.persistAnnotations();
|
||||
}
|
||||
if (this.readingSessionService.isSessionActive()) {
|
||||
const percentage = this.totalPages > 0 ? Math.round((this.page / this.totalPages) * 1000) / 10 : 0;
|
||||
this.readingSessionService.endSession(this.page.toString(), percentage);
|
||||
@@ -202,11 +587,17 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
|
||||
private loadAnnotations(): void {
|
||||
this.pdfAnnotationService.getAnnotations(this.bookId).subscribe({
|
||||
next: (response) => {
|
||||
next: async (response) => {
|
||||
if (response?.data) {
|
||||
const annotations = JSON.parse(response.data);
|
||||
for (const annotation of annotations) {
|
||||
this.pdfViewerService.addEditorAnnotation(annotation);
|
||||
try {
|
||||
const annotations = JSON.parse(response.data);
|
||||
if (Array.isArray(annotations)) {
|
||||
for (const annotation of annotations) {
|
||||
await this.pdfViewerService.addEditorAnnotation(annotation);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[PDF Annotations] Failed to load annotations:', e);
|
||||
}
|
||||
}
|
||||
this.annotationsLoaded = true;
|
||||
@@ -217,19 +608,45 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
private async destroyEmbedPdf(): Promise<void> {
|
||||
|
||||
|
||||
// Remove message listener
|
||||
if (this.embedPdfMessageHandler) {
|
||||
window.removeEventListener('message', this.embedPdfMessageHandler);
|
||||
this.embedPdfMessageHandler = undefined;
|
||||
}
|
||||
|
||||
// Cancel any pending save
|
||||
if (this.embedPdfSaveTimer) {
|
||||
clearTimeout(this.embedPdfSaveTimer);
|
||||
this.embedPdfSaveTimer = undefined;
|
||||
}
|
||||
this.embedPdfSaveResolve?.(null);
|
||||
this.embedPdfSaveResolve = undefined;
|
||||
|
||||
// Remove the iframe — this destroys the entire browsing context,
|
||||
// freeing all WASM linear memory, JS heap, and DOM within it.
|
||||
if (this.embedPdfIframe) {
|
||||
this.embedPdfIframe.remove();
|
||||
this.embedPdfIframe = null;
|
||||
}
|
||||
|
||||
this.embedPdfInitTime = 0;
|
||||
}
|
||||
|
||||
private persistAnnotations(): void {
|
||||
if (!this.annotationsLoaded || !this.bookId) {
|
||||
if (!this.annotationsLoaded || !this.bookId || this.viewerMode === 'document') {
|
||||
return;
|
||||
}
|
||||
const serialized = this.pdfViewerService.getSerializedAnnotations();
|
||||
if (serialized && serialized.length > 0) {
|
||||
const cleaned = serialized.map((annotation: SerializedPdfAnnotation) => {
|
||||
const {id, ...rest} = annotation;
|
||||
void id;
|
||||
return rest;
|
||||
});
|
||||
const data = JSON.stringify(cleaned);
|
||||
this.pdfAnnotationService.saveAnnotations(this.bookId, data).subscribe();
|
||||
try {
|
||||
const serialized = this.pdfViewerService.getSerializedAnnotations();
|
||||
if (serialized && serialized.length > 0) {
|
||||
const data = JSON.stringify(serialized);
|
||||
this.pdfAnnotationService.saveAnnotations(this.bookId, data).subscribe();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[PDF Annotations] Failed to save annotations:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -48,7 +48,8 @@ export class CbxReaderPreferencesComponent {
|
||||
|
||||
readonly cbxScrollModes = [
|
||||
{name: 'Paginated', key: CbxScrollMode.PAGINATED, icon: 'pi pi-book', translationKey: 'paginated'},
|
||||
{name: 'Infinite', key: CbxScrollMode.INFINITE, icon: 'pi pi-sort-alt', translationKey: 'infinite'}
|
||||
{name: 'Infinite', key: CbxScrollMode.INFINITE, icon: 'pi pi-sort-alt', translationKey: 'infinite'},
|
||||
{name: 'Long Strip', key: CbxScrollMode.LONG_STRIP, icon: 'pi pi-bars', translationKey: 'longStrip'}
|
||||
];
|
||||
|
||||
readonly cbxBackgroundColors = [
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {computed, effect, inject, Injectable} from '@angular/core';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {lastValueFrom, Observable, throwError} from 'rxjs';
|
||||
import {API_CONFIG} from '../../../core/config/api-config';
|
||||
import {Library} from '../../book/model/library.model';
|
||||
import {catchError, map, tap} from 'rxjs/operators';
|
||||
import {AuthService} from '../../../shared/service/auth.service';
|
||||
import {DashboardConfig} from '../../dashboard/models/dashboard-config.model';
|
||||
import {injectQuery, queryOptions, QueryClient} from '@tanstack/angular-query-experimental';
|
||||
import {CURRENT_USER_QUERY_KEY} from './user-query-keys';
|
||||
import { computed, effect, inject, Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { lastValueFrom, Observable, throwError } from 'rxjs';
|
||||
import { API_CONFIG } from '../../../core/config/api-config';
|
||||
import { Library } from '../../book/model/library.model';
|
||||
import { catchError, map, tap } from 'rxjs/operators';
|
||||
import { AuthService } from '../../../shared/service/auth.service';
|
||||
import { DashboardConfig } from '../../dashboard/models/dashboard-config.model';
|
||||
import { injectQuery, queryOptions, QueryClient } from '@tanstack/angular-query-experimental';
|
||||
import { CURRENT_USER_QUERY_KEY } from './user-query-keys';
|
||||
|
||||
export interface EntityViewPreferences {
|
||||
global: EntityViewPreference;
|
||||
@@ -64,6 +64,14 @@ export type BookFilterMode = 'and' | 'or' | 'single' | 'not';
|
||||
export enum CbxPageViewMode {
|
||||
SINGLE_PAGE = 'SINGLE_PAGE',
|
||||
TWO_PAGE = 'TWO_PAGE',
|
||||
TWO_PAGE_REVERSED = 'TWO_PAGE_REVERSED',
|
||||
}
|
||||
|
||||
export enum CbxPageSplitOption {
|
||||
NO_SPLIT = 'NO_SPLIT',
|
||||
FIT_SPLIT = 'FIT_SPLIT',
|
||||
SPLIT_LEFT_TO_RIGHT = 'SPLIT_LEFT_TO_RIGHT',
|
||||
SPLIT_RIGHT_TO_LEFT = 'SPLIT_RIGHT_TO_LEFT',
|
||||
}
|
||||
|
||||
export enum CbxPageSpread {
|
||||
@@ -197,6 +205,11 @@ export interface CbxReaderSetting {
|
||||
backgroundColor?: CbxBackgroundColor;
|
||||
readingDirection?: CbxReadingDirection;
|
||||
slideshowInterval?: CbxSlideshowInterval;
|
||||
pageSplitOption?: CbxPageSplitOption;
|
||||
brightness?: number;
|
||||
emulateBook?: boolean;
|
||||
clickToPaginate?: boolean;
|
||||
autoCloseMenu?: boolean;
|
||||
}
|
||||
|
||||
export interface TableColumnPreference {
|
||||
@@ -231,33 +244,33 @@ export const ALL_FILTER_OPTION_VALUES: VisibleFilterType[] = [
|
||||
];
|
||||
|
||||
export const ALL_FILTER_OPTIONS: { label: string; value: VisibleFilterType }[] = [
|
||||
{label: 'Author', value: 'author'},
|
||||
{label: 'Genre', value: 'category'},
|
||||
{label: 'Series', value: 'series'},
|
||||
{label: 'Book Type', value: 'bookType'},
|
||||
{label: 'Read Status', value: 'readStatus'},
|
||||
{label: 'Personal Rating', value: 'personalRating'},
|
||||
{label: 'Library', value: 'library'},
|
||||
{label: 'Tag', value: 'tag'},
|
||||
{label: 'Age Rating', value: 'ageRating'},
|
||||
{label: 'Content Rating', value: 'contentRating'},
|
||||
{label: 'Metadata Match Score', value: 'matchScore'},
|
||||
{label: 'Publisher', value: 'publisher'},
|
||||
{label: 'Published Year', value: 'publishedDate'},
|
||||
{label: 'File Size', value: 'fileSize'},
|
||||
{label: 'Shelf', value: 'shelf'},
|
||||
{label: 'Shelf Status', value: 'shelfStatus'},
|
||||
{label: 'Language', value: 'language'},
|
||||
{label: 'Page Count', value: 'pageCount'},
|
||||
{label: 'Mood', value: 'mood'},
|
||||
{label: 'Amazon Rating', value: 'amazonRating'},
|
||||
{label: 'Goodreads Rating', value: 'goodreadsRating'},
|
||||
{label: 'Hardcover Rating', value: 'hardcoverRating'},
|
||||
{label: 'Narrator', value: 'narrator'},
|
||||
{label: 'Comic Character', value: 'comicCharacter'},
|
||||
{label: 'Comic Team', value: 'comicTeam'},
|
||||
{label: 'Comic Location', value: 'comicLocation'},
|
||||
{label: 'Comic Creator', value: 'comicCreator'}
|
||||
{ label: 'Author', value: 'author' },
|
||||
{ label: 'Genre', value: 'category' },
|
||||
{ label: 'Series', value: 'series' },
|
||||
{ label: 'Book Type', value: 'bookType' },
|
||||
{ label: 'Read Status', value: 'readStatus' },
|
||||
{ label: 'Personal Rating', value: 'personalRating' },
|
||||
{ label: 'Library', value: 'library' },
|
||||
{ label: 'Tag', value: 'tag' },
|
||||
{ label: 'Age Rating', value: 'ageRating' },
|
||||
{ label: 'Content Rating', value: 'contentRating' },
|
||||
{ label: 'Metadata Match Score', value: 'matchScore' },
|
||||
{ label: 'Publisher', value: 'publisher' },
|
||||
{ label: 'Published Year', value: 'publishedDate' },
|
||||
{ label: 'File Size', value: 'fileSize' },
|
||||
{ label: 'Shelf', value: 'shelf' },
|
||||
{ label: 'Shelf Status', value: 'shelfStatus' },
|
||||
{ label: 'Language', value: 'language' },
|
||||
{ label: 'Page Count', value: 'pageCount' },
|
||||
{ label: 'Mood', value: 'mood' },
|
||||
{ label: 'Amazon Rating', value: 'amazonRating' },
|
||||
{ label: 'Goodreads Rating', value: 'goodreadsRating' },
|
||||
{ label: 'Hardcover Rating', value: 'hardcoverRating' },
|
||||
{ label: 'Narrator', value: 'narrator' },
|
||||
{ label: 'Comic Character', value: 'comicCharacter' },
|
||||
{ label: 'Comic Team', value: 'comicTeam' },
|
||||
{ label: 'Comic Location', value: 'comicLocation' },
|
||||
{ label: 'Comic Creator', value: 'comicCreator' }
|
||||
];
|
||||
|
||||
export const DEFAULT_VISIBLE_SORT_FIELDS: string[] = [
|
||||
@@ -374,7 +387,7 @@ export class UserService {
|
||||
effect(() => {
|
||||
const token = this.token();
|
||||
if (token === null) {
|
||||
this.queryClient.removeQueries({queryKey: CURRENT_USER_QUERY_KEY});
|
||||
this.queryClient.removeQueries({ queryKey: CURRENT_USER_QUERY_KEY });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -457,13 +470,13 @@ export class UserService {
|
||||
value
|
||||
};
|
||||
this.http.put<void>(`${this.userUrl}/${userId}/settings`, payload, {
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
responseType: 'text' as 'json'
|
||||
}).subscribe(() => {
|
||||
const currentUser = this.currentUser();
|
||||
if (currentUser) {
|
||||
const updatedSettings = {...currentUser.userSettings, [key]: value};
|
||||
const updatedUser = {...currentUser, userSettings: updatedSettings};
|
||||
const updatedSettings = { ...currentUser.userSettings, [key]: value };
|
||||
const updatedUser = { ...currentUser, userSettings: updatedSettings };
|
||||
this.queryClient.setQueryData(CURRENT_USER_QUERY_KEY, updatedUser);
|
||||
}
|
||||
});
|
||||
@@ -483,7 +496,7 @@ export class UserService {
|
||||
|
||||
private serializeUserPayload<T extends object>(payload: T): T {
|
||||
const payloadRecord = payload as Record<string, unknown>;
|
||||
const nextPayload: Record<string, unknown> = {...payloadRecord};
|
||||
const nextPayload: Record<string, unknown> = { ...payloadRecord };
|
||||
|
||||
if ('permissions' in payloadRecord && payloadRecord['permissions'] && typeof payloadRecord['permissions'] === 'object') {
|
||||
const permissions = payloadRecord['permissions'] as User['permissions'];
|
||||
|
||||
+206
-267
@@ -1,8 +1,8 @@
|
||||
<ng-container *transloco="let t; prefix: 'layout.topbar'">
|
||||
<div class="layout-topbar">
|
||||
<div class="layout-topbar">
|
||||
|
||||
<a class="layout-topbar-logo topbar-logo" routerLink="">
|
||||
<!--
|
||||
<a class="layout-topbar-logo topbar-logo" routerLink="">
|
||||
<!--
|
||||
<svg class="logo-icon half-title" viewBox="0 0 126 126" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M59 4.79297C71.5051 11.5557 80 24.7854 80 40C80 40.5959 79.987 41.1888 79.9609 41.7783C79.8609 44.0406 81.7355 46 84 46C106.091 46 124 63.9086 124 86C124 108.091 106.091 126 84 126H10C4.47715 126 0 121.523 0 116V39.0068L0.0126953 38.9941C0.357624 25.0252 7.86506 12.8347 19 5.95215V63.832C19 64.8345 20.0676 65.4391 20.9121 64.9902L21.0771 64.8867L38.2227 52.3428C38.6819 52.0068 39.3064 52.0068 39.7656 52.3428L56.9229 64.8945L57.0879 64.998C57.9324 65.447 59 64.8423 59 63.8398V4.79297Z"/>
|
||||
@@ -11,299 +11,238 @@
|
||||
fill="white"/>
|
||||
</svg>
|
||||
-->
|
||||
<span class="logo-text">Grimmory</span>
|
||||
</a>
|
||||
<span class="logo-text">Grimmory</span>
|
||||
</a>
|
||||
|
||||
<p-button
|
||||
class="layout-menu-button"
|
||||
#menubutton
|
||||
icon="pi pi-bars"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
(click)="toggleMenu()"
|
||||
[ngClass]="{ 'rotate-right': !isMenuVisible, 'rotate-left': isMenuVisible }"
|
||||
>
|
||||
</p-button>
|
||||
<p-button class="layout-menu-button" #menubutton icon="pi pi-bars" [rounded]="true" [outlined]="true"
|
||||
(click)="toggleMenu()" [ngClass]="{ 'rotate-right': !isMenuVisible, 'rotate-left': isMenuVisible }">
|
||||
</p-button>
|
||||
|
||||
<div class="topbar-content">
|
||||
<app-book-searcher class="topbar-search"></app-book-searcher>
|
||||
<ul class="topbar-items topbar-desktop-items">
|
||||
<div class="topbar-action-group">
|
||||
@if (user(); as currentUser) {
|
||||
<div class="topbar-content">
|
||||
<app-book-searcher class="topbar-search"></app-book-searcher>
|
||||
<ul class="topbar-items topbar-desktop-items">
|
||||
<div class="topbar-action-group">
|
||||
@if (user(); as currentUser) {
|
||||
@if (currentUser.permissions?.canAccessBookdrop || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="navigateToBookdrop()" (keydown.enter)="navigateToBookdrop()" [pTooltip]="t('bookdrop')" tooltipPosition="bottom">
|
||||
<i class="pi pi-inbox topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="navigateToBookdrop()"
|
||||
(keydown.enter)="navigateToBookdrop()" [pTooltip]="t('bookdrop')" tooltipPosition="bottom">
|
||||
<i class="pi pi-inbox topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="openLibraryCreatorDialog()" (keydown.enter)="openLibraryCreatorDialog()" [pTooltip]="t('createNewLibrary')" tooltipPosition="bottom">
|
||||
<i class="pi pi-plus-circle topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="openLibraryCreatorDialog()"
|
||||
(keydown.enter)="openLibraryCreatorDialog()" [pTooltip]="t('createNewLibrary')" tooltipPosition="bottom">
|
||||
<i class="pi pi-plus-circle topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canUpload || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="openFileUploadDialog()" (keydown.enter)="openFileUploadDialog()" [pTooltip]="t('uploadBook')" tooltipPosition="bottom">
|
||||
<i class="pi pi-upload topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
@if (hasStatsAccess) {
|
||||
<li>
|
||||
<button
|
||||
class="topbar-item"
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="openFileUploadDialog()"
|
||||
(keydown.enter)="openFileUploadDialog()" [pTooltip]="t('uploadBook')" tooltipPosition="bottom">
|
||||
<i class="pi pi-upload topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
@if (hasStatsAccess) {
|
||||
<li>
|
||||
<button class="topbar-item"
|
||||
(click)="shouldShowStatsMenu ? statsMenu?.toggle($event) : handleStatsButtonClick($event)"
|
||||
[pTooltip]="statsTooltip"
|
||||
tooltipPosition="bottom">
|
||||
<svg class="multi-color-chart-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 1.25rem; height: 1.25rem;">
|
||||
<rect x="2" y="13" width="4" height="9" rx="1" fill="#ef4444"/>
|
||||
<rect x="7.5" y="3" width="4" height="19" rx="1" fill="#f59e0b"/>
|
||||
<rect x="13" y="9" width="4" height="13" rx="1" fill="#3b82f6"/>
|
||||
<rect x="18.5" y="5" width="4" height="17" rx="1" fill="#10b981"/>
|
||||
[pTooltip]="statsTooltip" tooltipPosition="bottom">
|
||||
<svg class="multi-color-chart-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"
|
||||
style="width: 1.25rem; height: 1.25rem;">
|
||||
<rect x="2" y="13" width="4" height="9" rx="1" fill="#ef4444" />
|
||||
<rect x="7.5" y="3" width="4" height="19" rx="1" fill="#f59e0b" />
|
||||
<rect x="13" y="9" width="4" height="13" rx="1" fill="#3b82f6" />
|
||||
<rect x="18.5" y="5" width="4" height="17" rx="1" fill="#10b981" />
|
||||
</svg>
|
||||
</button>
|
||||
@if (shouldShowStatsMenu) {
|
||||
<p-menu #statsMenu [model]="statsMenuItems" [popup]="true" appendTo="body"/>
|
||||
<p-menu #statsMenu [model]="statsMenuItems" [popup]="true" appendTo="body" />
|
||||
}
|
||||
</li>
|
||||
}
|
||||
@if (user(); as currentUser) {
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="navigateToMetadataManager()" (keydown.enter)="navigateToMetadataManager()" [pTooltip]="t('metadataManager')" tooltipPosition="bottom">
|
||||
<i class="pi pi-sparkles topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
<li>
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="navigateToSettings()" (keydown.enter)="navigateToSettings()" [pTooltip]="t('settings')" tooltipPosition="bottom">
|
||||
<i class="pi pi-cog topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
<p-divider layout="vertical"/>
|
||||
|
||||
|
||||
<div class="topbar-action-group">
|
||||
<li class="topbar-item-relative">
|
||||
<button
|
||||
type="button"
|
||||
class="topbar-item"
|
||||
(click)="notificationPopover.toggle($event)"
|
||||
>
|
||||
<i
|
||||
class="pi"
|
||||
[ngClass]="iconClass"
|
||||
[ngStyle]="{ color: iconColor }"
|
||||
style="font-size: 1.25rem"
|
||||
[class.pulsating]="iconPulsating"
|
||||
[attr.aria-label]="t('notificationAriaLabel')"
|
||||
></i>
|
||||
</button>
|
||||
|
||||
@if (shouldShowNotificationBadge) {
|
||||
<span class="notification-badge">{{ completedTaskCount }}</span>
|
||||
}
|
||||
|
||||
<p-popover #notificationPopover>
|
||||
<app-unified-notification-popover-component></app-unified-notification-popover-component>
|
||||
</p-popover>
|
||||
</li>
|
||||
|
||||
<li class="topbar-item-relative">
|
||||
<button
|
||||
type="button"
|
||||
class="topbar-item"
|
||||
(click)="langMenu.toggle($event)"
|
||||
[pTooltip]="t('language')"
|
||||
tooltipPosition="bottom">
|
||||
<i class="pi pi-language topbar-icon"></i>
|
||||
</button>
|
||||
<p-menu #langMenu [model]="langMenuItems" [popup]="true" appendTo="body"/>
|
||||
</li>
|
||||
<li class="topbar-item-relative">
|
||||
<button type="button"
|
||||
class="topbar-item config-item"
|
||||
enterActiveClass="animate-scalein"
|
||||
enterFromClass="hidden"
|
||||
leaveActiveClass="animate-fadeout"
|
||||
leaveToClass="hidden"
|
||||
pStyleClass="@next" [hideOnOutsideClick]="true">
|
||||
<i class="pi pi-palette"></i>
|
||||
</button>
|
||||
<app-theme-configurator></app-theme-configurator>
|
||||
</li>
|
||||
</div>
|
||||
<p-divider layout="vertical"/>
|
||||
<div class="topbar-action-group">
|
||||
<li>
|
||||
<a class="topbar-item"
|
||||
href="https://grimmory.org/docs/getting-started"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="t('documentation')"
|
||||
tooltipPosition="bottom">
|
||||
<i class="pi pi-info-circle topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Show Profile only to non-demo users -->
|
||||
@if (user(); as currentUser) {
|
||||
@if (!currentUser.permissions?.demoUser) {
|
||||
<li>
|
||||
<button class="topbar-item" (click)="openUserProfileDialog()" [pTooltip]="t('profile')" tooltipPosition="bottom">
|
||||
<i class="pi pi-user topbar-icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
|
||||
<li>
|
||||
<button class="topbar-item" (click)="logout()" [pTooltip]="t('logout')" tooltipPosition="left">
|
||||
<i class="pi pi-sign-out topbar-icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
<!-- Trigger Button -->
|
||||
<div class="mobile-trigger">
|
||||
<p-button
|
||||
icon="pi pi-ellipsis-v"
|
||||
outlined
|
||||
(click)="mobileMenu.toggle($event)"
|
||||
/>
|
||||
<p-popover #mobileMenu>
|
||||
<ul class="mobile-menu-list">
|
||||
@if (user(); as currentUser) {
|
||||
@if (currentUser.permissions?.canAccessBookdrop || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="navigateToBookdrop(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-inbox topbar-icon"></i>
|
||||
{{ t('bookdrop') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="openLibraryCreatorDialog(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-plus-circle topbar-icon"></i>
|
||||
{{ t('createLibrary') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canUpload || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="openFileUploadDialog(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-upload topbar-icon"></i>
|
||||
{{ t('uploadBook') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canAccessLibraryStats || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="navigateToStats(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-chart-line topbar-icon"></i>
|
||||
{{ t('libraryStats') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canAccessUserStats || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="navigateToUserStats(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-users topbar-icon"></i>
|
||||
{{ t('readingStats') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="navigateToMetadataManager(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-sparkles topbar-icon"></i>
|
||||
{{ t('metadataManager') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="navigateToSettings(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-cog topbar-icon"></i>
|
||||
{{ t('settings') }}
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="mobile-menu-item"
|
||||
href="https://grimmory.org/docs/getting-started"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
<i class="pi pi-info-circle topbar-icon"></i>
|
||||
{{ t('documentation') }}
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="navigateToMetadataManager()"
|
||||
(keydown.enter)="navigateToMetadataManager()" [pTooltip]="t('metadataManager')" tooltipPosition="bottom">
|
||||
<i class="pi pi-sparkles topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="langMenuMobile.toggle($event)"
|
||||
>
|
||||
<i class="pi pi-language topbar-icon"></i>
|
||||
{{ t('language') }}
|
||||
<a class="topbar-item" role="button" tabindex="0" (click)="navigateToSettings()"
|
||||
(keydown.enter)="navigateToSettings()" [pTooltip]="t('settings')" tooltipPosition="bottom">
|
||||
<i class="pi pi-cog topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
<p-divider layout="vertical" />
|
||||
|
||||
|
||||
<div class="topbar-action-group">
|
||||
<li class="topbar-item-relative">
|
||||
<button type="button" class="topbar-item" (click)="notificationPopover.toggle($event)">
|
||||
<i class="pi" [ngClass]="iconClass" [ngStyle]="{ color: iconColor }" style="font-size: 1.25rem"
|
||||
[class.pulsating]="iconPulsating" [attr.aria-label]="t('notificationAriaLabel')"></i>
|
||||
</button>
|
||||
<p-menu #langMenuMobile [model]="langMenuItems" [popup]="true"/>
|
||||
|
||||
@if (shouldShowNotificationBadge) {
|
||||
<span class="notification-badge">{{ completedTaskCount }}</span>
|
||||
}
|
||||
|
||||
<p-popover #notificationPopover>
|
||||
<app-unified-notification-popover-component></app-unified-notification-popover-component>
|
||||
</p-popover>
|
||||
</li>
|
||||
|
||||
<li class="topbar-item-relative">
|
||||
<button type="button" class="topbar-item" (click)="langMenu.toggle($event)" [pTooltip]="t('language')"
|
||||
tooltipPosition="bottom">
|
||||
<i class="pi pi-language topbar-icon"></i>
|
||||
</button>
|
||||
<p-menu #langMenu [model]="langMenuItems" [popup]="true" appendTo="body" />
|
||||
</li>
|
||||
<li class="topbar-item-relative">
|
||||
<button type="button" class="topbar-item config-item" enterActiveClass="animate-scalein"
|
||||
enterFromClass="hidden" leaveActiveClass="animate-fadeout" leaveToClass="hidden" pStyleClass="@next"
|
||||
[hideOnOutsideClick]="true">
|
||||
<i class="pi pi-palette"></i>
|
||||
</button>
|
||||
<app-theme-configurator></app-theme-configurator>
|
||||
</li>
|
||||
</div>
|
||||
<p-divider layout="vertical" />
|
||||
<div class="topbar-action-group">
|
||||
<li>
|
||||
<a class="topbar-item" href="https://grimmory.org/docs/getting-started" target="_blank"
|
||||
rel="noopener noreferrer" [pTooltip]="t('documentation')" tooltipPosition="bottom">
|
||||
<i class="pi pi-info-circle topbar-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Show Profile only to non-demo users -->
|
||||
@if (user(); as currentUser) {
|
||||
@if (!currentUser.permissions?.demoUser) {
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="openUserProfileDialog(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-user topbar-icon"></i>
|
||||
{{ t('profile') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (!currentUser.permissions.demoUser) {
|
||||
<li>
|
||||
<button class="topbar-item" (click)="openUserProfileDialog()" [pTooltip]="t('profile')"
|
||||
tooltipPosition="bottom">
|
||||
<i class="pi pi-user topbar-icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
|
||||
<li>
|
||||
<button
|
||||
class="mobile-menu-item"
|
||||
(click)="logout(); mobileMenu.hide()"
|
||||
>
|
||||
<button class="topbar-item" (click)="logout()" [pTooltip]="t('logout')" tooltipPosition="left">
|
||||
<i class="pi pi-sign-out topbar-icon"></i>
|
||||
{{ t('logout') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</p-popover>
|
||||
</div>
|
||||
</ul>
|
||||
<!-- Trigger Button -->
|
||||
<div class="mobile-trigger">
|
||||
<p-button icon="pi pi-ellipsis-v" outlined (click)="mobileMenu.toggle($event)" />
|
||||
<p-popover #mobileMenu>
|
||||
<ul class="mobile-menu-list">
|
||||
@if (user(); as currentUser) {
|
||||
@if (currentUser.permissions?.canAccessBookdrop || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="navigateToBookdrop(); mobileMenu.hide()">
|
||||
<i class="pi pi-inbox topbar-icon"></i>
|
||||
{{ t('bookdrop') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="openLibraryCreatorDialog(); mobileMenu.hide()">
|
||||
<i class="pi pi-plus-circle topbar-icon"></i>
|
||||
{{ t('createLibrary') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canUpload || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="openFileUploadDialog(); mobileMenu.hide()">
|
||||
<i class="pi pi-upload topbar-icon"></i>
|
||||
{{ t('uploadBook') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canAccessLibraryStats || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="navigateToStats(); mobileMenu.hide()">
|
||||
<i class="pi pi-chart-line topbar-icon"></i>
|
||||
{{ t('libraryStats') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canAccessUserStats || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="navigateToUserStats(); mobileMenu.hide()">
|
||||
<i class="pi pi-users topbar-icon"></i>
|
||||
{{ t('readingStats') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
@if (currentUser.permissions?.canManageLibrary || currentUser.permissions?.admin) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="navigateToMetadataManager(); mobileMenu.hide()">
|
||||
<i class="pi pi-sparkles topbar-icon"></i>
|
||||
{{ t('metadataManager') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="navigateToSettings(); mobileMenu.hide()">
|
||||
<i class="pi pi-cog topbar-icon"></i>
|
||||
{{ t('settings') }}
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<a class="mobile-menu-item" href="https://grimmory.org/docs/getting-started" target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
<i class="pi pi-info-circle topbar-icon"></i>
|
||||
{{ t('documentation') }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="langMenuMobile.toggle($event)">
|
||||
<i class="pi pi-language topbar-icon"></i>
|
||||
{{ t('language') }}
|
||||
</button>
|
||||
<p-menu #langMenuMobile [model]="langMenuItems" [popup]="true" />
|
||||
</li>
|
||||
|
||||
@if (user(); as currentUser) {
|
||||
@if (!currentUser.permissions.demoUser) {
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="openUserProfileDialog(); mobileMenu.hide()">
|
||||
<i class="pi pi-user topbar-icon"></i>
|
||||
{{ t('profile') }}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
|
||||
<li>
|
||||
<button class="mobile-menu-item" (click)="logout(); mobileMenu.hide()">
|
||||
<i class="pi pi-sign-out topbar-icon"></i>
|
||||
{{ t('logout') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</p-popover>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
@@ -0,0 +1,50 @@
|
||||
import {Injectable, OnDestroy} from '@angular/core';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class WakeLockService implements OnDestroy {
|
||||
private wakeLock: WakeLockSentinel | null = null;
|
||||
private enabled = false;
|
||||
|
||||
async enable(): Promise<void> {
|
||||
if (this.enabled) return;
|
||||
this.enabled = true;
|
||||
|
||||
document.addEventListener('visibilitychange', this.onVisibilityChange);
|
||||
await this.requestWakeLock();
|
||||
}
|
||||
|
||||
async disable(): Promise<void> {
|
||||
this.enabled = false;
|
||||
document.removeEventListener('visibilitychange', this.onVisibilityChange);
|
||||
await this.releaseWakeLock();
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.disable();
|
||||
}
|
||||
|
||||
private async requestWakeLock(): Promise<void> {
|
||||
if (!('wakeLock' in navigator)) return;
|
||||
try {
|
||||
this.wakeLock = await navigator.wakeLock.request('screen');
|
||||
this.wakeLock.addEventListener('release', () => {
|
||||
this.wakeLock = null;
|
||||
});
|
||||
} catch {
|
||||
// Wake lock request failed (e.g., page not visible)
|
||||
}
|
||||
}
|
||||
|
||||
private async releaseWakeLock(): Promise<void> {
|
||||
if (this.wakeLock) {
|
||||
await this.wakeLock.release();
|
||||
this.wakeLock = null;
|
||||
}
|
||||
}
|
||||
|
||||
private onVisibilityChange = async (): Promise<void> => {
|
||||
if (this.enabled && document.visibilityState === 'visible') {
|
||||
await this.requestWakeLock();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { height: 100%; overflow: hidden; }
|
||||
#viewer { height: 100%; width: 100%; display: flex; }
|
||||
#viewer embedpdf-container { display: flex; flex: 1; width: 100%; height: 100%; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="viewer"></div>
|
||||
<script type="module">
|
||||
import EmbedPDF from '/assets/embedpdf/embedpdf.js';
|
||||
|
||||
let viewer = null;
|
||||
let objectUrl = null;
|
||||
let registry = null;
|
||||
const myOrigin = location.origin;
|
||||
|
||||
function log(...args) {
|
||||
console.log('[EmbedPDF-frame]', ...args);
|
||||
parent.postMessage({
|
||||
type: 'log',
|
||||
args: args.map(a => typeof a === 'object' ? JSON.stringify(a) : String(a))
|
||||
}, myOrigin);
|
||||
}
|
||||
|
||||
function injectGrimmoryStyles(targetEl, attempt) {
|
||||
if (attempt === undefined) attempt = 0;
|
||||
const container = targetEl.querySelector('embedpdf-container');
|
||||
const shadow = container?.shadowRoot;
|
||||
if (!shadow) {
|
||||
if (attempt < 25) setTimeout(() => injectGrimmoryStyles(targetEl, attempt + 1), 200);
|
||||
return;
|
||||
}
|
||||
if (shadow.querySelector('style[data-grimmory]')) return;
|
||||
|
||||
const style = document.createElement('style');
|
||||
style.setAttribute('data-grimmory', '');
|
||||
style.textContent = `
|
||||
/* ── Grimmory theme overrides ── */
|
||||
|
||||
:host {
|
||||
--ep-background-app: #1a1a1a;
|
||||
--ep-background-surface: #2d2d2d;
|
||||
--ep-border-default: #404040;
|
||||
--ep-border-subtle: #333333;
|
||||
--ep-foreground-primary: rgba(255,255,255,0.95);
|
||||
--ep-foreground-secondary: rgba(255,255,255,0.60);
|
||||
--ep-accent-primary: #4a90e2;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) {
|
||||
--ep-background-app: #f5f5f5;
|
||||
--ep-background-surface: #ffffff;
|
||||
--ep-border-default: #d0d0d0;
|
||||
--ep-border-subtle: #e0e0e0;
|
||||
--ep-foreground-primary: rgba(0,0,0,0.87);
|
||||
--ep-foreground-secondary: rgba(0,0,0,0.54);
|
||||
}
|
||||
|
||||
[class*="border-b"][class*="bg-bg-surface"][class*="px-4"][class*="py-2"] {
|
||||
background: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%) !important;
|
||||
border-bottom-color: #404040 !important;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.30) !important;
|
||||
height: 38px !important;
|
||||
padding-right: 48px !important;
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) [class*="border-b"][class*="bg-bg-surface"][class*="px-4"][class*="py-2"] {
|
||||
background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%) !important;
|
||||
border-bottom-color: #d0d0d0 !important;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.10) !important;
|
||||
}
|
||||
|
||||
[class*="border-t"][class*="bg-bg-surface"][class*="px-4"][class*="py-1"] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
[data-epdf-i="open-document"],
|
||||
[data-epdf-i="close-document"],
|
||||
button[title="Open Document"],
|
||||
button[title="Close Document"] {
|
||||
display: none !important;
|
||||
}
|
||||
.pdf-btn-open {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
[role="menu"],
|
||||
[role="dialog"],
|
||||
[class*="rounded-lg"][class*="shadow"],
|
||||
[class*="rounded-md"][class*="shadow"] {
|
||||
background: #2d2d2d !important;
|
||||
border: 1px solid #404040 !important;
|
||||
border-radius: 0 0 8px 8px !important;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.40) !important;
|
||||
color: rgba(255,255,255,0.95) !important;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) [role="menu"],
|
||||
:host([data-color-scheme="light"]) [role="dialog"],
|
||||
:host([data-color-scheme="light"]) [class*="rounded-lg"][class*="shadow"],
|
||||
:host([data-color-scheme="light"]) [class*="rounded-md"][class*="shadow"] {
|
||||
background: #ffffff !important;
|
||||
border: 1px solid #d0d0d0 !important;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
|
||||
color: rgba(0,0,0,0.87) !important;
|
||||
}
|
||||
|
||||
[role="menuitem"],
|
||||
[role="menuitemcheckbox"],
|
||||
[role="menuitemradio"] {
|
||||
border-radius: 6px !important;
|
||||
transition: background 150ms ease !important;
|
||||
}
|
||||
|
||||
[role="menuitem"]:hover,
|
||||
[role="menuitemcheckbox"]:hover,
|
||||
[role="menuitemradio"]:hover {
|
||||
background: rgba(255,255,255,0.12) !important;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) [role="menuitem"]:hover,
|
||||
:host([data-color-scheme="light"]) [role="menuitemcheckbox"]:hover,
|
||||
:host([data-color-scheme="light"]) [role="menuitemradio"]:hover {
|
||||
background: rgba(0,0,0,0.06) !important;
|
||||
}
|
||||
|
||||
[role="menuitemcheckbox"][aria-checked="true"],
|
||||
[role="menuitemradio"][aria-checked="true"] {
|
||||
color: #4a90e2 !important;
|
||||
background: rgba(74,144,226,0.15) !important;
|
||||
}
|
||||
|
||||
button[class*="hover:bg-interactive-hover"]:hover {
|
||||
background: rgba(255,255,255,0.12) !important;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) button[class*="hover:bg-interactive-hover"]:hover {
|
||||
background: rgba(0,0,0,0.06) !important;
|
||||
}
|
||||
|
||||
[role="separator"],
|
||||
[class*="bg-border-default"][class*="h-6"][class*="w-px"] {
|
||||
background: rgba(255,255,255,0.15) !important;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) [role="separator"],
|
||||
:host([data-color-scheme="light"]) [class*="bg-border-default"][class*="h-6"][class*="w-px"] {
|
||||
background: rgba(0,0,0,0.12) !important;
|
||||
}
|
||||
|
||||
[class*="bg-tooltip-bg"] {
|
||||
background: #2d2d2d !important;
|
||||
color: rgba(255,255,255,0.95) !important;
|
||||
border: 1px solid #404040 !important;
|
||||
}
|
||||
|
||||
:host([data-color-scheme="light"]) [class*="bg-tooltip-bg"] {
|
||||
background: #ffffff !important;
|
||||
color: rgba(0,0,0,0.87) !important;
|
||||
border: 1px solid #d0d0d0 !important;
|
||||
}
|
||||
`;
|
||||
shadow.appendChild(style);
|
||||
targetEl.style.visibility = '';
|
||||
}
|
||||
|
||||
window.addEventListener('message', async (e) => {
|
||||
if (e.origin !== myOrigin) return;
|
||||
const msg = e.data;
|
||||
|
||||
if (msg.type === 'init') {
|
||||
log('Init, buffer:', msg.buffer?.byteLength, 'bytes');
|
||||
|
||||
const blob = new Blob([msg.buffer], { type: 'application/pdf' });
|
||||
objectUrl = URL.createObjectURL(blob);
|
||||
|
||||
const target = document.getElementById('viewer');
|
||||
target.style.visibility = 'hidden';
|
||||
|
||||
viewer = EmbedPDF.init({
|
||||
type: 'container',
|
||||
target,
|
||||
src: objectUrl,
|
||||
wasmUrl: msg.wasmUrl || '/assets/pdfium/pdfium.wasm',
|
||||
worker: false,
|
||||
theme: { preference: msg.theme || 'dark' }
|
||||
});
|
||||
|
||||
try {
|
||||
registry = await viewer.registry;
|
||||
const dm = registry.getPlugin('document-manager')?.provides();
|
||||
if (dm) {
|
||||
dm.onDocumentOpened?.((ev) => {
|
||||
log('Document opened, pages:', ev?.pageCount);
|
||||
parent.postMessage({ type: 'documentOpened', pageCount: ev?.pageCount }, myOrigin);
|
||||
});
|
||||
dm.onDocumentError?.((ev) => {
|
||||
log('Document error:', ev);
|
||||
parent.postMessage({ type: 'documentError', error: String(ev?.message || ev) }, myOrigin);
|
||||
});
|
||||
dm.onDocumentClosed?.((ev) => {
|
||||
log('Document closed:', ev?.documentId);
|
||||
});
|
||||
}
|
||||
parent.postMessage({ type: 'ready' }, myOrigin);
|
||||
} catch (err) {
|
||||
log('Registry error:', err);
|
||||
parent.postMessage({ type: 'documentError', error: String(err) }, myOrigin);
|
||||
}
|
||||
|
||||
injectGrimmoryStyles(target);
|
||||
}
|
||||
|
||||
if (msg.type === 'save') {
|
||||
try {
|
||||
if (!registry) {
|
||||
parent.postMessage({ type: 'saved', buffer: null }, myOrigin);
|
||||
return;
|
||||
}
|
||||
const exportPlugin = registry.plugins.get('export')?.provides();
|
||||
const state = registry.store.getState();
|
||||
const docId = Object.keys(state.core.documents)[0];
|
||||
if (!docId || !exportPlugin) {
|
||||
parent.postMessage({ type: 'saved', buffer: null }, myOrigin);
|
||||
return;
|
||||
}
|
||||
const buffer = await new Promise((resolve, reject) => {
|
||||
exportPlugin.saveAsCopy(docId).wait(resolve, reject);
|
||||
});
|
||||
log('Exported', (buffer.byteLength / 1048576).toFixed(1), 'MB');
|
||||
parent.postMessage({ type: 'saved', buffer }, myOrigin, [buffer]);
|
||||
} catch (err) {
|
||||
log('Save error:', err);
|
||||
parent.postMessage({ type: 'saveError', error: String(err) }, myOrigin);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.type === 'setTheme') {
|
||||
viewer?.setTheme?.(msg.theme);
|
||||
}
|
||||
});
|
||||
|
||||
log('Frame loaded, waiting for init');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -22,5 +22,7 @@
|
||||
"dismiss": "Dismiss",
|
||||
"discard": "Discard",
|
||||
"review": "Review",
|
||||
"libraryPathInaccessible": "Library path inaccessible"
|
||||
"libraryPathInaccessible": "Library path inaccessible",
|
||||
"on": "On",
|
||||
"off": "Off"
|
||||
}
|
||||
|
||||
@@ -110,7 +110,11 @@
|
||||
"gray": "Gray",
|
||||
"white": "White",
|
||||
"magnifierLensSize": "Lens Size",
|
||||
"magnifierZoom": "Magnification"
|
||||
"magnifierZoom": "Magnification",
|
||||
"brightness": "Brightness",
|
||||
"emulateBook": "Emulate Book",
|
||||
"clickToPaginate": "Click to Paginate",
|
||||
"autoCloseMenu": "Auto Close Menu"
|
||||
},
|
||||
"sidebar": {
|
||||
"contentTab": "Content",
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
"notesShortcut": "Notes",
|
||||
"display": "Display",
|
||||
"toggleFullscreen": "Toggle fullscreen",
|
||||
"toggleImmersive": "Toggle immersive mode",
|
||||
"exitFullscreenCloseDialogs": "Exit fullscreen / Close dialogs",
|
||||
"other": "Other",
|
||||
"showHelpDialog": "Show this help dialog",
|
||||
|
||||
@@ -2,7 +2,20 @@
|
||||
"toolbar": {
|
||||
"switchToLightMode": "Switch to Light Mode",
|
||||
"switchToDarkMode": "Switch to Dark Mode",
|
||||
"closePdfReader": "Close PDF Reader"
|
||||
"closePdfReader": "Close PDF Reader",
|
||||
"rotatePage": "Rotate Page",
|
||||
"fullscreen": "Fullscreen",
|
||||
"exitFullscreen": "Exit Fullscreen"
|
||||
},
|
||||
"footer": {
|
||||
"firstPage": "First Page",
|
||||
"previousPage": "Previous Page",
|
||||
"nextPage": "Next Page",
|
||||
"lastPage": "Last Page",
|
||||
"of": "of",
|
||||
"pageSlider": "Page Slider",
|
||||
"pagePlaceholder": "Page",
|
||||
"go": "Go"
|
||||
},
|
||||
"toast": {
|
||||
"failedToLoadBook": "Failed to load the book"
|
||||
|
||||
@@ -1026,6 +1026,625 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/core@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/core@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/engines": "npm:2.11.1"
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/75dd374e25fb8f70d61df545002945f02bd45761a783ff1d9a32aaf4d549699e749e58a7b95a2095c3c1210fecd280d54ba4e9a8a825df8905a46bdd6ec251c9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/engines@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/engines@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/fonts-arabic": "npm:1.0.0"
|
||||
"@embedpdf/fonts-hebrew": "npm:1.0.0"
|
||||
"@embedpdf/fonts-jp": "npm:1.0.0"
|
||||
"@embedpdf/fonts-kr": "npm:1.0.0"
|
||||
"@embedpdf/fonts-latin": "npm:1.0.0"
|
||||
"@embedpdf/fonts-sc": "npm:1.0.0"
|
||||
"@embedpdf/fonts-tc": "npm:1.0.0"
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
"@embedpdf/pdfium": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/1e010626669dcc8ea0d9a4b8fe397a1a39e7c393706d4c363f42464ef5eb2098027011459b593a79e6cc5504201f49ae12b81ede1bc08d4f39a5004cb0d082e8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-arabic@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-arabic@npm:1.0.0"
|
||||
checksum: 10c0/324d724b9e8d477d857c8673c5694a550f6dad90c4cf19f8f0498ec3dcd25da09a89ffd38a8d85c9e20ed59df36e0c4802df02f8ad427b6d8091a7ba68cd469f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-hebrew@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-hebrew@npm:1.0.0"
|
||||
checksum: 10c0/d67988063fc082adc246a74a0aae1e99fbfaa9d8425911128ca123e047e38323af4bfacfb1cab25277f7233701cf0e69bdc2477d8f213396d55e0d3628664530
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-jp@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-jp@npm:1.0.0"
|
||||
checksum: 10c0/0a0d989a085ec6aa3c6c370f86ed461e0951cc22f4fc4565ae3daff75c4fbf7c2f0eeb6d6902a63cea580aa6f95bc5457db2d19d3caaeb2070a436950449aa54
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-kr@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-kr@npm:1.0.0"
|
||||
checksum: 10c0/7750148272e088d9961b383188ec07e02ced6209a1274441c149690fc4d28e7591cceaa26e7e68991e4a8468ce6da7b916d61c0b3bf5e4fb8c24c58b66ec0be3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-latin@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-latin@npm:1.0.0"
|
||||
checksum: 10c0/a2c862d288a99a0f0134aa4781ce81bce00fd0b039e81401e2efaea0affc67a2f7b456252598a16953a5ba04ce11dadf9f95e4b4ff5bb9de1a32a41dd9dceffd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-sc@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-sc@npm:1.0.0"
|
||||
checksum: 10c0/2a5126390f9947656162601e3f0b3163eee5c2d362f0115d6d54137835265a3a672f98e6399e0c8efbe506546216f692d870d71e3803c0f2a18b631fd262cd34
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/fonts-tc@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@embedpdf/fonts-tc@npm:1.0.0"
|
||||
checksum: 10c0/f0ac603b81de074b1ec41c16ac3daf7dc6f7ae02659a9ee08006ab95c0fc4ff10338bc73ccf8cfbf9a357bdd158e08baa54a61ee8c87b5909154454ccddfb41c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/models@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/models@npm:2.11.1"
|
||||
checksum: 10c0/0c8ecde3acd64ccba91db2ea74ed50b4d499a28347ef5f6df655d700f016dffe35940379468d610087c92d5754fb9b1ec5fb7ba588e13b316a8035ac1c051de1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/pdfium@npm:2.11.1, @embedpdf/pdfium@npm:^2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/pdfium@npm:2.11.1"
|
||||
checksum: 10c0/ee2521756e0c2bb480baf956a287c0281810962e55b012e5eb39e050f17de3e9f88e2a9f5b341a3dd9756684ff0376cfbfca98cb0a1f5df446e9905c7e06a68c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-annotation@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-annotation@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
"@embedpdf/utils": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-history": 2.11.1
|
||||
"@embedpdf/plugin-interaction-manager": 2.11.1
|
||||
"@embedpdf/plugin-scroll": 2.11.1
|
||||
"@embedpdf/plugin-selection": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/6a1e996ea65002268f0d4b75c08f53a9cf744f896b464ad0d23333fb395e642f48b69ebe85e6a2f3291425b01a14093c6d70b207e88a724286cca334041f1672
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-attachment@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-attachment@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/ef28a71ec8cad9d0b05e31b09423b8c87d00ad40e4caafa7ddd68c122071b2a156d5b25836d8eaef35df4d7f6463cb72df96a464a80ce1c0d7a8fb3e59ea8e60
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-bookmark@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-bookmark@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/287c89fcd643dbd138ff3ad3d31d9d873d2cfa95f9951b31a2417115f5e3ce9a224118a234c2cbf837160da5d5e431d7b6aa25c0f8ab753d1aeb26a510b7f2b9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-capture@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-capture@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-interaction-manager": 2.11.1
|
||||
"@embedpdf/plugin-render": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/ca44ccaedbeee593ee2206dc6f8937dc91ff6e7ee150dbf8c884cb26d84a7562febe5a5975d81c8b2324f88be1caa48daa2f038f362b570878796376e5995f34
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-commands@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-commands@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/11cadacb9ad9c777b07bdfbdfa5bd24b22e8299a548cdb9f550c4c3797ca44d9c5498704dc583a572a8d21c127b0248cb8979dc2005cddc079cc321f113e3b50
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-document-manager@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-document-manager@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/a8cd9670c4419186cd5cf58906797361038fa46d980f7f85954b5f68ab1fe9ed7e78681f86c14666a637377b3b70beacdded18f339a58946618e77c3895dc6f4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-export@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-export@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/9080f9792b39d097a0975f7d07e1eed9816b842cffa511c2bf2c0acea4fec21bb58bcb4ab47c236abcfc7f8ec27c6f02f7050783dc472a80a682d32baa4115e6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-form@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-form@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
"@embedpdf/utils": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-annotation": 2.11.1
|
||||
"@embedpdf/plugin-history": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/f286c5350317705cb4176ebe978315a900c66a3a715b41fa513f09b3901573c412f6ac3ad1545e6afecdd8b76d8efc28d2dc0f3bd68c45c7c78a129d3e97318a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-fullscreen@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-fullscreen@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/9d75152666569ec9829409a8fc3ac1fdd6385b546c70261a7a5fea86303fd0f0d4c0f7cbae64f4c9acb6bb55578aeee7a788e05369076e46b7f2fbcc77413cc8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-history@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-history@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/078457ac898fc05a07db44174064f82c27540dc5293926f617207e904ebc1e8b1b0b122bdcc674996c33f287f6cc2420b43a9bdc7e73dd841bec277a6290e666
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-i18n@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-i18n@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/5437b687f94a5da79aa39208f706b6822d587f44ba2b7fe5bff3b02c0532f7e74bd7d6e9864dd00b5fc35b75494daf7114900e9c665eed85e50d6fd87a18a662
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-interaction-manager@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-interaction-manager@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/8426bd96892325f573feb7a6d74c2b4d5fe8e1c926e8010549cdf020c7fb3a9c5b33221c8b013e61388be56dd582d78024a5deed45dbf3e859c4dbf4eccf7684
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-pan@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-pan@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-interaction-manager": 2.11.1
|
||||
"@embedpdf/plugin-viewport": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/c32070588d78262ee32e1d16a8304ecb4dce3580ccab289332c02c04eefb56d382fd6e34f729a7bf3d08b26a56f995f4d37c57b9176b2032178c8f05d0086947
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-print@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-print@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=18.0.0"
|
||||
react-dom: ">=18.0.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/616900052da305b6f72e08832fe76950ebcf10d7886e87a342abbfc641d5687abd38f97c88681205562c2768f8d2e418d074aa7f7b2ba6fb86164d240c479624
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-redaction@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-redaction@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
"@embedpdf/utils": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-annotation": 2.11.1
|
||||
"@embedpdf/plugin-history": 2.11.1
|
||||
"@embedpdf/plugin-interaction-manager": 2.11.1
|
||||
"@embedpdf/plugin-selection": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/7da6c3b42ee40ce21a242f847493108e56fce6d91e24f902a00b14b3adfbeef439bfd546de31a5bdc4137ddf130f1f1bba01078893bde5393e42036fddad88dd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-render@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-render@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/1387451b5bd786d00a6530072488ae7b3938bd15e2662ddd4e98edb47d1bb51b052f73d2fc67a22c9518d0c3641292f1ac89cfa4d6ffcd53132957ac7fb1ea99
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-rotate@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-rotate@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/6cb3067ada41d73172ebce1dbc3d4b8cae82c1c8864d3ce02457385cf781cd90dfc70861f20861092e52155b6cb11fafd0c94e4b9548943b2a73fcc61e6456be
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-scroll@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-scroll@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-viewport": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/b6500e71deb6e400fa5efe0f1a09270e82ff4280535886136e7bd2df41fbfd326f5ae4d018bbcfe76e5aa09b6fbde72c994aaa9fa0605d94e00f78eb7ab6e93b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-search@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-search@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/ffa9b6f07d9b4868fa7a79b7ea05c790dc4b6ae6461c256c6420c6690260be3d14b7252378ae8593b883764731eb7f360b615b0986c041c423e110a152100160
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-selection@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-selection@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
"@embedpdf/utils": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-interaction-manager": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/144c46e1d50dbb07d0136548955d37ff33a1f60099529bb59ff4cbc1b0ad6223ce67b6003a5ff263c86cc67591d4b6f0bb27011fd95ffe8574f337e531415e30
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-spread@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-spread@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/b4777a94ca1679d7b8b4c996ef885d9870150ae9106eb2dcf40c5dcbf45781a5e7282fb3014351e7707f12d9ec1612f3e9d4806c67b585437f271ad3e334f090
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-stamp@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-stamp@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-annotation": 2.11.1
|
||||
"@embedpdf/plugin-i18n": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/8780c952d70ea2800ac620288188d8d1180081542004d7ef1b60dda030f0b4a521672310ad45f8d725958871b701263d69fb4fbcbd270b1ac95a0f0739d48000
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-thumbnail@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-thumbnail@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-render": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/c02ec3032221417416c2776abfbaa96a95c76ce62f3a6865b60aefa46959b2a7708bb3547cfcecf8a6e43130ac274d490fda93205f598b147afadb04b1d3ba06
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-tiling@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-tiling@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-render": 2.11.1
|
||||
"@embedpdf/plugin-scroll": 2.11.1
|
||||
"@embedpdf/plugin-viewport": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/85f43a3ee0a73ca7959595ee1c2f9d9e6af6152e8fde84984a9cff8cf2de1d5e7954b2817e5573f2802efd00818f36a80a16d5ad6b2112866bed3baf6afc30de
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-ui@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-ui@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-render": 2.11.1
|
||||
"@embedpdf/plugin-scroll": 2.11.1
|
||||
"@embedpdf/plugin-viewport": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/38431f2edf9e11129236bc4557528caf8b2af9dfd33dc6ce01e6438c6e29666558539c55ba06c0c6199425b6cdbc1e55d021a0e9d6a4b47e4a6169aeac9a6d3a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-viewport@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-viewport@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/61116fe5039386eea789cbfcbe8ca73ab62edf732e22cfb85cacc264522bfe0cd37bb57f32fca99d2a434ff6affb20e29e6dce9f0c7616edecbb59d400a97a2d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/plugin-zoom@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/plugin-zoom@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
peerDependencies:
|
||||
"@embedpdf/core": 2.11.1
|
||||
"@embedpdf/plugin-scroll": 2.11.1
|
||||
"@embedpdf/plugin-viewport": 2.11.1
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/5cc8d4d5eab5aed70ca7ef2446cb0f47626268d85eef58ecfea8ac6b0bc08fb3c3f51cda3a536bb8b0578016762687f4bd98b424e4bb58fe83faa04ab3f488cd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/snippet@npm:^2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/snippet@npm:2.11.1"
|
||||
dependencies:
|
||||
"@embedpdf/core": "npm:2.11.1"
|
||||
"@embedpdf/engines": "npm:2.11.1"
|
||||
"@embedpdf/models": "npm:2.11.1"
|
||||
"@embedpdf/pdfium": "npm:2.11.1"
|
||||
"@embedpdf/plugin-annotation": "npm:2.11.1"
|
||||
"@embedpdf/plugin-attachment": "npm:2.11.1"
|
||||
"@embedpdf/plugin-bookmark": "npm:2.11.1"
|
||||
"@embedpdf/plugin-capture": "npm:2.11.1"
|
||||
"@embedpdf/plugin-commands": "npm:2.11.1"
|
||||
"@embedpdf/plugin-document-manager": "npm:2.11.1"
|
||||
"@embedpdf/plugin-export": "npm:2.11.1"
|
||||
"@embedpdf/plugin-form": "npm:2.11.1"
|
||||
"@embedpdf/plugin-fullscreen": "npm:2.11.1"
|
||||
"@embedpdf/plugin-history": "npm:2.11.1"
|
||||
"@embedpdf/plugin-i18n": "npm:2.11.1"
|
||||
"@embedpdf/plugin-interaction-manager": "npm:2.11.1"
|
||||
"@embedpdf/plugin-pan": "npm:2.11.1"
|
||||
"@embedpdf/plugin-print": "npm:2.11.1"
|
||||
"@embedpdf/plugin-redaction": "npm:2.11.1"
|
||||
"@embedpdf/plugin-render": "npm:2.11.1"
|
||||
"@embedpdf/plugin-rotate": "npm:2.11.1"
|
||||
"@embedpdf/plugin-scroll": "npm:2.11.1"
|
||||
"@embedpdf/plugin-search": "npm:2.11.1"
|
||||
"@embedpdf/plugin-selection": "npm:2.11.1"
|
||||
"@embedpdf/plugin-spread": "npm:2.11.1"
|
||||
"@embedpdf/plugin-stamp": "npm:2.11.1"
|
||||
"@embedpdf/plugin-thumbnail": "npm:2.11.1"
|
||||
"@embedpdf/plugin-tiling": "npm:2.11.1"
|
||||
"@embedpdf/plugin-ui": "npm:2.11.1"
|
||||
"@embedpdf/plugin-viewport": "npm:2.11.1"
|
||||
"@embedpdf/plugin-zoom": "npm:2.11.1"
|
||||
preact: "npm:^10.17.0"
|
||||
tailwind-merge: "npm:^3.4.0"
|
||||
checksum: 10c0/dc987e3e42a0b90a41ec71e0b80ef095e823c635d5f5ceac230e6410ed3070f5e311eca4e374ab25ea5ba2f150cee784b7a8ebfd552e3e9556156e75e53e9b13
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@embedpdf/utils@npm:2.11.1":
|
||||
version: 2.11.1
|
||||
resolution: "@embedpdf/utils@npm:2.11.1"
|
||||
peerDependencies:
|
||||
preact: ^10.26.4
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
svelte: ">=5 <6"
|
||||
vue: ">=3.2.0"
|
||||
checksum: 10c0/1ef1908070a6dfbf188dc43d4a4f29851a7c54980e1eb76959f4213809aaf7d45c65853e1813bc6dfa160a584b70db6913dbfb4ea1683bc424d5b5df6fdb49b6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@emnapi/core@npm:^1.7.1":
|
||||
version: 1.9.1
|
||||
resolution: "@emnapi/core@npm:1.9.1"
|
||||
@@ -5430,6 +6049,8 @@ __metadata:
|
||||
"@angular/platform-browser-dynamic": "npm:^21.2.6"
|
||||
"@angular/router": "npm:^21.2.6"
|
||||
"@angular/service-worker": "npm:^21.2.6"
|
||||
"@embedpdf/pdfium": "npm:^2.11.1"
|
||||
"@embedpdf/snippet": "npm:^2.11.1"
|
||||
"@eslint/js": "npm:^10.0.1"
|
||||
"@iharbeck/ngx-virtual-scroller": "npm:^20.0.0"
|
||||
"@jsverse/transloco": "npm:^8.2.1"
|
||||
@@ -7333,6 +7954,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"preact@npm:^10.17.0":
|
||||
version: 10.29.0
|
||||
resolution: "preact@npm:10.29.0"
|
||||
checksum: 10c0/d111381e5b48335e3a797a03adb83521cf5e9bdf880570fb2eff4fe9da9c82e6dedcbdf54538b1ed8f60bf813a0df0f4891b03dc32140ad93f8f720a8812dd5c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"prelude-ls@npm:^1.2.1":
|
||||
version: 1.2.1
|
||||
resolution: "prelude-ls@npm:1.2.1"
|
||||
@@ -8385,6 +9013,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tailwind-merge@npm:^3.4.0":
|
||||
version: 3.5.0
|
||||
resolution: "tailwind-merge@npm:3.5.0"
|
||||
checksum: 10c0/4dc588f5b5296ba3f38e1ebb41f02b6d24a8c5bb45e44b33748c118fb4b5767dd0efc464431ca3e75404056b618b5f67bec3708158baa65fed8a2fc9201e0c53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tar@npm:^7.4.3, tar@npm:^7.5.4":
|
||||
version: 7.5.13
|
||||
resolution: "tar@npm:7.5.13"
|
||||
|
||||
Reference in New Issue
Block a user