@solidpepper/solidpepper-solidreviewer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit, OnChanges, EventEmitter, ElementRef, ChangeDetectorRef, SimpleChanges } from '@angular/core';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import { SafeHtml, DomSanitizer } from '@angular/platform-browser';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { DocumentComment, DocumentCommentService, SettingsService } from '@solidpepper/solidpepper-service';
|
|
7
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
8
|
+
|
|
9
|
+
declare class SvgCacheService {
|
|
10
|
+
private http;
|
|
11
|
+
private memoryCache;
|
|
12
|
+
constructor(http: HttpClient);
|
|
13
|
+
/**
|
|
14
|
+
* Helper to parse any timestamp parameter from a URL (e.g. date=, t=, s=)
|
|
15
|
+
*/
|
|
16
|
+
private getTimestampFromUrl;
|
|
17
|
+
/**
|
|
18
|
+
* Extracts a timestamp from the SVG content if present.
|
|
19
|
+
*/
|
|
20
|
+
private getTimestampFromSvgContent;
|
|
21
|
+
/**
|
|
22
|
+
* Loads an SVG. Checks sessionStorage first. If cached version is found and
|
|
23
|
+
* the timestamps match, it returns the cached content. Otherwise, it fetches
|
|
24
|
+
* it and updates the cache.
|
|
25
|
+
*/
|
|
26
|
+
loadSvg(url: string, pageGuid: string, token?: string): Observable<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Clear the cache for a specific page or the whole document
|
|
29
|
+
*/
|
|
30
|
+
clearCache(pageGuid?: string): void;
|
|
31
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SvgCacheService, never>;
|
|
32
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SvgCacheService>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class TranslationService {
|
|
36
|
+
translate?: TranslateService | undefined;
|
|
37
|
+
private defaultLanguage;
|
|
38
|
+
private availablelangs;
|
|
39
|
+
constructor(translate?: TranslateService | undefined);
|
|
40
|
+
setDefaultLang(lang: string): void;
|
|
41
|
+
useLanguage(lang: string): void;
|
|
42
|
+
getAvailableLanguages(): {
|
|
43
|
+
code: string;
|
|
44
|
+
text: string;
|
|
45
|
+
}[];
|
|
46
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TranslationService, [{ optional: true; }]>;
|
|
47
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TranslationService>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ReviewerPage {
|
|
51
|
+
documentPageGuid: string;
|
|
52
|
+
publicationTemplateUrl: string;
|
|
53
|
+
publicationTemplateThumbnail: string;
|
|
54
|
+
pageNumber: number;
|
|
55
|
+
width?: number;
|
|
56
|
+
height?: number;
|
|
57
|
+
}
|
|
58
|
+
interface PageRow {
|
|
59
|
+
isCover: boolean;
|
|
60
|
+
pages: ReviewerPage[];
|
|
61
|
+
}
|
|
62
|
+
declare class AppComponent implements OnInit, OnChanges {
|
|
63
|
+
private http;
|
|
64
|
+
private svgCache;
|
|
65
|
+
private elRef;
|
|
66
|
+
private cdr;
|
|
67
|
+
private sanitizer;
|
|
68
|
+
private commentService;
|
|
69
|
+
private settingsService;
|
|
70
|
+
private translationService;
|
|
71
|
+
guid?: string;
|
|
72
|
+
token?: string;
|
|
73
|
+
apiUrl: string;
|
|
74
|
+
language: string;
|
|
75
|
+
companyAlias?: string;
|
|
76
|
+
disableAuthPrompt: boolean;
|
|
77
|
+
logout: EventEmitter<void>;
|
|
78
|
+
private loggedOutToken?;
|
|
79
|
+
private originalInputToken?;
|
|
80
|
+
isLoading: _angular_core.WritableSignal<boolean>;
|
|
81
|
+
hasError: _angular_core.WritableSignal<boolean>;
|
|
82
|
+
errorMessage: _angular_core.WritableSignal<string>;
|
|
83
|
+
showAuthPrompt: _angular_core.WritableSignal<boolean>;
|
|
84
|
+
authLogin: string;
|
|
85
|
+
authPassword: string;
|
|
86
|
+
guestNickname: string;
|
|
87
|
+
guestName: string;
|
|
88
|
+
isGuest: boolean;
|
|
89
|
+
documentName: _angular_core.WritableSignal<string>;
|
|
90
|
+
pages: _angular_core.WritableSignal<ReviewerPage[]>;
|
|
91
|
+
loadedSvgContents: Record<string, SafeHtml>;
|
|
92
|
+
visiblePages: Set<string>;
|
|
93
|
+
private invisibleLoadedQueue;
|
|
94
|
+
private maxLoadedPagesLimit;
|
|
95
|
+
private isProgrammaticScrolling;
|
|
96
|
+
private initialTouchDistance;
|
|
97
|
+
private initialZoomLevel;
|
|
98
|
+
layoutMode: _angular_core.WritableSignal<"single" | "double" | "double-cover">;
|
|
99
|
+
zoomLevel: _angular_core.WritableSignal<number>;
|
|
100
|
+
activePageGuid: _angular_core.WritableSignal<string>;
|
|
101
|
+
continuousScroll: _angular_core.WritableSignal<boolean>;
|
|
102
|
+
lastWheelTime: number;
|
|
103
|
+
readingMode: _angular_core.WritableSignal<boolean>;
|
|
104
|
+
fitMode: _angular_core.WritableSignal<"none" | "width" | "height">;
|
|
105
|
+
sidebarOpen: _angular_core.WritableSignal<boolean>;
|
|
106
|
+
commentsSidebarOpen: _angular_core.WritableSignal<boolean>;
|
|
107
|
+
commentModeActive: _angular_core.WritableSignal<boolean>;
|
|
108
|
+
activeTool: _angular_core.WritableSignal<"text" | "point" | "drawing" | "shape-rect" | "shape-line" | "highlight">;
|
|
109
|
+
selectedColor: _angular_core.WritableSignal<string>;
|
|
110
|
+
availableColors: string[];
|
|
111
|
+
isDrawing: boolean;
|
|
112
|
+
isDraggingPin: boolean;
|
|
113
|
+
dragCommentGuid: string | null;
|
|
114
|
+
dragPageGuid: string | null;
|
|
115
|
+
private drawStartPoint;
|
|
116
|
+
private drawStartPointPercent;
|
|
117
|
+
draftDrawing: _angular_core.WritableSignal<{
|
|
118
|
+
pageGuid: string;
|
|
119
|
+
type: string;
|
|
120
|
+
pathData: string;
|
|
121
|
+
color: string;
|
|
122
|
+
} | null>;
|
|
123
|
+
comments: _angular_core.WritableSignal<DocumentComment[]>;
|
|
124
|
+
activeCommentId: _angular_core.WritableSignal<string | null>;
|
|
125
|
+
draftComment: _angular_core.WritableSignal<{
|
|
126
|
+
pageGuid: string;
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
} | null>;
|
|
130
|
+
loginError: _angular_core.WritableSignal<string | null>;
|
|
131
|
+
authTab: _angular_core.WritableSignal<"login" | "guest">;
|
|
132
|
+
constructor(http: HttpClient, svgCache: SvgCacheService, elRef: ElementRef, cdr: ChangeDetectorRef, sanitizer: DomSanitizer, commentService: DocumentCommentService, settingsService: SettingsService, translationService: TranslationService);
|
|
133
|
+
ngOnInit(): void;
|
|
134
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
135
|
+
private syncSettingsService;
|
|
136
|
+
private isTokenExpired;
|
|
137
|
+
private getCompanyAliasFromToken;
|
|
138
|
+
private initReviewer;
|
|
139
|
+
private getUsernameFromToken;
|
|
140
|
+
onAuthLogin(): void;
|
|
141
|
+
onAccessAsGuest(): void;
|
|
142
|
+
onLogout(): void;
|
|
143
|
+
onWindowResize(): void;
|
|
144
|
+
handleKeyboardEvent(event: KeyboardEvent): void;
|
|
145
|
+
/**
|
|
146
|
+
* Binds non-passive wheel and touch listeners to the scroll container.
|
|
147
|
+
* This is required because modern browsers treat touchmove and wheel as passive by default,
|
|
148
|
+
* which blocks event.preventDefault() and triggers native browser zoom.
|
|
149
|
+
*/
|
|
150
|
+
private setupGestureListeners;
|
|
151
|
+
private getTouchDistance;
|
|
152
|
+
/**
|
|
153
|
+
* Helper to normalize document URLs if relative.
|
|
154
|
+
* Resolves paths like 'Dam/assets/xxx' against the base root of the API service.
|
|
155
|
+
*/
|
|
156
|
+
private getAbsoluteUrl;
|
|
157
|
+
loadDocument(): void;
|
|
158
|
+
pageRows: _angular_core.Signal<PageRow[]>;
|
|
159
|
+
visibleRows: _angular_core.Signal<PageRow[]>;
|
|
160
|
+
/**
|
|
161
|
+
* Fallback strategy: Pre-loads the active page and neighboring pages in a small buffer.
|
|
162
|
+
*/
|
|
163
|
+
loadPagesAroundActive(): void;
|
|
164
|
+
private checkAndUnloadExcessPages;
|
|
165
|
+
onPageVisible(pageGuid: string, isVisible: boolean, page: ReviewerPage): void;
|
|
166
|
+
getPageIndex(guid: string): number;
|
|
167
|
+
get activePageNumber(): number;
|
|
168
|
+
prevPage(): void;
|
|
169
|
+
nextPage(): void;
|
|
170
|
+
selectPageNumber(pageNum: number): void;
|
|
171
|
+
scrollToPage(pageGuid: string): void;
|
|
172
|
+
zoomIn(): void;
|
|
173
|
+
zoomOut(): void;
|
|
174
|
+
zoomReset(): void;
|
|
175
|
+
fitWidth(): void;
|
|
176
|
+
fitHeight(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Applies the zoom level based on the selected fitMode and container dimensions.
|
|
179
|
+
*/
|
|
180
|
+
applyFitZoom(): void;
|
|
181
|
+
setLayoutMode(mode: 'single' | 'double' | 'double-cover'): void;
|
|
182
|
+
toggleScroll(): void;
|
|
183
|
+
toggleReading(): void;
|
|
184
|
+
toggleFullScreen(): void;
|
|
185
|
+
toggleSidebar(): void;
|
|
186
|
+
toggleCommentsSidebar(): void;
|
|
187
|
+
toggleCommentMode(): void;
|
|
188
|
+
loadComments(): void;
|
|
189
|
+
onPageClick(event: MouseEvent, pageGuid: string): void;
|
|
190
|
+
saveDraftComment(text: string): void;
|
|
191
|
+
cancelDraft(): void;
|
|
192
|
+
selectTool(tool: 'point' | 'drawing' | 'shape-rect' | 'shape-line' | 'highlight' | 'text'): void;
|
|
193
|
+
selectColor(color: string): void;
|
|
194
|
+
onPageMouseDown(event: MouseEvent, page: ReviewerPage): void;
|
|
195
|
+
onPageMouseMove(event: MouseEvent, page: ReviewerPage): void;
|
|
196
|
+
onPageMouseUp(event: MouseEvent, page: ReviewerPage): void;
|
|
197
|
+
deleteComment(commentGuid: string): void;
|
|
198
|
+
deleteAllArchivedComments(): void;
|
|
199
|
+
onPinMouseDown(event: MouseEvent, comment: DocumentComment): void;
|
|
200
|
+
onWindowMouseUp(event: MouseEvent): void;
|
|
201
|
+
updateComment(event: {
|
|
202
|
+
guid: string;
|
|
203
|
+
updates: {
|
|
204
|
+
color?: string;
|
|
205
|
+
x?: number;
|
|
206
|
+
y?: number;
|
|
207
|
+
documentCommentIsArchived?: boolean;
|
|
208
|
+
};
|
|
209
|
+
}): void;
|
|
210
|
+
selectComment(comment: DocumentComment): void;
|
|
211
|
+
getPageComments(pageGuid: string): DocumentComment[];
|
|
212
|
+
onPostReply(event: {
|
|
213
|
+
parentCommentGuid: string;
|
|
214
|
+
text: string;
|
|
215
|
+
}): void;
|
|
216
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppComponent, never>;
|
|
217
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AppComponent, "solid-reviewer, solidpepper-solidreviewer", never, { "guid": { "alias": "guid"; "required": false; }; "token": { "alias": "token"; "required": false; }; "apiUrl": { "alias": "apiUrl"; "required": false; }; "language": { "alias": "language"; "required": false; }; "companyAlias": { "alias": "companyAlias"; "required": false; }; "disableAuthPrompt": { "alias": "disableAuthPrompt"; "required": false; }; }, { "logout": "logout"; }, never, never, true, never>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export { AppComponent as SolidReviewerComponent, SvgCacheService };
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solidpepper/solidpepper-solidreviewer",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.12",
|
|
6
|
+
"@angular/core": "^20.3.12",
|
|
7
|
+
"@angular/platform-browser": "^20.3.12",
|
|
8
|
+
"@angular/elements": "^20.3.12",
|
|
9
|
+
"@angular/router": "^20.3.12",
|
|
10
|
+
"@ngx-translate/core": "^17.0.0",
|
|
11
|
+
"rxjs": "^7.8.0"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"tslib": "^2.3.0"
|
|
15
|
+
},
|
|
16
|
+
"module": "fesm2022/solidpepper-solidpepper-solidreviewer.mjs",
|
|
17
|
+
"typings": "index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
"./package.json": {
|
|
20
|
+
"default": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"default": "./fesm2022/solidpepper-solidpepper-solidreviewer.mjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false
|
|
28
|
+
}
|